From 33690c2eeb96e8bea35caa011175a4de9b1ba79c Mon Sep 17 00:00:00 2001 From: jensp Date: Mon, 26 Jul 2010 13:54:11 +0000 Subject: [PATCH] Fixed several errors, the most important ones: - trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericPerson.java: Changed type for birthdate accessors from String to java.util.Date - trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertyForm.java: Changed start and end year of the date widget to 1900 (start) and the current year (end) - trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java: Fixed error in the EditCellRenderer. git-svn-id: https://svn.libreccm.org/ccm/trunk@496 8810af33-2d31-482b-a856-94f89814c4df --- .../arsdigita/cms/contenttypes/Member.java | 4 +- .../contenttypes/ui/MemberPropertiesStep.java | 10 ++- .../contenttypes/ui/MemberPropertyForm.java | 13 ++- .../GenericOrganizationalUnit.java | 3 +- ...cOrganizationalUnitChildrenCollection.java | 3 +- .../cms/contenttypes/GenericPerson.java | 7 +- .../GenericOrganizationalUnitChildTable.java | 90 ++++++++++++++++--- ...anizationalUnitChildrenPropertiesStep.java | 4 +- ...enericOrganizationalUnitPersonAddForm.java | 29 +++++- ...GenericOrganizationalUnitPersonsTable.java | 89 ++++++++++-------- ...nericOrganizationalUnitPropertiesStep.java | 2 +- .../ui/GenericPersonPropertiesStep.java | 7 +- .../ui/GenericPersonPropertyForm.java | 8 +- 13 files changed, 197 insertions(+), 72 deletions(-) diff --git a/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/Member.java b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/Member.java index 8ed751e70..c1bc43a04 100644 --- a/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/Member.java +++ b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/Member.java @@ -58,12 +58,12 @@ public class Member extends GenericPerson { super(type); } - @Override + /* @Override public void beforeSave() { super.beforeSave(); Assert.exists(getContentType(), ContentType.class); - } + }*/ /* accessors *****************************************************/ } diff --git a/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertiesStep.java b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertiesStep.java index b56b2e26f..a89b59e52 100644 --- a/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertiesStep.java +++ b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertiesStep.java @@ -28,18 +28,22 @@ public class MemberPropertiesStep extends GenericPersonPropertiesStep { public static final String EDIT_SHEET_NAME = "edit"; - public MemberPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) { + public MemberPropertiesStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent) { super(itemModel, parent); } protected void createEditSheet(ItemSelectionModel itemModel) { BasicPageForm editSheet; editSheet = new MemberPropertyForm(itemModel, this); - add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.getSaveCancelSection().getCancelButton()); + add(EDIT_SHEET_NAME, "Edit", + new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet. + getSaveCancelSection().getCancelButton()); } public static Component getMemberPropertySheet(ItemSelectionModel itemModel) { - Component sheet = GenericPersonPropertiesStep.getPersonPropertySheet(itemModel); + Component sheet = GenericPersonPropertiesStep.getGenericPersonPropertySheet( + itemModel); return sheet; } diff --git a/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertyForm.java b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertyForm.java index 8271c61ff..203933703 100644 --- a/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertyForm.java +++ b/ccm-cms-types-member/src/com/arsdigita/cms/contenttypes/ui/MemberPropertyForm.java @@ -38,9 +38,14 @@ import org.apache.log4j.Logger; * * @author: Jens Pelzetter */ -public class MemberPropertyForm extends GenericPersonPropertyForm implements FormProcessListener, FormInitListener, FormSubmissionListener { +public class MemberPropertyForm + extends GenericPersonPropertyForm + implements FormProcessListener, + FormInitListener, + FormSubmissionListener { - private static final Logger s_log = Logger.getLogger(MemberPropertyForm.class); + private static final Logger s_log = Logger.getLogger( + MemberPropertyForm.class); private MemberPropertiesStep m_step; public static final String ID = "Member_edit"; @@ -48,7 +53,8 @@ public class MemberPropertyForm extends GenericPersonPropertyForm implements For this(itemModel, null); } - public MemberPropertyForm(ItemSelectionModel itemModel, MemberPropertiesStep step) { + public MemberPropertyForm(ItemSelectionModel itemModel, + MemberPropertiesStep step) { super(itemModel, step); m_step = step; addSubmissionListener(this); @@ -71,4 +77,3 @@ public class MemberPropertyForm extends GenericPersonPropertyForm implements For } } - diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnit.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnit.java index d0c28ec67..29f025e9a 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnit.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnit.java @@ -127,11 +127,12 @@ public class GenericOrganizationalUnit extends ContentPage { return new GenericOrganizationalUnitPersonCollection((DataCollection) get(PERSONS)); } - public void addPerson(GenericPerson person) { + public void addPerson(GenericPerson person, String role) { Assert.exists(person, GenericPerson.class); DataObject link = add(PERSONS, person); + link.set(ROLE, role); link.set(PERSON_ORDER, BigDecimal.valueOf(getPersons().size())); } diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitChildrenCollection.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitChildrenCollection.java index f37491e80..93ccdd37e 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitChildrenCollection.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnitChildrenCollection.java @@ -29,7 +29,8 @@ import java.math.BigDecimal; */ public class GenericOrganizationalUnitChildrenCollection extends DomainCollection { - public static final String ORDER = "map_order asc"; + //public static final String ORDER = "map_order asc"; + public static final String ORDER = "link.orgaunit_children_order"; //public static final String CHILDREN_ORDER = "link.children_order"; public GenericOrganizationalUnitChildrenCollection(DataCollection dataCollection) { diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericPerson.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericPerson.java index 4f766ebea..fe9fb8a69 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericPerson.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericPerson.java @@ -27,6 +27,7 @@ import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; import com.arsdigita.util.Assert; import java.math.BigDecimal; +import java.util.Date; /** * Basic GenericPerson Contenttype for OpenCCM. @@ -107,10 +108,10 @@ public class GenericPerson extends ContentPage { set(TITLEPOST, titlePost); } - public String getBirthdate() { - return (String)get(BIRTHDATE); + public Date getBirthdate() { + return (Date)get(BIRTHDATE); } - public void setBirthdate(String birthdate) { + public void setBirthdate(Date birthdate) { set(BIRTHDATE, birthdate); } diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitChildTable.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitChildTable.java index 9bfe90759..aaad08dbc 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitChildTable.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitChildTable.java @@ -50,6 +50,8 @@ public class GenericOrganizationalUnitChildTable extends Table implements private final String TABLE_COL_EDIT = "table_col_edit"; private final String TABLE_COL_DEL = "table_col_del"; + private final String TABLE_COL_UP = "table_col_up"; + private final String TABLE_COL_DOWN = "table_col_down"; private ItemSelectionModel m_itemModel; public GenericOrganizationalUnitChildTable( @@ -61,26 +63,40 @@ public class GenericOrganizationalUnitChildTable extends Table implements "cms.contenttypes.ui.genericorgaunit.childs.none"))); TableColumnModel tabModel = getColumnModel(); + /*tabModel.add(new TableColumn( + 0, + ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.genericorgaunit.child.order").localize(), + TABLE_COL_EDIT));*/ tabModel.add(new TableColumn( 0, ContenttypesGlobalizationUtil.globalize( - "cms.contenttypes.ui.genericorgaunit.child.order").localize(), + "cms.contenttypes.ui.genericorgaunit.child.name").localize(), TABLE_COL_EDIT)); tabModel.add(new TableColumn( 1, ContenttypesGlobalizationUtil.globalize( - "cms.contenttypes.ui.genericorgaunit.child.name").localize())); - tabModel.add(new TableColumn( - 2, - ContenttypesGlobalizationUtil.globalize( "cms.contenttypes.ui.genericorgaunit.child.action").localize(), TABLE_COL_DEL)); + /* tabModel.add(new TableColumn( + 2, + ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.genericorgaunit.child.up").localize(), + TABLE_COL_UP)); + tabModel.add(new TableColumn( + 3, + ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.genericorgaunit.child.down").localize(), + TABLE_COL_DOWN));*/ + setModelBuilder(new GenericOrganizationalUnitChildTableModelBuilder( itemModel)); tabModel.get(0).setCellRenderer(new EditCellRenderer()); - tabModel.get(2).setCellRenderer(new DeleteCellRenderer()); + tabModel.get(1).setCellRenderer(new DeleteCellRenderer()); + //tabModel.get(2).setCellRenderer(new UpCellRenderer()); + //tabModel.get(3).setCellRenderer(new DownCellRenderer()); addTableActionListener(this); } @@ -137,11 +153,11 @@ public class GenericOrganizationalUnitChildTable extends Table implements public Object getElementAt(int colIndex) { switch (colIndex) { + /*case 0: + return m_childCollection.getChildrenOrder();*/ case 0: - return m_childCollection.getChildrenOrder(); - case 1: return m_child.getName(); - case 2: + case 1: return GlobalizationUtil.globalize("cms.ui.delete").localize(); default: return null; @@ -166,7 +182,8 @@ public class GenericOrganizationalUnitChildTable extends Table implements int col) { com.arsdigita.cms.SecurityManager securityManager = Utilities. getSecurityManager(state); - GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel. + GenericOrganizationalUnit orgaunit = + (GenericOrganizationalUnit) m_itemModel. getSelectedObject(state); boolean canEdit = securityManager.canAccess( @@ -215,6 +232,50 @@ public class GenericOrganizationalUnitChildTable extends Table implements } } + private class UpCellRenderer extends LockableImpl implements + TableCellRenderer { + + public Component getComponent( + Table table, + PageState state, + Object value, + boolean isSelected, + Object key, + int row, + int col) { + /*com.arsdigita.cms.SecurityManager securityManager = Utilities. + getSecurityManager(state); + GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel. + getSelectedObject(state);*/ + + ControlLink link = new ControlLink("up"); + + return link; + } + } + + private class DownCellRenderer extends LockableImpl implements + TableCellRenderer { + + public Component getComponent( + Table table, + PageState state, + Object value, + boolean isSelected, + Object key, + int row, + int col) { + /*com.arsdigita.cms.SecurityManager securityManager = Utilities. + getSecurityManager(state); + GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel. + getSelectedObject(state);*/ + + ControlLink link = new ControlLink("down"); + + return link; + } + } + @Override public void cellSelected(TableActionEvent event) { PageState state = event.getPageState(); @@ -228,10 +289,13 @@ public class GenericOrganizationalUnitChildTable extends Table implements TableColumn col = getColumnModel().get(event.getColumn().intValue()); if (col.getHeaderKey().toString().equals(TABLE_COL_EDIT)) { - } - - if (col.getHeaderKey().toString().equals(TABLE_COL_DEL)) { + } else if (col.getHeaderKey().toString().equals(TABLE_COL_DEL)) { parent.removeOrgaUnitChildren(child); + /*} else if(col.getHeaderKey().toString().equals(TABLE_COL_UP)) { + + } else if(col.getHeaderKey().toString().equals(TABLE_COL_DOWN)) { + + }*/ } } diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitChildrenPropertiesStep.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitChildrenPropertiesStep.java index f67ad1ff2..57880d68f 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitChildrenPropertiesStep.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitChildrenPropertiesStep.java @@ -55,8 +55,8 @@ public class GenericOrganizationalUnitChildrenPropertiesStep extends SimpleEditS new WorkflowLockedComponentAccess(addChildSheet, itemModel), addChildSheet.getSaveCancelSection().getCancelButton()); - GenericOrganizationalUnitChildTable childrenTable = new GenericOrganizationalUnitChildTable( - itemModel); + GenericOrganizationalUnitChildTable childrenTable = + new GenericOrganizationalUnitChildTable(itemModel); setDisplayComponent(childrenTable); } } diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java index f3d2cd034..fb4923fd6 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java @@ -25,9 +25,15 @@ import com.arsdigita.bebop.Label; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.SaveCancelSection; import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.form.Option; +import com.arsdigita.bebop.form.SingleSelect; +import com.arsdigita.bebop.parameters.NotNullValidationListener; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; +import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection; import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; import com.arsdigita.cms.ui.ItemSearchWidget; @@ -60,6 +66,25 @@ public class GenericOrganizationalUnitPersonAddForm extends BasicItemForm { this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType. findByAssociatedObjectType(GenericPerson.BASE_DATA_OBJECT_TYPE)); add(this.m_itemSearch); + + add(new Label(ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.genericorgaunit.person.role"))); + ParameterModel roleParam = + new StringParameter( + GenericOrganizationalUnitPersonCollection.PERSON_ROLE); + SingleSelect roleSelect = new SingleSelect(roleParam); + roleSelect.addValidationListener(new NotNullValidationListener()); + roleSelect.addOption( + new Option("", + new Label((String) ContenttypesGlobalizationUtil. + globalize("cms.ui.select_one").localize()))); + + roleSelect.addOption(new Option("Dummy", "Dummy")); + roleSelect.addOption(new Option("Boss", "Boss")); + roleSelect.addOption(new Option("Terrorist", "Terrorist")); + + add(roleSelect); + } @Override @@ -78,7 +103,9 @@ public class GenericOrganizationalUnitPersonAddForm extends BasicItemForm { getSelectedObject(state); if (!(this.getSaveCancelSection().getCancelButton().isSelected(state))) { - orga.addPerson((GenericPerson) data.get(ITEM_SEARCH)); + orga.addPerson((GenericPerson) data.get(ITEM_SEARCH), + (String) data.get( + GenericOrganizationalUnitPersonCollection.PERSON_ROLE)); } init(fse); diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java index 9c78fe82b..188c032e8 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java @@ -40,44 +40,52 @@ import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.util.LockableImpl; import java.math.BigDecimal; +import org.apache.log4j.Logger; /** * Table for showing the persons associated with an organization. * * @author Jens Pelzetter */ -public class GenericOrganizationalUnitPersonsTable extends Table implements TableActionListener { +public class GenericOrganizationalUnitPersonsTable extends Table implements + TableActionListener { + private final static Logger s_log = Logger.getLogger( + GenericOrganizationalUnitPersonsTable.class); private final String TABLE_COL_EDIT = "table_col_edit"; private final String TABLE_COL_DEL = "table_col_del"; private ItemSelectionModel m_itemModel; - public GenericOrganizationalUnitPersonsTable(final ItemSelectionModel itemModel) { + public GenericOrganizationalUnitPersonsTable( + final ItemSelectionModel itemModel) { super(); m_itemModel = itemModel; - setEmptyView(new Label(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.genericorgaunit.persons.none"))); + setEmptyView(new Label(ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.genericorgaunit.persons.none"))); TableColumnModel tabModel = getColumnModel(); tabModel.add(new TableColumn( 0, - ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.genericorgaunit.persons.order").localize(), - TABLE_COL_EDIT - )); + ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.genericorgaunit.persons.order").localize(), + TABLE_COL_EDIT)); tabModel.add(new TableColumn( 1, - ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.genericorgaunit.persons.name").localize() - )); + ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.genericorgaunit.persons.name").localize())); tabModel.add(new TableColumn( 2, - ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.genericorgaunit.persons.role").localize() - )); - tabModel.add(new TableColumn( + ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.genericorgaunit.persons.role").localize())); + tabModel.add( + new TableColumn( 3, - ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.genericorgaunit.persons.delete").localize() - )); + ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.genericorgaunit.persons.delete").localize())); - setModelBuilder(new GenericOrganizationalUnitTableModelBuilder(itemModel)); + setModelBuilder( + new GenericOrganizationalUnitTableModelBuilder(itemModel)); tabModel.get(0).setCellRenderer(new EditCellRenderer()); tabModel.get(3).setCellRenderer(new DeleteCellRenderer()); @@ -97,22 +105,24 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl public TableModel makeModel(Table table, PageState state) { table.getRowSelectionModel().clearSelection(state); GenericOrganizationalUnit orgaunit = - (GenericOrganizationalUnit) m_itemModel.getSelectedObject(state); - return new GenericOrganizationalUnitTableModel(table, state, orgaunit); + (GenericOrganizationalUnit) m_itemModel. + getSelectedObject(state); + return new GenericOrganizationalUnitTableModel(table, state, + orgaunit); } } private class GenericOrganizationalUnitTableModel implements TableModel { + private final int MAX_DESC_LENGTH = 25; private Table m_table; private GenericOrganizationalUnitPersonCollection m_personsCollection; - private GenericPerson m_person; + private GenericPerson m_person; private GenericOrganizationalUnitTableModel( Table table, PageState state, - GenericOrganizationalUnit orgaunit - ) { + GenericOrganizationalUnit orgaunit) { m_table = table; m_personsCollection = orgaunit.getPersons(); } @@ -125,7 +135,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl boolean ret; if ((m_personsCollection != null) - && m_personsCollection.next()) { + && m_personsCollection.next()) { m_person = m_personsCollection.getPerson(); ret = true; } else { @@ -136,15 +146,15 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl } public Object getElementAt(int columnIndex) { - switch(columnIndex) { + switch (columnIndex) { case 0: return m_personsCollection.getPersonOrder(); case 1: - return String.format("%s %s %s %s", - m_person.getTitlePre(), - m_person.getGivenName(), - m_person.getSurname(), - m_person.getTitlePost()); + return String.format("%s %s %s %s", + m_person.getTitlePre(), + m_person.getGivenName(), + m_person.getSurname(), + m_person.getTitlePost()); case 2: return m_personsCollection.getRoleName(); case 3: @@ -159,7 +169,8 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl } } - private class EditCellRenderer extends LockableImpl implements TableCellRenderer { + private class EditCellRenderer extends LockableImpl implements + TableCellRenderer { public Component getComponent( Table table, @@ -171,12 +182,13 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl int col) { com.arsdigita.cms.SecurityManager securityManager = Utilities. getSecurityManager(state); - GenericPerson person = (GenericPerson) m_itemModel.getSelectedObject( + GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel. + getSelectedObject( state); boolean canEdit = securityManager.canAccess(state.getRequest(), - com.arsdigita.cms.SecurityManager.EDIT_ITEM, - person); + com.arsdigita.cms.SecurityManager.EDIT_ITEM, + orgaunit); if (canEdit) { ControlLink link = new ControlLink(value.toString()); return link; @@ -186,7 +198,8 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl } } - private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer { + private class DeleteCellRenderer extends LockableImpl implements + TableCellRenderer { public Component getComponent( Table table, @@ -198,12 +211,13 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl int col) { com.arsdigita.cms.SecurityManager securityManager = Utilities. getSecurityManager(state); - GenericPerson person = (GenericPerson) m_itemModel.getSelectedObject( + GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel. + getSelectedObject( state); boolean canEdit = securityManager.canAccess(state.getRequest(), - com.arsdigita.cms.SecurityManager.DELETE_ITEM, - person); + com.arsdigita.cms.SecurityManager.DELETE_ITEM, + orgaunit); if (canEdit) { ControlLink link = new ControlLink(value.toString()); link.setConfirmation((String) ContenttypesGlobalizationUtil. @@ -221,9 +235,11 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl public void cellSelected(TableActionEvent event) { PageState state = event.getPageState(); - GenericPerson person = new GenericPerson(new BigDecimal(event.getRowKey().toString())); + GenericPerson person = new GenericPerson(new BigDecimal(event.getRowKey(). + toString())); - GenericOrganizationalUnit orga = (GenericOrganizationalUnit) m_itemModel.getSelectedObject(state); + GenericOrganizationalUnit orga = (GenericOrganizationalUnit) m_itemModel. + getSelectedObject(state); TableColumn col = getColumnModel().get(event.getColumn().intValue()); @@ -235,7 +251,6 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements Tabl } } - @Override public void headSelected(TableActionEvent event) { throw new UnsupportedOperationException("Not supported yet."); diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPropertiesStep.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPropertiesStep.java index 87fb31ab4..8b3940f00 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPropertiesStep.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPropertiesStep.java @@ -121,7 +121,7 @@ public class GenericOrganizationalUnitPropertiesStep extends SimpleEditStep { AuthoringKitWizard parent) { addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel, parent), - "cms.contenttypes.ui.orgaunit.contact"); + "cms.contenttypes.ui.orgaunit.childs"); addStep(new GenericOrganizationalUnitChildrenPropertiesStep(itemModel, parent), "cms.contenttypes.ui.orgaunit.contact"); diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertiesStep.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertiesStep.java index 221ca57ac..c254ad1b5 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertiesStep.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertiesStep.java @@ -84,9 +84,10 @@ public class GenericPersonPropertiesStep extends SimpleEditStep { public String format(DomainObject item, String attribute, PageState state) { - ContentPage page = (ContentPage) item; - if (page.getLaunchDate() != null) { - return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate()); + //ContentPage page = (ContentPage) item; + GenericPerson person = (GenericPerson) item; + if (person.getBirthdate() != null) { + return DateFormat.getDateInstance(DateFormat.LONG).format(person.getBirthdate()); } else { return (String) ContenttypesGlobalizationUtil.globalize("cms.ui.unknown").localize(); } diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertyForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertyForm.java index ae1c5b88b..8a810d4ea 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertyForm.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertyForm.java @@ -32,6 +32,9 @@ import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; import com.arsdigita.cms.ui.authoring.BasicPageForm; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; import org.apache.log4j.Logger; /** @@ -88,6 +91,8 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.birthdate").localize())); ParameterModel birthdateParam = new DateParameter(BIRTHDATE); com.arsdigita.bebop.form.Date birthdate = new com.arsdigita.bebop.form.Date(birthdateParam); + Calendar today = new GregorianCalendar(); + birthdate.setYearRange(1900, today.get(Calendar.YEAR)); add(birthdate); } @@ -121,7 +126,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)); - person.setBirthdate((String) data.get(BIRTHDATE)); + //Date birthdate = (Date)data.get(BIRTHDATE); + person.setBirthdate((Date) data.get(BIRTHDATE)); person.save(); }