Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge into develop-exo - EXO-72738,EXO-72741,EXO-72749,EXO-73246 #263

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
<import>war:/conf/news/metadata-plugins-configuration.xml</import>
<import>war:/conf/news/gamification-configuration.xml</import>
<import>war:/conf/news/ckeditor-configuration.xml</import>
<import>war:/conf/news/feature-flags-configuration.xml</import>

</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
* This file is part of the Meeds project (https://meeds.io/).
*
* Copyright (C) 2024 Meeds Association [email protected]
*
* This program 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 3 of the License, or (at your option) any later version.
*
* This program 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 program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_3.xsd http://www.exoplatform.org/xml/ns/kernel_1_3.xsd"
xmlns="http://www.exoplatform.org/xml/ns/kernel_1_3.xsd">

<component>
<key>ContentFeatureProperties</key>
<type>org.exoplatform.container.ExtendedPropertyConfigurator</type>
<init-params>
<properties-param>
<name>ContentFeatureProperties</name>
<description>Content Feature enablement flag</description>
<property name="exo.feature.newPublicationDrawer.enabled"
value="${exo.feature.newPublicationDrawer.enabled:false}"/>
</properties-param>
</init-params>
</component>

<external-component-plugins>
<target-component>org.exoplatform.groovyscript.text.TemplateService</target-component>
<component-plugin>
<name>UIPortalApplication-head</name>
<set-method>addTemplateExtension</set-method>
<type>org.exoplatform.groovyscript.text.TemplateExtensionPlugin</type>
<init-params>
<values-param>
<name>templates</name>
<description>The list of templates to include in HTML Page Header with UIPortalApplication.gtmpl
</description>
<value>war:/groovy/webui/workspace/UIContentHeadTemplate.gtmpl</value>
</values-param>
</init-params>
</component-plugin>
</external-component-plugins>
</configuration>
3 changes: 3 additions & 0 deletions content-webapp/src/main/webapp/WEB-INF/gatein-resources.xml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@
<minify>false</minify>
<path>/js/newsDetails.bundle.js</path>
</script>
<depends>
<module>NotesPublication</module>
</depends>
<depends>
<module>vue</module>
</depends>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<%
import org.exoplatform.commons.api.settings.ExoFeatureService;
def rcontext = _ctx.getRequestContext();
ExoFeatureService featureService = uicomponent.getApplicationComponent(ExoFeatureService.class);
def userName = rcontext.getRemoteUser();
%>

<script type="text/javascript" id="contentHeadScripts">
eXo.env.portal.newPublicationDrawerEnabled = <%=featureService.isFeatureActiveForUser("newPublicationDrawer", userName)%>;
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
:form-title="contentFormTitle"
:suggester-space-url="spacePrettyName"
:app-name="appName"
:web-page-note="false"
:web-page-url="false"
:languages="languages"
:translations="translations"
:selected-language="selectedLanguage"
Expand All @@ -44,6 +42,8 @@
:save-button-icon="saveButtonIcon"
:save-button-disabled="disableSaveButton"
:editor-icon="editorIcon"
:space-id="spaceId"
:can-publish="canScheduleArticle"
:images-download-folder="'DRIVE_ROOT_NODE/News/images'"
@editor-closed="editorClosed"
@open-treeview="openTreeView"
Expand All @@ -55,7 +55,7 @@
ref="noteTreeview"
@closed="closePluginsDrawer()" />
<schedule-news-drawer
v-if="canScheduleArticle"
v-if="canScheduleArticle && !newPublicationDrawerEnabled"
:posting-news="postingNews"
:news-id="articleId"
:news-type="articleType"
Expand Down Expand Up @@ -140,6 +140,9 @@ export default {
this.autoSave();
}
},
postingNews() {
this.$refs.editor.setPublishing(this.postingNews);
}
},
computed: {
editMode() {
Expand Down Expand Up @@ -175,6 +178,9 @@ export default {
propertiesModified() {
return JSON.stringify(this.article?.properties) !== JSON.stringify(this.originalArticle?.properties);
},
newPublicationDrawerEnabled() {
return eXo?.env?.portal?.newPublicationDrawerEnabled;
}
},
created() {
this.getAvailableLanguages();
Expand Down Expand Up @@ -407,11 +413,7 @@ export default {
}
},
postArticle(schedulePostDate, postArticleMode, publish, isActivityPosted, selectedTargets, selectedAudience) {
if (typeof isActivityPosted === 'undefined') {
this.article.activityPosted = true;
} else {
this.article.activityPosted = isActivityPosted;
}
this.article.activityPosted = isActivityPosted;
this.article.published = publish;
this.article.targets = selectedTargets;
if (selectedAudience !== null) {
Expand Down Expand Up @@ -474,6 +476,7 @@ export default {
alertLinkText: this.$t('news.view.label'),
alertLink: this.isSpaceMember ? `${eXo.env.portal.context}/${eXo.env.portal.metaPortalName}/activity?id=${createdArticle.activityId}` : `${eXo.env.portal.context}/${eXo.env.portal.metaPortalName}/news-detail?newsId=${createdArticle.id}`
});
this.enableClickOnce();
}).catch(error => {
this.displayAlert({type: 'error', message: this.$t('news.save.error.message', error.message)});
this.enableClickOnce();
Expand Down Expand Up @@ -504,7 +507,20 @@ export default {
window.history.pushState('news', '', `${url.origin}${url.pathname}?${params.toString()}`);

},
postArticleActions() {
postAndPublish(editMode, publicationSettings) {
if (editMode) {
this.article.activityPosted = publicationSettings?.post;
this.updateAndPostArticle();
return;
}
this.postingNews = true;
this.postArticle(null, null, false, publicationSettings?.post);
},
postArticleActions(publicationSettings) {
if (this.newPublicationDrawerEnabled) {
this.postAndPublish(this.editMode, publicationSettings);
return;
}
if (this.editMode) {
this.updateAndPostArticle();
return;
Expand All @@ -514,9 +530,7 @@ export default {
this.$root.$emit('open-schedule-drawer', this.scheduleMode);
this.postKey++;
} else {
this.postingNews = true;
this.postArticle();
this.enableClickOnce();
this.postAndPublish();
}
},
updateArticleData(article) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,16 @@
:cancel-label="$t('news.button.cancel')"
@ok="deleteNews" />
<exo-news-edit-publishing-drawer
v-if="news && currentUser"
v-if="news && currentUser && !newPublicationDrawerEnabled"
:news="news"
@refresh-news="getNewsById(newsId)" />
<note-publication-drawer
v-if="newPublicationDrawerEnabled"
ref="publicationDrawer"
:is-publishing="isPublishing"
:space-id="spaceId"
:edit-mode="true"
@publish="publishArticle" />
<news-mobile-action-menu
:news="news"
@edit-article="editLink"
Expand Down Expand Up @@ -139,7 +146,8 @@ export default {
hour: '2-digit',
minute: '2-digit',
},
iframelyOriginRegex: /^https?:\/\/if-cdn.com/
iframelyOriginRegex: /^https?:\/\/if-cdn.com/,
isPublishing: false
};
},
computed: {
Expand All @@ -148,6 +156,9 @@ export default {
},
processedNewsType() {
return this.activityId && this.activityId !== '' ? this.$newsConstants.newsObjectType.ARTICLE : this.newsType;
},
newPublicationDrawerEnabled() {
return eXo?.env?.portal?.newPublicationDrawerEnabled;
}
},
created() {
Expand All @@ -169,11 +180,17 @@ export default {
}
}
});
this.$root.$on('open-edit-publishing-drawer', this.openPublicationDrawer);
},
mounted() {
this.markNewsAsRead(this.newsId);
},
methods: {
openPublicationDrawer() {
if (this.newPublicationDrawerEnabled) {
this.$refs.publicationDrawer.open(this.news);
}
},
markNewsAsRead(newsId) {
if (newsId) {
this.$newsServices.markNewsAsRead(newsId);
Expand Down Expand Up @@ -222,7 +239,18 @@ export default {
}
}, redirectionTime);
},

publishArticle(publicationSettings) {
this.isPublishing = true;
this.news.activityPosted = publicationSettings?.post;
return this.$newsServices.updateNews(this.news, false, this.$newsConstants.newsObjectType.ARTICLE, this.$newsConstants.newsUpdateType.POSTING_AND_PUBLISHING).then(() => {
this.isPublishing = false;
this.$root.$emit('alert-message', this.$t('news.composer.alert.success.UpdateTargets'), 'success');
this.$refs.publicationDrawer.close();
}).catch(() => {
this.isPublishing = false;
this.$root.$emit('alert-message', this.$t('news.composer.alert.error.UpdateTargets'), 'error');
});
},
postNews(schedulePostDate, postArticleMode, publish, isActivityPosted, selectedTargets, selectedAudience) {
this.news.timeZoneId = USER_TIMEZONE_ID;
this.news.activityPosted = isActivityPosted;
Expand Down