Neue Dateien hinzugefügt
Unfertige Teile für ItemSearchWidget und RelatedAttribute git-svn-id: https://svn.libreccm.org/ccm/trunk@1343 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
d269b11f5e
commit
09053df6b1
|
|
@ -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) <sbernstein@zes.uni-bremen.de>
|
||||||
|
*/
|
||||||
|
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("<br/>", 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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) <sbernstein@zes.uni-bremen.de>
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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) <sbernstein@zes.uni-bremen.de>
|
||||||
|
*/
|
||||||
|
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")));
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -100,7 +100,7 @@ public class ContentTypeFilterWidget extends FilterWidget {
|
||||||
|
|
||||||
// If the section and parent type both equals the preset from initializer
|
// If the section and parent type both equals the preset from initializer
|
||||||
// there is no need to get a new ContentTypeCollection
|
// 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) {
|
if (getContentSection() != null) {
|
||||||
ContentSection section = getContentSection();
|
ContentSection section = getContentSection();
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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 {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -356,7 +356,7 @@ public class AttachedFilesStep
|
||||||
while(files.next()) {
|
while(files.next()) {
|
||||||
PostFileAttachment file = (PostFileAttachment) DomainObjectFactory.newInstance(
|
PostFileAttachment file = (PostFileAttachment) DomainObjectFactory.newInstance(
|
||||||
files.getDataObject());
|
files.getDataObject());
|
||||||
DomainObjectXMLRenderer xr = new DomainObjectXMLRenderer(p.newChildElement("files"));
|
DomainObjectXMLRenderer xr = new DomainObjectXMLRenderer(p.newChildElement(FORUM_XML_PREFIX + "files"));
|
||||||
xr.setWrapRoot(false);
|
xr.setWrapRoot(false);
|
||||||
xr.setWrapAttributes(true);
|
xr.setWrapAttributes(true);
|
||||||
xr.setWrapObjects(false);
|
xr.setWrapObjects(false);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue