Für die Rolle beim Hinzufügen einer Person zu einer Organisation wird jetzt das RelationAttribute verwendet.
git-svn-id: https://svn.libreccm.org/ccm/trunk@572 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
da30758724
commit
e994fe7bda
|
|
@ -54,7 +54,7 @@ import org.xml.sax.SAXException;
|
||||||
* <code>RelationAttributeImporter</code> would like the following:
|
* <code>RelationAttributeImporter</code> would like the following:
|
||||||
* </p>
|
* </p>
|
||||||
* <pre>
|
* <pre>
|
||||||
* 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
|
||||||
* </pre>
|
* </pre>
|
||||||
* <p>
|
* <p>
|
||||||
* You have to add the <code>RelationAttributeImporter</code> to add to your
|
* You have to add the <code>RelationAttributeImporter</code> to add to your
|
||||||
|
|
|
||||||
|
|
@ -24,18 +24,23 @@ 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.TextField;
|
import com.arsdigita.bebop.form.Option;
|
||||||
|
import com.arsdigita.bebop.form.SingleSelect;
|
||||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
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.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
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.GenericOrganizationalUnit;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||||
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;
|
||||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
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.
|
* Form for adding related persons the an organization.
|
||||||
|
|
@ -44,20 +49,24 @@ import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
*/
|
*/
|
||||||
public class GenericOrganizationalUnitPersonAddForm extends BasicItemForm {
|
public class GenericOrganizationalUnitPersonAddForm extends BasicItemForm {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(
|
||||||
|
GenericOrganizationalUnitPersonAddForm.class);
|
||||||
private GenericOrganizationalUnitPersonPropertiesStep m_step;
|
private GenericOrganizationalUnitPersonPropertiesStep m_step;
|
||||||
private ItemSearchWidget m_itemSearch;
|
private ItemSearchWidget m_itemSearch;
|
||||||
private final String ITEM_SEARCH = "orgaunitPerson";
|
private final String ITEM_SEARCH = "orgaunitPerson";
|
||||||
|
|
||||||
public GenericOrganizationalUnitPersonAddForm(ItemSelectionModel itemModel) {
|
public GenericOrganizationalUnitPersonAddForm(ItemSelectionModel itemModel) {
|
||||||
super("PersonAddForm", itemModel);
|
super("PersonAddForm", itemModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
add(new Label((String) ContenttypesGlobalizationUtil.globalize(
|
add(new Label((String) ContenttypesGlobalizationUtil.globalize(
|
||||||
"cms.contenttypes.ui.genericorgaunit.select_person").localize()));
|
"cms.contenttypes.ui.genericorgaunit.select_person").localize()));
|
||||||
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
||||||
findByAssociatedObjectType(getPersonType()));
|
findByAssociatedObjectType(getPersonType()));
|
||||||
|
m_itemSearch.getItemField().addValidationListener(
|
||||||
|
new NotNullValidationListener());
|
||||||
add(this.m_itemSearch);
|
add(this.m_itemSearch);
|
||||||
|
|
||||||
add(new Label(ContenttypesGlobalizationUtil.globalize(
|
add(new Label(ContenttypesGlobalizationUtil.globalize(
|
||||||
|
|
@ -65,17 +74,27 @@ public class GenericOrganizationalUnitPersonAddForm extends BasicItemForm {
|
||||||
ParameterModel roleParam =
|
ParameterModel roleParam =
|
||||||
new StringParameter(
|
new StringParameter(
|
||||||
GenericOrganizationalUnitPersonCollection.PERSON_ROLE);
|
GenericOrganizationalUnitPersonCollection.PERSON_ROLE);
|
||||||
/*SingleSelect roleSelect = new SingleSelect(roleParam);
|
SingleSelect roleSelect = new SingleSelect(roleParam);
|
||||||
roleSelect.addValidationListener(new NotNullValidationListener());
|
roleSelect.addValidationListener(new NotNullValidationListener());
|
||||||
roleSelect.addOption(
|
roleSelect.addOption(
|
||||||
new Option("",
|
new Option("",
|
||||||
new Label((String) ContenttypesGlobalizationUtil.
|
new Label((String) ContenttypesGlobalizationUtil.
|
||||||
globalize("cms.ui.select_one").localize())));
|
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);*/
|
add(roleSelect);
|
||||||
TextField role = new TextField(roleParam);
|
|
||||||
|
/*TextField role = new TextField(roleParam);
|
||||||
role.addValidationListener(new NotNullValidationListener());
|
role.addValidationListener(new NotNullValidationListener());
|
||||||
add(role);
|
add(role);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -92,7 +111,14 @@ public class GenericOrganizationalUnitPersonAddForm extends BasicItemForm {
|
||||||
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) getItemSelectionModel().
|
GenericOrganizationalUnit orga = (GenericOrganizationalUnit) getItemSelectionModel().
|
||||||
getSelectedObject(state);
|
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),
|
orga.addPerson((GenericPerson) data.get(ITEM_SEARCH),
|
||||||
(String) data.get(
|
(String) data.get(
|
||||||
GenericOrganizationalUnitPersonCollection.PERSON_ROLE));
|
GenericOrganizationalUnitPersonCollection.PERSON_ROLE));
|
||||||
|
|
@ -104,4 +130,8 @@ public class GenericOrganizationalUnitPersonAddForm extends BasicItemForm {
|
||||||
protected String getPersonType() {
|
protected String getPersonType() {
|
||||||
return GenericPerson.class.getName();
|
return GenericPerson.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getRoleAttributeName() {
|
||||||
|
return "GenericOrganizationRole";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,13 @@ import com.arsdigita.bebop.table.TableModel;
|
||||||
import com.arsdigita.bebop.table.TableModelBuilder;
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
import com.arsdigita.bebop.util.GlobalizationUtil;
|
import com.arsdigita.bebop.util.GlobalizationUtil;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.RelationAttributeCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||||
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;
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -145,7 +147,17 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
case 0:
|
case 0:
|
||||||
return m_person.getFullName();
|
return m_person.getFullName();
|
||||||
case 1:
|
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:
|
case 2:
|
||||||
return GlobalizationUtil.globalize("cms.ui.delete").localize();
|
return GlobalizationUtil.globalize("cms.ui.delete").localize();
|
||||||
default:
|
default:
|
||||||
|
|
@ -244,4 +256,8 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
|
||||||
public void headSelected(TableActionEvent event) {
|
public void headSelected(TableActionEvent event) {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String getRoleAttributeName() {
|
||||||
|
return "GenericOrganizationalUnitRole";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,4 +44,9 @@ public class SciDepartmentMemberAddForm
|
||||||
protected String getPersonType() {
|
protected String getPersonType() {
|
||||||
return SciMember.class.getName();
|
return SciMember.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getRoleAttributeName() {
|
||||||
|
return "SciDepartmentRole";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ public class SciDepartmentMemberStep extends SimpleEditStep {
|
||||||
new WorkflowLockedComponentAccess(addMemberSheet, itemModel),
|
new WorkflowLockedComponentAccess(addMemberSheet, itemModel),
|
||||||
addMemberSheet.getSaveCancelSection().getCancelButton());
|
addMemberSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
GenericOrganizationalUnitPersonsTable memberTable = new GenericOrganizationalUnitPersonsTable(
|
SciDepartmentMemberTable memberTable = new SciDepartmentMemberTable(
|
||||||
itemModel);
|
itemModel);
|
||||||
setDisplayComponent(memberTable);
|
setDisplayComponent(memberTable);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -47,4 +47,8 @@ public class SciOrganizationMemberAddForm
|
||||||
return SciMember.class.getName();
|
return SciMember.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getRoleAttributeName() {
|
||||||
|
return "SciOrganizationRole";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,17 +50,15 @@ public class SciOrganizationMemberStep extends SimpleEditStep {
|
||||||
super(itemModel, parent, prefix);
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
BasicItemForm addMemberSheet =
|
BasicItemForm addMemberSheet =
|
||||||
new SciOrganizationMemberAddForm(itemModel);
|
new SciOrganizationMemberAddForm(itemModel);
|
||||||
add(ADD_MEMBER_SHEET_NAME,
|
add(ADD_MEMBER_SHEET_NAME,
|
||||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||||
"sciorganization.ui.orgnization.add_member").localize(),
|
"sciorganization.ui.orgnization.add_member").localize(),
|
||||||
new WorkflowLockedComponentAccess(addMemberSheet, itemModel),
|
new WorkflowLockedComponentAccess(addMemberSheet, itemModel),
|
||||||
addMemberSheet.getSaveCancelSection().getCancelButton());
|
addMemberSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
GenericOrganizationalUnitPersonsTable memberTable = new GenericOrganizationalUnitPersonsTable(
|
SciOrganizationMemberTable memberTable = new SciOrganizationMemberTable(
|
||||||
itemModel);
|
itemModel);
|
||||||
setDisplayComponent(memberTable);
|
setDisplayComponent(memberTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -40,4 +40,9 @@ public class SciProjectMemberAddForm
|
||||||
protected String getPersonType() {
|
protected String getPersonType() {
|
||||||
return SciMember.class.getName();
|
return SciMember.class.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getRoleAttributeName() {
|
||||||
|
return "SciProjectRole";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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";
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue