From f53938ad949f88a2fa2166c93e67840f8407d298 Mon Sep 17 00:00:00 2001 From: jensp Date: Wed, 16 Feb 2011 09:35:42 +0000 Subject: [PATCH] =?UTF-8?q?-=20Die=20Assoziation=20zwischen=20einer=20Publ?= =?UTF-8?q?ikation=20und=20einer=20Person=20(Autor)=20kann=20jetzt=20bearb?= =?UTF-8?q?eitet=20werden.=20Es=20k=C3=B6nnen=20nur=20die=20zus=C3=A4tzlic?= =?UTF-8?q?hen=20Attribute=20der=20Verkn=C3=BCpfung=20ver=C3=A4ndert=20wer?= =?UTF-8?q?den,=20nicht=20das=20Ziel=20der=20Verkn=C3=BCpfung=20(die=20ver?= =?UTF-8?q?kn=C3=BCpfte=20Person).=20-=20Einige=20PropertySheets=20in=20sc?= =?UTF-8?q?i-publications=20so=20angepasst,=20dass=20sie=20beim=20Verlag?= =?UTF-8?q?=20statt=20der=20OID=20den=20Namen=20des=20Verlages=20(=3D=20Ti?= =?UTF-8?q?tel=20des=20Content-Items)=20anzeigen.=20Leider=20ist=20es=20mi?= =?UTF-8?q?t=20den=20Methoden=20von=20DomainObjectPropertySheet=20nicht=20?= =?UTF-8?q?=20m=C3=B6glich=20sowohl=20den=20Names=20als=20auch=20den=20Ort?= =?UTF-8?q?=20anzuzeigen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@751 8810af33-2d31-482b-a856-94f89814c4df --- .../GenericOrganizationalUnit.java | 1 + .../ui/ExpertisePropertiesStep.java | 4 +- .../ui/InternetArticlePropertiesStep.java | 2 +- .../ui/ProceedingsPropertiesStep.java | 2 +- .../ui/PublicationAuthorAddForm.java | 64 ++++++++++++++- .../ui/PublicationAuthorsPropertyStep.java | 26 +++++- .../ui/PublicationAuthorsTable.java | 81 +++++++++++++++++-- .../ui/PublicationResources.properties | 1 + .../ui/PublicationResources_de.properties | 1 + ...ublicationWithPublisherPropertiesStep.java | 2 +- .../ui/UnPublishedPropertiesStep.java | 2 +- 11 files changed, 166 insertions(+), 20 deletions(-) diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnit.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnit.java index f32a774c8..56788c64e 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnit.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/GenericOrganizationalUnit.java @@ -135,4 +135,5 @@ public class GenericOrganizationalUnit extends ContentPage { public boolean hasPersons() { return !this.getPersons().isEmpty(); } + } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertisePropertiesStep.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertisePropertiesStep.java index ef74a3ab8..a2d99b06b 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertisePropertiesStep.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertisePropertiesStep.java @@ -50,7 +50,7 @@ public class ExpertisePropertiesStep extends PublicationPropertiesStep { Expertise.PLACE); sheet.add(PublicationGlobalizationUtil.globalize( - "publications.ui.expertise.organization"), + "organization.title"), Expertise.ORGANIZATION); sheet.add(PublicationGlobalizationUtil.globalize( @@ -58,7 +58,7 @@ public class ExpertisePropertiesStep extends PublicationPropertiesStep { Expertise.NUMBER_OF_PAGES); sheet.add(PublicationGlobalizationUtil.globalize( - "publications.ui.expertise.orderer"), + "orderer.title"), Expertise.ORDERER); return sheet; diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/InternetArticlePropertiesStep.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/InternetArticlePropertiesStep.java index 6b6cc6f6a..fa3846871 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/InternetArticlePropertiesStep.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/InternetArticlePropertiesStep.java @@ -51,7 +51,7 @@ public class InternetArticlePropertiesStep extends PublicationPropertiesStep { sheet.add(PublicationGlobalizationUtil.globalize( "publications.ui.internetarticle.organization"), - InternetArticle.ORGANIZATION); + "organization.title"); sheet.add(PublicationGlobalizationUtil.globalize( "publications.ui.internetarticle.number"), diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertiesStep.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertiesStep.java index 58a561908..1c1041e95 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertiesStep.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertiesStep.java @@ -49,7 +49,7 @@ public class ProceedingsPropertiesStep sheet.add(PublicationGlobalizationUtil.globalize( "publications.ui.proceedings.organizer_of_conference"), - Proceedings.ORGANIZER_OF_CONFERENCE); + "organizerOfConference.title"); sheet.add(PublicationGlobalizationUtil.globalize( "publications.ui.proceedings.name_of_conference"), diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorAddForm.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorAddForm.java index 86a20677a..b4142e580 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorAddForm.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorAddForm.java @@ -38,6 +38,7 @@ import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.Publication; import com.arsdigita.cms.ui.ItemSearchWidget; import com.arsdigita.cms.ui.authoring.BasicItemForm; +import com.arsdigita.cms.ui.authoring.SimpleEditStep; import org.apache.log4j.Logger; /** @@ -56,10 +57,15 @@ public class PublicationAuthorAddForm //private SaveCancelSection m_saveCancelSection; private final String ITEM_SEARCH = "authors"; private ItemSelectionModel m_itemModel; + private SimpleEditStep editStep; - public PublicationAuthorAddForm(ItemSelectionModel itemModel) { + private Label selectedAuthorLabel; + + public PublicationAuthorAddForm(ItemSelectionModel itemModel, + SimpleEditStep editStep) { super("AuthorsEntryForm", itemModel); m_itemModel = itemModel; + this.editStep = editStep; } @Override @@ -72,6 +78,9 @@ public class PublicationAuthorAddForm getName())); add(m_itemSearch); + selectedAuthorLabel = new Label(""); + add(selectedAuthorLabel); + add(new Label((String) PublicationGlobalizationUtil.globalize( "publications.ui.authors.author.is_editor").localize())); ParameterModel isEditorModel = new BooleanParameter( @@ -99,6 +108,29 @@ public class PublicationAuthorAddForm FormData data = fse.getFormData(); PageState state = fse.getPageState(); + GenericPerson author; + Boolean editor; + + author = ((PublicationAuthorsPropertyStep) editStep).getSelectedAuthor(); + editor = ((PublicationAuthorsPropertyStep) editStep). + isSelectedAuthorEditor(); + + if (author == null) { + s_log.warn("No author selected."); + + m_itemSearch.setVisible(state, true); + selectedAuthorLabel.setVisible(state, false); + } else { + s_log.warn(String.format("Author is here: %s", author.getFullName())); + + data.put(ITEM_SEARCH, author); + data.put(AuthorshipCollection.EDITOR, editor); + + m_itemSearch.setVisible(state, false); + selectedAuthorLabel.setLabel(author.getFullName(), state); + selectedAuthorLabel.setVisible(state, true); + } + setVisible(state, true); } @@ -111,9 +143,33 @@ public class PublicationAuthorAddForm if (!(this.getSaveCancelSection().getCancelButton(). isSelected(state))) { - publication.addAuthor( - (GenericPerson) data.get(ITEM_SEARCH), - (Boolean) data.get(AuthorshipCollection.EDITOR)); + GenericPerson author; + author = ((PublicationAuthorsPropertyStep) editStep). + getSelectedAuthor(); + + if (author == null) { + publication.addAuthor( + (GenericPerson) data.get(ITEM_SEARCH), + (Boolean) data.get(AuthorshipCollection.EDITOR)); + } else { + AuthorshipCollection authors; + + authors = publication.getAuthors(); + + while (authors.next()) { + if (authors.getAuthor().equals(author)) { + break; + } + } + + authors.setEditor( + (Boolean) data.get(AuthorshipCollection.EDITOR)); + + ((PublicationAuthorsPropertyStep) editStep).setSelectedAuthor( + null); + ((PublicationAuthorsPropertyStep) editStep). + setSelectedAuthorEditor(null); + } } init(fse); diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsPropertyStep.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsPropertyStep.java index 786e2c8e0..005cd0144 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsPropertyStep.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsPropertyStep.java @@ -24,6 +24,7 @@ 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.cms.contenttypes.GenericPerson; /** * @@ -31,7 +32,10 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; */ public class PublicationAuthorsPropertyStep extends SimpleEditStep { - private static final String ADD_AUTHOR_SHEET_NAME = "addAuthor"; + public static final String ADD_AUTHOR_SHEET_NAME = "addAuthor"; + + private GenericPerson selectedAuthor; + private Boolean selectedAuthorEditor; public PublicationAuthorsPropertyStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) { @@ -44,7 +48,7 @@ public class PublicationAuthorsPropertyStep extends SimpleEditStep { super(itemModel, parent, prefix); BasicItemForm addAuthorSheet = - new PublicationAuthorAddForm(itemModel); + new PublicationAuthorAddForm(itemModel, this); add(ADD_AUTHOR_SHEET_NAME, (String) PublicationGlobalizationUtil.globalize( "publications.ui.authors.add_author").localize(), @@ -52,7 +56,23 @@ public class PublicationAuthorsPropertyStep extends SimpleEditStep { addAuthorSheet.getSaveCancelSection().getCancelButton()); PublicationAuthorsTable authorsTable = new PublicationAuthorsTable( - itemModel); + itemModel, this); setDisplayComponent(authorsTable); } + + protected GenericPerson getSelectedAuthor() { + return selectedAuthor; + } + + protected Boolean isSelectedAuthorEditor() { + return selectedAuthorEditor; + } + + protected void setSelectedAuthor(GenericPerson selectedAuthor) { + this.selectedAuthor = selectedAuthor; + } + + protected void setSelectedAuthorEditor(Boolean selectedAuthorEditor) { + this.selectedAuthorEditor = selectedAuthorEditor; + } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java index a5ec2f259..157ce45cc 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java @@ -37,6 +37,7 @@ import com.arsdigita.cms.contenttypes.AuthorshipCollection; import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.Publication; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.util.LockableImpl; import java.math.BigDecimal; import org.apache.log4j.Logger; @@ -52,14 +53,22 @@ public class PublicationAuthorsTable private static final Logger s_log = Logger.getLogger(PublicationAuthorsTable.class); private final String TABLE_COL_EDIT = "table_col_edit"; + private final String TABLE_COL_EDIT_ASSOC = "table_col_edit_assoc"; private final String TABLE_COL_DEL = "table_col_del"; private final String TABLE_COL_UP = "table_col_up"; private final String TABLE_COL_DOWN = "table_col_down"; + public static final String SELECTED_PUBLICATION = + "selected_publication_author_association_publication"; + public static final String SELECTED_AUTHOR = + "selected_publication_author_association_author"; private ItemSelectionModel m_itemModel; + private SimpleEditStep editStep; - public PublicationAuthorsTable(ItemSelectionModel itemModel) { + public PublicationAuthorsTable(ItemSelectionModel itemModel, + SimpleEditStep editStep) { super(); m_itemModel = itemModel; + this.editStep = editStep; setEmptyView(new Label(PublicationGlobalizationUtil.globalize( "publications.ui.authors.none"))); @@ -77,15 +86,20 @@ public class PublicationAuthorsTable colModel.add(new TableColumn( 2, PublicationGlobalizationUtil.globalize( + "publications.ui.authors.edit_assoc").localize(), + TABLE_COL_EDIT_ASSOC)); + colModel.add(new TableColumn( + 3, + PublicationGlobalizationUtil.globalize( "publications.ui.authors.author.delete").localize(), TABLE_COL_DEL)); colModel.add(new TableColumn( - 3, + 4, PublicationGlobalizationUtil.globalize( "publications.ui.authors.author.up").localize(), TABLE_COL_UP)); colModel.add(new TableColumn( - 4, + 5, PublicationGlobalizationUtil.globalize( "publications.ui.authors.author.down").localize(), TABLE_COL_DOWN)); @@ -94,9 +108,10 @@ public class PublicationAuthorsTable new PublicationAuthorsTableModelBuilder(itemModel)); colModel.get(0).setCellRenderer(new EditCellRenderer()); - colModel.get(2).setCellRenderer(new DeleteCellRenderer()); - colModel.get(3).setCellRenderer(new UpCellRenderer()); - colModel.get(4).setCellRenderer(new DownCellRenderer()); + colModel.get(2).setCellRenderer(new EditAssocCellRenderer()); + colModel.get(3).setCellRenderer(new DeleteCellRenderer()); + colModel.get(4).setCellRenderer(new UpCellRenderer()); + colModel.get(5).setCellRenderer(new DownCellRenderer()); s_log.info("Adding table action listener..."); addTableActionListener(this); @@ -164,7 +179,7 @@ public class PublicationAuthorsTable case 1: if (m_authorshipCollection.isEditor()) { return (String) PublicationGlobalizationUtil.globalize( - "publications.ui.authors.author.is_editor"). + "publications.ui.authors.author.is_editor_true"). localize(); } else { return PublicationGlobalizationUtil.globalize( @@ -172,6 +187,9 @@ public class PublicationAuthorsTable localize(); } case 2: + return PublicationGlobalizationUtil.globalize( + "publications.ui.authors.edit_assoc").localize(); + case 3: return PublicationGlobalizationUtil.globalize( "publications.ui.authors.author.remove"). localize(); @@ -218,6 +236,38 @@ public class PublicationAuthorsTable } } + private class EditAssocCellRenderer + extends LockableImpl + implements TableCellRenderer { + + @Override + public Component getComponent(Table table, + PageState state, + Object value, + boolean isSelected, + Object key, + int row, + int col) { + SecurityManager securityManager = + Utilities.getSecurityManager(state); + Publication publication = (Publication) m_itemModel. + getSelectedObject(state); + + boolean canEdit = securityManager.canAccess( + state.getRequest(), + SecurityManager.EDIT_ITEM, + publication); + + if (canEdit) { + ControlLink link = new ControlLink(value.toString()); + return link; + } else { + Label label = new Label(value.toString()); + return label; + } + } + } + private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer { @@ -327,6 +377,23 @@ public class PublicationAuthorsTable TableColumn column = getColumnModel().get(event.getColumn().intValue()); if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) { + } else if (column.getHeaderKey().toString().equals( + TABLE_COL_EDIT_ASSOC)) { + + while(authors.next()) { + if (authors.getAuthor().equals(author)) { + break; + } + } + + ((PublicationAuthorsPropertyStep)editStep).setSelectedAuthor(author); + ((PublicationAuthorsPropertyStep)editStep).setSelectedAuthorEditor( + authors.isEditor()); + + editStep.showComponent(state, + PublicationAuthorsPropertyStep.ADD_AUTHOR_SHEET_NAME); + + authors.close(); } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) { publication.removeAuthor(author); } else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) { diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationResources.properties b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationResources.properties index 21fb3afae..f8f002dc7 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationResources.properties +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationResources.properties @@ -271,3 +271,4 @@ publications.ui.inProceedings.proceedings.none=Not associated with a procedings publications.ui.inProceedings.proceedings.remove=Remove this association publications.ui.inProceedings.proceedings.confirm_remove=Do really want to remove this association publications.ui.series.name=Name (URL) +publications.ui.authors.edit_assoc=Edit association diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationResources_de.properties b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationResources_de.properties index 1db8c8e03..06f6ae6cf 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationResources_de.properties +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationResources_de.properties @@ -270,3 +270,4 @@ publications.ui.inProceedings.proceedings.none=Derzeit mit keinem Tagungsband ve publications.ui.inProceedings.proceedings.remove=Verkn\u00fcpfung entfernen publications.ui.inProceedings.proceedings.confirm_remove=Wollen Sie diese Verkn\u00fcpfung wirklich entfernen publications.ui.series.name=Name (URL) +publications.ui.authors.edit_assoc=Verkn\u00fcpfung bearbeiten diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationWithPublisherPropertiesStep.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationWithPublisherPropertiesStep.java index 9ec57b36e..3808c2bec 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationWithPublisherPropertiesStep.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationWithPublisherPropertiesStep.java @@ -69,7 +69,7 @@ public class PublicationWithPublisherPropertiesStep sheet.add(PublicationGlobalizationUtil.globalize( "publications.ui.with_publisher.publisher"), - PublicationWithPublisher.PUBLISHER); + "publisher.title"); return sheet; } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/UnPublishedPropertiesStep.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/UnPublishedPropertiesStep.java index 30f50d3a5..2425a38e3 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/UnPublishedPropertiesStep.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/UnPublishedPropertiesStep.java @@ -52,7 +52,7 @@ public class UnPublishedPropertiesStep extends PublicationPropertiesStep { sheet.add(PublicationGlobalizationUtil.globalize( "publications.ui.unpublished.organization"), - UnPublished.ORGANIZATION); + "organization.title"); sheet.add(PublicationGlobalizationUtil.globalize( "publications.ui.unpublished.number"),