Author: pboy Date: 2012-12-16 09:26:24 +0000 (Sun, 16 Dec 2012) New Revision: 2374 Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties trunk/ccm-cms/src/com/arsdigita/cms/PageLocations.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitSelector.java trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicItemForm.java trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/SimpleEditStep.java trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/WizardSelector.java trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java trunk/ccm-core/src/com/arsdigita/bebop/TabbedPane.java Log: Further enhanced ItemSearchWidget. Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties 2012-12-16 09:26:24 UTC (rev 2374) @@ -1103,3 +1103,5 @@ cms.ui.item_search.selected=Selected content item (id) cms.ui.item_search.create=Create new cms.ui.item_search.create.folder_select=Select folder +cms.ui.search.create.select_close=Select item and close +cms.ui.search.create.select_edit=Select item and edit Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties 2012-12-16 09:26:24 UTC (rev 2374) @@ -1094,3 +1094,5 @@ cms.ui.item_search.selected=Ausgew\u00e4hltes Content Item (ID) cms.ui.item_search.create=Neu anlegen cms.ui.item_search.create.folder_select=Ordner ausw\u00e4hlen +cms.ui.search.create.select_close=Item ausw\u00e4hlen und schlie\u00dfen +cms.ui.search.create.select_edit=Item ausw\u00e4hlen und weiter bearbeiten Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties 2012-12-16 09:26:24 UTC (rev 2374) @@ -42,3 +42,5 @@ cms.ui.item_search.selected= cms.ui.item_search.create= cms.ui.item_search.create.folder_select= +cms.ui.search.create.select_close= +cms.ui.search.create.select_edit= Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties 2012-12-16 09:26:24 UTC (rev 2374) @@ -573,3 +573,5 @@ cms.ui.item_search.selected= cms.ui.item_search.create= cms.ui.item_search.create.folder_select= +cms.ui.search.create.select_close= +cms.ui.search.create.select_edit= Modified: trunk/ccm-cms/src/com/arsdigita/cms/PageLocations.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/PageLocations.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/PageLocations.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -28,5 +28,5 @@ **/ public interface PageLocations { public String SECTION_PAGE = "admin/index.jsp"; - public String ITEM_PAGE = "admin/item.jsp"; + public String ITEM_PAGE = "admin/item.jsp"; } Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -133,6 +133,8 @@ private ItemRevisionAdminPane m_revisionsPane; private ItemTemplates m_templatesPane; private Link m_previewLink; + private GlobalNavigation m_globalNavigation; + private ContentItemContextBar m_contextBar; private class ItemRequestLocal extends ContentItemRequestLocal { @@ -194,8 +196,11 @@ m_returnURL = new StringParameter(RETURN_URL); addGlobalStateParam(m_returnURL); - add(new GlobalNavigation()); - add(new ContentItemContextBar(m_itemModel)); + m_globalNavigation = new GlobalNavigation(); + add(m_globalNavigation); + + m_contextBar = new ContentItemContextBar(m_itemModel); + add(m_contextBar); // Create panels. m_summaryPane = new Summary(m_itemModel); @@ -416,7 +421,7 @@ * @param tab The index of the tab to display */ public static String getItemURL(ContentItem item, int tab) { - final ContentSection section = ContentSection.getContentSection(item); + final ContentSection section = item.getContentSection(); if (section == null) { return null; @@ -504,5 +509,13 @@ return ContentSection.getConfig().getUseStreamlinedCreation() && STREAMLINED_CREATION_ACTIVE.equals(state.getRequest(). getParameter(STREAMLINED_CREATION)); + } + + protected TabbedPane getTabbedPane() { + return m_tabbedPane; } + + protected WizardSelector getWizardPane() { + return m_wizardPane; + } } Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -5,30 +5,44 @@ package com.arsdigita.cms.ui; import com.arsdigita.bebop.BoxPanel; +import com.arsdigita.bebop.Component; import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.Page; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.ParameterSingleSelectionModel; import com.arsdigita.bebop.SegmentedPanel; import com.arsdigita.bebop.SegmentedPanel.Segment; import com.arsdigita.bebop.SingleSelectionModel; -import com.arsdigita.bebop.event.ActionEvent; -import com.arsdigita.bebop.event.ActionListener; +import com.arsdigita.bebop.event.FormCancelListener; import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSubmissionListener; +import com.arsdigita.bebop.event.PrintEvent; +import com.arsdigita.bebop.event.PrintListener; +import com.arsdigita.bebop.form.Option; +import com.arsdigita.bebop.form.SingleSelect; import com.arsdigita.bebop.parameters.BigDecimalParameter; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.AuthoringKit; import com.arsdigita.cms.CMS; +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentSection; +import com.arsdigita.cms.ContentType; +import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.authoring.CreationSelector; import com.arsdigita.cms.ui.authoring.NewItemForm; +import com.arsdigita.cms.ui.authoring.WizardSelector; import com.arsdigita.cms.ui.folder.FlatFolderPicker; -import com.arsdigita.cms.ui.folder.FolderItemPane; import com.arsdigita.cms.ui.folder.FolderRequestLocal; import com.arsdigita.cms.ui.folder.FolderSelectionModel; -import com.arsdigita.cms.ui.folder.FolderTreeModelBuilder; +import com.arsdigita.cms.ui.item.ContentItemRequestLocal; import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.persistence.OID; +import com.arsdigita.web.RedirectSignal; +import com.arsdigita.web.URL; import java.math.BigDecimal; /** @@ -38,29 +52,38 @@ */ class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListener, FormSubmissionListener { + public static final String WIDGET_PARAM = "widget"; + public static final String SEARCHWIDGET_PARAM = "searchWidget"; + public static final String PUBLISHWIDGET_PARAM = "publishWidget"; private static final String CONTENT_TYPE_ID = "ct"; private static final String FOLDER_ID = "folder_id"; - private NewItemForm m_newItem; - private SingleSelectionModel m_typeSel; - private FlatFolderPicker m_folderPicker; + private final NewItemForm m_newItem; + private final SingleSelectionModel m_typeSel; + private final FlatFolderPicker m_folderPicker; //private final BaseTree m_tree; private final SingleSelectionModel m_model; private final FolderSelectionModel m_folderSel; // To support legacy UI code private final FolderRequestLocal m_folder; private final CreationSelector m_creator; - private final ItemSearchPage parent; - private SegmentedPanel m_segPanel; - private Segment m_creationSeg; - private Segment m_newItemSeg; + private final ItemSearchPage m_parent; + private final ContentItemRequestLocal m_contentItem = new ContentItemRequestLocal() { + }; + private final Link m_selectCloseLink; + private final Link m_selectEditLink; + private final SegmentedPanel m_segPanel; + private final Segment m_creationSeg; + private final Segment m_newItemSeg; + private final Segment m_linkSeg; public ItemSearchCreateItemPane(final ItemSearchPage parent) { super(); - this.parent = parent; + this.m_parent = parent; m_segPanel = new SegmentedPanel("itemSearchCreate"); m_creationSeg = new Segment(); m_newItemSeg = new Segment(); + m_linkSeg = new Segment(); m_newItem = new SectionNewItemForm("newItem"); //m_newItem.addProcessListener(this); @@ -78,7 +101,25 @@ m_typeSel = new ParameterSingleSelectionModel(new BigDecimalParameter(CONTENT_TYPE_ID)); // m_typeSel.addChangeListener(this); - m_creator = new CreationSelector(m_typeSel, m_folderSel); + m_creator = new CreationSelector(m_typeSel, m_folderSel) { + + @Override + public void editItem(final PageState state, final ContentItem item) { + + //final ContentSection section = getContentSection(state); + //final String nodeURL = URL.getDispatcherPath() + section.getPath() + "/"; + //final String target = ItemSearchContentItemPage.getItemURL(nodeURL, item.getID(), + // ContentItemPage.AUTHORING_TAB, true); + + //throw new RedirectSignal(target, true); + + m_creationSeg.setVisible(state, false); + m_linkSeg.setVisible(state, true); + + m_contentItem.set(state, item); + } + + }; m_creationSeg.add(m_creator); m_creationSeg.add(new Label("<br/>", false)); @@ -96,9 +137,89 @@ m_segPanel.add(m_newItemSeg); m_segPanel.add(m_creationSeg); - add(m_segPanel); + m_selectCloseLink = new Link( + (String) GlobalizationUtil.globalize("cms.ui.search.create.select_close").localize(), + new PrintListener() { + + public void prepare(final PrintEvent event) { + final Link target = (Link) event.getTarget(); + final PageState state = event.getPageState(); + + final ContentItem item = m_contentItem.getContentItem(state); + final String title; + if (item instanceof ContentPage) { + title = ((ContentPage) item).getTitle(); + } else { + title = item.getName(); + } + + final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM)); + final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM)); + final String publishWidget = (String) state.getValue(new StringParameter(PUBLISHWIDGET_PARAM)); + + target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";" + + "window.opener.document.%s.value=\"%s\";" + + "window.opener.document.%s.value=\"%s\";" + + "self.close();" + + "return false;", + widget, + item.getID().toString(), + searchWidget, + title, + publishWidget, + Boolean.TRUE.toString())); + } + + }); + + m_selectEditLink = new Link((String) GlobalizationUtil.globalize("cms.ui.search.create.select_edit").localize(), + new PrintListener() { + + public void prepare(final PrintEvent event) { + final Link target = (Link) event.getTarget(); + final PageState state = event.getPageState(); + + final ContentItem item = m_contentItem.getContentItem(state); + final String title; + if (item instanceof ContentPage) { + title = ((ContentPage) item).getTitle(); + } else { + title = item.getName(); + } + + + final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM)); + final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM)); + final String publishWidget = (String) state.getValue(new StringParameter(PUBLISHWIDGET_PARAM)); + + final ContentSection section = item.getContentSection(); + final String nodeURL = section.getPath() + "/"; + final String linkTarget = ContentItemPage.getItemURL(nodeURL, item.getID(), + ContentItemPage.AUTHORING_TAB, true); + target.setTarget(linkTarget); + target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";" + + "window.opener.document.%s.value=\"%s\";" + + "window.opener.document.%s.value=\"%s\";", + widget, + item.getID().toString(), + searchWidget, + title, + publishWidget, + Boolean.TRUE.toString())); + + } + + }); + + final BoxPanel linkPanel = new BoxPanel(BoxPanel.VERTICAL); + linkPanel.add(m_selectCloseLink); + linkPanel.add(m_selectEditLink); + m_linkSeg.add(linkPanel); + + m_segPanel.add(m_linkSeg); + } @Override @@ -107,6 +228,7 @@ page.setVisibleDefault(m_newItemSeg, true); page.setVisibleDefault(m_creationSeg, false); + page.setVisibleDefault(m_linkSeg, false); page.addComponentStateParam(this, m_typeSel.getStateParameter()); page.addComponentStateParam(this, m_folderSel.getStateParameter()); @@ -117,29 +239,14 @@ final BigDecimal typeID = m_newItem.getTypeID(state); m_typeSel.setSelectedKey(state, typeID); - final BigDecimal folderId = (BigDecimal) m_folderPicker.getValue(state); - m_folderSel.setSelectedKey(state, folderId); - + final OID folderOID = OID.valueOf((String) m_folderPicker.getValue(state)); + m_folderSel.setSelectedKey(state, folderOID.get("id")); m_newItemSeg.setVisible(state, false); m_creationSeg.setVisible(state, true); } public void process(final FormSectionEvent fse) throws FormProcessException { - final PageState state = fse.getPageState(); - final Object source = fse.getSource(); - //if (source == m_newItem) { - final BigDecimal typeID = m_newItem.getTypeID(state); - m_typeSel.setSelectedKey(state, typeID); - final BigDecimal folderId = (BigDecimal) m_folderPicker.getValue(state); - m_folderSel.setSelectedKey(state, folderId); - - //m_newItem.setVisible(state, false); - //m_creator.setVisible(state, true); - m_newItemSeg.setVisible(state, false); - m_creationSeg.setVisible(state, true); - //parent.setTabActive(state, this, true); - //newItemMode(state); - //} + //Nothing } private static class SectionNewItemForm extends NewItemForm { @@ -151,5 +258,6 @@ public ContentSection getContentSection(PageState s) { return CMS.getContext().getContentSection(); } + } } Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -5,7 +5,6 @@ import com.arsdigita.bebop.Form; import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormProcessException; -import com.arsdigita.bebop.GridPanel; import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Link; import com.arsdigita.bebop.Page; @@ -13,7 +12,6 @@ import com.arsdigita.bebop.PaginationModelBuilder; import com.arsdigita.bebop.Paginator; import com.arsdigita.bebop.RequestLocal; -import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.Table; import com.arsdigita.bebop.event.FormInitListener; import com.arsdigita.bebop.event.FormProcessListener; @@ -37,14 +35,10 @@ import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.persistence.DataCollection; -import com.arsdigita.persistence.DataQuery; import com.arsdigita.persistence.Session; import com.arsdigita.persistence.SessionManager; -import com.arsdigita.toolbox.ui.DataQueryBuilder; -import com.arsdigita.toolbox.ui.DataTable; import com.arsdigita.util.LockableImpl; import java.math.BigDecimal; -import org.bouncycastle.asn1.ess.ContentIdentifier; /** * @@ -297,7 +291,10 @@ final ContentPage page = new ContentPage((BigDecimal) key); link.setOnClick(String.format( - "window.opener.document.%s.value=\"%s\";window.opener.document.%s.value=\"%s\";self.close();return false;", + "window.opener.document.%s.value=\"%s\";" + + "window.opener.document.%s.value=\"%s\";" + + "self.close();" + + "return false;", widget, key.toString(), searchWidget, Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -78,6 +78,7 @@ addGlobalStateParam(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM)); addGlobalStateParam(new StringParameter(ItemSearchPopup.WIDGET_PARAM)); addGlobalStateParam(new StringParameter("searchWidget")); + addGlobalStateParam(new StringParameter("publishWidget")); m_sectionId = new BigDecimalParameter(CONTENT_SECTION); addGlobalStateParam(m_sectionId); Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -59,8 +59,9 @@ private static final Logger s_log = Logger.getLogger(ItemSearchWidget.class); //private Hidden m_selected; - private TextField m_selected; + private TextField m_selected; private TextField m_item; + private Hidden m_publish; private Submit m_search; private Submit m_clear; private Label m_jsLabel; @@ -78,6 +79,7 @@ public static final String BEBOP_ITEM_SEARCH = "bebop:itemSearch"; public static final String SEARCH = "search"; public static final boolean LIMIT_TO_CONTENT_SECTION = false; + public static final String PUBLISH = "publish"; private class ItemFragment extends TextField { @@ -184,18 +186,18 @@ } /** - * 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 + * * @param model - * @param contentType + *param + * contentType */ public ItemSearchWidget(final ParameterModel model, final ContentType contentType) { super(new BoxPanel(BoxPanel.VERTICAL)); @@ -203,7 +205,7 @@ if (!(model instanceof ItemSearchParameter)) { throw new IllegalArgumentException( "The ItemSearch widget " + model.getName() - + " must be backed by a ItemSearchParameter parmeter model"); + + " must be backed by a ItemSearchParameter parameter model"); } m_name = model.getName(); @@ -223,22 +225,29 @@ m_contentType = contentType; //m_selected = new Hidden(model); m_selected = new ItemFragment(model, this); - final Label selectedItemLabel = new Label(selectedLabelText); + final Label selectedItemLabel = new Label(selectedLabelText); selectedItemLabel.addPrintListener(new PrintListener() { + public void prepare(final PrintEvent event) { - final Label target = (Label) event.getTarget(); - target.setLabel(selectedLabelText); + final Label target = (Label) event.getTarget(); + target.setLabel(selectedLabelText); } + }); final Label searchLabel = new Label(searchLabelText); searchLabel.addPrintListener(new PrintListener() { public void prepare(final PrintEvent event) { final Label target = (Label) event.getTarget(); - target.setLabel(searchLabelText); + target.setLabel(searchLabelText); } + }); //m_item = new ItemFragment(model, this); + + m_publish = new Hidden(PUBLISH); + add(m_publish); + m_item = new TextField(m_searchModel); m_search = new SearchFragment(m_searchName, this); m_clear = new ClearFragment(m_clearName, this); @@ -255,12 +264,12 @@ CMS.getContext().getContentSection().getID()); params.setParameter("widget", formName + ".elements['" + m_selected. //m_item. getName() + "']"); - params.setParameter("searchWidget", formName + ".elements['" + m_item.getName() + "']"); + params.setParameter("searchWidget", formName + ".elements['" + m_item.getName() + "']"); if (typeURLFrag != null) { params.setParameter("single_type", typeURLFrag); } + params.setParameter("publishWidget", formName + ".elements['" + m_publish.getName() + "']"); - String searchURL = WorkspaceServlet.getURLStubForClass( ItemSearchPage.class.getName()); s_log.debug("Search URL stub is: " + searchURL); @@ -277,9 +286,18 @@ //+ m_item.getName().replace('.', '_') + m_selected.getName().replace('.', '_') + "Popup(theForm) { \n" - + " aWindow = window.open(\"" + url + "&query=\" + document.getElementById('" + m_item.getName() + "').value , " + + "var width = screen.width * 0.5;\n" + + "var height = screen.height * 0.5;\n" + + "if ((width < 800) && (screen.width >= 800)) {\n" + + "width = 800;\n" + + "}\n" + + "if ((height < 600) && (screen.height >= 600)) {\n" + + "height = 600;\n" + + "}\n" + + " aWindow = window.open(\"" + url + "&query=\" + document.getElementById('" + m_item. + getName() + "').value , " //+ "\"search\", \"toolbar=no,width=800,height=600,status=no,scrollbars=yes,resize=yes\");\n" - + "\"search\", \"toolbar=no,width=\" + screen.width*0.5 + \",height=\" + screen.height*0.5 + \",status=no,scrollbars=yes,resize=yes\");\n" + + "\"search\", \"toolbar=no,width=\" + width + \",height=\" + height + \",status=no,scrollbars=yes,resize=yes\");\n " + "return false;\n" + " } \n" + " --> \n" @@ -292,12 +310,12 @@ final FormSection searchSection = new FormSection(new BoxPanel(BoxPanel.VERTICAL)); final BoxPanel searchRow = new BoxPanel(BoxPanel.HORIZONTAL); searchRow.add(searchLabel); - searchRow.add(m_item); + searchRow.add(m_item); searchRow.add(m_search); searchRow.add(m_clear); final BoxPanel itemRow = new BoxPanel(BoxPanel.HORIZONTAL); - itemRow.add(selectedItemLabel); - itemRow.add(m_selected); + itemRow.add(selectedItemLabel); + itemRow.add(m_selected); searchSection.add(searchRow); searchSection.add(itemRow); searchSection.add(m_jsLabel); @@ -363,6 +381,7 @@ m_topHR.setVisible(s, false); m_bottomHR.setVisible(s, false); m_search.setVisible(s, true); + e.getFormData().put(PUBLISH, Boolean.FALSE.toString()); } catch (IllegalStateException ex) { // component is in metaform. nothing to do here. Custom generateXML must hide for us } @@ -403,10 +422,10 @@ if (m_contentType != null) { state.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM), - m_contentType.getID()); + m_contentType.getID()); } else { state.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM), - null); + null); } throw new FormProcessException("item search FormSection submit"); } else if (m_search.isSelected(state)) { @@ -423,10 +442,10 @@ if (m_contentType != null) { state.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM), - m_contentType.getID()); + m_contentType.getID()); } else { state.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM), - null); + null); } throw new FormProcessException("item search FormSection submit"); } else if (m_clear.isSelected(state)) { @@ -436,7 +455,7 @@ m_searchComponent.setVisible(state, false); m_topHR.setVisible(state, false); m_bottomHR.setVisible(state, false); - m_search.setVisible(state, true); + m_search.setVisible(state, true); } catch (IllegalStateException ex) { // component is in metaform. nothing to do here. Custom generateXML must hide for us } @@ -455,9 +474,9 @@ } public String getSearchLabelText() { - return searchLabelText; + return searchLabelText; } - + public void setSearchLabelText(final String searchLabelText) { this.searchLabelText = searchLabelText; } @@ -469,5 +488,5 @@ public void setSelectedLabelText(String selectedLabelText) { this.selectedLabelText = selectedLabelText; } - + } Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitSelector.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitSelector.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitSelector.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -18,46 +18,49 @@ */ package com.arsdigita.cms.ui.authoring; - import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.Label; import com.arsdigita.bebop.MapComponentSelectionModel; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.SingleSelectionModel; +import com.arsdigita.bebop.event.PrintEvent; +import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.cms.AuthoringKit; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentTypeCollection; +import com.arsdigita.cms.ui.ScriptPrinter; import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.toolbox.ui.LayoutPanel; import com.arsdigita.xml.Element; import org.apache.log4j.Logger; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; - /** * Selects a component based on content type. Helper class for {@link * com.arsdigita.cms.ui.authoring.WizardSelector}. * - * @version $Id$ + * @version $Id$ */ public abstract class AuthoringKitSelector extends SimpleContainer { private static Logger s_log = - Logger.getLogger(AuthoringKitSelector.class); - + Logger.getLogger(AuthoringKitSelector.class); private Map m_comps; private MapComponentSelectionModel m_sel; ContentTypeCollection m_types; + private ScriptPrinter scriptPrinter; /** - * Construct a new AuthoringKitSelector. Load all the possible - * authoring kits from the database and construct components - * for them. + * Construct a new AuthoringKitSelector. Load all the possible authoring kits from the database and construct + * components for them. * - * @param model the {@link ItemSelectionModel} which will - * supply the selector with the id of a content type + * @param model the {@link ItemSelectionModel} which will supply the selector with the id of a content type * * @pre itemModel != null */ @@ -68,62 +71,78 @@ m_sel = new MapComponentSelectionModel(model, m_comps); m_types = ContentType.getAllContentTypes(); - if ( m_types.isEmpty() ) { + if (m_types.isEmpty()) { m_types.close(); - throw new IllegalStateException( (String) GlobalizationUtil.globalize("cms.ui.authoring.no_content_types_were_found").localize()); + throw new IllegalStateException((String) GlobalizationUtil.globalize( + "cms.ui.authoring.no_content_types_were_found").localize()); } - } // Overloaded add methods + @Override public void add(Component c) { throw new UnsupportedOperationException(); } // Overloaded add methods + @Override public void add(Component c, int constraints) { throw new UnsupportedOperationException(); } /** - * Instantiate all the authoring kit wizards. - * The child class should call this method after it is done - * with initialization + * Instantiate all the authoring kit wizards. The child class should call this method after it is done with + * initialization */ protected void processKit() { - while(m_types.next()) { + while (m_types.next()) { ContentType type = m_types.getContentType(); AuthoringKit kit = type.getAuthoringKit(); - if(kit != null) { + if (kit != null) { Component c = instantiateKitComponent(kit, type); - if(c != null) { + if (c != null) { super.add(c); m_comps.put(type.getID(), c); s_log.info("Added component " + c + " for " + type.getAssociatedObjectType()); } + + if (c instanceof LayoutPanel) { + Label label = new Label("", false); + label.addPrintListener(new PrintListener() { + + public void prepare(final PrintEvent event) { + final Label label = (Label) event.getTarget(); + if (scriptPrinter != null) { + label.setLabel(scriptPrinter.printScript(event.getPageState())); + } + } + + }); + + ((LayoutPanel) c).setBottom(label); + } } } } /** - * Instantiate an authoring kit component. Child classes should - * override this to do the right thing. It is permissible for this - * method to return null. + * Instantiate an authoring kit component. Child classes should override this to do the right thing. It is + * permissible for this method to return null. * - * @param kit for this kit + * @param kit for this kit * @param type for this type */ protected abstract Component instantiateKitComponent( - AuthoringKit kit, ContentType type - ); + AuthoringKit kit, ContentType type); /** * @param id The content type id + * * @return The component the given type id */ public Component getComponent(BigDecimal id) { - return (Component)m_comps.get(id); + return (Component) m_comps.get(id); } /** @@ -135,14 +154,13 @@ // Choose the right component and run it public void generateXML(PageState state, Element parent) { - if ( isVisible(state) ) { + if (isVisible(state)) { Component c = m_sel.getComponent(state); - if ( c == null) { + if (c == null) { throw new IllegalStateException("No component for " + m_sel.getSelectedKey(state)); } c.generateXML(state, parent); } - } - + } } Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicItemForm.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicItemForm.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicItemForm.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -31,6 +31,7 @@ import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormValidationListener; +import com.arsdigita.bebop.form.Hidden; import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.bebop.parameters.TrimmedStringParameter; @@ -66,6 +67,7 @@ private final ItemSelectionModel m_itemModel; private SaveCancelSection m_saveCancelSection; private FormSection m_widgetSection; + public static final String CONTENT_ITEM_ID = ContentItem.ID; public static final String NAME = ContentItem.NAME; public static final String TITLE = ContentPage.TITLE; public static final String LANGUAGE = ContentItem.LANGUAGE; @@ -137,7 +139,12 @@ */ protected void addWidgets() { //add(new FormErrorDisplay(this), ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT); - + + //add(new Label("id")); + final Hidden id = new Hidden(CONTENT_ITEM_ID); + //final TextField id = new TextField(CONTENT_ITEM_ID); + add(id); + // JavaScript auto-name generation is off by default. // It is turned on under the following circumstances // Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -123,6 +123,7 @@ if (item != null) { // Preset fields + data.put(CONTENT_ITEM_ID, item.getID().toString()); data.put(NAME, item.getName()); data.put(TITLE, item.getTitle()); // data.put(DESCRIPTION, item.getDescription()); Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/SimpleEditStep.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/SimpleEditStep.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/SimpleEditStep.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -18,6 +18,7 @@ */ package com.arsdigita.cms.ui.authoring; +import com.arsdigita.bebop.Label; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -26,9 +27,12 @@ import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.event.ActionEvent; import com.arsdigita.bebop.event.ActionListener; +import com.arsdigita.bebop.event.PrintEvent; +import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.bebop.event.RequestEvent; import com.arsdigita.bebop.event.RequestListener; import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.ui.ContentItemPage; @@ -133,7 +137,7 @@ component.setItemSelectionModel(itemModel); addDisplayComponent(component); - } + } } /** Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/WizardSelector.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/WizardSelector.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/WizardSelector.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -22,6 +22,7 @@ import com.arsdigita.bebop.Component; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Resettable; +import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.parameters.BigDecimalParameter; import com.arsdigita.cms.AuthoringKit; @@ -29,6 +30,7 @@ import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.util.GlobalizationUtil; +import com.arsdigita.toolbox.ui.LayoutPanel; import com.arsdigita.xml.Element; import java.math.BigDecimal; @@ -81,7 +83,7 @@ new ItemSelectionModel(type, (BigDecimalParameter)m_itemSel.getStateParameter()); - AuthoringKitWizard w = new AuthoringKitWizard(type, itemModel); + AuthoringKitWizard w = new AuthoringKitWizard(type, itemModel); return w; } @@ -114,7 +116,7 @@ } else { typeId = type.getID(); } - + // Return the selected wizard return (Component)getComponent(typeId); } Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -8,6 +8,7 @@ import com.arsdigita.bebop.event.PrintListener; import com.arsdigita.bebop.event.PrintEvent; import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.cms.Folder; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.persistence.OID; @@ -19,42 +20,46 @@ * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ public abstract class AbstractFolderPicker extends SingleSelect { - + public AbstractFolderPicker(String name) { - super(new OIDParameter(name)); - + //super(new OIDParameter(name)); + super(new StringParameter(name)); + try { addPrintListener(new PrintListener() { + @Override - public void prepare(PrintEvent ev) { - addOptions(ev.getPageState(), - (SingleSelect)ev.getTarget()); - } - }); + public void prepare(PrintEvent ev) { + addOptions(ev.getPageState(), + (SingleSelect) ev.getTarget()); + } + + }); } catch (TooManyListenersException ex) { throw new RuntimeException("this cannot happen"); - } + } } - + public Folder getFolder(PageState state) { - OID oid = (OID)getValue(state); - + OID oid = OID.valueOf((String) getValue(state));//(OID) getValue(state); + if (oid == null) { return null; + } else { + return (Folder) DomainObjectFactory.newInstance(oid); } - return (Folder)DomainObjectFactory.newInstance(oid); } - - public void setCategory(PageState state, - Folder folder) { + + public void setFolder(PageState state, + Folder folder) { if (folder == null) { setValue(state, null); } else { - setValue(state, folder.getOID()); + setValue(state, folder.getOID().toString()); } } - + protected abstract void addOptions(PageState state, SingleSelect target); - + } Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -25,7 +25,7 @@ } protected void addOptions(PageState state, SingleSelect target) { - target.addOption(new Option(null, "")); + target.addOption(new Option("", "")); final ContentSection section = CMS.getContext().getContentSection(); //final String sectionName = section.getName(); @@ -70,7 +70,7 @@ path = String.format("%s/%s", prefix, folder.getName()); } - target.addOption(new Option(folder.getID().toString(), path)); + target.addOption(new Option(folder.getOID().toString(), path)); final ItemCollection children = folder.getChildren(); children.addEqualsFilter("objectType", Folder.BASE_DATA_OBJECT_TYPE); Modified: trunk/ccm-core/src/com/arsdigita/bebop/TabbedPane.java =================================================================== --- trunk/ccm-core/src/com/arsdigita/bebop/TabbedPane.java 2012-12-16 09:21:24 UTC (rev 2373) +++ trunk/ccm-core/src/com/arsdigita/bebop/TabbedPane.java 2012-12-16 09:26:24 UTC (rev 2374) @@ -100,7 +100,7 @@ while (i.hasNext()) { Pane pane = (Pane) i.next(); p.setVisibleDefault(pane.getComponent(), pane == m_defaultPane); - } + } } /** |