From f523fef59b5d0adba27c3efd0cbe1af2ad902739 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Tue, 16 Dec 2008 17:37:54 +0100
Subject: [PATCH] ACL Manager: correctly highlight when page and namespace are
 named the same

darcs-hash:20081216163754-7ad00-a66381e543006ace0a4ff3747034290652b758fc.gz
---
 lib/plugins/acl/admin.php | 5 ++---
 lib/plugins/acl/script.js | 6 ++++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php
index 8e0be08ce..77bd285d3 100644
--- a/lib/plugins/acl/admin.php
+++ b/lib/plugins/acl/admin.php
@@ -423,9 +423,8 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
         }
 
         // highlight?
-        if(($item['type']=='d' &&
-            $item['id'] == $this->ns) ||
-            $item['id'] == $ID) $cl = ' cur';
+        if( ($item['type']=='d' && $item['id'] == $this->ns) ||
+            ($item['type']!='d' && $item['id'] == $ID)) $cl = ' cur';
 
         // namespace or page?
         if($item['type']=='d'){
diff --git a/lib/plugins/acl/script.js b/lib/plugins/acl/script.js
index 01f9d12bc..7ab83db58 100644
--- a/lib/plugins/acl/script.js
+++ b/lib/plugins/acl/script.js
@@ -131,8 +131,10 @@ acl = {
             acl.treetoggle(e.target);
         } else if(e.target.href){ // is it a link?
             // remove highlighting
-            var obj = getElementsByClass('cur',$('acl__tree'),'a')[0];
-            if(obj) obj.className = obj.className.replace(/ cur/,'');
+            var obj = getElementsByClass('cur',$('acl__tree'),'a');
+            for(var i=0; i<obj.length; i++){
+                obj[i].className = obj[i].className.replace(/ cur/,'');
+            }
 
             // add new highlighting
             e.target.className += ' cur';
-- 
GitLab