r9935 - in apps/gobi/trunk/code: Global Page Redirect

[email protected] Sat, 19 Sep 2009 22:01:21 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090919200121.4B3A83D0E3@mia>
Author: hannes
Date: 2009-09-19 22:01:21 +0200 (Sat, 19 Sep 2009)
New Revision: 9935

Modified:
   apps/gobi/trunk/code/Global/WikiMarkup.js
   apps/gobi/trunk/code/Page/PageCore.js
   apps/gobi/trunk/code/Redirect/Redirect.js
Log:
Introduce rawHref() method in Page which is used for wiki links, so wiki links to Redirect pages are rendered without ?redirect=no

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

Modified: apps/gobi/trunk/code/Global/WikiMarkup.js
===================================================================
--- apps/gobi/trunk/code/Global/WikiMarkup.js	2009-09-19 19:28:32 UTC (rev 9934)
+++ apps/gobi/trunk/code/Global/WikiMarkup.js	2009-09-19 20:01:21 UTC (rev 9935)
@@ -72,7 +72,7 @@
                     if (!wikipage) {
                         return [mainWiki.href("create") + "?name=" + id, "Create new wiki page"];
                     } else {
-                        return [wikipage.href(), "Internal wiki link"];
+                        return [wikipage.rawHref(), "Internal wiki link"];
                     }
                 }
                 return null;
@@ -192,7 +192,7 @@
                         var href = mainWiki.href("create") + "?name=" + link.target;
                         return md[1] + Html.A({ href: href, "class": "undefinedLink" }, link.label);
                     } else {
-                        return md[1] + Html.A({ href: page.href(), "class": "wikiLink" }, link.label);
+                        return md[1] + Html.A({ href: page.rawHref(), "class": "wikiLink" }, link.label);
                     }
                 }
             });

Modified: apps/gobi/trunk/code/Page/PageCore.js
===================================================================
--- apps/gobi/trunk/code/Page/PageCore.js	2009-09-19 19:28:32 UTC (rev 9934)
+++ apps/gobi/trunk/code/Page/PageCore.js	2009-09-19 20:01:21 UTC (rev 9935)
@@ -526,6 +526,16 @@
 }
 
 /**
+ * Provide Helma's native href() method to subclasses of Page that
+ * override href(). Also, this is used by the wiki markup formatter 
+ * for rendering wiki links.
+ * @param action optional
+ */
+function rawHref(action) {
+    return Page.prototype.href.apply(this, [action]);
+}
+
+/**
  * Get this page's path, optionally formatted as HTML link tags
  */
 function getPath(param) {

Modified: apps/gobi/trunk/code/Redirect/Redirect.js
===================================================================
--- apps/gobi/trunk/code/Redirect/Redirect.js	2009-09-19 19:28:32 UTC (rev 9934)
+++ apps/gobi/trunk/code/Redirect/Redirect.js	2009-09-19 20:01:21 UTC (rev 9935)
@@ -1,5 +1,11 @@
+this._actions = new LookupList([
+    new Action("main", {category: READ, label: "Main View"}),
+    new Action("list", {category: READ, label: "List Child Pages"}),
+    new Action("history", {category: WRITE, label: "Page History"}),
+    new Action("edit", {category: WRITE, label: "Edit Content"}),
+]);
+
 function main_action() {
-    var redirect = true;
     if (req.params.redirect == "no") {
         res.data.body = this.renderSkinAsString("body");
         this.renderSkin("page");
@@ -32,11 +38,6 @@
     return url;
 }
 
-function redirectingHref(action) {
-    return Page.prototype.href.apply(this, [action]);
-}
-
 function href(action) {
-    var href = Page.prototype.href.apply(this, [action]);
-    return href + "?redirect=no";
+    return this.rawHref(action) + "?redirect=no";
 }
\ No newline at end of file