ItemSearchWidget

Dieverse Änderungen am ItemSearchWidget

 * Übersetzung vom Browse-Pane
 * Such-Fomular erweitert, so daß die Liste der Contenttypen jetzt durch den Basis-CT eingeschränkt wird.
 * viele andere Kleinigkeiten - hauptsächlich Formatierung

git-svn-id: https://svn.libreccm.org/ccm/trunk@636 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2010-11-25 18:16:01 +00:00
parent e3d3b435ac
commit b57e0d9474
18 changed files with 753 additions and 766 deletions

View File

@ -28,7 +28,6 @@ package com.arsdigita.cms;
* // URL resource: protocol handler removal: START * // URL resource: protocol handler removal: START
* Will be removed as soon as a stable release 6.6 is created. * Will be removed as soon as a stable release 6.6 is created.
*/ */
import com.arsdigita.bebop.SimpleComponent; import com.arsdigita.bebop.SimpleComponent;
import com.arsdigita.bebop.form.DHTMLEditor; import com.arsdigita.bebop.form.DHTMLEditor;
import com.arsdigita.categorization.Category; import com.arsdigita.categorization.Category;
@ -117,51 +116,37 @@ public final class CMSConfig extends AbstractConfig {
return s_config; return s_config;
} }
/** /**
* Storage (map) for method getAssetStepsToSkip(ContentType type) to store * Storage (map) for method getAssetStepsToSkip(ContentType type) to store
* mapping of steps that are deemed irrelevant for the passid in type. * mapping of steps that are deemed irrelevant for the passid in type.
*/ */
private static Map s_skipAssetSteps = null; private static Map s_skipAssetSteps = null;
/** /**
* Item category add form speciofies Subclass of ItemCategoryForm * Item category add form speciofies Subclass of ItemCategoryForm
* to use for the assign categories step. * to use for the assign categories step.
* Used in c.ad.cms.ui.authoring.ItemCategoryStep * Used in c.ad.cms.ui.authoring.ItemCategoryStep
*/ */
private final Parameter private final Parameter m_categoryAuthoringAddForm = new SpecificClassParameter("com.arsdigita.cms.category_authoring_add_form",
m_categoryAuthoringAddForm = new SpecificClassParameter
("com.arsdigita.cms.category_authoring_add_form",
Parameter.REQUIRED, Parameter.REQUIRED,
ItemCategoryForm.class, ItemCategoryForm.class,
SimpleComponent.class); SimpleComponent.class);
/** /**
* Path for the default item template. Path is relative to the * Path for the default item template. Path is relative to the
* Template Root path. * Template Root path.
*/ */
private final Parameter private final Parameter m_defaultItemTemplatePath = new StringParameter("com.arsdigita.cms.default_item_template_path",
m_defaultItemTemplatePath = new StringParameter
("com.arsdigita.cms.default_item_template_path",
Parameter.REQUIRED, "/default/item.jsp"); Parameter.REQUIRED, "/default/item.jsp");
/** /**
* Path for the default folder template. Path is relative to the * Path for the default folder template. Path is relative to the
* Template Root path. * Template Root path.
*/ */
private final Parameter private final Parameter m_defaultFolderTemplatePath = new StringParameter("com.arsdigita.cms.default_folder_template_path",
m_defaultFolderTemplatePath = new StringParameter
("com.arsdigita.cms.default_folder_template_path",
Parameter.REQUIRED, "/default/folder.jsp"); Parameter.REQUIRED, "/default/folder.jsp");
/** /**
* Path for the default template folder. Path is relative to webapp root * Path for the default template folder. Path is relative to webapp root
*/ */
private final Parameter private final Parameter m_templateRootPath = new StringParameter("com.arsdigita.cms.template_root_path",
m_templateRootPath = new StringParameter
("com.arsdigita.cms.template_root_path",
Parameter.REQUIRED, "/packages/content-section/templates"); Parameter.REQUIRED, "/packages/content-section/templates");
// URL resource: protocol handler removal: START // URL resource: protocol handler removal: START
// remove: // remove:
// try { // try {
@ -177,29 +162,21 @@ public final class CMSConfig extends AbstractConfig {
* Item Adapters File, path to an XML resource containing adapter * Item Adapters File, path to an XML resource containing adapter
* specifications. Path is relative to webapp root. * specifications. Path is relative to webapp root.
*/ */
private final Parameter private final Parameter m_itemAdapters = new ResourceParameter("com.arsdigita.cms.item_adapters",
m_itemAdapters = new ResourceParameter
("com.arsdigita.cms.item_adapters",
Parameter.REQUIRED, Parameter.REQUIRED,
"/WEB-INF/resources/cms-item-adapters.xml"); "/WEB-INF/resources/cms-item-adapters.xml");
// URL resource: protocol handler removal: END // URL resource: protocol handler removal: END
/** /**
* Use streamlined content creation: upon item creation, * Use streamlined content creation: upon item creation,
* automatically open authoring steps and forward to the next step * automatically open authoring steps and forward to the next step
*/ */
private final Parameter private final Parameter m_useStreamlinedCreation = new BooleanParameter("com.arsdigita.cms.use_streamlined_creation",
m_useStreamlinedCreation = new BooleanParameter
("com.arsdigita.cms.use_streamlined_creation",
Parameter.REQUIRED, new Boolean(true)); Parameter.REQUIRED, new Boolean(true));
/** /**
* DHTML Editor Configuration for use in CMS module, lists the * DHTML Editor Configuration for use in CMS module, lists the
* config object name and Javascript source location for its definition. * config object name and Javascript source location for its definition.
*/ */
private final Parameter private final Parameter m_dhtmlEditorConfig = new DHTMLEditorConfigParameter("com.arsdigita.cms.dhtml_editor_config",
m_dhtmlEditorConfig = new DHTMLEditorConfigParameter
("com.arsdigita.cms.dhtml_editor_config",
Parameter.REQUIRED, Parameter.REQUIRED,
new DHTMLEditor.Config("XinhaConfig", new DHTMLEditor.Config("XinhaConfig",
"/assets/xinha/CCMcmsXinhaConfig.js")); "/assets/xinha/CCMcmsXinhaConfig.js"));
@ -213,222 +190,149 @@ public final class CMSConfig extends AbstractConfig {
// content items for links and internal image assets, which may not // content items for links and internal image assets, which may not
// be accessable by other modules which use DHTMLeditor. // be accessable by other modules which use DHTMLeditor.
// Would be bad style to configure a cms specific parameter in core. // Would be bad style to configure a cms specific parameter in core.
/** /**
* Defines which plugins to use, e.g.TableOperations,CSS * Defines which plugins to use, e.g.TableOperations,CSS
* Format: [string,string,string] * Format: [string,string,string]
*/ */
private final Parameter private final Parameter m_dhtmlEditorPlugins = new StringArrayParameter("com.arsdigita.cms.dhtml_editor_plugins",
m_dhtmlEditorPlugins = new StringArrayParameter
("com.arsdigita.cms.dhtml_editor_plugins",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
/** /**
* Prevent undesirable functions from being made available, * Prevent undesirable functions from being made available,
* eg images should only be added through the cms methods. * eg images should only be added through the cms methods.
*/ */
private final Parameter private final Parameter m_dhtmlEditorHiddenButtons = new StringArrayParameter("com.arsdigita.cms.dhtml_editor_hidden_buttons",
m_dhtmlEditorHiddenButtons = new StringArrayParameter
("com.arsdigita.cms.dhtml_editor_hidden_buttons",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
/** /**
* Hide section admin tabs from users without administrative rights. * Hide section admin tabs from users without administrative rights.
*/ */
private final Parameter private final Parameter m_hideAdminTabs = new BooleanParameter("com.arsdigita.cms.hide_admin_tabs",
m_hideAdminTabs = new BooleanParameter
("com.arsdigita.cms.hide_admin_tabs",
Parameter.REQUIRED, new Boolean(false)); Parameter.REQUIRED, new Boolean(false));
/** /**
* Hide Folder Index Checkbox from folder view * Hide Folder Index Checkbox from folder view
*/ */
private final Parameter private final Parameter m_hideFolderIndexCheckbox = new BooleanParameter("com.arsdigita.cms.hide_folder_index_checkbox",
m_hideFolderIndexCheckbox = new BooleanParameter
("com.arsdigita.cms.hide_folder_index_checkbox",
Parameter.REQUIRED, new Boolean(false)); Parameter.REQUIRED, new Boolean(false));
/** /**
* Hide launch date parameter on all forms and displays where it's used. * Hide launch date parameter on all forms and displays where it's used.
*/ */
private final Parameter private final Parameter m_hideLaunchDate = new BooleanParameter("com.arsdigita.cms.hide_launch_date",
m_hideLaunchDate = new BooleanParameter
("com.arsdigita.cms.hide_launch_date",
Parameter.REQUIRED, new Boolean(true)); Parameter.REQUIRED, new Boolean(true));
/** /**
* Require the launch date parameter to be set by the content author. * Require the launch date parameter to be set by the content author.
*/ */
private final Parameter private final Parameter m_requireLaunchDate = new BooleanParameter("com.arsdigita.cms.require_launch_date",
m_requireLaunchDate = new BooleanParameter
("com.arsdigita.cms.require_launch_date",
Parameter.REQUIRED, new Boolean(false)); Parameter.REQUIRED, new Boolean(false));
/** /**
* Hide the templates tab on the item admin page. * Hide the templates tab on the item admin page.
*/ */
private final Parameter private final Parameter m_hideTemplatesTab = new BooleanParameter("com.arsdigita.cms.hide_templates_tab",
m_hideTemplatesTab = new BooleanParameter
("com.arsdigita.cms.hide_templates_tab",
Parameter.REQUIRED, new Boolean(false)); Parameter.REQUIRED, new Boolean(false));
/** /**
* Hide the upload file link in the editing of a text asset. * Hide the upload file link in the editing of a text asset.
*/ */
private final Parameter private final Parameter m_hideTextAssetUploadFile = new BooleanParameter("com.arsdigita.cms.hide_text_asset_upload_file",
m_hideTextAssetUploadFile = new BooleanParameter
("com.arsdigita.cms.hide_text_asset_upload_file",
Parameter.REQUIRED, Parameter.REQUIRED,
new Boolean(false)); new Boolean(false));
/** /**
* Hide timezone labels (if, for example, all users will be in the * Hide timezone labels (if, for example, all users will be in the
* same timezone and such information would be unnecessary) * same timezone and such information would be unnecessary)
*/ */
private final Parameter private final Parameter m_hideTimezone = new BooleanParameter("com.arsdigita.cms.hide_timezone",
m_hideTimezone = new BooleanParameter
("com.arsdigita.cms.hide_timezone",
Parameter.REQUIRED, new Boolean(false)); Parameter.REQUIRED, new Boolean(false));
/** /**
* Hide User Defined Content Types UI * Hide User Defined Content Types UI
*/ */
private final Parameter private final Parameter m_hideUDCTUI = new BooleanParameter("com.arsdigita.cms.hide_udct_ui",
m_hideUDCTUI = new BooleanParameter
("com.arsdigita.cms.hide_udct_ui",
Parameter.REQUIRED, new Boolean(false)); Parameter.REQUIRED, new Boolean(false));
/** /**
* Specifies the name of the class to use as a PublishLifecycleListener * Specifies the name of the class to use as a PublishLifecycleListener
*/ */
private final Parameter private final Parameter m_publishLifecycleListenerClass = new StringParameter("com.arsdigita.cms.publish_lifecycle_listener_class",
m_publishLifecycleListenerClass = new StringParameter
("com.arsdigita.cms.publish_lifecycle_listener_class",
Parameter.OPTIONAL, PublishLifecycleListener.class.getName()); Parameter.OPTIONAL, PublishLifecycleListener.class.getName());
/** /**
* Wether the Wysiwyg editor should clear the text of MSWord tags, * Wether the Wysiwyg editor should clear the text of MSWord tags,
* everytime the user clicks on 'Save' * everytime the user clicks on 'Save'
*/ */
private final Parameter private final Parameter m_saveTextCleansWordTags = new BooleanParameter("com.arsdigita.cms.save_text_cleans_word_tags",
m_saveTextCleansWordTags = new BooleanParameter
("com.arsdigita.cms.save_text_cleans_word_tags",
Parameter.OPTIONAL, new Boolean(false)); Parameter.OPTIONAL, new Boolean(false));
/** /**
* Hide Additional Resource Fields on RelatedLinkPropertyForm * Hide Additional Resource Fields on RelatedLinkPropertyForm
*/ */
private final Parameter private final Parameter m_hideAdditionalResourceFields = new BooleanParameter("com.arsdigita.cms.contentassets.ui."
m_hideAdditionalResourceFields = new BooleanParameter + "RelatedLinkPropertyForm.hideAdditionalResourceFields",
("com.arsdigita.cms.contentassets.ui."+
"RelatedLinkPropertyForm.hideAdditionalResourceFields",
Parameter.REQUIRED, new Boolean(false)); Parameter.REQUIRED, new Boolean(false));
/** /**
* Get the search indexing not to process FileAssets, * Get the search indexing not to process FileAssets,
* eg to avoid PDF slowdowns * eg to avoid PDF slowdowns
*/ */
private final Parameter private final Parameter m_disableFileAssetExtraction = new BooleanParameter("com.arsdigita.cms.search.disableFileAssetExtraction",
m_disableFileAssetExtraction = new BooleanParameter
("com.arsdigita.cms.search.disableFileAssetExtraction",
Parameter.REQUIRED, new Boolean(false)); Parameter.REQUIRED, new Boolean(false));
/** /**
* Whether an item's workflow should be deleted, once the item * Whether an item's workflow should be deleted, once the item
* has been (re)published * has been (re)published
*/ */
private final Parameter private final Parameter m_deleteWorkflowAfterPublication = new BooleanParameter("com.arsdigita.cms.delete_workflow_after_publication",
m_deleteWorkflowAfterPublication = new BooleanParameter
("com.arsdigita.cms.delete_workflow_after_publication",
Parameter.REQUIRED, new Boolean(true)); Parameter.REQUIRED, new Boolean(true));
/** /**
* Defines the number of days ahead that are covered in the * Defines the number of days ahead that are covered in the
* 'Soon Expired' tab * 'Soon Expired' tab
*/ */
private final Parameter private final Parameter m_soonExpiredTimespanDays = new IntegerParameter("com.arsdigita.cms.soon_expired_timespan_days",
m_soonExpiredTimespanDays = new IntegerParameter
("com.arsdigita.cms.soon_expired_timespan_days",
Parameter.REQUIRED, new Integer(14)); Parameter.REQUIRED, new Integer(14));
/** /**
* Defines the number of months ahead that are covered in the * Defines the number of months ahead that are covered in the
* 'Soon Expired' tab * 'Soon Expired' tab
*/ */
private final Parameter private final Parameter m_soonExpiredTimespanMonths = new IntegerParameter("com.arsdigita.cms.soon_expired_timespan_months",
m_soonExpiredTimespanMonths = new IntegerParameter
("com.arsdigita.cms.soon_expired_timespan_months",
Parameter.REQUIRED, new Integer(1)); Parameter.REQUIRED, new Integer(1));
/** /**
* Does a redirect to the unpublished item generate not found error? * Does a redirect to the unpublished item generate not found error?
*/ */
private final Parameter private final Parameter m_unpublishedNotFound = new BooleanParameter("com.arsdigita.cms.unpublished_not_found",
m_unpublishedNotFound = new BooleanParameter
("com.arsdigita.cms.unpublished_not_found",
Parameter.REQUIRED, new Boolean(true)); Parameter.REQUIRED, new Boolean(true));
/** /**
* Links created through browse interfaces should only be within the * Links created through browse interfaces should only be within the
* same subsite * same subsite
*/ */
private final Parameter private final Parameter m_linksOnlyInSameSubsite = new BooleanParameter("com.arsdigita.cms.browse_links_in_same_subsite_only",
m_linksOnlyInSameSubsite = new BooleanParameter
("com.arsdigita.cms.browse_links_in_same_subsite_only",
Parameter.REQUIRED, new Boolean(false)); Parameter.REQUIRED, new Boolean(false));
/** /**
* Item category step extension hook: Subclass of ItemCategoryExtension * Item category step extension hook: Subclass of ItemCategoryExtension
* which adds extension actions for the category authoring step * which adds extension actions for the category authoring step
*/ */
private final Parameter private final Parameter m_categoryAuthoringExtension = new SpecificClassParameter("com.arsdigita.cms.category_authoring_extension",
m_categoryAuthoringExtension = new SpecificClassParameter
("com.arsdigita.cms.category_authoring_extension",
Parameter.REQUIRED, Parameter.REQUIRED,
ItemCategoryExtension.class, ItemCategoryExtension.class,
ItemCategoryExtension.class); ItemCategoryExtension.class);
/** /**
* Link available to reset lifecycle on republish. If false don't display * Link available to reset lifecycle on republish. If false don't display
* the link otherwise display. * the link otherwise display.
*/ */
private final Parameter private final Parameter m_hideResetLifecycleLink = new BooleanParameter("com.arsdigita.cms.hide_reset_lifecycle_link",
m_hideResetLifecycleLink = new BooleanParameter
("com.arsdigita.cms.hide_reset_lifecycle_link",
Parameter.OPTIONAL, new Boolean(true)); Parameter.OPTIONAL, new 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 private final Parameter m_scoreTitleAndKeywords = new BooleanParameter("com.arsdigita.cms.search.score_title_and_keywords",
m_scoreTitleAndKeywords = new BooleanParameter
("com.arsdigita.cms.search.score_title_and_keywords",
Parameter.OPTIONAL, Parameter.OPTIONAL,
Boolean.FALSE); Boolean.FALSE);
/** /**
* Title Weight, the relative weight given to title element within * Title Weight, the relative weight given to title element within
* cms:item when ranking search results (only used by interMedia) * cms:item when ranking search results (only used by interMedia)
*/ */
private final Parameter private final Parameter m_titleWeight = new IntegerParameter("com.arsdigita.cms.search.intermedia.title_weight",
m_titleWeight = new IntegerParameter
("com.arsdigita.cms.search.intermedia.title_weight",
Parameter.OPTIONAL, Parameter.OPTIONAL,
new Integer(1)); new Integer(1));
/** /**
* Keyword Weight, the relative weight given to the dcKeywords element * Keyword Weight, the relative weight given to the dcKeywords element
* within dublinCore element within cms:item element when ranking * within dublinCore element within cms:item element when ranking
* search results (only used by interMedia) * search results (only used by interMedia)
*/ */
private final Parameter private final Parameter m_keywordWeight = new IntegerParameter("com.arsdigita.cms.search.intermedia.keyword_weight",
m_keywordWeight = new IntegerParameter
("com.arsdigita.cms.search.intermedia.keyword_weight",
Parameter.OPTIONAL, Parameter.OPTIONAL,
new Integer(1)); new Integer(1));
/** /**
* Asset steps to skip, specify asset steps that are not relevant for * Asset steps to skip, specify asset steps that are not relevant for
* specific content types. * specific content types.
@ -438,101 +342,69 @@ public final class CMSConfig extends AbstractConfig {
* Second string is the name of the bebop step component * Second string is the name of the bebop step component
* eg com.arsdigita.cms.contenttypes.ui.ImageStep * eg com.arsdigita.cms.contenttypes.ui.ImageStep
*/ */
private final Parameter private final Parameter m_skipAssetSteps = new StringArrayParameter("com.arsdigita.cms.skip_asset_steps",
m_skipAssetSteps = new StringArrayParameter
("com.arsdigita.cms.skip_asset_steps",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
/** /**
* Mandatory Descriptions Content types may refer to this to decide * Mandatory Descriptions Content types may refer to this to decide
* whether to validate against empty descriptions * whether to validate against empty descriptions
*/ */
private final Parameter private final Parameter m_mandatoryDescriptions = new BooleanParameter("com.arsdigita.cms.mandatory_descriptions",
m_mandatoryDescriptions = new BooleanParameter
("com.arsdigita.cms.mandatory_descriptions",
Parameter.OPTIONAL, new Boolean(false)); Parameter.OPTIONAL, new Boolean(false));
/** /**
* Delete Finished Lifecycles. Decide whether lifecycles and their phases * Delete Finished Lifecycles. Decide whether lifecycles and their phases
* should be deleted from the system when finished. * should be deleted from the system when finished.
*/ */
private final Parameter private final Parameter m_deleteLifecycleWhenComplete = new BooleanParameter("com.arsdigita.cms.delete_lifecycle_when_complete",
m_deleteLifecycleWhenComplete = new BooleanParameter
("com.arsdigita.cms.delete_lifecycle_when_complete",
Parameter.OPTIONAL, new Boolean(false)); Parameter.OPTIONAL, new Boolean(false));
/** /**
* Contacts for content items. Allows you to add a Contact authoring step * Contacts for content items. Allows you to add a Contact authoring step
* to all items * to all items
*/ */
private final Parameter private final Parameter m_hasContactsAuthoringStep = new BooleanParameter("com.arsdigita.cms.has_contacts_authoring_step",
m_hasContactsAuthoringStep = new BooleanParameter
("com.arsdigita.cms.has_contacts_authoring_step",
Parameter.REQUIRED, new Boolean(false)); Parameter.REQUIRED, new Boolean(false));
/** /**
* Ordering for nodes in assign category tree. Decide whether entries * Ordering for nodes in assign category tree. Decide whether entries
* should be ordered alphabetically or according to sort key * should be ordered alphabetically or according to sort key
* (maintained in category admin tab in content centre) * (maintained in category admin tab in content centre)
* SortKey|Alphabetical is initialized in constructor! See below. * SortKey|Alphabetical is initialized in constructor! See below.
*/ */
private final Parameter private final Parameter m_categoryTreeOrdering = new EnumerationParameter("com.arsdigita.cms.category_tree_order",
m_categoryTreeOrdering = new EnumerationParameter
("com.arsdigita.cms.category_tree_order",
Parameter.OPTIONAL, Category.SORT_KEY); Parameter.OPTIONAL, Category.SORT_KEY);
/** /**
* Allow content creation in section listing. Allows you to turn off * Allow content creation in section listing. Allows you to turn off
* the ability to create content in the section listing * the ability to create content in the section listing
*/ */
private final Parameter private final Parameter m_allowContentCreateInSectionListing = new BooleanParameter("com.arsdigita.cms.allow_content_create_in_section_listing",
m_allowContentCreateInSectionListing = new BooleanParameter
("com.arsdigita.cms.allow_content_create_in_section_listing",
Parameter.REQUIRED, Parameter.REQUIRED,
new Boolean(true)); new Boolean(true));
// /////////////////////////////////////////// // ///////////////////////////////////////////
// Notification related parameters // Notification related parameters
// /////////////////////////////////////////// // ///////////////////////////////////////////
/** /**
* Delete Sent Workflow Notifications. Decide whether successfully sent * Delete Sent Workflow Notifications. Decide whether successfully sent
* notifications and messages should be deleted from the system * notifications and messages should be deleted from the system
*/ */
private final Parameter private final Parameter m_deleteWorkflowNotificationsWhenSent = new BooleanParameter("com.arsdigita.cms.delete_workflow_notification_when_sent",
m_deleteWorkflowNotificationsWhenSent = new BooleanParameter
("com.arsdigita.cms.delete_workflow_notification_when_sent",
Parameter.OPTIONAL, new Boolean(false)); Parameter.OPTIONAL, new Boolean(false));
/** /**
* Decide whether successfully sent notifications and messages * Decide whether successfully sent notifications and messages
* should be deleted from the system * should be deleted from the system
*/ */
private final Parameter private final Parameter m_deleteExpiryNotificationsWhenSent = new BooleanParameter("com.arsdigita.cms.delete_expiry_notification_when_sent",
m_deleteExpiryNotificationsWhenSent = new BooleanParameter
("com.arsdigita.cms.delete_expiry_notification_when_sent",
Parameter.OPTIONAL, new Boolean(false)); Parameter.OPTIONAL, new Boolean(false));
/** /**
* Amount of time (in hours) before the expiration of a content item * Amount of time (in hours) before the expiration of a content item
* that users in the Alert Recipient role are alerted via email * that users in the Alert Recipient role are alerted via email
*/ */
private final Parameter private final Parameter m_defaultNotificationTime = new IntegerParameter("com.arsdigita.cms.default_notification_time",
m_defaultNotificationTime = new IntegerParameter
("com.arsdigita.cms.default_notification_time",
Parameter.REQUIRED, new Integer(0)); Parameter.REQUIRED, new Integer(0));
/** /**
* Wether a content item's author should be notified * Wether a content item's author should be notified
* by the item's LifecycleListener; defaults to true * by the item's LifecycleListener; defaults to true
*/ */
private final Parameter private final Parameter m_notifyAuthorOnLifecycle = new BooleanParameter("com.arsdigita.cms.notify_author_on_lifecycle",
m_notifyAuthorOnLifecycle = new BooleanParameter
("com.arsdigita.cms.notify_author_on_lifecycle",
Parameter.OPTIONAL, new Boolean(true)); Parameter.OPTIONAL, new Boolean(true));
// //////////////////////////////////////////////////// // ////////////////////////////////////////////////////
// Content Center (Workspace) config related parameters // Content Center (Workspace) config related parameters
// //////////////////////////////////////////////////// // ////////////////////////////////////////////////////
@ -540,21 +412,15 @@ public final class CMSConfig extends AbstractConfig {
* XML Mapping of the content center tabs to URLs, see * XML Mapping of the content center tabs to URLs, see
* {@link ContentCenterDispatcher} * {@link ContentCenterDispatcher}
*/ */
private final StringParameter private final StringParameter m_contentCenterMap = new StringParameter(
m_contentCenterMap = new StringParameter(
"com.arsdigita.cms.loader.content_center_map", "com.arsdigita.cms.loader.content_center_map",
Parameter.REQUIRED, Parameter.REQUIRED,
"/WEB-INF/resources/content-center-map.xml"); "/WEB-INF/resources/content-center-map.xml");
// /////////////////////////////////////////// // ///////////////////////////////////////////
// Content Section config related parameters // Content Section config related parameters
// /////////////////////////////////////////// // ///////////////////////////////////////////
private final Parameter private final Parameter m_defaultSection = new StringParameter("com.arsdigita.cms.default_content_section",
m_defaultSection = new StringParameter
("com.arsdigita.cms.default_content_section",
Parameter.REQUIRED, "content"); Parameter.REQUIRED, "content");
// /////////////////////////////////////////// // ///////////////////////////////////////////
// Content Section creation parameters // Content Section creation parameters
// XXX these are probably temporary parameters, as the // XXX these are probably temporary parameters, as the
@ -562,30 +428,26 @@ public final class CMSConfig extends AbstractConfig {
// to SectionInitializer. However, it still may be useful to // to SectionInitializer. However, it still may be useful to
// keep these for the default values. // keep these for the default values.
// /////////////////////////////////////////// // ///////////////////////////////////////////
private final Parameter private final Parameter m_defaultItemResolverClass = new SpecificClassParameter("com.arsdigita.cms.default_item_resolver_class",
m_defaultItemResolverClass = new SpecificClassParameter
("com.arsdigita.cms.default_item_resolver_class",
Parameter.REQUIRED, Parameter.REQUIRED,
MultilingualItemResolver.class, MultilingualItemResolver.class,
ItemResolver.class); ItemResolver.class);
private final Parameter m_defaultTemplateResolverClass = new SpecificClassParameter("com.arsdigita.cms.default_template_resolver_class",
private final Parameter
m_defaultTemplateResolverClass = new SpecificClassParameter
("com.arsdigita.cms.default_template_resolver_class",
Parameter.REQUIRED, Parameter.REQUIRED,
DefaultTemplateResolver.class, DefaultTemplateResolver.class,
TemplateResolver.class); TemplateResolver.class);
/////////////////////////////////////////////
// ItemSearchWidget
/////////////////////////////////////////////
private final Parameter m_itemSearchDefaultTab = new StringParameter("com.arsdigita.cms.item_search.default_tab",
Parameter.REQUIRED, "browse");
// /////////////////////////////////////////// // ///////////////////////////////////////////
// publishToFile package related parameter // publishToFile package related parameter
// /////////////////////////////////////////// // ///////////////////////////////////////////
// Moved to publishToFile.PublishToFileConfig as of version 6.0.2 // Moved to publishToFile.PublishToFileConfig as of version 6.0.2
// private final Parameter m_disableItemPfs; // private final Parameter m_disableItemPfs;
// private final Parameter m_publishToFileClass; // private final Parameter m_publishToFileClass;
/** /**
* Constructor, but do NOT instantiate this class directly. * Constructor, but do NOT instantiate this class directly.
* *
@ -652,6 +514,8 @@ public final class CMSConfig extends AbstractConfig {
register(m_defaultItemResolverClass); register(m_defaultItemResolverClass);
register(m_defaultTemplateResolverClass); register(m_defaultTemplateResolverClass);
register(m_itemSearchDefaultTab);
// publishToFile package related parameter // publishToFile package related parameter
// Moved to publishToFile.PublishToFileConfig as of version 6.0.2 // Moved to publishToFile.PublishToFileConfig as of version 6.0.2
// register(m_disableItemPfs); // register(m_disableItemPfs);
@ -795,7 +659,6 @@ public final class CMSConfig extends AbstractConfig {
// /////////////////////////////////////////// // ///////////////////////////////////////////
// publishToFile package related configuration // publishToFile package related configuration
// /////////////////////////////////////////// // ///////////////////////////////////////////
// Moved to publishToFile.PublishToFileConfig! Temporarily retained here // Moved to publishToFile.PublishToFileConfig! Temporarily retained here
// for backwards compatibility // for backwards compatibility
public final boolean getDisableItemPfs() { public final boolean getDisableItemPfs() {
@ -808,7 +671,6 @@ public final class CMSConfig extends AbstractConfig {
return PublishToFileConfig.getConfig().getPublishListenerClass(); return PublishToFileConfig.getConfig().getPublishListenerClass();
} }
/** /**
* Fetch the file name contaning XML Mapping of the content center tabs * Fetch the file name contaning XML Mapping of the content center tabs
* to URLs * to URLs
@ -818,7 +680,6 @@ public final class CMSConfig extends AbstractConfig {
return (String) get(m_contentCenterMap); return (String) get(m_contentCenterMap);
} }
/** /**
* Internal class representing a DHTMLEditor configuration parameter. It * Internal class representing a DHTMLEditor configuration parameter. It
* creates a new DHMTLEditor Config object (internal class in DHTMLEditor). * creates a new DHMTLEditor Config object (internal class in DHTMLEditor).
@ -833,6 +694,7 @@ public final class CMSConfig extends AbstractConfig {
* (pboy, 2010-09-02) * (pboy, 2010-09-02)
*/ */
private class DHTMLEditorConfigParameter extends StringParameter { private class DHTMLEditorConfigParameter extends StringParameter {
public DHTMLEditorConfigParameter(final String name, public DHTMLEditorConfigParameter(final String name,
final int multiplicity, final int multiplicity,
final Object defaultObj) { final Object defaultObj) {
@ -850,8 +712,6 @@ public final class CMSConfig extends AbstractConfig {
return DHTMLEditor.Config.valueOf(value); return DHTMLEditor.Config.valueOf(value);
} }
} }
protected static HashMap extraXMLGenerators = new HashMap(); protected static HashMap extraXMLGenerators = new HashMap();
/** Add one ExtraXMLGenerator to the list. */ /** Add one ExtraXMLGenerator to the list. */
@ -871,6 +731,7 @@ public final class CMSConfig extends AbstractConfig {
public static Iterator getExtraXMLGeneratorsIterator() { public static Iterator getExtraXMLGeneratorsIterator() {
return extraXMLGenerators.entrySet().iterator(); return extraXMLGenerators.entrySet().iterator();
} }
public final boolean hideResetLifecycleLink() { public final boolean hideResetLifecycleLink() {
return ((Boolean) get(m_hideResetLifecycleLink)).booleanValue(); return ((Boolean) get(m_hideResetLifecycleLink)).booleanValue();
} }
@ -905,7 +766,6 @@ public final class CMSConfig extends AbstractConfig {
return ((Boolean) get(m_scoreTitleAndKeywords)).booleanValue(); return ((Boolean) get(m_scoreTitleAndKeywords)).booleanValue();
} }
/** /**
* for the given content type, returns a collection of * for the given content type, returns a collection of
* steps that are deemed irrelevant for the type. * steps that are deemed irrelevant for the type.
@ -1024,4 +884,8 @@ public final class CMSConfig extends AbstractConfig {
public final boolean getAllowContentCreateInSectionListing() { public final boolean getAllowContentCreateInSectionListing() {
return ((Boolean) get(m_allowContentCreateInSectionListing)).booleanValue(); return ((Boolean) get(m_allowContentCreateInSectionListing)).booleanValue();
} }
public String getItemSearchDefaultTab() {
return (String) get(m_itemSearchDefaultTab);
}
} }

View File

@ -227,3 +227,14 @@ com.arsdigita.cms.allow_content_create_in_section_listing.title=Allow content cr
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
com.arsdigita.cms.allow_content_create_in_section_listing.format=[boolean] com.arsdigita.cms.allow_content_create_in_section_listing.format=[boolean]
com.arsdigita.cms.item_search.default_tab.title=Set the default tabe for ItemSearchWidget
com.arsdigita.cms.item_search.default_tab.purpose=Select either "browse" or "search" for default tab
com.arsdigita.cms.item_search.default_tab.example=browse
com.arsdigita.cms.item_search.default_tab.format=[string]
com.arsdigita.cms.item_search.xx.title=
com.arsdigita.cms.item_search.xx.purpose=
com.arsdigita.cms.item_search.xx.example=
com.arsdigita.cms.item_search.xx.format=[string]

View File

@ -315,6 +315,7 @@ cms.ui.search_prompt=Search to add new members
cms.ui.search_to_add_new_members=Search to Add New Members cms.ui.search_to_add_new_members=Search to Add New Members
cms.ui.search_errors.empty_terms=Please enter some search terms cms.ui.search_errors.empty_terms=Please enter some search terms
cms.ui.search_errors.bad_terms=Your search terms contain illegal words or characters cms.ui.search_errors.bad_terms=Your search terms contain illegal words or characters
cms.ui.search_no_results=Sorry. Your search returned 0 results.
cms.ui.select_one=--select one-- cms.ui.select_one=--select one--
cms.ui.sign_out=Sign out cms.ui.sign_out=Sign out
cms.ui.submission_cancelled=Submission Cancelled cms.ui.submission_cancelled=Submission Cancelled
@ -346,6 +347,10 @@ cms.ui.workflow_profile_exists_on_selected_folder=Workflow Profile exists on sel
cms.ui.yes=Yes cms.ui.yes=Yes
cms.ui.you_do_not_have_sufficient_privileges_to_access_this_page=You do not have sufficient privileges to access this page. cms.ui.you_do_not_have_sufficient_privileges_to_access_this_page=You do not have sufficient privileges to access this page.
cms.ui.item_search.page_title=Item Search
cms.ui.item_search.browse=Browse
cms.ui.item_search.search=Search
# Package com.arsdigita.cms.ui.authoring # Package com.arsdigita.cms.ui.authoring
# ====================================== # ======================================

View File

@ -314,6 +314,7 @@ cms.ui.search_prompt=Suche um neue Mitglieder zu erg\u00e4nzen
cms.ui.search_to_add_new_members=Suche um neue Mitglieder zu erg\u00e4nzen cms.ui.search_to_add_new_members=Suche um neue Mitglieder zu erg\u00e4nzen
cms.ui.search_errors.empty_terms=Bitte Suchbegriffe eingeben cms.ui.search_errors.empty_terms=Bitte Suchbegriffe eingeben
cms.ui.search_errors.bad_terms=Your search terms contain illegal words or characters cms.ui.search_errors.bad_terms=Your search terms contain illegal words or characters
cms.ui.search_no_results=Ihre Suche ergab leider keine Treffer.
cms.ui.select_one=--ausw\u00e4hlen-- cms.ui.select_one=--ausw\u00e4hlen--
cms.ui.sign_out=Abmelden cms.ui.sign_out=Abmelden
cms.ui.submission_cancelled=Prozess abgebrochen cms.ui.submission_cancelled=Prozess abgebrochen
@ -345,7 +346,9 @@ cms.ui.workflow_profile_exists_on_selected_folder=Ablaufprofil existiert f\u00fc
cms.ui.yes=Ja cms.ui.yes=Ja
cms.ui.you_do_not_have_sufficient_privileges_to_access_this_page=Unzureichende Zugriffsrechte f\u00fcr diese Seite. cms.ui.you_do_not_have_sufficient_privileges_to_access_this_page=Unzureichende Zugriffsrechte f\u00fcr diese Seite.
cms.ui.item_search.page_title=Dokumentensuche
cms.ui.item_search.browse=Bl\u00e4ttern
cms.ui.item_search.search=Suchen
# Package com.arsdigita.cms.ui.authoring # Package com.arsdigita.cms.ui.authoring
# ====================================== # ======================================

View File

@ -35,11 +35,13 @@ import com.arsdigita.globalization.Locale;
import com.arsdigita.kernel.Group; import com.arsdigita.kernel.Group;
import com.arsdigita.kernel.SiteNode; import com.arsdigita.kernel.SiteNode;
import com.arsdigita.kernel.permissions.PermissionService; import com.arsdigita.kernel.permissions.PermissionService;
import com.arsdigita.persistence.CompoundFilter;
import com.arsdigita.persistence.DataAssociation; import com.arsdigita.persistence.DataAssociation;
import com.arsdigita.persistence.DataAssociationCursor; import com.arsdigita.persistence.DataAssociationCursor;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.FilterFactory;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.SessionManager; import com.arsdigita.persistence.SessionManager;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
@ -53,6 +55,7 @@ import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.StringTokenizer;
/** /**
* <p>A content section represents a collection of content that is * <p>A content section represents a collection of content that is
@ -776,6 +779,32 @@ public class ContentSection extends Application {
return types; return types;
} }
public ContentTypeCollection getSiblingsOfContentType(ContentType ct) {
ContentTypeCollection ctc = getContentTypes();
// The Filter Factory
FilterFactory ff = ctc.getFilterFactory();
// Create an or-filter
CompoundFilter or = ff.or();
// The content type must be either of the requested type
or.addFilter(ff.equals(ContentType.ID, ct.ID));
// Or must be a sibling of the requested type
try {
StringTokenizer strTok = new StringTokenizer(ct.getSiblings(), "/");
while (strTok.hasMoreElements()) {
or.addFilter(ff.equals(ContentType.ID, (String) strTok.nextElement()));
}
} catch (Exception ex) {
// WTF? The selected content type does not exist in the table???
}
ctc.addFilter(or);
return ctc;
}
/** /**
* Get all user-defined content types registered to the content section * Get all user-defined content types registered to the content section
* that can be created. * that can be created.

View File

@ -583,6 +583,7 @@ public class ContentType extends ACSObject {
ctc.addFilter(or); ctc.addFilter(or);
return ctc; return ctc;
} }
private static List s_xsl = new ArrayList(); private static List s_xsl = new ArrayList();
/** /**

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.cms.ui; package com.arsdigita.cms.ui;
import com.arsdigita.bebop.Form; import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Resettable; import com.arsdigita.bebop.Resettable;
@ -34,15 +33,11 @@ import com.arsdigita.search.ui.QueryGenerator;
* @author Stanislav Freidin (sfreidin@arsdigita.com) * @author Stanislav Freidin (sfreidin@arsdigita.com)
* @version $Id: ItemSearch.java 1940 2009-05-29 07:15:05Z terry $ * @version $Id: ItemSearch.java 1940 2009-05-29 07:15:05Z terry $
*/ */
public class ItemSearch extends Form public class ItemSearch extends Form implements Resettable, QueryGenerator {
implements Resettable, QueryGenerator {
private static final org.apache.log4j.Logger s_log = private static final org.apache.log4j.Logger s_log =
org.apache.log4j.Logger.getLogger(ItemSearch.class); org.apache.log4j.Logger.getLogger(ItemSearch.class);
public static final String SINGLE_TYPE_PARAM = ItemSearchSection.SINGLE_TYPE_PARAM;
public static final String SINGLE_TYPE_PARAM
= ItemSearchSection.SINGLE_TYPE_PARAM;
private ItemSearchSection m_section; private ItemSearchSection m_section;
/** /**

View File

@ -66,7 +66,6 @@ public class ItemSearchBrowsePane extends CMSContainer
private static final Logger s_log = private static final Logger s_log =
Logger.getLogger(ItemSearchBrowsePane.class); Logger.getLogger(ItemSearchBrowsePane.class);
private FolderSelectionModel m_folderSel; private FolderSelectionModel m_folderSel;
private Tree m_tree; private Tree m_tree;
private ItemSearchFolderBrowser m_browser; private ItemSearchFolderBrowser m_browser;
@ -74,7 +73,7 @@ public class ItemSearchBrowsePane extends CMSContainer
public ItemSearchBrowsePane() { public ItemSearchBrowsePane() {
setClassAttr("sidebarNavPanel"); setClassAttr("sidebarNavPanel");
setAttribute("navbar-title", "Folders"); setAttribute("navbar-title", GlobalizationUtil.globalize("cms.ui.folder_browser").localize().toString());
Label l = new Label(GlobalizationUtil.globalize("cms.ui.folder_browser")); Label l = new Label(GlobalizationUtil.globalize("cms.ui.folder_browser"));
l.setClassAttr("heading"); l.setClassAttr("heading");
@ -87,10 +86,14 @@ public class ItemSearchBrowsePane extends CMSContainer
s_log.debug("linksOnlyInSameSubsite value is " + linksOnlyInSameSubsite); s_log.debug("linksOnlyInSameSubsite value is " + linksOnlyInSameSubsite);
m_tree = new Tree(new FolderTreeModelBuilder() { m_tree = new Tree(new FolderTreeModelBuilder() {
@Override
protected Folder getRoot(PageState ps) { protected Folder getRoot(PageState ps) {
Folder root = getRootFolder(ps); Folder root = getRootFolder(ps);
if( null == root ) return super.getRoot( ps ); if (null == root) {
return super.getRoot(ps);
}
return root; return root;
} }
}); });
@ -133,6 +136,7 @@ public class ItemSearchBrowsePane extends CMSContainer
} }
sectionForm.addInitListener(new FormInitListener() { sectionForm.addInitListener(new FormInitListener() {
public void init(FormSectionEvent ev) { public void init(FormSectionEvent ev) {
PageState ps = ev.getPageState(); PageState ps = ev.getPageState();
@ -155,16 +159,18 @@ public class ItemSearchBrowsePane extends CMSContainer
// We have more than one subsite to choose between // We have more than one subsite to choose between
OID sectionOID = (OID) m_section.getValue(ps); OID sectionOID = (OID) m_section.getValue(ps);
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
if( null != sectionOID ) if (null != sectionOID) {
s_log.debug("Using section " + sectionOID.toString()); s_log.debug("Using section " + sectionOID.toString());
else } else {
s_log.debug("Using default section"); s_log.debug("Using default section");
} }
}
if( null == sectionOID ) return null; if (null == sectionOID) {
return null;
}
ContentSection section = (ContentSection) ContentSection section = (ContentSection) DomainObjectFactory.newInstance(sectionOID);
DomainObjectFactory.newInstance( sectionOID );
return section.getRootFolder(); return section.getRootFolder();
} else { } else {
@ -214,7 +220,6 @@ public class ItemSearchBrowsePane extends CMSContainer
} }
// Implement TreeExpansionListener // Implement TreeExpansionListener
public void treeCollapsed(TreeExpansionEvent e) { public void treeCollapsed(TreeExpansionEvent e) {
PageState s = e.getPageState(); PageState s = e.getPageState();
m_folderSel.setSelectedKey(s, e.getNodeKey()); m_folderSel.setSelectedKey(s, e.getNodeKey());
@ -262,13 +267,15 @@ public class ItemSearchBrowsePane extends CMSContainer
private FolderSelectionModel createFolderSelectionModel() { private FolderSelectionModel createFolderSelectionModel() {
return new FolderSelectionModel("folder") { return new FolderSelectionModel("folder") {
protected BigDecimal getRootFolderID(PageState ps) { protected BigDecimal getRootFolderID(PageState ps) {
Folder root = getRootFolder(ps); Folder root = getRootFolder(ps);
if( null == root ) return super.getRootFolderID( ps ); if (null == root) {
return super.getRootFolderID(ps);
}
return root.getID(); return root.getID();
} }
}; };
} }
} }

View File

@ -157,6 +157,7 @@ public class ItemSearchFolderBrowser extends Table {
return new Integer((int) itemColl.size()); return new Integer((int) itemColl.size());
} }
}; };
private RequestLocal m_itemColl = new RequestLocal() { private RequestLocal m_itemColl = new RequestLocal() {
@Override @Override

View File

@ -23,10 +23,12 @@ import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.TabbedPane; import com.arsdigita.bebop.TabbedPane;
import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.CMSConfig;
import com.arsdigita.cms.CMSExcursion; import com.arsdigita.cms.CMSExcursion;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.dispatcher.CMSPage; import com.arsdigita.cms.dispatcher.CMSPage;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.dispatcher.RequestContext; import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.templating.PresentationManager; import com.arsdigita.templating.PresentationManager;
@ -48,26 +50,24 @@ import javax.servlet.http.HttpServletResponse;
* @version $Revision: #12 $ $DateTime: 2004/08/17 23:15:09 $ * @version $Revision: #12 $ $DateTime: 2004/08/17 23:15:09 $
*/ */
public class ItemSearchPage extends CMSPage { public class ItemSearchPage extends CMSPage {
private final static String XSL_CLASS = "CMS Admin"; private final static String XSL_CLASS = "CMS Admin";
private TabbedPane m_tabbedPane; private TabbedPane m_tabbedPane;
private ItemSearchBrowsePane m_browse; private ItemSearchBrowsePane m_browse;
private ItemSearchPopup m_search; private ItemSearchPopup m_search;
private BigDecimalParameter m_sectionId; private BigDecimalParameter m_sectionId;
private static final CMSConfig s_conf = CMSConfig.getInstance();
public static final String CONTENT_SECTION = "section_id"; public static final String CONTENT_SECTION = "section_id";
/** /**
* Construct a new ItemSearchPage * Construct a new ItemSearchPage
*/ */
public ItemSearchPage() { public ItemSearchPage() {
super("Item Search", new SimpleContainer()); super(GlobalizationUtil.globalize("cms.ui.item_search.page_title").localize().toString(), new SimpleContainer());
setClassAttr("cms-admin"); setClassAttr("cms-admin");
addGlobalStateParam addGlobalStateParam(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
addGlobalStateParam(new StringParameter(ItemSearchPopup.WIDGET_PARAM)); addGlobalStateParam(new StringParameter(ItemSearchPopup.WIDGET_PARAM));
m_sectionId = new BigDecimalParameter(CONTENT_SECTION); m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
@ -81,7 +81,6 @@ public class ItemSearchPage extends CMSPage {
add(m_tabbedPane); add(m_tabbedPane);
} }
/** /**
* Creates, and then caches, the Browse pane. Overriding this * Creates, and then caches, the Browse pane. Overriding this
* method to return null will prevent this tab from appearing. * method to return null will prevent this tab from appearing.
@ -107,7 +106,6 @@ public class ItemSearchPage extends CMSPage {
return m_search; return m_search;
} }
/** /**
* Created the TabbedPane to use for this page. Sets the class * Created the TabbedPane to use for this page. Sets the class
* attribute for this tabbed pane. The default implementation uses a * attribute for this tabbed pane. The default implementation uses a
@ -122,13 +120,21 @@ public class ItemSearchPage extends CMSPage {
protected TabbedPane createTabbedPane() { protected TabbedPane createTabbedPane() {
TabbedPane pane = new TabbedPane(); TabbedPane pane = new TabbedPane();
pane.setClassAttr(XSL_CLASS); pane.setClassAttr(XSL_CLASS);
addToPane(pane, "Browse", getBrowsePane());
addToPane(pane, "Search", getSearchPane()); addToPane(pane, "browse", getBrowsePane());
addToPane(pane, "search", getSearchPane());
if(s_conf.getItemSearchDefaultTab().equals("browse")) {
pane.setDefaultPane(m_browse); pane.setDefaultPane(m_browse);
//pane.addActionListener(this); }
return pane; if(s_conf.getItemSearchDefaultTab().equals("search")) {
pane.setDefaultPane(m_search);
} }
//pane.addActionListener(this);
// pane.setTabVisible(null, pane, true);
return pane;
}
/** /**
* Adds the specified component, with the specified tab name, to the * Adds the specified component, with the specified tab name, to the
@ -140,11 +146,10 @@ public class ItemSearchPage extends CMSPage {
*/ */
protected void addToPane(TabbedPane pane, String tabName, Component comp) { protected void addToPane(TabbedPane pane, String tabName, Component comp) {
if (comp != null) { if (comp != null) {
pane.addTab(tabName, comp); pane.addTab(GlobalizationUtil.globalize("cms.ui.item_search." + tabName).localize().toString(), comp);
} }
} }
/** /**
* When a new tab is selected, reset the state of the * When a new tab is selected, reset the state of the
* formerly-selected pane. * formerly-selected pane.
@ -154,22 +159,22 @@ public class ItemSearchPage extends CMSPage {
//public void actionPerformed(ActionEvent event) { //public void actionPerformed(ActionEvent event) {
//PageState state = event.getPageState(); //PageState state = event.getPageState();
//Component pane = m_tabbedPane.getCurrentPane(state); //Component pane = m_tabbedPane.getCurrentPane(state);
//if ( pane == m_browse ) { //if ( pane == m_browse ) {
// MP: reset tasks pane // MP: reset tasks pane
//} else if ( pane == m_search ) { //} else if ( pane == m_search ) {
//m_search.reset(state); //m_search.reset(state);
//} //}
//} //}
/** /**
* This strange voodoo from Dan. No idea what it does. * This strange voodoo from Dan. No idea what it does.
*/ */
@Override
public void dispatch(final HttpServletRequest request, public void dispatch(final HttpServletRequest request,
final HttpServletResponse response, final HttpServletResponse response,
RequestContext actx) RequestContext actx)
throws IOException, ServletException { throws IOException, ServletException {
new CMSExcursion() { new CMSExcursion() {
public void excurse() public void excurse()
throws IOException, ServletException { throws IOException, ServletException {
ContentSection section = null; ContentSection section = null;
@ -178,15 +183,13 @@ public class ItemSearchPage extends CMSPage {
section = (ContentSection) app; section = (ContentSection) app;
} else { } else {
try { try {
section = new ContentSection section = new ContentSection((BigDecimal) m_sectionId.transformValue(request));
((BigDecimal) m_sectionId.transformValue(request));
} catch (DataObjectNotFoundException ex) { } catch (DataObjectNotFoundException ex) {
throw new UncheckedWrapperException(ex); throw new UncheckedWrapperException(ex);
} }
} }
setContentSection(section); setContentSection(section);
final Document doc = buildDocument(request, response); final Document doc = buildDocument(request, response);
final PresentationManager pm = final PresentationManager pm =
Templating.getPresentationManager(); Templating.getPresentationManager();

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.cms.ui; package com.arsdigita.cms.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Page; import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
@ -45,10 +44,8 @@ import javax.servlet.http.HttpServletRequest;
*/ */
public class ItemSearchPopup extends ItemSearch { public class ItemSearchPopup extends ItemSearch {
private static final org.apache.log4j.Logger s_log = private static final org.apache.log4j.Logger s_log =
org.apache.log4j.Logger.getLogger(ItemSearchPopup.class); org.apache.log4j.Logger.getLogger(ItemSearchPopup.class);
public static final String WIDGET_PARAM = "widget"; public static final String WIDGET_PARAM = "widget";
public static final String URL_PARAM = "useURL"; public static final String URL_PARAM = "useURL";
@ -63,12 +60,14 @@ public class ItemSearchPopup extends ItemSearch {
} }
// Hide results by default // Hide results by default
@Override
public void register(Page p) { public void register(Page p) {
super.register(p); super.register(p);
p.addGlobalStateParam(new StringParameter(WIDGET_PARAM)); p.addGlobalStateParam(new StringParameter(WIDGET_PARAM));
p.addGlobalStateParam(new StringParameter(URL_PARAM)); p.addGlobalStateParam(new StringParameter(URL_PARAM));
} }
@Override
protected ItemSearchSection createSearchSection(String context) { protected ItemSearchSection createSearchSection(String context) {
return new ItemSearchSectionPopup(context); return new ItemSearchSectionPopup(context);
} }
@ -79,6 +78,7 @@ public class ItemSearchPopup extends ItemSearch {
super(context); super(context);
} }
@Override
protected Component createResultsPane(QueryGenerator generator) { protected Component createResultsPane(QueryGenerator generator) {
return new PopupResultsPane(generator); return new PopupResultsPane(generator);
} }
@ -97,13 +97,14 @@ public class ItemSearchPopup extends ItemSearch {
} }
private static class PopupResultsPane extends ResultsPane { private static class PopupResultsPane extends ResultsPane {
public PopupResultsPane(QueryGenerator generator) { public PopupResultsPane(QueryGenerator generator) {
super(generator); super(generator);
setRelativeURLs(true); setRelativeURLs(true);
} }
protected Element generateDocumentXML(PageState state, @Override
Document doc) { protected Element generateDocumentXML(PageState state, Document doc) {
Element element = super.generateDocumentXML(state, doc); Element element = super.generateDocumentXML(state, doc);
element.addAttribute("class", "jsButton"); element.addAttribute("class", "jsButton");
@ -114,14 +115,14 @@ public class ItemSearchPopup extends ItemSearch {
boolean useURL = "true".equals( boolean useURL = "true".equals(
state.getValue(new StringParameter(URL_PARAM))); state.getValue(new StringParameter(URL_PARAM)));
String fillString = useURL ? String fillString = useURL
getItemURL(state.getRequest(), doc.getOID()) : ? getItemURL(state.getRequest(), doc.getOID())
doc.getOID().get("id").toString() + : doc.getOID().get("id").toString()
" (" + doc.getTitle() + ")"; + " (" + doc.getTitle() + ")";
Element jsLabel = Search.newElement("jsAction"); Element jsLabel = Search.newElement("jsAction");
jsLabel.addAttribute("name", "fillItem" + jsLabel.addAttribute("name", "fillItem"
doc.getOID().get("id") + "()"); + doc.getOID().get("id") + "()");
jsLabel.setText(generateJSLabel((BigDecimal) doc.getOID().get("id"), jsLabel.setText(generateJSLabel((BigDecimal) doc.getOID().get("id"),
widget, fillString)); widget, fillString));
element.addContent(jsLabel); element.addContent(jsLabel);
@ -130,18 +131,18 @@ public class ItemSearchPopup extends ItemSearch {
} }
private String generateJSLabel(BigDecimal id, String widget, String fill) { private String generateJSLabel(BigDecimal id, String widget, String fill) {
return " <script language=javascript> " + return " <script language=javascript> "
" <!-- \n" + + " <!-- \n"
" function fillItem" + + " function fillItem"
id + + id
"() { \n" + + "() { \n"
" window.opener.document." + + " window.opener.document."
widget + ".value=\"" + fill + "\";\n" + + widget + ".value=\"" + fill + "\";\n"
" self.close(); \n" + + " self.close(); \n"
" return false; \n" + + " return false; \n"
" } \n" + + " } \n"
" --> \n" + + " --> \n"
" </script> "; + " </script> ";
} }
} }
} }

View File

@ -79,8 +79,8 @@ public class ItemSearchSection extends FormSection
m_query = createQueryGenerator(context); m_query = createQueryGenerator(context);
m_results = createResultsPane(m_query); m_results = createResultsPane(m_query);
addResultsPane(this);
addQueryGenerator(this); addQueryGenerator(this);
addResultsPane(this);
addFormListener(); addFormListener();
setClassAttr("itemSearch"); setClassAttr("itemSearch");

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.cms.ui; package com.arsdigita.cms.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Container; import com.arsdigita.bebop.Container;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
@ -47,11 +46,8 @@ public class ItemSearchSectionInline extends ItemSearchSection {
private static final org.apache.log4j.Logger s_log = private static final org.apache.log4j.Logger s_log =
org.apache.log4j.Logger.getLogger(ItemSearchSectionInline.class); org.apache.log4j.Logger.getLogger(ItemSearchSectionInline.class);
private Submit m_selectItem; private Submit m_selectItem;
private String m_name; private String m_name;
private OIDParameter m_item; private OIDParameter m_item;
/** /**
@ -66,15 +62,18 @@ public class ItemSearchSectionInline extends ItemSearchSection {
m_item = new OIDParameter(name + "_itemOID"); m_item = new OIDParameter(name + "_itemOID");
} }
@Override
public void register(Page p) { public void register(Page p) {
super.register(p); super.register(p);
p.addGlobalStateParam(m_item); p.addGlobalStateParam(m_item);
} }
@Override
protected Component createResultsPane(QueryGenerator generator) { protected Component createResultsPane(QueryGenerator generator) {
return new InlineResultsPane(generator); return new InlineResultsPane(generator);
} }
@Override
protected void addResultsPane(Container container) { protected void addResultsPane(Container container) {
super.addResultsPane(container); super.addResultsPane(container);
@ -83,10 +82,12 @@ public class ItemSearchSectionInline extends ItemSearchSection {
container.add(m_selectItem); container.add(m_selectItem);
} }
@Override
protected void addFormListener() { protected void addFormListener() {
// do nothing (ItemSearchWidget's submission listener does this. // do nothing (ItemSearchWidget's submission listener does this.
} }
@Override
public void processQuery(PageState state) { public void processQuery(PageState state) {
super.processQuery(state); super.processQuery(state);
m_selectItem.setVisible(state, hasQuery(state)); m_selectItem.setVisible(state, hasQuery(state));
@ -107,25 +108,29 @@ public class ItemSearchSectionInline extends ItemSearchSection {
} }
private class ItemSelectSubmit extends Submit { private class ItemSelectSubmit extends Submit {
public ItemSelectSubmit(String name, String label) { public ItemSelectSubmit(String name, String label) {
super(name, label); super(name, label);
} }
public ItemSelectSubmit(String name, GlobalizedMessage label) { public ItemSelectSubmit(String name, GlobalizedMessage label) {
super(name, label); super(name, label);
} }
@Override
public boolean isVisible(PageState ps) { public boolean isVisible(PageState ps) {
return hasQuery(ps) && super.isVisible(ps); return hasQuery(ps) && super.isVisible(ps);
} }
} }
private class InlineResultsPane extends ResultsPane { private class InlineResultsPane extends ResultsPane {
public InlineResultsPane(QueryGenerator query) { public InlineResultsPane(QueryGenerator query) {
super(query); super(query);
setRelativeURLs(true); setRelativeURLs(true);
} }
@Override
protected Element generateDocumentXML(PageState state, protected Element generateDocumentXML(PageState state,
Document doc) { Document doc) {
Element element = super.generateDocumentXML(state, doc); Element element = super.generateDocumentXML(state, doc);

View File

@ -165,8 +165,7 @@ public class ItemSearchWidget extends FormSection
/** /**
* Construct a new ItemSearchWidget. The model must be an ItemSearchParameter * Construct a new ItemSearchWidget. The model must be an ItemSearchParameter
*/ */
public ItemSearchWidget(ParameterModel model, public ItemSearchWidget(ParameterModel model, ContentType contentType) {
ContentType contentType) {
super(new BoxPanel(BoxPanel.VERTICAL)); super(new BoxPanel(BoxPanel.VERTICAL));
if (!(model instanceof ItemSearchParameter)) { if (!(model instanceof ItemSearchParameter)) {
@ -267,8 +266,7 @@ public class ItemSearchWidget extends FormSection
: ContentType.findByAssociatedObjectType(objectType))); : ContentType.findByAssociatedObjectType(objectType)));
} }
public ItemSearchWidget(String name, public ItemSearchWidget(String name, ContentType contentType) {
ContentType contentType) {
this(new ItemSearchParameter(name, contentType), contentType); this(new ItemSearchParameter(name, contentType), contentType);
} }

View File

@ -45,7 +45,6 @@ import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* A {@link com.arsdigita.bebop.tree.TreeModelBuilder} that produces trees * A {@link com.arsdigita.bebop.tree.TreeModelBuilder} that produces trees
* containing the folder structure underneath a root folder. The root * containing the folder structure underneath a root folder. The root
@ -56,14 +55,13 @@ import org.apache.log4j.Logger;
* *
* @version $Id: FolderTreeModelBuilder.java 1940 2009-05-29 07:15:05Z terry $ * @version $Id: FolderTreeModelBuilder.java 1940 2009-05-29 07:15:05Z terry $
*/ */
public class FolderTreeModelBuilder extends LockableImpl public class FolderTreeModelBuilder extends LockableImpl
implements TreeModelBuilder { implements TreeModelBuilder {
private static final Logger s_log = Logger.getLogger(FolderTreeModelBuilder.class); private static final Logger s_log = Logger.getLogger(FolderTreeModelBuilder.class);
private PrivilegeDescriptor TREE_DESCRIPTOR = private PrivilegeDescriptor TREE_DESCRIPTOR =
SecurityManager.CMS_PREVIEW_ITEM_DESCRIPTOR; SecurityManager.CMS_PREVIEW_ITEM_DESCRIPTOR;
/** /**
* Make a tree model that lists the hierarchy of folders underneath the * Make a tree model that lists the hierarchy of folders underneath the
* folder returnedby {@link #getRoot getRoot}. * folder returnedby {@link #getRoot getRoot}.
@ -78,8 +76,15 @@ public class FolderTreeModelBuilder extends LockableImpl
"com.arsdigita.cms.getRootFolder", "com.arsdigita.cms.getRootFolder",
"com.arsdigita.cms.getSubFolders") { "com.arsdigita.cms.getSubFolders") {
@Override
public Iterator getChildren(TreeNode node, PageState data) { public Iterator getChildren(TreeNode node, PageState data) {
String nodeKey = node.getKey().toString(); String nodeKey = node.getKey().toString();
// Always expand root node
if (nodeKey.equals(getRoot(data).getKey().toString())/* && t.isCollapsed(nodeKey, data)*/) {
t.expand(nodeKey, data);
}
if (t.isCollapsed(nodeKey, data)) { if (t.isCollapsed(nodeKey, data)) {
return Collections.EMPTY_LIST.iterator(); return Collections.EMPTY_LIST.iterator();
} }
@ -92,10 +97,8 @@ public class FolderTreeModelBuilder extends LockableImpl
partyOID = party.getOID(); partyOID = party.getOID();
} }
UniversalPermissionDescriptor universalPermission = UniversalPermissionDescriptor universalPermission =
new UniversalPermissionDescriptor new UniversalPermissionDescriptor(SecurityManager.CMS_PREVIEW_ITEM_DESCRIPTOR, partyOID);
(SecurityManager.CMS_PREVIEW_ITEM_DESCRIPTOR, partyOID); if (PermissionService.checkPermission(universalPermission)) {
if (PermissionService.checkPermission
(universalPermission)) {
// the person is an admin so we just pass in the // the person is an admin so we just pass in the
// standard, non filtered query // standard, non filtered query
return getDataQueryTreeIterator( return getDataQueryTreeIterator(
@ -124,7 +127,6 @@ public class FolderTreeModelBuilder extends LockableImpl
return sec.getRootFolder(); return sec.getRootFolder();
} }
private class NewFolderBrowserIterator implements Iterator { private class NewFolderBrowserIterator implements Iterator {
private DataQuery m_nodes; private DataQuery m_nodes;
@ -182,8 +184,7 @@ public class FolderTreeModelBuilder extends LockableImpl
m_nodes = new GenericDataQuery( m_nodes = new GenericDataQuery(
SessionManager.getSession(), SessionManager.getSession(),
sql, sql,
new String[] {"id", "name", "nchild"} new String[]{"id", "name", "nchild"});
);
} }
public Object next() { public Object next() {
@ -192,25 +193,24 @@ public class FolderTreeModelBuilder extends LockableImpl
// this appears to be the only portable way to dig numbers out // this appears to be the only portable way to dig numbers out
// of the result set // of the result set
id = new BigDecimal(m_nodes.get("id").toString()); id = new BigDecimal(m_nodes.get("id").toString());
} catch (NumberFormatException nfe) {} } catch (NumberFormatException nfe) {
}
String name = m_nodes.get("name").toString(); String name = m_nodes.get("name").toString();
BigDecimal count = new BigDecimal(0); BigDecimal count = new BigDecimal(0);
try { try {
count = new BigDecimal(m_nodes.get("nchild").toString()); count = new BigDecimal(m_nodes.get("nchild").toString());
} catch (NumberFormatException nfe) {} } catch (NumberFormatException nfe) {
}
return new DataQueryTreeNode(id, name, count.intValue() > 0); return new DataQueryTreeNode(id, name, count.intValue() > 0);
} }
public void remove() { public void remove() {
throw new UnsupportedOperationException throw new UnsupportedOperationException("cannot remove nodes via iterator");
("cannot remove nodes via iterator");
} }
public boolean hasNext() { public boolean hasNext() {
return m_nodes.next(); return m_nodes.next();
} }
} }
} }

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.cms.ui.search; package com.arsdigita.cms.ui.search;
import com.arsdigita.search.ui.FilterWidget; import com.arsdigita.search.ui.FilterWidget;
import com.arsdigita.search.Search; import com.arsdigita.search.Search;
import com.arsdigita.search.FilterSpecification; import com.arsdigita.search.FilterSpecification;
@ -28,34 +27,101 @@ import com.arsdigita.cms.ContentSection;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.parameters.ArrayParameter; import com.arsdigita.bebop.parameters.ArrayParameter;
import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.search.ContentTypeFilterType; import com.arsdigita.cms.search.ContentTypeFilterType;
import com.arsdigita.cms.search.ContentTypeFilterSpecification; import com.arsdigita.cms.search.ContentTypeFilterSpecification;
import com.arsdigita.cms.ui.ItemSearch;
import com.arsdigita.domain.DataObjectNotFoundException;
import java.math.BigDecimal;
public class ContentTypeFilterWidget extends FilterWidget { public class ContentTypeFilterWidget extends FilterWidget {
private ContentType[] m_types; private ContentType m_parentType = null;
private ContentSection m_section = null;
private ContentTypeCollection m_types = null;
public ContentTypeFilterWidget(ContentTypeCollection types) { public ContentTypeFilterWidget(ContentTypeCollection types) {
super(new ContentTypeFilterType(), super(new ContentTypeFilterType(), new ArrayParameter(new StringParameter(ContentTypeFilterType.KEY)));
new ArrayParameter(new StringParameter(ContentTypeFilterType.KEY))); m_types = types;
}
m_types = new ContentType[(int)types.size()];
int i = 0;
while (types.next()) {
m_types[i++] = types.getContentType();
}
}
public ContentTypeFilterWidget(ContentSection section) { public ContentTypeFilterWidget(ContentSection section) {
this(section.getContentTypes()); this(section.getContentTypes());
} }
public ContentTypeFilterWidget(ContentSection section, ContentType parentType) {
this(section.getSiblingsOfContentType(parentType));
m_section = section;
m_parentType = parentType;
}
public ContentTypeFilterWidget(ContentType parentType) {
this(ContentType.getSiblingsOf(parentType));
m_parentType = parentType;
}
public ContentTypeFilterWidget() { public ContentTypeFilterWidget() {
this(ContentType.getRegisteredContentTypes()); this(ContentType.getRegisteredContentTypes());
} }
protected ContentSection getContentSection() {
return m_section;
}
private ContentType getParentType(PageState state) {
ContentType ct = m_parentType;
BigDecimal singleTypeID =
(BigDecimal) state.getValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
if (singleTypeID != null) {
try {
ct = new ContentType(singleTypeID);
} catch (DataObjectNotFoundException ex) {
ct = null;
}
}
return ct;
}
protected ContentType[] getContentTypes(PageState state) { protected ContentType[] getContentTypes(PageState state) {
return m_types;
ContentType parentType = getParentType(state);
ContentTypeCollection typesCollection = m_types;
// If the section and parent type both equals the preset from initializer
// there is no need to get a new ContentTypeCollection
if (getContentSection() != m_section && parentType != m_parentType) {
if (getContentSection() != null) {
ContentSection section = getContentSection();
if (parentType == null) {
typesCollection = section.getContentTypes();
} else {
typesCollection = section.getSiblingsOfContentType(parentType);
}
} else {
if (parentType == null) {
typesCollection = ContentType.getRegisteredContentTypes();
} else {
typesCollection = ContentType.getSiblingsOf(parentType);
}
}
}
ContentType[] typesArray = new ContentType[(int) typesCollection.size()];
for (int i = 0; typesCollection.next();) {
typesArray[i++] = typesCollection.getContentType();
}
return typesArray;
} }
public FilterSpecification getFilter(PageState state) { public FilterSpecification getFilter(PageState state) {
@ -68,8 +134,8 @@ public class ContentTypeFilterWidget extends FilterWidget {
return new ContentTypeFilterSpecification(types); return new ContentTypeFilterSpecification(types);
} }
public void generateBodyXML(PageState state, @Override
Element parent) { public void generateBodyXML(PageState state, Element parent) {
super.generateBodyXML(state, parent); super.generateBodyXML(state, parent);
String[] types = (String[]) getValue(state); String[] types = (String[]) getValue(state);
@ -83,15 +149,15 @@ public class ContentTypeFilterWidget extends FilterWidget {
Element type = Search.newElement("contentType"); Element type = Search.newElement("contentType");
type.addAttribute("name", widgetTypes[i].getAssociatedObjectType()); type.addAttribute("name", widgetTypes[i].getAssociatedObjectType());
type.addAttribute("title", widgetTypes[i].getLabel()); type.addAttribute("title", widgetTypes[i].getLabel());
for (int j = 0; j < types.length; j++) { for (int j = 0; j < types.length; j++) {
if (types[j].equals(widgetTypes[i].getAssociatedObjectType())) { if (types[j].equals(widgetTypes[i].getAssociatedObjectType())) {
type.addAttribute("isSelected", "1"); type.addAttribute("isSelected", "1");
break; break;
} }
} }
parent.addContent(type); parent.addContent(type);
} }
} }

View File

@ -60,13 +60,15 @@ public class ItemQueryComponent extends BaseQueryComponent {
LaunchDateFilterType.KEY)); LaunchDateFilterType.KEY));
} }
if (Search.getConfig().isIntermediaEnabled() || if (Search.getConfig().isIntermediaEnabled()
Search.getConfig().isLuceneEnabled()) { || Search.getConfig().isLuceneEnabled()) {
add(new PermissionFilterComponent( add(new PermissionFilterComponent(
SecurityManager.CMS_PREVIEW_ITEM)); SecurityManager.CMS_PREVIEW_ITEM));
add(new SimpleCategoryFilterWidget() { add(new SimpleCategoryFilterWidget() {
@Override
protected Category[] getRoots(PageState state) { protected Category[] getRoots(PageState state) {
Category[] roots; Category[] roots;
if (CMS.getContext().hasContentSection()) { if (CMS.getContext().hasContentSection()) {
@ -87,19 +89,13 @@ public class ItemQueryComponent extends BaseQueryComponent {
}); });
add(new ContentTypeFilterWidget() { add(new ContentTypeFilterWidget() {
protected ContentType[] getContentTypes(PageState state) {
// override only if there's content section context @Override
protected ContentSection getContentSection() {
if (CMS.getContext().hasContentSection()) { if (CMS.getContext().hasContentSection()) {
ContentSection section = CMS.getContext().getContentSection(); return CMS.getContext().getContentSection();
ContentTypeCollection typesCollection = section.getContentTypes();
ContentType[] typesArray = new ContentType[(int)typesCollection.size()];
int i = 0;
while (typesCollection.next()) {
typesArray[i++] = typesCollection.getContentType();
}
return typesArray;
} else { } else {
return super.getContentTypes(state); return super.getContentSection();
} }
} }
}); });
@ -122,14 +118,15 @@ public class ItemQueryComponent extends BaseQueryComponent {
} }
private class LaunchDateFilterWidget extends DateRangeFilterWidget { private class LaunchDateFilterWidget extends DateRangeFilterWidget {
public LaunchDateFilterWidget(FilterType type, String name) { public LaunchDateFilterWidget(FilterType type, String name) {
super(type, name); super(type, name);
} }
public boolean isVisible(PageState state) {
return !ContentSection.getConfig().getHideLaunchDate() &&
super.isVisible(state);
}
public boolean isVisible(PageState state) {
return !ContentSection.getConfig().getHideLaunchDate()
&& super.isVisible(state);
}
} }
} }

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.search.ui; package com.arsdigita.search.ui;
import com.arsdigita.bebop.SimpleComponent; import com.arsdigita.bebop.SimpleComponent;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.parameters.IntegerParameter; import com.arsdigita.bebop.parameters.IntegerParameter;
@ -41,15 +40,11 @@ import java.util.Iterator;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
public class ResultsPane extends SimpleComponent { public class ResultsPane extends SimpleComponent {
private static final Logger s_log = Logger.getLogger(ResultsPane.class); private static final Logger s_log = Logger.getLogger(ResultsPane.class);
public static final int PAGE_SIZE = 10; public static final int PAGE_SIZE = 10;
private int m_pageSize = PAGE_SIZE; private int m_pageSize = PAGE_SIZE;
private String m_engine; private String m_engine;
private QueryGenerator m_query; private QueryGenerator m_query;
private IntegerParameter m_pageNumber; private IntegerParameter m_pageNumber;
@ -75,8 +70,7 @@ public class ResultsPane extends SimpleComponent {
m_relative = false; m_relative = false;
} }
public void generateXML(PageState state, public void generateXML(PageState state, Element parent) {
Element parent) {
if (!m_query.hasQuery(state)) { if (!m_query.hasQuery(state)) {
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("No query available, skipping XMl generation"); s_log.debug("No query available, skipping XMl generation");
@ -87,17 +81,17 @@ public class ResultsPane extends SimpleComponent {
QuerySpecification spec = m_query.getQuerySpecification(state); QuerySpecification spec = m_query.getQuerySpecification(state);
ResultSet resultSet = null; ResultSet resultSet = null;
try { try {
resultSet = m_engine == null ? resultSet = m_engine == null
Search.process(spec) : ? Search.process(spec)
Search.process(spec, : Search.process(spec, Search.DEFAULT_RESULT_CACHE, m_engine);
Search.DEFAULT_RESULT_CACHE,
m_engine);
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Got result set " + resultSet.getClass() + s_log.debug("Got result set " + resultSet.getClass()
" count: " + resultSet.getCount()); + " count: " + resultSet.getCount());
} }
if (resultSet.getCount() > 0) {
Integer page = (Integer) m_pageNumber.transformValue(state.getRequest()); Integer page = (Integer) m_pageNumber.transformValue(state.getRequest());
int pageNumber = (page == null ? 1 : page.intValue()); int pageNumber = (page == null ? 1 : page.intValue());
long objectCount = resultSet.getCount(); long objectCount = resultSet.getCount();
@ -121,10 +115,10 @@ public class ResultsPane extends SimpleComponent {
exportAttributes(content); exportAttributes(content);
if (s_log.isDebugEnabled()) { if (s_log.isDebugEnabled()) {
s_log.debug("Paginator stats\n page number:" + pageNumber + s_log.debug("Paginator stats\n page number:" + pageNumber
"\n page count: "+ pageCount + "\n page size: " + + "\n page count: " + pageCount + "\n page size: "
m_pageSize + "\n start " + begin + "\n end: " + + m_pageSize + "\n start " + begin + "\n end: "
end + "\n count: "+ objectCount); + end + "\n count: " + objectCount);
} }
content.addContent(generatePaginatorXML(state, content.addContent(generatePaginatorXML(state,
@ -135,6 +129,16 @@ public class ResultsPane extends SimpleComponent {
content.addContent(generateDocumentsXML(state, results)); content.addContent(generateDocumentsXML(state, results));
parent.addContent(content); parent.addContent(content);
} else {
// No search result, so we don't need a paginator, but we want
// to inform the user, that there are no results for this search
Element content = Search.newElement("results");
Element info = content.newChildElement("info");
// info.setText(GlobalizationUtil.globalize("cms.ui.search_no_results").localize().toString());
info.setText("Sorry. Your search returned 0 results.");
parent.addContent(content);
}
} finally { } finally {
if (resultSet != null) { if (resultSet != null) {
try { try {
@ -174,8 +178,7 @@ public class ResultsPane extends SimpleComponent {
} }
paginator.addAttribute("pageParam", m_pageNumber.getName()); paginator.addAttribute("pageParam", m_pageNumber.getName());
paginator.addAttribute("baseURL", URL.there(url.getPathInfo(), map) paginator.addAttribute("baseURL", URL.there(url.getPathInfo(), map).toString());
.toString());
paginator.addAttribute("pageNumber", XML.format(new Integer(pageNumber))); paginator.addAttribute("pageNumber", XML.format(new Integer(pageNumber)));
paginator.addAttribute("pageCount", XML.format(new Integer(pageCount))); paginator.addAttribute("pageCount", XML.format(new Integer(pageCount)));
paginator.addAttribute("pageSize", XML.format(new Integer(pageSize))); paginator.addAttribute("pageSize", XML.format(new Integer(pageSize)));
@ -247,6 +250,4 @@ public class ResultsPane extends SimpleComponent {
return entry; return entry;
} }
} }