summaryrefslogtreecommitdiffstats
path: root/module/web/pyload
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-04-03 11:06:18 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-04-03 11:06:18 +0200
commit44941dd9b11d9140589f7b1eacb9baf2a82d4c8b (patch)
treedd5c3ea532746bb6eae3ff9b7991165b6e5254af /module/web/pyload
parentmerged (diff)
downloadpyload-44941dd9b11d9140589f7b1eacb9baf2a82d4c8b.tar.xz
webif settings page
Diffstat (limited to 'module/web/pyload')
-rw-r--r--module/web/pyload/views.py38
1 files changed, 37 insertions, 1 deletions
diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py
index 6dbbd22c6..db04f8c67 100644
--- a/module/web/pyload/views.py
+++ b/module/web/pyload/views.py
@@ -170,5 +170,41 @@ def collector(request):
@check_server
def config(request):
conf = settings.PYLOAD.get_config_data()
+
+ if request.META.get('REQUEST_METHOD', "GET") == "POST":
+
+ errors = []
+
+ for key, value in request.POST.iteritems():
+ if not "|" in key: continue
+ skey, okey = key.split("|")[:]
+ if conf.has_key(skey):
+ if conf[skey]['options'].has_key(okey):
+ try:
+ if str(conf[skey]['options'][okey]['value']) != value:
+ settings.PYLOAD.set_conf_val(skey, okey, value)
+ except:
+ errors.append("%s | %s" % (skey, okey))
+ else:
+ continue
+ else:
+ continue
+
+ messages = []
+
+ if errors:
+ messages.append(_("Error occured when setting the following options:"))
+ messages.append("")
+ messages += errors
+ else:
+ messages.append(_("All options set correctly."))
+
+ return render_to_response(join(settings.TEMPLATE, 'settings.html'), RequestContext(request, {'conf': {}, 'errors': messages}, [status_proc]))
+
+
+ for section in conf.iterkeys():
+ for option in conf[section]['options'].iterkeys():
+ if conf[section]['options'][option]['input']:
+ conf[section]['options'][option]['input'] = conf[section]['options'][option]['input'].split(";")
- return render_to_response(join(settings.TEMPLATE, 'settings.html'), RequestContext(request, {'conf': conf}, [status_proc]))
+ return render_to_response(join(settings.TEMPLATE, 'settings.html'), RequestContext(request, {'conf': conf, 'messages': []}, [status_proc]))