Beschreibungsfeld für GenericPerson hinzugefügt
git-svn-id: https://svn.libreccm.org/ccm/trunk@526 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
8e72411c1f
commit
607fad6a81
|
|
@ -202,7 +202,7 @@ import java.util.StringTokenizer;
|
|||
*
|
||||
* @version $Id: ContentItem.java 1621 2007-09-13 12:43:12Z chrisg23 $
|
||||
*/
|
||||
public class ContentItem extends VersionedACSObject implements CustomCopy, RelationAttribute {
|
||||
public class ContentItem extends VersionedACSObject implements CustomCopy, RelationAttributeInterface {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(ContentItem.class);
|
||||
private static final Logger s_logDenorm = Logger.getLogger(ContentItem.class.getName() + ".Denorm");
|
||||
|
|
|
|||
|
|
@ -5,16 +5,104 @@
|
|||
|
||||
package com.arsdigita.cms;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author quasi
|
||||
*/
|
||||
public interface RelationAttribute {
|
||||
public class RelationAttribute extends ContentItem {
|
||||
|
||||
public static final String ATTRIBUTE = "attribute";
|
||||
public static final String KEY = "KEY";
|
||||
public static final String LANGUAGE = "lang";
|
||||
//public static final String NAME = "name";
|
||||
public static final String DESCRIPTION = "DESCRIPTION";
|
||||
/** Data object type for this domain object */
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.RelationAttribute";
|
||||
|
||||
/**
|
||||
* Default constructor. This creates a new (empty) RelationAttribute.
|
||||
**/
|
||||
public RelationAttribute() {
|
||||
super(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public RelationAttribute(OID id) throws DataObjectNotFoundException {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public RelationAttribute(BigDecimal id) throws DataObjectNotFoundException {
|
||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
}
|
||||
|
||||
|
||||
public RelationAttribute(DataObject obj) {
|
||||
super(obj);
|
||||
}
|
||||
|
||||
public RelationAttribute(String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the base PDL object type for this item. Child classes
|
||||
* should override this method to return the correct value
|
||||
*/
|
||||
public String getBaseDataObjectType() {
|
||||
return BASE_DATA_OBJECT_TYPE;
|
||||
}
|
||||
|
||||
/* accessors *****************************************************/
|
||||
public String getAttribute() {
|
||||
return (String) get(ATTRIBUTE);
|
||||
}
|
||||
|
||||
public void setAttribute(String attribute) {
|
||||
set(ATTRIBUTE, attribute);
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return (String) get(KEY);
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
set(KEY, key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return (String) get(LANGUAGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLanguage(String language) {
|
||||
set(LANGUAGE, language);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getName() {
|
||||
// return (String) get(NAME);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setName(String name) {
|
||||
// set(NAME, name);
|
||||
// }
|
||||
|
||||
public String getDescription() {
|
||||
return (String) get(DESCRIPTION);
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
set(DESCRIPTION, description);
|
||||
}
|
||||
|
||||
|
||||
public abstract boolean hasRelationAttributes();
|
||||
|
||||
public abstract StringTokenizer getRelationAttributes();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package com.arsdigita.cms;
|
||||
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author quasi
|
||||
*/
|
||||
public interface RelationAttributeInterface {
|
||||
|
||||
public abstract boolean hasRelationAttributes();
|
||||
|
||||
public abstract StringTokenizer getRelationAttributes();
|
||||
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ import com.arsdigita.persistence.DataObject;
|
|||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.RelationAttribute;
|
||||
import com.arsdigita.cms.RelationAttributeInterface;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.util.Assert;
|
||||
|
|
@ -35,7 +35,7 @@ import java.util.StringTokenizer;
|
|||
* This content type represents an basic contact
|
||||
*
|
||||
*/
|
||||
public class GenericContact extends ContentPage implements RelationAttribute {
|
||||
public class GenericContact extends ContentPage implements RelationAttributeInterface {
|
||||
|
||||
/** PDL property names */
|
||||
public static final String PERSON = "person";
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ package com.arsdigita.cms.contenttypes;
|
|||
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.RelationAttribute;
|
||||
import com.arsdigita.cms.RelationAttributeInterface;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
|
|
@ -36,7 +36,7 @@ import java.util.Date;
|
|||
* @author Sören Bernstein
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class GenericPerson extends ContentPage implements RelationAttribute {
|
||||
public class GenericPerson extends ContentPage implements RelationAttributeInterface {
|
||||
|
||||
public static final String PERSON = "person";
|
||||
public static final String SURNAME = "surname";
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ public class GenericPersonPropertiesStep extends SimpleEditStep {
|
|||
});
|
||||
}
|
||||
|
||||
sheet.add((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.description").localize(), GenericPerson.DESCRIPTION);
|
||||
return sheet;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.arsdigita.bebop.event.FormInitListener;
|
|||
import com.arsdigita.bebop.event.FormProcessListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.form.TextArea;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.bebop.parameters.DateParameter;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
|
|
@ -52,6 +53,7 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
|
|||
public static final String TITLEPRE = GenericPerson.TITLEPRE;
|
||||
public static final String TITLEPOST = GenericPerson.TITLEPOST;
|
||||
public static final String BIRTHDATE = GenericPerson.BIRTHDATE;
|
||||
public static final String DESCRIPTION = GenericPerson.DESCRIPTION;
|
||||
public static final String ID = "Person_edit";
|
||||
|
||||
public GenericPersonPropertyForm(ItemSelectionModel itemModel) {
|
||||
|
|
@ -95,6 +97,13 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
|
|||
birthdate.setYearRange(1900, today.get(Calendar.YEAR));
|
||||
add(birthdate);
|
||||
|
||||
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.description").localize()));
|
||||
ParameterModel descriptionParam = new StringParameter(DESCRIPTION);
|
||||
TextArea description = new TextArea(descriptionParam);
|
||||
description.setCols(50);
|
||||
description.setRows(5);
|
||||
add(description);
|
||||
|
||||
}
|
||||
|
||||
public void init(FormSectionEvent fse) {
|
||||
|
|
@ -106,6 +115,7 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
|
|||
data.put(TITLEPRE, person.getTitlePre());
|
||||
data.put(TITLEPOST, person.getTitlePost());
|
||||
data.put(BIRTHDATE, person.getBirthdate());
|
||||
data.put(DESCRIPTION, person.getDescription());
|
||||
}
|
||||
|
||||
public void submitted(FormSectionEvent fse) {
|
||||
|
|
@ -126,8 +136,8 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
|
|||
person.setGivenName((String) data.get(GIVENNAME));
|
||||
person.setTitlePre((String) data.get(TITLEPRE));
|
||||
person.setTitlePost((String) data.get(TITLEPOST));
|
||||
//Date birthdate = (Date)data.get(BIRTHDATE);
|
||||
person.setBirthdate((Date) data.get(BIRTHDATE));
|
||||
person.setDescription((String)data.get(DESCRIPTION));
|
||||
|
||||
person.save();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@ import com.arsdigita.bebop.PageState;
|
|||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.ParameterEvent;
|
||||
import com.arsdigita.bebop.event.ParameterListener;
|
||||
//import com.arsdigita.bebop.form.TextArea;
|
||||
import com.arsdigita.bebop.parameters.DateParameter;
|
||||
import com.arsdigita.bebop.parameters.ParameterData;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
//import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
|
|
@ -51,6 +53,7 @@ public abstract class BasicPageForm extends BasicItemForm {
|
|||
|
||||
private FormSection m_widgetSection;
|
||||
|
||||
// public static final String DESCRIPTION = ContentPage.DESCRIPTION;
|
||||
public static final String LAUNCH_DATE = ContentPage.LAUNCH_DATE;
|
||||
|
||||
/**
|
||||
|
|
@ -83,8 +86,17 @@ public abstract class BasicPageForm extends BasicItemForm {
|
|||
* Add various widgets to the form. Child classes should override
|
||||
* this method to perform all their widget-adding needs
|
||||
*/
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
super.addWidgets();
|
||||
|
||||
// add(new Label(GlobalizationUtil.globalize("cms.ui.authoring.page_description")));
|
||||
// ParameterModel descriptionParam = new StringParameter(DESCRIPTION);
|
||||
// TextArea description = new TextArea(descriptionParam);
|
||||
// description.setCols(50);
|
||||
// description.setRows(5);
|
||||
// add(description);
|
||||
//
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
add(new Label(GlobalizationUtil.
|
||||
globalize("cms.ui.authoring.page_launch_date")));
|
||||
|
|
@ -121,6 +133,7 @@ public abstract class BasicPageForm extends BasicItemForm {
|
|||
// Preset fields
|
||||
data.put(NAME, item.getName());
|
||||
data.put(TITLE, item.getTitle());
|
||||
// data.put(DESCRIPTION, item.getDescription());
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
data.put(LAUNCH_DATE, item.getLaunchDate());
|
||||
// if launch date is required, help user by suggesting today's date
|
||||
|
|
@ -153,6 +166,7 @@ public abstract class BasicPageForm extends BasicItemForm {
|
|||
// Update attributes
|
||||
item.setName((String)data.get(NAME));
|
||||
item.setTitle((String)data.get(TITLE));
|
||||
// item.setDescription((String)data.get(DESCRIPTION));
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
item.setLaunchDate((Date)data.get(LAUNCH_DATE));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
}
|
||||
|
||||
private class RelationAttributeSection extends Section {
|
||||
RelationAttributeSection(/*final ActionLink attributeEditLink*/) {
|
||||
RelationAttributeSection() {
|
||||
setHeading(new Label(gz("cms.ui.type.attributes")));
|
||||
|
||||
setBody(new RelationAttributeList(m_type));
|
||||
|
|
@ -228,7 +228,8 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
|
||||
@Override
|
||||
public final boolean isVisible(final PageState state) {
|
||||
|
||||
// ISt es möglich, den folgenden Code nur einmal zu haben?? Kann man auf die isVisible von RelationAttributeList
|
||||
// zurückgreifen??
|
||||
boolean retVal = false;
|
||||
ContentType ct = (ContentType) m_type.getContentType(state);
|
||||
ContentItem ci = null;
|
||||
|
|
|
|||
|
|
@ -13,6 +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 java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
|
|
@ -37,6 +38,8 @@ public class RelationAttributeList extends List {
|
|||
@Override
|
||||
public final boolean isVisible(final PageState state) {
|
||||
|
||||
// Mit getModelBuilder(); den ModelBuilder holen und abfragen,, ob es etwas anzuzeigen gibt?
|
||||
|
||||
boolean retVal = false;
|
||||
ContentType ct = (ContentType) m_type.getContentType(state);
|
||||
ContentItem ci = null;
|
||||
|
|
@ -82,26 +85,15 @@ public class RelationAttributeList extends List {
|
|||
//retVal = false;
|
||||
}
|
||||
|
||||
// final DataCollection folders =
|
||||
// SessionManager.getSession().retrieve(Folder.BASE_DATA_OBJECT_TYPE);
|
||||
//
|
||||
// folders.addEqualsFilter(ContentItem.PARENT, parent.getID());
|
||||
// folders.addOrder("lower(" + ACSObject.DISPLAY_NAME + ")");
|
||||
//
|
||||
// return new Model(new ItemCollection(folders));
|
||||
|
||||
return new Model(relationAttributeList);
|
||||
}
|
||||
|
||||
private class Model implements ListModel {
|
||||
|
||||
// private final ItemCollection m_items;
|
||||
private final StringTokenizer m_items;
|
||||
private String m_item;
|
||||
// private String m_item;
|
||||
private RelationAttributeCollection m_item;
|
||||
|
||||
// Model(final ItemCollection items) {
|
||||
// m_items = items;
|
||||
// }
|
||||
Model(final StringTokenizer items) {
|
||||
m_items = items;
|
||||
m_item = null;
|
||||
|
|
@ -109,7 +101,8 @@ public class RelationAttributeList extends List {
|
|||
|
||||
public final boolean next() {
|
||||
if (m_items.hasMoreTokens()) {
|
||||
m_item = m_items.nextToken();
|
||||
// m_item = m_items.nextToken();
|
||||
m_item = new RelationAttributeCollection(m_items.nextToken());
|
||||
return true;
|
||||
} else {
|
||||
m_item = null;
|
||||
|
|
@ -119,12 +112,12 @@ public class RelationAttributeList extends List {
|
|||
|
||||
// Label
|
||||
public final Object getElement() {
|
||||
return m_item;
|
||||
return m_item.getDisplayName();
|
||||
}
|
||||
|
||||
// URL
|
||||
public final String getKey() {
|
||||
return m_item + "/";
|
||||
return m_item+"/";//.getName() + "/";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue