From 2b07ec42584699cac34a3d592838114c68225e40 Mon Sep 17 00:00:00 2001 From: quasi Date: Mon, 27 Jun 2011 17:16:05 +0000 Subject: [PATCH] ItemSearch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ItemSearch konfigurierbar gemacht, so daß bei Bedarf auch ContentSection-übergreifend gesucht werden kann. Dabei ist folgendes zu Beachten: 1. Die Suche aus dem ContentCenter ist immer eine Suche über alle ContentSection, da es keine aktuelle ContentSection gibt 2. Die Suche aus einer ContentSection wird durch die Einstellung des Config-Parameters com.arsdigita.cms.search.limitToContentSection beeinflußt. 3. Die Suche in einem ItemSearchWidget ist (zur Zeit) immer ContentSection-übergreifend, da es noch keinen Config-Parameter dafür gibt. git-svn-id: https://svn.libreccm.org/ccm/trunk@991 8810af33-2d31-482b-a856-94f89814c4df --- .../src/com/arsdigita/cms/ui/ItemSearchBrowsePane.java | 10 ++++++++-- ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java | 10 +++++++--- .../cms/ui/search/ContentSectionFilterComponent.java | 1 + .../arsdigita/cms/ui/search/ItemQueryComponent.java | 7 ++++++- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchBrowsePane.java b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchBrowsePane.java index b65ea2d55..f4d641ac8 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchBrowsePane.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchBrowsePane.java @@ -23,6 +23,7 @@ import com.arsdigita.bebop.Form; import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Page; import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.ParameterSingleSelectionModel; import com.arsdigita.bebop.Resettable; import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.Tree; @@ -39,6 +40,7 @@ import com.arsdigita.bebop.event.TreeExpansionListener; import com.arsdigita.bebop.form.Option; import com.arsdigita.bebop.form.SingleSelect; import com.arsdigita.bebop.form.Submit; +import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.domain.DomainObjectFactory; @@ -71,6 +73,8 @@ public class ItemSearchBrowsePane extends CMSContainer implements Resettable, TreeExpansionListener, ChangeListener, FormProcessListener, FormSubmissionListener { + private static final String CONTENT_TYPE_ID = "ct"; + private static final Logger s_log = Logger.getLogger(ItemSearchBrowsePane.class); private FolderSelectionModel m_folderSel; @@ -132,7 +136,9 @@ public class ItemSearchBrowsePane extends CMSContainer container.add(m_browser.getPaginator()); // m_newItem = new SectionNewItemForm("newItem"); +// m_typeSel = new ParameterSingleSelectionModel(new BigDecimalParameter(CONTENT_TYPE_ID)); // m_newItem.addProcessListener(this); +// // container.add(m_newItem); add(container); @@ -248,7 +254,7 @@ public class ItemSearchBrowsePane extends CMSContainer // sm.canAccess(state.getRequest(), SecurityManager.NEW_ITEM, folder); // // if (!newItem) { - browseMode(state); +// browseMode(state); // } // m_newItem.setVisible(state, newItem); } @@ -337,7 +343,7 @@ public class ItemSearchBrowsePane extends CMSContainer private void browseMode(PageState s) { // m_browseSeg.setVisible(s, true); -// m_typeSel.clearSelection(s); + m_typeSel.clearSelection(s); } private void newItemMode(PageState s) { diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java index 7556b644e..28cf8e4c7 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java @@ -23,6 +23,7 @@ import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.TabbedPane; import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.CMS; import com.arsdigita.cms.CMSConfig; import com.arsdigita.cms.CMSExcursion; import com.arsdigita.cms.ContentItem; @@ -47,7 +48,7 @@ import javax.servlet.http.HttpServletResponse; *

The Item Search page.

* * @author Scott Seago (scott@arsdigita.com) - * @version $Revision: #12 $ $DateTime: 2004/08/17 23:15:09 $ + * @author Sören Bernstein (sbernstein@quasiweb.de) */ public class ItemSearchPage extends CMSPage { @@ -55,9 +56,10 @@ public class ItemSearchPage extends CMSPage { private TabbedPane m_tabbedPane; private ItemSearchBrowsePane m_browse; private ItemSearchPopup m_search; -// private ItemSearchCreateItemPane m_create; + private ItemSearchCreateItemPane m_create; private BigDecimalParameter m_sectionId; private static final CMSConfig s_conf = CMSConfig.getInstance(); + private static final boolean LIMIT_TO_CONTENT_SECTION = false; public static final String CONTENT_SECTION = "section_id"; /** @@ -102,7 +104,9 @@ public class ItemSearchPage extends CMSPage { */ protected ItemSearchPopup getSearchPane() { if (m_search == null) { - m_search = new ItemSearchPopup(ContentItem.DRAFT, false); + // Always search in every content section +// m_search = new ItemSearchPopup(ContentItem.DRAFT, CMS.getConfig().limitToContentSection()); + m_search = new ItemSearchPopup(ContentItem.DRAFT, LIMIT_TO_CONTENT_SECTION); } return m_search; diff --git a/ccm-cms/src/com/arsdigita/cms/ui/search/ContentSectionFilterComponent.java b/ccm-cms/src/com/arsdigita/cms/ui/search/ContentSectionFilterComponent.java index a6edea458..d8e7b3f1f 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/search/ContentSectionFilterComponent.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/search/ContentSectionFilterComponent.java @@ -32,6 +32,7 @@ public class ContentSectionFilterComponent extends StaticFilterComponent { private String m_version; + @Override public FilterSpecification getFilter(PageState state) { if (CMS.getContext().hasContentSection()) { String section = CMS.getContext().getContentSection().getName(); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/search/ItemQueryComponent.java b/ccm-cms/src/com/arsdigita/cms/ui/search/ItemQueryComponent.java index 3419fbfcf..da41c170f 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/search/ItemQueryComponent.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/search/ItemQueryComponent.java @@ -45,6 +45,9 @@ import java.util.List; * This class provides a basic query form for CMS admin pages * that automatically adds components for the maximal set of * filters supported by the current search query engine. + * + * @author unknown + * @author Sören Bernstein (sbernstein@quasiweb.de) */ public class ItemQueryComponent extends BaseQueryComponent { @@ -99,7 +102,9 @@ public class ItemQueryComponent extends BaseQueryComponent { }); add(new VersionFilterComponent(context)); - add(new ContentSectionFilterComponent()); + if (limitToContentSection == true) { + add(new ContentSectionFilterComponent()); + } add(new DateRangeFilterWidget(new LastModifiedDateFilterType(), LastModifiedDateFilterType.KEY)); add(new DateRangeFilterWidget(new CreationDateFilterType(),