- Die neue FlatBrowsePane es ItemSearchWidgets kann jetzt konfiguriert werden
- Weitere kleinere Korrekturen an der FlatBrowsePane git-svn-id: https://svn.libreccm.org/ccm/trunk@1716 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
250994a172
commit
3802caaed2
|
|
@ -543,6 +543,15 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
new StringParameter(
|
new StringParameter(
|
||||||
"com.arsdigita.cms.item_search.default_tab",
|
"com.arsdigita.cms.item_search.default_tab",
|
||||||
Parameter.REQUIRED, "browse");
|
Parameter.REQUIRED, "browse");
|
||||||
|
private final Parameter m_itemSearchFlatBrowsePaneEnable = new BooleanParameter(
|
||||||
|
"com.arsdigita.cms.item_search.flat_browse_pane.enable",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
true);
|
||||||
|
private final Parameter m_itemSearchFlatBrowsePanePageSize = new IntegerParameter(
|
||||||
|
"com.arsdigita.cms.item_search.flat_browse_pane.page_size",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
20);
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// FolderBrowse
|
// FolderBrowse
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
|
@ -595,7 +604,8 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
private final Parameter m_imageBrowserThumbnailMaxHeight = new IntegerParameter(
|
private final Parameter m_imageBrowserThumbnailMaxHeight = new IntegerParameter(
|
||||||
"com.arsdigita.cms.image_browser.thumbnail_max_height",
|
"com.arsdigita.cms.image_browser.thumbnail_max_height",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
50);
|
50);
|
||||||
|
|
||||||
|
|
||||||
// ///////////////////////////////////////////
|
// ///////////////////////////////////////////
|
||||||
// publishToFile package related parameter
|
// publishToFile package related parameter
|
||||||
|
|
@ -664,7 +674,7 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
register(m_hideTextAssetUploadFile);
|
register(m_hideTextAssetUploadFile);
|
||||||
register(m_allowCategoryCreateUseContext);
|
register(m_allowCategoryCreateUseContext);
|
||||||
register(m_allowContentCreateInSectionListing);
|
register(m_allowContentCreateInSectionListing);
|
||||||
register(m_hideLegacyPublicSiteLink);
|
register(m_hideLegacyPublicSiteLink);
|
||||||
|
|
||||||
// Content Center (Workspace) config related parameters
|
// Content Center (Workspace) config related parameters
|
||||||
register(m_contentCenterMap);
|
register(m_contentCenterMap);
|
||||||
|
|
@ -695,6 +705,9 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
// register(m_disableItemPfs);
|
// register(m_disableItemPfs);
|
||||||
// register(m_publishToFileClass);
|
// register(m_publishToFileClass);
|
||||||
|
|
||||||
|
register(m_itemSearchFlatBrowsePaneEnable);
|
||||||
|
register(m_itemSearchFlatBrowsePanePageSize);
|
||||||
|
|
||||||
loadInfo();
|
loadInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1142,5 +1155,13 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
public Integer getImageBrowserThumbnailMaxHeight() {
|
public Integer getImageBrowserThumbnailMaxHeight() {
|
||||||
return (Integer) get(m_imageBrowserThumbnailMaxHeight);
|
return (Integer) get(m_imageBrowserThumbnailMaxHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getItemSearchFlatBrowsePaneEnable() {
|
||||||
|
return (Boolean) get(m_itemSearchFlatBrowsePaneEnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getItemSearchFlatBrowsePanePageSize() {
|
||||||
|
return (Integer) get(m_itemSearchFlatBrowsePanePageSize);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -240,10 +240,21 @@ 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 table for ItemSearchWidget
|
com.arsdigita.cms.item_search.default_tab.title=Set the default table 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.purpose=Select either "browse", "flatBrowse" or "search" for default tab
|
||||||
com.arsdigita.cms.item_search.default_tab.example=browse
|
com.arsdigita.cms.item_search.default_tab.example=browse
|
||||||
com.arsdigita.cms.item_search.default_tab.format=[string]
|
com.arsdigita.cms.item_search.default_tab.format=[string]
|
||||||
|
|
||||||
|
com.arsdigita.cms.item_search.flat_browse_pane.enable.title=Enables the flat browse pane of the item search widget
|
||||||
|
com.arsdigita.cms.item_search.flat_browse_pane.enable.purpose=Enables the flat browse pane of the item search widget
|
||||||
|
com.arsdigita.cms.item_search.flat_browse_pane.enable.example=true
|
||||||
|
com.arsdigita.cms.item_search.flat_browse_pane.enable.format=[boolean]
|
||||||
|
|
||||||
|
com.arsdigita.cms.item_search.flat_browse_pane.page_size.title=Page size for the flat browse pane
|
||||||
|
com.arsdigita.cms.item_search.flat_browse_pane.page_size.purpose=Sets the page size for the flat browse pane
|
||||||
|
com.arsdigita.cms.item_search.flat_browse_pane.page_size.example=20
|
||||||
|
com.arsdigita.cms.item_search.flat_browse_pane.page_size.format=[integer]
|
||||||
|
|
||||||
|
|
||||||
com.arsdigita.cms.folder_browse_list_size.title=List size for the folder browse widget
|
com.arsdigita.cms.folder_browse_list_size.title=List size for the folder browse widget
|
||||||
com.arsdigita.cms.folder_browse_list_size.purpose=Allows to change the number of items displayed on each page of the folder browse widget
|
com.arsdigita.cms.folder_browse_list_size.purpose=Allows to change the number of items displayed on each page of the folder browse widget
|
||||||
com.arsdigita.cms.folder_browse_list_size.example=20
|
com.arsdigita.cms.folder_browse_list_size.example=20
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import com.arsdigita.bebop.table.TableColumn;
|
||||||
import com.arsdigita.bebop.table.TableColumnModel;
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
import com.arsdigita.bebop.table.TableModel;
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
import com.arsdigita.bebop.table.TableModelBuilder;
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
|
import com.arsdigita.cms.CMSConfig;
|
||||||
import com.arsdigita.cms.ContentBundle;
|
import com.arsdigita.cms.ContentBundle;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentPage;
|
import com.arsdigita.cms.ContentPage;
|
||||||
|
|
@ -59,6 +60,7 @@ public class ItemSearchFlatBrowsePane extends Form implements FormInitListener,
|
||||||
private final Table resultsTable;
|
private final Table resultsTable;
|
||||||
private final Paginator paginator;
|
private final Paginator paginator;
|
||||||
private final StringParameter queryParam;
|
private final StringParameter queryParam;
|
||||||
|
private final static CMSConfig CMS_CONFIG = CMSConfig.getInstance();
|
||||||
|
|
||||||
public ItemSearchFlatBrowsePane(final String name) {
|
public ItemSearchFlatBrowsePane(final String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
|
@ -67,19 +69,20 @@ public class ItemSearchFlatBrowsePane extends Form implements FormInitListener,
|
||||||
|
|
||||||
queryParam = new StringParameter(QUERY_PARAM);
|
queryParam = new StringParameter(QUERY_PARAM);
|
||||||
|
|
||||||
final BoxPanel boxPanel = new BoxPanel(BoxPanel.HORIZONTAL);
|
final BoxPanel boxPanel = new BoxPanel(BoxPanel.HORIZONTAL);
|
||||||
boxPanel.add(new Label(GlobalizationUtil.globalize("cms.ui.item_search.flat.filter")));
|
boxPanel.add(new Label(GlobalizationUtil.globalize("cms.ui.item_search.flat.filter")));
|
||||||
final TextField filter = new TextField(new StringParameter(QUERY_PARAM));
|
final TextField filter = new TextField(new StringParameter(QUERY_PARAM));
|
||||||
boxPanel.add(filter);
|
boxPanel.add(filter);
|
||||||
boxPanel.add(new Submit(FILTER_SUBMIT, GlobalizationUtil.globalize("cms.ui.item_search.flat.filter.submit")));
|
boxPanel.add(new Submit(FILTER_SUBMIT, GlobalizationUtil.globalize("cms.ui.item_search.flat.filter.submit")));
|
||||||
mainPanel.add(boxPanel);
|
mainPanel.add(boxPanel);
|
||||||
|
|
||||||
resultsTable = new ResultsTable();
|
resultsTable = new ResultsTable();
|
||||||
paginator = new Paginator((PaginationModelBuilder) resultsTable.getModelBuilder(), 5);
|
paginator = new Paginator((PaginationModelBuilder) resultsTable.getModelBuilder(),
|
||||||
|
CMS_CONFIG.getItemSearchFlatBrowsePanePageSize());
|
||||||
mainPanel.add(paginator);
|
mainPanel.add(paginator);
|
||||||
|
|
||||||
mainPanel.add(resultsTable);
|
mainPanel.add(resultsTable);
|
||||||
|
|
||||||
add(mainPanel);
|
add(mainPanel);
|
||||||
|
|
||||||
addInitListener(this);
|
addInitListener(this);
|
||||||
|
|
@ -100,6 +103,7 @@ public class ItemSearchFlatBrowsePane extends Form implements FormInitListener,
|
||||||
if ((query == null) || query.isEmpty()) {
|
if ((query == null) || query.isEmpty()) {
|
||||||
data.setParameter(QUERY_PARAM,
|
data.setParameter(QUERY_PARAM,
|
||||||
new ParameterData(queryParam, state.getValue(new StringParameter(ItemSearchPopup.QUERY))));
|
new ParameterData(queryParam, state.getValue(new StringParameter(ItemSearchPopup.QUERY))));
|
||||||
|
state.setValue(queryParam, data.getParameter(QUERY_PARAM).getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -146,13 +150,13 @@ public class ItemSearchFlatBrowsePane extends Form implements FormInitListener,
|
||||||
private RequestLocal collection = new RequestLocal();
|
private RequestLocal collection = new RequestLocal();
|
||||||
|
|
||||||
public TableModel makeModel(final Table table, final PageState state) {
|
public TableModel makeModel(final Table table, final PageState state) {
|
||||||
|
|
||||||
if (collection.get(state) == null) {
|
if (collection.get(state) == null) {
|
||||||
query(state);
|
query(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
((DataCollection) collection.get(state)).setRange(paginator.getFirst(state), paginator.getLast(state) + 1);
|
((DataCollection) collection.get(state)).setRange(paginator.getFirst(state), paginator.getLast(state) + 1);
|
||||||
|
|
||||||
return new ResultsTableModel(table, state, (DataCollection) collection.get(state));
|
return new ResultsTableModel(table, state, (DataCollection) collection.get(state));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,10 +164,10 @@ public class ItemSearchFlatBrowsePane extends Form implements FormInitListener,
|
||||||
if (collection.get(state) == null) {
|
if (collection.get(state) == null) {
|
||||||
query(state);
|
query(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
//((DataCollection)collection.get(state)).setRange(paginator.getFirst(state), paginator.getLast(state) + 1);
|
//((DataCollection)collection.get(state)).setRange(paginator.getFirst(state), paginator.getLast(state) + 1);
|
||||||
|
|
||||||
return (int) ((DataCollection)collection.get(state)).size();
|
return (int) ((DataCollection) collection.get(state)).size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVisible(PageState state) {
|
public boolean isVisible(PageState state) {
|
||||||
|
|
@ -182,12 +186,12 @@ public class ItemSearchFlatBrowsePane extends Form implements FormInitListener,
|
||||||
|
|
||||||
final String query = (String) state.getValue(queryParam);
|
final String query = (String) state.getValue(queryParam);
|
||||||
if ((query != null) && !query.isEmpty()) {
|
if ((query != null) && !query.isEmpty()) {
|
||||||
((DataCollection)collection.get(state)).addFilter(String.format(
|
((DataCollection) collection.get(state)).addFilter(String.format(
|
||||||
"(lower(%s) like lower('%%%s%%')) or (lower(%s) like lower('%%%s%%'))",
|
"(lower(%s) like lower('%%%s%%')) or (lower(%s) like lower('%%%s%%'))",
|
||||||
ContentItem.NAME, query,
|
ContentItem.NAME, query,
|
||||||
ContentPage.TITLE, query));
|
ContentPage.TITLE, query));
|
||||||
}
|
}
|
||||||
|
|
||||||
((DataCollection) collection.get(state)).addOrder("title asc, name asc");
|
((DataCollection) collection.get(state)).addOrder("title asc, name asc");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -204,17 +208,6 @@ public class ItemSearchFlatBrowsePane extends Form implements FormInitListener,
|
||||||
|
|
||||||
this.collection = collection;
|
this.collection = collection;
|
||||||
|
|
||||||
/*
|
|
||||||
* final Session session = SessionManager.getSession(); final BigDecimal typeId = (BigDecimal)
|
|
||||||
* state.getValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM)); if (typeId == null) { collection =
|
|
||||||
* session.retrieve(ContentPage.BASE_DATA_OBJECT_TYPE); } else { final ContentType type = new
|
|
||||||
* ContentType(typeId); collection = session.retrieve(type.getClassName()); }
|
|
||||||
*
|
|
||||||
* final String query = (String) state.getValue(queryParam); if ((query != null) && !query.isEmpty()) {
|
|
||||||
* collection.addFilter(String.format( "(lower(%s) like lower('%%%s%%')) or (lower(%s) like
|
|
||||||
* lower('%%%s%%'))", ContentItem.NAME, query, ContentPage.TITLE, query));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColumnCount() {
|
public int getColumnCount() {
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ public class ItemSearchPage extends CMSPage {
|
||||||
private static final CMSConfig s_conf = CMSConfig.getInstance();
|
private static final CMSConfig s_conf = CMSConfig.getInstance();
|
||||||
private static final boolean LIMIT_TO_CONTENT_SECTION = false;
|
private static final boolean LIMIT_TO_CONTENT_SECTION = false;
|
||||||
public static final String CONTENT_SECTION = "section_id";
|
public static final String CONTENT_SECTION = "section_id";
|
||||||
private boolean showFlatBrowsePane = false;
|
private final boolean showFlatBrowsePane;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new ItemSearchPage
|
* Construct a new ItemSearchPage
|
||||||
|
|
@ -75,6 +75,9 @@ public class ItemSearchPage extends CMSPage {
|
||||||
addGlobalStateParam(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
|
addGlobalStateParam(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
|
||||||
addGlobalStateParam(new StringParameter(ItemSearchPopup.WIDGET_PARAM));
|
addGlobalStateParam(new StringParameter(ItemSearchPopup.WIDGET_PARAM));
|
||||||
addGlobalStateParam(new StringParameter("searchWidget"));
|
addGlobalStateParam(new StringParameter("searchWidget"));
|
||||||
|
|
||||||
|
showFlatBrowsePane = s_conf.getItemSearchFlatBrowsePaneEnable();
|
||||||
|
|
||||||
|
|
||||||
m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
|
m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
|
||||||
addGlobalStateParam(m_sectionId);
|
addGlobalStateParam(m_sectionId);
|
||||||
|
|
@ -152,15 +155,16 @@ public class ItemSearchPage extends CMSPage {
|
||||||
addToPane(pane, "search", getSearchPane());
|
addToPane(pane, "search", getSearchPane());
|
||||||
// addToPane(pane, "create", getCreatePane());
|
// addToPane(pane, "create", getCreatePane());
|
||||||
|
|
||||||
if (s_conf.getItemSearchDefaultTab().equals("browse")) {
|
if ("browse".equals(s_conf.getItemSearchDefaultTab())) {
|
||||||
pane.setDefaultPane(m_browse);
|
pane.setDefaultPane(m_browse);
|
||||||
}
|
}
|
||||||
if (s_conf.getItemSearchDefaultTab().equals("search")) {
|
if ("search".equals(s_conf.getItemSearchDefaultTab())) {
|
||||||
pane.setDefaultPane(m_search);
|
pane.setDefaultPane(m_search);
|
||||||
}
|
}
|
||||||
|
if ("flatBrowse".equals(s_conf.getItemSearchDefaultTab()) && showFlatBrowsePane) {
|
||||||
if (showFlatBrowsePane) {
|
|
||||||
pane.setDefaultPane(m_flatBrowse);
|
pane.setDefaultPane(m_flatBrowse);
|
||||||
|
} else {
|
||||||
|
pane.setDefaultPane(m_browse);
|
||||||
}
|
}
|
||||||
|
|
||||||
//pane.addActionListener(this);
|
//pane.addActionListener(this);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue