RelationAttribute
* angepasste Spaltennamen zum Debuggen. Es gab einfach zuviele Spalten mit der Bezeichnung key RelatedLink * linkListName hinzufügt. Ist noch nicht vollständig... denke ich. GenericPerson * NullPointer Exception im PageCreate gelöst * NotNullValidationListener zum Feld Nachname hinzugefügt git-svn-id: https://svn.libreccm.org/ccm/trunk@581 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
6dd53b0920
commit
8d7857ade5
|
|
@ -21,6 +21,7 @@ import com.arsdigita.cms.MimeType;
|
||||||
|
|
||||||
object type RelatedLink extends Link {
|
object type RelatedLink extends Link {
|
||||||
|
|
||||||
|
String[0..1] linkListName = cms_related_links.link_list_name VARCHAR(100);
|
||||||
String[0..1] resourceSize = cms_related_links.resource_size VARCHAR(50);
|
String[0..1] resourceSize = cms_related_links.resource_size VARCHAR(50);
|
||||||
MimeType[0..1] resourceType = join cms_related_links.resource_type
|
MimeType[0..1] resourceType = join cms_related_links.resource_type
|
||||||
to cms_mime_types.mime_type;
|
to cms_mime_types.mime_type;
|
||||||
|
|
@ -56,7 +57,7 @@ query allRelatedLinkOrderForItem {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
select l.link_order from cms_links l, cms_related_links r
|
select l.link_order from cms_links l, cms_related_links r
|
||||||
where r.owner_id = :ownerID and l.link_id = r.related_link_id
|
where r.owner_id = :ownerID and l.link_id = r.related_link_id and r.link_list_name = :linkListName
|
||||||
} map {
|
} map {
|
||||||
linkOrder = l.link_order;
|
linkOrder = l.link_order;
|
||||||
}
|
}
|
||||||
|
|
@ -68,7 +69,7 @@ query getReferringRelatedLinks {
|
||||||
do {
|
do {
|
||||||
select l.link_id
|
select l.link_id
|
||||||
from cms_links l, cms_related_links r
|
from cms_links l, cms_related_links r
|
||||||
where l.target_item_id = :itemID and l.link_id=r.related_link_id
|
where l.target_item_id = :itemID and l.link_id=r.related_link_id and r.link_list_name = :linkListName
|
||||||
} map {
|
} map {
|
||||||
id = l.link_id;
|
id = l.link_id;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ public class RelatedLink extends Link {
|
||||||
private static final Logger s_log = Logger.getLogger(RelatedLink.class);
|
private static final Logger s_log = Logger.getLogger(RelatedLink.class);
|
||||||
|
|
||||||
/** PDL properties */
|
/** PDL properties */
|
||||||
|
public static final String LINK_LIST_NAME = "linkListName";
|
||||||
public static final String RESOURCE_SIZE = "resourceSize";
|
public static final String RESOURCE_SIZE = "resourceSize";
|
||||||
public static final String RESOURCE_TYPE = "resourceType";
|
public static final String RESOURCE_TYPE = "resourceType";
|
||||||
public static final String LINK_OWNER = "linkOwner";
|
public static final String LINK_OWNER = "linkOwner";
|
||||||
|
|
@ -108,6 +109,16 @@ public class RelatedLink extends Link {
|
||||||
super( type );
|
super( type );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** get the name of the named link list. */
|
||||||
|
public String getLinkListName(){
|
||||||
|
return (String) get(LINK_LIST_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set the name of the named link list. */
|
||||||
|
public void setLinkListName(String name){
|
||||||
|
set(LINK_LIST_NAME , name);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the MimeType of the target resource to which this link points.
|
* Get the MimeType of the target resource to which this link points.
|
||||||
*
|
*
|
||||||
|
|
@ -171,15 +182,16 @@ public class RelatedLink extends Link {
|
||||||
*
|
*
|
||||||
* @param item The item to return links for
|
* @param item The item to return links for
|
||||||
*/
|
*/
|
||||||
public static DataCollection getRelatedLinks(ContentItem item) {
|
public static DataCollection getRelatedLinks(ContentItem item, String name) {
|
||||||
s_log.debug("Getting related links for a content item");
|
s_log.debug("Getting related links for a content item");
|
||||||
Session session = SessionManager.getSession();
|
Session session = SessionManager.getSession();
|
||||||
DataCollection links = session.retrieve(BASE_DATA_OBJECT_TYPE);
|
DataCollection links = session.retrieve(BASE_DATA_OBJECT_TYPE);
|
||||||
links.addEqualsFilter(LINK_OWNER + ".id", item.getID());
|
links.addEqualsFilter(LINK_OWNER + ".id", item.getID());
|
||||||
|
links.addEqualsFilter(LINK_LIST_NAME, name);
|
||||||
links.addOrder(ORDER);
|
links.addOrder(ORDER);
|
||||||
return links;
|
return links;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a DataCollection of related links which refer to the
|
* Returns a DataCollection of related links which refer to the
|
||||||
* given item.
|
* given item.
|
||||||
|
|
@ -261,6 +273,7 @@ public class RelatedLink extends Link {
|
||||||
Session session = SessionManager.getSession();
|
Session session = SessionManager.getSession();
|
||||||
DataCollection links = session.retrieve(BASE_DATA_OBJECT_TYPE);
|
DataCollection links = session.retrieve(BASE_DATA_OBJECT_TYPE);
|
||||||
links.addEqualsFilter(LINK_OWNER + ".id", getLinkOwner().getID());
|
links.addEqualsFilter(LINK_OWNER + ".id", getLinkOwner().getID());
|
||||||
|
links.addEqualsFilter(LINK_LIST_NAME, getLinkListName());
|
||||||
links.addOrder(TITLE);
|
links.addOrder(TITLE);
|
||||||
int sortKey = 0;
|
int sortKey = 0;
|
||||||
while (links.next()) {
|
while (links.next()) {
|
||||||
|
|
@ -287,6 +300,7 @@ public class RelatedLink extends Link {
|
||||||
DataQuery query = SessionManager.getSession().retrieveQuery
|
DataQuery query = SessionManager.getSession().retrieveQuery
|
||||||
("com.arsdigita.cms.contentassets.allRelatedLinkOrderForItem");
|
("com.arsdigita.cms.contentassets.allRelatedLinkOrderForItem");
|
||||||
query.setParameter("ownerID", getLinkOwner().getID());
|
query.setParameter("ownerID", getLinkOwner().getID());
|
||||||
|
query.setParameter("linkListName", getLinkListName());
|
||||||
query.addOrder("linkOrder DESC");
|
query.addOrder("linkOrder DESC");
|
||||||
if (query.next()) {
|
if (query.next()) {
|
||||||
Integer linkOrder = ((Integer)query.get("linkOrder"));
|
Integer linkOrder = ((Integer)query.get("linkOrder"));
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,9 @@ import com.arsdigita.cms.contenttypes.ui.LinkTable;
|
||||||
* Authoring step to create a RelatedLink and change ordering.
|
* Authoring step to create a RelatedLink and change ordering.
|
||||||
*/
|
*/
|
||||||
public class RelatedLinkPropertiesStep extends LinkPropertiesStep {
|
public class RelatedLinkPropertiesStep extends LinkPropertiesStep {
|
||||||
|
|
||||||
|
protected String m_linkListName = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. Creates a <code>RelatedLinkPropertiesStep</code> given an
|
* Constructor. Creates a <code>RelatedLinkPropertiesStep</code> given an
|
||||||
* <code>ItemSelectionModel</code> and an
|
* <code>ItemSelectionModel</code> and an
|
||||||
|
|
@ -63,10 +65,9 @@ public class RelatedLinkPropertiesStep extends LinkPropertiesStep {
|
||||||
LinkTable table;
|
LinkTable table;
|
||||||
if (ContentSection.getConfig().isHideAdditionalResourceFields()) {
|
if (ContentSection.getConfig().isHideAdditionalResourceFields()) {
|
||||||
table = new LinkTable(getItemSelectionModel(), getLinkSelectionModel());
|
table = new LinkTable(getItemSelectionModel(), getLinkSelectionModel());
|
||||||
table.setModelBuilder(new RelatedLinkTableModelBuilder(getItemSelectionModel()));
|
table.setModelBuilder(new RelatedLinkTableModelBuilder(getItemSelectionModel(), m_linkListName));
|
||||||
} else {
|
} else {
|
||||||
table = new RelatedLinkTable(getItemSelectionModel(),
|
table = new RelatedLinkTable(getItemSelectionModel(), getLinkSelectionModel(), m_linkListName);
|
||||||
getLinkSelectionModel());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
container.add(table);
|
container.add(table);
|
||||||
|
|
@ -81,7 +82,8 @@ public class RelatedLinkPropertiesStep extends LinkPropertiesStep {
|
||||||
@Override
|
@Override
|
||||||
protected FormSection getEditSheet() {
|
protected FormSection getEditSheet() {
|
||||||
return new RelatedLinkPropertyForm(getItemSelectionModel(),
|
return new RelatedLinkPropertyForm(getItemSelectionModel(),
|
||||||
getLinkSelectionModel());
|
getLinkSelectionModel(),
|
||||||
|
m_linkListName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import com.arsdigita.bebop.FormProcessException;
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.form.Hidden;
|
||||||
import com.arsdigita.bebop.form.Option;
|
import com.arsdigita.bebop.form.Option;
|
||||||
import com.arsdigita.bebop.form.SingleSelect;
|
import com.arsdigita.bebop.form.SingleSelect;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
|
@ -49,6 +50,7 @@ import com.arsdigita.util.Assert;
|
||||||
public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
||||||
|
|
||||||
private static boolean isHideAdditionalResourceFields;
|
private static boolean isHideAdditionalResourceFields;
|
||||||
|
private String m_linkListName = "";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
isHideAdditionalResourceFields = ContentSection.getConfig().isHideAdditionalResourceFields();
|
isHideAdditionalResourceFields = ContentSection.getConfig().isHideAdditionalResourceFields();
|
||||||
|
|
@ -63,7 +65,7 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
||||||
* Link to work on
|
* Link to work on
|
||||||
*/
|
*/
|
||||||
public RelatedLinkPropertyForm(ItemSelectionModel itemModel,
|
public RelatedLinkPropertyForm(ItemSelectionModel itemModel,
|
||||||
LinkSelectionModel link) {
|
LinkSelectionModel link, String linkListName) {
|
||||||
|
|
||||||
super(itemModel, link);
|
super(itemModel, link);
|
||||||
}
|
}
|
||||||
|
|
@ -99,6 +101,9 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
||||||
addMimeOptions(resType);
|
addMimeOptions(resType);
|
||||||
add(resType);
|
add(resType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Hidden linkListName = new Hidden(new StringParameter(RelatedLink.LINK_LIST_NAME));
|
||||||
|
add(linkListName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -124,6 +129,7 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
||||||
* @param s the PageState
|
* @param s the PageState
|
||||||
* @return the newly-created RelatedLink
|
* @return the newly-created RelatedLink
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected Link createLink(PageState s) {
|
protected Link createLink(PageState s) {
|
||||||
ContentItem item = getContentItem(s);
|
ContentItem item = getContentItem(s);
|
||||||
Assert.exists(item, ContentItem.class);
|
Assert.exists(item, ContentItem.class);
|
||||||
|
|
@ -141,6 +147,7 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
||||||
* Over-ride super class method to initialize addtional fields specific
|
* Over-ride super class method to initialize addtional fields specific
|
||||||
* to <code>RelatedLink</code> content asset.
|
* to <code>RelatedLink</code> content asset.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||||
super.init(fse);
|
super.init(fse);
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
|
|
@ -156,10 +163,12 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
||||||
if (rl.getResourceType() != null) {
|
if (rl.getResourceType() != null) {
|
||||||
data.put(RelatedLink.RESOURCE_TYPE, rl.getResourceType().getMimeType());
|
data.put(RelatedLink.RESOURCE_TYPE, rl.getResourceType().getMimeType());
|
||||||
}
|
}
|
||||||
|
data.put(RelatedLink.LINK_LIST_NAME, rl.getLinkListName());
|
||||||
} else {
|
} else {
|
||||||
// New Link creation , clear the fields.
|
// New Link creation , clear the fields.
|
||||||
data.put(RelatedLink.RESOURCE_SIZE, null);
|
data.put(RelatedLink.RESOURCE_SIZE, null);
|
||||||
data.put(RelatedLink.RESOURCE_TYPE, null);
|
data.put(RelatedLink.RESOURCE_TYPE, null);
|
||||||
|
data.put(RelatedLink.LINK_LIST_NAME, m_linkListName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -168,6 +177,7 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
||||||
* over-ride super class method to set extended properties for
|
* over-ride super class method to set extended properties for
|
||||||
* <code>RelatedLink</code>.
|
* <code>RelatedLink</code>.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void setLinkProperties(Link link, FormSectionEvent fse) {
|
protected void setLinkProperties(Link link, FormSectionEvent fse) {
|
||||||
RelatedLink rl = (RelatedLink) (link);
|
RelatedLink rl = (RelatedLink) (link);
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
|
|
@ -181,6 +191,7 @@ public class RelatedLinkPropertyForm extends LinkPropertyForm {
|
||||||
MimeType mType = MimeType.loadMimeType(typeName);
|
MimeType mType = MimeType.loadMimeType(typeName);
|
||||||
rl.setResourceType(mType);
|
rl.setResourceType(mType);
|
||||||
}
|
}
|
||||||
|
rl.setLinkListName(data.getString(RelatedLink.LINK_LIST_NAME));
|
||||||
super.setLinkProperties(link, fse);
|
super.setLinkProperties(link, fse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,10 @@ public class RelatedLinkTable extends LinkTable {
|
||||||
* @param link The <code>LinkSelectionModel</code> to track the
|
* @param link The <code>LinkSelectionModel</code> to track the
|
||||||
* current link
|
* current link
|
||||||
*/
|
*/
|
||||||
public RelatedLinkTable(ItemSelectionModel item, LinkSelectionModel link) {
|
public RelatedLinkTable(ItemSelectionModel item, LinkSelectionModel link, String linkListName) {
|
||||||
super(item, link);
|
super(item, link);
|
||||||
|
|
||||||
setModelBuilder(new RelatedLinkTableModelBuilder(item));
|
setModelBuilder(new RelatedLinkTableModelBuilder(item, linkListName));
|
||||||
|
|
||||||
RelatedLinkRenderer rlcr = new RelatedLinkRenderer();
|
RelatedLinkRenderer rlcr = new RelatedLinkRenderer();
|
||||||
m_typeCol.setCellRenderer(rlcr);
|
m_typeCol.setCellRenderer(rlcr);
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,12 @@ import org.apache.log4j.Logger;
|
||||||
* @author Scott Seago (sseago@redhat.com)
|
* @author Scott Seago (sseago@redhat.com)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class RelatedLinkTableModelBuilder
|
public class RelatedLinkTableModelBuilder extends LinkTableModelBuilder {
|
||||||
extends LinkTableModelBuilder {
|
|
||||||
private static final Logger s_log =
|
private static final Logger s_log =
|
||||||
Logger.getLogger(RelatedLinkTableModelBuilder.class);
|
Logger.getLogger(RelatedLinkTableModelBuilder.class);
|
||||||
|
|
||||||
private ItemSelectionModel m_itemModel;
|
private ItemSelectionModel m_itemModel;
|
||||||
|
private String m_linkListName = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor. Creates a <code>LinkTableModelBuilder</code> given an
|
* Constructor. Creates a <code>LinkTableModelBuilder</code> given an
|
||||||
|
|
@ -45,8 +45,9 @@ public class RelatedLinkTableModelBuilder
|
||||||
* @param item The <code>ItemSelectionModel</code> for the current page.
|
* @param item The <code>ItemSelectionModel</code> for the current page.
|
||||||
* current link
|
* current link
|
||||||
*/
|
*/
|
||||||
public RelatedLinkTableModelBuilder(ItemSelectionModel item) {
|
public RelatedLinkTableModelBuilder(ItemSelectionModel item, String name) {
|
||||||
m_itemModel = item;
|
m_itemModel = item;
|
||||||
|
m_linkListName = name;
|
||||||
s_log.debug("RelatedLinkTableModelBuilder");
|
s_log.debug("RelatedLinkTableModelBuilder");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,7 +62,7 @@ public class RelatedLinkTableModelBuilder
|
||||||
Assert.isTrue(m_itemModel.isSelected(s), "item selected");
|
Assert.isTrue(m_itemModel.isSelected(s), "item selected");
|
||||||
ContentItem item = m_itemModel.getSelectedItem(s);
|
ContentItem item = m_itemModel.getSelectedItem(s);
|
||||||
s_log.debug("Getting related links for " + item.getName());
|
s_log.debug("Getting related links for " + item.getName());
|
||||||
return RelatedLink.getRelatedLinks(item);
|
return RelatedLink.getRelatedLinks(item, m_linkListName);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,12 @@ object type RelationAttribute {
|
||||||
|
|
||||||
BigDecimal[1..1] id = cms_relation_attribute.object_id INTEGER;
|
BigDecimal[1..1] id = cms_relation_attribute.object_id INTEGER;
|
||||||
String[1..1] attribute = cms_relation_attribute.attribute VARCHAR(100);
|
String[1..1] attribute = cms_relation_attribute.attribute VARCHAR(100);
|
||||||
String[1..1] key = cms_relation_attribute.key VARCHAR(100);
|
String[1..1] attr_key = cms_relation_attribute.attr_key VARCHAR(100);
|
||||||
String[1..1] lang = cms_relation_attribute.lang VARCHAR(2);
|
String[1..1] lang = cms_relation_attribute.lang VARCHAR(2);
|
||||||
String[1..1] name = cms_relation_attribute.name VARCHAR(100);
|
String[1..1] name = cms_relation_attribute.name VARCHAR(100);
|
||||||
String[0..1] description = cms_relation_attribute.description VARCHAR(500);
|
String[0..1] description = cms_relation_attribute.description VARCHAR(500);
|
||||||
|
|
||||||
unique (attribute, key, lang);
|
unique (attribute, attr_key, lang);
|
||||||
object key (id);
|
object key (id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ association {
|
||||||
to cms_contacts.contact_id;
|
to cms_contacts.contact_id;
|
||||||
|
|
||||||
// Link Attribute
|
// Link Attribute
|
||||||
BigDecimal[0..1] contact_order = cms_person_contact_map.contact_order INTEGER;
|
BigDecimal[0..1] link_order = cms_person_contact_map.link_order INTEGER;
|
||||||
String[0..1] contact_type = cms_person_contact_map.key VARCHAR(100);
|
String[0..1] link_key = cms_person_contact_map.link_key VARCHAR(100);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public class RelationAttribute extends DomainObject {
|
||||||
|
|
||||||
public static final String ID = "id";
|
public static final String ID = "id";
|
||||||
public static final String ATTRIBUTE = "attribute";
|
public static final String ATTRIBUTE = "attribute";
|
||||||
public static final String KEY = "key";
|
public static final String KEY = "attr_key";
|
||||||
public static final String LANGUAGE = "lang";
|
public static final String LANGUAGE = "lang";
|
||||||
public static final String NAME = "name";
|
public static final String NAME = "name";
|
||||||
public static final String DESCRIPTION = "description";
|
public static final String DESCRIPTION = "description";
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ public class GenericContact extends ContentPage implements RelationAttributeInte
|
||||||
|
|
||||||
/** PDL property names */
|
/** PDL property names */
|
||||||
public static final String PERSON = "person";
|
public static final String PERSON = "person";
|
||||||
|
// public static final String CONTACT_TYPE = "";
|
||||||
public static final String ADDRESS = "address";
|
public static final String ADDRESS = "address";
|
||||||
public static final String CONTACT_ENTRIES = "contactentries";
|
public static final String CONTACT_ENTRIES = "contactentries";
|
||||||
|
|
||||||
|
|
@ -98,12 +99,22 @@ public class GenericContact extends ContentPage implements RelationAttributeInte
|
||||||
public GenericPerson getPerson() {
|
public GenericPerson getPerson() {
|
||||||
return (GenericPerson) DomainObjectFactory.newInstance((DataObject)get(PERSON));
|
return (GenericPerson) DomainObjectFactory.newInstance((DataObject)get(PERSON));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the person for this contact
|
// Set the person for this contact
|
||||||
public void setPerson(GenericPerson person) {
|
public void setPerson(GenericPerson person) {
|
||||||
set(PERSON, person);
|
set(PERSON, person);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// // Get the type for this contact
|
||||||
|
// public String getContactType() {
|
||||||
|
// return get(CONTACT_TYPE));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Set the type for this contact
|
||||||
|
// public void setContactType(String type) {
|
||||||
|
// set(CONTACT_TYPE, type);
|
||||||
|
// }
|
||||||
|
|
||||||
// Unset the address for this contact
|
// Unset the address for this contact
|
||||||
public void unsetPerson() {
|
public void unsetPerson() {
|
||||||
set(PERSON, null);
|
set(PERSON, null);
|
||||||
|
|
@ -141,6 +152,14 @@ public class GenericContact extends ContentPage implements RelationAttributeInte
|
||||||
remove(CONTACT_ENTRIES, contactEntry);
|
remove(CONTACT_ENTRIES, contactEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasPerson() {
|
||||||
|
return !(this.getPerson() == null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasAddress() {
|
||||||
|
return !(this.getAddress() == null);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasContactEntries() {
|
public boolean hasContactEntries() {
|
||||||
return !this.getContactEntries().isEmpty();
|
return !this.getContactEntries().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,19 @@ import com.arsdigita.persistence.DataCollection;
|
||||||
*/
|
*/
|
||||||
public class GenericContactTypeCollection extends RelationAttributeCollection {
|
public class GenericContactTypeCollection extends RelationAttributeCollection {
|
||||||
|
|
||||||
public static final String CONTACT_ORDER = "contact_order";
|
public static final String CONTACTS_KEY = GenericPerson.CONTACTS_KEY;
|
||||||
|
public static final String CONTACTS_ORDER = GenericPerson.CONTACTS_ORDER;
|
||||||
|
public static final String ATTRIBUTE_NAME = "person";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of GenericContactEntryCollection
|
* Creates a new instance of GenericContactEntryCollection
|
||||||
*/
|
*/
|
||||||
public GenericContactTypeCollection() {
|
public GenericContactTypeCollection() {
|
||||||
super("person");
|
super(ATTRIBUTE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericContactTypeCollection(String key) {
|
public GenericContactTypeCollection(String key) {
|
||||||
super("person", key);
|
super(ATTRIBUTE_NAME, CONTACTS_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericContactTypeCollection(DataCollection dataCollection) {
|
public GenericContactTypeCollection(DataCollection dataCollection) {
|
||||||
|
|
@ -38,6 +40,6 @@ public class GenericContactTypeCollection extends RelationAttributeCollection {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public String getContactOrder() {
|
public String getContactOrder() {
|
||||||
return (String) get(CONTACT_ORDER);
|
return (String) get(CONTACTS_ORDER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ public class GenericPerson extends ContentPage implements RelationAttributeInter
|
||||||
public static final String BIRTHDATE = "birthdate";
|
public static final String BIRTHDATE = "birthdate";
|
||||||
public static final String GENDER = "gender";
|
public static final String GENDER = "gender";
|
||||||
public static final String CONTACTS = "contacts";
|
public static final String CONTACTS = "contacts";
|
||||||
public static final String CONTACT_TYPE = "contact_type";
|
public static final String CONTACTS_KEY = "link_key";
|
||||||
public static final String CONTACT_ORDER = "contact_order";
|
public static final String CONTACTS_ORDER = "link_order";
|
||||||
private static final String RELATION_ATTRIBUTES = "GenericContactType";
|
private static final String RELATION_ATTRIBUTES = "GenericContactType";
|
||||||
/** Data object type for this domain object */
|
/** Data object type for this domain object */
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
|
|
@ -166,9 +166,11 @@ public class GenericPerson extends ContentPage implements RelationAttributeInter
|
||||||
|
|
||||||
private void updateNameAndTitle() {
|
private void updateNameAndTitle() {
|
||||||
// Sync title and name with CI data
|
// Sync title and name with CI data
|
||||||
setTitle(getFullName());
|
String fullname = getFullName();
|
||||||
setName(GenericPerson.urlSave(getTitle()));
|
if (fullname != null && !fullname.isEmpty()) {
|
||||||
|
setTitle(fullname);
|
||||||
|
setName(GenericPerson.urlSave(fullname));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all contacts for this person
|
// Get all contacts for this person
|
||||||
|
|
@ -183,8 +185,8 @@ public class GenericPerson extends ContentPage implements RelationAttributeInter
|
||||||
|
|
||||||
DataObject link = add(CONTACTS, contact);
|
DataObject link = add(CONTACTS, contact);
|
||||||
|
|
||||||
link.set(CONTACT_TYPE, contactType);
|
link.set(CONTACTS_KEY, contactType);
|
||||||
link.set(CONTACT_ORDER, BigDecimal.valueOf(getContacts().size()));
|
link.set(CONTACTS_ORDER, BigDecimal.valueOf(getContacts().size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove a contact for this person
|
// Remove a contact for this person
|
||||||
|
|
@ -210,18 +212,24 @@ public class GenericPerson extends ContentPage implements RelationAttributeInter
|
||||||
// Create a ulr save version of the full name
|
// Create a ulr save version of the full name
|
||||||
public static String urlSave(String in) {
|
public static String urlSave(String in) {
|
||||||
|
|
||||||
// Replacement map
|
if (in != null && !in.isEmpty()) {
|
||||||
String[][] replacements = {{"ä", "ae"}, {"Ä", "Ae"}, {"ö", "oe"}, {"Ö", "Oe"}, {"ü", "ue"}, {"Ü", "Ue"}, {"ß", "ss"}, {".", ""}};
|
|
||||||
|
|
||||||
// Replace all spaces with dash
|
// Replacement map
|
||||||
String out = in.replace(" ", "-");
|
String[][] replacements = {{"ä", "ae"}, {"Ä", "Ae"}, {"ö", "oe"}, {"Ö", "Oe"}, {"ü", "ue"}, {"Ü", "Ue"}, {"ß", "ss"}, {".", ""}};
|
||||||
|
|
||||||
// Replace all special chars defined in replacement map
|
// Replace all spaces with dash
|
||||||
for (int i = 0; i < replacements.length; i++) {
|
String out = in.replace(" ", "-");
|
||||||
out = out.replace(replacements[i][0], replacements[i][1]);
|
|
||||||
|
// Replace all special chars defined in replacement map
|
||||||
|
for (int i = 0; i < replacements.length; i++) {
|
||||||
|
out = out.replace(replacements[i][0], replacements[i][1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace all special chars that are not yet replaced with a dash
|
||||||
|
return out.replaceAll("[^A-Za-z0-9-]", "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace all special chars that are not yet replaced with a dash
|
return in;
|
||||||
return out.replaceAll("[^A-Za-z0-9-]", "_");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@ import java.math.BigDecimal;
|
||||||
*/
|
*/
|
||||||
public class GenericPersonContactCollection extends DomainCollection {
|
public class GenericPersonContactCollection extends DomainCollection {
|
||||||
|
|
||||||
public static final String ORDER = "link.contact_order asc";
|
public static final String ORDER = "link." + GenericPerson.CONTACTS_ORDER + " asc";
|
||||||
public static final String CONTACT_TYPE = "link.contact_type";
|
public static final String CONTACTS_KEY = "link." + GenericPerson.CONTACTS_KEY;
|
||||||
public static final String CONTACT_ORDER = "link.contact_order";
|
public static final String CONTACTS_ORDER = "link." + GenericPerson.CONTACTS_ORDER;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of GenericPersonContactCollection
|
* Creates a new instance of GenericPersonContactCollection
|
||||||
|
|
@ -34,12 +34,12 @@ public class GenericPersonContactCollection extends DomainCollection {
|
||||||
|
|
||||||
// Get the contact type of the link
|
// Get the contact type of the link
|
||||||
public String getContactType() {
|
public String getContactType() {
|
||||||
return (String) m_dataCollection.get(CONTACT_TYPE);
|
return (String) m_dataCollection.get(CONTACTS_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the contact order of the link
|
// Get the contact order of the link
|
||||||
public String getContactOrder() {
|
public String getContactOrder() {
|
||||||
String retVal = ((BigDecimal) m_dataCollection.get(CONTACT_ORDER)).toString();
|
String retVal = ((BigDecimal) m_dataCollection.get(CONTACTS_ORDER)).toString();
|
||||||
|
|
||||||
if(retVal == null || retVal.isEmpty()) {
|
if(retVal == null || retVal.isEmpty()) {
|
||||||
retVal = String.valueOf(this.getPosition());
|
retVal = String.valueOf(this.getPosition());
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
|
||||||
private ItemSearchWidget m_itemSearch;
|
private ItemSearchWidget m_itemSearch;
|
||||||
private SaveCancelSection m_saveCancelSection;
|
private SaveCancelSection m_saveCancelSection;
|
||||||
private final String ITEM_SEARCH = "contactPerson";
|
private final String ITEM_SEARCH = "contactPerson";
|
||||||
|
private final String CONTACTS_KEY = GenericPersonContactCollection.CONTACTS_KEY;
|
||||||
/**
|
/**
|
||||||
* ID of the form
|
* ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
@ -90,7 +91,7 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
|
||||||
|
|
||||||
// GenericContact type field
|
// GenericContact type field
|
||||||
add(new Label(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.contact.type")));
|
add(new Label(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.contact.type")));
|
||||||
ParameterModel contactTypeParam = new StringParameter(GenericPersonContactCollection.CONTACT_TYPE);
|
ParameterModel contactTypeParam = new StringParameter(GenericPersonContactCollection.CONTACTS_KEY);
|
||||||
SingleSelect contactType = new SingleSelect(contactTypeParam);
|
SingleSelect contactType = new SingleSelect(contactTypeParam);
|
||||||
contactType.addValidationListener(new NotNullValidationListener());
|
contactType.addValidationListener(new NotNullValidationListener());
|
||||||
contactType.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.ui.select_one").localize())));
|
contactType.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.ui.select_one").localize())));
|
||||||
|
|
@ -116,6 +117,7 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
|
||||||
|
|
||||||
if (contact != null) {
|
if (contact != null) {
|
||||||
data.put(ITEM_SEARCH, contact.getPerson());
|
data.put(ITEM_SEARCH, contact.getPerson());
|
||||||
|
// data.put(CONTACTS_KEY, contact.getContactType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,6 +128,7 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm implem
|
||||||
|
|
||||||
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
|
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
|
||||||
contact.setPerson((GenericPerson) data.get(ITEM_SEARCH));
|
contact.setPerson((GenericPerson) data.get(ITEM_SEARCH));
|
||||||
|
// contact.setContactType(data.get(CONTACTS_KEY));
|
||||||
}
|
}
|
||||||
init(fse);
|
init(fse);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -168,11 +168,11 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
|
||||||
GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(state);
|
GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
if (getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
if (getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
||||||
if (contact.getAddress() == null) {
|
// if (contact.getAddress() == null) {
|
||||||
contact.setAddress(new GenericAddress());
|
// contact.setAddress(new GenericAddress());
|
||||||
contact.getAddress().setName("Address for " + contact.getName() + "(" + contact.getID() + ")");
|
// contact.getAddress().setName("Address for " + contact.getName() + "(" + contact.getID() + ")");
|
||||||
contact.getAddress().setTitle("Address for " + contact.getName() + "(" + contact.getID() + ")");
|
// contact.getAddress().setTitle("Address for " + contact.getName() + "(" + contact.getID() + ")");
|
||||||
}
|
// }
|
||||||
|
|
||||||
contact.getAddress().setAddress((String) data.get(ADDRESS));
|
contact.getAddress().setAddress((String) data.get(ADDRESS));
|
||||||
contact.getAddress().setPostalCode((String) data.get(POSTAL_CODE));
|
contact.getAddress().setPostalCode((String) data.get(POSTAL_CODE));
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
* To change this template, choose Tools | Template Manager
|
* To change this template, choose Tools | Template Manager
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
|
@ -17,6 +16,8 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericContact;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||||
|
|
||||||
|
|
@ -25,11 +26,14 @@ import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||||
* @author quasi
|
* @author quasi
|
||||||
*/
|
*/
|
||||||
public class GenericContactPersonPropertiesStep extends SimpleEditStep {
|
public class GenericContactPersonPropertiesStep extends SimpleEditStep {
|
||||||
|
|
||||||
public static final String ADD_PERSON_SHEET_NAME = "addPerson";
|
public static final String ADD_PERSON_SHEET_NAME = "addPerson";
|
||||||
public static final String EDIT_PERSON_SHEET_NAME = "editPerson";
|
public static final String EDIT_PERSON_SHEET_NAME = "editPerson";
|
||||||
public static final String CHANGE_PERSON_SHEET_NAME = "changePerson";
|
public static final String CHANGE_PERSON_SHEET_NAME = "changePerson";
|
||||||
public static final String DELETE_PERSON_SHEET_NAME = "deletePerson";
|
public static final String DELETE_PERSON_SHEET_NAME = "deletePerson";
|
||||||
|
private WorkflowLockedComponentAccess addPerson;
|
||||||
|
private WorkflowLockedComponentAccess editPerson;
|
||||||
|
private WorkflowLockedComponentAccess delPerson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of GenericContactPersonPropertiesStep
|
* Creates a new instance of GenericContactPersonPropertiesStep
|
||||||
|
|
@ -37,48 +41,55 @@ public class GenericContactPersonPropertiesStep extends SimpleEditStep {
|
||||||
public GenericContactPersonPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
|
public GenericContactPersonPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
|
||||||
this(itemModel, parent, "");
|
this(itemModel, parent, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericContactPersonPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent, String prefix) {
|
public GenericContactPersonPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent, String prefix) {
|
||||||
super(itemModel, parent, prefix);
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
//XXX
|
|
||||||
// if(false/*EMPTY*/) {
|
|
||||||
|
|
||||||
BasicPageForm addPersonSheet = new GenericContactAttachPersonPropertyForm(itemModel, this);
|
|
||||||
add(ADD_PERSON_SHEET_NAME, (String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.attach_person").localize(), new WorkflowLockedComponentAccess(addPersonSheet, itemModel), addPersonSheet.getSaveCancelSection().getCancelButton());
|
|
||||||
|
|
||||||
/* Set the displayComponent for this step */
|
BasicPageForm addPersonSheet = new GenericContactAttachPersonPropertyForm(itemModel, this);
|
||||||
// setDisplayComponent(getEmptyPersonPropertySheet(itemModel));
|
addPerson = new WorkflowLockedComponentAccess(addPersonSheet, itemModel);
|
||||||
|
add(ADD_PERSON_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.attach_person").localize(), addPerson, addPersonSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
// } else {
|
BasicPageForm editPersonSheet = new GenericContactEditPersonPropertyForm(itemModel, this);
|
||||||
|
editPerson = new WorkflowLockedComponentAccess(editPersonSheet, itemModel);
|
||||||
BasicPageForm editPersonSheet = new GenericContactEditPersonPropertyForm(itemModel, this);
|
add(EDIT_PERSON_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.edit_person").localize(), editPerson, editPersonSheet.getSaveCancelSection().getCancelButton());
|
||||||
add(EDIT_PERSON_SHEET_NAME, (String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.edit_person").localize(), new WorkflowLockedComponentAccess(editPersonSheet, itemModel), editPersonSheet.getSaveCancelSection().getCancelButton());
|
|
||||||
|
|
||||||
// BasicPageForm changePersonSheet = new GenericContactEditPersonPropertyForm(itemModel, this);
|
|
||||||
// add(CHANGE_PERSON_SHEET_NAME, (String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.reattach_person").localize(), new WorkflowLockedComponentAccess(changePersonSheet, itemModel), changePersonSheet.getSaveCancelSection().getCancelButton());
|
|
||||||
|
|
||||||
BasicPageForm deletePersonSheet = new GenericContactDeletePersonForm(itemModel, this);
|
|
||||||
add(DELETE_PERSON_SHEET_NAME, (String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.delete_person").localize(), new WorkflowLockedComponentAccess(deletePersonSheet, itemModel), deletePersonSheet.getSaveCancelSection().getCancelButton());
|
|
||||||
|
|
||||||
/* Set the displayComponent for this step */
|
BasicPageForm deletePersonSheet = new GenericContactDeletePersonForm(itemModel, this);
|
||||||
setDisplayComponent(getPersonPropertySheet(itemModel));
|
delPerson = new WorkflowLockedComponentAccess(deletePersonSheet, itemModel);
|
||||||
// }
|
add(DELETE_PERSON_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.delete_person").localize(), delPerson, deletePersonSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
/* Set the displayComponent for this step */
|
||||||
|
setDisplayComponent(getPersonPropertySheet(itemModel));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component getPersonPropertySheet(ItemSelectionModel itemModel) {
|
public static Component getPersonPropertySheet(ItemSelectionModel itemModel) {
|
||||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||||
|
|
||||||
sheet.add((String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize(), "person." + GenericPerson.SURNAME);
|
sheet.add((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize(), "person." + GenericPerson.SURNAME);
|
||||||
sheet.add((String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.givenname").localize(), "person." + GenericPerson.GIVENNAME);
|
sheet.add((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.givenname").localize(), "person." + GenericPerson.GIVENNAME);
|
||||||
sheet.add((String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize(), "person." + GenericPerson.TITLEPRE);
|
sheet.add((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize(), "person." + GenericPerson.TITLEPRE);
|
||||||
sheet.add((String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize(), "person." + GenericPerson.TITLEPOST);
|
sheet.add((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize(), "person." + GenericPerson.TITLEPOST);
|
||||||
|
|
||||||
return sheet;
|
return sheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component getEmptyPersonPropertySheet(ItemSelectionModel itemModel) {
|
public static Component getEmptyPersonPropertySheet(ItemSelectionModel itemModel) {
|
||||||
return new Label(((String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.emptyPerson").localize()));
|
return new Label(((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.emptyPerson").localize()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible(PageState ps) {
|
||||||
|
|
||||||
|
if(((GenericContact) getItemSelectionModel().getSelectedItem(ps)).hasPerson() == false) {
|
||||||
|
addPerson.getComponent().setVisible(ps, true);
|
||||||
|
editPerson.getComponent().setVisible(ps, false);
|
||||||
|
delPerson.getComponent().setVisible(ps, false);
|
||||||
|
} else {
|
||||||
|
addPerson.getComponent().setVisible(ps, false);
|
||||||
|
editPerson.getComponent().setVisible(ps, true);
|
||||||
|
delPerson.getComponent().setVisible(ps, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.isVisible(ps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ public class GenericPersonContactAddForm extends BasicItemForm {
|
||||||
|
|
||||||
// GenericContact type field
|
// GenericContact type field
|
||||||
add(new Label(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.contact.type")));
|
add(new Label(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.contact.type")));
|
||||||
ParameterModel contactTypeParam = new StringParameter(GenericPersonContactCollection.CONTACT_TYPE);
|
ParameterModel contactTypeParam = new StringParameter(GenericPersonContactCollection.CONTACTS_KEY);
|
||||||
SingleSelect contactType = new SingleSelect(contactTypeParam);
|
SingleSelect contactType = new SingleSelect(contactTypeParam);
|
||||||
contactType.addValidationListener(new NotNullValidationListener());
|
contactType.addValidationListener(new NotNullValidationListener());
|
||||||
contactType.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.ui.select_one").localize())));
|
contactType.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.ui.select_one").localize())));
|
||||||
|
|
@ -109,7 +109,7 @@ public class GenericPersonContactAddForm extends BasicItemForm {
|
||||||
|
|
||||||
//
|
//
|
||||||
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
|
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
|
||||||
person.addContact((GenericContact) data.get(ITEM_SEARCH), (String) data.get(GenericPersonContactCollection.CONTACT_TYPE));
|
person.addContact((GenericContact) data.get(ITEM_SEARCH), (String) data.get(GenericPersonContactCollection.CONTACTS_KEY));
|
||||||
}
|
}
|
||||||
|
|
||||||
init(fse);
|
init(fse);
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ public class GenericPersonContactTable extends Table implements TableActionListe
|
||||||
|
|
||||||
setModelBuilder(new GenericPersonTableModelBuilder(itemModel));
|
setModelBuilder(new GenericPersonTableModelBuilder(itemModel));
|
||||||
|
|
||||||
tab_model.get(0).setCellRenderer(new EditCellRenderer());
|
tab_model.get(2).setCellRenderer(new EditCellRenderer());
|
||||||
tab_model.get(3).setCellRenderer(new DeleteCellRenderer());
|
tab_model.get(3).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
addTableActionListener(this);
|
addTableActionListener(this);
|
||||||
|
|
@ -150,18 +150,10 @@ public class GenericPersonContactTable extends Table implements TableActionListe
|
||||||
case 0:
|
case 0:
|
||||||
return m_contactCollection.getContactOrder();
|
return m_contactCollection.getContactOrder();
|
||||||
case 1:
|
case 1:
|
||||||
String lang = DispatcherHelper.getNegotiatedLocale().getLanguage();
|
|
||||||
String key = m_contactCollection.getContactType();
|
|
||||||
return contacttypes.getRelationAttribute(m_contactCollection.getContactType(),
|
return contacttypes.getRelationAttribute(m_contactCollection.getContactType(),
|
||||||
DispatcherHelper.getNegotiatedLocale().getLanguage());
|
DispatcherHelper.getNegotiatedLocale().getLanguage()).getName();
|
||||||
// return contacttypes.getRelationAttribute(m_contactCollection.getContactType(),
|
|
||||||
// DispatcherHelper.getNegotiatedLocale().getLanguage());
|
|
||||||
case 2:
|
case 2:
|
||||||
return m_contact.getTitle();
|
return m_contact.getTitle();
|
||||||
// case 2:
|
|
||||||
// return (m_personEntry.getDescription() != null && m_personEntry.getDescription().length() > MAX_DESC_LENGTH)
|
|
||||||
// ? m_personEntry.getDescription().substring(0, MAX_DESC_LENGTH)
|
|
||||||
// : m_personEntry.getDescription();
|
|
||||||
case 3:
|
case 3:
|
||||||
return GlobalizationUtil.globalize("cms.ui.delete").localize();
|
return GlobalizationUtil.globalize("cms.ui.delete").localize();
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import com.arsdigita.bebop.form.SingleSelect;
|
||||||
import com.arsdigita.bebop.form.TextArea;
|
import com.arsdigita.bebop.form.TextArea;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
import com.arsdigita.bebop.form.TextField;
|
||||||
import com.arsdigita.bebop.parameters.DateParameter;
|
import com.arsdigita.bebop.parameters.DateParameter;
|
||||||
|
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
|
@ -107,6 +108,7 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
|
||||||
|
|
||||||
form.add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize()));
|
form.add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize()));
|
||||||
ParameterModel surnameParam = new StringParameter(SURNAME);
|
ParameterModel surnameParam = new StringParameter(SURNAME);
|
||||||
|
surnameParam.addParameterListener(new NotNullValidationListener());
|
||||||
TextField surname = new TextField(surnameParam);
|
TextField surname = new TextField(surnameParam);
|
||||||
form.add(surname);
|
form.add(surname);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ public class LinkPropertyForm extends FormSection
|
||||||
add(m_targetURI);
|
add(m_targetURI);
|
||||||
|
|
||||||
add(new Label("Content Item:"));
|
add(new Label("Content Item:"));
|
||||||
m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, m_contentType);
|
m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, m_itemModel.getContentType());
|
||||||
m_itemSearch.getSearchButton().setOnFocus("toggle_link_fields(true)");
|
m_itemSearch.getSearchButton().setOnFocus("toggle_link_fields(true)");
|
||||||
m_itemSearch.getClearButton().setOnFocus("toggle_link_fields(true)");
|
m_itemSearch.getClearButton().setOnFocus("toggle_link_fields(true)");
|
||||||
add(m_itemSearch);
|
add(m_itemSearch);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue