Organization/Project content types: most recent versions of the code

git-svn-id: https://svn.libreccm.org/ccm/trunk@488 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2010-07-22 14:39:21 +00:00
parent 7d6da64ae5
commit 327319609e
44 changed files with 815 additions and 339 deletions

View File

@ -6,8 +6,8 @@
webapp="ROOT">
<ccm:dependencies>
<ccm:requires name="ccm-core" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms-types-organization"/>
<ccm:requires name="ccm-cms" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms-types-project" version="6.6.0" relation="ge"/>
</ccm:dependencies>
<ccm:directories>
<ccm:directory name="pdl"/>

View File

@ -3,6 +3,6 @@ model com.arsdigita.cms.contenttypes;
import com.arsdigita.kernel.ACSObject;
import com.arsdigita.cms.*;
object type Department extends Organization {
object type Department extends GenericOrganizationalUnit {
reference key ( ct_departments.department_id );
}

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
<!-- Is internal will be set the yes when testing is finished. -->
<ctd:content-type
label="Department"
description="A content type of Department."
objectType="com.arsdigita.cms.contenttypes.Department"
classname="com.arsdigita.cms.contenttypes.Department">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step
labelKey="cms.contenttypes.department.basic_properties.title"
labelBundle="cms.contenttypes.cms.ui.CMSResources"
descriptionKey="cms.contenttypes.department.basic_properties.description"
descriptionBundle="com.arsdigita.cms.ui.CMSResources"
component="com.arsdigita.cms.contenttypes.ui.DepartmentPropertiesStep"
ordering="1"
/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
</ctd:authoring-kit>
</ctd:content-type>
</ctd:content-types>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<xrd:adapters
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
<!--
Extend adapter for ContentItemPanel to also output the associated objects.
The default properties for BaseContact are left as is and are inherited from ContentPage
-->
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Department" extends="com.arsdigita.cms.ContentPage">
<xrd:associations rule="include">
<xrd:property name="/object/contacts"/>
</xrd:associations>
</xrd:adapter>
</xrd:context>
</xrd:adapters>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<registry>
<!-- <config class="com.arsdigita.cms.contenttypes.DepartmentConfig" storage="ccm-cms-types-department/department.properties"/> -->
</registry>

View File

@ -0,0 +1,17 @@
<load>
<requires>
<table name="inits"/>
<table name="acs_objects"/>
<table name="cms_items"/>
<!--<table name="cms_organizationalunits"/>-->
<initializer class="com.arsdigita.cms.Initializer"/>
</requires>
<provides>
<table name="ct_departemts"/>
<initializer class="com.arsdigita.cms.contenttypes.DepartmentInitializer"/>
</provides>
<scripts>
<schema directory="ccm-cms-types-department"/>
<data class="com.arsdigita.cms.contenttypes.DepartmentLoader"/>
</scripts>
</load>

View File

@ -0,0 +1,36 @@
package com.arsdigita.cms.contenttypes;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.OID;
import java.math.BigDecimal;
/**
*
* @author Jens Pelzetter
*/
public class Department extends GenericOrganizationalUnit {
public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.cms.contenttypes.Department";
public Department() {
super(BASE_DATA_OBJECT_TYPE);
}
public Department(BigDecimal id) throws DataObjectNotFoundException {
this(new OID(BASE_DATA_OBJECT_TYPE, id));
}
public Department(OID oid) {
super(oid);
}
public Department(DataObject obj) {
super(obj);
}
public Department(String type) {
super(type);
}
}

View File

@ -0,0 +1,29 @@
package com.arsdigita.cms.contenttypes;
import org.apache.log4j.Logger;
/**
*
* @author Jens Pelzetter
*/
public class DepartmentInitializer extends ContentTypeInitializer {
private static final Logger s_log = Logger.getLogger(DepartmentInitializer.class);
public DepartmentInitializer() {
super("ccm-cms-types-department.pdl.mf", Department.BASE_DATA_OBJECT_TYPE);
}
@Override
public String[] getStylesheets() {
return new String[] {
"/static/content-types/com/arsdigita/cms/contenttypes/Department.xsl"
};
}
@Override
public String getTraversalXML() {
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Department.xml";
}
}

View File

@ -0,0 +1,17 @@
package com.arsdigita.cms.contenttypes;
/**
*
* @author Jens Pelzetter
*/
public class DepartmentLoader extends AbstractContentTypeLoader {
private static final String[] TYPES = {
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/Department.xml"
};
public String[] getTypes() {
return TYPES;
}
}

View File

@ -0,0 +1,26 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.Project;
/**
*
* @author Jens Pelzetter
*/
public class DepartmentProjectAddForm
extends GenericOrganizationalUnitChildAddForm {
public DepartmentProjectAddForm(ItemSelectionModel itemModel) {
super("ProjectAddForm", itemModel);
}
@Override
protected String getChildDataObjectType() {
return Project.BASE_DATA_OBJECT_TYPE;
}
}

View File

@ -0,0 +1,49 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import org.apache.log4j.Logger;
/**
*
* @author Jens Pelzetter
*/
public class DepartmentProjectPropertiesStep extends SimpleEditStep {
private static final Logger s_log =
Logger.getLogger(DepartmentProjectPropertiesStep.class);
private static String ADD_CHILD_SHEET_NAME = "addProject";
public DepartmentProjectPropertiesStep(
ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
this(itemModel, parent, null);
}
public DepartmentProjectPropertiesStep(
ItemSelectionModel itemModel,
AuthoringKitWizard parent,
String prefix) {
super(itemModel, parent, prefix);
BasicItemForm addChildSheet = new DepartmentProjectAddForm(itemModel);
add(ADD_CHILD_SHEET_NAME,
(String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.department.add_project").localize(),
new WorkflowLockedComponentAccess(addChildSheet, itemModel),
addChildSheet.getSaveCancelSection().getCancelButton());
GenericOrganizationalUnitChildTable childrenTable = new GenericOrganizationalUnitChildTable(
itemModel);
setDisplayComponent(childrenTable);
}
}

View File

@ -0,0 +1,38 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
/**
*
* @author Jens Pelzetter
*/
public class DepartmentPropertiesStep
extends GenericOrganizationalUnitPropertiesStep {
public DepartmentPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
super(itemModel, parent);
}
@Override
protected void addSteps(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
parent),
"cms.contenttypes.ui.orgaunit.contact");
addStep(new DepartmentSubDepartmentPropertiesStep(itemModel,
parent),
"cms.contenttypes.ui.orgaunit.subdepartments");
addStep(new DepartmentProjectPropertiesStep(itemModel,
parent),
"cms.contenttypes.ui.orgaunit.projects");
addStep(new GenericOrganizationalUnitPersonPropertiesStep(itemModel,
parent),
"cms.contenttypes.ui.orgaunit.persons");
}
}

View File

@ -0,0 +1,21 @@
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.Department;
/**
*
* @author Jens Pelzetter
*/
public class DepartmentSubDepartmentAddForm
extends GenericOrganizationalUnitChildAddForm {
public DepartmentSubDepartmentAddForm(ItemSelectionModel itemModel) {
super("SubDepartmentAddForm", itemModel);
}
@Override
protected String getChildDataObjectType() {
return Department.BASE_DATA_OBJECT_TYPE;
}
}

View File

@ -0,0 +1,42 @@
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import org.apache.log4j.Logger;
/**
*
* @author Jens Pelzetter
*/
public class DepartmentSubDepartmentPropertiesStep extends SimpleEditStep {
private static final Logger s_log = Logger.getLogger(
DepartmentSubDepartmentPropertiesStep.class);
private static String ADD_CHILD_SHEET_NAME = "addChild";
public DepartmentSubDepartmentPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
this(itemModel, parent, null);
}
public DepartmentSubDepartmentPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent,
String prefix) {
super(itemModel, parent, prefix);
BasicItemForm addChildSheet = new DepartmentSubDepartmentAddForm(itemModel);
add(ADD_CHILD_SHEET_NAME, (String) ContenttypesGlobalizationUtil.
globalize("cms.contenttypes.ui.genericorgaunit.add_child").
localize(),
new WorkflowLockedComponentAccess(addChildSheet, itemModel),
addChildSheet.getSaveCancelSection().getCancelButton());
GenericOrganizationalUnitChildTable childrenTable = new GenericOrganizationalUnitChildTable(
itemModel);
setDisplayComponent(childrenTable);
}
}

View File

@ -8,6 +8,7 @@
<ccm:dependencies>
<ccm:requires name="ccm-core" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms" version="6.6.0" relation="ge"/>
<ccm:requires name="ccm-cms-types-department" version="6.6.0" relation="ge"/>
</ccm:dependencies>
<ccm:directories>
<ccm:directory name="pdl"/>

View File

@ -14,32 +14,13 @@
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step
labelKey="cms.contenttypes.shared.basic_properties.title"
labelKey="cms.contenttypes.organization_properties.title"
labelBundle="cms.contenttypes.cms.ui.CMSResources"
descriptionKey="cms.contenttypes.shared.basic_properties.description"
descriptionKey="cms.contenttypes.organization.basic_properties.description"
descriptionBundle="com.arsdigita.cms.ui.CMSResources"
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitPropertiesStep"
component="com.arsdigita.cms.contenttypes.ui.OrganizationPropertiesStep"
ordering="1"
/>
<ctd:authoring-step
labelKey="genericorgaunit.authoring.contact_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
descriptionKey="genericorgaunit.authoring.contact_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitContactPropertiesStep"
ordering="2"
/>
<ctd:authoring-step
labelKey="genericorgaunit.authoring.child_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
descriptionKey="genericorgaunit.authoring.child_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
component="com.arsdigita.cms.contenttypes.ui.OrganizationChildrenPropertiesStep"
ordering="3"
/>
/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
</ctd:authoring-kit>

View File

@ -3,6 +3,7 @@
<table name="inits"/>
<table name="acs_objects"/>
<table name="cms_items"/>
<!--<table name="cms_organizationalunits"/>-->
<initializer class="com.arsdigita.cms.Initializer"/>
</requires>
<provides>

View File

@ -1,72 +0,0 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SaveCancelSection;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.contenttypes.Organization;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.ui.ItemSearchWidget;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import org.apache.log4j.Logger;
/**
*
* @author Jens Pelzetter
*/
public class OrganizationAddChildForm extends BasicItemForm {
private static final Logger s_log = Logger.getLogger(
OrganizationAddChildForm.class);
private OrganizationChildrenPropertiesStep m_step;
private ItemSearchWidget m_itemSearch;
private SaveCancelSection m_saveCancelSection;
private final String ITEM_SEARCH = "orgaunitChild";
private ItemSelectionModel m_itemModel;
public OrganizationAddChildForm(ItemSelectionModel itemModel) {
super("ChildAddForm", itemModel);
}
@Override
protected void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.select_child").localize()));
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(
Organization.BASE_DATA_OBJECT_TYPE));
add(this.m_itemSearch);
}
@Override
public void init(FormSectionEvent fse) throws FormProcessException {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
setVisible(state, true);
}
@Override
public void process(FormSectionEvent fse) throws FormProcessException {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
GenericOrganizationalUnit parent = (GenericOrganizationalUnit) getItemSelectionModel().
getSelectedObject(state);
if (!(this.getSaveCancelSection().getCancelButton().isSelected(state))) {
parent.addOrgaUnitChildren((GenericOrganizationalUnit) data.get(
ITEM_SEARCH));
}
init(fse);
}
}

View File

@ -0,0 +1,21 @@
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.Department;
/**
*
* @author Jens Pelzetter
*/
public class OrganizationDepartmentAddForm
extends GenericOrganizationalUnitChildAddForm {
public OrganizationDepartmentAddForm(ItemSelectionModel itemModel) {
super("DepartmentAddForm", itemModel);
}
@Override
protected String getChildDataObjectType() {
return Department.BASE_DATA_OBJECT_TYPE;
}
}

View File

@ -14,30 +14,31 @@ import org.apache.log4j.Logger;
/**
*
* @author jensp
* @author Jens Pelzetter
*/
public class OrganizationChildrenPropertiesStep extends SimpleEditStep {
public class OrganizationDepartmentPropertiesStep extends SimpleEditStep {
private static final Logger s_log = Logger.getLogger(OrganizationChildrenPropertiesStep.class);
private static String ADD_CHILD_SHEET_NAME = "addChild";
private static final Logger s_log = Logger.getLogger(
OrganizationDepartmentPropertiesStep.class);
private static String ADD_CHILD_SHEET_NAME = "addDepartment";
public OrganizationChildrenPropertiesStep(
public OrganizationDepartmentPropertiesStep(
ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
this(itemModel, parent, null);
}
public OrganizationChildrenPropertiesStep(
public OrganizationDepartmentPropertiesStep(
ItemSelectionModel itemModel,
AuthoringKitWizard parent,
String prefix) {
super(itemModel, parent, prefix);
BasicItemForm addChildSheet = new OrganizationAddChildForm(
BasicItemForm addChildSheet = new OrganizationDepartmentAddForm(
itemModel);
add(ADD_CHILD_SHEET_NAME,
(String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.add_child").localize(),
"cms.contenttypes.ui.organization.add_department").localize(),
new WorkflowLockedComponentAccess(addChildSheet, itemModel),
addChildSheet.getSaveCancelSection().getCancelButton());
@ -45,4 +46,4 @@ public class OrganizationChildrenPropertiesStep extends SimpleEditStep {
itemModel);
setDisplayComponent(childrenTable);
}
}
}

View File

@ -0,0 +1,35 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
/**
*
* @author Jens Pelzetter
*/
public class OrganizationPropertiesStep
extends GenericOrganizationalUnitPropertiesStep {
public OrganizationPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
super(itemModel, parent);
}
@Override
protected void addSteps(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
parent),
"cms.contenttypes.ui.orgaunit.contact");
addStep(new OrganizationDepartmentPropertiesStep(itemModel,
parent),
"cms.contenttypes.ui.orgaunit.departments");
addStep(new GenericOrganizationalUnitPersonPropertiesStep(itemModel,
parent),
"cms.contenttypes.ui.orgaunit.persons");
}
}

View File

@ -4,43 +4,22 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
<!-- Is internal will be set the yes when testing is finished. -->
<ctd:content-type
label="Project"
description="A content type of project."
description="The content type Oroject."
objectType="com.arsdigita.cms.contenttypes.Project"
classname="com.arsdigita.cms.contenttypes.Project">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step
labelKey="cms.contenttypes.shared.basic_properties.title"
labelKey="cms.contenttypes.project.basic_properties.title"
labelBundle="cms.contenttypes.cms.ui.CMSResources"
descriptionKey="cms.contenttypes.shared.basic_properties.description"
descriptionKey="cms.contenttypes.project.basic_properties.description"
descriptionBundle="com.arsdigita.cms.ui.CMSResources"
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitPropertiesStep"
ordering="1"
/>
<ctd:authoring-step
labelKey="genericorgaunit.authoring.contact_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
descriptionKey="genericorgaunit.authoring.contact_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitContactPropertiesStep"
ordering="2"
/>
<ctd:authoring-step
labelKey="genericorgaunit.authoring.child_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
descriptionKey="genericorgaunit.authoring.child_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
component="com.arsdigita.cms.contenttypes.ui.ProjectChildrenPropertiesStep"
ordering="3"
/>
component="com.arsdigita.cms.contenttypes.ui.ProjectPropertiesStep"
ordering="1"/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
</ctd:authoring-kit>

View File

@ -3,6 +3,7 @@
<table name="inits"/>
<table name="acs_objects"/>
<table name="cms_items"/>
<!--<table name="cms_organizationalunits"/>-->
<initializer class="com.arsdigita.cms.Initializer"/>
</requires>
<provides>

View File

@ -1,73 +0,0 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SaveCancelSection;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.contenttypes.Project;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.ui.ItemSearchWidget;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import org.apache.log4j.Logger;
/**
*
* @author Jens Pelzetter
*/
public class ProjectAddChildForm extends BasicItemForm{
private static final Logger s_log = Logger.getLogger(ProjectAddChildForm.class);
private ProjectChildrenPropertiesStep m_step;
private ItemSearchWidget m_itemSearch;
private SaveCancelSection m_saveCancelSection;
private final String ITEM_SEARCH = "projectChild";
private ItemSelectionModel m_itemModel;
public ProjectAddChildForm(ItemSelectionModel itemModel) {
super("ChildAddForm", itemModel);
}
@Override
protected void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.select_child").localize()));
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(
Project.BASE_DATA_OBJECT_TYPE));
add(this.m_itemSearch);
}
@Override
public void init(FormSectionEvent fse) throws FormProcessException {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
setVisible(state, true);
}
@Override
public void process(FormSectionEvent fse) throws FormProcessException {
FormData data = fse.getFormData();
PageState state = fse.getPageState();
GenericOrganizationalUnit parent = (GenericOrganizationalUnit) getItemSelectionModel().
getSelectedObject(state);
if (!(this.getSaveCancelSection().getCancelButton().isSelected(state))) {
parent.addOrgaUnitChildren((GenericOrganizationalUnit) data.get(
ITEM_SEARCH));
}
init(fse);
}
}

View File

@ -0,0 +1,21 @@
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.Project;
/**
*
* @author Jens Pelzetter
*/
public class ProjectSubprojectAddForm
extends GenericOrganizationalUnitChildAddForm {
public ProjectSubprojectAddForm(ItemSelectionModel itemModel) {
super("SubprojectAddForm", itemModel);
}
@Override
protected String getChildDataObjectType() {
return Project.BASE_DATA_OBJECT_TYPE;
}
}

View File

@ -16,24 +16,24 @@ import org.apache.log4j.Logger;
*
* @author Jens Pelzetter
*/
public class ProjectChildrenPropertiesStep extends SimpleEditStep {
public class ProjectSubprojectPropertiesStep extends SimpleEditStep {
private final static Logger s_log = Logger.getLogger(
ProjectChildrenPropertiesStep.class);
ProjectSubprojectPropertiesStep.class);
private String ADD_CHILD_SHEET_NAME = "addChild";
public ProjectChildrenPropertiesStep(ItemSelectionModel itemModel,
public ProjectSubprojectPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
this(itemModel, parent, null);
}
public ProjectChildrenPropertiesStep(
public ProjectSubprojectPropertiesStep(
ItemSelectionModel itemModel,
AuthoringKitWizard parent,
String prefix) {
super(itemModel, parent, prefix);
BasicItemForm addChildSheet = new ProjectAddChildForm(itemModel);
BasicItemForm addChildSheet = new ProjectSubprojectAddForm(itemModel);
add(ADD_CHILD_SHEET_NAME,
(String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.add_child").localize(),

View File

@ -1,4 +1,4 @@
#Tue Jul 20 17:23:53 CEST 2010
#Wed Jul 21 09:20:24 CEST 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
@ -37,7 +37,7 @@ org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nullReference=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
@ -56,7 +56,7 @@ org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled

View File

@ -22,7 +22,7 @@ model com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentPage;
//PDL definition for a commons base type for orgnizations, departments, projects etc.
// PDL definition for a commons base type for orgnizations, departments, projects etc.
object type GenericOrganizationalUnit extends ContentPage {
//String[0..1] orgaunit_name = cms_organizationalunits.name VARCHAR(256);
@ -31,7 +31,7 @@ object type GenericOrganizationalUnit extends ContentPage {
reference key (cms_organizationalunits.organizationalunit_id);
}
//Parent <-> child relation organizationalunits to build department structures etc.
// Parent <-> child relation organizationalunits to build department structures etc.
association {
GenericOrganizationalUnit[0..1] orgaunit_parent = join cms_organizationalunits.organizationalunit_id
@ -44,11 +44,11 @@ association {
join cms_organizationalunits_organizationalunit_map.orgaunit_children_id
to cms_organizationalunits.organizationalunit_id;
//Link attribute, allows it to customize the order which the childs will be shown.
// Link attribute, allows it to customize the order which the childs will be shown.
BigDecimal[0..1] orgaunit_children_order = cms_organizationalunits_organizationalunit_map.map_order INTEGER;
}
//Link for contact points.
// Link for contact points.
association {
GenericOrganizationalUnit[0..1] organizationalunit = join cms_contacts.contact_id
@ -61,13 +61,13 @@ association {
join cms_organizationalunits_contact_map.contact_id
to cms_contacts.contact_id;
//Some link attributes.
// Some link attributes.
String contact_type = cms_organizationalunits_contact_map.contact_type VARCHAR(100);
BigDecimal contact_order = cms_organizationalunits_contact_map.map_order INTEGER;
}
//Links a organization with persons.
// Links a organization with persons.
association {
GenericOrganizationalUnit[0..1] organizationalunit = join cms_persons.person_id
@ -80,7 +80,7 @@ association {
join cms_organizationalunits_person_map.person_id
to cms_persons.person_id;
//Additional attributes for the association
// Additional attributes for the association
String role_name = cms_organizationalunits_person_map.role_name VARCHAR(100);
BigDecimal person_order = cms_organizationalunits_person_map.map_order INTEGER;

View File

@ -22,34 +22,6 @@
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitPropertiesStep"
ordering="1"
/>
<ctd:authoring-step
labelKey="genericorgaunit.authoring.contact_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
descriptionKey="genericorgaunit.authoring.contact_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitContactPropertiesStep"
ordering="2"
/>
<ctd:authoring-step
labelKey="genericorgaunit.authoring.child_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
descriptionKey="genericorgaunit.authoring.child_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitChildrenPropertiesStep"
ordering="3"
/>
<ctd:authoring-step
labelKey="genericorgaunit.authoring.persons_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
descriptionKey="genericorgaunit.authoring.persons_properties.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalPersonPropertiesStep"
ordering="4"
/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
</ctd:authoring-kit>

View File

@ -30,6 +30,11 @@ import java.math.BigDecimal;
* This class provides a base type for building content types which represent organizations,
* departments, projects etc.
*
* An item of this content type can be linked with several other content types:
* - Contact (0..n)
* - Person (0..n)
* - GenericOrganizationalUnit (0..n) to build organizations structures.
*
* @author Jens Pelzetter
* @version $Id$
*/
@ -67,21 +72,6 @@ public class GenericOrganizationalUnit extends ContentPage {
super(type);
}
/*@Override
public void beforeSave() {
super.beforeSave();
Assert.exists(getContentType(), ContentType.class);
}*/
/*public String getOrgaUnitName() {
return (String) get(ORGAUNIT_NAME);
}
public void setOrgaUnitName(String orgaUnitName) {
set(ORGAUNIT_NAME, orgaUnitName);
}*/
public String getAddendum() {
return (String) get(ADDENDUM);
}

View File

@ -1,6 +1,20 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* 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;
@ -9,22 +23,23 @@ import com.arsdigita.persistence.DataCollection;
import java.math.BigDecimal;
/**
* Collection class for the childs of a GenericOrganizationalUnit.
*
* @author jensp
* @author Jens Pelzetter
*/
public class GenericOrganizationalUnitChildrenCollection extends DomainCollection {
public static final String ORDER = "link.contact_order asc";
public static final String CHILDREN_ORDER = "link.children_order";
public static final String ORDER = "map_order asc";
//public static final String CHILDREN_ORDER = "link.children_order";
public GenericOrganizationalUnitChildrenCollection(DataCollection dataCollection) {
super(dataCollection);
m_dataCollection.addOrder(ORDER);
//m_dataCollection.addOrder(ORDER);
}
public String getChildrenOrder() {
String retVal = ((BigDecimal) m_dataCollection.get(CHILDREN_ORDER)).toString();
String retVal = ((BigDecimal) m_dataCollection.get(ORDER)).toString();
if (retVal == null || retVal.isEmpty()) {
retVal = String.valueOf(this.getPosition());

View File

@ -1,6 +1,20 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* 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;
@ -9,8 +23,9 @@ import com.arsdigita.persistence.DataCollection;
import java.math.BigDecimal;
/**
* Collection class for the GenericOrganizationalUnit -> Contact relation.
*
* @author jensp
* @author Jens Pelzetter
*/
public class GenericOrganizationalUnitContactCollection extends DomainCollection {

View File

@ -1,3 +1,21 @@
/*
* 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;
import com.arsdigita.domain.DomainCollection;
@ -5,6 +23,7 @@ import com.arsdigita.persistence.DataCollection;
import java.math.BigDecimal;
/**
* Collection class for the GenericOrganizationalUnit -> Person relation.
*
* @author Jens Pelzetter
*/

View File

@ -1,3 +1,22 @@
/*
* 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.bebop.FormData;
@ -15,21 +34,28 @@ import com.arsdigita.cms.ui.authoring.BasicItemForm;
import org.apache.log4j.Logger;
/**
* Form for adding a child to an organization. To change the type of childs
* allowed, overwrite the {@link getChildDataObjectType()} method.
*
* @author Jens Pelzetter
*/
public class GenericOrganizationalUnitAddChildForm extends BasicItemForm {
public class GenericOrganizationalUnitChildAddForm extends BasicItemForm {
private static final Logger s_log = Logger.getLogger(
GenericOrganizationalUnitChildAddForm.class);
private GenericOrganizationalUnitChildrenPropertiesStep m_step;
private ItemSearchWidget m_itemSGenericOrganizationalUnitAddChildFormearch;
private ItemSearchWidget m_itemSearch;
private SaveCancelSection m_saveCancelSection;
private final String ITEM_SEARCH = "orgaunitChild";
private ItemSelectionModel m_itemModel;
public GenericOrganizationalUnitChildAddForm(ItemSelectionModel itemModel) {
super("ChildAddForm", itemModel);
this("ChildAddForm", itemModel);
}
public GenericOrganizationalUnitChildAddForm(String formName,
ItemSelectionModel itemModel) {
super(formName, itemModel);
}
@Override
@ -38,7 +64,7 @@ public class GenericOrganizationalUnitAddChildForm extends BasicItemForm {
"cms.contenttypes.ui.genericorgaunit.select_child").localize()));
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(
GenericOrganizationalUnit.BASE_DATA_OBJECT_TYPE));
getChildDataObjectType()));
add(this.m_itemSearch);
}
@ -64,4 +90,12 @@ public class GenericOrganizationalUnitAddChildForm extends BasicItemForm {
init(fse);
}
/**
*
* @return The BASE_DATA_OBJECT_TYPE of the childs allowed.
*/
protected String getChildDataObjectType() {
return GenericOrganizationalUnit.BASE_DATA_OBJECT_TYPE;
}
}

View File

@ -1,6 +1,21 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* 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;
@ -26,6 +41,7 @@ import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/**
* Table for showing the childs of an organization.
*
* @author Jens Pelzetter
*/

View File

@ -1,3 +1,22 @@
/*
* 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;
@ -8,8 +27,9 @@ import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
/**
* Step for editing the childs of an organization (other organizations).
*
* @author jensp
* @author Jens Pelzetter
*/
public class GenericOrganizationalUnitChildrenPropertiesStep extends SimpleEditStep {

View File

@ -1,6 +1,21 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* 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;
@ -29,6 +44,7 @@ import com.arsdigita.dispatcher.DispatcherHelper;
import org.apache.log4j.Logger;
/**
* Form for addings an related contact to an organization.
*
* @author Jens Pelzetter
*/
@ -74,6 +90,9 @@ public class GenericOrganizationalUnitContactAddForm extends BasicItemForm {
contactType.addOption(new Option(ct.getKey(), ct.getName()));
}
//Only for testing
contactType.addOption(new Option("commonContact", "Common Contact"));
add(contactType);
}

View File

@ -1,6 +1,21 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* 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;
@ -12,6 +27,7 @@ import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
/**
* Step for editing the associated contacts.
*
* @author Jens Pelzetter
*/

View File

@ -1,6 +1,21 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* 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;
@ -31,6 +46,7 @@ import java.math.BigDecimal;
import java.math.BigInteger;
/**
* Table for showing the contacts associated with an organization.
*
* @author Jens Pelzetter
*/

View File

@ -1,6 +1,21 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* 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;
@ -20,6 +35,7 @@ import com.arsdigita.cms.ui.authoring.BasicItemForm;
import org.apache.log4j.Logger;
/**
* Form for adding related persons the an organization.
*
* @author Jens Pelzetter
*/

View File

@ -1,3 +1,22 @@
/*
* 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;
@ -8,10 +27,12 @@ import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
/**
* Properties step for editing the persons related to an organization.
*
* @author Jens Pelzetter
*/
public class GenericOrganizationalUnitPersonPropertiesStep extends SimpleEditStep {
public class GenericOrganizationalUnitPersonPropertiesStep
extends SimpleEditStep {
private static final String ADD_PERSON_SHEET_NAME = "addPerson";

View File

@ -1,3 +1,22 @@
/*
* 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.bebop.Component;
@ -23,6 +42,7 @@ import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/**
* Table for showing the persons associated with an organization.
*
* @author Jens Pelzetter
*/

View File

@ -2,7 +2,6 @@
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component;
@ -24,71 +23,122 @@ import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import java.text.DateFormat;
/**
* PropertiesStep for GenericOrganizationalUnits. This properties step uses an
* SegmentedPanel to show all relevant data of an organization. To change the
* steps shown, extend this class, and overwrite the {@link addSteps()} method.
*
* @author Jens Pelzetter
*/
public class GenericOrganizationalUnitPropertiesStep extends SimpleEditStep {
public static final String EDIT_SHEET_NAME = "edit";
private SegmentedPanel segmentedPanel;
public GenericOrganizationalUnitPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
AuthoringKitWizard parent) {
super(itemModel, parent);
SegmentedPanel segmentedPanel = new SegmentedPanel();
segmentedPanel = new SegmentedPanel();
setDefaultEditKey(EDIT_SHEET_NAME);
SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
parent,
EDIT_SHEET_NAME);
BasicPageForm editBasicSheet =
new GenericOrganizationalUnitPropertyForm(itemModel, this);
basicProperties.add(EDIT_SHEET_NAME,
(String) ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.genericorgaunit.edit_basic_properties").localize(),
new WorkflowLockedComponentAccess(editBasicSheet, itemModel),
editBasicSheet.getSaveCancelSection().getCancelButton());
basicProperties.setDisplayComponent(getGenericOrganizationalUnitPropertySheet(itemModel));
segmentedPanel.addSegment(
new Label((String) ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.genericorganunit.basic_properties").localize()),
basicProperties);
addBasicProperties(itemModel, parent);
addSteps(itemModel, parent);
setDisplayComponent(segmentedPanel);
}
public static Component
getGenericOrganizationalUnitPropertySheet(
public static Component getGenericOrganizationalUnitPropertySheet(
ItemSelectionModel itemModel) {
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
itemModel);
sheet.add(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganunit.name"),
GenericOrganizationalUnit.NAME);
sheet.add(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.genericorganunit.addendum"),
GenericOrganizationalUnit.ADDENDUM);
sheet.add(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorganunit.name"),
GenericOrganizationalUnit.NAME);
sheet.add(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorganunit.addendum"),
GenericOrganizationalUnit.ADDENDUM);
if (!ContentSection.getConfig().getHideLaunchDate()) {
sheet.add((String) ContenttypesGlobalizationUtil.globalize("cms.ui.authoring.page_launch_date").localize(),
ContentPage.LAUNCH_DATE,
new DomainObjectPropertySheet.AttributeFormatter() {
sheet.add((String) ContenttypesGlobalizationUtil.globalize(
"cms.ui.authoring.page_launch_date").localize(),
ContentPage.LAUNCH_DATE,
new DomainObjectPropertySheet.AttributeFormatter() {
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());
} else {
return (String) ContenttypesGlobalizationUtil.globalize("cms.ui.unknown").localize();
}
}
});
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());
} else {
return (String) ContenttypesGlobalizationUtil.globalize(
"cms.ui.unknown").localize();
}
}
});
}
return sheet;
}
protected void addBasicProperties(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
parent,
EDIT_SHEET_NAME);
BasicPageForm editBasicSheet =
new GenericOrganizationalUnitPropertyForm(itemModel, this);
basicProperties.add(EDIT_SHEET_NAME,
(String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.edit_basic_properties").
localize(),
new WorkflowLockedComponentAccess(editBasicSheet,
itemModel),
editBasicSheet.getSaveCancelSection().
getCancelButton());
basicProperties.setDisplayComponent(getGenericOrganizationalUnitPropertySheet(
itemModel));
segmentedPanel.addSegment(
new Label((String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorganunit.basic_properties").
localize()),
basicProperties);
}
/**
* This method adds the steps for editing the relations of an organization.
* To change the steps, overwrite this method.
*
* @param itemModel
* @param parent
*/
protected void addSteps(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
parent),
"cms.contenttypes.ui.orgaunit.contact");
addStep(new GenericOrganizationalUnitChildrenPropertiesStep(itemModel,
parent),
"cms.contenttypes.ui.orgaunit.contact");
addStep(new GenericOrganizationalUnitPersonPropertiesStep(itemModel,
parent),
"cms.contenttypes.ui.orgaunit.persons");
}
/**
* Helper method for editing a step.
*
* @param step
* @param labelKey
*/
protected void addStep(SimpleEditStep step, String labelKey) {
segmentedPanel.addSegment(new Label((String) ContenttypesGlobalizationUtil.
globalize(labelKey).localize()),
step);
}
}

View File

@ -1,6 +1,21 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
* 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;
@ -12,7 +27,6 @@ import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormSubmissionListener;
import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.DateParameter;
import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel;
@ -22,6 +36,7 @@ import com.arsdigita.cms.ui.authoring.BasicPageForm;
import org.apache.log4j.Logger;
/**
* Form for editing the basic properties of an GenericOrganizationalUnit.
*
* @author Jens Pelzetter
*/