From a43cdb247b12eddc5bed9090025e3ba0abace081 Mon Sep 17 00:00:00 2001
From: Jacob Christiansen <jach@wayf.dk>
Date: Thu, 3 Sep 2009 11:25:09 +0000
Subject: [PATCH] Minor update to consentAdmin. Added config option to display
 description.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1746 44740490-163a-0410-bde0-09ae8108e29a
---
 .../config-templates/module_consentAdmin.php             | 3 +++
 modules/consentAdmin/dictionaries/consentadmin.php       | 5 ++++-
 modules/consentAdmin/templates/consentadmin.php          | 9 ++++++---
 modules/consentAdmin/www/consentAdmin.php                | 1 +
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/modules/consentAdmin/config-templates/module_consentAdmin.php b/modules/consentAdmin/config-templates/module_consentAdmin.php
index dd338f702..c40fd1399 100644
--- a/modules/consentAdmin/config-templates/module_consentAdmin.php
+++ b/modules/consentAdmin/config-templates/module_consentAdmin.php
@@ -22,4 +22,7 @@ $config = array(
 
 	// Where to direct the user after logout
 	'relaystate' => 'www.wayf.dk',
+
+    // Shows description of the services if set to true (defaults to true)
+    'showDesription' => true, 
 );
diff --git a/modules/consentAdmin/dictionaries/consentadmin.php b/modules/consentAdmin/dictionaries/consentadmin.php
index 4a002f1f2..030dedd00 100644
--- a/modules/consentAdmin/dictionaries/consentadmin.php
+++ b/modules/consentAdmin/dictionaries/consentadmin.php
@@ -194,7 +194,10 @@ WAYF foretager behandlinger af personoplysninger i henhold til persondataloven (
 		'en' => 'show/hide attributes',
         'da' => 'vis/skjul attributter',		
 		),
-		
+    'consentadmin_purpose' => array(
+        'en' => 'The purpose of the service is',
+        'da' => 'FormĂĄlet med tjenesten er',
+    ),        
 );
 
 
diff --git a/modules/consentAdmin/templates/consentadmin.php b/modules/consentAdmin/templates/consentadmin.php
index de96ab211..c1023b39b 100755
--- a/modules/consentAdmin/templates/consentadmin.php
+++ b/modules/consentAdmin/templates/consentadmin.php
@@ -75,8 +75,8 @@ span.showhide {
 			foreach ($spList AS $spName => $spValues) {
 				$this->includeInlineTranslation('spname', $spValues['name']);
 				$this->includeInlineTranslation('spdescription', $spValues['description']);
-				$htmlSpName = htmlspecialchars($this->t('spname', array(), false, true) );
-				$spDescription = htmlspecialchars($this->t('spdescription',array(), false, true));
+				$htmlSpName = $this->t('spname', array(), false, true);
+				$spDescription = $this->t('spdescription',array(), false, true);
 				$checkedAttr = $spValues['consentStatus'] == 'ok' ? "checked='yes'" : "";
 				$consentValue = $spValues['consentValue'];
 				$consentText = $spValues['consentStatus'] == 'changed' ? "attributes has changed" : "";
@@ -90,7 +90,10 @@ span.showhide {
 	  <tr><td colspan="2" class="caAttributes"><div id="attributes_$show_spid" style="display: none;">
 TRSTART;
 				$attributes = $spValues['attributes_by_sp'];
-				echo "\n<ul>\n";
+				if ($this->data['showDescription']) {
+                    echo '<p>' . $this->t('consentadmin_purpose') . ' ' . $spDescription . '</p>';
+                }
+                echo "\n<ul>\n";
 				foreach ($attributes AS $name => $value) {
 
 				if (isset($this->data['attribute_' . htmlspecialchars(strtolower($name)) ])) {
diff --git a/modules/consentAdmin/www/consentAdmin.php b/modules/consentAdmin/www/consentAdmin.php
index b6573c213..830d07163 100644
--- a/modules/consentAdmin/www/consentAdmin.php
+++ b/modules/consentAdmin/www/consentAdmin.php
@@ -241,5 +241,6 @@ $relaystate = $cA_config->getValue('relaystate');
 $et->data['header'] = 'Consent Administration';
 $et->data['logout'] = '<p>[ <a href="/' . $config->getBaseURL() . 'saml2/sp/initSLO.php?RelayState='. $relaystate .'">Logout</a> ]';
 $et->data['spList'] = $sp_list;
+$et->data['showDescription'] = $cA_config->getValue('showDescription');
 $et->show();
 ?>
-- 
GitLab