You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/06/25 13:55:48 UTC

svn commit: r550462 - in /lenya/trunk/src: modules-core/sitemanagement/usecases/tab/ modules-core/usecase/ modules/sitetree/ modules/sitetree/resources/javascript/

Author: andreas
Date: Mon Jun 25 04:55:47 2007
New Revision: 550462

URL: http://svn.apache.org/viewvc?view=rev&rev=550462
Log:
Improved sitetree behaviour for proxying

Modified:
    lenya/trunk/src/modules-core/sitemanagement/usecases/tab/sitetree.jx
    lenya/trunk/src/modules-core/usecase/usecase.xmap
    lenya/trunk/src/modules/sitetree/resources/javascript/lenyatree.js
    lenya/trunk/src/modules/sitetree/resources/javascript/navtree.js
    lenya/trunk/src/modules/sitetree/sitemap.xmap

Modified: lenya/trunk/src/modules-core/sitemanagement/usecases/tab/sitetree.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/sitemanagement/usecases/tab/sitetree.jx?view=diff&rev=550462&r1=550461&r2=550462
==============================================================================
--- lenya/trunk/src/modules-core/sitemanagement/usecases/tab/sitetree.jx (original)
+++ lenya/trunk/src/modules-core/sitemanagement/usecases/tab/sitetree.jx Mon Jun 25 04:55:47 2007
@@ -21,6 +21,7 @@
 <jx:template
   xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
   xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+  xmlns:proxy="http://apache.org/lenya/proxy/1.0"
   xmlns="http://www.w3.org/1999/xhtml"
   name="">
   
@@ -68,7 +69,9 @@
     <div id="lenya-info-tree">
       <div id="tree">
         <script type="text/javascript">
-          CONTEXT_PREFIX = '<jx:out value="${request.contextPath}"/>';
+          WEBAPP_BASE_PATH = '<proxy:url href="/"/>';
+          AREA_BASE_PATH = '<proxy:url href="/${publicationId}/authoring"/>';
+          
           PUBLICATION_ID = '<jx:out value="${publicationId}"/>';
           <jx:choose>
             <jx:when test="${docExists.booleanValue()}">
@@ -79,7 +82,7 @@
             </jx:otherwise>
           </jx:choose>
           DEFAULT_LANGUAGE = '<jx:out value="${publication.getDefaultLanguage()}"/>';
-          IMAGE_PATH = '<jx:out value="${request.contextPath + '/lenya/images/tree/'}"/>';
+          IMAGE_PATH = '<proxy:url href="/lenya/images/tree/"/>';
           
           
           <jx:set var="clipboard" value="${request.getSession().getAttribute('org.apache.lenya.cms.site.usecases.Clipboard')}"/>
@@ -94,7 +97,7 @@
           </jx:choose>
           
           ALL_AREAS = 'authoring,trash,archive';
-          PIPELINE_PATH = '/authoring/sitetree-fragment.xml';
+          PIPELINE_PATH = '/sitetree-fragment.xml';
           SHOW_LOADING_HINT = true;
           SHOW_ICONS = true;
           

Modified: lenya/trunk/src/modules-core/usecase/usecase.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/usecase/usecase.xmap?view=diff&rev=550462&r1=550461&r2=550462
==============================================================================
--- lenya/trunk/src/modules-core/usecase/usecase.xmap (original)
+++ lenya/trunk/src/modules-core/usecase/usecase.xmap Mon Jun 25 04:55:47 2007
@@ -27,6 +27,10 @@
   <map:components>
     <map:transformers default="xslt">    
       <map:transformer name="browser-update" src="org.apache.cocoon.ajax.BrowserUpdateTransformer"/>
+      <map:transformer name="usecase-proxy" logger="lenya.sitemap.transformer.proxy"
+        src="org.apache.lenya.cms.cocoon.transformation.ProxyTransformer">
+        <transform namespace="http://apache.org/lenya/proxy/1.0" element="url" attribute="href"/>
+      </map:transformer>
     </map:transformers>
     <map:selectors>
       <map:selector name="ajax-request" src="org.apache.cocoon.ajax.AjaxRequestSelector"/>
@@ -55,6 +59,10 @@
         <map:transform type="browser-update"/>
         <map:transform type="cinclude"/>
         <map:transform type="forms" />
+        
+        <map:transform type="usecase-proxy"/>
+        <map:transform src="xslt/proxyUrl2text.xsl"/>
+        
         <map:transform src="cocoon://lenya-screen.xsl"/>
         <map:transform type="i18n">
           <map:parameter name="locale" value="{request:locale}"/>

Modified: lenya/trunk/src/modules/sitetree/resources/javascript/lenyatree.js
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sitetree/resources/javascript/lenyatree.js?view=diff&rev=550462&r1=550461&r2=550462
==============================================================================
--- lenya/trunk/src/modules/sitetree/resources/javascript/lenyatree.js (original)
+++ lenya/trunk/src/modules/sitetree/resources/javascript/lenyatree.js Mon Jun 25 04:55:47 2007
@@ -18,7 +18,8 @@
 
 /*
   The following variables must be set:
-  CONTEXT_PREFIX
+  WEBAPP_BASE_PATH - path to the web application root, including the trailing slash
+  AREA_BASE_PATH - path to the area root, without the trailing slash
   PUBLICATION_ID
   PIPELINE_PATH
   IMAGE_PATH
@@ -83,7 +84,7 @@
 
 LenyaNode.prototype.getLoadSubTreeURL = function() {
     var path = this.getPath();
-    return encodeURI(CONTEXT_PREFIX + '/' + PUBLICATION_ID + PIPELINE_PATH + '?path='+path+'&lenya.module=sitetree');
+    return encodeURI(AREA_BASE_PATH + PIPELINE_PATH + '?path='+path+'&lenya.module=sitetree');
 }
 
 
@@ -193,7 +194,7 @@
 };
 
 LenyaTree.prototype.getLoadInitialTreeURL = function(path) {
-    return encodeURI(CONTEXT_PREFIX + '/' + PUBLICATION_ID + PIPELINE_PATH + '?path='+path+'&lenya.module=sitetree');
+    return encodeURI(AREA_BASE_PATH + PIPELINE_PATH + '?path='+path+'&lenya.module=sitetree');
 }
 
 LenyaTree.prototype.initialTreeLoaded = function(xml) {
@@ -244,7 +245,7 @@
         else {
             var img = this.doc.createElement('img');
             var language = CHOSEN_LANGUAGE;
-            img.setAttribute('src', CONTEXT_PREFIX + item.getPath() + '_' + language + '.gif?lenya.module=sitetree');
+            img.setAttribute('src', AREA_BASE_PATH + item.path + '_' + language + '.gif?lenya.module=sitetree');
             img.setAttribute('alt', '');
             return img;
         }

Modified: lenya/trunk/src/modules/sitetree/resources/javascript/navtree.js
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sitetree/resources/javascript/navtree.js?view=diff&rev=550462&r1=550461&r2=550462
==============================================================================
--- lenya/trunk/src/modules/sitetree/resources/javascript/navtree.js (original)
+++ lenya/trunk/src/modules/sitetree/resources/javascript/navtree.js Mon Jun 25 04:55:47 2007
@@ -15,6 +15,10 @@
   limitations under the License.
 */
 
+/*
+Required variables: see lenyatree.js
+*/
+
 /******************************************
  *  NavNode 
  ******************************************/
@@ -62,7 +66,7 @@
 NavNode.prototype.getLoadSubTreeURL = function() {
     area = this.area;
     var path = this.getBasePath();
-    return encodeURI(CONTEXT_PREFIX + '/' + PUBLICATION_ID + PIPELINE_PATH + '?area='+area+'&path='+path+'&language='+CHOSEN_LANGUAGE+'&areas='+ALL_AREAS+'&lenya.module=sitetree');
+    return encodeURI(AREA_BASE_PATH + PIPELINE_PATH + '?area='+area+'&path='+path+'&language='+CHOSEN_LANGUAGE+'&areas='+ALL_AREAS+'&lenya.module=sitetree');
 }
 
 NavNode.prototype.getStyle = function() {
@@ -147,7 +151,7 @@
 };
 
 NavTree.prototype.loadInitialTree = function(area, path) {
-    var url = encodeURI(CONTEXT_PREFIX + '/' + PUBLICATION_ID + PIPELINE_PATH + '?area='+area+'&path='+path+'&language='+CHOSEN_LANGUAGE+'&initial=true&areas='+ALL_AREAS+'&lenya.module=sitetree');
+    var url = encodeURI(AREA_BASE_PATH + PIPELINE_PATH + '?area='+area+'&path='+path+'&language='+CHOSEN_LANGUAGE+'&initial=true&areas='+ALL_AREAS+'&lenya.module=sitetree');
     
     callback = function(fragment, param) {
         var tree = param[0];
@@ -203,8 +207,7 @@
 
 NavTree.prototype.handleItemClick = function(item, event) {
     if (!item.isprotected) { // && item.root!=item) {
-        var itemhref = item.href.replace(/^\//, "");
-        href = encodeURI(CONTEXT_PREFIX+'/'+PUBLICATION_ID+"/"+item.area+"/"+itemhref+"?lenya.usecase=tab.overview"); 
+        href = encodeURI(item.href + "?lenya.usecase=tab.overview"); 
         window.location = href;
     }
 };

Modified: lenya/trunk/src/modules/sitetree/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/sitetree/sitemap.xmap?view=diff&rev=550462&r1=550461&r2=550462
==============================================================================
--- lenya/trunk/src/modules/sitetree/sitemap.xmap (original)
+++ lenya/trunk/src/modules/sitetree/sitemap.xmap Mon Jun 25 04:55:47 2007
@@ -41,7 +41,6 @@
       </map:transformer>
       <map:transformer logger="lenya.sitemap.transformer.proxy" name="proxy-sitetree"
           src="org.apache.lenya.cms.cocoon.transformation.ProxyTransformer">
-        <urls type="relative"/>
         <transform namespace="http://apache.org/cocoon/lenya/navigation/1.0" element="node" attribute="href"/>
       </map:transformer>
     </map:transformers>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org