RelationAttribute
Auf der Webseite sollten jetzt für alle RelationAttribute statt des keys der lokalisierte Wert angezeigt. Dazu waren u.A. einige Änderungen am ContentItemXMLRenderer und dem RelationAttributeInterface nötig. git-svn-id: https://svn.libreccm.org/ccm/trunk@696 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
12a8a41f85
commit
613c3a2d0b
|
|
@ -19,6 +19,7 @@
|
|||
package com.arsdigita.cms.ui.type;
|
||||
|
||||
import com.arsdigita.bebop.ActionLink;
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.Form;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Page;
|
||||
|
|
@ -32,6 +33,7 @@ import com.arsdigita.cms.CMS;
|
|||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.RelationAttributeInterface;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.cms.ui.BaseItemPane;
|
||||
|
|
@ -53,15 +55,11 @@ import org.apache.log4j.Logger;
|
|||
final class ContentTypeItemPane extends BaseItemPane {
|
||||
|
||||
private static Logger s_log = Logger.getLogger(ContentTypeItemPane.class);
|
||||
|
||||
private final ACSObjectSelectionModel m_model;
|
||||
private final ContentTypeRequestLocal m_type;
|
||||
|
||||
private final SimpleContainer m_detailPane;
|
||||
|
||||
private final TypeElements m_elements;
|
||||
private final AddElement m_elementAddForm;
|
||||
|
||||
private final SectionTemplatesListing m_templates;
|
||||
// private final RelationAttributeSection m_relationAttributes;
|
||||
|
||||
|
|
@ -79,16 +77,12 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
m_elements = new TypeElements(m_model);
|
||||
m_elementAddForm = new AddElement();
|
||||
|
||||
m_templates = new SectionTemplatesListing
|
||||
(new ContentSectionRequestLocal(), m_type);
|
||||
m_templates = new SectionTemplatesListing(new ContentSectionRequestLocal(), m_type);
|
||||
|
||||
final ActionLink templateAddLink = new ActionLink
|
||||
(new Label(gz("cms.ui.type.template.add")));
|
||||
final ActionLink templateAddLink = new ActionLink(new Label(gz("cms.ui.type.template.add")));
|
||||
final TemplateCreate templateFormSection = new TemplateCreate(m_model);
|
||||
|
||||
final Form templateForm = new CancellableForm
|
||||
("AddTemplate", templateFormSection.getSaveCancelSection
|
||||
().getCancelButton());
|
||||
final Form templateForm = new CancellableForm("AddTemplate", templateFormSection.getSaveCancelSection().getCancelButton());
|
||||
templateForm.add(templateFormSection);
|
||||
|
||||
add(templateForm);
|
||||
|
|
@ -111,8 +105,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
final AddFileElement fileForm = new AddFileElement(m_model);
|
||||
add(fileForm);
|
||||
|
||||
final AddContentItemElement itemForm = new AddContentItemElement
|
||||
(m_model);
|
||||
final AddContentItemElement itemForm = new AddContentItemElement(m_model);
|
||||
add(itemForm);
|
||||
|
||||
m_detailPane.add(new SummarySection(editLink, deleteLink));
|
||||
|
|
@ -156,6 +149,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
|
||||
// XXX A temporary, low-impact fix.
|
||||
private class CancellableForm extends Form implements Cancellable {
|
||||
|
||||
private final Submit m_cancel;
|
||||
|
||||
CancellableForm(final String name, final Submit cancel) {
|
||||
|
|
@ -170,6 +164,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
}
|
||||
|
||||
private class SummarySection extends Section {
|
||||
|
||||
SummarySection(final ActionLink editLink,
|
||||
final ActionLink deleteLink) {
|
||||
setHeading(new Label(gz("cms.ui.type.details")));
|
||||
|
|
@ -185,6 +180,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
}
|
||||
|
||||
private class ElementSection extends Section {
|
||||
|
||||
ElementSection() {
|
||||
setHeading(new Label(gz("cms.ui.type.elements")));
|
||||
|
||||
|
|
@ -197,12 +193,13 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
|
||||
@Override
|
||||
public final boolean isVisible(final PageState state) {
|
||||
return m_model.isSelected(state) && isDynamicType(state) &&
|
||||
!ContentSection.getConfig().getHideUDCTUI();
|
||||
return m_model.isSelected(state) && isDynamicType(state)
|
||||
&& !ContentSection.getConfig().getHideUDCTUI();
|
||||
}
|
||||
}
|
||||
|
||||
private class TemplateSection extends Section {
|
||||
|
||||
TemplateSection(final ActionLink templateAddLink) {
|
||||
setHeading(new Label(gz("cms.ui.type.templates")));
|
||||
|
||||
|
|
@ -220,6 +217,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
}
|
||||
|
||||
private class RelationAttributeSection extends Section {
|
||||
|
||||
RelationAttributeSection() {
|
||||
setHeading(new Label(gz("cms.ui.type.attributes")));
|
||||
|
||||
|
|
@ -237,7 +235,10 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
try {
|
||||
Class<? extends ContentItem> clazz = Class.forName(ct.getClassName()).asSubclass(ContentItem.class);
|
||||
ci = clazz.newInstance();
|
||||
retVal = clazz.cast(ci).hasRelationAttributes();
|
||||
if (ci instanceof RelationAttributeInterface) {
|
||||
RelationAttributeInterface rai = (RelationAttributeInterface) ci;
|
||||
retVal = rai.hasRelationAttributes();
|
||||
}
|
||||
ci.delete();
|
||||
} catch (Exception ex) {
|
||||
//retVal = false;
|
||||
|
|
@ -252,6 +253,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
super.register(page);
|
||||
|
||||
page.addActionListener(new ActionListener() {
|
||||
|
||||
public final void actionPerformed(final ActionEvent e) {
|
||||
final PageState state = e.getPageState();
|
||||
|
||||
|
|
@ -260,8 +262,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
&& !userCanEdit(state)) {
|
||||
m_templates.getRemoveColumn().setVisible(state, false);
|
||||
m_templates.getDefaultColumn().setVisible(state, false);
|
||||
m_elements.getTable().getColumn(3).setVisible
|
||||
(state, false);
|
||||
m_elements.getTable().getColumn(3).setVisible(state, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -301,8 +302,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
|
||||
final String objectTypeString =
|
||||
"com.arsdigita.persistence.DynamicObjectType";
|
||||
final DataCollection collection = SessionManager.getSession().retrieve
|
||||
(objectTypeString);
|
||||
final DataCollection collection = SessionManager.getSession().retrieve(objectTypeString);
|
||||
collection.addEqualsFilter("dynamicType", type.getAssociatedObjectType());
|
||||
|
||||
final boolean b = collection.next();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
package com.arsdigita.cms.ui.type;
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.Link;
|
||||
import com.arsdigita.bebop.ControlLink;
|
||||
import com.arsdigita.bebop.List;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.list.AbstractListModelBuilder;
|
||||
|
|
@ -13,7 +13,7 @@ import com.arsdigita.bebop.list.ListCellRenderer;
|
|||
import com.arsdigita.bebop.list.ListModel;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.RelationAttributeCollection;
|
||||
import com.arsdigita.cms.RelationAttributeInterface;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
|
|
@ -23,15 +23,11 @@ import java.util.StringTokenizer;
|
|||
public class RelationAttributeList extends List {
|
||||
|
||||
private ContentTypeRequestLocal m_type;
|
||||
private ContentType contentType;
|
||||
private StringTokenizer relationAttributeList;
|
||||
|
||||
public RelationAttributeList(ContentTypeRequestLocal type) {
|
||||
super(new RelationAttributeListModelBuilder(type));
|
||||
|
||||
m_type = type;
|
||||
relationAttributeList = null;
|
||||
|
||||
setCellRenderer(new CellRenderer());
|
||||
}
|
||||
|
||||
|
|
@ -47,8 +43,10 @@ public class RelationAttributeList extends List {
|
|||
try {
|
||||
Class<? extends ContentItem> clazz = Class.forName(ct.getClassName()).asSubclass(ContentItem.class);
|
||||
ci = clazz.newInstance();
|
||||
retVal = clazz.cast(ci).hasRelationAttributes();
|
||||
relationAttributeList = clazz.cast(ci).getRelationAttributes();
|
||||
if (ci instanceof RelationAttributeInterface) {
|
||||
RelationAttributeInterface rai = (RelationAttributeInterface) ci;
|
||||
retVal = rai.hasRelationAttributes();
|
||||
}
|
||||
ci.delete();
|
||||
} catch (Exception ex) {
|
||||
//retVal = false;
|
||||
|
|
@ -60,7 +58,6 @@ public class RelationAttributeList extends List {
|
|||
private static class RelationAttributeListModelBuilder extends AbstractListModelBuilder {
|
||||
|
||||
private ContentTypeRequestLocal m_type;
|
||||
private ContentType contentType;
|
||||
private StringTokenizer relationAttributeList;
|
||||
|
||||
public RelationAttributeListModelBuilder(ContentTypeRequestLocal type) {
|
||||
|
|
@ -71,15 +68,16 @@ public class RelationAttributeList extends List {
|
|||
|
||||
public final ListModel makeModel(final List list, final PageState state) {
|
||||
|
||||
boolean retVal = false;
|
||||
ContentType ct = (ContentType) m_type.getContentType(state);
|
||||
ContentItem ci = null;
|
||||
|
||||
try {
|
||||
Class<? extends ContentItem> clazz = Class.forName(ct.getClassName()).asSubclass(ContentItem.class);
|
||||
ci = clazz.newInstance();
|
||||
retVal = clazz.cast(ci).hasRelationAttributes();
|
||||
relationAttributeList = clazz.cast(ci).getRelationAttributes();
|
||||
if (ci instanceof RelationAttributeInterface) {
|
||||
RelationAttributeInterface rai = (RelationAttributeInterface) ci;
|
||||
relationAttributeList = rai.getRelationAttributes();
|
||||
}
|
||||
ci.delete();
|
||||
} catch (Exception ex) {
|
||||
//retVal = false;
|
||||
|
|
@ -91,8 +89,8 @@ public class RelationAttributeList extends List {
|
|||
private class Model implements ListModel {
|
||||
|
||||
private final StringTokenizer m_items;
|
||||
// private String m_item;
|
||||
private RelationAttributeCollection m_item;
|
||||
private String m_item;
|
||||
// private RelationAttributeCollection m_item;
|
||||
|
||||
Model(final StringTokenizer items) {
|
||||
m_items = items;
|
||||
|
|
@ -101,8 +99,8 @@ public class RelationAttributeList extends List {
|
|||
|
||||
public final boolean next() {
|
||||
if (m_items.hasMoreTokens()) {
|
||||
// m_item = m_items.nextToken();
|
||||
m_item = new RelationAttributeCollection(m_items.nextToken());
|
||||
m_item = m_items.nextToken();
|
||||
// m_item = new RelationAttributeCollection(m_items.nextToken());
|
||||
return true;
|
||||
} else {
|
||||
m_item = null;
|
||||
|
|
@ -112,13 +110,14 @@ public class RelationAttributeList extends List {
|
|||
|
||||
// Label
|
||||
public final Object getElement() {
|
||||
return m_item.getName();
|
||||
// return m_item.getDisplayName();
|
||||
return m_item;
|
||||
// return m_item.getName();
|
||||
}
|
||||
|
||||
// URL
|
||||
public final String getKey() {
|
||||
return m_item+"/";//.getName() + "/";
|
||||
return m_item;
|
||||
// return m_item.getName() + "/";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -131,7 +130,13 @@ public class RelationAttributeList extends List {
|
|||
final String key,
|
||||
final int index,
|
||||
final boolean isSelected) {
|
||||
return new Link((String) value, key);
|
||||
ControlLink link = new ControlLink(key){
|
||||
public void setControlEvent(PageState state) {
|
||||
state.setControlEvent(list, "editRelationAttributes", key);
|
||||
};
|
||||
};
|
||||
|
||||
return link;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue