Parameter com.arsdigita.cms.allow_category_create_use_context eingeführt, der den Link zu "Create Use Context" in content sections ausblendet.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1708 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2012-06-14 06:23:14 +00:00
parent 18455ff686
commit 5f507521fc
4 changed files with 57 additions and 53 deletions

View File

@ -40,23 +40,11 @@ import com.arsdigita.cms.ui.authoring.ItemCategoryExtension;
import com.arsdigita.cms.ui.authoring.ItemCategoryForm; import com.arsdigita.cms.ui.authoring.ItemCategoryForm;
import com.arsdigita.runtime.AbstractConfig; import com.arsdigita.runtime.AbstractConfig;
import com.arsdigita.util.StringUtils; import com.arsdigita.util.StringUtils;
import com.arsdigita.util.parameter.BooleanParameter; import com.arsdigita.util.parameter.*;
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 java.io.InputStream; import java.io.InputStream;
import java.util.Collection; import java.util.*;
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 org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
@ -102,7 +90,7 @@ public final class CMSConfig extends AbstractConfig {
*/ */
private static Map s_skipAssetSteps = null; 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 * the assign categories step. Used in
* c.ad.cms.ui.authoring.ItemCategoryStep * c.ad.cms.ui.authoring.ItemCategoryStep
*/ */
@ -438,6 +426,19 @@ public final class CMSConfig extends AbstractConfig {
"com.arsdigita.cms.category_tree_order", "com.arsdigita.cms.category_tree_order",
Parameter.OPTIONAL, Parameter.OPTIONAL,
Category.SORT_KEY); 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. * Allow content creation in Workspace (content center) section listing.
* Allows you to turn off the ability to create content in the section * 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 * Hide the legacy public site link in Workspace (content center) section
* listing. Legacy public site display is replaced by navigation based * 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. * default now.
*/ */
private final Parameter m_hideLegacyPublicSiteLink = private final Parameter m_hideLegacyPublicSiteLink =
@ -570,9 +571,6 @@ public final class CMSConfig extends AbstractConfig {
//Actives threaded publishing. If active, the publish process for //Actives threaded publishing. If active, the publish process for
//content items will run in a separate thread. May useful if you have //content items will run in a separate thread. May useful if you have
//large objects. //large objects.
//
//WARNING: Not tested very much. Use at your own risk.
//
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
private final Parameter m_threadPublishing = new BooleanParameter( private final Parameter m_threadPublishing = new BooleanParameter(
"com.arsdigita.cms.lifecycle.threaded_publishing", "com.arsdigita.cms.lifecycle.threaded_publishing",
@ -664,6 +662,7 @@ public final class CMSConfig extends AbstractConfig {
register(m_categoryTreeOrdering); register(m_categoryTreeOrdering);
register(m_hasContactsAuthoringStep); register(m_hasContactsAuthoringStep);
register(m_hideTextAssetUploadFile); register(m_hideTextAssetUploadFile);
register(m_allowCategoryCreateUseContext);
register(m_allowContentCreateInSectionListing); register(m_allowContentCreateInSectionListing);
register(m_hideLegacyPublicSiteLink); register(m_hideLegacyPublicSiteLink);
@ -1081,6 +1080,20 @@ public final class CMSConfig extends AbstractConfig {
return ((Boolean) get(m_hideTextAssetUploadFile)).booleanValue(); 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() { public final boolean getAllowContentCreateInSectionListing() {
return ((Boolean) get(m_allowContentCreateInSectionListing)). return ((Boolean) get(m_allowContentCreateInSectionListing)).
booleanValue(); booleanValue();

View File

@ -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.example=false
com.arsdigita.cms.hide_text_asset_upload_file.format=[boolean] 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.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.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 com.arsdigita.cms.allow_content_create_in_section_listing.example=true

View File

@ -20,11 +20,7 @@
package com.arsdigita.cms.contentsection; package com.arsdigita.cms.contentsection;
import com.arsdigita.runtime.AbstractConfig; import com.arsdigita.runtime.AbstractConfig;
import com.arsdigita.util.parameter.BooleanParameter; import com.arsdigita.util.parameter.*;
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 java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; 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()} * loaded using the next parameters file list {@see getUseSectionCategories()}
* *
* Default value is false, so standard navigation is used. * Default value is false, so standard navigation is used.

View File

@ -18,24 +18,8 @@
*/ */
package com.arsdigita.cms.ui.category; package com.arsdigita.cms.ui.category;
import com.arsdigita.bebop.ActionLink; import com.arsdigita.bebop.*;
import com.arsdigita.bebop.Form; import com.arsdigita.bebop.event.*;
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.parameters.ParameterModel; import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.categorization.CategorizedCollection; 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.ActionGroup;
import com.arsdigita.toolbox.ui.Section; import com.arsdigita.toolbox.ui.Section;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
@ -109,12 +91,15 @@ public final class CategoryAdminPane extends BaseAdminPane {
ActionGroup contextGroup = new ActionGroup(); ActionGroup contextGroup = new ActionGroup();
contextSection.setBody(contextGroup); contextSection.setBody(contextGroup);
contextGroup.setSubject(list); contextGroup.setSubject(list);
ActionLink addContextAction = new ActionLink(new Label(gz("cms.ui.category.add_use_context")));
Form addContextForm = new AddUseContextForm(m_contextModel); if (CMS.getConfig().getAllowCategoryCreateUseContext()) {
getBody().add(addContextForm); ActionLink addContextAction = new ActionLink(new Label(gz("cms.ui.category.add_use_context")));
getBody().connect(addContextAction,addContextForm); Form addContextForm = new AddUseContextForm(m_contextModel);
contextGroup.addAction(new VisibilityComponent(addContextAction, getBody().add(addContextForm);
SecurityManager.CATEGORY_ADMIN)); getBody().connect(addContextAction,addContextForm);
contextGroup.addAction(new VisibilityComponent(addContextAction,
SecurityManager.CATEGORY_ADMIN));
}
final Section categorySection = new Section(); final Section categorySection = new Section();
categorySection.setHeading(new Label(gz("cms.ui.categories"))); 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) { public void register(final Page page) {
super.register(page); super.register(page);
@ -166,6 +152,7 @@ public final class CategoryAdminPane extends BaseAdminPane {
m_alternativeLabel = new Label("Can't be deleted"); m_alternativeLabel = new Label("Can't be deleted");
} }
@Override
public void generateXML(PageState state, Element parent) { public void generateXML(PageState state, Element parent) {
if (!isVisible(state)) { return; } if (!isVisible(state)) { return; }
@ -250,6 +237,7 @@ public final class CategoryAdminPane extends BaseAdminPane {
} }
private final class SelectionRequestLocal extends CategoryRequestLocal { private final class SelectionRequestLocal extends CategoryRequestLocal {
@Override
protected final Object initialValue(final PageState state) { protected final Object initialValue(final PageState state) {
final String id = m_model.getSelectedKey(state).toString(); final String id = m_model.getSelectedKey(state).toString();
@ -262,6 +250,7 @@ public final class CategoryAdminPane extends BaseAdminPane {
} }
private final class ParentRequestLocal extends CategoryRequestLocal { private final class ParentRequestLocal extends CategoryRequestLocal {
@Override
protected final Object initialValue(final PageState state) { protected final Object initialValue(final PageState state) {
return m_category.getCategory(state).getDefaultParentCategory(); return m_category.getCategory(state).getDefaultParentCategory();
} }
@ -286,6 +275,7 @@ public final class CategoryAdminPane extends BaseAdminPane {
public UseContextSelectionModel(ParameterModel m) { public UseContextSelectionModel(ParameterModel m) {
super(m); super(m);
} }
@Override
public Object getSelectedKey(PageState state) { public Object getSelectedKey(PageState state) {
Object val = super.getSelectedKey(state); Object val = super.getSelectedKey(state);
if (val == null || ((String) val).length() == 0) { if (val == null || ((String) val).length() == 0) {