- 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();
|
||||
|
||||
// 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
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -135,10 +135,13 @@ public class Paginator {
|
|||
}
|
||||
|
||||
private int getEnd() {
|
||||
int paginatorEnd = getBegin() + getCount();
|
||||
int paginatorEnd = getBegin() + getCount() - 1;
|
||||
if (paginatorEnd < 0) {
|
||||
paginatorEnd = 0;
|
||||
}
|
||||
if (paginatorEnd <= getBegin()) {
|
||||
paginatorEnd = (getBegin() + 1);
|
||||
}
|
||||
return paginatorEnd;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui;
|
||||
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.SimpleContainer;
|
||||
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.FormSectionEvent;
|
||||
import com.arsdigita.bebop.parameters.BigDecimalParameter;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ui.search.ItemQueryComponent;
|
||||
|
||||
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
|
||||
* {@link com.arsdigita.search.ui.ResultsPane} which will perform
|
||||
* the search and display the results
|
||||
* {@link com.arsdigita.search.ui.ResultsPane} which will perform the search and
|
||||
* display the results
|
||||
*
|
||||
* @author Stanislav Freidin (sfreidin@arsdigita.com)
|
||||
* @version $Id: ItemSearchSection.java 1940 2009-05-29 07:15:05Z terry $
|
||||
*/
|
||||
public class ItemSearchSection extends FormSection
|
||||
implements Resettable, QueryGenerator {
|
||||
implements Resettable, QueryGenerator {
|
||||
|
||||
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";
|
||||
|
||||
|
||||
private ItemQueryComponent m_query;
|
||||
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
|
||||
* {@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) {
|
||||
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
|
||||
* {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
|
||||
* @param name The name of the search parameter for the particular FormSection
|
||||
* @param limitToContentSection limit the search to the current content section
|
||||
* @param name The name of the search parameter for the particular
|
||||
* 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());
|
||||
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);
|
||||
|
||||
addQueryGenerator(this);
|
||||
|
|
@ -100,10 +117,17 @@ public class ItemSearchSection extends FormSection
|
|||
m_results.setVisible(state, false);
|
||||
}
|
||||
|
||||
protected ItemQueryComponent createQueryGenerator(String context, boolean limitToContentSection) {
|
||||
protected ItemQueryComponent createQueryGenerator(String context,
|
||||
boolean 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) {
|
||||
ResultsPane pane = new ResultsPane(generator);
|
||||
pane.setRelativeURLs(true);
|
||||
|
|
@ -137,6 +161,7 @@ public class ItemSearchSection extends FormSection
|
|||
* Displays the "keywords" and "content types" widgets
|
||||
*/
|
||||
private class SearchFormProcessListener implements FormProcessListener {
|
||||
|
||||
public void process(FormSectionEvent e) throws FormProcessException {
|
||||
PageState s = e.getPageState();
|
||||
processQuery(s);
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import com.arsdigita.bebop.form.Submit;
|
|||
import com.arsdigita.toolbox.ui.OIDParameter;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.xml.Element;
|
||||
|
|
@ -63,6 +64,14 @@ public class ItemSearchSectionInline extends ItemSearchSection {
|
|||
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
|
||||
public void register(Page p) {
|
||||
super.register(p);
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ import com.arsdigita.web.URL;
|
|||
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)
|
||||
* @version $Id: ItemSearchWidget.java 1166 2006-06-14 11:45:15Z fabrice $
|
||||
* @author Scott Seago (sseago@redhat.com)
|
||||
* @version $Id: ItemSearchWidget.java 1166 2006-06-14 11:45:15Z fabrice $
|
||||
*/
|
||||
public class ItemSearchWidget extends FormSection
|
||||
implements BebopConstants, FormSubmissionListener, FormInitListener {
|
||||
|
|
@ -88,14 +88,15 @@ public class ItemSearchWidget extends FormSection
|
|||
public SearchFragment(String name, ItemSearchWidget parent) {
|
||||
super(name, "Search");
|
||||
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");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible(PageState ps) {
|
||||
return (!(parent.m_search.isSelected(ps)
|
||||
|| parent.m_searchComponent.hasQuery(ps))
|
||||
|| parent.m_searchComponent.hasQuery(ps))
|
||||
&& super.isVisible(ps));
|
||||
}
|
||||
}
|
||||
|
|
@ -107,7 +108,8 @@ public class ItemSearchWidget extends FormSection
|
|||
public ClearFragment(String name, ItemSearchWidget parent) {
|
||||
super(name, "Clear");
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
|
@ -116,7 +118,8 @@ public class ItemSearchWidget extends FormSection
|
|||
|
||||
private ItemSearchWidget parent;
|
||||
|
||||
public LabelFragment(String name, boolean escaping, ItemSearchWidget parent) {
|
||||
public LabelFragment(String name, boolean escaping,
|
||||
ItemSearchWidget parent) {
|
||||
super(name, escaping);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
|
@ -126,15 +129,25 @@ public class ItemSearchWidget extends FormSection
|
|||
|
||||
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);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public ItemSearchFragment(String name, String context,
|
||||
ItemSearchWidget parent,
|
||||
boolean limitToContentSection,
|
||||
ContentType type) {
|
||||
super(name, context, limitToContentSection, type);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible(PageState ps) {
|
||||
return ((m_search.isSelected(ps)
|
||||
|| hasQuery(ps))
|
||||
|| hasQuery(ps))
|
||||
&& super.isVisible(ps));
|
||||
}
|
||||
}
|
||||
|
|
@ -148,20 +161,22 @@ public class ItemSearchWidget extends FormSection
|
|||
@Override
|
||||
public boolean isVisible(PageState ps) {
|
||||
return ((m_search.isSelected(ps)
|
||||
|| m_searchComponent.hasQuery(ps))
|
||||
|| m_searchComponent.hasQuery(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) {
|
||||
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) {
|
||||
super(new BoxPanel(BoxPanel.VERTICAL));
|
||||
|
|
@ -194,11 +209,13 @@ public class ItemSearchWidget extends FormSection
|
|||
public void prepare(PrintEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
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();
|
||||
params.setParameter("section_id",
|
||||
CMS.getContext().getContentSection().getID());
|
||||
params.setParameter("widget", formName + ".elements['" + m_item.getName() + "']");
|
||||
CMS.getContext().getContentSection().getID());
|
||||
params.setParameter("widget", formName + ".elements['" + m_item.
|
||||
getName() + "']");
|
||||
if (typeURLFrag != null) {
|
||||
params.setParameter("single_type", typeURLFrag);
|
||||
}
|
||||
|
|
@ -208,34 +225,45 @@ public class ItemSearchWidget extends FormSection
|
|||
ItemSearchPage.class.getName());
|
||||
s_log.debug("Search URL stub is: " + searchURL);
|
||||
|
||||
searchURL = com.arsdigita.cms.dispatcher.Utilities.getWorkspaceURL()
|
||||
+ searchURL;
|
||||
searchURL = com.arsdigita.cms.dispatcher.Utilities.
|
||||
getWorkspaceURL()
|
||||
+ searchURL;
|
||||
|
||||
// TODO Not sure what to do when you get a null here
|
||||
|
||||
URL url = URL.there(state.getRequest(), searchURL, params);
|
||||
|
||||
t.setLabel(" <script language=javascript> "
|
||||
+ " <!-- \n"
|
||||
+ " function "
|
||||
+ m_item.getName().replace('.', '_')
|
||||
+ "Popup(theForm) { \n"
|
||||
+ " aWindow = window.open(\"" + url
|
||||
+ "\", \"search\", \"toolbar=no,width=800,height=600,status=no,scrollbars=yes,resize=yes,menubar=no\");\n return false;\n"
|
||||
+ " } \n"
|
||||
+ " --> \n"
|
||||
+ " </script> ");
|
||||
+ " <!-- \n"
|
||||
+ " function "
|
||||
+ m_item.getName().replace('.', '_')
|
||||
+ "Popup(theForm) { \n"
|
||||
+ " aWindow = window.open(\"" + url
|
||||
+ "\", \"search\", \"toolbar=no,width=800,height=600,status=no,scrollbars=yes,resize=yes,menubar=no\");\n return false;\n"
|
||||
+ " } \n"
|
||||
+ " --> \n"
|
||||
+ " </script> ");
|
||||
}
|
||||
});
|
||||
m_topHR = new HRLabel();
|
||||
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_search);
|
||||
searchSection.add(m_clear);
|
||||
searchSection.add(m_jsLabel);
|
||||
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);
|
||||
addSubmissionListener(this);
|
||||
addInitListener(this);
|
||||
|
|
@ -257,11 +285,11 @@ public class ItemSearchWidget extends FormSection
|
|||
}
|
||||
|
||||
public ItemSearchWidget(String name,
|
||||
String objectType)
|
||||
String objectType)
|
||||
throws DataObjectNotFoundException {
|
||||
this(name, (objectType == null || objectType.length() == 0
|
||||
? null
|
||||
: ContentType.findByAssociatedObjectType(objectType)));
|
||||
? null
|
||||
: ContentType.findByAssociatedObjectType(objectType)));
|
||||
}
|
||||
|
||||
public ItemSearchWidget(String name, ContentType contentType) {
|
||||
|
|
@ -326,9 +354,11 @@ public class ItemSearchWidget extends FormSection
|
|||
}
|
||||
|
||||
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 {
|
||||
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");
|
||||
} else if (m_search.isSelected(s)) {
|
||||
|
|
@ -344,9 +374,11 @@ public class ItemSearchWidget extends FormSection
|
|||
}
|
||||
|
||||
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 {
|
||||
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");
|
||||
} else if (m_clear.isSelected(s)) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@
|
|||
*/
|
||||
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.Search;
|
||||
import com.arsdigita.search.FilterSpecification;
|
||||
|
|
@ -42,7 +46,8 @@ public class ContentTypeFilterWidget extends FilterWidget {
|
|||
private ContentType[] m_types = null;
|
||||
|
||||
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()];
|
||||
|
||||
|
|
@ -55,7 +60,8 @@ public class ContentTypeFilterWidget extends FilterWidget {
|
|||
this(section.getContentTypes());
|
||||
}
|
||||
|
||||
public ContentTypeFilterWidget(ContentSection section, ContentType parentType) {
|
||||
public ContentTypeFilterWidget(ContentSection section,
|
||||
ContentType parentType) {
|
||||
this(section.getDescendantsOfContentType(parentType));
|
||||
m_section = section;
|
||||
m_parentType = parentType;
|
||||
|
|
@ -79,7 +85,8 @@ public class ContentTypeFilterWidget extends FilterWidget {
|
|||
ContentType ct = m_parentType;
|
||||
|
||||
BigDecimal singleTypeID =
|
||||
(BigDecimal) state.getValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
|
||||
(BigDecimal) state.getValue(new BigDecimalParameter(
|
||||
ItemSearch.SINGLE_TYPE_PARAM));
|
||||
|
||||
if (singleTypeID != null) {
|
||||
try {
|
||||
|
|
@ -108,7 +115,8 @@ public class ContentTypeFilterWidget extends FilterWidget {
|
|||
if (parentType == null) {
|
||||
typesCollection = section.getContentTypes();
|
||||
} else {
|
||||
typesCollection = section.getDescendantsOfContentType(parentType);
|
||||
typesCollection = section.getDescendantsOfContentType(
|
||||
parentType);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -134,7 +142,15 @@ public class ContentTypeFilterWidget extends FilterWidget {
|
|||
String[] types = (String[]) getValue(state);
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.arsdigita.categorization.Category;
|
|||
import com.arsdigita.cms.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentSectionCollection;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.search.CreationDateFilterType;
|
||||
import com.arsdigita.cms.search.CreationUserFilterType;
|
||||
|
|
@ -42,12 +43,13 @@ import java.util.ArrayList;
|
|||
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.
|
||||
* 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)
|
||||
* @author Jens Pelzetter (jens@jp-digital.de)
|
||||
*/
|
||||
public class ItemQueryComponent extends BaseQueryComponent {
|
||||
|
||||
|
|
@ -55,6 +57,12 @@ public class ItemQueryComponent extends BaseQueryComponent {
|
|||
|
||||
public ItemQueryComponent(String context,
|
||||
final boolean limitToContentSection) {
|
||||
this(context, limitToContentSection, null);
|
||||
}
|
||||
|
||||
public ItemQueryComponent(String context,
|
||||
final boolean limitToContentSection,
|
||||
ContentType type) {
|
||||
m_context = context;
|
||||
|
||||
if (Search.getConfig().isIntermediaEnabled()) {
|
||||
|
|
@ -94,18 +102,33 @@ public class ItemQueryComponent extends BaseQueryComponent {
|
|||
}
|
||||
});
|
||||
|
||||
add(new ContentTypeFilterWidget() {
|
||||
if (type == null) {
|
||||
add(new ContentTypeFilterWidget() {
|
||||
|
||||
@Override
|
||||
protected ContentSection getContentSection() {
|
||||
if (limitToContentSection == true && CMS.getContext().
|
||||
hasContentSection()) {
|
||||
return CMS.getContext().getContentSection();
|
||||
} else {
|
||||
return super.getContentSection();
|
||||
@Override
|
||||
protected ContentSection getContentSection() {
|
||||
if (limitToContentSection == true && CMS.getContext().
|
||||
hasContentSection()) {
|
||||
return CMS.getContext().getContentSection();
|
||||
} else {
|
||||
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));
|
||||
if (limitToContentSection == true) {
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
*/
|
||||
package com.arsdigita.cms.scipublications.exporter.ris;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Builds an reference in RIS format.
|
||||
|
|
@ -37,8 +37,9 @@ public class RisBuilder {
|
|||
/**
|
||||
* Fields of the reference.
|
||||
*/
|
||||
private Map<RisFields, String> fields = new EnumMap<RisFields, String>(
|
||||
RisFields.class);
|
||||
private List<RisFieldValue> fields =new ArrayList<RisFieldValue>();
|
||||
//private Map<RisFields, String> fields = new EnumMap<RisFields, String>(
|
||||
// RisFields.class);
|
||||
|
||||
public RisBuilder() {
|
||||
}
|
||||
|
|
@ -59,7 +60,8 @@ public class RisBuilder {
|
|||
* @param value The value of the field.
|
||||
*/
|
||||
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();
|
||||
|
||||
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(),
|
||||
field.getValue(),
|
||||
builder);
|
||||
}*/
|
||||
for(RisFieldValue field : fields) {
|
||||
appendField(field.getName().name(),
|
||||
field.getValue(),
|
||||
builder);
|
||||
}
|
||||
appendField("ER", "", builder);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue