r9423 - apps/gobi/trunk/code/Global

[email protected]
Newsgroups gmane.comp.java.helma.cvs
Message-ID <[email protected]>
Author: hannes
Date: 2008-12-12 17:26:35 +0100 (Fri, 12 Dec 2008)
New Revision: 9423

Modified:
   apps/gobi/trunk/code/Global/Global.js
Log:
Fix actionLink() to check if current action is on the same page.

Details at http://dev.helma.org/trac/helma/changeset/9423

Modified: apps/gobi/trunk/code/Global/Global.js
===================================================================
--- apps/gobi/trunk/code/Global/Global.js	2008-12-12 14:26:46 UTC (rev 9422)
+++ apps/gobi/trunk/code/Global/Global.js	2008-12-12 16:26:35 UTC (rev 9423)
@@ -282,7 +282,8 @@
 function actionLink(obj, param) {
     var actionName = param.action || "main";
     var action = actionName == "main" ? "" : param.action;
-    var isActive = (req.action == action || req.action == "main" && action == "");
+    var isActive = obj == path[path.length - 1] &&
+                   (req.action == action || req.action == "main" && action == "");
     if (param.skin) {
         if (obj.checkAccess(param.action)) {
             param.href = obj.href(action);
@@ -294,7 +295,7 @@
         }
     } else {
         var text = param.text || actionName;
-        if (req.action == action || req.action == "main" && action == "")
+        if (isActive)
             res.write(text.bold());
         else if (obj.checkAccess(param.action))
             Html.link({href: obj.href(action)}, text);
@@ -314,9 +315,9 @@
  
     var attr = {};
     if (obj == activeObject)
-        attr["class"] = "navlink-"+level+"-active";
+        attr["class"] = "navlink-" + level + "-active";
     else
-        attr["class"] = "navlink-"+level;
+        attr["class"] = "navlink-" + level;
     
     if (activeObject == obj && req.action == "main") {
         Html.openTag("div", attr);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.