diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-11-09 18:17:35 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-11-09 18:17:35 +0100 |
commit | 1257e46ba9dc952f2e596b1f377fc45925dfc3e1 (patch) | |
tree | 23ba8aa24e96bae8c345a393034cbad084099312 /module/web | |
parent | added browser to set paths in settings (diff) | |
download | pyload-1257e46ba9dc952f2e596b1f377fc45925dfc3e1.tar.xz |
little pathchooser improvements
Diffstat (limited to 'module/web')
-rw-r--r-- | module/web/pyload/views.py | 10 | ||||
-rw-r--r-- | module/web/templates/default/settings.html | 7 |
2 files changed, 11 insertions, 6 deletions
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> |