Zweiter Teil der Dateien für ccm-sci-types-organizationwithpublications
git-svn-id: https://svn.libreccm.org/ccm/trunk@953 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
3669e85d11
commit
92fb740757
|
|
@ -0,0 +1,34 @@
|
||||||
|
model com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
import com.arsdigita.cms.*;
|
||||||
|
|
||||||
|
object type SciDepartmentWithPublications extends SciDepartment {
|
||||||
|
reference key ( ct_sciorga_departments_with_publications.department_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
association {
|
||||||
|
SciDepartment[0..n] departments = join ct_publications.publication_id
|
||||||
|
to ct_department_publication_map.publication_id,
|
||||||
|
join ct_department_publication_map.department_id
|
||||||
|
to ct_sciorga_departments_with_publications.department_id;
|
||||||
|
|
||||||
|
Publication[0..n] publications = join ct_sciorga_departments_with_publications.department_id
|
||||||
|
to ct_department_publication_map.department_id,
|
||||||
|
join ct_department_publication_map.publication_id
|
||||||
|
to ct_publications.publication_id;
|
||||||
|
|
||||||
|
Integer[0..1] publicationOrder = ct_department_publication_map.publication_order INTEGER;
|
||||||
|
}
|
||||||
|
|
||||||
|
query getIdsOfPublicationsOfSciDepartment {
|
||||||
|
BigDecimal publicationId;
|
||||||
|
|
||||||
|
do {
|
||||||
|
select ct_department_publication_map.publication_id
|
||||||
|
from ct_department_publication_map
|
||||||
|
where ct_department_publication_map.department_id = :department
|
||||||
|
} map {
|
||||||
|
publicationId = ct_department_publication_map.publication_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
model com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
import com.arsdigita.cms.*;
|
||||||
|
|
||||||
|
object type SciOrganizationWithPublications extends SciOrganization {
|
||||||
|
reference key ( ct_sciorga_organizations_with_publications.organization_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
association {
|
||||||
|
SciOrganization[0..n] organizations = join ct_publications.publication_id
|
||||||
|
to ct_organization_publication_map.publication_id,
|
||||||
|
join ct_organization_publication_map.organization_id
|
||||||
|
to ct_sciorga_organizations_with_publications.organization_id;
|
||||||
|
|
||||||
|
Publication[0..n] publications = join ct_sciorga_organizations_with_publications.organization_id
|
||||||
|
to ct_organization_publication_map.organization_id,
|
||||||
|
join ct_organization_publication_map.publication_id
|
||||||
|
to ct_publications.publication_id;
|
||||||
|
|
||||||
|
Integer[0..1] publicationOrder = ct_organization_publication_map.publication_order INTEGER;
|
||||||
|
}
|
||||||
|
|
||||||
|
query getIdsOfPublicationsOfSciOrganization {
|
||||||
|
BigDecimal publicationId;
|
||||||
|
|
||||||
|
do {
|
||||||
|
select ct_organization_publication_map.publication_id
|
||||||
|
from ct_organization_publication_map
|
||||||
|
where ct_organization_publication_map.organization_id = :organization
|
||||||
|
} map {
|
||||||
|
publicationId = ct_organization_publication_map.publication_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
model com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
import com.arsdigita.cms.*;
|
||||||
|
|
||||||
|
object type SciProjectWithPublications extends SciProject {
|
||||||
|
|
||||||
|
reference key ( ct_sciorga_projects_with_publications.project_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
association {
|
||||||
|
SciProject[0..n] projects = join ct_publications.publication_id
|
||||||
|
to ct_project_publication_map.publication_id,
|
||||||
|
join ct_project_publication_map.project_id
|
||||||
|
to ct_sciorga_projects_with_publications.project_id;
|
||||||
|
|
||||||
|
Publication[0..n] publications = join ct_sciorga_projects_with_publications.project_id
|
||||||
|
to ct_project_publication_map.project_id,
|
||||||
|
join ct_project_publication_map.publication_id
|
||||||
|
to ct_publications.publication_id;
|
||||||
|
|
||||||
|
Integer[0..1] publicationOrder = ct_project_publication_map.publication_order INTEGER;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
query getIdsOfPublicationsOfSciProject {
|
||||||
|
BigDecimal publicationId;
|
||||||
|
|
||||||
|
do {
|
||||||
|
select ct_project_publication_map.publication_id
|
||||||
|
from ct_project_publication_map
|
||||||
|
where ct_project_publication_map.project_id = :project
|
||||||
|
} map {
|
||||||
|
publicationId = ct_project_publication_map.publication_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?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="SciDepartment with association for publications"
|
||||||
|
objectType="com.arsdigita.cms.contenttypes.SciDepartmentWithPublications"
|
||||||
|
classname="com.arsdigita.cms.contenttypes.SciDepartmentWithPublications">
|
||||||
|
|
||||||
|
<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.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:authoring-step
|
||||||
|
labelKey = "sciorganizationpublication.ui.department.publications.title"
|
||||||
|
labelBundle = "com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"
|
||||||
|
descriptionKey = "sciorganizationpublication.ui.department.publications.description"
|
||||||
|
component = "com.arsdigita.cms.contenttypes.ui.SciDepartmentPublicationsStep"
|
||||||
|
ordering = "6"/>
|
||||||
|
|
||||||
|
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||||
|
|
||||||
|
</ctd:authoring-kit>
|
||||||
|
|
||||||
|
</ctd:content-type>
|
||||||
|
|
||||||
|
|
||||||
|
</ctd:content-types>
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
<?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="Scientific organization type with association for publications"
|
||||||
|
objectType="com.arsdigita.cms.contenttypes.SciOrganizationWithPublications"
|
||||||
|
classname="com.arsdigita.cms.contenttypes.SciOrganizationWithPublications">
|
||||||
|
|
||||||
|
<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:authoring-step
|
||||||
|
labelKey = "sciorganizationpublication.ui.organization.publications.title"
|
||||||
|
labelBundle = "com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"
|
||||||
|
descriptionKey = "sciorganizationpublication.ui.organization.publications.description"
|
||||||
|
component = "com.arsdigita.cms.contenttypes.ui.SciOrganizationPublicationsStep"
|
||||||
|
ordering = "6"/>
|
||||||
|
|
||||||
|
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||||
|
|
||||||
|
</ctd:authoring-kit>
|
||||||
|
|
||||||
|
</ctd:content-type>
|
||||||
|
|
||||||
|
</ctd:content-types>
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?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 with association for publications"
|
||||||
|
objectType="com.arsdigita.cms.contenttypes.SciProjectWithPublications"
|
||||||
|
classname="com.arsdigita.cms.contenttypes.SciProjectWithPublications">
|
||||||
|
|
||||||
|
<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_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:authoring-step
|
||||||
|
labelKey = "sciorganizationpublication.ui.project.publications.title"
|
||||||
|
labelBundle = "com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"
|
||||||
|
descriptionKey = "sciorganizationpublication.ui.project.publications.description"
|
||||||
|
component = "com.arsdigita.cms.contenttypes.ui.SciProjectPublicationsStep"
|
||||||
|
ordering = "6"/>
|
||||||
|
|
||||||
|
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||||
|
|
||||||
|
</ctd:authoring-kit>
|
||||||
|
|
||||||
|
</ctd:content-type>
|
||||||
|
|
||||||
|
|
||||||
|
</ctd:content-types>
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<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.london.navigation.NavigationModel,
|
||||||
|
com.arsdigita.london.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.london.navigation.ui.category.Path"/>
|
||||||
|
<jsp:scriptlet>
|
||||||
|
((com.arsdigita.london.navigation.ui.category.Path)categoryPath)
|
||||||
|
.setModel(model);
|
||||||
|
</jsp:scriptlet>
|
||||||
|
<define:component name="categoryMenu"
|
||||||
|
classname="com.arsdigita.london.navigation.ui.category.Menu"/>
|
||||||
|
<jsp:scriptlet>
|
||||||
|
((com.arsdigita.london.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.SciDepartmentWithPublicationsPanel"/>
|
||||||
|
|
||||||
|
<define:component name="relatedItems"
|
||||||
|
classname="com.arsdigita.london.navigation.ui.RelatedItems"/>
|
||||||
|
|
||||||
|
<define:component name="assignedTerms"
|
||||||
|
classname="com.arsdigita.aplaws.ui.AssignedItemTerms"/>
|
||||||
|
</define:page>
|
||||||
|
|
||||||
|
<show:all/>
|
||||||
|
|
||||||
|
|
||||||
|
</jsp:root>
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<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.london.navigation.NavigationModel,
|
||||||
|
com.arsdigita.london.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.london.navigation.ui.category.Path"/>
|
||||||
|
<jsp:scriptlet>
|
||||||
|
((com.arsdigita.london.navigation.ui.category.Path)categoryPath)
|
||||||
|
.setModel(model);
|
||||||
|
</jsp:scriptlet>
|
||||||
|
<define:component name="categoryMenu"
|
||||||
|
classname="com.arsdigita.london.navigation.ui.category.Menu"/>
|
||||||
|
<jsp:scriptlet>
|
||||||
|
((com.arsdigita.london.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.SciOrganizationWithPublicationsPanel"/>
|
||||||
|
|
||||||
|
<define:component name="relatedItems"
|
||||||
|
classname="com.arsdigita.london.navigation.ui.RelatedItems"/>
|
||||||
|
|
||||||
|
<define:component name="assignedTerms"
|
||||||
|
classname="com.arsdigita.aplaws.ui.AssignedItemTerms"/>
|
||||||
|
</define:page>
|
||||||
|
|
||||||
|
<show:all/>
|
||||||
|
|
||||||
|
|
||||||
|
</jsp:root>
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<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.london.navigation.NavigationModel,
|
||||||
|
com.arsdigita.london.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.london.navigation.ui.category.Path"/>
|
||||||
|
<jsp:scriptlet>
|
||||||
|
((com.arsdigita.london.navigation.ui.category.Path)categoryPath)
|
||||||
|
.setModel(model);
|
||||||
|
</jsp:scriptlet>
|
||||||
|
<define:component name="categoryMenu"
|
||||||
|
classname="com.arsdigita.london.navigation.ui.category.Menu"/>
|
||||||
|
<jsp:scriptlet>
|
||||||
|
((com.arsdigita.london.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.SciProjectWithPublicationsPanel"/>
|
||||||
|
|
||||||
|
<define:component name="relatedItems"
|
||||||
|
classname="com.arsdigita.london.navigation.ui.RelatedItems"/>
|
||||||
|
|
||||||
|
<define:component name="assignedTerms"
|
||||||
|
classname="com.arsdigita.aplaws.ui.AssignedItemTerms"/>
|
||||||
|
</define:page>
|
||||||
|
|
||||||
|
<show:all/>
|
||||||
|
|
||||||
|
|
||||||
|
</jsp:root>
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?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.SciDepartmentWithPublications"
|
||||||
|
extends="com.arsdigita.cms.contenttypes.SciDepartment">
|
||||||
|
</xrd:adapter>
|
||||||
|
</xrd:context>
|
||||||
|
|
||||||
|
</xrd:adapters>
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?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.SciOrganizationWithPublications"
|
||||||
|
extends="com.arsdigita.cms.contenttypes.SciOrganization">
|
||||||
|
</xrd:adapter>
|
||||||
|
</xrd:context>
|
||||||
|
|
||||||
|
</xrd:adapters>
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?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.SciProjectWithPublications"
|
||||||
|
extends="com.arsdigita.cms.contenttypes.SciProject">
|
||||||
|
</xrd:adapter>
|
||||||
|
</xrd:context>
|
||||||
|
|
||||||
|
<!--<xrd:context name="sciProjectList">
|
||||||
|
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.SciProject"
|
||||||
|
extends="com.arsdigita.cms.contenttypes.SciProject">
|
||||||
|
</xrd:adapter>
|
||||||
|
</xrd:context>-->
|
||||||
|
|
||||||
|
</xrd:adapters>
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* 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.domain.DomainCollection;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationSciDepartmentCollection extends DomainCollection {
|
||||||
|
|
||||||
|
public PublicationSciDepartmentCollection(
|
||||||
|
final DataCollection dataCollection) {
|
||||||
|
super(dataCollection);
|
||||||
|
|
||||||
|
addOrder("title");
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciDepartmentWithPublications getDepartment() {
|
||||||
|
return (SciDepartmentWithPublications) DomainObjectFactory.newInstance(m_dataCollection.
|
||||||
|
getDataObject());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* 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.domain.DomainCollection;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationSciOrganizationCollection extends DomainCollection {
|
||||||
|
|
||||||
|
public PublicationSciOrganizationCollection(
|
||||||
|
final DataCollection dataCollection) {
|
||||||
|
super(dataCollection);
|
||||||
|
|
||||||
|
addOrder("title");
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciOrganizationWithPublications getOrganization() {
|
||||||
|
return (SciOrganizationWithPublications) DomainObjectFactory.newInstance(m_dataCollection.
|
||||||
|
getDataObject());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* 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.domain.DomainCollection;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationSciProjectCollection extends DomainCollection {
|
||||||
|
|
||||||
|
public PublicationSciProjectCollection(
|
||||||
|
final DataCollection dataCollection) {
|
||||||
|
super(dataCollection);
|
||||||
|
|
||||||
|
addOrder("title");
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciProjectWithPublications getOrganization() {
|
||||||
|
return (SciProjectWithPublications) DomainObjectFactory.newInstance(m_dataCollection.
|
||||||
|
getDataObject());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* 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.domain.DomainCollection;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciDepartmentPublicationsCollection extends DomainCollection {
|
||||||
|
|
||||||
|
public SciDepartmentPublicationsCollection(
|
||||||
|
final DataCollection dataCollection) {
|
||||||
|
super(dataCollection);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Publication getPublication() {
|
||||||
|
return (Publication) DomainObjectFactory.newInstance(m_dataCollection.
|
||||||
|
getDataObject());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
* 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.cms.contenttypes.ui.PublicationSciDepartmentStep;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.runtime.DomainInitEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciDepartmentWithPublicationsInitializer
|
||||||
|
extends ContentTypeInitializer {
|
||||||
|
|
||||||
|
public SciDepartmentWithPublicationsInitializer() {
|
||||||
|
super("empty.pdl.mf",
|
||||||
|
SciOrganizationWithPublications.BASE_DATA_OBJECT_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final DomainInitEvent event) {
|
||||||
|
super.init(event);
|
||||||
|
|
||||||
|
ContentType departmentType =
|
||||||
|
ContentType.findByAssociatedObjectType(SciDepartment.class.
|
||||||
|
getName());
|
||||||
|
departmentType.setMode("internal");
|
||||||
|
|
||||||
|
AuthoringKitWizard.registerAssetStep(Publication.BASE_DATA_OBJECT_TYPE,
|
||||||
|
PublicationSciDepartmentStep.class,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"sciorganizationpublication.ui.publication.departments.title",
|
||||||
|
"com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"),
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"sciorganizationpublication.ui.publication.departments.description",
|
||||||
|
"com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"),
|
||||||
|
1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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/SciDepartmentWithPublications.xml";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
* 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.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciDepartmentWithPublicationsLoader extends AbstractContentTypeLoader {
|
||||||
|
|
||||||
|
private ResourceParameter m_template;
|
||||||
|
private static final String[] TYPES = {
|
||||||
|
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.xml"
|
||||||
|
};
|
||||||
|
|
||||||
|
public SciDepartmentWithPublicationsLoader() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
m_template =
|
||||||
|
new ResourceParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.SciDepartmentWithPublicationsTemplate",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
"/WEB-INF/content-types/com/arsdigita/"
|
||||||
|
+ "cms/contenttypes/scidepartment-with-publications-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("SciDepartmentWithPublications Item",
|
||||||
|
"scidepartment-with-publications-item",
|
||||||
|
(InputStream) get(m_template),
|
||||||
|
section,
|
||||||
|
type,
|
||||||
|
lifecycle,
|
||||||
|
workflow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* 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.domain.DomainCollection;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciOrganizationPublicationsCollection extends DomainCollection {
|
||||||
|
|
||||||
|
public String ORDER = "departmentOrder";
|
||||||
|
public String LINKORDER = "link.departmentOrder";
|
||||||
|
|
||||||
|
public SciOrganizationPublicationsCollection(
|
||||||
|
final DataCollection dataCollection) {
|
||||||
|
super(dataCollection);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Publication getPublication() {
|
||||||
|
return (Publication) DomainObjectFactory.newInstance(m_dataCollection.
|
||||||
|
getDataObject());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
* 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.cms.contenttypes.ui.PublicationSciOrganizationStep;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.runtime.DomainInitEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciOrganizationWithPublicationsInitializer
|
||||||
|
extends ContentTypeInitializer {
|
||||||
|
|
||||||
|
public SciOrganizationWithPublicationsInitializer() {
|
||||||
|
super("ccm-sci-types-organizationwithpublications.pdl.mf",
|
||||||
|
SciOrganizationWithPublications.BASE_DATA_OBJECT_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final DomainInitEvent event) {
|
||||||
|
super.init(event);
|
||||||
|
|
||||||
|
ContentType orgaType =
|
||||||
|
ContentType.findByAssociatedObjectType(SciOrganization.class.
|
||||||
|
getName());
|
||||||
|
orgaType.setMode("internal");
|
||||||
|
|
||||||
|
AuthoringKitWizard.registerAssetStep(Publication.BASE_DATA_OBJECT_TYPE,
|
||||||
|
PublicationSciOrganizationStep.class,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"sciorganizationpublication.ui.publication.organization.title",
|
||||||
|
"com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"),
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"sciorganizationpublication.ui.publication.organization.description",
|
||||||
|
"com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"),
|
||||||
|
1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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/SciOrganizationWithPublications.xml";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* 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.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciOrganizationWithPublicationsLoader extends AbstractContentTypeLoader {
|
||||||
|
|
||||||
|
private ResourceParameter m_template;
|
||||||
|
|
||||||
|
public SciOrganizationWithPublicationsLoader() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
m_template = new ResourceParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.SciOrganizationWithPublicationsTemplate",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
"/WEB-INF/content-types/com/arsdigita/"
|
||||||
|
+ "cms/contenttypes/sciorganization-with-publications-item.jsp");
|
||||||
|
|
||||||
|
register(m_template);
|
||||||
|
}
|
||||||
|
private static final String[] TYPES = {
|
||||||
|
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/"
|
||||||
|
+ "SciOrganizationWithPublications.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("SciOrganizationWithPublications Item",
|
||||||
|
"sciorganization-with-publications-item",
|
||||||
|
(InputStream) get(m_template),
|
||||||
|
section,
|
||||||
|
type,
|
||||||
|
lifecycle,
|
||||||
|
workflow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* 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.domain.DomainCollection;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciProjectPublicationsCollection extends DomainCollection {
|
||||||
|
|
||||||
|
public SciProjectPublicationsCollection(final DataCollection dataCollection) {
|
||||||
|
super(dataCollection);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Publication getPublication() {
|
||||||
|
return (Publication) DomainObjectFactory.newInstance(m_dataCollection.
|
||||||
|
getDataObject());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
* 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.cms.contenttypes.ui.PublicationSciProjectStep;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.runtime.DomainInitEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciProjectWithPublicationsInitializer
|
||||||
|
extends ContentTypeInitializer {
|
||||||
|
|
||||||
|
public SciProjectWithPublicationsInitializer() {
|
||||||
|
super("empty.pdl.mf",
|
||||||
|
SciOrganizationWithPublications.BASE_DATA_OBJECT_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final DomainInitEvent event) {
|
||||||
|
super.init(event);
|
||||||
|
|
||||||
|
ContentType projectType =
|
||||||
|
ContentType.findByAssociatedObjectType(SciProject.class.
|
||||||
|
getName());
|
||||||
|
projectType.setMode("internal");
|
||||||
|
|
||||||
|
AuthoringKitWizard.registerAssetStep(Publication.BASE_DATA_OBJECT_TYPE,
|
||||||
|
PublicationSciProjectStep.class,
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"sciorganizationpublication.ui.publication.projects.title",
|
||||||
|
"com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"),
|
||||||
|
new GlobalizedMessage(
|
||||||
|
"sciorganizationpublication.ui.publication.projects.description",
|
||||||
|
"com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"),
|
||||||
|
1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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/SciProjectWithPublications.xml";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* 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.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciProjectWithPublicationsLoader extends AbstractContentTypeLoader {
|
||||||
|
|
||||||
|
private ResourceParameter m_template;
|
||||||
|
private static final String[] TYPES = {
|
||||||
|
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProjectWithPublications.xml"
|
||||||
|
};
|
||||||
|
|
||||||
|
public SciProjectWithPublicationsLoader() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
m_template =
|
||||||
|
new ResourceParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.SciProjectWithPublicationsTemplate",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
"/WEB-INF/content-types/com/arsdigita/"
|
||||||
|
+ "cms/contenttypes/sciproject-with-publications-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("SciProjectWithPublications Item",
|
||||||
|
"sciproject-with-publications-item",
|
||||||
|
(InputStream) get(m_template),
|
||||||
|
section,
|
||||||
|
type,
|
||||||
|
lifecycle,
|
||||||
|
workflow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
/*
|
||||||
|
* 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.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.Publication;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciDepartmentWithPublications;
|
||||||
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationSciDepartmentAddForm
|
||||||
|
extends BasicItemForm
|
||||||
|
implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
|
||||||
|
private ItemSearchWidget itemSearch;
|
||||||
|
private final String ITEM_SEARCH = "departments";
|
||||||
|
|
||||||
|
public PublicationSciDepartmentAddForm(ItemSelectionModel itemModel) {
|
||||||
|
super("PublicationSciDepartmentAddForm", itemModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWidgets() {
|
||||||
|
add(new Label((String) SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize("sciorganization.ui.selectDepartment").localize()));
|
||||||
|
itemSearch = new ItemSearchWidget(ITEM_SEARCH,
|
||||||
|
ContentType.findByAssociatedObjectType(SciDepartmentWithPublications.class.
|
||||||
|
getName()));
|
||||||
|
add(itemSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
|
||||||
|
setVisible(state, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
|
||||||
|
Publication publication = (Publication) getItemSelectionModel().
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
|
SciDepartmentWithPublications department =
|
||||||
|
(SciDepartmentWithPublications) data.
|
||||||
|
get(
|
||||||
|
ITEM_SEARCH);
|
||||||
|
DataObject link = publication.add("departments", department);
|
||||||
|
link.set("publicationOrder", Integer.valueOf((int) department.
|
||||||
|
getPublications().size()));
|
||||||
|
|
||||||
|
link.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
init(fse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* 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.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationSciDepartmentStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
private String ADD_ORGANIZATION_SHEET_NAME = "addSciDepartment";
|
||||||
|
|
||||||
|
public PublicationSciDepartmentStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicationSciDepartmentStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
BasicItemForm addDepartmentSheet =
|
||||||
|
new PublicationSciDepartmentAddForm(itemModel);
|
||||||
|
add(ADD_ORGANIZATION_SHEET_NAME,
|
||||||
|
(String) SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.addDepartment").localize(),
|
||||||
|
new WorkflowLockedComponentAccess(addDepartmentSheet, itemModel),
|
||||||
|
addDepartmentSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
PublicationSciDepartmentTable departmentTable =
|
||||||
|
new PublicationSciDepartmentTable(
|
||||||
|
itemModel);
|
||||||
|
setDisplayComponent(departmentTable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,265 @@
|
||||||
|
/*
|
||||||
|
* 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.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.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.contenttypes.PublicationSciDepartmentCollection;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciDepartmentWithPublications;
|
||||||
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
|
import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
|
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationSciDepartmentTable
|
||||||
|
extends Table
|
||||||
|
implements TableActionListener {
|
||||||
|
|
||||||
|
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||||
|
private final String TABLE_COL_DEL = "table_col_del";
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public PublicationSciDepartmentTable(final ItemSelectionModel itemModel) {
|
||||||
|
super();
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
|
||||||
|
setEmptyView(new Label(SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize("sciorganizationpublication.ui.departments.none")));
|
||||||
|
|
||||||
|
TableColumnModel columnModel = getColumnModel();
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.department").localize(),
|
||||||
|
TABLE_COL_EDIT));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
1,
|
||||||
|
SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.department.remove").
|
||||||
|
localize(), TABLE_COL_DEL));
|
||||||
|
|
||||||
|
setModelBuilder(new PublicationSciDepartmentTableModelBuilder(
|
||||||
|
itemModel));
|
||||||
|
|
||||||
|
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||||
|
columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
|
addTableActionListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PublicationSciDepartmentTableModelBuilder
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableModelBuilder {
|
||||||
|
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public PublicationSciDepartmentTableModelBuilder(
|
||||||
|
final ItemSelectionModel itemModel) {
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableModel makeModel(final Table table, final PageState state) {
|
||||||
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
|
Publication publication = (Publication) itemModel.getSelectedObject(
|
||||||
|
state);
|
||||||
|
return new PublicationSciDepartmentTableModel(table,
|
||||||
|
state,
|
||||||
|
publication);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PublicationSciDepartmentTableModel implements TableModel {
|
||||||
|
|
||||||
|
private Table table;
|
||||||
|
private PublicationSciDepartmentCollection departments;
|
||||||
|
private SciDepartmentWithPublications department;
|
||||||
|
|
||||||
|
public PublicationSciDepartmentTableModel(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Publication publication) {
|
||||||
|
this.table = table;
|
||||||
|
|
||||||
|
departments =
|
||||||
|
new PublicationSciDepartmentCollection((DataCollection) publication.
|
||||||
|
get("departments"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColumnCount() {
|
||||||
|
return table.getColumnModel().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean nextRow() {
|
||||||
|
boolean ret;
|
||||||
|
|
||||||
|
if ((departments != null) && departments.next()) {
|
||||||
|
department = departments.getDepartment();
|
||||||
|
ret = true;
|
||||||
|
} else {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getElementAt(int columnIndex) {
|
||||||
|
switch (columnIndex) {
|
||||||
|
case 0:
|
||||||
|
return department.getTitle();
|
||||||
|
case 1:
|
||||||
|
return SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize(
|
||||||
|
"sciorganizationpublication.ui.department.remove").
|
||||||
|
localize();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getKeyAt(int columnIndex) {
|
||||||
|
return department.getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
|
getSecurityManager(state);
|
||||||
|
Publication publication = (Publication) itemModel.getSelectedObject(
|
||||||
|
state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
publication);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
SciDepartmentWithPublications department;
|
||||||
|
try {
|
||||||
|
department =
|
||||||
|
new SciDepartmentWithPublications((BigDecimal) key);
|
||||||
|
} catch (ObjectNotFoundException ex) {
|
||||||
|
return new Label(value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
ContentSection section = CMS.getContext().getContentSection();
|
||||||
|
ItemResolver resolver = section.getItemResolver();
|
||||||
|
Link link =
|
||||||
|
new Link(value.toString(),
|
||||||
|
resolver.generateItemURL(state,
|
||||||
|
department,
|
||||||
|
section,
|
||||||
|
department.getVersion()));
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DeleteCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
|
getSecurityManager(state);
|
||||||
|
Publication publication = (Publication) itemModel.getSelectedObject(
|
||||||
|
state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.DELETE_ITEM,
|
||||||
|
publication);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
ControlLink link = new ControlLink(value.toString());
|
||||||
|
link.setConfirmation((String) SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize(
|
||||||
|
"sciorganizationpublication.ui.department.confirm.remove").
|
||||||
|
localize());
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
PageState state =event.getPageState();
|
||||||
|
|
||||||
|
SciDepartmentWithPublications department = new SciDepartmentWithPublications(
|
||||||
|
new BigDecimal(event.getRowKey().toString()));
|
||||||
|
|
||||||
|
Publication publication = (Publication) itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
|
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||||
|
//Nothing to do
|
||||||
|
} else if(TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||||
|
Assert.exists(department, SciDepartmentWithPublications.class);
|
||||||
|
|
||||||
|
publication.remove("departments", department);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing to do
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
* 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.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.Publication;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
|
||||||
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationSciOrganizationAddForm
|
||||||
|
extends BasicItemForm
|
||||||
|
implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
|
||||||
|
private ItemSearchWidget itemSearch;
|
||||||
|
private final String ITEM_SEARCH = "organizations";
|
||||||
|
|
||||||
|
public PublicationSciOrganizationAddForm(final ItemSelectionModel itemModel) {
|
||||||
|
super("PublicationSciOrganizationAddForm", itemModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWidgets() {
|
||||||
|
add(new Label((String) SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize("sciorganization.ui.selectOrganization").localize()));
|
||||||
|
itemSearch = new ItemSearchWidget(ITEM_SEARCH,
|
||||||
|
ContentType.findByAssociatedObjectType(SciOrganizationWithPublications.class.
|
||||||
|
getName()));
|
||||||
|
add(itemSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
|
||||||
|
setVisible(state, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
|
||||||
|
Publication publication = (Publication) getItemSelectionModel().
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
|
SciOrganizationWithPublications organization =
|
||||||
|
(SciOrganizationWithPublications) data.
|
||||||
|
get(
|
||||||
|
ITEM_SEARCH);
|
||||||
|
DataObject link = publication.add("organizations", organization);
|
||||||
|
link.set("publicationOrder", Integer.valueOf((int)organization.getPublications().size()));
|
||||||
|
link.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
init(fse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* 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.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationSciOrganizationStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
private String ADD_ORGANIZATION_SHEET_NAME = "addSciOrganization";
|
||||||
|
|
||||||
|
public PublicationSciOrganizationStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicationSciOrganizationStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
BasicItemForm addOrganizationSheet =
|
||||||
|
new PublicationSciOrganizationAddForm(itemModel);
|
||||||
|
add(ADD_ORGANIZATION_SHEET_NAME,
|
||||||
|
(String) SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.addOrganization").localize(),
|
||||||
|
new WorkflowLockedComponentAccess(addOrganizationSheet, itemModel),
|
||||||
|
addOrganizationSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
PublicationSciOrganizationTable organizationTable =
|
||||||
|
new PublicationSciOrganizationTable(
|
||||||
|
itemModel);
|
||||||
|
setDisplayComponent(organizationTable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,268 @@
|
||||||
|
/*
|
||||||
|
* 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.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.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.contenttypes.PublicationSciOrganizationCollection;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
|
||||||
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
|
import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
|
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationSciOrganizationTable
|
||||||
|
extends Table
|
||||||
|
implements TableActionListener {
|
||||||
|
|
||||||
|
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||||
|
private final String TABLE_COL_DEL = "table_col_del";
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public PublicationSciOrganizationTable(final ItemSelectionModel itemModel) {
|
||||||
|
super();
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
|
||||||
|
setEmptyView(new Label(SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize("sciorganizationpublication.ui.organizations.none")));
|
||||||
|
|
||||||
|
TableColumnModel columnModel = getColumnModel();
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.organization").localize(),
|
||||||
|
TABLE_COL_EDIT));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
1,
|
||||||
|
SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.organization.remove").
|
||||||
|
localize(), TABLE_COL_DEL));
|
||||||
|
|
||||||
|
setModelBuilder(new PublicationSciOrganizationTableModelBuilder(
|
||||||
|
itemModel));
|
||||||
|
|
||||||
|
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||||
|
columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
|
addTableActionListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PublicationSciOrganizationTableModelBuilder
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableModelBuilder {
|
||||||
|
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public PublicationSciOrganizationTableModelBuilder(
|
||||||
|
final ItemSelectionModel itemModel) {
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableModel makeModel(final Table table, final PageState state) {
|
||||||
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
|
Publication publication = (Publication) itemModel.getSelectedObject(
|
||||||
|
state);
|
||||||
|
return new PublicationSciOrganizationTableModel(table,
|
||||||
|
state,
|
||||||
|
publication);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PublicationSciOrganizationTableModel implements TableModel {
|
||||||
|
|
||||||
|
private Table table;
|
||||||
|
private PublicationSciOrganizationCollection organizations;
|
||||||
|
private SciOrganizationWithPublications organization;
|
||||||
|
|
||||||
|
public PublicationSciOrganizationTableModel(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Publication publication) {
|
||||||
|
|
||||||
|
this.table = table;
|
||||||
|
|
||||||
|
organizations =
|
||||||
|
new PublicationSciOrganizationCollection((DataCollection) publication.
|
||||||
|
get("organizations"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColumnCount() {
|
||||||
|
return table.getColumnModel().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean nextRow() {
|
||||||
|
boolean ret;
|
||||||
|
|
||||||
|
if ((organizations != null) && organizations.next()) {
|
||||||
|
organization = organizations.getOrganization();
|
||||||
|
ret = true;
|
||||||
|
} else {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getElementAt(int columnIndex) {
|
||||||
|
switch (columnIndex) {
|
||||||
|
case 0:
|
||||||
|
return organization.getTitle();
|
||||||
|
case 1:
|
||||||
|
return SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize(
|
||||||
|
"sciorganizationpublication.ui.organization.remove").
|
||||||
|
localize();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getKeyAt(int columnIndex) {
|
||||||
|
return organization.getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
|
getSecurityManager(state);
|
||||||
|
Publication publication = (Publication) itemModel.getSelectedObject(
|
||||||
|
state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
publication);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
SciOrganizationWithPublications organization;
|
||||||
|
try {
|
||||||
|
organization =
|
||||||
|
new SciOrganizationWithPublications((BigDecimal) key);
|
||||||
|
} catch (ObjectNotFoundException ex) {
|
||||||
|
return new Label(value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
ContentSection section = CMS.getContext().getContentSection();
|
||||||
|
ItemResolver resolver = section.getItemResolver();
|
||||||
|
Link link =
|
||||||
|
new Link(value.toString(),
|
||||||
|
resolver.generateItemURL(state,
|
||||||
|
organization,
|
||||||
|
section,
|
||||||
|
organization.getVersion()));
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DeleteCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
|
getSecurityManager(state);
|
||||||
|
Publication publication = (Publication) itemModel.getSelectedObject(
|
||||||
|
state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.DELETE_ITEM,
|
||||||
|
publication);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
ControlLink link = new ControlLink(value.toString());
|
||||||
|
link.setConfirmation((String) SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize(
|
||||||
|
"sciorganizationpublication.ui.organization.confirm.remove").
|
||||||
|
localize());
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
|
SciOrganizationWithPublications organization =
|
||||||
|
new SciOrganizationWithPublications(
|
||||||
|
new BigDecimal(event.getRowKey().toString()));
|
||||||
|
|
||||||
|
Publication publication = (Publication) itemModel.getSelectedObject(
|
||||||
|
state);
|
||||||
|
|
||||||
|
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
|
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||||
|
//Nothing to do
|
||||||
|
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||||
|
Assert.exists(organization, SciOrganizationWithPublications.class);
|
||||||
|
|
||||||
|
publication.remove("organizations", organization);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing to do
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
* 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.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.Publication;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProjectWithPublications;
|
||||||
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationSciProjectAddForm
|
||||||
|
extends BasicItemForm
|
||||||
|
implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
|
||||||
|
private ItemSearchWidget itemSearch;
|
||||||
|
private final String ITEM_SEARCH = "projects";
|
||||||
|
|
||||||
|
public PublicationSciProjectAddForm(final ItemSelectionModel itemModel) {
|
||||||
|
super("PublicationSciProjectAddForm", itemModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWidgets() {
|
||||||
|
add(new Label((String) SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize("sciorganization.ui.selectProject").localize()));
|
||||||
|
itemSearch = new ItemSearchWidget(ITEM_SEARCH,
|
||||||
|
ContentType.findByAssociatedObjectType(SciProjectWithPublications.class.
|
||||||
|
getName()));
|
||||||
|
add(itemSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
|
||||||
|
setVisible(state, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
|
||||||
|
Publication publication = (Publication) getItemSelectionModel().
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
|
SciProjectWithPublications project =
|
||||||
|
(SciProjectWithPublications) data.get(
|
||||||
|
ITEM_SEARCH);
|
||||||
|
DataObject link = publication.add("projects", project);
|
||||||
|
link.set("publicationOrder", Integer.valueOf((int) project.
|
||||||
|
getPublications().size()));
|
||||||
|
link.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
init(fse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* 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.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationSciProjectStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
private String ADD_ORGANIZATION_SHEET_NAME = "addSciProject";
|
||||||
|
|
||||||
|
public PublicationSciProjectStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicationSciProjectStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
BasicItemForm addProjectSheet =
|
||||||
|
new PublicationSciProjectAddForm(itemModel);
|
||||||
|
add(ADD_ORGANIZATION_SHEET_NAME,
|
||||||
|
(String) SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.addOrganization").localize(),
|
||||||
|
new WorkflowLockedComponentAccess(addProjectSheet, itemModel),
|
||||||
|
addProjectSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
PublicationSciProjectTable projectTable =
|
||||||
|
new PublicationSciProjectTable(
|
||||||
|
itemModel);
|
||||||
|
setDisplayComponent(projectTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,266 @@
|
||||||
|
/*
|
||||||
|
* 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.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.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.contenttypes.PublicationSciProjectCollection;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProjectWithPublications;
|
||||||
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
|
import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
|
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class PublicationSciProjectTable
|
||||||
|
extends Table
|
||||||
|
implements TableActionListener {
|
||||||
|
|
||||||
|
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||||
|
private final String TABLE_COL_DEL = "table_col_del";
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public PublicationSciProjectTable(final ItemSelectionModel itemModel) {
|
||||||
|
super();
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
|
||||||
|
setEmptyView(new Label(SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize("sciorganizationpublication.ui.projects.none")));
|
||||||
|
|
||||||
|
TableColumnModel columnModel = getColumnModel();
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.projects").localize(),
|
||||||
|
TABLE_COL_EDIT));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
1,
|
||||||
|
SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.projects.remove").
|
||||||
|
localize(), TABLE_COL_DEL));
|
||||||
|
|
||||||
|
setModelBuilder(new PublicationSciProjectTableModelBuilder(
|
||||||
|
itemModel));
|
||||||
|
|
||||||
|
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||||
|
columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
|
addTableActionListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PublicationSciProjectTableModelBuilder
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableModelBuilder {
|
||||||
|
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public PublicationSciProjectTableModelBuilder(
|
||||||
|
final ItemSelectionModel itemModel) {
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableModel makeModel(final Table table, final PageState state) {
|
||||||
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
|
Publication publication = (Publication) itemModel.getSelectedObject(
|
||||||
|
state);
|
||||||
|
return new PublicationSciProjectTableModel(table,
|
||||||
|
state,
|
||||||
|
publication);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class PublicationSciProjectTableModel implements TableModel {
|
||||||
|
|
||||||
|
private Table table;
|
||||||
|
private PublicationSciProjectCollection projects;
|
||||||
|
private SciProjectWithPublications project;
|
||||||
|
|
||||||
|
public PublicationSciProjectTableModel(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Publication publication) {
|
||||||
|
|
||||||
|
this.table = table;
|
||||||
|
|
||||||
|
projects =
|
||||||
|
new PublicationSciProjectCollection((DataCollection) publication.
|
||||||
|
get("projects"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColumnCount() {
|
||||||
|
return table.getColumnModel().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean nextRow() {
|
||||||
|
boolean ret;
|
||||||
|
|
||||||
|
if ((projects != null) && projects.next()) {
|
||||||
|
project = projects.getOrganization();
|
||||||
|
ret = true;
|
||||||
|
} else {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getElementAt(int columnIndex) {
|
||||||
|
switch (columnIndex) {
|
||||||
|
case 0:
|
||||||
|
return project.getTitle();
|
||||||
|
case 1:
|
||||||
|
return SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize(
|
||||||
|
"sciorganizationpublication.ui.project.remove").
|
||||||
|
localize();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getKeyAt(int columnIndex) {
|
||||||
|
return project.getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
|
getSecurityManager(state);
|
||||||
|
Publication publication = (Publication) itemModel.getSelectedObject(
|
||||||
|
state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
publication);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
SciProjectWithPublications project;
|
||||||
|
try {
|
||||||
|
project =
|
||||||
|
new SciProjectWithPublications((BigDecimal) key);
|
||||||
|
} catch (ObjectNotFoundException ex) {
|
||||||
|
return new Label(value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
ContentSection section = CMS.getContext().getContentSection();
|
||||||
|
ItemResolver resolver = section.getItemResolver();
|
||||||
|
Link link =
|
||||||
|
new Link(value.toString(),
|
||||||
|
resolver.generateItemURL(state,
|
||||||
|
project,
|
||||||
|
section,
|
||||||
|
project.getVersion()));
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DeleteCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
|
getSecurityManager(state);
|
||||||
|
Publication publication = (Publication) itemModel.getSelectedObject(
|
||||||
|
state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.DELETE_ITEM,
|
||||||
|
publication);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
ControlLink link = new ControlLink(value.toString());
|
||||||
|
link.setConfirmation((String) SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize(
|
||||||
|
"sciorganizationpublication.ui.project.confirm.remove").
|
||||||
|
localize());
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
PageState state =event.getPageState();
|
||||||
|
|
||||||
|
SciProjectWithPublications project = new SciProjectWithPublications(
|
||||||
|
new BigDecimal(event.getRowKey().toString()));
|
||||||
|
|
||||||
|
Publication publication = (Publication) itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
|
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||||
|
//Nothing to do
|
||||||
|
} else if(TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||||
|
Assert.exists(project, SciProjectWithPublications.class);
|
||||||
|
|
||||||
|
publication.remove("projects", project);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing to do
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
* 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.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.Publication;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciDepartmentWithPublications;
|
||||||
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciDepartmentPublicationsAddForm
|
||||||
|
extends BasicItemForm
|
||||||
|
implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
|
||||||
|
private ItemSearchWidget itemSearch;
|
||||||
|
private final String ITEM_SEARCH = "publications";
|
||||||
|
|
||||||
|
public SciDepartmentPublicationsAddForm(final ItemSelectionModel itemModel) {
|
||||||
|
super("SciDepartmentPublicationsAddForm", itemModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWidgets() {
|
||||||
|
add(new Label((String) SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize("sciorganization.ui.selectPublication").localize()));
|
||||||
|
itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
||||||
|
findByAssociatedObjectType(Publication.class.getName()));
|
||||||
|
add(itemSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
|
||||||
|
setVisible(state, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
SciDepartmentWithPublications organization =
|
||||||
|
(SciDepartmentWithPublications) getItemSelectionModel().
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
|
organization.addPublication((Publication) data.get(ITEM_SEARCH));
|
||||||
|
}
|
||||||
|
|
||||||
|
init(fse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* 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.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciDepartmentPublicationsStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
private String ADD_PUBLICATION_SHEET_NAME = "addPublication";
|
||||||
|
|
||||||
|
public SciDepartmentPublicationsStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciDepartmentPublicationsStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
BasicItemForm addPublicationSheet =
|
||||||
|
new SciDepartmentPublicationsAddForm(itemModel);
|
||||||
|
add(ADD_PUBLICATION_SHEET_NAME,
|
||||||
|
(String) SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganization.ui.addPublication").localize(),
|
||||||
|
new WorkflowLockedComponentAccess(addPublicationSheet, itemModel),
|
||||||
|
addPublicationSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
SciDepartmentPublicationsTable publicationTable =
|
||||||
|
new SciDepartmentPublicationsTable(
|
||||||
|
itemModel);
|
||||||
|
setDisplayComponent(publicationTable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,269 @@
|
||||||
|
/*
|
||||||
|
* 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.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.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciDepartmentPublicationsCollection;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciDepartmentWithPublications;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciDepartmentPublicationsTable
|
||||||
|
extends Table
|
||||||
|
implements TableActionListener {
|
||||||
|
|
||||||
|
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||||
|
private final String TABLE_COL_DEL = "table_col_del";
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public SciDepartmentPublicationsTable(final ItemSelectionModel itemModel) {
|
||||||
|
super();
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
|
||||||
|
setEmptyView(new Label(SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize("sciorganizationpublication.ui.publications.none")));
|
||||||
|
|
||||||
|
TableColumnModel columnModel = getColumnModel();
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.publication").localize(),
|
||||||
|
TABLE_COL_EDIT));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
1,
|
||||||
|
SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.publication.remove").
|
||||||
|
localize(), TABLE_COL_DEL));
|
||||||
|
|
||||||
|
setModelBuilder(
|
||||||
|
new SciDepartmentPublicationsTableModelBuilder(itemModel));
|
||||||
|
|
||||||
|
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||||
|
columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
|
addTableActionListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SciDepartmentPublicationsTableModelBuilder
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableModelBuilder {
|
||||||
|
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public SciDepartmentPublicationsTableModelBuilder(
|
||||||
|
final ItemSelectionModel itemModel) {
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableModel makeModel(final Table table,
|
||||||
|
final PageState state) {
|
||||||
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
|
SciDepartmentWithPublications department =
|
||||||
|
(SciDepartmentWithPublications) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
return new SciDepartmentPublicationsTableModel(table,
|
||||||
|
state,
|
||||||
|
department);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SciDepartmentPublicationsTableModel
|
||||||
|
implements TableModel {
|
||||||
|
|
||||||
|
private Table table;
|
||||||
|
private SciDepartmentPublicationsCollection publications;
|
||||||
|
private Publication publication;
|
||||||
|
|
||||||
|
public SciDepartmentPublicationsTableModel(
|
||||||
|
final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final SciDepartmentWithPublications department) {
|
||||||
|
this.table = table;
|
||||||
|
publications = department.getPublications();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColumnCount() {
|
||||||
|
return table.getColumnModel().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean nextRow() {
|
||||||
|
boolean ret;
|
||||||
|
|
||||||
|
if ((publications != null) && publications.next()) {
|
||||||
|
publication = publications.getPublication();
|
||||||
|
ret = true;
|
||||||
|
} else {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getElementAt(int columnIndex) {
|
||||||
|
switch (columnIndex) {
|
||||||
|
case 0:
|
||||||
|
return publication.getTitle();
|
||||||
|
case 1:
|
||||||
|
return SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize(
|
||||||
|
"sciorganizationpublication.ui.publiction.remove").
|
||||||
|
localize();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getKeyAt(int columnIndex) {
|
||||||
|
return publication.getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
|
getSecurityManager(state);
|
||||||
|
|
||||||
|
SciDepartmentWithPublications department =
|
||||||
|
(SciDepartmentWithPublications) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
department);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
Publication publication;
|
||||||
|
try {
|
||||||
|
publication = new Publication((BigDecimal) key);
|
||||||
|
} catch (ObjectNotFoundException ex) {
|
||||||
|
return new Label(value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
ContentSection section = CMS.getContext().getContentSection();
|
||||||
|
ItemResolver resolver = section.getItemResolver();
|
||||||
|
Link link = new Link(value.toString(),
|
||||||
|
resolver.generateItemURL(state,
|
||||||
|
publication,
|
||||||
|
section,
|
||||||
|
publication.
|
||||||
|
getVersion()));
|
||||||
|
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DeleteCellRenderer
|
||||||
|
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);
|
||||||
|
SciDepartmentWithPublications organization =
|
||||||
|
(SciDepartmentWithPublications) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.DELETE_ITEM,
|
||||||
|
organization);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
ControlLink link = new ControlLink(value.toString());
|
||||||
|
link.setConfirmation((String) SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize(
|
||||||
|
"sciorganizationpublication.ui.publication.confirm.remove").
|
||||||
|
localize());
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
|
Publication publication =
|
||||||
|
new Publication(new BigDecimal(event.getRowKey().toString()));
|
||||||
|
|
||||||
|
SciDepartmentWithPublications department =
|
||||||
|
(SciDepartmentWithPublications) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
|
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||||
|
//Nothing to do here
|
||||||
|
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||||
|
department.removePublication(publication);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing to do her
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
* 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.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.Publication;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
|
||||||
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciOrganizationPublicationsAddForm
|
||||||
|
extends BasicItemForm
|
||||||
|
implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
|
||||||
|
private ItemSearchWidget itemSearch;
|
||||||
|
private final String ITEM_SEARCH = "publications";
|
||||||
|
|
||||||
|
public SciOrganizationPublicationsAddForm(final ItemSelectionModel itemModel) {
|
||||||
|
super("SciOrganizationPublicationsAddForm", itemModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWidgets() {
|
||||||
|
add(new Label((String) SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize("sciorganization.ui.selectPublication").localize()));
|
||||||
|
itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
||||||
|
findByAssociatedObjectType(Publication.class.getName()));
|
||||||
|
add(itemSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
|
||||||
|
setVisible(state, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
SciOrganizationWithPublications organization =
|
||||||
|
(SciOrganizationWithPublications) getItemSelectionModel().
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
|
organization.addPublication((Publication) data.get(ITEM_SEARCH));
|
||||||
|
}
|
||||||
|
|
||||||
|
init(fse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* 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.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciOrganizationPublicationsStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
private String ADD_PUBLICATION_SHEET_NAME = "addPublication";
|
||||||
|
|
||||||
|
public SciOrganizationPublicationsStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciOrganizationPublicationsStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
BasicItemForm addPublicationSheet = new SciOrganizationPublicationsAddForm(itemModel);
|
||||||
|
add(ADD_PUBLICATION_SHEET_NAME,
|
||||||
|
(String) SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.addPublication").localize(),
|
||||||
|
new WorkflowLockedComponentAccess(addPublicationSheet, itemModel),
|
||||||
|
addPublicationSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
SciOrganizationPublicationsTable publicationTable = new SciOrganizationPublicationsTable(itemModel);
|
||||||
|
setDisplayComponent(publicationTable);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,267 @@
|
||||||
|
/*
|
||||||
|
* 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.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.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciOrganizationPublicationsCollection;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciOrganizationPublicationsTable
|
||||||
|
extends Table
|
||||||
|
implements TableActionListener {
|
||||||
|
|
||||||
|
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||||
|
private final String TABLE_COL_DEL = "table_col_del";
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public SciOrganizationPublicationsTable(final ItemSelectionModel itemModel) {
|
||||||
|
super();
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
|
||||||
|
setEmptyView(new Label(SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize("sciorganizationpublication.ui.publications.none")));
|
||||||
|
|
||||||
|
TableColumnModel columnModel = getColumnModel();
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.publication").localize(),
|
||||||
|
TABLE_COL_EDIT));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
1,
|
||||||
|
SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.publication.remove").
|
||||||
|
localize(), TABLE_COL_DEL));
|
||||||
|
|
||||||
|
setModelBuilder(new SciOrganizationPublicationsTableModelBuilder(
|
||||||
|
itemModel));
|
||||||
|
|
||||||
|
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||||
|
columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
|
addTableActionListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SciOrganizationPublicationsTableModelBuilder
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableModelBuilder {
|
||||||
|
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public SciOrganizationPublicationsTableModelBuilder(
|
||||||
|
final ItemSelectionModel itemModel) {
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableModel makeModel(final Table table, final PageState state) {
|
||||||
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
|
SciOrganizationWithPublications organization =
|
||||||
|
(SciOrganizationWithPublications) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
return new SciOrganizationPublicationsTableModel(table,
|
||||||
|
state,
|
||||||
|
organization);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SciOrganizationPublicationsTableModel implements TableModel {
|
||||||
|
|
||||||
|
private Table table;
|
||||||
|
private SciOrganizationPublicationsCollection publications;
|
||||||
|
private Publication publication;
|
||||||
|
|
||||||
|
public SciOrganizationPublicationsTableModel(
|
||||||
|
final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final SciOrganizationWithPublications organization) {
|
||||||
|
this.table = table;
|
||||||
|
publications = organization.getPublications();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColumnCount() {
|
||||||
|
return table.getColumnModel().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean nextRow() {
|
||||||
|
boolean ret;
|
||||||
|
|
||||||
|
if ((publications != null) && publications.next()) {
|
||||||
|
publication = publications.getPublication();
|
||||||
|
ret = true;
|
||||||
|
} else {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getElementAt(final int columnIndex) {
|
||||||
|
switch (columnIndex) {
|
||||||
|
case 0:
|
||||||
|
return publication.getTitle();
|
||||||
|
case 1:
|
||||||
|
return SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize(
|
||||||
|
"sciorganizationpublication.ui.publiction.remove").
|
||||||
|
localize();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getKeyAt(final int columnIndex) {
|
||||||
|
return publication.getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
|
getSecurityManager(state);
|
||||||
|
SciOrganizationWithPublications organization =
|
||||||
|
(SciOrganizationWithPublications) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
organization);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
Publication publication;
|
||||||
|
try {
|
||||||
|
publication = new Publication((BigDecimal) key);
|
||||||
|
} catch (ObjectNotFoundException ex) {
|
||||||
|
return new Label(value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
ContentSection section = CMS.getContext().getContentSection();
|
||||||
|
ItemResolver resolver = section.getItemResolver();
|
||||||
|
Link link = new Link(value.toString(),
|
||||||
|
resolver.generateItemURL(state,
|
||||||
|
publication,
|
||||||
|
section,
|
||||||
|
publication.
|
||||||
|
getVersion()));
|
||||||
|
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DeleteCellRenderer
|
||||||
|
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);
|
||||||
|
SciOrganizationWithPublications organization =
|
||||||
|
(SciOrganizationWithPublications) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.DELETE_ITEM,
|
||||||
|
organization);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
ControlLink link = new ControlLink(value.toString());
|
||||||
|
link.setConfirmation((String) SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize(
|
||||||
|
"sciorganizationpublication.ui.publication.confirm.remove").
|
||||||
|
localize());
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
|
Publication publication =
|
||||||
|
new Publication(new BigDecimal(event.getRowKey().toString()));
|
||||||
|
|
||||||
|
SciOrganizationWithPublications organization =
|
||||||
|
(SciOrganizationWithPublications) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
|
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||||
|
//Nothing to do here
|
||||||
|
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||||
|
organization.removePublication(publication);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing to do.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*
|
||||||
|
* 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.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.Publication;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProjectWithPublications;
|
||||||
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciProjectPublicationsAddForm
|
||||||
|
extends BasicItemForm
|
||||||
|
implements FormInitListener,
|
||||||
|
FormProcessListener {
|
||||||
|
|
||||||
|
private ItemSearchWidget itemSearch;
|
||||||
|
private final String ITEM_SEARCH = "publications";
|
||||||
|
|
||||||
|
public SciProjectPublicationsAddForm(final ItemSelectionModel itemModel) {
|
||||||
|
super("SciProjectPublicationsAddForm", itemModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWidgets() {
|
||||||
|
add(new Label((String) SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize("sciorganization.ui.selectPublication").localize()));
|
||||||
|
itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
||||||
|
findByAssociatedObjectType(Publication.class.getName()));
|
||||||
|
add(itemSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
|
||||||
|
setVisible(state, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
SciProjectWithPublications project =
|
||||||
|
(SciProjectWithPublications) getItemSelectionModel().
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
|
project.addPublication((Publication) data.get(ITEM_SEARCH));
|
||||||
|
}
|
||||||
|
|
||||||
|
init(fse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* 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.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciProjectPublicationsStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
private String ADD_PUBLICATION_SHEET_NAME = "addPublication";
|
||||||
|
|
||||||
|
public SciProjectPublicationsStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciProjectPublicationsStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
BasicItemForm addPublicationSheet = new SciProjectPublicationsAddForm(itemModel);
|
||||||
|
add(ADD_PUBLICATION_SHEET_NAME,
|
||||||
|
(String) SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.project.addPublication").localize(),
|
||||||
|
new WorkflowLockedComponentAccess(addPublicationSheet, itemModel),
|
||||||
|
addPublicationSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
SciProjectPublicationsTable publicationTable = new SciProjectPublicationsTable(itemModel);
|
||||||
|
setDisplayComponent(publicationTable);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,265 @@
|
||||||
|
/*
|
||||||
|
* 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.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.contenttypes.Publication;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProjectPublicationsCollection;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProjectWithPublications;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciProjectPublicationsTable
|
||||||
|
extends Table
|
||||||
|
implements TableActionListener {
|
||||||
|
|
||||||
|
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||||
|
private final String TABLE_COL_DEL = "table_col_del";
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public SciProjectPublicationsTable(final ItemSelectionModel itemModel) {
|
||||||
|
super();
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
|
||||||
|
setEmptyView(new Label(SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize("sciorganizationpublication.ui.publications.none")));
|
||||||
|
|
||||||
|
TableColumnModel columnModel = getColumnModel();
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.publication").localize(),
|
||||||
|
TABLE_COL_EDIT));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
1,
|
||||||
|
SciOrganizationWithPublicationsGlobalizationUtil.globalize(
|
||||||
|
"sciorganizationpublication.ui.publication.remove").
|
||||||
|
localize(), TABLE_COL_DEL));
|
||||||
|
|
||||||
|
setModelBuilder(new SciProjectPublicationsTableModelBuilder(
|
||||||
|
itemModel));
|
||||||
|
|
||||||
|
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||||
|
columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
|
addTableActionListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SciProjectPublicationsTableModelBuilder
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableModelBuilder {
|
||||||
|
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public SciProjectPublicationsTableModelBuilder(
|
||||||
|
final ItemSelectionModel itemModel) {
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableModel makeModel(final Table table, final PageState state) {
|
||||||
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
|
SciProjectWithPublications project =
|
||||||
|
(SciProjectWithPublications) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
return new SciProjectPublicationsTableModel(table,
|
||||||
|
state,
|
||||||
|
project);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SciProjectPublicationsTableModel implements TableModel {
|
||||||
|
|
||||||
|
private Table table;
|
||||||
|
private SciProjectPublicationsCollection publications;
|
||||||
|
private Publication publication;
|
||||||
|
|
||||||
|
public SciProjectPublicationsTableModel(
|
||||||
|
final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final SciProjectWithPublications project) {
|
||||||
|
this.table = table;
|
||||||
|
publications = project.getPublications();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColumnCount() {
|
||||||
|
return table.getColumnModel().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean nextRow() {
|
||||||
|
boolean ret;
|
||||||
|
|
||||||
|
if ((publications != null) && publications.next()) {
|
||||||
|
publication = publications.getPublication();
|
||||||
|
ret = true;
|
||||||
|
} else {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getElementAt(int columnIndex) {
|
||||||
|
switch (columnIndex) {
|
||||||
|
case 0:
|
||||||
|
return publication.getTitle();
|
||||||
|
case 1:
|
||||||
|
return SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize(
|
||||||
|
"sciorganizationpublication.ui.publiction.remove").
|
||||||
|
localize();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getKeyAt(int columnIndex) {
|
||||||
|
return publication.getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
|
getSecurityManager(state);
|
||||||
|
SciProjectWithPublications project =
|
||||||
|
(SciProjectWithPublications) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
project);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
Publication publication;
|
||||||
|
try {
|
||||||
|
publication = new Publication((BigDecimal) key);
|
||||||
|
} catch (ObjectNotFoundException ex) {
|
||||||
|
return new Label(value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
ContentSection section = CMS.getContext().getContentSection();
|
||||||
|
ItemResolver resolver = section.getItemResolver();
|
||||||
|
Link link = new Link(value.toString(),
|
||||||
|
resolver.generateItemURL(state,
|
||||||
|
publication,
|
||||||
|
section,
|
||||||
|
publication.
|
||||||
|
getVersion()));
|
||||||
|
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DeleteCellRenderer
|
||||||
|
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);
|
||||||
|
SciProjectWithPublications project =
|
||||||
|
(SciProjectWithPublications) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.DELETE_ITEM,
|
||||||
|
project);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
ControlLink link = new ControlLink(value.toString());
|
||||||
|
link.setConfirmation((String) SciOrganizationWithPublicationsGlobalizationUtil.
|
||||||
|
globalize(
|
||||||
|
"sciorganizationpublication.ui.publication.confirm.remove").
|
||||||
|
localize());
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
|
Publication publication =
|
||||||
|
new Publication(new BigDecimal(event.getRowKey().toString()));
|
||||||
|
|
||||||
|
SciProjectWithPublications project =
|
||||||
|
(SciProjectWithPublications) itemModel.
|
||||||
|
getSelectedObject(state);
|
||||||
|
|
||||||
|
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
|
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||||
|
//Nothing to do here
|
||||||
|
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||||
|
project.removePublication(publication);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing to do.
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue