summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-11-09 18:17:35 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-11-09 18:17:35 +0100
commit1257e46ba9dc952f2e596b1f377fc45925dfc3e1 (patch)
tree23ba8aa24e96bae8c345a393034cbad084099312 /module
parentadded browser to set paths in settings (diff)
downloadpyload-1257e46ba9dc952f2e596b1f377fc45925dfc3e1.tar.xz
little pathchooser improvements
Diffstat (limited to 'module')
-rw-r--r--module/ConfigParser.py6
-rw-r--r--module/config/default.conf8
-rw-r--r--module/web/pyload/views.py10
-rw-r--r--module/web/templates/default/settings.html7
4 files changed, 20 insertions, 11 deletions
diff --git a/module/ConfigParser.py b/module/ConfigParser.py
index 98c82a1a5..da4e734e5 100644
--- a/module/ConfigParser.py
+++ b/module/ConfigParser.py
@@ -254,7 +254,11 @@ class ConfigParser:
return int(value)
elif typ == "bool":
return True if value.lower() in ("1","true", "on", "an","yes") else False
- elif typ == "str":
+ elif typ == "time":
+ if not value: value = "0:00"
+ if not ":" in value: value+=":00"
+ return value
+ elif typ in ("str","file","folder"):
try:
return value.encode("utf8")
except:
diff --git a/module/config/default.conf b/module/config/default.conf
index 5994974e8..cd23b3ca1 100644
--- a/module/config/default.conf
+++ b/module/config/default.conf
@@ -7,8 +7,8 @@ remote - "Remote":
str password : "Password" = pwhere
ssl - "SSL":
bool activated : "Activated"= False
- str cert : "SSL Certificate" = ssl.srt
- str key : "SSL Key" = ssl.key
+ file cert : "SSL Certificate" = ssl.srt
+ file key : "SSL Key" = ssl.key
webinterface - "Webinterface":
bool activated : "Activated" = True
builtin;lighttpd;nginx;fastcgi server : "Server" = builtin
@@ -18,11 +18,11 @@ webinterface - "Webinterface":
str template : "Template" = default
log - "Log":
bool file_log : "File Log" = True
- str log_folder : "Folder" = Logs
+ folder log_folder : "Folder" = Logs
int log_count : "Count" = 5
general - "General":
en;de;it;pl;es language : "Language" = en
- str download_folder : "Download Folder" = Downloads
+ folder download_folder : "Download Folder" = Downloads
int max_downloads : "Max Parallel Downloads" = 3
bool debug_mode : "Debug Mode" = False
int max_download_time : "Max Download Time" = 5
diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py
index 8e08e408b..a9d3830ed 100644
--- a/module/web/pyload/views.py
+++ b/module/web/pyload/views.py
@@ -19,6 +19,7 @@ from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from django.http import HttpResponseNotFound
+from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext as _
@@ -397,8 +398,13 @@ def path(request, path):
parentdir = os.path.split(cwd[:-1])[0]
else:
parentdir = os.path.split(cwd)[0]
-
- for f in os.listdir(cwd):
+
+ try:
+ folders = os.listdir(cwd)
+ except:
+ folders = []
+
+ for f in folders:
data = {'name': f[:50],
'size': '',
'modified': '',
diff --git a/module/web/templates/default/settings.html b/module/web/templates/default/settings.html
index dd67801a9..ab1a445db 100644
--- a/module/web/templates/default/settings.html
+++ b/module/web/templates/default/settings.html
@@ -114,13 +114,12 @@
{% endfor %}
</select>
{% else %}
- {% if okey|contains:"_folder" %}
-
+ {% ifequal option.type "folder" %}
<input name="{{configname}}|{{skey}}|{{okey}}" type="text" id="{{skey}}|{{okey}}" value="{{option.value}}"/>
- <input name="browsebutton" type="button" onClick="ifield = document.getElementById('{{skey}}|{{okey}}'); pathchooser = window.open('{% if option.value %}{% url path option.value %}{% else %}{% url root %}{% endif %}', 'pathchooser', 'scrollbars=yes,toolbar=no,menubar=no,statusbar=no,width=650,height=300'); pathchooser.ifield = ifield; window.ifield = ifield;" value="browse"/>
+ <input name="browsebutton" type="button" onClick="ifield = document.getElementById('{{skey}}|{{okey}}'); pathchooser = window.open('{% if option.value %}{% url path option.value %}{% else %}{% url root %}{% endif %}', 'pathchooser', 'scrollbars=yes,toolbar=no,menubar=no,statusbar=no,width=650,height=300'); pathchooser.ifield = ifield; window.ifield = ifield;" value="{% trans "Browse" %}"/>
{% else %}
<input id="{{skey}}|{{okey}}" name="{{configname}}|{{skey}}|{{okey}}" type="text" value="{{option.value}}"/>
- {% endif %}
+ {% endifequal %}
{% endif %}
{% endifequal %}
</td>