summaryrefslogtreecommitdiffstats
path: root/module/web/pyload/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/pyload/views.py')
-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]))