Der Typ einer Assoziation zwischen einer generischen Organisation (GenericOrganizationalUnit) und einem Kontakt (GenericContact) kann jetzt nachträglich geändert
werden. git-svn-id: https://svn.libreccm.org/ccm/trunk@763 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
d50306851d
commit
dd645e695c
|
|
@ -1066,3 +1066,4 @@ cms.ui.workflow.approve_this_content=Approve
|
|||
cms.ui.unknownRole=Unknown role
|
||||
cms.ui.unknownStatus=Unknown status
|
||||
cms.contenttypes.ui.genericorgaunit.persons.status=Status
|
||||
cms.ui.edit_assoc=Edit association
|
||||
|
|
|
|||
|
|
@ -1057,3 +1057,4 @@ cms.ui.workflow.approve_this_content=Aktzeptieren
|
|||
cms.ui.unknownRole=Unbekannte Rolle
|
||||
cms.ui.unknownStatus=Unbekannter status
|
||||
cms.contenttypes.ui.genericorgaunit.persons.status=Status
|
||||
cms.ui.edit_assoc=Verkn\u00fcpfung bearbeiten
|
||||
|
|
|
|||
|
|
@ -5,3 +5,4 @@ cms.ui.unknownRole=
|
|||
cms.ui.unknownStatus=Unknown status
|
||||
cms.contenttypes.ui.genericorgaunit.persons.status=Status
|
||||
cms.contenttypes.shared.basic_properties.title=
|
||||
cms.ui.edit_assoc=
|
||||
|
|
|
|||
|
|
@ -536,3 +536,4 @@ cms.contenttypes.ui.address.uri=URL (TRANSLATE THIS cms.contenttypes.ui.address.
|
|||
cms.contenttypes.ui.address.email.desc=Means of contacting someone at this address (TRANSLATE THIS cms.contenttypes.ui.address.email.desc)
|
||||
cms.contenttypes.ui.address.uri.desc=A URL to find more information about this Address (TRANSLATE THIS cms.contenttypes.ui.address.uri.desc)
|
||||
cms.contenttypes.shared.basic_properties.title=
|
||||
cms.ui.edit_assoc=
|
||||
|
|
|
|||
|
|
@ -132,3 +132,4 @@ cms.contenttypes.ui.person.contact.del=Delete
|
|||
"cms.contenttypes.ui.genericorgaunit.contacts.none=No contacts associated yet
|
||||
cms.contenttypes.ui.genericorgaunit.contact.up=Up
|
||||
cms.contenttypes.ui.genericorgaunit.contact.down=Down
|
||||
cms.contenttypes.ui.genericorgaunit.contact.edit=Edit association
|
||||
|
|
|
|||
|
|
@ -143,3 +143,4 @@ cms.contenttypes.ui.person.contact.del=L\u00f6schen
|
|||
"cms.contenttypes.ui.genericorgaunit.contacts.none=Derzeit sind keine Kontakte verkn\u00fcpft
|
||||
cms.contenttypes.ui.genericorgaunit.contact.up=Hoch
|
||||
cms.contenttypes.ui.genericorgaunit.contact.down=Runter
|
||||
cms.contenttypes.ui.genericorgaunit.contact.edit=Verkn\u00fcpfung bearbeiten
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ package com.arsdigita.cms.contenttypes;
|
|||
import com.arsdigita.domain.DomainCollection;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -34,30 +33,38 @@ public class GenericOrganizationalUnitContactCollection extends DomainCollection
|
|||
private final static Logger s_log =
|
||||
Logger.getLogger(
|
||||
GenericOrganizationalUnitContactCollection.class);
|
||||
public static final String CONTACT_ORDER = "link.contact_order";
|
||||
public static final String CONTACT_TYPE = "link.contact_type";
|
||||
public static final String LINK_CONTACT_ORDER = "link.contact_order";
|
||||
public static final String LINK_CONTACT_TYPE = "link.contact_type";
|
||||
public static final String CONTACT_ORDER = "contact_order";
|
||||
public static final String CONTACT_TYPE = "contact_type";
|
||||
|
||||
public GenericOrganizationalUnitContactCollection(
|
||||
DataCollection dataCollection) {
|
||||
super(dataCollection);
|
||||
|
||||
m_dataCollection.addOrder(CONTACT_ORDER);
|
||||
m_dataCollection.addOrder(LINK_CONTACT_ORDER);
|
||||
}
|
||||
|
||||
// Get the contact type of the link
|
||||
public String getContactType() {
|
||||
return (String) m_dataCollection.get(CONTACT_TYPE);
|
||||
return (String) m_dataCollection.get(LINK_CONTACT_TYPE);
|
||||
}
|
||||
|
||||
public void setContactType(final String contactType) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(CONTACT_TYPE, contactType);
|
||||
}
|
||||
|
||||
// Get the contact order of the link
|
||||
public Integer getContactOrder() {
|
||||
return (Integer) m_dataCollection.get(CONTACT_ORDER);
|
||||
return (Integer) m_dataCollection.get(LINK_CONTACT_ORDER);
|
||||
}
|
||||
|
||||
public void setContactOrder(Integer order) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(CONTACT_ORDER, order);
|
||||
link.set(LINK_CONTACT_ORDER, order);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -57,10 +57,14 @@ public class GenericOrganizationalUnitContactAddForm extends BasicItemForm {
|
|||
private SaveCancelSection m_saveCancelSection;
|
||||
private final String ITEM_SEARCH = "personAddress";
|
||||
private ItemSelectionModel m_itemModel;
|
||||
private GenericOrganizationalUnitContactPropertiesStep editStep;
|
||||
private Label selectedContactLabel;
|
||||
|
||||
public GenericOrganizationalUnitContactAddForm(ItemSelectionModel itemModel) {
|
||||
public GenericOrganizationalUnitContactAddForm(ItemSelectionModel itemModel,
|
||||
GenericOrganizationalUnitContactPropertiesStep editStep) {
|
||||
super("ContactEntryAddForm", itemModel);
|
||||
m_itemModel = itemModel;
|
||||
this.editStep = editStep;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -71,6 +75,9 @@ public class GenericOrganizationalUnitContactAddForm extends BasicItemForm {
|
|||
findByAssociatedObjectType(GenericContact.class.getName()));
|
||||
add(m_itemSearch);
|
||||
|
||||
selectedContactLabel = new Label("");
|
||||
add(selectedContactLabel);
|
||||
|
||||
add(new Label(ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.contact.type")));
|
||||
ParameterModel contactTypeParam = new StringParameter(
|
||||
|
|
@ -95,8 +102,24 @@ public class GenericOrganizationalUnitContactAddForm extends BasicItemForm {
|
|||
|
||||
@Override
|
||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
|
||||
GenericContact selectedContact = editStep.getSelectedContact();
|
||||
String selectedContactType = editStep.getSelectedContactType();
|
||||
|
||||
if (selectedContact == null) {
|
||||
selectedContactLabel.setVisible(state, false);
|
||||
} else {
|
||||
data.put(ITEM_SEARCH, selectedContact);
|
||||
data.put(GenericOrganizationalUnitContactCollection.CONTACT_TYPE,
|
||||
selectedContactType);
|
||||
|
||||
m_itemSearch.setVisible(state, false);
|
||||
selectedContactLabel.setLabel(selectedContact.getTitle(), state);
|
||||
selectedContactLabel.setVisible(state, true);
|
||||
}
|
||||
|
||||
setVisible(state, true);
|
||||
}
|
||||
|
||||
|
|
@ -107,12 +130,36 @@ public class GenericOrganizationalUnitContactAddForm extends BasicItemForm {
|
|||
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
|
||||
|
||||
|
||||
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||
GenericContact selectedContact;
|
||||
selectedContact = editStep.getSelectedContact();
|
||||
|
||||
if (selectedContact == null) {
|
||||
orgaunit.addContact((GenericContact) data.get(ITEM_SEARCH),
|
||||
(String) data.get(
|
||||
GenericOrganizationalUnit.CONTACT_TYPE));
|
||||
} else {
|
||||
GenericOrganizationalUnitContactCollection contacts;
|
||||
|
||||
contacts = orgaunit.getContacts();
|
||||
|
||||
while (contacts.next()) {
|
||||
if (contacts.getContact().equals(selectedContact)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//init(fse);
|
||||
contacts.setContactType((String) data.get(
|
||||
GenericOrganizationalUnitContactCollection.CONTACT_TYPE));
|
||||
|
||||
editStep.setSelectedContact(null);
|
||||
editStep.setSelectedContactType(null);
|
||||
contacts.close();
|
||||
}
|
||||
}
|
||||
|
||||
init(fse);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.GenericContact;
|
||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
|
|
@ -34,7 +35,9 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
|||
public class GenericOrganizationalUnitContactPropertiesStep
|
||||
extends SimpleEditStep {
|
||||
|
||||
private static String ADD_CONTACT_SHEET_NAME = "addContact";
|
||||
public static final String ADD_CONTACT_SHEET_NAME = "addContact";
|
||||
private GenericContact selectedContact;
|
||||
private String selectedContactType;
|
||||
|
||||
public GenericOrganizationalUnitContactPropertiesStep(
|
||||
ItemSelectionModel itemModel, AuthoringKitWizard parent) {
|
||||
|
|
@ -47,8 +50,8 @@ public class GenericOrganizationalUnitContactPropertiesStep
|
|||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addContactSheet =
|
||||
new GenericOrganizationalUnitContactAddForm(
|
||||
itemModel);
|
||||
new GenericOrganizationalUnitContactAddForm(itemModel,
|
||||
this);
|
||||
add(ADD_CONTACT_SHEET_NAME,
|
||||
(String) ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.add_contact").localize(),
|
||||
|
|
@ -56,7 +59,23 @@ public class GenericOrganizationalUnitContactPropertiesStep
|
|||
addContactSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
GenericOrganizationalUnitContactTable contactsTable = new GenericOrganizationalUnitContactTable(
|
||||
itemModel);
|
||||
itemModel, this);
|
||||
setDisplayComponent(contactsTable);
|
||||
}
|
||||
|
||||
public GenericContact getSelectedContact() {
|
||||
return selectedContact;
|
||||
}
|
||||
|
||||
public void setSelectedContact(final GenericContact selectedContact) {
|
||||
this.selectedContact = selectedContact;
|
||||
}
|
||||
|
||||
public String getSelectedContactType() {
|
||||
return selectedContactType;
|
||||
}
|
||||
|
||||
public void setSelectedContactType(final String selectedContactType) {
|
||||
this.selectedContactType = selectedContactType;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,14 @@ import com.arsdigita.cms.dispatcher.ItemResolver;
|
|||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
|
||||
;
|
||||
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -61,15 +66,19 @@ public class GenericOrganizationalUnitContactTable extends Table implements
|
|||
private final static Logger s_log = Logger.getLogger(
|
||||
GenericOrganizationalUnitContactTable.class);
|
||||
private final static String TABLE_COL_EDIT = "table_col_edit";
|
||||
private final static String TABLE_COL_EDIT_ASSOC = "table_col_edit_assoc";
|
||||
private final static String TABLE_COL_DEL = "table_col_del";
|
||||
private final static String TABLE_COL_UP = "table_col_up";
|
||||
private final static String TABLE_COL_DOWN = "table_col_down";
|
||||
private ItemSelectionModel m_itemModel;
|
||||
private GenericOrganizationalUnitContactPropertiesStep editStep;
|
||||
|
||||
public GenericOrganizationalUnitContactTable(
|
||||
final ItemSelectionModel itemModel) {
|
||||
final ItemSelectionModel itemModel,
|
||||
final GenericOrganizationalUnitContactPropertiesStep editStep) {
|
||||
super();
|
||||
this.m_itemModel = itemModel;
|
||||
this.editStep = editStep;
|
||||
|
||||
setEmptyView(new Label(ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.contacts.none")));
|
||||
|
|
@ -87,15 +96,20 @@ public class GenericOrganizationalUnitContactTable extends Table implements
|
|||
tabModel.add(new TableColumn(
|
||||
2,
|
||||
ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.contact.edit").localize(),
|
||||
TABLE_COL_EDIT_ASSOC));
|
||||
tabModel.add(new TableColumn(
|
||||
3,
|
||||
ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.contact.action").localize(),
|
||||
TABLE_COL_DEL));
|
||||
tabModel.add(new TableColumn(
|
||||
3,
|
||||
4,
|
||||
ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.contact.up").localize(),
|
||||
TABLE_COL_UP));
|
||||
tabModel.add(new TableColumn(
|
||||
4,
|
||||
5,
|
||||
ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.contact.down").localize(),
|
||||
TABLE_COL_DOWN));
|
||||
|
|
@ -104,9 +118,10 @@ public class GenericOrganizationalUnitContactTable extends Table implements
|
|||
new GenericOrganizationalUnitTableModelBuilder(itemModel));
|
||||
|
||||
tabModel.get(1).setCellRenderer(new EditCellRenderer());
|
||||
tabModel.get(2).setCellRenderer(new DeleteCellRenderer());
|
||||
tabModel.get(3).setCellRenderer(new UpCellRenderer());
|
||||
tabModel.get(4).setCellRenderer(new DownCellRenderer());
|
||||
tabModel.get(2).setCellRenderer(new EditAssocCellRenderer());
|
||||
tabModel.get(3).setCellRenderer(new DeleteCellRenderer());
|
||||
tabModel.get(4).setCellRenderer(new UpCellRenderer());
|
||||
tabModel.get(5).setCellRenderer(new DownCellRenderer());
|
||||
|
||||
addTableActionListener(this);
|
||||
}
|
||||
|
|
@ -181,7 +196,8 @@ public class GenericOrganizationalUnitContactTable extends Table implements
|
|||
s_log.warn(String.format("No matching relation "
|
||||
+ "attributes for contact type '%s' found. "
|
||||
+ "Using key as fallback.",
|
||||
m_contactCollection.getContactType()));
|
||||
m_contactCollection.
|
||||
getContactType()));
|
||||
return m_contactCollection.getContactType();
|
||||
}
|
||||
if (m_contacttypes.getRelationAttribute(m_contactCollection.
|
||||
|
|
@ -189,8 +205,7 @@ public class GenericOrganizationalUnitContactTable extends Table implements
|
|||
s_log.debug(String.format(
|
||||
"No human readable name "
|
||||
+ "found for '%s' for language '%s' Using key.",
|
||||
m_contactCollection.
|
||||
getContactType(),
|
||||
m_contactCollection.getContactType(),
|
||||
lang));
|
||||
return m_contactCollection.getContactType();
|
||||
} else {
|
||||
|
|
@ -208,6 +223,9 @@ public class GenericOrganizationalUnitContactTable extends Table implements
|
|||
case 1:
|
||||
return m_contact.getTitle();
|
||||
case 2:
|
||||
return GlobalizationUtil.globalize("cms.ui.edit_assoc").
|
||||
localize();
|
||||
case 3:
|
||||
return GlobalizationUtil.globalize("cms.ui.delete").localize();
|
||||
default:
|
||||
return null;
|
||||
|
|
@ -262,6 +280,36 @@ public class GenericOrganizationalUnitContactTable extends Table implements
|
|||
}
|
||||
}
|
||||
|
||||
private class EditAssocCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
public Component getComponent(
|
||||
Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int col) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
GenericOrganizationalUnit orgaunit =
|
||||
(GenericOrganizationalUnit) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||
SecurityManager.EDIT_ITEM,
|
||||
orgaunit);
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
return link;
|
||||
} else {
|
||||
return new Label(value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class DeleteCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
|
@ -368,6 +416,21 @@ public class GenericOrganizationalUnitContactTable extends Table implements
|
|||
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||
|
||||
if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
||||
} else if (column.getHeaderKey().toString().equals(
|
||||
TABLE_COL_EDIT_ASSOC)) {
|
||||
while (contacts.next()) {
|
||||
if (contacts.getContact().equals(contact)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
editStep.setSelectedContact(contact);
|
||||
editStep.setSelectedContactType(contacts.getContactType());
|
||||
|
||||
contacts.close();
|
||||
|
||||
editStep.showComponent(state,
|
||||
GenericOrganizationalUnitContactPropertiesStep.ADD_CONTACT_SHEET_NAME);
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
||||
orgaunit.removeContact(contact);
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ public class SeriesEditshipAddForm extends BasicItemForm {
|
|||
if (!(this.getSaveCancelSection().
|
||||
getCancelButton().isSelected(state))) {
|
||||
GenericPerson editor;
|
||||
editor = ((SeriesEditshipStep) editStep).getSelectedEditor();
|
||||
editor = editStep.getSelectedEditor();
|
||||
|
||||
if (editor == null) {
|
||||
series.addEditor((GenericPerson) data.get(ITEM_SEARCH),
|
||||
|
|
@ -154,6 +154,7 @@ public class SeriesEditshipAddForm extends BasicItemForm {
|
|||
editStep.setSelectedEditor(null);
|
||||
editStep.setSelectedEditorDateFrom(null);
|
||||
editStep.setSelectedEditorDateTo(null);
|
||||
editors.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -377,6 +377,8 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
|
|||
((SeriesEditshipStep)editStep).setSelectedEditorDateFrom(editors.getFrom());
|
||||
((SeriesEditshipStep)editStep).setSelectedEditorDateTo(editors.getTo());
|
||||
|
||||
editors.close();
|
||||
|
||||
editStep.showComponent(state, SeriesEditshipStep.ADD_EDITOR_SHEET_NAME);
|
||||
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||
series.removeEditor(editor);
|
||||
|
|
|
|||
Loading…
Reference in New Issue