| Newsgroups |
gmane.comp.java.helma.cvs |
| Message-ID |
<[email protected]> |
Author: hannes
Date: 2009-02-05 15:07:47 +0100 (Thu, 05 Feb 2009)
New Revision: 9501
Modified:
apps/gobi/trunk/code/Page/PageCore.js
Log:
Some code cleanup and fix for a bug that didn't return inherited links when no direct link was present.
Details at http://dev.helma.org/trac/helma/changeset/9501
Modified: apps/gobi/trunk/code/Page/PageCore.js
===================================================================
--- apps/gobi/trunk/code/Page/PageCore.js 2009-02-05 13:10:45 UTC (rev 9500)
+++ apps/gobi/trunk/code/Page/PageCore.js 2009-02-05 14:07:47 UTC (rev 9501)
@@ -268,7 +268,7 @@
options = options || {};
// check if type is a regular expression
- if (typeof type == "function" && type.test) {
+ if (type instanceof RegExp) {
var links = [];
var list = collection.list();
var l = list.length;
@@ -285,12 +285,11 @@
// treat type as ordinary string
if (collection)
collection = collection.get(type);
- if (!collection)
- return [];
- var links = collection.list();
+ var links = collection ? collection.list() : [];
var parent = options.inherit && this.getParent();
- if (parent)
+ if (parent) {
links = links.concat(parent.getLinks(type, direction, {inherit: true}));
+ }
return options.reverse ? links.reverse() : links;
}
}
@@ -642,10 +641,10 @@
*/
function getWikiPage(name) {
var page = this.getPage(name);
- if (!page && name.lastIndexOf("s") == name.length-1) {
- page = this.getPage (name.substring(0, name.length-1));
+ if (!page && name.lastIndexOf("s") == name.length - 1) {
+ page = this.getPage (name.substring(0, name.length - 1));
} else if (!page) {
- page = this.getPage (name+"s");
+ page = this.getPage (name + "s");
}
return page;
}