From cbc5154f03b236b8686b2ef822150bc8526e7743 Mon Sep 17 00:00:00 2001 From: jensp Date: Mon, 11 Oct 2010 14:57:04 +0000 Subject: [PATCH] Modul ccm-sci-types-organization: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Steps und Forms Description für SciOrganization und SciDepartment - Steps und Forms für SuperProject in SciProject - Steps und Forms für SuperDepartment und Organization in SciDepartment - Alle Steps für Verknüpfungen zwischen SciOrganization, SciDepartment und SciProject sind über die Configuration ausblendbar - Für alle Beschriebungsfelder kann der DHTML-Editor abgeschaltet werden - Verschiedene Korrekturen an den PDL-Dateien git-svn-id: https://svn.libreccm.org/ccm/trunk@570 8810af33-2d31-482b-a856-94f89814c4df --- .../arsdigita/content-types/SciDepartment.pdl | 5 +- .../content-types/SciOrganization.pdl | 4 +- .../cms/contenttypes/SciDepartment.xml | 8 + .../cms/contenttypes/SciOrganization.xml | 7 + .../cms/contenttypes/SciDepartment.java | 80 +++++++ .../cms/contenttypes/SciOrganization.java | 22 +- .../contenttypes/SciOrganizationConfig.java | 205 +++++++++++++++++- ...SciOrganizationConfig_parameter.properties | 100 ++++++++- .../ui/SciDepartmentDescriptionEditForm.java | 80 +++++++ .../ui/SciDepartmentDescriptionStep.java | 63 ++++++ .../SciDepartmentDescriptionUploadForm.java | 39 ++++ .../ui/SciDepartmentOrganizationForm.java | 63 ++++++ .../ui/SciDepartmentOrganizationSheet.java | 205 ++++++++++++++++++ .../ui/SciDepartmentOrganizationStep.java | 41 ++++ .../ui/SciDepartmentPropertiesStep.java | 41 +++- .../ui/SciDepartmentPropertyForm.java | 16 +- .../ui/SciDepartmentSuperDepartmentForm.java | 65 ++++++ .../ui/SciDepartmentSuperDepartmentSheet.java | 205 ++++++++++++++++++ .../ui/SciDepartmentSuperDepartmentStep.java | 43 ++++ .../SciOrganizationDescriptionEditForm.java | 81 +++++++ .../ui/SciOrganizationDescriptionStep.java | 62 ++++++ .../SciOrganizationDescriptionUploadForm.java | 40 ++++ .../ui/SciOrganizationPropertiesStep.java | 31 ++- .../ui/SciOrganizationPropertyForm.java | 16 +- .../ui/SciProjectDescriptionEditForm.java | 10 +- .../ui/SciProjectDescriptionStep.java | 10 +- .../ui/SciProjectDescriptionUploadForm.java | 3 +- .../ui/SciProjectPropertiesStep.java | 52 +++-- ...ava => SciProjectSuperProjectSetForm.java} | 14 +- .../ui/SciProjectSuperProjectSheet.java | 5 +- .../ui/SciProjectSuperProjectStep.java | 14 +- 31 files changed, 1539 insertions(+), 91 deletions(-) create mode 100644 ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionEditForm.java create mode 100644 ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionStep.java create mode 100644 ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionUploadForm.java create mode 100644 ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationForm.java create mode 100644 ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationSheet.java create mode 100644 ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationStep.java create mode 100644 ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentForm.java create mode 100644 ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentSheet.java create mode 100644 ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentStep.java create mode 100644 ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionEditForm.java create mode 100644 ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionStep.java create mode 100644 ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionUploadForm.java rename ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/{SciProjectSuperProjectAttachForm.java => SciProjectSuperProjectSetForm.java} (82%) diff --git a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciDepartment.pdl b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciDepartment.pdl index ec4b5189b..ff86d7b3d 100644 --- a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciDepartment.pdl +++ b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciDepartment.pdl @@ -4,13 +4,14 @@ import com.arsdigita.kernel.ACSObject; import com.arsdigita.cms.*; object type SciDepartment extends GenericOrganizationalUnit { - String[0..1] departmentDescription = ct_sciorga_departments.description VARCHAR(4096); + String[0..1] departmentShortDescription = ct_sciorga_departments.shortdescription VARCHAR(500); + String[0..1] departmentDescription = ct_sciorga_departments.description CLOB; reference key ( ct_sciorga_departments.department_id ); } association { - SciDepartment[0..n] department = join ct_sciorga_departments.department_id + SciDepartment[0..n] superDepartment = join ct_sciorga_departments.department_id to ct_sciorga_departments_subdepartments_map.subdepartment_id, join ct_sciorga_departments_subdepartments_map.department_id to ct_sciorga_departments.department_id; diff --git a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciOrganization.pdl b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciOrganization.pdl index cfbc41435..1d801c527 100644 --- a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciOrganization.pdl +++ b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciOrganization.pdl @@ -4,7 +4,9 @@ import com.arsdigita.kernel.ACSObject; import com.arsdigita.cms.*; object type SciOrganization extends GenericOrganizationalUnit { - String[0..1] organizationDescription = ct_sciorga_organizations.description VARCHAR(4096); + + String[0..1] organizationShortDescription = ct_sciorga_organizations.shortdescription VARCHAR(500); + String[0..1] organizationDescription = ct_sciorga_organizations.description CLOB; reference key ( ct_sciorga_organizations.organization_id ); } diff --git a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml b/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml index ebca06dad..55ad11950 100644 --- a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml +++ b/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml @@ -20,6 +20,14 @@ component="com.arsdigita.cms.contenttypes.ui.SciDepartmentPropertiesStep" ordering="1"/> + + + diff --git a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xml b/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xml index bd9fafd66..a872d6722 100644 --- a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xml +++ b/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xml @@ -20,6 +20,13 @@ component="com.arsdigita.cms.contenttypes.ui.SciOrganizationPropertiesStep" ordering="1"/> + + diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartment.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartment.java index 0a931d11a..e5ed0b84f 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartment.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartment.java @@ -13,13 +13,23 @@ import java.math.BigDecimal; */ public class SciDepartment extends GenericOrganizationalUnit { + public static final String DEPARTMENT_SHORT_DESCRIPTION = + "departmentShortDescription"; public static final String DEPARTMENT_DESCRIPTION = "departmentDescription"; + public static final String ORGANIZATION = "organization"; + public static final String SUPER_DEPARTMENT = "superDepartment"; public static final String SUBDEPARTMENTS = "subDepartments"; public static final String SUBDEPARTMENT_ORDER = "subDepartmentOrder"; public static final String PROJECTS = "projects"; public static final String PROJECT_ORDER = "projectOrder"; public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.SciDepartment"; + private static final SciOrganizationConfig s_config = + new SciOrganizationConfig(); + + static { + s_config.load(); + } public SciDepartment() { this(BASE_DATA_OBJECT_TYPE); @@ -41,6 +51,18 @@ public class SciDepartment extends GenericOrganizationalUnit { super(type); } + public static final SciOrganizationConfig getConfig() { + return s_config; + } + + public String getDepartmentShortDescription() { + return (String) get(DEPARTMENT_SHORT_DESCRIPTION); + } + + public void setDepartmentShortDescription(String description) { + set(DEPARTMENT_SHORT_DESCRIPTION, description); + } + public String getDepartmentDescription() { return (String) get(DEPARTMENT_DESCRIPTION); } @@ -49,6 +71,64 @@ public class SciDepartment extends GenericOrganizationalUnit { set(DEPARTMENT_DESCRIPTION, description); } + public SciDepartment getSuperDepartment() { + DataCollection collection; + + collection = (DataCollection) get(SUPER_DEPARTMENT); + + if (0 == collection.size()) { + return null; + } else { + DataObject dobj; + + collection.next(); + dobj = collection.getDataObject(); + + return new SciDepartment(dobj); + } + } + + public void setSuperDepartment(SciDepartment department) { + SciDepartment oldSuperDepartment; + + oldSuperDepartment = getSuperDepartment(); + remove(SUPER_DEPARTMENT, oldSuperDepartment); + + if (null != department) { + Assert.exists(department, SciDepartment.class); + add(SUPER_DEPARTMENT, department); + } + } + + public SciOrganization getOrganization() { + DataCollection collection; + + collection = (DataCollection) get(ORGANIZATION); + + if (0 == collection.size()) { + return null; + } else { + DataObject dobj; + + collection.next(); + dobj = collection.getDataObject(); + + return new SciOrganization(dobj); + } + } + + public void setOrganization(SciOrganization orga) { + SciOrganization oldOrganization; + + oldOrganization = getOrganization(); + remove(ORGANIZATION, oldOrganization); + + if (null != orga) { + Assert.exists(orga, SciOrganization.class); + add(ORGANIZATION, orga); + } + } + public SciDepartmentSubDepartmentsCollection getSubDepartments() { return new SciDepartmentSubDepartmentsCollection( (DataCollection) get(SUBDEPARTMENTS)); diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java index 377a8b11e..fbe26a31a 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java @@ -13,14 +13,22 @@ import java.math.BigDecimal; */ public class SciOrganization extends GenericOrganizationalUnit { + public static final String ORGANIZATION_SHORT_DESCRIPTION = + "organizationShortDescription"; public static final String ORGANIZATION_DESCRIPTION = "organizationDescription"; public static final String DEPARTMENTS = "departments"; public static final String DEPARTMENT_ORDER = "departmentOrder"; - public static final String PROJECTS ="projects"; + public static final String PROJECTS = "projects"; public static final String PROJECT_ORDER = "projectOrder"; public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.SciOrganization"; + private static final SciOrganizationConfig s_config = + new SciOrganizationConfig(); + + static { + s_config.load(); + } public SciOrganization() { this(BASE_DATA_OBJECT_TYPE); @@ -42,6 +50,18 @@ public class SciOrganization extends GenericOrganizationalUnit { super(type); } + public static final SciOrganizationConfig getConfig() { + return s_config; + } + + public String getOrganizationShortDescription() { + return (String) get(ORGANIZATION_SHORT_DESCRIPTION); + } + + public void setOrganizationShortDescription(String description) { + set(ORGANIZATION_SHORT_DESCRIPTION, description); + } + public String getOrganizationDescription() { return (String) get(ORGANIZATION_DESCRIPTION); } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig.java index e1647c690..330e25218 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig.java @@ -10,12 +10,108 @@ import com.arsdigita.util.parameter.Parameter; */ public class SciOrganizationConfig extends AbstractConfig { + private final Parameter m_organizationAddPersonHide; + private final Parameter m_organizationAddDepartmentHide; + private final Parameter m_organizationAddProjectHide; + private final Parameter m_organizationAddContactHide; + private final Parameter m_departmentAddPersonHide; + private final Parameter m_departmentAddSubDepartmentHide; + private final Parameter m_departmentAddProjectHide; + private final Parameter m_departmentSetOrganizationHide; + private final Parameter m_departmentSetSuperDepartmentHide; + private final Parameter m_departmentAddContactHide; + private final Parameter m_projectAddPersonHide; + private final Parameter m_projectAddOrganizationHide; + private final Parameter m_projectAddDepartmentHide; + private final Parameter m_projectAddSubProjectHide; + private final Parameter m_projectSetSuperProjectHide; + private final Parameter m_projectAddContactHide; + private final Parameter m_organizationDescriptionDhtml; + private final Parameter m_departmentDescriptionDhtml; + private final Parameter m_projectDescriptionDhtml; private final Parameter m_projectFundingHide; private final Parameter m_projectFundingDhtml; private final Parameter m_projectMaterialsHide; - private final Parameter m_organizationPersonsHide; public SciOrganizationConfig() { + + m_organizationAddPersonHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciorganization.add_person_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_organizationAddDepartmentHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciorganization.add_department_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_organizationAddProjectHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciorganization.add_project_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_organizationAddContactHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciorganization.add_contact_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_departmentAddPersonHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.add_person_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_departmentAddSubDepartmentHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.add_subdepartment_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_departmentAddProjectHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.add_project_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_departmentSetOrganizationHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.organization_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_departmentSetSuperDepartmentHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.set_superdepartment_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_departmentAddContactHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.add_contact_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_projectAddPersonHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.add_person_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_projectAddOrganizationHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.add_organization_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_projectAddDepartmentHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.add_department_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_projectAddSubProjectHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.add_subproject_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_projectSetSuperProjectHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.set_superproject_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_projectAddContactHide = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciorganization.add_project_hide", + Parameter.REQUIRED, + Boolean.FALSE); + m_organizationDescriptionDhtml = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciorganization.description_dhtml", + Parameter.REQUIRED, + Boolean.TRUE); + m_departmentDescriptionDhtml = new BooleanParameter( + "com.arsdigita.cms.contenttypes.scidepartment.description_dhtml", + Parameter.REQUIRED, + Boolean.TRUE); + m_projectDescriptionDhtml = new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.description_dhtml", + Parameter.REQUIRED, + Boolean.TRUE); + m_projectFundingHide = new BooleanParameter( "com.arsdigita.cms.contenttypes.sciproject.funding_hide", Parameter.REQUIRED, @@ -28,32 +124,119 @@ public class SciOrganizationConfig extends AbstractConfig { "com.arsdigita.cms.contenttypes.sciproject.materials_hide", Parameter.REQUIRED, Boolean.FALSE); - m_organizationPersonsHide = new BooleanParameter( - "com.arsdigita.cms.contenttypes.sciorganization.persons_hide", - Parameter.REQUIRED, - Boolean.TRUE); + + register(m_organizationAddPersonHide); + register(m_organizationAddDepartmentHide); + register(m_organizationAddProjectHide); + register(m_departmentAddPersonHide); + register(m_departmentAddSubDepartmentHide); + register(m_departmentAddProjectHide); + register(m_departmentSetOrganizationHide); + register(m_departmentSetSuperDepartmentHide); + register(m_projectAddPersonHide); + register(m_projectAddOrganizationHide); + register(m_projectAddDepartmentHide); + register(m_projectAddSubProjectHide); + register(m_projectSetSuperProjectHide); + register(m_organizationDescriptionDhtml); + register(m_departmentDescriptionDhtml); + register(m_projectDescriptionDhtml); + register(m_organizationAddContactHide); + register(m_departmentAddContactHide); + register(m_projectAddContactHide); register(m_projectFundingHide); register(m_projectFundingDhtml); register(m_projectMaterialsHide); - register(m_organizationPersonsHide); loadInfo(); } + public final boolean getOrganizationAddPersonHide() { + return (Boolean) get(m_organizationAddPersonHide); + } + + public final boolean getOrganizationAddDepartmentHide() { + return (Boolean) get(m_organizationAddDepartmentHide); + } + + public final boolean getOrganizationAddProjectHide() { + return (Boolean) get(m_organizationAddProjectHide); + } + + public final boolean getOrganizationAddContactHide() { + return (Boolean) get(m_organizationAddContactHide); + } + + public final boolean getDepartmentAddPersonHide() { + return (Boolean) get(m_departmentAddPersonHide); + } + + public final boolean getDepartmentAddSubDepartmentHide() { + return (Boolean) get(m_departmentAddSubDepartmentHide); + } + + public final boolean getDepartmentAddProjectHide() { + return (Boolean) get(m_departmentAddProjectHide); + } + + public final boolean getDepartmentSetOrganizationHide() { + return (Boolean) get(m_departmentSetOrganizationHide); + } + + public final boolean getDepartmentSetSuperDepartmentHide() { + return (Boolean) get(m_departmentSetSuperDepartmentHide); + } + + public final boolean getDepartmentAddContactHide() { + return (Boolean) get(m_departmentAddContactHide); + } + + public final boolean getProjectAddPersonHide() { + return (Boolean) get(m_projectAddPersonHide); + } + + public final boolean getProjectAddOrganizationHide() { + return (Boolean) get(m_projectAddOrganizationHide); + } + + public final boolean getProjectAddDepartmentHide() { + return (Boolean) get(m_projectAddDepartmentHide); + } + + public final boolean getProjectAddSubProjectHide() { + return (Boolean) get(m_projectAddSubProjectHide); + } + + public final boolean getProjectSetSuperProjectHide() { + return (Boolean) get(m_projectSetSuperProjectHide); + } + + public final boolean getProjectAddContactHide() { + return (Boolean) get(m_projectAddContactHide); + } + + public final boolean getOrganizationDescriptionDhtml() { + return (Boolean) get(m_organizationDescriptionDhtml); + } + + public final boolean getDepartmentDescriptionDhtml() { + return (Boolean) get(m_departmentDescriptionDhtml); + } + + public final boolean getProjectDescriptionDhtml() { + return (Boolean) get(m_projectDescriptionDhtml); + } + public final boolean getProjectFundingHide() { return (Boolean) get(m_projectFundingHide); } - public final boolean getProjectFundingDhtml() { + public final boolean getProjectFundingDhtml() { return (Boolean) get(m_projectFundingDhtml); } public final boolean getProjectMaterialsHide() { return (Boolean) get(m_projectMaterialsHide); } - - public final boolean getOrganizationPersonsHide() { - return (Boolean) get(m_organizationPersonsHide); - } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig_parameter.properties b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig_parameter.properties index 828016a48..45451ca62 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig_parameter.properties +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig_parameter.properties @@ -1,10 +1,100 @@ +com.arsdigita.cms.contenttypes.sciorganization.add_person_hide.title = Hide the persons add step of SciOrganization +com.arsdigita.cms.contenttypes.sciorganization.add_person_hide.purpose = Hide the persons add step of SciOrganization +com.arsdigita.cms.contenttypes.sciorganization.add_person_hide.example = false +com.arsdigita.cms.contenttypes.sciorganization.add_person_hide.format = [boolean] + +com.arsdigita.cms.contenttypes.sciorganization.add_department_hide.title = Hide the department add step of SciOrganization +com.arsdigita.cms.contenttypes.sciorganization.add_department_hide.purpose = Hide the department add step of SciOrganization +com.arsdigita.cms.contenttypes.sciorganization.add_department_hide.example = false +com.arsdigita.cms.contenttypes.sciorganization.add_department_hide.format = [boolean] + +com.arsdigita.cms.contenttypes.sciorganization.add_project_hide.title = Hide the project add step of SciOrganization +com.arsdigita.cms.contenttypes.sciorganization.add_project_hide.purpose = Hide the project add step of SciOrganization +com.arsdigita.cms.contenttypes.sciorganization.add_project_hide.example = false +com.arsdigita.cms.contenttypes.sciorganization.add_project_hide.format = [boolean] + +com.arsdigita.cms.contenttypes.sciorganization.add_contact_hide.title = Hide the contact add step of SciOrganization +com.arsdigita.cms.contenttypes.sciorganization.add_contact_hide.purpose = Hide the contact add step of SciOrganization +com.arsdigita.cms.contenttypes.sciorganization.add_contact_hide.example = false +com.arsdigita.cms.contenttypes.sciorganization.add_contact_hide.format = [boolean] + +com.arsdigita.cms.contenttypes.scidepartment.add_person_hide.title = Hide the person add step of SciDepartment +com.arsdigita.cms.contenttypes.scidepartment.add_person_hide.purpose = Hide the person add step of SciDepartment +com.arsdigita.cms.contenttypes.scidepartment.add_person_hide.example = false +com.arsdigita.cms.contenttypes.scidepartment.add_person_hide.format = [boolean] + +com.arsdigita.cms.contenttypes.scidepartment.add_subdepartment_hide.title = Hide the subdepartment add step of SciDepartment +com.arsdigita.cms.contenttypes.scidepartment.add_subdepartment_hide.purpose = Hide the subdepartment add step of SciDepartment +com.arsdigita.cms.contenttypes.scidepartment.add_subdepartment_hide.example = false +com.arsdigita.cms.contenttypes.scidepartment.add_subdepartment_hide.format = [boolean] + +com.arsdigita.cms.contenttypes.scidepartment.set_organization_hide.title = Hide the organization set step of SciDepartment +com.arsdigita.cms.contenttypes.scidepartment.set_organization_hide.purpose = Hide the organization set step of SciDepartment +com.arsdigita.cms.contenttypes.scidepartment.set_organization_hide.example = false +com.arsdigita.cms.contenttypes.scidepartment.set_organization_hide.format = [boolean] + +com.arsdigita.cms.contenttypes.scidepartment.set_superdepartment_hide.title = Hide the superdepartment set step of SciDepartment +com.arsdigita.cms.contenttypes.scidepartment.set_superdepartment_hide.purpose = Hide the superdepartment set step of SciDepartment +com.arsdigita.cms.contenttypes.scidepartment.set_superdepartment_hide.example = false +com.arsdigita.cms.contenttypes.scidepartment.set_superdepartment_hide.format = [boolean] + +com.arsdigita.cms.contenttypes.scidepartment.add_contact_hide.title = Hide the contact add step of Scidepartment +com.arsdigita.cms.contenttypes.scidepartment.add_contact_hide.purpose = Hide the contact add step of Scidepartment +com.arsdigita.cms.contenttypes.scidepartment.add_contact_hide.example = false +com.arsdigita.cms.contenttypes.scidepartment.add_contact_hide.format = [boolean] + +com.arsdigita.cms.contenttypes.sciproject.add_person_hide.title = Hide the person add step of SciProject +com.arsdigita.cms.contenttypes.sciproject.add_person_hide.purpose = Hide the person add step of SciProject +com.arsdigita.cms.contenttypes.sciproject.add_person_hide.example = false +com.arsdigita.cms.contenttypes.sciproject.add_person_hide.format = [boolean] + +com.arsdigita.cms.contenttypes.sciproject.add_organization_hide.title = Hide the organization add step of SciProject +com.arsdigita.cms.contenttypes.sciproject.add_organization_hide.purpose = Hide the organization add step of SciProject +com.arsdigita.cms.contenttypes.sciproject.add_organization_hide.example = false +com.arsdigita.cms.contenttypes.sciproject.add_organization_hide.format = [boolean] + +com.arsdigita.cms.contenttypes.sciproject.add_department_hide.title = Hide the department add step of SciProject +com.arsdigita.cms.contenttypes.sciproject.add_department_hide.purpose Hide the department add step of SciProject +com.arsdigita.cms.contenttypes.sciproject.add_department_hide.example = false +com.arsdigita.cms.contenttypes.sciproject.add_department_hide = [boolean] + +com.arsdigita.cms.contenttypes.sciproject.add_subproject_hide.title = Hide the subproject add step of SciProject +com.arsdigita.cms.contenttypes.sciproject.add_subproject_hide.purpose = Hide the subproject add step of SciProject +com.arsdigita.cms.contenttypes.sciproject.add_subproject_hide.example = false +com.arsdigita.cms.contenttypes.sciproject.add_subproject_hide.format = [boolean] + +com.arsdigita.cms.contenttypes.sciproject.set_superproject_hide.title = Hide the superproject add step of SciProject +com.arsdigita.cms.contenttypes.sciproject.set_superproject_hide.purpose = Hide the superprojecft add step of SciProject +com.arsdigita.cms.contenttypes.sciproject.set_superproject_hide.example = false +com.arsdigita.cms.contenttypes.sciproject.set_superproject_hide.format = [boolean] + +com.arsdigita.cms.contenttypes.sciorganization.description_dhtml.title = Toggles the DHTML for the description of SciOrganization +com.arsdigita.cms.contenttypes.sciorganization.description_dhtml.purpose = Toggles the DHTML for the description of SciOrganization +com.arsdigita.cms.contenttypes.sciorganization.description_dhtml.example = true +com.arsdigita.cms.contenttypes.sciorganization.description_dhtml.format = [boolean] + +com.arsdigita.cms.contenttypes.scidepartment.description_dhtml.title = Toggles the DHTML for the description of SciDepartment +com.arsdigita.cms.contenttypes.scidepartment.description_dhtml.purpose = Toggles the DHTML for the description of SciDepartment +com.arsdigita.cms.contenttypes.scidepartment.description_dhtml.example = true +com.arsdigita.cms.contenttypes.scidepartment.description_dhtml = [boolean] + +com.arsdigita.cms.contenttypes.sciproject.description_dhtml.title = Toggles the DHTML for the description of SciProject +com.arsdigita.cms.contenttypes.sciproject.description_dhtml.purpose = Toggles the DHTML for the description of SciProject +com.arsdigita.cms.contenttypes.sciproject.description_dhtml.example = true +com.arsdigita.cms.contenttypes.sciproject.description_dhtml.format = [boolean] + +com.arsdigita.cms.contenttypes.sciproject.add_contact_hide.title = Hide the contact add step of Sciproject +com.arsdigita.cms.contenttypes.sciproject.add_contact_hide.purpose = Hide the contact add step of Sciproject +com.arsdigita.cms.contenttypes.sciproject.add_contact_hide.example = false +com.arsdigita.cms.contenttypes.sciproject.add_contact_hide.format = [boolean] + com.arsdigita.cms.contenttypes.sciproject.funding_hide.title = Hide funding text input com.arsdigita.cms.contenttypes.sciproject.funding_hide.purpose = Hide the funding text inpu -com.arsdigita.cms.contenttypes.sciproject.funding_hide.example = false +com.arsdigita.cms.contenttypes.sciproject.funding_hide.example = true com.arsdigita.cms.contenttypes.sciproject.funding_hide.format = [boolean] -com.arsdigita.cms.contenttypes.sciproject.funding_dhtml.title = Toggles the DHTML for funding -com.arsdigita.cms.contenttypes.sciproject.funding_dhtml.purpose = Toggles the DHTML editor +com.arsdigita.cms.contenttypes.sciproject.funding_dhtml.title = Toggles the DHTML editor for funding +com.arsdigita.cms.contenttypes.sciproject.funding_dhtml.purpose = Toggles the DHTML editor for funding com.arsdigita.cms.contenttypes.sciproject.funding_dhtml.example = false com.arsdigita.cms.contenttypes.sciproject.funding_dhtml.format = [boolean] @@ -13,7 +103,3 @@ com.arsdigita.cms.contenttypes.sciproject.materials_hide.purpose = Hides the ste com.arsdigita.cms.contenttypes.sciproject.materials_hide.example = false com.arsdigita.cms.contenttypes.sciproject.materials_hide.format = [boolean] -com.arsdigita.cms.contenttypes.sciorganization.persons_hide.title = Hides the persons step for SciOrganization -com.arsdigita.cms.contenttypes.sciorganization.persons_hide.purpose = Hides the persons step for SciOrganization -com.arsdigita.cms.contenttypes.sciorganization.persons_hide.example = true -com.arsdigita.cms.contenttypes.sciorganization.persons_hide.format = [boolean] diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionEditForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionEditForm.java new file mode 100644 index 000000000..8d4f7399a --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionEditForm.java @@ -0,0 +1,80 @@ +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.event.FormInitListener; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.form.TextArea; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciDepartment; +import com.arsdigita.cms.ui.CMSDHTMLEditor; +import com.arsdigita.cms.ui.authoring.BasicItemForm; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentDescriptionEditForm + extends BasicItemForm + implements FormProcessListener, + FormInitListener { + + public SciDepartmentDescriptionEditForm(ItemSelectionModel itemModel) { + super("scidepartmentEditDescForm", itemModel); + } + + @Override + protected void addWidgets() { + add(new Label(SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.description"))); + ParameterModel descParam = new StringParameter( + SciDepartment.DEPARTMENT_DESCRIPTION); + TextArea desc; + if (SciDepartment.getConfig().getDepartmentDescriptionDhtml()) { + desc = new CMSDHTMLEditor(descParam); + } else { + desc = new TextArea(descParam); + } + desc.setCols(75); + desc.setRows(25); + add(desc); + } + + @Override + public void init(FormSectionEvent fse) throws FormProcessException { + PageState state = fse.getPageState(); + + FormData data = fse.getFormData(); + SciDepartment department = (SciDepartment) getItemSelectionModel(). + getSelectedObject(state); + + data.put(SciDepartment.DEPARTMENT_DESCRIPTION, + department.getDepartmentDescription()); + + setVisible(state, true); + } + + @Override + public void process(FormSectionEvent fse) throws FormProcessException { + PageState state = fse.getPageState(); + + FormData data = fse.getFormData(); + SciDepartment department = (SciDepartment) getItemSelectionModel(). + getSelectedObject(state); + + if ((department != null) && getSaveCancelSection().getSaveButton(). + isSelected(state)) { + department.setDepartmentDescription((String) data.get( + SciDepartment.DEPARTMENT_DESCRIPTION)); + + department.save(); + + init(fse); + } + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionStep.java new file mode 100644 index 000000000..b49dc57c6 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionStep.java @@ -0,0 +1,63 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciDepartment; +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 com.arsdigita.toolbox.ui.DomainObjectPropertySheet; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentDescriptionStep extends SimpleEditStep { + + private String EDIT_DEPARTMENT_DESC_SHEET_NAME = "editDepartmentDesc"; + private String UPLOAD_DEPARTMENT_DESC_SHEET_NAME = "uploadDepartmentDesc"; + + public SciDepartmentDescriptionStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent) { + this(itemModel, parent, null); + } + + public SciDepartmentDescriptionStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent, + String prefix) { + super(itemModel, parent, prefix); + + BasicItemForm editDescForm = + new SciDepartmentDescriptionEditForm(itemModel); + add(EDIT_DEPARTMENT_DESC_SHEET_NAME, + (String) SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.edit_desc").localize(), + new WorkflowLockedComponentAccess(editDescForm, itemModel), + editDescForm.getSaveCancelSection().getCancelButton()); + + SciDepartmentDescriptionUploadForm uploadDescForm = + new SciDepartmentDescriptionUploadForm( + itemModel); + add(UPLOAD_DEPARTMENT_DESC_SHEET_NAME, + (String) SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.upload_desc").localize(), + new WorkflowLockedComponentAccess(uploadDescForm, itemModel), + uploadDescForm.getSaveCancelSection().getCancelButton()); + + setDisplayComponent( + getSciDepartmentDescSheet(itemModel)); + } + + public static Component getSciDepartmentDescSheet( + ItemSelectionModel itemModel) { + DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( + itemModel); + + sheet.add(SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.desc"), + SciDepartment.DEPARTMENT_DESCRIPTION); + + return sheet; + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionUploadForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionUploadForm.java new file mode 100644 index 000000000..4f4ca3c64 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionUploadForm.java @@ -0,0 +1,39 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciDepartment; +import com.arsdigita.globalization.GlobalizedMessage; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentDescriptionUploadForm extends AbstractTextUploadForm { + + public SciDepartmentDescriptionUploadForm(ItemSelectionModel itemModel) { + super(itemModel); + } + + @Override + public GlobalizedMessage getLabelText() { + return SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.description.upload"); + } + + @Override + public GlobalizedMessage getMimeTypeLabel() { + return SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.description.upload.mimetype"); + } + + @Override + public void setText(ItemSelectionModel itemModel, + PageState state, + String text) { + SciDepartment department = (SciDepartment) itemModel.getSelectedObject( + state); + department.setDepartmentDescription(text); + department.save(); + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationForm.java new file mode 100644 index 000000000..5dfc355a1 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationForm.java @@ -0,0 +1,63 @@ +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.event.FormInitListener; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.cms.ContentType; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciDepartment; +import com.arsdigita.cms.contenttypes.SciOrganization; +import com.arsdigita.cms.ui.ItemSearchWidget; +import com.arsdigita.cms.ui.authoring.BasicItemForm; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentOrganizationForm + extends BasicItemForm + implements FormProcessListener, + FormInitListener { + + private ItemSearchWidget m_itemSearch; + private final String ITEM_SEARCH = "departmentOrga"; + + public SciDepartmentOrganizationForm(ItemSelectionModel itemModel) { + super("DepartmentOrganizationForm", itemModel); + } + + @Override + protected void addWidgets() { + add(new Label(SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.select_organization"))); + m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, + ContentType. + findByAssociatedObjectType(SciOrganization.class.getName())); + add(m_itemSearch); + } + + @Override + public void init(FormSectionEvent fse) throws FormProcessException { + PageState state = fse.getPageState(); + + setVisible(state, true); + } + + @Override + public void process(FormSectionEvent fse) throws FormProcessException { + FormData data = fse.getFormData(); + PageState state = fse.getPageState(); + SciDepartment department = (SciDepartment) getItemSelectionModel(). + getSelectedObject(state); + + if (this.getSaveCancelSection().getSaveButton().isSelected(state)) { + department.setOrganization((SciOrganization) data.get(ITEM_SEARCH)); + + init(fse); + } + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationSheet.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationSheet.java new file mode 100644 index 000000000..ab0b3893d --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationSheet.java @@ -0,0 +1,205 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.ControlLink; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.Table; +import com.arsdigita.bebop.event.TableActionEvent; +import com.arsdigita.bebop.event.TableActionListener; +import com.arsdigita.bebop.table.TableCellRenderer; +import com.arsdigita.bebop.table.TableColumn; +import com.arsdigita.bebop.table.TableColumnModel; +import com.arsdigita.bebop.table.TableModel; +import com.arsdigita.bebop.table.TableModelBuilder; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.SecurityManager; +import com.arsdigita.cms.contenttypes.SciDepartment; +import com.arsdigita.cms.contenttypes.SciOrganization; +import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.util.LockableImpl; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentOrganizationSheet + extends Table + implements TableActionListener { + + private final String TABLE_COL_EDIT = "table_col_edit"; + private final String TABLE_COL_DEL = "table_col_del"; + private ItemSelectionModel m_itemModel; + + public SciDepartmentOrganizationSheet(ItemSelectionModel itemModel) { + super(); + m_itemModel = itemModel; + + setEmptyView( + new Label(SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.organization_none"))); + + TableColumnModel colModel = getColumnModel(); + colModel.add(new TableColumn( + 0, + SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.organization").localize(), + TABLE_COL_EDIT)); + colModel.add(new TableColumn( + 1, + SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.organization.remove").localize(), + TABLE_COL_DEL)); + + setModelBuilder( + new SciDepartmentOrganizationSheetModelBuilder(itemModel)); + colModel.get(0).setCellRenderer(new EditCellRenderer()); + colModel.get(1).setCellRenderer(new DeleteCellRenderer()); + + addTableActionListener(this); + } + + private class SciDepartmentOrganizationSheetModelBuilder + extends LockableImpl + implements TableModelBuilder { + + private ItemSelectionModel m_itemModel; + + public SciDepartmentOrganizationSheetModelBuilder( + ItemSelectionModel itemModel) { + m_itemModel = itemModel; + } + + @Override + public TableModel makeModel(Table table, PageState state) { + table.getRowSelectionModel().clearSelection(state); + SciDepartment department = (SciDepartment) m_itemModel. + getSelectedObject(state); + return new SciDepartmentOrganizationSheetModel(table, + state, + department); + } + } + + private class SciDepartmentOrganizationSheetModel + implements TableModel { + + private Table m_table; + private SciOrganization m_orga; + + public SciDepartmentOrganizationSheetModel(Table table, + PageState state, + SciDepartment department) { + m_table = table; + m_orga = department.getOrganization(); + } + + public int getColumnCount() { + return m_table.getColumnModel().size(); + } + + public boolean nextRow() { + boolean ret; + + if (null == m_orga) { + ret = false; + } else { + ret = true; + m_orga = null; + } + + return ret; + } + + public Object getElementAt(int columnIndex) { + switch (columnIndex) { + case 0: + return m_orga.getTitle(); + case 1: + return SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.departemnt.organzation.remove"); + default: + return null; + } + } + + public Object getKeyAt(int columnIndex) { + return m_orga.getID(); + } + } + + private class EditCellRenderer + extends LockableImpl + implements TableCellRenderer { + + @Override + public Component getComponent(Table table, + PageState state, + Object value, + boolean isSelected, + Object key, + int row, + int column) { + Label label = new Label(value.toString()); + return label; + } + } + + private class DeleteCellRenderer + extends LockableImpl + implements TableCellRenderer { + + @Override + public Component getComponent(Table table, + PageState state, + Object value, + boolean isSelected, + Object key, + int row, + int col) { + SecurityManager securityManager = + Utilities.getSecurityManager(state); + SciDepartment project = (SciDepartment) m_itemModel. + getSelectedObject( + state); + + boolean canEdit = securityManager.canAccess( + state.getRequest(), + SecurityManager.DELETE_ITEM, + project); + + if (canEdit) { + ControlLink link = new ControlLink(value.toString()); + link.setConfirmation((String) SciOrganizationGlobalizationUtil. + globalize( + "sciorganization.ui.department.organization." + + ".confirm_remove"). + localize()); + return link; + } else { + Label label = new Label(value.toString()); + return label; + } + } + } + + @Override + public void cellSelected(TableActionEvent event) { + PageState state = event.getPageState(); + + SciDepartment department = (SciDepartment) m_itemModel.getSelectedObject( + state); + + TableColumn column = getColumnModel().get(event.getColumn().intValue()); + + if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) { + } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) { + department.setOrganization(null); + } + } + + @Override + public void headSelected(TableActionEvent event) { + //Nothing to do + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationStep.java new file mode 100644 index 000000000..34c6fc27d --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationStep.java @@ -0,0 +1,41 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.cms.ItemSelectionModel; +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; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentOrganizationStep extends SimpleEditStep { + + private String SET_DEPARTMENT_ORGANIZATION_STEP = + "setDepartmentOrganization"; + + public SciDepartmentOrganizationStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent) { + this(itemModel, parent, null); + } + + public SciDepartmentOrganizationStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent, + String prefix) { + super(itemModel, parent, prefix); + + BasicItemForm setOrgaForm = + new SciDepartmentOrganizationForm(itemModel); + add(SET_DEPARTMENT_ORGANIZATION_STEP, + (String) SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.setOrganization").localize(), + new WorkflowLockedComponentAccess(setOrgaForm, itemModel), + setOrgaForm.getSaveCancelSection().getCancelButton()); + + SciDepartmentOrganizationSheet sheet = + new SciDepartmentOrganizationSheet( + itemModel); + setDisplayComponent(sheet); + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertiesStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertiesStep.java index fa900722e..e0feab095 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertiesStep.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertiesStep.java @@ -3,6 +3,8 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Label; import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciDepartment; +import com.arsdigita.cms.contenttypes.SciOrganizationConfig; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.authoring.SimpleEditStep; @@ -61,12 +63,41 @@ public class SciDepartmentPropertiesStep @Override protected void addSteps(ItemSelectionModel itemModel, AuthoringKitWizard parent) { - super.addSteps(itemModel, parent); + //super.addSteps(itemModel, parent); - addStep(new SciDepartmentSubDepartmentsStep(itemModel, parent), - "sciorganization.ui.department.subdepartments"); + SciOrganizationConfig config; + config = SciDepartment.getConfig(); - addStep(new SciDepartmentProjectsStep(itemModel, parent), - "sciorganization.ui.department.projects"); + if (!config.getDepartmentAddContactHide()) { + addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel, + parent), + "cms.contenttypes.ui.orgaunit.contact"); + } + + if (!config.getDepartmentAddPersonHide()) { + addStep(new GenericOrganizationalUnitPersonPropertiesStep(itemModel, + parent), + "cms.contenttypes.ui.orgaunit.persons"); + } + + if (!config.getDepartmentAddSubDepartmentHide()) { + addStep(new SciDepartmentSubDepartmentsStep(itemModel, parent), + "sciorganization.ui.department.subdepartments"); + } + + if (!config.getDepartmentSetSuperDepartmentHide()) { + addStep(new SciDepartmentSuperDepartmentStep(itemModel, parent), + "sciorganization.ui.department.superdepartment"); + } + + if (!config.getDepartmentAddProjectHide()) { + addStep(new SciDepartmentProjectsStep(itemModel, parent), + "sciorganization.ui.department.projects"); + } + + if (!config.getDepartmentSetOrganizationHide()) { + addStep(new SciDepartmentOrganizationStep(itemModel, parent), + "sciorganization.ui.department.organization"); + } } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertyForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertyForm.java index 1326e138d..4220fb89e 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertyForm.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertyForm.java @@ -38,13 +38,13 @@ public class SciDepartmentPropertyForm super.addWidgets(); Label descLabel = new Label(SciOrganizationGlobalizationUtil.globalize( - "sciorganizations.ui.department.description")); + "sciorganizations.ui.department.shortdescription")); add(descLabel); ParameterModel descParam = new StringParameter( - SciDepartment.DEPARTMENT_DESCRIPTION); + SciDepartment.DEPARTMENT_SHORT_DESCRIPTION); TextArea desc = new TextArea(descParam); - desc.setCols(60); - desc.setRows(18); + desc.setCols(75); + desc.setRows(5); add(desc); } @@ -55,8 +55,8 @@ public class SciDepartmentPropertyForm FormData data = fse.getFormData(); SciDepartment department = (SciDepartment) super.initBasicWidgets(fse); - data.put(SciDepartment.DEPARTMENT_DESCRIPTION, - department.getDepartmentDescription()); + data.put(SciDepartment.DEPARTMENT_SHORT_DESCRIPTION, + department.getDepartmentShortDescription()); } @Override @@ -69,8 +69,8 @@ public class SciDepartmentPropertyForm if ((department != null) && getSaveCancelSection().getSaveButton(). isSelected(fse.getPageState())) { - department.setDepartmentDescription( - (String) data.get(SciDepartment.DEPARTMENT_DESCRIPTION)); + department.setDepartmentShortDescription( + (String) data.get(SciDepartment.DEPARTMENT_SHORT_DESCRIPTION)); department.save(); diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentForm.java new file mode 100644 index 000000000..4e2116190 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentForm.java @@ -0,0 +1,65 @@ +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.event.FormInitListener; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.cms.ContentType; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciDepartment; +import com.arsdigita.cms.ui.ItemSearchWidget; +import com.arsdigita.cms.ui.authoring.BasicItemForm; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentSuperDepartmentForm + extends BasicItemForm + implements FormProcessListener, + FormInitListener { + + private ItemSearchWidget m_itemSearch; + private final String ITEM_SEARCH = "superdepartment"; + + public SciDepartmentSuperDepartmentForm(ItemSelectionModel itemModel) { + super("SuperDepartmentSetForm", itemModel); + } + + @Override + public void addWidgets() { + add(new Label((String) SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.select_superdepartment"). + localize())); + m_itemSearch = new ItemSearchWidget( + ITEM_SEARCH, + ContentType.findByAssociatedObjectType( + SciDepartment.class.getName())); + add(m_itemSearch); + } + + @Override + public void init(FormSectionEvent fse) throws FormProcessException { + PageState state = fse.getPageState(); + + setVisible(state, true); + } + + @Override + public void process(FormSectionEvent fse) throws FormProcessException { + FormData data = fse.getFormData(); + PageState state = fse.getPageState(); + SciDepartment department = (SciDepartment) getItemSelectionModel(). + getSelectedObject(state); + + if ((this.getSaveCancelSection().getSaveButton().isSelected(state))) { + department.setSuperDepartment( + (SciDepartment) data.get(ITEM_SEARCH)); + + init(fse); + } + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentSheet.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentSheet.java new file mode 100644 index 000000000..1c13c7729 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentSheet.java @@ -0,0 +1,205 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.ControlLink; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.Table; +import com.arsdigita.bebop.event.TableActionEvent; +import com.arsdigita.bebop.event.TableActionListener; +import com.arsdigita.bebop.table.TableCellRenderer; +import com.arsdigita.bebop.table.TableColumn; +import com.arsdigita.bebop.table.TableColumnModel; +import com.arsdigita.bebop.table.TableModel; +import com.arsdigita.bebop.table.TableModelBuilder; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.SecurityManager; +import com.arsdigita.cms.contenttypes.SciDepartment; +import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.util.LockableImpl; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentSuperDepartmentSheet + extends Table + implements TableActionListener { + + private final String TABLE_COL_EDIT = "table_col_edit"; + private final String TABLE_COL_DEL = "table_col_del"; + private ItemSelectionModel m_itemModel; + + public SciDepartmentSuperDepartmentSheet(ItemSelectionModel itemModel) { + super(); + m_itemModel = itemModel; + + setEmptyView( + new Label(SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.superdepartment_none"))); + + TableColumnModel colModel = getColumnModel(); + colModel.add(new TableColumn( + 0, + SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.superdepartment").localize(), + TABLE_COL_EDIT)); + colModel.add(new TableColumn( + 1, + SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.superdepartment.remove").localize(), + TABLE_COL_DEL)); + + setModelBuilder( + new SciDepartmentSuperDepartmentSheetModelBuilder(itemModel)); + colModel.get(0).setCellRenderer(new EditCellRenderer()); + colModel.get(1).setCellRenderer(new DeleteCellRenderer()); + + addTableActionListener(this); + } + + private class SciDepartmentSuperDepartmentSheetModelBuilder + extends LockableImpl + implements TableModelBuilder { + + private ItemSelectionModel m_itemModel; + + public SciDepartmentSuperDepartmentSheetModelBuilder( + ItemSelectionModel itemModel) { + m_itemModel = itemModel; + } + + @Override + public TableModel makeModel(Table table, PageState state) { + table.getRowSelectionModel().clearSelection(state); + SciDepartment department = (SciDepartment) m_itemModel. + getSelectedObject(state); + return new SciDepartmentSuperDepartmentSheetModel(table, + state, + department); + } + } + + private class SciDepartmentSuperDepartmentSheetModel + implements TableModel { + + private Table m_table; + private SciDepartment m_superDepartment; + + public SciDepartmentSuperDepartmentSheetModel(Table table, + PageState state, + SciDepartment department) { + m_table = table; + m_superDepartment = department.getSuperDepartment(); + } + + @Override + public int getColumnCount() { + return m_table.getColumnModel().size(); + } + + @Override + public boolean nextRow() { + boolean ret; + + if (null == m_superDepartment) { + ret = false; + } else { + ret = true; + m_superDepartment = null; + } + + return ret; + } + + @Override + public Object getElementAt(int columnIndex) { + switch (columnIndex) { + case 0: + return m_superDepartment.getTitle(); + case 1: + return SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.superdepartment.remove"); + default: + return null; + } + } + + @Override + public Object getKeyAt(int columnIndex) { + return m_superDepartment.getID(); + } + } + + private class EditCellRenderer + extends LockableImpl + implements TableCellRenderer { + + @Override + public Component getComponent(Table table, + PageState state, Object value, + boolean isSelected, + Object key, + int row, + int column) { + Label label = new Label(value.toString()); + return label; + } + } + + private class DeleteCellRenderer + extends LockableImpl + implements TableCellRenderer { + + @Override + public Component getComponent(Table table, + PageState state, Object value, + boolean isSelected, + Object key, + int row, + int column) { + SecurityManager securityManager = + Utilities.getSecurityManager(state); + SciDepartment project = (SciDepartment) m_itemModel. + getSelectedObject( + state); + + boolean canEdit = securityManager.canAccess( + state.getRequest(), + SecurityManager.DELETE_ITEM, + project); + + if (canEdit) { + ControlLink link = new ControlLink(value.toString()); + link.setConfirmation((String) SciOrganizationGlobalizationUtil. + globalize( + "sciorganization.ui.department.superdepartment." + + ".confirm_remove"). + localize()); + return link; + } else { + Label label = new Label(value.toString()); + return label; + } + } + } + + public void cellSelected(TableActionEvent event) { + PageState state = event.getPageState(); + + SciDepartment department = (SciDepartment) m_itemModel.getSelectedObject( + state); + + TableColumn column = getColumnModel().get(event.getColumn().intValue()); + + if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) { + + } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) { + department.setSuperDepartment(null); + } + } + + public void headSelected(TableActionEvent event) { + //Noting to do + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentStep.java new file mode 100644 index 000000000..bc5aa8c8c --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentStep.java @@ -0,0 +1,43 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.cms.ItemSelectionModel; +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; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentSuperDepartmentStep extends SimpleEditStep { + + private String SET_SUPER_DEPARTMENT_STEP = "setSuperDepartment"; + + public SciDepartmentSuperDepartmentStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent) { + this(itemModel, parent, null); + } + + public SciDepartmentSuperDepartmentStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent, + String prefix) { + super(itemModel, parent, prefix); + + BasicItemForm setSuperDepartmentForm = + new SciDepartmentSuperDepartmentForm(itemModel); + add(SET_SUPER_DEPARTMENT_STEP, + (String) SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.setSuperDepartment").localize(), + new WorkflowLockedComponentAccess(setSuperDepartmentForm, + itemModel), + setSuperDepartmentForm.getSaveCancelSection(). + getCancelButton()); + + SciDepartmentSuperDepartmentSheet sheet = + new SciDepartmentSuperDepartmentSheet( + itemModel); + setDisplayComponent(sheet); + + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionEditForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionEditForm.java new file mode 100644 index 000000000..d3856df59 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionEditForm.java @@ -0,0 +1,81 @@ +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.event.FormInitListener; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.form.TextArea; +import com.arsdigita.bebop.parameters.ParameterModel; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciOrganization; +import com.arsdigita.cms.ui.CMSDHTMLEditor; +import com.arsdigita.cms.ui.authoring.BasicItemForm; + +/** + * + * @author Jens Pelzetter + */ +public class SciOrganizationDescriptionEditForm + extends BasicItemForm + implements FormProcessListener, + FormInitListener { + + public SciOrganizationDescriptionEditForm(ItemSelectionModel itemModel) { + super("sciorganizationEditDescForm", itemModel); + } + + @Override + public void addWidgets() { + add(new Label(SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.organization.description"))); + ParameterModel descParam = new StringParameter( + SciOrganization.ORGANIZATION_DESCRIPTION); + TextArea desc; + if (SciOrganization.getConfig().getOrganizationDescriptionDhtml()) { + desc = new CMSDHTMLEditor(descParam); + } else { + desc = new TextArea(descParam); + } + desc.setCols(75); + desc.setRows(25); + add(desc); + } + + @Override + public void init(FormSectionEvent fse) throws FormProcessException { + PageState state = fse.getPageState(); + + FormData data = fse.getFormData(); + SciOrganization orga = (SciOrganization) getItemSelectionModel(). + getSelectedObject(state); + + data.put(SciOrganization.ORGANIZATION_DESCRIPTION, + orga.getOrganizationDescription()); + + setVisible(state, true); + } + + @Override + public void process(FormSectionEvent fse) throws FormProcessException { + PageState state = fse.getPageState(); + + FormData data = fse.getFormData(); + + SciOrganization orga = (SciOrganization) getItemSelectionModel(). + getSelectedObject(state); + + if ((orga != null) && this.getSaveCancelSection().getSaveButton(). + isSelected(state)) { + orga.setOrganizationDescription((String) data.get( + SciOrganization.ORGANIZATION_DESCRIPTION)); + + orga.save(); + + init(fse); + } + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionStep.java new file mode 100644 index 000000000..8dd985220 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionStep.java @@ -0,0 +1,62 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciOrganization; +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 com.arsdigita.toolbox.ui.DomainObjectPropertySheet; + +/** + * + * @author Jens Pelzetter + */ +public class SciOrganizationDescriptionStep extends SimpleEditStep { + + private String EDIT_ORGANIZATION_DESC_SHEET_NAME = "editOrganizationDesc"; + private String UPLOAD_ORGANIZATION_DESC_SHEET_NAME = + "uploadOrganizationDesc"; + + public SciOrganizationDescriptionStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent) { + this(itemModel, parent, null); + } + + public SciOrganizationDescriptionStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent, + String prefix) { + super(itemModel, parent, prefix); + + BasicItemForm editDescForm = + new SciOrganizationDescriptionEditForm(itemModel); + add(EDIT_ORGANIZATION_DESC_SHEET_NAME, + (String) SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.organization.edit_desc").localize(), + new WorkflowLockedComponentAccess(editDescForm, itemModel), + editDescForm.getSaveCancelSection().getCancelButton()); + + SciOrganizationDescriptionUploadForm uploadDescForm = + new SciOrganizationDescriptionUploadForm(itemModel); + add(UPLOAD_ORGANIZATION_DESC_SHEET_NAME, + (String) SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.organization.upload_desc").localize(), + new WorkflowLockedComponentAccess(uploadDescForm, itemModel), + uploadDescForm.getSaveCancelSection().getCancelButton()); + + setDisplayComponent(getSciOrganizationEditDescSheet(itemModel)); + } + + public static Component getSciOrganizationEditDescSheet( + ItemSelectionModel itemModel) { + DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( + itemModel); + + sheet.add(SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.organization.desc"), + SciOrganization.ORGANIZATION_DESCRIPTION); + + return sheet; + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionUploadForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionUploadForm.java new file mode 100644 index 000000000..57c3dda23 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionUploadForm.java @@ -0,0 +1,40 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciOrganization; +import com.arsdigita.globalization.GlobalizedMessage; + +/** + * + * @author Jens Pelzetter + */ +public class SciOrganizationDescriptionUploadForm + extends AbstractTextUploadForm { + + public SciOrganizationDescriptionUploadForm(ItemSelectionModel itemModel) { + super(itemModel); + } + + @Override + public GlobalizedMessage getLabelText() { + return SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.organization.description.upload"); + } + + @Override + public GlobalizedMessage getMimeTypeLabel() { + return SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.organization.description.upload.mimetype"); + } + + @Override + public void setText(ItemSelectionModel itemModel, + PageState state, + String text) { + SciOrganization orga = (SciOrganization) itemModel.getSelectedObject( + state); + orga.setOrganizationDescription(text); + orga.save(); + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertiesStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertiesStep.java index 0a90836a1..092dde574 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertiesStep.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertiesStep.java @@ -2,6 +2,8 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Label; import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciOrganization; +import com.arsdigita.cms.contenttypes.SciOrganizationConfig; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.authoring.SimpleEditStep; @@ -50,12 +52,31 @@ public class SciOrganizationPropertiesStep @Override protected void addSteps(ItemSelectionModel itemModel, AuthoringKitWizard parent) { - super.addSteps(itemModel, parent); + //super.addSteps(itemModel, parent); - addStep(new SciOrganizationDepartmentsStep(itemModel, parent), - "sciorganization.ui.organization.departments"); + SciOrganizationConfig config; + config = SciOrganization.getConfig(); - addStep(new SciOrganizationProjectsStep(itemModel, parent), - "sciorganization.ui.organization.projects"); + if (!config.getOrganizationAddContactHide()) { + addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel, + parent), + "cms.contenttypes.ui.orgaunit.contact"); + } + + if (!config.getOrganizationAddPersonHide()) { + addStep(new GenericOrganizationalUnitPersonPropertiesStep(itemModel, + parent), + "cms.contenttypes.ui.orgaunit.persons"); + } + + if (!config.getOrganizationAddDepartmentHide()) { + addStep(new SciOrganizationDepartmentsStep(itemModel, parent), + "sciorganization.ui.organization.departments"); + } + + if (!config.getOrganizationAddProjectHide()) { + addStep(new SciOrganizationProjectsStep(itemModel, parent), + "sciorganization.ui.organization.projects"); + } } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertyForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertyForm.java index 855a7f0ee..536485188 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertyForm.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertyForm.java @@ -40,13 +40,13 @@ public class SciOrganizationPropertyForm super.addWidgets(); Label descLabel = new Label(SciOrganizationGlobalizationUtil.globalize( - "sciorganizations.ui.organization.description")); + "sciorganizations.ui.organization.shortdescription")); add(descLabel); ParameterModel descParam = new StringParameter( - SciOrganization.ORGANIZATION_DESCRIPTION); + SciOrganization.ORGANIZATION_SHORT_DESCRIPTION); TextArea desc = new TextArea(descParam); - desc.setCols(60); - desc.setRows(18); + desc.setCols(75); + desc.setRows(5); add(desc); } @@ -57,8 +57,8 @@ public class SciOrganizationPropertyForm FormData data = fse.getFormData(); SciOrganization orga = (SciOrganization) super.initBasicWidgets(fse); - data.put(SciOrganization.ORGANIZATION_DESCRIPTION, - orga.getOrganizationDescription()); + data.put(SciOrganization.ORGANIZATION_SHORT_DESCRIPTION, + orga.getOrganizationShortDescription()); } @Override @@ -72,8 +72,8 @@ public class SciOrganizationPropertyForm if ((organization != null) && getSaveCancelSection().getSaveButton(). isSelected(fse.getPageState())) { - organization.setOrganizationDescription((String) data.get( - SciOrganization.ORGANIZATION_DESCRIPTION)); + organization.setOrganizationShortDescription((String) data.get( + SciOrganization.ORGANIZATION_SHORT_DESCRIPTION)); organization.save(); } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionEditForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionEditForm.java index 0562f0844..ee6973a37 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionEditForm.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionEditForm.java @@ -34,7 +34,12 @@ public class SciProjectDescriptionEditForm "sciorganizazion.ui.project.description"))); ParameterModel descParam = new StringParameter( SciProject.PROJECT_DESCRIPTION); - CMSDHTMLEditor desc = new CMSDHTMLEditor(descParam); + TextArea desc; + if (SciProject.getConfig().getProjectDescriptionDhtml()) { + desc = new CMSDHTMLEditor(descParam); + } else { + desc = new TextArea(descParam); + } desc.setCols(75); desc.setRows(25); add(desc); @@ -51,7 +56,6 @@ public class SciProjectDescriptionEditForm } else { funding = new TextArea(fundingParam); } - funding.setCols(75); funding.setRows(25); add(funding); @@ -83,7 +87,7 @@ public class SciProjectDescriptionEditForm SciProject project = (SciProject) getItemSelectionModel(). getSelectedObject(state); - if ((project != null) && this.getSaveCancelSection().getSaveButton(). + if ((project != null) && getSaveCancelSection().getSaveButton(). isSelected(state)) { project.setProjectDescription((String) data.get( SciProject.PROJECT_DESCRIPTION)); diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionStep.java index d38e9fadb..2a805f9ed 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionStep.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionStep.java @@ -1,7 +1,6 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; -import com.arsdigita.bebop.Form; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contenttypes.SciProject; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; @@ -38,12 +37,13 @@ public class SciProjectDescriptionStep extends SimpleEditStep { editDescForm.getSaveCancelSection().getCancelButton()); SciProjectDescriptionUploadForm uploadDescForm = - new SciProjectDescriptionUploadForm(itemModel); + new SciProjectDescriptionUploadForm( + itemModel); add(UPLOAD_PROJECT_DESC_SHEET_NAME, - (String) SciOrganizationGlobalizationUtil.globalize( + (String) SciOrganizationGlobalizationUtil.globalize( "sciorganization.ui.project.upload_desc").localize(), - new WorkflowLockedComponentAccess(uploadDescForm, itemModel), - uploadDescForm.getSaveCancelSection().getCancelButton()); + new WorkflowLockedComponentAccess(uploadDescForm, itemModel), + uploadDescForm.getSaveCancelSection().getCancelButton()); setDisplayComponent( getSciProjectEditDescSheet(itemModel)); diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionUploadForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionUploadForm.java index 1dc68d37c..9b9300d58 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionUploadForm.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionUploadForm.java @@ -28,7 +28,8 @@ public class SciProjectDescriptionUploadForm extends AbstractTextUploadForm { } @Override - public void setText(ItemSelectionModel itemModel, PageState state, + public void setText(ItemSelectionModel itemModel, + PageState state, String text) { SciProject project = (SciProject) itemModel.getSelectedObject(state); project.setProjectDescription(text); diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java index e94d8d3e9..d6b7090a8 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java @@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Label; import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.SciOrganizationConfig; import com.arsdigita.cms.contenttypes.SciProject; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.BasicPageForm; @@ -72,26 +73,43 @@ public class SciProjectPropertiesStep @Override protected void addSteps(ItemSelectionModel itemModel, AuthoringKitWizard parent) { - addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel, - parent), - "cms.contenttypes.ui.orgaunit.contact"); - addStep(new GenericOrganizationalUnitPersonPropertiesStep(itemModel, - parent), - "cms.contenttypes.ui.orgaunit.persons"); + SciOrganizationConfig config; + config = SciProject.getConfig(); - super.addSteps(itemModel, parent); + if (!config.getProjectAddContactHide()) { + addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel, + parent), + "cms.contenttypes.ui.orgaunit.contact"); + } - addStep(new SciProjectSuperProjectStep(itemModel, - parent), - "sciorganization.ui.project.superproject"); - addStep(new SciProjectSubprojectsStep(itemModel, - parent), - "sciorganization.ui.project.subprojects"); + if (!config.getProjectAddPersonHide()) { + addStep(new GenericOrganizationalUnitPersonPropertiesStep(itemModel, + parent), + "cms.contenttypes.ui.orgaunit.persons"); + } - addStep(new SciProjectOrganizationsStep(itemModel, parent), - "sciorganization.ui.project.organizations"); + //super.addSteps(itemModel, parent); - addStep(new SciProjectDepartmentsStep(itemModel, parent), - "sciorganization.ui.project.departments"); + if (!config.getProjectSetSuperProjectHide()) { + addStep(new SciProjectSuperProjectStep(itemModel, + parent), + "sciorganization.ui.project.superproject"); + } + + if (!config.getProjectAddSubProjectHide()) { + addStep(new SciProjectSubprojectsStep(itemModel, + parent), + "sciorganization.ui.project.subprojects"); + } + + if (!config.getProjectAddOrganizationHide()) { + addStep(new SciProjectOrganizationsStep(itemModel, parent), + "sciorganization.ui.project.organizations"); + } + + if (!config.getProjectAddDepartmentHide()) { + addStep(new SciProjectDepartmentsStep(itemModel, parent), + "sciorganization.ui.project.departments"); + } } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectAttachForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSetForm.java similarity index 82% rename from ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectAttachForm.java rename to ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSetForm.java index fc0a4486d..e862f2945 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectAttachForm.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSetForm.java @@ -17,7 +17,7 @@ import com.arsdigita.cms.ui.authoring.BasicItemForm; * * @author Jens Pelzetter */ -public class SciProjectSuperProjectAttachForm +public class SciProjectSuperProjectSetForm extends BasicItemForm implements FormProcessListener, FormInitListener { @@ -25,14 +25,14 @@ public class SciProjectSuperProjectAttachForm private ItemSearchWidget m_itemSearch; private final String ITEM_SEARCH = "superproject"; - public SciProjectSuperProjectAttachForm(ItemSelectionModel itemModel) { - super("SuperProjectAttachForm", itemModel); + public SciProjectSuperProjectSetForm(ItemSelectionModel itemModel) { + super("SuperProjectSetForm", itemModel); } @Override protected void addWidgets() { - add(new Label((String) SciOrganizationGlobalizationUtil.globalize( - "sciorganization.ui.project.select_superproject").localize())); + add(new Label(SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.project.select_superproject"))); m_itemSearch = new ItemSearchWidget( ITEM_SEARCH, ContentType.findByAssociatedObjectType( @@ -54,8 +54,8 @@ public class SciProjectSuperProjectAttachForm SciProject project = (SciProject) getItemSelectionModel(). getSelectedObject(state); - if (!(this.getSaveCancelSection().getCancelButton(). - isSelected(state))) { + if (this.getSaveCancelSection().getSaveButton(). + isSelected(state)) { project.setSuperProject((SciProject) data.get(ITEM_SEARCH)); init(fse); diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSheet.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSheet.java index 628d510cb..59d7d9a3c 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSheet.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSheet.java @@ -18,7 +18,6 @@ import com.arsdigita.cms.contenttypes.SciProject; import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.util.LockableImpl; -import java.math.BigDecimal; /** * @@ -187,8 +186,8 @@ public class SciProjectSuperProjectSheet public void cellSelected(TableActionEvent event) { PageState state = event.getPageState(); - SciProject superProject = new SciProject( - new BigDecimal(event.getRowKey().toString())); + /*SciProject superProject = new SciProject( + new BigDecimal(event.getRowKey().toString()));*/ SciProject project = (SciProject) m_itemModel.getSelectedObject(state); diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectStep.java index f5c04c089..2b17e74be 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectStep.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectStep.java @@ -12,7 +12,7 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; */ public class SciProjectSuperProjectStep extends SimpleEditStep { - private String ATTACH_SUPER_PROJECT_STEP = "attachSuperProject"; + private String SET_SUPER_PROJECT_STEP = "setSuperProject"; public SciProjectSuperProjectStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) { @@ -24,14 +24,14 @@ public class SciProjectSuperProjectStep extends SimpleEditStep { String prefix) { super(itemModel, parent, prefix); - BasicItemForm attachSuperProjectForm = - new SciProjectSuperProjectAttachForm(itemModel); - add(ATTACH_SUPER_PROJECT_STEP, + BasicItemForm setSuperProjectForm = + new SciProjectSuperProjectSetForm(itemModel); + add(SET_SUPER_PROJECT_STEP, (String) SciOrganizationGlobalizationUtil.globalize( - "sciorganization.ui.project.attachSuperProject").localize(), - new WorkflowLockedComponentAccess(attachSuperProjectForm, + "sciorganization.ui.project.setSuperProject").localize(), + new WorkflowLockedComponentAccess(setSuperProjectForm, itemModel), - attachSuperProjectForm.getSaveCancelSection(). + setSuperProjectForm.getSaveCancelSection(). getCancelButton()); SciProjectSuperProjectSheet superProjectSheet =