Project

General

Profile

« Previous | Next » 

Revision 43270

Added functionality for the moderator to mark library and publisher fund submitted requests as paid

View differences:

modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/server/DataServiceImpl.java
324 324
    }
325 325

  
326 326
    @Override
327
    public void paidLibraryRequest(String requestId, String personId, String comment, String template, float apc_paid, float transfer_cost, float other_cost, Date datePaid) {
328
        requestManager.paidLibraryRequest(requestId, personId, comment, template, apc_paid, transfer_cost, other_cost, datePaid);
329
    }
330

  
331
    @Override
332
    public void paidPublisherRequest(String requestId, String personId, String comment, String template, float apc_paid, float transfer_cost, float other_cost, Date datePaid) {
333
        requestManager.paidPublisherRequest(requestId, personId, comment, template, apc_paid, transfer_cost, other_cost, datePaid);
334
    }
335

  
336
    @Override
327 337
    public RequestInfo getRequestById(String requestId) {
328 338
        return requestManager.getById(requestId);
329 339
    }
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/monitor/MonitorFundingRequestsWidget.java
88 88
        statusOptions.add(new Vocabulary(Request.RequestStatus.CONDITIONALLY_APPROVED.name(), Request.RequestStatus.CONDITIONALLY_APPROVED.getValue()));
89 89
        statusOptions.add(new Vocabulary(Request.RequestStatus.APPROVED.name(), Request.RequestStatus.APPROVED.getValue()));
90 90
        statusOptions.add(new Vocabulary(Request.RequestStatus.REJECTED.name(), Request.RequestStatus.REJECTED.getValue()));
91
        statusOptions.add(new Vocabulary(Request.RequestStatus.LIBRARY_FUND_SUBMITTED.name(), Request.RequestStatus.LIBRARY_FUND_SUBMITTED.getValue()));
92
        statusOptions.add(new Vocabulary(Request.RequestStatus.PUBLISHER_FUND_SUBMITTED.name(), Request.RequestStatus.PUBLISHER_FUND_SUBMITTED.getValue()));
93
        statusOptions.add(new Vocabulary(Request.RequestStatus.LIBRARY_FUND_PAID.name(), Request.RequestStatus.LIBRARY_FUND_PAID.getValue()));
94
        statusOptions.add(new Vocabulary(Request.RequestStatus.PUBLISHER_FUND_PAID.name(), Request.RequestStatus.PUBLISHER_FUND_PAID.getValue()));
91 95
        statusOptions.add(new Vocabulary(Request.RequestStatus.ACCOUNTING_PROCESSING.name(), Request.RequestStatus.ACCOUNTING_PROCESSING.getValue()));
92 96
        statusOptions.add(new Vocabulary(Request.RequestStatus.ACCOUNTING_PAID.name(), Request.RequestStatus.ACCOUNTING_PAID.getValue()));
93 97
        statusOptions.add(new Vocabulary(Request.RequestStatus.ACCOUNTING_ON_HOLD.name(), Request.RequestStatus.ACCOUNTING_ON_HOLD.getValue()));
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/monitor/RequestInfoElement.java
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);
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/DataService.java
78 78

  
79 79
    public void deniedRequest(String requestId, String personId, String comment, String templateId);
80 80

  
81
    public void paidLibraryRequest(String requestId, String personId, String comment, String template, float apc_paid, float transfer_cost, float other_cost, Date datePaid);
82

  
83
    public void paidPublisherRequest(String requestId, String personId, String comment, String template, float apc_paid, float transfer_cost, float other_cost, Date datePaid);
84

  
81 85
    public RequestInfo getRequestById(String requestId);
82 86

  
83 87
    public void submitContactForm(Contact contact, String captchaChallenge, String captchaResponse) throws Exception;

Also available in: Unified diff