r9500 - in apps/gobi/trunk/code: Global Page

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

Modified:
   apps/gobi/trunk/code/Global/Global.js
   apps/gobi/trunk/code/Global/WikiMarkup.js
   apps/gobi/trunk/code/Page/InternalLinks.js
Log:
Add optional second page argument to global getService() function in order to make services overridable. Use this for the wiki service so we can have multiple wikis on one site.

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

Modified: apps/gobi/trunk/code/Global/Global.js
===================================================================
--- apps/gobi/trunk/code/Global/Global.js	2009-02-02 15:35:00 UTC (rev 9499)
+++ apps/gobi/trunk/code/Global/Global.js	2009-02-05 13:10:45 UTC (rev 9500)
@@ -23,8 +23,9 @@
 /**
  *  Retrieve an page by service name
  */
-function getService(name) {
-    var links = root.getLinks("system:service:"+name, "out");
+function getService(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;
@@ -38,7 +39,7 @@
     if (param.service) {
         base = getService(param.service);
         if (!base)
-            throw "Can't retrieve base page for "+param.service;
+            throw "Can't retrieve base page for " + param.service;
     } else if (param.base) {
         base = getPageInPath(param.base);
         if (!base)

Modified: apps/gobi/trunk/code/Global/WikiMarkup.js
===================================================================
--- apps/gobi/trunk/code/Global/WikiMarkup.js	2009-02-02 15:35:00 UTC (rev 9499)
+++ apps/gobi/trunk/code/Global/WikiMarkup.js	2009-02-05 13:10:45 UTC (rev 9500)
@@ -116,7 +116,7 @@
     },
 
     renderLinks: function(thisPage, src) {
-        var wikiService = getService("wiki");
+        var wikiService = getService("wiki", thisPage);
         src = this.replaceAllWith(src, new RegExp(this.WIKI_LINK_RE, 'i'),
             function (md) {
                 var link = WikiMarkup.parseWikiLink(md[2]);

Modified: apps/gobi/trunk/code/Page/InternalLinks.js
===================================================================
--- apps/gobi/trunk/code/Page/InternalLinks.js	2009-02-02 15:35:00 UTC (rev 9499)
+++ apps/gobi/trunk/code/Page/InternalLinks.js	2009-02-05 13:10:45 UTC (rev 9500)
@@ -15,7 +15,7 @@
 }
 
 function updateTextLinkObjects(func) {
-    var wikiService = getService("wiki");
+    var wikiService = getService("wiki", this);
     var links = this.extractWikiLinks();
     var linksToKeep = {};
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.