From 3a5d756e040a911c838a280c61a222f269e584de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaime=20Pe=CC=81rez=20Crespo?= <jaime.perez@uninett.no>
Date: Tue, 11 Dec 2018 17:32:13 +0100
Subject: [PATCH] Minor fixes in the new "test auth sources" page / templates.

---
 modules/admin/lib/ConfigController.php       |  1 -
 modules/admin/lib/TestController.php         | 12 ++++++------
 modules/admin/templates/authsource_list.twig |  2 +-
 modules/admin/templates/status.twig          |  8 ++++----
 4 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/modules/admin/lib/ConfigController.php b/modules/admin/lib/ConfigController.php
index 5c196b83d..94bf0327b 100644
--- a/modules/admin/lib/ConfigController.php
+++ b/modules/admin/lib/ConfigController.php
@@ -6,7 +6,6 @@ use SimpleSAML\HTTP\RunnableResponse;
 use SimpleSAML\Locale\Translate;
 use SimpleSAML\Utils\HTTP;
 use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\HttpFoundation\Response;
 
 /**
  * Controller class for the admin module.
diff --git a/modules/admin/lib/TestController.php b/modules/admin/lib/TestController.php
index d97faf59d..b0991eb8b 100644
--- a/modules/admin/lib/TestController.php
+++ b/modules/admin/lib/TestController.php
@@ -82,14 +82,14 @@ class TestController
             $t = new \SimpleSAML\XHTML\Template($this->config, 'admin:status.twig', 'attributes');
             $t->data = [
                 'attributes' => $attributes,
-                'attributesHtml' => $this->present_attributes($t, $attributes, ''),
+                'attributesHtml' => $this->getAttributesHTML($t, $attributes, ''),
                 'authData' => $authData,
                 'nameid' => $nameId,
                 'logouturl' => \SimpleSAML\Utils\HTTP::getSelfURLNoQuery().'?as='.urlencode($as).'&logout',
             ];
 
             if ($nameId !== false) {
-                $this->data['nameidHtml'] = present_nameid($t, $nameId);
+                $this->data['nameidHtml'] = $this->getNameIDHTML($t, $nameId);
             }
         }
 
@@ -99,7 +99,7 @@ class TestController
     }
 
 
-    private function present_nameid(\SimpleSAML\XHTML\Template $t, \SAML2\XML\saml\NameID $nameId)
+    private function getNameIDHTML(\SimpleSAML\XHTML\Template $t, \SAML2\XML\saml\NameID $nameId)
     {
         $result = '';
         if ($nameId->getValue() === null) {
@@ -122,11 +122,11 @@ class TestController
                 $list['SPProvidedID'] = [$nameId->getSPProvidedID()];
             }
         }
-        return $result.present_attributes($t, $list, '');
+        return $result.$this->getAttributesHTML($t, $list, '');
     }
 
 
-    private function present_attributes(\SimpleSAML\XHTML\Template $t, $attributes, $nameParent)
+    private function getAttributesHTML(\SimpleSAML\XHTML\Template $t, $attributes, $nameParent)
     {
         $alternate = ['pure-table-odd', 'pure-table-even'];
         $i = 0;
@@ -141,7 +141,7 @@ class TestController
                 $parentName = preg_replace('/^child_/', '', $nameraw);
                 foreach ($value as $child) {
                     $str .= '<tr class="odd"><td colspan="2" style="padding: 2em">'.
-                        $this->present_attributes($t, $child, $parentName).'</td></tr>';
+                        $this->getAttributesHTML($t, $child, $parentName).'</td></tr>';
                 }
             } else {
                 if (sizeof($value) > 1) {
diff --git a/modules/admin/templates/authsource_list.twig b/modules/admin/templates/authsource_list.twig
index 6262d5be3..e00b3c356 100644
--- a/modules/admin/templates/authsource_list.twig
+++ b/modules/admin/templates/authsource_list.twig
@@ -6,7 +6,7 @@
     {%- include "@admin/includes/menu.twig" %}
     <ul>
     {% for key, name in sources %}
-        <li><a href="test/{{ name|escape('url') }}">{{ name|escape('html') }}</a></li>
+        <li><a href="test/{{ name|escape('url') }}">{{ name }}</a></li>
     {% endfor %}
     </ul>
 {% endblock %}
diff --git a/modules/admin/templates/status.twig b/modules/admin/templates/status.twig
index 6d75486d4..341d3790e 100644
--- a/modules/admin/templates/status.twig
+++ b/modules/admin/templates/status.twig
@@ -4,9 +4,9 @@
 
 {% block content %}
     {%- include "@admin/includes/menu.twig" %}
-    <h2>{{ '{status:header_saml20_sp}'|trans }}</h2>
 
-    <p>{{ '{status:intro}'|trans }}</p>
+    <p>{% trans %}Hi, this is the status page of SimpleSAMLphp. Here you can see if your session is timed out, how long
+     it lasts until it times out and all the attributes that are attached to your session.{% endtrans %}</p>
 
     <h2>{{ '{status:attributes_header}'|trans }}</h2>
 
@@ -18,8 +18,8 @@
     {%- endif %}
 
     {% if authData -%}
-    <h2>{{ '{status:authData_header}'|trans }}</h2>
-    <details><summary>{{ '{status:authData_summary}'|trans }}</summary> 
+    <h2>{% trans %}AuthData{% endtrans %}</h2>
+    <details><summary>{% trans %}Click to view AuthData{% endtrans %}</summary>
       <pre>{{ authData|json_encode|raw }}</pre>
     </details>
     {%- endif %}    
-- 
GitLab