From 01d42fee404450ec33864881fb5b68d35e5df562 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Fri, 10 Aug 2018 11:20:13 +0200
Subject: [PATCH] Add Twig-template for consentAdmin

---
 .../consentAdmin/templates/consentadmin.twig  | 83 +++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 modules/consentAdmin/templates/consentadmin.twig

diff --git a/modules/consentAdmin/templates/consentadmin.twig b/modules/consentAdmin/templates/consentadmin.twig
new file mode 100644
index 000000000..e0eaf6d58
--- /dev/null
+++ b/modules/consentAdmin/templates/consentadmin.twig
@@ -0,0 +1,83 @@
+{% set pagetitle = '{consentAdmin:consentadmin:consentadmin_header}'|trans %}
+{% extends "base.twig" %}
+
+{% block preload %}
+<link rel="stylesheet" type="text/css" href="{{ basepathurl }}assets/css/consentAdmin.css" />
+{% endblock %}
+
+{% block postload %}
+<script src="{{ baseurlpath }}assets/js/consentAdmin.js"></script>
+<script src="{{ baseurlpath }}assets/js/consentSimpleAjax.js"></script>
+{% endblock %}
+
+{% block content %}
+
+<h2>{{ '{consentAdmin:consentadmin:consentadmin_header}'|trans }}</h2>
+<p>{{ '{consentAdmin:consentadmin:consentadmin_description1}'|trans }}</p>
+
+<table>
+    <tr>
+        <th colspan="2" width="80%">{{ '{consentAdmin:consentadmin:service_provider_header}'|trans }}</th>
+        <th width="140">{{ '{consentAdmin:consentadmin:status_header}'|trans }}</th>
+    </tr>
+
+{% for spName, spValues in spList %}
+
+    {% if loop.index0 % 2 == 0 %}
+        {% set rowClass = 'row0' %}
+    {% else %}
+        {% set rowClass = 'row1' %}
+    {% endif %}
+
+    <tr class="{{ rowClass }}">
+        <td>
+            <span class='caSPName'>
+                <span title='{{ spValues.description|escape('html') }}'>
+                {% if spValues.serviceurl is defined %}
+                    {{ spValues.name|escape('html') }}
+                {% else %}
+                    <a href="{{ spValues.serviceurl }}" style="color: black; font-weight: bold">{{ spValues.name|escape('html') }}</a>
+                {% endif %}
+                </span>
+                <span style="font-size: 80%" onclick="javascript:toggleShowAttributes({{ loop.index0 }});">
+                    <span id="showing_{{ loop.index0 }}">{{ '{consentAdmin:consentadmin:show}'|trans }}</span>
+                    <span id="hiding_{{ loop.index0 }}" style="display: none">{{ '{consentAdmin:consentadmin:hide}'|trans }}</span>
+                    {{ '{consentAdmin:consentadmin:attributes_text}'|trans }}
+                </span>
+            </span>
+        </td>
+        <td class="caAttributes">
+            <div id="attributes_{{ loop.index0 }}" style="display: none">
+            {% if showDescription %}
+                <p>{{ '{consentAdmin:consentadmin:consentadmin_purpose}'|trans }}{{ spValues.description|escape('html') }}</p>
+            {% endif %}
+                <ul>
+                {% for attrName, attrValue in spValues.attributes_by_sp %}
+                {% if attrValue|length > 1 %}
+                    <li>{{ attrName|escape('html') }}:
+                        <ul>
+                        {% for valKey, value in attrValue %}
+                            <li>{{ value|escape('html') }}</li>
+                        {% endfor %}
+                        </ul>
+                    </li>
+                {% else %}
+                    <li>{{ attrName|escape('html') }}: {{ attrValue|first|escape('html') }}</li>
+                {% endif %}
+                {% endfor %}
+                </ul>
+            </div>
+        </td>
+        <td class="caAllowed">
+            <input onclick="javascript:checkConsent(this.value, {{ loop.index0 }}, this.checked)" value='{{ spValues.consentValue }}' type='checkbox'{% if spValues.consentStatus == 'ok'%} checked="checked"{% endif %} /><span id="consentText{{ loop.index0 }}">{% if spValues.consentStatus == 'changed' %}attributes has changed{% endif %}</span>
+        </td>
+    </tr>
+{% endfor %}
+</table>
+
+<p>{{ '{consentAdmin:consentadmin:consentadmin_description2}'|trans|raw }}</p>
+
+<h2>Logout</h2>
+<p><a href="{{ baseurlpath }}consentAdmin.php?logout=1">Logout</a></p>
+
+{% endblock %}
-- 
GitLab