r9504 - apps/gobi/trunk/code/Global

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

Modified:
   apps/gobi/trunk/code/Global/WikiMarkup.js
Log:
Fix WikiMarkup.renderLinks() to create new page in nearest wiki service, if one is defined.

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

Modified: apps/gobi/trunk/code/Global/WikiMarkup.js
===================================================================
--- apps/gobi/trunk/code/Global/WikiMarkup.js	2009-02-05 14:10:57 UTC (rev 9503)
+++ apps/gobi/trunk/code/Global/WikiMarkup.js	2009-02-05 17:38:28 UTC (rev 9504)
@@ -118,6 +118,9 @@
     renderLinks: function(thisPage, src) {
         thisPage = thisPage.isPersistent() ? thisPage : path.page;
         var wikis = getServices("wiki", thisPage);
+        // this is the wiki we're going to create a new page in if required
+        var mainWiki = wikis[0] || thisPage;
+        // add this page as first element to wiki search path
         wikis.unshift(thisPage);
         src = this.replaceAllWith(src, new RegExp(this.WIKI_LINK_RE, 'i'),
             function (md) {
@@ -133,7 +136,7 @@
                         page = wiki.getWikiPage(link.target);
                     }
                     if (!page) {
-                        var href = wikis[0].href("create") + "?name=" + link.target;
+                        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);
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.