Diverse Änderungen an ItemSearchWidget, FlatItemList und NewItemForm in Vorbereitung für die weitern Änderungen am ItemSearchWidget
FlatItemList * Die Länge der Liste ist nun per Config-Parameter einstellbar (war auf 20 hardcodiert) ItemSearchFolderBrowser * Die Länger der Liste ist nun per Config-Parameter einstellbar (war auf 15 hardcodiert) NewitemForm * Sucht jetzt im PageState nach einem SingleType - Parameter und begrenzt ggf. die Liste der CTs auf die Liste der Siblings von singleType TextAssetBodyLabelCellRenderer * Dem Label des Textkörpers zum Anzeigen des TextAssets (z.B. be Artikeln) wird nun ein id="webPage" mitgegeben. Dadurch kann man auch im CC an dieser Stelle die Layouts der Webseite verwenden. git-svn-id: https://svn.libreccm.org/ccm/trunk@649 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
30573f253d
commit
c8889b9925
|
|
@ -442,6 +442,13 @@ public final class CMSConfig extends AbstractConfig {
|
|||
private final Parameter m_itemSearchDefaultTab = new StringParameter("com.arsdigita.cms.item_search.default_tab",
|
||||
Parameter.REQUIRED, "browse");
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// FolderBrowse
|
||||
/////////////////////////////////////////////
|
||||
private final Parameter m_folderBrowseListSize = new IntegerParameter("com.arsdigita.cms.folder_browse_list_size",
|
||||
Parameter.REQUIRED, 20);
|
||||
|
||||
|
||||
// ///////////////////////////////////////////
|
||||
// publishToFile package related parameter
|
||||
// ///////////////////////////////////////////
|
||||
|
|
@ -516,6 +523,8 @@ public final class CMSConfig extends AbstractConfig {
|
|||
|
||||
register(m_itemSearchDefaultTab);
|
||||
|
||||
register(m_folderBrowseListSize);
|
||||
|
||||
// publishToFile package related parameter
|
||||
// Moved to publishToFile.PublishToFileConfig as of version 6.0.2
|
||||
// register(m_disableItemPfs);
|
||||
|
|
@ -888,4 +897,8 @@ public final class CMSConfig extends AbstractConfig {
|
|||
public String getItemSearchDefaultTab() {
|
||||
return (String) get(m_itemSearchDefaultTab);
|
||||
}
|
||||
|
||||
public Integer getFolderBrowseListSize() {
|
||||
return (Integer) get(m_folderBrowseListSize);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,8 +233,13 @@ com.arsdigita.cms.item_search.default_tab.purpose=Select either "browse" or "sea
|
|||
com.arsdigita.cms.item_search.default_tab.example=browse
|
||||
com.arsdigita.cms.item_search.default_tab.format=[string]
|
||||
|
||||
com.arsdigita.cms.item_search.xx.title=
|
||||
com.arsdigita.cms.item_search.xx.purpose=
|
||||
com.arsdigita.cms.item_search.xx.example=
|
||||
com.arsdigita.cms.item_search.xx.format=[string]
|
||||
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.example=20
|
||||
com.arsdigita.cms.folder_browse_list_size.format=[integer]
|
||||
|
||||
com.arsdigita.cms.xx.title=
|
||||
com.arsdigita.cms.xx.purpose=
|
||||
com.arsdigita.cms.xx.example=
|
||||
com.arsdigita.cms.xx.format=[string]
|
||||
|
||||
|
|
|
|||
|
|
@ -93,9 +93,6 @@ public class FlatItemList extends SegmentedPanel
|
|||
private static final String PRIVILEGE = "privilege";
|
||||
private static final String PRIVILEGE_NAME = "prettyName";
|
||||
|
||||
//maximum number of items displayed in the table at a time
|
||||
public static int LIST_SIZE = 20;
|
||||
|
||||
// The folder selectors
|
||||
private FolderSelectionModel m_folderSel;
|
||||
private FolderRequestLocal m_folder;
|
||||
|
|
@ -295,6 +292,7 @@ public class FlatItemList extends SegmentedPanel
|
|||
m_editFolderSeg.add(new Label("<br/>", false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(Page p) {
|
||||
super.register(p);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,8 +56,6 @@ import com.arsdigita.persistence.FilterFactory;
|
|||
import com.arsdigita.util.Assert;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
|
|
@ -72,7 +70,7 @@ public class ItemSearchFolderBrowser extends Table {
|
|||
|
||||
private static final org.apache.log4j.Logger s_log =
|
||||
org.apache.log4j.Logger.getLogger(ItemSearchFolderBrowser.class);
|
||||
public static final int MAX_ROWS = 15;
|
||||
|
||||
private static GlobalizedMessage[] s_headers = {
|
||||
globalize("cms.ui.folder.name"),
|
||||
globalize("cms.ui.folder.title"),
|
||||
|
|
@ -90,7 +88,7 @@ public class ItemSearchFolderBrowser extends Table {
|
|||
FolderTableModelBuilder builder = new FolderTableModelBuilder();
|
||||
setModelBuilder(builder);
|
||||
|
||||
m_paginator = new Paginator(builder, MAX_ROWS);
|
||||
m_paginator = new Paginator(builder, ContentSection.getConfig().getFolderBrowseListSize());
|
||||
|
||||
m_currentFolder = currentFolder;
|
||||
|
||||
|
|
@ -253,7 +251,7 @@ public class ItemSearchFolderBrowser extends Table {
|
|||
int size = ((Integer) m_size.get(state)).intValue();
|
||||
|
||||
return ItemSearchFolderBrowser.this.isVisible(state)
|
||||
&& (size > MAX_ROWS);
|
||||
&& (size > ContentSection.getConfig().getFolderBrowseListSize());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -319,7 +317,7 @@ public class ItemSearchFolderBrowser extends Table {
|
|||
}
|
||||
|
||||
private String generateJSLabel(BigDecimal id, String widget, String fill) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append(" <script language=javascript> "
|
||||
+ " <!-- \n"
|
||||
+ " function fillItem"
|
||||
|
|
@ -389,6 +387,7 @@ public class ItemSearchFolderBrowser extends Table {
|
|||
|
||||
private class FolderChanger extends TableActionAdapter {
|
||||
|
||||
@Override
|
||||
public void cellSelected(TableActionEvent e) {
|
||||
PageState s = e.getPageState();
|
||||
int col = e.getColumn().intValue();
|
||||
|
|
|
|||
|
|
@ -83,18 +83,15 @@ public class ItemSearchWidget extends FormSection
|
|||
private class SearchFragment extends Submit {
|
||||
|
||||
private ItemSearchWidget parent;
|
||||
private ContentType contentType;
|
||||
|
||||
public SearchFragment(String name,
|
||||
ItemSearchWidget parent,
|
||||
ContentType contentType) {
|
||||
public SearchFragment(String name, ItemSearchWidget parent) {
|
||||
super(name, "Search");
|
||||
this.parent = parent;
|
||||
this.contentType = contentType;
|
||||
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))
|
||||
|
|
@ -188,7 +185,7 @@ public class ItemSearchWidget extends FormSection
|
|||
|
||||
m_contentType = contentType;
|
||||
m_item = new ItemFragment(model, this);
|
||||
m_search = new SearchFragment(m_searchName, this, m_contentType);
|
||||
m_search = new SearchFragment(m_searchName, this);
|
||||
m_clear = new ClearFragment(m_clearName, this);
|
||||
m_jsLabel = new LabelFragment("", false, this);
|
||||
m_jsLabel.addPrintListener(new PrintListener() {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.cms.ui.authoring;
|
||||
|
||||
|
||||
import com.arsdigita.bebop.BoxPanel;
|
||||
import com.arsdigita.bebop.Form;
|
||||
import com.arsdigita.bebop.Label;
|
||||
|
|
@ -34,11 +33,12 @@ import com.arsdigita.cms.ContentSection;
|
|||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ContentTypeCollection;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.ui.ItemSearch;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.Party;
|
||||
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||
import com.arsdigita.kernel.permissions.PermissionManager;
|
||||
import com.arsdigita.kernel.permissions.PermissionService;
|
||||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
|
@ -59,15 +59,12 @@ public abstract class NewItemForm extends Form {
|
|||
|
||||
public static final String RESOURCE_BUNDLE =
|
||||
"com.arsdigita.cms.ui.authoring.AuthoringResources";
|
||||
|
||||
public static String DP_TYPE_PREFIX =
|
||||
"com.arsdigita.dp.";
|
||||
|
||||
private SingleSelect m_typeWidget;
|
||||
private Submit m_submit;
|
||||
private Label m_emptyLabel;
|
||||
private Label m_createLabel;
|
||||
|
||||
public static final String TYPE_ID = "tid";
|
||||
|
||||
/**
|
||||
|
|
@ -82,13 +79,11 @@ public abstract class NewItemForm extends Form {
|
|||
panel.setWidth("2%");
|
||||
panel.setBorder(0);
|
||||
|
||||
m_emptyLabel = new Label
|
||||
(globalize("cms.ui.authoring.no_types_registered"), false);
|
||||
m_emptyLabel = new Label(globalize("cms.ui.authoring.no_types_registered"), false);
|
||||
m_emptyLabel.setIdAttr("empty_label");
|
||||
add(m_emptyLabel);
|
||||
|
||||
m_createLabel = new Label
|
||||
(globalize("cms.ui.authoring.create_new"), false);
|
||||
m_createLabel = new Label(globalize("cms.ui.authoring.create_new"), false);
|
||||
m_createLabel.setIdAttr("create_label");
|
||||
add(m_createLabel);
|
||||
|
||||
|
|
@ -102,16 +97,31 @@ public abstract class NewItemForm extends Form {
|
|||
PageState state = e.getPageState();
|
||||
|
||||
ContentSection section = getContentSection(state);
|
||||
ContentType parentType = null;
|
||||
ContentTypeCollection typesCollection = null;
|
||||
BigDecimal singleTypeID = (BigDecimal) state.getValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
|
||||
|
||||
ContentTypeCollection c = section.getCreatableContentTypes();
|
||||
if (singleTypeID != null) {
|
||||
try {
|
||||
parentType = new ContentType(singleTypeID);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
parentType = null;
|
||||
}
|
||||
}
|
||||
|
||||
c.addOrder(ContentType.LABEL);
|
||||
if (parentType == null) {
|
||||
typesCollection = section.getCreatableContentTypes();
|
||||
} else {
|
||||
typesCollection = section.getSiblingsOfContentType(parentType);
|
||||
}
|
||||
|
||||
if(!c.isEmpty()) {
|
||||
typesCollection.addOrder(ContentType.LABEL);
|
||||
|
||||
if (!typesCollection.isEmpty()) {
|
||||
// Add content types
|
||||
while(c.next()) {
|
||||
while (typesCollection.next()) {
|
||||
boolean list = true;
|
||||
ContentType type = c.getContentType();
|
||||
ContentType type = typesCollection.getContentType();
|
||||
if (PermissionService.getDirectGrantedPermissions(type.getOID()).size() > 0) {
|
||||
// chris gilbert - allow restriction of some types to certain
|
||||
// users/groups. No interface to do this, but group could be
|
||||
|
|
@ -136,17 +146,15 @@ public abstract class NewItemForm extends Form {
|
|||
String cn = type.getClassName();
|
||||
String l = type.getLabel();
|
||||
if (cn.startsWith(DP_TYPE_PREFIX, 0)) {
|
||||
o.addOption(new Option
|
||||
(type.getID().toString(),
|
||||
o.addOption(new Option(type.getID().toString(),
|
||||
new Label(globalize(l.replace(' ', '_')))));
|
||||
} else {
|
||||
o.addOption(new Option
|
||||
(type.getID().toString(), type.getLabel()));
|
||||
o.addOption(new Option(type.getID().toString(), type.getLabel()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
c.reset();
|
||||
typesCollection.reset();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -156,8 +164,7 @@ public abstract class NewItemForm extends Form {
|
|||
|
||||
add(m_typeWidget);
|
||||
|
||||
m_submit = new Submit
|
||||
("new", globalize("cms.ui.authoring.go"));
|
||||
m_submit = new Submit("new", globalize("cms.ui.authoring.go"));
|
||||
add(m_submit);
|
||||
|
||||
}
|
||||
|
|
@ -200,5 +207,4 @@ public abstract class NewItemForm extends Form {
|
|||
public static GlobalizedMessage globalize(String key) {
|
||||
return new GlobalizedMessage(key, RESOURCE_BUNDLE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,16 +44,16 @@ public class TextAssetBodyLabelCellRenderer implements TableCellRenderer {
|
|||
if (TextAsset.CONTENT.equals(key) && value instanceof TextAsset) {
|
||||
// We have different styles for different mime types
|
||||
TextAsset asset = (TextAsset)value;
|
||||
label = new Label(asset.getText());
|
||||
label.setIdAttr("webPage");
|
||||
String type = asset.getMimeType().getMimeType()
|
||||
.toLowerCase();
|
||||
if (type.indexOf("text/xml") > -1 ||
|
||||
type.indexOf("text/xsl") > -1 ||
|
||||
type.indexOf("text/x-jsp") > -1) {
|
||||
label = new Label(asset.getText());
|
||||
label.setClassAttr("preformatted");
|
||||
label.setOutputEscaping(true);
|
||||
} else {
|
||||
label = new Label(asset.getText());
|
||||
label.setOutputEscaping(false);
|
||||
}
|
||||
} else if (MIME_TYPE_KEY.equals(key) && value instanceof TextAsset) {
|
||||
|
|
|
|||
|
|
@ -57,11 +57,11 @@ import com.arsdigita.bebop.table.TableColumn;
|
|||
import com.arsdigita.bebop.tree.TreeCellRenderer;
|
||||
import com.arsdigita.cms.ContentBundle;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.Folder;
|
||||
import com.arsdigita.cms.ItemCollection;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.cms.ui.FlatItemList;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
|
|
@ -129,6 +129,7 @@ public class FolderManipulator extends SimpleContainer
|
|||
m_targetSelector.addSubmissionListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(Page p) {
|
||||
super.register(p);
|
||||
p.setVisibleDefault(m_targetSelector, false);
|
||||
|
|
@ -369,6 +370,7 @@ public class FolderManipulator extends SimpleContainer
|
|||
add(scs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(Page p) {
|
||||
super.register(p);
|
||||
p.addComponentStateParam(this, m_targetSel.getStateParameter());
|
||||
|
|
@ -429,7 +431,7 @@ public class FolderManipulator extends SimpleContainer
|
|||
m_browser = new FolderBrowser(m_srcFolderSel);
|
||||
m_paginator = new Paginator
|
||||
((PaginationModelBuilder)m_browser.getModelBuilder(),
|
||||
FlatItemList.LIST_SIZE);
|
||||
ContentSection.getConfig().getFolderBrowseListSize());
|
||||
panel.add(m_paginator);
|
||||
panel.add(m_browser);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ 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.ContentTypeCollection;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.search.CreationDateFilterType;
|
||||
import com.arsdigita.cms.search.CreationUserFilterType;
|
||||
|
|
@ -124,6 +122,7 @@ public class ItemQueryComponent extends BaseQueryComponent {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible(PageState state) {
|
||||
return !ContentSection.getConfig().getHideLaunchDate()
|
||||
&& super.isVisible(state);
|
||||
|
|
|
|||
Loading…
Reference in New Issue