r9502 - apps/gobi/trunk/code/Global

[email protected]
Newsgroups gmane.comp.java.helma.cvs
Message-ID <[email protected]>
Author: hannes
Date: 2009-02-05 15:09:38 +0100 (Thu, 05 Feb 2009)
New Revision: 9502

Modified:
   apps/gobi/trunk/code/Global/Global.js
Log:
Implement global getServices(name, page) function to be able to retrieve a list of inherited services for a page. Is required for inter-wiki linking on servers with multiple wikis.

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

Modified: apps/gobi/trunk/code/Global/Global.js
===================================================================
--- apps/gobi/trunk/code/Global/Global.js	2009-02-05 14:07:47 UTC (rev 9501)
+++ apps/gobi/trunk/code/Global/Global.js	2009-02-05 14:09:38 UTC (rev 9502)
@@ -24,11 +24,16 @@
  *  Retrieve an page by service name
  */
 function getService(name, page) {
+    var services = getServices(name, page);
+    return services.length > 0 ? services[0] : null;
+}
+
+/**
+ *  Retrieve an list of page by service name
+ */
+function getServices(name, page) {
     page = page || root;
-    var links = page.getLinks("system:service:" + name, Link.OUT, { inherit: true });
-    if (links.length > 0)
-        return links[0].target;
-    return null;
+    return page.getLinkedPages("system:service:" + name, Link.OUT, { inherit: true });
 }
 
 /**
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.