[Yanel-commits] rev 40892 - public/yanel/contributions/resources/xinha/htdocs

simon at wyona.com simon at wyona.com
Sun Jan 11 00:49:53 CET 2009


Author: simon
Date: 2009-01-11 00:49:53 +0100 (Sun, 11 Jan 2009)
New Revision: 40892

Modified:
   public/yanel/contributions/resources/xinha/htdocs/xinha.jelly
Log:
xinha has problems if _editor_url is set to relative url. this was causing some null pointers because of strange urls had been requested by xinha.

Modified: public/yanel/contributions/resources/xinha/htdocs/xinha.jelly
===================================================================
--- public/yanel/contributions/resources/xinha/htdocs/xinha.jelly	2009-01-10 18:12:48 UTC (rev 40891)
+++ public/yanel/contributions/resources/xinha/htdocs/xinha.jelly	2009-01-10 23:49:53 UTC (rev 40892)
@@ -4,12 +4,19 @@
     <head>
       <title>Edit ${resource.getEditPath()} with Xinha</title>
       <link rel="stylesheet" type="text/css" href="${yanel.back2realm}${yanel.reservedPrefix}/resource-types/http://www.wyona.org/yanel/resource/1.0::xinha/css/xinha-resource.css"/>
-      <script language="javascript" type="text/javascript" src="${yanel.back2realm}${yanel.reservedPrefix}/resource-types/http://www.wyona.org/yanel/resource/1.0::xinha/xinha/jscripts/xinha/xinha.js"></script>
       
       <script type="text/javascript">
-        _editor_url  = "${yanel.back2realm}${yanel.reservedPrefix}/resource-types/http://www.wyona.org/yanel/resource/1.0::xinha/xinha/"  // (preferably absolute) URL (including trailing slash) where Xinha is installed
+        _editor_url  = resolveRelative("${yanel.back2realm}") + "${yanel.reservedPrefix}/resource-types/http://www.wyona.org/yanel/resource/1.0::xinha/xinha/";  // (preferably absolute) URL (including trailing slash) where Xinha is installed
         _editor_lang = "${resource.getRequestedLanguage()}";      // And the language we need to use in the editor.
         _editor_skin = "silva";   // If you want use a skin, add the name (of the folder) here
+        
+        // resolves a path relative to the current window.location.href
+        function resolveRelative(path, relativeTo) {
+            var url = window.location.href;
+            url = url.split('?')[0];
+            url = url.substring(0, url.lastIndexOf('/'));
+            return url + '/' + path;
+        }
       </script>
       <script type="text/javascript" src="${yanel.back2realm}${yanel.reservedPrefix}/resource-types/http://www.wyona.org/yanel/resource/1.0::xinha/xinha/XinhaCore.js"></script>
       <script type="text/javascript">



More information about the Yanel-commits mailing list