diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java new file mode 100644 index 000000000..70af47748 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java @@ -0,0 +1,88 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.arsdigita.cms.ui; + +import com.arsdigita.bebop.Label; +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.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.parameters.BigDecimalParameter; +import com.arsdigita.cms.CMS; +import com.arsdigita.cms.ContentSection; +import com.arsdigita.cms.ui.authoring.CreationSelector; +import com.arsdigita.cms.ui.authoring.NewItemForm; +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.util.GlobalizationUtil; +import java.math.BigDecimal; + +/** + * + * @author Sören Bernstein (quasimodo) + */ +class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListener { + + private static final String CONTENT_TYPE_ID = "ct"; + private NewItemForm m_newItem; + private SingleSelectionModel m_typeSel; + 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 CreationSelector m_selector; + private Segment m_newItemSeg; + + public ItemSearchCreateItemPane() { + +// m_newItem = new SectionNewItemForm("newItem"); +// m_newItem.addProcessListener(this); + + m_tree = new BaseTree(new FolderTreeModelBuilder()); + m_model = m_tree.getSelectionModel(); + m_folderSel = new FolderSelectionModel(m_model); + m_folder = new FolderRequestLocal(m_folderSel); + +// m_newItemSeg = addSegment(); + this.setIdAttr("folder-new-item"); + +// m_newItemSeg.addHeader(new Label(GlobalizationUtil.globalize("cms.ui.new_item"))); + m_typeSel = new ParameterSingleSelectionModel(new BigDecimalParameter(CONTENT_TYPE_ID)); +// m_typeSel.addChangeListener(this); + + m_selector = new CreationSelector(m_typeSel, m_folderSel); + this.add(m_selector); + this.add(new Label("
", false)); + +// add(m_newItem); + + + } + + public void process(FormSectionEvent e) { + PageState s = e.getPageState(); + final Object source = e.getSource(); + if (source == m_newItem) { + BigDecimal typeID = m_newItem.getTypeID(s); + m_typeSel.setSelectedKey(s, typeID); + //newItemMode(s); + } + } + + private static class SectionNewItemForm extends NewItemForm { + + public SectionNewItemForm(String name) { + super(name); + } + + public ContentSection getContentSection(PageState s) { + return CMS.getContext().getContentSection(); + } + } +} diff --git a/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java b/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java new file mode 100644 index 000000000..9063ea33e --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java @@ -0,0 +1,60 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.arsdigita.cms.ui.folder; + +import com.arsdigita.bebop.form.SingleSelect; +import com.arsdigita.bebop.event.PrintListener; +import com.arsdigita.bebop.event.PrintEvent; +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.Folder; +import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.persistence.OID; +import com.arsdigita.toolbox.ui.OIDParameter; +import java.util.TooManyListenersException; + +/** + * + * @author Sören Bernstein (quasimodo) + */ +public abstract class AbstractFolderPicker extends SingleSelect { + + public AbstractFolderPicker(String name) { + super(new OIDParameter(name)); + + try { + addPrintListener(new PrintListener() { + @Override + 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); + + if (oid == null) { + return null; + } + return (Folder)DomainObjectFactory.newInstance(oid); + } + + public void setCategory(PageState state, + Folder folder) { + if (folder == null) { + setValue(state, null); + } else { + setValue(state, folder.getOID()); + } + } + + protected abstract void addOptions(PageState state, + SingleSelect target); + +} diff --git a/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java b/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java new file mode 100644 index 000000000..495093dda --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java @@ -0,0 +1,43 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.arsdigita.cms.ui.folder; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.form.Option; +import com.arsdigita.bebop.form.SingleSelect; +import com.arsdigita.persistence.DataCollection; +import com.arsdigita.persistence.OID; +import com.arsdigita.persistence.SessionManager; + +/** + * + * @author Sören Bernstein (quasimodo) + */ +public class FlatFolderPicker extends AbstractFolderPicker { + + public FlatFolderPicker(String name) { + super(name); + } + + protected void addOptions(PageState state, SingleSelect target) { +// DataCollection terms = SessionManager.getSession() +// .retrieve(Term.BASE_DATA_OBJECT_TYPE); +// terms.addPath("model.id"); +// terms.addPath("model.objectType"); +// terms.addPath("model.name"); +// terms.addPath("domain.title"); +// terms.addOrder("domain.title"); +// terms.addOrder("model.name"); +// +// target.addOption(new Option(null, "-- pick one --")); +// while (terms.next()) { +// target.addOption( +// new Option(new OID((String)terms.get("model.objectType"), +// terms.get("model.id")).toString(), +// terms.get("domain.title") + " -> " + +// terms.get("model.name"))); +// } + } +} diff --git a/ccm-cms/src/com/arsdigita/cms/ui/search/ContentTypeFilterWidget.java b/ccm-cms/src/com/arsdigita/cms/ui/search/ContentTypeFilterWidget.java index afb2fa0b9..0f0f7d965 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/search/ContentTypeFilterWidget.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/search/ContentTypeFilterWidget.java @@ -100,7 +100,7 @@ public class ContentTypeFilterWidget extends FilterWidget { // If the section and parent type both equals the preset from initializer // there is no need to get a new ContentTypeCollection - if (getContentSection() != m_section && parentType != m_parentType) { + if (getContentSection() != m_section || parentType != m_parentType) { if (getContentSection() != null) { ContentSection section = getContentSection(); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/type/RelationAttributeAddForm.java b/ccm-cms/src/com/arsdigita/cms/ui/type/RelationAttributeAddForm.java new file mode 100644 index 000000000..c8936052d --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/ui/type/RelationAttributeAddForm.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.arsdigita.cms.ui.type; + +/** + * + * @author quasi + */ +public class RelationAttributeAddForm { + +} diff --git a/ccm-cms/src/com/arsdigita/cms/ui/type/RelationAttributeAdminPane.java b/ccm-cms/src/com/arsdigita/cms/ui/type/RelationAttributeAdminPane.java new file mode 100644 index 000000000..00ed27f66 --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/ui/type/RelationAttributeAdminPane.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.arsdigita.cms.ui.type; + +import com.arsdigita.bebop.SimpleComponent; + +/** + * + * @author quasi + */ +public class RelationAttributeAdminPane extends SimpleComponent { + +} diff --git a/ccm-cms/src/com/arsdigita/cms/ui/type/RelationAttributeEditForm.java b/ccm-cms/src/com/arsdigita/cms/ui/type/RelationAttributeEditForm.java new file mode 100644 index 000000000..4f444e05d --- /dev/null +++ b/ccm-cms/src/com/arsdigita/cms/ui/type/RelationAttributeEditForm.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.arsdigita.cms.ui.type; + +import com.arsdigita.bebop.Label; +import com.arsdigita.cms.ui.BaseForm; + +/** + * + * @author quasi + */ +public class RelationAttributeEditForm extends BaseForm +{ + + public RelationAttributeEditForm() { + super("RelatioNAttributeEdit" ,new Label("RelationAttributeEdit")); + } + + +} diff --git a/ccm-forum/src/com/arsdigita/forum/ui/AttachedFilesStep.java b/ccm-forum/src/com/arsdigita/forum/ui/AttachedFilesStep.java index 30a85597f..d8d15f130 100644 --- a/ccm-forum/src/com/arsdigita/forum/ui/AttachedFilesStep.java +++ b/ccm-forum/src/com/arsdigita/forum/ui/AttachedFilesStep.java @@ -356,7 +356,7 @@ public class AttachedFilesStep while(files.next()) { PostFileAttachment file = (PostFileAttachment) DomainObjectFactory.newInstance( files.getDataObject()); - DomainObjectXMLRenderer xr = new DomainObjectXMLRenderer(p.newChildElement("files")); + DomainObjectXMLRenderer xr = new DomainObjectXMLRenderer(p.newChildElement(FORUM_XML_PREFIX + "files")); xr.setWrapRoot(false); xr.setWrapAttributes(true); xr.setWrapObjects(false);