This commit is contained in:
Francesco Mangiacrapa 2023-01-27 16:35:35 +01:00
parent 45c178579b
commit b1a17f1ea5
3 changed files with 39 additions and 6 deletions

View File

@ -9,6 +9,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
#### Enhancements
- [#23903] Catalogue Moderation: allow to send a message to the moderators
- [#24309] Inform the VRE users that the catalogue is moderated
- Moved to gwt 2.10.0
## [v2.2.4] - 2022-10-27

View File

@ -16,6 +16,7 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowOrgani
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowStatisticsEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowTypesEvent;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
@ -23,6 +24,7 @@ import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.dom.client.Style.FontWeight;
import com.google.gwt.dom.client.Style.TextAlign;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
@ -39,6 +41,10 @@ import com.google.gwt.user.client.ui.InlineHTML;
*/
public class CkanMetadataManagementPanel extends FlowPanel {
private static final String MESSAGE_MODERATED_CATALOGUE = "Controlled Catalogue";
public static final String CATALOGUE_ITEMS_WERE_APPROVED_BY_CATALOGUE_MODERATOR_S = "Catalogue items were approved by Catalogue Moderator(s).";
/**
*
*/
@ -74,8 +80,11 @@ public class CkanMetadataManagementPanel extends FlowPanel {
private Button uploadToZenodo = new Button("Upload to Zenodo");
private Button insertMeta = new Button("Publish Item");
private Button editMeta = new Button("Edit Item");
private Button manageGRSFProduct = new Button("Manage GRSF Item"); //GRSF Manage
private Button manageCModS = new Button("Manage Items"); //Moderation
private Button manageGRSFProduct = new Button("Manage GRSF Item"); // GRSF Manage
private Button manageCModS = new Button("Manage Items"); // Moderation
private Alert messageModerationEnanbled = new Alert(MESSAGE_MODERATED_CATALOGUE); // Moderation message
private HandlerManager eventBus;
/**
@ -111,6 +120,11 @@ public class CkanMetadataManagementPanel extends FlowPanel {
manageCModS.setType(ButtonType.PRIMARY);
manageCModS.getElement().getStyle().setFloat(Float.RIGHT);
manageCModS.getElement().getStyle().setMarginRight(20, Unit.PX);
messageModerationEnanbled.setType(AlertType.INFO);
messageModerationEnanbled.setClose(false);
//messageModerationEnanbled.addStyleName("moderation-message");
messageModerationEnanbled.getElement().getStyle().setTextAlign(TextAlign.CENTER);
messageModerationEnanbled.setTitle(CATALOGUE_ITEMS_WERE_APPROVED_BY_CATALOGUE_MODERATOR_S);
// set icons
home.setIcon(IconType.HOME);
@ -138,6 +152,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
manageGRSFProduct.setEnabled(false);
manageCModS.setVisible(false);
manageCModS.setEnabled(false);
messageModerationEnanbled.setVisible(false);
// manage GRSF item info
manageGRSFProduct.setTitle(MANAGE_GRSF_ITEM_TOOLTIP);
@ -147,6 +162,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
manageCModS.setTitle(MANAGE_CMS_ITEMS_TOOLTIP);
manageCModS.getElement().getStyle().setFontWeight(FontWeight.BOLD);
nav.add(messageModerationEnanbled);
// add to navigation bar
nav.add(home);
nav.add(organizations);
@ -374,7 +390,8 @@ public class CkanMetadataManagementPanel extends FlowPanel {
}
/**
* Button to manage the products under moderation via Content Moderation System (CMS)
* Button to manage the products under moderation via Content Moderation System
* (CMS)
*
* @param value true or false
*/
@ -382,6 +399,17 @@ public class CkanMetadataManagementPanel extends FlowPanel {
manageCModS.setVisible(value);
}
/**
* Show message catalogue is moderated.
*
* @param isContentModerationEnabled the is content moderation enabled
*/
public void showMessageCatalogueIsModerated(boolean isContentModerationEnabled) {
messageModerationEnanbled.setVisible(isContentModerationEnabled);
}
/**
* Enable manage CMS products button.
*
@ -408,7 +436,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
public void enablePublishOnZenodoButton(boolean value) {
uploadToZenodo.setEnabled(value);
}
/**
* Visibility publish on zenodo button.
*

View File

@ -109,13 +109,13 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
String queryStringParameter = paramsMap.get(GCubeCkanDataCatalog.GET_QUERY_STRING_PARAMETER);
if (queryStringParameter != null) {
GWT.log("Read "+GCubeCkanDataCatalog.GET_QUERY_STRING_PARAMETER+ " as: "+queryStringParameter);
GWT.log("Read " + GCubeCkanDataCatalog.GET_QUERY_STRING_PARAMETER + " as: " + queryStringParameter);
String base64DecodeQueryString = QueryStringUtil.base64DecodeQueryString(queryStringParameter);
ModerationBuilder moderationBuilder = new ModerationQueryStringUtil()
.toModerationBuilder(base64DecodeQueryString);
if (moderationBuilder != null) {
GWT.log("Moderation Builder is: "+moderationBuilder);
GWT.log("Moderation Builder is: " + moderationBuilder);
CkanContentModeratorWidget ccmw = new CkanContentModeratorWidget(moderationBuilder);
ccmw.showAsModal("Manage Items");
}
@ -268,6 +268,10 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
GWT.log("Moderator role is assigned? " + isModeratorRoleAssingned);
GWT.log("isExistsMyItemInModeration? " + isExistsMyItemInModeration);
if (isContentModerationEnabled) {
managementPanel.showMessageCatalogueIsModerated(isContentModerationEnabled);
}
// Enabling moderation if the moderation is active in the context and
// the user has the role of MODERATOR in the context
if (isContentModerationEnabled && isModeratorRoleAssingned) {