ItemSearch

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
master
quasi 2011-06-27 17:16:05 +00:00
parent 5907f650cd
commit 2b07ec4258
4 changed files with 22 additions and 6 deletions

View File

@ -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) {

View File

@ -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;
* <p>The Item Search page.</p>
*
* @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;

View File

@ -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();

View File

@ -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(),