svn commit: r589779 - in /lenya/trunk/src: pubs/default/sitemap.xmap webapp/lenya/xslt/exception/document-does-not-exist.xsl

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Author: andreas
Date: Mon Oct 29 11:13:40 2007
New Revision: 589779

URL: http://svn.apache.org/viewvc?rev=589779&view=rev
Log:
Display layouted 404 page also for non-XHTML documents

Modified:
    lenya/trunk/src/pubs/default/sitemap.xmap
    lenya/trunk/src/webapp/lenya/xslt/exception/document-does-not-exist.xsl

Modified: lenya/trunk/src/pubs/default/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/pubs/default/sitemap.xmap?rev=589779&r1=589778&r2=589779&view=diff
==============================================================================
--- lenya/trunk/src/pubs/default/sitemap.xmap (original)
+++ lenya/trunk/src/pubs/default/sitemap.xmap Mon Oct 29 11:13:40 2007
@@ -129,17 +129,19 @@
         <map:serialize type="xml"/>
       </map:match>
       
-      <!-- {1:rendertype}/{2:area}/{3:path} -->
-      <map:match pattern="document-content/*/*/**">
+      <!-- {1:rendertype}/{2:pub}/{3:area}/{4:path} -->
+      <map:match pattern="document-content/*/*/*/**">
         <map:act type="language-exists">
           <map:generate src="{resource-type:format-xhtml}?rendertype={1}"/>
           <map:serialize type="xml"/>
         </map:act>
         <map:generate type="serverpages" src="fallback://lenya/content/exception/document-does-not-exist.xsp"/>
         <map:transform src="fallback://lenya/xslt/exception/document-does-not-exist.xsl">
-          <map:parameter name="documenturl" value="/{3}.html"/>
-          <map:parameter name="path" value="/{3}"/>
-          <map:parameter name="area" value="{2}"/>
+          <map:parameter name="requestUrl" value="{request:requestURI}"/>
+          <map:parameter name="contextPath" value="{request:contextPath}"/>
+          <map:parameter name="pub" value="{2}"/>
+          <map:parameter name="path" value="/{4}"/>
+          <map:parameter name="area" value="{3}"/>
         </map:transform>
         <map:transform type="i18n">
           <map:parameter name="locale" value="{page-envelope:language}"/>
@@ -155,7 +157,7 @@
           <map:part src="cocoon:/navigation-element/menu/{2}/{3}/{5}/{6}/{7}"/>
           <map:part src="cocoon:/navigation-element/search/{2}/{3}/{5}/{6}/{7}"/>
           <map:part src="cocoon://modules/languageselector/text-none/flagsize-13"/>
-          <map:part src="cocoon:/document-content/{1}/{3}/{7}"/>
+          <map:part src="cocoon:/document-content/{1}/{2}/{3}/{7}"/>
         </map:aggregate>
         <map:serialize type="xml"/>
       </map:match>
@@ -348,7 +350,10 @@
                 <map:transform src="fallback://lenya/modules/prettyprinting/xslt/xml2nicexml.xsl"/>
                 <!-- the proxy transformer handles proxy-related URL rewriting -->
                 <map:transform type="proxy"/>
-                <map:serialize type="xhtml"/>
+            <map:act type="language-exists">
+              <map:serialize type="xhtml"/>
+            </map:act>
+            <map:serialize type="xhtml" status-code="404"/>
             <!-- Uncomment to enable XUL menus under Mozilla 5 -->
             <!--  </map:otherwise>
             </map:select> -->
@@ -371,14 +376,17 @@
           <map:read src="lenya-document:{page-envelope:document-uuid},lang={page-envelope:document-language}{link:rev}"/>
         </map:act>
 
-        <map:generate type="serverpages" src="fallback://lenya/content/exception/document-does-not-exist.xsp"/>
-        <map:transform src="fallback://lenya/xslt/exception/document-does-not-exist.xsl">
-          <map:parameter name="documenturl" value="{2}.{3}"/>
-          <map:parameter name="path" value="{page-envelope:document-path}"/>
-          <map:parameter name="area" value="{1}"/>
-        </map:transform>
-        <map:call resource="style-cms-page" />
-        <map:serialize status-code="404" />
+        <map:generate src="cocoon:/lenyabody-view/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-type}{page-envelope:document-path}"/>
+        <map:select type="parameter">
+          <map:parameter name="parameter-selector-test" value="{1}"/>
+          <map:when test="live"/>
+          <map:otherwise>
+            <map:transform src="cocoon://lenya-page/{page-envelope:publication-id}/{1}/{2}.xml?doctype={page-envelope:document-type}"/>
+          </map:otherwise>
+        </map:select>
+        <map:transform src="fallback://lenya/xslt/util/strip_namespaces.xsl"/>
+        <map:transform type="proxy"/>
+        <map:serialize type="xhtml" status-code="404"/>
       </map:match>
       
     </map:pipeline>

Modified: lenya/trunk/src/webapp/lenya/xslt/exception/document-does-not-exist.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/lenya/xslt/exception/document-does-not-exist.xsl?rev=589779&r1=589778&r2=589779&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/xslt/exception/document-does-not-exist.xsl (original)
+++ lenya/trunk/src/webapp/lenya/xslt/exception/document-does-not-exist.xsl Mon Oct 29 11:13:40 2007
@@ -26,12 +26,15 @@
   
   <xsl:import href="../util/page-util.xsl"/>
   
+  <xsl:param name="pub"/>
   <xsl:param name="area"/>
   <xsl:param name="path"/>
-  <xsl:param name="documenturl"/>
-  <xsl:param name="baseUrl"/>
+  <xsl:param name="requestUrl"/>
+  <xsl:param name="contextPath"/>
   
   <xsl:variable name="language"><xsl:value-of select="/missing-language/current-language"/></xsl:variable>
+  <xsl:variable name="prefix" select="concat($contextPath, '/', $pub, '/', $area)"/>
+  <xsl:variable name="documentUrl" select="substring($requestUrl, string-length($prefix) + 1)"/>
   
   <xsl:template match="/">
     
@@ -76,7 +79,7 @@
               <p>
                 <i18n:translate>
                   <i18n:text i18n:key="error-document-existance" />
-                  <i18n:param>'<xsl:value-of select="$documenturl"/>'</i18n:param>
+                  <i18n:param>'<xsl:value-of select="$documentUrl"/>'</i18n:param>
                 </i18n:translate>
               </p>
               <xsl:if test="$area = 'authoring'">
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.