Entfernen der obsoleten Module ccm-sci-types-organization und ccm-sci-types-organizationwithpublications aus dem trunk
git-svn-id: https://svn.libreccm.org/ccm/trunk@1277 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
fbb91c0767
commit
cce7f68179
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||
name="ccm-sci-types-organization"
|
||||
prettyName="OpenCCM Content Types"
|
||||
version="6.6.1"
|
||||
release="1"
|
||||
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" version="6.6.3" relation="le"/>
|
||||
<ccm:requires name="ccm-cms-assets-relatedlink" version="6.6.0" relation="ge"/>
|
||||
</ccm:dependencies>
|
||||
<ccm:directories>
|
||||
<ccm:directory name="pdl"/>
|
||||
<ccm:directory name="sql"/>
|
||||
<ccm:directory name="src"/>
|
||||
</ccm:directories>
|
||||
<ccm:contacts>
|
||||
<ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/>
|
||||
<ccm:contact uri="mailto:rhea@redhat.com" type="support"/>
|
||||
</ccm:contacts>
|
||||
<ccm:description>
|
||||
Content types for scientific organizations
|
||||
</ccm:description>
|
||||
</ccm:application>
|
||||
|
|
@ -1,165 +0,0 @@
|
|||
model com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.cms.*;
|
||||
|
||||
object type SciDepartment extends GenericOrganizationalUnit {
|
||||
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] 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;
|
||||
SciDepartment[0..n] subDepartments = join ct_sciorga_departments.department_id
|
||||
to ct_sciorga_departments_subdepartments_map.department_id,
|
||||
join ct_sciorga_departments_subdepartments_map.subdepartment_id
|
||||
to ct_sciorga_departments.department_id;
|
||||
|
||||
Integer[0..1] subDepartmentOrder = ct_sciorga_departments_subdepartments_map.subdepartments_order INTEGER;
|
||||
}
|
||||
|
||||
association {
|
||||
SciDepartment[0..n] department = join ct_sciorga_projects.project_id
|
||||
to ct_sciorga_departments_projects_map.project_id,
|
||||
join ct_sciorga_departments_projects_map.department_id
|
||||
to ct_sciorga_departments.department_id;
|
||||
|
||||
SciProject[0..n] projects = join ct_sciorga_departments.department_id
|
||||
to ct_sciorga_departments_projects_map.department_id,
|
||||
join ct_sciorga_departments_projects_map.project_id
|
||||
to ct_sciorga_projects.project_id;
|
||||
|
||||
Integer[0..1] departmentOrder = ct_sciorga_departments_projects_map.departmentOrder INTEGER;
|
||||
Integer[0..1] projectOrder = ct_sciorga_departments_projects_map.projectorder INTEGER;
|
||||
}
|
||||
|
||||
query getIdsOfContactsOfSciDepartment {
|
||||
BigDecimal contactId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_contact_map.contact_id
|
||||
from cms_organizationalunits_contact_map
|
||||
where cms_organizationalunits_contact_map.organizationalunit_id = :department
|
||||
} map {
|
||||
contactId = cms_organizationalunits_contact_map.contact_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfSubDepartmentsOfSciDepartment {
|
||||
BigDecimal subDepartmentId;
|
||||
|
||||
do {
|
||||
select ct_sciorga_departments_subdepartments_map.subdepartment_id
|
||||
from ct_sciorga_departments_subdepartments_map
|
||||
where ct_sciorga_departments_subdepartments_map.department_id = :department
|
||||
} map {
|
||||
subDepartmentId = ct_sciorga_departments_subdepartments_map.subdepartment_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfMembersOfSciDepartment {
|
||||
BigDecimal memberId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_person_map.person_id
|
||||
from cms_organizationalunits_person_map
|
||||
where cms_organizationalunits_person_map.organizationalunit_id = :department
|
||||
} map {
|
||||
memberId = cms_organizationalunits_person_map.person_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfActiveMembersOfSciDepartment {
|
||||
BigDecimal memberId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_person_map.person_id
|
||||
from cms_organizationalunits_person_map
|
||||
where cms_organizationalunits_person_map.organizationalunit_id = :department
|
||||
and cms_organizationalunits_person_map.status = 'active'
|
||||
} map {
|
||||
memberId = cms_organizationalunits_person_map.person_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfAssociatedMembersOfSciDepartment {
|
||||
BigDecimal memberId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_person_map.person_id
|
||||
from cms_organizationalunits_person_map
|
||||
where cms_organizationalunits_person_map.organizationalunit_id = :department
|
||||
and cms_organizationalunits_person_map.status = 'associated'
|
||||
} map {
|
||||
memberId = cms_organizationalunits_person_map.personId;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfFormerMembersOfSciDepartment {
|
||||
BigDecimal memberId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_person_map.person_id
|
||||
from cms_organizationalunits_person_map
|
||||
where cms_organizationalunits_person_map.organizationalunit_id = :department
|
||||
and (cms_organizationalunits_person_map.status = 'former' or cms_organizationalunits_person_map.status = 'associatedFormer')
|
||||
} map {
|
||||
memberId = cms_organizationalunits_person_map.personId;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfProjectsOfSciDepartment {
|
||||
BigDecimal projectId;
|
||||
|
||||
do {
|
||||
select ct_sciorga_departments_projects_map.project_id
|
||||
from ct_sciorga_departments_projects_map
|
||||
where ct_sciorga_departments_projects_map.department_id = :department
|
||||
} map {
|
||||
projectId = ct_sciorga_departments_projects_map.project_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfOngoingProjectsOfSciDepartment {
|
||||
BigDecimal projectId;
|
||||
|
||||
do {
|
||||
select ct_sciorga_projects.project_id
|
||||
from ct_sciorga_departments_projects_map
|
||||
join ct_sciorga_projects on ct_sciorga_departments_projects_map.project_id = ct_sciorga_projects.project_id
|
||||
where ct_sciorga_departments_projects_map.department_id = :department and ct_sciorga_projects.projectend >= ':today'
|
||||
} map {
|
||||
projectId = ct_sciorga_projects.project_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfFinishedProjectsOfSciDepartment {
|
||||
BigDecimal projectId;
|
||||
|
||||
do {
|
||||
select ct_sciorga_projects.project_id
|
||||
from ct_sciorga_departments_projects_map
|
||||
join ct_sciorga_projects on ct_sciorga_departments_projects_map.project_id = ct_sciorga_projects.project_id
|
||||
where ct_sciorga_departments_projects_map.department_id = :department and ct_sciorga_projects.projectend < ':today'
|
||||
} map {
|
||||
projectId = ct_sciorga_projects.project_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfPublicationLinksOfSciDepartment {
|
||||
BigDecimal linkId;
|
||||
|
||||
do {
|
||||
select cms_related_links.related_link_id
|
||||
from cms_related_links
|
||||
where cms_related_links.owner_id = :department
|
||||
and cms_related_links.link_list_name = 'SciDepartmentPublications'
|
||||
} map {
|
||||
linkId = cms_related_links.related_link_id;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
model com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.cms.*;
|
||||
|
||||
object type SciMember extends GenericPerson {
|
||||
reference key ( ct_sciorga_members.member_id );
|
||||
}
|
||||
|
|
@ -1,169 +0,0 @@
|
|||
model com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.cms.*;
|
||||
|
||||
object type SciOrganization extends GenericOrganizationalUnit {
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
association {
|
||||
SciOrganization[0..n] organization = join ct_sciorga_departments.department_id
|
||||
to ct_sciorga_organizations_departments_map.department_id,
|
||||
join ct_sciorga_organizations_departments_map.organization_id
|
||||
to ct_sciorga_organizations.organization_id;
|
||||
|
||||
SciDepartment[0..n] departments = join ct_sciorga_organizations.organization_id
|
||||
to ct_sciorga_organizations_departments_map.organization_id,
|
||||
join ct_sciorga_organizations_departments_map.department_id
|
||||
to ct_sciorga_departments.department_id;
|
||||
|
||||
Integer[0..1] departmentOrder = ct_sciorga_organizations_departments_map.department_order INTEGER;
|
||||
Integer[0..1] organizationOrder = ct_sciorga_organizations_departments_map.organization_order INTEGER;
|
||||
}
|
||||
|
||||
association {
|
||||
SciOrganization[0..n] organization = join ct_sciorga_projects.project_id
|
||||
to ct_sciorga_organizations_projects_map.project_id,
|
||||
join ct_sciorga_organizations_projects_map.organization_id
|
||||
to ct_sciorga_organizations.organization_id;
|
||||
|
||||
SciProject[0..n] projects = join ct_sciorga_organizations.organization_id
|
||||
to ct_sciorga_organizations_projects_map.organization_id,
|
||||
join ct_sciorga_organizations_projects_map.project_id
|
||||
to ct_sciorga_projects.project_id;
|
||||
|
||||
Integer[0..1] projectOrder = ct_sciorga_organizations_projects_map.project_order INTEGER;
|
||||
Integer[0..1] organizationOrder = ct_sciorga_organizations_projects_map.organization_order INTEGER;
|
||||
}
|
||||
|
||||
query getIdsOfContactsOfSciOrganization {
|
||||
BigDecimal contactId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_contact_map.contact_id
|
||||
from cms_organizationalunits_contact_map
|
||||
where cms_organizationalunits_contact_map.organizationalunit_id = :organization
|
||||
} map {
|
||||
contactId = cms_organizationalunits_contact_map.contact_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfDepartmentsOfSciOrganization {
|
||||
BigDecimal departmentId;
|
||||
|
||||
do {
|
||||
select ct_sciorga_organizations_departments_map.department_id
|
||||
from ct_sciorga_organizations_departments_map
|
||||
where ct_sciorga_organizations_departments_map.organization_id = :organization
|
||||
} map {
|
||||
departmentId = ct_sciorga_organizations_departments_map.department_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfMembersOfSciOrganization {
|
||||
BigDecimal memberId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_person_map.person_id
|
||||
from cms_organizationalunits_person_map
|
||||
where cms_organizationalunits_person_map.organizationalunit_id = :organization
|
||||
} map {
|
||||
memberId = cms_organizationalunits_person_map.person_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfActiveMembersOfSciOrganization {
|
||||
BigDecimal memberId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_person_map.person_id
|
||||
from cms_organizationalunits_person_map
|
||||
where cms_organizationalunits_person_map.organizationalunit_id = :organization
|
||||
and cms_organizationalunits_person_map.status = 'active'
|
||||
} map {
|
||||
memberId = cms_organizationalunits_person_map.person_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfAssociatedMembersOfSciOrganization {
|
||||
BigDecimal memberId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_person_map.person_id
|
||||
from cms_organizationalunits_person_map
|
||||
where cms_organizationalunits_person_map.organizationalunit_id = :organization
|
||||
and cms_organizationalunits_person_map.status = 'associated'
|
||||
} map {
|
||||
memberId = cms_organizationalunits_person_map.personId;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfFormerMembersOfSciOrganization {
|
||||
BigDecimal memberId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_person_map.person_id
|
||||
from cms_organizationalunits_person_map
|
||||
where cms_organizationalunits_person_map.organizationalunit_id = :organization
|
||||
and (cms_organizationalunits_person_map.status = 'former' or cms_organizationalunits_person_map.status = 'associatedFormer')
|
||||
} map {
|
||||
memberId = cms_organizationalunits_person_map.personId;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfProjectsOfSciOrganization {
|
||||
BigDecimal projectId;
|
||||
|
||||
do {
|
||||
select ct_sciorga_organizations_projects_map.project_id
|
||||
from ct_sciorga_organizations_projects_map
|
||||
where ct_sciorga_organizations_projects_map.organization_id = :organization
|
||||
} map {
|
||||
projectId = ct_sciorga_organizations_projects_map.project_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfOngoingProjectsOfSciOrganization {
|
||||
BigDecimal projectId;
|
||||
|
||||
do {
|
||||
select ct_sciorga_projects.project_id
|
||||
from ct_sciorga_organizations_projects_map
|
||||
join ct_sciorga_projects on ct_sciorga_organizations_projects_map.project_id = ct_sciorga_projects.project_id
|
||||
where ct_sciorga_organizations_projects_map.organization_id = :organization and ct_sciorga_projects.projectend >= ':today'
|
||||
} map {
|
||||
projectId = ct_sciorga_projects.project_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfFinishedProjectsOfSciOrganization {
|
||||
BigDecimal projectId;
|
||||
|
||||
do {
|
||||
select ct_sciorga_projects.project_id
|
||||
from ct_sciorga_organizations_projects_map
|
||||
join ct_sciorga_projects on ct_sciorga_organizations_projects_map.project_id = ct_sciorga_projects.project_id
|
||||
where ct_sciorga_organizations_projects_map.organization_id = :organization and ct_sciorga_projects.projectend < ':today'
|
||||
} map {
|
||||
projectId = ct_sciorga_projects.project_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfPublicationLinksOfSciOrganization {
|
||||
BigDecimal linkId;
|
||||
|
||||
do {
|
||||
select cms_related_links.related_link_id
|
||||
from cms_related_links
|
||||
where cms_related_links.owner_id = :organization
|
||||
and cms_related_links.link_list_name = 'SciOrganizationPublications'
|
||||
} map {
|
||||
linkId = cms_related_links.related_link_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
model com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.cms.*;
|
||||
|
||||
object type SciProject extends GenericOrganizationalUnit {
|
||||
|
||||
Date[0..1] projectbegin = ct_sciorga_projects.projectbegin DATE;
|
||||
Date[0..1] projectend = ct_sciorga_projects.projectend DATE;
|
||||
String[0..1] projectShortDesc = ct_sciorga_projects.shortdesc VARCHAR(500);
|
||||
String[0..1] projectDescription = ct_sciorga_projects.description CLOB;
|
||||
String[0..1] funding = ct_sciorga_projects.funding CLOB;
|
||||
String[0..1] fundingVolume = ct_sciorga_projects.funding_volume VARCHAR(128);
|
||||
|
||||
reference key ( ct_sciorga_projects.project_id );
|
||||
}
|
||||
|
||||
association {
|
||||
SciProject[0..n] superProject = join ct_sciorga_projects.project_id
|
||||
to ct_sciorga_projects_subprojects_map.subproject_id,
|
||||
join ct_sciorga_projects_subprojects_map.project_id
|
||||
to ct_sciorga_projects.project_id;
|
||||
|
||||
SciProject[0..n] subProjects = join ct_sciorga_projects.project_id
|
||||
to ct_sciorga_projects_subprojects_map.project_id,
|
||||
join ct_sciorga_projects_subprojects_map.subproject_id
|
||||
to ct_sciorga_projects.project_id;
|
||||
|
||||
Integer[0..1] subProjectOrder = ct_sciorga_projects_subprojects_map.subprojectorder INTEGER;
|
||||
|
||||
}
|
||||
|
||||
query getIdsOfContactsOfSciProject {
|
||||
BigDecimal contactId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_contact_map.contact_id
|
||||
from cms_organizationalunits_contact_map
|
||||
where cms_organizationalunits_contact_map.organizationalunit_id = :project
|
||||
} map {
|
||||
contactId = cms_organizationalunits_contact_map.contact_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfSubProjectsOfSciProject {
|
||||
BigDecimal projectId;
|
||||
|
||||
do {
|
||||
select ct_sciorga_projects_subprojects_map.subproject_id
|
||||
from ct_sciorga_projects_subprojects_map
|
||||
where ct_sciorga_projects_subprojects_map.project_id = :project
|
||||
} map {
|
||||
projectId = ct_sciorga_projects_subprojects_map.project_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfMembersOfSciProject {
|
||||
BigDecimal memberId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_person_map.person_id
|
||||
from cms_organizationalunits_person_map
|
||||
where cms_organizationalunits_person_map.organizationalunit_id = :project
|
||||
} map {
|
||||
memberId = cms_organizationalunits_person_map.person_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfActiveMembersOfSciProject {
|
||||
BigDecimal memberId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_person_map.person_id
|
||||
from cms_organizationalunits_person_map
|
||||
where cms_organizationalunits_person_map.organizationalunit_id = :project
|
||||
and cms_organizationalunits_person_map.status = 'active'
|
||||
} map {
|
||||
memberId = cms_organizationalunits_person_map.person_id;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfAssociatedMembersOfSciProject {
|
||||
BigDecimal memberId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_person_map.person_id
|
||||
from cms_organizationalunits_person_map
|
||||
where cms_organizationalunits_person_map.organizationalunit_id = :project
|
||||
and cms_organizationalunits_person_map.status = 'associated'
|
||||
} map {
|
||||
memberId = cms_organizationalunits_person_map.personId;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfFormerMembersOfSciProject {
|
||||
BigDecimal memberId;
|
||||
|
||||
do {
|
||||
select cms_organizationalunits_person_map.cms_persons.person_id
|
||||
from cms_organizationalunits_person_map
|
||||
where cms_organizationalunits_person_map.organizationalunit_id = :project
|
||||
and (cms_organizationalunits_person_map.status = 'former' or cms_organizationalunits_person_map.status = 'associatedFormer')
|
||||
} map {
|
||||
memberId = cms_organizationalunits_person_map.personId;
|
||||
}
|
||||
}
|
||||
|
||||
query getIdsOfPublicationLinksOfSciProject {
|
||||
BigDecimal linkId;
|
||||
|
||||
do {
|
||||
select cms_related_links.related_link_id
|
||||
from cms_related_links
|
||||
where cms_related_links.owner_id = :project
|
||||
and cms_related_links.link_list_name = 'SciProjectPublications'
|
||||
} map {
|
||||
linkId = cms_related_links.related_link_id;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
begin;
|
||||
\i ddl/postgres/create.sql
|
||||
\i ddl/postgres/deferred.sql
|
||||
end;
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
<?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">
|
||||
|
||||
<ctd:content-type
|
||||
label="SciDepartment"
|
||||
description="Base type for departments of scientific organizations"
|
||||
objectType="com.arsdigita.cms.contenttypes.SciDepartment"
|
||||
classname="com.arsdigita.cms.contenttypes.SciDepartment">
|
||||
|
||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.department.properties.title"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="publications.ui.publication_properties.title.description"
|
||||
descriptionBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentPropertiesStep"
|
||||
ordering="1"/>
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.department.members"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.department.members.description.title"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentMemberStep"
|
||||
ordering="2"/>
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.department.subdepartments"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.department.subdepartments.description.title"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentSubDepartmentsStep"
|
||||
ordering="3"/>
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.department.projects"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.department.projects.description.title"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentProjectsStep"
|
||||
ordering="4"/>
|
||||
|
||||
<!--<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.department.publications"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.department.publications.description.title"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentPublicationsStep"
|
||||
ordering="5"/> -->
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.department.description.title"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.department.description.title"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentDescriptionStep"
|
||||
ordering="5"/>
|
||||
|
||||
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||
|
||||
</ctd:authoring-kit>
|
||||
|
||||
</ctd:content-type>
|
||||
|
||||
|
||||
</ctd:content-types>
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<?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">
|
||||
|
||||
<ctd:content-type
|
||||
label="SciMember"
|
||||
description="Base type for members of scientific orgnizations"
|
||||
objectType="com.arsdigita.cms.contenttypes.SciMember"
|
||||
classname="com.arsdigita.cms.contenttypes.SciMember">
|
||||
|
||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.contenttypes.ui.GenericPersonCreate">
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="cms.contenttypes.shared.basic_properties.title"
|
||||
labelBundle="com.arsdigita.cms.CMSResources"
|
||||
descriptionKey="cms.contenttypes.shared.basic_properties.description"
|
||||
descriptionBundle="com.arsdigita.cms.CMSResources"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciMemberPropertiesStep"
|
||||
ordering="1"/>
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="person.authoring.contact_properties.title"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
|
||||
descriptionKey="person.authoring.contact_properties.description"
|
||||
descriptionBundle="com.arsdigita.cms.contenttypes.ContenttypesResources"
|
||||
component="com.arsdigita.cms.contenttypes.ui.GenericPersonContactPropertiesStep"
|
||||
ordering="2"/>
|
||||
|
||||
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||
|
||||
</ctd:authoring-kit>
|
||||
|
||||
</ctd:content-type>
|
||||
|
||||
</ctd:content-types>
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
<?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">
|
||||
|
||||
<ctd:content-type
|
||||
label="SciOrganization"
|
||||
description="Base type for scientific orgnizations"
|
||||
objectType="com.arsdigita.cms.contenttypes.SciOrganization"
|
||||
classname="com.arsdigita.cms.contenttypes.SciOrganization">
|
||||
|
||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.organization.properties.title"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="publications.ui.publication_properties.title.description"
|
||||
descriptionBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciOrganizationPropertiesStep"
|
||||
ordering="1"/>
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.organization_members"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.organization_members.title.description"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciOrganizationMemberStep"
|
||||
ordering="2"/>
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.organization.departments"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.organization.departments.description"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciOrganizationDepartmentsStep"
|
||||
ordering="3"/>
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.organization.projects"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.organization.projects.description"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciOrganizationProjectsStep"
|
||||
ordering="4"/>
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.organization.description.title"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.organization_description.title.description"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciOrganizationDescriptionStep"
|
||||
ordering="5"/>
|
||||
|
||||
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||
|
||||
</ctd:authoring-kit>
|
||||
|
||||
</ctd:content-type>
|
||||
|
||||
|
||||
</ctd:content-types>
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
|
||||
xmlns:define="/WEB-INF/bebop-define.tld"
|
||||
xmlns:show="/WEB-INF/bebop-show.tld"
|
||||
version="1.2">
|
||||
|
||||
|
||||
<jsp:directive.page import="com.arsdigita.dispatcher.DispatcherHelper"/>
|
||||
<jsp:directive.page import="com.arsdigita.bebop.parameters.BigDecimalParameter"/>
|
||||
<jsp:directive.page import="com.arsdigita.navigation.Navigation"/>
|
||||
<jsp:directive.page import="com.arsdigita.navigation.cms.CMSDataCollectionDefinition"/>
|
||||
<jsp:directive.page import="com.arsdigita.navigation.cms.CMSDataCollectionRenderer"/>
|
||||
|
||||
|
||||
<jsp:scriptlet>
|
||||
long age = Navigation.getConfig().getIndexPageCacheLifetime();
|
||||
if (age == 0) {
|
||||
DispatcherHelper.cacheDisable(response);
|
||||
} else {
|
||||
DispatcherHelper.cacheForWorld(response, (int)age);
|
||||
}
|
||||
</jsp:scriptlet>
|
||||
|
||||
<define:page name="defaultItemPage" application="navigation"
|
||||
title="Navigation" cache="true">
|
||||
|
||||
<define:component name="greetingItem"
|
||||
classname="com.arsdigita.navigation.ui.GreetingItem"/>
|
||||
<define:component name="categoryPath"
|
||||
classname="com.arsdigita.navigation.ui.category.Path"/>
|
||||
<define:component name="categoryMenu"
|
||||
classname="com.arsdigita.navigation.ui.category.Menu"/>
|
||||
<define:component name="itemList"
|
||||
classname="com.arsdigita.navigation.ui.object.SimpleObjectList"/>
|
||||
|
||||
<define:component name="assignedTerms"
|
||||
classname="com.arsdigita.navigation.ui.CategoryIndexAssignedTerms"/>
|
||||
|
||||
<define:component name="itemXML"
|
||||
classname="com.arsdigita.cms.dispatcher.SciOrganizationDescriptionPanel"/>
|
||||
|
||||
<define:component name="assignedTerms"
|
||||
classname="com.arsdigita.navigation.ui.CategoryIndexAssignedTerms"/>
|
||||
|
||||
</define:page>
|
||||
|
||||
<show:all/>
|
||||
|
||||
|
||||
</jsp:root>
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
<?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">
|
||||
|
||||
<ctd:content-type
|
||||
label="SciProject"
|
||||
description="Projects of scientific organizations."
|
||||
objectType="com.arsdigita.cms.contenttypes.SciProject"
|
||||
classname="com.arsdigita.cms.contenttypes.SciProject">
|
||||
|
||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.project_properties.title"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.project_properties.title"
|
||||
descriptionBundle="com.arsdigita.cms.contenttypes.ui.SciProjectResources"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciProjectPropertiesStep"
|
||||
ordering="1"/>
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.project.members"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.project.members.description"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciProjectMemberStep"
|
||||
ordering="2"/>
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.project.subprojects"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.project.subprojects"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciProjectSubprojectsStep"
|
||||
ordering="3"/>
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.project.departments"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.project.departments"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciProjectDepartmentsStep"
|
||||
ordering="4"/>
|
||||
|
||||
|
||||
<!--<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.project.publications"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.project.publications"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciProjectPublicationsStep"
|
||||
ordering="5"/> -->
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.project_description.title"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.project_description.title"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciProjectDescriptionStep"
|
||||
ordering="5"/>
|
||||
|
||||
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||
|
||||
</ctd:authoring-kit>
|
||||
|
||||
</ctd:content-type>
|
||||
|
||||
|
||||
</ctd:content-types>
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
|
||||
xmlns:define="/WEB-INF/bebop-define.tld"
|
||||
xmlns:show="/WEB-INF/bebop-show.tld"
|
||||
version="1.2">
|
||||
|
||||
<jsp:directive.page
|
||||
import="com.arsdigita.navigation.NavigationModel,
|
||||
com.arsdigita.navigation.cms.CMSNavigationModel"/>
|
||||
|
||||
<jsp:declaration>
|
||||
NavigationModel model = new CMSNavigationModel();
|
||||
</jsp:declaration>
|
||||
|
||||
<define:page name="itemPage" application="content-section"
|
||||
title="APLAWS" cache="false">
|
||||
|
||||
<define:component name="categoryPath"
|
||||
classname="com.arsdigita.navigation.ui.category.Path"/>
|
||||
<jsp:scriptlet>
|
||||
((com.arsdigita.navigation.ui.category.Path)categoryPath)
|
||||
.setModel(model);
|
||||
</jsp:scriptlet>
|
||||
<define:component name="categoryMenu"
|
||||
classname="com.arsdigita.navigation.ui.category.Menu"/>
|
||||
<jsp:scriptlet>
|
||||
((com.arsdigita.navigation.ui.category.Menu)categoryMenu)
|
||||
.setModel(model);
|
||||
</jsp:scriptlet>
|
||||
<define:component name="itemXML"
|
||||
classname="com.arsdigita.cms.dispatcher.ContentPanel"/>
|
||||
<define:component name="orgaXML"
|
||||
classname="com.arsdigita.cms.contenttypes.ui.SciDepartmentPanel"/>
|
||||
|
||||
<define:component name="relatedItems"
|
||||
classname="com.arsdigita.lnavigation.ui.RelatedItems"/>
|
||||
|
||||
<define:component name="assignedTerms"
|
||||
classname="com.arsdigita.bundle.ui.AssignedItemTerms"/>
|
||||
</define:page>
|
||||
|
||||
<show:all/>
|
||||
|
||||
|
||||
</jsp:root>
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
|
||||
xmlns:define="/WEB-INF/bebop-define.tld"
|
||||
xmlns:show="/WEB-INF/bebop-show.tld"
|
||||
version="1.2">
|
||||
|
||||
<jsp:directive.page
|
||||
import="com.arsdigita.navigation.NavigationModel,
|
||||
com.arsdigita.navigation.cms.CMSNavigationModel"/>
|
||||
|
||||
<jsp:declaration>
|
||||
NavigationModel model = new CMSNavigationModel();
|
||||
</jsp:declaration>
|
||||
|
||||
<define:page name="itemPage" application="content-section"
|
||||
title="APLAWS" cache="false">
|
||||
|
||||
<define:component name="categoryPath"
|
||||
classname="com.arsdigita.navigation.ui.category.Path"/>
|
||||
<jsp:scriptlet>
|
||||
((com.arsdigita.navigation.ui.category.Path)categoryPath)
|
||||
.setModel(model);
|
||||
</jsp:scriptlet>
|
||||
<define:component name="categoryMenu"
|
||||
classname="com.arsdigita.navigation.ui.category.Menu"/>
|
||||
<jsp:scriptlet>
|
||||
((com.arsdigita.navigation.ui.category.Menu)categoryMenu)
|
||||
.setModel(model);
|
||||
</jsp:scriptlet>
|
||||
<define:component name="itemXML"
|
||||
classname="com.arsdigita.cms.dispatcher.ContentPanel"/>
|
||||
<define:component name="orgaXML"
|
||||
classname="com.arsdigita.cms.contenttypes.ui.SciOrganizationPanel"/>
|
||||
|
||||
<define:component name="relatedItems"
|
||||
classname="com.arsdigita.navigation.ui.RelatedItems"/>
|
||||
|
||||
<define:component name="assignedTerms"
|
||||
classname="com.arsdigita.bundle.ui.AssignedItemTerms"/>
|
||||
</define:page>
|
||||
|
||||
<show:all/>
|
||||
|
||||
|
||||
</jsp:root>
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
|
||||
xmlns:define="/WEB-INF/bebop-define.tld"
|
||||
xmlns:show="/WEB-INF/bebop-show.tld"
|
||||
version="1.2">
|
||||
|
||||
<jsp:directive.page
|
||||
import="com.arsdigita.navigation.NavigationModel,
|
||||
com.arsdigita.navigation.cms.CMSNavigationModel"/>
|
||||
|
||||
<jsp:declaration>
|
||||
NavigationModel model = new CMSNavigationModel();
|
||||
</jsp:declaration>
|
||||
|
||||
<define:page name="itemPage" application="content-section"
|
||||
title="APLAWS" cache="false">
|
||||
|
||||
<define:component name="categoryPath"
|
||||
classname="com.arsdigita.navigation.ui.category.Path"/>
|
||||
<jsp:scriptlet>
|
||||
((com.arsdigita.navigation.ui.category.Path)categoryPath)
|
||||
.setModel(model);
|
||||
</jsp:scriptlet>
|
||||
<define:component name="categoryMenu"
|
||||
classname="com.arsdigita.navigation.ui.category.Menu"/>
|
||||
<jsp:scriptlet>
|
||||
((com.arsdigita.navigation.ui.category.Menu)categoryMenu)
|
||||
.setModel(model);
|
||||
</jsp:scriptlet>
|
||||
<define:component name="itemXML"
|
||||
classname="com.arsdigita.cms.dispatcher.ContentPanel"/>
|
||||
<define:component name="orgaXML"
|
||||
classname="com.arsdigita.cms.contenttypes.ui.SciProjectPanel"/>
|
||||
|
||||
<define:component name="relatedItems"
|
||||
classname="com.arsdigita.navigation.ui.RelatedItems"/>
|
||||
|
||||
<define:component name="assignedTerms"
|
||||
classname="com.arsdigita.bundle.ui.AssignedItemTerms"/>
|
||||
</define:page>
|
||||
|
||||
<show:all/>
|
||||
|
||||
|
||||
</jsp:root>
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<?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.SciDepartment" extends="com.arsdigita.cms.ContentPage">
|
||||
<xrd:attributes rule="exclude">
|
||||
<xrd:property name="/object/departmentDescription"/>
|
||||
</xrd:attributes>
|
||||
<!--<xrd:associations rule="include">
|
||||
<xrd:property name="/object/addendum"/>
|
||||
<xrd:property name="/object/contacts"/>
|
||||
<xrd:property name="/object/contacts/person"/>
|
||||
<xrd:property name="/object/contacts/address"/>
|
||||
<xrd:property name="/object/contacts/contactentries"/>
|
||||
<xrd:property name="/object/subDepartments"/>
|
||||
<xrd:property name="/object/subDepartments/projects"/>
|
||||
<xrd:property name="/object/subDepartments/contacts"/>
|
||||
<xrd:property name="/object/subDepartments/contacts/address"/>
|
||||
<xrd:property name="/object/subDepartments/contacts/contactentries"/>
|
||||
<xrd:property name="/object/projects"/>
|
||||
<xrd:property name="/object/projects/persons"/>
|
||||
<xrd:property name="/object/persons"/>
|
||||
<xrd:property name="/object/persons/contacts"/>
|
||||
<xrd:property name="/object/persons/contacts/address"/>
|
||||
<xrd:property name="/object/persons/contacts/contactentries"/>
|
||||
</xrd:associations>-->
|
||||
</xrd:adapter>
|
||||
</xrd:context>
|
||||
</xrd:adapters>
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
<?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">
|
||||
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
|
||||
|
||||
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.SciMember"
|
||||
extends="com.arsdigita.cms.ContentPage">
|
||||
|
||||
<xrd:attributes rule="exclude">
|
||||
<xrd:property name="/object/birthdate"/>
|
||||
<xrd:property name="/object/gender"/>
|
||||
</xrd:attributes>
|
||||
|
||||
<xrd:associations rule="include">
|
||||
<xrd:property name="/object/contacts"/>
|
||||
<xrd:property name="/object/contacts/contactentries"/>
|
||||
<xrd:property name="/object/contacts/address"/>
|
||||
<xrd:property name="/object/organizationalunit"/>
|
||||
</xrd:associations>
|
||||
|
||||
</xrd:adapter>
|
||||
</xrd:context>
|
||||
</xrd:adapters>
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<?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.SciOrganization"
|
||||
extends="com.arsdigita.cms.ContentPage">
|
||||
<xrd:attributes rule="exclude">
|
||||
<xrd:property name="/object/organizationDescription"/>
|
||||
</xrd:attributes>
|
||||
<!--<xrd:associations rule="include">
|
||||
<xrd:property name="/object/addendum"/>
|
||||
<xrd:property name="/object/contacts"/>
|
||||
<xrd:property name="/object/contacts/person"/>
|
||||
<xrd:property name="/object/contacts/address"/>
|
||||
<xrd:property name="/object/contacts/contactentries"/>
|
||||
<xrd:property name="/object/departments"/>
|
||||
<xrd:property name="/object/departments/persons"/>
|
||||
<xrd:property name="/object/departments/persons/contacts"/>
|
||||
<xrd:property name="/object/departments/persons/contacts/address"/>
|
||||
<xrd:property name="/object/departments/persons/contacts/contactentries"/>
|
||||
<xrd:property name="/object/projects"/>
|
||||
<xrd:property name="/object/projects/persons"/>
|
||||
<xrd:property name="/object/persons"/>
|
||||
<xrd:property name="/object/persons/contacts"/>
|
||||
<xrd:property name="/object/persons/contacts/address"/>
|
||||
<xrd:property name="/object/persons/contacts/contactentries"/>
|
||||
</xrd:associations>-->
|
||||
</xrd:adapter>
|
||||
</xrd:context>
|
||||
|
||||
</xrd:adapters>
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<?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.SciProject" extends="com.arsdigita.cms.ContentPage">
|
||||
<xrd:attributes rule="exclude">
|
||||
<xrd:property name="/object/projectDescription"/>
|
||||
</xrd:attributes>
|
||||
<!--<xrd:associations rule="include">
|
||||
<xrd:property name="/object/contacts"/>
|
||||
<xrd:property name="/object/persons"/>
|
||||
</xrd:associations>-->
|
||||
</xrd:adapter>
|
||||
</xrd:context>
|
||||
|
||||
<xrd:context name="com.arsdigita.cms.contenttypes.SciProjectListXmlGenerator">
|
||||
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.SciProject" extends="com.arsdigita.cms.ContentPage">-->
|
||||
<!--<xrd:attributes rule="exclude">
|
||||
<xrd:property name="/object/projectDescription"/>
|
||||
</xrd:attributes>-->
|
||||
<xrd:associations rule="include">
|
||||
<xrd:property name="/object/contacts"/>
|
||||
<xrd:property name="/object/persons"/>
|
||||
</xrd:associations>
|
||||
</xrd:adapter>
|
||||
</xrd:context>
|
||||
</xrd:adapters>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<registry>
|
||||
<config class="com.arsdigita.cms.contenttypes.SciOrganizationConfig"
|
||||
storage="ccm-sci-types-organization/sciorganization.properties"/>
|
||||
</registry>
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<load>
|
||||
<requires>
|
||||
<table name="inits"/>
|
||||
<table name="acs_objects"/>
|
||||
<table name="cms_items"/>
|
||||
<table name="cms_related_links"/>
|
||||
<initializer class="com.arsdigita.cms.Initializer"/>
|
||||
</requires>
|
||||
<provides>
|
||||
<table name="ct_sciorga_organizations"/>
|
||||
<table name="ct_sciorga_departments"/>
|
||||
<table name="ct_sciorga_projects"/>
|
||||
<table name="ct_sciorga_members"/>
|
||||
<initializer class="com.arsdigita.cms.contenttypes.SciOrganizationInitializer"/>
|
||||
<initializer class="com.arsdigita.cms.contenttypes.SciDepartmentInitializer"/>
|
||||
<initializer class="com.arsdigita.cms.contenttypes.SciProjectInitializer"/>
|
||||
<initializer class="com.arsdigita.cms.contenttypes.SciMemberInitializer"/>
|
||||
</provides>
|
||||
<scripts>
|
||||
<schema directory="ccm-sci-types-organization"/>
|
||||
<data class="com.arsdigita.cms.contenttypes.SciOrganizationLoader"/>
|
||||
<data class="com.arsdigita.cms.contenttypes.SciDepartmentLoader"/>
|
||||
<data class="com.arsdigita.cms.contenttypes.SciProjectLoader"/>
|
||||
<data class="com.arsdigita.cms.contenttypes.SciMemberLoader"/>
|
||||
</scripts>
|
||||
</load>
|
||||
|
|
@ -1,620 +0,0 @@
|
|||
/*
|
||||
* 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.DataObjectNotFoundException;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.DataQuery;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.util.Assert;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* A class for representing departments of an organization. Adds two
|
||||
* associations to {@link GenericOrganizationalUnit}:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>Subdepartments</li>
|
||||
* <li>Projects</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* The <em>subdepartments</em> association links one instance of this class
|
||||
* with another.
|
||||
* The <em>projects</em> association links an department with projects.
|
||||
* </p>
|
||||
* <p>
|
||||
* Also, there are two additional fields:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>shortDescription</li>
|
||||
* <li>description</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* <em>shortDescription</em> takes a short text (maximum length 500 characters)
|
||||
* about the department. For more detailed description, the <em>description</em>
|
||||
* field can be used.
|
||||
* </p>
|
||||
* <p>
|
||||
* There is an
|
||||
* <a href="doc-files/ccm-sci-types-organization_entities.png">UML digram</a>
|
||||
* with an overview of the content types and their associations. Please not that
|
||||
* the diagram show a design sketch and not the actually implemented classes.
|
||||
* </p>
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see GenericOrganizationalUnit
|
||||
* @see SciOrganization
|
||||
* @see SciProject
|
||||
*/
|
||||
public class SciDepartment extends GenericOrganizationalUnit {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(SciDepartment.class);
|
||||
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 {
|
||||
logger.debug("Static initalizer starting...");
|
||||
s_config.load();
|
||||
logger.debug("Static initalizer finished.");
|
||||
}
|
||||
|
||||
public enum MemberStatus {
|
||||
|
||||
ALL,
|
||||
ACTIVE,
|
||||
ASSOCIATED,
|
||||
FORMER
|
||||
}
|
||||
|
||||
public enum ProjectStatus {
|
||||
|
||||
ALL,
|
||||
ONGOING,
|
||||
FINISHED
|
||||
}
|
||||
|
||||
public SciDepartment() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public SciDepartment(BigDecimal id) throws DataObjectNotFoundException {
|
||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
}
|
||||
|
||||
public SciDepartment(OID oid) throws DataObjectNotFoundException {
|
||||
super(oid);
|
||||
}
|
||||
|
||||
public SciDepartment(DataObject obj) {
|
||||
super(obj);
|
||||
}
|
||||
|
||||
public SciDepartment(String type) {
|
||||
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);
|
||||
}
|
||||
|
||||
public void setDepartmentDescription(String description) {
|
||||
set(DEPARTMENT_DESCRIPTION, description);
|
||||
}
|
||||
|
||||
public SciDepartment getSuperDepartment() {
|
||||
/*This is some sort of hack because if we define the
|
||||
* relation in PDL with a multiplicity of 0..1 for the super department
|
||||
* part, CCM crashes when trying to publish the item. So we have to
|
||||
* define both parts of the association with 0..n in PDL. But we don't
|
||||
* want more than one superior department per department. So we are
|
||||
* retrieving the data collection and get the first element of it, and
|
||||
* return this.
|
||||
*/
|
||||
DataCollection collection;
|
||||
|
||||
collection = (DataCollection) get(SUPER_DEPARTMENT);
|
||||
|
||||
if (0 == collection.size()) {
|
||||
return null;
|
||||
} else {
|
||||
DataObject dobj;
|
||||
|
||||
collection.next();
|
||||
dobj = collection.getDataObject();
|
||||
collection.close();
|
||||
|
||||
return (SciDepartment) DomainObjectFactory.newInstance(dobj);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSuperDepartment(SciDepartment department) {
|
||||
/* Similar hack as in getSuperDepartment() above. Here, we are
|
||||
* retrieving the data collection, removing the first (and only item)
|
||||
* and put the new one in it.
|
||||
*
|
||||
*/
|
||||
SciDepartment oldSuperDepartment;
|
||||
|
||||
oldSuperDepartment = getSuperDepartment();
|
||||
if (oldSuperDepartment != null) {
|
||||
remove(SUPER_DEPARTMENT, oldSuperDepartment);
|
||||
}
|
||||
|
||||
if (null != department) {
|
||||
Assert.exists(department, SciDepartment.class);
|
||||
DataObject link = add(SUPER_DEPARTMENT, department);
|
||||
link.set(SUBDEPARTMENT_ORDER,
|
||||
Integer.valueOf((int) department.getSubDepartments().size()));
|
||||
link.save();
|
||||
}
|
||||
}
|
||||
|
||||
/*public boolean hasSuperDepartment() {
|
||||
|
||||
|
||||
|
||||
}*/
|
||||
public SciOrganization getOrganization() {
|
||||
DataCollection collection;
|
||||
|
||||
collection = (DataCollection) get(ORGANIZATION);
|
||||
|
||||
if (0 == collection.size()) {
|
||||
return null;
|
||||
} else {
|
||||
DataObject dobj;
|
||||
|
||||
collection.next();
|
||||
dobj = collection.getDataObject();
|
||||
collection.close();
|
||||
|
||||
return (SciOrganization) DomainObjectFactory.newInstance(dobj);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOrganization(SciOrganization orga) {
|
||||
SciOrganization oldOrganization;
|
||||
|
||||
oldOrganization = getOrganization();
|
||||
if (oldOrganization != null) {
|
||||
remove(ORGANIZATION, oldOrganization);
|
||||
}
|
||||
|
||||
if (null != orga) {
|
||||
Assert.exists(orga, SciOrganization.class);
|
||||
DataObject link = add(ORGANIZATION, orga);
|
||||
link.set(SciOrganization.DEPARTMENT_ORDER,
|
||||
Integer.valueOf((int) orga.getDepartments().size()));
|
||||
link.save();
|
||||
}
|
||||
}
|
||||
|
||||
public SciDepartmentSubDepartmentsCollection getSubDepartments() {
|
||||
return new SciDepartmentSubDepartmentsCollection(
|
||||
(DataCollection) get(SUBDEPARTMENTS));
|
||||
}
|
||||
|
||||
public void addSubDepartment(SciDepartment subDepartment) {
|
||||
Assert.exists(subDepartment, SciDepartment.class);
|
||||
|
||||
DataObject link = add(SUBDEPARTMENTS, subDepartment);
|
||||
|
||||
link.set(SUBDEPARTMENT_ORDER, Integer.valueOf((int) getSubDepartments().
|
||||
size()));
|
||||
link.save();
|
||||
}
|
||||
|
||||
public void removeSubDepartment(SciDepartment subDepartment) {
|
||||
Assert.exists(subDepartment, SciDepartment.class);
|
||||
|
||||
remove(SUBDEPARTMENTS, subDepartment);
|
||||
}
|
||||
|
||||
public SciDepartmentProjectsCollection getProjects() {
|
||||
return new SciDepartmentProjectsCollection(
|
||||
(DataCollection) get(PROJECTS));
|
||||
}
|
||||
|
||||
public void addProject(SciProject project) {
|
||||
Assert.exists(project, SciProject.class);
|
||||
|
||||
DataObject link = add(PROJECTS, project);
|
||||
|
||||
link.set(PROJECT_ORDER,
|
||||
Integer.valueOf((int) getProjects().size()));
|
||||
link.set(SciProject.DEPARTMENTS_ORDER,
|
||||
Integer.valueOf((int) project.getDepartments().size()));
|
||||
link.save();
|
||||
}
|
||||
|
||||
public void removeProject(SciProject project) {
|
||||
Assert.exists(project, SciProject.class);
|
||||
|
||||
remove(PROJECTS, project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContacts() {
|
||||
boolean result = false;
|
||||
|
||||
DataQuery query =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfContactsOfSciDepartment");
|
||||
query.setParameter("department", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
||||
query.close();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean hasSubDepartments() {
|
||||
boolean result = false;
|
||||
|
||||
DataQuery query =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
||||
query.setParameter("department", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
||||
query.close();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param merge Should I also look into the departments and return true
|
||||
* if the organization or at least one of the departments has members?
|
||||
* @return
|
||||
*/
|
||||
public boolean hasMembers(final boolean merge, final MemberStatus status) {
|
||||
String queryName;
|
||||
|
||||
switch (status) {
|
||||
case ALL:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciDepartment";
|
||||
break;
|
||||
case ACTIVE:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciDepartment";
|
||||
break;
|
||||
case ASSOCIATED:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfSciDepartment";
|
||||
break;
|
||||
case FORMER:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciDepartment";
|
||||
break;
|
||||
default:
|
||||
queryName = "";
|
||||
break;
|
||||
}
|
||||
|
||||
DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
|
||||
query.setParameter("department", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
query.close();
|
||||
return true;
|
||||
} else {
|
||||
if (merge) {
|
||||
query.close();
|
||||
DataQuery departmentsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
||||
departmentsQuery.setParameter("department", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
BigDecimal departmentId;
|
||||
boolean result = false;
|
||||
while (departmentsQuery.next()) {
|
||||
departmentId = (BigDecimal) departmentsQuery.get(
|
||||
"subDepartmentId");
|
||||
result = hasMembers(departmentId, merge, status);
|
||||
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
departmentsQuery.close();
|
||||
return result;
|
||||
} else {
|
||||
departmentsQuery.close();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
query.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasMembers(final BigDecimal departmentId,
|
||||
final boolean merge,
|
||||
final MemberStatus status) {
|
||||
String queryName;
|
||||
|
||||
switch (status) {
|
||||
case ALL:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciDepartment";
|
||||
break;
|
||||
case ACTIVE:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciDepartment";
|
||||
break;
|
||||
case ASSOCIATED:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfDepartment";
|
||||
break;
|
||||
case FORMER:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciDepartment";
|
||||
break;
|
||||
default:
|
||||
queryName = "";
|
||||
break;
|
||||
}
|
||||
|
||||
DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
|
||||
query.setParameter("department", departmentId);
|
||||
|
||||
if (query.size() > 0) {
|
||||
query.close();
|
||||
return true;
|
||||
} else {
|
||||
if (merge) {
|
||||
query.close();
|
||||
DataQuery subDepartmentsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
||||
subDepartmentsQuery.setParameter("department", departmentId);
|
||||
|
||||
if (query.size() > 0) {
|
||||
BigDecimal subDepartmentId;
|
||||
boolean result = false;
|
||||
while (subDepartmentsQuery.next()) {
|
||||
subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
|
||||
"subDepartmentId");
|
||||
result = hasMembers(subDepartmentId, merge, status);
|
||||
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
subDepartmentsQuery.close();
|
||||
return result;
|
||||
} else {
|
||||
subDepartmentsQuery.close();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
query.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasProjects(final boolean merge,
|
||||
final ProjectStatus status) {
|
||||
String queryName;
|
||||
|
||||
switch (status) {
|
||||
case ALL:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfProjectsOfSciDepartment";
|
||||
break;
|
||||
case ONGOING:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfOngoingProjectsOfSciDepartment";
|
||||
break;
|
||||
case FINISHED:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfFinishedProjectsOfSciDepartment";
|
||||
break;
|
||||
default:
|
||||
queryName = "";
|
||||
break;
|
||||
}
|
||||
|
||||
DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
|
||||
query.setParameter("department", getID());
|
||||
if (status != ProjectStatus.ALL) {
|
||||
Calendar today = new GregorianCalendar();
|
||||
query.setParameter("today",
|
||||
String.format("%d-%02d-%02d",
|
||||
today.get(Calendar.YEAR),
|
||||
today.get(Calendar.MONTH) + 1,
|
||||
today.get(Calendar.DAY_OF_MONTH)));
|
||||
}
|
||||
|
||||
if (query.size() > 0) {
|
||||
query.close();
|
||||
return true;
|
||||
} else {
|
||||
if (merge) {
|
||||
query.close();
|
||||
DataQuery departmentsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
||||
departmentsQuery.setParameter("department", getID());
|
||||
|
||||
if (departmentsQuery.size() > 0) {
|
||||
BigDecimal departmentId;
|
||||
boolean result = false;
|
||||
while (departmentsQuery.next()) {
|
||||
departmentId = (BigDecimal) departmentsQuery.get(
|
||||
"subDepartmentId");
|
||||
result = hasProjects(departmentId, merge, status);
|
||||
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
departmentsQuery.close();
|
||||
return result;
|
||||
} else {
|
||||
departmentsQuery.close();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
query.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasProjects(final BigDecimal departmentId,
|
||||
final boolean merge,
|
||||
final ProjectStatus status) {
|
||||
String queryName;
|
||||
|
||||
switch (status) {
|
||||
case ALL:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfProjectsOfSciDepartment";
|
||||
break;
|
||||
case ONGOING:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfOngoingProjectsOfSciDepartment";
|
||||
break;
|
||||
case FINISHED:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfFinishedProjectsOfSciDepartment";
|
||||
break;
|
||||
default:
|
||||
queryName = "";
|
||||
break;
|
||||
}
|
||||
|
||||
DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
|
||||
query.setParameter("department", departmentId);
|
||||
if (status != ProjectStatus.ALL) {
|
||||
Calendar today = new GregorianCalendar();
|
||||
query.setParameter("today",
|
||||
String.format("%d-%02d-%02d",
|
||||
today.get(Calendar.YEAR),
|
||||
today.get(Calendar.MONTH) + 1,
|
||||
today.get(Calendar.DAY_OF_MONTH)));
|
||||
|
||||
}
|
||||
|
||||
if (query.size() > 0) {
|
||||
query.close();
|
||||
return true;
|
||||
} else {
|
||||
if (merge) {
|
||||
query.close();
|
||||
DataQuery subDepartmentsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
||||
subDepartmentsQuery.setParameter("department", departmentId);
|
||||
|
||||
if (query.size() > 0) {
|
||||
BigDecimal subDepartmentId;
|
||||
boolean result = false;
|
||||
while (subDepartmentsQuery.next()) {
|
||||
subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
|
||||
"subDepartmentId");
|
||||
result = hasProjects(subDepartmentId, merge, status);
|
||||
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
subDepartmentsQuery.close();
|
||||
return result;
|
||||
} else {
|
||||
subDepartmentsQuery.close();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
query.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasPublications() {
|
||||
boolean result = false;
|
||||
|
||||
DataQuery query =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfPublicationLinksOfSciDepartment");
|
||||
query.setParameter("department", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
||||
query.close();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* 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 org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Initializer for {@link SciDepartment}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciDepartmentInitializer extends ContentTypeInitializer {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(
|
||||
SciDepartmentInitializer.class);
|
||||
|
||||
public SciDepartmentInitializer() {
|
||||
super("empty.pdl.mf", SciDepartment.BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getStylesheets() {
|
||||
return new String[]{
|
||||
"/static/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xsl"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTraversalXML() {
|
||||
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciDepartment.xml";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
/*
|
||||
* 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.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
import com.arsdigita.util.parameter.ResourceParameter;
|
||||
import com.arsdigita.workflow.simple.WorkflowTemplate;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Loader for {@link SciDepartment}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciDepartmentLoader extends AbstractContentTypeLoader {
|
||||
|
||||
private ResourceParameter m_template;
|
||||
private static final String[] TYPES = {
|
||||
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml"
|
||||
};
|
||||
|
||||
public SciDepartmentLoader() {
|
||||
super();
|
||||
|
||||
m_template = new ResourceParameter(
|
||||
"com.arsdigita.cms.contenttypes.SciDepartmentTemplate",
|
||||
Parameter.REQUIRED,
|
||||
"/WEB-INF/content-types/com/arsdigita/"
|
||||
+ "cms/contenttypes/scidepartment-item.jsp");
|
||||
|
||||
register(m_template);
|
||||
}
|
||||
|
||||
public String[] getTypes() {
|
||||
return TYPES;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void prepareSection(final ContentSection section,
|
||||
final ContentType type,
|
||||
final LifecycleDefinition lifecycle,
|
||||
final WorkflowTemplate workflow) {
|
||||
super.prepareSection(section, type, lifecycle, workflow);
|
||||
|
||||
setDefaultTemplate("SciDepartment Item",
|
||||
"scidepartment-item",
|
||||
(InputStream) get(m_template),
|
||||
section,
|
||||
type,
|
||||
lifecycle,
|
||||
workflow);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Special domain collection for the projects of an department.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
* @see SciProject
|
||||
*/
|
||||
public class SciDepartmentProjectsCollection extends DomainCollection {
|
||||
|
||||
public String ORDER = "projectOrder";
|
||||
public String LINKORDER = "link.projectOrder";
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(SciDepartmentProjectsCollection.class);
|
||||
|
||||
public SciDepartmentProjectsCollection(DataCollection dataCollection) {
|
||||
super(dataCollection);
|
||||
|
||||
m_dataCollection.addOrder(LINKORDER);
|
||||
}
|
||||
|
||||
public Integer getProjectOrder() {
|
||||
return (Integer) m_dataCollection.get(LINKORDER);
|
||||
}
|
||||
|
||||
public void setProjectOrder(Integer order) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(ORDER, order);
|
||||
}
|
||||
|
||||
public void swapWithNext(SciProject project) {
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
int nextIndex = 0;
|
||||
|
||||
s_log.debug("Searching project...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getProjectOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getProjectOrder(): %d",
|
||||
getProjectOrder()));
|
||||
if (this.getProject().equals(project)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided project is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (this.next()) {
|
||||
nextIndex = this.getProjectOrder();
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"The provided project is the last "
|
||||
+ "in the collection, so there is no next object "
|
||||
+ "to swap with.");
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
|
||||
while (this.getPosition() != currentPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setProjectOrder(nextIndex);
|
||||
this.next();
|
||||
this.setProjectOrder(currentIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public void swapWithPrevious(SciProject project) {
|
||||
int previousPosition = 0;
|
||||
int previousIndex = 0;
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
|
||||
s_log.debug("Searching project...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getProjectOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getProjectOrder(): %d",
|
||||
getProjectOrder()));
|
||||
if (this.getProject().equals(project)) {
|
||||
break;
|
||||
}
|
||||
|
||||
previousPosition = currentPosition;
|
||||
previousIndex = currentIndex;
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided project is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (previousPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided project is the first one in this "
|
||||
+ "collection, so there is no previous one to switch "
|
||||
+ "with."));
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
while (this.getPosition() != previousPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setProjectOrder(currentIndex);
|
||||
this.next();
|
||||
this.setProjectOrder(previousIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public SciProject getProject() {
|
||||
return new SciProject(m_dataCollection.getDataObject());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,155 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Special domain collection for the subdepartments of a department.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
*/
|
||||
public class SciDepartmentSubDepartmentsCollection extends DomainCollection {
|
||||
|
||||
public String ORDER = "subDepartmentOrder";
|
||||
public String LINKORDER = "link.subDepartmentOrder";
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(SciDepartmentSubDepartmentsCollection.class);
|
||||
|
||||
public SciDepartmentSubDepartmentsCollection(DataCollection dataCollection) {
|
||||
super(dataCollection);
|
||||
|
||||
m_dataCollection.addOrder(LINKORDER);
|
||||
}
|
||||
|
||||
public Integer getSubDepartmentOrder() {
|
||||
return (Integer) m_dataCollection.get(LINKORDER);
|
||||
}
|
||||
|
||||
public void setSubDepartmentOrder(Integer order) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(ORDER, order);
|
||||
}
|
||||
|
||||
public void swapWithNext(SciDepartment department) {
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
int nextIndex = 0;
|
||||
|
||||
s_log.debug("Searching department...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getSubDepartmentOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getDepartmentOrder(): %d",
|
||||
getSubDepartmentOrder()));
|
||||
if (this.getSubDepartment().equals(department)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided department is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (this.next()) {
|
||||
nextIndex = this.getSubDepartmentOrder();
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"The provided department is the last "
|
||||
+ "in the collection, so there is no next object "
|
||||
+ "to swap with.");
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
|
||||
while (this.getPosition() != currentPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setSubDepartmentOrder(nextIndex);
|
||||
this.next();
|
||||
this.setSubDepartmentOrder(currentIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public void swapWithPrevious(SciDepartment department) {
|
||||
int previousPosition = 0;
|
||||
int previousIndex = 0;
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
|
||||
s_log.debug("Searching department...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getSubDepartmentOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getDepartmentOrder(): %d",
|
||||
getSubDepartmentOrder()));
|
||||
if (this.getSubDepartment().equals(department)) {
|
||||
break;
|
||||
}
|
||||
|
||||
previousPosition = currentPosition;
|
||||
previousIndex = currentIndex;
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided department is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (previousPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided department is the first one in this "
|
||||
+ "collection, so there is no previous one to switch "
|
||||
+ "with."));
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
while (this.getPosition() != previousPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setSubDepartmentOrder(currentIndex);
|
||||
this.next();
|
||||
this.setSubDepartmentOrder(previousIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public SciDepartment getSubDepartment() {
|
||||
return new SciDepartment(m_dataCollection.getDataObject());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,143 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010 Jens Pelzetter,
|
||||
*
|
||||
* 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.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.util.Assert;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* A concrete class extending {@link GenericPerson}. Does not add any new
|
||||
* fields, it just makes the internal type <code>GenericPerson</code> usable
|
||||
* without any other modules.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciMember extends GenericPerson {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(SciMember.class);
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.contenttypes.SciMember";
|
||||
private static final String ORGANIZATIONS = "organizationalunit";
|
||||
private static final String DEPARTMENTS = "organizationalunit";
|
||||
private static final String PROJECTS = "organizationalunit";
|
||||
private static final SciOrganizationConfig s_config =
|
||||
new SciOrganizationConfig();
|
||||
|
||||
static {
|
||||
logger.debug("Static initalizer starting...");
|
||||
s_config.load();
|
||||
logger.debug("Static initalizer starting...");
|
||||
}
|
||||
|
||||
public SciMember() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public SciMember(BigDecimal id) throws DataObjectNotFoundException {
|
||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
}
|
||||
|
||||
public SciMember(OID oid) throws DataObjectNotFoundException {
|
||||
super(oid);
|
||||
}
|
||||
|
||||
public SciMember(DataObject dobj) {
|
||||
super(dobj);
|
||||
}
|
||||
|
||||
public SciMember(String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public SciMemberSciOrganizationsCollection getOrganizations() {
|
||||
return new SciMemberSciOrganizationsCollection((DataCollection) get(
|
||||
ORGANIZATIONS));
|
||||
}
|
||||
|
||||
public void addOrganization(SciOrganization organization,
|
||||
String role,
|
||||
String status) {
|
||||
Assert.exists(organization, SciOrganization.class);
|
||||
|
||||
DataObject link = add(ORGANIZATIONS, organization);
|
||||
|
||||
link.set(SciMemberSciOrganizationsCollection.MEMBER_ROLE, role);
|
||||
link.set(SciMemberSciOrganizationsCollection.STATUS, status);
|
||||
link.save();
|
||||
}
|
||||
|
||||
public void removeOrganization(SciOrganization organization) {
|
||||
Assert.exists(organization, SciOrganization.class);
|
||||
|
||||
remove(ORGANIZATIONS, organization);
|
||||
}
|
||||
|
||||
public SciMemberSciDepartmentsCollection getDepartments() {
|
||||
return new SciMemberSciDepartmentsCollection((DataCollection) get(DEPARTMENTS));
|
||||
}
|
||||
|
||||
public void addDepartment(SciDepartment department,
|
||||
String role,
|
||||
String status) {
|
||||
Assert.exists(department, SciDepartment.class);
|
||||
|
||||
DataObject link = add(DEPARTMENTS, department);
|
||||
|
||||
link.set(SciMemberSciDepartmentsCollection.MEMBER_ROLE, role);
|
||||
link.set(SciMemberSciDepartmentsCollection.STATUS, status);
|
||||
link.save();
|
||||
}
|
||||
|
||||
public void removeDepartment(SciDepartment department) {
|
||||
Assert.exists(department, SciDepartment.class);
|
||||
|
||||
remove(DEPARTMENTS, department);
|
||||
}
|
||||
|
||||
public SciMemberSciProjectsCollection getProjects() {
|
||||
return new SciMemberSciProjectsCollection((DataCollection) get(PROJECTS));
|
||||
}
|
||||
|
||||
public void addProject(SciProject project,
|
||||
String role,
|
||||
String status) {
|
||||
Assert.exists(project, SciProject.class);
|
||||
|
||||
DataObject link = add(PROJECTS, project);
|
||||
|
||||
link.set(SciMemberSciDepartmentsCollection.MEMBER_ROLE, role);
|
||||
link.set(SciMemberSciDepartmentsCollection.STATUS, status);
|
||||
link.save();
|
||||
}
|
||||
|
||||
public void removeProject(SciProject project) {
|
||||
Assert.exists(project, SciProject.class);
|
||||
|
||||
remove(PROJECTS, project);
|
||||
}
|
||||
|
||||
public static SciOrganizationConfig getConfig() {
|
||||
return s_config;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Initializer for {@link SciMember}
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciMemberInitializer extends ContentTypeInitializer {
|
||||
|
||||
public SciMemberInitializer() {
|
||||
super("empty.pdl.mf", SciMember.BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getStylesheets() {
|
||||
return new String[]{
|
||||
"/static/content-types/com/arsdigita/cms/contenttypes/SciMember.xsl"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTraversalXML() {
|
||||
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciMember.xml";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010 Jens Pelzetter,
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Loader for {@link SciMember}
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciMemberLoader extends AbstractContentTypeLoader {
|
||||
|
||||
private static final String[] TYPES = {
|
||||
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciMember.xml"};
|
||||
|
||||
@Override
|
||||
public String[] getTypes() {
|
||||
return TYPES;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2011 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.cms.ContentType;
|
||||
import com.arsdigita.domain.DomainCollection;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciMemberSciDepartmentsCollection extends DomainCollection {
|
||||
|
||||
public static final String LINK_MEMBER_ROLE = "link.role_name";
|
||||
public static final String LINK_STATUS = "link.status";
|
||||
public static final String MEMBER_ROLE = "role_name";
|
||||
public static final String STATUS = "status";
|
||||
|
||||
public SciMemberSciDepartmentsCollection(DataCollection dataCollection) {
|
||||
super(dataCollection);
|
||||
|
||||
m_dataCollection.addFilter(String.format("type = '%s'",
|
||||
ContentType.
|
||||
findByAssociatedObjectType(SciDepartment.class.getName()).getID().
|
||||
toString()));
|
||||
|
||||
m_dataCollection.addOrder("title");
|
||||
}
|
||||
|
||||
public String getRoleName() {
|
||||
return (String) m_dataCollection.get(LINK_MEMBER_ROLE);
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(MEMBER_ROLE, roleName);
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return (String) m_dataCollection.get(LINK_STATUS);
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(STATUS, status);
|
||||
}
|
||||
|
||||
public SciDepartment getDepartment() {
|
||||
return (SciDepartment) DomainObjectFactory.newInstance(m_dataCollection.
|
||||
getDataObject());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2011 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.cms.ContentType;
|
||||
import com.arsdigita.domain.DomainCollection;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciMemberSciOrganizationsCollection extends DomainCollection {
|
||||
|
||||
public static final String LINK_MEMBER_ROLE = "link.role_name";
|
||||
public static final String LINK_STATUS = "link.status";
|
||||
public static final String MEMBER_ROLE = "role_name";
|
||||
public static final String STATUS = "status";
|
||||
|
||||
public SciMemberSciOrganizationsCollection(DataCollection dataCollection) {
|
||||
super(dataCollection);
|
||||
|
||||
m_dataCollection.addFilter(String.format("type = '%s'",
|
||||
ContentType.
|
||||
findByAssociatedObjectType(SciOrganization.class.getName()).
|
||||
getID().toString()));
|
||||
|
||||
m_dataCollection.addOrder("title");
|
||||
}
|
||||
|
||||
public String getRoleName() {
|
||||
return (String) m_dataCollection.get(LINK_MEMBER_ROLE);
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(MEMBER_ROLE, roleName);
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return (String) m_dataCollection.get(LINK_STATUS);
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(STATUS, status);
|
||||
}
|
||||
|
||||
public SciOrganization getOrganization() {
|
||||
return (SciOrganization) DomainObjectFactory.newInstance(m_dataCollection.
|
||||
getDataObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2011 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.cms.ContentType;
|
||||
import com.arsdigita.domain.DomainCollection;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciMemberSciProjectsCollection extends DomainCollection {
|
||||
|
||||
public static final String LINK_MEMBER_ROLE = "link.role_name";
|
||||
public static final String LINK_STATUS = "link.status";
|
||||
public static final String MEMBER_ROLE = "role_name";
|
||||
public static final String STATUS = "status";
|
||||
|
||||
public SciMemberSciProjectsCollection(DataCollection dataCollection) {
|
||||
super(dataCollection);
|
||||
|
||||
m_dataCollection.addFilter(String.format("type = '%s'",
|
||||
ContentType.
|
||||
findByAssociatedObjectType(SciProject.class.getName()).getID().
|
||||
toString()));
|
||||
|
||||
m_dataCollection.addOrder("title");
|
||||
}
|
||||
|
||||
public String getRoleName() {
|
||||
return (String) m_dataCollection.get(LINK_MEMBER_ROLE);
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(MEMBER_ROLE, roleName);
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return (String) m_dataCollection.get(LINK_STATUS);
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(STATUS, status);
|
||||
}
|
||||
|
||||
public SciProject getProject() {
|
||||
return (SciProject) DomainObjectFactory.newInstance(m_dataCollection.
|
||||
getDataObject());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,524 +0,0 @@
|
|||
/*
|
||||
* 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.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.DataQuery;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.util.Assert;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* A class for representing departments of an organization. Adds two
|
||||
* associations to {@link GenericOrganizationalUnit}:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>departments</li>
|
||||
* <li>projects</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* The <em>departments</em> association is used to link an organization with
|
||||
* its departments. The <em>project</em> association can be used to link an
|
||||
* organization with projects.
|
||||
* </p>
|
||||
* <p>
|
||||
* Also, two fields are added. The <code>shortDescription</code> takes a string
|
||||
* of 500 characters for a short description of the organization. An detailed
|
||||
* description of the organization can be put into the <code>description</code>
|
||||
* field.
|
||||
* </p>
|
||||
* <p>
|
||||
* There is an
|
||||
* <a href="doc-files/ccm-sci-types-organization_entities.png">UML digram</a>
|
||||
* with an overview of the content types and their associations. Please not that
|
||||
* the diagram show a design sketch and not the actually implemented classes.
|
||||
* </p>
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see GenericOrganizationalUnit
|
||||
* @see SciDepartment
|
||||
* @see SciProject
|
||||
*/
|
||||
public class SciOrganization extends GenericOrganizationalUnit {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(SciOrganization.class);
|
||||
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 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 {
|
||||
logger.debug("Static initalizer starting...");
|
||||
s_config.load();
|
||||
logger.debug("Static initalizer finished.");
|
||||
}
|
||||
|
||||
public enum MemberStatus {
|
||||
|
||||
ALL,
|
||||
ACTIVE,
|
||||
ASSOCIATED,
|
||||
FORMER
|
||||
}
|
||||
|
||||
public enum ProjectStatus {
|
||||
|
||||
ALL,
|
||||
ONGOING,
|
||||
FINISHED
|
||||
}
|
||||
|
||||
public SciOrganization() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public SciOrganization(BigDecimal id) throws DataObjectNotFoundException {
|
||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
}
|
||||
|
||||
public SciOrganization(OID oid) throws DataObjectNotFoundException {
|
||||
super(oid);
|
||||
}
|
||||
|
||||
public SciOrganization(DataObject obj) {
|
||||
super(obj);
|
||||
}
|
||||
|
||||
public SciOrganization(String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public static 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContacts() {
|
||||
boolean result = false;
|
||||
|
||||
DataQuery query =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfContactsOfSciOrganization");
|
||||
query.setParameter("organization", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
||||
query.close();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean hasDepartments() {
|
||||
boolean result = false;
|
||||
|
||||
DataQuery query =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfDepartmentsOfSciOrganization");
|
||||
query.setParameter("organization", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
||||
query.close();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param merge Should I also look into the departments and return true
|
||||
* if the organization or at least one of the departments has members?
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
public boolean hasMembers(final boolean merge, final MemberStatus status) {
|
||||
String queryName;
|
||||
|
||||
switch (status) {
|
||||
case ALL:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciOrganization";
|
||||
break;
|
||||
case ACTIVE:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciOrganization";
|
||||
break;
|
||||
case ASSOCIATED:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfSciOrganization";
|
||||
break;
|
||||
case FORMER:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciOrganization";
|
||||
break;
|
||||
default:
|
||||
queryName = "";
|
||||
break;
|
||||
}
|
||||
|
||||
DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
|
||||
query.setParameter("organization", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
query.close();
|
||||
return true;
|
||||
} else {
|
||||
if (merge) {
|
||||
query.close();
|
||||
DataQuery departmentsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfDepartmentsOfSciOrganization");
|
||||
departmentsQuery.setParameter("organization", getID());
|
||||
|
||||
if (departmentsQuery.size() > 0) {
|
||||
BigDecimal departmentId;
|
||||
boolean result = false;
|
||||
while (departmentsQuery.next()) {
|
||||
departmentId = (BigDecimal) departmentsQuery.get(
|
||||
"departmentId");
|
||||
result = hasMembers(departmentId, merge, status);
|
||||
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
departmentsQuery.close();
|
||||
return result;
|
||||
} else {
|
||||
departmentsQuery.close();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
query.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasMembers(final BigDecimal departmentId,
|
||||
final boolean merge,
|
||||
final MemberStatus status) {
|
||||
String queryName;
|
||||
|
||||
switch (status) {
|
||||
case ALL:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciDepartment";
|
||||
break;
|
||||
case ACTIVE:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciDepartment";
|
||||
break;
|
||||
case ASSOCIATED:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfSciDepartment";
|
||||
break;
|
||||
case FORMER:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciDepartment";
|
||||
break;
|
||||
default:
|
||||
queryName = "";
|
||||
break;
|
||||
}
|
||||
|
||||
DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
|
||||
query.setParameter("department", departmentId);
|
||||
|
||||
if (query.size() > 0) {
|
||||
query.close();
|
||||
return true;
|
||||
} else {
|
||||
if (merge) {
|
||||
query.close();
|
||||
DataQuery subDepartmentsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
||||
subDepartmentsQuery.setParameter("department", departmentId);
|
||||
|
||||
if (query.size() > 0) {
|
||||
BigDecimal subDepartmentId;
|
||||
boolean result = false;
|
||||
while (subDepartmentsQuery.next()) {
|
||||
subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
|
||||
"subDepartmentId");
|
||||
result = hasMembers(subDepartmentId, merge, status);
|
||||
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
subDepartmentsQuery.close();
|
||||
return result;
|
||||
} else {
|
||||
subDepartmentsQuery.close();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
query.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasProjects(final boolean merge,
|
||||
final ProjectStatus status) {
|
||||
String queryName;
|
||||
|
||||
switch (status) {
|
||||
case ALL:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfProjectsOfSciOrganization";
|
||||
break;
|
||||
case ONGOING:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfOngoingProjectsOfSciOrganization";
|
||||
break;
|
||||
case FINISHED:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfFinishedProjectsOfSciOrganization";
|
||||
break;
|
||||
default:
|
||||
queryName = "";
|
||||
break;
|
||||
}
|
||||
|
||||
DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
|
||||
query.setParameter("organization", getID());
|
||||
if (status != ProjectStatus.ALL) {
|
||||
Calendar today = new GregorianCalendar();
|
||||
query.setParameter("today",
|
||||
String.format("%d-%02d-%02d",
|
||||
today.get(Calendar.YEAR),
|
||||
today.get(Calendar.MONTH) + 1,
|
||||
today.get(Calendar.DAY_OF_MONTH)));
|
||||
}
|
||||
|
||||
if (query.size() > 0) {
|
||||
query.close();
|
||||
return true;
|
||||
} else {
|
||||
if (merge) {
|
||||
query.close();
|
||||
DataQuery departmentsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfDepartmentsOfSciOrganization");
|
||||
departmentsQuery.setParameter("organization", getID());
|
||||
|
||||
if (departmentsQuery.size() > 0) {
|
||||
BigDecimal departmentId;
|
||||
boolean result = false;
|
||||
while (departmentsQuery.next()) {
|
||||
departmentId = (BigDecimal) departmentsQuery.get(
|
||||
"departmentId");
|
||||
result = hasProjects(departmentId, merge, status);
|
||||
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
departmentsQuery.close();
|
||||
return result;
|
||||
} else {
|
||||
departmentsQuery.close();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
query.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasProjects(final BigDecimal departmentId,
|
||||
final boolean merge,
|
||||
final ProjectStatus status) {
|
||||
String queryName;
|
||||
|
||||
switch (status) {
|
||||
case ALL:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfProjectsOfSciDepartment";
|
||||
break;
|
||||
case ONGOING:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfOngoingProjectsOfSciDepartment";
|
||||
break;
|
||||
case FINISHED:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfFinishedProjectsOfSciDepartment";
|
||||
break;
|
||||
default:
|
||||
queryName = "";
|
||||
break;
|
||||
}
|
||||
|
||||
DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
|
||||
query.setParameter("department", departmentId);
|
||||
if (status != ProjectStatus.ALL) {
|
||||
Calendar today = new GregorianCalendar();
|
||||
query.setParameter("today",
|
||||
String.format("%d-%02d-%02d",
|
||||
today.get(Calendar.YEAR),
|
||||
today.get(Calendar.MONTH) + 1,
|
||||
today.get(Calendar.DAY_OF_MONTH)));
|
||||
|
||||
}
|
||||
|
||||
if (query.size() > 0) {
|
||||
query.close();
|
||||
return true;
|
||||
} else {
|
||||
if (merge) {
|
||||
query.close();
|
||||
DataQuery subDepartmentsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
|
||||
subDepartmentsQuery.setParameter("department", departmentId);
|
||||
|
||||
if (subDepartmentsQuery.size() > 0) {
|
||||
BigDecimal subDepartmentId;
|
||||
boolean result = false;
|
||||
while (subDepartmentsQuery.next()) {
|
||||
subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
|
||||
"subDepartmentId");
|
||||
result = hasProjects(subDepartmentId, merge, status);
|
||||
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
subDepartmentsQuery.close();
|
||||
return result;
|
||||
} else {
|
||||
subDepartmentsQuery.close();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
query.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*public boolean hasPublications() {
|
||||
boolean result = false;
|
||||
|
||||
DataQuery query =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfPublicationLinksOfSciOrganization");
|
||||
query.setParameter("organization", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
||||
query.close();
|
||||
|
||||
return result;
|
||||
}*/
|
||||
|
||||
public void setOrganizationDescription(String description) {
|
||||
set(ORGANIZATION_DESCRIPTION, description);
|
||||
}
|
||||
|
||||
public SciOrganizationDepartmentsCollection getDepartments() {
|
||||
return new SciOrganizationDepartmentsCollection(
|
||||
(DataCollection) get(DEPARTMENTS));
|
||||
}
|
||||
|
||||
public void addDepartment(SciDepartment department) {
|
||||
Assert.exists(department, SciDepartment.class);
|
||||
|
||||
DataObject link = add(DEPARTMENTS, department);
|
||||
|
||||
link.set(DEPARTMENT_ORDER,
|
||||
Integer.valueOf((int) getDepartments().size()));
|
||||
link.save();
|
||||
}
|
||||
|
||||
public void removeDepartment(SciDepartment department) {
|
||||
Assert.exists(department, SciDepartment.class);
|
||||
|
||||
remove(DEPARTMENTS, department);
|
||||
}
|
||||
|
||||
public SciOrganizationProjectsCollection getProjects() {
|
||||
return new SciOrganizationProjectsCollection(
|
||||
(DataCollection) get(PROJECTS));
|
||||
}
|
||||
|
||||
public void addProject(SciProject project) {
|
||||
Assert.exists(project, SciProject.class);
|
||||
|
||||
DataObject link = add(PROJECTS, project);
|
||||
link.set(PROJECT_ORDER, Integer.valueOf((int) getProjects().size()));
|
||||
link.set(SciProject.ORGANIZATIONS_ORDER, Integer.valueOf((int) project.
|
||||
getOrganizations().size()));
|
||||
link.save();
|
||||
}
|
||||
|
||||
public void removeProject(SciProject project) {
|
||||
Assert.exists(project, SciProject.class);
|
||||
|
||||
remove(PROJECTS, project);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,329 +0,0 @@
|
|||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.runtime.AbstractConfig;
|
||||
import com.arsdigita.util.parameter.BooleanParameter;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
|
||||
/**
|
||||
* Configuration class for the complete ccm-sci-types-organization-module.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
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_organizationMembersAllInOne;
|
||||
private final Parameter m_organizationMembersMerge;
|
||||
private final Parameter m_organizationProjectsAllInOne;
|
||||
private final Parameter m_organizationProjectsMerge;
|
||||
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_departmentPublicationsHide;
|
||||
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_projectFundingVolumeHide;
|
||||
private final Parameter m_projectMaterialsHide;
|
||||
private final Parameter m_projectMembersAllInOne;
|
||||
private final Parameter m_projectMembersMerge;
|
||||
|
||||
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_organizationMembersAllInOne = new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciorganization.members_all_in_one",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.FALSE);
|
||||
m_organizationMembersMerge = new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciorganization.members_merge",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
m_organizationProjectsAllInOne = new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciorganization.projects_all_in_one",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.FALSE);
|
||||
m_organizationProjectsMerge = new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciorganization.projects_merge",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
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.TRUE);
|
||||
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.TRUE);
|
||||
m_departmentAddContactHide = new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.scidepartment.add_contact_hide",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.FALSE);
|
||||
m_departmentPublicationsHide = new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.scidepartment.publications_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.TRUE);
|
||||
m_projectSetSuperProjectHide = new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciproject.set_superproject_hide",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
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,
|
||||
Boolean.FALSE);
|
||||
m_projectFundingDhtml = new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciproject.funding_dhtml",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.FALSE);
|
||||
m_projectFundingVolumeHide = new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciproject.funding_volume_hide",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.FALSE);
|
||||
m_projectMaterialsHide = new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciproject.materials_hide",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.FALSE);
|
||||
|
||||
m_projectMembersAllInOne = new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciproject.members_all_in_one",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.TRUE);
|
||||
m_projectMembersMerge = new BooleanParameter(
|
||||
"com.arsdigita.cms.contenttypes.sciproject.members_merge",
|
||||
Parameter.REQUIRED,
|
||||
Boolean.FALSE);
|
||||
|
||||
register(m_organizationAddPersonHide);
|
||||
register(m_organizationAddDepartmentHide);
|
||||
register(m_organizationAddProjectHide);
|
||||
register(m_organizationMembersAllInOne);
|
||||
register(m_organizationMembersMerge);
|
||||
register(m_organizationProjectsAllInOne);
|
||||
register(m_organizationProjectsMerge);
|
||||
|
||||
register(m_departmentAddPersonHide);
|
||||
register(m_departmentAddSubDepartmentHide);
|
||||
register(m_departmentAddProjectHide);
|
||||
register(m_departmentSetOrganizationHide);
|
||||
register(m_departmentSetSuperDepartmentHide);
|
||||
register(m_departmentPublicationsHide);
|
||||
|
||||
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_projectFundingVolumeHide);
|
||||
register(m_projectFundingDhtml);
|
||||
register(m_projectMaterialsHide);
|
||||
|
||||
register(m_projectMembersAllInOne);
|
||||
register(m_projectMembersMerge);
|
||||
|
||||
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 getOrganizationMembersAllInOne() {
|
||||
return (Boolean) get(m_organizationMembersAllInOne);
|
||||
}
|
||||
|
||||
public final boolean getOrganizationMembersMerge() {
|
||||
return (Boolean) get(m_organizationMembersMerge);
|
||||
}
|
||||
|
||||
public final boolean getOrganizationProjectsAllInOne() {
|
||||
return (Boolean) get(m_organizationProjectsAllInOne);
|
||||
}
|
||||
|
||||
public final boolean getOrganizationProjectsMerge() {
|
||||
return (Boolean) get(m_organizationProjectsMerge);
|
||||
}
|
||||
|
||||
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 getDepartmentPublicationsHide() {
|
||||
return (Boolean) get(m_departmentPublicationsHide);
|
||||
}
|
||||
|
||||
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() {
|
||||
return (Boolean) get(m_projectFundingDhtml);
|
||||
}
|
||||
|
||||
public final boolean getProjectFundingVolumeHide() {
|
||||
return (Boolean) get(m_projectFundingVolumeHide);
|
||||
}
|
||||
|
||||
public final boolean getProjectMaterialsHide() {
|
||||
return (Boolean) get(m_projectMaterialsHide);
|
||||
}
|
||||
|
||||
public final boolean getProjectMembersAllInOne() {
|
||||
return (Boolean) get(m_projectMembersAllInOne);
|
||||
}
|
||||
|
||||
public final boolean getProjectMembersMerge() {
|
||||
return (Boolean) get(m_projectMembersMerge);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,144 +0,0 @@
|
|||
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.sciorganization.members_all_in_one.title = Members All-in-one
|
||||
com.arsdigita.cms.contenttypes.sciorganization.members_all_in_one.purpose = Show all members (active, associated and former) in one instead in three seprated lists
|
||||
com.arsdigita.cms.contenttypes.sciorganization.members_all_in_one.example = false
|
||||
com.arsdigita.cms.contenttypes.sciorganization.members_all_in_one.format = [boolean]
|
||||
|
||||
com.arsdigita.cms.contenttypes.sciorganization.members_merge.title = Merge members
|
||||
com.arsdigita.cms.contenttypes.sciorganization.members_merge.purpose = Merge members from all departments and the organization into one list (or three list, for each status)
|
||||
com.arsdigita.cms.contenttypes.sciorganization.members_merge.example = true
|
||||
com.arsdigita.cms.contenttypes.sciorganization.members_merge.format = [boolean]
|
||||
|
||||
com.arsdigita.cms.contenttypes.sciorganization.projects_all_in_one.title = Project All-in-one
|
||||
com.arsdigita.cms.contenttypes.sciorganization.projects_all_in_one.purpose = Show all projects (ongoing and finished) in one instead of two seperated lists.
|
||||
com.arsdigita.cms.contenttypes.sciorganization.projects_all_in_one.example = false
|
||||
com.arsdigita.cms.contenttypes.sciorganization.projects_all_in_one.format = [boolean]
|
||||
|
||||
com.arsdigita.cms.contenttypes.sciorganization.projects_merge.title = Merge projects
|
||||
com.arsdigita.cms.contenttypes.sciorganization.projects_merge.purpose = Merge all projects from the organization and its departments into one list (or two list for ongoing and finished projects)
|
||||
com.arsdigita.cms.contenttypes.sciorganization.projects_merge.examle = true
|
||||
com.arsdigita.cms.contenttypes.sciorganization.projects_merge.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 = true
|
||||
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 = true
|
||||
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 = true
|
||||
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 input
|
||||
com.arsdigita.cms.contenttypes.sciproject.funding_hide.example = false
|
||||
com.arsdigita.cms.contenttypes.sciproject.funding_hide.format = [boolean]
|
||||
|
||||
com.arsdigita.cms.contenttypes.sciproject.funding_volume_hide.title = Hide funding_volume text input
|
||||
com.arsdigita.cms.contenttypes.sciproject.funding_volume_hide.purpose = Hide the funding_volume text input
|
||||
com.arsdigita.cms.contenttypes.sciproject.funding_volume_hide.example = true
|
||||
com.arsdigita.cms.contenttypes.sciproject.funding_volume_hide.format = [boolean]
|
||||
|
||||
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]
|
||||
|
||||
com.arsdigita.cms.contenttypes.sciproject.materials_hide.title = Hides the step for linking materials with a project
|
||||
com.arsdigita.cms.contenttypes.sciproject.materials_hide.purpose = Hides the step for linking materials with a project
|
||||
com.arsdigita.cms.contenttypes.sciproject.materials_hide.example = false
|
||||
com.arsdigita.cms.contenttypes.sciproject.materials_hide.format = [boolean]
|
||||
|
||||
com.arsdigita.cms.contenttypes.sciproject.members_all_in_one.title = Members All-in-one
|
||||
com.arsdigita.cms.contenttypes.sciproject.members_all_in_one.purpose = Show all members (active, associated and former) in one instead in three separated lists
|
||||
com.arsdigita.cms.contenttypes.sciproject.members_all_in_one.example = true
|
||||
com.arsdigita.cms.contenttypes.sciproject.members_all_in_one.format = [boolean]
|
||||
|
||||
com.arsdigita.cms.contenttypes.sciorganization.members_merge.title = Merge members
|
||||
com.arsdigita.cms.contenttypes.sciorganization.members_merge.purpose = Merge members from all subproject into one list (or three list, for each status)
|
||||
com.arsdigita.cms.contenttypes.sciorganization.members_merge.example = false
|
||||
com.arsdigita.cms.contenttypes.sciorganization.members_merge.format = [boolean]
|
||||
|
||||
com.arsdigita.cms.contenttypes.scidepartment.publications_hide.title = Hides the step for linking publications with a department
|
||||
com.arsdigita.cms.contenttypes.scidepartment.publications_hide.purpose = Hides the step for linking publications with a department
|
||||
com.arsdigita.cms.contenttypes.scidepartment.publications_hide.example = false
|
||||
com.arsdigita.cms.contenttypes.scidepartment.publications_hide.format = [boolean]
|
||||
|
|
@ -1,156 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Special domain collection for the departments of an organization.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciOrganization
|
||||
* @see SciDepartment
|
||||
*/
|
||||
public class SciOrganizationDepartmentsCollection extends DomainCollection {
|
||||
|
||||
public String ORDER = "departmentOrder";
|
||||
public String LINKORDER = "link.departmentOrder";
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(SciOrganizationDepartmentsCollection.class);
|
||||
|
||||
public SciOrganizationDepartmentsCollection(DataCollection dataCollection) {
|
||||
super(dataCollection);
|
||||
|
||||
m_dataCollection.addOrder(LINKORDER);
|
||||
}
|
||||
|
||||
public Integer getDepartmentOrder() {
|
||||
return (Integer) m_dataCollection.get(LINKORDER);
|
||||
}
|
||||
|
||||
public void setDepartmentOrder(Integer order) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(ORDER, order);
|
||||
}
|
||||
|
||||
public void swapWithNext(SciDepartment department) {
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
int nextIndex = 0;
|
||||
|
||||
s_log.debug("Searching department...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getDepartmentOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getDepartmentOrder(): %d",
|
||||
getDepartmentOrder()));
|
||||
if (this.getDepartment().equals(department)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided department is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (this.next()) {
|
||||
nextIndex = this.getDepartmentOrder();
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"The provided department is the last "
|
||||
+ "in the collection, so there is no next object "
|
||||
+ "to swap with.");
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
|
||||
while (this.getPosition() != currentPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setDepartmentOrder(nextIndex);
|
||||
this.next();
|
||||
this.setDepartmentOrder(currentIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public void swapWithPrevious(SciDepartment department) {
|
||||
int previousPosition = 0;
|
||||
int previousIndex = 0;
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
|
||||
s_log.debug("Searching department...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getDepartmentOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getDepartmentOrder(): %d",
|
||||
getDepartmentOrder()));
|
||||
if (this.getDepartment().equals(department)) {
|
||||
break;
|
||||
}
|
||||
|
||||
previousPosition = currentPosition;
|
||||
previousIndex = currentIndex;
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided department is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (previousPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided department is the first one in this "
|
||||
+ "collection, so there is no previous one to switch "
|
||||
+ "with."));
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
while (this.getPosition() != previousPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setDepartmentOrder(currentIndex);
|
||||
this.next();
|
||||
this.setDepartmentOrder(previousIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public SciDepartment getDepartment() {
|
||||
return new SciDepartment(m_dataCollection.getDataObject());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* 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 org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Initalizer for {@link SciOrganization}
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciOrganizationInitializer extends ContentTypeInitializer {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(
|
||||
SciOrganizationInitializer.class);
|
||||
|
||||
public SciOrganizationInitializer() {
|
||||
super("ccm-sci-types-organization.pdl.mf",
|
||||
SciOrganization.BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getStylesheets() {
|
||||
return new String[]{
|
||||
"/static/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xsl"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTraversalXML() {
|
||||
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciOrganization.xml";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* 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.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
import com.arsdigita.util.parameter.ResourceParameter;
|
||||
import com.arsdigita.workflow.simple.WorkflowTemplate;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Loader for {@link SciOrganization}
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciOrganizationLoader extends AbstractContentTypeLoader {
|
||||
|
||||
private ResourceParameter m_template;
|
||||
|
||||
public SciOrganizationLoader() {
|
||||
super();
|
||||
|
||||
m_template = new ResourceParameter(
|
||||
"com.arsdigita.cms.contenttypes.SciOrganizationTemplate",
|
||||
Parameter.REQUIRED,
|
||||
"/WEB-INF/content-types/com/arsdigita/"
|
||||
+ "cms/contenttypes/sciorganization-item.jsp");
|
||||
|
||||
register(m_template);
|
||||
|
||||
}
|
||||
|
||||
private static final String[] TYPES = {
|
||||
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/"
|
||||
+ "SciOrganization.xml"
|
||||
};
|
||||
|
||||
@Override
|
||||
public String[] getTypes() {
|
||||
return TYPES;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void prepareSection(final ContentSection section,
|
||||
final ContentType type,
|
||||
final LifecycleDefinition lifecycle,
|
||||
final WorkflowTemplate workflow) {
|
||||
super.prepareSection(section, type, lifecycle, workflow);
|
||||
|
||||
setDefaultTemplate("SciOrganization Item",
|
||||
"sciorganization-item",
|
||||
(InputStream) get(m_template),
|
||||
section,
|
||||
type,
|
||||
lifecycle,
|
||||
workflow);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Special domain collection for the projects of an organization.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciOrganization
|
||||
* @see SciProject
|
||||
*/
|
||||
public class SciOrganizationProjectsCollection extends DomainCollection {
|
||||
|
||||
public String ORDER = "projectOrder";
|
||||
public String LINKORDER = "link.projectOrder";
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(SciOrganizationProjectsCollection.class);
|
||||
|
||||
public SciOrganizationProjectsCollection(DataCollection dataCollection) {
|
||||
super(dataCollection);
|
||||
|
||||
m_dataCollection.addOrder(LINKORDER);
|
||||
}
|
||||
|
||||
public Integer getProjectOrder() {
|
||||
return (Integer) m_dataCollection.get(LINKORDER);
|
||||
}
|
||||
|
||||
public void setProjectOrder(Integer order) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(ORDER, order);
|
||||
}
|
||||
|
||||
public void swapWithNext(SciProject project) {
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
int nextIndex = 0;
|
||||
|
||||
s_log.debug("Searching project...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getProjectOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getProjectOrder(): %d",
|
||||
getProjectOrder()));
|
||||
if (this.getProject().equals(project)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided project is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (this.next()) {
|
||||
nextIndex = this.getProjectOrder();
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"The provided project is the last "
|
||||
+ "in the collection, so there is no next object "
|
||||
+ "to swap with.");
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
|
||||
while (this.getPosition() != currentPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setProjectOrder(nextIndex);
|
||||
this.next();
|
||||
this.setProjectOrder(currentIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public void swapWithPrevious(SciProject project) {
|
||||
int previousPosition = 0;
|
||||
int previousIndex = 0;
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
|
||||
s_log.debug("Searching project...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getProjectOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getProjectOrder(): %d",
|
||||
getProjectOrder()));
|
||||
if (this.getProject().equals(project)) {
|
||||
break;
|
||||
}
|
||||
|
||||
previousPosition = currentPosition;
|
||||
previousIndex = currentIndex;
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided project is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (previousPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided project is the first one in this "
|
||||
+ "collection, so there is no previous one to switch "
|
||||
+ "with."));
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
while (this.getPosition() != previousPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setProjectOrder(currentIndex);
|
||||
this.next();
|
||||
this.setProjectOrder(previousIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public SciProject getProject() {
|
||||
return new SciProject(m_dataCollection.getDataObject());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,496 +0,0 @@
|
|||
/*
|
||||
* 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.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.DataQuery;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.util.Assert;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The class represents a (scientific) project. It extends
|
||||
* {@link GenericOrganizationalUnit} and adds a relation for subprojects and
|
||||
* some fields for additional information:
|
||||
* </p>
|
||||
* <dl>
|
||||
* <dt><code>projectBegin</code></dt>
|
||||
* <dd>The begin of the project</dd>
|
||||
* <dt><code>projectEnd</code></dt>
|
||||
* <dd>The end of the project</dd>
|
||||
* <dt><code>shortDescription</code></dt>
|
||||
* <dd>A short description (500 characters) of the project</dd>
|
||||
* <dt><code>description</code></dt>
|
||||
* <dd>A description of the project/<dd>
|
||||
* <dt><code>funding</code><dt>
|
||||
* <dd>A text about the funding of the project</dd>
|
||||
* <dt><code>fundingVolume</code></dt>
|
||||
* <dd><code>Volume of the funding</code></dt>
|
||||
* </dl>
|
||||
* <p>
|
||||
* Also, the class has some methods the access the associations defined by
|
||||
* {@link SciOrganization} and {@link SciDepartment} with
|
||||
* <code>SciProject</code>.
|
||||
* </p>
|
||||
* <p>
|
||||
* There is an
|
||||
* <a href="doc-files/ccm-sci-types-organization_entities.png">UML digram</a>
|
||||
* with an overview of the content types and their associations. Please not that
|
||||
* the diagram show a design sketch and not the actually implemented classes.
|
||||
* </p>
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see GenericOrganizationalUnit
|
||||
* @see SciOrganization
|
||||
* @see SciDepartment
|
||||
*/
|
||||
public class SciProject extends GenericOrganizationalUnit {
|
||||
|
||||
public static final String BEGIN = "projectbegin";
|
||||
public static final String END = "projectend";
|
||||
public static final String PROJECT_SHORT_DESCRIPTION = "projectShortDesc";
|
||||
public static final String PROJECT_DESCRIPTION = "projectDescription";
|
||||
public static final String FUNDING = "funding";
|
||||
public static final String FUNDING_VOLUME = "fundingVolume";
|
||||
public static final String SUBPROJECTS = "subProjects";
|
||||
public static final String SUBPROJECT_ORDER = "subProjectOrder";
|
||||
public static final String ORGANIZATIONS = "organization";
|
||||
public static final String ORGANIZATIONS_ORDER = "organizationOrder";
|
||||
public static final String SUPER_PROJECT = "superProject";
|
||||
public static final String DEPARTMENTS = "department";
|
||||
public static final String DEPARTMENTS_ORDER = "departmentOrder";
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.contenttypes.SciProject";
|
||||
private static final SciOrganizationConfig s_config =
|
||||
new SciOrganizationConfig();
|
||||
private static final Logger logger = Logger.getLogger(SciProject.class);
|
||||
|
||||
static {
|
||||
logger.debug("Static initalizer starting...");
|
||||
s_config.load();
|
||||
logger.debug("Static initalizer finished.");
|
||||
}
|
||||
|
||||
public enum MemberStatus {
|
||||
|
||||
ALL,
|
||||
ACTIVE,
|
||||
ASSOCIATED,
|
||||
FORMER
|
||||
}
|
||||
|
||||
public enum ProjectStatus {
|
||||
|
||||
ALL,
|
||||
ONGOING,
|
||||
FINISHED
|
||||
}
|
||||
|
||||
public SciProject() {
|
||||
super(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public SciProject(BigDecimal id) throws DataObjectNotFoundException {
|
||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
}
|
||||
|
||||
public SciProject(OID oid) {
|
||||
super(oid);
|
||||
}
|
||||
|
||||
public SciProject(DataObject obj) {
|
||||
super(obj);
|
||||
}
|
||||
|
||||
public SciProject(String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public static SciOrganizationConfig getConfig() {
|
||||
return s_config;
|
||||
}
|
||||
|
||||
public Date getBegin() {
|
||||
return (Date) get(BEGIN);
|
||||
}
|
||||
|
||||
public void setBegin(Date begin) {
|
||||
set(BEGIN, begin);
|
||||
}
|
||||
|
||||
public Date getEnd() {
|
||||
return (Date) get(END);
|
||||
}
|
||||
|
||||
public void setEnd(Date end) {
|
||||
set(END, end);
|
||||
}
|
||||
|
||||
public String getProjectShortDescription() {
|
||||
return (String) get(PROJECT_SHORT_DESCRIPTION);
|
||||
}
|
||||
|
||||
public void setProjectShortDescription(String shortDesc) {
|
||||
set(PROJECT_SHORT_DESCRIPTION, shortDesc);
|
||||
}
|
||||
|
||||
public String getProjectDescription() {
|
||||
return (String) get(PROJECT_DESCRIPTION);
|
||||
}
|
||||
|
||||
public void setProjectDescription(String description) {
|
||||
set(PROJECT_DESCRIPTION, description);
|
||||
}
|
||||
|
||||
public String getFunding() {
|
||||
return (String) get(FUNDING);
|
||||
}
|
||||
|
||||
public void setFunding(String funding) {
|
||||
set(FUNDING, funding);
|
||||
}
|
||||
|
||||
public String getFundingVolume() {
|
||||
return (String) get(FUNDING_VOLUME);
|
||||
}
|
||||
|
||||
public void setFundingVolume(String fundingVolume) {
|
||||
set(FUNDING_VOLUME, fundingVolume);
|
||||
}
|
||||
|
||||
public SciProjectSubProjectsCollection getSubProjects() {
|
||||
return new SciProjectSubProjectsCollection(
|
||||
(DataCollection) get(SUBPROJECTS));
|
||||
}
|
||||
|
||||
public void addSubProject(SciProject project) {
|
||||
Assert.exists(project, SciProject.class);
|
||||
|
||||
DataObject link = add(SUBPROJECTS, project);
|
||||
|
||||
link.set(SUBPROJECT_ORDER,
|
||||
Integer.valueOf((int) getSubProjects().size()));
|
||||
link.save();
|
||||
}
|
||||
|
||||
public void removeSubProject(SciProject project) {
|
||||
Assert.exists(project, SciProject.class);
|
||||
|
||||
logger.debug(String.format("Removing subproject %s",
|
||||
project.getTitle()));
|
||||
remove(SUBPROJECTS, project);
|
||||
}
|
||||
|
||||
public SciProjectOrganizationsCollection getOrganizations() {
|
||||
return new SciProjectOrganizationsCollection((DataCollection) get(
|
||||
ORGANIZATIONS));
|
||||
}
|
||||
|
||||
public void addOrganization(SciOrganization orga) {
|
||||
Assert.exists(orga, SciOrganization.class);
|
||||
|
||||
DataObject link = add(ORGANIZATIONS, orga);
|
||||
|
||||
link.set(ORGANIZATIONS_ORDER,
|
||||
Integer.valueOf((int) getOrganizations().size()));
|
||||
link.set(SciOrganization.PROJECT_ORDER,
|
||||
Integer.valueOf((int) orga.getProjects().size()));
|
||||
link.save();
|
||||
}
|
||||
|
||||
public void removeOrganization(SciOrganization orga) {
|
||||
Assert.exists(orga, SciOrganization.class);
|
||||
|
||||
remove(ORGANIZATIONS, orga);
|
||||
}
|
||||
|
||||
public boolean hasOrganizations() {
|
||||
return !this.getOrganizations().isEmpty();
|
||||
}
|
||||
|
||||
public SciProjectDepartmentsCollection getDepartments() {
|
||||
return new SciProjectDepartmentsCollection((DataCollection) get(
|
||||
DEPARTMENTS));
|
||||
}
|
||||
|
||||
public void addDepartment(SciDepartment department) {
|
||||
Assert.exists(department, SciDepartment.class);
|
||||
|
||||
DataObject link = add(DEPARTMENTS, department);
|
||||
|
||||
link.set(DEPARTMENTS_ORDER,
|
||||
Integer.valueOf((int) getDepartments().size()));
|
||||
link.save();
|
||||
}
|
||||
|
||||
public void removeDepartment(SciDepartment department) {
|
||||
Assert.exists(department, SciDepartment.class);
|
||||
|
||||
remove(DEPARTMENTS, department);
|
||||
}
|
||||
|
||||
public boolean hasDepartments() {
|
||||
return !this.getDepartments().isEmpty();
|
||||
}
|
||||
|
||||
public SciProject getSuperProject() {
|
||||
DataCollection collection;
|
||||
|
||||
collection = (DataCollection) get(SUPER_PROJECT);
|
||||
|
||||
if (0 == collection.size()) {
|
||||
logger.debug(String.format("Project %s has NO super project...",
|
||||
getTitle()));
|
||||
return null;
|
||||
} else {
|
||||
DataObject dobj;
|
||||
|
||||
logger.debug(String.format("Project %s has a super project...",
|
||||
getTitle()));
|
||||
collection.next();
|
||||
dobj = collection.getDataObject();
|
||||
collection.close();
|
||||
|
||||
return new SciProject(dobj);
|
||||
}
|
||||
}
|
||||
|
||||
public void setSuperProject(SciProject superProject) {
|
||||
SciProject oldSuperProject;
|
||||
|
||||
oldSuperProject = getSuperProject();
|
||||
if (oldSuperProject != null) {
|
||||
logger.debug("Removing old super project...");
|
||||
remove(SUPER_PROJECT, oldSuperProject);
|
||||
}
|
||||
|
||||
if (superProject != null) {
|
||||
Assert.exists(superProject, SciProject.class);
|
||||
logger.debug("Setting new super project...");
|
||||
DataObject link = add(SUPER_PROJECT, superProject);
|
||||
|
||||
link.set(SUBPROJECT_ORDER,
|
||||
Integer.valueOf((int) superProject.getSubProjects().size()));
|
||||
link.save();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasContacts() {
|
||||
boolean result = false;
|
||||
|
||||
DataQuery query =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfContactsOfSciProject");
|
||||
query.setParameter("project", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
||||
query.close();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean hasSubProjects() {
|
||||
boolean result = false;
|
||||
|
||||
DataQuery query =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject");
|
||||
query.setParameter("project", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
||||
query.close();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param merge Should I also look into the projects and return true
|
||||
* if the organization or at least one of the projects has members?
|
||||
* @return
|
||||
*/
|
||||
public boolean hasMembers(final boolean merge, final MemberStatus status) {
|
||||
String queryName;
|
||||
|
||||
switch (status) {
|
||||
case ALL:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciProject";
|
||||
break;
|
||||
case ACTIVE:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciProject";
|
||||
break;
|
||||
case ASSOCIATED:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfSciProject";
|
||||
break;
|
||||
case FORMER:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciProject";
|
||||
break;
|
||||
default:
|
||||
queryName = "";
|
||||
break;
|
||||
}
|
||||
|
||||
DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
|
||||
query.setParameter("project", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
query.close();
|
||||
return true;
|
||||
} else {
|
||||
if (merge) {
|
||||
query.close();
|
||||
DataQuery projectsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject");
|
||||
projectsQuery.setParameter("project", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
BigDecimal projectId;
|
||||
boolean result = false;
|
||||
while (projectsQuery.next()) {
|
||||
projectId = (BigDecimal) projectsQuery.get(
|
||||
"projectId");
|
||||
result = hasMembers(projectId, merge, status);
|
||||
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
projectsQuery.close();
|
||||
return result;
|
||||
} else {
|
||||
projectsQuery.close();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
query.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasMembers(final BigDecimal projectId,
|
||||
final boolean merge,
|
||||
final MemberStatus status) {
|
||||
String queryName;
|
||||
|
||||
switch (status) {
|
||||
case ALL:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciProject";
|
||||
break;
|
||||
case ACTIVE:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciProject";
|
||||
break;
|
||||
case ASSOCIATED:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfProject";
|
||||
break;
|
||||
case FORMER:
|
||||
queryName =
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciProject";
|
||||
break;
|
||||
default:
|
||||
queryName = "";
|
||||
break;
|
||||
}
|
||||
|
||||
DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
|
||||
query.setParameter("project", projectId);
|
||||
|
||||
if (query.size() > 0) {
|
||||
query.close();
|
||||
return true;
|
||||
} else {
|
||||
if (merge) {
|
||||
query.close();
|
||||
DataQuery subProjectsQuery =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject");
|
||||
subProjectsQuery.setParameter("project", projectId);
|
||||
|
||||
if (query.size() > 0) {
|
||||
BigDecimal subprojectId;
|
||||
boolean result = false;
|
||||
while (subProjectsQuery.next()) {
|
||||
subprojectId = (BigDecimal) subProjectsQuery.get(
|
||||
"projectId");
|
||||
result = hasMembers(subprojectId, merge, status);
|
||||
|
||||
if (result) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
subProjectsQuery.close();
|
||||
return result;
|
||||
} else {
|
||||
subProjectsQuery.close();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
query.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*public boolean hasPublications() {
|
||||
boolean result = false;
|
||||
|
||||
DataQuery query =
|
||||
SessionManager.getSession().retrieveQuery(
|
||||
"com.arsdigita.cms.contenttypes.getIdsOfPublicationLinksOfSciProject");
|
||||
query.setParameter("project", getID());
|
||||
|
||||
if (query.size() > 0) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
||||
query.close();
|
||||
|
||||
return result;
|
||||
}*/
|
||||
}
|
||||
|
|
@ -1,154 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Special domain collection for the departments involved in a project.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciProjectDepartmentsCollection extends DomainCollection {
|
||||
|
||||
public String ORDER = "departmentOrder";
|
||||
public String LINKORDER = "link.departmentOrder";
|
||||
public static final Logger s_log = Logger.getLogger(
|
||||
SciProjectDepartmentsCollection.class);
|
||||
|
||||
public SciProjectDepartmentsCollection(DataCollection dataCollection) {
|
||||
super(dataCollection);
|
||||
|
||||
m_dataCollection.addOrder(LINKORDER);
|
||||
}
|
||||
|
||||
public Integer getDepartmentOrder() {
|
||||
return (Integer) m_dataCollection.get(LINKORDER);
|
||||
}
|
||||
|
||||
public void setDepartmentOrder(Integer order) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(ORDER, order);
|
||||
}
|
||||
|
||||
public void swapWithNext(SciDepartment department) {
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
int nextIndex = 0;
|
||||
|
||||
s_log.debug("Searching department...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getDepartmentOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getDepartmentOrder(): %d",
|
||||
getDepartmentOrder()));
|
||||
if (this.getDepartment().equals(department)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided subproject is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (this.next()) {
|
||||
nextIndex = this.getDepartmentOrder();
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"The provided subproject is the last "
|
||||
+ "in the collection, so there is no next object "
|
||||
+ "to swap with.");
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
|
||||
while (this.getPosition() != currentPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setDepartmentOrder(nextIndex);
|
||||
this.next();
|
||||
this.setDepartmentOrder(currentIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public void swapWithPrevious(SciDepartment department) {
|
||||
int previousPosition = 0;
|
||||
int previousIndex = 0;
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
|
||||
s_log.debug("Searching organization...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getDepartmentOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getDepartmentOrder(): %d",
|
||||
getDepartmentOrder()));
|
||||
if (this.getDepartment().equals(department)) {
|
||||
break;
|
||||
}
|
||||
|
||||
previousPosition = currentPosition;
|
||||
previousIndex = currentIndex;
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided organization is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (previousPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided organization is the first one in this "
|
||||
+ "collection, so there is no previous one to switch "
|
||||
+ "with."));
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
while (this.getPosition() != previousPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setDepartmentOrder(currentIndex);
|
||||
this.next();
|
||||
this.setDepartmentOrder(previousIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public SciDepartment getDepartment() {
|
||||
return new SciDepartment(m_dataCollection.getDataObject());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* 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 org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Initializer for {@link SciProject}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciProjectInitializer extends ContentTypeInitializer {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(
|
||||
SciProjectInitializer.class);
|
||||
|
||||
public SciProjectInitializer() {
|
||||
super("empty.pdl.mf", SciProject.BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getStylesheets() {
|
||||
return new String[]{
|
||||
"/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTraversalXML() {
|
||||
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciProjectListXmlGenerator extends SimpleXMLGenerator {
|
||||
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* 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.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
import com.arsdigita.util.parameter.ResourceParameter;
|
||||
import com.arsdigita.workflow.simple.WorkflowTemplate;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Loader for {@link SciProject}
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciProjectLoader extends AbstractContentTypeLoader {
|
||||
|
||||
private ResourceParameter m_template;
|
||||
private static final String[] TYPES = {
|
||||
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProject.xml"
|
||||
};
|
||||
|
||||
public SciProjectLoader() {
|
||||
super();
|
||||
|
||||
m_template = new ResourceParameter(
|
||||
"com.arsdigita.cms.contenttypes.SciProjectTemplate",
|
||||
Parameter.REQUIRED,
|
||||
"/WEB-INF/content-types/com/arsdigita/"
|
||||
+ "cms/contenttypes/sciproject-item.jsp");
|
||||
|
||||
register(m_template);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTypes() {
|
||||
return TYPES;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void prepareSection(final ContentSection section,
|
||||
final ContentType type,
|
||||
final LifecycleDefinition lifecycle,
|
||||
final WorkflowTemplate workflow) {
|
||||
super.prepareSection(section, type, lifecycle, workflow);
|
||||
|
||||
setDefaultTemplate("SciProject Item",
|
||||
"sciproject-item",
|
||||
(InputStream) get(m_template),
|
||||
section,
|
||||
type,
|
||||
lifecycle,
|
||||
workflow);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,156 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Special domain collection for the organization involved in a project.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciProjectOrganizationsCollection extends DomainCollection {
|
||||
|
||||
public String ORDER = "organizationOrder";
|
||||
public String LINKORDER = "link.organizationOrder";
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(
|
||||
SciProjectSubProjectsCollection.class);
|
||||
|
||||
public SciProjectOrganizationsCollection(DataCollection dataCollection) {
|
||||
super(dataCollection);
|
||||
|
||||
m_dataCollection.addOrder(LINKORDER);
|
||||
}
|
||||
|
||||
public Integer getOrganizationOrder() {
|
||||
return (Integer) m_dataCollection.get(LINKORDER);
|
||||
}
|
||||
|
||||
public void setOrganizationOrder(Integer order) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(ORDER, order);
|
||||
}
|
||||
|
||||
public void swapWithNext(SciOrganization orga) {
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
int nextIndex = 0;
|
||||
|
||||
s_log.debug("Searching organization...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getOrganizationOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getOrganizationOrder(): %d",
|
||||
getOrganizationOrder()));
|
||||
if (this.getOrganization().equals(orga)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided subproject is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (this.next()) {
|
||||
nextIndex = this.getOrganizationOrder();
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"The provided subproject is the last "
|
||||
+ "in the collection, so there is no next object "
|
||||
+ "to swap with.");
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
|
||||
while (this.getPosition() != currentPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setOrganizationOrder(nextIndex);
|
||||
this.next();
|
||||
this.setOrganizationOrder(currentIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public void swapWithPrevious(SciOrganization orga) {
|
||||
int previousPosition = 0;
|
||||
int previousIndex = 0;
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
|
||||
s_log.debug("Searching organization...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getOrganizationOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getOrganizationOrder(): %d",
|
||||
getOrganizationOrder()));
|
||||
if (this.getOrganization().equals(orga)) {
|
||||
break;
|
||||
}
|
||||
|
||||
previousPosition = currentPosition;
|
||||
previousIndex = currentIndex;
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided organization is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (previousPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided organization is the first one in this "
|
||||
+ "collection, so there is no previous one to switch "
|
||||
+ "with."));
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
while (this.getPosition() != previousPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setOrganizationOrder(currentIndex);
|
||||
this.next();
|
||||
this.setOrganizationOrder(previousIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public SciOrganization getOrganization() {
|
||||
return new SciOrganization(m_dataCollection.getDataObject());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,155 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Special domain collection for the suprojects of a project.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciProjectSubProjectsCollection extends DomainCollection {
|
||||
|
||||
public String ORDER = "subProjectOrder";
|
||||
public String LINKORDER = "link.subProjectOrder";
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(
|
||||
SciProjectSubProjectsCollection.class);
|
||||
|
||||
public SciProjectSubProjectsCollection(DataCollection dataCollection) {
|
||||
super(dataCollection);
|
||||
|
||||
m_dataCollection.addOrder(LINKORDER);
|
||||
}
|
||||
|
||||
public Integer getSubProjectOrder() {
|
||||
return (Integer) m_dataCollection.get(LINKORDER);
|
||||
}
|
||||
|
||||
public void setSubProjectOrder(Integer order) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(ORDER, order);
|
||||
}
|
||||
|
||||
public void swapWithNext(SciProject subproject) {
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
int nextIndex = 0;
|
||||
|
||||
s_log.debug("Searching subproject...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getSubProjectOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getSubProjectOrder(): %d",
|
||||
getSubProjectOrder()));
|
||||
if (this.getSubProject().equals(subproject)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided subproject is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (this.next()) {
|
||||
nextIndex = this.getSubProjectOrder();
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"The provided subproject is the last "
|
||||
+ "in the collection, so there is no next object "
|
||||
+ "to swap with.");
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
|
||||
while (this.getPosition() != currentPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setSubProjectOrder(nextIndex);
|
||||
this.next();
|
||||
this.setSubProjectOrder(currentIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public void swapWithPrevious(SciProject subproject) {
|
||||
int previousPosition = 0;
|
||||
int previousIndex = 0;
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
|
||||
s_log.debug("Searching subproject...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getSubProjectOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getSubProjectOrder(): %d",
|
||||
getSubProjectOrder()));
|
||||
if (this.getSubProject().equals(subproject)) {
|
||||
break;
|
||||
}
|
||||
|
||||
previousPosition = currentPosition;
|
||||
previousIndex = currentIndex;
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided subproject is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (previousPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided subproject is the first one in this "
|
||||
+ "collection, so there is no previous one to switch "
|
||||
+ "with."));
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
while (this.getPosition() != previousPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setSubProjectOrder(currentIndex);
|
||||
this.next();
|
||||
this.setSubProjectOrder(previousIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public SciProject getSubProject() {
|
||||
return new SciProject(m_dataCollection.getDataObject());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.installer.xml.XMLContentTypeHandler;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.kernel.KernelExcursion;
|
||||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.persistence.TransactionContext;
|
||||
import com.arsdigita.xml.XML;
|
||||
|
||||
/**
|
||||
* Updates the authoring steps of SciOrganization, SciDepartment and
|
||||
* SciProject to reflect the changes made in version 6.6.1 (PWI SVN
|
||||
* revision 887).
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciTypesOrganizationUpdate660to661 {
|
||||
|
||||
private static final String SCI_ORGANIZATION =
|
||||
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xml";
|
||||
private static final String SCI_DEPARTMENT =
|
||||
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml";
|
||||
private static final String SCI_PROJECT =
|
||||
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProject.xml";
|
||||
|
||||
public static void main(String[] args) {
|
||||
final com.arsdigita.runtime.Runtime runtime =
|
||||
new com.arsdigita.runtime.Runtime();
|
||||
runtime.startup();
|
||||
|
||||
final Session session = SessionManager.getSession();
|
||||
final TransactionContext tc = session.getTransactionContext();
|
||||
|
||||
try {
|
||||
tc.beginTxn();
|
||||
new KernelExcursion() {
|
||||
|
||||
@Override
|
||||
protected void excurse() {
|
||||
setEffectiveParty(Kernel.getSystemParty());
|
||||
|
||||
/*
|
||||
* Reload content type definitions from XML config to add
|
||||
* new authoring steps.
|
||||
*/
|
||||
XMLContentTypeHandler handler = new XMLContentTypeHandler();
|
||||
XML.parseResource(SCI_ORGANIZATION, handler);
|
||||
XML.parseResource(SCI_DEPARTMENT, handler);
|
||||
XML.parseResource(SCI_PROJECT, handler);
|
||||
}
|
||||
}.run();
|
||||
session.flushAll();
|
||||
tc.commitTxn();
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Exception ocurred during update: ");
|
||||
ex.printStackTrace(System.out);
|
||||
} finally {
|
||||
if (tc.inTxn()) {
|
||||
tc.abortTxn();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 136 KiB |
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Edit form for the description of a SciDepartment.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
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;
|
||||
|
||||
/**
|
||||
* EditStep for the description of a SciDepartment.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* 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.PageState;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
/**
|
||||
* Upload form for the description of a SciDepartment.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
* @see AbstractTextUploadForm
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* 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.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
|
||||
/**
|
||||
* Form for adding members to a SciDepartment. This form overwrites
|
||||
* the {@link GenericOrganizationalUnitPersonAddForm#getPersonType()}
|
||||
* to limit the selectable type for adding to {@link SciMember}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
* @see SciMember
|
||||
* @see GenericOrganizationalUnitPersonAddForm
|
||||
*/
|
||||
public class SciDepartmentMemberAddForm
|
||||
extends GenericOrganizationalUnitPersonAddForm {
|
||||
|
||||
public SciDepartmentMemberAddForm(ItemSelectionModel itemModel,
|
||||
GenericOrganizationalUnitPersonSelector personSelector) {
|
||||
super(itemModel, personSelector);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPersonType() {
|
||||
return GenericPerson.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRoleAttributeName() {
|
||||
return "SciDepartmentRole";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
/*
|
||||
* 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.PageState;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Edit step for adding members to a SciDepartment.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciDepartmentMemberStep
|
||||
extends SimpleEditStep
|
||||
implements GenericOrganizationalUnitPersonSelector {
|
||||
|
||||
private static final String ADD_MEMBER_SHEET_NAME = "addMember";
|
||||
private GenericPerson selectedPerson;
|
||||
private String selectedPersonRole;
|
||||
private String selectedPersonStatus;
|
||||
|
||||
public SciDepartmentMemberStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public SciDepartmentMemberStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent,
|
||||
String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addMemberSheet =
|
||||
new SciDepartmentMemberAddForm(itemModel,
|
||||
this);
|
||||
add(ADD_MEMBER_SHEET_NAME,
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.add_member").localize(),
|
||||
new WorkflowLockedComponentAccess(addMemberSheet, itemModel),
|
||||
addMemberSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
SciDepartmentMemberTable memberTable = new SciDepartmentMemberTable(
|
||||
itemModel,
|
||||
this);
|
||||
setDisplayComponent(memberTable);
|
||||
}
|
||||
|
||||
public GenericPerson getSelectedPerson() {
|
||||
return selectedPerson;
|
||||
}
|
||||
|
||||
public void setSelectedPerson(final GenericPerson selectedPerson) {
|
||||
this.selectedPerson = selectedPerson;
|
||||
}
|
||||
|
||||
public String getSelectedPersonRole() {
|
||||
return selectedPersonRole;
|
||||
}
|
||||
|
||||
public void setSelectedPersonRole(final String selectedPersonRole) {
|
||||
this.selectedPersonRole = selectedPersonRole;
|
||||
}
|
||||
|
||||
public String getSelectedPersonStatus() {
|
||||
return selectedPersonStatus;
|
||||
}
|
||||
|
||||
public void setSelectedPersonStatus(final String selectedPersonStatus) {
|
||||
this.selectedPersonStatus = selectedPersonStatus;
|
||||
}
|
||||
|
||||
public void showEditComponent(PageState state) {
|
||||
showComponent(state, ADD_MEMBER_SHEET_NAME);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010 Jens Pelzetter,
|
||||
* for the Center of Social Politics of the University of Bremen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciDepartmentMemberTable extends GenericOrganizationalUnitPersonsTable {
|
||||
|
||||
public SciDepartmentMemberTable(ItemSelectionModel itemModel,
|
||||
GenericOrganizationalUnitPersonSelector personSelector) {
|
||||
super(itemModel, personSelector);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRoleAttributeName() {
|
||||
return "SciDepartmentRole";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Form for setting the superior organization of an SciDepartment.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
* @see SciOrganization
|
||||
*/
|
||||
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)) {
|
||||
SciOrganization orga = (SciOrganization) data.get(ITEM_SEARCH);
|
||||
|
||||
orga = (SciOrganization) orga.getContentBundle().getInstance(department.getLanguage());
|
||||
|
||||
department.setOrganization(orga);
|
||||
//department.setOrganization((SciOrganization) data.get(ITEM_SEARCH));
|
||||
}
|
||||
|
||||
init(fse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.organization.add.no_organization_selected"));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
SciDepartment department = (SciDepartment) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
|
||||
SciOrganization orga = (SciOrganization) data.get(ITEM_SEARCH);
|
||||
|
||||
if (!(orga.getContentBundle().hasInstance(department.getLanguage()))) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.organization.add.no_suitable_language_variant"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,295 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.bebop.ControlLink;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Link;
|
||||
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.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
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.ItemResolver;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Sheet for showing the superior organization of a SciDepartment.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
* @see SciOrganization
|
||||
*/
|
||||
public class SciDepartmentOrganizationSheet
|
||||
extends Table
|
||||
implements TableActionListener {
|
||||
|
||||
private static final Logger logger =
|
||||
Logger.getLogger(
|
||||
SciDepartmentOrganizationSheet.class);
|
||||
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;
|
||||
private boolean m_done;
|
||||
|
||||
public SciDepartmentOrganizationSheetModel(Table table,
|
||||
PageState state,
|
||||
SciDepartment department) {
|
||||
m_table = table;
|
||||
m_orga = department.getOrganization();
|
||||
if (m_orga == null) {
|
||||
m_done = false;
|
||||
} else {
|
||||
m_done = true;
|
||||
}
|
||||
}
|
||||
|
||||
public int getColumnCount() {
|
||||
return m_table.getColumnModel().size();
|
||||
}
|
||||
|
||||
public boolean nextRow() {
|
||||
boolean ret;
|
||||
|
||||
if (m_done) {
|
||||
ret = true;
|
||||
m_done = false;
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Object getElementAt(int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return m_orga.getTitle();
|
||||
case 1:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.organization.remove").
|
||||
localize();
|
||||
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) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
SciDepartment department = (SciDepartment) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
SecurityManager.EDIT_ITEM,
|
||||
department);
|
||||
|
||||
if (canEdit) {
|
||||
SciOrganization organization;
|
||||
try {
|
||||
organization = new SciOrganization((BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
logger.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
Link link = new Link(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
organization.getLanguage()),
|
||||
resolver.generateItemURL(state,
|
||||
organization,
|
||||
section,
|
||||
organization.
|
||||
getVersion()));
|
||||
|
||||
return link;
|
||||
} else {
|
||||
SciOrganization organization;
|
||||
try {
|
||||
organization = new SciOrganization((BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
logger.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
Label label = new Label(
|
||||
String.format("%s (%s)",
|
||||
value.toString(),
|
||||
organization.getLanguage()));
|
||||
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 department = (SciDepartment) m_itemModel.
|
||||
getSelectedObject(
|
||||
state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
SecurityManager.DELETE_ITEM,
|
||||
department);
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Step for setting the superior organization of a SciDepartment.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
* @see SciOrganization
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,570 +0,0 @@
|
|||
/*
|
||||
* 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.PageState;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganization;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
import com.arsdigita.cms.contenttypes.ui.panels.Filter;
|
||||
import com.arsdigita.cms.contenttypes.ui.panels.TextFilter;
|
||||
import com.arsdigita.xml.Element;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciDepartmentPanel extends SciOrganizationBasePanel {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(
|
||||
SciDepartmentPanel.class);
|
||||
public static final String SHOW_DESCRIPTION = "description";
|
||||
public static final String SHOW_MEMBERS_ACTIVE = "membersActive";
|
||||
public static final String SHOW_MEMBERS_ASSOCIATED = "membersAssociated";
|
||||
public static final String SHOW_MEMBERS_FORMER = "membersFormer";
|
||||
public static final String SHOW_SUBDEPARTMENTS = "subdepartments";
|
||||
public static final String SHOW_PROJECTS = "projects";
|
||||
public static final String SHOW_PROJECTS_ONGOING = "projectsOngoing";
|
||||
public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
|
||||
private static final String TITLE = "title";
|
||||
private String show;
|
||||
private boolean displayDescription = true;
|
||||
private boolean displaySubDepartments = true;
|
||||
private boolean displayProjects = true;
|
||||
private Map<String, Filter> projectFilters =
|
||||
new LinkedHashMap<String, Filter>();
|
||||
|
||||
public SciDepartmentPanel() {
|
||||
projectFilters.put(TITLE, new TextFilter(TITLE, TITLE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultShowParam() {
|
||||
return SHOW_DESCRIPTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends ContentItem> getAllowedClass() {
|
||||
return SciDepartment.class;
|
||||
}
|
||||
|
||||
public boolean isDisplayDescription() {
|
||||
return displayDescription;
|
||||
}
|
||||
|
||||
public void setDisplayDescription(boolean displayDescription) {
|
||||
this.displayDescription = displayDescription;
|
||||
}
|
||||
|
||||
public boolean isDisplayProjects() {
|
||||
return displayProjects;
|
||||
}
|
||||
|
||||
public void setDisplayProjects(boolean displayProjects) {
|
||||
this.displayProjects = displayProjects;
|
||||
}
|
||||
|
||||
public boolean isDisplaySubDepartments() {
|
||||
return displaySubDepartments;
|
||||
}
|
||||
|
||||
public void setDisplaySubDepartments(boolean displaySubDepartments) {
|
||||
this.displaySubDepartments = displaySubDepartments;
|
||||
}
|
||||
|
||||
protected boolean hasMembers(final SciDepartment department) {
|
||||
return department.hasMembers(SciDepartment.getConfig().
|
||||
getOrganizationMembersMerge(),
|
||||
SciDepartment.MemberStatus.ALL);
|
||||
}
|
||||
|
||||
protected boolean hasActiveMembers(final SciDepartment department) {
|
||||
return department.hasMembers(SciDepartment.getConfig().
|
||||
getOrganizationMembersMerge(),
|
||||
SciDepartment.MemberStatus.ACTIVE);
|
||||
}
|
||||
|
||||
protected boolean hasAssociatedMembers(final SciDepartment department) {
|
||||
return department.hasMembers(SciDepartment.getConfig().
|
||||
getOrganizationMembersMerge(),
|
||||
SciDepartment.MemberStatus.ASSOCIATED);
|
||||
}
|
||||
|
||||
protected boolean hasFormerMembers(final SciDepartment department) {
|
||||
return department.hasMembers(SciDepartment.getConfig().
|
||||
getOrganizationMembersMerge(),
|
||||
SciDepartment.MemberStatus.FORMER);
|
||||
}
|
||||
|
||||
protected boolean hasProjects(final SciDepartment department) {
|
||||
return department.hasProjects(SciDepartment.getConfig().
|
||||
getOrganizationProjectsMerge(),
|
||||
SciDepartment.ProjectStatus.ALL);
|
||||
}
|
||||
|
||||
protected boolean hasOngoingProjects(final SciDepartment department) {
|
||||
return department.hasProjects(SciDepartment.getConfig().
|
||||
getOrganizationProjectsMerge(),
|
||||
SciDepartment.ProjectStatus.ONGOING);
|
||||
}
|
||||
|
||||
protected boolean hasFinishedProjects(final SciDepartment department) {
|
||||
return department.hasProjects(SciDepartment.getConfig().
|
||||
getOrganizationProjectsMerge(),
|
||||
SciDepartment.ProjectStatus.FINISHED);
|
||||
}
|
||||
|
||||
protected void generateSubDepartmentsXML(final SciDepartment department,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
SciDepartmentSubDepartmentsCollection subDepartments;
|
||||
subDepartments = department.getSubDepartments();
|
||||
subDepartments.addOrder("link.subDepartmentOrder asc");
|
||||
|
||||
long pageNumber = getPageNumber(state);
|
||||
|
||||
Element subDepartmentsElem = parent.newChildElement("subDepartments");
|
||||
|
||||
long pageCount = getPageCount(subDepartments.size());
|
||||
long begin = getPaginatorBegin(pageNumber);
|
||||
long count = getPaginatorCount(begin, subDepartments.size());
|
||||
long end = getPaginatorEnd(begin, count);
|
||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||
|
||||
createPaginatorElement(
|
||||
parent, pageNumber, pageCount, begin, end, count,
|
||||
subDepartments.size());
|
||||
subDepartments.setRange((int) begin + 1, (int) end + 1);
|
||||
|
||||
while (subDepartments.next()) {
|
||||
SciDepartment subDepartment;
|
||||
subDepartment = subDepartments.getSubDepartment();
|
||||
|
||||
Element subDepartmentElem = subDepartmentsElem.newChildElement(
|
||||
"department");
|
||||
subDepartmentElem.addAttribute("order",
|
||||
Integer.toString(subDepartments.
|
||||
getSubDepartmentOrder()));
|
||||
subDepartmentElem.addAttribute("oid", subDepartment.getOID().
|
||||
toString());
|
||||
|
||||
Element title = subDepartmentElem.newChildElement("title");
|
||||
title.setText(subDepartment.getTitle());
|
||||
|
||||
if ((subDepartment.getAddendum() != null)
|
||||
&& !(subDepartment.getAddendum().isEmpty())) {
|
||||
Element addendum = subDepartmentElem.newChildElement("addendum");
|
||||
addendum.setText(subDepartment.getAddendum());
|
||||
}
|
||||
|
||||
if ((subDepartment.getDepartmentShortDescription() != null)
|
||||
&& !(subDepartment.getDepartmentShortDescription().isEmpty())) {
|
||||
Element shortDesc = subDepartmentElem.newChildElement(
|
||||
"shortDescription");
|
||||
shortDesc.setText(subDepartment.getDepartmentShortDescription());
|
||||
}
|
||||
|
||||
GenericOrganizationalUnitPersonCollection heads;
|
||||
heads = subDepartment.getPersons();
|
||||
heads.addFilter(("link.role_name = 'head'"));
|
||||
heads.addOrder("surname asc, givenname asc");
|
||||
|
||||
if (heads.size() > 0) {
|
||||
Element headsElem = subDepartmentElem.newChildElement("heads");
|
||||
|
||||
while (heads.next()) {
|
||||
Element headElem = headsElem.newChildElement("head");
|
||||
Element titlePre = headElem.newChildElement("titlePre");
|
||||
titlePre.setText(heads.getTitlePre());
|
||||
Element givenName = headElem.newChildElement("givenname");
|
||||
givenName.setText(heads.getGivenName());
|
||||
Element surname = headElem.newChildElement("surname");
|
||||
surname.setText(heads.getSurname());
|
||||
Element titlePost = headElem.newChildElement("titlePost");
|
||||
titlePost.setText(heads.getTitlePost());
|
||||
}
|
||||
}
|
||||
|
||||
GenericOrganizationalUnitContactCollection contacts;
|
||||
contacts = subDepartment.getContacts();
|
||||
if (contacts.size() > 0) {
|
||||
Element contactsElem = subDepartmentElem.newChildElement(
|
||||
"contacts");
|
||||
|
||||
while (contacts.next()) {
|
||||
generateContactXML(contacts.getContactType(),
|
||||
contacts.getPerson(),
|
||||
contacts.getContactEntries(),
|
||||
contacts.getAddress(),
|
||||
contactsElem,
|
||||
state,
|
||||
Integer.toString(
|
||||
contacts.getContactOrder()),
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void generateMembersXML(final SciDepartment department,
|
||||
final Element parent,
|
||||
final PageState state,
|
||||
final List<String> filters) {
|
||||
if (SciDepartment.getConfig().getOrganizationMembersMerge()) {
|
||||
List<MemberListItem> members;
|
||||
members = new LinkedList<MemberListItem>();
|
||||
GenericOrganizationalUnitPersonCollection departmentMembers;
|
||||
departmentMembers = department.getPersons();
|
||||
for (String filter : filters) {
|
||||
departmentMembers.addFilter(filter);
|
||||
}
|
||||
|
||||
SciDepartmentSubDepartmentsCollection subDepartments;
|
||||
subDepartments = department.getSubDepartments();
|
||||
|
||||
while (departmentMembers.next()) {
|
||||
addMember(departmentMembers,
|
||||
members);
|
||||
}
|
||||
|
||||
mergeMembers(subDepartments, members, filters);
|
||||
|
||||
Collections.sort(members, new MemberListItemComparator());
|
||||
|
||||
long pageNumber = getPageNumber(state);
|
||||
long pageCount = getPageCount(members.size());
|
||||
long begin = getPaginatorBegin(pageNumber);
|
||||
long count = getPaginatorCount(begin, members.size());
|
||||
long end = getPaginatorEnd(begin, count);
|
||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||
|
||||
createPaginatorElement(
|
||||
parent, pageNumber, pageCount, begin, end, count, members.
|
||||
size());
|
||||
List<MemberListItem> membersToShow = members.subList((int) begin,
|
||||
(int) end);
|
||||
|
||||
Element membersElem = parent.newChildElement("members");
|
||||
|
||||
for (MemberListItem memberItem : membersToShow) {
|
||||
generateMemberXML(memberItem,
|
||||
membersElem,
|
||||
memberItem.getRole(),
|
||||
memberItem.getStatus(),
|
||||
state);
|
||||
}
|
||||
} else {
|
||||
GenericOrganizationalUnitPersonCollection departmentMembers;
|
||||
departmentMembers = department.getPersons();
|
||||
for (String filter : filters) {
|
||||
departmentMembers.addFilter(filter);
|
||||
}
|
||||
|
||||
List<MemberListItem> members = new LinkedList<MemberListItem>();
|
||||
|
||||
while (departmentMembers.next()) {
|
||||
addMember(departmentMembers,
|
||||
members);
|
||||
}
|
||||
|
||||
Collections.sort(members, new MemberListItemComparator());
|
||||
|
||||
long pageNumber = getPageNumber(state);
|
||||
|
||||
Element membersElem = parent.newChildElement("members");
|
||||
|
||||
long pageCount = getPageCount(members.size());
|
||||
long begin = getPaginatorBegin(pageNumber);
|
||||
long count = getPaginatorCount(begin, members.size());
|
||||
long end = getPaginatorEnd(begin, count);
|
||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||
|
||||
createPaginatorElement(
|
||||
parent, pageNumber, pageCount, begin, end, count, members.
|
||||
size());
|
||||
List<MemberListItem> membersToShow = members.subList((int) begin,
|
||||
(int) end);
|
||||
|
||||
for (MemberListItem memberItem : membersToShow) {
|
||||
generateMemberXML(memberItem,
|
||||
membersElem,
|
||||
memberItem.getRole(),
|
||||
memberItem.getStatus(),
|
||||
state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void generateProjectFiltersXml(
|
||||
final List<SciProject> projects,
|
||||
final Element element) {
|
||||
final Element filterElement = element.newChildElement("filters");
|
||||
|
||||
for (Map.Entry<String, Filter> filterEntry : projectFilters.entrySet()) {
|
||||
filterEntry.getValue().generateXml(filterElement);
|
||||
}
|
||||
}
|
||||
|
||||
protected void applyProjectFilters(
|
||||
final List<String> filters,
|
||||
final HttpServletRequest request) {
|
||||
//Get parameters from HTTP request
|
||||
for (Map.Entry<String, Filter> filterEntry : projectFilters.entrySet()) {
|
||||
String value = request.getParameter(
|
||||
filterEntry.getValue().getLabel());
|
||||
|
||||
if ((value != null) && !(value.trim().isEmpty())) {
|
||||
filterEntry.getValue().setValue(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void generateProjectsXML(final SciDepartment department,
|
||||
final Element parent,
|
||||
final PageState state,
|
||||
final List<String> filters) {
|
||||
Element controls = parent.newChildElement("filterControls");
|
||||
controls.addAttribute("customName", "sciDepartmentProjects");
|
||||
controls.addAttribute("show", show);
|
||||
|
||||
if (SciDepartment.getConfig().getOrganizationProjectsMerge()) {
|
||||
List<SciProject> projects;
|
||||
projects = new LinkedList<SciProject>();
|
||||
SciDepartmentProjectsCollection departmentProjects;
|
||||
departmentProjects = department.getProjects();
|
||||
|
||||
applyProjectFilters(filters, state.getRequest());
|
||||
if ((filters != null)
|
||||
&& !(filters.isEmpty())) {
|
||||
for (String filter : filters) {
|
||||
departmentProjects.addFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
SciDepartmentSubDepartmentsCollection subDepartments;
|
||||
subDepartments = department.getSubDepartments();
|
||||
|
||||
while (departmentProjects.next()) {
|
||||
projects.add(departmentProjects.getProject());
|
||||
}
|
||||
|
||||
mergeProjects(subDepartments, projects, filters);
|
||||
|
||||
Set<SciProject> projectsSet;
|
||||
List<SciProject> projectsWithoutDoubles;
|
||||
projectsSet = new HashSet<SciProject>(projects);
|
||||
projectsWithoutDoubles = new LinkedList<SciProject>(projectsSet);
|
||||
|
||||
Collections.sort(projectsWithoutDoubles, new SciProjectComparator());
|
||||
|
||||
long pageNumber = getPageNumber(state);
|
||||
long pageCount = getPageCount(projectsWithoutDoubles.size());
|
||||
long begin = getPaginatorBegin(pageNumber);
|
||||
long count = getPaginatorCount(begin, projectsWithoutDoubles.size());
|
||||
long end = getPaginatorEnd(begin, count);
|
||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||
|
||||
generateProjectFiltersXml(projectsWithoutDoubles, controls);
|
||||
createPaginatorElement(parent,
|
||||
pageNumber,
|
||||
pageCount,
|
||||
begin,
|
||||
end,
|
||||
count,
|
||||
projectsWithoutDoubles.size());
|
||||
List<SciProject> projectsToShow =
|
||||
projectsWithoutDoubles.subList((int) begin,
|
||||
(int) end);
|
||||
|
||||
Element projectsElem = parent.newChildElement("projects");
|
||||
for (SciProject project : projectsToShow) {
|
||||
generateProjectXML(project, projectsElem, state);
|
||||
}
|
||||
} else {
|
||||
SciDepartmentProjectsCollection departmentProjects;
|
||||
departmentProjects = department.getProjects();
|
||||
|
||||
if ((filters != null)
|
||||
&& !(filters.isEmpty())) {
|
||||
for (String filter : filters) {
|
||||
departmentProjects.addFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
List<SciProject> projects = new LinkedList<SciProject>();
|
||||
|
||||
while (departmentProjects.next()) {
|
||||
projects.add(departmentProjects.getProject());
|
||||
}
|
||||
|
||||
Collections.sort(projects, new SciProjectComparator());
|
||||
|
||||
long pageNumber = getPageNumber(state);
|
||||
long pageCount = getPageCount(projects.size());
|
||||
long begin = getPaginatorBegin(pageNumber);
|
||||
long count = getPaginatorCount(begin, projects.size());
|
||||
long end = getPaginatorEnd(begin, count);
|
||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||
|
||||
generateProjectFiltersXml(projects, controls);
|
||||
createPaginatorElement(
|
||||
parent, pageNumber, pageCount, begin, end, count, projects.
|
||||
size());
|
||||
List<SciProject> projectsToShow = projects.subList((int) begin,
|
||||
(int) end);
|
||||
|
||||
Element projectsElem = parent.newChildElement("projects");
|
||||
for (SciProject project : projectsToShow) {
|
||||
generateProjectXML(project, projectsElem, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateAvailableDataXml(final GenericOrganizationalUnit orga,
|
||||
final Element element,
|
||||
final PageState state) {
|
||||
final SciOrganizationConfig config = SciOrganization.getConfig();
|
||||
|
||||
SciDepartment department = (SciDepartment) orga;
|
||||
|
||||
if ((department.getDepartmentDescription() != null)
|
||||
&& !department.getDepartmentDescription().isEmpty()
|
||||
&& displayDescription) {
|
||||
element.newChildElement("description");
|
||||
}
|
||||
if (department.hasContacts()
|
||||
&& isDisplayContacts()) {
|
||||
element.newChildElement("contacts");
|
||||
}
|
||||
if (department.hasSubDepartments()
|
||||
&& displaySubDepartments) {
|
||||
element.newChildElement("subDepartments");
|
||||
}
|
||||
if (config.getOrganizationMembersAllInOne()) {
|
||||
if (hasMembers(department)
|
||||
&& isDisplayMembers()) {
|
||||
element.newChildElement("members");
|
||||
}
|
||||
} else {
|
||||
if (hasActiveMembers(department)
|
||||
&& isDisplayMembers()) {
|
||||
element.newChildElement("membersActive");
|
||||
}
|
||||
if (hasAssociatedMembers(department)
|
||||
&& isDisplayMembers()) {
|
||||
element.newChildElement("membersAssociated");
|
||||
}
|
||||
if (hasFormerMembers(department)
|
||||
&& isDisplayMembers()) {
|
||||
element.newChildElement("membersFormer");
|
||||
}
|
||||
}
|
||||
if (config.getOrganizationProjectsAllInOne()) {
|
||||
if (hasProjects(department)
|
||||
&& displayProjects) {
|
||||
element.newChildElement("projects");
|
||||
}
|
||||
} else {
|
||||
if (hasOngoingProjects(department)
|
||||
&& displayProjects) {
|
||||
element.newChildElement("projectsOngoing");
|
||||
}
|
||||
if (hasFinishedProjects(department)
|
||||
&& displayProjects) {
|
||||
element.newChildElement("projectsFinished");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateDataXml(GenericOrganizationalUnit orga,
|
||||
Element element,
|
||||
PageState state) {
|
||||
show = getShowParam(state);
|
||||
|
||||
SciDepartment department = (SciDepartment) orga;
|
||||
|
||||
if (SHOW_DESCRIPTION.equals(show)) {
|
||||
String desc;
|
||||
desc = department.getDepartmentDescription();
|
||||
|
||||
Element description = element.newChildElement("description");
|
||||
description.setText(desc);
|
||||
} else if (SHOW_CONTACTS.equals(show)) {
|
||||
generateContactsXML(department, element, state);
|
||||
} else if (SHOW_MEMBERS.equals(show)) {
|
||||
generateMembersXML(department, element, state,
|
||||
new LinkedList<String>());
|
||||
} else if (SHOW_MEMBERS_ACTIVE.equals(show)) {
|
||||
generateMembersXML(department, element, state,
|
||||
getFiltersForActiveMembers());
|
||||
} else if (SHOW_MEMBERS_ASSOCIATED.equals(show)) {
|
||||
generateMembersXML(department, element, state,
|
||||
getFiltersForAssociatedMembers());
|
||||
} else if (SHOW_MEMBERS_FORMER.equals(show)) {
|
||||
generateMembersXML(department, element, state,
|
||||
getFiltersForFormerMembers());
|
||||
} else if (SHOW_PROJECTS.equals(show)) {
|
||||
generateProjectsXML(department, element, state,
|
||||
new LinkedList<String>());
|
||||
} else if (SHOW_PROJECTS_ONGOING.equals(show)) {
|
||||
generateProjectsXML(department, element, state,
|
||||
getFiltersForOngoingProjects());
|
||||
} else if (SHOW_PROJECTS_FINISHED.equals(show)) {
|
||||
generateProjectsXML(department, element, state,
|
||||
getFiltersForFinishedProjects());
|
||||
} else if (SHOW_SUBDEPARTMENTS.equals(show)) {
|
||||
generateSubDepartmentsXML(department, element, state);
|
||||
}
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void generateXML(ContentItem item,
|
||||
Element element,
|
||||
PageState state) {
|
||||
Element content = generateBaseXML(item, element, state);
|
||||
|
||||
Element availableData = content.newChildElement("availableData");
|
||||
|
||||
SciDepartment department = (SciDepartment) item;
|
||||
|
||||
generateAvailableDataXml(department, availableData, state);
|
||||
|
||||
generateDataXml(department, content, state);
|
||||
}*/
|
||||
}
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
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.SciDepartmentProjectsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
|
||||
/**
|
||||
* Form for linking an {@link SciDepartment} with a {@link SciProject}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
* @see SciProject
|
||||
*/
|
||||
public class SciDepartmentProjectAddForm
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener {
|
||||
|
||||
private ItemSearchWidget m_itemSearch;
|
||||
private final String ITEM_SEARCH = "projects";
|
||||
|
||||
public SciDepartmentProjectAddForm(ItemSelectionModel itemModel) {
|
||||
super("ProjectsAddForm", itemModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
add(new Label((String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.select_project").localize()));
|
||||
m_itemSearch = new ItemSearchWidget(
|
||||
ITEM_SEARCH,
|
||||
ContentType.findByAssociatedObjectType(
|
||||
SciProject.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().getCancelButton().
|
||||
isSelected(state))) {
|
||||
SciProject project = (SciProject) data.get(ITEM_SEARCH);
|
||||
project = (SciProject) project.getContentBundle().getInstance(department.
|
||||
getLanguage());
|
||||
|
||||
department.addProject(project);
|
||||
}
|
||||
|
||||
init(fse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.select_project.no_project_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
SciDepartment department = (SciDepartment) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
SciProject project = (SciProject) data.get(ITEM_SEARCH);
|
||||
if (!(project.getContentBundle().hasInstance(department.getLanguage()))) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.select_project.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
||||
project = (SciProject) project.getContentBundle().getInstance(department.
|
||||
getLanguage());
|
||||
SciDepartmentProjectsCollection projects = department.getProjects();
|
||||
projects.addFilter(String.format("id = %s", project.getID().toString()));
|
||||
if (projects.size() > 0) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.select_project.already_added"));
|
||||
}
|
||||
|
||||
projects.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Step for linking {@link SciDepartment}s with {@link SciProject}s.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
* @see SciProject
|
||||
*/
|
||||
public class SciDepartmentProjectsStep extends SimpleEditStep {
|
||||
|
||||
private String ADD_PROJECT_SHEET_NAME = "addProject";
|
||||
|
||||
public SciDepartmentProjectsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public SciDepartmentProjectsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent,
|
||||
String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addProjectSheet =
|
||||
new SciDepartmentProjectAddForm(itemModel);
|
||||
add(ADD_PROJECT_SHEET_NAME,
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.add_project").localize(),
|
||||
new WorkflowLockedComponentAccess(addProjectSheet, itemModel),
|
||||
addProjectSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
SciDepartmentProjectsTable projectsTable =
|
||||
new SciDepartmentProjectsTable(
|
||||
itemModel);
|
||||
setDisplayComponent(projectsTable);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,383 +0,0 @@
|
|||
/*
|
||||
* 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 java.math.BigDecimal;
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.ControlLink;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Link;
|
||||
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.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Table for showing all {@link SciProject}s linked with a {@link SciDepartment}
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
* @see SciProject
|
||||
*/
|
||||
public class SciDepartmentProjectsTable
|
||||
extends Table
|
||||
implements TableActionListener {
|
||||
|
||||
private final Logger s_log = Logger.getLogger(
|
||||
SciDepartmentProjectsTable.class);
|
||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||
private final String TABLE_COL_DEL = "table_col_del";
|
||||
private final String TABLE_COL_UP = "table_col_up";
|
||||
private final String TABLE_COL_DOWN = "table_col_down";
|
||||
private ItemSelectionModel m_itemModel;
|
||||
|
||||
public SciDepartmentProjectsTable(ItemSelectionModel itemModel) {
|
||||
super();
|
||||
m_itemModel = itemModel;
|
||||
|
||||
setEmptyView(
|
||||
new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.projects.none")));
|
||||
|
||||
TableColumnModel colModel = getColumnModel();
|
||||
colModel.add(new TableColumn(
|
||||
0,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.project").localize(),
|
||||
TABLE_COL_EDIT));
|
||||
colModel.add(new TableColumn(
|
||||
1,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.project.remove").localize(),
|
||||
TABLE_COL_DEL));
|
||||
/*colModel.add(new TableColumn(
|
||||
2,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.project.up").localize(),
|
||||
TABLE_COL_UP));
|
||||
colModel.add(new TableColumn(
|
||||
3,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.project.down").localize(),
|
||||
TABLE_COL_DOWN));*/
|
||||
|
||||
setModelBuilder(
|
||||
new SciDepartmentProjectsTableModelBuilder(itemModel));
|
||||
|
||||
colModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||
colModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||
//colModel.get(2).setCellRenderer(new UpCellRenderer());
|
||||
//colModel.get(3).setCellRenderer(new DownCellRenderer());
|
||||
|
||||
addTableActionListener(this);
|
||||
}
|
||||
|
||||
private class SciDepartmentProjectsTableModelBuilder
|
||||
extends LockableImpl
|
||||
implements TableModelBuilder {
|
||||
|
||||
private ItemSelectionModel m_itemModel;
|
||||
|
||||
public SciDepartmentProjectsTableModelBuilder(
|
||||
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 SciDepartmentProjectsTableModel(table,
|
||||
state,
|
||||
department);
|
||||
}
|
||||
}
|
||||
|
||||
private class SciDepartmentProjectsTableModel
|
||||
implements TableModel {
|
||||
|
||||
private Table m_table;
|
||||
private SciDepartmentProjectsCollection m_projects;
|
||||
private SciProject m_project;
|
||||
|
||||
public SciDepartmentProjectsTableModel(Table table,
|
||||
PageState state,
|
||||
SciDepartment department) {
|
||||
m_table = table;
|
||||
m_projects = department.getProjects();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return m_table.getColumnModel().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nextRow() {
|
||||
boolean ret;
|
||||
|
||||
if ((m_projects != null) && m_projects.next()) {
|
||||
m_project = m_projects.getProject();
|
||||
ret = true;
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return m_project.getTitle();
|
||||
case 1:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.project.remove").
|
||||
localize();
|
||||
case 2:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.project.up").
|
||||
localize();
|
||||
case 3:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.project.down").
|
||||
localize();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getKeyAt(int columnIndex) {
|
||||
return m_project.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 col) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
SciDepartment department = (SciDepartment) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
SecurityManager.EDIT_ITEM,
|
||||
department);
|
||||
|
||||
if (canEdit) {
|
||||
SciProject project;
|
||||
try {
|
||||
project = new SciProject((BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
s_log.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
|
||||
}
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
Link link =
|
||||
new Link(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
project.getLanguage()),
|
||||
resolver.generateItemURL(state,
|
||||
project,
|
||||
section,
|
||||
project.getVersion()));
|
||||
|
||||
return link;
|
||||
} else {
|
||||
SciProject project;
|
||||
try {
|
||||
project = new SciProject((BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
s_log.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
|
||||
}
|
||||
Label label = new Label(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
project.getLanguage()));
|
||||
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 department = (SciDepartment) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
SecurityManager.DELETE_ITEM,
|
||||
department);
|
||||
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
link.setConfirmation((String) SciOrganizationGlobalizationUtil.
|
||||
globalize(
|
||||
"sciorganization.ui.department.project."
|
||||
+ "confirm_remove").
|
||||
localize());
|
||||
return link;
|
||||
} else {
|
||||
Label label = new Label(value.toString());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class UpCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getComponent(
|
||||
Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int col) {
|
||||
|
||||
if (0 == row) {
|
||||
Label label = new Label("");
|
||||
return label;
|
||||
} else {
|
||||
ControlLink link = new ControlLink(
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.project.up").
|
||||
localize());
|
||||
return link;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class DownCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getComponent(
|
||||
Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int col) {
|
||||
|
||||
SciDepartment department = (SciDepartment) m_itemModel.
|
||||
getSelectedObject(
|
||||
state);
|
||||
SciDepartmentProjectsCollection projects =
|
||||
department.getProjects();
|
||||
|
||||
if ((projects.size() - 1) == row) {
|
||||
Label label = new Label("");
|
||||
return label;
|
||||
} else {
|
||||
ControlLink link = new ControlLink(
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.project.down").
|
||||
localize());
|
||||
return link;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cellSelected(TableActionEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
|
||||
SciProject project = new SciProject(
|
||||
new BigDecimal(event.getRowKey().toString()));
|
||||
|
||||
SciDepartment department =
|
||||
(SciDepartment) m_itemModel.getSelectedObject(state);
|
||||
|
||||
SciDepartmentProjectsCollection projects =
|
||||
department.getProjects();
|
||||
|
||||
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.removeProject(project);
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
|
||||
projects.swapWithPrevious(project);
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
|
||||
projects.swapWithNext(project);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void headSelected(TableActionEvent event) {
|
||||
//Nothing to do.
|
||||
}
|
||||
}
|
||||
|
|
@ -1,159 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ContentTypeCollection;
|
||||
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;
|
||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
|
||||
/**
|
||||
* Step for editing a {@link SciDepartment}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
*/
|
||||
public class SciDepartmentPropertiesStep
|
||||
extends GenericOrganizationalUnitPropertiesStep {
|
||||
|
||||
public SciDepartmentPropertiesStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
super(itemModel, parent);
|
||||
}
|
||||
|
||||
public static Component getSciDepartmentPropertySheet(
|
||||
ItemSelectionModel itemModel) {
|
||||
DomainObjectPropertySheet sheet =
|
||||
(DomainObjectPropertySheet) GenericOrganizationalUnitPropertiesStep.
|
||||
getGenericOrganizationalUnitPropertySheet(itemModel);
|
||||
|
||||
sheet.add(SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganizations.ui.department.shortdescription"),
|
||||
SciDepartment.DEPARTMENT_SHORT_DESCRIPTION);
|
||||
|
||||
return sheet;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addBasicProperties(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
|
||||
parent,
|
||||
EDIT_SHEET_NAME);
|
||||
|
||||
BasicPageForm editBasicSheet =
|
||||
new SciDepartmentPropertyForm(itemModel, this);
|
||||
|
||||
basicProperties.add(EDIT_SHEET_NAME,
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.edit_basic_properties").
|
||||
localize(),
|
||||
new WorkflowLockedComponentAccess(editBasicSheet,
|
||||
itemModel),
|
||||
editBasicSheet.getSaveCancelSection().
|
||||
getCancelButton());
|
||||
|
||||
basicProperties.setDisplayComponent(
|
||||
getSciDepartmentPropertySheet(itemModel));
|
||||
|
||||
getSegmentedPanel().addSegment(
|
||||
new Label((String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.basic_properties").localize()),
|
||||
basicProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addSteps(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
//super.addSteps(itemModel, parent);
|
||||
|
||||
SciOrganizationConfig config;
|
||||
config = SciDepartment.getConfig();
|
||||
|
||||
if (!config.getDepartmentAddContactHide()) {
|
||||
addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
|
||||
parent),
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.contacts"));
|
||||
}
|
||||
|
||||
/*
|
||||
if (!config.getDepartmentAddPersonHide()) {
|
||||
addStep(new SciDepartmentMemberStep(itemModel,
|
||||
parent),
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.members"));
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if (!config.getDepartmentAddSubDepartmentHide()) {
|
||||
addStep(new SciDepartmentSubDepartmentsStep(itemModel, parent),
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.subdepartments"));
|
||||
}
|
||||
*/
|
||||
|
||||
if (!config.getDepartmentSetSuperDepartmentHide()) {
|
||||
addStep(new SciDepartmentSuperDepartmentStep(itemModel, parent),
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.superdepartment"));
|
||||
}
|
||||
|
||||
/*
|
||||
if (!config.getDepartmentAddProjectHide()) {
|
||||
addStep(new SciDepartmentProjectsStep(itemModel, parent),
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.projects"));
|
||||
}
|
||||
*/
|
||||
|
||||
if (!config.getDepartmentSetOrganizationHide()) {
|
||||
addStep(new SciDepartmentOrganizationStep(itemModel, parent),
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.organization"));
|
||||
}
|
||||
|
||||
/*
|
||||
ContentTypeCollection contentTypes = ContentType.getAllContentTypes();
|
||||
contentTypes.addFilter("associatedObjectType = :type").set(
|
||||
"type",
|
||||
"com.arsdigita.cms.contenttypes.Publication");
|
||||
if ((!config.getDepartmentPublicationsHide())
|
||||
&& (contentTypes.size() > 0)) {
|
||||
/*
|
||||
* Must add this step manually since the basic class is not
|
||||
* SimpleEditStep...
|
||||
*/
|
||||
/* getSegmentedPanel().addSegment(new Label(SciOrganizationGlobalizationUtil.
|
||||
globalize("sciorganization.ui.department.publications")),
|
||||
new SciDepartmentPublicationsStep(
|
||||
itemModel, parent));
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
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.StringInRangeValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
|
||||
/**
|
||||
* Form for editing the basic properties of a {@link SciDepartment}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
*/
|
||||
public class SciDepartmentPropertyForm
|
||||
extends GenericOrganizationalUnitPropertyForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener {
|
||||
|
||||
public static final String ID = "SciDepartmentEdit";
|
||||
|
||||
public SciDepartmentPropertyForm(ItemSelectionModel itemModel) {
|
||||
this(itemModel, null);
|
||||
}
|
||||
|
||||
public SciDepartmentPropertyForm(ItemSelectionModel itemModel,
|
||||
SciDepartmentPropertiesStep step) {
|
||||
super(itemModel, step);
|
||||
addSubmissionListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
super.addWidgets();
|
||||
|
||||
Label descLabel = new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganizations.ui.department.shortdescription"));
|
||||
add(descLabel);
|
||||
ParameterModel descParam = new StringParameter(
|
||||
SciDepartment.DEPARTMENT_SHORT_DESCRIPTION);
|
||||
TextArea desc = new TextArea(descParam);
|
||||
desc.addValidationListener(new StringInRangeValidationListener(0, 500));
|
||||
desc.setCols(75);
|
||||
desc.setRows(5);
|
||||
add(desc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||
super.init(fse);
|
||||
|
||||
FormData data = fse.getFormData();
|
||||
SciDepartment department = (SciDepartment) super.initBasicWidgets(fse);
|
||||
|
||||
data.put(SciDepartment.DEPARTMENT_SHORT_DESCRIPTION,
|
||||
department.getDepartmentShortDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FormSectionEvent fse) throws FormProcessException {
|
||||
super.process(fse);
|
||||
|
||||
FormData data = fse.getFormData();
|
||||
SciDepartment department =
|
||||
(SciDepartment) super.processBasicWidgets(fse);
|
||||
|
||||
if ((department != null) && getSaveCancelSection().getSaveButton().
|
||||
isSelected(fse.getPageState())) {
|
||||
department.setDepartmentShortDescription(
|
||||
(String) data.get(SciDepartment.DEPARTMENT_SHORT_DESCRIPTION));
|
||||
|
||||
department.save();
|
||||
|
||||
init(fse);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTitleLabel() {
|
||||
return (String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganizations.ui.department.title").localize();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010 Jens Pelzetter
|
||||
*
|
||||
* 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;
|
||||
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.SciDepartmentSubDepartmentsCollection;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
|
||||
/**
|
||||
* Form for adding subdepartments to a {@link SciDepartment}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
*/
|
||||
public class SciDepartmentSubDepartmentAddForm
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener {
|
||||
|
||||
private ItemSearchWidget m_itemSearch;
|
||||
private final String ITEM_SEARCH = "subdepartments";
|
||||
|
||||
public SciDepartmentSubDepartmentAddForm(ItemSelectionModel itemModel) {
|
||||
super("SubDepartmentsAddForm", itemModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
add(new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.select_subdepartment")));
|
||||
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().getCancelButton().
|
||||
isSelected(state))) {
|
||||
SciDepartment subDepartment = (SciDepartment) data.get(ITEM_SEARCH);
|
||||
subDepartment = (SciDepartment) subDepartment.getContentBundle().
|
||||
getInstance(department.getLanguage());
|
||||
|
||||
department.addSubDepartment(subDepartment);
|
||||
}
|
||||
|
||||
init(fse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.select_subdepartment.no_department_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
SciDepartment department = (SciDepartment) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
SciDepartment subDepartment = (SciDepartment) data.get(ITEM_SEARCH);
|
||||
if (!(subDepartment.getContentBundle().hasInstance(department.getLanguage()))) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.select_subdepartment.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
||||
subDepartment = (SciDepartment) subDepartment.getContentBundle().getInstance(department.getLanguage());
|
||||
|
||||
if (department.getID().equals(subDepartment.getID())) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.select_subdepartment.adding_to_itself"));
|
||||
return;
|
||||
}
|
||||
|
||||
SciDepartmentSubDepartmentsCollection subDepartments = department.getSubDepartments();
|
||||
subDepartments.addFilter(String.format("id = %s", subDepartment.getID().toString()));
|
||||
if (subDepartments.size() > 0) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.select_subdepartment.already_added"));
|
||||
}
|
||||
|
||||
subDepartments.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Step for adding subdepartments to a {@link SciDepartment}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
*/
|
||||
public class SciDepartmentSubDepartmentsStep extends SimpleEditStep {
|
||||
|
||||
private String ADD_SUBDEPARTMENT_SHEET_NAME = "addSubDepartment";
|
||||
|
||||
public SciDepartmentSubDepartmentsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public SciDepartmentSubDepartmentsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent,
|
||||
String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addSubDepartmentSheet =
|
||||
new SciDepartmentSubDepartmentAddForm(itemModel);
|
||||
add(ADD_SUBDEPARTMENT_SHEET_NAME,
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.add_subdepartment").localize(),
|
||||
new WorkflowLockedComponentAccess(addSubDepartmentSheet, itemModel),
|
||||
addSubDepartmentSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
SciDepartmentSubDepartmentsTable subdepartmentTable =
|
||||
new SciDepartmentSubDepartmentsTable(
|
||||
itemModel);
|
||||
setDisplayComponent(subdepartmentTable);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,382 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010 Jens Pelzetter,
|
||||
*
|
||||
* 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;
|
||||
import com.arsdigita.bebop.ControlLink;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Link;
|
||||
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.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
|
||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Table for showing the subdepartments of a {@link SciDepartment}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
*/
|
||||
public class SciDepartmentSubDepartmentsTable
|
||||
extends Table
|
||||
implements TableActionListener {
|
||||
|
||||
private final Logger s_log = Logger.getLogger(
|
||||
SciDepartmentSubDepartmentsTable.class);
|
||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||
private final String TABLE_COL_DEL = "table_col_del";
|
||||
private final String TABLE_COL_UP = "table_col_up";
|
||||
private final String TABLE_COL_DOWN = "table_col_down";
|
||||
private ItemSelectionModel m_itemModel;
|
||||
|
||||
public SciDepartmentSubDepartmentsTable(ItemSelectionModel itemModel) {
|
||||
super();
|
||||
m_itemModel = itemModel;
|
||||
|
||||
setEmptyView(
|
||||
new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.subdepartments.none")));
|
||||
|
||||
TableColumnModel colModel = getColumnModel();
|
||||
colModel.add(new TableColumn(
|
||||
0,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.subdepartment").localize(),
|
||||
TABLE_COL_EDIT));
|
||||
colModel.add(new TableColumn(
|
||||
1,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.subdepartment.remove").localize(),
|
||||
TABLE_COL_DEL));
|
||||
colModel.add(new TableColumn(
|
||||
2,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.subdepartment.up").localize(),
|
||||
TABLE_COL_UP));
|
||||
colModel.add(new TableColumn(
|
||||
3,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.subdepartment.down").localize(),
|
||||
TABLE_COL_DOWN));
|
||||
|
||||
setModelBuilder(
|
||||
new SciDepartmentSubDepartmentsTableModelBuilder(itemModel));
|
||||
|
||||
colModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||
colModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||
colModel.get(2).setCellRenderer(new UpCellRenderer());
|
||||
colModel.get(3).setCellRenderer(new DownCellRenderer());
|
||||
|
||||
addTableActionListener(this);
|
||||
}
|
||||
|
||||
private class SciDepartmentSubDepartmentsTableModelBuilder
|
||||
extends LockableImpl
|
||||
implements TableModelBuilder {
|
||||
|
||||
private ItemSelectionModel m_itemModel;
|
||||
|
||||
public SciDepartmentSubDepartmentsTableModelBuilder(
|
||||
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 SciDepartmentSubDepartmentsTableModel(table,
|
||||
state,
|
||||
department);
|
||||
}
|
||||
}
|
||||
|
||||
private class SciDepartmentSubDepartmentsTableModel
|
||||
implements TableModel {
|
||||
|
||||
private Table m_table;
|
||||
private SciDepartmentSubDepartmentsCollection m_subdepartments;
|
||||
private SciDepartment m_subdepartment;
|
||||
|
||||
private SciDepartmentSubDepartmentsTableModel(Table table,
|
||||
PageState state,
|
||||
SciDepartment department) {
|
||||
m_table = table;
|
||||
m_subdepartments = department.getSubDepartments();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return m_table.getColumnModel().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nextRow() {
|
||||
boolean ret;
|
||||
|
||||
if ((m_subdepartments != null) && m_subdepartments.next()) {
|
||||
m_subdepartment = m_subdepartments.getSubDepartment();
|
||||
ret = true;
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return m_subdepartment.getTitle();
|
||||
case 1:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.subdepartment.remove").
|
||||
localize();
|
||||
case 2:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.subdepartment.up").
|
||||
localize();
|
||||
case 3:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.subdepartment.down").
|
||||
localize();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getKeyAt(int columnIndex) {
|
||||
return m_subdepartment.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 col) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
SciDepartment department = (SciDepartment) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
SecurityManager.EDIT_ITEM,
|
||||
department);
|
||||
|
||||
if (canEdit) {
|
||||
SciDepartment subDepartment;
|
||||
try {
|
||||
subDepartment = new SciDepartment(
|
||||
(BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
s_log.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
Link link = new Link(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
subDepartment.getLanguage()),
|
||||
resolver.generateItemURL(state,
|
||||
subDepartment,
|
||||
section,
|
||||
subDepartment.
|
||||
getVersion()));
|
||||
|
||||
return link;
|
||||
|
||||
|
||||
} else {
|
||||
SciDepartment subDepartment;
|
||||
try {
|
||||
subDepartment = new SciDepartment(
|
||||
(BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
s_log.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
Label label = new Label(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
subDepartment.getLanguage()));
|
||||
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 department = (SciDepartment) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
SecurityManager.DELETE_ITEM,
|
||||
department);
|
||||
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
link.setConfirmation((String) SciOrganizationGlobalizationUtil.
|
||||
globalize(
|
||||
"sciorganization.ui.department.subdepartment."
|
||||
+ ".confirm_remove").
|
||||
localize());
|
||||
return link;
|
||||
} else {
|
||||
Label label = new Label(value.toString());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class UpCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getComponent(
|
||||
Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int col) {
|
||||
|
||||
if (0 == row) {
|
||||
Label label = new Label("");
|
||||
return label;
|
||||
} else {
|
||||
ControlLink link = new ControlLink(
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.subdepartment.up").
|
||||
localize());
|
||||
return link;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class DownCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getComponent(
|
||||
Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int col) {
|
||||
|
||||
SciDepartment department = (SciDepartment) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
SciDepartmentSubDepartmentsCollection subDepartments =
|
||||
department.getSubDepartments();
|
||||
|
||||
if ((subDepartments.size() - 1) == row) {
|
||||
Label label = new Label("");
|
||||
return label;
|
||||
} else {
|
||||
ControlLink link = new ControlLink(
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.subdepartment.down").
|
||||
localize());
|
||||
return link;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cellSelected(TableActionEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
|
||||
SciDepartment subdepartment = new SciDepartment(
|
||||
new BigDecimal(event.getRowKey().toString()));
|
||||
|
||||
SciDepartment department =
|
||||
(SciDepartment) m_itemModel.getSelectedObject(state);
|
||||
|
||||
SciDepartmentSubDepartmentsCollection subdepartments =
|
||||
department.getSubDepartments();
|
||||
|
||||
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.removeSubDepartment(subdepartment);
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
|
||||
subdepartments.swapWithPrevious(subdepartment);
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
|
||||
subdepartments.swapWithNext(subdepartment);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void headSelected(TableActionEvent event) {
|
||||
//Nothing to do.
|
||||
}
|
||||
}
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Form for setting the superior department of a {@link SciDepartment}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
*/
|
||||
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))) {
|
||||
SciDepartment superDepartment =
|
||||
(SciDepartment) data.get(ITEM_SEARCH);
|
||||
superDepartment = (SciDepartment) superDepartment.getContentBundle().
|
||||
getInstance(department.getLanguage());
|
||||
|
||||
department.setSuperDepartment(superDepartment);
|
||||
}
|
||||
|
||||
init(fse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.select_superdepartment.no_department_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
SciDepartment department = (SciDepartment) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
SciDepartment superDepartment =
|
||||
(SciDepartment) data.get(ITEM_SEARCH);
|
||||
if (!(superDepartment.getContentBundle().hasInstance(department.
|
||||
getLanguage()))) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.select_superdepartment.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
||||
superDepartment = (SciDepartment) superDepartment.getContentBundle().
|
||||
getInstance(department.getLanguage());
|
||||
if (superDepartment.getID().equals(department.getID())) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.department.select_superdepartment.same_department"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,282 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.bebop.ControlLink;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Link;
|
||||
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.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Sheet for showing the superior department of a {@link SciDepartment}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
*/
|
||||
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;
|
||||
private boolean m_done;
|
||||
|
||||
public SciDepartmentSuperDepartmentSheetModel(Table table,
|
||||
PageState state,
|
||||
SciDepartment department) {
|
||||
m_table = table;
|
||||
m_superDepartment = department.getSuperDepartment();
|
||||
if (m_superDepartment == null) {
|
||||
m_done = false;
|
||||
} else {
|
||||
m_done = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return m_table.getColumnModel().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nextRow() {
|
||||
boolean ret;
|
||||
|
||||
if (m_done) {
|
||||
ret = true;
|
||||
m_done = false;
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
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").
|
||||
localize();
|
||||
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) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
SciDepartment department = (SciDepartment) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
SecurityManager.EDIT_ITEM,
|
||||
department);
|
||||
|
||||
if (canEdit) {
|
||||
SciDepartment subDepartment;
|
||||
try {
|
||||
subDepartment = new SciDepartment((BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
Link link = new Link(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
subDepartment.getLanguage()),
|
||||
resolver.generateItemURL(state,
|
||||
subDepartment,
|
||||
section,
|
||||
subDepartment.
|
||||
getVersion()));
|
||||
|
||||
return link;
|
||||
} else {
|
||||
SciDepartment subDepartment;
|
||||
try {
|
||||
subDepartment = new SciDepartment((BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
Label label = new Label(
|
||||
String.format("%s (%s)",
|
||||
value.toString(),
|
||||
subDepartment.getLanguage()));
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Step for setting the superior department of a {@link SciDepartment}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010 Jens Pelzetter
|
||||
*
|
||||
* 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;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.SegmentedPanel;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
|
||||
/**
|
||||
* Step for editing the basic properties of an {@link SciMember}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciMember
|
||||
* @see GenericPerson
|
||||
*/
|
||||
public class SciMemberPropertiesStep extends SimpleEditStep {
|
||||
|
||||
public static final String EDIT_SHEET_NAME = "edit";
|
||||
private SegmentedPanel segmentedPanel;
|
||||
|
||||
public SciMemberPropertiesStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
super(itemModel, parent);
|
||||
|
||||
segmentedPanel = new SegmentedPanel();
|
||||
setDefaultEditKey(EDIT_SHEET_NAME);
|
||||
|
||||
SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
|
||||
parent,
|
||||
EDIT_SHEET_NAME);
|
||||
|
||||
BasicPageForm editSheet;
|
||||
editSheet = new SciMemberPropertyForm(itemModel, this);
|
||||
basicProperties.add(EDIT_SHEET_NAME,
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.member.edit_basic_properties").localize(),
|
||||
new WorkflowLockedComponentAccess(editSheet,
|
||||
itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
basicProperties.setDisplayComponent(getSciMemberPropertySheet(itemModel));
|
||||
|
||||
segmentedPanel.addSegment(new Label((String) SciOrganizationGlobalizationUtil.
|
||||
globalize("scimember.ui.basic_properties").localize()),
|
||||
basicProperties);
|
||||
|
||||
segmentedPanel.addSegment(new Label((String) SciOrganizationGlobalizationUtil.
|
||||
globalize("scimember.ui.organizations").localize()),
|
||||
new SciMemberSciOrganizationsStep(itemModel,
|
||||
parent));
|
||||
|
||||
segmentedPanel.addSegment(new Label((String) SciOrganizationGlobalizationUtil.
|
||||
globalize("scimember.ui.departments").localize()),
|
||||
new SciMemberSciDepartmentsStep(itemModel,
|
||||
parent));
|
||||
|
||||
segmentedPanel.addSegment(new Label((String) SciOrganizationGlobalizationUtil.
|
||||
globalize("scimember.ui.projects").localize()),
|
||||
new SciMemberSciProjectsStep(itemModel,
|
||||
parent));
|
||||
|
||||
setDisplayComponent(segmentedPanel);
|
||||
}
|
||||
|
||||
public static Component getSciMemberPropertySheet(
|
||||
ItemSelectionModel itemModel) {
|
||||
DomainObjectPropertySheet sheet;
|
||||
|
||||
sheet = (DomainObjectPropertySheet) GenericPersonPropertiesStep.
|
||||
getGenericPersonPropertySheet(itemModel);
|
||||
|
||||
return sheet;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010 Jens Pelzetter
|
||||
*
|
||||
* 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;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.event.FormInitListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
|
||||
/**
|
||||
* Form for editing the basic properties of a {@link SciMember}. This form
|
||||
* extends the form for editing the basic properties of {@link GenericPerson}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciMember
|
||||
* @see GenericPerson
|
||||
* @see GenericPersonPropertyForm
|
||||
*/
|
||||
public class SciMemberPropertyForm
|
||||
extends GenericPersonPropertyForm
|
||||
implements FormInitListener,
|
||||
FormSubmissionListener {
|
||||
|
||||
/*private static final Logger logger =
|
||||
Logger.getLogger(SciMemberPropertyForm.class);
|
||||
private SciMemberPropertiesStep m_step;
|
||||
private CheckboxGroup m_associated;
|
||||
private CheckboxGroup m_former;*/
|
||||
|
||||
public SciMemberPropertyForm(ItemSelectionModel itemModel) {
|
||||
this(itemModel, null);
|
||||
}
|
||||
|
||||
public SciMemberPropertyForm(ItemSelectionModel itemModel,
|
||||
SciMemberPropertiesStep step) {
|
||||
super(itemModel);
|
||||
//m_step = step;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
super.addWidgets();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FormSectionEvent fse) {
|
||||
super.init(fse);
|
||||
|
||||
FormData data = fse.getFormData();
|
||||
SciMember member = (SciMember) super.initBasicWidgets(fse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FormSectionEvent fse) {
|
||||
super.process(fse);
|
||||
|
||||
PageState state = fse.getPageState();
|
||||
SciMember member = (SciMember) super.processBasicWidgets(fse);
|
||||
|
||||
if ((member != null) && getSaveCancelSection().getSaveButton().
|
||||
isSelected(fse.getPageState())) {
|
||||
|
||||
member.save();
|
||||
|
||||
init(fse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,231 +0,0 @@
|
|||
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.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.form.Option;
|
||||
import com.arsdigita.bebop.form.SingleSelect;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.RelationAttribute;
|
||||
import com.arsdigita.cms.RelationAttributeCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
import com.arsdigita.cms.contenttypes.SciMemberSciDepartmentsCollection;
|
||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciMemberSciDepartmentAddForm
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener,
|
||||
FormSubmissionListener {
|
||||
|
||||
private ItemSearchWidget itemSearch;
|
||||
private final String ITEM_SEARCH = "sciMemberDepartment";
|
||||
private SciMemberSciDepartmentsStep step;
|
||||
private Label selectedDepartmentNameLabel;
|
||||
|
||||
public SciMemberSciDepartmentAddForm(ItemSelectionModel itemModel,
|
||||
SciMemberSciDepartmentsStep step) {
|
||||
super("sciMemberDepartmentAddForm", itemModel);
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
add(new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.department.select_department")));
|
||||
itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
||||
findByAssociatedObjectType(SciDepartment.class.getName()));
|
||||
add(itemSearch);
|
||||
|
||||
selectedDepartmentNameLabel = new Label("");
|
||||
add(selectedDepartmentNameLabel);
|
||||
|
||||
add(new Label(ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.person.role")));
|
||||
ParameterModel roleParam =
|
||||
new StringParameter(
|
||||
SciMemberSciDepartmentsCollection.MEMBER_ROLE);
|
||||
SingleSelect roleSelect = new SingleSelect(roleParam);
|
||||
roleSelect.addValidationListener(new NotNullValidationListener());
|
||||
roleSelect.addOption(
|
||||
new Option("",
|
||||
new Label((String) ContenttypesGlobalizationUtil.
|
||||
globalize("cms.ui.select_one").localize())));
|
||||
RelationAttributeCollection roles = new RelationAttributeCollection(
|
||||
"SciDepartmentRole");
|
||||
roles.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
|
||||
getLanguage());
|
||||
while (roles.next()) {
|
||||
RelationAttribute role;
|
||||
role = roles.getRelationAttribute();
|
||||
roleSelect.addOption(new Option(role.getKey(), role.getName()));
|
||||
}
|
||||
add(roleSelect);
|
||||
|
||||
add(new Label(ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.person.status")));
|
||||
ParameterModel statusModel =
|
||||
new StringParameter(
|
||||
SciMemberSciDepartmentsCollection.STATUS);
|
||||
SingleSelect statusSelect = new SingleSelect(statusModel);
|
||||
statusSelect.addValidationListener(new NotNullValidationListener());
|
||||
statusSelect.addOption(new Option("",
|
||||
new Label((String) ContenttypesGlobalizationUtil.
|
||||
globalize("cms.ui.select_one").localize())));
|
||||
RelationAttributeCollection statusColl =
|
||||
new RelationAttributeCollection(
|
||||
"GenericOrganizationalUnitMemberStatus");
|
||||
statusColl.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
|
||||
getLanguage());
|
||||
while (statusColl.next()) {
|
||||
RelationAttribute status;
|
||||
status = statusColl.getRelationAttribute();
|
||||
statusSelect.addOption(new Option(status.getKey(), status.getName()));
|
||||
}
|
||||
add(statusSelect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
|
||||
SciDepartment department;
|
||||
String role;
|
||||
String status;
|
||||
|
||||
department = step.getSelectedDepartment();
|
||||
role = step.getSelectedDepartmentRole();
|
||||
status = step.getSelectedDepartmentStatus();
|
||||
|
||||
if (department == null) {
|
||||
itemSearch.setVisible(state, true);
|
||||
selectedDepartmentNameLabel.setVisible(state, false);
|
||||
} else {
|
||||
data.put(ITEM_SEARCH, department);
|
||||
data.put(SciMemberSciDepartmentsCollection.MEMBER_ROLE, role);
|
||||
data.put(SciMemberSciDepartmentsCollection.STATUS, status);
|
||||
|
||||
itemSearch.setVisible(state, false);
|
||||
selectedDepartmentNameLabel.setVisible(state, true);
|
||||
selectedDepartmentNameLabel.setLabel(department.getTitle(), state);
|
||||
}
|
||||
|
||||
setVisible(state, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FormSectionEvent fse) throws FormProcessException {
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
SciMember member = (SciMember) getItemSelectionModel().getSelectedObject(
|
||||
state);
|
||||
|
||||
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||
SciDepartment department;
|
||||
department = step.getSelectedDepartment();
|
||||
|
||||
if (department == null) {
|
||||
SciDepartment departmentToAdd = (SciDepartment) data.get(
|
||||
ITEM_SEARCH);
|
||||
departmentToAdd = (SciDepartment) departmentToAdd.
|
||||
getContentBundle().getInstance(
|
||||
member.getLanguage());
|
||||
|
||||
member.addDepartment(departmentToAdd,
|
||||
(String) data.get(
|
||||
SciMemberSciDepartmentsCollection.MEMBER_ROLE),
|
||||
(String) data.get(
|
||||
SciMemberSciDepartmentsCollection.STATUS));
|
||||
} else {
|
||||
SciMemberSciDepartmentsCollection departments;
|
||||
|
||||
departments = member.getDepartments();
|
||||
|
||||
while (departments.next()) {
|
||||
if (departments.getDepartment().equals(department)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
departments.setRoleName((String) data.get(
|
||||
SciMemberSciDepartmentsCollection.MEMBER_ROLE));
|
||||
departments.setStatus((String) data.get(
|
||||
SciMemberSciDepartmentsCollection.STATUS));
|
||||
|
||||
step.setSelectedDepartment(null);
|
||||
step.setSelectedDepartmentRole(null);
|
||||
step.setSelectedDepartmentStatus(null);
|
||||
|
||||
departments.close();
|
||||
}
|
||||
|
||||
init(fse);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submitted(FormSectionEvent fse) throws FormProcessException {
|
||||
if (getSaveCancelSection().getCancelButton().isSelected(
|
||||
fse.getPageState())) {
|
||||
step.setSelectedDepartment(null);
|
||||
step.setSelectedDepartmentRole(null);
|
||||
step.setSelectedDepartmentStatus(null);
|
||||
|
||||
init(fse);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.department.select_department.no_department_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
SciMember member = (SciMember) getItemSelectionModel().getSelectedObject(
|
||||
state);
|
||||
SciDepartment department = (SciDepartment) data.get(ITEM_SEARCH);
|
||||
if (!(department.getContentBundle().hasInstance(member.getLanguage()))) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.department.select_department.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
||||
department = (SciDepartment) department.getContentBundle().getInstance(member.
|
||||
getLanguage());
|
||||
SciMemberSciDepartmentsCollection departments = member.getDepartments();
|
||||
departments.addFilter(String.format("id = %s", department.getID().toString()));
|
||||
if (departments.size() > 0) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.department.select_department.already_added"));
|
||||
}
|
||||
|
||||
departments.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
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.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
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciMemberSciDepartmentsStep extends SimpleEditStep {
|
||||
|
||||
private String MEMBER_ADD_DEPARTMENT_SHEET_NAME = "memberAddDepartment";
|
||||
private SciDepartment selectedDepartment;
|
||||
private String selectedDepartmentRole;
|
||||
private String selectedDepartmentStatus;
|
||||
|
||||
public SciMemberSciDepartmentsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public SciMemberSciDepartmentsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent,
|
||||
String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addDepartmentForm = new SciMemberSciDepartmentAddForm(itemModel, this);
|
||||
add(MEMBER_ADD_DEPARTMENT_SHEET_NAME,
|
||||
(String) SciOrganizationGlobalizationUtil.globalize("scimember.ui.department.add").localize(),
|
||||
new WorkflowLockedComponentAccess(addDepartmentForm, itemModel),
|
||||
addDepartmentForm.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDisplayComponent(new SciMemberSciDepartmentsTable(itemModel, this));
|
||||
}
|
||||
|
||||
protected SciDepartment getSelectedDepartment() {
|
||||
return selectedDepartment;
|
||||
}
|
||||
|
||||
protected void setSelectedDepartment(SciDepartment selectedDepartment) {
|
||||
this.selectedDepartment = selectedDepartment;
|
||||
}
|
||||
|
||||
protected String getSelectedDepartmentRole() {
|
||||
return selectedDepartmentRole;
|
||||
}
|
||||
|
||||
protected void setSelectedDepartmentRole(String selectedDepartmentRole) {
|
||||
this.selectedDepartmentRole = selectedDepartmentRole;
|
||||
}
|
||||
|
||||
protected String getSelectedDepartmentStatus() {
|
||||
return selectedDepartmentStatus;
|
||||
}
|
||||
|
||||
protected void setSelectedDepartmentStatus(String selectedDepartmentStatus) {
|
||||
this.selectedDepartmentStatus = selectedDepartmentStatus;
|
||||
}
|
||||
|
||||
protected void showEditComponent(PageState state) {
|
||||
showComponent(state, MEMBER_ADD_DEPARTMENT_SHEET_NAME);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,352 +0,0 @@
|
|||
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.Link;
|
||||
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.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.RelationAttributeCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
import com.arsdigita.cms.contenttypes.SciMemberSciDepartmentsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciMemberSciDepartmentsTable
|
||||
extends Table
|
||||
implements TableActionListener {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
SciMemberSciDepartmentsTable.class);
|
||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||
private final String TABLE_COL_EDIT_LINK = "table_col_edit_link";
|
||||
private final String TABLE_COL_DEL = "table_col_del";
|
||||
private final String TABLE_COL_UP = "table_col_up";
|
||||
private final String TABLE_COL_DOWN = "table_col_down";
|
||||
private ItemSelectionModel itemModel;
|
||||
private SciMemberSciDepartmentsStep step;
|
||||
|
||||
public SciMemberSciDepartmentsTable(ItemSelectionModel itemModel,
|
||||
SciMemberSciDepartmentsStep step) {
|
||||
super();
|
||||
this.itemModel = itemModel;
|
||||
this.step = step;
|
||||
|
||||
setEmptyView(new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.departments.none")));
|
||||
|
||||
TableColumnModel columnModel = getColumnModel();
|
||||
columnModel.add(new TableColumn(
|
||||
0,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.department").localize(),
|
||||
TABLE_COL_EDIT));
|
||||
columnModel.add(new TableColumn(
|
||||
1,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.department.role").localize()));
|
||||
columnModel.add(new TableColumn(
|
||||
2,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.department.status").localize()));
|
||||
columnModel.add(new TableColumn(
|
||||
3,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.department.edit").localize(),
|
||||
TABLE_COL_EDIT_LINK));
|
||||
columnModel.add(new TableColumn(
|
||||
4,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.department.remove").localize(),
|
||||
TABLE_COL_DEL));
|
||||
|
||||
setModelBuilder(
|
||||
new SciMemberSciDepartmentsTableModelBuilder(itemModel));
|
||||
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||
columnModel.get(3).setCellRenderer(new EditLinkCellRenderer());
|
||||
columnModel.get(4).setCellRenderer(new DeleteCellRenderer());
|
||||
|
||||
addTableActionListener(this);
|
||||
}
|
||||
|
||||
private class SciMemberSciDepartmentsTableModelBuilder
|
||||
extends LockableImpl
|
||||
implements TableModelBuilder {
|
||||
|
||||
public SciMemberSciDepartmentsTableModelBuilder(
|
||||
ItemSelectionModel itemModel) {
|
||||
SciMemberSciDepartmentsTable.this.itemModel = itemModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableModel makeModel(Table table, PageState state) {
|
||||
table.getRowSelectionModel().clearSelection(state);
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
return new SciMemberSciDepartmentsTableModel(table,
|
||||
state,
|
||||
member);
|
||||
}
|
||||
}
|
||||
|
||||
private class SciMemberSciDepartmentsTableModel implements TableModel {
|
||||
|
||||
private Table table;
|
||||
private SciMemberSciDepartmentsCollection departments;
|
||||
private SciDepartment department;
|
||||
|
||||
public SciMemberSciDepartmentsTableModel(Table table,
|
||||
PageState state,
|
||||
SciMember member) {
|
||||
this.table = table;
|
||||
this.departments = member.getDepartments();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return table.getColumnModel().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nextRow() {
|
||||
boolean ret;
|
||||
|
||||
if ((departments != null) && departments.next()) {
|
||||
department = departments.getDepartment();
|
||||
ret = true;
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return department.getTitle();
|
||||
case 1:
|
||||
RelationAttributeCollection role =
|
||||
new RelationAttributeCollection(
|
||||
"SciDepartmentRole",
|
||||
departments.getRoleName());
|
||||
if (role.next()) {
|
||||
String roleName = role.getName();
|
||||
role.close();
|
||||
return roleName;
|
||||
} else {
|
||||
return ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.ui.unknownRole").localize();
|
||||
}
|
||||
case 2:
|
||||
RelationAttributeCollection status =
|
||||
new RelationAttributeCollection(
|
||||
"GenericOrganizationalUnitMemberStatus",
|
||||
departments.getStatus());
|
||||
if (status.next()) {
|
||||
String statusName = status.getName();
|
||||
status.close();
|
||||
return statusName;
|
||||
} else {
|
||||
return ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.ui.unknownStatus").localize();
|
||||
}
|
||||
case 3:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.departments.edit_assoc").localize();
|
||||
case 4:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.departments.remove").localize();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getKeyAt(int columnIndex) {
|
||||
return department.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) {
|
||||
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||
getSecurityManager(state);
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||
member);
|
||||
|
||||
if (canEdit) {
|
||||
SciDepartment department;
|
||||
try {
|
||||
department = new SciDepartment((BigDecimal) key);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
logger.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
Link link = new Link(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
department.getLanguage()),
|
||||
resolver.generateItemURL(state,
|
||||
department,
|
||||
section,
|
||||
department.
|
||||
getVersion()));
|
||||
return link;
|
||||
} else {
|
||||
SciDepartment department;
|
||||
try {
|
||||
department = new SciDepartment((BigDecimal) key);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
logger.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
Label label = new Label(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
department.getLanguage()));
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class EditLinkCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
public Component getComponent(Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int column) {
|
||||
com.arsdigita.cms.SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||
member);
|
||||
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
return link;
|
||||
} else {
|
||||
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) {
|
||||
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||
getSecurityManager(state);
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||
member);
|
||||
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
link.setConfirmation((String) SciOrganizationGlobalizationUtil.
|
||||
globalize(
|
||||
"scimember.ui.department."
|
||||
+ "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 = new SciDepartment(new BigDecimal(event.
|
||||
getRowKey().toString()));
|
||||
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
|
||||
SciMemberSciDepartmentsCollection departments = member.getDepartments();
|
||||
|
||||
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||
|
||||
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||
} else if (TABLE_COL_EDIT_LINK.equals(
|
||||
column.getHeaderKey().toString())) {
|
||||
while (departments.next()) {
|
||||
if (departments.getDepartment().equals(department)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
step.setSelectedDepartment(departments.getDepartment());
|
||||
step.setSelectedDepartmentRole(departments.getRoleName());
|
||||
step.setSelectedDepartmentStatus(departments.getStatus());
|
||||
|
||||
departments.close();
|
||||
|
||||
step.showEditComponent(state);
|
||||
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||
member.removeDepartment(department);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void headSelected(TableActionEvent event) {
|
||||
//Nothing to do
|
||||
}
|
||||
}
|
||||
|
|
@ -1,234 +0,0 @@
|
|||
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.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.form.Option;
|
||||
import com.arsdigita.bebop.form.SingleSelect;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.RelationAttribute;
|
||||
import com.arsdigita.cms.RelationAttributeCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
import com.arsdigita.cms.contenttypes.SciMemberSciOrganizationsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganization;
|
||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciMemberSciOrganizationAddForm
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener,
|
||||
FormSubmissionListener {
|
||||
|
||||
private ItemSearchWidget itemSearch;
|
||||
private final String ITEM_SEARCH = "sciMemberOrganization";
|
||||
private SciMemberSciOrganizationsStep step;
|
||||
private Label selectedOrganizationNameLabel;
|
||||
|
||||
public SciMemberSciOrganizationAddForm(ItemSelectionModel itemModel,
|
||||
SciMemberSciOrganizationsStep step) {
|
||||
super("sciMemberOrganizationAddForm", itemModel);
|
||||
this.step = step;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
add(new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.organization.select_organization")));
|
||||
itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
||||
findByAssociatedObjectType(SciOrganization.class.getName()));
|
||||
add(itemSearch);
|
||||
|
||||
selectedOrganizationNameLabel = new Label("");
|
||||
add(selectedOrganizationNameLabel);
|
||||
|
||||
add(new Label(ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.person.role")));
|
||||
ParameterModel roleParam =
|
||||
new StringParameter(
|
||||
SciMemberSciOrganizationsCollection.MEMBER_ROLE);
|
||||
SingleSelect roleSelect = new SingleSelect(roleParam);
|
||||
roleSelect.addValidationListener(new NotNullValidationListener());
|
||||
roleSelect.addOption(
|
||||
new Option("",
|
||||
new Label((String) ContenttypesGlobalizationUtil.
|
||||
globalize("cms.ui.select_one").localize())));
|
||||
RelationAttributeCollection roles = new RelationAttributeCollection(
|
||||
"SciOrganizationRole");
|
||||
roles.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
|
||||
getLanguage());
|
||||
while (roles.next()) {
|
||||
RelationAttribute role;
|
||||
role = roles.getRelationAttribute();
|
||||
roleSelect.addOption(new Option(role.getKey(), role.getName()));
|
||||
}
|
||||
add(roleSelect);
|
||||
|
||||
add(new Label(ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.person.status")));
|
||||
ParameterModel statusModel =
|
||||
new StringParameter(
|
||||
SciMemberSciOrganizationsCollection.STATUS);
|
||||
SingleSelect statusSelect = new SingleSelect(statusModel);
|
||||
statusSelect.addValidationListener(new NotNullValidationListener());
|
||||
statusSelect.addOption(new Option("",
|
||||
new Label((String) ContenttypesGlobalizationUtil.
|
||||
globalize("cms.ui.select_one").localize())));
|
||||
RelationAttributeCollection statusColl =
|
||||
new RelationAttributeCollection(
|
||||
"GenericOrganizationalUnitMemberStatus");
|
||||
statusColl.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
|
||||
getLanguage());
|
||||
while (statusColl.next()) {
|
||||
RelationAttribute status;
|
||||
status = statusColl.getRelationAttribute();
|
||||
statusSelect.addOption(new Option(status.getKey(), status.getName()));
|
||||
}
|
||||
add(statusSelect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
|
||||
SciOrganization orga;
|
||||
String role;
|
||||
String status;
|
||||
|
||||
orga = step.getSelectedOrganization();
|
||||
role = step.getSelectedOrganizationRole();
|
||||
status = step.getSelectedOrganizationStatus();
|
||||
|
||||
if (orga == null) {
|
||||
itemSearch.setVisible(state, true);
|
||||
selectedOrganizationNameLabel.setVisible(state, false);
|
||||
} else {
|
||||
data.put(ITEM_SEARCH, orga);
|
||||
data.put(SciMemberSciOrganizationsCollection.MEMBER_ROLE, role);
|
||||
data.put(SciMemberSciOrganizationsCollection.STATUS, status);
|
||||
|
||||
itemSearch.setVisible(state, false);
|
||||
selectedOrganizationNameLabel.setVisible(state, true);
|
||||
selectedOrganizationNameLabel.setLabel(orga.getTitle(), state);
|
||||
}
|
||||
|
||||
setVisible(state, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FormSectionEvent fse) throws FormProcessException {
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
SciMember member = (SciMember) getItemSelectionModel().getSelectedObject(
|
||||
state);
|
||||
|
||||
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||
|
||||
SciOrganization orga;
|
||||
orga = step.getSelectedOrganization();
|
||||
|
||||
if (orga == null) {
|
||||
SciOrganization orgaToAdd = (SciOrganization) data.get(
|
||||
ITEM_SEARCH);
|
||||
orgaToAdd = (SciOrganization) orgaToAdd.getContentBundle().
|
||||
getInstance(member.getLanguage());
|
||||
|
||||
member.addOrganization(orga,
|
||||
(String) data.get(
|
||||
SciMemberSciOrganizationsCollection.MEMBER_ROLE),
|
||||
(String) data.get(
|
||||
SciMemberSciOrganizationsCollection.STATUS));
|
||||
} else {
|
||||
SciMemberSciOrganizationsCollection orgas;
|
||||
|
||||
orgas = member.getOrganizations();
|
||||
|
||||
while (orgas.next()) {
|
||||
if (orgas.getOrganization().equals(orga)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
orgas.setRoleName((String) data.get(
|
||||
SciMemberSciOrganizationsCollection.MEMBER_ROLE));
|
||||
orgas.setStatus((String) data.get(
|
||||
SciMemberSciOrganizationsCollection.STATUS));
|
||||
|
||||
step.setSelectedOrganization(null);
|
||||
step.setSelectedOrganizationRole(null);
|
||||
step.setSelectedOrganizationStatus(null);
|
||||
|
||||
orgas.close();
|
||||
}
|
||||
|
||||
init(fse);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submitted(FormSectionEvent fse) throws FormProcessException {
|
||||
if (getSaveCancelSection().getCancelButton().isSelected(
|
||||
fse.getPageState())) {
|
||||
step.setSelectedOrganization(null);
|
||||
step.setSelectedOrganizationRole(null);
|
||||
step.setSelectedOrganizationStatus(null);
|
||||
|
||||
init(fse);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.organization.select_organization.no_orga_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
SciMember member = (SciMember) getItemSelectionModel().getSelectedObject(
|
||||
state);
|
||||
SciOrganization orga = (SciOrganization) data.get(
|
||||
ITEM_SEARCH);
|
||||
if (!(orga.getContentBundle().hasInstance(member.getLanguage()))) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.organization.select_organization.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
||||
orga = (SciOrganization) orga.getContentBundle().getInstance(member.
|
||||
getLanguage());
|
||||
SciMemberSciOrganizationsCollection organizations = member.
|
||||
getOrganizations();
|
||||
organizations.addFilter(String.format("id = %s",
|
||||
orga.getID().toString()));
|
||||
if (organizations.size() > 0) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.organization.select_organization.already_added"));
|
||||
}
|
||||
|
||||
organizations.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
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.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 SciMemberSciOrganizationsStep extends SimpleEditStep {
|
||||
|
||||
private String MEMBER_ADD_ORGANIZATION_SHEET_NAME = "memberAddOrganization";
|
||||
private SciOrganization selectedOrganization;
|
||||
private String selectedOrganizationRole;
|
||||
private String selectedOrganizationStatus;
|
||||
|
||||
public SciMemberSciOrganizationsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public SciMemberSciOrganizationsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent,
|
||||
String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addOrganizationForm = new SciMemberSciOrganizationAddForm(
|
||||
itemModel,
|
||||
this);
|
||||
add(MEMBER_ADD_ORGANIZATION_SHEET_NAME,
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.organization.add").localize(),
|
||||
new WorkflowLockedComponentAccess(addOrganizationForm, itemModel),
|
||||
addOrganizationForm.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDisplayComponent(new SciMemberSciOrganizationsTable(itemModel, this));
|
||||
}
|
||||
|
||||
protected SciOrganization getSelectedOrganization() {
|
||||
return selectedOrganization;
|
||||
}
|
||||
|
||||
protected void setSelectedOrganization(SciOrganization organization) {
|
||||
this.selectedOrganization = organization;
|
||||
}
|
||||
|
||||
protected String getSelectedOrganizationRole() {
|
||||
return selectedOrganizationRole;
|
||||
}
|
||||
|
||||
protected void setSelectedOrganizationRole(String role) {
|
||||
this.selectedOrganizationRole = role;
|
||||
}
|
||||
|
||||
protected String getSelectedOrganizationStatus() {
|
||||
return selectedOrganizationStatus;
|
||||
}
|
||||
|
||||
protected void setSelectedOrganizationStatus(String status) {
|
||||
this.selectedOrganizationStatus = status;
|
||||
}
|
||||
|
||||
protected void showEditComponent(PageState state) {
|
||||
showComponent(state, MEMBER_ADD_ORGANIZATION_SHEET_NAME);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,354 +0,0 @@
|
|||
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.Link;
|
||||
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.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.RelationAttributeCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
import com.arsdigita.cms.contenttypes.SciMemberSciOrganizationsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganization;
|
||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciMemberSciOrganizationsTable
|
||||
extends Table
|
||||
implements TableActionListener {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
SciMemberSciOrganizationsTable.class);
|
||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||
private final String TABLE_COL_EDIT_LINK = "table_col_edit_link";
|
||||
private final String TABLE_COL_DEL = "table_col_del";
|
||||
private final String TABLE_COL_UP = "table_col_up";
|
||||
private final String TABLE_COL_DOWN = "table_col_down";
|
||||
private ItemSelectionModel itemModel;
|
||||
private SciMemberSciOrganizationsStep step;
|
||||
|
||||
public SciMemberSciOrganizationsTable(ItemSelectionModel itemModel,
|
||||
SciMemberSciOrganizationsStep step) {
|
||||
super();
|
||||
this.itemModel = itemModel;
|
||||
this.step = step;
|
||||
|
||||
setEmptyView(new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.organizations.none")));
|
||||
|
||||
TableColumnModel columnModel = getColumnModel();
|
||||
columnModel.add(new TableColumn(
|
||||
0,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.organization").localize(),
|
||||
TABLE_COL_EDIT));
|
||||
columnModel.add(new TableColumn(
|
||||
1,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.organization.role").localize()));
|
||||
columnModel.add(new TableColumn(
|
||||
2,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.organization.status").localize()));
|
||||
columnModel.add(new TableColumn(
|
||||
3,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.organization.edit").localize(),
|
||||
TABLE_COL_EDIT_LINK));
|
||||
columnModel.add(new TableColumn(
|
||||
4,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.organization.remove").localize(),
|
||||
TABLE_COL_DEL));
|
||||
|
||||
setModelBuilder(
|
||||
new SciMemberSciOrganizationsTableModelBuilder(itemModel));
|
||||
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||
columnModel.get(3).setCellRenderer(new EditLinkCellRenderer());
|
||||
columnModel.get(4).setCellRenderer(new DeleteCellRenderer());
|
||||
|
||||
addTableActionListener(this);
|
||||
}
|
||||
|
||||
private class SciMemberSciOrganizationsTableModelBuilder
|
||||
extends LockableImpl
|
||||
implements TableModelBuilder {
|
||||
|
||||
public SciMemberSciOrganizationsTableModelBuilder(
|
||||
ItemSelectionModel itemModel) {
|
||||
SciMemberSciOrganizationsTable.this.itemModel = itemModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableModel makeModel(Table table, PageState state) {
|
||||
table.getRowSelectionModel().clearSelection(state);
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
return new SciMemberSciOrganizationsTableModel(table,
|
||||
state,
|
||||
member);
|
||||
}
|
||||
}
|
||||
|
||||
private class SciMemberSciOrganizationsTableModel implements TableModel {
|
||||
|
||||
private Table table;
|
||||
private SciMemberSciOrganizationsCollection organizations;
|
||||
private SciOrganization organization;
|
||||
|
||||
public SciMemberSciOrganizationsTableModel(Table table,
|
||||
PageState state,
|
||||
SciMember member) {
|
||||
this.table = table;
|
||||
this.organizations = member.getOrganizations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return table.getColumnModel().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nextRow() {
|
||||
boolean ret;
|
||||
|
||||
if ((organizations != null) && organizations.next()) {
|
||||
organization = organizations.getOrganization();
|
||||
ret = true;
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return organization.getTitle();
|
||||
case 1:
|
||||
RelationAttributeCollection role =
|
||||
new RelationAttributeCollection(
|
||||
"SciOrganizationRole",
|
||||
organizations.getRoleName());
|
||||
if (role.next()) {
|
||||
String roleName = role.getName();
|
||||
role.close();
|
||||
return roleName;
|
||||
} else {
|
||||
return ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.ui.unknownRole").localize();
|
||||
}
|
||||
case 2:
|
||||
RelationAttributeCollection status =
|
||||
new RelationAttributeCollection(
|
||||
"GenericOrganizationalUnitMemberStatus",
|
||||
organizations.getStatus());
|
||||
if (status.next()) {
|
||||
String statusName = status.getName();
|
||||
status.close();
|
||||
return statusName;
|
||||
} else {
|
||||
return ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.ui.unknownStatus").localize();
|
||||
}
|
||||
case 3:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.organizations.edit_assoc").localize();
|
||||
case 4:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.organizations.remove").localize();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getKeyAt(int columnIndex) {
|
||||
return organization.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) {
|
||||
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||
getSecurityManager(state);
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||
member);
|
||||
|
||||
if (canEdit) {
|
||||
SciOrganization organization;
|
||||
try {
|
||||
organization = new SciOrganization((BigDecimal) key);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
logger.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
Link link = new Link(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
organization.getLanguage()),
|
||||
resolver.generateItemURL(state,
|
||||
organization,
|
||||
section,
|
||||
organization.
|
||||
getVersion()));
|
||||
return link;
|
||||
} else {
|
||||
SciOrganization organization;
|
||||
try {
|
||||
organization = new SciOrganization((BigDecimal) key);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
logger.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
Label label = new Label(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
organization.getLanguage()));
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class EditLinkCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
public Component getComponent(Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int column) {
|
||||
com.arsdigita.cms.SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||
member);
|
||||
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
return link;
|
||||
} else {
|
||||
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) {
|
||||
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||
getSecurityManager(state);
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||
member);
|
||||
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
link.setConfirmation((String) SciOrganizationGlobalizationUtil.
|
||||
globalize(
|
||||
"scimember.ui.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();
|
||||
|
||||
SciOrganization organization = new SciOrganization(new BigDecimal(event.
|
||||
getRowKey().toString()));
|
||||
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
|
||||
SciMemberSciOrganizationsCollection organizations = member.
|
||||
getOrganizations();
|
||||
|
||||
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||
|
||||
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||
} else if (TABLE_COL_EDIT_LINK.equals(
|
||||
column.getHeaderKey().toString())) {
|
||||
while (organizations.next()) {
|
||||
if (organizations.getOrganization().equals(organization)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
step.setSelectedOrganization(organizations.getOrganization());
|
||||
step.setSelectedOrganizationRole(organizations.getRoleName());
|
||||
step.setSelectedOrganizationStatus(organizations.getStatus());
|
||||
|
||||
organizations.close();
|
||||
|
||||
step.showEditComponent(state);
|
||||
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||
member.removeOrganization(organization);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void headSelected(TableActionEvent event) {
|
||||
//Nothing to do
|
||||
}
|
||||
}
|
||||
|
|
@ -1,225 +0,0 @@
|
|||
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.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.form.Option;
|
||||
import com.arsdigita.bebop.form.SingleSelect;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.RelationAttribute;
|
||||
import com.arsdigita.cms.RelationAttributeCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
import com.arsdigita.cms.contenttypes.SciMemberSciProjectsCollection;
|
||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciMemberSciProjectAddForm
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener,
|
||||
FormSubmissionListener {
|
||||
|
||||
private ItemSearchWidget itemSearch;
|
||||
private final String ITEM_SEARCH = "sciMemberProject";
|
||||
private SciMemberSciProjectsStep step;
|
||||
private Label selectedProjectNameLabel;
|
||||
|
||||
public SciMemberSciProjectAddForm(ItemSelectionModel itemModel,
|
||||
SciMemberSciProjectsStep step) {
|
||||
super("sciMemberProjectAddForm", itemModel);
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
add(new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.project.select_project")));
|
||||
itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
||||
findByAssociatedObjectType(SciProject.class.getName()));
|
||||
add(itemSearch);
|
||||
|
||||
selectedProjectNameLabel = new Label("");
|
||||
add(selectedProjectNameLabel);
|
||||
|
||||
add(new Label(ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.person.role")));
|
||||
ParameterModel roleParam =
|
||||
new StringParameter(
|
||||
SciMemberSciProjectsCollection.MEMBER_ROLE);
|
||||
SingleSelect roleSelect = new SingleSelect(roleParam);
|
||||
roleSelect.addValidationListener(new NotNullValidationListener());
|
||||
roleSelect.addOption(
|
||||
new Option("",
|
||||
new Label((String) ContenttypesGlobalizationUtil.
|
||||
globalize("cms.ui.select_one").localize())));
|
||||
RelationAttributeCollection roles = new RelationAttributeCollection(
|
||||
"SciProjectRole");
|
||||
roles.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
|
||||
getLanguage());
|
||||
while (roles.next()) {
|
||||
RelationAttribute role;
|
||||
role = roles.getRelationAttribute();
|
||||
roleSelect.addOption(new Option(role.getKey(), role.getName()));
|
||||
}
|
||||
add(roleSelect);
|
||||
|
||||
add(new Label(ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.genericorgaunit.person.status")));
|
||||
ParameterModel statusModel =
|
||||
new StringParameter(
|
||||
SciMemberSciProjectsCollection.STATUS);
|
||||
SingleSelect statusSelect = new SingleSelect(statusModel);
|
||||
statusSelect.addValidationListener(new NotNullValidationListener());
|
||||
statusSelect.addOption(new Option("",
|
||||
new Label((String) ContenttypesGlobalizationUtil.
|
||||
globalize("cms.ui.select_one").localize())));
|
||||
RelationAttributeCollection statusColl =
|
||||
new RelationAttributeCollection(
|
||||
"GenericOrganizationalUnitMemberStatus");
|
||||
statusColl.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
|
||||
getLanguage());
|
||||
while (statusColl.next()) {
|
||||
RelationAttribute status;
|
||||
status = statusColl.getRelationAttribute();
|
||||
statusSelect.addOption(new Option(status.getKey(), status.getName()));
|
||||
}
|
||||
add(statusSelect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
|
||||
SciProject project;
|
||||
String role;
|
||||
String status;
|
||||
|
||||
project = step.getSelectedProject();
|
||||
role = step.getSelectedProjectRole();
|
||||
status = step.getSelectedProjectStatus();
|
||||
|
||||
if (project == null) {
|
||||
itemSearch.setVisible(state, true);
|
||||
selectedProjectNameLabel.setVisible(state, false);
|
||||
} else {
|
||||
data.put(ITEM_SEARCH, project);
|
||||
data.put(SciMemberSciProjectsCollection.MEMBER_ROLE, role);
|
||||
data.put(SciMemberSciProjectsCollection.STATUS, status);
|
||||
|
||||
itemSearch.setVisible(state, false);
|
||||
selectedProjectNameLabel.setVisible(state, true);
|
||||
selectedProjectNameLabel.setLabel(project.getTitle(), state);
|
||||
}
|
||||
|
||||
setVisible(state, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FormSectionEvent fse) throws FormProcessException {
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
SciMember member = (SciMember) getItemSelectionModel().getSelectedObject(
|
||||
state);
|
||||
|
||||
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||
SciProject project;
|
||||
project = step.getSelectedProject();
|
||||
|
||||
if (project == null) {
|
||||
SciProject projectToAdd = (SciProject) data.get(ITEM_SEARCH);
|
||||
projectToAdd = (SciProject) projectToAdd.getContentBundle().
|
||||
getInstance(member.getLanguage());
|
||||
|
||||
member.addProject(projectToAdd,
|
||||
(String) data.get(
|
||||
SciMemberSciProjectsCollection.MEMBER_ROLE),
|
||||
(String) data.get(
|
||||
SciMemberSciProjectsCollection.STATUS));
|
||||
} else {
|
||||
SciMemberSciProjectsCollection projects;
|
||||
|
||||
projects = member.getProjects();
|
||||
|
||||
while (projects.next()) {
|
||||
if (projects.getProject().equals(project)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
projects.setRoleName((String) data.get(
|
||||
SciMemberSciProjectsCollection.MEMBER_ROLE));
|
||||
projects.setStatus((String) data.get(
|
||||
SciMemberSciProjectsCollection.STATUS));
|
||||
|
||||
step.setSelectedProject(null);
|
||||
step.setSelectedProjectRole(null);
|
||||
step.setSelectedProjectStatus(null);
|
||||
|
||||
projects.close();
|
||||
}
|
||||
|
||||
init(fse);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submitted(FormSectionEvent fse) throws FormProcessException {
|
||||
if (getSaveCancelSection().getCancelButton().isSelected(
|
||||
fse.getPageState())) {
|
||||
step.setSelectedProject(null);
|
||||
step.setSelectedProjectRole(null);
|
||||
step.setSelectedProjectStatus(null);
|
||||
|
||||
init(fse);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.project.select_project.no_project_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
SciMember member = (SciMember) getItemSelectionModel().getSelectedObject(
|
||||
state);
|
||||
SciProject project = (SciProject) data.get(ITEM_SEARCH);
|
||||
if (!(project.getContentBundle().hasInstance(member.getLanguage()))) {
|
||||
data.addError(SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.project.select_project.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
||||
project = (SciProject) project.getContentBundle().getInstance(member.getLanguage());
|
||||
SciMemberSciProjectsCollection projects = member.getProjects();
|
||||
projects.addFilter(String.format("id = %s", project.getID().toString()));
|
||||
if (projects.size() > 0) {
|
||||
data.addError(SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.project.select_project.already_added"));
|
||||
}
|
||||
|
||||
projects.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
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
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciMemberSciProjectsStep extends SimpleEditStep {
|
||||
|
||||
private String MEMBER_ADD_project_SHEET_NAME = "memberAddproject";
|
||||
private SciProject selectedProject;
|
||||
private String selectedProjectRole;
|
||||
private String selectedProjectStatus;
|
||||
|
||||
public SciMemberSciProjectsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public SciMemberSciProjectsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent,
|
||||
String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addprojectForm = new SciMemberSciProjectAddForm(itemModel, this);
|
||||
add(MEMBER_ADD_project_SHEET_NAME,
|
||||
(String) SciOrganizationGlobalizationUtil.globalize("scimember.ui.project.add").localize(),
|
||||
new WorkflowLockedComponentAccess(addprojectForm, itemModel),
|
||||
addprojectForm.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDisplayComponent(new SciMemberSciProjectsTable(itemModel, this));
|
||||
}
|
||||
|
||||
protected SciProject getSelectedProject() {
|
||||
return selectedProject;
|
||||
}
|
||||
|
||||
protected void setSelectedProject(SciProject selectedProject) {
|
||||
this.selectedProject = selectedProject;
|
||||
}
|
||||
|
||||
protected String getSelectedProjectRole() {
|
||||
return selectedProjectRole;
|
||||
}
|
||||
|
||||
protected void setSelectedProjectRole(String selectedProjectRole) {
|
||||
this.selectedProjectRole = selectedProjectRole;
|
||||
}
|
||||
|
||||
protected String getSelectedProjectStatus() {
|
||||
return selectedProjectStatus;
|
||||
}
|
||||
|
||||
protected void setSelectedProjectStatus(String selectedProjectStatus) {
|
||||
this.selectedProjectStatus = selectedProjectStatus;
|
||||
}
|
||||
|
||||
protected void showEditComponent(PageState state) {
|
||||
showComponent(state, MEMBER_ADD_project_SHEET_NAME);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,352 +0,0 @@
|
|||
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.Link;
|
||||
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.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.RelationAttributeCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
import com.arsdigita.cms.contenttypes.SciMemberSciProjectsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciMemberSciProjectsTable
|
||||
extends Table
|
||||
implements TableActionListener {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(
|
||||
SciMemberSciProjectsTable.class);
|
||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||
private final String TABLE_COL_EDIT_LINK = "table_col_edit_link";
|
||||
private final String TABLE_COL_DEL = "table_col_del";
|
||||
private final String TABLE_COL_UP = "table_col_up";
|
||||
private final String TABLE_COL_DOWN = "table_col_down";
|
||||
private ItemSelectionModel itemModel;
|
||||
private SciMemberSciProjectsStep step;
|
||||
|
||||
public SciMemberSciProjectsTable(ItemSelectionModel itemModel,
|
||||
SciMemberSciProjectsStep step) {
|
||||
super();
|
||||
this.itemModel = itemModel;
|
||||
this.step = step;
|
||||
|
||||
setEmptyView(new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.projects.none")));
|
||||
|
||||
TableColumnModel columnModel = getColumnModel();
|
||||
columnModel.add(new TableColumn(
|
||||
0,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.project").localize(),
|
||||
TABLE_COL_EDIT));
|
||||
columnModel.add(new TableColumn(
|
||||
1,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.project.role").localize()));
|
||||
columnModel.add(new TableColumn(
|
||||
2,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.project.status").localize()));
|
||||
columnModel.add(new TableColumn(
|
||||
3,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.project.edit").localize(),
|
||||
TABLE_COL_EDIT_LINK));
|
||||
columnModel.add(new TableColumn(
|
||||
4,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.project.remove").localize(),
|
||||
TABLE_COL_DEL));
|
||||
|
||||
setModelBuilder(
|
||||
new SciMemberSciProjectsTableModelBuilder(itemModel));
|
||||
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||
columnModel.get(3).setCellRenderer(new EditLinkCellRenderer());
|
||||
columnModel.get(4).setCellRenderer(new DeleteCellRenderer());
|
||||
|
||||
addTableActionListener(this);
|
||||
}
|
||||
|
||||
private class SciMemberSciProjectsTableModelBuilder
|
||||
extends LockableImpl
|
||||
implements TableModelBuilder {
|
||||
|
||||
public SciMemberSciProjectsTableModelBuilder(
|
||||
ItemSelectionModel itemModel) {
|
||||
SciMemberSciProjectsTable.this.itemModel = itemModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableModel makeModel(Table table, PageState state) {
|
||||
table.getRowSelectionModel().clearSelection(state);
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
return new SciMemberSciProjectsTableModel(table,
|
||||
state,
|
||||
member);
|
||||
}
|
||||
}
|
||||
|
||||
private class SciMemberSciProjectsTableModel implements TableModel {
|
||||
|
||||
private Table table;
|
||||
private SciMemberSciProjectsCollection projects;
|
||||
private SciProject project;
|
||||
|
||||
public SciMemberSciProjectsTableModel(Table table,
|
||||
PageState state,
|
||||
SciMember member) {
|
||||
this.table = table;
|
||||
this.projects = member.getProjects();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return table.getColumnModel().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nextRow() {
|
||||
boolean ret;
|
||||
|
||||
if ((projects != null) && projects.next()) {
|
||||
project = projects.getProject();
|
||||
ret = true;
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return project.getTitle();
|
||||
case 1:
|
||||
RelationAttributeCollection role =
|
||||
new RelationAttributeCollection(
|
||||
"SciProjectRole",
|
||||
projects.getRoleName());
|
||||
if (role.next()) {
|
||||
String roleName = role.getName();
|
||||
role.close();
|
||||
return roleName;
|
||||
} else {
|
||||
return ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.ui.unknownRole").localize();
|
||||
}
|
||||
case 2:
|
||||
RelationAttributeCollection status =
|
||||
new RelationAttributeCollection(
|
||||
"GenericOrganizationalUnitMemberStatus",
|
||||
projects.getStatus());
|
||||
if (status.next()) {
|
||||
String statusName = status.getName();
|
||||
status.close();
|
||||
return statusName;
|
||||
} else {
|
||||
return ContenttypesGlobalizationUtil.globalize(
|
||||
"cms.ui.unknownStatus").localize();
|
||||
}
|
||||
case 3:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.projects.edit_assoc").localize();
|
||||
case 4:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"scimember.ui.projects.remove").localize();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getKeyAt(int columnIndex) {
|
||||
return project.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) {
|
||||
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||
getSecurityManager(state);
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||
member);
|
||||
|
||||
if (canEdit) {
|
||||
SciProject project;
|
||||
try {
|
||||
project = new SciProject((BigDecimal) key);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
logger.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
Link link = new Link(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
project.getLanguage()),
|
||||
resolver.generateItemURL(state,
|
||||
project,
|
||||
section, project.
|
||||
getVersion()));
|
||||
return link;
|
||||
} else {
|
||||
SciProject project;
|
||||
try {
|
||||
project = new SciProject((BigDecimal) key);
|
||||
} catch (DataObjectNotFoundException ex) {
|
||||
logger.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
Label label = new Label(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
project.getLanguage()));
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class EditLinkCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
public Component getComponent(Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int column) {
|
||||
com.arsdigita.cms.SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||
member);
|
||||
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
return link;
|
||||
} else {
|
||||
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) {
|
||||
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||
getSecurityManager(state);
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||
member);
|
||||
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
link.setConfirmation((String) SciOrganizationGlobalizationUtil.
|
||||
globalize(
|
||||
"scimember.ui.project."
|
||||
+ "confirm_remove").
|
||||
localize());
|
||||
return link;
|
||||
} else {
|
||||
Label label = new Label(value.toString());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cellSelected(TableActionEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
|
||||
SciProject project = new SciProject(new BigDecimal(event.getRowKey().
|
||||
toString()));
|
||||
|
||||
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||
|
||||
SciMemberSciProjectsCollection projects = member.getProjects();
|
||||
|
||||
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||
|
||||
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||
} else if (TABLE_COL_EDIT_LINK.equals(
|
||||
column.getHeaderKey().toString())) {
|
||||
while (projects.next()) {
|
||||
if (projects.getProject().equals(project)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
step.setSelectedProject(projects.getProject());
|
||||
step.setSelectedProjectRole(projects.getRoleName());
|
||||
step.setSelectedProjectStatus(projects.getStatus());
|
||||
|
||||
projects.close();
|
||||
|
||||
step.showEditComponent(state);
|
||||
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||
member.removeProject(project);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void headSelected(TableActionEvent event) {
|
||||
//Nothing to do
|
||||
}
|
||||
}
|
||||
|
|
@ -1,796 +0,0 @@
|
|||
/*
|
||||
* 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.PageState;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.xml.Element;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Base class for all panels of the sci-types-organization module. The panels
|
||||
* are displaying the information of an organization type (
|
||||
* <code>SciOrganization</code>, <code>SciDepartment</code>,
|
||||
* <code>SciProject</code>) similar to the <code>MultiPartArticle</code>. For
|
||||
* each information, e.g. members, there is a link, which replaces the
|
||||
* information shown. To use this as an index item, a special template is
|
||||
* necessary. An example of such a template can be found in the ccm-zes-aplaws
|
||||
* module.
|
||||
*
|
||||
* @see SciOrganizationPanel
|
||||
* @see SciDepartmentPanel
|
||||
* @see SciProjectPanel
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public abstract class SciOrganizationBasePanel
|
||||
extends GenericOrganizationalUnitPanel {
|
||||
|
||||
private final static Logger s_log = Logger.getLogger(
|
||||
SciOrganizationBasePanel.class);
|
||||
|
||||
protected class MemberListItem {
|
||||
|
||||
private OID oid;
|
||||
private String surname;
|
||||
private String givenName;
|
||||
private String titlePre;
|
||||
private String titlePost;
|
||||
private Date birthdate;
|
||||
private String gender;
|
||||
private DataCollection contacts;
|
||||
//private GenericPerson member;
|
||||
private String role;
|
||||
private String status;
|
||||
|
||||
public MemberListItem(final GenericPerson member,
|
||||
final String role,
|
||||
final String status) {
|
||||
/*this.member = member;
|
||||
this.role = role;
|
||||
this.status = status;*/
|
||||
this(member.getOID(),
|
||||
member.getSurname(),
|
||||
member.getGivenName(),
|
||||
member.getTitlePre(),
|
||||
member.getTitlePost(),
|
||||
member.getBirthdate(),
|
||||
member.getGender(),
|
||||
null,
|
||||
role,
|
||||
status);
|
||||
|
||||
}
|
||||
|
||||
public MemberListItem(final OID oid,
|
||||
final String surname,
|
||||
final String givenName,
|
||||
final String titlePre,
|
||||
final String titlePost,
|
||||
final Date birthdate,
|
||||
final String gender,
|
||||
final DataCollection contacts,
|
||||
final String role,
|
||||
final String status) {
|
||||
this.oid = oid;
|
||||
this.surname = surname;
|
||||
this.givenName = givenName;
|
||||
this.titlePre = titlePre;
|
||||
this.titlePost = titlePost;
|
||||
this.birthdate = birthdate;
|
||||
this.gender = gender;
|
||||
this.contacts = contacts;
|
||||
this.role = role;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/*public GenericPerson getMember() {
|
||||
return member;
|
||||
}*/
|
||||
public OID getOID() {
|
||||
return oid;
|
||||
}
|
||||
|
||||
public Date getBirthdate() {
|
||||
return birthdate;
|
||||
}
|
||||
|
||||
public DataCollection getContacts() {
|
||||
return contacts;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
|
||||
public String getGivenName() {
|
||||
return givenName;
|
||||
}
|
||||
|
||||
public String getSurname() {
|
||||
return surname;
|
||||
}
|
||||
|
||||
public String getTitlePost() {
|
||||
return titlePost;
|
||||
}
|
||||
|
||||
public String getTitlePre() {
|
||||
return titlePre;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof MemberListItem) {
|
||||
MemberListItem other = (MemberListItem) obj;
|
||||
|
||||
return member.equals(other.getMember());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final MemberListItem other = (MemberListItem) obj;
|
||||
if ((this.surname == null) ? (other.surname != null)
|
||||
: !this.surname.equals(other.surname)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.givenName == null) ? (other.givenName != null)
|
||||
: !this.givenName.equals(other.givenName)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.titlePre == null) ? (other.titlePre != null)
|
||||
: !this.titlePre.equals(other.titlePre)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.titlePost == null) ? (other.titlePost != null)
|
||||
: !this.titlePost.equals(other.titlePost)) {
|
||||
return false;
|
||||
}
|
||||
if (this.birthdate != other.birthdate && (this.birthdate == null
|
||||
|| !this.birthdate.equals(
|
||||
other.birthdate))) {
|
||||
return false;
|
||||
}
|
||||
if ((this.gender == null) ? (other.gender != null)
|
||||
: !this.gender.equals(other.gender)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.role == null) ? (other.role != null)
|
||||
: !this.role.equals(other.role)) {
|
||||
return false;
|
||||
}
|
||||
if ((this.status == null) ? (other.status != null)
|
||||
: !this.status.equals(other.status)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public int hashCode() {
|
||||
return member.hashCode();
|
||||
}*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 3;
|
||||
hash =
|
||||
41 * hash + (this.surname != null ? this.surname.hashCode() : 0);
|
||||
hash =
|
||||
41 * hash + (this.givenName != null ? this.givenName.hashCode() : 0);
|
||||
hash =
|
||||
41 * hash + (this.titlePre != null ? this.titlePre.hashCode() : 0);
|
||||
hash =
|
||||
41 * hash + (this.titlePost != null ? this.titlePost.hashCode() : 0);
|
||||
hash =
|
||||
41 * hash + (this.birthdate != null ? this.birthdate.hashCode() : 0);
|
||||
hash =
|
||||
41 * hash + (this.gender != null ? this.gender.hashCode() : 0);
|
||||
hash = 41 * hash + (this.role != null ? this.role.hashCode() : 0);
|
||||
hash =
|
||||
41 * hash + (this.status != null ? this.status.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
protected class MemberListItemComparator
|
||||
implements Comparator<MemberListItem> {
|
||||
|
||||
public int compare(MemberListItem member1, MemberListItem member2) {
|
||||
int result = 0;
|
||||
|
||||
/*result =
|
||||
member1.getMember().getSurname().compareToIgnoreCase(member2.
|
||||
getMember().
|
||||
getSurname());
|
||||
|
||||
if (result == 0) {
|
||||
result = member1.getMember().getGivenName().compareTo(
|
||||
member2.getMember().getGivenName());
|
||||
}*/
|
||||
|
||||
result =
|
||||
member1.getSurname().compareToIgnoreCase(member2.getSurname());
|
||||
|
||||
if (result == 0) {
|
||||
result =
|
||||
member1.getGivenName().compareTo(member2.getGivenName());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
protected class SciProjectComparator implements Comparator<SciProject> {
|
||||
|
||||
public int compare(SciProject project1, SciProject project2) {
|
||||
/*int result = 0;
|
||||
|
||||
if (project1.getBegin() == null) {
|
||||
return -1;
|
||||
} else if (project2.getBegin() == null) {
|
||||
return 1;
|
||||
} else {
|
||||
result = project1.getBegin().compareTo(project2.getBegin());
|
||||
}
|
||||
|
||||
if (result == 0) {
|
||||
if (project1.getEnd() == null) {
|
||||
return -1;
|
||||
} else if (project2.getEnd() == null) {
|
||||
return 1;
|
||||
} else if ((project1.getEnd() == null) && (project2.getEnd()
|
||||
== null)) {
|
||||
return 0;
|
||||
} else {
|
||||
result = project1.getEnd().compareTo(project2.getEnd());
|
||||
}
|
||||
}
|
||||
|
||||
return result;*/
|
||||
|
||||
return project1.getTitle().compareTo(project2.getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
protected List<String> getFiltersForActiveMembers() {
|
||||
List<String> filters;
|
||||
filters = new LinkedList<String>();
|
||||
|
||||
filters.add("link.status = 'active'");
|
||||
|
||||
return filters;
|
||||
}
|
||||
|
||||
protected List<String> getFiltersForAssociatedMembers() {
|
||||
List<String> filters;
|
||||
filters = new LinkedList<String>();
|
||||
|
||||
filters.add("link.status = 'associated'");
|
||||
|
||||
return filters;
|
||||
}
|
||||
|
||||
protected List<String> getFiltersForFormerAssociatedMembers() {
|
||||
List<String> filters;
|
||||
filters = new LinkedList<String>();
|
||||
|
||||
filters.add("link.status = 'associatedFormer'");
|
||||
|
||||
return filters;
|
||||
}
|
||||
|
||||
protected List<String> getFiltersForFormerMembers() {
|
||||
List<String> filters;
|
||||
filters = new LinkedList<String>();
|
||||
|
||||
//filters.add("link.status = 'former'");
|
||||
filters.add("lower(link.status) like lower('%former%')");
|
||||
|
||||
return filters;
|
||||
}
|
||||
|
||||
protected List<String> getFiltersForOngoingProjects() {
|
||||
List<String> filters;
|
||||
Calendar today;
|
||||
|
||||
filters = new LinkedList<String>();
|
||||
today = new GregorianCalendar();
|
||||
filters.add(String.format(
|
||||
"(projectbegin IS NOT null) AND (projectend > '%d-%02d-%02d' OR projectend IS null)",
|
||||
today.get(java.util.Calendar.YEAR),
|
||||
today.get(java.util.Calendar.MONTH)
|
||||
+ 1,
|
||||
today.get(java.util.Calendar.DAY_OF_MONTH)));
|
||||
return filters;
|
||||
}
|
||||
|
||||
protected List<String> getFiltersForFinishedProjects() {
|
||||
List<String> filters;
|
||||
Calendar today;
|
||||
|
||||
filters = new LinkedList<String>();
|
||||
today = new GregorianCalendar();
|
||||
filters.add(String.format("projectend <= '%d-%02d-%02d'",
|
||||
today.get(java.util.Calendar.YEAR),
|
||||
today.get(java.util.Calendar.MONTH)
|
||||
+ 1,
|
||||
today.get(java.util.Calendar.DAY_OF_MONTH)));
|
||||
return filters;
|
||||
}
|
||||
|
||||
protected void generateMemberXML(final MemberListItem person,
|
||||
final Element parent,
|
||||
final String roleName,
|
||||
final String status,
|
||||
final PageState state) {
|
||||
Element memberElem = parent.newChildElement("member");
|
||||
|
||||
memberElem.addAttribute("role", roleName);
|
||||
memberElem.addAttribute("status", status);
|
||||
memberElem.addAttribute("oid", person.getOID().toString());
|
||||
|
||||
//Element title = memberElem.newChildElement("title");
|
||||
//title.setText(person.getTitle());
|
||||
|
||||
if ((person.getTitlePre() != null)
|
||||
&& !person.getTitlePre().isEmpty()) {
|
||||
Element titlePre = memberElem.newChildElement("titlePre");
|
||||
titlePre.setText(person.getTitlePre());
|
||||
}
|
||||
|
||||
Element surname = memberElem.newChildElement("surname");
|
||||
surname.setText(person.getSurname());
|
||||
|
||||
Element givenName = memberElem.newChildElement("givenname");
|
||||
givenName.setText(person.getGivenName());
|
||||
|
||||
if ((person.getTitlePost() != null)
|
||||
&& !person.getTitlePost().isEmpty()) {
|
||||
Element titlePost = memberElem.newChildElement("titlePost");
|
||||
titlePost.setText(person.getTitlePost());
|
||||
}
|
||||
|
||||
if ((person.getContacts() != null)
|
||||
&& (person.getContacts().size() > 0)) {
|
||||
GenericPersonContactCollection contacts;
|
||||
contacts = new GenericPersonContactCollection(person.getContacts());
|
||||
|
||||
Element contactsElem =
|
||||
memberElem.newChildElement("contacts");
|
||||
|
||||
while (contacts.next()) {
|
||||
generateContactXML(
|
||||
contacts.getContactType(),
|
||||
contacts.getPerson(),
|
||||
contacts.getContactEntries(),
|
||||
contacts.getAddress(),
|
||||
contactsElem,
|
||||
state,
|
||||
contacts.getContactOrder(),
|
||||
false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected void generateMemberXML(final GenericPerson person,
|
||||
final Element parent,
|
||||
final String roleName,
|
||||
final String status,
|
||||
final PageState state) {
|
||||
Element memberElem = parent.newChildElement("member");
|
||||
|
||||
memberElem.addAttribute("role", roleName);
|
||||
memberElem.addAttribute("status", status);
|
||||
memberElem.addAttribute("oid", person.getOID().toString());
|
||||
|
||||
Element title = memberElem.newChildElement("title");
|
||||
title.setText(person.getTitle());
|
||||
|
||||
if ((person.getTitlePre() != null)
|
||||
&& !person.getTitlePre().isEmpty()) {
|
||||
Element titlePre = memberElem.newChildElement("titlePre");
|
||||
titlePre.setText(person.getTitlePre());
|
||||
}
|
||||
|
||||
Element surname = memberElem.newChildElement("surname");
|
||||
surname.setText(person.getSurname());
|
||||
|
||||
Element givenName = memberElem.newChildElement("givenname");
|
||||
givenName.setText(person.getGivenName());
|
||||
|
||||
if ((person.getTitlePost() != null)
|
||||
&& !person.getTitlePost().isEmpty()) {
|
||||
Element titlePost = memberElem.newChildElement("titlePost");
|
||||
titlePost.setText(person.getTitlePost());
|
||||
}
|
||||
|
||||
if ((person.getContacts() != null)
|
||||
&& (person.getContacts().size() > 0)) {
|
||||
GenericPersonContactCollection contacts;
|
||||
contacts = person.getContacts();
|
||||
|
||||
Element contactsElem =
|
||||
memberElem.newChildElement("contacts");
|
||||
|
||||
while (contacts.next()) {
|
||||
generateContactXML(
|
||||
contacts.getContactType(),
|
||||
contacts.getPerson(),
|
||||
contacts.getContactEntries(),
|
||||
contacts.getAddress(),
|
||||
contactsElem,
|
||||
state,
|
||||
contacts.getContactOrder(),
|
||||
false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void addMember(
|
||||
final GenericOrganizationalUnitPersonCollection persons,
|
||||
final List<MemberListItem> members) {
|
||||
addMember(persons.getOID(),
|
||||
persons.getSurname(),
|
||||
persons.getGivenName(),
|
||||
persons.getTitlePre(),
|
||||
persons.getTitlePost(),
|
||||
persons.getBirthdate(),
|
||||
persons.getGender(),
|
||||
persons.getContacts(),
|
||||
persons.getRoleName(),
|
||||
persons.getStatus(),
|
||||
members);
|
||||
}
|
||||
|
||||
private void addMember(final OID oid,
|
||||
final String surname,
|
||||
final String givenName,
|
||||
final String titlePre,
|
||||
final String titlePost,
|
||||
final Date birthdate,
|
||||
final String gender,
|
||||
final DataCollection contacts,
|
||||
final String role,
|
||||
final String status,
|
||||
final List<MemberListItem> members) {
|
||||
MemberListItem listItem = new MemberListItem(oid,
|
||||
surname,
|
||||
givenName,
|
||||
titlePre,
|
||||
titlePost,
|
||||
birthdate,
|
||||
gender,
|
||||
contacts,
|
||||
role,
|
||||
status);
|
||||
|
||||
if (!members.contains(listItem)) {
|
||||
members.add(listItem);
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected void addMember(final GenericPerson person,
|
||||
final String roleName,
|
||||
final String status,
|
||||
final List<MemberListItem> members) {
|
||||
MemberListItem listItem = new MemberListItem(person, roleName, status);
|
||||
|
||||
if (!members.contains(listItem)) {
|
||||
members.add(listItem);
|
||||
}
|
||||
}
|
||||
|
||||
protected void mergeMembers(
|
||||
final SciDepartmentSubDepartmentsCollection subDepartments,
|
||||
final List<MemberListItem> members,
|
||||
final List<String> filters) {
|
||||
while (subDepartments.next()) {
|
||||
SciDepartment subDepartment = subDepartments.getSubDepartment();
|
||||
GenericOrganizationalUnitPersonCollection departmentMembers;
|
||||
departmentMembers = subDepartment.getPersons();
|
||||
for (String filter : filters) {
|
||||
departmentMembers.addFilter(filter);
|
||||
}
|
||||
|
||||
while (departmentMembers.next()) {
|
||||
addMember(departmentMembers.getOID(),
|
||||
departmentMembers.getSurname(),
|
||||
departmentMembers.getGivenName(),
|
||||
departmentMembers.getTitlePre(),
|
||||
departmentMembers.getTitlePost(),
|
||||
departmentMembers.getBirthdate(),
|
||||
departmentMembers.getGender(),
|
||||
null,
|
||||
departmentMembers.getRoleName(),
|
||||
departmentMembers.getStatus(),
|
||||
members);
|
||||
}
|
||||
|
||||
SciDepartmentSubDepartmentsCollection subSubDepartments;
|
||||
subSubDepartments = subDepartment.getSubDepartments();
|
||||
|
||||
if ((subSubDepartments != null)
|
||||
&& (subSubDepartments.size() > 0)) {
|
||||
mergeMembers(subSubDepartments, members, filters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void generateMembersListXML(final List<MemberListItem> members,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
Set<MemberListItem> membersSet;
|
||||
List<MemberListItem> membersWithoutDoubles;
|
||||
membersSet = new HashSet<MemberListItem>(members);
|
||||
membersWithoutDoubles = new LinkedList<MemberListItem>(membersSet);
|
||||
|
||||
Collections.sort(membersWithoutDoubles, new MemberListItemComparator());
|
||||
|
||||
long pageNumber = getPageNumber(state);
|
||||
long pageCount = getPageCount(membersWithoutDoubles.size());
|
||||
long begin = getPaginatorBegin(pageNumber);
|
||||
long count = getPaginatorCount(begin, membersWithoutDoubles.size());
|
||||
long end = getPaginatorEnd(begin, count);
|
||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||
|
||||
createPaginatorElement(
|
||||
parent, pageNumber, pageCount, begin, end, count,
|
||||
membersWithoutDoubles.size());
|
||||
List<MemberListItem> membersWithoutDoublesToShow =
|
||||
membersWithoutDoubles.subList((int) begin,
|
||||
(int) end);
|
||||
|
||||
Element membersWithoutDoublesElem = parent.newChildElement(
|
||||
"members");
|
||||
|
||||
for (MemberListItem memberItem : membersWithoutDoublesToShow) {
|
||||
generateMemberXML(memberItem,
|
||||
membersWithoutDoublesElem,
|
||||
memberItem.getRole(),
|
||||
memberItem.getStatus(),
|
||||
state);
|
||||
}
|
||||
}
|
||||
|
||||
protected void generateProjectXML(final SciProject project,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
Element projectElem = parent.newChildElement("project");
|
||||
projectElem.addAttribute("oid", project.getOID().toString());
|
||||
|
||||
Element title = projectElem.newChildElement("title");
|
||||
title.setText(project.getTitle());
|
||||
|
||||
Element beginElem = projectElem.newChildElement("projectbegin");
|
||||
|
||||
if ((project.getAddendum() != null)
|
||||
&& !(project.getAddendum().isEmpty())) {
|
||||
Element addendum = projectElem.newChildElement("addendum");
|
||||
addendum.setText(project.getAddendum());
|
||||
}
|
||||
|
||||
if ((project.getProjectShortDescription() != null)
|
||||
&& !(project.getProjectShortDescription().isEmpty())) {
|
||||
Element shortDesc = projectElem.newChildElement("shortDescription");
|
||||
shortDesc.setText(project.getProjectShortDescription());
|
||||
}
|
||||
|
||||
GenericOrganizationalUnitPersonCollection members;
|
||||
members = project.getPersons();
|
||||
members.addOrder("surname asc, givenname asc");
|
||||
|
||||
if (members.size() > 0) {
|
||||
Element membersElem = projectElem.newChildElement("members");
|
||||
|
||||
while (members.next()) {
|
||||
generateMemberXML(new MemberListItem(members.getOID(),
|
||||
members.getSurname(),
|
||||
members.getGivenName(),
|
||||
members.getTitlePre(),
|
||||
members.getTitlePost(),
|
||||
members.getBirthdate(),
|
||||
members.getGender(),
|
||||
null, members.getRoleName(),
|
||||
members.getStatus()),
|
||||
membersElem,
|
||||
members.getRoleName(),
|
||||
members.getStatus(),
|
||||
state);
|
||||
}
|
||||
}
|
||||
|
||||
GenericOrganizationalUnitContactCollection contacts;
|
||||
contacts = project.getContacts();
|
||||
|
||||
if (contacts.size() > 0) {
|
||||
Element contactsElem = projectElem.newChildElement("contacts");
|
||||
|
||||
while (contacts.next()) {
|
||||
generateContactXML(contacts.getContactType(),
|
||||
contacts.getPerson(),
|
||||
contacts.getContactEntries(),
|
||||
contacts.getAddress(),
|
||||
contactsElem,
|
||||
state,
|
||||
Integer.toString(contacts.getContactOrder()),
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void mergeProjects(
|
||||
final SciDepartmentSubDepartmentsCollection subDepartments,
|
||||
final List<SciProject> projects,
|
||||
final List<String> filters) {
|
||||
while (subDepartments.next()) {
|
||||
SciDepartmentProjectsCollection departmentProjects;
|
||||
departmentProjects = subDepartments.getSubDepartment().getProjects();
|
||||
|
||||
if ((filters != null)
|
||||
&& !(filters.isEmpty())) {
|
||||
for (String filter : filters) {
|
||||
departmentProjects.addFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
while (departmentProjects.next()) {
|
||||
projects.add(departmentProjects.getProject());
|
||||
}
|
||||
|
||||
SciDepartmentSubDepartmentsCollection subSubDepartments;
|
||||
subSubDepartments = subDepartments.getSubDepartment().
|
||||
getSubDepartments();
|
||||
|
||||
if ((subSubDepartments != null)
|
||||
&& subSubDepartments.size() > 0) {
|
||||
mergeProjects(subSubDepartments, projects, filters);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create the XML for the list of publications, using the special
|
||||
* RelatedLinks passed by the caller. To avoid a dependency to the
|
||||
* sci-publications module, we are using only methods from
|
||||
* {@link DataObject}, {@link DomainObject}, {@link DataCollection} and
|
||||
* {@link DomainCollection}.
|
||||
*
|
||||
* @param links Links to the publications
|
||||
* @param parent The parent XML element for the XML created by this method
|
||||
* @param state The current page state.
|
||||
*/
|
||||
/* protected void generatePublicationsXML(final DataCollection links,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
RelatedLink link;
|
||||
ContentItem publication;
|
||||
List<ContentItem> publications;
|
||||
|
||||
publications = new ArrayList<ContentItem>();
|
||||
|
||||
while (links.next()) {
|
||||
link = new RelatedLink(links.getDataObject());
|
||||
publication = link.getTargetItem();
|
||||
|
||||
publications.add(publication);
|
||||
}
|
||||
|
||||
Collections.sort(publications, new Comparator<ContentItem>() {
|
||||
|
||||
public int compare(ContentItem o1, ContentItem o2) {
|
||||
Integer year1;
|
||||
Integer year2;
|
||||
|
||||
if ((o1 == null) && o2 == null) {
|
||||
return 0;
|
||||
} else if ((o1 == null) && (o2 != null)) {
|
||||
return -1;
|
||||
} else if ((o1 != null) && o2 == null) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
year1 = (Integer) o1.get("yearOfPublication");
|
||||
year2 = (Integer) o2.get("yearOfPublication");
|
||||
|
||||
|
||||
if (year1.compareTo(year2)
|
||||
== 0) {
|
||||
String title1;
|
||||
String title2;
|
||||
|
||||
title1 = (String) o1.get("title");
|
||||
title2 = (String) o2.get("title");
|
||||
|
||||
return title1.compareTo(title2);
|
||||
} else {
|
||||
return (year1.compareTo(year2)) * -1;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
long pageNumber = getPageNumber(state);
|
||||
long pageCount = getPageCount(publications.size());
|
||||
long begin = getPaginatorBegin(pageNumber);
|
||||
long count = getPaginatorCount(begin, publications.size());
|
||||
long end = getPaginatorEnd(begin, count);
|
||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||
|
||||
createPaginatorElement(parent, pageNumber, pageCount, begin, end, count,
|
||||
end);
|
||||
List<ContentItem> publicationsToShow = publications.subList((int) begin,
|
||||
(int) end);
|
||||
|
||||
for (ContentItem pub : publicationsToShow) {
|
||||
generatePublicationXML(pub, parent, state);
|
||||
}
|
||||
}
|
||||
|
||||
protected void generatePublicationXML(final ContentItem publication,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
Element publicationElem;
|
||||
ContentItemXMLRenderer renderer;
|
||||
|
||||
if (publication == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
publicationElem = parent.newChildElement("publications");
|
||||
|
||||
renderer = new ContentItemXMLRenderer(publicationElem);
|
||||
renderer.setWrapAttributes(true);
|
||||
|
||||
renderer.walk(publication, SimpleXMLGenerator.class.getName());
|
||||
}*/
|
||||
}
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
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.contenttypes.SciOrganizationDepartmentsCollection;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
|
||||
/**
|
||||
* Form for linking {@link SciOrganization}s with {@link SciDepartment}s.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciOrganization
|
||||
* @see SciDepartment
|
||||
*/
|
||||
public class SciOrganizationDepartmentAddForm
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener {
|
||||
|
||||
private ItemSearchWidget m_itemSearch;
|
||||
private final String ITEM_SEARCH = "departments";
|
||||
|
||||
public SciOrganizationDepartmentAddForm(ItemSelectionModel itemModel) {
|
||||
super("DepartmentsAddForm", itemModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
add(new Label((String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.select_department").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();
|
||||
SciOrganization orga = (SciOrganization) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
|
||||
if (!(this.getSaveCancelSection().getCancelButton().
|
||||
isSelected(state))) {
|
||||
SciDepartment department = (SciDepartment) data.get(ITEM_SEARCH);
|
||||
|
||||
department = (SciDepartment) department.getContentBundle().
|
||||
getInstance(orga.getLanguage());
|
||||
|
||||
orga.addDepartment(department);
|
||||
//orga.addDepartment((SciDepartment) data.get(ITEM_SEARCH));
|
||||
}
|
||||
|
||||
init(fse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.department.add.no_department_selected"));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
SciOrganization orga = (SciOrganization) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
|
||||
SciDepartment department = (SciDepartment) data.get(ITEM_SEARCH);
|
||||
if (!(department.getContentBundle().hasInstance(orga.getLanguage()))) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.department.add.no_suitable_language_variant"));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
department = (SciDepartment) department.getContentBundle().getInstance(orga.
|
||||
getLanguage());
|
||||
SciOrganizationDepartmentsCollection departments = orga.getDepartments();
|
||||
departments.addFilter(String.format("id = %s",
|
||||
department.getID().toString()));
|
||||
if (departments.size() > 0) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.department.add.already_added"));
|
||||
}
|
||||
|
||||
departments.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Step for adding {@link SciDepartment}s to a {@link SciOrganization}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciDepartment
|
||||
* @see SciOrganization
|
||||
*/
|
||||
public class SciOrganizationDepartmentsStep extends SimpleEditStep {
|
||||
|
||||
private String ADD_DEPARTMENT_SHEET_NAME = "addDepartment";
|
||||
|
||||
public SciOrganizationDepartmentsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public SciOrganizationDepartmentsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent,
|
||||
String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addDepartmentSheet =
|
||||
new SciOrganizationDepartmentAddForm(itemModel);
|
||||
add(ADD_DEPARTMENT_SHEET_NAME,
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.add_department").localize(),
|
||||
new WorkflowLockedComponentAccess(addDepartmentSheet, itemModel),
|
||||
addDepartmentSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
SciOrganizationDepartmentsTable departmentTable =
|
||||
new SciOrganizationDepartmentsTable(
|
||||
itemModel);
|
||||
setDisplayComponent(departmentTable);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,382 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.bebop.ControlLink;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Link;
|
||||
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.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
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.contenttypes.SciOrganizationDepartmentsCollection;
|
||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Table for showing the {@link SciDepartment}s linked to a
|
||||
* {@link SciOrganization}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciOrganization
|
||||
* @see SciDepartment
|
||||
*/
|
||||
public class SciOrganizationDepartmentsTable
|
||||
extends Table
|
||||
implements TableActionListener {
|
||||
|
||||
private final Logger s_log = Logger.getLogger(
|
||||
SciOrganizationDepartmentsTable.class);
|
||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||
private final String TABLE_COL_DEL = "table_col_del";
|
||||
private final String TABLE_COL_UP = "table_col_up";
|
||||
private final String TABLE_COL_DOWN = "table_col_down";
|
||||
private ItemSelectionModel m_itemModel;
|
||||
|
||||
public SciOrganizationDepartmentsTable(ItemSelectionModel itemModel) {
|
||||
super();
|
||||
m_itemModel = itemModel;
|
||||
|
||||
setEmptyView(
|
||||
new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.departments.none")));
|
||||
|
||||
TableColumnModel colModel = getColumnModel();
|
||||
colModel.add(new TableColumn(
|
||||
0,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.department").localize(),
|
||||
TABLE_COL_EDIT));
|
||||
colModel.add(new TableColumn(
|
||||
1,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.department.remove").localize(),
|
||||
TABLE_COL_DEL));
|
||||
colModel.add(new TableColumn(
|
||||
2,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.department.up").localize(),
|
||||
TABLE_COL_UP));
|
||||
colModel.add(new TableColumn(
|
||||
3,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.department.down").localize(),
|
||||
TABLE_COL_DOWN));
|
||||
|
||||
setModelBuilder(
|
||||
new SciOrganizationDepartmentsTableModelBuilder(itemModel));
|
||||
|
||||
colModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||
colModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||
colModel.get(2).setCellRenderer(new UpCellRenderer());
|
||||
colModel.get(3).setCellRenderer(new DownCellRenderer());
|
||||
|
||||
addTableActionListener(this);
|
||||
}
|
||||
|
||||
private class SciOrganizationDepartmentsTableModelBuilder
|
||||
extends LockableImpl
|
||||
implements TableModelBuilder {
|
||||
|
||||
private ItemSelectionModel m_itemModel;
|
||||
|
||||
public SciOrganizationDepartmentsTableModelBuilder(
|
||||
ItemSelectionModel itemModel) {
|
||||
m_itemModel = itemModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableModel makeModel(Table table, PageState state) {
|
||||
table.getRowSelectionModel().clearSelection(state);
|
||||
SciOrganization orga = (SciOrganization) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
return new SciOrganizationDepartmentsTableModel(table,
|
||||
state,
|
||||
orga);
|
||||
}
|
||||
}
|
||||
|
||||
private class SciOrganizationDepartmentsTableModel
|
||||
implements TableModel {
|
||||
|
||||
private Table m_table;
|
||||
private SciOrganizationDepartmentsCollection m_departments;
|
||||
private SciDepartment m_department;
|
||||
|
||||
private SciOrganizationDepartmentsTableModel(Table table,
|
||||
PageState state,
|
||||
SciOrganization orga) {
|
||||
m_table = table;
|
||||
m_departments = orga.getDepartments();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return m_table.getColumnModel().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nextRow() {
|
||||
boolean ret;
|
||||
|
||||
if ((m_departments != null) && m_departments.next()) {
|
||||
m_department = m_departments.getDepartment();
|
||||
ret = true;
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return m_department.getTitle();
|
||||
case 1:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.department.remove").
|
||||
localize();
|
||||
case 2:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.department.up").
|
||||
localize();
|
||||
case 3:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.department.down").
|
||||
localize();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getKeyAt(int columnIndex) {
|
||||
return m_department.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 col) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
SciOrganization orga = (SciOrganization) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
SecurityManager.EDIT_ITEM,
|
||||
orga);
|
||||
|
||||
if (canEdit) {
|
||||
SciDepartment department;
|
||||
try {
|
||||
department = new SciDepartment((BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
s_log.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
Link link = new Link(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
department.getLanguage()),
|
||||
resolver.generateItemURL(state,
|
||||
department,
|
||||
section,
|
||||
department.
|
||||
getVersion()));
|
||||
|
||||
return link;
|
||||
} else {
|
||||
SciDepartment department;
|
||||
try {
|
||||
department = new SciDepartment((BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
s_log.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
Label label = new Label(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
department.getLanguage()));
|
||||
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);
|
||||
SciOrganization orga = (SciOrganization) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
SecurityManager.DELETE_ITEM,
|
||||
orga);
|
||||
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
link.setConfirmation((String) SciOrganizationGlobalizationUtil.
|
||||
globalize(
|
||||
"sciorganization.ui.organization.department."
|
||||
+ "confirm_remove").
|
||||
localize());
|
||||
return link;
|
||||
} else {
|
||||
Label label = new Label(value.toString());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class UpCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getComponent(
|
||||
Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int col) {
|
||||
|
||||
if (0 == row) {
|
||||
Label label = new Label("");
|
||||
return label;
|
||||
} else {
|
||||
ControlLink link = new ControlLink(
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.department.up").
|
||||
localize());
|
||||
return link;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class DownCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getComponent(
|
||||
Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int col) {
|
||||
|
||||
SciOrganization orga = (SciOrganization) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
SciOrganizationDepartmentsCollection departments = orga.
|
||||
getDepartments();
|
||||
|
||||
if ((departments.size() - 1) == row) {
|
||||
Label label = new Label("");
|
||||
return label;
|
||||
} else {
|
||||
ControlLink link = new ControlLink(
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.department.down").
|
||||
localize());
|
||||
return link;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cellSelected(TableActionEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
|
||||
SciDepartment department = new SciDepartment(
|
||||
new BigDecimal(event.getRowKey().toString()));
|
||||
|
||||
SciOrganization orga =
|
||||
(SciOrganization) m_itemModel.getSelectedObject(state);
|
||||
|
||||
SciOrganizationDepartmentsCollection departments =
|
||||
orga.getDepartments();
|
||||
|
||||
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||
|
||||
if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
||||
orga.removeDepartment(department);
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
|
||||
departments.swapWithPrevious(department);
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
|
||||
departments.swapWithNext(department);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void headSelected(TableActionEvent event) {
|
||||
//Nothing to do.
|
||||
}
|
||||
}
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Form for editing the description of a {@link SciOrganization}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciOrganization
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Step for editing the description of a {@link SciOrganization}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciOrganization
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
/*
|
||||
* 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.PageState;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganization;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
/**
|
||||
* Form for uploading the description of a {@link SciOrganization}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciOrganization
|
||||
* @see AbstractTextUploadForm
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* 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.globalization.GlobalizedMessage;
|
||||
|
||||
/**
|
||||
* GlobalizationUtil for the ccm-sci-types-organization module.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciOrganizationGlobalizationUtil {
|
||||
|
||||
public static final String BUNDLE_NAME = "com.arsdigita.cms.contenttypes.ui.SciOrganizationResources";
|
||||
|
||||
public static GlobalizedMessage globalize(String key) {
|
||||
return new GlobalizedMessage(key, BUNDLE_NAME);
|
||||
}
|
||||
|
||||
public static GlobalizedMessage globalize(String key, Object[] args) {
|
||||
return new GlobalizedMessage(key, BUNDLE_NAME, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* 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.FormProcessException;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganization;
|
||||
|
||||
/**
|
||||
* Form for linking members with a {@link SciOrganization}. The form overwrites
|
||||
* the {@link GenericOrganizationalUnitPersonAddForm#getPersonType()} to limit
|
||||
* the selectable person type to {@link SciMember}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciOrganization
|
||||
* @see SciMember
|
||||
* @see GenericPerson
|
||||
* @see GenericOrganizationalUnitPersonAddForm
|
||||
*/
|
||||
public class SciOrganizationMemberAddForm
|
||||
extends GenericOrganizationalUnitPersonAddForm {
|
||||
|
||||
public SciOrganizationMemberAddForm(
|
||||
ItemSelectionModel itemModel,
|
||||
GenericOrganizationalUnitPersonSelector personSelector) {
|
||||
super(itemModel, personSelector);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPersonType() {
|
||||
return GenericPerson.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRoleAttributeName() {
|
||||
return "SciOrganizationRole";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
* 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.PageState;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Step for adding and removing member form a {@link SciOrganization}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciOrganizationMemberAddForm
|
||||
* @see SciMember
|
||||
* @see SciOrganization
|
||||
*/
|
||||
public class SciOrganizationMemberStep
|
||||
extends SimpleEditStep
|
||||
implements GenericOrganizationalUnitPersonSelector {
|
||||
|
||||
public static final String ADD_MEMBER_SHEET_NAME = "addMember";
|
||||
private GenericPerson selectedPerson;
|
||||
private String selectedPersonRole;
|
||||
private String selectedPersonStatus;
|
||||
|
||||
public SciOrganizationMemberStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public SciOrganizationMemberStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent,
|
||||
String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addMemberSheet =
|
||||
new SciOrganizationMemberAddForm(itemModel, this);
|
||||
add(ADD_MEMBER_SHEET_NAME,
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.orgnization.add_member").localize(),
|
||||
new WorkflowLockedComponentAccess(addMemberSheet, itemModel),
|
||||
addMemberSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
SciOrganizationMemberTable memberTable = new SciOrganizationMemberTable(
|
||||
itemModel, this);
|
||||
setDisplayComponent(memberTable);
|
||||
}
|
||||
|
||||
public GenericPerson getSelectedPerson() {
|
||||
return selectedPerson;
|
||||
}
|
||||
|
||||
public void setSelectedPerson(final GenericPerson selectedPerson) {
|
||||
this.selectedPerson = selectedPerson;
|
||||
}
|
||||
|
||||
public String getSelectedPersonRole() {
|
||||
return selectedPersonRole;
|
||||
}
|
||||
|
||||
public void setSelectedPersonRole(final String selectedPersonRole) {
|
||||
this.selectedPersonRole = selectedPersonRole;
|
||||
}
|
||||
|
||||
public String getSelectedPersonStatus() {
|
||||
return selectedPersonStatus;
|
||||
}
|
||||
|
||||
public void setSelectedPersonStatus(final String selectedPersonStatus) {
|
||||
this.selectedPersonStatus = selectedPersonStatus;
|
||||
}
|
||||
|
||||
public void showEditComponent(final PageState state) {
|
||||
showComponent(state, ADD_MEMBER_SHEET_NAME);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010 Jens Pelzetter,
|
||||
* for the Center of Social Politics of the University of Bremen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciOrganizationMemberTable extends GenericOrganizationalUnitPersonsTable {
|
||||
|
||||
public SciOrganizationMemberTable(ItemSelectionModel itemModel,
|
||||
GenericOrganizationalUnitPersonSelector personSelector) {
|
||||
super(itemModel, personSelector);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRoleAttributeName() {
|
||||
return "SciOrganizationRole";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,594 +0,0 @@
|
|||
/*
|
||||
* 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.PageState;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganization;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganizationDepartmentsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganizationProjectsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
import com.arsdigita.cms.contenttypes.ui.panels.Filter;
|
||||
import com.arsdigita.cms.contenttypes.ui.panels.TextFilter;
|
||||
import com.arsdigita.xml.Element;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Panel for rendering the properties of a SciOrganization. The property to show
|
||||
* is selected via the <code>show</code> parameter.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(
|
||||
SciOrganizationPanel.class);
|
||||
public static final String SHOW_DESCRIPTION = "description";
|
||||
public static final String SHOW_MEMBERS_ACTIVE = "membersActive";
|
||||
public static final String SHOW_MEMBERS_ASSOCIATED = "membersAssociated";
|
||||
public static final String SHOW_MEMBERS_FORMER = "membersFormer";
|
||||
public static final String SHOW_DEPARTMENTS = "departments";
|
||||
public static final String SHOW_PROJECTS = "projects";
|
||||
public static final String SHOW_PROJECTS_ONGOING = "projectsOngoing";
|
||||
public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
|
||||
private static final String TTILE = "title";
|
||||
private String show;
|
||||
private boolean displayDescription = true;
|
||||
private boolean displayDepartments = true;
|
||||
private boolean displayProjects = true;
|
||||
private final Map<String, Filter> projectFilters =
|
||||
new LinkedHashMap<String, Filter>();
|
||||
|
||||
public SciOrganizationPanel() {
|
||||
projectFilters.put(TTILE, new TextFilter(TTILE, TTILE));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDefaultShowParam() {
|
||||
return SHOW_DESCRIPTION;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends ContentItem> getAllowedClass() {
|
||||
return SciOrganization.class;
|
||||
}
|
||||
|
||||
public boolean isDisplayDepartments() {
|
||||
return displayDepartments;
|
||||
}
|
||||
|
||||
public void setDisplayDepartments(boolean displayDepartments) {
|
||||
this.displayDepartments = displayDepartments;
|
||||
}
|
||||
|
||||
public boolean isDisplayDescription() {
|
||||
return displayDescription;
|
||||
}
|
||||
|
||||
public void setDisplayDescription(boolean displayDescription) {
|
||||
this.displayDescription = displayDescription;
|
||||
}
|
||||
|
||||
public boolean isDisplayProjects() {
|
||||
return displayProjects;
|
||||
}
|
||||
|
||||
public void setDisplayProjects(boolean displayProjects) {
|
||||
this.displayProjects = displayProjects;
|
||||
}
|
||||
|
||||
protected boolean hasMembers(final SciOrganization orga) {
|
||||
return orga.hasMembers(true, SciOrganization.MemberStatus.ALL);
|
||||
}
|
||||
|
||||
protected boolean hasActiveMembers(final SciOrganization orga) {
|
||||
return orga.hasMembers(true, SciOrganization.MemberStatus.ACTIVE);
|
||||
}
|
||||
|
||||
protected boolean hasAssociatedMembers(final SciOrganization orga) {
|
||||
return orga.hasMembers(true, SciOrganization.MemberStatus.ASSOCIATED);
|
||||
}
|
||||
|
||||
protected boolean hasFormerMembers(final SciOrganization orga) {
|
||||
return orga.hasMembers(true, SciOrganization.MemberStatus.FORMER);
|
||||
}
|
||||
|
||||
protected boolean hasProjects(final SciOrganization orga) {
|
||||
return orga.hasProjects(SciOrganization.getConfig().
|
||||
getOrganizationProjectsMerge(),
|
||||
SciOrganization.ProjectStatus.ALL);
|
||||
}
|
||||
|
||||
protected boolean hasOngoingProjects(final SciOrganization orga) {
|
||||
return orga.hasProjects(SciOrganization.getConfig().
|
||||
getOrganizationProjectsMerge(),
|
||||
SciOrganization.ProjectStatus.ONGOING);
|
||||
}
|
||||
|
||||
protected boolean hasFinishedProjects(final SciOrganization orga) {
|
||||
return orga.hasProjects(SciOrganization.getConfig().
|
||||
getOrganizationProjectsMerge(),
|
||||
SciOrganization.ProjectStatus.FINISHED);
|
||||
}
|
||||
|
||||
protected void generateDepartmentsXML(final SciOrganization orga,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
SciOrganizationDepartmentsCollection departments;
|
||||
departments = orga.getDepartments();
|
||||
departments.addOrder("link.departmentOrder asc");
|
||||
|
||||
long pageNumber = getPageNumber(state);
|
||||
|
||||
Element departmentsElem = parent.newChildElement("departments");
|
||||
|
||||
long pageCount = getPageCount(departments.size());
|
||||
long begin = getPaginatorBegin(pageNumber);
|
||||
long count = getPaginatorCount(begin, departments.size());
|
||||
long end = getPaginatorEnd(begin, count);
|
||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||
|
||||
createPaginatorElement(
|
||||
parent, pageNumber, pageCount, begin, end, count, departments.
|
||||
size());
|
||||
departments.setRange((int) begin + 1, (int) end + 1);
|
||||
|
||||
while (departments.next()) {
|
||||
SciDepartment department;
|
||||
department = departments.getDepartment();
|
||||
|
||||
Element departmentElem = departmentsElem.newChildElement(
|
||||
"department");
|
||||
departmentElem.addAttribute("order", Integer.toString(departments.
|
||||
getDepartmentOrder()));
|
||||
departmentElem.addAttribute("oid", department.getOID().toString());
|
||||
|
||||
Element title = departmentElem.newChildElement("title");
|
||||
title.setText(department.getTitle());
|
||||
|
||||
if ((department.getAddendum() != null)
|
||||
&& !(department.getAddendum().isEmpty())) {
|
||||
Element addendum = departmentElem.newChildElement("addendum");
|
||||
addendum.setText(department.getAddendum());
|
||||
}
|
||||
|
||||
if ((department.getDepartmentShortDescription() != null)
|
||||
&& !(department.getDepartmentShortDescription().isEmpty())) {
|
||||
Element shortDesc = departmentElem.newChildElement(
|
||||
"shortDescription");
|
||||
shortDesc.setText(department.getDepartmentShortDescription());
|
||||
}
|
||||
|
||||
GenericOrganizationalUnitPersonCollection heads;
|
||||
heads = department.getPersons();
|
||||
heads.addFilter("link.role_name = 'head' and link.status = 'active'");
|
||||
heads.addOrder("surname asc, givenname asc");
|
||||
|
||||
if (heads.size() > 0) {
|
||||
Element headsElem = departmentElem.newChildElement("heads");
|
||||
|
||||
while (heads.next()) {
|
||||
Element headElem = headsElem.newChildElement("head");
|
||||
Element titlePre = headElem.newChildElement("titlePre");
|
||||
titlePre.setText(heads.getTitlePre());
|
||||
Element givenName = headElem.newChildElement("givenname");
|
||||
givenName.setText(heads.getGivenName());
|
||||
Element surname = headElem.newChildElement("surname");
|
||||
surname.setText(heads.getSurname());
|
||||
Element titlePost = headElem.newChildElement("titlePost");
|
||||
titlePost.setText(heads.getTitlePost());
|
||||
}
|
||||
}
|
||||
|
||||
GenericOrganizationalUnitContactCollection contacts;
|
||||
contacts = department.getContacts();
|
||||
if (contacts.size() > 0) {
|
||||
Element contactsElem =
|
||||
departmentElem.newChildElement("contacts");
|
||||
|
||||
while (contacts.next()) {
|
||||
generateContactXML(contacts.getContactType(),
|
||||
contacts.getPerson(),
|
||||
contacts.getContactEntries(),
|
||||
contacts.getAddress(),
|
||||
contactsElem,
|
||||
state,
|
||||
Integer.toString(
|
||||
contacts.getContactOrder()),
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void mergeMembers(
|
||||
final SciOrganizationDepartmentsCollection departments,
|
||||
final List<MemberListItem> members,
|
||||
final List<String> filters) {
|
||||
|
||||
while (departments.next()) {
|
||||
SciDepartment department = departments.getDepartment();
|
||||
GenericOrganizationalUnitPersonCollection departmentsMembers;
|
||||
departmentsMembers = department.getPersons();
|
||||
for (String filter : filters) {
|
||||
departmentsMembers.addFilter(filter);
|
||||
}
|
||||
|
||||
while (departmentsMembers.next()) {
|
||||
addMember(departmentsMembers,
|
||||
members);
|
||||
}
|
||||
|
||||
SciDepartmentSubDepartmentsCollection subDepartments;
|
||||
subDepartments = department.getSubDepartments();
|
||||
|
||||
|
||||
if ((subDepartments != null)
|
||||
&& subDepartments.size() > 0) {
|
||||
mergeMembers(subDepartments, members, filters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void generateMembersXML(final SciOrganization orga,
|
||||
final Element parent,
|
||||
final PageState state,
|
||||
final List<String> filters) {
|
||||
if (SciOrganization.getConfig().getOrganizationMembersMerge()) {
|
||||
long begin = System.currentTimeMillis();
|
||||
List<MemberListItem> members;
|
||||
members = new LinkedList<MemberListItem>();
|
||||
GenericOrganizationalUnitPersonCollection orgaMembers;
|
||||
orgaMembers = orga.getPersons();
|
||||
for (String filter : filters) {
|
||||
orgaMembers.addFilter(filter);
|
||||
}
|
||||
|
||||
SciOrganizationDepartmentsCollection departments;
|
||||
departments = orga.getDepartments();
|
||||
|
||||
while (orgaMembers.next()) {
|
||||
addMember(orgaMembers,
|
||||
members);
|
||||
}
|
||||
|
||||
mergeMembers(departments, members, filters);
|
||||
|
||||
generateMembersListXML(members, parent, state);
|
||||
System.out.printf("Members XML generated in %d ms\n", System.currentTimeMillis() - begin);
|
||||
} else {
|
||||
GenericOrganizationalUnitPersonCollection orgaMembers;
|
||||
orgaMembers = orga.getPersons();
|
||||
for (String filter : filters) {
|
||||
orgaMembers.addFilter(filter);
|
||||
}
|
||||
List<MemberListItem> members = new LinkedList<MemberListItem>();
|
||||
|
||||
while (orgaMembers.next()) {
|
||||
addMember(orgaMembers,
|
||||
members);
|
||||
}
|
||||
|
||||
generateMembersListXML(members, parent, state);
|
||||
}
|
||||
}
|
||||
|
||||
protected void mergeProjects(
|
||||
final SciOrganizationDepartmentsCollection departments,
|
||||
final List<SciProject> projects,
|
||||
final List<String> filters,
|
||||
final PageState state) {
|
||||
|
||||
while (departments.next()) {
|
||||
SciDepartmentProjectsCollection departmentProjects;
|
||||
departmentProjects = departments.getDepartment().getProjects();
|
||||
|
||||
if ((filters != null)
|
||||
&& !(filters.isEmpty())) {
|
||||
for (String filter : filters) {
|
||||
departmentProjects.addFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
while (departmentProjects.next()) {
|
||||
projects.add(departmentProjects.getProject());
|
||||
}
|
||||
|
||||
SciDepartmentSubDepartmentsCollection subDepartments;
|
||||
subDepartments = departments.getDepartment().getSubDepartments();
|
||||
|
||||
if ((subDepartments != null)
|
||||
&& subDepartments.size() > 0) {
|
||||
mergeProjects(subDepartments, projects, filters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void generateProjectsXML(final SciOrganization orga,
|
||||
final Element parent,
|
||||
final PageState state,
|
||||
final List<String> filters) {
|
||||
Element controls = parent.newChildElement("filterControls");
|
||||
controls.addAttribute("customName", "sciOrganizationProjects");
|
||||
controls.addAttribute("show", show);
|
||||
|
||||
if (SciOrganization.getConfig().getOrganizationProjectsMerge()) {
|
||||
List<SciProject> projects;
|
||||
projects = new LinkedList<SciProject>();
|
||||
SciOrganizationProjectsCollection orgaProjects;
|
||||
orgaProjects = orga.getProjects();
|
||||
|
||||
applyProjectFilters(filters, state.getRequest());
|
||||
if ((filters != null)
|
||||
&& !(filters.isEmpty())) {
|
||||
for (String filter : filters) {
|
||||
orgaProjects.addFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
SciOrganizationDepartmentsCollection departments;
|
||||
departments = orga.getDepartments();
|
||||
|
||||
while (orgaProjects.next()) {
|
||||
projects.add(orgaProjects.getProject());
|
||||
}
|
||||
|
||||
mergeProjects(departments, projects, filters, state);
|
||||
|
||||
Set<SciProject> projectsSet;
|
||||
List<SciProject> projectsWithoutDoubles;
|
||||
projectsSet = new HashSet<SciProject>(projects);
|
||||
projectsWithoutDoubles = new LinkedList<SciProject>(projectsSet);
|
||||
|
||||
Collections.sort(projectsWithoutDoubles, new SciProjectComparator());
|
||||
|
||||
long pageNumber = getPageNumber(state);
|
||||
long pageCount = getPageCount(projectsWithoutDoubles.size());
|
||||
long begin = getPaginatorBegin(pageNumber);
|
||||
long count = getPaginatorCount(begin, projectsWithoutDoubles.size());
|
||||
long end = getPaginatorEnd(begin, count);
|
||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||
|
||||
generateProjectFiltersXml(projectsWithoutDoubles, controls);
|
||||
createPaginatorElement(
|
||||
parent, pageNumber, pageCount, begin, end, count,
|
||||
projectsWithoutDoubles.size());
|
||||
List<SciProject> projectsWithoutDoublesToShow =
|
||||
projectsWithoutDoubles.subList((int) begin,
|
||||
(int) end);
|
||||
|
||||
Element projectsWithoutDoublesElem = parent.newChildElement(
|
||||
"projects");
|
||||
for (SciProject project : projectsWithoutDoublesToShow) {
|
||||
generateProjectXML(project, projectsWithoutDoublesElem, state);
|
||||
}
|
||||
} else {
|
||||
SciOrganizationProjectsCollection orgaProjects;
|
||||
orgaProjects = orga.getProjects();
|
||||
|
||||
applyProjectFilters(filters, state.getRequest());
|
||||
if ((filters != null)
|
||||
&& !(filters.isEmpty())) {
|
||||
for (String filter : filters) {
|
||||
orgaProjects.addFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
List<SciProject> projects = new LinkedList<SciProject>();
|
||||
|
||||
while (orgaProjects.next()) {
|
||||
projects.add(orgaProjects.getProject());
|
||||
}
|
||||
|
||||
Collections.sort(projects, new SciProjectComparator());
|
||||
|
||||
long pageNumber = getPageNumber(state);
|
||||
long pageCount = getPageCount(projects.size());
|
||||
long begin = getPaginatorBegin(pageNumber);
|
||||
long count = getPaginatorCount(begin, projects.size());
|
||||
long end = getPaginatorEnd(begin, count);
|
||||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||
|
||||
generateProjectFiltersXml(projects, controls);
|
||||
createPaginatorElement(
|
||||
parent, pageNumber, pageCount, begin, end, count, projects.
|
||||
size());
|
||||
List<SciProject> projectsToShow = projects.subList((int) begin,
|
||||
(int) end);
|
||||
|
||||
Element projectsElem = parent.newChildElement("projects");
|
||||
for (SciProject project : projectsToShow) {
|
||||
generateProjectXML(project, projectsElem, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void generateProjectFiltersXml(
|
||||
final List<SciProject> projects,
|
||||
final Element element) {
|
||||
final Element filterElement = element.newChildElement("filters");
|
||||
|
||||
for (Map.Entry<String, Filter> filterEntry : projectFilters.entrySet()) {
|
||||
filterEntry.getValue().generateXml(filterElement);
|
||||
}
|
||||
}
|
||||
|
||||
protected void applyProjectFilters(
|
||||
final List<String> filters,
|
||||
final HttpServletRequest request) {
|
||||
//Get parameters from HTTP request
|
||||
for (Map.Entry<String, Filter> filterEntry : projectFilters.entrySet()) {
|
||||
String value = request.getParameter(
|
||||
filterEntry.getValue().getLabel());
|
||||
|
||||
if ((value != null) && !(value.trim().isEmpty())) {
|
||||
filterEntry.getValue().setValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
//Apply filters to DomainCollection
|
||||
final StringBuilder filterBuilder = new StringBuilder();
|
||||
for (Map.Entry<String, Filter> filterEntry : projectFilters.entrySet()) {
|
||||
if ((filterEntry.getValue().getFilter() == null)
|
||||
|| (filterEntry.getValue().getFilter().isEmpty())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (filterBuilder.length() > 0) {
|
||||
filterBuilder.append(" AND ");
|
||||
}
|
||||
filterBuilder.append(filterEntry.getValue().getFilter());
|
||||
s_log.debug(String.format("filters: %s", filterBuilder));
|
||||
if (filterBuilder.length() > 0) {
|
||||
filters.add(filterBuilder.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateAvailableDataXml(final GenericOrganizationalUnit orga,
|
||||
final Element element,
|
||||
final PageState state) {
|
||||
SciOrganizationConfig config;
|
||||
config = SciOrganization.getConfig();
|
||||
|
||||
SciOrganization organization = (SciOrganization) orga;
|
||||
|
||||
if ((organization.getOrganizationDescription() != null)
|
||||
&& !(organization.getOrganizationDescription().isEmpty())
|
||||
&& displayDescription) {
|
||||
element.newChildElement("description");
|
||||
}
|
||||
if (organization.hasContacts()
|
||||
&& isDisplayContacts()) {
|
||||
element.newChildElement("contacts");
|
||||
}
|
||||
if (organization.hasDepartments()
|
||||
&& displayDepartments) {
|
||||
element.newChildElement("departments");
|
||||
}
|
||||
if (config.getOrganizationMembersAllInOne()) {
|
||||
if (hasMembers(organization)
|
||||
&& isDisplayMembers()) {
|
||||
element.newChildElement("members");
|
||||
}
|
||||
} else {
|
||||
if (hasActiveMembers(organization)
|
||||
&& isDisplayMembers()) {
|
||||
element.newChildElement("membersActive");
|
||||
}
|
||||
if (hasAssociatedMembers(organization)
|
||||
&& isDisplayMembers()) {
|
||||
element.newChildElement("membersAssociated");
|
||||
}
|
||||
if (hasFormerMembers(organization)
|
||||
&& isDisplayMembers()) {
|
||||
element.newChildElement("membersFormer");
|
||||
}
|
||||
}
|
||||
if (config.getOrganizationProjectsAllInOne()) {
|
||||
if (hasProjects(organization)
|
||||
&& displayProjects) {
|
||||
element.newChildElement("projects");
|
||||
}
|
||||
} else {
|
||||
if (hasOngoingProjects(organization)
|
||||
&& displayProjects) {
|
||||
element.newChildElement("projectsOngoing");
|
||||
}
|
||||
if (hasFinishedProjects(organization)
|
||||
&& displayProjects) {
|
||||
element.newChildElement("projectsFinished");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateDataXml(final GenericOrganizationalUnit orga,
|
||||
final Element element,
|
||||
final PageState state) {
|
||||
show = getShowParam(state);
|
||||
|
||||
SciOrganization organization = (SciOrganization) orga;
|
||||
|
||||
if (SHOW_DESCRIPTION.equals(show)) {
|
||||
String desc;
|
||||
desc = organization.getOrganizationDescription();
|
||||
|
||||
Element description = element.newChildElement("description");
|
||||
description.setText(desc);
|
||||
} else if (SHOW_CONTACTS.equals(show)) {
|
||||
generateContactsXML(organization, element, state);
|
||||
} else if (SHOW_DEPARTMENTS.equals(show)) {
|
||||
generateDepartmentsXML(organization, element, state);
|
||||
} else if (SHOW_MEMBERS.equals(show)) {
|
||||
generateMembersXML(organization, element, state,
|
||||
new LinkedList<String>());
|
||||
} else if (SHOW_MEMBERS_ACTIVE.equals(show)) {
|
||||
generateMembersXML(organization, element, state,
|
||||
getFiltersForActiveMembers());
|
||||
} else if (SHOW_MEMBERS_ASSOCIATED.equals(show)) {
|
||||
generateMembersXML(organization, element, state,
|
||||
getFiltersForAssociatedMembers());
|
||||
} else if (SHOW_MEMBERS_FORMER.equals(show)) {
|
||||
generateMembersXML(organization, element, state,
|
||||
getFiltersForFormerMembers());
|
||||
} else if (SHOW_PROJECTS.equals(show)) {
|
||||
generateProjectsXML(organization, element, state,
|
||||
new LinkedList<String>());
|
||||
} else if (SHOW_PROJECTS_ONGOING.equals(show)) {
|
||||
generateProjectsXML(
|
||||
organization, element, state, getFiltersForOngoingProjects());
|
||||
} else if (SHOW_PROJECTS_FINISHED.equals(show)) {
|
||||
generateProjectsXML(
|
||||
organization, element, state,
|
||||
getFiltersForFinishedProjects());
|
||||
}
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void generateXML(ContentItem item,
|
||||
Element element,
|
||||
PageState state) {
|
||||
Element content = generateBaseXML(item, element, state);
|
||||
|
||||
SciOrganization orga = (SciOrganization) item;
|
||||
Element availableData = content.newChildElement("availableData");
|
||||
|
||||
generateAvailableDataXml(orga, availableData, state);
|
||||
|
||||
generateDataXml(orga, content, state);
|
||||
}*/
|
||||
}
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
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.SciOrganization;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganizationProjectsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
|
||||
/**
|
||||
* Form for linking projects with a {@link SciOrganization}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciOrganizationProjectAddForm
|
||||
* @see SciOrganization
|
||||
* @see SciProject
|
||||
*/
|
||||
public class SciOrganizationProjectAddForm
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener {
|
||||
|
||||
private ItemSearchWidget m_itemSearch;
|
||||
private final String ITEM_SEARCH = "projects";
|
||||
|
||||
public SciOrganizationProjectAddForm(ItemSelectionModel itemModel) {
|
||||
super("ProjectsAddForm", itemModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
add(new Label((String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.select_project").localize()));
|
||||
m_itemSearch = new ItemSearchWidget(
|
||||
ITEM_SEARCH,
|
||||
ContentType.findByAssociatedObjectType(
|
||||
SciProject.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();
|
||||
SciOrganization orga = (SciOrganization) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
|
||||
if (!(this.getSaveCancelSection().getCancelButton().
|
||||
isSelected(state))) {
|
||||
SciProject project = (SciProject) data.get(ITEM_SEARCH);
|
||||
project = (SciProject) project.getContentBundle().getInstance(orga.
|
||||
getLanguage());
|
||||
|
||||
orga.addProject(project);
|
||||
}
|
||||
|
||||
init(fse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.select_project.no_project_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
SciOrganization orga = (SciOrganization) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
SciProject project = (SciProject) data.get(ITEM_SEARCH);
|
||||
if (!(project.getContentBundle().hasInstance(orga.getLanguage()))) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.select_project.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
||||
project = (SciProject) project.getContentBundle().getInstance(orga.
|
||||
getLanguage());
|
||||
SciOrganizationProjectsCollection projects = orga.getProjects();
|
||||
projects.addFilter(String.format("id = %s", project.getID().toString()));
|
||||
if (projects.size() > 0) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.select_project.already_added"));
|
||||
}
|
||||
|
||||
projects.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganization;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Step for adding and removing links from a {@link SciOrganization} to a
|
||||
* {@link SciProject}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciOrganizationProjectAddForm
|
||||
* @see SciOrganization
|
||||
* @see SciProject
|
||||
*/
|
||||
public class SciOrganizationProjectsStep extends SimpleEditStep {
|
||||
|
||||
private String ADD_PROJECT_SHEET_NAME = "addProject";
|
||||
|
||||
public SciOrganizationProjectsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public SciOrganizationProjectsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent,
|
||||
String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addProjectSheet =
|
||||
new SciOrganizationProjectAddForm(itemModel);
|
||||
add(ADD_PROJECT_SHEET_NAME,
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.add_project").localize(),
|
||||
new WorkflowLockedComponentAccess(addProjectSheet, itemModel),
|
||||
addProjectSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
SciOrganizationProjectsTable projectsTable =
|
||||
new SciOrganizationProjectsTable(
|
||||
itemModel);
|
||||
setDisplayComponent(projectsTable);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,382 +0,0 @@
|
|||
/*
|
||||
* 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 java.math.BigDecimal;
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.ControlLink;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.Link;
|
||||
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.CMS;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganization;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganizationProjectsCollection;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* Table for showing the links between a {@link SciOrganization} and
|
||||
* {@link SciProject}s.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @see SciOrganization
|
||||
* @see SciProject
|
||||
*/
|
||||
public class SciOrganizationProjectsTable
|
||||
extends Table
|
||||
implements TableActionListener {
|
||||
|
||||
private final Logger s_log = Logger.getLogger(
|
||||
SciOrganizationProjectsTable.class);
|
||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||
private final String TABLE_COL_DEL = "table_col_del";
|
||||
private final String TABLE_COL_UP = "table_col_up";
|
||||
private final String TABLE_COL_DOWN = "table_col_down";
|
||||
private ItemSelectionModel m_itemModel;
|
||||
|
||||
public SciOrganizationProjectsTable(ItemSelectionModel itemModel) {
|
||||
super();
|
||||
m_itemModel = itemModel;
|
||||
|
||||
setEmptyView(
|
||||
new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.projects.none")));
|
||||
|
||||
TableColumnModel colModel = getColumnModel();
|
||||
colModel.add(new TableColumn(
|
||||
0,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.project").localize(),
|
||||
TABLE_COL_EDIT));
|
||||
colModel.add(new TableColumn(
|
||||
1,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.project.remove").localize(),
|
||||
TABLE_COL_DEL));
|
||||
/*colModel.add(new TableColumn(
|
||||
2,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.project.up").localize(),
|
||||
TABLE_COL_UP));
|
||||
colModel.add(new TableColumn(
|
||||
3,
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.project.down").localize(),
|
||||
TABLE_COL_DOWN));*/
|
||||
|
||||
setModelBuilder(
|
||||
new SciOrganizationProjectsTableModelBuilder(itemModel));
|
||||
|
||||
colModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||
colModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||
//colModel.get(2).setCellRenderer(new UpCellRenderer());
|
||||
//colModel.get(3).setCellRenderer(new DownCellRenderer());
|
||||
|
||||
addTableActionListener(this);
|
||||
}
|
||||
|
||||
private class SciOrganizationProjectsTableModelBuilder
|
||||
extends LockableImpl
|
||||
implements TableModelBuilder {
|
||||
|
||||
private ItemSelectionModel m_itemModel;
|
||||
|
||||
public SciOrganizationProjectsTableModelBuilder(
|
||||
ItemSelectionModel itemModel) {
|
||||
m_itemModel = itemModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableModel makeModel(Table table, PageState state) {
|
||||
table.getRowSelectionModel().clearSelection(state);
|
||||
SciOrganization orga = (SciOrganization) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
return new SciOrganizationProjectsTableModel(table,
|
||||
state,
|
||||
orga);
|
||||
}
|
||||
}
|
||||
|
||||
private class SciOrganizationProjectsTableModel
|
||||
implements TableModel {
|
||||
|
||||
private Table m_table;
|
||||
private SciOrganizationProjectsCollection m_projects;
|
||||
private SciProject m_project;
|
||||
|
||||
public SciOrganizationProjectsTableModel(Table table,
|
||||
PageState state,
|
||||
SciOrganization orga) {
|
||||
m_table = table;
|
||||
m_projects = orga.getProjects();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return m_table.getColumnModel().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean nextRow() {
|
||||
boolean ret;
|
||||
|
||||
if ((m_projects != null) && m_projects.next()) {
|
||||
m_project = m_projects.getProject();
|
||||
ret = true;
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getElementAt(int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return m_project.getTitle();
|
||||
case 1:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.project.remove").
|
||||
localize();
|
||||
case 2:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.project.up").
|
||||
localize();
|
||||
case 3:
|
||||
return SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.project.down").
|
||||
localize();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getKeyAt(int columnIndex) {
|
||||
return m_project.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 col) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
SciOrganization orga = (SciOrganization) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
SecurityManager.EDIT_ITEM,
|
||||
orga);
|
||||
|
||||
if (canEdit) {
|
||||
SciProject project;
|
||||
try {
|
||||
project = new SciProject((BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
s_log.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
ContentSection section = CMS.getContext().getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
Link link =
|
||||
new Link(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
project.getLanguage()),
|
||||
resolver.generateItemURL(state,
|
||||
project,
|
||||
section,
|
||||
project.getVersion()));
|
||||
|
||||
return link;
|
||||
|
||||
} else {
|
||||
SciProject project;
|
||||
try {
|
||||
project = new SciProject((BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
s_log.warn(String.format("No object with key '%s' found.",
|
||||
key),
|
||||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
Label label = new Label(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
project.getLanguage()));
|
||||
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);
|
||||
SciOrganization orga = (SciOrganization) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
SecurityManager.DELETE_ITEM,
|
||||
orga);
|
||||
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
link.setConfirmation((String) SciOrganizationGlobalizationUtil.
|
||||
globalize(
|
||||
"sciorganization.ui.organization.project."
|
||||
+ "confirm_remove").
|
||||
localize());
|
||||
return link;
|
||||
} else {
|
||||
Label label = new Label(value.toString());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class UpCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getComponent(
|
||||
Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int col) {
|
||||
|
||||
if (0 == row) {
|
||||
Label label = new Label("");
|
||||
return label;
|
||||
} else {
|
||||
ControlLink link = new ControlLink(
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.project.up").
|
||||
localize());
|
||||
return link;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class DownCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getComponent(
|
||||
Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int col) {
|
||||
|
||||
SciOrganization orga = (SciOrganization) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
SciOrganizationProjectsCollection projects = orga.getProjects();
|
||||
|
||||
if ((projects.size() - 1) == row) {
|
||||
Label label = new Label("");
|
||||
return label;
|
||||
} else {
|
||||
ControlLink link = new ControlLink(
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.project.down").
|
||||
localize());
|
||||
return link;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cellSelected(TableActionEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
|
||||
SciProject project = new SciProject(
|
||||
new BigDecimal(event.getRowKey().toString()));
|
||||
|
||||
SciOrganization orga =
|
||||
(SciOrganization) m_itemModel.getSelectedObject(state);
|
||||
|
||||
SciOrganizationProjectsCollection projects =
|
||||
orga.getProjects();
|
||||
|
||||
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||
|
||||
if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
||||
orga.removeProject(project);
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
|
||||
projects.swapWithPrevious(project);
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
|
||||
projects.swapWithNext(project);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void headSelected(TableActionEvent event) {
|
||||
//Nothing to do.
|
||||
}
|
||||
}
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
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;
|
||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
|
||||
/**
|
||||
* Step for editing the basic properties of a {@link SciOrganization}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciOrganizationPropertiesStep
|
||||
extends GenericOrganizationalUnitPropertiesStep {
|
||||
|
||||
public SciOrganizationPropertiesStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
super(itemModel, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addBasicProperties(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
|
||||
parent,
|
||||
EDIT_SHEET_NAME);
|
||||
|
||||
BasicPageForm editBasicSheet =
|
||||
new SciOrganizationPropertyForm(itemModel, this);
|
||||
|
||||
basicProperties.add(EDIT_SHEET_NAME,
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.edit_basic_sheet").localize(),
|
||||
new WorkflowLockedComponentAccess(editBasicSheet,
|
||||
itemModel),
|
||||
editBasicSheet.getSaveCancelSection().
|
||||
getCancelButton());
|
||||
|
||||
basicProperties.setDisplayComponent(
|
||||
getSciOrganizationPropertySheet(itemModel));
|
||||
|
||||
getSegmentedPanel().addSegment(
|
||||
new Label((String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.basic_properties").
|
||||
localize()),
|
||||
basicProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addSteps(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
//super.addSteps(itemModel, parent);
|
||||
|
||||
SciOrganizationConfig config;
|
||||
config = SciOrganization.getConfig();
|
||||
|
||||
if (!config.getOrganizationAddContactHide()) {
|
||||
addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
|
||||
parent),
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.contacts"));
|
||||
}
|
||||
|
||||
/* This steps are now separate steps in the left box.
|
||||
if (!config.getOrganizationAddPersonHide()) {
|
||||
addStep(new SciOrganizationMemberStep(itemModel,
|
||||
parent),
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization_members"));
|
||||
}
|
||||
|
||||
if (!config.getOrganizationAddDepartmentHide()) {
|
||||
addStep(new SciOrganizationDepartmentsStep(itemModel, parent),
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.departments"));
|
||||
}
|
||||
|
||||
if (!config.getOrganizationAddProjectHide()) {
|
||||
addStep(new SciOrganizationProjectsStep(itemModel, parent),
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.organization.projects"));
|
||||
}*/
|
||||
}
|
||||
|
||||
public static Component getSciOrganizationPropertySheet(
|
||||
ItemSelectionModel itemModel) {
|
||||
DomainObjectPropertySheet sheet = (DomainObjectPropertySheet) GenericOrganizationalUnitPropertiesStep.
|
||||
getGenericOrganizationalUnitPropertySheet(itemModel);
|
||||
|
||||
sheet.add(SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganizations.ui.organization.shortdescription"),
|
||||
SciOrganization.ORGANIZATION_SHORT_DESCRIPTION);
|
||||
|
||||
return sheet;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.event.FormInitListener;
|
||||
import com.arsdigita.bebop.event.FormProcessListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.form.TextArea;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.SciOrganization;
|
||||
|
||||
/**
|
||||
* Form for editing the basic properties of a {@link SciOrganization}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciOrganizationPropertyForm
|
||||
extends GenericOrganizationalUnitPropertyForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener,
|
||||
FormSubmissionListener {
|
||||
|
||||
public static final String ID = "SciOrganizationEdit";
|
||||
|
||||
public SciOrganizationPropertyForm(ItemSelectionModel itemModel) {
|
||||
this(itemModel, null);
|
||||
}
|
||||
|
||||
public SciOrganizationPropertyForm(ItemSelectionModel itemModel,
|
||||
SciOrganizationPropertiesStep step) {
|
||||
super(itemModel, step);
|
||||
addSubmissionListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
super.addWidgets();
|
||||
|
||||
Label descLabel = new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganizations.ui.organization.shortdescription"));
|
||||
add(descLabel);
|
||||
ParameterModel descParam = new StringParameter(
|
||||
SciOrganization.ORGANIZATION_SHORT_DESCRIPTION);
|
||||
TextArea desc = new TextArea(descParam);
|
||||
desc.addValidationListener(new StringInRangeValidationListener(0, 500));
|
||||
desc.setCols(75);
|
||||
desc.setRows(5);
|
||||
add(desc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||
super.init(fse);
|
||||
|
||||
FormData data = fse.getFormData();
|
||||
SciOrganization orga = (SciOrganization) super.initBasicWidgets(fse);
|
||||
|
||||
data.put(SciOrganization.ORGANIZATION_SHORT_DESCRIPTION,
|
||||
orga.getOrganizationShortDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FormSectionEvent fse) throws FormProcessException {
|
||||
super.process(fse);
|
||||
|
||||
FormData data = fse.getFormData();
|
||||
SciOrganization organization = (SciOrganization) super.
|
||||
processBasicWidgets(fse);
|
||||
|
||||
if ((organization != null) && getSaveCancelSection().getSaveButton().
|
||||
isSelected(fse.getPageState())) {
|
||||
|
||||
organization.setOrganizationShortDescription((String) data.get(
|
||||
SciOrganization.ORGANIZATION_SHORT_DESCRIPTION));
|
||||
|
||||
organization.save();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitleLabel() {
|
||||
return (String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganizations.ui.organization.title").localize();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,232 +0,0 @@
|
|||
sciorganization.ui.project.subprojects.none=No subprojects found
|
||||
sciorganization.ui.project.subproject=Subproject
|
||||
sciorganization.ui.project.subproject.remove=Remove subproject
|
||||
sciorganization.ui.project.subproject.up=Up
|
||||
sciorganization.ui.project.subproject.down=Down
|
||||
sciorganization.ui.project.subproject.confirm_remove=Are you sure to remove this department?
|
||||
sciorganization.ui.project.select_subproject=Select project to add as subproject
|
||||
sciorganization.ui.member.edit_basic_properties=Edit basic properties
|
||||
sciorganization.ui.member.associatedMember=Associated member?
|
||||
sciorganization.ui.member.formerMember=Former member?
|
||||
sciorganization.ui.project.edit_desc=Edit description
|
||||
sciorganization.ui.project.upload_desc=Upload description
|
||||
sciorganization.ui.project.desc=Project description
|
||||
sciorganization.ui.project.funding=Funding
|
||||
sciorganization.ui.organization.add_department=Add department
|
||||
sciorganization.ui.department.add_project=Add project
|
||||
sciorganization.ui.organization.add_project=Add project
|
||||
sciorganization.ui.department.edit_basic_properties=Edit basic properties
|
||||
sciorganization.ui.department.basic_properties=Basic properties
|
||||
sciorganization.ui.organization.edit_basic_sheet=Basic properties
|
||||
sciorganization.ui.organization.basic_properties=Basic properties
|
||||
sciorganization.ui.project.begin=Start of project
|
||||
sciorganization.ui.project.end=End of project
|
||||
sciorganization.ui.project.shortdesc=Short description
|
||||
sciorganization.ui.project.edit_basic_sheet=Basic properties
|
||||
sciorganization.ui.project.basic_properties=Basis properties
|
||||
sciorganization.ui.department.add_subdepartment=Add subdepartment
|
||||
sciorganization.ui.organization.departments.none=No departments found
|
||||
sciorganization.ui.organization.department=Department
|
||||
sciorganization.ui.organization.department.remove=Remove department
|
||||
sciorganization.ui.organization.department.up=Up
|
||||
sciorganization.ui.organization.department.down=Down
|
||||
sciorganization.ui.organization.department.confirm_remove=Are you sure to remove this department?
|
||||
sciorganization.ui.department.projects.none=No projects found
|
||||
sciorganization.ui.department.project=Project
|
||||
sciorganization.ui.department.project.remove=Remove project
|
||||
sciorganization.ui.department.project.up=Up
|
||||
sciorganization.ui.department.project.down=Down
|
||||
sciorganization.ui.department.project.confirm_remove=Are you sure to remove this project?
|
||||
sciorganization.ui.organization.select_department=Select department to add
|
||||
sciorganization.ui.organization.projects.none=No projects found
|
||||
sciorganization.ui.organization.project=Project
|
||||
sciorganization.ui.organization.project.remove=Remove project
|
||||
sciorganization.ui.organization.project.up=Up
|
||||
sciorganization.ui.organization.project.down=Down
|
||||
sciorganization.ui.organization.project.confirm_remove=Are you sure to remove this project?
|
||||
sciorganization.ui.project.addSubProject=Add subproject
|
||||
sciorganization.ui.department.select_project=Select project to add
|
||||
sciorganization.ui.organization.select_project=Select project to add
|
||||
sciorganization.ui.department.subdepartments.none=No subdepartments found
|
||||
sciorganization.ui.department.subdepartment=Subdepartment
|
||||
sciorganization.ui.department.subdepartment.remove=Remove subdepartment
|
||||
sciorganization.ui.department.subdepartment.up=Up
|
||||
sciorganization.ui.department.subdepartment.down=Down
|
||||
sciorganization.ui.department.subdepartment.confirm_remove=Are you sure to remove this subdepartment?
|
||||
sciorganizations.ui.department.shortdescription=Short description
|
||||
sciorganizations.ui.organization.shortdescription=Short description
|
||||
sciorganization.ui.department.select_subdepartment=Select subdepartment to add
|
||||
sciorganization.ui.department.add_member=Add member
|
||||
sciorganizations.ui.project.shortdesc=Short description
|
||||
sciorganization.ui.project.addDepartment=Add involved department
|
||||
sciorganization.ui.project.addOrga=Add involved organization
|
||||
sciorganization.ui.project.departments.none=No involved departments found
|
||||
sciorganization.ui.project.department=Involved department
|
||||
sciorganization.ui.project.department.remove=Remove involved department
|
||||
sciorganization.ui.project.department.up=Up
|
||||
sciorganization.ui.project.department.down=Down
|
||||
sciorganization.ui.project.organization.confirm_remove=Are you sure to remove this involved organization?
|
||||
sciorganization.ui.project.select_organization=Select organization to add
|
||||
sciorganization.ui.project.organization.none=No involved organizations found
|
||||
sciorganization.ui.project.organization=Involved organization
|
||||
sciorganization.ui.project.organization.remove=Remove involved organization
|
||||
sciorganization.ui.project.organization.up=Up
|
||||
sciorganization.ui.project.organization.down=Down
|
||||
sciorganization.ui.project.select_department=Select department to add
|
||||
sciorganization.ui.project.superproject_none=No superior project found
|
||||
sciorganization.ui.project.superproject=Superior project
|
||||
sciorganization.ui.project.superproject.remove=Remove superior project
|
||||
sciorganization.ui.project.superproject.confirm_remove=Are you sure to remove this superior project?
|
||||
sciorganization.ui.department.select_superdepartment=Superior department
|
||||
sciorganization.ui.project.setSuperProject=Set superior project
|
||||
sciorganization.ui.project.description.upload=Upload project description
|
||||
sciorganization.ui.project.description.upload.mimetype=Type of file
|
||||
sciorganization.ui.organization.edit_desc=Edit description
|
||||
sciorganization.ui.organization.upload_desc=Upload description
|
||||
sciorganization.ui.organization.desc=Description
|
||||
sciorganization.ui.organization.description=Description
|
||||
sciorganization.ui.organization.description.upload=Upload description
|
||||
sciorganization.ui.organization.description.upload.mimetype=Type of file
|
||||
sciorganization.ui.project.select_superproject=Select superior project
|
||||
sciorganization.ui.department.setSuperDepartment=Set superior department
|
||||
sciorganization.ui.department.superdepartment_none=No superior department found
|
||||
sciorganization.ui.department.superdepartment=Superior department
|
||||
sciorganization.ui.department.superdepartment.remove=Remove superior department
|
||||
sciorganization.ui.department.superdepartment.confirm_remove=Are you sure to remove the superior department?
|
||||
sciorganization.ui.department.setOrganization=Set organization
|
||||
sciorganization.ui.department.select_organization=Select organization
|
||||
sciorganization.ui.department.organization_none=No assigned organization found
|
||||
sciorganization.ui.department.organization=Organization
|
||||
sciorganization.ui.department.organization.remove=Remove assigned organization
|
||||
sciorganization.ui.department.organization.confirm_remove=Are you sure sure to remove to assigned organization?
|
||||
sciorganization.ui.department.edit_desc=Edit description
|
||||
sciorganization.ui.department.upload_desc=Upload description
|
||||
sciorganization.ui.department.desc=Description
|
||||
sciorganization.ui.department.description=Description
|
||||
sciorganization.ui.department.description.upload=Upload description
|
||||
sciorganization.ui.department.description.upload.mimetype=Type of file
|
||||
sciorganization.ui.orgnization.add_member=Add member
|
||||
sciorganization.ui.member.yes=Yes
|
||||
sciorganization.ui.member.no=No
|
||||
sciorganization.ui.organization.contacts=Contacts
|
||||
sciorganization.ui.organization_members=Members of the organization
|
||||
sciorganization.ui.organization.departments=Departments
|
||||
sciorganization.ui.organization.projects=Projects
|
||||
sciorganization.ui.organizsation_description.title=Description
|
||||
sciorganization.ui.organization.properties.title=Properties
|
||||
sciorganization.ui.organization.description.title=Description
|
||||
sciorganization.ui.department.properties.title=Properties
|
||||
sciorganization.ui.department.contacts=Contacts
|
||||
sciorganization.ui.department.members=Members of the department
|
||||
sciorganization.ui.department.subdepartments=Subdivisions
|
||||
sciorganization.ui.department.projects=Projects of the department
|
||||
sciorganization.ui.department.description.title=Description
|
||||
sciorganization.ui.project_properties.title=Properties
|
||||
sciorganization.ui.project.edit_basic_properties=Edit basic properties
|
||||
sciorganization.ui.project.contacts=Contacts
|
||||
sciorganization.ui.project.members=Members of the project
|
||||
sciorganization.ui.project.subprojects=Subprojects
|
||||
sciorganization.ui.project.organizations=Involved organizations
|
||||
sciorganization.ui.project.departments=Involved departments
|
||||
sciorganization.ui.project.publications=Publications of the project
|
||||
sciorganization.ui.project_description.title=Description
|
||||
sciorganization.ui.project.add_member\ =Add member
|
||||
sciorganization.ui.project.subproject..confirm_remove=Are you sure to remove this subproject?
|
||||
sciorganization.ui.project.superproject..confirm_remove=Are you sure to remove the superior project?
|
||||
sciorganization.ui.project.add_member=Add member
|
||||
sciorganization.ui.department.publications=Publications of the department
|
||||
sciorganizations.ui.department.title=Name of the department
|
||||
sciorganizations.ui.organization.title=Name of the organization
|
||||
sciorganizations.ui.project.title=Name of the project
|
||||
sciorganization.ui.project.funding_volume=Volume of funding
|
||||
scimember.ui.basic_properties=Basic properties
|
||||
scimember.ui.organization=Organization
|
||||
scimember.ui.organization.role=Role
|
||||
scimember.ui.organization.status=Status
|
||||
scimember.ui.organization.edit=Edit
|
||||
scimember.ui.organization.remove=Remove
|
||||
scimember.ui.organizations.edit_assoc=Edit association
|
||||
scimember.ui.organizations.remove=Remove assoication
|
||||
scimember.ui.organization.add=Add member to organization
|
||||
scimember.ui.organization.select_organization=Organization
|
||||
scimember.ui.organization.confirm_remove=Do you really want to remove this association?
|
||||
scimember.ui.departments=Departments
|
||||
scimember.ui.projects=Projects
|
||||
scimember.ui.organizations=Organizations
|
||||
scimember.ui.department=Department
|
||||
scimember.ui.department.role=Role
|
||||
scimember.ui.department.status=Status
|
||||
scimember.ui.department.edit=Edit
|
||||
scimember.ui.department.remove=Remove
|
||||
scimember.ui.departments.edit_assoc=Edit association
|
||||
scimember.ui.departments.remove=Remove association
|
||||
scimember.ui.department.add=Add member to department
|
||||
scimember.ui.organizations.none=This member is not associated to any organization
|
||||
scimember.ui.departments.none=This member is not associated to any department
|
||||
scimember.ui.projects.none=This member is not associated to any project
|
||||
scimember.ui.project.add=Add member to project
|
||||
scimember.ui.project=Project
|
||||
scimember.ui.project.role=Role
|
||||
scimember.ui.project.status=Status
|
||||
scimember.ui.project.edit=Edit
|
||||
scimember.ui.project.remove=Remove
|
||||
scimember.ui.project.edit_assoc=Edit association
|
||||
scimember.ui.projects.remove=Remove association
|
||||
scimember.ui.department.select_department=Department
|
||||
scimember.ui.department.confirm_remove=Do you really want to remove this association?
|
||||
scimember.ui.project.confirm_remove=Do you really want to remove this association?
|
||||
scimember.ui.project.select_project=Project
|
||||
scimember.ui.projects.edit_assoc=Edit association
|
||||
sciorganization.ui.project.description=Description of project
|
||||
sciorganization.ui.organization.department.add.no_suitable_language_variant=The selected item has no language variant for the language of the current item. Please add an suitable language variant to the item to add before adding it.
|
||||
sciorganization.ui.department.organization.add.no_suitable_language_variant=The selected item has no language variant for the language of the current item. Please add an suitable language variant to the item to add before adding it.
|
||||
sciorganization.ui.organization.department.add.already_added=The selected department has already been added to the current organization.
|
||||
sciorganization.ui.organization.department.add.no_department_selected=No department selected.
|
||||
sciorganization.ui.department.organization.add.no_organization_selected=No organization selected.
|
||||
sciorganization.ui.department.select_project.no_project_selected=No project selected.
|
||||
sciorganization.ui.department.select_project.no_suitable_language_variant=The select project is no available for the language of the current department item..
|
||||
sciorganization.ui.department.select_project.already_added=The selected project has already been added to the projects of the current department item.
|
||||
sciorganization.ui.department.select_subdepartment.no_department_selected=No department selected.
|
||||
sciorganization.ui.department.select_subdepartment.no_suitable_language_variant=The selected department to add as subdepartment is not available for the language of the current department.
|
||||
sciorganization.ui.department.select_subdepartment.adding_to_itself=It is not possible to add a department to itself as a sub department.
|
||||
sciorganization.ui.department.select_subdepartment.already_added=The selected department is already an sub department of the current department.
|
||||
sciorganization.ui.department.select_superdepartment.no_department_selected=No department selected.
|
||||
sciorganization.ui.department.select_superdepartment.no_suitable_language_variant=The department selected to set as super department is not available in the language of the current department.
|
||||
sciorganization.ui.department.select_superdepartment.same_department=It is not possible to set the super department of a department to itself.
|
||||
scimember.ui.department.select_department.no_department_selected=No department selected.
|
||||
scimember.ui.department.select_department.no_suitable_language_variant=The department to add is not available for the language of the current member item.
|
||||
scimember.ui.department.select_department.already_added=The current member is already a member of the selected department.
|
||||
scimember.ui.organization.select_organization.no_orga_selected=No organization selected.
|
||||
scimember.ui.organization.select_organization.no_suitable_language_variant=The selected organization is not available for the language of the current member item.
|
||||
scimember.ui.organization.select_organization.already_added=The current member is already a member of the selected organization.
|
||||
scimember.ui.project.select_project.no_project_selected=No project selected.
|
||||
scimember.ui.project.select_project.no_suitable_language_variant=The selected project is not available for the language of the current member item.
|
||||
scimember.ui.project.select_project.already_added=The current member is already a member of the selected project.
|
||||
sciorganization.ui.organization.select_project.no_project_selected=No project selected.
|
||||
sciorganization.ui.organization.select_project.no_suitable_language_variant=The selected project is not available for the language of the current organization item.
|
||||
sciorganization.ui.organization.select_project.already_added=The selected project is already a project of the current organization.
|
||||
sciorganization.ui.project.select_department.no_department_selected=No department selected.
|
||||
sciorganization.ui.project.select_department.no_suitable_language_variant=The selected department is not available for the language of the current project item.
|
||||
sciorganization.ui.project.select_department.already_added=The current project is already a project of the selected department.
|
||||
sciorganization.ui.project.select_organization.no_organization_selected=No organization selected.
|
||||
sciorganization.ui.project.select_organization.no_suitable_language_variant=The selected organization is not available for the language of the current project item.
|
||||
sciorganization.ui.project.select_organization.already_added=The current project is already a project of the selected organization.
|
||||
sciorganization.ui.project.select_subproject.no_project_selected=No project selected.
|
||||
sciorganization.ui.project.select_subproject.no_suitable_language_variant=The selected sub project is not available for the language of the current project.
|
||||
sciorganization.ui.project.select_subproject.same_project=A project can't be a sub project of itself.
|
||||
sciorganization.ui.project.select_subproject.already_added=The selected project is already a sub project of the current project.
|
||||
sciorganization.ui.project.select_superproject.no_project_selected=No project selected.
|
||||
sciorganization.ui.project.select_superproject.no_suitable_language_variant=The selected super project is not available for the language of the current project item.
|
||||
sciorganization.ui.project.select_superproject.same_project=A project can't be the super project of itself.
|
||||
sciorganization.ui.selectDepartment.no_department_selected=No department selected.
|
||||
sciorganization.ui.selectDepartment.no_suitable_language_variant=The selected department is not avaiable for the language of the current publication item.
|
||||
sciorganization.ui.selectDepartment.already_added=The current publications has already been added to the list of publications of the selected department.
|
||||
sciorganization.ui.selectOrganization.no_orga_selected=No organization selected.
|
||||
sciorganization.ui.selectOrganization.no_suitable_language_variant=The selected organization is not avaiable for the language of the current publication item.
|
||||
sciorganization.ui.selectOrganization.already_added=The current publication has already been added to the list of publications of the selected organization.
|
||||
sciorganization.ui.selectProject.no_project_selected=No project selected.
|
||||
sciorganization.ui.selectProject.no_suitable_language_variant=The selected project is not available for the language of the current publication item.
|
||||
sciorganization.ui.selectProject.already_added=The current publications has already been added to the publication list of the selected project.
|
||||
sciorganization.ui.selectPublication.no_publication_selected=No publication selected.
|
||||
sciorganization.ui.selectPublication.no_suitable_language_variant=The selected publication is not available for the language of the current item.
|
||||
sciorganization.ui.selectPublication.already_added=The selected publication has already been added to the publication list of the current item.
|
||||
|
|
@ -1,232 +0,0 @@
|
|||
sciorganization.ui.project.subprojects.none=Keine Unterprojekte gefunden
|
||||
sciorganization.ui.project.subproject=Unterprojekt
|
||||
sciorganization.ui.project.subproject.remove=Unterprojekt entfernen
|
||||
sciorganization.ui.project.subproject.up=Hoch
|
||||
sciorganization.ui.project.subproject.down=Runter
|
||||
sciorganization.ui.project.subproject.confirm_remove=Wollen sie dieses Unterprojekt wirklich entfernen?
|
||||
sciorganization.ui.project.select_subproject=Projekt zum Hinzuf\u00fcgen als Unterprojekt ausw\u00e4hlen
|
||||
sciorganization.ui.member.edit_basic_properties=Basiseigenschaften bearbeiten
|
||||
sciorganization.ui.member.associatedMember=Assoziertes Mitglied?
|
||||
sciorganization.ui.member.formerMember=Ehemaliges Mitglied?
|
||||
sciorganization.ui.project.edit_desc=Beschreibung bearbeiten
|
||||
sciorganization.ui.project.upload_desc=Beschreibung hochladen
|
||||
sciorganization.ui.project.desc=Projektbeschreibung
|
||||
sciorganization.ui.project.funding=Finanzierung
|
||||
sciorganization.ui.organization.add_department=Abteilung hinzuf\u00fcgen
|
||||
sciorganization.ui.department.add_project=Projekt hinzuf\u00fcgen
|
||||
sciorganization.ui.organization.add_project=Projekt hinzuf\u00fcgen
|
||||
sciorganization.ui.department.edit_basic_properties=Basiseigenschaften bearbeiten
|
||||
sciorganization.ui.department.basic_properties=Basiseigenschaften
|
||||
sciorganization.ui.organization.edit_basic_sheet=Basiseigenschaften
|
||||
sciorganization.ui.organization.basic_properties=Basiseigenschaften
|
||||
sciorganization.ui.project.begin=Begin des Projektes
|
||||
sciorganization.ui.project.end=Ende des Projektes
|
||||
sciorganization.ui.project.shortdesc=Kurzbeschreibung
|
||||
sciorganization.ui.project.edit_basic_sheet=Basiseigenschaften
|
||||
sciorganization.ui.project.basic_properties=Basiseigenschaften
|
||||
sciorganization.ui.department.add_subdepartment=Unterabteilung hinzuf\u00fcgen
|
||||
sciorganization.ui.organization.departments.none=Keine Abteilungen gefunden
|
||||
sciorganization.ui.organization.department=Abteilung
|
||||
sciorganization.ui.organization.department.remove=Abteilung entfernen
|
||||
sciorganization.ui.organization.department.up=Hoch
|
||||
sciorganization.ui.organization.department.down=Runter
|
||||
sciorganization.ui.organization.department.confirm_remove=Wollen sie diese Abteilung wirklich entfernen?
|
||||
sciorganization.ui.department.projects.none=Keine Projekte gefunden
|
||||
sciorganization.ui.department.project=Projekt
|
||||
sciorganization.ui.department.project.remove=Projekt entfernen
|
||||
sciorganization.ui.department.project.up=Hoch
|
||||
sciorganization.ui.department.project.down=Runter
|
||||
sciorganization.ui.department.project.confirm_remove=Wollen sie dieses Projekt wirklich entfernen?
|
||||
sciorganization.ui.organization.select_department=Abteilung zum hinzuf\u00fcgen ausw\u00e4hlen
|
||||
sciorganization.ui.organization.projects.none=Keine Projekte gefunden
|
||||
sciorganization.ui.organization.project=Projekt
|
||||
sciorganization.ui.organization.project.remove=Projekt entfernen
|
||||
sciorganization.ui.organization.project.up=Hoch
|
||||
sciorganization.ui.organization.project.down=Runter
|
||||
sciorganization.ui.organization.project.confirm_remove=Wollen sie dieses Projekt wirklich entfernen?
|
||||
sciorganization.ui.project.addSubProject=Unterprojekt hinzuf\u00fcgen
|
||||
sciorganization.ui.department.select_project=Projekt zum hinzuf\u00fcgen ausw\u00e4hlen
|
||||
sciorganization.ui.organization.select_project=Projekt zum hinzuf\u00fcgen ausw\u00e4hlen
|
||||
sciorganization.ui.department.subdepartments.none=Keine Unterabteilungen gefunden
|
||||
sciorganization.ui.department.subdepartment=Unterabteilung
|
||||
sciorganization.ui.department.subdepartment.remove=Unterabteilung entfernen
|
||||
sciorganization.ui.department.subdepartment.up=Hoch
|
||||
sciorganization.ui.department.subdepartment.down=Runter
|
||||
sciorganization.ui.department.subdepartment.confirm_remove=Wollen sie diese Unterabteilung wirklich entfernen
|
||||
sciorganizations.ui.department.shortdescription=Kurzbeschreibung
|
||||
sciorganizations.ui.organization.shortdescription=Kurzbeschreibung
|
||||
sciorganization.ui.department.select_subdepartment=Unterabteilung zum hinzuf\u00fcgen ausw\u00e4hlen
|
||||
sciorganization.ui.department.add_member=Mitglied hinzuf\u00fcgen
|
||||
sciorganizations.ui.project.shortdesc=Kurzbeschreibung
|
||||
sciorganization.ui.project.addDepartment=Beteiligte Abteilung hinzuf\u00fcgen
|
||||
sciorganization.ui.project.addOrga=Beteiligte Organization hinzuf\u00fcgen
|
||||
sciorganization.ui.project.departments.none=Keine beteiligen Abteilungen gefunden
|
||||
sciorganization.ui.project.department=Beteiligte Abteilung
|
||||
sciorganization.ui.project.department.remove=Beteiligte Abteilung entfernen
|
||||
sciorganization.ui.project.department.up=Hoch
|
||||
sciorganization.ui.project.department.down=Runter
|
||||
sciorganization.ui.project.organization.confirm_remove=Wollen diese beteiligte Organization wirklich entfernen?
|
||||
sciorganization.ui.project.select_organization=Organisation zum hinzuf\u00fcgen ausw\u00e4hlen
|
||||
sciorganization.ui.project.organization.none=Keine beteiligten Organisationen gefunden
|
||||
sciorganization.ui.project.organization=Beteiligte Organisation
|
||||
sciorganization.ui.project.organization.remove=Beteiligte Organisation entfernen
|
||||
sciorganization.ui.project.organization.up=Hoch
|
||||
sciorganization.ui.project.organization.down=Runter
|
||||
sciorganization.ui.project.select_department=Abteilung zum hinzuf\u00fcgen ausw\u00e4hlen
|
||||
sciorganization.ui.project.superproject_none=Kein \u00fcbergeordnetes Projekt gefunden
|
||||
sciorganization.ui.project.superproject=\u00dcbergeordnetes Projekt
|
||||
sciorganization.ui.project.superproject.remove=\u00dcbergeordnetes Projekt entfernen
|
||||
sciorganization.ui.project.superproject.confirm_remove=Wollen sie dieses \u00fcbergeordnete Projekt wirklich entfernen?
|
||||
sciorganization.ui.department.select_superdepartment=\u00dcbergeordnete Abteilung
|
||||
sciorganization.ui.project.setSuperProject=\u00dcbergeordnetes Projekt setzen
|
||||
sciorganization.ui.project.description.upload=Projektbeschreibung hochladen
|
||||
sciorganization.ui.project.description.upload.mimetype=Dateityp
|
||||
sciorganization.ui.organization.edit_desc=Beschreibung bearbeiten
|
||||
sciorganization.ui.organization.upload_desc=Beschreibung hochladen
|
||||
sciorganization.ui.organization.desc=Beschreibung
|
||||
sciorganization.ui.organization.description=Beschreibung
|
||||
sciorganization.ui.organization.description.upload=Beschriebung hochladen
|
||||
sciorganization.ui.organization.description.upload.mimetype=Dateityp
|
||||
sciorganization.ui.project.select_superproject=\u00dcbergeordnetes Projekt ausw\u00e4hlen
|
||||
sciorganization.ui.department.setSuperDepartment=\u00dcbergeordnete Abteilung setzen
|
||||
sciorganization.ui.department.superdepartment_none=Keine \u00fcbergeordnete Abteilung gefunden
|
||||
sciorganization.ui.department.superdepartment=\u00dcbergeordnete Abteilung
|
||||
sciorganization.ui.department.superdepartment.remove=\u00dcbergeordnete Abteilung entfernen
|
||||
sciorganization.ui.department.superdepartment.confirm_remove=Wollen sie die \u00fcbergeordnete Abteilung wirklich entfernen?
|
||||
sciorganization.ui.department.setOrganization=Organization setzen
|
||||
sciorganization.ui.department.select_organization=Organization ausw\u00e4hlen
|
||||
sciorganization.ui.department.organization_none=Keine zugeordnete Organization gefunden
|
||||
sciorganization.ui.department.organization=Organisation
|
||||
sciorganization.ui.department.organization.remove=Zugeordnete Organisation entfernen
|
||||
sciorganization.ui.department.organization.confirm_remove=Wollen sie zugeordnete Organisation wirklich entfernen?
|
||||
sciorganization.ui.department.edit_desc=Beschreibung bearbeiten
|
||||
sciorganization.ui.department.upload_desc=Beschreibung hochladen
|
||||
sciorganization.ui.department.desc=Beschreibung
|
||||
sciorganization.ui.department.description=Beschreibung
|
||||
sciorganization.ui.department.description.upload=Beschreibung hochladen
|
||||
sciorganization.ui.department.description.upload.mimetype=Dateityp
|
||||
sciorganization.ui.orgnization.add_member=Mitglied hinzuf\u00fcgen
|
||||
sciorganization.ui.member.yes=Ja
|
||||
sciorganization.ui.member.no=Nein
|
||||
sciorganization.ui.organization.contacts=Kontakte
|
||||
sciorganization.ui.organization_members=Mitglieder der Organisation
|
||||
sciorganization.ui.organization.departments=Abteilungen
|
||||
sciorganization.ui.organization.projects=Projekte
|
||||
sciorganization.ui.organizsation_description.title=Beschreibung
|
||||
sciorganization.ui.organization.properties.title=Eigenschaften
|
||||
sciorganization.ui.organization.description.title=Beschreibung
|
||||
sciorganization.ui.department.properties.title=Eigenschaften
|
||||
sciorganization.ui.department.contacts=Kontakte
|
||||
sciorganization.ui.department.members=Mitglieder der Abteilung
|
||||
sciorganization.ui.department.subdepartments=Unterabteilungen
|
||||
sciorganization.ui.department.projects=Projekte der Abteilung
|
||||
sciorganization.ui.department.description.title=Beschreibung
|
||||
sciorganization.ui.project_properties.title=Eigenschaften
|
||||
sciorganization.ui.project.edit_basic_properties=Basiseigenschaften bearbeiten
|
||||
sciorganization.ui.project.contacts=Kontakte
|
||||
sciorganization.ui.project.members=Mitglieder des Projektes
|
||||
sciorganization.ui.project.subprojects=Unterprojekte
|
||||
sciorganization.ui.project.organizations=Beteiligte Organisationen
|
||||
sciorganization.ui.project.departments=Beteiligte Abteilungen
|
||||
sciorganization.ui.project.publications=Publikationen des Projektes
|
||||
sciorganization.ui.project_description.title=Beschreibung
|
||||
sciorganization.ui.project.add_member\ =Mitglied hinzuf\u00fcgen
|
||||
sciorganization.ui.project.subproject..confirm_remove=Sind sie sicher das sie dieses Unterprojekt entfernen wollen?
|
||||
sciorganization.ui.project.superproject..confirm_remove=Wollen sie dieses \u00fcbergeordnete Projekt wirklich entfernen?
|
||||
sciorganization.ui.project.add_member=Mitglied hinzuf\u00fcgen
|
||||
sciorganization.ui.department.publications=Publikationen der Abteilung
|
||||
sciorganizations.ui.department.title=Bezeichnung der Abteilung
|
||||
sciorganizations.ui.organization.title=Name der Organisation
|
||||
sciorganizations.ui.project.title=Name des Projektes
|
||||
sciorganization.ui.project.funding_volume=Volumen der Finanzierung
|
||||
scimember.ui.basic_properties=Basiseigenschaften
|
||||
scimember.ui.organization=Organisation
|
||||
scimember.ui.organization.role=Rolle
|
||||
scimember.ui.organization.status=Status
|
||||
scimember.ui.organization.edit=Bearbeiten
|
||||
scimember.ui.organization.remove=Entfernen
|
||||
scimember.ui.organizations.edit_assoc=Verkn\u00fcpfung bearbeiten
|
||||
scimember.ui.organizations.remove=Verkn\u00fcpfung entfernen
|
||||
scimember.ui.organization.add=Mitglied einer Organisation hinzuf\u00fcgen
|
||||
scimember.ui.organization.select_organization=Organisation
|
||||
scimember.ui.organization.confirm_remove=Wollen Sie diese Verkn\u00fcpfung wirklich entfernen?
|
||||
scimember.ui.departments=Abteilungen
|
||||
scimember.ui.projects=Projekte
|
||||
scimember.ui.organizations=Organisationen
|
||||
scimember.ui.department=Abteilung
|
||||
scimember.ui.department.role=Rolle
|
||||
scimember.ui.department.status=Status
|
||||
scimember.ui.department.edit=Bearbeiten
|
||||
scimember.ui.department.remove=Entfernen
|
||||
scimember.ui.departments.edit_assoc=Verkn\u00fcpfung bearbeiten
|
||||
scimember.ui.departments.remove=Verkn\u00fcpfung entfernen
|
||||
scimember.ui.department.add=Mitglied einer Abteilung hinzuf\u00fcgen
|
||||
scimember.ui.organizations.none=Dieses Mitglied ist keinen Organisationen zugeordnet
|
||||
scimember.ui.departments.none=Dieses Mitglied ist keinen Abteilungen zugeordnet
|
||||
scimember.ui.projects.none=Dieses Mitglied ist keinen Projekten zugeordnet
|
||||
scimember.ui.project.add=Mitglied einem Projekt hinzuf\u00fcgen
|
||||
scimember.ui.project=Projekt
|
||||
scimember.ui.project.role=Rolle
|
||||
scimember.ui.project.status=Status
|
||||
scimember.ui.project.edit=Bearbeiten
|
||||
scimember.ui.project.remove=Entfernen
|
||||
scimember.ui.project.edit_assoc=Verkn\u00fcpfung bearbeiten
|
||||
scimember.ui.projects.remove=Verkn\u00fcpfung entfernen
|
||||
scimember.ui.department.select_department=Abteilung
|
||||
scimember.ui.department.confirm_remove=Wollen Sie diese Verkn\u00fcpfung wirklich entfernen?
|
||||
scimember.ui.project.confirm_remove=Wollen Sie diese Verkn\u00fcpfung wirklich entfernen?
|
||||
scimember.ui.project.select_project=Projekt
|
||||
scimember.ui.projects.edit_assoc=Verkn\u00fcpfung bearbeiten
|
||||
sciorganization.ui.project.description=Projektbeschreibung
|
||||
sciorganization.ui.organization.department.add.no_suitable_language_variant=Das ausgew\u00e4hlte ContentItem besitzt keine Sprachvariante f\u00fcr die Sprache dieses Items und kann daher nicht hinzugef\u00fcgt werden.
|
||||
sciorganization.ui.department.organization.add.no_suitable_language_variant=Das ausgew\u00e4hlte ContentItem besitzt keine Sprachvariante f\u00fcr die Sprache dieses Items und kann daher nicht hinzugef\u00fcgt werden.
|
||||
sciorganization.ui.organization.department.add.already_added=Die ausgew\u00e4hlte Abteilung wurde der aktuellen Organisation bereits hinzugef\u00fcgt.
|
||||
sciorganization.ui.organization.department.add.no_department_selected=Keine Abteilung ausgew\u00e4hlt.
|
||||
sciorganization.ui.department.organization.add.no_organization_selected=Keine Organisation ausgew\u00e4hlt.
|
||||
sciorganization.ui.department.select_project.no_project_selected=Kein Project ausgew\u00e4hlt.
|
||||
sciorganization.ui.department.select_project.no_suitable_language_variant=Das ausgew\u00e4hlte Projekt ist f\u00fcr die Sprache des aktuellen Abteilungs-Items nicht verf\u00fcgbar.
|
||||
sciorganization.ui.department.select_project.already_added=Das ausgew\u00e4hlte Projekt wurde dem aktuellen Abteilungs-Item bereits hinzugef\u00fcgt.
|
||||
sciorganization.ui.department.select_subdepartment.no_department_selected=Keine Abteilung ausgew\u00e4hlt.
|
||||
sciorganization.ui.department.select_subdepartment.no_suitable_language_variant=Die zum hinzuf\u00fcgen als Unterabteilung ausw\u00e4hlte Abteilung ist f\u00fcr die Sprache der aktuellen Abteilung nicht verf\u00fcgbar.
|
||||
sciorganization.ui.department.select_subdepartment.adding_to_itself=Eine Abteilung kann nicht sich selbst als Unterabteilung zugewiesen werden.
|
||||
sciorganization.ui.department.select_subdepartment.already_added=Die ausgew\u00e4hlte Abteilung ist bereits eine Unterabteilung der aktuellen Abteilung.
|
||||
sciorganization.ui.department.select_superdepartment.no_department_selected=Keine Abteilung ausgew\u00e4hlt.
|
||||
sciorganization.ui.department.select_superdepartment.no_suitable_language_variant=Die als \u00fcbergeordnete Abteilung ausgew\u00e4hlte Abteilung ist nicht in der Sprache der aktuellen Abteilung verf\u00fcgbar.
|
||||
sciorganization.ui.department.select_superdepartment.same_department=Eine Abteilung kann nicht ihre eigene \u00fcbergeordnete Abteilung sein.
|
||||
scimember.ui.department.select_department.no_department_selected=Keine Abteilung ausgew\u00e4hlt.
|
||||
scimember.ui.department.select_department.no_suitable_language_variant=Die ausgew\u00e4hlte Abteilung ist nicht f\u00fcr die Sprache des aktuellen Mitglieds-Items verf\u00fcgbar.
|
||||
scimember.ui.department.select_department.already_added=Das aktuelle Mitglieder ist bereits ein Mitglied der ausgew\u00e4hlten Abteilung.
|
||||
scimember.ui.organization.select_organization.no_orga_selected=Keine Organisation ausgew\u00e4hlt.
|
||||
scimember.ui.organization.select_organization.no_suitable_language_variant=Die ausgew\u00e4hlte Organisation ist f\u00fcr die Sprache des aktuellen Mitglieds-Items nicht verf\u00fcgbar.
|
||||
scimember.ui.organization.select_organization.already_added=Das aktuelle Mitglied ist bereits Mitglied der ausgew\u00e4hlten Organisation.
|
||||
scimember.ui.project.select_project.no_project_selected=Kein Projekt ausgew\u00e4hlt.
|
||||
scimember.ui.project.select_project.no_suitable_language_variant=Das ausgew\u00e4hlte Projekt ist f\u00fcr die Sprache des aktuellen Mitglieds-Items nicht verf\u00fcgbar.
|
||||
scimember.ui.project.select_project.already_added=Das aktuelle Mitglied ist bereits ein Mitglied des ausgew\u00e4hlten Projektes.
|
||||
sciorganization.ui.organization.select_project.no_project_selected=Kein Projekt ausgew\u00e4hlt.
|
||||
sciorganization.ui.organization.select_project.no_suitable_language_variant=Das ausgew\u00e4hlte Projekt ist nicht f\u00fcr die Sprache des aktuellen Organisations-Items verf\u00fcgbar.
|
||||
sciorganization.ui.organization.select_project.already_added=Das ausgew\u00e4hlte Projekt ist bereits ein Projekt der aktuellen Organisation.
|
||||
sciorganization.ui.project.select_department.no_department_selected=Kein Projekt ausgew\u00e4hlt.
|
||||
sciorganization.ui.project.select_department.no_suitable_language_variant=Die ausgew\u00e4hlte Abteilung ist nicht f\u00fcr die Sprache des aktuellen Projekt-Items verf\u00fcgbar.
|
||||
sciorganization.ui.project.select_department.already_added=Das aktuelle Projekt ist bereits ein Projekt der ausgew\u00e4hlten Abteilung.
|
||||
sciorganization.ui.project.select_organization.no_organization_selected=Keine Organisation ausgew\u00e4hlt.
|
||||
sciorganization.ui.project.select_organization.no_suitable_language_variant=Die ausgew\u00e4hlte Organisation ist nicht f\u00fcr die Sprache des aktuellen Projekt-Items verf\u00fcgbar.
|
||||
sciorganization.ui.project.select_organization.already_added=Das aktuelle Projekt is bereits ein Projekt der der ausgew\u00e4hlten Organisation.
|
||||
sciorganization.ui.project.select_subproject.no_project_selected=Kein Projekt ausgew\u00e4hlt.
|
||||
sciorganization.ui.project.select_subproject.no_suitable_language_variant=Das ausgew\u00e4hlte Unterprojekt ist nicht f\u00fcr die Sprache des aktuellen Projektes verf\u00fcgbar.
|
||||
sciorganization.ui.project.select_subproject.same_project=Ein Projekt kann kein Unterprojekt von sich selbst sein.
|
||||
sciorganization.ui.project.select_subproject.already_added=Das ausgew\u00e4hlte Projekt ist bereits ein Unterprojekt des aktuellen Projektes.
|
||||
sciorganization.ui.project.select_superproject.no_project_selected=Kein Projekt ausgew\u00e4hlt.
|
||||
sciorganization.ui.project.select_superproject.no_suitable_language_variant=Das ausgew\u00e4hlte Hauptprojekt ist nicht f\u00fcr die Sprache des aktuellen Projektes verf\u00fcgbar.
|
||||
sciorganization.ui.project.select_superproject.same_project=Ein Projekt kann nicht sein eigenes Hauptprojekt sein.
|
||||
sciorganization.ui.selectDepartment.no_department_selected=Keine Abteilung ausgew\u00e4hlt.
|
||||
sciorganization.ui.selectDepartment.no_suitable_language_variant=Die ausgew\u00e4hlte Abteilung ist nicht f\u00fcr die Sprache des aktuellen Publikations-Items verf\u00fcgbar.
|
||||
sciorganization.ui.selectDepartment.already_added=Die aktuelle Publikation wurde bereits der Publikationsliste der ausgew\u00e4hlten Abteilung hinzugef\u00fcgt.
|
||||
sciorganization.ui.selectOrganization.no_orga_selected=Keine Organisation ausgew\u00e4hlt.
|
||||
sciorganization.ui.selectOrganization.no_suitable_language_variant=Die ausgew\u00e4hlte Organisation ist nicht f\u00fcr die Sprache der aktuellen Publikation verf\u00fcgbar.
|
||||
sciorganization.ui.selectOrganization.already_added=Die aktuelle Publikation wurde bereits der Liste der Publikationen der ausgew\u00e4hlten Organisation hinzugef\u00fcgt.
|
||||
sciorganization.ui.selectProject.no_project_selected=Kein Projekt ausgew\u00e4hlt.
|
||||
sciorganization.ui.selectProject.no_suitable_language_variant=Das ausgew\u00e4hlte Projekt ist nicht f\u00fcr die Sprache des aktuellen Publikations-Items verf\u00fcgbar.
|
||||
sciorganization.ui.selectProject.already_added=Die aktuelle Publikation wurde bereits der Publikationsliste des ausgew\u00e4hlten Projektes hinzugef\u00fcgt.
|
||||
sciorganization.ui.selectPublication.no_publication_selected=Keine Publikation ausgew\u00e4hlt.
|
||||
sciorganization.ui.selectPublication.no_suitable_language_variant=Die ausgew\u00e4hlte Publikation ist nicht f\u00fcr die Sprache des aktuellen Items verf\u00fcgbar.
|
||||
sciorganization.ui.selectPublication.already_added=Die ausgew\u00e4hlte Publikation ist bereits Teil der Publikationsliste des aktuellen Items.
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
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.SciProject;
|
||||
import com.arsdigita.cms.contenttypes.SciProjectDepartmentsCollection;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
|
||||
/**
|
||||
* Form for adding a link between a {@link SciProject} and a
|
||||
* {@link SciDepartment}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciProjectDepartmentAddForm
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener {
|
||||
|
||||
private ItemSearchWidget m_itemSearch;
|
||||
private final String ITEM_SEARCH = "projectDepartment";
|
||||
|
||||
public SciProjectDepartmentAddForm(ItemSelectionModel itemModel) {
|
||||
super("projectDepartmentAddForm", itemModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
add(new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.project.select_department")));
|
||||
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();
|
||||
SciProject project = (SciProject) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
|
||||
if (!(this.getSaveCancelSection().getCancelButton().
|
||||
isSelected(state))) {
|
||||
SciDepartment department = (SciDepartment) data.get(ITEM_SEARCH);
|
||||
department = (SciDepartment) department.getContentBundle().
|
||||
getInstance(project.getLanguage());
|
||||
|
||||
project.addDepartment(department);
|
||||
}
|
||||
|
||||
init(fse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.project.select_department.no_department_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
SciProject project = (SciProject) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
SciDepartment department = (SciDepartment) data.get(ITEM_SEARCH);
|
||||
if (!(department.getContentBundle().hasInstance(project.getLanguage()))) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.project.select_department.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
||||
department = (SciDepartment) department.getContentBundle().getInstance(project.
|
||||
getLanguage());
|
||||
SciProjectDepartmentsCollection departments = project.getDepartments();
|
||||
departments.addFilter(String.format("id = %s", department.getID().
|
||||
toString()));
|
||||
if (departments.size() > 0) {
|
||||
data.addError(
|
||||
SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.project.select_department.already_added"));
|
||||
}
|
||||
|
||||
departments.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
import com.arsdigita.cms.contenttypes.SciDepartment;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
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;
|
||||
|
||||
/**
|
||||
* Step for adding and removing links between a {@link SciProject} and a
|
||||
* {@link SciDepartment}.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class SciProjectDepartmentsStep extends SimpleEditStep {
|
||||
|
||||
private String PROJECT_ADD_DEPARTMENT_SHEET_NAME = "projectAddDepartment";
|
||||
|
||||
public SciProjectDepartmentsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public SciProjectDepartmentsStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent,
|
||||
String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addDepartmentForm =
|
||||
new SciProjectDepartmentAddForm(itemModel);
|
||||
add(PROJECT_ADD_DEPARTMENT_SHEET_NAME,
|
||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||
"sciorganization.ui.project.addDepartment").localize(),
|
||||
new WorkflowLockedComponentAccess(addDepartmentForm, itemModel),
|
||||
addDepartmentForm.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDisplayComponent(new SciProjectDepartmentsTable(itemModel));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue