- Bei SciProject kann jetzt optional eine Organisation als Drittmittelgeber ausgewählt werden
- Verschiedene Formatierungen git-svn-id: https://svn.libreccm.org/ccm/trunk@2334 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
5be6e98b64
commit
c245341db7
|
|
@ -52,8 +52,10 @@ public class PublicationGenericOrganizationalUnitsStep extends SimpleEditStep {
|
||||||
new WorkflowLockedComponentAccess(addOrgaUnitSheet, itemModel),
|
new WorkflowLockedComponentAccess(addOrgaUnitSheet, itemModel),
|
||||||
addOrgaUnitSheet.getSaveCancelSection().getCancelButton());
|
addOrgaUnitSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
final PublicationGenericOrganizationalUnitsTable orgaunitsTable = new PublicationGenericOrganizationalUnitsTable(
|
final PublicationGenericOrganizationalUnitsTable orgaunitsTable =
|
||||||
|
new PublicationGenericOrganizationalUnitsTable(
|
||||||
itemModel);
|
itemModel);
|
||||||
setDisplayComponent(orgaunitsTable);
|
setDisplayComponent(orgaunitsTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import com.arsdigita.bebop.table.TableColumn;
|
||||||
import com.arsdigita.bebop.table.TableColumnModel;
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
import com.arsdigita.bebop.table.TableModel;
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
import com.arsdigita.bebop.table.TableModelBuilder;
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
|
|
@ -160,8 +161,7 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
|
||||||
final Object key,
|
final Object key,
|
||||||
final int row,
|
final int row,
|
||||||
final int column) {
|
final int column) {
|
||||||
final com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
getSecurityManager(state);
|
|
||||||
final GenericOrganizationalUnit orgaunit =
|
final GenericOrganizationalUnit orgaunit =
|
||||||
new GenericOrganizationalUnit(
|
new GenericOrganizationalUnit(
|
||||||
(BigDecimal) key);
|
(BigDecimal) key);
|
||||||
|
|
@ -171,7 +171,7 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
|
||||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
orgaunit);
|
orgaunit);
|
||||||
if (canEdit) {
|
if (canEdit) {
|
||||||
final ContentSection section = orgaunit.getContentSection();//CMS.getContext().getContentSection();
|
final ContentSection section = orgaunit.getContentSection();
|
||||||
final ItemResolver resolver = section.getItemResolver();
|
final ItemResolver resolver = section.getItemResolver();
|
||||||
final Link link = new Link(
|
final Link link = new Link(
|
||||||
String.format("%s (%s)",
|
String.format("%s (%s)",
|
||||||
|
|
@ -205,8 +205,7 @@ public class PublicationGenericOrganizationalUnitsTable extends Table {
|
||||||
final Object key,
|
final Object key,
|
||||||
final int row,
|
final int row,
|
||||||
final int column) {
|
final int column) {
|
||||||
final com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
getSecurityManager(state);
|
|
||||||
final Publication publication =
|
final Publication publication =
|
||||||
(Publication) itemModel.getSelectedObject(state);
|
(Publication) itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ public class PublicationWithPublisherSetPublisherForm
|
||||||
config.load();
|
config.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public PublicationWithPublisherSetPublisherForm(
|
public PublicationWithPublisherSetPublisherForm(
|
||||||
final ItemSelectionModel itemModel) {
|
final ItemSelectionModel itemModel) {
|
||||||
super("PublicationWithPublisherSetPublisher", itemModel);
|
super("PublicationWithPublisherSetPublisher", itemModel);
|
||||||
|
|
@ -62,12 +61,14 @@ public class PublicationWithPublisherSetPublisherForm
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addWidgets() {
|
public void addWidgets() {
|
||||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
add(new Label(PublicationGlobalizationUtil.globalize(
|
||||||
"publications.ui.with_publisher.publisher").localize()));
|
"publications.ui.with_publisher.publisher")));
|
||||||
itemSearch =
|
itemSearch =
|
||||||
new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType(Publisher.class.getName()));
|
new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType(Publisher.class.
|
||||||
|
getName()));
|
||||||
if ((config.getDefaultPublisherFolder() != null) && config.getDefaultPublisherFolder() != 0) {
|
if ((config.getDefaultPublisherFolder() != null) && config.getDefaultPublisherFolder() != 0) {
|
||||||
itemSearch.setDefaultCreationFolder(new Folder(new BigDecimal(config.getDefaultPublisherFolder())));
|
itemSearch.setDefaultCreationFolder(new Folder(new BigDecimal(config.
|
||||||
|
getDefaultPublisherFolder())));
|
||||||
}
|
}
|
||||||
itemSearch.setEditAfterCreate(false);
|
itemSearch.setEditAfterCreate(false);
|
||||||
add(itemSearch);
|
add(itemSearch);
|
||||||
|
|
@ -90,7 +91,8 @@ public class PublicationWithPublisherSetPublisherForm
|
||||||
|
|
||||||
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
Publisher publisher = (Publisher) data.get(ITEM_SEARCH);
|
Publisher publisher = (Publisher) data.get(ITEM_SEARCH);
|
||||||
publisher = (Publisher) publisher.getContentBundle().getInstance(publication.getLanguage());
|
publisher = (Publisher) publisher.getContentBundle().getInstance(publication.
|
||||||
|
getLanguage());
|
||||||
|
|
||||||
publication.setPublisher(publisher);
|
publication.setPublisher(publisher);
|
||||||
itemSearch.publishCreatedItem(data, publisher);
|
itemSearch.publishCreatedItem(data, publisher);
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,12 @@ import com.arsdigita.bebop.table.TableColumn;
|
||||||
import com.arsdigita.bebop.table.TableColumnModel;
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
import com.arsdigita.bebop.table.TableModel;
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
import com.arsdigita.bebop.table.TableModelBuilder;
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
|
import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ContentSection;
|
import com.arsdigita.cms.ContentSection;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.PublicationWithPublisher;
|
import com.arsdigita.cms.contenttypes.PublicationWithPublisher;
|
||||||
import com.arsdigita.cms.contenttypes.Publisher;
|
import com.arsdigita.cms.contenttypes.Publisher;
|
||||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
|
||||||
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||||
import com.arsdigita.util.LockableImpl;
|
import com.arsdigita.util.LockableImpl;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -171,7 +171,7 @@ public class PublicationWithPublisherSetPublisherSheet
|
||||||
int row,
|
int row,
|
||||||
int column) {
|
int column) {
|
||||||
com.arsdigita.cms.SecurityManager securityManager =
|
com.arsdigita.cms.SecurityManager securityManager =
|
||||||
Utilities.getSecurityManager(state);
|
CMS.getSecurityManager(state);
|
||||||
PublicationWithPublisher publication =
|
PublicationWithPublisher publication =
|
||||||
(PublicationWithPublisher) itemModel.
|
(PublicationWithPublisher) itemModel.
|
||||||
getSelectedObject(state);
|
getSelectedObject(state);
|
||||||
|
|
@ -226,7 +226,7 @@ public class PublicationWithPublisherSetPublisherSheet
|
||||||
int row,
|
int row,
|
||||||
int col) {
|
int col) {
|
||||||
com.arsdigita.cms.SecurityManager securityManager =
|
com.arsdigita.cms.SecurityManager securityManager =
|
||||||
Utilities.getSecurityManager(state);
|
CMS.getSecurityManager(state);
|
||||||
PublicationWithPublisher publication =
|
PublicationWithPublisher publication =
|
||||||
(PublicationWithPublisher) itemModel.
|
(PublicationWithPublisher) itemModel.
|
||||||
getSelectedObject(
|
getSelectedObject(
|
||||||
|
|
|
||||||
|
|
@ -46,12 +46,15 @@ public class PublicationWithPublisherSetPublisherStep extends SimpleEditStep {
|
||||||
BasicItemForm setPublisherForm = new PublicationWithPublisherSetPublisherForm(
|
BasicItemForm setPublisherForm = new PublicationWithPublisherSetPublisherForm(
|
||||||
itemModel);
|
itemModel);
|
||||||
add(SET_PUBLICATION_PUBLISHER_STEP,
|
add(SET_PUBLICATION_PUBLISHER_STEP,
|
||||||
(String) PublicationGlobalizationUtil.globalize("publications.ui.with_publisher.setPublisher").localize(),
|
(String) PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.with_publisher.setPublisher").localize(),
|
||||||
new WorkflowLockedComponentAccess(setPublisherForm, itemModel),
|
new WorkflowLockedComponentAccess(setPublisherForm, itemModel),
|
||||||
setPublisherForm.getSaveCancelSection().getCancelButton());
|
setPublisherForm.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
PublicationWithPublisherSetPublisherSheet sheet = new PublicationWithPublisherSetPublisherSheet(
|
PublicationWithPublisherSetPublisherSheet sheet =
|
||||||
|
new PublicationWithPublisherSetPublisherSheet(
|
||||||
itemModel);
|
itemModel);
|
||||||
setDisplayComponent(sheet);
|
setDisplayComponent(sheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||||
name="ccm-sci-types-project"
|
name="ccm-sci-types-project"
|
||||||
prettyName="Scientific CMS Project content type"
|
prettyName="Scientific CMS Project content type"
|
||||||
version = "6.6.6"
|
version = "6.6.7"
|
||||||
release="1"
|
release="1"
|
||||||
webapp="ROOT">
|
webapp="ROOT">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,19 @@ object type SciProjectBundle extends GenericOrganizationalUnitBundle {
|
||||||
reference key (ct_sci_project_bundles.bundle_id);
|
reference key (ct_sci_project_bundles.bundle_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
association {
|
||||||
|
GenericOrganizationalUnitBundle[0..n] sponsors = join ct_sci_project_bundles.bundle_id
|
||||||
|
to ct_sci_project_sponsor_map.project_id,
|
||||||
|
join ct_sci_project_sponsor_map.sponsor_id
|
||||||
|
to cms_orgaunit_bundles.bundle_id;
|
||||||
|
|
||||||
|
SciProjectBundle[0..n] sponsoredProjects = join cms_orgaunit_bundles.bundle_id
|
||||||
|
to ct_sci_project_sponsor_map.sponsor_id,
|
||||||
|
join ct_sci_project_sponsor_map.project_id
|
||||||
|
to ct_sci_project_bundles.bundle_id;
|
||||||
|
Integer[0..1] sponsorOrder = ct_sci_project_sponsor_map.sponsor_order INTEGER;
|
||||||
|
}
|
||||||
|
|
||||||
query getIdsOfProjectsOfOrgaUnit {
|
query getIdsOfProjectsOfOrgaUnit {
|
||||||
BigDecimal projectId;
|
BigDecimal projectId;
|
||||||
BigDecimal orgaunitId;
|
BigDecimal orgaunitId;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
create table ct_sci_project_sponsor_map (
|
||||||
|
sponsor_id INTEGER not null,
|
||||||
|
project_id INTEGER not null,
|
||||||
|
sponsor_order INTEGER,
|
||||||
|
|
||||||
|
constraint ct_sci_pro_spo_map_pro_p_y6bbk
|
||||||
|
primary key(project_id, sponsor_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
alter table ct_sci_project_sponsor_map add
|
||||||
|
constraint ct_sci_pro_spo_map_pro_f_8a7hv foreign key (project_id)
|
||||||
|
references ct_sci_project_bundles(bundle_id);
|
||||||
|
alter table ct_sci_project_sponsor_map add
|
||||||
|
constraint ct_sci_pro_spo_map_spo_f_7x6td foreign key (sponsor_id)
|
||||||
|
references cms_orgaunit_bundles(bundle_id);
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
\echo 'ScientificCMS SciProject module upgrade 6.6.6 -> 6.6.7 (PostgreSQL)'
|
||||||
|
|
||||||
|
begin;
|
||||||
|
|
||||||
|
\i ../default/upgrade/6.6.6-6.6.7/create_sponsor_map.sql
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
@ -2,4 +2,7 @@
|
||||||
<version from="6.6.5" to="6.6.6">
|
<version from="6.6.5" to="6.6.6">
|
||||||
<script class="com.arsdigita.cms.contenttypes.upgrades.SciProjectUpgrade665to666"/>
|
<script class="com.arsdigita.cms.contenttypes.upgrades.SciProjectUpgrade665to666"/>
|
||||||
</version>
|
</version>
|
||||||
|
<version from="6.6.6" to="6.6.7">
|
||||||
|
<script sql="ccm-sci-publications/upgrade/::database::-6.6.6-6.6.7.sql"/>
|
||||||
|
</version>
|
||||||
</upgrade>
|
</upgrade>
|
||||||
|
|
@ -84,6 +84,10 @@ public class SciProject extends GenericOrganizationalUnit {
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SciProjectBundle getSciProjectBundle() {
|
||||||
|
return (SciProjectBundle) getContentBundle();
|
||||||
|
}
|
||||||
|
|
||||||
public Date getBegin() {
|
public Date getBegin() {
|
||||||
return (Date) get(BEGIN);
|
return (Date) get(BEGIN);
|
||||||
}
|
}
|
||||||
|
|
@ -182,6 +186,22 @@ public class SciProject extends GenericOrganizationalUnit {
|
||||||
set(PROJECT_DESCRIPTION, description);
|
set(PROJECT_DESCRIPTION, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SciProjectSponsorCollection getSponsors() {
|
||||||
|
return getSciProjectBundle().getSponsors();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addSponsor(final GenericOrganizationalUnit sponsor) {
|
||||||
|
getSciProjectBundle().addSponsor(sponsor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeSponsor(final GenericOrganizationalUnit sponsor) {
|
||||||
|
getSciProjectBundle().removeSponsor(sponsor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasSponsors() {
|
||||||
|
return !getSponsors().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
public String getFunding() {
|
public String getFunding() {
|
||||||
return (String) get(FUNDING);
|
return (String) get(FUNDING);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,15 @@
|
||||||
package com.arsdigita.cms.contenttypes;
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.CustomCopy;
|
||||||
|
import com.arsdigita.cms.ItemCopier;
|
||||||
|
import com.arsdigita.cms.XMLDeliveryCache;
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.persistence.metadata.Property;
|
||||||
import com.arsdigita.util.Assert;
|
import com.arsdigita.util.Assert;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
@ -16,6 +22,8 @@ public class SciProjectBundle extends GenericOrganizationalUnitBundle {
|
||||||
|
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
"com.arsdigita.cms.contenttypes.SciProjectBundle";
|
"com.arsdigita.cms.contenttypes.SciProjectBundle";
|
||||||
|
public static final String SPONSORS = "sponsors";
|
||||||
|
public static final String SPONSOR_ORDER = "sponsorOrder";
|
||||||
|
|
||||||
public SciProjectBundle(final ContentItem primary) {
|
public SciProjectBundle(final ContentItem primary) {
|
||||||
super(BASE_DATA_OBJECT_TYPE);
|
super(BASE_DATA_OBJECT_TYPE);
|
||||||
|
|
@ -54,4 +62,109 @@ public class SciProjectBundle extends GenericOrganizationalUnitBundle {
|
||||||
public SciProject getProject(final String language) {
|
public SciProject getProject(final String language) {
|
||||||
return (SciProject) getInstance(language);
|
return (SciProject) getInstance(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SciProjectSponsorCollection getSponsors() {
|
||||||
|
return new SciProjectSponsorCollection((DataCollection) get(SPONSORS));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addSponsor(final GenericOrganizationalUnit sponsor) {
|
||||||
|
Assert.exists(sponsor, GenericOrganizationalUnit.class);
|
||||||
|
|
||||||
|
final DataObject link = add(SPONSORS, sponsor.getGenericOrganizationalUnitBundle());
|
||||||
|
|
||||||
|
link.set(SPONSOR_ORDER, Integer.valueOf((int) getSponsors().size()));
|
||||||
|
|
||||||
|
link.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeSponsor(final GenericOrganizationalUnit sponsor) {
|
||||||
|
Assert.exists(sponsor, GenericOrganizationalUnit.class);
|
||||||
|
|
||||||
|
remove(SPONSORS, sponsor);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean copyProperty(final CustomCopy source,
|
||||||
|
final Property property,
|
||||||
|
final ItemCopier copier) {
|
||||||
|
if (copier.getCopyType() == ItemCopier.VERSION_COPY) {
|
||||||
|
final SciProjectBundle projectBundle = (SciProjectBundle) source;
|
||||||
|
|
||||||
|
if (SPONSORS.equals(property.getName())) {
|
||||||
|
final DataCollection sponsors = (DataCollection) projectBundle.get(SPONSORS);
|
||||||
|
|
||||||
|
while (sponsors.next()) {
|
||||||
|
createSponsorAssoc(sponsors);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return super.copyProperty(source, property, copier);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return super.copyProperty(source, property, copier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createSponsorAssoc(final DataCollection sponsors) {
|
||||||
|
final GenericOrganizationalUnitBundle sponsorDraft =
|
||||||
|
(GenericOrganizationalUnitBundle) DomainObjectFactory.
|
||||||
|
newInstance(sponsors.getDataObject());
|
||||||
|
final GenericOrganizationalUnitBundle sponsorLive =
|
||||||
|
(GenericOrganizationalUnitBundle) sponsorDraft.
|
||||||
|
getLiveVersion();
|
||||||
|
|
||||||
|
if (sponsorLive != null) {
|
||||||
|
final DataObject link = add(SPONSORS, sponsorLive);
|
||||||
|
|
||||||
|
link.set(SPONSOR_ORDER, sponsors.get("link." + SPONSOR_ORDER));
|
||||||
|
|
||||||
|
link.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean copyReverseProperty(final CustomCopy source,
|
||||||
|
final ContentItem liveItem,
|
||||||
|
final Property property,
|
||||||
|
final ItemCopier copier) {
|
||||||
|
if (copier.getCopyType() == ItemCopier.VERSION_COPY) {
|
||||||
|
if ("sponsoredProjects".equals(property.getName())
|
||||||
|
&& (source instanceof GenericOrganizationalUnitBundle)) {
|
||||||
|
final GenericOrganizationalUnitBundle sponsorBundle =
|
||||||
|
(GenericOrganizationalUnitBundle) source;
|
||||||
|
final DataCollection sponsoredProjects = (DataCollection) sponsorBundle.get(
|
||||||
|
"sponsoredProjects");
|
||||||
|
|
||||||
|
while(sponsoredProjects.next()) {
|
||||||
|
createSponsorProjectAssoc(sponsoredProjects,
|
||||||
|
(GenericOrganizationalUnitBundle) liveItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return super.copyReverseProperty(source, liveItem, property, copier);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return super.copyReverseProperty(source, liveItem, property, copier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createSponsorProjectAssoc(final DataCollection projects,
|
||||||
|
final GenericOrganizationalUnitBundle sponsor) {
|
||||||
|
final SciProjectBundle draftProject = (SciProjectBundle) DomainObjectFactory.newInstance(
|
||||||
|
projects.getDataObject());
|
||||||
|
final SciProjectBundle liveProject = (SciProjectBundle) draftProject.getLiveVersion();
|
||||||
|
|
||||||
|
if (liveProject != null) {
|
||||||
|
final DataObject link = sponsor.add("sponsoredProjects", liveProject);
|
||||||
|
|
||||||
|
link.set(SPONSOR_ORDER, projects.get("link." + SPONSOR_ORDER));
|
||||||
|
|
||||||
|
link.save();
|
||||||
|
|
||||||
|
XMLDeliveryCache.getInstance().removeFromCache(liveProject.getOID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,8 @@ public class SciProjectConfig extends AbstractConfig {
|
||||||
private final Parameter enableDescriptionDhtml;
|
private final Parameter enableDescriptionDhtml;
|
||||||
private final Parameter enableMembersAllInOne;
|
private final Parameter enableMembersAllInOne;
|
||||||
private final Parameter enableMembersMerge;
|
private final Parameter enableMembersMerge;
|
||||||
|
private final Parameter enableSponsor;
|
||||||
|
private final Parameter sponsorType;
|
||||||
private final Parameter enableFunding;
|
private final Parameter enableFunding;
|
||||||
private final Parameter enableFundingDhtml;
|
private final Parameter enableFundingDhtml;
|
||||||
private final Parameter enableFundingVolume;
|
private final Parameter enableFundingVolume;
|
||||||
|
|
@ -91,6 +93,16 @@ public class SciProjectConfig extends AbstractConfig {
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
Boolean.TRUE);
|
Boolean.TRUE);
|
||||||
|
|
||||||
|
enableSponsor = new BooleanParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.sciproject.enable_sponsor",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
Boolean.TRUE);
|
||||||
|
|
||||||
|
sponsorType = new StringParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.sciproject.sponsor_type",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
GenericOrganizationalUnit.class.getName());
|
||||||
|
|
||||||
enableFunding = new BooleanParameter(
|
enableFunding = new BooleanParameter(
|
||||||
"com.arsdigita.cms.contenttypes.sciproject.enable_funding",
|
"com.arsdigita.cms.contenttypes.sciproject.enable_funding",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
|
|
@ -135,6 +147,8 @@ public class SciProjectConfig extends AbstractConfig {
|
||||||
register(enableDescriptionDhtml);
|
register(enableDescriptionDhtml);
|
||||||
register(enableMembersAllInOne);
|
register(enableMembersAllInOne);
|
||||||
register(enableMembersMerge);
|
register(enableMembersMerge);
|
||||||
|
register(enableSponsor);
|
||||||
|
register(sponsorType);
|
||||||
register(enableFunding);
|
register(enableFunding);
|
||||||
register(enableFundingDhtml);
|
register(enableFundingDhtml);
|
||||||
register(enableFundingVolume);
|
register(enableFundingVolume);
|
||||||
|
|
@ -185,6 +199,14 @@ public class SciProjectConfig extends AbstractConfig {
|
||||||
return (Boolean) get(enableMembersMerge);
|
return (Boolean) get(enableMembersMerge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final boolean getEnableSponsor() {
|
||||||
|
return (Boolean) get(enableSponsor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final String getSponsorType() {
|
||||||
|
return (String) get(sponsorType);
|
||||||
|
}
|
||||||
|
|
||||||
public final boolean getEnableFunding() {
|
public final boolean getEnableFunding() {
|
||||||
return (Boolean) get(enableFunding);
|
return (Boolean) get(enableFunding);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,16 @@ com.arsdigita.cms.contenttypes.sciproject.enable_members_merge.purpose = Decides
|
||||||
com.arsdigita.cms.contenttypes.sciproject.enable_members_merge.example = true
|
com.arsdigita.cms.contenttypes.sciproject.enable_members_merge.example = true
|
||||||
com.arsdigita.cms.contenttypes.sciproject.enable_members_merge.format = [Boolean]
|
com.arsdigita.cms.contenttypes.sciproject.enable_members_merge.format = [Boolean]
|
||||||
|
|
||||||
|
com.arsdigita.cms.contenttypes.sciproject.enable_sponsor.title = Enable sponsor selection
|
||||||
|
com.arsdigita.cms.contenttypes.sciproject.enable_sponsor.purpose = Enables or disables the ItemSearchWidget for selecting the sponsoring organisation of a SciProject.
|
||||||
|
com.arsdigita.cms.contenttypes.sciproject.enable_sponsor.example = true
|
||||||
|
com.arsdigita.cms.contenttypes.sciproject.enable_sponsor.format = [Boolean]
|
||||||
|
|
||||||
|
com.arsdigita.cms.contenttypes.sciproject.sponsor_type.title = Content type for sponsoring organizations.
|
||||||
|
com.arsdigita.cms.contenttypes.sciproject.sponsor_type.purpose = Restrict the type of organization which can be used as sponsors.
|
||||||
|
com.arsdigita.cms.contenttypes.sciproject.sponsor_type.example = com.arsdigita.cms.contenttypes.GenericOrganizationalUnit
|
||||||
|
com.arsdigita.cms.contenttypes.sciproject.sponsor_type.format = [String]
|
||||||
|
|
||||||
com.arsdigita.cms.contenttypes.sciproject.enable_funding.title = Enable funding input field
|
com.arsdigita.cms.contenttypes.sciproject.enable_funding.title = Enable funding input field
|
||||||
com.arsdigita.cms.contenttypes.sciproject.enable_funding.purpose = Enables or disables an text area input field for a description how the project is funded.
|
com.arsdigita.cms.contenttypes.sciproject.enable_funding.purpose = Enables or disables an text area input field for a description how the project is funded.
|
||||||
com.arsdigita.cms.contenttypes.sciproject.enable_funding.example = true
|
com.arsdigita.cms.contenttypes.sciproject.enable_funding.example = true
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import com.arsdigita.cms.ContentBundle;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciProjectSponsorCollection extends DomainCollection {
|
||||||
|
|
||||||
|
public SciProjectSponsorCollection(final DataCollection dataCollection) {
|
||||||
|
super(dataCollection);
|
||||||
|
|
||||||
|
addOrder("name");
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenericOrganizationalUnit getSponsor() {
|
||||||
|
final ContentBundle bundle = (ContentBundle) DomainObjectFactory.newInstance(
|
||||||
|
m_dataCollection.getDataObject());
|
||||||
|
return (GenericOrganizationalUnit) bundle.getPrimaryInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GenericOrganizationalUnit getSponsor(final String language) {
|
||||||
|
final ContentBundle bundle = (ContentBundle) DomainObjectFactory.newInstance(
|
||||||
|
m_dataCollection.getDataObject());
|
||||||
|
return (GenericOrganizationalUnit) bundle.getInstance(language);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getID() {
|
||||||
|
return getSponsor().getID();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return getSponsor().getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -7,18 +7,29 @@ import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.event.FormInitListener;
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.event.PrintEvent;
|
||||||
|
import com.arsdigita.bebop.event.PrintListener;
|
||||||
import com.arsdigita.bebop.form.TextArea;
|
import com.arsdigita.bebop.form.TextArea;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
import com.arsdigita.bebop.form.TextField;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
import com.arsdigita.cms.ContentType;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||||
import com.arsdigita.cms.contenttypes.SciProject;
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
import com.arsdigita.cms.contenttypes.SciProjectConfig;
|
import com.arsdigita.cms.contenttypes.SciProjectConfig;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProjectSponsorCollection;
|
||||||
import com.arsdigita.cms.ui.CMSDHTMLEditor;
|
import com.arsdigita.cms.ui.CMSDHTMLEditor;
|
||||||
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Edit for the the detailed description of a SciProject.
|
||||||
|
*
|
||||||
|
* Note about the sponsors: The PDL and Java code is prepared to handle more than one sponsor, but
|
||||||
|
* for now the UI will only allow to add one sponsor. Will may change in future versions.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* @author Jens Pelzetter
|
* @author Jens Pelzetter
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
|
@ -28,7 +39,9 @@ public class SciProjectDescriptionEditForm
|
||||||
implements FormProcessListener,
|
implements FormProcessListener,
|
||||||
FormInitListener {
|
FormInitListener {
|
||||||
|
|
||||||
private final static SciProjectConfig config = SciProject.getConfig();
|
private final static SciProjectConfig CONFIG = SciProject.getConfig();
|
||||||
|
private final static String SPONSOR_SEARCH = "SPONSOR_SEARCH";
|
||||||
|
private ItemSearchWidget sponsorSearch;
|
||||||
|
|
||||||
public SciProjectDescriptionEditForm(final ItemSelectionModel itemModel) {
|
public SciProjectDescriptionEditForm(final ItemSelectionModel itemModel) {
|
||||||
super("SciProjectDescriptionEditForm", itemModel);
|
super("SciProjectDescriptionEditForm", itemModel);
|
||||||
|
|
@ -41,7 +54,7 @@ public class SciProjectDescriptionEditForm
|
||||||
final ParameterModel descParam = new StringParameter(
|
final ParameterModel descParam = new StringParameter(
|
||||||
SciProject.PROJECT_DESCRIPTION);
|
SciProject.PROJECT_DESCRIPTION);
|
||||||
final TextArea desc;
|
final TextArea desc;
|
||||||
if (config.getEnableDescriptionDhtml()) {
|
if (CONFIG.getEnableDescriptionDhtml()) {
|
||||||
desc = new CMSDHTMLEditor(descParam);
|
desc = new CMSDHTMLEditor(descParam);
|
||||||
} else {
|
} else {
|
||||||
desc = new TextArea(descParam);
|
desc = new TextArea(descParam);
|
||||||
|
|
@ -50,13 +63,44 @@ public class SciProjectDescriptionEditForm
|
||||||
desc.setRows(25);
|
desc.setRows(25);
|
||||||
add(desc);
|
add(desc);
|
||||||
|
|
||||||
if (config.getEnableFunding()) {
|
if (CONFIG.getEnableSponsor()) {
|
||||||
|
add(new Label(SciProjectGlobalizationUtil.globalize("sciproject.ui.sponsor")));
|
||||||
|
final Label sponsorLabel = new Label();
|
||||||
|
sponsorLabel.addPrintListener(new PrintListener() {
|
||||||
|
public void prepare(final PrintEvent event) {
|
||||||
|
final Label target = (Label) event.getTarget();
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
final SciProject project = (SciProject) getItemSelectionModel().
|
||||||
|
getSelectedObject(state);
|
||||||
|
final SciProjectSponsorCollection sponsors = project.getSponsors();
|
||||||
|
|
||||||
|
if ((sponsors != null) && !sponsors.isEmpty()) {
|
||||||
|
sponsors.next();
|
||||||
|
final GenericOrganizationalUnit sponsor = sponsors.getSponsor();
|
||||||
|
target.setLabel(sponsor.getTitle());
|
||||||
|
sponsors.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
add(sponsorLabel);
|
||||||
|
|
||||||
|
add(new Label(SciProjectGlobalizationUtil.globalize("sciproject.ui.choose_sponsor")));
|
||||||
|
sponsorSearch = new ItemSearchWidget(SPONSOR_SEARCH, ContentType.
|
||||||
|
findByAssociatedObjectType(CONFIG.getSponsorType()));
|
||||||
|
add(sponsorSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CONFIG.getEnableFunding()) {
|
||||||
add(new Label(SciProjectGlobalizationUtil.globalize(
|
add(new Label(SciProjectGlobalizationUtil.globalize(
|
||||||
"sciproject.ui.funding")));
|
"sciproject.ui.funding")));
|
||||||
final ParameterModel fundingParam = new StringParameter(
|
final ParameterModel fundingParam = new StringParameter(
|
||||||
SciProject.FUNDING);
|
SciProject.FUNDING);
|
||||||
final TextArea funding;
|
final TextArea funding;
|
||||||
if (config.getEnableFundingDhtml()) {
|
if (CONFIG.getEnableFundingDhtml()) {
|
||||||
funding = new CMSDHTMLEditor(fundingParam);
|
funding = new CMSDHTMLEditor(fundingParam);
|
||||||
} else {
|
} else {
|
||||||
funding = new TextArea(fundingParam);
|
funding = new TextArea(fundingParam);
|
||||||
|
|
@ -66,7 +110,7 @@ public class SciProjectDescriptionEditForm
|
||||||
add(funding);
|
add(funding);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.getEnableFundingVolume()) {
|
if (CONFIG.getEnableFundingVolume()) {
|
||||||
add(new Label(SciProjectGlobalizationUtil.globalize(
|
add(new Label(SciProjectGlobalizationUtil.globalize(
|
||||||
"sciproject.ui.funding.volume")));
|
"sciproject.ui.funding.volume")));
|
||||||
final ParameterModel fundingVolumeParam = new StringParameter(
|
final ParameterModel fundingVolumeParam = new StringParameter(
|
||||||
|
|
@ -74,7 +118,7 @@ public class SciProjectDescriptionEditForm
|
||||||
final TextField fundingVolume = new TextField(fundingVolumeParam);
|
final TextField fundingVolume = new TextField(fundingVolumeParam);
|
||||||
fundingVolume.addValidationListener(new StringInRangeValidationListener(
|
fundingVolume.addValidationListener(new StringInRangeValidationListener(
|
||||||
0,
|
0,
|
||||||
config.getFundingVolumeLength()));
|
CONFIG.getFundingVolumeLength()));
|
||||||
add(fundingVolume);
|
add(fundingVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -88,11 +132,11 @@ public class SciProjectDescriptionEditForm
|
||||||
|
|
||||||
data.put(SciProject.PROJECT_DESCRIPTION,
|
data.put(SciProject.PROJECT_DESCRIPTION,
|
||||||
project.getProjectDescription());
|
project.getProjectDescription());
|
||||||
if (config.getEnableFunding()) {
|
if (CONFIG.getEnableFunding()) {
|
||||||
data.put(SciProject.FUNDING, project.getFunding());
|
data.put(SciProject.FUNDING, project.getFunding());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.getEnableFundingVolume()) {
|
if (CONFIG.getEnableFundingVolume()) {
|
||||||
data.put(SciProject.FUNDING_VOLUME, project.getFundingVolume());
|
data.put(SciProject.FUNDING_VOLUME, project.getFundingVolume());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,20 +147,31 @@ public class SciProjectDescriptionEditForm
|
||||||
public void process(final FormSectionEvent fse) throws FormProcessException {
|
public void process(final FormSectionEvent fse) throws FormProcessException {
|
||||||
final PageState state = fse.getPageState();
|
final PageState state = fse.getPageState();
|
||||||
final FormData data = fse.getFormData();
|
final FormData data = fse.getFormData();
|
||||||
final SciProject project = (SciProject) getItemSelectionModel().
|
final SciProject project = (SciProject) getItemSelectionModel().getSelectedObject(state);
|
||||||
getSelectedObject(state);
|
|
||||||
|
|
||||||
if ((project != null)
|
if ((project != null)
|
||||||
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
|
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
project.setProjectDescription((String) data.get(
|
|
||||||
SciProject.PROJECT_DESCRIPTION));
|
project.setProjectDescription((String) data.get(SciProject.PROJECT_DESCRIPTION));
|
||||||
if (config.getEnableFunding()) {
|
|
||||||
project.setFunding((String) data.get(
|
if (CONFIG.getEnableSponsor()) {
|
||||||
SciProject.FUNDING));
|
GenericOrganizationalUnit sponsor = (GenericOrganizationalUnit) data.get(
|
||||||
|
SPONSOR_SEARCH);
|
||||||
|
|
||||||
|
if (sponsor != null) {
|
||||||
|
sponsor = (GenericOrganizationalUnit) sponsor.getContentBundle().getInstance(
|
||||||
|
project.getLanguage());
|
||||||
|
|
||||||
|
project.addSponsor(sponsor);
|
||||||
|
sponsorSearch.publishCreatedItem(data, sponsor);
|
||||||
}
|
}
|
||||||
if (config.getEnableFundingVolume()) {
|
}
|
||||||
project.setFundingVolume((String) data.get(
|
|
||||||
SciProject.FUNDING_VOLUME));
|
if (CONFIG.getEnableFunding()) {
|
||||||
|
project.setFunding((String) data.get(SciProject.FUNDING));
|
||||||
|
}
|
||||||
|
if (CONFIG.getEnableFundingVolume()) {
|
||||||
|
project.setFundingVolume((String) data.get(SciProject.FUNDING_VOLUME));
|
||||||
}
|
}
|
||||||
|
|
||||||
project.save();
|
project.save();
|
||||||
|
|
@ -125,4 +180,5 @@ public class SciProjectDescriptionEditForm
|
||||||
|
|
||||||
init(fse);
|
init(fse);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.SegmentedPanel;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.SciProject;
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
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.authoring.SimpleEditStep;
|
||||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
|
||||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -16,60 +14,97 @@ import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
*/
|
*/
|
||||||
public class SciProjectDescriptionStep extends SimpleEditStep {
|
public class SciProjectDescriptionStep extends SimpleEditStep {
|
||||||
|
|
||||||
private String EDIT_PROJECT_DESC_SHEET_NAME = "editProjectDesc";
|
public static final String EDIT_SHEET_NAME = "SciProjectDescription";
|
||||||
private String UPLOAD_PROJECT_DESC_SHEET_NAME = "uploadProjectDesc";
|
private final SegmentedPanel segmentedPanel;
|
||||||
|
|
||||||
public SciProjectDescriptionStep(final ItemSelectionModel itemModel,
|
public SciProjectDescriptionStep(final ItemSelectionModel itemModel,
|
||||||
final AuthoringKitWizard parent) {
|
final AuthoringKitWizard parent) {
|
||||||
this(itemModel, parent, null);
|
super(itemModel, parent);
|
||||||
|
|
||||||
|
segmentedPanel = new SegmentedPanel();
|
||||||
|
setDefaultEditKey(EDIT_SHEET_NAME);
|
||||||
|
|
||||||
|
addSteps(itemModel, parent);
|
||||||
|
|
||||||
|
setDisplayComponent(segmentedPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SciProjectDescriptionStep(final ItemSelectionModel itemModel,
|
protected SegmentedPanel getSegmentedPanel() {
|
||||||
final AuthoringKitWizard parent,
|
return segmentedPanel;
|
||||||
final String prefix) {
|
|
||||||
super(itemModel, parent, prefix);
|
|
||||||
|
|
||||||
final BasicItemForm editDescForm =
|
|
||||||
new SciProjectDescriptionEditForm(itemModel);
|
|
||||||
add(EDIT_PROJECT_DESC_SHEET_NAME,
|
|
||||||
(String) SciProjectGlobalizationUtil.globalize(
|
|
||||||
"sciproject.ui.desc.edit").localize(),
|
|
||||||
new WorkflowLockedComponentAccess(editDescForm, itemModel),
|
|
||||||
editDescForm.getSaveCancelSection().getCancelButton());
|
|
||||||
|
|
||||||
final SciProjectDescriptionUploadForm uploadDescForm =
|
|
||||||
new SciProjectDescriptionUploadForm(
|
|
||||||
itemModel);
|
|
||||||
add(UPLOAD_PROJECT_DESC_SHEET_NAME,
|
|
||||||
(String) SciProjectGlobalizationUtil.globalize(
|
|
||||||
"sciproject.ui.desc.upload").localize(),
|
|
||||||
new WorkflowLockedComponentAccess(uploadDescForm, itemModel),
|
|
||||||
uploadDescForm.getSaveCancelSection().getCancelButton());
|
|
||||||
|
|
||||||
setDisplayComponent(
|
|
||||||
getSciProjectEditDescSheet(itemModel));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component getSciProjectEditDescSheet(
|
protected void addSteps(final ItemSelectionModel itemModel,
|
||||||
final ItemSelectionModel itemModel) {
|
final AuthoringKitWizard parent) {
|
||||||
final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
|
addStep(new SciProjectDescriptionTextStep(itemModel, parent),
|
||||||
itemModel);
|
"sciproject.ui.steps.description.title");
|
||||||
|
|
||||||
|
if (SciProject.getConfig().getEnableSponsor()) {
|
||||||
|
addStep(new SciProjectSponsorStep(itemModel, parent),
|
||||||
|
"sciproject.ui.steps.sponsor.title");
|
||||||
|
}
|
||||||
|
|
||||||
sheet.add(SciProjectGlobalizationUtil.globalize(
|
|
||||||
"sciproject.ui.desc"),
|
|
||||||
SciProject.PROJECT_DESCRIPTION);
|
|
||||||
if (SciProject.getConfig().getEnableFunding()) {
|
if (SciProject.getConfig().getEnableFunding()) {
|
||||||
sheet.add(SciProjectGlobalizationUtil.globalize(
|
addStep(new SciProjectFundingStep(itemModel, parent),
|
||||||
"sciproject.ui.funding"),
|
"sciproject.ui.steps.funding.title");
|
||||||
SciProject.FUNDING);
|
|
||||||
}
|
}
|
||||||
if (SciProject.getConfig().getEnableFundingVolume()) {
|
|
||||||
sheet.add(SciProjectGlobalizationUtil.globalize(
|
|
||||||
"sciproject.ui.funding.volume"),
|
|
||||||
SciProject.FUNDING_VOLUME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sheet;
|
protected void addStep(final SimpleEditStep step,
|
||||||
|
final String labelKey) {
|
||||||
|
segmentedPanel.addSegment(
|
||||||
|
new Label(SciProjectGlobalizationUtil.globalize(labelKey)), step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private String EDIT_PROJECT_DESC_SHEET_NAME = "editProjectDesc";
|
||||||
|
// private String UPLOAD_PROJECT_DESC_SHEET_NAME = "uploadProjectDesc";
|
||||||
|
//
|
||||||
|
// public SciProjectDescriptionStep(final ItemSelectionModel itemModel,
|
||||||
|
// final AuthoringKitWizard parent) {
|
||||||
|
// this(itemModel, parent, null);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public SciProjectDescriptionStep(final ItemSelectionModel itemModel,
|
||||||
|
// final AuthoringKitWizard parent,
|
||||||
|
// final String prefix) {
|
||||||
|
// super(itemModel, parent, prefix);
|
||||||
|
//
|
||||||
|
// final BasicItemForm editDescForm =
|
||||||
|
// new SciProjectDescriptionEditForm(itemModel);
|
||||||
|
// add(EDIT_PROJECT_DESC_SHEET_NAME,
|
||||||
|
// SciProjectGlobalizationUtil.globalize("sciproject.ui.desc.edit"),
|
||||||
|
// new WorkflowLockedComponentAccess(editDescForm, itemModel),
|
||||||
|
// editDescForm.getSaveCancelSection().getCancelButton());
|
||||||
|
//
|
||||||
|
// final SciProjectDescriptionUploadForm uploadDescForm =
|
||||||
|
// new SciProjectDescriptionUploadForm(
|
||||||
|
// itemModel);
|
||||||
|
// add(UPLOAD_PROJECT_DESC_SHEET_NAME,
|
||||||
|
// SciProjectGlobalizationUtil.globalize("sciproject.ui.desc.upload"),
|
||||||
|
// new WorkflowLockedComponentAccess(uploadDescForm, itemModel),
|
||||||
|
// uploadDescForm.getSaveCancelSection().getCancelButton());
|
||||||
|
//
|
||||||
|
// setDisplayComponent(
|
||||||
|
// getSciProjectEditDescSheet(itemModel));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static Component getSciProjectEditDescSheet(
|
||||||
|
// final ItemSelectionModel itemModel) {
|
||||||
|
// final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
|
||||||
|
// itemModel);
|
||||||
|
//
|
||||||
|
// sheet.add(SciProjectGlobalizationUtil.globalize("sciproject.ui.desc"),
|
||||||
|
// SciProject.PROJECT_DESCRIPTION);
|
||||||
|
//
|
||||||
|
// if (SciProject.getConfig().getEnableFunding()) {
|
||||||
|
// sheet.add(SciProjectGlobalizationUtil.globalize("sciproject.ui.funding"),
|
||||||
|
// SciProject.FUNDING);
|
||||||
|
// }
|
||||||
|
// if (SciProject.getConfig().getEnableFundingVolume()) {
|
||||||
|
// sheet.add(SciProjectGlobalizationUtil.globalize("sciproject.ui.funding.volume"),
|
||||||
|
// SciProject.FUNDING_VOLUME);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return sheet;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.form.TextArea;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProjectConfig;
|
||||||
|
import com.arsdigita.cms.ui.CMSDHTMLEditor;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciProjectDescriptionTextEditForm extends BasicItemForm implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
|
||||||
|
private final static SciProjectConfig CONFIG = SciProject.getConfig();
|
||||||
|
|
||||||
|
public SciProjectDescriptionTextEditForm(final ItemSelectionModel itemModel) {
|
||||||
|
super("SciProjectDescriptionTextEditForm", itemModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWidgets() {
|
||||||
|
add(new Label(SciProjectGlobalizationUtil.globalize(
|
||||||
|
"sciproject.ui.description")));
|
||||||
|
final ParameterModel descParam = new StringParameter(
|
||||||
|
SciProject.PROJECT_DESCRIPTION);
|
||||||
|
final TextArea desc;
|
||||||
|
if (CONFIG.getEnableDescriptionDhtml()) {
|
||||||
|
desc = new CMSDHTMLEditor(descParam);
|
||||||
|
} else {
|
||||||
|
desc = new TextArea(descParam);
|
||||||
|
}
|
||||||
|
desc.setCols(75);
|
||||||
|
desc.setRows(25);
|
||||||
|
add(desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
final SciProject project = (SciProject) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
|
data.put(SciProject.PROJECT_DESCRIPTION, project.getProjectDescription());
|
||||||
|
|
||||||
|
setVisible(state, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
final SciProject project = (SciProject) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
|
if ((project != null)
|
||||||
|
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
|
|
||||||
|
project.setProjectDescription((String) data.get(SciProject.PROJECT_DESCRIPTION));
|
||||||
|
|
||||||
|
project.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
init(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciProjectDescriptionTextStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
public static final String EDIT_DESCRIPTION_TEXT_SHEET_NAME = "editDescriptionText";
|
||||||
|
private String UPLOAD_PROJECT_DESC_SHEET_NAME = "uploadProjectDesc";
|
||||||
|
|
||||||
|
public SciProjectDescriptionTextStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciProjectDescriptionTextStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
final BasicItemForm descTextEditSheet = new SciProjectDescriptionTextEditForm(itemModel);
|
||||||
|
add(EDIT_DESCRIPTION_TEXT_SHEET_NAME,
|
||||||
|
SciProjectGlobalizationUtil.globalize("sciproject.ui.desc.text.edit"),
|
||||||
|
new WorkflowLockedComponentAccess(descTextEditSheet, itemModel),
|
||||||
|
descTextEditSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
final SciProjectDescriptionUploadForm uploadDescForm =
|
||||||
|
new SciProjectDescriptionUploadForm(
|
||||||
|
itemModel);
|
||||||
|
add(UPLOAD_PROJECT_DESC_SHEET_NAME,
|
||||||
|
SciProjectGlobalizationUtil.globalize("sciproject.ui.desc.upload"),
|
||||||
|
new WorkflowLockedComponentAccess(uploadDescForm, itemModel),
|
||||||
|
uploadDescForm.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
setDisplayComponent(
|
||||||
|
getSciProjectEditDescTextSheet(itemModel));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Component getSciProjectEditDescTextSheet(final ItemSelectionModel itemModel) {
|
||||||
|
final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
|
||||||
|
itemModel);
|
||||||
|
|
||||||
|
sheet.add(SciProjectGlobalizationUtil.globalize("sciproject.ui.desc"),
|
||||||
|
SciProject.PROJECT_DESCRIPTION);
|
||||||
|
|
||||||
|
return sheet;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,127 @@
|
||||||
|
/*;
|
||||||
|
* Copyright (c) 2013 Jens Pelzetter
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.bebop.form.TextArea;
|
||||||
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
|
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
||||||
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProjectConfig;
|
||||||
|
import com.arsdigita.cms.ui.CMSDHTMLEditor;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciProjectFundingEditForm extends BasicItemForm implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
|
||||||
|
private final static SciProjectConfig CONFIG = SciProject.getConfig();
|
||||||
|
|
||||||
|
public SciProjectFundingEditForm(final ItemSelectionModel itemModel) {
|
||||||
|
super("SciProjectFundingForm", itemModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWidgets() {
|
||||||
|
|
||||||
|
if (CONFIG.getEnableFunding()) {
|
||||||
|
add(new Label(SciProjectGlobalizationUtil.globalize(
|
||||||
|
"sciproject.ui.funding")));
|
||||||
|
final ParameterModel fundingParam = new StringParameter(
|
||||||
|
SciProject.FUNDING);
|
||||||
|
final TextArea funding;
|
||||||
|
if (CONFIG.getEnableFundingDhtml()) {
|
||||||
|
funding = new CMSDHTMLEditor(fundingParam);
|
||||||
|
} else {
|
||||||
|
funding = new TextArea(fundingParam);
|
||||||
|
}
|
||||||
|
funding.setCols(75);
|
||||||
|
funding.setRows(8);
|
||||||
|
add(funding);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CONFIG.getEnableFundingVolume()) {
|
||||||
|
add(new Label(SciProjectGlobalizationUtil.globalize(
|
||||||
|
"sciproject.ui.funding.volume")));
|
||||||
|
final ParameterModel fundingVolumeParam = new StringParameter(
|
||||||
|
SciProject.FUNDING_VOLUME);
|
||||||
|
final TextField fundingVolume = new TextField(fundingVolumeParam);
|
||||||
|
fundingVolume.addValidationListener(new StringInRangeValidationListener(
|
||||||
|
0,
|
||||||
|
CONFIG.getFundingVolumeLength()));
|
||||||
|
add(fundingVolume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
final SciProject project = (SciProject) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
|
if (CONFIG.getEnableFunding()) {
|
||||||
|
data.put(SciProject.FUNDING, project.getFunding());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CONFIG.getEnableFundingVolume()) {
|
||||||
|
data.put(SciProject.FUNDING_VOLUME, project.getFundingVolume());
|
||||||
|
}
|
||||||
|
|
||||||
|
setVisible(state, true);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
final SciProject project = (SciProject) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
|
if ((project != null)
|
||||||
|
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
|
|
||||||
|
if (CONFIG.getEnableFunding()) {
|
||||||
|
project.setFunding((String) data.get(SciProject.FUNDING));
|
||||||
|
}
|
||||||
|
if (CONFIG.getEnableFundingVolume()) {
|
||||||
|
project.setFundingVolume((String) data.get(SciProject.FUNDING_VOLUME));
|
||||||
|
}
|
||||||
|
|
||||||
|
project.save();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
init(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciProjectFundingStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
private String EDIT_PROJECT_FUNDING_SHEET_NAME = "editProjectFunding";
|
||||||
|
private String UPLOAD_PROJECT_FUNDING_SHEET_NAME = "uploadProjectFunding";
|
||||||
|
|
||||||
|
public SciProjectFundingStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciProjectFundingStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
final BasicItemForm editFundingForm = new SciProjectFundingEditForm(itemModel);
|
||||||
|
add(EDIT_PROJECT_FUNDING_SHEET_NAME,
|
||||||
|
SciProjectGlobalizationUtil.globalize("sciproject.ui.funding.edit"),
|
||||||
|
new WorkflowLockedComponentAccess(editFundingForm, itemModel),
|
||||||
|
editFundingForm.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
final SciProjectFundingUploadForm uploadFundingForm = new SciProjectFundingUploadForm(
|
||||||
|
itemModel);
|
||||||
|
add(UPLOAD_PROJECT_FUNDING_SHEET_NAME,
|
||||||
|
SciProjectGlobalizationUtil.globalize("sciproject.ui.funding.upload"),
|
||||||
|
new WorkflowLockedComponentAccess(uploadFundingForm, itemModel),
|
||||||
|
uploadFundingForm.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
setDisplayComponent(getSciProjectEditFundingSheet(itemModel));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Component getSciProjectEditFundingSheet(final ItemSelectionModel itemModel) {
|
||||||
|
final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||||
|
|
||||||
|
if (SciProject.getConfig().getEnableFunding()) {
|
||||||
|
sheet.add(SciProjectGlobalizationUtil.globalize("sciproject.ui.funding"),
|
||||||
|
SciProject.FUNDING);
|
||||||
|
}
|
||||||
|
if (SciProject.getConfig().getEnableFundingVolume()) {
|
||||||
|
sheet.add(SciProjectGlobalizationUtil.globalize("sciproject.ui.funding.volume"),
|
||||||
|
SciProject.FUNDING_VOLUME);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sheet;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciProjectFundingUploadForm extends AbstractTextUploadForm {
|
||||||
|
|
||||||
|
public SciProjectFundingUploadForm(final ItemSelectionModel itemModel) {
|
||||||
|
super(itemModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GlobalizedMessage getLabelText() {
|
||||||
|
return SciProjectGlobalizationUtil.globalize("sciproject.ui.funding.upload");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GlobalizedMessage getMimeTypeLabel() {
|
||||||
|
return SciProjectGlobalizationUtil.globalize("sciproject.ui.funding.upload.mimetype");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setText(final ItemSelectionModel itemModel,
|
||||||
|
final PageState state,
|
||||||
|
final String text) {
|
||||||
|
final SciProject project = (SciProject) itemModel.getSelectedObject(state);
|
||||||
|
project.setFunding(text);
|
||||||
|
project.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -5,11 +5,11 @@ import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.SciProject;
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
|
||||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
import com.arsdigita.domain.DomainObject;
|
import com.arsdigita.domain.DomainObject;
|
||||||
import com.arsdigita.globalization.GlobalizationHelper;
|
import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
|
|
@ -47,7 +47,7 @@ public class SciProjectPropertiesStep
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
final SciProject project = (SciProject) obj;
|
final SciProject project = (SciProject) obj;
|
||||||
if (project.getBegin() == null) {
|
if (project.getBegin() == null) {
|
||||||
return (String) ContenttypesGlobalizationUtil.globalize(
|
return (String) GlobalizationUtil.globalize(
|
||||||
"cms.ui.unknown").localize();
|
"cms.ui.unknown").localize();
|
||||||
} else if (project.getBeginSkipMonth()
|
} else if (project.getBeginSkipMonth()
|
||||||
|| project.getBeginSkipDay()) {
|
|| project.getBeginSkipDay()) {
|
||||||
|
|
@ -85,7 +85,7 @@ public class SciProjectPropertiesStep
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
final SciProject project = (SciProject) obj;
|
final SciProject project = (SciProject) obj;
|
||||||
if (project.getEnd() == null) {
|
if (project.getEnd() == null) {
|
||||||
return (String) ContenttypesGlobalizationUtil.globalize(
|
return (String) GlobalizationUtil.globalize(
|
||||||
"cms.ui.unknown").localize();
|
"cms.ui.unknown").localize();
|
||||||
} else if (project.getEndSkipMonth()
|
} else if (project.getEndSkipMonth()
|
||||||
|| project.getEndSkipDay()) {
|
|| project.getEndSkipDay()) {
|
||||||
|
|
|
||||||
|
|
@ -86,3 +86,14 @@ sciproject.ui.involved_orgas.description=Managed involved organizations
|
||||||
scidepartment.ui.superdepartment.add=Add superior department
|
scidepartment.ui.superdepartment.add=Add superior department
|
||||||
sciproject.ui.edit_basic_properties=Basic properties
|
sciproject.ui.edit_basic_properties=Basic properties
|
||||||
sciproject.ui.desc=Description
|
sciproject.ui.desc=Description
|
||||||
|
sciproject.ui.steps.description.title=Description
|
||||||
|
sciproject.ui.desc.text.edit=Edit description
|
||||||
|
sciproject.ui.steps.sponsor.title=Sponsoring organization
|
||||||
|
sciproject.ui.sponsor_none=No sponsoring organization
|
||||||
|
sciproject.ui.sponsor.add=Add sponsoring organization
|
||||||
|
sciproject.ui.steps.funding.title=Funding description
|
||||||
|
sciproject.ui.funding.edit=Edit funding description
|
||||||
|
sciproject.ui.funding.upload=Upload
|
||||||
|
sciproject.ui.sponsor\ =Sponsoring organization
|
||||||
|
sciproject.ui.sponsor_name=Sponsoring organization
|
||||||
|
sciproject.ui.sponsor_remove=Action
|
||||||
|
|
|
||||||
|
|
@ -87,3 +87,14 @@ sciproject.ui.involved_orgas.description=Verwalten von am Projekt beteiligten Or
|
||||||
scidepartment.ui.superdepartment.add=\u00dcbergeordnete Abteilung hinzuf\u00fcgen
|
scidepartment.ui.superdepartment.add=\u00dcbergeordnete Abteilung hinzuf\u00fcgen
|
||||||
sciproject.ui.edit_basic_properties=Basiseigenschaften
|
sciproject.ui.edit_basic_properties=Basiseigenschaften
|
||||||
sciproject.ui.desc=Beschreibung
|
sciproject.ui.desc=Beschreibung
|
||||||
|
sciproject.ui.steps.description.title=Beschreibung
|
||||||
|
sciproject.ui.desc.text.edit=Beschreibung bearbeiten
|
||||||
|
sciproject.ui.steps.sponsor.title=Drittmittelgeber
|
||||||
|
sciproject.ui.sponsor_none=Kein Drittmittelgeber
|
||||||
|
sciproject.ui.sponsor.add=Drittmittelgeber hinzuf\u00fcgen
|
||||||
|
sciproject.ui.steps.funding.title=Beschreibung Finanzierung
|
||||||
|
sciproject.ui.funding.edit=Beschreibung der Finanzierung bearbeiten
|
||||||
|
sciproject.ui.funding.upload=Hochladen
|
||||||
|
sciproject.ui.sponsor\ =Drittmittelgeber
|
||||||
|
sciproject.ui.sponsor_name=Drittmittelgeber
|
||||||
|
sciproject.ui.sponsor_remove=Aktion
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,99 @@
|
||||||
|
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.GenericOrganizationalUnit;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProjectConfig;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProjectSponsorCollection;
|
||||||
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciProjectSponsorForm extends BasicItemForm implements FormInitListener,
|
||||||
|
FormProcessListener {
|
||||||
|
|
||||||
|
private ItemSearchWidget itemSearch;
|
||||||
|
private final String ITEM_SEARCH = "setSponsor";
|
||||||
|
private final static SciProjectConfig CONFIG = SciProject.getConfig();
|
||||||
|
|
||||||
|
public SciProjectSponsorForm(final ItemSelectionModel itemModel) {
|
||||||
|
super("SciProjectSetSponsor", itemModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addWidgets() {
|
||||||
|
add(new Label(SciProjectGlobalizationUtil.globalize("sciproject.ui.sponsor")));
|
||||||
|
|
||||||
|
itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType(
|
||||||
|
GenericOrganizationalUnit.class.getName()));
|
||||||
|
itemSearch.setEditAfterCreate(false);
|
||||||
|
add(itemSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
setVisible(state, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
final SciProject project = (SciProject) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
|
if (getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
|
GenericOrganizationalUnit sponsor = (GenericOrganizationalUnit) data.get(ITEM_SEARCH);
|
||||||
|
sponsor = (GenericOrganizationalUnit) sponsor.getContentBundle().getInstance(project.
|
||||||
|
getLanguage());
|
||||||
|
|
||||||
|
if ((project.getSponsors() != null) && !(project.getSponsors().isEmpty())) {
|
||||||
|
final SciProjectSponsorCollection sponsors = project.getSponsors();
|
||||||
|
sponsors.next();
|
||||||
|
project.removeSponsor(sponsors.getSponsor());
|
||||||
|
sponsors.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
project.addSponsor(sponsor);
|
||||||
|
itemSearch.publishCreatedItem(data, sponsor);
|
||||||
|
}
|
||||||
|
|
||||||
|
init(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validate(final FormSectionEvent event) throws FormProcessException {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
final FormData data = event.getFormData();
|
||||||
|
|
||||||
|
if (data.get(ITEM_SEARCH) == null) {
|
||||||
|
data.addError(SciProjectGlobalizationUtil.globalize(
|
||||||
|
"sciproject.ui.sponsor_no_sponsor_selected"));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final SciProject project = (SciProject) getItemSelectionModel().getSelectedItem(state);
|
||||||
|
final GenericOrganizationalUnit sponsor = (GenericOrganizationalUnit) data.get(ITEM_SEARCH);
|
||||||
|
if (!(sponsor.getContentBundle().hasInstance(project.getLanguage(),
|
||||||
|
Kernel.getConfig().languageIndependentItems()))) {
|
||||||
|
data.addError(SciProjectGlobalizationUtil.globalize(
|
||||||
|
"sciproject.ui.sponsor.no_suitable_language_variant"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,218 @@
|
||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
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.GenericOrganizationalUnit;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProjectSponsorCollection;
|
||||||
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public class SciProjectSponsorSheet extends Table {
|
||||||
|
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||||
|
private final String TABLE_COL_DEL = "table_col_del";
|
||||||
|
|
||||||
|
public SciProjectSponsorSheet(final ItemSelectionModel itemModel) {
|
||||||
|
super();
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
|
||||||
|
setEmptyView(new Label(SciProjectGlobalizationUtil.globalize(
|
||||||
|
"sciproject.ui.sponsor_none")));
|
||||||
|
|
||||||
|
final TableColumnModel columnModel = getColumnModel();
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
SciProjectGlobalizationUtil.globalize("sciproject.ui.sponsor_name").localize(),
|
||||||
|
TABLE_COL_EDIT));
|
||||||
|
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
SciProjectGlobalizationUtil.globalize("sciproject.ui.sponsor_remove").localize(),
|
||||||
|
TABLE_COL_DEL));
|
||||||
|
|
||||||
|
setModelBuilder(new ModelBuilder(itemModel));
|
||||||
|
|
||||||
|
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||||
|
columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
|
addTableActionListener(new ActionListener());
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ModelBuilder extends LockableImpl implements TableModelBuilder {
|
||||||
|
|
||||||
|
private final ItemSelectionModel itemModel;
|
||||||
|
|
||||||
|
public ModelBuilder(final ItemSelectionModel itemModel) {
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TableModel makeModel(final Table table, final PageState state) {
|
||||||
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
|
final SciProject project = (SciProject) itemModel.getSelectedObject(state);
|
||||||
|
return new Model(table, state, project);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class Model implements TableModel {
|
||||||
|
|
||||||
|
private final Table table;
|
||||||
|
private final SciProjectSponsorCollection sponsors;
|
||||||
|
|
||||||
|
public Model(final Table table, final PageState state, final SciProject project) {
|
||||||
|
this.table = table;
|
||||||
|
|
||||||
|
sponsors = project.getSponsors();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColumnCount() {
|
||||||
|
return table.getColumnModel().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean nextRow() {
|
||||||
|
boolean ret;
|
||||||
|
|
||||||
|
if ((sponsors != null) && sponsors.next()) {
|
||||||
|
ret = true;
|
||||||
|
} else {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getElementAt(final int columnIndex) {
|
||||||
|
switch (columnIndex) {
|
||||||
|
case 0:
|
||||||
|
return sponsors.getTitle();
|
||||||
|
case 1:
|
||||||
|
return SciProjectGlobalizationUtil.globalize("sciproject.ui.sponsor.remove").
|
||||||
|
localize();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getKeyAt(final int columnIndex) {
|
||||||
|
return sponsors.getID();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
|
final GenericOrganizationalUnit sponsor =
|
||||||
|
new GenericOrganizationalUnit((BigDecimal) key);
|
||||||
|
|
||||||
|
final boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
sponsor);
|
||||||
|
if (canEdit) {
|
||||||
|
final ContentSection section = sponsor.getContentSection();
|
||||||
|
final ItemResolver resolver = section.getItemResolver();
|
||||||
|
final Link link = new Link(String.format("%s (%s)",
|
||||||
|
value.toString(),
|
||||||
|
sponsor.getLanguage()),
|
||||||
|
resolver.generateItemURL(state,
|
||||||
|
sponsor,
|
||||||
|
section,
|
||||||
|
sponsor.getVersion()));
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
final Label label = new Label(String.format("%s (%s)",
|
||||||
|
value.toString(),
|
||||||
|
sponsor.getLanguage()));
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(final Table table,
|
||||||
|
final PageState state,
|
||||||
|
final Object value,
|
||||||
|
final boolean isSelected,
|
||||||
|
final Object key,
|
||||||
|
final int row,
|
||||||
|
final int column) {
|
||||||
|
final com.arsdigita.cms.SecurityManager securityManager = CMS.getSecurityManager(state);
|
||||||
|
final GenericOrganizationalUnit sponsor =
|
||||||
|
new GenericOrganizationalUnit((BigDecimal) key);
|
||||||
|
|
||||||
|
final boolean canEdit = securityManager.canAccess(
|
||||||
|
state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
sponsor);
|
||||||
|
if (canEdit) {
|
||||||
|
final ControlLink link = new ControlLink(value.toString());
|
||||||
|
link.setConfirmation((String) SciProjectGlobalizationUtil.globalize(
|
||||||
|
"sciproject.ui.sponsor.remove.confirm").localize());
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
return new Label("");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ActionListener implements TableActionListener {
|
||||||
|
|
||||||
|
public void cellSelected(final TableActionEvent event) {
|
||||||
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
|
final GenericOrganizationalUnit sponsor = new GenericOrganizationalUnit(new BigDecimal(
|
||||||
|
event.getRowKey().toString()));
|
||||||
|
final SciProject project = (SciProject) itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
final TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
|
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||||
|
//Nothing yet
|
||||||
|
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||||
|
Assert.exists(sponsor, GenericOrganizationalUnit.class);
|
||||||
|
|
||||||
|
project.removeSponsor(sponsor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void headSelected(final TableActionEvent event) {
|
||||||
|
//Nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
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 <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciProjectSponsorStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
private String SCIPROJECT_SPONSOR_STEP = "SciProjectSponsorStep";
|
||||||
|
|
||||||
|
public SciProjectSponsorStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciProjectSponsorStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
final BasicItemForm sponsorForm = new SciProjectSponsorForm(itemModel);
|
||||||
|
add(SCIPROJECT_SPONSOR_STEP,
|
||||||
|
(String) SciProjectGlobalizationUtil.globalize("sciproject.ui.sponsor.add").localize(),
|
||||||
|
new WorkflowLockedComponentAccess(sponsorForm, itemModel),
|
||||||
|
sponsorForm.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
final SciProjectSponsorSheet sheet = new SciProjectSponsorSheet(itemModel);
|
||||||
|
setDisplayComponent(sheet);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,7 @@ import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitSubordinateCollec
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitSuperiorCollection;
|
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitSuperiorCollection;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
import com.arsdigita.cms.contenttypes.SciProject;
|
import com.arsdigita.cms.contenttypes.SciProject;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciProjectSponsorCollection;
|
||||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||||
import com.arsdigita.globalization.GlobalizationHelper;
|
import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
|
@ -435,6 +436,15 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
|
||||||
protected void generateFundingXml(final SciProject project,
|
protected void generateFundingXml(final SciProject project,
|
||||||
final Element parent,
|
final Element parent,
|
||||||
final PageState state) {
|
final PageState state) {
|
||||||
|
if ((project.getSponsors() != null)
|
||||||
|
&& !project.getSponsors().isEmpty()) {
|
||||||
|
final Element sponsorElem = parent.newChildElement("sponsor");
|
||||||
|
final SciProjectSponsorCollection sponsors = project.getSponsors();
|
||||||
|
sponsors.next();
|
||||||
|
final GenericOrganizationalUnit sponsor = sponsors.getSponsor();
|
||||||
|
sponsorElem.setText(sponsor.getTitle());
|
||||||
|
}
|
||||||
|
|
||||||
if ((project.getFunding() != null)
|
if ((project.getFunding() != null)
|
||||||
&& !project.getFunding().trim().isEmpty()) {
|
&& !project.getFunding().trim().isEmpty()) {
|
||||||
final Element fundingElem = parent.newChildElement("funding");
|
final Element fundingElem = parent.newChildElement("funding");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue