Project

General

Profile

« Previous | Next » 

Revision 35483

Added publiction step functionality

View differences:

modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/JournalInfoForm.java
1
package eu.dnetlib.client;
2

  
3
import com.github.gwtbootstrap.client.ui.Alert;
4
import com.github.gwtbootstrap.client.ui.Form;
5
import com.github.gwtbootstrap.client.ui.SubmitButton;
6
import com.github.gwtbootstrap.client.ui.TextBox;
7
import com.github.gwtbootstrap.client.ui.constants.AlertType;
8
import com.github.gwtbootstrap.client.ui.constants.AlternateSize;
9
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
10
import com.github.gwtbootstrap.client.ui.constants.FormType;
11
import com.google.gwt.core.client.GWT;
12
import com.google.gwt.event.dom.client.ClickEvent;
13
import com.google.gwt.event.dom.client.ClickHandler;
14
import com.google.gwt.user.client.ui.FlowPanel;
15
import com.google.gwt.user.client.ui.IsWidget;
16
import com.google.gwt.user.client.ui.Widget;
17
import eu.dnetlib.client.widgets.FormFieldSet;
18

  
19
/**
20
 * Created by stefania on 3/11/15.
21
 */
22
public class JournalInfoForm implements IsWidget {
23

  
24
    private FlowPanel journalInfoPanel = new FlowPanel();
25

  
26
    private Alert errorLabel = new Alert();
27
    private Alert informationLabel = new Alert();
28
    private Alert warningLabel = new Alert();
29

  
30
    private Form journalInfoForm = new Form();
31
    private TextBox title = new TextBox();
32
    private TextBox alternativeTitle = new TextBox();
33
    private TextBox url = new TextBox();
34
    private TextBox languages = new TextBox();
35
    private TextBox issn = new TextBox();
36
    private TextBox eissn = new TextBox();
37
    private TextBox country = new TextBox();
38
    private TextBox subjects = new TextBox();
39
    private TextBox licence = new TextBox();
40

  
41
    private DataServiceAsync dataService = GWT.create(DataService.class);
42

  
43
    public JournalInfoForm() {
44

  
45
        journalInfoPanel.addStyleName("journalInfoPanel");
46

  
47
        journalInfoPanel.add(informationLabel);
48
        journalInfoPanel.add(warningLabel);
49
        journalInfoPanel.add(errorLabel);
50

  
51
        informationLabel.addStyleName("alertLabel");
52
        informationLabel.setType(AlertType.SUCCESS);
53
        informationLabel.setHeading("Success! ");
54
        informationLabel.setVisible(false);
55
        informationLabel.setClose(false);
56

  
57
        warningLabel.addStyleName("alertLabel");
58
        warningLabel.setType(AlertType.WARNING);
59
        warningLabel.setHeading("Warning! ");
60
        warningLabel.setVisible(false);
61
        warningLabel.setClose(false);
62

  
63
        errorLabel.addStyleName("alertLabel");
64
        errorLabel.setType(AlertType.ERROR);
65
        errorLabel.setHeading("Error! ");
66
        errorLabel.setVisible(false);
67
        errorLabel.setClose(false);
68

  
69
        journalInfoForm.setType(FormType.HORIZONTAL);
70
        journalInfoForm.addStyleName("journalInfoForm");
71
        journalInfoPanel.add(journalInfoForm);
72

  
73
        title.setAlternateSize(AlternateSize.XXLARGE);
74

  
75
        alternativeTitle.setAlternateSize(AlternateSize.XXLARGE);
76

  
77
        url.setAlternateSize(AlternateSize.XXLARGE);
78

  
79
        languages.setAlternateSize(AlternateSize.XXLARGE);
80
        languages.setPlaceholder(" languages as a comma-separated list");
81

  
82
        issn.setAlternateSize(AlternateSize.XXLARGE);
83

  
84
        eissn.setAlternateSize(AlternateSize.XXLARGE);
85

  
86
        country.setAlternateSize(AlternateSize.XXLARGE);
87

  
88
        subjects.setAlternateSize(AlternateSize.XXLARGE);
89
        subjects.setPlaceholder(" subjects as a comma-separated list");
90

  
91
        licence.setAlternateSize(AlternateSize.XXLARGE);
92

  
93
        journalInfoForm.add(new FormFieldSet("Title (*)", title));
94
        journalInfoForm.add(new FormFieldSet("Alternative Title", alternativeTitle));
95
        journalInfoForm.add(new FormFieldSet("URL", url));
96
        journalInfoForm.add(new FormFieldSet("Languages", languages));
97
        journalInfoForm.add(new FormFieldSet("ISSN", issn));
98
        journalInfoForm.add(new FormFieldSet("EISSN", eissn));
99
        journalInfoForm.add(new FormFieldSet("Country (*)", country));
100
        journalInfoForm.add(new FormFieldSet("Subjects", subjects));
101
        journalInfoForm.add(new FormFieldSet("Licence", licence));
102

  
103
//        submit.setText("Submit");
104
//        submit.setType(ButtonType.PRIMARY);
105
//        journalInfoForm.add(new FormFieldSet(null, submit));
106
//
107
//        submit.addClickHandler(new ClickHandler() {
108
//            @Override
109
//            public void onClick(ClickEvent clickEvent) {
110
//
111
//                informationLabel.setVisible(false);
112
//                errorLabel.setVisible(false);
113
//                warningLabel.setVisible(false);
114
//
115
//            }
116
//        });
117
    }
118

  
119
    @Override
120
    public Widget asWidget() {
121
        return journalInfoPanel;
122
    }
123
}
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/PublicationInfoForm.java
1
package eu.dnetlib.client;
2

  
3
import com.github.gwtbootstrap.client.ui.*;
4
import com.github.gwtbootstrap.client.ui.constants.AlertType;
5
import com.github.gwtbootstrap.client.ui.constants.AlternateSize;
6
import com.github.gwtbootstrap.client.ui.constants.FormType;
7
import com.github.gwtbootstrap.datepicker.client.ui.DateBoxAppended;
8
import com.github.gwtbootstrap.datepicker.client.ui.base.HasStartView;
9
import com.github.gwtbootstrap.datetimepicker.client.ui.base.HasViewMode;
10
import com.google.gwt.core.client.GWT;
11
import com.google.gwt.event.logical.shared.ValueChangeEvent;
12
import com.google.gwt.event.logical.shared.ValueChangeHandler;
13
import com.google.gwt.i18n.client.DateTimeFormat;
14
import com.google.gwt.user.client.ui.FlowPanel;
15
import com.google.gwt.user.client.ui.IsWidget;
16
import com.google.gwt.user.client.ui.Widget;
17
import eu.dnetlib.client.widgets.FormFieldSet;
18
import eu.dnetlib.client.widgets.MultipleAuthorsWidget;
19
import eu.dnetlib.client.widgets.MultipleIdentifiersWidget;
20
import eu.dnetlib.goldoa.domain.Publication;
21

  
22
/**
23
 * Created by stefania on 3/9/15.
24
 */
25
public class PublicationInfoForm implements IsWidget {
26

  
27
    private FlowPanel publicationInfoPanel = new FlowPanel();
28

  
29
    private Alert errorLabel = new Alert();
30
    private Alert informationLabel = new Alert();
31
    private Alert warningLabel = new Alert();
32

  
33
    private Form publicationInfoForm = new Form();
34
    private TextBox titleTextBox = new TextBox();
35
//    private DateBoxAppended publicationDateTextBox = new DateBoxAppended();
36
    private TextBox languages = new TextBox();
37

  
38
    private RadioButton articleRadio = new RadioButton("publicationType", "Article", false);
39
    private RadioButton monographRadio = new RadioButton("publicationType", "Monograph", false);
40

  
41
    private TextBox subjects = new TextBox();
42

  
43
    private MultipleAuthorsWidget multipleAuthorsWidget = new MultipleAuthorsWidget();
44

  
45
    private MultipleIdentifiersWidget multipleIdentifiersWidget = new MultipleIdentifiersWidget();
46

  
47
    private PublicationTypeListener publicationTypeListener;
48
    private PublicationFormListener publicationFormListener;
49

  
50
    private DataServiceAsync dataService = GWT.create(DataService.class);
51

  
52
    private DateTimeFormat dtf = DateTimeFormat.getFormat("dd-MM-yyyy");
53

  
54
    public PublicationInfoForm() {
55

  
56
        publicationInfoPanel.addStyleName("publicationInfoPanel");
57

  
58
        publicationInfoPanel.add(informationLabel);
59
        publicationInfoPanel.add(warningLabel);
60
        publicationInfoPanel.add(errorLabel);
61

  
62
        informationLabel.addStyleName("alertLabel");
63
        informationLabel.setType(AlertType.SUCCESS);
64
        informationLabel.setHeading("Success! ");
65
        informationLabel.setVisible(false);
66
        informationLabel.setClose(false);
67

  
68
        warningLabel.addStyleName("alertLabel");
69
        warningLabel.setType(AlertType.WARNING);
70
        warningLabel.setHeading("Warning! ");
71
        warningLabel.setVisible(false);
72
        warningLabel.setClose(false);
73

  
74
        errorLabel.addStyleName("alertLabel");
75
        errorLabel.setType(AlertType.ERROR);
76
        errorLabel.setHeading("Error! ");
77
        errorLabel.setVisible(false);
78
        errorLabel.setClose(false);
79

  
80
        publicationInfoForm.setType(FormType.HORIZONTAL);
81
        publicationInfoForm.addStyleName("publicationInfoForm");
82
        publicationInfoPanel.add(publicationInfoForm);
83

  
84
        titleTextBox.setAlternateSize(AlternateSize.XXLARGE);
85

  
86
//        publicationDateTextBox.setAlternateSize(AlternateSize.XLARGE);
87
//        publicationDateTextBox.setStartView(HasStartView.ViewMode.YEAR);
88
//        publicationDateTextBox.setAutoClose(true);
89
//        publicationDateTextBox.setFormat("dd-MM-yyyy");
90

  
91
        articleRadio.setValue(true);
92
        articleRadio.addStyleName("inlineBlock");
93
        articleRadio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
94
            @Override
95
            public void onValueChange(ValueChangeEvent<Boolean> booleanValueChangeEvent) {
96
                if(articleRadio.getValue()) {
97
                    if(publicationTypeListener!=null)
98
                        publicationTypeListener.publicationTypeChanged("article");
99
                }
100
            }
101
        });
102
        monographRadio.addStyleName("inlineBlock");
103
        monographRadio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
104
            @Override
105
            public void onValueChange(ValueChangeEvent<Boolean> booleanValueChangeEvent) {
106
                if(monographRadio.getValue()) {
107
                    if(publicationTypeListener!=null)
108
                        publicationTypeListener.publicationTypeChanged("monograph");
109
                }
110
            }
111
        });
112

  
113
        languages.setAlternateSize(AlternateSize.XXLARGE);
114
        languages.setPlaceholder(" languages as a comma-separated list");
115

  
116
        subjects.setAlternateSize(AlternateSize.XXLARGE);
117
        subjects.setPlaceholder(" subjects as a comma-separated list");
118

  
119
        publicationInfoForm.add(new FormFieldSet("Title (*)", titleTextBox));
120
        publicationInfoForm.add(new FormFieldSet("Authors (*)", multipleAuthorsWidget.asWidget()));
121
//        publicationInfoForm.add(new FormFieldSet("Publication Date (*)", publicationDateTextBox));
122
        publicationInfoForm.add(new FormFieldSet("Type (*)", articleRadio, monographRadio));
123
        publicationInfoForm.add(new FormFieldSet("Languages (*)", languages));
124
        publicationInfoForm.add(new FormFieldSet("Subjects (*)", subjects));
125
        publicationInfoForm.add(new FormFieldSet("Identifiers", multipleIdentifiersWidget.asWidget()));
126

  
127
//        submit.setText("Submit");
128
//        submit.setType(ButtonType.PRIMARY);
129
//        publicationInfoForm.add(new FormFieldSet(null, submit));
130
//
131
//        submit.addClickHandler(new ClickHandler() {
132
//            @Override
133
//            public void onClick(ClickEvent clickEvent) {
134
//
135
//                informationLabel.setVisible(false);
136
//                errorLabel.setVisible(false);
137
//                warningLabel.setVisible(false);
138
//
139
//            }
140
//        });
141
    }
142

  
143
    @Override
144
    public Widget asWidget() {
145
        return publicationInfoPanel;
146
    }
147

  
148
    public interface PublicationTypeListener {
149
        public void publicationTypeChanged(String publicationType);
150
    }
151

  
152
    public void setPublicationTypeListener(PublicationTypeListener publicationTypeListener) {
153
        this.publicationTypeListener = publicationTypeListener;
154
    }
155

  
156
    public interface PublicationFormListener {
157
        public void publicationSaved(String researcherId);
158
    }
159

  
160
    public void setPublicationFormListener(PublicationFormListener publicationFormListener) {
161
        this.publicationFormListener = publicationFormListener;
162
    }
163

  
164
    public boolean isComplete() {
165

  
166
//        if(!titleTextBox.getValue().trim().equals("") && !multipleAuthorsWidget.getAuthors().isEmpty()
167
//                && publicationDateTextBox.getValue()!=null && !languages.getValue().trim().equals("")
168
//                && !subjects.getValue().trim().equals(""))
169
//            return true;
170

  
171
        return false;
172
    }
173

  
174
    public Publication getPublication() {
175

  
176
        Publication publication = new Publication();
177

  
178
        publication.setTitle(titleTextBox.getValue().trim());
179
        publication.setLanguages(languages.getValue().trim());
180
        publication.setSubjects(subjects.getValue().trim());
181

  
182

  
183
        return publication;
184
    }
185

  
186
    public void savePublicationInfo() {
187

  
188
    }
189
}
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/server/DataServiceImpl.java
3 3
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
4 4
import eu.dnetlib.client.DataService;
5 5
import eu.dnetlib.goldoa.domain.*;
6
import eu.dnetlib.goldoa.service.OrganizationManager;
7
import eu.dnetlib.goldoa.service.PersonManager;
8
import eu.dnetlib.goldoa.service.ProjectManager;
6
import eu.dnetlib.goldoa.service.*;
9 7
import eu.dnetlib.shared.InitLoad;
10 8
import org.springframework.context.ApplicationContext;
11 9
import org.springframework.web.context.support.WebApplicationContextUtils;
......
24 22
    private OrganizationManager organizationManager = null;
25 23
    private PersonManager personManager = null;
26 24
    private ProjectManager projectManager = null;
25
    private PublisherManager publisherManager = null;
26
    private JournalManager journalManager = null;
27
    private PublicationManager publicationManager = null;
28
    private RequestManager requestManager = null;
27 29

  
28 30
    public void init(ServletConfig config) throws ServletException {
29 31

  
......
35 37
        this.organizationManager = (OrganizationManager) context.getBean("organisationManager");
36 38
        this.personManager = (PersonManager) context.getBean("personManager");
37 39
        this.projectManager = (ProjectManager) context.getBean("projectManager");
40
        this.publisherManager = (PublisherManager) context.getBean("publisherManager");
41
        this.journalManager = (JournalManager) context.getBean("journalManager");
42
        this.publicationManager = (PublicationManager) context.getBean("publicationManager");
43
        this.requestManager = (RequestManager) context.getBean("requestManager");
38 44
    }
39 45

  
40 46
    @Override
......
121 127
    }
122 128

  
123 129
    @Override
124
    public void saveRequest(Request request) {
125
        //TODO saveRequest
130
    public Request saveRequest(Request request) {
131
        return requestManager.saveRequest(request);
126 132
    }
127 133

  
128 134
    @Override
129 135
    public Project getProject(String projectId) {
130 136
        return projectManager.getById(projectId);
131 137
    }
138

  
139
    @Override
140
    public Publication savePublication(Publication publication) {
141

  
142
        Publication savedPublication = null;
143

  
144
        if(publication.getType().equals(Publication.Type.ARTICLE)) {
145

  
146
            Journal journal = publication.getJournal();
147
            if (journal.getId()==null) {
148
                Journal savedJournal = journalManager.saveJournal(journal);
149
                publication.setJournal(savedJournal);
150
            }
151

  
152
            savedPublication = publicationManager.savePublication(publication);
153

  
154
        } else {
155

  
156
            Publisher publisher = publication.getPublisher();
157
            if(publisher.getId()==null) {
158
                Publisher savedPublisher = publisherManager.savePublisher(publisher);
159
                publication.setPublisher(savedPublisher);
160
            }
161

  
162
            savedPublication = publicationManager.savePublication(publication);
163
        }
164

  
165
        return savedPublication;
166
    }
167

  
168
    @Override
169
    public Journal getJournal(String journalId) {
170
        return journalManager.getJournal(journalId);
171
    }
132 172
}
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/ContentManager.java
1 1
package eu.dnetlib.client;
2 2

  
3
import com.google.gwt.user.client.Window;
3 4
import com.google.gwt.user.client.ui.IsWidget;
4 5
import com.google.gwt.user.client.ui.RootPanel;
5 6
import eu.dnetlib.client.user.UserLoginForm;
......
75 76
    public void updateContent(String token) {
76 77

  
77 78
        RootPanel.get("content").clear();
79
        Window.scrollTo(0, 0);
78 80
        if(widgetMap.get(token)!=null) {
79 81
            RootPanel.get("content").add(widgetMap.get(token));
80 82
        } else {
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/JournalInfoStep.java
1 1
package eu.dnetlib.client;
2 2

  
3
import com.github.gwtbootstrap.client.ui.Alert;
3 4
import com.github.gwtbootstrap.client.ui.CheckBox;
4 5
import com.github.gwtbootstrap.client.ui.Form;
6
import com.github.gwtbootstrap.client.ui.TextBox;
7
import com.github.gwtbootstrap.client.ui.constants.AlertType;
8
import com.github.gwtbootstrap.client.ui.constants.AlternateSize;
5 9
import com.github.gwtbootstrap.client.ui.constants.FormType;
10
import com.google.gwt.core.client.GWT;
6 11
import com.google.gwt.event.logical.shared.ValueChangeEvent;
7 12
import com.google.gwt.event.logical.shared.ValueChangeHandler;
13
import com.google.gwt.user.client.rpc.AsyncCallback;
8 14
import com.google.gwt.user.client.ui.FlowPanel;
9 15
import com.google.gwt.user.client.ui.IsWidget;
10 16
import com.google.gwt.user.client.ui.Widget;
11 17
import eu.dnetlib.client.widgets.AutoCompleteWidget;
12 18
import eu.dnetlib.client.widgets.FormFieldSet;
19
import eu.dnetlib.goldoa.domain.Journal;
20
import eu.dnetlib.goldoa.domain.Vocabulary;
13 21

  
14 22
/**
15 23
 * Created by stefania on 3/11/15.
......
18 26

  
19 27
    private FlowPanel journalInfoStepPanel = new FlowPanel();
20 28

  
29
    private Alert errorLabel = new Alert();
30

  
21 31
    private Form journalAutoCompleteForm = new Form();
22 32
    private AutoCompleteWidget journalAutoComplete = new AutoCompleteWidget("journal", "Search...");
23 33

  
24 34
    private CheckBox cannotFindJournal = new CheckBox();
25 35

  
26
    private JournalInfoForm journalInfoForm = new JournalInfoForm();
36
    // journal info form
37
    private FlowPanel journalInfoPanel = new FlowPanel();
27 38

  
39
    private Alert journalFormErrorLabel = new Alert();
40

  
41
    private Form journalInfoForm = new Form();
42
    private TextBox title = new TextBox();
43
    private TextBox alternativeTitle = new TextBox();
44
    private TextBox url = new TextBox();
45
    private TextBox languages = new TextBox();
46
    private TextBox issn = new TextBox();
47
    private TextBox eissn = new TextBox();
48
    private TextBox country = new TextBox();
49
    private TextBox subjects = new TextBox();
50
    private TextBox licence = new TextBox();
51

  
52
    private FlowPanel journalDisplayInfoPanel = new FlowPanel();
53

  
54
    private Vocabulary journal = null;
55

  
56
    private DataServiceAsync dataService = GWT.create(DataService.class);
57

  
28 58
    public JournalInfoStep() {
29 59

  
60
        errorLabel.addStyleName("alertLabel");
61
        errorLabel.addStyleName("width80");
62
        errorLabel.setType(AlertType.ERROR);
63
        errorLabel.setVisible(false);
64
        errorLabel.setClose(false);
65

  
30 66
        journalAutoCompleteForm.setType(FormType.HORIZONTAL);
31 67
        journalAutoCompleteForm.addStyleName("journalAutoCompleteForm");
68

  
69
        journalInfoStepPanel.add(errorLabel);
32 70
        journalInfoStepPanel.add(journalAutoCompleteForm);
33 71

  
34

  
35 72
        cannotFindJournal.setText("If you cannot find your journal, check to complete its information");
36 73
        cannotFindJournal.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
37 74
            @Override
38 75
            public void onValueChange(ValueChangeEvent<Boolean> booleanValueChangeEvent) {
39 76

  
40 77
                if (cannotFindJournal.getValue()) {
41
                    journalInfoStepPanel.add(journalInfoForm.asWidget());
78
                    journalInfoStepPanel.remove(journalDisplayInfoPanel);
79
                    journalInfoStepPanel.add(journalInfoPanel);
80
                    journalAutoComplete.setValue("");
42 81
                } else {
43
                    journalInfoStepPanel.remove(journalInfoForm.asWidget());
82
                    journalInfoStepPanel.remove(journalInfoPanel);
44 83
                }
45 84
            }
46 85
        });
47 86

  
87
        AutoCompleteWidget.AutoCompleteListener autoCompleteListener = new AutoCompleteWidget.AutoCompleteListener() {
88
            @Override
89
            public void valueSelected(Vocabulary vocabulary) {
90

  
91
                journal = vocabulary;
92
                cannotFindJournal.setValue(false);
93

  
94
                dataService.getJournal(vocabulary.getId(), new AsyncCallback<Journal>() {
95

  
96
                    @Override
97
                    public void onFailure(Throwable throwable) {
98
                        journalDisplayInfoPanel.clear();
99
                        JournalDisplayInfo journalDisplayInfo = new JournalDisplayInfo(null);
100
                        journalDisplayInfoPanel.add(journalDisplayInfo.asWidget());
101
                        journalInfoStepPanel.remove(journalInfoPanel);
102
                        journalInfoStepPanel.add(journalDisplayInfoPanel);
103
                    }
104

  
105
                    @Override
106
                    public void onSuccess(Journal journal) {
107
                        journalDisplayInfoPanel.clear();
108
                        JournalDisplayInfo journalDisplayInfo = new JournalDisplayInfo(journal);
109
                        journalDisplayInfoPanel.add(journalDisplayInfo.asWidget());
110
                        journalInfoStepPanel.remove(journalInfoPanel);
111
                        journalInfoStepPanel.add(journalDisplayInfoPanel);
112
                    }
113
                });
114
            }
115
        };
116
        journalAutoComplete.setAutoCompleteListener(autoCompleteListener);
117

  
48 118
        journalAutoCompleteForm.add(new FormFieldSet("Journal Title (*)", journalAutoComplete.asWidget(), cannotFindJournal));
119

  
120
        //journal info form
121
        journalInfoPanel.addStyleName("journalInfoPanel");
122

  
123
        journalFormErrorLabel.addStyleName("alertLabel");
124
        journalFormErrorLabel.setType(AlertType.ERROR);
125
        journalFormErrorLabel.setVisible(false);
126
        journalFormErrorLabel.setClose(false);
127

  
128
        journalInfoForm.setType(FormType.HORIZONTAL);
129
        journalInfoForm.addStyleName("journalInfoForm");
130
        journalInfoPanel.add(journalInfoForm);
131

  
132
        title.setAlternateSize(AlternateSize.XXLARGE);
133

  
134
        alternativeTitle.setAlternateSize(AlternateSize.XXLARGE);
135

  
136
        url.setAlternateSize(AlternateSize.XXLARGE);
137

  
138
        languages.setAlternateSize(AlternateSize.XXLARGE);
139
        languages.setPlaceholder(" languages as a comma-separated list");
140

  
141
        issn.setAlternateSize(AlternateSize.XXLARGE);
142

  
143
        eissn.setAlternateSize(AlternateSize.XXLARGE);
144

  
145
        country.setAlternateSize(AlternateSize.XXLARGE);
146

  
147
        subjects.setAlternateSize(AlternateSize.XXLARGE);
148
        subjects.setPlaceholder(" subjects as a comma-separated list");
149

  
150
        licence.setAlternateSize(AlternateSize.XXLARGE);
151

  
152
        journalInfoForm.add(journalFormErrorLabel);
153
        journalInfoForm.add(new FormFieldSet("Title (*)", title));
154
        journalInfoForm.add(new FormFieldSet("Alternative Title", alternativeTitle));
155
        journalInfoForm.add(new FormFieldSet("URL", url));
156
        journalInfoForm.add(new FormFieldSet("Languages", languages));
157
        journalInfoForm.add(new FormFieldSet("ISSN", issn));
158
        journalInfoForm.add(new FormFieldSet("EISSN", eissn));
159
        journalInfoForm.add(new FormFieldSet("Country (*)", country));
160
        journalInfoForm.add(new FormFieldSet("Subjects", subjects));
161
        journalInfoForm.add(new FormFieldSet("Licence", licence));
49 162
    }
50 163

  
51 164
    @Override
52 165
    public Widget asWidget() {
53 166
        return journalInfoStepPanel;
54 167
    }
168

  
169
    public boolean isComplete() {
170

  
171
        if(!title.getValue().trim().equals("") && !country.getValue().trim().equals(""))
172
            return true;
173

  
174
        return false;
175
    }
176

  
177
    public Journal getJournal() {
178

  
179
        journalFormErrorLabel.setVisible(false);
180
        errorLabel.setVisible(false);
181

  
182
        if(cannotFindJournal.getValue()) {
183
            if (isComplete()) {
184

  
185
                Journal journal = new Journal();
186
                journal.setTitle(title.getValue().trim());
187
                journal.setAlternativeTitle(alternativeTitle.getValue().trim());
188
                journal.setUrl(url.getValue().trim());
189
                journal.setLanguages(languages.getValue().trim());
190
                journal.setIssn(issn.getValue().trim());
191
                journal.setEissn(eissn.getValue().trim());
192
                journal.setCountry(country.getValue().trim());
193
                journal.setSubjects(subjects.getValue().trim());
194
                journal.setLicence(licence.getValue().trim());
195
                return journal;
196
            } else {
197
                journalFormErrorLabel.setText("All asterisk (*) fields are required.");
198
                journalFormErrorLabel.setVisible(true);
199
            }
200
        } else {
201
            if(journal!=null) {
202

  
203
                Journal journal = new Journal();
204
                journal.setId(this.journal.getId());
205
                return journal;
206
            } else {
207
                errorLabel.setText("You need to select a journal.");
208
                errorLabel.setVisible(true);
209
            }
210
        }
211

  
212
        return null;
213
    }
55 214
}
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/ResearcherStepWidget.java
101 101
    public void updateState(FundingWizardState fundingWizardState) {
102 102

  
103 103
        Request request = fundingWizardState.getRequest();
104
        request.setResearcher(researchersID);
104
        if(researchersID!=null)
105
            request.setResearcher(researchersID);
106
        else
107
            request.setResearcher(GoldOAPortal.currentUser.getEmail());
105 108
    }
106 109

  
107 110
    @Override
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/PublisherInfoStep.java
1 1
package eu.dnetlib.client;
2 2

  
3
import com.github.gwtbootstrap.client.ui.Alert;
3 4
import com.github.gwtbootstrap.client.ui.Form;
5
import com.github.gwtbootstrap.client.ui.constants.AlertType;
4 6
import com.github.gwtbootstrap.client.ui.constants.FormType;
5 7
import com.google.gwt.user.client.ui.FlowPanel;
6 8
import com.google.gwt.user.client.ui.IsWidget;
7 9
import com.google.gwt.user.client.ui.Widget;
8 10
import eu.dnetlib.client.widgets.AutoCompleteWidget;
9 11
import eu.dnetlib.client.widgets.FormFieldSet;
12
import eu.dnetlib.goldoa.domain.Publisher;
13
import eu.dnetlib.goldoa.domain.Vocabulary;
10 14

  
11 15
/**
12 16
 * Created by stefania on 3/11/15.
......
15 19

  
16 20
    private FlowPanel publisherInfoStepPanel = new FlowPanel();
17 21

  
22
    private Alert errorLabel = new Alert();
23

  
18 24
    private Form publisherAutoCompleteForm = new Form();
19 25
    private AutoCompleteWidget publisherAutoComplete = new AutoCompleteWidget("publisher", "Search or complete publisher's name...");
20 26

  
27
    private Vocabulary publisher = null;
28

  
21 29
    public PublisherInfoStep() {
22 30

  
31
        errorLabel.addStyleName("alertLabel");
32
        errorLabel.addStyleName("width80");
33
        errorLabel.setType(AlertType.ERROR);
34
        errorLabel.setVisible(false);
35
        errorLabel.setClose(false);
36

  
23 37
        publisherAutoCompleteForm.setType(FormType.HORIZONTAL);
24 38
        publisherAutoCompleteForm.addStyleName("publisherAutoCompleteForm");
39

  
40
        publisherInfoStepPanel.add(errorLabel);
25 41
        publisherInfoStepPanel.add(publisherAutoCompleteForm);
26 42

  
27 43
        publisherAutoCompleteForm.add(new FormFieldSet("Publisher name (*)", publisherAutoComplete.asWidget()));
......
31 47
    public Widget asWidget() {
32 48
        return publisherInfoStepPanel;
33 49
    }
50

  
51
    public Publisher getPublisher() {
52

  
53
        errorLabel.setVisible(false);
54

  
55
        if(!publisherAutoComplete.getValue().equals("")) {
56

  
57
            Publisher publisher = new Publisher();
58
            if(this.publisher!=null && this.publisher.getName().equals(publisherAutoComplete.getValue())) {
59
                publisher.setId(this.publisher.getId());
60
            } else {
61
                publisher.setName(publisherAutoComplete.getValue());
62
            }
63
            return publisher;
64
        } else {
65
            errorLabel.setText("You need to select a publisher or complete your publisher's name.");
66
            errorLabel.setVisible(true);
67
        }
68

  
69
        return null;
70
    }
34 71
}
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/PublicationStepWidget.java
1 1
package eu.dnetlib.client;
2 2

  
3
import com.github.gwtbootstrap.client.ui.Alert;
4
import com.github.gwtbootstrap.client.ui.constants.AlertType;
5
import com.google.gwt.core.client.GWT;
6
import com.google.gwt.user.client.rpc.AsyncCallback;
3 7
import com.google.gwt.user.client.ui.FlowPanel;
4 8
import com.google.gwt.user.client.ui.HTML;
5 9
import com.google.gwt.user.client.ui.Label;
6 10
import com.google.gwt.user.client.ui.Widget;
11
import eu.dnetlib.goldoa.domain.Journal;
12
import eu.dnetlib.goldoa.domain.Publication;
13
import eu.dnetlib.goldoa.domain.Publisher;
14
import eu.dnetlib.goldoa.domain.Request;
7 15
import eu.dnetlib.shared.FundingWizardState;
8 16

  
9 17
/**
......
13 21

  
14 22
    private FlowPanel publicationStepPanel = new FlowPanel();
15 23

  
24
    private Alert errorLabel = new Alert();
25

  
16 26
    private FlowPanel publicationPanel = new FlowPanel();
17 27
    private Label publicationInfoLabel = new Label();
18 28
    private PublicationInfoStep publicationInfoStep = new PublicationInfoStep();
......
26 36

  
27 37
    private FundingWizardStepCompleteListener fundingWizardStepCompleteListener;
28 38

  
39
    private DataServiceAsync dataService = GWT.create(DataService.class);
40

  
41
    private Publication savedPublication = null;
42

  
29 43
    public PublicationStepWidget(String title) {
30 44

  
31 45
        super(title);
32 46

  
47
        errorLabel.addStyleName("alertLabel");
48
        errorLabel.addStyleName("width80");
49
        errorLabel.setType(AlertType.ERROR);
50
        errorLabel.setVisible(false);
51
        errorLabel.setClose(false);
52

  
33 53
        publicationInfoLabel.addStyleName("stepWidgetLabel");
34 54
        publicationInfoLabel.setText("Publication Info");
35 55
        publicationPanel.add(publicationInfoLabel);
......
59 79
        journalPanel.add(journalInfoLabel);
60 80
        journalPanel.add(journalInfoStep);
61 81

  
82
        publicationStepPanel.add(errorLabel);
62 83
        publicationStepPanel.add(publicationPanel);
63 84
        publicationStepPanel.add(journalPanel);
64 85
    }
......
66 87
    @Override
67 88
    public void updateState(FundingWizardState fundingWizardState) {
68 89

  
90
        Request request = fundingWizardState.getRequest();
91
        if(savedPublication!=null) {
92
            request.setPublication(savedPublication.getId());
93
            if(savedPublication.getType().equals(Publication.Type.ARTICLE) && savedPublication.getJournal()!=null)
94
                request.setJournal(savedPublication.getJournal().getId());
95
            if(savedPublication.getType().equals(Publication.Type.MONOGRAPH) && savedPublication.getPublisher()!=null)
96
                request.setPublisher(savedPublication.getPublisher().getId());
97
        }
69 98
    }
70 99

  
71 100
    @Override
72 101
    public void save() {
73 102

  
103
        errorLabel.setVisible(false);
104

  
105
        if(publicationType.equals("article")) {
106

  
107
            Publication publication = publicationInfoStep.getPublication();
108
            Journal journal = journalInfoStep.getJournal();
109
            if(publication!=null && journal!=null) {
110
                publication.setJournal(journal);
111
                savePublication(publication);
112
            } else {
113
                errorLabel.setText("You need to complete both the publication and the journal info");
114
                errorLabel.setVisible(true);
115
            }
116

  
117
        } else {
118

  
119
            Publication publication = publicationInfoStep.getPublication();
120
            Publisher publisher = publisherInfoStep.getPublisher();
121
            if(publication!=null && publisher!=null) {
122
                publication.setPublisher(publisherInfoStep.getPublisher());
123
                savePublication(publication);
124
            } else {
125
                errorLabel.setText("You need to complete both the publication and the publisher info");
126
                errorLabel.setVisible(true);
127
            }
128
        }
74 129
    }
75 130

  
76 131
    @Override
......
82 137
    public Widget asWidget() {
83 138
        return publicationStepPanel;
84 139
    }
140

  
141
    private void savePublication(Publication publication) {
142

  
143
        dataService.savePublication(publication, new AsyncCallback<Publication>() {
144

  
145
            @Override
146
            public void onFailure(Throwable throwable) {
147
                if(publicationType.equals("article"))
148
                    errorLabel.setText("System error saving publication and journal info");
149
                else
150
                    errorLabel.setText("System error saving publication and publisher info");
151
                errorLabel.setVisible(true);
152
            }
153

  
154
            @Override
155
            public void onSuccess(Publication publication) {
156

  
157
                savedPublication = publication;
158

  
159
                if(fundingWizardStepCompleteListener!=null)
160
                    fundingWizardStepCompleteListener.setStepComplete(true);
161
            }
162
        });
163
    }
85 164
}
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/JournalDisplayInfo.java
1
package eu.dnetlib.client;
2

  
3
import com.github.gwtbootstrap.client.ui.Alert;
4
import com.github.gwtbootstrap.client.ui.constants.AlertType;
5
import com.google.gwt.user.client.ui.FlowPanel;
6
import com.google.gwt.user.client.ui.HTML;
7
import com.google.gwt.user.client.ui.IsWidget;
8
import com.google.gwt.user.client.ui.Widget;
9
import eu.dnetlib.goldoa.domain.Journal;
10

  
11
/**
12
 * Created by stefania on 3/18/15.
13
 */
14
public class JournalDisplayInfo implements IsWidget {
15

  
16
    private FlowPanel journalDisplayInfoPanel = new FlowPanel();
17

  
18
    private Alert errorLabel = new Alert();
19

  
20
    private HTML journalDisplayInfoElement = new HTML();
21
    private String contents;
22

  
23
    public JournalDisplayInfo(Journal journal) {
24

  
25
        if(journal==null) {
26

  
27
            errorLabel.setText("System error while retrieving journal information");
28
            errorLabel.addStyleName("alertLabel");
29
            errorLabel.setType(AlertType.ERROR);
30
            errorLabel.setHeading("Error! ");
31
            errorLabel.setClose(false);
32

  
33
            journalDisplayInfoPanel.add(errorLabel);
34

  
35
        } else {
36

  
37
            contents = "<div class=\"displayInfoElement\">";
38

  
39
            contents += "<div class=\"displayInfoElementTitle\">" + journal.getTitle() + "</div>";
40

  
41
            if (journal.getAlternativeTitle() != null)
42
                contents += "<dl class=\"dl-horizontal\"><dt>ALTERNATIVE TITLE</dt><dd>" + journal.getAlternativeTitle() + "</dd></dl>";
43

  
44
            if (journal.getUrl() != null)
45
                contents += "<dl class=\"dl-horizontal\"><dt>URL</dt><dd><a target=\"_blank\" href=\"" + journal.getUrl() + "\">" + journal.getUrl() + "</a></dd></dl>";
46

  
47
            if (journal.getPublisher() != null && journal.getPublisher().getName() !=null)
48
                contents += "<dl class=\"dl-horizontal\"><dt>PUBLISHER</dt><dd>" + journal.getPublisher().getName() + "</dd></dl>";
49

  
50
            if (journal.getLanguages() != null)
51
                contents += "<dl class=\"dl-horizontal\"><dt>LANGUAGES</dt><dd>" + journal.getLanguages() + "</dd></dl>";
52

  
53
            if (journal.getIssn() != null)
54
                contents += "<dl class=\"dl-horizontal\"><dt>ISSN</dt><dd>" + journal.getIssn() + "</dd></dl>";
55

  
56
            if (journal.getEissn() != null)
57
                contents += "<dl class=\"dl-horizontal\"><dt>EISSN</dt><dd>" + journal.getEissn() + "</dd></dl>";
58

  
59
            if (journal.getCountry() != null)
60
                contents += "<dl class=\"dl-horizontal\"><dt>COUNTRY</dt><dd>" + journal.getCountry() + "</dd></dl>";
61

  
62
            if (journal.getSubjects() != null)
63
                contents += "<dl class=\"dl-horizontal\"><dt>SUBJECTS</dt><dd>" + journal.getSubjects() + "</dd></dl>";
64

  
65
            if (journal.getLicence() != null)
66
                contents += "<dl class=\"dl-horizontal\"><dt>LICENCE</dt><dd>" + journal.getLicence() + "</dd></dl>";
67

  
68
            contents += "<dl class=\"dl-horizontal\"><dt>APC</dt><dd>" + journal.getApc() + "</dd></dl>";
69

  
70
            contents += "<dl class=\"dl-horizontal\"><dt>DISCOUNT</dt><dd>" + journal.getDiscount() + "</dd></dl>";
71

  
72
            contents += "</div>";
73
            journalDisplayInfoElement.setHTML(contents);
74

  
75
            journalDisplayInfoPanel.add(journalDisplayInfoElement);
76
        }
77
    }
78

  
79
    @Override
80
    public Widget asWidget() {
81
        return journalDisplayInfoPanel;
82
    }
83
}
84

  
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/FundingWizardWidget.java
1 1
package eu.dnetlib.client;
2 2

  
3
import com.github.gwtbootstrap.client.ui.Alert;
4
import com.github.gwtbootstrap.client.ui.constants.AlertType;
3 5
import com.google.gwt.core.client.GWT;
6
import com.google.gwt.user.client.Window;
4 7
import com.google.gwt.user.client.rpc.AsyncCallback;
5 8
import com.google.gwt.user.client.ui.FlowPanel;
6 9
import com.google.gwt.user.client.ui.IsWidget;
7 10
import com.google.gwt.user.client.ui.Widget;
11
import eu.dnetlib.goldoa.domain.Request;
8 12
import eu.dnetlib.shared.*;
9 13

  
10 14
import java.util.ArrayList;
......
17 21

  
18 22
    private FlowPanel fundingWizardPanel = new FlowPanel();
19 23

  
24
    private Alert errorLabel = new Alert();
25

  
20 26
    private FundingBreadcrumbWidget fundingBreadcrumbWidget;
21 27
    private FlowPanel fundingWizardStepPanel = new FlowPanel();
22 28
    private FundingNavigationWidget fundingNavigationWidget = new FundingNavigationWidget();
......
31 37

  
32 38
    public FundingWizardWidget(final List<FundingWizardStepWidget> wizardStepWidgets) {
33 39

  
40
        fundingWizardState.getRequest().setUser(GoldOAPortal.currentUser.getEmail());
41

  
42
        errorLabel.addStyleName("alertLabel");
43
        errorLabel.addStyleName("width80");
44
        errorLabel.setType(AlertType.ERROR);
45
        errorLabel.setVisible(false);
46
        errorLabel.setClose(false);
47

  
34 48
        this.wizardStepWidgets.addAll(wizardStepWidgets);
35 49
        List<String> wizardStepNames = new ArrayList<>();
36 50
        for(FundingWizardStepWidget fundingWizardStepWidget : wizardStepWidgets) {
......
43 57
        fundingWizardPanel.add(fundingWizardStepPanel);
44 58

  
45 59
        fundingWizardStepPanel.addStyleName("fundingWizardStepPanel");
60
        fundingWizardStepPanel.add(errorLabel);
46 61
        fundingWizardStepPanel.add(wizardStepWidgets.get(currentActiveStep).asWidget());
47 62
        fundingWizardPanel.add(fundingNavigationWidget.asWidget());
48 63

  
......
57 72
                            if(isComplete) {
58 73

  
59 74
                                wizardStepWidgets.get(currentActiveStep).updateState(fundingWizardState);
60
                                dataService.saveRequest(fundingWizardState.getRequest(), new AsyncCallback<Void>() {
75
                                dataService.saveRequest(fundingWizardState.getRequest(), new AsyncCallback<Request>() {
61 76

  
62 77
                                    @Override
63 78
                                    public void onFailure(Throwable throwable) {
64
                                        //TODO failed to save request. What do we do?
79
                                        errorLabel.setText("System error saving your request");
80
                                        errorLabel.setVisible(true);
65 81
                                    }
66 82

  
67 83
                                    @Override
68
                                    public void onSuccess(Void aVoid) {
84
                                    public void onSuccess(Request request) {
69 85

  
86
                                        fundingWizardState.setRequest(request);
87

  
70 88
                                        //TODO add the else part which will be the results
71 89
                                        if(newActiveStep<wizardStepWidgets.size())
72 90
                                            setActiveStep(newActiveStep);
......
86 104
            @Override
87 105
            public void nextClicked(int newActiveStep) {
88 106

  
107
                errorLabel.setVisible(false);
108

  
89 109
                FundingWizardWidget.this.newActiveStep = newActiveStep;
110
                Window.scrollTo(0, 0);
90 111
                wizardStepWidgets.get(currentActiveStep).save();
91 112
            }
92 113
        };
......
122 143
        fundingNavigationWidget.setActiveStep(stepNumber);
123 144

  
124 145
        fundingWizardStepPanel.clear();
146
        Window.scrollTo(0, 0);
147
        fundingWizardStepPanel.add(errorLabel);
125 148
        fundingWizardStepPanel.add(wizardStepWidgets.get(stepNumber).asWidget());
126 149
    }
127 150
}
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/PublicationInfoStep.java
1 1
package eu.dnetlib.client;
2 2

  
3
import com.github.gwtbootstrap.client.ui.Alert;
3 4
import com.github.gwtbootstrap.client.ui.CheckBox;
4 5
import com.github.gwtbootstrap.client.ui.Form;
5 6
import com.github.gwtbootstrap.client.ui.RadioButton;
6 7
import com.github.gwtbootstrap.client.ui.base.IconAnchor;
8
import com.github.gwtbootstrap.client.ui.constants.AlertType;
7 9
import com.github.gwtbootstrap.client.ui.constants.AlternateSize;
8 10
import com.github.gwtbootstrap.client.ui.constants.FormType;
9 11
import com.github.gwtbootstrap.client.ui.constants.IconType;
12
import com.github.gwtbootstrap.datepicker.client.ui.DateBox;
13
import com.github.gwtbootstrap.datepicker.client.ui.base.HasStartView;
10 14
import com.google.gwt.event.logical.shared.ValueChangeEvent;
11 15
import com.google.gwt.event.logical.shared.ValueChangeHandler;
12 16
import com.google.gwt.user.client.ui.FlowPanel;
......
14 18
import com.google.gwt.user.client.ui.Label;
15 19
import com.google.gwt.user.client.ui.Widget;
16 20
import eu.dnetlib.client.widgets.FormFieldSet;
21
import eu.dnetlib.client.widgets.MultipleAuthorsWidget;
22
import eu.dnetlib.client.widgets.MultipleIdentifiersWidget;
17 23
import eu.dnetlib.client.widgets.TextBox;
24
import eu.dnetlib.goldoa.domain.Publication;
18 25

  
19 26
/**
20 27
 * Created by stefania on 3/9/15.
......
26 33
    private Form publicationDOIForm = new Form();
27 34
    private TextBox doi = new TextBox();
28 35
    private IconAnchor resolveDOI = new IconAnchor();
29
    private CheckBox noDOI = new CheckBox();
36
    private Label comment = new Label();
37
//    private CheckBox noDOI = new CheckBox();
30 38

  
31
    private PublicationInfoForm publicationInfoForm = new PublicationInfoForm();
39
    //publication info form
40
    private FlowPanel publicationInfoPanel = new FlowPanel();
32 41

  
42
    private Alert errorLabel = new Alert();
43

  
44
    private Form publicationInfoForm = new Form();
45
    private TextBox titleTextBox = new TextBox();
46
    private DateBox publicationDateTextBox = new DateBox();
47
    private TextBox languages = new TextBox();
48

  
49
    private RadioButton articleRadio = new RadioButton("publicationType", "Article", false);
50
    private RadioButton monographRadio = new RadioButton("publicationType", "Monograph", false);
51

  
52
    private TextBox subjects = new TextBox();
53

  
54
    private MultipleAuthorsWidget multipleAuthorsWidget = new MultipleAuthorsWidget();
55

  
56
    private MultipleIdentifiersWidget multipleIdentifiersWidget = new MultipleIdentifiersWidget();
57

  
33 58
    private PublicationTypeListener publicationTypeListener;
34 59

  
35 60
    public PublicationInfoStep() {
......
37 62
        publicationDOIForm.setType(FormType.HORIZONTAL);
38 63
        publicationDOIForm.addStyleName("publicationDOIForm");
39 64
        publicationInfoStepPanel.add(publicationDOIForm);
65
        publicationInfoStepPanel.add(publicationInfoPanel);
40 66

  
41 67
        doi.setAlternateSize(AlternateSize.XXLARGE);
42 68
        doi.addStyleName("inlineBlock");
......
45 71
        resolveDOI.addStyleName("resolveIcon");
46 72
        resolveDOI.addStyleName("inlineBlock");
47 73

  
48
        noDOI.setText("If you do not have a DOI, check to complete your publication info");
49
        noDOI.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
74
        comment.setText("If you have a DOI, type it here and click resolve so that we can auto complete all the available information");
75
        comment.addStyleName("comment");
76

  
77
//        noDOI.setText("If you do not have a DOI, check to complete your publication info");
78
//        noDOI.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
79
//            @Override
80
//            public void onValueChange(ValueChangeEvent<Boolean> booleanValueChangeEvent) {
81
//
82
//                if(noDOI.getValue()) {
83
//                    publicationInfoStepPanel.add(publicationInfoPanel);
84
//                } else {
85
//                    publicationInfoStepPanel.remove(publicationInfoPanel);
86
//                }
87
//            }
88
//        });
89
//
90
//        publicationDOIForm.add(new FormFieldSet("DOI (*)", doi, resolveDOI, noDOI));
91
        publicationDOIForm.add(new FormFieldSet("DOI", doi, resolveDOI, comment));
92

  
93
        //publication info form
94
        publicationInfoPanel.addStyleName("publicationInfoPanel");
95

  
96
        errorLabel.addStyleName("alertLabel");
97
        errorLabel.setType(AlertType.ERROR);
98
        errorLabel.setVisible(false);
99
        errorLabel.setClose(false);
100

  
101
        publicationInfoForm.setType(FormType.HORIZONTAL);
102
        publicationInfoForm.addStyleName("publicationInfoForm");
103
        publicationInfoPanel.add(publicationInfoForm);
104

  
105
        titleTextBox.setAlternateSize(AlternateSize.XXLARGE);
106

  
107
        publicationDateTextBox.setAlternateSize(AlternateSize.XLARGE);
108
        publicationDateTextBox.setStartView(HasStartView.ViewMode.YEAR);
109
        publicationDateTextBox.setAutoClose(true);
110
        publicationDateTextBox.setFormat("dd-MM-yyyy");
111

  
112
        articleRadio.setValue(true);
113
        articleRadio.addStyleName("inlineBlock");
114
        articleRadio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
50 115
            @Override
51 116
            public void onValueChange(ValueChangeEvent<Boolean> booleanValueChangeEvent) {
52

  
53
                if(noDOI.getValue()) {
54
                    publicationInfoStepPanel.add(publicationInfoForm.asWidget());
55
                } else {
56
                    publicationInfoStepPanel.remove(publicationInfoForm.asWidget());
117
                if(articleRadio.getValue()) {
118
                    if(publicationTypeListener!=null)
119
                        publicationTypeListener.publicationTypeChanged("article");
57 120
                }
58 121
            }
59 122
        });
60

  
61
        PublicationInfoForm.PublicationTypeListener publicationTypeListener = new PublicationInfoForm.PublicationTypeListener() {
123
        monographRadio.addStyleName("inlineBlock");
124
        monographRadio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
62 125
            @Override
63
            public void publicationTypeChanged(String publicationType) {
64
                if(PublicationInfoStep.this.publicationTypeListener!=null)
65
                    PublicationInfoStep.this.publicationTypeListener.publicationTypeChanged(publicationType);
126
            public void onValueChange(ValueChangeEvent<Boolean> booleanValueChangeEvent) {
127
                if(monographRadio.getValue()) {
128
                    if(publicationTypeListener!=null)
129
                        publicationTypeListener.publicationTypeChanged("monograph");
130
                }
66 131
            }
67
        };
68
        publicationInfoForm.setPublicationTypeListener(publicationTypeListener);
132
        });
69 133

  
70
        publicationDOIForm.add(new FormFieldSet("DOI (*)", doi, resolveDOI, noDOI));
134
        languages.setAlternateSize(AlternateSize.XXLARGE);
135
        languages.setPlaceholder(" languages as a comma-separated list");
136

  
137
        subjects.setAlternateSize(AlternateSize.XXLARGE);
138
        subjects.setPlaceholder(" subjects as a comma-separated list");
139

  
140
        publicationInfoForm.add(errorLabel);
141
        publicationInfoForm.add(new FormFieldSet("Title (*)", titleTextBox));
142
        publicationInfoForm.add(new FormFieldSet("Authors (*)", multipleAuthorsWidget.asWidget()));
143
        publicationInfoForm.add(new FormFieldSet("Publication Date (*)", publicationDateTextBox));
144
        publicationInfoForm.add(new FormFieldSet("Type (*)", articleRadio, monographRadio));
145
        publicationInfoForm.add(new FormFieldSet("Languages (*)", languages));
146
        publicationInfoForm.add(new FormFieldSet("Subjects (*)", subjects));
147
        publicationInfoForm.add(new FormFieldSet("Identifiers", multipleIdentifiersWidget.asWidget()));
71 148
    }
72 149

  
73 150
    @Override
......
82 159
    public void setPublicationTypeListener(PublicationTypeListener publicationTypeListener) {
83 160
        this.publicationTypeListener = publicationTypeListener;
84 161
    }
162

  
163
    public boolean isComplete() {
164

  
165
        if(!titleTextBox.getValue().trim().equals("") && !multipleAuthorsWidget.getAuthors().isEmpty()
166
                && publicationDateTextBox.getValue()!=null && !languages.getValue().trim().equals("")
167
                && !subjects.getValue().trim().equals(""))
168
            return true;
169

  
170
        return false;
171
    }
172

  
173
    public Publication getPublication() {
174

  
175
        errorLabel.setVisible(false);
176

  
177
        if(isComplete()) {
178
            Publication publication = new Publication();
179

  
180
            if(!doi.getValue().trim().equals(""))
181
                publication.setDoi(doi.getValue().trim());
182
            publication.setTitle(titleTextBox.getValue().trim());
183
            publication.setAuthors(multipleAuthorsWidget.getAuthors());
184
            publication.setPublicationDate(publicationDateTextBox.getValue());
185

  
186
            if(articleRadio.getValue())
187
                publication.setType(Publication.Type.ARTICLE);
188
            else
189
                publication.setType(Publication.Type.MONOGRAPH);
190

  
191
            publication.setLanguages(languages.getValue().trim());
192
            publication.setSubjects(subjects.getValue().trim());
193
            publication.setIdentifiers(multipleIdentifiersWidget.getPublicationIdentifiers());
194

  
195
            return publication;
196
        } else {
197
            errorLabel.setText("All asterisk (*) fields are required.");
198
            errorLabel.setVisible(true);
199
        }
200

  
201
        return null;
202
    }
85 203
}
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/widgets/AuthorInfoWidget.java
84 84
        this.deleteAuthorListener = deleteAuthorListener;
85 85
    }
86 86

  
87
    public Person getAuthor() {
87
    public Affiliation getAuthor() {
88 88

  
89 89
        if(isComplete()) {
90 90

  
91
            Affiliation affiliation = new Affiliation();
92

  
91 93
            Person person = new Person();
92 94
            person.setName(firstNameTextBox.getValue().trim());
93 95
            person.setInitials(initialsTextBox.getValue().trim());
94 96
            person.setLastname(lastNameTextBox.getValue().trim());
95 97
            person.setEmail(emailTextBox.getValue().trim());
98
            affiliation.setPerson(person);
96 99

  
97
            List<Affiliation> affiliations = new ArrayList<>();
98
            affiliations.add(affiliationInfoWidget.getAffiliation());
100
            affiliation.setOrganization(affiliationInfoWidget.getAffiliation().getOrganization());
101
            if(affiliationInfoWidget.getAffiliation().getDepartment()!=null && !affiliationInfoWidget.getAffiliation().getDepartment().equals(""))
102
                affiliation.setDepartment(affiliationInfoWidget.getAffiliation().getDepartment());
99 103

  
100
            return person;
104
            return affiliation;
101 105
        }
102 106

  
103 107
        return null;
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/widgets/IdentifierInfoWidget.java
9 9
import com.google.gwt.user.client.ui.FlowPanel;
10 10
import com.google.gwt.user.client.ui.IsWidget;
11 11
import com.google.gwt.user.client.ui.Widget;
12
import eu.dnetlib.goldoa.domain.PublicationIdentifier;
12 13

  
13 14
/**
14 15
 * Created by stefania on 3/11/15.
......
67 68
    public void setDeleteIdentifierListener(DeleteIdentifierListener deleteIdentifierListener) {
68 69
        this.deleteIdentifierListener = deleteIdentifierListener;
69 70
    }
71

  
72
    public boolean isComplete() {
73

  
74
        if(!identifierTypes.getValue().equals("noneSelected") && !identifierValue.getValue().trim().equals(""))
75
            return true;
76

  
77
        return false;
78
    }
79

  
80
    public PublicationIdentifier getPublicationIdentifier() {
81

  
82
        if(isComplete()) {
83

  
84
            PublicationIdentifier publicationIdentifier = new PublicationIdentifier();
85
            publicationIdentifier.setType(identifierTypes.getValue());
86
            publicationIdentifier.setValue(identifierValue.getValue().trim());
87
            return publicationIdentifier;
88
        }
89

  
90
        return null;
91
    }
70 92
}
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/widgets/MultipleAuthorsWidget.java
7 7
import com.google.gwt.user.client.ui.FlowPanel;
8 8
import com.google.gwt.user.client.ui.IsWidget;
9 9
import com.google.gwt.user.client.ui.Widget;
10
import eu.dnetlib.goldoa.domain.Affiliation;
10 11
import eu.dnetlib.goldoa.domain.Person;
11 12

  
12 13
import java.util.ArrayList;
......
63 64
        return multipleAuthorsPanel;
64 65
    }
65 66

  
66
    public List<Person> getAuthors() {
67
    public List<Affiliation> getAuthors() {
67 68

  
68
        List<Person> authorsList = new ArrayList<>();
69
        List<Affiliation> authorsList = new ArrayList<>();
69 70

  
70 71
        for(AuthorInfoWidget authorInfoWidget : authorInfoWidgetList) {
71 72

  
......
76 77

  
77 78
        return authorsList;
78 79
    }
79

  
80 80
}
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/widgets/MultipleIdentifiersWidget.java
7 7
import com.google.gwt.user.client.ui.FlowPanel;
8 8
import com.google.gwt.user.client.ui.IsWidget;
9 9
import com.google.gwt.user.client.ui.Widget;
10
import eu.dnetlib.goldoa.domain.PublicationIdentifier;
10 11

  
11 12
import java.util.ArrayList;
12 13
import java.util.List;
......
62 63
        return multipleIdentifiersPanel;
63 64
    }
64 65

  
66
    public List<PublicationIdentifier> getPublicationIdentifiers() {
65 67

  
68
        List<PublicationIdentifier> publicationIdentifierList = new ArrayList<>();
69

  
70
        for(IdentifierInfoWidget identifierInfoWidget : identifierInfoWidgetList) {
71

  
72
            if(identifierInfoWidget.getPublicationIdentifier()!=null)
73
                publicationIdentifierList.add(identifierInfoWidget.getPublicationIdentifier());
74
        }
75

  
76
        return publicationIdentifierList;
77
    }
66 78
}
modules/uoa-goldoa-portal/trunk/src/main/java/eu/dnetlib/client/DataService.java
25 25

  
26 26
    public void saveResearcher(Person person) throws PersonManagerException;
27 27

  
28
    public void saveRequest(Request request);
28
    public Request saveRequest(Request request);
29 29

  
30 30
    public Project getProject(String projectId);
31

  
32
    public Publication savePublication(Publication publication);
33

  
34
    public Journal getJournal(String journalId);
31 35
}
modules/uoa-goldoa-portal/trunk/src/main/webapp/GoldOAPortal.css
168 168

  
169 169
.researcherInfoPanel {
170 170
    border: 1px solid #ccc;
171
    border-radius: 4px;
171 172
    margin: 15px;
172
    width: 80%;
173
    width: 85%;
173 174
}
174 175

  
175 176
.researcherInfoPanel .contentLabel {
......
362 363
    border-radius: 4px;
363 364
    margin-left: 20px;
364 365
    padding: 20px;
365
    width: 72%;
366
    width: 80%;
366 367
}
367 368

  
368 369
.displayInfoElementTitle {
......
375 376
    border-radius: 4px;
376 377
    margin-left: 20px;
377 378
    padding: 20px;
378
    width: 71%;
379
    width: 79%;
379 380
}
380 381

  
381 382
.publicationDOIForm {
382
    margin: 20px;
383
    margin: 0 0 0 20px;
383 384
    padding-top: 20px;
384 385
    width: 85%;
385 386
}
......
526 527

  
527 528
/********************************/
528 529

  
530
.comment {
531
    font-size: 12px;
532
}
529 533

  
534
.width80 {
535
    width: 80%;
536
}
530 537

  
531 538

  
532 539

  
......
541 548

  
542 549

  
543 550

  
544

  
545

  
546 551
/********************************/
547 552

  
548 553
/* Bootstrap overrides */

Also available in: Unified diff