diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs
index 6be4bd1..c6eba3f 100644
--- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs
+++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs
@@ -1,6 +1,5 @@
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.0.1
warSrcDir=src/main/webapp
warSrcDirIsOutput=false
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index 19dcf7d..7f0db17 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -1,37 +1,49 @@
-
+
-
-
+
+
+
+
-
+
+
-
+
+
-
+
+
-
+
+ uses
+
+
+
-
+
+
-
+
+
-
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fc3177c..da746a7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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-10-05
+
+#### Enhancements
+
+[#19988] Integrated with `checkEnvironment` to show or not the "Upload to Zenodo" facility
+
## [v2.0.1] - 2021-05-04
#### Enhancements
diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/CkanMetadataManagementPanel.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/CkanMetadataManagementPanel.java
index 6021b60..af9d6e9 100644
--- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/CkanMetadataManagementPanel.java
+++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/CkanMetadataManagementPanel.java
@@ -29,15 +29,13 @@ 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 {
/**
*
@@ -79,10 +77,10 @@ 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);
+ // this.getElement().getStyle().setPaddingTop(H_OFFSET, Unit.PX);
+ // this.getElement().getStyle().setPaddingBottom(H_OFFSET, Unit.PX);
// set link style buttons
home.setType(ButtonType.LINK);
@@ -254,7 +252,6 @@ public class CkanMetadataManagementPanel extends FlowPanel{
}
});
-
myGroups.addClickHandler(new ClickHandler() {
@Override
@@ -280,7 +277,8 @@ public class CkanMetadataManagementPanel extends FlowPanel{
@Override
public void onClick(ClickEvent event) {
- eventBus.fireEvent(new ShowManageProductWidgetEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
+ eventBus.fireEvent(new ShowManageProductWidgetEvent(
+ GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
}
});
@@ -294,13 +292,14 @@ public class CkanMetadataManagementPanel extends FlowPanel{
}
});
-
+
uploadToZenodo.addClickHandler(new ClickHandler() {
-
+
@Override
public void onClick(ClickEvent event) {
-
- eventBus.fireEvent(new PublishOnZenodoEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
+
+ eventBus.fireEvent(
+ new PublishOnZenodoEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
}
});
}
@@ -310,19 +309,20 @@ 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);
}
@@ -332,7 +332,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
*
* @param value true or false
*/
- public void showManageProductButton(boolean value){
+ public void showManageProductButton(boolean value) {
manageProduct.setVisible(value);
}
@@ -341,7 +341,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
*
* @param value the value
*/
- public void enableManageProductButton(boolean value){
+ public void enableManageProductButton(boolean value) {
manageProduct.setEnabled(value);
}
@@ -350,7 +350,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 +359,23 @@ public class CkanMetadataManagementPanel extends FlowPanel{
*
* @param value the value
*/
- public void enablePublishOnZenodoButton(boolean value){
+ public void enablePublishOnZenodoButton(boolean value) {
uploadToZenodo.setEnabled(value);
}
+ /**
+ * Visibility publish on zenodo button.
+ *
+ * @param value the value
+ */
+ public void visibilityPublishOnZenodoButton(boolean value) {
+ uploadToZenodo.setVisible(value);
+ }
/**
* Show only home/statistics buttons.
*/
- public void doNotShowUserRelatedInfo(){
+ public void doNotShowUserRelatedInfo() {
separatorMyInfo.setVisible(false);
separatorAdminButtons.setVisible(false);
@@ -402,63 +410,60 @@ public class CkanMetadataManagementPanel extends FlowPanel{
}
-
/**
* Customize label according translate.
*
- * @param labelName the label name
+ * @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());
}
}
diff --git a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java
index ea23787..96f05a5 100644
--- a/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java
+++ b/src/main/java/org/gcube/portlets/gcubeckan/gcubeckandatacatalog/client/view/GCubeCkanDataCatalogPanel.java
@@ -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.widgets.ckan2zenodopublisher.client.CkanToZenodoPublisherServiceAsync;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ResizeEvent;
@@ -268,6 +269,23 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
// listen for DOM messages
listenForPostMessage();
+
+
+ CkanToZenodoPublisherServiceAsync.Util.getInstance().checkZenodoEnvironment(new AsyncCallback() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ managementPanel.visibilityPublishOnZenodoButton(false);
+
+ }
+
+ @Override
+ public void onSuccess(Boolean result) {
+ GWT.log("checkZenodoEnvironment result: "+result);
+ managementPanel.visibilityPublishOnZenodoButton(result);
+
+ }
+ });
}