Author: kevinshen
Date: 2010-03-24 08:29:57 +0100 (Wed, 24 Mar 2010)
New Revision: 41586

Added:
   
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/src/webapp/error/nopreview.jsp
Modified:
   CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/resources/cmsc.properties
   CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/resources/cmsc_nl.properties
   CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/resources/cmsc_zh.properties
   
CMSContainer/trunk/CMSContainer/cmsc/portal/src/java/com/finalist/cmsc/portalImpl/PortalErrorServlet.java
Log:
CMSC-1459 Problem with previewing content that isnt linked to a page

Modified: 
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/resources/cmsc.properties
===================================================================
--- CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/resources/cmsc.properties  
2010-03-23 18:27:28 UTC (rev 41585)
+++ CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/resources/cmsc.properties  
2010-03-24 07:29:57 UTC (rev 41586)
@@ -218,4 +218,5 @@
 modules.glossary = Glossary
 asset.notimage.warning = Only image files allowed!
 
-simple.editor.login.title=Simple Editor Login
\ No newline at end of file
+simple.editor.login.title=Simple Editor Login
+exception.404.no.previewpage= No preview page found for content element

Modified: 
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/resources/cmsc_nl.properties
===================================================================
--- 
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/resources/cmsc_nl.properties   
    2010-03-23 18:27:28 UTC (rev 41585)
+++ 
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/resources/cmsc_nl.properties   
    2010-03-24 07:29:57 UTC (rev 41586)
@@ -216,4 +216,5 @@
 modules.glossary=Glossary
 asset.notimage.warning = Alleen plaatjes toegestaan!
 
-simple.editor.login.title=Simple Editor Login
\ No newline at end of file
+simple.editor.login.title=Simple Editor Login
+exception.404.no.previewpage= No preview page found for content element
\ No newline at end of file

Modified: 
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/resources/cmsc_zh.properties
===================================================================
--- 
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/resources/cmsc_zh.properties   
    2010-03-23 18:27:28 UTC (rev 41585)
+++ 
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/resources/cmsc_zh.properties   
    2010-03-24 07:29:57 UTC (rev 41586)
@@ -212,4 +212,5 @@
 modules.glossary=Glossary
 asset.notimage.warning = 只允许图片文件上传!
 
-simple.editor.login.title=简单编辑器登录
\ No newline at end of file
+simple.editor.login.title=简单编辑器登录
+exception.404.no.previewpage= 没有相关的预览页面!
\ No newline at end of file

Added: 
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/src/webapp/error/nopreview.jsp
===================================================================
--- 
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/src/webapp/error/nopreview.jsp 
                            (rev 0)
+++ 
CMSContainer/trunk/CMSContainer/cmsc/edit-webapp/src/webapp/error/nopreview.jsp 
    2010-03-24 07:29:57 UTC (rev 41586)
@@ -0,0 +1,9 @@
+<%...@page language="java" contentType="text/html;charset=UTF-8"%>
+<%...@include file="globals.jsp"%>
+<c:set var="title" scope="request"><fmt:message key="exception.404.message" 
/></c:set>
+<%...@include file="header.jsp"%>
+<fmt:message key="exception.404.no.previewpage" />
+  No preview page found for content element
+<%...@include file="footer.jsp"%>
+
+

Modified: 
CMSContainer/trunk/CMSContainer/cmsc/portal/src/java/com/finalist/cmsc/portalImpl/PortalErrorServlet.java
===================================================================
--- 
CMSContainer/trunk/CMSContainer/cmsc/portal/src/java/com/finalist/cmsc/portalImpl/PortalErrorServlet.java
   2010-03-23 18:27:28 UTC (rev 41585)
+++ 
CMSContainer/trunk/CMSContainer/cmsc/portal/src/java/com/finalist/cmsc/portalImpl/PortalErrorServlet.java
   2010-03-24 07:29:57 UTC (rev 41586)
@@ -12,6 +12,7 @@
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.List;
+import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import javax.servlet.RequestDispatcher;
@@ -68,6 +69,8 @@
 
    private static final String SIMPLE_404 = 
"(.*/editors/.*[.](jpg$|gif$|png$|css$|js$|ico$))|robots.txt";
 
+   private static final Pattern FILE_PATTERN = 
Pattern.compile(".*?\\D((?:session=.*?\\+)?\\d+(?:\\+.+?)?)(/.*)?");
+
    private Pattern excludePattern = Pattern.compile(SIMPLE_404);
 
    protected static final String[] vars = { ERROR_STATUS_CODE, 
ERROR_EXCEPTION_TYPE,
@@ -120,6 +123,22 @@
                }
             }
             else {
+                if(statusCode == 404 && !ServerUtil.useServerName()) {
+                  Matcher m = FILE_PATTERN.matcher(path);
+                  String redirectPath = "";   
+                  if (m.matches()) {                  
+                     if (request.getContextPath() != null) {
+                        redirectPath = 
request.getContextPath()+"/error/nopreview.jsp";
+                     }
+                     else {
+                        redirectPath = "/error/nopreview.jsp";
+                     } 
+                  }
+                  if(!"".equals(redirectPath)) {
+                     response.sendRedirect(redirectPath);
+                     return;
+                  }
+               }
                List<Site> sites = SiteManagement.getSites();
                for (Site site2 : sites) {
                   if (SiteManagement.isNavigation(site2.getUrlfragment() + 
PATH_SP + statusCode)) {

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to