diff --git a/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/RelationAttributeImporter.java b/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/RelationAttributeImporter.java
index 6f0e3e1e5..71ceeb6e8 100644
--- a/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/RelationAttributeImporter.java
+++ b/ccm-cms-relationattributeimporter/src/com/arsdigita/cms/relationattributeimporter/RelationAttributeImporter.java
@@ -54,7 +54,7 @@ import org.xml.sax.SAXException;
* RelationAttributeImporter would like the following:
*
- * ant -Dccm.classname="com.arsdigita.cms.relationattributeimporter.RelationAttributeImporter" -Dccm.parameters="/path/to/relation/attribute/file.xml" ccm-ru + * ant -Dccm.classname="com.arsdigita.cms.relationattributeimporter.RelationAttributeImporter" -Dccm.parameters="/path/to/relation/attribute/file.xml" ccm-run **
* You have to add the RelationAttributeImporter to add to your
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 f6a62136e..f0bb929f1 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java
@@ -24,18 +24,23 @@ import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.form.TextField;
+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.RelationAttribute;
+import com.arsdigita.cms.RelationAttributeCollection;
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;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
+import com.arsdigita.dispatcher.DispatcherHelper;
+import org.apache.log4j.Logger;
/**
* Form for adding related persons the an organization.
@@ -44,20 +49,24 @@ import com.arsdigita.cms.ui.authoring.BasicItemForm;
*/
public class GenericOrganizationalUnitPersonAddForm extends BasicItemForm {
+ private static final Logger logger = Logger.getLogger(
+ GenericOrganizationalUnitPersonAddForm.class);
private GenericOrganizationalUnitPersonPropertiesStep m_step;
private ItemSearchWidget m_itemSearch;
- private final String ITEM_SEARCH = "orgaunitPerson";
+ private final String ITEM_SEARCH = "orgaunitPerson";
public GenericOrganizationalUnitPersonAddForm(ItemSelectionModel itemModel) {
- super("PersonAddForm", itemModel);
+ super("PersonAddForm", itemModel);
}
-
+
@Override
protected void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.select_person").localize()));
- this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
+ m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(getPersonType()));
+ m_itemSearch.getItemField().addValidationListener(
+ new NotNullValidationListener());
add(this.m_itemSearch);
add(new Label(ContenttypesGlobalizationUtil.globalize(
@@ -65,17 +74,27 @@ public class GenericOrganizationalUnitPersonAddForm extends BasicItemForm {
ParameterModel roleParam =
new StringParameter(
GenericOrganizationalUnitPersonCollection.PERSON_ROLE);
- /*SingleSelect roleSelect = new SingleSelect(roleParam);
+ SingleSelect roleSelect = new SingleSelect(roleParam);
roleSelect.addValidationListener(new NotNullValidationListener());
roleSelect.addOption(
- new Option("",
- new Label((String) ContenttypesGlobalizationUtil.
- globalize("cms.ui.select_one").localize())));
+ new Option("",
+ new Label((String) ContenttypesGlobalizationUtil.
+ globalize("cms.ui.select_one").localize())));
+ RelationAttributeCollection roles = new RelationAttributeCollection(
+ getRoleAttributeName());
+ roles.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
+ getLanguage());
+ while (roles.next()) {
+ RelationAttribute role;
+ role = roles.getRelationAttribute();
+ roleSelect.addOption(new Option(role.getKey(), role.getName()));
+ }
- add(roleSelect);*/
- TextField role = new TextField(roleParam);
+ add(roleSelect);
+
+ /*TextField role = new TextField(roleParam);
role.addValidationListener(new NotNullValidationListener());
- add(role);
+ add(role);*/
}
@Override
@@ -92,7 +111,14 @@ public class GenericOrganizationalUnitPersonAddForm extends BasicItemForm {
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) getItemSelectionModel().
getSelectedObject(state);
- if (!(this.getSaveCancelSection().getCancelButton().isSelected(state))) {
+ if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
+ if (data.get(ITEM_SEARCH) == null) {
+ logger.warn("Person to add is null!!!");
+ } else {
+ logger.debug(String.format("Adding person %s",
+ ((GenericPerson) data.get(ITEM_SEARCH)).
+ getFullName()));
+ }
orga.addPerson((GenericPerson) data.get(ITEM_SEARCH),
(String) data.get(
GenericOrganizationalUnitPersonCollection.PERSON_ROLE));
@@ -104,4 +130,8 @@ public class GenericOrganizationalUnitPersonAddForm extends BasicItemForm {
protected String getPersonType() {
return GenericPerson.class.getName();
}
+
+ protected String getRoleAttributeName() {
+ return "GenericOrganizationRole";
+ }
}
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 1a6ed7d11..d3169c26e 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java
@@ -33,11 +33,13 @@ import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.bebop.util.GlobalizationUtil;
import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.RelationAttributeCollection;
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.dispatcher.Utilities;
+import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
import org.apache.log4j.Logger;
@@ -64,7 +66,7 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
setEmptyView(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.persons.none")));
TableColumnModel tabModel = getColumnModel();
-
+
tabModel.add(new TableColumn(
0,
ContenttypesGlobalizationUtil.globalize(
@@ -141,11 +143,21 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
}
public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
+ switch (columnIndex) {
case 0:
return m_person.getFullName();
case 1:
- return m_personsCollection.getRoleName();
+ RelationAttributeCollection role = new RelationAttributeCollection(
+ getRoleAttributeName(),
+ m_personsCollection.getRoleName());
+ role.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
+ getLanguage());
+ //return m_personsCollection.getRoleName();
+ if (role.next()) {
+ return role.getName();
+ } else {
+ return GlobalizationUtil.globalize("cms.ui.unknownRole");
+ }
case 2:
return GlobalizationUtil.globalize("cms.ui.delete").localize();
default:
@@ -244,4 +256,8 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
public void headSelected(TableActionEvent event) {
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ protected String getRoleAttributeName() {
+ return "GenericOrganizationalUnitRole";
+ }
}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberAddForm.java
index 08699a116..af6fb5378 100644
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberAddForm.java
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberAddForm.java
@@ -44,4 +44,9 @@ public class SciDepartmentMemberAddForm
protected String getPersonType() {
return SciMember.class.getName();
}
+
+ @Override
+ protected String getRoleAttributeName() {
+ return "SciDepartmentRole";
+ }
}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberStep.java
index 8f9ede4ff..2aa0e52d9 100644
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberStep.java
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberStep.java
@@ -52,7 +52,7 @@ public class SciDepartmentMemberStep extends SimpleEditStep {
new WorkflowLockedComponentAccess(addMemberSheet, itemModel),
addMemberSheet.getSaveCancelSection().getCancelButton());
- GenericOrganizationalUnitPersonsTable memberTable = new GenericOrganizationalUnitPersonsTable(
+ SciDepartmentMemberTable memberTable = new SciDepartmentMemberTable(
itemModel);
setDisplayComponent(memberTable);
}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberTable.java
new file mode 100644
index 000000000..e6292526a
--- /dev/null
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberTable.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010 Jens Pelzetter,
+ * for the Center of Social Politics of the University of Bremen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.cms.ItemSelectionModel;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class SciDepartmentMemberTable extends GenericOrganizationalUnitPersonsTable {
+
+ public SciDepartmentMemberTable(ItemSelectionModel itemModel) {
+ super(itemModel);
+ }
+
+ @Override
+ protected String getRoleAttributeName() {
+ return "SciDepartmentRole";
+ }
+
+}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberAddForm.java
index 138cfe11f..8b48a25cf 100644
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberAddForm.java
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberAddForm.java
@@ -47,4 +47,8 @@ public class SciOrganizationMemberAddForm
return SciMember.class.getName();
}
+ @Override
+ protected String getRoleAttributeName() {
+ return "SciOrganizationRole";
+ }
}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberStep.java
index df6ed775e..c113280da 100644
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberStep.java
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberStep.java
@@ -50,17 +50,15 @@ public class SciOrganizationMemberStep extends SimpleEditStep {
super(itemModel, parent, prefix);
BasicItemForm addMemberSheet =
- new SciOrganizationMemberAddForm(itemModel);
+ new SciOrganizationMemberAddForm(itemModel);
add(ADD_MEMBER_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
+ (String) SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.orgnization.add_member").localize(),
- new WorkflowLockedComponentAccess(addMemberSheet, itemModel),
- addMemberSheet.getSaveCancelSection().getCancelButton());
+ new WorkflowLockedComponentAccess(addMemberSheet, itemModel),
+ addMemberSheet.getSaveCancelSection().getCancelButton());
- GenericOrganizationalUnitPersonsTable memberTable = new GenericOrganizationalUnitPersonsTable(
+ SciOrganizationMemberTable memberTable = new SciOrganizationMemberTable(
itemModel);
setDisplayComponent(memberTable);
}
-
-
}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberTable.java
new file mode 100644
index 000000000..2b6104406
--- /dev/null
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberTable.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010 Jens Pelzetter,
+ * for the Center of Social Politics of the University of Bremen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.cms.ItemSelectionModel;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class SciOrganizationMemberTable extends GenericOrganizationalUnitPersonsTable {
+
+ public SciOrganizationMemberTable(ItemSelectionModel itemModel) {
+ super(itemModel);
+ }
+
+ @Override
+ protected String getRoleAttributeName() {
+ return "SciOrganizationRole";
+ }
+
+}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberAddForm.java
index a242cf01f..4d00d930b 100644
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberAddForm.java
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberAddForm.java
@@ -40,4 +40,9 @@ public class SciProjectMemberAddForm
protected String getPersonType() {
return SciMember.class.getName();
}
+
+ @Override
+ protected String getRoleAttributeName() {
+ return "SciProjectRole";
+ }
}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberTable.java
new file mode 100644
index 000000000..301f67876
--- /dev/null
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberTable.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2010 Jens Pelzetter,
+ * for the Center of Social Politics of the University of Bremen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+package com.arsdigita.cms.contenttypes.ui;
+
+import com.arsdigita.cms.ItemSelectionModel;
+
+/**
+ *
+ * @author Jens Pelzetter
+ */
+public class SciProjectMemberTable
+ extends GenericOrganizationalUnitPersonsTable {
+
+ public SciProjectMemberTable(ItemSelectionModel itemModel) {
+ super(itemModel);
+ }
+
+ @Override
+ protected String getRoleAttributeName() {
+ return "SciProjectRole";
+ }
+}