Fehler #2400 FormprocessException, modul ccm-webpage
git-svn-id: https://svn.libreccm.org/ccm/trunk@3221 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
0f1b1cb8b7
commit
6f4ebfe78f
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
webpage.ui.error=There is an error on the form
|
||||||
|
webpage.ui.contentsection_null=ContentSection is null
|
||||||
|
webpage.ui.insufficient_permissions=Insufficient permissions
|
||||||
|
webpage.ui.contentsection_doesnt_match=Content section does not match!
|
||||||
|
webpage.ui.no_such_contentsection=no such content section.
|
||||||
|
webpage.ui.illegal_portlet=Illegal portlet ID
|
||||||
|
webpage.ui.illegal_webpage_portlet=Illegal Webpage Portlet ID
|
||||||
|
webpage.ui.no_permission_edit=You do not have permission to edit this item.
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
|
||||||
|
webpage.ui.error=Es ist ein Fehler aufgetreten
|
||||||
|
webpage.ui.contentsection_null=Contentsection ist null
|
||||||
|
webpage.ui.insufficient_permissions=Keine Erlaubnis
|
||||||
|
webpage.ui.contentsection_doesnt_match=Content section does not match!
|
||||||
|
webpage.ui.no_such_contentsection=no such content section.
|
||||||
|
webpage.ui.illegal_portlet=Illegal portlet ID
|
||||||
|
webpage.ui.illegal_webpage_portlet=Illegal Webpage Portlet ID
|
||||||
|
webpage.ui.no_permission_edit=Sie haben nicht die Erlaubnis dieses Item zu editieren.
|
||||||
|
|
@ -51,6 +51,7 @@ import com.arsdigita.cms.ui.CMSDHTMLEditor;
|
||||||
import com.arsdigita.cms.util.SecurityConstants;
|
import com.arsdigita.cms.util.SecurityConstants;
|
||||||
import com.arsdigita.cms.webpage.Webpage;
|
import com.arsdigita.cms.webpage.Webpage;
|
||||||
import com.arsdigita.cms.webpage.WebpageConstants;
|
import com.arsdigita.cms.webpage.WebpageConstants;
|
||||||
|
import com.arsdigita.cms.webpage.util.WebpageGlobalizationUtil;
|
||||||
import com.arsdigita.cms.workflow.CMSTask;
|
import com.arsdigita.cms.workflow.CMSTask;
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.kernel.User;
|
import com.arsdigita.kernel.User;
|
||||||
|
|
@ -336,7 +337,8 @@ public class WebpageCMSEditorPage extends CMSPage implements WebpageConstants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
throw new FormProcessException("There is an error on the form");
|
throw new FormProcessException(WebpageGlobalizationUtil.globalize(
|
||||||
|
"webpage.ui.error"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -371,17 +373,20 @@ public class WebpageCMSEditorPage extends CMSPage implements WebpageConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
throw new FormProcessException("ContentSection is null");
|
throw new FormProcessException(WebpageGlobalizationUtil
|
||||||
|
.globalize("webpage.ui.contentsection_null"));
|
||||||
}
|
}
|
||||||
SecurityManager sm = new SecurityManager(section);
|
SecurityManager sm = new SecurityManager(section);
|
||||||
User user = Web.getWebContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
|
|
||||||
if (webpage != null) {
|
if (webpage != null) {
|
||||||
if (!sm.canAccess(user, SecurityConstants.EDIT_ITEM, webpage)) {
|
if (!sm.canAccess(user, SecurityConstants.EDIT_ITEM, webpage)) {
|
||||||
throw new FormProcessException("Insufficient permissions");
|
throw new FormProcessException(WebpageGlobalizationUtil
|
||||||
|
.globalize("webpage.ui.insufficient_permissions"));
|
||||||
}
|
}
|
||||||
if (!webpage.getContentSection().equals(section)) {
|
if (!webpage.getContentSection().equals(section)) {
|
||||||
throw new FormProcessException("content section doesn't match!");
|
throw new FormProcessException(WebpageGlobalizationUtil
|
||||||
|
.globalize("webpage.ui.contentsection_doesnt_match"));
|
||||||
}
|
}
|
||||||
webpage.setTitle((String) m_title.getValue(state));
|
webpage.setTitle((String) m_title.getValue(state));
|
||||||
webpage.setName("webpage" + webpage.getID());
|
webpage.setName("webpage" + webpage.getID());
|
||||||
|
|
@ -392,7 +397,8 @@ public class WebpageCMSEditorPage extends CMSPage implements WebpageConstants {
|
||||||
webpage.save();
|
webpage.save();
|
||||||
} else {
|
} else {
|
||||||
if (!sm.canAccess(user, SecurityConstants.NEW_ITEM)) {
|
if (!sm.canAccess(user, SecurityConstants.NEW_ITEM)) {
|
||||||
throw new FormProcessException("Insufficient permissions");
|
throw new FormProcessException(WebpageGlobalizationUtil
|
||||||
|
.globalize("webpage.ui.insufficient_permissions"));
|
||||||
}
|
}
|
||||||
webpage = new Webpage();
|
webpage = new Webpage();
|
||||||
webpage.setLanguage("en");
|
webpage.setLanguage("en");
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.bebop.portal.PortletConfigFormSection;
|
import com.arsdigita.bebop.portal.PortletConfigFormSection;
|
||||||
import com.arsdigita.categorization.Category;
|
|
||||||
import com.arsdigita.categorization.CategoryCollection;
|
import com.arsdigita.categorization.CategoryCollection;
|
||||||
import com.arsdigita.cms.ContentBundle;
|
import com.arsdigita.cms.ContentBundle;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
|
@ -52,6 +51,7 @@ import com.arsdigita.util.Assert;
|
||||||
import com.arsdigita.util.StringUtils;
|
import com.arsdigita.util.StringUtils;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
import com.arsdigita.web.Web;
|
import com.arsdigita.web.Web;
|
||||||
|
import com.arsdigita.cms.webpage.util.WebpageGlobalizationUtil;
|
||||||
import com.arsdigita.workflow.simple.Engine;
|
import com.arsdigita.workflow.simple.Engine;
|
||||||
import com.arsdigita.workflow.simple.Task;
|
import com.arsdigita.workflow.simple.Task;
|
||||||
import com.arsdigita.workflow.simple.TaskCollection;
|
import com.arsdigita.workflow.simple.TaskCollection;
|
||||||
|
|
@ -166,7 +166,8 @@ public class WebpagePortletEditor extends PortletConfigFormSection {
|
||||||
if (webpage == null) {
|
if (webpage == null) {
|
||||||
ContentSection section = Initializer.getConfig().getWebpageSection();
|
ContentSection section = Initializer.getConfig().getWebpageSection();
|
||||||
if (section == null) {
|
if (section == null) {
|
||||||
throw new FormProcessException("no such content section");
|
throw new FormProcessException(WebpageGlobalizationUtil
|
||||||
|
.globalize("webpage.ui.no_such_contentsection"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// FR: move reference from PortalSite to Application (could be Workspace)
|
// FR: move reference from PortalSite to Application (could be Workspace)
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import com.arsdigita.cms.dispatcher.CMSPage;
|
||||||
import com.arsdigita.cms.ui.CMSDHTMLEditor;
|
import com.arsdigita.cms.ui.CMSDHTMLEditor;
|
||||||
import com.arsdigita.cms.webpage.Webpage;
|
import com.arsdigita.cms.webpage.Webpage;
|
||||||
import com.arsdigita.cms.webpage.WebpageConstants;
|
import com.arsdigita.cms.webpage.WebpageConstants;
|
||||||
|
import com.arsdigita.cms.webpage.util.WebpageGlobalizationUtil;
|
||||||
// import com.arsdigita.cms.webpage.installer.Initializer;
|
// import com.arsdigita.cms.webpage.installer.Initializer;
|
||||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.kernel.User;
|
import com.arsdigita.kernel.User;
|
||||||
|
|
@ -194,7 +195,8 @@ public class WebpagePortletEditorPage extends CMSPage {
|
||||||
private WebpagePortlet getWebpagePortlet(PageState ps) throws FormProcessException {
|
private WebpagePortlet getWebpagePortlet(PageState ps) throws FormProcessException {
|
||||||
String portletIDString = ps.getRequest().getParameter(PORTLET_ID);
|
String portletIDString = ps.getRequest().getParameter(PORTLET_ID);
|
||||||
if (portletIDString == null) {
|
if (portletIDString == null) {
|
||||||
throw new FormProcessException("Illegal portlet ID: " + portletIDString);
|
throw new FormProcessException(WebpageGlobalizationUtil
|
||||||
|
.globalize("webpage.ui.illegal_portlet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal portletID = new BigDecimal(portletIDString);
|
BigDecimal portletID = new BigDecimal(portletIDString);
|
||||||
|
|
@ -204,14 +206,16 @@ public class WebpagePortletEditorPage extends CMSPage {
|
||||||
protected WebpagePortlet getWebpagePortlet(PageState ps, BigDecimal portletID) throws FormProcessException {
|
protected WebpagePortlet getWebpagePortlet(PageState ps, BigDecimal portletID) throws FormProcessException {
|
||||||
WebpagePortlet portlet = (WebpagePortlet) Portlet.retrievePortlet(portletID);
|
WebpagePortlet portlet = (WebpagePortlet) Portlet.retrievePortlet(portletID);
|
||||||
if (portlet == null) {
|
if (portlet == null) {
|
||||||
throw new FormProcessException("Illegal Webpage Portlet ID: " + portletID);
|
throw new FormProcessException(WebpageGlobalizationUtil
|
||||||
|
.globalize("webpage.ui.illegal_webpage_portlet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
User user = Web.getWebContext().getUser();
|
User user = Web.getWebContext().getUser();
|
||||||
PermissionDescriptor perm = new PermissionDescriptor(PrivilegeDescriptor.EDIT,
|
PermissionDescriptor perm = new PermissionDescriptor(PrivilegeDescriptor.EDIT,
|
||||||
portlet.getParentResource(), user);
|
portlet.getParentResource(), user);
|
||||||
if (!PermissionService.checkPermission(perm)) {
|
if (!PermissionService.checkPermission(perm)) {
|
||||||
throw new FormProcessException("You do not have permission to edit this item.");
|
throw new FormProcessException(WebpageGlobalizationUtil
|
||||||
|
.globalize("webpage.ui.no_permission_edit"));
|
||||||
}
|
}
|
||||||
return portlet;
|
return portlet;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.webpage.util;
|
||||||
|
|
||||||
|
import com.arsdigita.globalization.Globalized;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* .
|
||||||
|
* Contains methods to simplify globalizing keys
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Konermann
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class WebpageGlobalizationUtil implements Globalized {
|
||||||
|
|
||||||
|
private static final String BUNDLE_NAME =
|
||||||
|
"com.arsdigita.webpage.WebpageResources";
|
||||||
|
|
||||||
|
public static GlobalizedMessage globalize(String key) {
|
||||||
|
return new GlobalizedMessage(key, BUNDLE_NAME);
|
||||||
|
}
|
||||||
|
public static GlobalizedMessage globalize(String key, Object[] args) {
|
||||||
|
return new GlobalizedMessage(key, BUNDLE_NAME, args);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue