From 612e6a3814722bfaa9cc64e924cf869bc849832d Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 2 May 2023 15:36:03 +0200 Subject: [PATCH] Updated "Show on Map" --- .../ConstantsGeoPortalDataEntryApp.java | 2 ++ .../client/GeoPortalDataEntryApp.java | 35 +++++++++++-------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java index f9c305e..513fef7 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java @@ -49,6 +49,8 @@ public class ConstantsGeoPortalDataEntryApp { public static final String WORKFLOW_ACTION_POST_CREATION_ACTION_ID = "post_creation_action"; public static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getFormat("dd MMMM yyyy"); + + public static final String SHOW_ON_MAP_NOT_AVAILABLE_IN_DRAFT = "The 'Show on Map' facility is not available in DRAFT phase"; public static final String ALERT_MESSAGE_PROJECT_NOT_EDITABLE = "A Project can only be updated in " + WORKFLOW_PHASE.DRAFT.name() diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java index 06e5537..9cc1022 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java @@ -1441,18 +1441,32 @@ public class GeoPortalDataEntryApp implements EntryPoint { switch (action) { case VIEW_ON_MAP: { - + final Modal modal = new Modal(true, true); modal.setTitle("Show on Map the Project..."); modal.setCloseVisible(true); + if (resultDocumentDV.getLifecycleInfo() != null) { + String phase = resultDocumentDV.getLifecycleInfo().getPhase(); + // IF the project is not in DRAFT phase, showing an alert and no Update Mode + // will + // be activated + if (phase != null && phase.compareToIgnoreCase(WORKFLOW_PHASE.DRAFT.getLabel()) == 0) { + + Alert alert = new Alert( + ConstantsGeoPortalDataEntryApp.SHOW_ON_MAP_NOT_AVAILABLE_IN_DRAFT); + alert.setType(AlertType.WARNING); + alert.setClose(false); + modal.add(alert); + modal.show(); + return; + } + } + final HorizontalPanel hpGetLink = new HorizontalPanel(); final LoaderIcon lc = new LoaderIcon("Just moment getting link..."); hpGetLink.add(lc); modal.add(hpGetLink); - // final NewBrowserWindow newBrowserWindow = NewBrowserWindow.open("", "_blank", - // ""); - GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(resultDocumentDV.getId(), resultDocumentDV.getProfileID(), new AsyncCallback() { @Override @@ -1576,15 +1590,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { isNotInDRAFT = true; } } - -// EditModeRecord emr = new EditModeRecord(appManagerBus, resultDocumentDV); -// modal3.add(emr); -// modal3.show(); -// -// if(isPublishedProject) { -// emr.noUpdateMode(); -// } - + UpdateRecord ur = new UpdateRecord(appManagerBus, resultDocumentDV.getProfileID(), resultDocumentDV.getId(), width, height); @@ -1630,7 +1636,8 @@ public class GeoPortalDataEntryApp implements EntryPoint { break; } - + + //It is the show document case SHOW_METADATA: { GWT.log("VIEW SHOW_METADATA fired"); final Modal modal = new Modal(true, true);