{% extends "base.html" %}

{% comment %}
# This file is part of k4ever, a point-of-sale system
#   Contact............  <k4ever@lists.someserver.de>
#   Website............  http://k4ever.someserver.de/
#   Bug tracker........  http://k4ever.someserver.de/report
#
# Licensed under GNU Affero General Public License v3 or later
{% endcomment %}

{% block "content" %}
	<div style="width:800px">
	<h1>Passwort</h1>
	<br />
	{% if form %}
		{% if password_success %}
			{{ password_success }} <br />
		{% endif %}
		<table>
			<form method="post" action="#">
			{% csrf_token %}
			{{ form }}
			<tr><th align="center" colspan="2"><input type="submit" value="&Auml;ndern" /></th></tr>
			</form>
		</table>
	{% else %}
		Da du dich nicht &uuml;ber Django authentifizierst (sondern z.B. &uuml;ber LDAP) kannst du dein Passwort hier nicht &auml;ndern.
	{% endif %}
	</div>
	<div style="width:800px; margin-top: 25px">
	<h1>Pluginberechtigungen</h1>
	{% if pluginerror %}
		<font color="red">{{ pluginerror|safe }}</font>
	{% endif %}
	{% if pluginmsg %}
		<font color="green">{{ pluginmsg|safe }}</font>
	{% endif %}
	<p>
	<table style="border: 2px solid #BBBBBB; -moz-border-radius: 3px; -webkit-border-radius: 3px; -khtml-border-radius: 3px; border-radius: 3px">
		<tr style="height: 40px">
			{% if permissions %}
				<th rowspan={{ permissions|length|add:"1"}} style="vertical-align:middle; text-align:center; color:#0cb31c; -moz-transform: rotate(270deg); -webkit-transform: rotate(270deg); -ms-transform: rotate(270deg); -o-transform: rotate(270deg); transform: rotate(270deg)">Erlaubt</th>
			{% else %}
				<th>&nbsp;</th>
			{% endif %}
			<th width="100px" style="vertical-align:middle">Name</th>
			<th width="100px" style="vertical-align:middle">Author</th>
			<th style="vertical-align:middle">Beschreibung</th>
			<th width="100px" style="vertical-align:middle">AuthBlob</th>
			<th width="150px" style="vertical-align:middle">Erlauben/Verbieten</th>
		</tr>
	{% for p in permissions %}
	<tr>
		<td style="vertical-align:middle; text-align:center">{{ p.plugin.name }}<br/>{{ p.plugin.version }}</td>
		<td style="vertical-align:middle; text-align:center">{{ p.plugin.author }}</td>
		<td style="vertical-align:middle; text-align:center"><div style="margin: 5px">{{ p.plugin.descr }}</div></td>
		<td style="text-align:center">
		{% if p.plugin.userCanWriteAuthblob %}
			<div style="margin:5px">
				<form method="post" action="/user/settings/plugin/authblob/{{ p.plugin.id }}/">
					{% csrf_token %}
					<textarea name="authblob">{{ p.authblob }}</textarea>
					<input type="submit" value="Speichern">
				</form>
			</div>
		{% else %}
			{% if p.plugin.userCanReadAuthblob %}
				{{ p.authblob }}
			{% else %}
				---
			{% endif %}
		{% endif %}
		</td>
		<td style="vertical-align:middle; text-align:center"><a href="/user/settings/plugin/deny/{{ p.plugin.id }}/" class="button" style="color: #e61e1e; margin-bottom: 35px">Plugin verbieten</a></td>
	</tr>
	{% endfor %}
	{% if unallowed %}
		<tr style="border-top: 1px solid #BBBBBB">
			<th rowspan={{ unallowed|length}} style="vertical-align:middle; text-align:center; color:#e61e1e; -moz-transform: rotate(270deg); -webkit-transform: rotate(270deg); -ms-transform: rotate(270deg); -o-transform: rotate(270deg); transform: rotate(270deg)">Verboten</th>
			{% for plugin in unallowed %}
				<td style="vertical-align:middle; text-align:center">{{ plugin.name }}<br/>{{ plugin.version }}</td>
				<td style="vertical-align:middle; text-align:center">{{ plugin.author }}</td>
				<td style="vertical-align:middle; text-align:center"><div style="margin:5px">{{ plugin.descr }}</div></td>
				<td>&nbsp;</td>
				<td style="vertical-align:middle; text-align:center"><a class="button" href="/user/settings/plugin/allow/{{ plugin.id }}/" style="color: #0cb31c; margin-buttom: 35px">Plugin erlauben</a></td>
			</tr>
			<tr>
			{% endfor %}
		{% endif %}
	</table>
	</p>
{% endblock %}
