#23390 Implementing facility: "Clone Project"
This commit is contained in:
parent
0cd6880a54
commit
eb6a8ff587
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-2.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
@ -30,5 +30,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/geoportal-data-entry-app-2.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/geoportal-data-entry-app-2.2.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
eclipse.preferences.version=1
|
||||
jarsExcludedFromWebInfLib=
|
||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-2.1.0-SNAPSHOT
|
||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-2.2.0-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -22,8 +22,10 @@
|
|||
|
||||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-entry-app-2.1.0-SNAPSHOT">
|
||||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-entry-app-2.2.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -47,7 +49,8 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -71,7 +74,8 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -95,10 +99,11 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
<dependent-module archiveName="geoportal-data-common-1.3.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||
<dependent-module archiveName="metadata-profile-discovery-1.0.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/metadata-profile-discovery/metadata-profile-discovery">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -122,7 +127,8 @@
|
|||
|
||||
|
||||
<property name="context-root" value="geoportal-data-entry-app"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -146,7 +152,8 @@
|
|||
|
||||
|
||||
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -170,7 +177,8 @@
|
|||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v2.2.0-SNAPSHOT] - 2022-05-25
|
||||
|
||||
#### Enhancements
|
||||
|
||||
- [#23390] Implemented facility: "Clone Project"
|
||||
|
||||
## [v2.1.0] - 2021-11-24
|
||||
|
||||
#### Enhancements
|
||||
|
|
28
pom.xml
28
pom.xml
|
@ -14,7 +14,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>geoportal-data-entry-app</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.1.0</version>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
<name>GeoPortal Data Entry App</name>
|
||||
<description>The GeoPortal Data Entry App is an application to build the web forms for data entries needed to GeoNa project</description>
|
||||
<scm>
|
||||
|
@ -25,7 +25,7 @@
|
|||
|
||||
<properties>
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwtVersion>2.9.0</gwtVersion>
|
||||
<gwtVersion>2.8.2</gwtVersion>
|
||||
<!-- GWT needs at least java 1.6 -->
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -98,6 +98,9 @@
|
|||
<artifactId>gwt-bootstrap</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>metadata-profile-form-builder-widget</artifactId>
|
||||
|
@ -136,16 +139,31 @@
|
|||
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- FORCING THESE DEPENDENCIES IN ORDER TO USE THE "OLD" CONCESSIONI CLIENT/MODEL -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-common</artifactId>
|
||||
<version>[1.0.0,1.0.8-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>metadata-profile-discovery</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 1.1.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-data-common</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<version>[1.0.0-SNAPSHOT, 1.5.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-client</artifactId>
|
||||
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
|
||||
<version>[1.0.0, 1.0.7-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
@ -154,6 +172,8 @@
|
|||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- END FORCING -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>gcube-widgets</artifactId>
|
||||
|
|
|
@ -108,7 +108,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
private UserRights myRights = null;
|
||||
|
||||
private LoaderIcon loader = new LoaderIcon("Loading Application...");
|
||||
|
||||
|
||||
private List<ItemField> displayFields = new ArrayList<ItemField>();
|
||||
private List<ItemField> sortByFields = new ArrayList<ItemField>();
|
||||
private List<ItemField> searchByFields = new ArrayList<ItemField>();
|
||||
|
@ -120,152 +120,148 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
RootPanel.get(DIV_PORTLET_ID).add(loader);
|
||||
|
||||
/*GeoportalDataEntryServiceAsync.Util.getInstance().listDisplayFields(new AsyncCallback<List<ItemField>>() {
|
||||
/*
|
||||
* GeoportalDataEntryServiceAsync.Util.getInstance().listDisplayFields(new
|
||||
* AsyncCallback<List<ItemField>>() {
|
||||
*
|
||||
* @Override public void onFailure(Throwable caught) {
|
||||
* Window.alert(caught.getMessage());
|
||||
*
|
||||
* }
|
||||
*
|
||||
* @Override public void onSuccess(List<ItemField> result) {
|
||||
*
|
||||
* for (ItemField itemField : result) { if(itemField.isDisplayAsResult()) {
|
||||
* displayFields.add(itemField); }
|
||||
*
|
||||
* if(itemField.isSearchable()) { searchByFields.add(itemField); }
|
||||
*
|
||||
* if(itemField.isSortable()) { sortByFields.add(itemField); } }
|
||||
*
|
||||
*
|
||||
* GWT.log("List display fields: "+result); SearchingFilter initialSortFilter =
|
||||
* new SearchingFilter(); initialSortFilter.setOrder(ORDER.ASC);
|
||||
* initialSortFilter.setOrderByFields(Arrays.asList(new ItemField("Name",
|
||||
* Arrays.asList("name"), true, true, true)));
|
||||
*
|
||||
* displayFields = result; mainTabPanel = new GeonaMainTabPanel(appManagerBus,
|
||||
* displayFields, sortByFields, searchByFields, initialSortFilter);
|
||||
* mainTabPanel.setLoaderVisible("Loading...", true);
|
||||
*
|
||||
* geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
||||
* mainTabPanel.addFormPanel(geoNaMainForm);
|
||||
*
|
||||
* } });
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(caught.getMessage());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<ItemField> result) {
|
||||
|
||||
for (ItemField itemField : result) {
|
||||
if(itemField.isDisplayAsResult()) {
|
||||
displayFields.add(itemField);
|
||||
}
|
||||
|
||||
if(itemField.isSearchable()) {
|
||||
searchByFields.add(itemField);
|
||||
}
|
||||
|
||||
if(itemField.isSortable()) {
|
||||
sortByFields.add(itemField);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GWT.log("List display fields: "+result);
|
||||
SearchingFilter initialSortFilter = new SearchingFilter();
|
||||
initialSortFilter.setOrder(ORDER.ASC);
|
||||
initialSortFilter.setOrderByFields(Arrays.asList(new ItemField("Name", Arrays.asList("name"), true, true, true)));
|
||||
|
||||
displayFields = result;
|
||||
mainTabPanel = new GeonaMainTabPanel(appManagerBus, displayFields, sortByFields, searchByFields, initialSortFilter);
|
||||
mainTabPanel.setLoaderVisible("Loading...", true);
|
||||
|
||||
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
||||
mainTabPanel.addFormPanel(geoNaMainForm);
|
||||
|
||||
}
|
||||
});*/
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().readDataViewerConfig(new AsyncCallback<GNADataEntryExtConfigProfile>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
String errorMsg = "Sorry, an error occurrend on istancing the application. Please, contact the support";
|
||||
Alert alert = new Alert(errorMsg, AlertType.ERROR);
|
||||
alert.setClose(false);
|
||||
try {
|
||||
RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
RootPanel.get(DIV_PORTLET_ID).add(alert);
|
||||
Window.alert(errorMsg);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GNADataEntryExtConfigProfile gNADataEntryConfig) {
|
||||
|
||||
try {
|
||||
RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
List<ItemField> itemFields = gNADataEntryConfig.getListItemFields();
|
||||
|
||||
for (ItemField itemField : itemFields) {
|
||||
if(itemField.isDisplayAsResult()) {
|
||||
displayFields.add(itemField);
|
||||
}
|
||||
|
||||
if(itemField.isSearchable()) {
|
||||
searchByFields.add(itemField);
|
||||
}
|
||||
|
||||
if(itemField.isSortable()) {
|
||||
sortByFields.add(itemField);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GWT.log("List display fields: "+itemFields);
|
||||
SearchingFilter initialSortFilter = new SearchingFilter();
|
||||
initialSortFilter.setOrder(ORDER.ASC);
|
||||
initialSortFilter.setOrderByFields(Arrays.asList(new ItemField("Name", Arrays.asList("name"), true, true, true)));
|
||||
|
||||
displayFields = itemFields;
|
||||
mainTabPanel = new GeonaMainTabPanel(appManagerBus, displayFields, sortByFields, searchByFields, initialSortFilter);
|
||||
mainTabPanel.setLoaderVisible("Loading...", true);
|
||||
|
||||
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
||||
mainTabPanel.addFormPanel(geoNaMainForm);
|
||||
|
||||
//PERMISSIONS
|
||||
myRights = gNADataEntryConfig.getUserRights();
|
||||
initGUI();
|
||||
GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
|
||||
String msg = "Logged in as ";
|
||||
if(userRole != null && userRole.getName()!=null) {
|
||||
msg+= userRole.getName().substring(userRole.getName().indexOf("-")+1, userRole.getName().length());
|
||||
}else
|
||||
msg+="Member";
|
||||
|
||||
mainTabPanel.setRoleLabel(msg);
|
||||
|
||||
|
||||
RoleRights roleRights = myRights.getRoleRights();
|
||||
boolean canCreateNewItem = roleRights.getListPermessions().keySet().contains(ACTION_ON_ITEM.CREATE_NEW_PROJECT);
|
||||
|
||||
if (!canCreateNewItem) {
|
||||
// removing Tab "Create New Project"
|
||||
mainTabPanel.removeTab(0);
|
||||
// activating Tab "List of Project"
|
||||
mainTabPanel.setTabActive(0);
|
||||
mainTabPanel.instanceAndShowListOfConcessioni();
|
||||
return;
|
||||
}
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() {
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance()
|
||||
.readDataViewerConfig(new AsyncCallback<GNADataEntryExtConfigProfile>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(
|
||||
"Sorry, an error occurrend when loading configurations. Please, contact the support");
|
||||
String errorMsg = "Sorry, an error occurrend on istancing the application. Please, contact the support";
|
||||
Alert alert = new Alert(errorMsg, AlertType.ERROR);
|
||||
alert.setClose(false);
|
||||
try {
|
||||
RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
RootPanel.get(DIV_PORTLET_ID).add(alert);
|
||||
Window.alert(errorMsg);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GeonaISConfig result) {
|
||||
public void onSuccess(GNADataEntryExtConfigProfile gNADataEntryConfig) {
|
||||
|
||||
if (result != null && result.getGenericResourceSecondaryType() != null
|
||||
&& result.getScope() != null) {
|
||||
callGetMetadataProfiles(result.getScope(), result.getGenericResourceSecondaryType());
|
||||
try {
|
||||
RootPanel.get(DIV_PORTLET_ID).remove(loader);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
List<ItemField> itemFields = gNADataEntryConfig.getListItemFields();
|
||||
|
||||
for (ItemField itemField : itemFields) {
|
||||
if (itemField.isDisplayAsResult()) {
|
||||
displayFields.add(itemField);
|
||||
}
|
||||
|
||||
if (itemField.isSearchable()) {
|
||||
searchByFields.add(itemField);
|
||||
}
|
||||
|
||||
if (itemField.isSortable()) {
|
||||
sortByFields.add(itemField);
|
||||
}
|
||||
}
|
||||
|
||||
GWT.log("List display fields: " + itemFields);
|
||||
SearchingFilter initialSortFilter = new SearchingFilter();
|
||||
initialSortFilter.setOrder(ORDER.ASC);
|
||||
initialSortFilter.setOrderByFields(
|
||||
Arrays.asList(new ItemField("Name", Arrays.asList("name"), true, true, true)));
|
||||
|
||||
displayFields = itemFields;
|
||||
mainTabPanel = new GeonaMainTabPanel(appManagerBus, displayFields, sortByFields, searchByFields,
|
||||
initialSortFilter);
|
||||
mainTabPanel.setLoaderVisible("Loading...", true);
|
||||
|
||||
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
|
||||
mainTabPanel.addFormPanel(geoNaMainForm);
|
||||
|
||||
// PERMISSIONS
|
||||
myRights = gNADataEntryConfig.getUserRights();
|
||||
initGUI();
|
||||
GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
|
||||
String msg = "Logged in as ";
|
||||
if (userRole != null && userRole.getName() != null) {
|
||||
msg += userRole.getName().substring(userRole.getName().indexOf("-") + 1,
|
||||
userRole.getName().length());
|
||||
} else
|
||||
Window.alert(
|
||||
"Sorry, no configuration found in the context. Please, contact the support");
|
||||
msg += "Member";
|
||||
|
||||
mainTabPanel.setRoleLabel(msg);
|
||||
|
||||
RoleRights roleRights = myRights.getRoleRights();
|
||||
boolean canCreateNewItem = roleRights.getListPermessions().keySet()
|
||||
.contains(ACTION_ON_ITEM.CREATE_NEW_PROJECT);
|
||||
|
||||
if (!canCreateNewItem) {
|
||||
// removing Tab "Create New Project"
|
||||
mainTabPanel.removeTab(0);
|
||||
// activating Tab "List of Project"
|
||||
mainTabPanel.setTabActive(0);
|
||||
mainTabPanel.instanceAndShowListOfConcessioni();
|
||||
return;
|
||||
}
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance()
|
||||
.getGeonaInitConfig(new AsyncCallback<GeonaISConfig>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(
|
||||
"Sorry, an error occurrend when loading configurations. Please, contact the support");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GeonaISConfig result) {
|
||||
|
||||
if (result != null && result.getGenericResourceSecondaryType() != null
|
||||
&& result.getScope() != null) {
|
||||
callGetMetadataProfiles(result.getScope(),
|
||||
result.getGenericResourceSecondaryType());
|
||||
} else
|
||||
Window.alert(
|
||||
"Sorry, no configuration found in the context. Please, contact the support");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// GeoportalDataEntryServiceAsync.Util.getInstance().getMyRightsInTheContext(new AsyncCallback<UserRights>() {
|
||||
//
|
||||
|
@ -657,7 +653,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
mainTabPanel.showListOfConcessioniView(grpw);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
appManagerBus.addHandler(ActionPerformedOnItemEvent.TYPE, new ActionPerformedOnItemEventHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -731,40 +727,44 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
final ConcessioneDV concessione = (ConcessioneDV) item;
|
||||
GWT.log("onDoActionFired item: " + concessione);
|
||||
|
||||
|
||||
// Checking if the user is NOT authorized to perform this action in two ways:
|
||||
// 1. the map of actions allowed for the user does not contain the action;
|
||||
RoleRights roleRights = myRights.getRoleRights();
|
||||
OPERATION_TYPE operationType = roleRights.getListPermessions().get(action);
|
||||
boolean allowedOperationForUser = operationType != null? true:false;
|
||||
boolean allowedOperationForUser = operationType != null ? true : false;
|
||||
if (!allowedOperationForUser) {
|
||||
|
||||
String msg = "You are not authorized to perform the action: "+ action.getLabel();
|
||||
ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()), "Forbidden: "+action, msg, AlertType.WARNING);
|
||||
|
||||
String msg = "You are not authorized to perform the action: " + action.getLabel();
|
||||
ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()),
|
||||
"Forbidden: " + action, msg, AlertType.WARNING);
|
||||
modalW.show();
|
||||
return;
|
||||
}
|
||||
// 2. the user cannot access to action (e.g. the user cannot write an item of another user)
|
||||
// 2. the user cannot access to action (e.g. the user cannot write an item of
|
||||
// another user)
|
||||
// if so an error is shown
|
||||
GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
|
||||
boolean allowedWriteActionOnItem = checkAccessToOperationType(userRole, operationType, concessione);
|
||||
boolean allowedWriteActionOnItem = checkAccessToOperationType(userRole, operationType,
|
||||
concessione);
|
||||
if (!allowedWriteActionOnItem) {
|
||||
String title = "Forbidden: missing write access";
|
||||
String msg = "You do not have write access to item: "+ concessione.getNome();
|
||||
if(!userRole.isWriteOwn()) {
|
||||
msg = "You do not have write access to item: "+ concessione.getNome();
|
||||
}else if (!userRole.isWriteAny()){
|
||||
String msg = "You do not have write access to item: " + concessione.getNome();
|
||||
if (!userRole.isWriteOwn()) {
|
||||
msg = "You do not have write access to item: " + concessione.getNome();
|
||||
} else if (!userRole.isWriteAny()) {
|
||||
title = "Forbidden: missing ownership";
|
||||
msg = "You are not the creator of: "+ concessione.getNome() +". You cannot access to it";
|
||||
msg = "You are not the creator of: " + concessione.getNome()
|
||||
+ ". You cannot access to it";
|
||||
}
|
||||
ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()), title, msg, AlertType.WARNING);
|
||||
ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()), title, msg,
|
||||
AlertType.WARNING);
|
||||
modalW.show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (action) {
|
||||
case VIEW_ON_MAP:
|
||||
case VIEW_ON_MAP: {
|
||||
final Modal modal = new Modal(true, true);
|
||||
modal.setCloseVisible(true);
|
||||
final HorizontalPanel hpGetLink = new HorizontalPanel();
|
||||
|
@ -798,8 +798,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
modal.show();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case VIEW_REPORT:
|
||||
case VIEW_REPORT: {
|
||||
|
||||
final Modal modal2 = new Modal(true, true);
|
||||
modal2.setTitle(
|
||||
|
@ -817,8 +818,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
modal2.show();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case EDIT_PROJECT:
|
||||
case EDIT_PROJECT: {
|
||||
final Modal modal3 = new Modal(true, true);
|
||||
modal3.setTitle(
|
||||
"<span style='font-size:20px;'>Edit: <span style='color:#555; font-size:20px;'>"
|
||||
|
@ -833,12 +835,43 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
modal3.add(emr);
|
||||
modal3.show();
|
||||
break;
|
||||
}
|
||||
|
||||
// case UPDATED_PROJECT:
|
||||
// appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||
// mainTabPanel.getCurrentSortFilter()));
|
||||
// break;
|
||||
case DELETE_PROJECT:
|
||||
|
||||
case CLONE_PROJECT: {
|
||||
|
||||
String htmlMsg = "Going to create a copy of the project with:";
|
||||
htmlMsg += "<ul>";
|
||||
htmlMsg += "<li>id: " + concessione.getItemId() + "</li>";
|
||||
htmlMsg += "<li>name: " + concessione.getNome() + "</li>";
|
||||
htmlMsg += "</ul>";
|
||||
htmlMsg += "<br>";
|
||||
htmlMsg += "Would you like to proceed?";
|
||||
|
||||
final DialogConfirm dialog = new DialogConfirm(null, "Cloning Confirm?", htmlMsg);
|
||||
dialog.center();
|
||||
|
||||
dialog.getYesButton().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
dialog.hide();
|
||||
final Modal modal = new Modal(true, true);
|
||||
modal.setCloseVisible(true);
|
||||
final HorizontalPanel hp = new HorizontalPanel();
|
||||
final LoaderIcon lc = new LoaderIcon("Creating a copy of the project...");
|
||||
hp.add(lc);
|
||||
modal.add(hp);
|
||||
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
case DELETE_PROJECT: {
|
||||
|
||||
String htmlMsg = "Going to delete the project with:";
|
||||
htmlMsg += "<ul>";
|
||||
|
@ -895,6 +928,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
modal.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@ -907,8 +941,9 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
});
|
||||
}
|
||||
|
||||
private boolean checkAccessToOperationType(GcubeUserRole userRole, OPERATION_TYPE allowedAction, ConcessioneDV concessione) {
|
||||
|
||||
private boolean checkAccessToOperationType(GcubeUserRole userRole, OPERATION_TYPE allowedAction,
|
||||
ConcessioneDV concessione) {
|
||||
|
||||
boolean writeAnyAPassed = false;
|
||||
boolean writeOwnPassed = false;
|
||||
|
@ -924,37 +959,37 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
String ownerUser = concessione.getCreationUser();
|
||||
if (ownerUser == null || ownerUser.isEmpty()) {
|
||||
writeOwnPassed = false;
|
||||
}else if (ownerUser.compareTo(myRights.getMyUsername()) == 0) {
|
||||
} else if (ownerUser.compareTo(myRights.getMyUsername()) == 0) {
|
||||
// if my username is equal the owner of the concessione
|
||||
writeOwnPassed = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean operationAllowed = false;
|
||||
switch (allowedAction) {
|
||||
case READ:
|
||||
//Access to READ operation is allowed to everyone
|
||||
// Access to READ operation is allowed to everyone
|
||||
operationAllowed = true;
|
||||
GWT.log(OPERATION_TYPE.READ+ " ALLOWED? "+operationAllowed);
|
||||
GWT.log(OPERATION_TYPE.READ + " ALLOWED? " + operationAllowed);
|
||||
break;
|
||||
case READ_WRITE:
|
||||
//Access to READ_WRITE operation
|
||||
// Access to READ_WRITE operation
|
||||
operationAllowed = writeAnyAPassed || writeOwnPassed;
|
||||
GWT.log(OPERATION_TYPE.READ_WRITE+ " ALLOWED? "+operationAllowed);
|
||||
GWT.log(OPERATION_TYPE.READ_WRITE + " ALLOWED? " + operationAllowed);
|
||||
break;
|
||||
case WRITE:
|
||||
//Access to WRITE operation
|
||||
// Access to WRITE operation
|
||||
operationAllowed = writeAnyAPassed || writeOwnPassed;
|
||||
GWT.log(OPERATION_TYPE.WRITE+ " ALLOWED? "+operationAllowed);
|
||||
GWT.log(OPERATION_TYPE.WRITE + " ALLOWED? " + operationAllowed);
|
||||
break;
|
||||
case UNKNOWN:
|
||||
operationAllowed = false;
|
||||
GWT.log(OPERATION_TYPE.UNKNOWN+ " ALLOWED? "+operationAllowed);
|
||||
GWT.log(OPERATION_TYPE.UNKNOWN + " ALLOWED? " + operationAllowed);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return operationAllowed;
|
||||
}
|
||||
|
||||
|
|
|
@ -125,6 +125,9 @@ public class GeonaMainTabPanel extends Composite {
|
|||
@UiField
|
||||
NavLink navEditMode;
|
||||
|
||||
@UiField
|
||||
NavLink navCloneProject;
|
||||
|
||||
@UiField
|
||||
NavLink navDelete;
|
||||
|
||||
|
@ -133,7 +136,7 @@ public class GeonaMainTabPanel extends Composite {
|
|||
|
||||
@UiField
|
||||
Button resetSearch;
|
||||
|
||||
|
||||
@UiField
|
||||
Label roleLabel;
|
||||
|
||||
|
@ -173,7 +176,7 @@ public class GeonaMainTabPanel extends Composite {
|
|||
|
||||
alertSearchFor.setText(searchForFields.get(0).getDisplayName());
|
||||
alertSortBy.setText(toLabelFilter((initialSortFilter.getOrderByFields().get(0)), initialSortFilter.getOrder()));
|
||||
|
||||
|
||||
bindEvents();
|
||||
resetSearch.setIconSize(IconSize.TWO_TIMES);
|
||||
resetSearch.setType(ButtonType.LINK);
|
||||
|
@ -310,6 +313,20 @@ public class GeonaMainTabPanel extends Composite {
|
|||
}
|
||||
});
|
||||
|
||||
navCloneProject.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
List<ConcessioneDV> listConcessioni = null;
|
||||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listConcessioni = grpw.getSelectItems();
|
||||
}
|
||||
appManagerBus
|
||||
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.CLONE_PROJECT));
|
||||
}
|
||||
});
|
||||
|
||||
navDelete.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -347,7 +364,7 @@ public class GeonaMainTabPanel extends Composite {
|
|||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setRoleLabel(String msg) {
|
||||
roleLabel.setText(msg);
|
||||
}
|
||||
|
|
|
@ -90,6 +90,8 @@
|
|||
title="Show Publication Report" icon="FILE_TEXT_ALT">Publication Report</b:NavLink>
|
||||
<b:NavLink ui:field="navEditMode" title="Edit"
|
||||
icon="PENCIL">Edit</b:NavLink>
|
||||
<b:NavLink ui:field="navCloneProject" title="Clone Project"
|
||||
icon="TRASH">Clone Project</b:NavLink>
|
||||
<b:NavLink ui:field="navDelete" title="Delete Project"
|
||||
icon="TRASH">Delete Project</b:NavLink>
|
||||
</b:NavPills>
|
||||
|
|
Loading…
Reference in New Issue