diff options
Diffstat (limited to 'module/web')
| -rw-r--r-- | module/web/pyload/views.py | 25 | ||||
| -rw-r--r-- | module/web/templates/default/settings.html | 55 | 
2 files changed, 75 insertions, 5 deletions
| diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py index b8cbacf30..880ec7843 100644 --- a/module/web/pyload/views.py +++ b/module/web/pyload/views.py @@ -300,6 +300,7 @@ def collector(request):  def config(request):      conf = settings.PYLOAD.get_config()      plugin = settings.PYLOAD.get_plugin_config() +    accs = settings.PYLOAD.get_accounts()      messages = []          for section in chain(conf.itervalues(), plugin.itervalues()): @@ -343,6 +344,26 @@ def config(request):                          continue                  else:                      continue +                 +            elif sec == "Accounts": +                if ";" in okey: +                    action, name = okey.split(";") +                     +                    if action == "delete": +                        settings.PYLOAD.remove_account(skey, name) +                    elif action == "password": +                         +                        for acc in accs[skey]: +                            if acc["login"] == name and acc["password"] != value: +                                settings.PYLOAD.update_account(skey, name, value) +                     +                elif okey == "newacc" and value: +                    # add account +                     +                    pw = request.POST.get("Accounts|%s|newpw" % skey) +                     +                    settings.PYLOAD.update_account(skey, value, pw) +                          if errors:              messages.append(_("Error occured when setting the following options:")) @@ -351,4 +372,6 @@ def config(request):          else:              messages.append(_("All options were set correctly.")) -    return render_to_response(join(settings.TEMPLATE, 'settings.html'), RequestContext(request, {'conf': {'Plugin':plugin, 'General':conf}, 'errors': messages}, [status_proc])) +    accs = settings.PYLOAD.get_accounts() +             +    return render_to_response(join(settings.TEMPLATE, 'settings.html'), RequestContext(request, {'conf': {'Plugin':plugin, 'General':conf, 'Accounts': accs}, 'errors': messages}, [status_proc])) diff --git a/module/web/templates/default/settings.html b/module/web/templates/default/settings.html index 208549813..e9a40ff3a 100644 --- a/module/web/templates/default/settings.html +++ b/module/web/templates/default/settings.html @@ -77,17 +77,23 @@      <ul id="tabs" class="tabs">          {% for configname, config in conf.iteritems  %}              <span id="g_{{configname}}"> -                {% for skey, section in config.iteritems  %} -                    <li><a href="#{{configname}}{{skey}}">{{section.desc}}</a></li> -                {% endfor %} +				{% ifnotequal configname "Accounts" %} +					{% for skey, section in config.iteritems  %} +					    <li><a href="#{{configname}}{{skey}}">{{section.desc}}</a></li> +					{% endfor %} +				{% else %} +					{% for skey, section in config.iteritems  %} +					    <li><a href="#{{configname}}{{skey}}">{{skey}}</a></li> +					{% endfor %} +				{% endifnotequal %}              </span>          {% endfor %}      </ul>  </div>  <form id="horizontalForm" action="" method="POST">  {% for configname, config in conf.iteritems  %} +	{% ifnotequal configname "Accounts" %}      {% for skey, section in config.iteritems  %} -          <div class="tabContent" id="{{configname}}{{skey}}">              <table class="settable">                  {% for okey, option in section.items %} @@ -118,6 +124,47 @@              </table>          </div>      {% endfor %} +	{% else %} +	<!-- Accounts -->	 +	{% for plugin, accounts in config.iteritems  %} +        <div class="tabContent" id="{{configname}}{{plugin}}"> +            <table class="settable"> +                {% for account in accounts %}          +                        <tr> +                            <td><label for="{{configname}}|{{plugin}}|password;{{account.login}}" style="color:#424242;">{{account.login}}:</label></td> +                            <td> +							<input id="{{plugin}}|delete;{{account.login}}" name="{{configname}}|{{plugin}}|password;{{account.login}}" type="password" value="{{account.password}}"/> +                            </td> +							<td> +							{% trans "Delete? " %} +							<input id="{{plugin}}|delete;{{account.login}}" name="{{configname}}|{{plugin}}|delete;{{account.login}}" type="checkbox" value="True"/> + +							</td> +                        </tr> +												 +                {% endfor %} +				<tr><td> </td></tr> +				 +				<tr> +					<td><label for="{{configname}}|{{plugin}}|{{account.login}}" style="color:#424242;">{% trans "New account:" %}</label></td> +                             +					<td> +						<input id="{{plugin}}|newacc" name="{{configname}}|{{plugin}}|newacc" type="text"/> +					</td> +				</tr> +				<tr> +					<td><label for="{{configname}}|{{plugin}}|{{account.name}}" style="color:#424242;">{% trans "New password:" %}</label></td> +                             +					<td> +						<input id="{{config}}|{{plugin}}" name="{{configname}}|{{plugin}}|newpw" type="password"/> +					</td> +				</tr>	 +				 +            </table> +        </div> +    {% endfor %} +	 +	{% endifnotequal %}  {% endfor %}  {% if conf %}  <input class="submit" type="submit" value="{% trans "Submit" %}" /> | 
