in progress on managing operations
This commit is contained in:
parent
ae9f61a4f2
commit
88a36476ad
|
@ -48,11 +48,11 @@ public interface CkanContentModeratorService extends RemoteService {
|
|||
/**
|
||||
* Reject item.
|
||||
*
|
||||
* @param itemName the item name
|
||||
* @param itemNames the item names
|
||||
* @param permanentlyDelete the permanently delete
|
||||
* @param reasonMsg the reason msg
|
||||
*/
|
||||
public void rejectItem(String itemName, boolean permanentlyDelete, String reasonMsg);
|
||||
public void rejectItem(List<String> itemNames, boolean permanentlyDelete, String reasonMsg);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,15 +26,7 @@ public interface CkanContentModeratorServiceAsync {
|
|||
void isContentModeratorEnabled(AsyncCallback<Boolean> callback);
|
||||
|
||||
|
||||
/**
|
||||
* Reject item.
|
||||
*
|
||||
* @param itemName the item name
|
||||
* @param permanentlyDelete the permanently delete
|
||||
* @param reasonMsg the reason msg
|
||||
* @param callback the callback
|
||||
*/
|
||||
void rejectItem(String itemName, boolean permanentlyDelete, String reasonMsg, AsyncCallback<Void> callback);
|
||||
void rejectItem(List<String> itemNames, boolean permanentlyDelete, String reasonMsg, AsyncCallback<Void> callback);
|
||||
|
||||
/**
|
||||
* Gets the list items for status.
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
|
||||
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class DoActionCMS extends Composite {
|
||||
|
||||
private static DoActionCMSUiBinder uiBinder = GWT.create(DoActionCMSUiBinder.class);
|
||||
|
||||
interface DoActionCMSUiBinder extends UiBinder<Widget, DoActionCMS> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
HTML htmlDisplayMessage;
|
||||
|
||||
@UiField
|
||||
CheckBox checkBoxPermDelete;
|
||||
|
||||
@UiField
|
||||
TextArea txtMsgReason;
|
||||
|
||||
@UiField
|
||||
Button buttonActionConfirmYES;
|
||||
|
||||
@UiField
|
||||
Button buttonActionConfirmNO;
|
||||
|
||||
@UiField
|
||||
AlertBlock alertBlockDoAction;
|
||||
|
||||
public DoActionCMS(ItemStatus fromStatus, ItemStatus toStatus, List<CatalogueDataset> listSelectItems) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
int count = listSelectItems.size();
|
||||
String msg = "Going to update status of";
|
||||
if (count > 0) {
|
||||
if (count == 1) {
|
||||
msg += " one item";
|
||||
} else {
|
||||
msg += " " + count + " items";
|
||||
}
|
||||
|
||||
msg += " from <b>" + fromStatus.getLabel() + "</b> to <b>" + toStatus.getLabel() + "</b>. Confirm?";
|
||||
} else
|
||||
return;
|
||||
|
||||
htmlDisplayMessage.setHTML(msg);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<b:AlertBlock ui:field="alertBlockDoAction">
|
||||
<g:HTML ui:field="htmlDisplayMessage"></g:HTML>
|
||||
<b:Form type="VERTICAL">
|
||||
<b:TextArea placeholder="Rejecting reason..."
|
||||
ui:field="txtMsgReason" />
|
||||
<b:CheckBox ui:field="checkBoxPermDelete">Permanently Delete</b:CheckBox>
|
||||
<b:Paragraph>
|
||||
<b:Button type="PRIMARY" ui:field="buttonActionConfirmYES">YES</b:Button>
|
||||
<b:Button ui:field="buttonActionConfirmNO">NO</b:Button>
|
||||
</b:Paragraph>
|
||||
</b:Form>
|
||||
</b:AlertBlock>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,225 @@
|
|||
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
|
||||
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||
import com.github.gwtbootstrap.client.ui.HelpBlock;
|
||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* The Class DoActionCMSView.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jun 29, 2021
|
||||
*/
|
||||
public class DoActionCMSView extends Composite {
|
||||
|
||||
private static DoActionCMSUiBinder uiBinder = GWT.create(DoActionCMSUiBinder.class);
|
||||
|
||||
/**
|
||||
* The Interface DoActionCMSUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jun 29, 2021
|
||||
*/
|
||||
interface DoActionCMSUiBinder extends UiBinder<Widget, DoActionCMSView> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
HTML htmlDisplayMessage;
|
||||
|
||||
@UiField
|
||||
CheckBox checkBoxPermDelete;
|
||||
|
||||
@UiField
|
||||
TextArea txtMsgReason;
|
||||
|
||||
@UiField
|
||||
Button buttonActionConfirmYES;
|
||||
|
||||
@UiField
|
||||
Button buttonActionConfirmNO;
|
||||
|
||||
@UiField
|
||||
AlertBlock alertBlockDoAction;
|
||||
|
||||
@UiField
|
||||
HelpBlock helpPermDelete;
|
||||
|
||||
|
||||
private List<CatalogueDataset> listSelectItems;
|
||||
|
||||
private ItemStatus fromStatus;
|
||||
|
||||
private ItemStatus toStatus;
|
||||
|
||||
/**
|
||||
* Instantiates a new do action CMS view.
|
||||
*
|
||||
* @param fromStatus the from status
|
||||
* @param toStatus the to status
|
||||
* @param listSelectItems the list select items
|
||||
*/
|
||||
public DoActionCMSView() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.alertBlockDoAction.setClose(true);
|
||||
this.alertBlockDoAction.setAnimation(true);
|
||||
this.checkBoxPermDelete.setVisible(false);
|
||||
this.txtMsgReason.setVisible(false);
|
||||
|
||||
checkBoxPermDelete.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
helpPermDelete.setVisible(false);
|
||||
if(event.getValue()) {
|
||||
helpPermDelete.setVisible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void updateStatus(ItemStatus fromStatus, ItemStatus toStatus, List<CatalogueDataset> listSelectItems) {
|
||||
this.fromStatus = fromStatus;
|
||||
this.toStatus = toStatus;
|
||||
this.listSelectItems = listSelectItems;
|
||||
int count = listSelectItems.size();
|
||||
String msg = "Going to update the status of";
|
||||
if (count > 0) {
|
||||
if (count == 1) {
|
||||
msg += " one item";
|
||||
} else {
|
||||
msg += " " + count + " items";
|
||||
}
|
||||
|
||||
msg += " from <b>" + fromStatus.getLabel() + "</b> to <b>" + toStatus.getLabel() + "</b>. Confirm?";
|
||||
} else
|
||||
return;
|
||||
|
||||
switch (toStatus) {
|
||||
case PENDING:
|
||||
checkBoxPermDelete.setVisible(false);
|
||||
txtMsgReason.setVisible(false);
|
||||
break;
|
||||
case APPROVED:
|
||||
checkBoxPermDelete.setVisible(false);
|
||||
txtMsgReason.setVisible(false);
|
||||
break;
|
||||
case REJECTED:
|
||||
checkBoxPermDelete.setVisible(true);
|
||||
txtMsgReason.setVisible(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
htmlDisplayMessage.setHTML(msg);
|
||||
}
|
||||
|
||||
public void permanentlyDelete(List<CatalogueDataset> listSelectItems) {
|
||||
this.listSelectItems = listSelectItems;
|
||||
int count = listSelectItems.size();
|
||||
String msg = "Going to delete permanently ";
|
||||
if (count > 0) {
|
||||
if (count == 1) {
|
||||
msg += " one item";
|
||||
} else {
|
||||
msg += " " + count + " items";
|
||||
}
|
||||
|
||||
msg += " from Catalogue. This operation cannot be undone. Would you like to proceed?";
|
||||
} else
|
||||
return;
|
||||
|
||||
htmlDisplayMessage.setHTML(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is permanently delete.
|
||||
*
|
||||
* @return true, if is permanently delete
|
||||
*/
|
||||
boolean isPermanentlyDelete() {
|
||||
return checkBoxPermDelete.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the txt reason msg.
|
||||
*
|
||||
* @return the txt reason msg
|
||||
*/
|
||||
String getTxtReasonMsg() {
|
||||
return txtMsgReason.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list select items.
|
||||
*
|
||||
* @return the list select items
|
||||
*/
|
||||
public List<CatalogueDataset> getListSelectItems() {
|
||||
return listSelectItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the from status.
|
||||
*
|
||||
* @return the from status
|
||||
*/
|
||||
public ItemStatus getFromStatus() {
|
||||
return fromStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the to status.
|
||||
*
|
||||
* @return the to status
|
||||
*/
|
||||
public ItemStatus getToStatus() {
|
||||
return toStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the button action confirm YES.
|
||||
*
|
||||
* @return the button action confirm YES
|
||||
*/
|
||||
public Button getButtonActionConfirmYES() {
|
||||
return buttonActionConfirmYES;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the button action confirm NO.
|
||||
*
|
||||
* @return the button action confirm NO
|
||||
*/
|
||||
public Button getButtonActionConfirmNO() {
|
||||
return buttonActionConfirmNO;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the alert block do action.
|
||||
*
|
||||
* @return the alert block do action
|
||||
*/
|
||||
public AlertBlock getAlertBlockDoAction() {
|
||||
return alertBlockDoAction;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.fontsize-16 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.margin-top-15 {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.margin-left-10 {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<b:AlertBlock ui:field="alertBlockDoAction">
|
||||
<g:HTML ui:field="htmlDisplayMessage"
|
||||
addStyleNames="{style.fontsize-16}"></g:HTML>
|
||||
<b:Form type="VERTICAL" addStyleNames="{style.margin-top-15}">
|
||||
<b:TextArea placeholder="Rejecting reason..."
|
||||
ui:field="txtMsgReason" />
|
||||
<b:CheckBox ui:field="checkBoxPermDelete"
|
||||
title="Permanently removes the selected item/s from Catalogue">Permanently Delete</b:CheckBox>
|
||||
<b:HelpBlock ui:field="helpPermDelete" visible="false">This operation cannot be undone. The selected items will be permantently deleted from Catalogue</b:HelpBlock>
|
||||
<b:Paragraph addStyleNames="{style.margin-top-15}">
|
||||
<b:Button type="PRIMARY" ui:field="buttonActionConfirmYES"
|
||||
addStyleNames="{style.margin-left-10}">YES</b:Button>
|
||||
<b:Button ui:field="buttonActionConfirmNO"
|
||||
addStyleNames="{style.margin-left-10}">NO</b:Button>
|
||||
</b:Paragraph>
|
||||
</b:Form>
|
||||
</b:AlertBlock>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -4,14 +4,21 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
|
||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorWidgetController;
|
||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.events.CheckBoxSelectIemsEvent;
|
||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.table.ItemsTable.DISPLAY_FIELD;
|
||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.util.UtilFunct;
|
||||
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||
import com.github.gwtbootstrap.client.ui.Dropdown;
|
||||
import com.github.gwtbootstrap.client.ui.Heading;
|
||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||
import com.github.gwtbootstrap.client.ui.base.AlertBase;
|
||||
import com.github.gwtbootstrap.client.ui.event.ClosedEvent;
|
||||
import com.github.gwtbootstrap.client.ui.event.ClosedHandler;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
|
@ -20,12 +27,13 @@ import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
|||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
|
||||
/**
|
||||
* The Class HomeView.
|
||||
*
|
||||
|
@ -54,6 +62,9 @@ public class HomeView extends Composite {
|
|||
@UiField
|
||||
HTMLPanel confirmPanel;
|
||||
|
||||
@UiField
|
||||
Button permanentlyDelete;
|
||||
|
||||
private ScrollPanel confirmPanelContainer = new ScrollPanel();
|
||||
|
||||
private List<NavLink> setStatusOptions = new ArrayList<NavLink>();
|
||||
|
@ -62,8 +73,6 @@ public class HomeView extends Composite {
|
|||
|
||||
private HandlerManager eventBus;
|
||||
|
||||
private List<CatalogueDataset> selectedItems;
|
||||
|
||||
/**
|
||||
* The Interface HomeViewUiBinder.
|
||||
*
|
||||
|
@ -92,25 +101,42 @@ public class HomeView extends Composite {
|
|||
cmsPanel.addToBottom(paginatedView.getPagerPanel());
|
||||
panelContainer.add(cmsPanel.getPanel());
|
||||
setVisibleUpdateStatusAction(false);
|
||||
fillSetStatusOptions();
|
||||
setVisiblePermanentlyDelete(false);
|
||||
|
||||
// Filling the Dropdown with status options
|
||||
for (ItemStatus iStatus : ItemStatus.values()) {
|
||||
NavLink nl = new NavLink(iStatus.getLabel());
|
||||
dropdownSetStatus.add(nl);
|
||||
setStatusOptions.add(nl);
|
||||
|
||||
}
|
||||
|
||||
setStatusOptions();
|
||||
bindEvents();
|
||||
confirmPanel.add(confirmPanelContainer);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill set status options.
|
||||
* Sets the status options according to item status selected
|
||||
*/
|
||||
private void fillSetStatusOptions() {
|
||||
for (ItemStatus status : ItemStatus.values()) {
|
||||
if (!status.equals(displayingItemStatus)) {
|
||||
NavLink nl = new NavLink(status.getLabel());
|
||||
dropdownSetStatus.add(nl);
|
||||
setStatusOptions.add(nl);
|
||||
private void setStatusOptions() {
|
||||
|
||||
// Fired when user clicks on CMS action
|
||||
for (final NavLink navLink : setStatusOptions) {
|
||||
navLink.setVisible(true);
|
||||
// Hiding the status selected/displayed from navigation link
|
||||
if (navLink.getText().trim().equals(displayingItemStatus.getLabel())) {
|
||||
navLink.setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the displaying with status.
|
||||
*
|
||||
* @param status the new displaying with status
|
||||
*/
|
||||
private void setDisplayingWithStatus(ItemStatus status) {
|
||||
this.displayingItemStatus = status;
|
||||
this.pageHeader.setSubtext(status.getLabel());
|
||||
|
@ -131,32 +157,31 @@ public class HomeView extends Composite {
|
|||
}
|
||||
});
|
||||
|
||||
// Fired when user clicks on CMS action
|
||||
for (final NavLink navLink : setStatusOptions) {
|
||||
navLink.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
// selectedItems = paginatedView.getSelectItems();
|
||||
// int count = selectedItems.size();
|
||||
// String msg = "Going to update status of";
|
||||
// if (count > 0) {
|
||||
// if (count == 1) {
|
||||
// msg += " one item";
|
||||
// } else {
|
||||
// msg += " " + count + " items";
|
||||
// }
|
||||
//
|
||||
// msg += " from <b>" + displayingItemStatus.getLabel() + "</b> to <b>" + navLink.getText()
|
||||
// + "</b>. Confirm?";
|
||||
// } else
|
||||
// return;
|
||||
if (paginatedView.getSelectItems().size() > 0) {
|
||||
showConfirm(navLink);
|
||||
showDoActionView(navLink);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
permanentlyDelete.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if (paginatedView.getSelectItems().size() > 0) {
|
||||
showDoActionViewDeletePermanently();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -177,6 +202,15 @@ public class HomeView extends Composite {
|
|||
dropdownSetStatus.setVisible(bool);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the visible permanently delete.
|
||||
*
|
||||
* @param bool the new visible permanently delete
|
||||
*/
|
||||
public void setVisiblePermanentlyDelete(boolean bool) {
|
||||
permanentlyDelete.setVisible(bool);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark items as checked.
|
||||
*
|
||||
|
@ -197,34 +231,24 @@ public class HomeView extends Composite {
|
|||
}
|
||||
|
||||
/**
|
||||
* Show confirm.
|
||||
* Show do action view.
|
||||
*
|
||||
* @param msg the msg
|
||||
* @param navLink the nav link
|
||||
*/
|
||||
public void showConfirm(NavLink navLink) {
|
||||
private void showDoActionView(NavLink navLink) {
|
||||
confirmPanelContainer.clear();
|
||||
GWT.log("showConfirm clicked link: " + navLink.getText());
|
||||
ItemStatus fromStatus = displayingItemStatus;
|
||||
ItemStatus toStatus = null;
|
||||
|
||||
for (ItemStatus theStatus : ItemStatus.values()) {
|
||||
if(theStatus.getLabel().compareTo(navLink.getText().trim())==0) {
|
||||
toStatus = theStatus;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStatus toStatus = UtilFunct.toStatusFromStatusLabel(navLink.getText().trim());
|
||||
GWT.log("Do action on from: " + fromStatus + " to: " + toStatus);
|
||||
if (toStatus == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
DoActionCMS doActionCMS = new DoActionCMS(fromStatus, toStatus, paginatedView.getSelectItems());
|
||||
|
||||
/*final AlertBlock newAlertBlock = new AlertBlock(AlertType.DEFAULT);
|
||||
newAlertBlock.setAnimation(true);
|
||||
newAlertBlock.setClose(true);
|
||||
DoActionCMSView doActionCMS = new DoActionCMSView();
|
||||
doActionCMS.updateStatus(fromStatus, toStatus, paginatedView.getSelectItems());
|
||||
|
||||
final AlertBlock newAlertBlock = doActionCMS.getAlertBlockDoAction();
|
||||
newAlertBlock.addClosedHandler(new ClosedHandler<AlertBase>() {
|
||||
|
||||
@Override
|
||||
|
@ -233,29 +257,67 @@ public class HomeView extends Composite {
|
|||
}
|
||||
});
|
||||
|
||||
Button buttActionConfirmYes = new Button(new ClickHandler() {
|
||||
Button buttActionConfirmYes = doActionCMS.getButtonActionConfirmYES();
|
||||
buttActionConfirmYes.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
confirmPanelContainer.clear();
|
||||
|
||||
}
|
||||
});
|
||||
buttActionConfirmYes.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
buttActionConfirmYes.setText("YES");
|
||||
newAlertBlock.add(buttActionConfirmYes);
|
||||
|
||||
Button buttonActionConfirmNo = new Button(new ClickHandler() {
|
||||
Button buttonActionConfirmNo = doActionCMS.getButtonActionConfirmNO();
|
||||
buttonActionConfirmNo.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
confirmPanelContainer.clear();
|
||||
|
||||
}
|
||||
});
|
||||
buttonActionConfirmNo.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
buttonActionConfirmNo.setText("NO");
|
||||
newAlertBlock.add(buttonActionConfirmNo);
|
||||
|
||||
newAlertBlock.setHTML(msg);*/
|
||||
confirmPanelContainer.add(doActionCMS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show do action delete permanently.
|
||||
*/
|
||||
private void showDoActionViewDeletePermanently() {
|
||||
confirmPanelContainer.clear();
|
||||
GWT.log("showDoActionDeletePermanently...");
|
||||
|
||||
DoActionCMSView doActionCMS = new DoActionCMSView();
|
||||
doActionCMS.permanentlyDelete(paginatedView.getSelectItems());
|
||||
|
||||
final AlertBlock newAlertBlock = doActionCMS.getAlertBlockDoAction();
|
||||
newAlertBlock.addClosedHandler(new ClosedHandler<AlertBase>() {
|
||||
|
||||
@Override
|
||||
public void onClosed(ClosedEvent<AlertBase> event) {
|
||||
confirmPanelContainer.clear();
|
||||
}
|
||||
});
|
||||
|
||||
Button buttActionConfirmYes = doActionCMS.getButtonActionConfirmYES();
|
||||
buttActionConfirmYes.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
confirmPanelContainer.clear();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Button buttonActionConfirmNo = doActionCMS.getButtonActionConfirmNO();
|
||||
buttonActionConfirmNo.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
confirmPanelContainer.clear();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
confirmPanelContainer.add(doActionCMS);
|
||||
}
|
||||
|
@ -270,14 +332,87 @@ public class HomeView extends Composite {
|
|||
setDisplayingWithStatus(itemStatus);
|
||||
setCheckedCheckboxSelectAll(false);
|
||||
setVisibleUpdateStatusAction(false);
|
||||
try {
|
||||
setVisiblePermanentlyDelete(false);
|
||||
setStatusOptions();
|
||||
confirmPanelContainer.clear();
|
||||
} catch (Exception e) {
|
||||
GWT.log("error: " + e.getMessage() + " cause: " + e.getCause().toString());
|
||||
}
|
||||
if (itemStatus.equals(ItemStatus.REJECTED))
|
||||
setVisiblePermanentlyDelete(true);
|
||||
|
||||
paginatedView.loadItemsForStatus(itemStatus);
|
||||
|
||||
GWT.log("loadItemsWithStatus end");
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform CMS action.
|
||||
*
|
||||
* @param doActionCMSView the do action CMS view
|
||||
*/
|
||||
public void performCMSAction(DoActionCMSView doActionCMSView) {
|
||||
|
||||
ItemStatus toStatus = doActionCMSView.getToStatus();
|
||||
List<String> listDatasetNames = UtilFunct.toListDatasetNames(doActionCMSView.getListSelectItems());
|
||||
switch (toStatus) {
|
||||
case PENDING:
|
||||
|
||||
CkanContentModeratorWidgetController.contentModeratorService.setStatus(toStatus, listDatasetNames,
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case APPROVED:
|
||||
|
||||
CkanContentModeratorWidgetController.contentModeratorService.approveItem(listDatasetNames,
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
case REJECTED:
|
||||
|
||||
CkanContentModeratorWidgetController.contentModeratorService.rejectItem(listDatasetNames,
|
||||
doActionCMSView.isPermanentlyDelete(), doActionCMSView.getTxtReasonMsg(),
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,19 @@
|
|||
font-size: 16px !important;
|
||||
}
|
||||
|
||||
.button-style {
|
||||
margin-left: 20px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.font-size-14 {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.font-size-14 li {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.headinghome>small {
|
||||
font-size: 16px !important;
|
||||
}
|
||||
|
@ -29,11 +42,17 @@
|
|||
<b:Heading ui:field="pageHeader" size="4"
|
||||
addStyleNames="{style.headinghome}">Items with status: </b:Heading>
|
||||
<g:HorizontalPanel
|
||||
addStyleNames="{style.margin-left-5}">
|
||||
<b:CheckBox ui:field="cbSelectAll"></b:CheckBox>
|
||||
addStyleNames="{style.font-size-14}">
|
||||
<b:CheckBox ui:field="cbSelectAll"
|
||||
addStyleNames="{style.margin-left-5}"></b:CheckBox>
|
||||
<b:Nav>
|
||||
<b:Dropdown text="Update status as..."
|
||||
ui:field="dropdownSetStatus" addStyleNames="{style.margin-left-20}">
|
||||
</b:Dropdown>
|
||||
</b:Nav>
|
||||
<b:Button ui:field="permanentlyDelete"
|
||||
addStyleNames="{style.button-style}" type="LINK" visible="false">Permanently
|
||||
Delete</b:Button>
|
||||
</g:HorizontalPanel>
|
||||
<g:HTMLPanel ui:field="confirmPanel"></g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="panelContainer"></g:HTMLPanel>
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
package org.gcube.portlets.widgets.ckancontentmoderator.client.ui.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.datacatalogue.utillibrary.shared.ItemStatus;
|
||||
import org.gcube.portlets.widgets.ckancontentmoderator.shared.CatalogueDataset;
|
||||
|
||||
|
||||
/**
|
||||
* The Class UtilFunct.
|
||||
|
@ -14,7 +20,7 @@ public class UtilFunct {
|
|||
* Ellipsis.
|
||||
*
|
||||
* @param value the value
|
||||
* @param lenght the length
|
||||
* @param length the length
|
||||
* @param left the left
|
||||
* @return the string
|
||||
*/
|
||||
|
@ -31,4 +37,39 @@ public class UtilFunct {
|
|||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* To status from status label.
|
||||
*
|
||||
* @param label the label
|
||||
* @return the item status
|
||||
*/
|
||||
public static ItemStatus toStatusFromStatusLabel(String label) {
|
||||
|
||||
for (ItemStatus theStatus : ItemStatus.values()) {
|
||||
if (theStatus.getLabel().compareTo(label.trim()) == 0) {
|
||||
return theStatus;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To list dataset names.
|
||||
*
|
||||
* @param itemsSelected the items selected
|
||||
* @return the list
|
||||
*/
|
||||
public static List<String> toListDatasetNames(List<CatalogueDataset> itemsSelected) {
|
||||
|
||||
List<String> listDatasetNames = new ArrayList<String>(itemsSelected.size());
|
||||
for (CatalogueDataset catalogueDataset : itemsSelected) {
|
||||
listDatasetNames.add(catalogueDataset.getName());
|
||||
}
|
||||
|
||||
return listDatasetNames;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void rejectItem(String itemId, boolean permanentlyDelete, String reasonMsg) {
|
||||
public void rejectItem(List<String> itemNames, boolean permanentlyDelete, String reasonMsg) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue