diff --git a/ccm-webpage/src/com/arsdigita/cms/webpage/WebpageResources.properties b/ccm-webpage/src/com/arsdigita/cms/webpage/WebpageResources.properties new file mode 100644 index 000000000..d44c9f086 --- /dev/null +++ b/ccm-webpage/src/com/arsdigita/cms/webpage/WebpageResources.properties @@ -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. diff --git a/ccm-webpage/src/com/arsdigita/cms/webpage/WebpageResources_de.properties b/ccm-webpage/src/com/arsdigita/cms/webpage/WebpageResources_de.properties new file mode 100644 index 000000000..d6161a978 --- /dev/null +++ b/ccm-webpage/src/com/arsdigita/cms/webpage/WebpageResources_de.properties @@ -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. diff --git a/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpageCMSEditorPage.java b/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpageCMSEditorPage.java index 7df540e0a..5628fe87f 100755 --- a/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpageCMSEditorPage.java +++ b/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpageCMSEditorPage.java @@ -51,6 +51,7 @@ import com.arsdigita.cms.ui.CMSDHTMLEditor; import com.arsdigita.cms.util.SecurityConstants; import com.arsdigita.cms.webpage.Webpage; import com.arsdigita.cms.webpage.WebpageConstants; +import com.arsdigita.cms.webpage.util.WebpageGlobalizationUtil; import com.arsdigita.cms.workflow.CMSTask; import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.kernel.User; @@ -336,7 +337,8 @@ public class WebpageCMSEditorPage extends CMSPage implements WebpageConstants { } } 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) { - throw new FormProcessException("ContentSection is null"); + throw new FormProcessException(WebpageGlobalizationUtil + .globalize("webpage.ui.contentsection_null")); } SecurityManager sm = new SecurityManager(section); User user = Web.getWebContext().getUser(); if (webpage != null) { 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)) { - 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.setName("webpage" + webpage.getID()); @@ -392,7 +397,8 @@ public class WebpageCMSEditorPage extends CMSPage implements WebpageConstants { webpage.save(); } else { 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.setLanguage("en"); diff --git a/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpagePortletEditor.java b/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpagePortletEditor.java index d0dc8e939..66292fa9f 100755 --- a/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpagePortletEditor.java +++ b/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpagePortletEditor.java @@ -30,7 +30,6 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.bebop.parameters.StringInRangeValidationListener; import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.portal.PortletConfigFormSection; -import com.arsdigita.categorization.Category; import com.arsdigita.categorization.CategoryCollection; import com.arsdigita.cms.ContentBundle; import com.arsdigita.cms.ContentSection; @@ -52,6 +51,7 @@ import com.arsdigita.util.Assert; import com.arsdigita.util.StringUtils; import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.web.Web; +import com.arsdigita.cms.webpage.util.WebpageGlobalizationUtil; import com.arsdigita.workflow.simple.Engine; import com.arsdigita.workflow.simple.Task; import com.arsdigita.workflow.simple.TaskCollection; @@ -166,7 +166,8 @@ public class WebpagePortletEditor extends PortletConfigFormSection { if (webpage == null) { ContentSection section = Initializer.getConfig().getWebpageSection(); 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) diff --git a/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpagePortletEditorPage.java b/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpagePortletEditorPage.java index 784d09442..4f8dd847d 100755 --- a/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpagePortletEditorPage.java +++ b/ccm-webpage/src/com/arsdigita/cms/webpage/ui/WebpagePortletEditorPage.java @@ -31,6 +31,7 @@ import com.arsdigita.cms.dispatcher.CMSPage; import com.arsdigita.cms.ui.CMSDHTMLEditor; import com.arsdigita.cms.webpage.Webpage; import com.arsdigita.cms.webpage.WebpageConstants; +import com.arsdigita.cms.webpage.util.WebpageGlobalizationUtil; // import com.arsdigita.cms.webpage.installer.Initializer; import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.kernel.User; @@ -194,7 +195,8 @@ public class WebpagePortletEditorPage extends CMSPage { private WebpagePortlet getWebpagePortlet(PageState ps) throws FormProcessException { String portletIDString = ps.getRequest().getParameter(PORTLET_ID); if (portletIDString == null) { - throw new FormProcessException("Illegal portlet ID: " + portletIDString); + throw new FormProcessException(WebpageGlobalizationUtil + .globalize("webpage.ui.illegal_portlet")); } BigDecimal portletID = new BigDecimal(portletIDString); @@ -204,14 +206,16 @@ public class WebpagePortletEditorPage extends CMSPage { protected WebpagePortlet getWebpagePortlet(PageState ps, BigDecimal portletID) throws FormProcessException { WebpagePortlet portlet = (WebpagePortlet) Portlet.retrievePortlet(portletID); 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(); PermissionDescriptor perm = new PermissionDescriptor(PrivilegeDescriptor.EDIT, portlet.getParentResource(), user); 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; } diff --git a/ccm-webpage/src/com/arsdigita/cms/webpage/util/WebpageGlobalizationUtil.java b/ccm-webpage/src/com/arsdigita/cms/webpage/util/WebpageGlobalizationUtil.java new file mode 100644 index 000000000..3ed2672de --- /dev/null +++ b/ccm-webpage/src/com/arsdigita/cms/webpage/util/WebpageGlobalizationUtil.java @@ -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; + +/** + *

+ * . + * Contains methods to simplify globalizing keys + *

+ * + * @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); + + } +}