- The list of content types on the NewItemForm is now sorted by the localised
names of the content types - The length of the description of (releated) link is now limited. The limit can be configured using the com.arsdigita.cms.link_description_max_length property in CMSConfig. The default value are 400 characters. git-svn-id: https://svn.libreccm.org/ccm/trunk@2769 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
725f60d768
commit
9b70cf8018
|
|
@ -42,12 +42,11 @@ import com.arsdigita.util.Assert;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Form to edit the basic properties of a RelatedLink. This form
|
||||
* extends LinkPropertyForm in order to create items of the correct
|
||||
* subclass and set the linkOwner property. Users have found the additional
|
||||
* fields confusing at authoring time (resourceSize and resourceType) so we
|
||||
* have added a configuration parameter that allows us to hide them on a
|
||||
* site wide basis.
|
||||
* Form to edit the basic properties of a RelatedLink. This form extends LinkPropertyForm in order
|
||||
* to create items of the correct subclass and set the linkOwner property. Users have found the
|
||||
* additional fields confusing at authoring time (resourceSize and resourceType) so we have added a
|
||||
* configuration parameter that allows us to hide them on a site wide basis.
|
||||
*
|
||||
* @version $Revision: #3 $ $Date: 2004/03/30 $
|
||||
* @author Scott Seago (sseago@redhat.com)
|
||||
*/
|
||||
|
|
@ -55,21 +54,19 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
|||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
RelatedLinkPropertyForm.class);
|
||||
private static boolean isHideNewTargetWindow =
|
||||
RelatedLinkConfig.getInstance()
|
||||
private static boolean isHideNewTargetWindow = RelatedLinkConfig.getInstance()
|
||||
.isHideNewTargetWindow();
|
||||
private static boolean isHideAdditionalResourceFields =
|
||||
RelatedLinkConfig.getInstance()
|
||||
private static boolean isHideAdditionalResourceFields = RelatedLinkConfig.getInstance()
|
||||
.isHideAdditionalResourceFields();
|
||||
private String m_linkListName;
|
||||
|
||||
/**
|
||||
* Creates a new form to edit the RelatedLink object specified
|
||||
* by the item selection model passed in.
|
||||
* @param itemModel The ItemSelectionModel to use to obtain the
|
||||
* ContentItem to which this link is (or will be) attached
|
||||
* @param link The LinkSelectionModel to use to obtain the
|
||||
* Link to work on
|
||||
* Creates a new form to edit the RelatedLink object specified by the item selection model
|
||||
* passed in.
|
||||
*
|
||||
* @param itemModel The ItemSelectionModel to use to obtain the ContentItem to which this link
|
||||
* is (or will be) attached
|
||||
* @param link The LinkSelectionModel to use to obtain the Link to work on
|
||||
*/
|
||||
public RelatedLinkPropertyForm(ItemSelectionModel itemModel,
|
||||
LinkSelectionModel link, String linkListName) {
|
||||
|
|
@ -78,7 +75,8 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
|||
}
|
||||
|
||||
public RelatedLinkPropertyForm(ItemSelectionModel itemModel,
|
||||
LinkSelectionModel link, String linkListName, ContentType contentType) {
|
||||
LinkSelectionModel link, String linkListName,
|
||||
ContentType contentType) {
|
||||
|
||||
super(itemModel, link, contentType);
|
||||
logger.debug(String.format("linkListName = %s", linkListName));
|
||||
|
|
@ -111,14 +109,12 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
|||
} else {
|
||||
add(new Label(RelatedLinkGlobalizationUtil.globalize(
|
||||
"cms.contentassets.ui.related_link.resource_size")));
|
||||
TextField resSize = new TextField(new
|
||||
StringParameter(RelatedLink.RESOURCE_SIZE));
|
||||
TextField resSize = new TextField(new StringParameter(RelatedLink.RESOURCE_SIZE));
|
||||
add(resSize);
|
||||
|
||||
add(new Label(RelatedLinkGlobalizationUtil.globalize(
|
||||
"cms.contentassets.ui.related_link.resource_type")));
|
||||
SingleSelect resType = new SingleSelect(new
|
||||
StringParameter(RelatedLink.RESOURCE_TYPE));
|
||||
SingleSelect resType = new SingleSelect(new StringParameter(RelatedLink.RESOURCE_TYPE));
|
||||
addMimeOptions(resType);
|
||||
add(resType);
|
||||
}
|
||||
|
|
@ -129,8 +125,8 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add mime-type options to the option group by loading all mime
|
||||
* types which match a certain prefix from the database
|
||||
* Add mime-type options to the option group by loading all mime types which match a certain
|
||||
* prefix from the database
|
||||
*
|
||||
* @param w The mime type widget to which options should be added
|
||||
*
|
||||
|
|
@ -145,10 +141,11 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
|||
}
|
||||
|
||||
/**
|
||||
* Take care of basic RelatedLink creation steps. Creates the
|
||||
* RelatedLink and sets the linkOwner property.
|
||||
* Take care of basic RelatedLink creation steps. Creates the RelatedLink and sets the linkOwner
|
||||
* property.
|
||||
*
|
||||
* @param s the PageState
|
||||
*
|
||||
* @return the newly-created RelatedLink
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -166,8 +163,8 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
|||
}
|
||||
|
||||
/**
|
||||
* Over-ride super class method to initialize addtional fields specific
|
||||
* to <code>RelatedLink</code> content asset.
|
||||
* Over-ride super class method to initialize addtional fields specific to
|
||||
* <code>RelatedLink</code> content asset.
|
||||
*/
|
||||
@Override
|
||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||
|
|
@ -197,8 +194,7 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
|||
}
|
||||
|
||||
/**
|
||||
* over-ride super class method to set extended properties for
|
||||
* <code>RelatedLink</code>.
|
||||
* over-ride super class method to set extended properties for <code>RelatedLink</code>.
|
||||
*/
|
||||
@Override
|
||||
protected void setLinkProperties(Link link, FormSectionEvent fse) {
|
||||
|
|
@ -223,4 +219,5 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
|||
|
||||
super.setLinkProperties(link, fse);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@ import org.apache.log4j.Logger;
|
|||
/**
|
||||
* A record containing server-session scoped configuration properties.
|
||||
*
|
||||
* Accessors of this class may return null. Developers should take care to trap
|
||||
* null return values in their code.
|
||||
* Accessors of this class may return null. Developers should take care to trap null return values
|
||||
* in their code.
|
||||
*
|
||||
* @see ContentSection#getConfig()
|
||||
*
|
||||
|
|
@ -71,8 +71,7 @@ public final class CMSConfig extends AbstractConfig {
|
|||
private static CMSConfig s_config;
|
||||
|
||||
/**
|
||||
* Returns the singleton configuration record for the content section
|
||||
* environment.
|
||||
* Returns the singleton configuration record for the content section environment.
|
||||
*
|
||||
* @return The <code>CMSConfig</code> record; it cannot be null
|
||||
*/
|
||||
|
|
@ -84,47 +83,40 @@ public final class CMSConfig extends AbstractConfig {
|
|||
|
||||
return s_config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Storage (map) for method getAssetStepsToSkip(ContentType type) to
|
||||
* store mapping of steps that are deemed irrelevant for the passid in
|
||||
* type.
|
||||
* Storage (map) for method getAssetStepsToSkip(ContentType type) to store mapping of steps that
|
||||
* are deemed irrelevant for the passid in type.
|
||||
*/
|
||||
private static Map s_skipAssetSteps = null;
|
||||
/**
|
||||
* Item category add form specifies Subclass of ItemCategoryForm to use
|
||||
* for the assign categories step. Used in
|
||||
* c.ad.cms.ui.authoring.ItemCategoryStep
|
||||
* Item category add form specifies Subclass of ItemCategoryForm to use for the assign
|
||||
* categories step. Used in c.ad.cms.ui.authoring.ItemCategoryStep
|
||||
*/
|
||||
private final Parameter m_categoryAuthoringAddForm =
|
||||
new SpecificClassParameter(
|
||||
private final Parameter m_categoryAuthoringAddForm = new SpecificClassParameter(
|
||||
"com.arsdigita.cms.category_authoring_add_form",
|
||||
Parameter.REQUIRED,
|
||||
ItemCategoryForm.class,
|
||||
SimpleComponent.class);
|
||||
/**
|
||||
* Path for the default item template. Path is relative to the Template
|
||||
* Root path.
|
||||
* Path for the default item template. Path is relative to the Template Root path.
|
||||
*/
|
||||
private final Parameter m_defaultItemTemplatePath =
|
||||
new StringParameter(
|
||||
private final Parameter m_defaultItemTemplatePath = new StringParameter(
|
||||
"com.arsdigita.cms.default_item_template_path",
|
||||
Parameter.REQUIRED,
|
||||
"/default/item.jsp");
|
||||
/**
|
||||
* Path for the default folder template. Path is relative to the
|
||||
* Template Root path.
|
||||
* Path for the default folder template. Path is relative to the Template Root path.
|
||||
*/
|
||||
private final Parameter m_defaultFolderTemplatePath =
|
||||
new StringParameter(
|
||||
private final Parameter m_defaultFolderTemplatePath = new StringParameter(
|
||||
"com.arsdigita.cms.default_folder_template_path",
|
||||
Parameter.REQUIRED,
|
||||
"/default/folder.jsp");
|
||||
/**
|
||||
* Path or the root folter for template folders. Path is relative to
|
||||
* webapp root. Modify with care! Usually modified by developers only!
|
||||
* Path or the root folter for template folders. Path is relative to webapp root. Modify with
|
||||
* care! Usually modified by developers only!
|
||||
*/
|
||||
private final Parameter m_templateRootPath =
|
||||
new StringParameter(
|
||||
private final Parameter m_templateRootPath = new StringParameter(
|
||||
"com.arsdigita.cms.template_root_path",
|
||||
Parameter.REQUIRED,
|
||||
"/templates/ccm-cms/content-section");
|
||||
|
|
@ -142,29 +134,27 @@ public final class CMSConfig extends AbstractConfig {
|
|||
// }
|
||||
// ADD:
|
||||
/**
|
||||
* Item Adapters File, path to an XML resource containing adapter
|
||||
* specifications. Path is relative to webapp root.
|
||||
* Item Adapters File, path to an XML resource containing adapter specifications. Path is
|
||||
* relative to webapp root.
|
||||
*/
|
||||
private final Parameter m_itemAdapters =
|
||||
new ResourceParameter(
|
||||
private final Parameter m_itemAdapters = new ResourceParameter(
|
||||
"com.arsdigita.cms.item_adapters",
|
||||
Parameter.REQUIRED,
|
||||
"/WEB-INF/resources/cms-item-adapters.xml");
|
||||
// URL resource: protocol handler removal: END
|
||||
/**
|
||||
* Use streamlined content creation: upon item creation, automatically
|
||||
* open authoring steps and forward to the next step
|
||||
* Use streamlined content creation: upon item creation, automatically open authoring steps and
|
||||
* forward to the next step
|
||||
*/
|
||||
private final Parameter m_useStreamlinedCreation = new BooleanParameter(
|
||||
"com.arsdigita.cms.use_streamlined_creation",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
/**
|
||||
* DHTML Editor Configuration for use in CMS module, lists the config
|
||||
* object name and Javascript source location for its definition.
|
||||
* DHTML Editor Configuration for use in CMS module, lists the config object name and Javascript
|
||||
* source location for its definition.
|
||||
*/
|
||||
private final Parameter m_dhtmlEditorConfig =
|
||||
new DHTMLEditorConfigParameter(
|
||||
private final Parameter m_dhtmlEditorConfig = new DHTMLEditorConfigParameter(
|
||||
"com.arsdigita.cms.dhtml_editor_config",
|
||||
Parameter.REQUIRED,
|
||||
new DHTMLEditor.Config("Xinha.Config",
|
||||
|
|
@ -180,19 +170,17 @@ public final class CMSConfig extends AbstractConfig {
|
|||
// be accessable by other modules which use DHTMLeditor.
|
||||
// Would be bad style to configure a cms specific parameter in core.
|
||||
/**
|
||||
* Defines which plugins to use, e.g.TableOperations,CSS Format:
|
||||
* [string,string,string]
|
||||
* Defines which plugins to use, e.g.TableOperations,CSS Format: [string,string,string]
|
||||
*/
|
||||
private final Parameter m_dhtmlEditorPlugins = new StringArrayParameter(
|
||||
"com.arsdigita.cms.dhtml_editor_plugins",
|
||||
Parameter.OPTIONAL,
|
||||
null);
|
||||
/**
|
||||
* Prevent undesirable functions from being made available, eg images
|
||||
* should only be added through the cms methods.
|
||||
* Prevent undesirable functions from being made available, eg images should only be added
|
||||
* through the cms methods.
|
||||
*/
|
||||
private final Parameter m_dhtmlEditorHiddenButtons =
|
||||
new StringArrayParameter(
|
||||
private final Parameter m_dhtmlEditorHiddenButtons = new StringArrayParameter(
|
||||
"com.arsdigita.cms.dhtml_editor_hidden_buttons",
|
||||
Parameter.OPTIONAL,
|
||||
null);
|
||||
|
|
@ -239,8 +227,8 @@ public final class CMSConfig extends AbstractConfig {
|
|||
Parameter.REQUIRED,
|
||||
Boolean.FALSE);
|
||||
/**
|
||||
* Hide timezone labels (if, for example, all users will be in the same
|
||||
* timezone and such information would be unnecessary)
|
||||
* Hide timezone labels (if, for example, all users will be in the same timezone and such
|
||||
* information would be unnecessary)
|
||||
*/
|
||||
private final Parameter m_hideTimezone = new BooleanParameter(
|
||||
"com.arsdigita.cms.hide_timezone",
|
||||
|
|
@ -256,47 +244,41 @@ public final class CMSConfig extends AbstractConfig {
|
|||
/**
|
||||
* Specifies the name of the class to use as a PublishLifecycleListener
|
||||
*/
|
||||
private final Parameter m_publishLifecycleListenerClass =
|
||||
new StringParameter(
|
||||
private final Parameter m_publishLifecycleListenerClass = new StringParameter(
|
||||
"com.arsdigita.cms.publish_lifecycle_listener_class",
|
||||
Parameter.OPTIONAL,
|
||||
PublishLifecycleListener.class.getName());
|
||||
/**
|
||||
* Wether the Wysiwyg editor should clear the text of MSWord tags,
|
||||
* everytime the user clicks on 'Save'
|
||||
* Wether the Wysiwyg editor should clear the text of MSWord tags, everytime the user clicks on
|
||||
* 'Save'
|
||||
*/
|
||||
private final Parameter m_saveTextCleansWordTags = new BooleanParameter(
|
||||
"com.arsdigita.cms.save_text_cleans_word_tags",
|
||||
Parameter.OPTIONAL,
|
||||
Boolean.FALSE);
|
||||
/**
|
||||
* Get the search indexing not to process FileAssets, eg to avoid PDF
|
||||
* slowdowns
|
||||
* Get the search indexing not to process FileAssets, eg to avoid PDF slowdowns
|
||||
*/
|
||||
private final Parameter m_disableFileAssetExtraction = new BooleanParameter(
|
||||
"com.arsdigita.cms.search.disableFileAssetExtraction",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.FALSE);
|
||||
/**
|
||||
* Whether an item's workflow should be deleted, once the item has been
|
||||
* (re)published
|
||||
* Whether an item's workflow should be deleted, once the item has been (re)published
|
||||
*/
|
||||
private final Parameter m_deleteWorkflowAfterPublication =
|
||||
new BooleanParameter(
|
||||
private final Parameter m_deleteWorkflowAfterPublication = new BooleanParameter(
|
||||
"com.arsdigita.cms.delete_workflow_after_publication",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
/**
|
||||
* Defines the number of days ahead that are covered in the 'Soon
|
||||
* Expired' tab
|
||||
* Defines the number of days ahead that are covered in the 'Soon Expired' tab
|
||||
*/
|
||||
private final Parameter m_soonExpiredTimespanDays = new IntegerParameter(
|
||||
"com.arsdigita.cms.soon_expired_timespan_days",
|
||||
Parameter.REQUIRED,
|
||||
new Integer(14));
|
||||
/**
|
||||
* Defines the number of months ahead that are covered in the 'Soon
|
||||
* Expired' tab
|
||||
* Defines the number of months ahead that are covered in the 'Soon Expired' tab
|
||||
*/
|
||||
private final Parameter m_soonExpiredTimespanMonths = new IntegerParameter(
|
||||
"com.arsdigita.cms.soon_expired_timespan_months",
|
||||
|
|
@ -310,146 +292,126 @@ public final class CMSConfig extends AbstractConfig {
|
|||
Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
/**
|
||||
* Links created through browse interfaces should only be within the
|
||||
* same subsite
|
||||
* Links created through browse interfaces should only be within the same subsite
|
||||
*/
|
||||
private final Parameter m_linksOnlyInSameSubsite = new BooleanParameter(
|
||||
"com.arsdigita.cms.browse_links_in_same_subsite_only",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.FALSE);
|
||||
/**
|
||||
* Item category step extension hook: Subclass of ItemCategoryExtension
|
||||
* which adds extension actions for the category authoring step
|
||||
* Item category step extension hook: Subclass of ItemCategoryExtension which adds extension
|
||||
* actions for the category authoring step
|
||||
*/
|
||||
private final Parameter m_categoryAuthoringExtension =
|
||||
new SpecificClassParameter(
|
||||
private final Parameter m_categoryAuthoringExtension = new SpecificClassParameter(
|
||||
"com.arsdigita.cms.category_authoring_extension",
|
||||
Parameter.REQUIRED,
|
||||
ItemCategoryExtension.class,
|
||||
ItemCategoryExtension.class);
|
||||
/**
|
||||
* Link available to reset lifecycle on republish. If false don't
|
||||
* display the link otherwise display.
|
||||
* Link available to reset lifecycle on republish. If false don't display the link otherwise
|
||||
* display.
|
||||
*/
|
||||
private final Parameter m_hideResetLifecycleLink = new BooleanParameter(
|
||||
"com.arsdigita.cms.hide_reset_lifecycle_link",
|
||||
Parameter.OPTIONAL,
|
||||
Boolean.TRUE);
|
||||
/**
|
||||
* Whether to include INPATH operators to contains clause in intermedia
|
||||
* search
|
||||
* Whether to include INPATH operators to contains clause in intermedia search
|
||||
*/
|
||||
private final Parameter m_scoreTitleAndKeywords =
|
||||
new BooleanParameter(
|
||||
private final Parameter m_scoreTitleAndKeywords = new BooleanParameter(
|
||||
"com.arsdigita.cms.search.score_title_and_keywords",
|
||||
Parameter.OPTIONAL,
|
||||
Boolean.FALSE);
|
||||
/**
|
||||
* Title Weight, the relative weight given to title element within
|
||||
* cms:item when ranking search results (only used by interMedia)
|
||||
* Title Weight, the relative weight given to title element within cms:item when ranking search
|
||||
* results (only used by interMedia)
|
||||
*/
|
||||
private final Parameter m_titleWeight = new IntegerParameter(
|
||||
"com.arsdigita.cms.search.intermedia.title_weight",
|
||||
Parameter.OPTIONAL,
|
||||
new Integer(1));
|
||||
/**
|
||||
* Keyword Weight, the relative weight given to the dcKeywords element
|
||||
* within dublinCore element within cms:item element when ranking search
|
||||
* results (only used by interMedia)
|
||||
* Keyword Weight, the relative weight given to the dcKeywords element within dublinCore element
|
||||
* within cms:item element when ranking search results (only used by interMedia)
|
||||
*/
|
||||
private final Parameter m_keywordWeight =
|
||||
new IntegerParameter(
|
||||
private final Parameter m_keywordWeight = new IntegerParameter(
|
||||
"com.arsdigita.cms.search.intermedia.keyword_weight",
|
||||
Parameter.OPTIONAL,
|
||||
new Integer(1));
|
||||
/**
|
||||
* Limit the item search to current content section
|
||||
*/
|
||||
private final Parameter m_limitToContentSection =
|
||||
new BooleanParameter(
|
||||
private final Parameter m_limitToContentSection = new BooleanParameter(
|
||||
"com.arsdigita.cms.search.limitToContentSection",
|
||||
Parameter.OPTIONAL,
|
||||
Boolean.TRUE);
|
||||
/**
|
||||
* Asset steps to skip, specify asset steps that are not relevant for
|
||||
* specific content types. Each entry in the list is a : separated pair.
|
||||
* The first string is the className for the type (refer to classname
|
||||
* column in contenttypes table eg
|
||||
* com.arsdigita.cms.contenttypes.MultiPartArticle Second string is the
|
||||
* name of the bebop step component eg
|
||||
* com.arsdigita.cms.contenttypes.ui.ImageStep
|
||||
* Asset steps to skip, specify asset steps that are not relevant for specific content types.
|
||||
* Each entry in the list is a : separated pair. The first string is the className for the type
|
||||
* (refer to classname column in contenttypes table eg
|
||||
* com.arsdigita.cms.contenttypes.MultiPartArticle Second string is the name of the bebop step
|
||||
* component eg com.arsdigita.cms.contenttypes.ui.ImageStep
|
||||
*/
|
||||
private final Parameter m_skipAssetSteps = new StringArrayParameter(
|
||||
"com.arsdigita.cms.skip_asset_steps",
|
||||
Parameter.OPTIONAL,
|
||||
null);
|
||||
/**
|
||||
* Mandatory Descriptions Content types may refer to this to decide
|
||||
* whether to validate against empty descriptions
|
||||
* Mandatory Descriptions Content types may refer to this to decide whether to validate against
|
||||
* empty descriptions
|
||||
*/
|
||||
private final Parameter m_mandatoryDescriptions = new BooleanParameter(
|
||||
"com.arsdigita.cms.mandatory_descriptions",
|
||||
Parameter.OPTIONAL,
|
||||
Boolean.FALSE);
|
||||
/**
|
||||
* Delete Finished Lifecycles. Decide whether lifecycles and their
|
||||
* phases should be deleted from the system when finished.
|
||||
* Delete Finished Lifecycles. Decide whether lifecycles and their phases should be deleted from
|
||||
* the system when finished.
|
||||
*/
|
||||
private final Parameter m_deleteLifecycleWhenComplete =
|
||||
new BooleanParameter(
|
||||
private final Parameter m_deleteLifecycleWhenComplete = new BooleanParameter(
|
||||
"com.arsdigita.cms.delete_lifecycle_when_complete",
|
||||
Parameter.OPTIONAL,
|
||||
Boolean.FALSE);
|
||||
/**
|
||||
* Contacts for content items. Allows you to add a Contact authoring
|
||||
* step to all items
|
||||
* Contacts for content items. Allows you to add a Contact authoring step to all items
|
||||
*/
|
||||
private final Parameter m_hasContactsAuthoringStep = new BooleanParameter(
|
||||
"com.arsdigita.cms.has_contacts_authoring_step",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.FALSE);
|
||||
/**
|
||||
* Ordering for nodes in assign category tree. Decide whether entries
|
||||
* should be ordered alphabetically or according to sort key (maintained
|
||||
* in category admin tab in content centre) SortKey|Alphabetical is
|
||||
* initialized in constructor! See below.
|
||||
* Ordering for nodes in assign category tree. Decide whether entries should be ordered
|
||||
* alphabetically or according to sort key (maintained in category admin tab in content centre)
|
||||
* SortKey|Alphabetical is initialized in constructor! See below.
|
||||
*/
|
||||
private final Parameter m_categoryTreeOrdering =
|
||||
new EnumerationParameter(
|
||||
private final Parameter m_categoryTreeOrdering = new EnumerationParameter(
|
||||
"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.
|
||||
* 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(
|
||||
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
|
||||
* listing
|
||||
* Allow content creation in Workspace (content center) section listing. Allows you to turn off
|
||||
* the ability to create content in the section listing
|
||||
*/
|
||||
private final Parameter m_allowContentCreateInSectionListing =
|
||||
new BooleanParameter(
|
||||
private final Parameter m_allowContentCreateInSectionListing = new BooleanParameter(
|
||||
"com.arsdigita.cms.allow_content_create_in_section_listing",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
/**
|
||||
* 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 by default now.
|
||||
* 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 by default now.
|
||||
*/
|
||||
private final Parameter m_hideLegacyPublicSiteLink =
|
||||
new BooleanParameter(
|
||||
private final Parameter m_hideLegacyPublicSiteLink = new BooleanParameter(
|
||||
"com.arsdigita.cms.hide_legacy_public_site_link",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
|
|
@ -457,34 +419,31 @@ public final class CMSConfig extends AbstractConfig {
|
|||
// Notification related parameters
|
||||
// ///////////////////////////////////////////
|
||||
/**
|
||||
* Delete Sent Workflow Notifications. Decide whether successfully sent
|
||||
* notifications and messages should be deleted from the system
|
||||
* Delete Sent Workflow Notifications. Decide whether successfully sent notifications and
|
||||
* messages should be deleted from the system
|
||||
*/
|
||||
private final Parameter m_deleteWorkflowNotificationsWhenSent =
|
||||
new BooleanParameter(
|
||||
private final Parameter m_deleteWorkflowNotificationsWhenSent = new BooleanParameter(
|
||||
"com.arsdigita.cms.delete_workflow_notification_when_sent",
|
||||
Parameter.OPTIONAL,
|
||||
Boolean.FALSE);
|
||||
/**
|
||||
* Decide whether successfully sent notifications and messages should be
|
||||
* deleted from the system
|
||||
* Decide whether successfully sent notifications and messages should be deleted from the system
|
||||
*/
|
||||
private final Parameter m_deleteExpiryNotificationsWhenSent =
|
||||
new BooleanParameter(
|
||||
private final Parameter m_deleteExpiryNotificationsWhenSent = new BooleanParameter(
|
||||
"com.arsdigita.cms.delete_expiry_notification_when_sent",
|
||||
Parameter.OPTIONAL,
|
||||
Boolean.FALSE);
|
||||
/**
|
||||
* Amount of time (in hours) before the expiration of a content item
|
||||
* that users in the Alert Recipient role are alerted via email
|
||||
* Amount of time (in hours) before the expiration of a content item that users in the Alert
|
||||
* Recipient role are alerted via email
|
||||
*/
|
||||
private final Parameter m_defaultNotificationTime = new IntegerParameter(
|
||||
"com.arsdigita.cms.default_notification_time",
|
||||
Parameter.REQUIRED,
|
||||
new Integer(0));
|
||||
/**
|
||||
* Wether a content item's author should be notified by the item's
|
||||
* LifecycleListener; defaults to true
|
||||
* Wether a content item's author should be notified by the item's LifecycleListener; defaults
|
||||
* to true
|
||||
*/
|
||||
private final Parameter m_notifyAuthorOnLifecycle = new BooleanParameter(
|
||||
"com.arsdigita.cms.notify_author_on_lifecycle",
|
||||
|
|
@ -494,8 +453,7 @@ public final class CMSConfig extends AbstractConfig {
|
|||
// Content Center (Workspace) config related parameters
|
||||
// ////////////////////////////////////////////////////
|
||||
/**
|
||||
* XML Mapping of the content center tabs to URLs, see
|
||||
* {@link ContentCenterDispatcher}
|
||||
* XML Mapping of the content center tabs to URLs, see {@link ContentCenterDispatcher}
|
||||
*/
|
||||
private final StringParameter m_contentCenterMap = new StringParameter(
|
||||
"com.arsdigita.cms.loader.content_center_map",
|
||||
|
|
@ -517,14 +475,12 @@ public final class CMSConfig extends AbstractConfig {
|
|||
// to SectionInitializer. However, it still may be useful to
|
||||
// keep these for the default values.
|
||||
// ///////////////////////////////////////////
|
||||
private final Parameter m_defaultItemResolverClass =
|
||||
new SpecificClassParameter(
|
||||
private final Parameter m_defaultItemResolverClass = new SpecificClassParameter(
|
||||
"com.arsdigita.cms.default_item_resolver_class",
|
||||
Parameter.REQUIRED,
|
||||
MultilingualItemResolver.class,
|
||||
ItemResolver.class);
|
||||
private final Parameter m_defaultTemplateResolverClass =
|
||||
new SpecificClassParameter(
|
||||
private final Parameter m_defaultTemplateResolverClass = new SpecificClassParameter(
|
||||
"com.arsdigita.cms.default_template_resolver_class",
|
||||
Parameter.REQUIRED,
|
||||
DefaultTemplateResolver.class,
|
||||
|
|
@ -532,8 +488,7 @@ public final class CMSConfig extends AbstractConfig {
|
|||
/////////////////////////////////////////////
|
||||
// ItemSearchWidget
|
||||
/////////////////////////////////////////////
|
||||
private final Parameter m_itemSearchDefaultTab =
|
||||
new StringParameter(
|
||||
private final Parameter m_itemSearchDefaultTab = new StringParameter(
|
||||
"com.arsdigita.cms.item_search.default_tab",
|
||||
Parameter.REQUIRED, "flatBrowse");
|
||||
// private final Parameter m_itemSearchFlatBrowsePaneEnable = new BooleanParameter(
|
||||
|
|
@ -563,8 +518,7 @@ public final class CMSConfig extends AbstractConfig {
|
|||
//republish and withdraw items) is used. Otherwise the new style form is
|
||||
//used, which is more secure against wrong clicks.
|
||||
//////////////////////////////////////////////
|
||||
private final Parameter m_useOldStyleItemLifecycleItemPane =
|
||||
new BooleanParameter(
|
||||
private final Parameter m_useOldStyleItemLifecycleItemPane = new BooleanParameter(
|
||||
"com.arsdigita.cms.lifecycle.use_old_style_item_lifecycle_item_pane",
|
||||
Parameter.REQUIRED,
|
||||
false);
|
||||
|
|
@ -662,14 +616,18 @@ public final class CMSConfig extends AbstractConfig {
|
|||
Parameter.REQUIRED,
|
||||
60 * 60 * 24);
|
||||
|
||||
/**
|
||||
* Max length of the description of a link (in database max length are 4000 characters)
|
||||
*/
|
||||
private final Parameter m_linkDescMaxLength = new IntegerParameter(
|
||||
"com.arsdigita.cms.link_description_max_length", Parameter.REQUIRED, 400);
|
||||
|
||||
// ///////////////////////////////////////////
|
||||
// publishToFile package related parameter
|
||||
// ///////////////////////////////////////////
|
||||
// Moved to publishToFile.PublishToFileConfig as of version 6.0.2
|
||||
// private final Parameter m_disableItemPfs;
|
||||
// private final Parameter m_publishToFileClass;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor, but do NOT instantiate this class directly.
|
||||
*
|
||||
|
|
@ -686,7 +644,6 @@ public final class CMSConfig extends AbstractConfig {
|
|||
((EnumerationParameter) m_categoryTreeOrdering).put("Alphabetical",
|
||||
Category.NAME);
|
||||
|
||||
|
||||
register(m_templateRootPath);
|
||||
register(m_defaultItemTemplatePath);
|
||||
register(m_defaultFolderTemplatePath);
|
||||
|
|
@ -736,7 +693,6 @@ public final class CMSConfig extends AbstractConfig {
|
|||
|
||||
// Content Section config related parameters
|
||||
// register(m_defaultSection);
|
||||
|
||||
// Content Section creation parameters
|
||||
register(m_defaultItemResolverClass);
|
||||
register(m_defaultTemplateResolverClass);
|
||||
|
|
@ -768,7 +724,6 @@ public final class CMSConfig extends AbstractConfig {
|
|||
// Moved to publishToFile.PublishToFileConfig as of version 6.0.2
|
||||
// register(m_disableItemPfs);
|
||||
// register(m_publishToFileClass);
|
||||
|
||||
// register(m_itemSearchFlatBrowsePaneEnable);
|
||||
register(m_itemSearchFlatBrowsePanePageSize);
|
||||
|
||||
|
|
@ -779,12 +734,13 @@ public final class CMSConfig extends AbstractConfig {
|
|||
register(m_xmlCacheSize);
|
||||
register(m_xmlCacheAge);
|
||||
|
||||
register(m_linkDescMaxLength);
|
||||
|
||||
loadInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve path of the root folder for template folders. Path is
|
||||
* relative to webapp root.
|
||||
* Retrieve path of the root folder for template folders. Path is relative to webapp root.
|
||||
*/
|
||||
public final String getTemplateRoot() {
|
||||
return (String) get(m_templateRootPath);
|
||||
|
|
@ -824,9 +780,7 @@ public final class CMSConfig extends AbstractConfig {
|
|||
|
||||
/**
|
||||
*
|
||||
* @deprecated use
|
||||
* com.arsdigita.cms.ContentSection.getDefaultSection().getName()
|
||||
* instead
|
||||
* @deprecated use com.arsdigita.cms.ContentSection.getDefaultSection().getName() instead
|
||||
*/
|
||||
public final String getDefaultContentSection() {
|
||||
// return (String) get(m_defaultSection);
|
||||
|
|
@ -937,8 +891,7 @@ public final class CMSConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* Fetch the file name contaning XML Mapping of the content center tabs
|
||||
* to URLs
|
||||
* Fetch the file name contaning XML Mapping of the content center tabs to URLs
|
||||
*
|
||||
* @return String containig file name including path component.
|
||||
*/
|
||||
|
|
@ -947,18 +900,15 @@ public final class CMSConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* Internal class representing a DHTMLEditor configuration parameter. It
|
||||
* creates a new DHMTLEditor Config object (internal class in
|
||||
* DHTMLEditor).
|
||||
* Internal class representing a DHTMLEditor configuration parameter. It creates a new
|
||||
* DHMTLEditor Config object (internal class in DHTMLEditor).
|
||||
*
|
||||
* XXX Method unmarshal is broken and currently does not work correctly.
|
||||
* It does not process default values provided by using
|
||||
* DHTMLEditor.Config.Standard (see parameter m_dhtmlEditorConfig
|
||||
* above). May be a similiar problem as with ResourceParameter and
|
||||
* default value, see patch provided by pbrucha. Best solution may be to
|
||||
* remove this special parameter class and use a string parameter
|
||||
* instead to directly create a DHTMLEditor.Config object. (pboy,
|
||||
* 2010-09-02)
|
||||
* XXX Method unmarshal is broken and currently does not work correctly. It does not process
|
||||
* default values provided by using DHTMLEditor.Config.Standard (see parameter
|
||||
* m_dhtmlEditorConfig above). May be a similiar problem as with ResourceParameter and default
|
||||
* value, see patch provided by pbrucha. Best solution may be to remove this special parameter
|
||||
* class and use a string parameter instead to directly create a DHTMLEditor.Config object.
|
||||
* (pboy, 2010-09-02)
|
||||
*/
|
||||
private class DHTMLEditorConfigParameter extends StringParameter {
|
||||
|
||||
|
|
@ -969,18 +919,20 @@ public final class CMSConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* WARNING: Does not correctly process default values, see
|
||||
* above!
|
||||
* WARNING: Does not correctly process default values, see above!
|
||||
*
|
||||
* @param value
|
||||
* @param errors
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected Object unmarshal(String value, ErrorList errors) {
|
||||
return DHTMLEditor.Config.valueOf(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected static HashMap extraXMLGenerators = new HashMap();
|
||||
|
||||
/**
|
||||
|
|
@ -1011,9 +963,8 @@ public final class CMSConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* The relative weight given to the dcKeywords element within dublinCore
|
||||
* element within cms:item element when ranking search results Only used
|
||||
* by the interMedia query engine.
|
||||
* The relative weight given to the dcKeywords element within dublinCore element within cms:item
|
||||
* element when ranking search results Only used by the interMedia query engine.
|
||||
*
|
||||
*/
|
||||
public Integer getKeywordSearchWeight() {
|
||||
|
|
@ -1025,8 +976,8 @@ public final class CMSConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* The relative weight given to title element within cms:item element
|
||||
* when ranking search results Only used by the interMedia query engine.
|
||||
* The relative weight given to title element within cms:item element when ranking search
|
||||
* results Only used by the interMedia query engine.
|
||||
*
|
||||
*/
|
||||
public Integer getTitleSearchWeight() {
|
||||
|
|
@ -1034,11 +985,9 @@ public final class CMSConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* Whether to include INPATH operators to contains clause in intermedia
|
||||
* search
|
||||
* Whether to include INPATH operators to contains clause in intermedia search
|
||||
*
|
||||
* NB - if true, INDEX MUST BE CREATED WITH PATH_SECTION_GROUP - upgrade
|
||||
* 6.5.0 - 6.5.1
|
||||
* NB - if true, INDEX MUST BE CREATED WITH PATH_SECTION_GROUP - upgrade 6.5.0 - 6.5.1
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -1047,15 +996,15 @@ public final class CMSConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* for the given content type, returns a collection of steps that are
|
||||
* deemed irrelevant for the type.
|
||||
* for the given content type, returns a collection of steps that are deemed irrelevant for the
|
||||
* type.
|
||||
*
|
||||
* If no irrelevant steps, an empty set is returned.
|
||||
*
|
||||
* Steps are the names of the bebop step components that are used by the
|
||||
* authoring kit wizard
|
||||
* Steps are the names of the bebop step components that are used by the authoring kit wizard
|
||||
*
|
||||
* @param type
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Collection getAssetStepsToSkip(ContentType type) {
|
||||
|
|
@ -1074,8 +1023,7 @@ public final class CMSConfig extends AbstractConfig {
|
|||
// 1st string is name of content type, 2nd string is name of asset step
|
||||
s_log.debug("parameter read - type = " + pair[0]
|
||||
+ " - step = " + pair[1]);
|
||||
Collection typeSteps =
|
||||
(Collection) s_skipAssetSteps.get(pair[0]);
|
||||
Collection typeSteps = (Collection) s_skipAssetSteps.get(pair[0]);
|
||||
if (typeSteps == null) {
|
||||
typeSteps = new HashSet();
|
||||
s_skipAssetSteps.put(pair[0], typeSteps);
|
||||
|
|
@ -1098,8 +1046,7 @@ public final class CMSConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* May be used by any content type creation form to decide whether to
|
||||
* validate description field
|
||||
* May be used by any content type creation form to decide whether to validate description field
|
||||
*
|
||||
*/
|
||||
public boolean mandatoryDescriptions() {
|
||||
|
|
@ -1107,22 +1054,21 @@ public final class CMSConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used to decide whether lifecycles (and all asociated phases) should
|
||||
* be deleted from the system when complete
|
||||
* Used to decide whether lifecycles (and all asociated phases) should be deleted from the
|
||||
* system when complete
|
||||
*
|
||||
* (Deleting lifecycle means that you lose a bit of historical
|
||||
* information eg when was this item unpublished)
|
||||
* (Deleting lifecycle means that you lose a bit of historical information eg when was this item
|
||||
* unpublished)
|
||||
*/
|
||||
public boolean deleteFinishedLifecycles() {
|
||||
return ((Boolean) get(m_deleteLifecycleWhenComplete)).booleanValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to decide whether to delete old notification records for expiry
|
||||
* notifications.
|
||||
* Used to decide whether to delete old notification records for expiry notifications.
|
||||
*
|
||||
* If true, notifications and messages are deleted if the notification
|
||||
* is successfully sent. Any send failures are retained
|
||||
* If true, notifications and messages are deleted if the notification is successfully sent. Any
|
||||
* send failures are retained
|
||||
*
|
||||
*/
|
||||
public boolean deleteExpiryNotifications() {
|
||||
|
|
@ -1130,11 +1076,10 @@ public final class CMSConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* Used to decide whether to delete old notification records for
|
||||
* workflow notifications.
|
||||
* Used to decide whether to delete old notification records for workflow notifications.
|
||||
*
|
||||
* If true, notifications and messages are deleted if the notification
|
||||
* is successfully sent. Any send failures are retained
|
||||
* If true, notifications and messages are deleted if the notification is successfully sent. Any
|
||||
* send failures are retained
|
||||
*
|
||||
*/
|
||||
public boolean deleteWorkflowNotifications() {
|
||||
|
|
@ -1147,13 +1092,11 @@ public final class CMSConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* I'am not sure for what this method is. I found it here when I tried
|
||||
* figure out how add multiple parts to an ContentType, like
|
||||
* ccm-cms-types-contact and the Multipart article do. I think this
|
||||
* method should not be here because it is only needed by one specific
|
||||
* contenttype. Because of this, I think that this method and the
|
||||
* contact are violating many rules of modern software design. Jens
|
||||
* Pelzetter, 2009-06-02.
|
||||
* I'am not sure for what this method is. I found it here when I tried figure out how add
|
||||
* multiple parts to an ContentType, like ccm-cms-types-contact and the Multipart article do. I
|
||||
* think this method should not be here because it is only needed by one specific contenttype.
|
||||
* Because of this, I think that this method and the contact are violating many rules of modern
|
||||
* software design. Jens Pelzetter, 2009-06-02.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -1166,12 +1109,10 @@ public final class CMSConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* 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)
|
||||
*/
|
||||
|
|
@ -1186,8 +1127,8 @@ public final class CMSConfig extends AbstractConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* Hide the (no longer used) legacy public site link in Workspace
|
||||
* (content center) section listing, true by default.
|
||||
* Hide the (no longer used) legacy public site link in Workspace (content center) section
|
||||
* listing, true by default.
|
||||
*/
|
||||
public final boolean getHideLegacyPublicSiteLink() {
|
||||
return ((Boolean) get(m_hideLegacyPublicSiteLink)).booleanValue();
|
||||
|
|
@ -1283,4 +1224,9 @@ public final class CMSConfig extends AbstractConfig {
|
|||
public Integer getXmlCacheAge() {
|
||||
return (Integer) get(m_xmlCacheAge);
|
||||
}
|
||||
|
||||
public Integer getLinkDescMaxLength() {
|
||||
return (Integer) get(m_linkDescMaxLength);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,3 +355,8 @@ com.arsdigita.cms.xml.cache.age.title=Maximum age of an entry in the XML cache
|
|||
com.arsdigita.cms.xml.cache.age.purpose=Maximum age of an entry in the XML cache
|
||||
com.arsdigita.cms.xml.cache.age.example=60*60*24
|
||||
com.arsdigita.cms.xml.cache.age.format=[integer]
|
||||
|
||||
com.arsdigita.cms.link_description_max_length.title=Maximum length of the description of a link.
|
||||
com.arsdigita.cms.link_description_max_length.purpose=Maximum length of the description of a link.
|
||||
com.arsdigita.cms.link_description_max_length.example=400
|
||||
com.arsdigita.cms.link_description_max_length.format={Integer]
|
||||
|
|
@ -41,6 +41,8 @@ import com.arsdigita.bebop.form.Fieldset;
|
|||
import com.arsdigita.bebop.form.TextArea;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringLengthValidationListener;
|
||||
import com.arsdigita.cms.CMSConfig;
|
||||
import com.arsdigita.cms.ContentBundle;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -60,8 +62,8 @@ import java.net.URL;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Form to edit the basic properties of an Link. This form can be extended to
|
||||
* create forms for Link subclasses.
|
||||
* Form to edit the basic properties of an Link. This form can be extended to create forms for Link
|
||||
* subclasses.
|
||||
*
|
||||
* @version $Revision: #5 $ $Date: 2004/08/17 $
|
||||
* @author Nobuko Asakai (nasakai@redhat.com)
|
||||
|
|
@ -73,7 +75,9 @@ public class LinkPropertyForm extends FormSection
|
|||
|
||||
private static final Logger s_log = Logger.getLogger(LinkPropertyForm.class);
|
||||
|
||||
/** Name of this form */
|
||||
/**
|
||||
* Name of this form
|
||||
*/
|
||||
public static final String ID = "link_edit";
|
||||
public static final String SSL_PROTOCOL = "https://";
|
||||
public static final String HTTP_PROTOCOL = "http://";
|
||||
|
|
@ -90,13 +94,12 @@ public class LinkPropertyForm extends FormSection
|
|||
private ContentType m_contentType;
|
||||
protected final String ITEM_SEARCH = "contentItem";
|
||||
|
||||
|
||||
/**
|
||||
* Constructor creates a new form to edit the Link object specified by the
|
||||
* item selection model passed in.
|
||||
* Constructor creates a new form to edit the Link object specified by the item selection model
|
||||
* passed in.
|
||||
*
|
||||
* @param itemModel The ItemSelectionModel to use to obtain the ContentItem
|
||||
* to which this link is (or will be) attached
|
||||
* @param itemModel The ItemSelectionModel to use to obtain the ContentItem to which this link
|
||||
* is (or will be) attached
|
||||
* @param link The LinkSelectionModel to use to obtain the Link to work on
|
||||
*/
|
||||
public LinkPropertyForm(ItemSelectionModel itemModel,
|
||||
|
|
@ -105,8 +108,8 @@ public class LinkPropertyForm extends FormSection
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructor creates a new form to edit the Link object specified by the
|
||||
* item selection model passed in.
|
||||
* Constructor creates a new form to edit the Link object specified by the item selection model
|
||||
* passed in.
|
||||
*
|
||||
* @param itemModel
|
||||
* @param link
|
||||
|
|
@ -149,6 +152,8 @@ public class LinkPropertyForm extends FormSection
|
|||
m_description = new TextArea("description");
|
||||
m_description.setCols(40);
|
||||
m_description.setRows(5);
|
||||
m_description.addValidationListener(new StringLengthValidationListener(CMSConfig
|
||||
.getInstanceOf().getLinkDescMaxLength()));
|
||||
add(new Label(GlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.description")));
|
||||
add(m_description);
|
||||
|
|
@ -299,6 +304,7 @@ public class LinkPropertyForm extends FormSection
|
|||
"cms.contenttyes.link.ui.button_reset"));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
m_saveCancelSection.getSaveButton().addPrintListener(
|
||||
new PrintListener() {
|
||||
|
|
@ -314,6 +320,7 @@ public class LinkPropertyForm extends FormSection
|
|||
"cms.contenttyes.link.ui.button_create"));
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
} catch (TooManyListenersException e) {
|
||||
throw new UncheckedWrapperException("this cannot happen", e);
|
||||
|
|
@ -323,6 +330,7 @@ public class LinkPropertyForm extends FormSection
|
|||
|
||||
/**
|
||||
* Retrieves the saveCancelSection.
|
||||
*
|
||||
* @return Save/Cencel section
|
||||
*/
|
||||
public SaveCancelSection getSaveCancelSection() {
|
||||
|
|
@ -340,6 +348,7 @@ public class LinkPropertyForm extends FormSection
|
|||
* Submission listener. Handles cancel events.
|
||||
*
|
||||
* @param e the FormSectionEvent
|
||||
*
|
||||
* @throws com.arsdigita.bebop.FormProcessException
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -354,10 +363,10 @@ public class LinkPropertyForm extends FormSection
|
|||
}
|
||||
|
||||
/**
|
||||
* Validation listener. Ensures consistency of internal vs. external link
|
||||
* data
|
||||
* Validation listener. Ensures consistency of internal vs. external link data
|
||||
*
|
||||
* @param event the FormSectionEvent
|
||||
*
|
||||
* @throws com.arsdigita.bebop.FormProcessException
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -398,8 +407,7 @@ public class LinkPropertyForm extends FormSection
|
|||
} else {
|
||||
// No idea, just throw the error
|
||||
|
||||
throw new FormProcessException("URL is not valid: " +
|
||||
ex.getMessage());
|
||||
throw new FormProcessException("URL is not valid: " + ex.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
@ -440,8 +448,7 @@ public class LinkPropertyForm extends FormSection
|
|||
// Quasimodo
|
||||
// The target of the link must not be the same as the owner
|
||||
if (m_itemModel.getSelectedItem(state).getID().equals(
|
||||
((ContentItem) data.get(ITEM_SEARCH)).getID())
|
||||
) {
|
||||
((ContentItem) data.get(ITEM_SEARCH)).getID())) {
|
||||
throw new FormProcessException("Link target is the same as this object.");
|
||||
}
|
||||
}
|
||||
|
|
@ -451,6 +458,7 @@ public class LinkPropertyForm extends FormSection
|
|||
* Get the current ContentItem
|
||||
*
|
||||
* @param s the PageState
|
||||
*
|
||||
* @return the ContentItem
|
||||
*/
|
||||
protected ContentItem getContentItem(PageState s) {
|
||||
|
|
@ -461,6 +469,7 @@ public class LinkPropertyForm extends FormSection
|
|||
* Take care of basic Link creation steps
|
||||
*
|
||||
* @param s the PageState
|
||||
*
|
||||
* @return the newly-created Link
|
||||
*/
|
||||
protected Link createLink(PageState s) {
|
||||
|
|
@ -474,6 +483,7 @@ public class LinkPropertyForm extends FormSection
|
|||
* Init listener. For edit actions, fills the form with current data
|
||||
*
|
||||
* @param fse the FormSectionEvent
|
||||
*
|
||||
* @throws com.arsdigita.bebop.FormProcessException
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -526,6 +536,7 @@ public class LinkPropertyForm extends FormSection
|
|||
* Process listener. Saves/creates the new or modified Link
|
||||
*
|
||||
* @param fse the FormSectionEvent
|
||||
*
|
||||
* @throws com.arsdigita.bebop.FormProcessException
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -561,8 +572,9 @@ public class LinkPropertyForm extends FormSection
|
|||
}
|
||||
|
||||
/**
|
||||
* Set various properties of the Link.Child clases can over-ride this method
|
||||
* to add additional properties to Link.
|
||||
* Set various properties of the Link.Child clases can over-ride this method to add additional
|
||||
* properties to Link.
|
||||
*
|
||||
* @param link
|
||||
* @param fse
|
||||
*/
|
||||
|
|
@ -621,4 +633,5 @@ public class LinkPropertyForm extends FormSection
|
|||
|
||||
link.save();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ import java.math.BigDecimal;
|
|||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* A form element which displays a select box of all content types available
|
||||
* under the given content section, and forwards to the item creation UI when
|
||||
* the user selects a content type to instantiate.
|
||||
* A form element which displays a select box of all content types available under the given content
|
||||
* section, and forwards to the item creation UI when the user selects a content type to
|
||||
* instantiate.
|
||||
*
|
||||
* @author Stanislav Freidin (sfreidin@arsdigtia.com)
|
||||
* @version $Revision: #12 $ $DateTime: 2004/08/17 23:15:09 $
|
||||
|
|
@ -59,10 +59,11 @@ import org.apache.log4j.Logger;
|
|||
*/
|
||||
public abstract class NewItemForm extends Form {
|
||||
|
||||
/** Internal logger instance to faciliate debugging. Enable logging output
|
||||
* by editing /WEB-INF/conf/log4j.properties int hte runtime environment
|
||||
* and set com.arsdigita.cms.ui.authoring.NewItemForm=DEBUG by uncommenting
|
||||
* or adding the line. */
|
||||
/**
|
||||
* Internal logger instance to faciliate debugging. Enable logging output by editing
|
||||
* /WEB-INF/conf/log4j.properties int hte runtime environment and set
|
||||
* com.arsdigita.cms.ui.authoring.NewItemForm=DEBUG by uncommenting or adding the line.
|
||||
*/
|
||||
private static final Logger s_log = Logger.getLogger(NewItemForm.class);
|
||||
|
||||
private final SingleSelect m_typeWidget;
|
||||
|
|
@ -72,8 +73,7 @@ public abstract class NewItemForm extends Form {
|
|||
public static final String TYPE_ID = "tid";
|
||||
|
||||
/**
|
||||
* Construct a new NewItemForm. It sets a vertical BoxPanel as the component
|
||||
* container.
|
||||
* Construct a new NewItemForm. It sets a vertical BoxPanel as the component container.
|
||||
*
|
||||
* @param name the name attribute of the form.
|
||||
*/
|
||||
|
|
@ -99,7 +99,8 @@ public abstract class NewItemForm extends Form {
|
|||
m_createLabel.setIdAttr("create_label");
|
||||
panel.add(m_createLabel);
|
||||
|
||||
m_typeWidget = new SingleSelect(new BigDecimalParameter(TYPE_ID));
|
||||
m_typeWidget = new SingleSelect(new BigDecimalParameter(TYPE_ID),
|
||||
OptionGroup.SortMode.ALPHABETICAL_ASCENDING);
|
||||
try {
|
||||
m_typeWidget.addPrintListener(new PrintListener() {
|
||||
|
||||
|
|
@ -113,9 +114,7 @@ public abstract class NewItemForm extends Form {
|
|||
ContentSection section = getContentSection(state);
|
||||
ContentType parentType = null;
|
||||
ContentTypeCollection typesCollection = null;
|
||||
BigDecimal singleTypeID = (BigDecimal)
|
||||
state.getValue(new
|
||||
BigDecimalParameter(
|
||||
BigDecimal singleTypeID = (BigDecimal) state.getValue(new BigDecimalParameter(
|
||||
ItemSearch.SINGLE_TYPE_PARAM));
|
||||
|
||||
if (singleTypeID != null) {
|
||||
|
|
@ -157,11 +156,9 @@ public abstract class NewItemForm extends Form {
|
|||
if (party == null) {
|
||||
party = Kernel.getPublicUser();
|
||||
}
|
||||
PermissionDescriptor create =
|
||||
new PermissionDescriptor(
|
||||
PermissionDescriptor create = new PermissionDescriptor(
|
||||
PrivilegeDescriptor
|
||||
.get(SecurityManager
|
||||
.CMS_NEW_ITEM),
|
||||
.get(SecurityManager.CMS_NEW_ITEM),
|
||||
type,
|
||||
party);
|
||||
list = PermissionService.checkPermission(create);
|
||||
|
|
@ -177,6 +174,7 @@ public abstract class NewItemForm extends Form {
|
|||
typesCollection.reset();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
} catch (java.util.TooManyListenersException e) {
|
||||
throw new UncheckedWrapperException("Too many listeners: " + e.getMessage(), e);
|
||||
|
|
@ -196,6 +194,7 @@ public abstract class NewItemForm extends Form {
|
|||
/**
|
||||
*
|
||||
* @param state
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getTypeID(PageState state) {
|
||||
|
|
@ -212,6 +211,7 @@ public abstract class NewItemForm extends Form {
|
|||
|
||||
/**
|
||||
* Generate XML - show/hide labels/widgets
|
||||
*
|
||||
* @param state
|
||||
* @param parent
|
||||
*/
|
||||
|
|
@ -233,4 +233,5 @@ public abstract class NewItemForm extends Form {
|
|||
super.generateXML(state, parent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class CheckboxGroup extends OptionGroup implements BebopConstants {
|
|||
|
||||
public CheckboxGroup(ArrayParameter param) {
|
||||
super(param);
|
||||
m_xmlElement = BEBOP_CHECKBOX;
|
||||
//m_xmlElement = BEBOP_CHECKBOX;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -60,4 +60,9 @@ public class CheckboxGroup extends OptionGroup implements BebopConstants {
|
|||
protected String getElementTag() {
|
||||
return BEBOP_CHECKBOXGROUP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOptionXMLElement() {
|
||||
return BEBOP_CHECKBOX;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,8 +133,7 @@ public class Option extends DescriptiveComponent {
|
|||
Assert.isUnlocked(this);
|
||||
Assert.exists(group);
|
||||
m_group = group;
|
||||
m_isSelectOption =
|
||||
BebopConstants.BEBOP_OPTION.equals(m_group.m_xmlElement);
|
||||
m_isSelectOption = BebopConstants.BEBOP_OPTION.equals(m_group.getOptionXMLElement());
|
||||
}
|
||||
|
||||
public final OptionGroup getGroup() {
|
||||
|
|
@ -243,7 +242,7 @@ public class Option extends DescriptiveComponent {
|
|||
*/
|
||||
@Override
|
||||
public void generateXML(PageState s, Element e) {
|
||||
Element option = e.newChildElement(m_group.m_xmlElement, BEBOP_XML_NS);
|
||||
Element option = e.newChildElement(m_group.getOptionXMLElement(), BEBOP_XML_NS);
|
||||
if ( ! m_isSelectOption ) {
|
||||
option.addAttribute("name", getName());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,17 +19,23 @@
|
|||
package com.arsdigita.bebop.form;
|
||||
|
||||
import com.arsdigita.bebop.Form;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.RequestLocal;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.parameters.ParameterData;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.parameters.ParameterModelWrapper;
|
||||
import com.arsdigita.bebop.util.BebopConstants;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.xml.Element;
|
||||
import java.text.Collator;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
|
|
@ -45,71 +51,171 @@ import org.apache.log4j.Logger;
|
|||
* @author Michael Pih
|
||||
* @version $Id: OptionGroup.java 738 2005-09-01 12:36:52Z sskracic $
|
||||
*/
|
||||
public abstract class OptionGroup extends Widget
|
||||
implements BebopConstants {
|
||||
public abstract class OptionGroup extends Widget implements BebopConstants {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(OptionGroup.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(OptionGroup.class);
|
||||
/**
|
||||
* The XML element to be used by individual options belonging to this group. This variable has
|
||||
* to be initialized by every subclass of OptionGroup. LEGACY: An abstract method would be the
|
||||
* better design, but changing it would break the API.
|
||||
*/
|
||||
protected String m_xmlElement;
|
||||
//protected String m_xmlElement;
|
||||
// this only needs to be an ArrayList for multiple selection option groups
|
||||
private ArrayList m_selected;
|
||||
private ArrayList m_options;
|
||||
private List<String> m_selected;
|
||||
private List<Option> m_options;
|
||||
private Widget m_otherOption = null;
|
||||
private Form m_form = null;
|
||||
private boolean m_isDisabled = false;
|
||||
private boolean m_isReadOnly = false;
|
||||
/**
|
||||
* Sort Mode for options
|
||||
*/
|
||||
private OptionGroup.SortMode sortMode;
|
||||
/**
|
||||
* Exclude first option from sorting?
|
||||
*/
|
||||
private boolean excludeFirst;
|
||||
public static final String OTHER_OPTION = "__other__";
|
||||
// request-local copy of selected elements, options
|
||||
private RequestLocal m_requestOptions = new RequestLocal() {
|
||||
|
||||
@Override
|
||||
public Object initialValue(PageState ps) {
|
||||
return new ArrayList();
|
||||
public Object initialValue(final PageState state) {
|
||||
return new ArrayList<Option>();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
public final boolean isCompound() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// this is only used for single selection option groups
|
||||
|
||||
private final static String TOO_MANY_OPTIONS_SELECTED
|
||||
= "Only one option may be selected by default on this option group.";
|
||||
|
||||
/**
|
||||
* The ParameterModel for mutliple OptionGroups is always an array parameter
|
||||
*
|
||||
* @param model
|
||||
*/
|
||||
protected OptionGroup(ParameterModel model) {
|
||||
protected OptionGroup(final ParameterModel model) {
|
||||
//super(model);
|
||||
//m_options = new ArrayList<Option>();
|
||||
//m_selected = new ArrayList<String>();
|
||||
this(model, OptionGroup.SortMode.NO_SORT, false);
|
||||
}
|
||||
|
||||
protected OptionGroup(final ParameterModel model,
|
||||
final OptionGroup.SortMode sortMode) {
|
||||
this(model, sortMode, false);
|
||||
}
|
||||
|
||||
protected OptionGroup(final ParameterModel model,
|
||||
final OptionGroup.SortMode sortMode,
|
||||
final boolean excludeFirst) {
|
||||
super(model);
|
||||
m_options = new ArrayList();
|
||||
m_selected = new ArrayList();
|
||||
m_options = new ArrayList<Option>();
|
||||
m_selected = new ArrayList<String>();
|
||||
this.sortMode = sortMode;
|
||||
this.excludeFirst = excludeFirst;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Iterator of all the default Options in this group.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Iterator getOptions() {
|
||||
public Iterator<Option> getOptions() {
|
||||
return m_options.iterator();
|
||||
}
|
||||
|
||||
public enum SortMode {
|
||||
|
||||
NO_SORT,
|
||||
ALPHABETICAL_ASCENDING,
|
||||
ALPHABETICAL_DESENDING
|
||||
|
||||
}
|
||||
|
||||
public abstract String getOptionXMLElement();
|
||||
|
||||
/**
|
||||
* This {@link Comparator} implementation is used to sort the list of options alphabetical. If
|
||||
* the sorting is ascending or descending depends on the selected sort mode. The Comparator
|
||||
* needs the {@link PageState} for retrieving the localised labels from the options.
|
||||
*/
|
||||
private class AlphabeticalSortComparator implements Comparator<Option> {
|
||||
|
||||
private final PageState state;
|
||||
|
||||
/**
|
||||
* Constructor taking the current {@code PageState}.
|
||||
*
|
||||
* @param state
|
||||
*/
|
||||
public AlphabeticalSortComparator(final PageState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(final Option option1, final Option option2) {
|
||||
String label1;
|
||||
String label2;
|
||||
|
||||
//Check if the first option to compare has a inner label component. If it has
|
||||
//store the localised text. Otherwise use the name of the option.
|
||||
if (option1.getComponent() instanceof Label) {
|
||||
final Label label = (Label) option1.getComponent();
|
||||
label1 = label.getLabel(state);
|
||||
} else {
|
||||
label1 = option1.getName();
|
||||
}
|
||||
|
||||
// Same for the second option
|
||||
if (option2.getComponent() instanceof Label) {
|
||||
final Label label = (Label) option2.getComponent();
|
||||
label2 = label.getLabel(state);
|
||||
} else {
|
||||
label2 = option2.getName();
|
||||
}
|
||||
|
||||
//We are using a Collator instance here instead of String#compare(String) because
|
||||
//String#compare(String) is not local sensitive. For example in german a word starting
|
||||
//with the letter 'Ö' should be handled like a word starting with the letter 'O'.
|
||||
//Using String#compare(String) would put them at the end of the list.
|
||||
//Depending on the sort mode we compare label1 with label2 (ascending) or label2 with
|
||||
//label1 (descending).
|
||||
final Collator collator = Collator
|
||||
.getInstance(GlobalizationHelper.getNegotiatedLocale());
|
||||
if (sortMode == SortMode.ALPHABETICAL_ASCENDING) {
|
||||
return collator.compare(label1, label2);
|
||||
} else if (sortMode == SortMode.ALPHABETICAL_DESENDING) {
|
||||
return collator.compare(label2, label1);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Iterator of all the default Options in this group, plus any request-specific
|
||||
* options.
|
||||
*
|
||||
* @param state
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Iterator getOptions(PageState ps) {
|
||||
ArrayList allOptions = new ArrayList();
|
||||
public Iterator<Option> getOptions(final PageState state) {
|
||||
List<Option> allOptions = new ArrayList<Option>();
|
||||
allOptions.addAll(m_options);
|
||||
ArrayList requestOptions = (ArrayList) m_requestOptions.get(ps);
|
||||
for (Iterator i = requestOptions.iterator(); i.hasNext();) {
|
||||
Object obj = i.next();
|
||||
if (!allOptions.contains(obj)) {
|
||||
allOptions.add(obj);
|
||||
List<Option> requestOptions = (List<Option>) m_requestOptions.get(state);
|
||||
for (Iterator<Option> iterator = requestOptions.iterator(); iterator.hasNext();) {
|
||||
final Option option = iterator.next();
|
||||
if (!allOptions.contains(option)) {
|
||||
allOptions.add(option);
|
||||
}
|
||||
}
|
||||
return allOptions.iterator();
|
||||
|
|
@ -117,74 +223,74 @@ public abstract class OptionGroup extends Widget
|
|||
|
||||
public void clearOptions() {
|
||||
Assert.isUnlocked(this);
|
||||
m_options = new ArrayList();
|
||||
m_options = new ArrayList<Option>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new option.
|
||||
*
|
||||
* @param opt The {@link Option} to be added. Note: the argument is modified and associated with
|
||||
* this OptionGroup, regardless of what its group was.
|
||||
* @param option The {@link Option} to be added. Note: the argument is modified and associated
|
||||
* with this OptionGroup, regardless of what its group was.
|
||||
*/
|
||||
public void addOption(Option opt) {
|
||||
addOption(opt, null, false);
|
||||
public void addOption(final Option option) {
|
||||
addOption(option, null, false);
|
||||
}
|
||||
|
||||
public void addOption(Option opt, PageState ps) {
|
||||
addOption(opt, ps, false);
|
||||
public void addOption(final Option option, final PageState state) {
|
||||
addOption(option, state, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new option.at the beginning of the list
|
||||
*
|
||||
* @param opt The {@link Option} to be added. Note: the argument is modified and associated with
|
||||
* this OptionGroup, regardless of what its group was.
|
||||
* @param option The {@link Option} to be added. Note: the argument is modified and associated
|
||||
* with this OptionGroup, regardless of what its group was.
|
||||
*/
|
||||
public void prependOption(Option opt) {
|
||||
addOption(opt, null, true);
|
||||
public void prependOption(final Option option) {
|
||||
addOption(option, null, true);
|
||||
}
|
||||
|
||||
public void prependOption(Option opt, PageState ps) {
|
||||
addOption(opt, ps, true);
|
||||
public void prependOption(final Option option, final PageState state) {
|
||||
addOption(option, state, true);
|
||||
}
|
||||
|
||||
public void removeOption(Option opt) {
|
||||
removeOption(opt, null);
|
||||
public void removeOption(final Option option) {
|
||||
removeOption(option, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new option for the scope of the current request, or to the page as a whole if there is
|
||||
* no current request.
|
||||
*
|
||||
* @param opt The {@link Option} to be added. Note: the argument is modified and associated
|
||||
* @param option The {@link Option} to be added. Note: the argument is modified and associated
|
||||
* with this OptionGroup, regardless of what its group was.
|
||||
* @param ps the current page state. if ps is null, adds option to the default option list.
|
||||
* @param state the current page state. if ps is null, adds option to the default option list.
|
||||
* @param prepend If true, prepend option to the list instead of appending it
|
||||
*/
|
||||
public void addOption(Option opt, PageState ps, boolean prepend) {
|
||||
ArrayList list = m_options;
|
||||
if (ps == null) {
|
||||
public void addOption(final Option option, final PageState state, final boolean prepend) {
|
||||
List<Option> list = m_options;
|
||||
if (state == null) {
|
||||
Assert.isUnlocked(this);
|
||||
} else {
|
||||
list = (ArrayList) m_requestOptions.get(ps);
|
||||
list = (List<Option>) m_requestOptions.get(state);
|
||||
}
|
||||
opt.setGroup(this);
|
||||
option.setGroup(this);
|
||||
|
||||
if (prepend == true) {
|
||||
list.add(0, opt);
|
||||
list.add(0, option);
|
||||
} else {
|
||||
list.add(opt);
|
||||
list.add(option);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeOption(Option opt, PageState ps) {
|
||||
ArrayList list = m_options;
|
||||
if (ps == null) {
|
||||
public void removeOption(final Option option, final PageState state) {
|
||||
List<Option> list = m_options;
|
||||
if (state == null) {
|
||||
Assert.isUnlocked(this);
|
||||
} else {
|
||||
list = (ArrayList) m_requestOptions.get(ps);
|
||||
list = (List<Option>) m_requestOptions.get(state);
|
||||
}
|
||||
list.remove(opt);
|
||||
list.remove(option);
|
||||
}
|
||||
|
||||
public void removeOption(String key) {
|
||||
|
|
@ -194,22 +300,22 @@ public abstract class OptionGroup extends Widget
|
|||
/**
|
||||
* Removes the first option whose key is isEqual to the key that is passed in.
|
||||
*/
|
||||
public void removeOption(String key, PageState ps) {
|
||||
public void removeOption(final String key, final PageState state) {
|
||||
// This is not an entirely efficient technique. A more
|
||||
// efficient solution is to switch to using a HashMap.
|
||||
ArrayList list = m_options;
|
||||
if (ps == null) {
|
||||
List<Option> list = m_options;
|
||||
if (state == null) {
|
||||
Assert.isUnlocked(this);
|
||||
} else {
|
||||
list = (ArrayList) m_requestOptions.get(ps);
|
||||
list = (List<Option>) m_requestOptions.get(state);
|
||||
}
|
||||
|
||||
Iterator i = list.iterator();
|
||||
Option o = null;
|
||||
while (i.hasNext()) {
|
||||
o = (Option) i.next();
|
||||
if (o.getValue().equals(key)) {
|
||||
list.remove(o);
|
||||
final Iterator<Option> iterator = list.iterator();
|
||||
Option option;
|
||||
while (iterator.hasNext()) {
|
||||
option = iterator.next();
|
||||
if (option.getValue().equals(key)) {
|
||||
list.remove(option);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -219,15 +325,15 @@ public abstract class OptionGroup extends Widget
|
|||
/**
|
||||
* Add an "Other (please specify)" type option to the widget
|
||||
*
|
||||
* @param hasOtherOption true is the widget has an "Other" option
|
||||
* @param label
|
||||
* @param width The width, in characters, of the "Other" entry area
|
||||
* @param height The height, in characters, of the "Other" entry area. If this is 1 then
|
||||
* a TextField is used. Otherwise a TextArea is used.
|
||||
* @param height The height, in characters, of the "Other" entry area. If this is 1 then a
|
||||
* TextField is used. Otherwise a TextArea is used.
|
||||
*/
|
||||
public void addOtherOption(String label, int width, int height) {
|
||||
public void addOtherOption(final String label, final int width, final int height) {
|
||||
Assert.isUnlocked(this);
|
||||
|
||||
Option otherOption = new Option(OTHER_OPTION, label);
|
||||
final Option otherOption = new Option(OTHER_OPTION, label);
|
||||
addOption(otherOption);
|
||||
|
||||
final ParameterModel model = getParameterModel();
|
||||
|
|
@ -276,14 +382,14 @@ public abstract class OptionGroup extends Widget
|
|||
}
|
||||
}
|
||||
|
||||
s_log.debug("createParameterData in OptionGroup");
|
||||
LOGGER.debug("createParameterData in OptionGroup");
|
||||
|
||||
return super.createParameterData(new HttpServletRequestWrapper(request) {
|
||||
|
||||
@Override
|
||||
public String[] getParameterValues(String key) {
|
||||
if (s_log.isDebugEnabled()) {
|
||||
s_log.debug("Getting values for " + key);
|
||||
if (LOGGER.isDebugEnabled()) {
|
||||
LOGGER.debug("Getting values for " + key);
|
||||
}
|
||||
|
||||
if (model.getName().equals(key)) {
|
||||
|
|
@ -307,12 +413,12 @@ public abstract class OptionGroup extends Widget
|
|||
*
|
||||
* @param value the value of the option to be added to the by-default-selected set.
|
||||
*/
|
||||
public void setOptionSelected(String value) {
|
||||
public void setOptionSelected(final String value) {
|
||||
Assert.isUnlocked(this);
|
||||
if (!isMultiple()) {
|
||||
// only one option may be selected
|
||||
// to this selected list better be empty
|
||||
Assert.isTrue(m_selected.size() == 0, TOO_MANY_OPTIONS_SELECTED);
|
||||
Assert.isTrue(m_selected.isEmpty(), TOO_MANY_OPTIONS_SELECTED);
|
||||
m_selected.add(value);
|
||||
getParameterModel().setDefaultValue(value);
|
||||
} else {
|
||||
|
|
@ -332,9 +438,11 @@ public abstract class OptionGroup extends Widget
|
|||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
OptionGroup cloned = (OptionGroup) super.clone();
|
||||
cloned.m_options = (ArrayList) m_options.clone();
|
||||
cloned.m_selected = (ArrayList) m_selected.clone();
|
||||
final OptionGroup cloned = (OptionGroup) super.clone();
|
||||
//cloned.m_options = m_options.clone();
|
||||
//cloned.m_selected = m_selected.clone();
|
||||
cloned.m_options.addAll(m_options);
|
||||
cloned.m_selected.addAll(m_selected);
|
||||
return cloned;
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +481,7 @@ public abstract class OptionGroup extends Widget
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setForm(Form form) {
|
||||
public void setForm(final Form form) {
|
||||
m_form = form;
|
||||
if (null != m_otherOption) {
|
||||
m_otherOption.setForm(form);
|
||||
|
|
@ -387,14 +495,15 @@ public abstract class OptionGroup extends Widget
|
|||
* <p>
|
||||
* Generates DOM fragment:
|
||||
* <p>
|
||||
* <pre><code><bebop:* name=... [onXXX=...]>
|
||||
* <
|
||||
* pre><code><bebop:* name=... [onXXX=...]>
|
||||
* <bebop:option name=... [selected]> option value </bebop:option%gt;
|
||||
* ...
|
||||
* </bebop:*select></code></pre>
|
||||
*/
|
||||
@Override
|
||||
public void generateWidget(PageState state, Element parent) {
|
||||
Element optionGroup = parent.newChildElement(getElementTag(), BEBOP_XML_NS);
|
||||
public void generateWidget(final PageState state, final Element parent) {
|
||||
final Element optionGroup = parent.newChildElement(getElementTag(), BEBOP_XML_NS);
|
||||
optionGroup.addAttribute("name", getName());
|
||||
optionGroup.addAttribute("class", getName().replace(".", " "));
|
||||
if (getLabel() != null) {
|
||||
|
|
@ -405,11 +514,35 @@ public abstract class OptionGroup extends Widget
|
|||
}
|
||||
exportAttributes(optionGroup);
|
||||
|
||||
for (Iterator i = getOptions(state); i.hasNext();) {
|
||||
Option o = (Option) i.next();
|
||||
o.generateXML(state, optionGroup);
|
||||
//Build a list of all options we can operator on.
|
||||
final List<Option> options = new ArrayList<Option>();
|
||||
for (Iterator<Option> iterator = getOptions(state); iterator.hasNext();) {
|
||||
options.add(iterator.next());
|
||||
}
|
||||
|
||||
//If the sort mode is not {@code NO_SORT}, sort the the list.
|
||||
if (sortMode != SortMode.NO_SORT) {
|
||||
|
||||
//If exclude first is sest to true the first option should stay on the top.
|
||||
//We simply remove the first option from our list and generate the XML for it here.
|
||||
if (excludeFirst && !options.isEmpty()) {
|
||||
final Option first = options.remove(0);
|
||||
first.generateXML(state, optionGroup);
|
||||
}
|
||||
|
||||
//Sort the list using our {@link AlphabeticalSortComparator}.
|
||||
Collections.sort(options, new AlphabeticalSortComparator(state));
|
||||
}
|
||||
|
||||
//Generate the XML for the options.
|
||||
for (Option option : options) {
|
||||
option.generateXML(state, optionGroup);
|
||||
}
|
||||
|
||||
// for (Iterator<Option> iterator = getOptions(state); iterator.hasNext();) {
|
||||
// Option option = iterator.next();
|
||||
// option.generateXML(state, optionGroup);
|
||||
// }
|
||||
if (null != m_otherOption) {
|
||||
m_otherOption.generateXML(state, optionGroup);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class RadioGroup extends OptionGroup implements BebopConstants {
|
|||
|
||||
public RadioGroup(ParameterModel model) {
|
||||
super(model);
|
||||
m_xmlElement = BEBOP_RADIO;
|
||||
//m_xmlElement = BEBOP_RADIO;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -74,6 +74,11 @@ public class RadioGroup extends OptionGroup implements BebopConstants {
|
|||
return BEBOP_RADIOGROUP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOptionXMLElement() {
|
||||
return BEBOP_RADIO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a multiple (and not single) selection option group?
|
||||
*
|
||||
|
|
|
|||
|
|
@ -36,9 +36,20 @@ import com.arsdigita.bebop.util.BebopConstants;
|
|||
* @version $Id: Select.java 738 2005-09-01 12:36:52Z sskracic $ */
|
||||
public abstract class Select extends OptionGroup implements BebopConstants {
|
||||
|
||||
public Select(ParameterModel model) {
|
||||
public Select(final ParameterModel model) {
|
||||
super(model);
|
||||
m_xmlElement = BEBOP_OPTION;
|
||||
//m_xmlElement = BEBOP_OPTION;
|
||||
}
|
||||
|
||||
public Select(final ParameterModel model,
|
||||
final OptionGroup.SortMode sortMode) {
|
||||
super(model, sortMode);
|
||||
}
|
||||
|
||||
public Select(final ParameterModel model,
|
||||
final OptionGroup.SortMode sortMode,
|
||||
final boolean excludeFirst) {
|
||||
super(model, sortMode, excludeFirst);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -68,4 +79,8 @@ public abstract class Select extends OptionGroup implements BebopConstants {
|
|||
* @return The tag to be used for the top level DOM element
|
||||
* generated for this type of Widget. */
|
||||
protected abstract String getElementTag();
|
||||
|
||||
public String getOptionXMLElement() {
|
||||
return BEBOP_OPTION;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,8 +22,7 @@ import com.arsdigita.bebop.parameters.StringParameter;
|
|||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
|
||||
/**
|
||||
* A class representing an HTML <code>SELECT</code> element with
|
||||
* a single selection.
|
||||
* A class representing an HTML <code>SELECT</code> element with a single selection.
|
||||
*
|
||||
* @author Karl Goldstein
|
||||
* @author Uday Mathur
|
||||
|
|
@ -34,41 +33,56 @@ import com.arsdigita.bebop.parameters.ParameterModel;
|
|||
*/
|
||||
public class SingleSelect extends Select {
|
||||
|
||||
/** The XML tag.
|
||||
* @return The tag to be used for the top level DOM element
|
||||
* generated for this type of Widget.
|
||||
/**
|
||||
* The XML tag.
|
||||
*
|
||||
* @return The tag to be used for the top level DOM element generated for this type of Widget.
|
||||
*/
|
||||
protected String getElementTag() {
|
||||
return BEBOP_SELECT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new SingleSelect widget, using a StringParameter model
|
||||
* with the given parameter name. Since you can only have one
|
||||
* item selected from a SingleSelect, the string parameter returns
|
||||
* the value of the selected option.
|
||||
* <p>This is equivalent to
|
||||
* <code>SingleSelect(new StringParameter(name))</code>
|
||||
* Creates a new SingleSelect widget, using a StringParameter model with the given parameter
|
||||
* name. Since you can only have one item selected from a SingleSelect, the string parameter
|
||||
* returns the value of the selected option.
|
||||
* <p>
|
||||
* This is equivalent to <code>SingleSelect(new StringParameter(name))</code>
|
||||
*
|
||||
* @param name the name of the string parameter
|
||||
*/
|
||||
public SingleSelect(String name) {
|
||||
public SingleSelect(final String name) {
|
||||
super(new StringParameter(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new SingleSelect widget, using the given
|
||||
* parameter model.
|
||||
* Creates a new SingleSelect widget, using the given parameter model.
|
||||
*
|
||||
* @param model the parameter model
|
||||
*/
|
||||
public SingleSelect(ParameterModel model) {
|
||||
public SingleSelect(final ParameterModel model) {
|
||||
super(model);
|
||||
}
|
||||
|
||||
/** State that this is a single select
|
||||
public SingleSelect(final ParameterModel model,
|
||||
final OptionGroup.SortMode sortMode) {
|
||||
super(model, sortMode);
|
||||
}
|
||||
|
||||
public SingleSelect(final ParameterModel model,
|
||||
final OptionGroup.SortMode sortMode,
|
||||
final boolean excludeFirst) {
|
||||
super(model, sortMode, excludeFirst);
|
||||
}
|
||||
|
||||
/**
|
||||
* State that this is a single select
|
||||
*
|
||||
* @return false
|
||||
*/
|
||||
@Override
|
||||
public boolean isMultiple() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import com.arsdigita.cms.ui.CMSDHTMLEditor;
|
|||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import java.text.Collator;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
|
|
@ -105,8 +106,11 @@ public class PublicationPropertyForm
|
|||
|
||||
@Override
|
||||
public int compare(final Locale locale1, final Locale locale2) {
|
||||
return locale1.getDisplayName(GlobalizationHelper.getNegotiatedLocale()).compareTo(
|
||||
locale2.getDisplayName(GlobalizationHelper.getNegotiatedLocale()));
|
||||
final Locale negLocale = GlobalizationHelper.getNegotiatedLocale();
|
||||
final Collator collator = Collator.getInstance(negLocale);
|
||||
|
||||
return collator.compare(locale1.getDisplayName(negLocale),
|
||||
locale2.getDisplayName(negLocale));
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue