From 77e72cb0476d7137f7868a226688ad9c30502cf6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Tue, 25 Mar 2008 07:54:03 +0000
Subject: [PATCH] Fixed the template of the metadata overview to use legal and
 unique ID attributes at the div elements by using base64 encoding of the
 header of the section concatenated with the entity ID. Also replacing '='
 with '_' to be legal IDs.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@421 44740490-163a-0410-bde0-09ae8108e29a
---
 templates/default/en/admin-metadatalist.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/templates/default/en/admin-metadatalist.php b/templates/default/en/admin-metadatalist.php
index 9ee471908..c02f4284c 100644
--- a/templates/default/en/admin-metadatalist.php
+++ b/templates/default/en/admin-metadatalist.php
@@ -12,7 +12,11 @@
 		
 			echo '<h3>' . $header . '</h3>';
 			
+
+			
 			foreach ($list AS $entityid => $entity) {
+			
+				$encodedEntityID = preg_replace('/=/', '_', base64_encode($entityid . $header));
 				$name = $entityid;
 				if (isset($entity['optional.found']['name'])) $name = $entity['optional.found']['name'];
 
@@ -24,14 +28,14 @@
 
 
 
-				echo '<h4 style="padding-left: 2em; clear: both;" onclick="document.getElementById(\'metadatasection-' . $entityid . '\').style.display=\'block\';">' . htmlspecialchars($name) . '</h4>';
+				echo '<h4 style="padding-left: 2em; clear: both;" onclick="document.getElementById(\'metadatasection-' . $encodedEntityID . '\').style.display=\'block\';">' . htmlspecialchars($name) . '</h4>';
 				
 				if ($warning) {
 					echo '<div><img src="/' . $baseurl . 'resources/icons/caution.png" style="float: left; margin-right: 1em" />';
 					echo 'Error in this metadata entry.</div>';
 				}
 				
-				echo '<div id="metadatasection-' . $entityid . '" style="display: none">';
+				echo '<div id="metadatasection-' . $encodedEntityID . '" style="display: none">';
 				
 				if (isset($entity['optional.found']['description'])) {
 					echo '<p>' . htmlspecialchars($entity['optional.found']['description']) . '</p>';
-- 
GitLab