From f667a9bad8fe930f724e2b1439e46de936559ce4 Mon Sep 17 00:00:00 2001 From: jensp Date: Thu, 7 Sep 2017 14:12:57 +0000 Subject: [PATCH] CCM NG/ccm-cms: RelatedInfoStep bug fixes git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4991 8810af33-2d31-482b-a856-94f89814c4df --- .../assets/relatedinfo/AttachmentsTable.java | 7 +-- .../relatedinfo/InternalLinkAddForm.java | 21 +++++++- .../RelatedInfoAttachAssetForm.java | 10 ++-- .../assets/relatedinfo/RelatedInfoStep.java | 51 ++++++++++++++++--- .../org/librecms/CmsResources.properties | 5 ++ .../org/librecms/CmsResources_de.properties | 5 ++ .../org/librecms/CmsResources_fr.properties | 5 ++ 7 files changed, 90 insertions(+), 14 deletions(-) diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/AttachmentsTable.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/AttachmentsTable.java index 9807d15c7..792a7abff 100644 --- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/AttachmentsTable.java +++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/AttachmentsTable.java @@ -31,7 +31,6 @@ import com.arsdigita.bebop.table.TableCellRenderer; import com.arsdigita.bebop.table.TableColumn; import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.cms.ItemSelectionModel; -import com.arsdigita.cms.ui.GlobalNavigation; import com.arsdigita.cms.ui.authoring.assets.AttachmentListSelectionModel; import com.arsdigita.cms.ui.authoring.assets.AttachmentSelectionModel; import com.arsdigita.globalization.GlobalizedMessage; @@ -89,11 +88,13 @@ class AttachmentsTable extends Table { columnModel.add(new TableColumn( COL_MOVE, new Label(new GlobalizedMessage( - "cms.ui.authoring.assets.related_info_step.attachment.move")))); + "cms.ui.authoring.assets.related_info_step.attachment.move", + CmsConstants.CMS_BUNDLE)))); columnModel.add(new TableColumn( COL_REMOVE, new Label(new GlobalizedMessage( - "cms.ui.authoring.assets.related_info_step.attachment.remove")))); + "cms.ui.authoring.assets.related_info_step.attachment.remove", + CmsConstants.CMS_BUNDLE)))); super .setModelBuilder(new AttachmentsTableModelBuilder( diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/InternalLinkAddForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/InternalLinkAddForm.java index 18ef18ed5..c9069afea 100644 --- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/InternalLinkAddForm.java +++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/InternalLinkAddForm.java @@ -20,6 +20,7 @@ package com.arsdigita.cms.ui.authoring.assets.relatedinfo; import com.arsdigita.bebop.Form; import com.arsdigita.bebop.FormProcessException; +import com.arsdigita.bebop.Label; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.SaveCancelSection; import com.arsdigita.bebop.event.FormInitListener; @@ -31,8 +32,10 @@ import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ui.assets.ItemSearchWidget; import com.arsdigita.cms.ui.authoring.assets.AttachmentListSelectionModel; +import com.arsdigita.globalization.GlobalizedMessage; import org.libreccm.cdi.utils.CdiUtil; +import org.librecms.CmsConstants; /** * @@ -67,10 +70,24 @@ public class InternalLinkAddForm this.listSelectionModel = listSelectionModel; this.selectedLanguageParam = selectedLanguageParam; + final Label titleLabel = new Label(new GlobalizedMessage( + "cms.ui.authoring.assets.related_info_step.internal_link.title", + CmsConstants.CMS_BUNDLE)); titleField = new TextField("link-title"); + // descriptionArea = new TextArea("link-description"); + final Label itemSearchLabel = new Label(new GlobalizedMessage( + "cms.ui.authoring.assets.related_info_step.internal_link.target_item", + CmsConstants.CMS_BUNDLE)); itemSearchWidget = new ItemSearchWidget("link-item-search"); + saveCancelSection = new SaveCancelSection(); + + super.add(titleLabel); + super.add(titleField); + super.add(itemSearchLabel); + super.add(itemSearchWidget); + super.add(saveCancelSection); } @Override @@ -103,11 +120,11 @@ public class InternalLinkAddForm @Override public void submitted(final FormSectionEvent event) throws FormProcessException { - + if (saveCancelSection.getCancelButton().isSelected(event.getPageState())) { relatedInfoStep.showAttachmentsTable(event.getPageState()); } - + } } diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/RelatedInfoAttachAssetForm.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/RelatedInfoAttachAssetForm.java index 568188bc2..f4a713bb1 100644 --- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/RelatedInfoAttachAssetForm.java +++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/RelatedInfoAttachAssetForm.java @@ -20,6 +20,7 @@ package com.arsdigita.cms.ui.authoring.assets.relatedinfo; import com.arsdigita.bebop.Form; import com.arsdigita.bebop.FormProcessException; +import com.arsdigita.bebop.Label; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.SaveCancelSection; import com.arsdigita.bebop.event.FormInitListener; @@ -30,13 +31,12 @@ import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ui.assets.AssetSearchWidget; import com.arsdigita.cms.ui.authoring.assets.AttachmentListSelectionModel; +import com.arsdigita.globalization.GlobalizedMessage; import org.libreccm.cdi.utils.CdiUtil; import org.libreccm.core.UnexpectedErrorException; -import org.librecms.contentsection.Asset; -import org.librecms.contentsection.AssetRepository; +import org.librecms.CmsConstants; import org.librecms.contentsection.AttachmentList; -import org.librecms.contentsection.ItemAttachmentManager; /** * @@ -69,6 +69,10 @@ class RelatedInfoAttachAssetForm this.listSelectionModel = listSelectionModel; this.selectedLanguageParameter = selectedLangugeParam; + final Label label = new Label(new GlobalizedMessage( + "cms.ui.authoring.assets.related_info_step.attach_asset.selected_asset", + CmsConstants.CMS_BUNDLE)); + super.add(label); searchWidget = new AssetSearchWidget("asset-search-widget"); super.add(searchWidget); saveCancelSection = new SaveCancelSection(); diff --git a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/RelatedInfoStep.java b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/RelatedInfoStep.java index 435ae3d12..d761f228d 100644 --- a/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/RelatedInfoStep.java +++ b/ccm-cms/src/main/java/com/arsdigita/cms/ui/authoring/assets/relatedinfo/RelatedInfoStep.java @@ -23,6 +23,7 @@ import com.arsdigita.bebop.BoxPanel; import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Page; import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; @@ -65,7 +66,10 @@ public class RelatedInfoStep extends ResettableContainer { private final AttachmentsTable attachmentsTable; private final RelatedInfoAttachAssetForm attachAssetForm; + private final InternalLinkAddForm internalLinkAddForm; + private final ActionLink attachAssetLink; + private final ActionLink internalLinkAddLink; private final ActionLink attachmentToFirstLink; public RelatedInfoStep(final ItemSelectionModel itemSelectionModel, @@ -145,6 +149,11 @@ public class RelatedInfoStep extends ResettableContainer { itemSelectionModel, selectedListModel, selectedLanguageParam); + internalLinkAddForm = new InternalLinkAddForm(this, + itemSelectionModel, + selectedListModel, + selectedLanguageParam); + attachAssetLink = new ActionLink(new GlobalizedMessage( "cms.ui.authoring.assets.related_info_step.attach_asset", @@ -153,6 +162,13 @@ public class RelatedInfoStep extends ResettableContainer { showAttachAssetForm(event.getPageState()); }); + internalLinkAddLink = new ActionLink(new GlobalizedMessage( + "cms.ui.authoring.assets.related_info_step.add_internal_link", + CmsConstants.CMS_BUNDLE)); + internalLinkAddLink.addActionListener(event -> { + showAddInternalLinkForm(event.getPageState()); + }); + attachmentToFirstLink = new ActionLink(new GlobalizedMessage( "cms.ui.authoring.assets.related_info_step.attachment.move_to_first", CmsConstants.CMS_BUNDLE)); @@ -184,9 +200,13 @@ public class RelatedInfoStep extends ResettableContainer { } }); + final SimpleContainer addLinks = new SimpleContainer(); + addLinks.add(addListLink); + addLinks.add(internalLinkAddLink); + final BoxPanel panel = new BoxPanel(BoxPanel.VERTICAL); - panel.add(addListLink); + panel.add(addLinks); panel.add(listToFirstLink); panel.add(listTable); panel.add(listForm); @@ -195,6 +215,7 @@ public class RelatedInfoStep extends ResettableContainer { panel.add(attachmentToFirstLink); panel.add(attachmentsTable); panel.add(attachAssetForm); + panel.add(internalLinkAddForm); super.add(panel); } @@ -211,17 +232,14 @@ public class RelatedInfoStep extends ResettableContainer { page.addComponentStateParam(this, moveAttachmentModel.getStateParameter()); -// page.addGlobalStateParam(selectedListModel.getStateParameter()); -// page.addGlobalStateParam(moveListModel.getStateParameter()); -// page.addGlobalStateParam(selectedAttachmentModel.getStateParameter()); -// page.addGlobalStateParam(moveAttachmentModel.getStateParameter()); - page.setVisibleDefault(listTable, true); page.setVisibleDefault(listForm, false); page.setVisibleDefault(addListLink, true); page.setVisibleDefault(listToFirstLink, false); page.setVisibleDefault(attachmentsTable, false); page.setVisibleDefault(attachAssetForm, false); + page.setVisibleDefault(internalLinkAddForm, false); + page.setVisibleDefault(internalLinkAddLink, false); page.setVisibleDefault(attachAssetLink, false); page.setVisibleDefault(attachmentToFirstLink, false); } @@ -236,6 +254,8 @@ public class RelatedInfoStep extends ResettableContainer { attachAssetForm.setVisible(state, false); attachAssetLink.setVisible(state, false); attachmentToFirstLink.setVisible(state, false); + internalLinkAddForm.setVisible(state, false); + internalLinkAddLink.setVisible(state, false); } void showListEditForm(final PageState state) { @@ -248,6 +268,8 @@ public class RelatedInfoStep extends ResettableContainer { attachAssetForm.setVisible(state, false); attachAssetLink.setVisible(state, false); attachmentToFirstLink.setVisible(state, false); + internalLinkAddForm.setVisible(state, false); + internalLinkAddLink.setVisible(state, false); } void showAttachmentsTable(final PageState state) { @@ -260,6 +282,8 @@ public class RelatedInfoStep extends ResettableContainer { attachAssetForm.setVisible(state, false); attachAssetLink.setVisible(state, true); attachmentToFirstLink.setVisible(state, false); + internalLinkAddForm.setVisible(state, false); + internalLinkAddLink.setVisible(state, true); } void showAttachAssetForm(final PageState state) { @@ -271,6 +295,21 @@ public class RelatedInfoStep extends ResettableContainer { attachAssetForm.setVisible(state, true); attachAssetLink.setVisible(state, false); attachmentToFirstLink.setVisible(state, false); + internalLinkAddForm.setVisible(state, false); + internalLinkAddLink.setVisible(state, false); + } + + void showAddInternalLinkForm(final PageState state) { + listTable.setVisible(state, false); + listForm.setVisible(state, false); + addListLink.setVisible(state, false); + listToFirstLink.setVisible(state, false); + attachmentsTable.setVisible(state, false); + attachAssetForm.setVisible(state, false); + attachAssetLink.setVisible(state, false); + attachmentToFirstLink.setVisible(state, false); + internalLinkAddForm.setVisible(state, true); + internalLinkAddLink.setVisible(state, false); } } diff --git a/ccm-cms/src/main/resources/org/librecms/CmsResources.properties b/ccm-cms/src/main/resources/org/librecms/CmsResources.properties index bafe3d755..171de3721 100644 --- a/ccm-cms/src/main/resources/org/librecms/CmsResources.properties +++ b/ccm-cms/src/main/resources/org/librecms/CmsResources.properties @@ -439,3 +439,8 @@ cms.ui.authoring.assets.related_info_step.attachment.move_here=Move here cms.ui.authoring.assets.related_info_step.list.move_here=Move here cms.ui.authoring.assets.related_info_step.list.none=No related informations yet cms.ui.authoring.assets.related_info_step.list.edit\ \t=Edit +cms.ui.authoring.assets.related_info_step.attach_asset.selected_asset=Selected asset +cms.ui.authoring.assets.related_info_step.attachment.move\ \t=Move +cms.ui.authoring.assets.related_info_step.add_internal_link=Add internal link +cms.ui.authoring.assets.related_info_step.internal_link.title=Title +cms.ui.authoring.assets.related_info_step.internal_link.target_item=Target diff --git a/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties b/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties index 9ea363267..8f603d8ee 100644 --- a/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties +++ b/ccm-cms/src/main/resources/org/librecms/CmsResources_de.properties @@ -436,3 +436,8 @@ cms.ui.authoring.assets.related_info_step.attachment.move_here=Hierher verschieb cms.ui.authoring.assets.related_info_step.list.move_here=Hierher verschieben cms.ui.authoring.assets.related_info_step.list.none=Es wurden noch keine weiterf\u00fchrenden Informationen hinzugef\u00fcgt cms.ui.authoring.assets.related_info_step.list.edit\ \t=Bearbeiten +cms.ui.authoring.assets.related_info_step.attach_asset.selected_asset=Ausgew\u00e4hltes Asset +cms.ui.authoring.assets.related_info_step.attachment.move\ \t=Verschieben +cms.ui.authoring.assets.related_info_step.add_internal_link=Internen Link hinzuf\u00fcgen +cms.ui.authoring.assets.related_info_step.internal_link.title=Titel +cms.ui.authoring.assets.related_info_step.internal_link.target_item=Ziel diff --git a/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties b/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties index 3a25b3fb1..fb162c6b8 100644 --- a/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties +++ b/ccm-cms/src/main/resources/org/librecms/CmsResources_fr.properties @@ -395,3 +395,8 @@ cms.ui.authoring.assets.related_info_step.attachment.move_here=Move here cms.ui.authoring.assets.related_info_step.list.move_here=Move here cms.ui.authoring.assets.related_info_step.list.none=No related informations yet cms.ui.authoring.assets.related_info_step.list.edit\ \t=Edit +cms.ui.authoring.assets.related_info_step.attach_asset.selected_asset=Selected asset +cms.ui.authoring.assets.related_info_step.attachment.move\ \t=Move +cms.ui.authoring.assets.related_info_step.add_internal_link=Add internal link +cms.ui.authoring.assets.related_info_step.internal_link.title=Title +cms.ui.authoring.assets.related_info_step.internal_link.target_item=Target