- Suche im ItemSearch Widget berücksichtigt jetzt Einschränkung auf Content-Type
- Verschiedene Kleinigkeiten git-svn-id: https://svn.libreccm.org/ccm/trunk@1451 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
8e967156bb
commit
16a5f190cf
|
|
@ -574,7 +574,7 @@ public class ContentType extends ACSObject {
|
||||||
CompoundFilter or = ff.or();
|
CompoundFilter or = ff.or();
|
||||||
|
|
||||||
// The content type must be either of the requested type
|
// The content type must be either of the requested type
|
||||||
or.addFilter(ff.equals(ContentType.ID, ct.ID));
|
or.addFilter(ff.equals(ContentType.ID, ct.getID().toString()));
|
||||||
|
|
||||||
// Or must be a descendant of the requested type
|
// Or must be a descendant of the requested type
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -135,10 +135,13 @@ public class Paginator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getEnd() {
|
private int getEnd() {
|
||||||
int paginatorEnd = getBegin() + getCount();
|
int paginatorEnd = getBegin() + getCount() - 1;
|
||||||
if (paginatorEnd < 0) {
|
if (paginatorEnd < 0) {
|
||||||
paginatorEnd = 0;
|
paginatorEnd = 0;
|
||||||
}
|
}
|
||||||
|
if (paginatorEnd <= getBegin()) {
|
||||||
|
paginatorEnd = (getBegin() + 1);
|
||||||
|
}
|
||||||
return paginatorEnd;
|
return paginatorEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.SimpleContainer;
|
import com.arsdigita.bebop.SimpleContainer;
|
||||||
import com.arsdigita.bebop.Container;
|
import com.arsdigita.bebop.Container;
|
||||||
|
|
@ -30,6 +29,7 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||||
|
import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.cms.ui.search.ItemQueryComponent;
|
import com.arsdigita.cms.ui.search.ItemQueryComponent;
|
||||||
|
|
||||||
import com.arsdigita.search.ui.ResultsPane;
|
import com.arsdigita.search.ui.ResultsPane;
|
||||||
|
|
@ -38,47 +38,64 @@ import com.arsdigita.search.QuerySpecification;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains a form for specifying search parameters, as well as a
|
* Contains a form for specifying search parameters, as well as a
|
||||||
* {@link com.arsdigita.search.ui.ResultsPane} which will perform
|
* {@link com.arsdigita.search.ui.ResultsPane} which will perform the search and
|
||||||
* the search and display the results
|
* display the results
|
||||||
*
|
*
|
||||||
* @author Stanislav Freidin (sfreidin@arsdigita.com)
|
* @author Stanislav Freidin (sfreidin@arsdigita.com)
|
||||||
* @version $Id: ItemSearchSection.java 1940 2009-05-29 07:15:05Z terry $
|
* @version $Id: ItemSearchSection.java 1940 2009-05-29 07:15:05Z terry $
|
||||||
*/
|
*/
|
||||||
public class ItemSearchSection extends FormSection
|
public class ItemSearchSection extends FormSection
|
||||||
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(ItemSearchSection.class);
|
org.apache.log4j.Logger.
|
||||||
|
getLogger(ItemSearchSection.class);
|
||||||
public static final String SINGLE_TYPE_PARAM = "single_type";
|
public static final String SINGLE_TYPE_PARAM = "single_type";
|
||||||
|
|
||||||
|
|
||||||
private ItemQueryComponent m_query;
|
private ItemQueryComponent m_query;
|
||||||
private Component m_results;
|
private Component m_results;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new <code>ItemSearchSection</code> component
|
* Construct a new
|
||||||
|
* <code>ItemSearchSection</code> component
|
||||||
*
|
*
|
||||||
* @param context the context for the retrieved items. Should be
|
* @param context the context for the retrieved items. Should be
|
||||||
* {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
|
* {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
|
||||||
* @param limitToContentSection limit the search to the current content section
|
* @param limitToContentSection limit the search to the current content
|
||||||
|
* section
|
||||||
*/
|
*/
|
||||||
public ItemSearchSection(String context, boolean limitToContentSection) {
|
public ItemSearchSection(String context, boolean limitToContentSection) {
|
||||||
this(null, context, limitToContentSection);
|
this(null, context, limitToContentSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new <code>ItemSearchSection</code> component
|
* Construct a new
|
||||||
|
* <code>ItemSearchSection</code> component
|
||||||
*
|
*
|
||||||
* @param context the context for the retrieved items. Should be
|
* @param context the context for the retrieved items. Should be
|
||||||
* {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
|
* {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
|
||||||
* @param name The name of the search parameter for the particular FormSection
|
* @param name The name of the search parameter for the particular
|
||||||
* @param limitToContentSection limit the search to the current content section
|
* FormSection
|
||||||
|
* @param limitToContentSection limit the search to the current content
|
||||||
|
* section
|
||||||
*/
|
*/
|
||||||
public ItemSearchSection(String name, String context, boolean limitToContentSection) {
|
public ItemSearchSection(String name,
|
||||||
|
String context,
|
||||||
|
boolean limitToContentSection) {
|
||||||
|
this(name, context, limitToContentSection, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemSearchSection(String name,
|
||||||
|
String context,
|
||||||
|
boolean limitToContentSection,
|
||||||
|
ContentType type) {
|
||||||
super(new SimpleContainer());
|
super(new SimpleContainer());
|
||||||
String thisName = (name == null ? "itemSearch" : name);
|
String thisName = (name == null ? "itemSearch" : name);
|
||||||
|
|
||||||
m_query = createQueryGenerator(context, limitToContentSection);
|
if (type == null) {
|
||||||
|
m_query = createQueryGenerator(context, limitToContentSection);
|
||||||
|
} else {
|
||||||
|
m_query = createQueryGenerator(context, limitToContentSection, type);
|
||||||
|
}
|
||||||
m_results = createResultsPane(m_query);
|
m_results = createResultsPane(m_query);
|
||||||
|
|
||||||
addQueryGenerator(this);
|
addQueryGenerator(this);
|
||||||
|
|
@ -100,10 +117,17 @@ public class ItemSearchSection extends FormSection
|
||||||
m_results.setVisible(state, false);
|
m_results.setVisible(state, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ItemQueryComponent createQueryGenerator(String context, boolean limitToContentSection) {
|
protected ItemQueryComponent createQueryGenerator(String context,
|
||||||
|
boolean limitToContentSection) {
|
||||||
return new ItemQueryComponent(context, limitToContentSection);
|
return new ItemQueryComponent(context, limitToContentSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected ItemQueryComponent createQueryGenerator(String context,
|
||||||
|
boolean limitToContentSection,
|
||||||
|
ContentType type) {
|
||||||
|
return new ItemQueryComponent(context, limitToContentSection, type);
|
||||||
|
}
|
||||||
|
|
||||||
protected Component createResultsPane(QueryGenerator generator) {
|
protected Component createResultsPane(QueryGenerator generator) {
|
||||||
ResultsPane pane = new ResultsPane(generator);
|
ResultsPane pane = new ResultsPane(generator);
|
||||||
pane.setRelativeURLs(true);
|
pane.setRelativeURLs(true);
|
||||||
|
|
@ -137,6 +161,7 @@ public class ItemSearchSection extends FormSection
|
||||||
* Displays the "keywords" and "content types" widgets
|
* Displays the "keywords" and "content types" widgets
|
||||||
*/
|
*/
|
||||||
private class SearchFormProcessListener implements FormProcessListener {
|
private class SearchFormProcessListener implements FormProcessListener {
|
||||||
|
|
||||||
public void process(FormSectionEvent e) throws FormProcessException {
|
public void process(FormSectionEvent e) throws FormProcessException {
|
||||||
PageState s = e.getPageState();
|
PageState s = e.getPageState();
|
||||||
processQuery(s);
|
processQuery(s);
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import com.arsdigita.bebop.form.Submit;
|
||||||
import com.arsdigita.toolbox.ui.OIDParameter;
|
import com.arsdigita.toolbox.ui.OIDParameter;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
|
@ -63,6 +64,14 @@ public class ItemSearchSectionInline extends ItemSearchSection {
|
||||||
m_item = new OIDParameter(name + "_itemOID");
|
m_item = new OIDParameter(name + "_itemOID");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemSearchSectionInline(String name, String context,
|
||||||
|
boolean limitToContentSection,
|
||||||
|
ContentType type) {
|
||||||
|
super(name, context, limitToContentSection, type);
|
||||||
|
m_name = name;
|
||||||
|
m_item = new OIDParameter(name + "_itemOID");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(Page p) {
|
public void register(Page p) {
|
||||||
super.register(p);
|
super.register(p);
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,10 @@ import com.arsdigita.web.URL;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class representing a content item search field in an HTML form.
|
* A class representing a content item search field in an HTML form.
|
||||||
*
|
*
|
||||||
* @author Scott Seago (sseago@redhat.com)
|
* @author Scott Seago (sseago@redhat.com)
|
||||||
* @version $Id: ItemSearchWidget.java 1166 2006-06-14 11:45:15Z fabrice $
|
* @version $Id: ItemSearchWidget.java 1166 2006-06-14 11:45:15Z fabrice $
|
||||||
*/
|
*/
|
||||||
public class ItemSearchWidget extends FormSection
|
public class ItemSearchWidget extends FormSection
|
||||||
implements BebopConstants, FormSubmissionListener, FormInitListener {
|
implements BebopConstants, FormSubmissionListener, FormInitListener {
|
||||||
|
|
@ -88,14 +88,15 @@ public class ItemSearchWidget extends FormSection
|
||||||
public SearchFragment(String name, ItemSearchWidget parent) {
|
public SearchFragment(String name, ItemSearchWidget parent) {
|
||||||
super(name, "Search");
|
super(name, "Search");
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.setAttribute("onClick", "return " + parent.m_item.getName().replace('.', '_') + "Popup(this.form)");
|
this.setAttribute("onClick", "return " + parent.m_item.getName().
|
||||||
|
replace('.', '_') + "Popup(this.form)");
|
||||||
this.setAttribute("value", "Search");
|
this.setAttribute("value", "Search");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible(PageState ps) {
|
public boolean isVisible(PageState ps) {
|
||||||
return (!(parent.m_search.isSelected(ps)
|
return (!(parent.m_search.isSelected(ps)
|
||||||
|| parent.m_searchComponent.hasQuery(ps))
|
|| parent.m_searchComponent.hasQuery(ps))
|
||||||
&& super.isVisible(ps));
|
&& super.isVisible(ps));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -107,7 +108,8 @@ public class ItemSearchWidget extends FormSection
|
||||||
public ClearFragment(String name, ItemSearchWidget parent) {
|
public ClearFragment(String name, ItemSearchWidget parent) {
|
||||||
super(name, "Clear");
|
super(name, "Clear");
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
this.setAttribute("onClick", "this.form." + parent.m_item.getName() + ".value = \"\"; return false;");
|
this.setAttribute("onClick", "this.form." + parent.m_item.getName()
|
||||||
|
+ ".value = \"\"; return false;");
|
||||||
this.setAttribute("value", "Clear");
|
this.setAttribute("value", "Clear");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -116,7 +118,8 @@ public class ItemSearchWidget extends FormSection
|
||||||
|
|
||||||
private ItemSearchWidget parent;
|
private ItemSearchWidget parent;
|
||||||
|
|
||||||
public LabelFragment(String name, boolean escaping, ItemSearchWidget parent) {
|
public LabelFragment(String name, boolean escaping,
|
||||||
|
ItemSearchWidget parent) {
|
||||||
super(name, escaping);
|
super(name, escaping);
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
@ -126,15 +129,25 @@ public class ItemSearchWidget extends FormSection
|
||||||
|
|
||||||
private ItemSearchWidget parent;
|
private ItemSearchWidget parent;
|
||||||
|
|
||||||
public ItemSearchFragment(String name, String context, ItemSearchWidget parent, boolean limitToContentSection) {
|
public ItemSearchFragment(String name, String context,
|
||||||
|
ItemSearchWidget parent,
|
||||||
|
boolean limitToContentSection) {
|
||||||
super(name, context, limitToContentSection);
|
super(name, context, limitToContentSection);
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemSearchFragment(String name, String context,
|
||||||
|
ItemSearchWidget parent,
|
||||||
|
boolean limitToContentSection,
|
||||||
|
ContentType type) {
|
||||||
|
super(name, context, limitToContentSection, type);
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible(PageState ps) {
|
public boolean isVisible(PageState ps) {
|
||||||
return ((m_search.isSelected(ps)
|
return ((m_search.isSelected(ps)
|
||||||
|| hasQuery(ps))
|
|| hasQuery(ps))
|
||||||
&& super.isVisible(ps));
|
&& super.isVisible(ps));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -148,20 +161,22 @@ public class ItemSearchWidget extends FormSection
|
||||||
@Override
|
@Override
|
||||||
public boolean isVisible(PageState ps) {
|
public boolean isVisible(PageState ps) {
|
||||||
return ((m_search.isSelected(ps)
|
return ((m_search.isSelected(ps)
|
||||||
|| m_searchComponent.hasQuery(ps))
|
|| m_searchComponent.hasQuery(ps))
|
||||||
&& super.isVisible(ps));
|
&& super.isVisible(ps));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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) {
|
||||||
this(model, null);
|
this(model, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new ItemSearchWidget. The model must be an ItemSearchParameter
|
* Construct a new ItemSearchWidget. The model must be an
|
||||||
|
* ItemSearchParameter
|
||||||
*/
|
*/
|
||||||
public ItemSearchWidget(ParameterModel model, ContentType contentType) {
|
public ItemSearchWidget(ParameterModel model, ContentType contentType) {
|
||||||
super(new BoxPanel(BoxPanel.VERTICAL));
|
super(new BoxPanel(BoxPanel.VERTICAL));
|
||||||
|
|
@ -194,11 +209,13 @@ public class ItemSearchWidget extends FormSection
|
||||||
public void prepare(PrintEvent event) {
|
public void prepare(PrintEvent event) {
|
||||||
PageState state = event.getPageState();
|
PageState state = event.getPageState();
|
||||||
Label t = (Label) event.getTarget();
|
Label t = (Label) event.getTarget();
|
||||||
String formName = ((LabelFragment) t).parent.getSearchButton().getForm().getName();
|
String formName = ((LabelFragment) t).parent.getSearchButton().
|
||||||
|
getForm().getName();
|
||||||
ParameterMap params = new ParameterMap();
|
ParameterMap params = new ParameterMap();
|
||||||
params.setParameter("section_id",
|
params.setParameter("section_id",
|
||||||
CMS.getContext().getContentSection().getID());
|
CMS.getContext().getContentSection().getID());
|
||||||
params.setParameter("widget", formName + ".elements['" + m_item.getName() + "']");
|
params.setParameter("widget", formName + ".elements['" + m_item.
|
||||||
|
getName() + "']");
|
||||||
if (typeURLFrag != null) {
|
if (typeURLFrag != null) {
|
||||||
params.setParameter("single_type", typeURLFrag);
|
params.setParameter("single_type", typeURLFrag);
|
||||||
}
|
}
|
||||||
|
|
@ -208,34 +225,45 @@ public class ItemSearchWidget extends FormSection
|
||||||
ItemSearchPage.class.getName());
|
ItemSearchPage.class.getName());
|
||||||
s_log.debug("Search URL stub is: " + searchURL);
|
s_log.debug("Search URL stub is: " + searchURL);
|
||||||
|
|
||||||
searchURL = com.arsdigita.cms.dispatcher.Utilities.getWorkspaceURL()
|
searchURL = com.arsdigita.cms.dispatcher.Utilities.
|
||||||
+ searchURL;
|
getWorkspaceURL()
|
||||||
|
+ searchURL;
|
||||||
|
|
||||||
// TODO Not sure what to do when you get a null here
|
// TODO Not sure what to do when you get a null here
|
||||||
|
|
||||||
URL url = URL.there(state.getRequest(), searchURL, params);
|
URL url = URL.there(state.getRequest(), searchURL, params);
|
||||||
|
|
||||||
t.setLabel(" <script language=javascript> "
|
t.setLabel(" <script language=javascript> "
|
||||||
+ " <!-- \n"
|
+ " <!-- \n"
|
||||||
+ " function "
|
+ " function "
|
||||||
+ m_item.getName().replace('.', '_')
|
+ m_item.getName().replace('.', '_')
|
||||||
+ "Popup(theForm) { \n"
|
+ "Popup(theForm) { \n"
|
||||||
+ " aWindow = window.open(\"" + url
|
+ " aWindow = window.open(\"" + url
|
||||||
+ "\", \"search\", \"toolbar=no,width=800,height=600,status=no,scrollbars=yes,resize=yes,menubar=no\");\n return false;\n"
|
+ "\", \"search\", \"toolbar=no,width=800,height=600,status=no,scrollbars=yes,resize=yes,menubar=no\");\n return false;\n"
|
||||||
+ " } \n"
|
+ " } \n"
|
||||||
+ " --> \n"
|
+ " --> \n"
|
||||||
+ " </script> ");
|
+ " </script> ");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
m_topHR = new HRLabel();
|
m_topHR = new HRLabel();
|
||||||
add(m_topHR);
|
add(m_topHR);
|
||||||
FormSection searchSection = new FormSection(new BoxPanel(BoxPanel.HORIZONTAL));
|
FormSection searchSection = new FormSection(new BoxPanel(
|
||||||
|
BoxPanel.HORIZONTAL));
|
||||||
searchSection.add(m_item);
|
searchSection.add(m_item);
|
||||||
searchSection.add(m_search);
|
searchSection.add(m_search);
|
||||||
searchSection.add(m_clear);
|
searchSection.add(m_clear);
|
||||||
searchSection.add(m_jsLabel);
|
searchSection.add(m_jsLabel);
|
||||||
add(searchSection);
|
add(searchSection);
|
||||||
m_searchComponent = new ItemSearchFragment(m_name, ContentItem.DRAFT, this, LIMIT_TO_CONTENT_SECTION);
|
if (m_contentType == null) {
|
||||||
|
m_searchComponent = new ItemSearchFragment(m_name, ContentItem.DRAFT,
|
||||||
|
this,
|
||||||
|
LIMIT_TO_CONTENT_SECTION);
|
||||||
|
} else {
|
||||||
|
m_searchComponent = new ItemSearchFragment(m_name, ContentItem.DRAFT,
|
||||||
|
this,
|
||||||
|
LIMIT_TO_CONTENT_SECTION,
|
||||||
|
m_contentType);
|
||||||
|
}
|
||||||
add(m_searchComponent);
|
add(m_searchComponent);
|
||||||
addSubmissionListener(this);
|
addSubmissionListener(this);
|
||||||
addInitListener(this);
|
addInitListener(this);
|
||||||
|
|
@ -257,11 +285,11 @@ public class ItemSearchWidget extends FormSection
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemSearchWidget(String name,
|
public ItemSearchWidget(String name,
|
||||||
String objectType)
|
String objectType)
|
||||||
throws DataObjectNotFoundException {
|
throws DataObjectNotFoundException {
|
||||||
this(name, (objectType == null || objectType.length() == 0
|
this(name, (objectType == null || objectType.length() == 0
|
||||||
? null
|
? null
|
||||||
: ContentType.findByAssociatedObjectType(objectType)));
|
: ContentType.findByAssociatedObjectType(objectType)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemSearchWidget(String name, ContentType contentType) {
|
public ItemSearchWidget(String name, ContentType contentType) {
|
||||||
|
|
@ -326,9 +354,11 @@ public class ItemSearchWidget extends FormSection
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_contentType != null) {
|
if (m_contentType != null) {
|
||||||
s.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM), m_contentType.getID());
|
s.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM),
|
||||||
|
m_contentType.getID());
|
||||||
} else {
|
} else {
|
||||||
s.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM), null);
|
s.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM),
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
throw new FormProcessException("item search FormSection submit");
|
throw new FormProcessException("item search FormSection submit");
|
||||||
} else if (m_search.isSelected(s)) {
|
} else if (m_search.isSelected(s)) {
|
||||||
|
|
@ -344,9 +374,11 @@ public class ItemSearchWidget extends FormSection
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_contentType != null) {
|
if (m_contentType != null) {
|
||||||
s.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM), m_contentType.getID());
|
s.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM),
|
||||||
|
m_contentType.getID());
|
||||||
} else {
|
} else {
|
||||||
s.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM), null);
|
s.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM),
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
throw new FormProcessException("item search FormSection submit");
|
throw new FormProcessException("item search FormSection submit");
|
||||||
} else if (m_clear.isSelected(s)) {
|
} else if (m_clear.isSelected(s)) {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,10 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.ui.search;
|
package com.arsdigita.cms.ui.search;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Unknown
|
||||||
|
* @author Jens Pelzetter (jens@jp-digital.de)
|
||||||
|
*/
|
||||||
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;
|
||||||
|
|
@ -42,7 +46,8 @@ public class ContentTypeFilterWidget extends FilterWidget {
|
||||||
private ContentType[] m_types = null;
|
private ContentType[] m_types = null;
|
||||||
|
|
||||||
public ContentTypeFilterWidget(ContentTypeCollection types) {
|
public ContentTypeFilterWidget(ContentTypeCollection types) {
|
||||||
super(new ContentTypeFilterType(), new ArrayParameter(new StringParameter(ContentTypeFilterType.KEY)));
|
super(new ContentTypeFilterType(),
|
||||||
|
new ArrayParameter(new StringParameter(ContentTypeFilterType.KEY)));
|
||||||
|
|
||||||
m_types = new ContentType[(int) types.size()];
|
m_types = new ContentType[(int) types.size()];
|
||||||
|
|
||||||
|
|
@ -55,7 +60,8 @@ public class ContentTypeFilterWidget extends FilterWidget {
|
||||||
this(section.getContentTypes());
|
this(section.getContentTypes());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContentTypeFilterWidget(ContentSection section, ContentType parentType) {
|
public ContentTypeFilterWidget(ContentSection section,
|
||||||
|
ContentType parentType) {
|
||||||
this(section.getDescendantsOfContentType(parentType));
|
this(section.getDescendantsOfContentType(parentType));
|
||||||
m_section = section;
|
m_section = section;
|
||||||
m_parentType = parentType;
|
m_parentType = parentType;
|
||||||
|
|
@ -79,7 +85,8 @@ public class ContentTypeFilterWidget extends FilterWidget {
|
||||||
ContentType ct = m_parentType;
|
ContentType ct = m_parentType;
|
||||||
|
|
||||||
BigDecimal singleTypeID =
|
BigDecimal singleTypeID =
|
||||||
(BigDecimal) state.getValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
|
(BigDecimal) state.getValue(new BigDecimalParameter(
|
||||||
|
ItemSearch.SINGLE_TYPE_PARAM));
|
||||||
|
|
||||||
if (singleTypeID != null) {
|
if (singleTypeID != null) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -108,7 +115,8 @@ public class ContentTypeFilterWidget extends FilterWidget {
|
||||||
if (parentType == null) {
|
if (parentType == null) {
|
||||||
typesCollection = section.getContentTypes();
|
typesCollection = section.getContentTypes();
|
||||||
} else {
|
} else {
|
||||||
typesCollection = section.getDescendantsOfContentType(parentType);
|
typesCollection = section.getDescendantsOfContentType(
|
||||||
|
parentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -134,7 +142,15 @@ public class ContentTypeFilterWidget extends FilterWidget {
|
||||||
String[] types = (String[]) getValue(state);
|
String[] types = (String[]) getValue(state);
|
||||||
|
|
||||||
if (types == null) {
|
if (types == null) {
|
||||||
types = new String[0];
|
if (getParentType(state) == null) {
|
||||||
|
types = new String[0];
|
||||||
|
} else {
|
||||||
|
final ContentType[] widgetTypes = getContentTypes(state);
|
||||||
|
types = new String[widgetTypes.length];
|
||||||
|
for (int i = 0; i < widgetTypes.length; i++) {
|
||||||
|
types[i] = widgetTypes[i].getAssociatedObjectType();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ContentTypeFilterSpecification(types);
|
return new ContentTypeFilterSpecification(types);
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import com.arsdigita.categorization.Category;
|
||||||
import com.arsdigita.cms.CMS;
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.ContentSectionCollection;
|
import com.arsdigita.cms.ContentSectionCollection;
|
||||||
|
import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.cms.SecurityManager;
|
import com.arsdigita.cms.SecurityManager;
|
||||||
import com.arsdigita.cms.search.CreationDateFilterType;
|
import com.arsdigita.cms.search.CreationDateFilterType;
|
||||||
import com.arsdigita.cms.search.CreationUserFilterType;
|
import com.arsdigita.cms.search.CreationUserFilterType;
|
||||||
|
|
@ -42,12 +43,13 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides a basic query form for CMS admin pages
|
* This class provides a basic query form for CMS admin pages that automatically
|
||||||
* that automatically adds components for the maximal set of
|
* adds components for the maximal set of filters supported by the current
|
||||||
* filters supported by the current search query engine.
|
* search query engine.
|
||||||
*
|
*
|
||||||
* @author unknown
|
* @author unknown
|
||||||
* @author Sören Bernstein (sbernstein@quasiweb.de)
|
* @author Sören Bernstein (sbernstein@quasiweb.de)
|
||||||
|
* @author Jens Pelzetter (jens@jp-digital.de)
|
||||||
*/
|
*/
|
||||||
public class ItemQueryComponent extends BaseQueryComponent {
|
public class ItemQueryComponent extends BaseQueryComponent {
|
||||||
|
|
||||||
|
|
@ -55,6 +57,12 @@ public class ItemQueryComponent extends BaseQueryComponent {
|
||||||
|
|
||||||
public ItemQueryComponent(String context,
|
public ItemQueryComponent(String context,
|
||||||
final boolean limitToContentSection) {
|
final boolean limitToContentSection) {
|
||||||
|
this(context, limitToContentSection, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemQueryComponent(String context,
|
||||||
|
final boolean limitToContentSection,
|
||||||
|
ContentType type) {
|
||||||
m_context = context;
|
m_context = context;
|
||||||
|
|
||||||
if (Search.getConfig().isIntermediaEnabled()) {
|
if (Search.getConfig().isIntermediaEnabled()) {
|
||||||
|
|
@ -94,18 +102,33 @@ public class ItemQueryComponent extends BaseQueryComponent {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
add(new ContentTypeFilterWidget() {
|
if (type == null) {
|
||||||
|
add(new ContentTypeFilterWidget() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ContentSection getContentSection() {
|
protected ContentSection getContentSection() {
|
||||||
if (limitToContentSection == true && CMS.getContext().
|
if (limitToContentSection == true && CMS.getContext().
|
||||||
hasContentSection()) {
|
hasContentSection()) {
|
||||||
return CMS.getContext().getContentSection();
|
return CMS.getContext().getContentSection();
|
||||||
} else {
|
} else {
|
||||||
return super.getContentSection();
|
return super.getContentSection();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
} else {
|
||||||
|
add(new ContentTypeFilterWidget(type) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ContentSection getContentSection() {
|
||||||
|
if (limitToContentSection == true && CMS.getContext().
|
||||||
|
hasContentSection()) {
|
||||||
|
return CMS.getContext().getContentSection();
|
||||||
|
} else {
|
||||||
|
return super.getContentSection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
add(new VersionFilterComponent(context));
|
add(new VersionFilterComponent(context));
|
||||||
if (limitToContentSection == true) {
|
if (limitToContentSection == true) {
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.scipublications.exporter.ris;
|
package com.arsdigita.cms.scipublications.exporter.ris;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
import java.util.ArrayList;
|
||||||
import java.util.Map;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds an reference in RIS format.
|
* Builds an reference in RIS format.
|
||||||
|
|
@ -37,8 +37,9 @@ public class RisBuilder {
|
||||||
/**
|
/**
|
||||||
* Fields of the reference.
|
* Fields of the reference.
|
||||||
*/
|
*/
|
||||||
private Map<RisFields, String> fields = new EnumMap<RisFields, String>(
|
private List<RisFieldValue> fields =new ArrayList<RisFieldValue>();
|
||||||
RisFields.class);
|
//private Map<RisFields, String> fields = new EnumMap<RisFields, String>(
|
||||||
|
// RisFields.class);
|
||||||
|
|
||||||
public RisBuilder() {
|
public RisBuilder() {
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +60,8 @@ public class RisBuilder {
|
||||||
* @param value The value of the field.
|
* @param value The value of the field.
|
||||||
*/
|
*/
|
||||||
public void addField(final RisFields field, final String value) {
|
public void addField(final RisFields field, final String value) {
|
||||||
fields.put(field, value);
|
//fields.put(field, value);
|
||||||
|
fields.add(new RisFieldValue(field, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -73,10 +75,15 @@ public class RisBuilder {
|
||||||
builder = new StringBuilder();
|
builder = new StringBuilder();
|
||||||
|
|
||||||
appendField("TY", type.name(), builder);
|
appendField("TY", type.name(), builder);
|
||||||
for (Map.Entry<RisFields, String> field : fields.entrySet()) {
|
/*for (Map.Entry<RisFields, String> field : fields.entrySet()) {
|
||||||
appendField(field.getKey().name(),
|
appendField(field.getKey().name(),
|
||||||
field.getValue(),
|
field.getValue(),
|
||||||
builder);
|
builder);
|
||||||
|
}*/
|
||||||
|
for(RisFieldValue field : fields) {
|
||||||
|
appendField(field.getName().name(),
|
||||||
|
field.getValue(),
|
||||||
|
builder);
|
||||||
}
|
}
|
||||||
appendField("ER", "", builder);
|
appendField("ER", "", builder);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue