#19988 Integrated with `checkEnvironment` for Zenodo. Moved to

2.1.0-SNAPSHOT
This commit is contained in:
Francesco Mangiacrapa 2021-10-05 11:10:13 +02:00
parent 219a4c3b4e
commit cefe1f43d8
5 changed files with 101 additions and 61 deletions

View File

@ -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

View File

@ -1,37 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="gcube-ckan-datacatalog-2.0.0-SNAPSHOT">
<wb-module deploy-name="gcube-ckan-datacatalog-2.0.1">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="ckan2zenodo-publisher-widget-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan2zenodo-publisher-widget/ckan2zenodo-publisher-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<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>

View File

@ -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

View File

@ -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());
}
}

View File

@ -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<Boolean>() {
@Override
public void onFailure(Throwable caught) {
managementPanel.visibilityPublishOnZenodoButton(false);
}
@Override
public void onSuccess(Boolean result) {
GWT.log("checkZenodoEnvironment result: "+result);
managementPanel.visibilityPublishOnZenodoButton(result);
}
});
}