Update of
/var/cvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets
In directory
james.mmbase.org:/tmp/cvs-serv3785/cmsc/portlets/src/java/com/finalist/cmsc/portlets
Modified Files:
CmscPortlet.java
Log Message:
CMSC-938 Make inline editors work for demo sites
Foxed some erro pager conditions
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets
See also: http://www.mmbase.org/jira/browse/CMSC-938
Index: CmscPortlet.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer/cmsc/portlets/src/java/com/finalist/cmsc/portlets/CmscPortlet.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- CmscPortlet.java 10 May 2008 16:31:23 -0000 1.21
+++ CmscPortlet.java 2 Jun 2008 21:56:34 -0000 1.22
@@ -11,18 +11,18 @@
import javax.servlet.jsp.jstl.fmt.LocalizationContext;
import net.sf.mmapps.commons.bridge.CloudUtil;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.pluto.core.CoreUtils;
import org.apache.pluto.core.InternalPortletRequest;
-import org.mmbase.bridge.*;
+import org.mmbase.bridge.Cloud;
+import org.mmbase.bridge.Node;
import com.finalist.cmsc.beans.om.PortletParameter;
import com.finalist.cmsc.beans.om.View;
import com.finalist.cmsc.portalImpl.PortalConstants;
-import com.finalist.cmsc.portalImpl.ControllerFilter;
import com.finalist.cmsc.security.SecurityUtil;
import com.finalist.cmsc.services.sitemanagement.SiteManagement;
import com.finalist.cmsc.services.sitemanagement.SiteManagementAdmin;
@@ -421,18 +421,35 @@
protected PortletRequestDispatcher getRequestDispatcher(String type, String
template) {
String resourceExtension = "jsp";
String fullTemplate = getTemplate(type, template, resourceExtension);
+
+ if (!templateExists(fullTemplate)) {
+ fullTemplate = getTemplate(type, "missing.jsp", resourceExtension);
+ if (!templateExists(fullTemplate)) {
+ String aggregationDir = getAggregationDir();
+ fullTemplate = aggregationDir + "missing.jsp";
+ }
+ }
+
PortletRequestDispatcher rd =
getPortletContext().getRequestDispatcher(fullTemplate);
return rd;
}
+ private boolean templateExists(String fullTemplate) {
+ Set<String> webInfResources =
getPortletContext().getResourcePaths(fullTemplate);
+ /* @see javax.servlet.ServletContext#getResourcePaths(String)
+ * getResourcePaths returns a Set containing the directory listing, or
null
+ * if there are no resources in the web application whose path begins
with the supplied path.
+ * we are using a full path instead of a partial path.
webInfResources.isEmpty() is true when
+ * the resource exists
+ */
+ return webInfResources != null;
+ }
+
protected String getTemplate(String type, String template, String
resourceExtension) {
String baseDir = getPortletContext().getInitParameter("cmsc.portal." +
type + ".base.dir");
if (StringUtils.isEmpty(baseDir)) {
- String aggregationDir =
getPortletContext().getInitParameter("cmsc.portal.aggregation.base.dir");
- if (StringUtils.isEmpty(aggregationDir)) {
- aggregationDir = "/WEB-INF/templates/";
- }
+ String aggregationDir = getAggregationDir();
baseDir = aggregationDir + type + "/";
}
@@ -447,6 +464,14 @@
return baseDir + template;
}
+ private String getAggregationDir() {
+ String aggregationDir =
getPortletContext().getInitParameter("cmsc.portal.aggregation.base.dir");
+ if (StringUtils.isEmpty(aggregationDir)) {
+ aggregationDir = "/WEB-INF/templates/";
+ }
+ return aggregationDir;
+ }
+
protected void setAttribute(RenderRequest request, String var, Object
value) {
if (StringUtils.isNotEmpty(var)) {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs