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:
|
||||
* </p>
|
||||
* <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>
|
||||
* <p>
|
||||
* 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.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";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,4 +44,9 @@ public class SciDepartmentMemberAddForm
|
|||
protected String getPersonType() {
|
||||
return SciMember.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRoleAttributeName() {
|
||||
return "SciDepartmentRole";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRoleAttributeName() {
|
||||
return "SciOrganizationRole";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
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