in progress integration with CMS
This commit is contained in:
parent
fd8655c220
commit
7c6049c48d
37
.classpath
37
.classpath
|
@ -1,11 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/gcube-ckan-datacatalog-2.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/gcube-ckan-datacatalog-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/gcube-ckan-datacatalog-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
|
@ -13,28 +24,16 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/gcube-ckan-datacatalog-2.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/gcube-ckan-datacatalog-2.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/gcube-ckan-datacatalog-2.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
>>>>>>>=refs/heads/task_20699
|
||||
eclipse.preferences.version=1
|
||||
jarsExcludedFromWebInfLib=
|
||||
lastWarOutDir=/home/francescomangiacrapa/git/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-2.0.0-SNAPSHOT
|
||||
>>>>>>> refs/heads/task_20699
|
||||
lastWarOutDir=/home/francescomangiacrapa/git/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-2.1.0-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
|
|
@ -2,7 +2,27 @@
|
|||
|
||||
|
||||
|
||||
<wb-module deploy-name="gcube-ckan-datacatalog-2.0.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-module deploy-name="gcube-ckan-datacatalog-2.1.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -10,11 +30,27 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -22,16 +58,62 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<property name="context-root" value="gcube-ckan-datacatalog"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</project-modules>
|
||||
|
|
|
@ -5,6 +5,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.1.0-SNAPSHOT] - 2021-06-15
|
||||
|
||||
#### Enhancements
|
||||
|
||||
[#20650] Data Catalogue: integrate the Content Moderator System
|
||||
|
||||
## [v2.0.1] - 2021-05-04
|
||||
|
||||
#### Enhancements
|
||||
|
|
30
pom.xml
30
pom.xml
|
@ -14,7 +14,7 @@
|
|||
<groupId>org.gcube.portlets.gcubeckan</groupId>
|
||||
<artifactId>gcube-ckan-datacatalog</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.0.1</version>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<name>gCube CKAN Data Catalog</name>
|
||||
<description>The gCube CKAN Data Catalog portlet</description>
|
||||
|
||||
|
@ -64,12 +64,31 @@
|
|||
<!-- <artifactId>xercesImpl</artifactId> -->
|
||||
<!-- <version>2.9.1</version> -->
|
||||
<!-- </dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
<version>1.4.01</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-user</artifactId>
|
||||
<scope>provided</scope>
|
||||
<!-- <scope>compile</scope> -->
|
||||
<version>${gwtVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-dev</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-servlet</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.gwtbootstrap</groupId>
|
||||
|
@ -101,6 +120,11 @@
|
|||
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>ckan-content-moderator-widget</artifactId>
|
||||
<version>[0.0.1, 1.0.0-SNAPSHOT)</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
|
|
|
@ -22,16 +22,24 @@
|
|||
name='org.gcube.portlets_widgets.catalogue_sharing_widget.ShareCatalogue' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.ckandatapublisherwidget.CKanMetadataPublisher' />
|
||||
<inherits name='org.gcube.datacatalogue.grsf_manage_widget.GRSFManageWidget' />
|
||||
<inherits name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
<inherits
|
||||
name='org.gcube.datacatalogue.grsf_manage_widget.GRSFManageWidget' />
|
||||
<inherits
|
||||
name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<inherits name='org.gcube.portlets.widgets.switchbutton.SwitchButton' />
|
||||
<inherits name='org.gcube.portlets.widgets.ckan2zenodopublisher.CkanToZenodoPublisher' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.switchbutton.SwitchButton' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.ckan2zenodopublisher.CkanToZenodoPublisher' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.ckancontentmoderator.CkanContentModeratorWidget' />
|
||||
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point class='org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog' />
|
||||
<entry-point
|
||||
class='org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog' />
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
|
|
|
@ -4,6 +4,9 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client;
|
|||
import org.gcube.datacatalogue.grsf_manage_widget.client.events.HideManagementPanelEvent;
|
||||
import org.gcube.datacatalogue.grsf_manage_widget.client.events.HideManagementPanelEventHandler;
|
||||
import org.gcube.datacatalogue.grsf_manage_widget.client.view.ManageProductWidget;
|
||||
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ClickedCMSManageProductButtonEvent;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ClickedCMSManageProductButtonEventHandler;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEvent;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEventHandler;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEvent;
|
||||
|
@ -32,6 +35,8 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view.GCubeCkanDa
|
|||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.client.CkanToZendoPublisherWidget;
|
||||
import org.gcube.portlets.widgets.ckan2zenodopublisher.shared.CatalogueItem;
|
||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorWidget;
|
||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.table.ItemsTable.DISPLAY_FIELD;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.CreateDatasetForm;
|
||||
import org.gcube.portlets_widgets.catalogue_sharing_widget.client.ShareCatalogueWidget;
|
||||
|
||||
|
@ -39,6 +44,8 @@ import com.github.gwtbootstrap.client.ui.Modal;
|
|||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
/**
|
||||
|
@ -232,6 +239,39 @@ public class CkanEventHandlerManager {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
eventBus.addHandler(ClickedCMSManageProductButtonEvent.TYPE, new ClickedCMSManageProductButtonEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onClickedManageProduct(ClickedCMSManageProductButtonEvent showManageProductWidgetEvent) {
|
||||
final CkanContentModeratorWidget cms = new CkanContentModeratorWidget(DISPLAY_FIELD.values(), DISPLAY_FIELD.TITLE);
|
||||
Modal modal = new Modal(true);
|
||||
try {
|
||||
|
||||
|
||||
cms.isContentModeratorEnabled(new Command() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
cms.loadItemsForStatus(ItemStatus.PENDING);
|
||||
} catch (Exception e) {
|
||||
Window.alert(e.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} catch (Exception e) {
|
||||
Window.alert(e.getMessage());
|
||||
return;
|
||||
}
|
||||
modal.add(cms.getPanel());
|
||||
modal.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
eventBus.addHandler(ShowRevertOperationWidgetEvent.TYPE, new ShowRevertOperationWidgetEventHandler() {
|
||||
@Override
|
||||
public void onShowRevertOperationWidgetEvent(
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import org.gcube.datacatalogue.utillibrary.shared.RolesCkanGroupOrOrg;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.BeanUserInOrgGroupRole;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.ManageProductResponse;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
|
@ -73,7 +74,7 @@ public interface GcubeCkanDataCatalogService extends RemoteService {
|
|||
* Check if the manage product needs to be shown (e.g., for GRSF products)
|
||||
* @return
|
||||
*/
|
||||
boolean isManageProductEnabled();
|
||||
ManageProductResponse isManageProductEnabled();
|
||||
|
||||
/**
|
||||
* Check if the view per VRE is enabled, so the management panels but publish/share link must be removed.
|
||||
|
|
|
@ -8,11 +8,13 @@ import java.util.List;
|
|||
import org.gcube.datacatalogue.utillibrary.shared.RolesCkanGroupOrOrg;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.BeanUserInOrgGroupRole;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.ManageProductResponse;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface GcubeCkanDataCatalogServiceAsync.
|
||||
*
|
||||
|
@ -67,12 +69,13 @@ public interface GcubeCkanDataCatalogServiceAsync {
|
|||
void getCkanGroupsNamesAndUrlsForUser(
|
||||
AsyncCallback<List<BeanUserInOrgGroupRole>> callback);
|
||||
|
||||
|
||||
/**
|
||||
* Check if the manage product needs to be shown (e.g., for GRSF products)
|
||||
* Checks if is manage product enabled.
|
||||
*
|
||||
* @param callback the callback
|
||||
*/
|
||||
void isManageProductEnabled(AsyncCallback<Boolean> callback);
|
||||
void isManageProductEnabled(AsyncCallback<ManageProductResponse> callback);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
/**
|
||||
* The Class ClickedCMSManageProductButtonEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jun 15, 2021
|
||||
*/
|
||||
public class ClickedCMSManageProductButtonEvent extends GwtEvent<ClickedCMSManageProductButtonEventHandler> {
|
||||
|
||||
public static Type<ClickedCMSManageProductButtonEventHandler> TYPE = new Type<ClickedCMSManageProductButtonEventHandler>();
|
||||
|
||||
/**
|
||||
* Instantiates a new clicked CMS manage product button event.
|
||||
*/
|
||||
public ClickedCMSManageProductButtonEvent() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
@Override
|
||||
public com.google.gwt.event.shared.GwtEvent.Type<ClickedCMSManageProductButtonEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(ClickedCMSManageProductButtonEventHandler handler) {
|
||||
handler.onClickedManageProduct(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
/**
|
||||
* The Interface ClickedCMSManageProductButtonEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jun 15, 2021
|
||||
*/
|
||||
public interface ClickedCMSManageProductButtonEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On clicked manage product.
|
||||
*
|
||||
* @param showManageProductWidgetEvent the show manage product widget event
|
||||
*/
|
||||
void onClickedManageProduct(ClickedCMSManageProductButtonEvent showManageProductWidgetEvent);
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
*/
|
||||
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view;
|
||||
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ClickedCMSManageProductButtonEvent;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEvent;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEvent;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.PublishOnZenodoEvent;
|
||||
|
@ -29,24 +30,26 @@ import com.google.gwt.event.shared.HandlerManager;
|
|||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.InlineHTML;
|
||||
|
||||
|
||||
/**
|
||||
* The Class CkanMetadataManagementPanel.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* @author Costantino Perciante costantino.perciante@isti.cnr.it
|
||||
* Jun 9, 2016
|
||||
* @author Costantino Perciante costantino.perciante@isti.cnr.it Jun 9, 2016
|
||||
*
|
||||
*/
|
||||
public class CkanMetadataManagementPanel extends FlowPanel{
|
||||
public class CkanMetadataManagementPanel extends FlowPanel {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final String MY_PREFIX = "My ";
|
||||
|
||||
private static final String MANAGE_ITEM_TOOLTIP = "By pushing on this button, you will be able to manage the item you are viewing."
|
||||
private static final String MANAGE_GRSF_ITEM_TOOLTIP = "By pushing on this button, you will be able to manage the item you are viewing."
|
||||
+ " Manageable items are the GRSF ones.";
|
||||
|
||||
private static final String MANAGE_CMS_ITEMS_TOOLTIP = "By pushing on this button, you will be able to manage (APPROVING or REJECTING) the item under approval"
|
||||
+ "Manageable items are not APPROVED and NOT PUBLISHED in the Catalogue.";
|
||||
|
||||
private AlertBlock nav = new AlertBlock();
|
||||
|
||||
// generic
|
||||
|
@ -71,7 +74,8 @@ 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 manageProduct = new Button("Manage Item");
|
||||
private Button manageGRSFProduct = new Button("Manage GRSF Item");
|
||||
private Button manageCMS = new Button("Manage Items");
|
||||
private HandlerManager eventBus;
|
||||
|
||||
/**
|
||||
|
@ -79,7 +83,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
|||
*
|
||||
* @param eventBus the event bus
|
||||
*/
|
||||
public CkanMetadataManagementPanel(HandlerManager eventBus){
|
||||
public CkanMetadataManagementPanel(HandlerManager eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
// this.getElement().getStyle().setPaddingTop(H_OFFSET, Unit.PX);
|
||||
// this.getElement().getStyle().setPaddingBottom(H_OFFSET, Unit.PX);
|
||||
|
@ -101,8 +105,11 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
|||
uploadToZenodo.setType(ButtonType.LINK);
|
||||
insertMeta.setType(ButtonType.LINK);
|
||||
editMeta.setType(ButtonType.LINK);
|
||||
manageProduct.setType(ButtonType.PRIMARY);
|
||||
manageProduct.getElement().getStyle().setFloat(Float.RIGHT);
|
||||
manageGRSFProduct.setType(ButtonType.PRIMARY);
|
||||
manageGRSFProduct.getElement().getStyle().setFloat(Float.RIGHT);
|
||||
|
||||
manageCMS.setType(ButtonType.PRIMARY);
|
||||
manageCMS.getElement().getStyle().setFloat(Float.RIGHT);
|
||||
|
||||
// set icons
|
||||
home.setIcon(IconType.HOME);
|
||||
|
@ -118,19 +125,26 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
|||
insertMeta.setIcon(IconType.FILE);
|
||||
editMeta.setIcon(IconType.EDIT_SIGN);
|
||||
statistics.setIcon(IconType.BAR_CHART);
|
||||
manageProduct.setIcon(IconType.CHECK_SIGN);
|
||||
manageGRSFProduct.setIcon(IconType.CHECK_SIGN);
|
||||
manageCMS.setIcon(IconType.CHECK_SIGN);
|
||||
|
||||
// hide edit and insert
|
||||
shareLink.setEnabled(false);
|
||||
uploadToZenodo.setEnabled(false);
|
||||
editMeta.setVisible(false);
|
||||
insertMeta.setVisible(false);
|
||||
manageProduct.setVisible(false);
|
||||
manageProduct.setEnabled(false);
|
||||
manageGRSFProduct.setVisible(false);
|
||||
manageGRSFProduct.setEnabled(false);
|
||||
manageCMS.setVisible(false);
|
||||
manageCMS.setEnabled(false);
|
||||
|
||||
// manage item info
|
||||
manageProduct.setTitle(MANAGE_ITEM_TOOLTIP);
|
||||
manageProduct.getElement().getStyle().setFontWeight(FontWeight.BOLD);
|
||||
// manage GRSF item info
|
||||
manageGRSFProduct.setTitle(MANAGE_GRSF_ITEM_TOOLTIP);
|
||||
manageGRSFProduct.getElement().getStyle().setFontWeight(FontWeight.BOLD);
|
||||
|
||||
// manage CMS item info
|
||||
manageCMS.setTitle(MANAGE_CMS_ITEMS_TOOLTIP);
|
||||
manageCMS.getElement().getStyle().setFontWeight(FontWeight.BOLD);
|
||||
|
||||
// add to navigation bar
|
||||
nav.add(home);
|
||||
|
@ -152,7 +166,8 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
|||
nav.add(uploadToZenodo);
|
||||
nav.add(insertMeta);
|
||||
nav.add(editMeta);
|
||||
nav.add(manageProduct);
|
||||
nav.add(manageGRSFProduct);
|
||||
nav.add(manageCMS);
|
||||
nav.setClose(false);
|
||||
nav.setType(AlertType.INFO);
|
||||
nav.getElement().getStyle().setMarginBottom(0, Unit.PX);
|
||||
|
@ -254,7 +269,6 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
myGroups.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -275,12 +289,23 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
|||
}
|
||||
});
|
||||
|
||||
manageProduct.addClickHandler(new ClickHandler() {
|
||||
manageGRSFProduct.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
eventBus.fireEvent(new ShowManageProductWidgetEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
|
||||
eventBus.fireEvent(new ShowManageProductWidgetEvent(
|
||||
GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
manageCMS.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
eventBus.fireEvent(new ClickedCMSManageProductButtonEvent());
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -300,7 +325,8 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
|||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
eventBus.fireEvent(new PublishOnZenodoEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
|
||||
eventBus.fireEvent(
|
||||
new PublishOnZenodoEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -310,30 +336,31 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
|||
*
|
||||
* @return the current height
|
||||
*/
|
||||
public int getCurrentHeight(){
|
||||
public int getCurrentHeight() {
|
||||
return this.getOffsetHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
* Those buttons can be only visible when the logged user has role edit/admin/sysadmin.
|
||||
* Those buttons can be only visible when the logged user has role
|
||||
* edit/admin/sysadmin.
|
||||
*
|
||||
* @param show the show
|
||||
*/
|
||||
public void showInsertAndEditProductButtons(boolean show){
|
||||
public void showInsertAndEditProductButtons(boolean show) {
|
||||
|
||||
//editMeta.setVisible(show); TODO
|
||||
//separatorAdminButtons.setVisible(show);
|
||||
// editMeta.setVisible(show); TODO
|
||||
// separatorAdminButtons.setVisible(show);
|
||||
insertMeta.setVisible(show);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Button to manage the product.. for example in grsf case
|
||||
* Button to manage the GRSF product.. for example in grsf case
|
||||
*
|
||||
* @param value true or false
|
||||
*/
|
||||
public void showManageProductButton(boolean value){
|
||||
manageProduct.setVisible(value);
|
||||
public void showManageGRSFProductButton(boolean value) {
|
||||
manageGRSFProduct.setVisible(value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -341,8 +368,26 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
|||
*
|
||||
* @param value the value
|
||||
*/
|
||||
public void enableManageProductButton(boolean value){
|
||||
manageProduct.setEnabled(value);
|
||||
public void enableManageGRSFProductButton(boolean value) {
|
||||
manageGRSFProduct.setEnabled(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Button to manage the CMS products..
|
||||
*
|
||||
* @param value true or false
|
||||
*/
|
||||
public void showManageCMSProductsButton(boolean value) {
|
||||
manageCMS.setVisible(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable manage CMS products button.
|
||||
*
|
||||
* @param value the value
|
||||
*/
|
||||
public void enableManageCMSProductsButton(boolean value) {
|
||||
manageCMS.setEnabled(value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -350,7 +395,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
|||
*
|
||||
* @param value the value
|
||||
*/
|
||||
public void enableShareItemButton(boolean value){
|
||||
public void enableShareItemButton(boolean value) {
|
||||
shareLink.setEnabled(value);
|
||||
}
|
||||
|
||||
|
@ -359,15 +404,14 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
|||
*
|
||||
* @param value the value
|
||||
*/
|
||||
public void enablePublishOnZenodoButton(boolean value){
|
||||
public void enablePublishOnZenodoButton(boolean value) {
|
||||
uploadToZenodo.setEnabled(value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show only home/statistics buttons.
|
||||
*/
|
||||
public void doNotShowUserRelatedInfo(){
|
||||
public void doNotShowUserRelatedInfo() {
|
||||
|
||||
separatorMyInfo.setVisible(false);
|
||||
separatorAdminButtons.setVisible(false);
|
||||
|
@ -378,7 +422,8 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
|||
myDatasets.setVisible(false);
|
||||
myOrganizations.setVisible(false);
|
||||
myGroups.setVisible(false);
|
||||
manageProduct.setVisible(false);
|
||||
manageGRSFProduct.setVisible(false);
|
||||
manageCMS.setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -398,67 +443,65 @@ public class CkanMetadataManagementPanel extends FlowPanel{
|
|||
myOrganizations.setVisible(false);
|
||||
myGroups.setVisible(false);
|
||||
statistics.setVisible(false);
|
||||
manageProduct.setVisible(false);
|
||||
manageGRSFProduct.setVisible(false);
|
||||
manageCMS.setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Customize label according translate.
|
||||
*
|
||||
* @param labelName the label name
|
||||
* @param translateValue the translate value
|
||||
*/
|
||||
public void customizeLabelAccordingTranslate(String labelName, String translateValue){
|
||||
public void customizeLabelAccordingTranslate(String labelName, String translateValue) {
|
||||
|
||||
|
||||
if(labelName==null || labelName.isEmpty() || translateValue==null || translateValue.isEmpty())
|
||||
if (labelName == null || labelName.isEmpty() || translateValue == null || translateValue.isEmpty())
|
||||
return;
|
||||
|
||||
// GWT.log("labelName "+labelName);
|
||||
// GWT.log("translateValue "+translateValue);
|
||||
// GWT.log("organizations "+organizations.getText());
|
||||
|
||||
if(labelName.compareToIgnoreCase(organizations.getText().trim())==0){
|
||||
if (labelName.compareToIgnoreCase(organizations.getText().trim()) == 0) {
|
||||
organizations.setText(translateValue);
|
||||
//return;
|
||||
}else if(labelName.compareToIgnoreCase(groups.getText().trim())==0){
|
||||
// return;
|
||||
} else if (labelName.compareToIgnoreCase(groups.getText().trim()) == 0) {
|
||||
groups.setText(translateValue);
|
||||
//return;
|
||||
}else if(labelName.compareToIgnoreCase(items.getText().trim())==0){
|
||||
// return;
|
||||
} else if (labelName.compareToIgnoreCase(items.getText().trim()) == 0) {
|
||||
items.setText(translateValue);
|
||||
//return;
|
||||
}else if(labelName.compareToIgnoreCase(types.getText().trim())==0){
|
||||
// return;
|
||||
} else if (labelName.compareToIgnoreCase(types.getText().trim()) == 0) {
|
||||
types.setText(translateValue);
|
||||
//return;
|
||||
// return;
|
||||
}
|
||||
|
||||
String mylabelName = MY_PREFIX+labelName;
|
||||
String mylabelName = MY_PREFIX + labelName;
|
||||
// GWT.log("mylabelName "+mylabelName);
|
||||
// GWT.log("myDatasets.getText() "+myDatasets.getText());
|
||||
|
||||
if(mylabelName.compareToIgnoreCase(myDatasets.getText().trim())==0){
|
||||
myDatasets.setText(MY_PREFIX+translateValue);
|
||||
//return;
|
||||
}else if(mylabelName.compareToIgnoreCase(myOrganizations.getText().trim())==0){
|
||||
myOrganizations.setText(MY_PREFIX+translateValue);
|
||||
//return;
|
||||
}else if(mylabelName.compareToIgnoreCase(myGroups.getText().trim())==0){
|
||||
myGroups.setText(MY_PREFIX+translateValue);
|
||||
//return;
|
||||
if (mylabelName.compareToIgnoreCase(myDatasets.getText().trim()) == 0) {
|
||||
myDatasets.setText(MY_PREFIX + translateValue);
|
||||
// return;
|
||||
} else if (mylabelName.compareToIgnoreCase(myOrganizations.getText().trim()) == 0) {
|
||||
myOrganizations.setText(MY_PREFIX + translateValue);
|
||||
// return;
|
||||
} else if (mylabelName.compareToIgnoreCase(myGroups.getText().trim()) == 0) {
|
||||
myGroups.setText(MY_PREFIX + translateValue);
|
||||
// return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Capitalize.
|
||||
*
|
||||
* @param stringValue the translate value
|
||||
* @return the string
|
||||
*/
|
||||
public static String capitalize(String stringValue){
|
||||
return stringValue.substring(0,1).toUpperCase()+stringValue.substring(1, stringValue.length());
|
||||
public static String capitalize(String stringValue) {
|
||||
return stringValue.substring(0, 1).toUpperCase() + stringValue.substring(1, stringValue.length());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowRevert
|
|||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.resource.CkanPortletResources;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.BeanUserInOrgGroupRole;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.ManageProductResponse;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||
|
@ -49,7 +50,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
private RootPanel rootPanel;
|
||||
private HandlerManager eventBus;
|
||||
private CkanConnectorAccessPoint ckanAccessPoint;
|
||||
private boolean isManageProductToShow = false;
|
||||
private ManageProductResponse manageProductResponse = null;
|
||||
private String viewPerVREPath = null;
|
||||
private static String latestSelectedProductIdentifier;
|
||||
public static final int IFRAME_FIX_HEIGHT = 1800;
|
||||
|
@ -58,18 +59,15 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
/**
|
||||
* Instantiates a new g cube ckan data catalog panel.
|
||||
*
|
||||
* @param rootPanel
|
||||
* the root panel
|
||||
* @param eventManager
|
||||
* the event manager
|
||||
* @param rootPanel the root panel
|
||||
* @param eventManager the event manager
|
||||
*/
|
||||
public GCubeCkanDataCatalogPanel(
|
||||
RootPanel rootPanel, HandlerManager eventManager) {
|
||||
public GCubeCkanDataCatalogPanel(RootPanel rootPanel, HandlerManager eventManager) {
|
||||
|
||||
this.rootPanel = rootPanel;
|
||||
this.eventBus = eventManager;
|
||||
|
||||
//postMessage(obj.toString(), ckanFramePanel.getFrame());
|
||||
// postMessage(obj.toString(), ckanFramePanel.getFrame());
|
||||
// send message about gateway url
|
||||
obj = new JSONObject();
|
||||
String landingPageVREs = Window.Location.getProtocol() + "//" + Window.Location.getHostName() + "/explore";
|
||||
|
@ -86,7 +84,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
// decode parameters (they could have been encoded)
|
||||
final Map<String, String> paramsMap = new HashMap<String, String>(2);
|
||||
String queryParameters = Window.Location.getQueryString();
|
||||
if(queryParameters != null && !queryParameters.isEmpty()){
|
||||
if (queryParameters != null && !queryParameters.isEmpty()) {
|
||||
String decoded = URL.decodeQueryString(queryParameters); // equals should be encoded too (%3D)
|
||||
String[] params = decoded.substring(decoded.indexOf("?") + 1).split("&");
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
|
@ -96,19 +94,18 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
GWT.log("Extracted parameters are " + paramsMap);
|
||||
}
|
||||
|
||||
String pathParameter = paramsMap.get(GCubeCkanDataCatalog.GET_PATH_PARAMETER); //Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER);
|
||||
String pathParameter = paramsMap.get(GCubeCkanDataCatalog.GET_PATH_PARAMETER); // Window.Location.getParameter(GCubeCkanDataCatalog.GET_PATH_PARAMETER);
|
||||
String queryParameter = paramsMap.get(GCubeCkanDataCatalog.GET_QUERY_PARAMETER);// Window.Location.getParameter(GCubeCkanDataCatalog.GET_QUERY_PARAMETER);
|
||||
|
||||
String browserLocationURL = getBrowserLocationURL();
|
||||
|
||||
GCubeCkanDataCatalog.service.getCKanConnector(browserLocationURL,
|
||||
pathParameter, queryParameter,
|
||||
GCubeCkanDataCatalog.service.getCKanConnector(browserLocationURL, pathParameter, queryParameter,
|
||||
new AsyncCallback<CkanConnectorAccessPoint>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(CkanConnectorAccessPoint ckan) {
|
||||
|
||||
if(ckan.isOutsideLoginOnPortal()){
|
||||
if (ckan.isOutsideLoginOnPortal()) {
|
||||
|
||||
// the portlet is outside the portal and no user is logged
|
||||
// in show only home and statistics
|
||||
|
@ -127,13 +124,15 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
String browserLocationURL = getBrowserLocationURL();
|
||||
|
||||
// check if view per organisation is enabled
|
||||
//and performing some actions in this case (e.g. removed the management buttons, etc.)
|
||||
GCubeCkanDataCatalog.service.isViewPerVREEnabled(browserLocationURL, new AsyncCallback<String>() {
|
||||
// and performing some actions in this case (e.g. removed the management
|
||||
// buttons, etc.)
|
||||
GCubeCkanDataCatalog.service.isViewPerVREEnabled(browserLocationURL,
|
||||
new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
GWT.log("isViewPerVREEnabled?: "+result);
|
||||
if(result != null && !result.isEmpty()){
|
||||
GWT.log("isViewPerVREEnabled?: " + result);
|
||||
if (result != null && !result.isEmpty()) {
|
||||
// hide all management buttons
|
||||
managementPanel.removeGenericManagementButtons();
|
||||
// set real relative path
|
||||
|
@ -151,8 +150,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
if(!ckan.isOutsideLoginOnPortal()){
|
||||
if (!ckan.isOutsideLoginOnPortal()) {
|
||||
|
||||
// MANAGE CKAN MANAGEMENT PANEL ACCORDING TO MY ROLE
|
||||
GCubeCkanDataCatalog.service.getMyRole(new AsyncCallback<RolesCkanGroupOrOrg>() {
|
||||
|
@ -183,7 +181,8 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
});
|
||||
|
||||
// retrieve organizations
|
||||
GCubeCkanDataCatalog.service.getCkanOrganizationsNamesAndUrlsForUser(new AsyncCallback<List<BeanUserInOrgGroupRole>>() {
|
||||
GCubeCkanDataCatalog.service.getCkanOrganizationsNamesAndUrlsForUser(
|
||||
new AsyncCallback<List<BeanUserInOrgGroupRole>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<BeanUserInOrgGroupRole> result) {
|
||||
|
@ -198,7 +197,8 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
});
|
||||
|
||||
// retrieve groups
|
||||
GCubeCkanDataCatalog.service.getCkanGroupsNamesAndUrlsForUser(new AsyncCallback<List<BeanUserInOrgGroupRole>>() {
|
||||
GCubeCkanDataCatalog.service.getCkanGroupsNamesAndUrlsForUser(
|
||||
new AsyncCallback<List<BeanUserInOrgGroupRole>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<BeanUserInOrgGroupRole> result) {
|
||||
|
@ -212,8 +212,8 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
});
|
||||
|
||||
// check if the url encodes a revert operation to be performed
|
||||
if(paramsMap.containsKey(GCubeCkanDataCatalog.REVERT_QUERY_PARAM) &&
|
||||
paramsMap.get(GCubeCkanDataCatalog.REVERT_QUERY_PARAM).equals("true")){
|
||||
if (paramsMap.containsKey(GCubeCkanDataCatalog.REVERT_QUERY_PARAM)
|
||||
&& paramsMap.get(GCubeCkanDataCatalog.REVERT_QUERY_PARAM).equals("true")) {
|
||||
|
||||
eventBus.fireEvent(new ShowRevertOperationWidgetEvent(Window.Location.getHref()));
|
||||
|
||||
|
@ -222,19 +222,27 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
/**
|
||||
* Just check if it is enabled.. then we need to listen for dom events coming
|
||||
*/
|
||||
GCubeCkanDataCatalog.service.isManageProductEnabled(new AsyncCallback<Boolean>() {
|
||||
GCubeCkanDataCatalog.service
|
||||
.isManageProductEnabled(new AsyncCallback<ManageProductResponse>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
isManageProductToShow = result;
|
||||
managementPanel.showManageProductButton(isManageProductToShow);
|
||||
public void onSuccess(ManageProductResponse result) {
|
||||
manageProductResponse = result;
|
||||
if (manageProductResponse != null) {
|
||||
|
||||
if(manageProductResponse.isGRSFManageEnabled()) {
|
||||
managementPanel.showManageCMSProductsButton(
|
||||
manageProductResponse.isManageEnabled());
|
||||
}else if(manageProductResponse.isManageEnabled()) {
|
||||
managementPanel.showManageCMSProductsButton(manageProductResponse.isManageEnabled());
|
||||
managementPanel.enableManageCMSProductsButton(manageProductResponse.isManageEnabled());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
isManageProductToShow = false;
|
||||
managementPanel.showManageProductButton(isManageProductToShow);
|
||||
managementPanel.showManageGRSFProductButton(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -250,14 +258,12 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
Window.addResizeHandler(new ResizeHandler() {
|
||||
|
||||
@Override
|
||||
public void onResize(ResizeEvent event) {
|
||||
|
||||
GWT.log("onWindowResized width: " + event.getWidth() +
|
||||
" height: " + event.getHeight());
|
||||
GWT.log("onWindowResized width: " + event.getWidth() + " height: " + event.getHeight());
|
||||
updateSize();
|
||||
}
|
||||
});
|
||||
|
@ -271,7 +277,6 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the browser location URL.
|
||||
*
|
||||
|
@ -283,15 +288,15 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
|
||||
try {
|
||||
browserLocationURL = Window.Location.getHref();
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
// silent
|
||||
}
|
||||
|
||||
GWT.log("Returning browserLocationURL: "+browserLocationURL);
|
||||
GWT.log("Returning browserLocationURL: " + browserLocationURL);
|
||||
return browserLocationURL;
|
||||
}
|
||||
|
||||
public static String getLatestSelectedProductIdentifier(){
|
||||
public static String getLatestSelectedProductIdentifier() {
|
||||
return latestSelectedProductIdentifier;
|
||||
}
|
||||
|
||||
|
@ -310,8 +315,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
/**
|
||||
* Sets the top panel visible.
|
||||
*
|
||||
* @param bool
|
||||
* the new top panel visible
|
||||
* @param bool the new top panel visible
|
||||
*/
|
||||
public void setTopPanelVisible(boolean bool) {
|
||||
|
||||
|
@ -322,8 +326,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
/**
|
||||
* show or hide edit/insert buttons according to the role.
|
||||
*
|
||||
* @param show
|
||||
* the show
|
||||
* @param show the show
|
||||
*/
|
||||
public void showEditInsertButtons(boolean show) {
|
||||
|
||||
|
@ -333,8 +336,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
/**
|
||||
* Instance ckan frame.
|
||||
*
|
||||
* @param ckanUrlConnector
|
||||
* the ckan url connector
|
||||
* @param ckanUrlConnector the ckan url connector
|
||||
* @return the frame
|
||||
*/
|
||||
public Frame instanceCkanFrame(String ckanUrlConnector) {
|
||||
|
@ -366,16 +368,15 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
* Update window size.
|
||||
*/
|
||||
public void updateSize() {
|
||||
/*RootPanel workspace = rootPanel;
|
||||
int topBorder = workspace.getAbsoluteTop();
|
||||
GWT.log("top: "+topBorder);
|
||||
int footer = 30; // 85 footer is bottombar + sponsor
|
||||
int rootHeight = Window.getClientHeight() - topBorder - 5 - footer;
|
||||
int height = rootHeight - getTopPanelHeight();
|
||||
if (ckanFramePanel.getFrame() != null) {
|
||||
int newH =managementPanel != null && managementPanel.getCurrentHeight() > 0 ? managementPanel.getOffsetHeight() + height : height;
|
||||
ckanFramePanel.getFrame().setHeight(2000+"px");
|
||||
}*/
|
||||
/*
|
||||
* RootPanel workspace = rootPanel; int topBorder = workspace.getAbsoluteTop();
|
||||
* GWT.log("top: "+topBorder); int footer = 30; // 85 footer is bottombar +
|
||||
* sponsor int rootHeight = Window.getClientHeight() - topBorder - 5 - footer;
|
||||
* int height = rootHeight - getTopPanelHeight(); if (ckanFramePanel.getFrame()
|
||||
* != null) { int newH =managementPanel != null &&
|
||||
* managementPanel.getCurrentHeight() > 0 ? managementPanel.getOffsetHeight() +
|
||||
* height : height; ckanFramePanel.getFrame().setHeight(2000+"px"); }
|
||||
*/
|
||||
|
||||
RootPanel workspace = this.rootPanel;
|
||||
int topBorder = workspace.getAbsoluteTop();
|
||||
|
@ -383,7 +384,9 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
int rootHeight = Window.getClientHeight() - topBorder - 5 - footer;
|
||||
int height = rootHeight - getTopPanelHeight();
|
||||
if (this.ckanFramePanel.getFrame() != null) {
|
||||
int newH = this.managementPanel != null &&this.managementPanel.getCurrentHeight() > 0? this.managementPanel.getOffsetHeight() + height : height;
|
||||
int newH = this.managementPanel != null && this.managementPanel.getCurrentHeight() > 0
|
||||
? this.managementPanel.getOffsetHeight() + height
|
||||
: height;
|
||||
this.ckanFramePanel.getFrame().setHeight(newH + "px");
|
||||
}
|
||||
// workspace.setHeight(height+"px");
|
||||
|
@ -391,6 +394,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
|
||||
/**
|
||||
* Print a message
|
||||
*
|
||||
* @param string
|
||||
*/
|
||||
protected native void printString(String string) /*-{
|
||||
|
@ -402,7 +406,10 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
*/
|
||||
private final native void listenForPostMessage() /*-{
|
||||
var that = this;
|
||||
$wnd.addEventListener("message", function(msg) {
|
||||
$wnd
|
||||
.addEventListener(
|
||||
"message",
|
||||
function(msg) {
|
||||
console.log("read message...");
|
||||
that.@org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view.GCubeCkanDataCatalogPanel::onPostMessage(Ljava/lang/String;Ljava/lang/String;)(msg.data, msg.origin);
|
||||
});
|
||||
|
@ -415,57 +422,59 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
* @param origin the origin
|
||||
*/
|
||||
private void onPostMessage(String data, String origin) {
|
||||
printString("Read data: "+data+", from origin: "+origin);
|
||||
printString("Ckan base url: "+ckanAccessPoint.getBaseUrl());
|
||||
printString("Read data: " + data + ", from origin: " + origin);
|
||||
printString("Ckan base url: " + ckanAccessPoint.getBaseUrl());
|
||||
|
||||
// parsing data.. it is a json bean of the type
|
||||
printString("Incoming message is " + data + " from " + origin);
|
||||
|
||||
if (ckanAccessPoint.getBaseUrl().indexOf(origin)>=0) {
|
||||
if (ckanAccessPoint.getBaseUrl().indexOf(origin) >= 0) {
|
||||
// The data has been sent from your site
|
||||
// The data sent with postMessage is stored in event.data
|
||||
String height = null;
|
||||
String productId = null;
|
||||
boolean isProductKeyMissing = false;
|
||||
|
||||
try{
|
||||
try {
|
||||
JSONValue parsedJSON = JSONParser.parseStrict(data);
|
||||
JSONObject object = parsedJSON.isObject();
|
||||
GWT.log("Object is " + object);
|
||||
if(object != null){
|
||||
//Supporting Task #12286: parsing the translate values for 'dataset', 'organization' and so on
|
||||
if(object.containsKey("translate")){
|
||||
if (object != null) {
|
||||
// Supporting Task #12286: parsing the translate values for 'dataset',
|
||||
// 'organization' and so on
|
||||
if (object.containsKey("translate")) {
|
||||
JSONObject theTranslate = (JSONObject) object.get("translate");
|
||||
GWT.log("theTranslate is " + object);
|
||||
for (String key : theTranslate.keySet()) {
|
||||
//GWT.log("theTranslate key " + key);
|
||||
// GWT.log("theTranslate key " + key);
|
||||
String value = theTranslate.get(key).isString().stringValue();
|
||||
printString("Customizing navigation link '" + key +"' with translate: "+value);
|
||||
managementPanel.customizeLabelAccordingTranslate(key,value);
|
||||
printString("Customizing navigation link '" + key + "' with translate: " + value);
|
||||
managementPanel.customizeLabelAccordingTranslate(key, value);
|
||||
}
|
||||
|
||||
}else if(object.containsKey("height")){
|
||||
} else if (object.containsKey("height")) {
|
||||
|
||||
height = object.get("height").isString().stringValue();
|
||||
if(object.containsKey("product"))
|
||||
if (object.containsKey("product"))
|
||||
productId = object.get("product").isString().stringValue();
|
||||
else
|
||||
isProductKeyMissing = true;
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
} catch (Exception e) {
|
||||
GWT.log("Exception is " + e);
|
||||
}
|
||||
|
||||
if(height != null)
|
||||
if (height != null)
|
||||
setIFrameHeight(height.toString());
|
||||
|
||||
// show or hide the manage product button
|
||||
if(!isProductKeyMissing){
|
||||
if (!isProductKeyMissing) {
|
||||
latestSelectedProductIdentifier = productId.toString();
|
||||
managementPanel.enableShareItemButton(productId != null && !productId.isEmpty());
|
||||
managementPanel.enablePublishOnZenodoButton(productId != null && !productId.isEmpty());
|
||||
managementPanel.enableManageProductButton(productId != null && !productId.isEmpty() && isManageProductToShow);
|
||||
managementPanel.enableManageGRSFProductButton(
|
||||
productId != null && !productId.isEmpty() && manageProductResponse.isGRSFManageEnabled());
|
||||
}
|
||||
} else {
|
||||
// The data hasn't been sent from your site!
|
||||
|
@ -475,30 +484,29 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the i frame height.
|
||||
*
|
||||
* @param height the new i frame height
|
||||
*/
|
||||
private void setIFrameHeight(String height){
|
||||
private void setIFrameHeight(String height) {
|
||||
String parsedHeight = null;
|
||||
if(height==null || height.isEmpty())
|
||||
if (height == null || height.isEmpty())
|
||||
return;
|
||||
|
||||
if(height.contains("px")){
|
||||
if (height.contains("px")) {
|
||||
parsedHeight = height;
|
||||
}else{
|
||||
try{
|
||||
} else {
|
||||
try {
|
||||
int intH = Integer.parseInt(height);
|
||||
parsedHeight = intH + " px";
|
||||
}catch(Exception e ){
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(parsedHeight!=null){
|
||||
GWT.log("Setting new height for ckan iFrame: "+height);
|
||||
if (parsedHeight != null) {
|
||||
GWT.log("Setting new height for ckan iFrame: " + height);
|
||||
this.ckanFramePanel.getFrame().setHeight(height);
|
||||
}
|
||||
}
|
||||
|
@ -515,9 +523,10 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
|
||||
/**
|
||||
* Return the catalogue url (e.g. http://ckan-d-d4s.d4science.org:443/)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getCatalogueUrl(){
|
||||
public String getCatalogueUrl() {
|
||||
|
||||
printString("Base url for iframe is " + ckanAccessPoint.getCatalogueBaseUrl());
|
||||
return ckanAccessPoint.getCatalogueBaseUrl();
|
||||
|
@ -565,11 +574,12 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
|||
|
||||
/**
|
||||
* Show management panel
|
||||
*
|
||||
* @param show
|
||||
*/
|
||||
public void showManagementPanel(boolean show){
|
||||
public void showManagementPanel(boolean show) {
|
||||
|
||||
managementPanel.showManageProductButton(show);
|
||||
managementPanel.showManageGRSFProductButton(show);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.gcube.common.authorization.library.provider.UserInfo;
|
|||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||
import org.gcube.datacatalogue.grsf_manage_widget.shared.ManageProductBean;
|
||||
import org.gcube.datacatalogue.utillibrary.server.DataCatalogue;
|
||||
import org.gcube.datacatalogue.utillibrary.server.DataCatalogueFactory;
|
||||
import org.gcube.datacatalogue.utillibrary.server.utils.CatalogueUtilMethods;
|
||||
|
@ -28,6 +29,7 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCat
|
|||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.server.thread.UpdateItemCatalogueResource;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.BeanUserInOrgGroupRole;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint;
|
||||
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.ManageProductResponse;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean;
|
||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||
import org.gcube.vomanagement.usermanagement.impl.LiferayGroupManager;
|
||||
|
@ -506,22 +508,24 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
* @see org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GcubeCkanDataCatalogService#isManageProductEnabled()
|
||||
*/
|
||||
@Override
|
||||
public boolean isManageProductEnabled() {
|
||||
public ManageProductResponse isManageProductEnabled() {
|
||||
logger.info("Checking if the manage product button needs to be shown or not for the current context");
|
||||
String scopePerCurrentUrl = SessionUtil.getScopeFromClientUrl(getThreadLocalRequest());
|
||||
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
|
||||
if(catalogue == null){
|
||||
logger.warn("There is no catalogue instance here..., returning false");
|
||||
return false;
|
||||
return new ManageProductResponse(false, scopePerCurrentUrl);
|
||||
}
|
||||
else{
|
||||
try{
|
||||
boolean toReturn = catalogue.isManageProductEnabled();
|
||||
logger.info("Will manage product be enabled for this user? " + Boolean.toString(toReturn));
|
||||
return toReturn;
|
||||
logger.info("isManageProductEnabled: "+toReturn);
|
||||
ManageProductResponse mpr = new ManageProductResponse(toReturn, scopePerCurrentUrl);
|
||||
logger.info("Will manage product be enabled for this user? " + mpr);
|
||||
return mpr;
|
||||
}catch(Exception e){
|
||||
logger.error("Unable to determine if the manage product needs to be shown or not", e);
|
||||
return false;
|
||||
return new ManageProductResponse(false, scopePerCurrentUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* The Class ManageProductResponse.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jun 15, 2021
|
||||
*/
|
||||
public class ManageProductResponse implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private boolean isManageEnabled;
|
||||
private String scope;
|
||||
|
||||
/**
|
||||
* Instantiates a new manage product response.
|
||||
*/
|
||||
public ManageProductResponse() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new manage product response.
|
||||
*
|
||||
* @param isManageEnabled the is manage enabled
|
||||
* @param scope the scope
|
||||
*/
|
||||
public ManageProductResponse(boolean isManageEnabled, String scope) {
|
||||
this.isManageEnabled = isManageEnabled;
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is manage enabled.
|
||||
*
|
||||
* @return true, if is manage enabled
|
||||
*/
|
||||
public boolean isManageEnabled() {
|
||||
return isManageEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scope.
|
||||
*
|
||||
* @return the scope
|
||||
*/
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the manage enabled.
|
||||
*
|
||||
* @param isManageEnabled the new manage enabled
|
||||
*/
|
||||
public void setManageEnabled(boolean isManageEnabled) {
|
||||
this.isManageEnabled = isManageEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the scope.
|
||||
*
|
||||
* @param scope the new scope
|
||||
*/
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
public boolean isGRSFScope() {
|
||||
if (this.scope != null) {
|
||||
if (this.scope.toLowerCase().contains("grsf")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isGRSFManageEnabled() {
|
||||
|
||||
if (isGRSFScope() && isManageEnabled)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("ManageProductResponse [isManageEnabled=");
|
||||
builder.append(isManageEnabled);
|
||||
builder.append(", scope=");
|
||||
builder.append(scope);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -22,16 +22,24 @@
|
|||
name='org.gcube.portlets_widgets.catalogue_sharing_widget.ShareCatalogue' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.ckandatapublisherwidget.CKanMetadataPublisher' />
|
||||
<inherits name='org.gcube.datacatalogue.grsf_manage_widget.GRSFManageWidget' />
|
||||
<inherits name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
<inherits
|
||||
name='org.gcube.datacatalogue.grsf_manage_widget.GRSFManageWidget' />
|
||||
<inherits
|
||||
name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<inherits name='org.gcube.portlets.widgets.switchbutton.SwitchButton' />
|
||||
<inherits name='org.gcube.portlets.widgets.ckan2zenodopublisher.CkanToZenodoPublisher' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.switchbutton.SwitchButton' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.ckan2zenodopublisher.CkanToZenodoPublisher' />
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.ckancontentmoderator.CkanContentModeratorWidget' />
|
||||
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point class='org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog' />
|
||||
<entry-point
|
||||
class='org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.GCubeCkanDataCatalog' />
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
|
|
|
@ -55,12 +55,23 @@
|
|||
<servlet-class>org.gcube.portlets_widgets.catalogue_sharing_widget.server.ShareServicesImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<!-- Servlets -->
|
||||
<!-- Servlets -->
|
||||
<servlet>
|
||||
<servlet-name>ckanToZenodoServlet</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.widgets.ckan2zenodopublisher.server.CkanToZenodoPublisherServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>greetServlet</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.widgets.ckancontentmoderator.server.CkanContentModeratorServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>greetServlet</servlet-name>
|
||||
<url-pattern>/gCubeCkanDataCatalog/greet</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>ckanToZenodoServlet</servlet-name>
|
||||
<url-pattern>/gCubeCkanDataCatalog/ckantozenodo</url-pattern>
|
||||
|
|
Loading…
Reference in New Issue