diff --git a/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_en.properties b/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_en.properties index 8f9b10dc21..960bb755cb 100644 --- a/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_en.properties +++ b/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_en.properties @@ -85,6 +85,10 @@ notes.publication.all.users.audience.info=All users will see the article notes.publication.audience.restricted=Audience Restricted: you cannot change it notes.publication.remove.selected.target.label=Remove selected target notes.publication.list.targets.drawer.close.label=Close +notes.publication.schedule.label=Schedule +notes.publication.schedule.between.label=Between +notes.publication.schedule.from.label=From +notes.publication.schedule.until.label=Until diff --git a/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_fr.properties b/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_fr.properties index 59d306e403..40bd34af47 100644 --- a/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_fr.properties +++ b/notes-webapp/src/main/resources/locale/portlet/notes/notesPortlet_fr.properties @@ -85,6 +85,10 @@ notes.publication.all.users.audience.info=Tous les utilisateurs verront l'articl notes.publication.audience.restricted=Audience Restreint : vous ne pouvez pas le modifier notes.publication.remove.selected.target.label=Supprimer la cible sélectionnée notes.publication.list.targets.drawer.close.label=Fermer +notes.publication.schedule.label=Programmer +notes.publication.schedule.between.label=Entre +notes.publication.schedule.from.label=De +notes.publication.schedule.until.label=Jusqu'\u00E0 popup.confirm=Confirmer popup.msg.confirmation=Confirmation diff --git a/notes-webapp/src/main/webapp/vue-app/notes-publication/components/NotePublicationDrawer.vue b/notes-webapp/src/main/webapp/vue-app/notes-publication/components/NotePublicationDrawer.vue index 86c1f55fce..1db2fab113 100644 --- a/notes-webapp/src/main/webapp/vue-app/notes-publication/components/NotePublicationDrawer.vue +++ b/notes-webapp/src/main/webapp/vue-app/notes-publication/components/NotePublicationDrawer.vue @@ -107,7 +107,7 @@
+ class="d-flex flex-column pb-10">
@@ -134,17 +134,31 @@
+
@@ -188,7 +202,9 @@ export default { publicationSettings: { post: true }, - currentPublicationSettings: {} + scheduleSettings: {}, + currentPublicationSettings: {}, + currentScheduleSettings: {} }; }, props: { @@ -210,6 +226,12 @@ export default { } }, computed: { + scheduleOptionEnabled() { + return eXo?.env?.portal?.newPublicationDrawerScheduleOptionEnabled; + }, + scheduleAllowed() { + return this.scheduleOptionEnabled && (!this.editMode || (this.publicationSettings?.publish || !!this.noteObject?.schedulePostDate)); + }, saveEnabled() { return !this.editMode || this.publicationSettingsUpdated; }, @@ -218,7 +240,8 @@ export default { }, saveButtonLabel() { return (!this.editMode && !this.expanded && this.stepper === 1) && this.$t('notes.publication.publish.next.label') - || this.$t('notes.publication.publish.save.label'); + || !this.editMode && this.$t('notes.publication.publish.save.label') + || this.$t('notes.button.publish'); }, summaryLengthError() { return this.noteObject?.properties?.summary?.length > this.summaryMaxLength; @@ -243,12 +266,17 @@ export default { methods: { updatedPublicationSettings(settings) { this.publicationSettings = structuredClone({ - post: this.publicationSettings.post + post: this.publicationSettings.post, + scheduleSettings: this.publicationSettings.scheduleSettings }); this.publicationSettings.publish = settings?.publish; this.publicationSettings.selectedTargets = settings?.selectedTargets; this.publicationSettings.selectedAudience = settings?.selectedAudience; }, + updatedScheduleSettings(settings) { + this.scheduleSettings = structuredClone(settings); + this.publicationSettings.scheduleSettings = this.scheduleSettings; + }, propertiesUpdated(properties) { if (!this.noteObject?.properties || !Object.keys(this.noteObject?.properties).length) { this.noteObject.properties = structuredClone(properties || {}); @@ -268,16 +296,24 @@ export default { this.noteObject = noteObject; if (this.editMode) { this.publicationSettings.post = this.noteObject?.activityPosted; + + this.scheduleSettings.schedule = !!this.noteObject?.schedulePostDate || !!this.noteObject?.scheduleUnpublishDate; + this.scheduleSettings.postDate = this.noteObject?.schedulePostDate; + this.scheduleSettings.unpublishDate = this.noteObject?.scheduleUnpublishDate; + this.publicationSettings.scheduleSettings = this.scheduleSettings; + this.publicationSettings.publish = this.noteObject?.published; this.publicationSettings.selectedTargets = this.noteObject?.targets; this.publicationSettings.selectedAudience = this.noteObject?.audience; } + this.currentScheduleSettings = structuredClone(this.scheduleSettings); this.currentPublicationSettings = structuredClone(this.publicationSettings); this.cloneProperties(); this.$refs.publicationDrawer.open(); this.toggleExpand(); setTimeout(() => { - this.$refs.publishOption.initSettings(); + this.$refs?.publishOption?.initSettings(); + this.$refs?.scheduleOption?.initSettings(); }, 200); this.$refs.propertiesForm?.initProperties(); }, @@ -304,6 +340,7 @@ export default { }, cancelChanges() { this.$refs?.publishOption?.cancelChanges(); + this.$refs?.scheduleOption?.cancelChanges(); }, reset() { setTimeout(() => { diff --git a/notes-webapp/src/main/webapp/vue-app/notes-publication/components/options/NotePublicationTargetDrawer.vue b/notes-webapp/src/main/webapp/vue-app/notes-publication/components/publish-option/NotePublicationTargetDrawer.vue similarity index 100% rename from notes-webapp/src/main/webapp/vue-app/notes-publication/components/options/NotePublicationTargetDrawer.vue rename to notes-webapp/src/main/webapp/vue-app/notes-publication/components/publish-option/NotePublicationTargetDrawer.vue diff --git a/notes-webapp/src/main/webapp/vue-app/notes-publication/components/options/NotePublicationTargetList.vue b/notes-webapp/src/main/webapp/vue-app/notes-publication/components/publish-option/NotePublicationTargetList.vue similarity index 100% rename from notes-webapp/src/main/webapp/vue-app/notes-publication/components/options/NotePublicationTargetList.vue rename to notes-webapp/src/main/webapp/vue-app/notes-publication/components/publish-option/NotePublicationTargetList.vue diff --git a/notes-webapp/src/main/webapp/vue-app/notes-publication/components/options/NotePublishOption.vue b/notes-webapp/src/main/webapp/vue-app/notes-publication/components/publish-option/NotePublishOption.vue similarity index 96% rename from notes-webapp/src/main/webapp/vue-app/notes-publication/components/options/NotePublishOption.vue rename to notes-webapp/src/main/webapp/vue-app/notes-publication/components/publish-option/NotePublishOption.vue index d15e340424..63228f7a7b 100644 --- a/notes-webapp/src/main/webapp/vue-app/notes-publication/components/options/NotePublishOption.vue +++ b/notes-webapp/src/main/webapp/vue-app/notes-publication/components/publish-option/NotePublishOption.vue @@ -179,7 +179,7 @@ export default { type: Array, default: () => [] }, - savedSettings: { + savedPublishSettings: { type: Object, default: null }, @@ -233,9 +233,9 @@ export default { }, methods: { initSettings() { - this.publish = this.savedSettings?.published; - this.selectedTargets = this.savedSettings?.selectedTargets; - this.selectedAudience = this.savedAudience(this.savedSettings?.selectedAudience) || this.defaultAudience; + this.publish = this.savedPublishSettings?.published; + this.selectedTargets = this.savedPublishSettings?.selectedTargets; + this.selectedAudience = this.savedAudience(this.savedPublishSettings?.selectedAudience) || this.defaultAudience; this.checkRestrictedAudience(); }, savedAudience(savedAudience) { diff --git a/notes-webapp/src/main/webapp/vue-app/notes-publication/components/schedule-option/NoteScheduleOption.vue b/notes-webapp/src/main/webapp/vue-app/notes-publication/components/schedule-option/NoteScheduleOption.vue new file mode 100644 index 0000000000..33861e3f34 --- /dev/null +++ b/notes-webapp/src/main/webapp/vue-app/notes-publication/components/schedule-option/NoteScheduleOption.vue @@ -0,0 +1,388 @@ + + + + + diff --git a/notes-webapp/src/main/webapp/vue-app/notes-publication/initComponents.js b/notes-webapp/src/main/webapp/vue-app/notes-publication/initComponents.js index af7478fc83..932805a8f7 100644 --- a/notes-webapp/src/main/webapp/vue-app/notes-publication/initComponents.js +++ b/notes-webapp/src/main/webapp/vue-app/notes-publication/initComponents.js @@ -1,15 +1,17 @@ import NotePublicationDrawer from './components/NotePublicationDrawer.vue'; import NoteMetadataPropertiesForm from '../notes-rich-editor/components/note-properties/NoteMetadataPropertiesForm.vue'; -import NotePublishOption from './components/options/NotePublishOption.vue'; -import NotePublicationTargetDrawer from './components/options/NotePublicationTargetDrawer.vue'; -import NotePublicationTargetList from './components/options/NotePublicationTargetList.vue'; +import NotePublishOption from './components/publish-option/NotePublishOption.vue'; +import NotePublicationTargetDrawer from './components/publish-option/NotePublicationTargetDrawer.vue'; +import NotePublicationTargetList from './components/publish-option/NotePublicationTargetList.vue'; +import NoteScheduleOption from './components/schedule-option/NoteScheduleOption.vue'; const components = { 'note-publication-drawer': NotePublicationDrawer, 'note-metadata-properties-form': NoteMetadataPropertiesForm, 'note-publish-option': NotePublishOption, 'note-publication-target-drawer': NotePublicationTargetDrawer, - 'note-publication-target-list': NotePublicationTargetList + 'note-publication-target-list': NotePublicationTargetList, + 'note-schedule-option': NoteScheduleOption }; for (const key in components) {