From 5f507521fc1a0c5d35380a588e1a1656aca4b4cb Mon Sep 17 00:00:00 2001 From: pb Date: Thu, 14 Jun 2012 06:23:14 +0000 Subject: [PATCH] =?UTF-8?q?Parameter=20com.arsdigita.cms.allow=5Fcategory?= =?UTF-8?q?=5Fcreate=5Fuse=5Fcontext=20eingef=C3=BChrt,=20der=20den=20Link?= =?UTF-8?q?=20zu=20"Create=20Use=20Context"=20in=20content=20sections=20au?= =?UTF-8?q?sblendet.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@1708 8810af33-2d31-482b-a856-94f89814c4df --- ccm-cms/src/com/arsdigita/cms/CMSConfig.java | 55 ++++++++++++------- .../cms/CMSConfig_parameter.properties | 5 ++ .../contentsection/ContentSectionConfig.java | 8 +-- .../cms/ui/category/CategoryAdminPane.java | 42 ++++++-------- 4 files changed, 57 insertions(+), 53 deletions(-) diff --git a/ccm-cms/src/com/arsdigita/cms/CMSConfig.java b/ccm-cms/src/com/arsdigita/cms/CMSConfig.java index 7da058806..99722323b 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSConfig.java +++ b/ccm-cms/src/com/arsdigita/cms/CMSConfig.java @@ -40,23 +40,11 @@ import com.arsdigita.cms.ui.authoring.ItemCategoryExtension; import com.arsdigita.cms.ui.authoring.ItemCategoryForm; import com.arsdigita.runtime.AbstractConfig; import com.arsdigita.util.StringUtils; -import com.arsdigita.util.parameter.BooleanParameter; -import com.arsdigita.util.parameter.EnumerationParameter; -import com.arsdigita.util.parameter.ErrorList; -import com.arsdigita.util.parameter.IntegerParameter; -import com.arsdigita.util.parameter.Parameter; -import com.arsdigita.util.parameter.ResourceParameter; -import com.arsdigita.util.parameter.SpecificClassParameter; -import com.arsdigita.util.parameter.StringArrayParameter; -import com.arsdigita.util.parameter.StringParameter; +import com.arsdigita.util.parameter.*; + import java.io.InputStream; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; +import java.util.*; + import org.apache.log4j.Logger; /** @@ -102,7 +90,7 @@ public final class CMSConfig extends AbstractConfig { */ private static Map s_skipAssetSteps = null; /** - * Item category add form speciofies Subclass of ItemCategoryForm to use for + * Item category add form specifies Subclass of ItemCategoryForm to use for * the assign categories step. Used in * c.ad.cms.ui.authoring.ItemCategoryStep */ @@ -438,6 +426,19 @@ public final class CMSConfig extends AbstractConfig { "com.arsdigita.cms.category_tree_order", Parameter.OPTIONAL, Category.SORT_KEY); + /** + * Allow creation of a new Use Context in category tab of content sections. + * "Use Context" is the construct to constitute a category hierarchy + * implementet in core. It is superseded by the construct "Category Domain" + * in Terms (ccm-ldn-terms). + * Global parameter for all content sections. Default is false because all + * installation bundles use Terms. + */ + private final Parameter m_allowCategoryCreateUseContext = + new BooleanParameter( + "com.arsdigita.cms.allow_category_create_use_context", + Parameter.REQUIRED, + Boolean.FALSE); /** * Allow content creation in Workspace (content center) section listing. * Allows you to turn off the ability to create content in the section @@ -451,7 +452,7 @@ public final class CMSConfig extends AbstractConfig { /** * Hide the legacy public site link in Workspace (content center) section * listing. Legacy public site display is replaced by navigation based - * presentation (or by portlets) and should be hidden in the admin ui be + * presentation (or by portlets) and should be hidden in the admin ui by * default now. */ private final Parameter m_hideLegacyPublicSiteLink = @@ -570,9 +571,6 @@ public final class CMSConfig extends AbstractConfig { //Actives threaded publishing. If active, the publish process for //content items will run in a separate thread. May useful if you have //large objects. - // - //WARNING: Not tested very much. Use at your own risk. - // //////////////////////////////////////////////////// private final Parameter m_threadPublishing = new BooleanParameter( "com.arsdigita.cms.lifecycle.threaded_publishing", @@ -664,6 +662,7 @@ public final class CMSConfig extends AbstractConfig { register(m_categoryTreeOrdering); register(m_hasContactsAuthoringStep); register(m_hideTextAssetUploadFile); + register(m_allowCategoryCreateUseContext); register(m_allowContentCreateInSectionListing); register(m_hideLegacyPublicSiteLink); @@ -1081,6 +1080,20 @@ public final class CMSConfig extends AbstractConfig { return ((Boolean) get(m_hideTextAssetUploadFile)).booleanValue(); } + /** + * Retrieve whether to allow creation of a new Use Context in category tab + * of content sections. "Use Context" is used to constitute a category + * hierarchy in core. It is superseded by the construct "Category Domain" + * in Terms (ccm-ldn-terms). + * Global parameter for all content sections. Default is false because all + * installation bundles use Terms. + * @return TRUE if creation is allowed, otherwise FALSE (default) + */ + public final boolean getAllowCategoryCreateUseContext() { + return ((Boolean) get(m_allowCategoryCreateUseContext)). + booleanValue(); + } + public final boolean getAllowContentCreateInSectionListing() { return ((Boolean) get(m_allowContentCreateInSectionListing)). booleanValue(); diff --git a/ccm-cms/src/com/arsdigita/cms/CMSConfig_parameter.properties b/ccm-cms/src/com/arsdigita/cms/CMSConfig_parameter.properties index 045ba11c5..f5511cc25 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSConfig_parameter.properties +++ b/ccm-cms/src/com/arsdigita/cms/CMSConfig_parameter.properties @@ -229,6 +229,11 @@ com.arsdigita.cms.hide_text_asset_upload_file.purpose=Hide the upload file link com.arsdigita.cms.hide_text_asset_upload_file.example=false com.arsdigita.cms.hide_text_asset_upload_file.format=[boolean] +com.arsdigita.cms.allow_category_create_use_context.title=Allow Use Context creation in content sections +com.arsdigita.cms.allow_category_create_use_context.purpose=In Categories tab show the option to create a new Use Context. False by default because Terms should be used. +com.arsdigita.cms.allow_category_create_use_context.example=false +com.arsdigita.cms.allow_category_create_use_context.format=[boolean] + com.arsdigita.cms.allow_content_create_in_section_listing.title=Allow content creation in section listing com.arsdigita.cms.allow_content_create_in_section_listing.purpose=Allows you to turn off the ability to create content in the section listing com.arsdigita.cms.allow_content_create_in_section_listing.example=true diff --git a/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionConfig.java b/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionConfig.java index 844269326..7e4de4db9 100644 --- a/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionConfig.java +++ b/ccm-cms/src/com/arsdigita/cms/contentsection/ContentSectionConfig.java @@ -20,11 +20,7 @@ package com.arsdigita.cms.contentsection; import com.arsdigita.runtime.AbstractConfig; -import com.arsdigita.util.parameter.BooleanParameter; -import com.arsdigita.util.parameter.IntegerParameter; -import com.arsdigita.util.parameter.Parameter; -import com.arsdigita.util.parameter.StringArrayParameter; -import com.arsdigita.util.parameter.StringParameter; +import com.arsdigita.util.parameter.*; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -671,7 +667,7 @@ public final class ContentSectionConfig extends AbstractConfig { /** - * Retrieve weather to use section specific categories. If true they are + * Retrieve whether to use section specific categories. If true they are * loaded using the next parameters file list {@see getUseSectionCategories()} * * Default value is false, so standard navigation is used. diff --git a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryAdminPane.java b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryAdminPane.java index 9d0ba457b..c7ccd1b9c 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryAdminPane.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryAdminPane.java @@ -18,24 +18,8 @@ */ package com.arsdigita.cms.ui.category; -import com.arsdigita.bebop.ActionLink; -import com.arsdigita.bebop.Form; -import com.arsdigita.bebop.FormProcessException; -import com.arsdigita.bebop.Label; -import com.arsdigita.bebop.List; -import com.arsdigita.bebop.Page; -import com.arsdigita.bebop.PageState; -import com.arsdigita.bebop.ParameterSingleSelectionModel; -import com.arsdigita.bebop.SimpleContainer; -import com.arsdigita.bebop.SingleSelectionModel; -import com.arsdigita.bebop.Tree; -import com.arsdigita.bebop.event.ActionEvent; -import com.arsdigita.bebop.event.ActionListener; -import com.arsdigita.bebop.event.ChangeEvent; -import com.arsdigita.bebop.event.ChangeListener; -import com.arsdigita.bebop.event.FormSectionEvent; -import com.arsdigita.bebop.event.PrintEvent; -import com.arsdigita.bebop.event.PrintListener; +import com.arsdigita.bebop.*; +import com.arsdigita.bebop.event.*; import com.arsdigita.bebop.parameters.ParameterModel; import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.categorization.CategorizedCollection; @@ -54,9 +38,7 @@ import com.arsdigita.kernel.permissions.PrivilegeDescriptor; import com.arsdigita.toolbox.ui.ActionGroup; import com.arsdigita.toolbox.ui.Section; import com.arsdigita.xml.Element; - import java.math.BigDecimal; - import org.apache.log4j.Logger; /** @@ -109,12 +91,15 @@ public final class CategoryAdminPane extends BaseAdminPane { ActionGroup contextGroup = new ActionGroup(); contextSection.setBody(contextGroup); contextGroup.setSubject(list); - ActionLink addContextAction = new ActionLink(new Label(gz("cms.ui.category.add_use_context"))); - Form addContextForm = new AddUseContextForm(m_contextModel); - getBody().add(addContextForm); - getBody().connect(addContextAction,addContextForm); - contextGroup.addAction(new VisibilityComponent(addContextAction, - SecurityManager.CATEGORY_ADMIN)); + + if (CMS.getConfig().getAllowCategoryCreateUseContext()) { + ActionLink addContextAction = new ActionLink(new Label(gz("cms.ui.category.add_use_context"))); + Form addContextForm = new AddUseContextForm(m_contextModel); + getBody().add(addContextForm); + getBody().connect(addContextAction,addContextForm); + contextGroup.addAction(new VisibilityComponent(addContextAction, + SecurityManager.CATEGORY_ADMIN)); + } final Section categorySection = new Section(); categorySection.setHeading(new Label(gz("cms.ui.categories"))); @@ -152,6 +137,7 @@ public final class CategoryAdminPane extends BaseAdminPane { } + @Override public void register(final Page page) { super.register(page); @@ -166,6 +152,7 @@ public final class CategoryAdminPane extends BaseAdminPane { m_alternativeLabel = new Label("Can't be deleted"); } + @Override public void generateXML(PageState state, Element parent) { if (!isVisible(state)) { return; } @@ -250,6 +237,7 @@ public final class CategoryAdminPane extends BaseAdminPane { } private final class SelectionRequestLocal extends CategoryRequestLocal { + @Override protected final Object initialValue(final PageState state) { final String id = m_model.getSelectedKey(state).toString(); @@ -262,6 +250,7 @@ public final class CategoryAdminPane extends BaseAdminPane { } private final class ParentRequestLocal extends CategoryRequestLocal { + @Override protected final Object initialValue(final PageState state) { return m_category.getCategory(state).getDefaultParentCategory(); } @@ -286,6 +275,7 @@ public final class CategoryAdminPane extends BaseAdminPane { public UseContextSelectionModel(ParameterModel m) { super(m); } + @Override public Object getSelectedKey(PageState state) { Object val = super.getSelectedKey(state); if (val == null || ((String) val).length() == 0) {