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 #### Enhancements
- [#23903] Catalogue Moderation: allow to send a message to the moderators - [#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 - Moved to gwt 2.10.0
## [v2.2.4] - 2022-10-27 ## [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.ShowStatisticsEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowTypesEvent; 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.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.AlertType; 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.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.dom.client.Style.Float; import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.dom.client.Style.FontWeight; 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.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; 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 { 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).";
/** /**
* *
*/ */
@ -76,6 +82,9 @@ public class CkanMetadataManagementPanel extends FlowPanel {
private Button editMeta = new Button("Edit Item"); private Button editMeta = new Button("Edit Item");
private Button manageGRSFProduct = new Button("Manage GRSF Item"); // GRSF Manage private Button manageGRSFProduct = new Button("Manage GRSF Item"); // GRSF Manage
private Button manageCModS = new Button("Manage Items"); // Moderation private Button manageCModS = new Button("Manage Items"); // Moderation
private Alert messageModerationEnanbled = new Alert(MESSAGE_MODERATED_CATALOGUE); // Moderation message
private HandlerManager eventBus; private HandlerManager eventBus;
/** /**
@ -111,6 +120,11 @@ public class CkanMetadataManagementPanel extends FlowPanel {
manageCModS.setType(ButtonType.PRIMARY); manageCModS.setType(ButtonType.PRIMARY);
manageCModS.getElement().getStyle().setFloat(Float.RIGHT); manageCModS.getElement().getStyle().setFloat(Float.RIGHT);
manageCModS.getElement().getStyle().setMarginRight(20, Unit.PX); 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 // set icons
home.setIcon(IconType.HOME); home.setIcon(IconType.HOME);
@ -138,6 +152,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
manageGRSFProduct.setEnabled(false); manageGRSFProduct.setEnabled(false);
manageCModS.setVisible(false); manageCModS.setVisible(false);
manageCModS.setEnabled(false); manageCModS.setEnabled(false);
messageModerationEnanbled.setVisible(false);
// manage GRSF item info // manage GRSF item info
manageGRSFProduct.setTitle(MANAGE_GRSF_ITEM_TOOLTIP); manageGRSFProduct.setTitle(MANAGE_GRSF_ITEM_TOOLTIP);
@ -147,6 +162,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
manageCModS.setTitle(MANAGE_CMS_ITEMS_TOOLTIP); manageCModS.setTitle(MANAGE_CMS_ITEMS_TOOLTIP);
manageCModS.getElement().getStyle().setFontWeight(FontWeight.BOLD); manageCModS.getElement().getStyle().setFontWeight(FontWeight.BOLD);
nav.add(messageModerationEnanbled);
// add to navigation bar // add to navigation bar
nav.add(home); nav.add(home);
nav.add(organizations); 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 * @param value true or false
*/ */
@ -382,6 +399,17 @@ public class CkanMetadataManagementPanel extends FlowPanel {
manageCModS.setVisible(value); 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. * Enable manage CMS products button.
* *

View File

@ -268,6 +268,10 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
GWT.log("Moderator role is assigned? " + isModeratorRoleAssingned); GWT.log("Moderator role is assigned? " + isModeratorRoleAssingned);
GWT.log("isExistsMyItemInModeration? " + isExistsMyItemInModeration); GWT.log("isExistsMyItemInModeration? " + isExistsMyItemInModeration);
if (isContentModerationEnabled) {
managementPanel.showMessageCatalogueIsModerated(isContentModerationEnabled);
}
// Enabling moderation if the moderation is active in the context and // Enabling moderation if the moderation is active in the context and
// the user has the role of MODERATOR in the context // the user has the role of MODERATOR in the context
if (isContentModerationEnabled && isModeratorRoleAssingned) { if (isContentModerationEnabled && isModeratorRoleAssingned) {