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/04/26 13:41:21 UTC

svn commit: r532712 - in /lenya/trunk/src/webapp: global-sitemap.xmap lenya/content/exception/publication-does-not-exist.jx lenya/resources/i18n/cmsui.xml lenya/resources/i18n/cmsui_de.xml

Author: andreas
Date: Thu Apr 26 04:41:20 2007
New Revision: 532712

URL: http://svn.apache.org/viewvc?view=rev&rev=532712
Log:
Added exception handling for non-existing publications. This fixes bug 42220. Thanks to Joern Nettingsmeier for enhancing the patch.

Added:
    lenya/trunk/src/webapp/lenya/content/exception/publication-does-not-exist.jx
Modified:
    lenya/trunk/src/webapp/global-sitemap.xmap
    lenya/trunk/src/webapp/lenya/resources/i18n/cmsui.xml
    lenya/trunk/src/webapp/lenya/resources/i18n/cmsui_de.xml

Modified: lenya/trunk/src/webapp/global-sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/global-sitemap.xmap?view=diff&rev=532712&r1=532711&r2=532712
==============================================================================
--- lenya/trunk/src/webapp/global-sitemap.xmap (original)
+++ lenya/trunk/src/webapp/global-sitemap.xmap Thu Apr 26 04:41:20 2007
@@ -412,7 +412,21 @@
       
       <!-- Enter the actual publication -->
       <map:match pattern="*/**">
-        <map:mount uri-prefix="{1}" src="{fallback:sitemap.xmap}" check-reload="true" reload-method="synchron"/>
+        <map:select type="resource-exists">
+          <map:when test="context://lenya/pubs/{1}">
+            <map:mount uri-prefix="{1}" src="{fallback:sitemap.xmap}" check-reload="true" reload-method="synchron"/>
+          </map:when>
+          <map:otherwise>
+            <map:generate type="jx" src="fallback://lenya/content/exception/publication-does-not-exist.jx">
+              <map:parameter name="publicationId" value="{1}"/>
+            </map:generate>
+            <map:transform type="i18n">
+              <map:parameter name="locale" value="{request:locale}"></map:parameter>
+            </map:transform>
+            <map:call resource="style-cms-page"/>
+            <map:serialize status-code="404" />
+          </map:otherwise>
+        </map:select>
       </map:match>
    </map:pipeline>
 

Added: lenya/trunk/src/webapp/lenya/content/exception/publication-does-not-exist.jx
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/lenya/content/exception/publication-does-not-exist.jx?view=auto&rev=532712
==============================================================================
--- lenya/trunk/src/webapp/lenya/content/exception/publication-does-not-exist.jx (added)
+++ lenya/trunk/src/webapp/lenya/content/exception/publication-does-not-exist.jx Thu Apr 26 04:41:20 2007
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jx:template xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+  
+  <page:page
+    xmlns:page="http://apache.org/cocoon/lenya/cms-page/1.0"
+    xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+    xmlns="http://www.w3.org/1999/xhtml">
+    
+    <page:title><i18n:text>publication-does-not-exist</i18n:text></page:title>
+    
+    <page:body>
+      <p>
+        <i18n:translate>
+          <i18n:text>publication-...-does-not-exist</i18n:text>
+          <jx:set var="requestUri" value="${cocoon.request.requestURI}"/>
+          <jx:set var="contextPath" value="${cocoon.request.contextPath}"/>
+          <jx:set var="snippets" value="${requestUri.substring(contextPath.length()).split('/')}"/>
+          <i18n:param><jx:out value="${snippets[1]}"/></i18n:param>
+        </i18n:translate>
+      </p>
+      <p>
+        <a href="/${contextPath}"><i18n:text>Back</i18n:text></a>
+      </p>
+    </page:body>
+    
+  </page:page>
+  
+</jx:template>
\ No newline at end of file

Modified: lenya/trunk/src/webapp/lenya/resources/i18n/cmsui.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/lenya/resources/i18n/cmsui.xml?view=diff&rev=532712&r1=532711&r2=532712
==============================================================================
--- lenya/trunk/src/webapp/lenya/resources/i18n/cmsui.xml (original)
+++ lenya/trunk/src/webapp/lenya/resources/i18n/cmsui.xml Thu Apr 26 04:41:20 2007
@@ -393,6 +393,9 @@
   <message key="error-generic">An error occured.</message>
   <message key="error-404">404: Page not found</message>
   
+  <message key="publication-does-not-exist">The publication does not exist</message>
+  <message key="publication-...-does-not-exist">The publication with the ID "{0}" does not exist.</message>
+  
   <message key="configure-content-repository">
     <xhtml:strong>Note:</xhtml:strong> Make sure that your content repository
     is configured correctly within <xhtml:code>$PUB_HOME/config/(local.)publication.xml</xhtml:code>.

Modified: lenya/trunk/src/webapp/lenya/resources/i18n/cmsui_de.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/webapp/lenya/resources/i18n/cmsui_de.xml?view=diff&rev=532712&r1=532711&r2=532712
==============================================================================
--- lenya/trunk/src/webapp/lenya/resources/i18n/cmsui_de.xml (original)
+++ lenya/trunk/src/webapp/lenya/resources/i18n/cmsui_de.xml Thu Apr 26 04:41:20 2007
@@ -403,6 +403,9 @@
   <message key="error-generic">Ein Fehler ist aufgetreten.</message>
   <message key="error-404">404: Seite nicht gefunden</message>
   
+  <message key="publication-does-not-exist">Die Publikation existiert nicht</message>
+  <message key="publication-...-does-not-exist">Die Publikation mit der ID "{0}" existiert nicht.</message>
+  
   <message key="configure-content-repository">
     <xhtml:strong>Hinweis:</xhtml:strong> Überprüfen Sie, ob das Content-Repository
     in <xhtml:code>$PUB_HOME/config/(local.)publication.xml</xhtml:code> richtig konfiguriert ist.



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