Added Updated Item button
This commit is contained in:
parent
f98ccd3bfc
commit
2257e3450e
|
@ -40,6 +40,7 @@ import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModerat
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.ContentModeratorWidgetConstants;
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.ContentModeratorWidgetConstants;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.shared.DISPLAY_FIELD;
|
import org.gcube.portlets.widgets.ckancontentmoderator.shared.DISPLAY_FIELD;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.CreateDatasetForm;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.CreateDatasetForm;
|
||||||
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.UpdateDatasetForm;
|
||||||
import org.gcube.portlets_widgets.catalogue_sharing_widget.client.ShareCatalogueWidget;
|
import org.gcube.portlets_widgets.catalogue_sharing_widget.client.ShareCatalogueWidget;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Modal;
|
import com.github.gwtbootstrap.client.ui.Modal;
|
||||||
|
@ -305,6 +306,48 @@ public class CkanEventHandlerManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
eventBus.addHandler(EditMetadataEvent.TYPE, new EditMetadataEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEditMetadata(EditMetadataEvent editMetadataEvent) {
|
||||||
|
GWT.log("onEditMetadata called");
|
||||||
|
|
||||||
|
if (editMetadataEvent.getItemID() != null) {
|
||||||
|
|
||||||
|
GWT.log("editMetadataEvent: " + editMetadataEvent);
|
||||||
|
final Modal modal = new ExtModal(true, true);
|
||||||
|
|
||||||
|
modal.setTitle(WIDGET_CREATE_TITLE);
|
||||||
|
modal.addStyleName("insert-metadata-modal-style");
|
||||||
|
modal.addStyleName("modal-top-custom");
|
||||||
|
((Element) modal.getElement().getChildNodes().getItem(1)).addClassName("modal-body-custom");
|
||||||
|
modal.add(new UpdateDatasetForm(eventBus, editMetadataEvent.getItemID()));
|
||||||
|
modal.setCloseVisible(true);
|
||||||
|
|
||||||
|
// // hide any popup gcubeCkanDataCatalogue opened
|
||||||
|
// modal.addHideHandler(new HideHandler() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onHide(HideEvent hideEvent) {
|
||||||
|
// GWT.log("HideEvent on modal fired");
|
||||||
|
// GWT.log(hideEvent.toDebugString());
|
||||||
|
// eventBus.fireEvent(new CloseCreationFormEvent());
|
||||||
|
//
|
||||||
|
// hideEvent.preventDefault();
|
||||||
|
// hideEvent.stopPropagation();
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
GWT.log("show");
|
||||||
|
modal.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,14 +11,22 @@ import com.google.gwt.event.shared.GwtEvent;
|
||||||
*/
|
*/
|
||||||
public class EditMetadataEvent extends GwtEvent<EditMetadataEventHandler> {
|
public class EditMetadataEvent extends GwtEvent<EditMetadataEventHandler> {
|
||||||
public static Type<EditMetadataEventHandler> TYPE = new Type<EditMetadataEventHandler>();
|
public static Type<EditMetadataEventHandler> TYPE = new Type<EditMetadataEventHandler>();
|
||||||
|
private String itemID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new insert metadata event.
|
* Instantiates a new edits the metadata event.
|
||||||
|
*
|
||||||
|
* @param itemID the item ID
|
||||||
*/
|
*/
|
||||||
public EditMetadataEvent() {
|
public EditMetadataEvent(String itemID) {
|
||||||
|
this.itemID = itemID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
*/
|
*/
|
||||||
|
@ -27,6 +35,11 @@ public class EditMetadataEvent extends GwtEvent<EditMetadataEventHandler> {
|
||||||
return TYPE;
|
return TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
||||||
*/
|
*/
|
||||||
|
@ -35,4 +48,8 @@ public class EditMetadataEvent extends GwtEvent<EditMetadataEventHandler> {
|
||||||
handler.onEditMetadata(this);
|
handler.onEditMetadata(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getItemID() {
|
||||||
|
return itemID;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import com.github.gwtbootstrap.client.ui.Label;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Float;
|
import com.google.gwt.dom.client.Style.Float;
|
||||||
import com.google.gwt.dom.client.Style.FontWeight;
|
import com.google.gwt.dom.client.Style.FontWeight;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
|
@ -78,7 +79,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
||||||
private Button shareLink = new Button("Share Link");
|
private Button shareLink = new Button("Share Link");
|
||||||
private Button uploadToZenodo = new Button("Upload to Zenodo");
|
private Button uploadToZenodo = new Button("Upload to Zenodo");
|
||||||
private Button insertMeta = new Button("Publish Item");
|
private Button insertMeta = new Button("Publish Item");
|
||||||
private Button editMeta = new Button("Edit Item");
|
private Button editMeta = new Button("Update Item");
|
||||||
private Button manageGRSFProduct = new Button("Manage GRSF Item"); // GRSF Manage
|
private Button manageGRSFProduct = new Button("Manage GRSF Item"); // GRSF Manage
|
||||||
private Button manageCModS = new Button("Manage Items"); // Moderation
|
private Button manageCModS = new Button("Manage Items"); // Moderation
|
||||||
|
|
||||||
|
@ -146,7 +147,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
||||||
// hide edit and insert
|
// hide edit and insert
|
||||||
shareLink.setEnabled(false);
|
shareLink.setEnabled(false);
|
||||||
uploadToZenodo.setEnabled(false);
|
uploadToZenodo.setEnabled(false);
|
||||||
editMeta.setVisible(false);
|
editMeta.setEnabled(false);
|
||||||
insertMeta.setVisible(false);
|
insertMeta.setVisible(false);
|
||||||
manageGRSFProduct.setVisible(false);
|
manageGRSFProduct.setVisible(false);
|
||||||
manageGRSFProduct.setEnabled(false);
|
manageGRSFProduct.setEnabled(false);
|
||||||
|
@ -261,8 +262,8 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
GWT.log("Edit Meta CLICK");
|
||||||
eventBus.fireEvent(new EditMetadataEvent());
|
eventBus.fireEvent(new EditMetadataEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -391,7 +392,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Button to manage the products under moderation via Content Moderation System
|
* Button to manage the products under moderation via Content Moderation System
|
||||||
* (CMS)
|
* (CMS).
|
||||||
*
|
*
|
||||||
* @param value true or false
|
* @param value true or false
|
||||||
*/
|
*/
|
||||||
|
@ -436,6 +437,15 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
||||||
uploadToZenodo.setEnabled(value);
|
uploadToZenodo.setEnabled(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable edit item button.
|
||||||
|
*
|
||||||
|
* @param value the value
|
||||||
|
*/
|
||||||
|
public void enableEditItemButton(boolean value) {
|
||||||
|
editMeta.setEnabled(value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visibility publish on zenodo button.
|
* Visibility publish on zenodo button.
|
||||||
*
|
*
|
||||||
|
@ -445,6 +455,16 @@ public class CkanMetadataManagementPanel extends FlowPanel {
|
||||||
uploadToZenodo.setVisible(value);
|
uploadToZenodo.setVisible(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visibility edit item button.
|
||||||
|
*
|
||||||
|
* @param value the value
|
||||||
|
*/
|
||||||
|
public void visibilityEditItemButton(boolean value) {
|
||||||
|
editMeta.setVisible(value);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show only home/statistics buttons.
|
* Show only home/statistics buttons.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -563,6 +563,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
|
||||||
if (!isProductKeyMissing) {
|
if (!isProductKeyMissing) {
|
||||||
latestSelectedProductIdentifier = productId.toString();
|
latestSelectedProductIdentifier = productId.toString();
|
||||||
managementPanel.enableShareItemButton(productId != null && !productId.isEmpty());
|
managementPanel.enableShareItemButton(productId != null && !productId.isEmpty());
|
||||||
|
managementPanel.enableEditItemButton(productId != null && !productId.isEmpty());
|
||||||
managementPanel.enablePublishOnZenodoButton(productId != null && !productId.isEmpty());
|
managementPanel.enablePublishOnZenodoButton(productId != null && !productId.isEmpty());
|
||||||
managementPanel.enableManageGRSFProductButton(
|
managementPanel.enableManageGRSFProductButton(
|
||||||
productId != null && !productId.isEmpty() && manageProductResponse.isManageEnabled());
|
productId != null && !productId.isEmpty() && manageProductResponse.isManageEnabled());
|
||||||
|
|
Loading…
Reference in New Issue