43 |
43 |
private Button conditionalApprove = new Button("Conditional Approve");
|
44 |
44 |
private Button reject = new Button("Reject");
|
45 |
45 |
|
|
46 |
private Button libraryFundPaid = new Button("Library Fund - Paid");
|
|
47 |
private Button publisherFundPaid = new Button("Publisher Fund - Paid");
|
|
48 |
|
46 |
49 |
private Button editRequest = new Button("Edit request");
|
47 |
50 |
private Button addDOI = new Button("Add DOI / repository");
|
48 |
51 |
|
... | ... | |
389 |
392 |
}
|
390 |
393 |
});
|
391 |
394 |
|
|
395 |
libraryFundPaid.addStyleName("requestInfoActionButton");
|
|
396 |
libraryFundPaid.setType(ButtonType.DEFAULT);
|
|
397 |
libraryFundPaid.addClickHandler(new ClickHandler() {
|
|
398 |
@Override
|
|
399 |
public void onClick(ClickEvent event) {
|
|
400 |
|
|
401 |
errorLabel.setVisible(false);
|
|
402 |
successLabel.setVisible(false);
|
|
403 |
|
|
404 |
ConfirmActionModal confirmActionModal = new ConfirmActionModal("Library Fund - Paid", null);
|
|
405 |
ConfirmActionModal.ActionConfirmedListener actionConfirmedListener = new ConfirmActionModal.ActionConfirmedListener() {
|
|
406 |
@Override
|
|
407 |
public void actionConfirmed(final String comment, final String templateId) {
|
|
408 |
|
|
409 |
final HTML loadingWheel = new HTML("<div class=\"loader-big\"></div><div class=\"whiteFilm\"></div>");
|
|
410 |
requestInfoPanel.addStyleName("loading");
|
|
411 |
requestInfoPanel.add(loadingWheel);
|
|
412 |
|
|
413 |
dataService.paidLibraryRequest(requestInfo.getId(), GoldOAPortal.currentUser.getId(), comment, templateId,
|
|
414 |
requestInfo.getFundingRequested(), 0, 0, new Date(), new AsyncCallback<Void>() {
|
|
415 |
|
|
416 |
@Override
|
|
417 |
public void onFailure(Throwable caught) {
|
|
418 |
|
|
419 |
requestInfoPanel.removeStyleName("loading");
|
|
420 |
requestInfoPanel.remove(loadingWheel);
|
|
421 |
|
|
422 |
errorLabel.setText("Error while marking the request as liberary fund - paid.");
|
|
423 |
errorLabel.setVisible(true);
|
|
424 |
if (actionListener != null) {
|
|
425 |
Comment newComment = new Comment(GoldOAPortal.currentUser, new Date(), comment, templateId);
|
|
426 |
actionListener.actionHappened(false, Request.RequestStatus.LIBRARY_FUND_PAID, newComment);
|
|
427 |
}
|
|
428 |
}
|
|
429 |
|
|
430 |
@Override
|
|
431 |
public void onSuccess(Void result) {
|
|
432 |
|
|
433 |
requestInfoPanel.removeStyleName("loading");
|
|
434 |
requestInfoPanel.remove(loadingWheel);
|
|
435 |
|
|
436 |
successLabel.setText("Request marked successfully as library fund - paid.");
|
|
437 |
successLabel.setVisible(true);
|
|
438 |
requestInfoPanel.remove(actionButtons);
|
|
439 |
if (actionListener != null) {
|
|
440 |
Comment newComment = new Comment(GoldOAPortal.currentUser, new Date(), comment, templateId);
|
|
441 |
actionListener.actionHappened(true, Request.RequestStatus.LIBRARY_FUND_PAID, newComment);
|
|
442 |
}
|
|
443 |
}
|
|
444 |
});
|
|
445 |
}
|
|
446 |
};
|
|
447 |
confirmActionModal.setActionConfirmedListener(actionConfirmedListener);
|
|
448 |
confirmActionModal.show();
|
|
449 |
}
|
|
450 |
});
|
|
451 |
|
|
452 |
publisherFundPaid.addStyleName("requestInfoActionButton");
|
|
453 |
publisherFundPaid.setType(ButtonType.DEFAULT);
|
|
454 |
publisherFundPaid.addClickHandler(new ClickHandler() {
|
|
455 |
@Override
|
|
456 |
public void onClick(ClickEvent event) {
|
|
457 |
|
|
458 |
errorLabel.setVisible(false);
|
|
459 |
successLabel.setVisible(false);
|
|
460 |
|
|
461 |
ConfirmActionModal confirmActionModal = new ConfirmActionModal("Publisher Fund - Paid", null);
|
|
462 |
ConfirmActionModal.ActionConfirmedListener actionConfirmedListener = new ConfirmActionModal.ActionConfirmedListener() {
|
|
463 |
@Override
|
|
464 |
public void actionConfirmed(final String comment, final String templateId) {
|
|
465 |
|
|
466 |
final HTML loadingWheel = new HTML("<div class=\"loader-big\"></div><div class=\"whiteFilm\"></div>");
|
|
467 |
requestInfoPanel.addStyleName("loading");
|
|
468 |
requestInfoPanel.add(loadingWheel);
|
|
469 |
|
|
470 |
dataService.paidPublisherRequest(requestInfo.getId(), GoldOAPortal.currentUser.getId(), comment, templateId,
|
|
471 |
requestInfo.getFundingRequested(), 0, 0, new Date(), new AsyncCallback<Void>() {
|
|
472 |
|
|
473 |
@Override
|
|
474 |
public void onFailure(Throwable caught) {
|
|
475 |
|
|
476 |
requestInfoPanel.removeStyleName("loading");
|
|
477 |
requestInfoPanel.remove(loadingWheel);
|
|
478 |
|
|
479 |
errorLabel.setText("Error while marking the request as publisher fund - paid.");
|
|
480 |
errorLabel.setVisible(true);
|
|
481 |
if (actionListener != null) {
|
|
482 |
Comment newComment = new Comment(GoldOAPortal.currentUser, new Date(), comment, templateId);
|
|
483 |
actionListener.actionHappened(false, Request.RequestStatus.PUBLISHER_FUND_PAID, newComment);
|
|
484 |
}
|
|
485 |
}
|
|
486 |
|
|
487 |
@Override
|
|
488 |
public void onSuccess(Void result) {
|
|
489 |
|
|
490 |
requestInfoPanel.removeStyleName("loading");
|
|
491 |
requestInfoPanel.remove(loadingWheel);
|
|
492 |
|
|
493 |
successLabel.setText("Request marked successfully as publisher fund - paid.");
|
|
494 |
successLabel.setVisible(true);
|
|
495 |
requestInfoPanel.remove(actionButtons);
|
|
496 |
if (actionListener != null) {
|
|
497 |
Comment newComment = new Comment(GoldOAPortal.currentUser, new Date(), comment, templateId);
|
|
498 |
actionListener.actionHappened(true, Request.RequestStatus.PUBLISHER_FUND_PAID, newComment);
|
|
499 |
}
|
|
500 |
}
|
|
501 |
});
|
|
502 |
}
|
|
503 |
};
|
|
504 |
confirmActionModal.setActionConfirmedListener(actionConfirmedListener);
|
|
505 |
confirmActionModal.show();
|
|
506 |
}
|
|
507 |
});
|
|
508 |
|
392 |
509 |
editRequest.addStyleName("float-right");
|
393 |
510 |
editRequest.setType(ButtonType.PRIMARY);
|
394 |
511 |
editRequest.addClickHandler(new ClickHandler() {
|
... | ... | |
450 |
567 |
}
|
451 |
568 |
|
452 |
569 |
if(!requestInfo.getStatus().equals(Request.RequestStatus.APPROVED) && !requestInfo.getStatus().equals(Request.RequestStatus.REJECTED)
|
453 |
|
&& !requestInfo.getStatus().equals(Request.RequestStatus.INCOMPLETE) && !requestInfo.getStatus().equals(Request.RequestStatus.ACCOUNTING_PAID)) {
|
|
570 |
&& !requestInfo.getStatus().equals(Request.RequestStatus.INCOMPLETE) && !requestInfo.getStatus().equals(Request.RequestStatus.ACCOUNTING_PAID)
|
|
571 |
&& !requestInfo.getStatus().equals(Request.RequestStatus.LIBRARY_FUND_SUBMITTED) && !requestInfo.getStatus().equals(Request.RequestStatus.LIBRARY_FUND_PAID)
|
|
572 |
&& !requestInfo.getStatus().equals(Request.RequestStatus.PUBLISHER_FUND_SUBMITTED) && !requestInfo.getStatus().equals(Request.RequestStatus.PUBLISHER_FUND_PAID)) {
|
454 |
573 |
actionButtons.add(approve);
|
455 |
574 |
actionButtons.add(conditionalApprove);
|
456 |
575 |
actionButtons.add(reject);
|
457 |
576 |
}
|
458 |
577 |
|
|
578 |
if(requestInfo.getStatus().equals(Request.RequestStatus.LIBRARY_FUND_SUBMITTED)) {
|
|
579 |
actionButtons.add(libraryFundPaid);
|
|
580 |
}
|
|
581 |
|
|
582 |
if(requestInfo.getStatus().equals(Request.RequestStatus.PUBLISHER_FUND_SUBMITTED)) {
|
|
583 |
actionButtons.add(publisherFundPaid);
|
|
584 |
}
|
|
585 |
|
459 |
586 |
actionButtons.add(addDOI);
|
460 |
587 |
actionButtons.add(editRequest);
|
461 |
588 |
requestInfoPanel.add(actionButtons);
|
Added functionality for the moderator to mark library and publisher fund submitted requests as paid