r9962 - apps/gobi/trunk/code/Redirect
[email protected] Tue, 22 Sep 2009 14:32:53 +0200 (CEST)
| Newsgroups | gmane.comp.java.helma.cvs |
|---|---|
| Message-ID | <20090922123253.2FF623D0E2@mia> |
Author: hannes
Date: 2009-09-22 14:32:53 +0200 (Tue, 22 Sep 2009)
New Revision: 9962
Modified:
apps/gobi/trunk/code/Redirect/Redirect.js
Log:
Allow Redirect pages to have other redirect pages as children
Details at http://dev.helma.org/trac/helma/changeset/9962
Modified: apps/gobi/trunk/code/Redirect/Redirect.js
===================================================================
--- apps/gobi/trunk/code/Redirect/Redirect.js 2009-09-22 11:21:33 UTC (rev 9961)
+++ apps/gobi/trunk/code/Redirect/Redirect.js 2009-09-22 12:32:53 UTC (rev 9962)
@@ -1,7 +1,9 @@
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: MANAGE, label: "Edit Content"}),
+ new Action("create", {category: MANAGE, label: "Create Child Page"}),
]);
function main_action() {
@@ -50,11 +52,21 @@
return "(Redirected from " + this.getHtmlLink() + ")";
}
+function getChildType() {
+ // redirect pages should only have other redirects as children
+ return "Redirect";
+}
+
// Dynamically generate transient redirect child pages so that
// this/foo/bar is redirected to target/foo/bar
function getChildElement(name) {
- // create a transient
- var child = new Redirect(name);
+ // if page exists return that
+ var child = this.get(name);
+ if (child) {
+ return child;
+ }
+ // else create a transient
+ child = new Redirect(name);
child.url = this.getChildUrl(name);
child.message = this.message || this.getRedirectMessage();
// overwrite getUrl() to just return the precalculated url
@@ -76,8 +88,8 @@
query = '';
var q = url.indexOf('?');
if (q > -1) {
+ query = url.substring(q);
url = url.substring(0, q);
- query = url.substring(q);
}
if (!url.endsWith('/')) {
url = url + '/';