1 |
35007
|
stefania.m
|
package eu.dnetlib.client.user;
|
2 |
|
|
|
3 |
36072
|
stefania.m
|
import com.claudiushauptmann.gwt.recaptcha.client.RecaptchaWidget;
|
4 |
35007
|
stefania.m
|
import com.github.gwtbootstrap.client.ui.*;
|
5 |
35631
|
stefania.m
|
import com.github.gwtbootstrap.client.ui.ListBox;
|
6 |
|
|
import com.github.gwtbootstrap.client.ui.SubmitButton;
|
7 |
35007
|
stefania.m
|
import com.github.gwtbootstrap.client.ui.constants.*;
|
8 |
35292
|
stefania.m
|
import com.google.gwt.core.client.GWT;
|
9 |
|
|
import com.google.gwt.event.dom.client.ChangeEvent;
|
10 |
|
|
import com.google.gwt.event.dom.client.ChangeHandler;
|
11 |
35007
|
stefania.m
|
import com.google.gwt.event.dom.client.ClickEvent;
|
12 |
|
|
import com.google.gwt.event.dom.client.ClickHandler;
|
13 |
35582
|
stefania.m
|
import com.google.gwt.user.client.History;
|
14 |
36110
|
stefania.m
|
import com.google.gwt.user.client.Window;
|
15 |
35292
|
stefania.m
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
16 |
35631
|
stefania.m
|
import com.google.gwt.user.client.ui.*;
|
17 |
35007
|
stefania.m
|
import com.google.gwt.user.client.ui.Label;
|
18 |
35507
|
stefania.m
|
import eu.dnetlib.client.*;
|
19 |
35757
|
stefania.m
|
import eu.dnetlib.client.widgets.*;
|
20 |
|
|
import eu.dnetlib.client.widgets.PasswordTextBox;
|
21 |
|
|
import eu.dnetlib.client.widgets.TextBox;
|
22 |
35292
|
stefania.m
|
import eu.dnetlib.goldoa.domain.*;
|
23 |
35007
|
stefania.m
|
|
24 |
35292
|
stefania.m
|
import java.util.ArrayList;
|
25 |
35507
|
stefania.m
|
import java.util.HashMap;
|
26 |
35292
|
stefania.m
|
import java.util.List;
|
27 |
35507
|
stefania.m
|
import java.util.Map;
|
28 |
35292
|
stefania.m
|
|
29 |
35007
|
stefania.m
|
/**
|
30 |
|
|
* Created by stefania on 2/25/15.
|
31 |
|
|
*/
|
32 |
35507
|
stefania.m
|
public class UserRegistrationForm implements MyWidget {
|
33 |
35007
|
stefania.m
|
|
34 |
36467
|
stefania.m
|
private String token = "";
|
35 |
|
|
|
36 |
35007
|
stefania.m
|
private FlowPanel userRegistrationFormPanel = new FlowPanel();
|
37 |
|
|
|
38 |
|
|
private Alert errorLabel = new Alert();
|
39 |
|
|
private Alert informationLabel = new Alert();
|
40 |
|
|
|
41 |
|
|
private Label label = new Label();
|
42 |
|
|
|
43 |
|
|
private Form userRegistrationForm = new Form();
|
44 |
35757
|
stefania.m
|
|
45 |
35292
|
stefania.m
|
private TextBox firstNameTextBox = new TextBox();
|
46 |
|
|
private TextBox lastNameTextBox = new TextBox();
|
47 |
|
|
private TextBox initialsTextBox = new TextBox();
|
48 |
35757
|
stefania.m
|
private FormFieldSet nameFormFieldSet = new FormFieldSet("Name (*)", firstNameTextBox, initialsTextBox, lastNameTextBox);
|
49 |
|
|
|
50 |
35007
|
stefania.m
|
private TextBox emailTextBox = new TextBox();
|
51 |
35757
|
stefania.m
|
private FormFieldSet emailFormFieldSet = new FormFieldSet("E-mail Address (*)", emailTextBox);
|
52 |
|
|
|
53 |
35007
|
stefania.m
|
private PasswordTextBox passwordTextBox = new PasswordTextBox();
|
54 |
35757
|
stefania.m
|
private FormFieldSet passwordFormFieldSet;
|
55 |
|
|
private FormFieldSet passwordOptionalFormFieldSet;
|
56 |
|
|
|
57 |
35007
|
stefania.m
|
private PasswordTextBox confirmPasswordTextBox = new PasswordTextBox();
|
58 |
35757
|
stefania.m
|
private FormFieldSet confirmPasswordFormFieldSet;
|
59 |
|
|
private FormFieldSet confirmPasswordOptionalFormFieldSet;
|
60 |
35007
|
stefania.m
|
|
61 |
35292
|
stefania.m
|
private MultipleAffiliationsWidget multipleAffiliationsWidget = new MultipleAffiliationsWidget();
|
62 |
35757
|
stefania.m
|
private FormFieldSet affiliationsFormFieldSet = new FormFieldSet("Affiliations (*)", multipleAffiliationsWidget.asWidget());
|
63 |
35007
|
stefania.m
|
|
64 |
|
|
private TextBox telephoneTextBox = new TextBox();
|
65 |
|
|
|
66 |
35292
|
stefania.m
|
private ListBox userRole = new ListBox(true);
|
67 |
35757
|
stefania.m
|
private FormFieldSet userRoleFormFieldSet = new FormFieldSet("I am a (*)", userRole);
|
68 |
|
|
|
69 |
35292
|
stefania.m
|
private TextBox orcidID = new TextBox();
|
70 |
36432
|
stefania.m
|
private FormFieldSet orcidFormFieldSet = new FormFieldSet("ORCID", orcidID);
|
71 |
|
|
|
72 |
35292
|
stefania.m
|
private AutoCompleteWidget projectAutoComplete = new AutoCompleteWidget("project", "Search project");
|
73 |
36432
|
stefania.m
|
private FormFieldSet projectFormFieldSet = new FormFieldSet("Coordinated Project (*)", projectAutoComplete.asWidget());
|
74 |
35292
|
stefania.m
|
|
75 |
36432
|
stefania.m
|
private AutoCompleteWidget publisherAutoComplete = new AutoCompleteWidget("publisher", "Search or insert publisher's name...");
|
76 |
|
|
private FormFieldSet publisherFormFieldSet = new FormFieldSet("Publisher (*)", publisherAutoComplete.asWidget());
|
77 |
|
|
|
78 |
35007
|
stefania.m
|
private SubmitButton registerButton = new SubmitButton();
|
79 |
|
|
|
80 |
35292
|
stefania.m
|
private boolean isProjectSelected = false;
|
81 |
|
|
private String projectId = null;
|
82 |
46460
|
panagiotis
|
private Project project = null;
|
83 |
35292
|
stefania.m
|
|
84 |
36432
|
stefania.m
|
private boolean isPublisherSelected = false;
|
85 |
|
|
private Publisher publisher = null;
|
86 |
|
|
|
87 |
35292
|
stefania.m
|
private List<String> selectedRoles = new ArrayList<>();
|
88 |
36631
|
stefania.m
|
private List<String> notShownRoles = new ArrayList<>();
|
89 |
35292
|
stefania.m
|
|
90 |
|
|
private DataServiceAsync dataService = GWT.create(DataService.class);
|
91 |
|
|
|
92 |
35507
|
stefania.m
|
private boolean isEdit = false;
|
93 |
45767
|
panagiotis
|
private User registeredPerson;
|
94 |
35507
|
stefania.m
|
|
95 |
|
|
private Map<String, Integer> rolesMap = new HashMap<>();
|
96 |
|
|
|
97 |
46304
|
panagiotis
|
private Map<String, String> roles = new HashMap<>();
|
98 |
|
|
|
99 |
36072
|
stefania.m
|
private RecaptchaWidget captchaWidget;
|
100 |
35007
|
stefania.m
|
|
101 |
36946
|
stefania.m
|
private GoldOAConstants goldOAConstants = GWT.create(GoldOAConstants.class);
|
102 |
|
|
|
103 |
35507
|
stefania.m
|
public UserRegistrationForm(final boolean edit) {
|
104 |
35007
|
stefania.m
|
|
105 |
46351
|
panagiotis
|
|
106 |
35792
|
stefania.m
|
userRegistrationFormPanel.addStyleName("content");
|
107 |
|
|
|
108 |
35507
|
stefania.m
|
isEdit = edit;
|
109 |
|
|
|
110 |
|
|
if(edit)
|
111 |
|
|
label.setText("Edit your information");
|
112 |
|
|
else
|
113 |
36582
|
stefania.m
|
label.setText("Create an account");
|
114 |
35700
|
stefania.m
|
label.addStyleName("contentTitleLabel");
|
115 |
35007
|
stefania.m
|
|
116 |
|
|
userRegistrationFormPanel.add(label);
|
117 |
|
|
userRegistrationFormPanel.add(informationLabel);
|
118 |
|
|
userRegistrationFormPanel.add(errorLabel);
|
119 |
|
|
|
120 |
|
|
informationLabel.addStyleName("alertLabel");
|
121 |
|
|
informationLabel.setType(AlertType.SUCCESS);
|
122 |
|
|
informationLabel.setVisible(false);
|
123 |
|
|
informationLabel.setClose(false);
|
124 |
|
|
|
125 |
|
|
errorLabel.addStyleName("alertLabel");
|
126 |
|
|
errorLabel.setType(AlertType.ERROR);
|
127 |
|
|
errorLabel.setVisible(false);
|
128 |
|
|
errorLabel.setClose(false);
|
129 |
|
|
|
130 |
|
|
userRegistrationForm.setType(FormType.HORIZONTAL);
|
131 |
35292
|
stefania.m
|
userRegistrationForm.addStyleName("userRegistrationForm");
|
132 |
35007
|
stefania.m
|
userRegistrationFormPanel.add(userRegistrationForm);
|
133 |
|
|
|
134 |
35700
|
stefania.m
|
firstNameTextBox.setAlternateSize(AlternateSize.MEDIUM);
|
135 |
35757
|
stefania.m
|
firstNameTextBox.setPlaceholder("First name (*)");
|
136 |
|
|
firstNameTextBox.setValueChangeHandler(new ValueChangeHandler() {
|
137 |
|
|
@Override
|
138 |
|
|
public void handle(ValueChangeEvent valueChangeEvent) {
|
139 |
|
|
nameFormFieldSet.setControlGroupType(ControlGroupType.NONE);
|
140 |
|
|
}
|
141 |
|
|
});
|
142 |
|
|
|
143 |
35700
|
stefania.m
|
lastNameTextBox.setAlternateSize(AlternateSize.MEDIUM);
|
144 |
35757
|
stefania.m
|
lastNameTextBox.setPlaceholder("Last name (*)");
|
145 |
|
|
lastNameTextBox.setValueChangeHandler(new ValueChangeHandler() {
|
146 |
|
|
@Override
|
147 |
|
|
public void handle(ValueChangeEvent valueChangeEvent) {
|
148 |
|
|
nameFormFieldSet.setControlGroupType(ControlGroupType.NONE);
|
149 |
|
|
}
|
150 |
|
|
});
|
151 |
|
|
|
152 |
35292
|
stefania.m
|
initialsTextBox.setAlternateSize(AlternateSize.MINI);
|
153 |
|
|
initialsTextBox.setPlaceholder("Initials");
|
154 |
35757
|
stefania.m
|
initialsTextBox.setValueChangeHandler(new ValueChangeHandler() {
|
155 |
|
|
@Override
|
156 |
|
|
public void handle(ValueChangeEvent valueChangeEvent) {
|
157 |
|
|
nameFormFieldSet.setControlGroupType(ControlGroupType.NONE);
|
158 |
|
|
}
|
159 |
|
|
});
|
160 |
|
|
userRegistrationForm.add(nameFormFieldSet);
|
161 |
35007
|
stefania.m
|
|
162 |
35292
|
stefania.m
|
emailTextBox.setAlternateSize(AlternateSize.XXLARGE);
|
163 |
35757
|
stefania.m
|
emailTextBox.setValueChangeHandler(new ValueChangeHandler() {
|
164 |
|
|
@Override
|
165 |
|
|
public void handle(ValueChangeEvent valueChangeEvent) {
|
166 |
|
|
emailFormFieldSet.setControlGroupType(ControlGroupType.NONE);
|
167 |
|
|
}
|
168 |
|
|
});
|
169 |
35631
|
stefania.m
|
if(edit)
|
170 |
|
|
emailTextBox.setEnabled(false);
|
171 |
35757
|
stefania.m
|
userRegistrationForm.add(emailFormFieldSet);
|
172 |
35007
|
stefania.m
|
|
173 |
35292
|
stefania.m
|
passwordTextBox.setAlternateSize(AlternateSize.XXLARGE);
|
174 |
35757
|
stefania.m
|
passwordTextBox.setValueChangeHandler(new ValueChangeHandler() {
|
175 |
|
|
@Override
|
176 |
|
|
public void handle(ValueChangeEvent valueChangeEvent) {
|
177 |
|
|
passwordOptionalFormFieldSet.setControlGroupType(ControlGroupType.NONE);
|
178 |
|
|
passwordFormFieldSet.setControlGroupType(ControlGroupType.NONE);
|
179 |
|
|
}
|
180 |
|
|
});
|
181 |
|
|
if(edit) {
|
182 |
|
|
passwordOptionalFormFieldSet = new FormFieldSet("Password (Optional)", passwordTextBox);
|
183 |
|
|
userRegistrationForm.add(passwordOptionalFormFieldSet);
|
184 |
|
|
}
|
185 |
|
|
else {
|
186 |
|
|
passwordFormFieldSet = new FormFieldSet("Password (*)", passwordTextBox);
|
187 |
|
|
userRegistrationForm.add(passwordFormFieldSet);
|
188 |
|
|
}
|
189 |
35007
|
stefania.m
|
|
190 |
35292
|
stefania.m
|
confirmPasswordTextBox.setAlternateSize(AlternateSize.XXLARGE);
|
191 |
35757
|
stefania.m
|
confirmPasswordTextBox.setValueChangeHandler(new ValueChangeHandler() {
|
192 |
|
|
@Override
|
193 |
|
|
public void handle(ValueChangeEvent valueChangeEvent) {
|
194 |
|
|
confirmPasswordOptionalFormFieldSet.setControlGroupType(ControlGroupType.NONE);
|
195 |
|
|
confirmPasswordFormFieldSet.setControlGroupType(ControlGroupType.NONE);
|
196 |
|
|
}
|
197 |
|
|
});
|
198 |
|
|
if(edit) {
|
199 |
|
|
confirmPasswordOptionalFormFieldSet = new FormFieldSet("Confirm Password (Optional)", confirmPasswordTextBox);
|
200 |
|
|
userRegistrationForm.add(confirmPasswordOptionalFormFieldSet);
|
201 |
|
|
}
|
202 |
|
|
else {
|
203 |
|
|
confirmPasswordFormFieldSet = new FormFieldSet("Confirm Password (*)", confirmPasswordTextBox);
|
204 |
|
|
userRegistrationForm.add(confirmPasswordFormFieldSet);
|
205 |
|
|
}
|
206 |
35007
|
stefania.m
|
|
207 |
35292
|
stefania.m
|
telephoneTextBox.setAlternateSize(AlternateSize.XXLARGE);
|
208 |
|
|
userRegistrationForm.add(new FormFieldSet("Telephone", telephoneTextBox));
|
209 |
|
|
|
210 |
46367
|
panagiotis
|
|
211 |
35292
|
stefania.m
|
userRole.setAlternateSize(AlternateSize.XXLARGE);
|
212 |
46367
|
panagiotis
|
int j = 0;
|
213 |
35507
|
stefania.m
|
for(int i=0; i<GoldOAPortal.userRoles.size(); i++) {
|
214 |
46304
|
panagiotis
|
if(!(GoldOAPortal.userRoles.get(i).getId().equals("administrator")
|
215 |
|
|
|| GoldOAPortal.userRoles.get(i).getId().equals("moderator")
|
216 |
36631
|
stefania.m
|
|| GoldOAPortal.userRoles.get(i).getId().equals("accounting"))) {
|
217 |
45767
|
panagiotis
|
userRole.addItem(GoldOAPortal.userRoles.get(i).getRole(), GoldOAPortal.userRoles.get(i).getId());
|
218 |
46367
|
panagiotis
|
rolesMap.put(GoldOAPortal.userRoles.get(i).getId(), j);
|
219 |
|
|
j++;
|
220 |
36631
|
stefania.m
|
}
|
221 |
46391
|
panagiotis
|
roles.put(GoldOAPortal.userRoles.get(i).getId(),GoldOAPortal.userRoles.get(i).getRole());
|
222 |
35507
|
stefania.m
|
}
|
223 |
46367
|
panagiotis
|
|
224 |
35292
|
stefania.m
|
userRole.addChangeHandler(new ChangeHandler() {
|
225 |
|
|
@Override
|
226 |
|
|
public void onChange(ChangeEvent changeEvent) {
|
227 |
35007
|
stefania.m
|
|
228 |
35757
|
stefania.m
|
userRoleFormFieldSet.setControlGroupType(ControlGroupType.NONE);
|
229 |
|
|
|
230 |
35292
|
stefania.m
|
selectedRoles.clear();
|
231 |
|
|
for (int i = 0; i < userRole.getItemCount(); i++) {
|
232 |
|
|
if (userRole.isItemSelected(i)) {
|
233 |
|
|
selectedRoles.add(userRole.getValue(i));
|
234 |
|
|
}
|
235 |
|
|
}
|
236 |
35007
|
stefania.m
|
|
237 |
36432
|
stefania.m
|
orcidFormFieldSet.setVisible(false);
|
238 |
|
|
projectFormFieldSet.setVisible(false);
|
239 |
|
|
publisherFormFieldSet.setVisible(false);
|
240 |
|
|
affiliationsFormFieldSet.setVisible(true);
|
241 |
|
|
|
242 |
35292
|
stefania.m
|
for(String selectedValue : selectedRoles) {
|
243 |
|
|
if(selectedValue.equals("researcher")) {
|
244 |
36432
|
stefania.m
|
orcidFormFieldSet.setVisible(true);
|
245 |
35292
|
stefania.m
|
}
|
246 |
|
|
if(selectedValue.equals("project_coordinator")) {
|
247 |
36432
|
stefania.m
|
projectFormFieldSet.setVisible(true);
|
248 |
35292
|
stefania.m
|
}
|
249 |
36432
|
stefania.m
|
if(selectedValue.equals("publisher")) {
|
250 |
|
|
publisherFormFieldSet.setVisible(true);
|
251 |
|
|
affiliationsFormFieldSet.setVisible(false);
|
252 |
|
|
}
|
253 |
35292
|
stefania.m
|
}
|
254 |
|
|
}
|
255 |
|
|
});
|
256 |
46304
|
panagiotis
|
|
257 |
36432
|
stefania.m
|
userRegistrationForm.add(userRoleFormFieldSet);
|
258 |
35007
|
stefania.m
|
|
259 |
35292
|
stefania.m
|
userRole.setAlternateSize(AlternateSize.XXLARGE);
|
260 |
35007
|
stefania.m
|
|
261 |
36432
|
stefania.m
|
userRegistrationForm.add(affiliationsFormFieldSet);
|
262 |
|
|
|
263 |
35292
|
stefania.m
|
orcidID.setAlternateSize(AlternateSize.XXLARGE);
|
264 |
36432
|
stefania.m
|
orcidFormFieldSet.setVisible(false);
|
265 |
|
|
userRegistrationForm.add(orcidFormFieldSet);
|
266 |
|
|
|
267 |
35292
|
stefania.m
|
AutoCompleteWidget.AutoCompleteListener projectAutoCompleteListener = new AutoCompleteWidget.AutoCompleteListener() {
|
268 |
|
|
@Override
|
269 |
|
|
public void valueSelected(Vocabulary vocabulary) {
|
270 |
|
|
isProjectSelected = true;
|
271 |
46460
|
panagiotis
|
project = vocabulary.getProject();
|
272 |
35292
|
stefania.m
|
}
|
273 |
|
|
};
|
274 |
|
|
projectAutoComplete.setAutoCompleteListener(projectAutoCompleteListener);
|
275 |
|
|
projectAutoComplete.addStyleName("userRegistrationCoordinatedProject");
|
276 |
36432
|
stefania.m
|
projectFormFieldSet.setVisible(false);
|
277 |
|
|
userRegistrationForm.add(projectFormFieldSet);
|
278 |
35292
|
stefania.m
|
|
279 |
36432
|
stefania.m
|
AutoCompleteWidget.AutoCompleteListener publisherAutoCompleteListener = new AutoCompleteWidget.AutoCompleteListener() {
|
280 |
|
|
@Override
|
281 |
|
|
public void valueSelected(Vocabulary vocabulary) {
|
282 |
|
|
isPublisherSelected = true;
|
283 |
46460
|
panagiotis
|
publisher = vocabulary.getPublisher();
|
284 |
36432
|
stefania.m
|
}
|
285 |
|
|
};
|
286 |
|
|
publisherAutoComplete.setAutoCompleteListener(publisherAutoCompleteListener);
|
287 |
|
|
publisherAutoComplete.addStyleName("userRegistrationAffiliatedPublisher");
|
288 |
|
|
publisherFormFieldSet.setVisible(false);
|
289 |
|
|
userRegistrationForm.add(publisherFormFieldSet);
|
290 |
|
|
|
291 |
35507
|
stefania.m
|
if(edit)
|
292 |
|
|
registerButton.setText("Submit");
|
293 |
36072
|
stefania.m
|
else {
|
294 |
35507
|
stefania.m
|
registerButton.setText("Register");
|
295 |
36072
|
stefania.m
|
captchaWidget = new RecaptchaWidget(GoldOAPortal.publicCaptchaKey, "en", "clean");
|
296 |
36432
|
stefania.m
|
userRegistrationForm.add(new FormFieldSet(null, captchaWidget));
|
297 |
36072
|
stefania.m
|
}
|
298 |
35007
|
stefania.m
|
registerButton.setType(ButtonType.PRIMARY);
|
299 |
|
|
|
300 |
36432
|
stefania.m
|
userRegistrationForm.add(new FormFieldSet(null, registerButton));
|
301 |
35007
|
stefania.m
|
|
302 |
|
|
registerButton.addClickHandler(new ClickHandler() {
|
303 |
|
|
|
304 |
|
|
@Override
|
305 |
|
|
public void onClick(ClickEvent event) {
|
306 |
35507
|
stefania.m
|
if(edit) {
|
307 |
|
|
informationLabel.setVisible(false);
|
308 |
|
|
errorLabel.setVisible(false);
|
309 |
35292
|
stefania.m
|
|
310 |
35507
|
stefania.m
|
if(isUpdateComplete()) {
|
311 |
|
|
|
312 |
|
|
if(!passwordTextBox.getValue().trim().isEmpty() || !confirmPasswordTextBox.getValue().trim().isEmpty()) {
|
313 |
|
|
|
314 |
|
|
if(!passwordTextBox.getValue().trim().isEmpty() && !confirmPasswordTextBox.getValue().trim().isEmpty()) {
|
315 |
|
|
if(!passwordTextBox.getValue().equals(confirmPasswordTextBox.getValue())) {
|
316 |
|
|
|
317 |
|
|
informationLabel.setVisible(false);
|
318 |
36946
|
stefania.m
|
errorLabel.setText(goldOAConstants.registerErrorPassFieldsDoNotMatch());
|
319 |
35507
|
stefania.m
|
errorLabel.setVisible(true);
|
320 |
35292
|
stefania.m
|
} else {
|
321 |
35507
|
stefania.m
|
updateUser(getPerson());
|
322 |
35292
|
stefania.m
|
}
|
323 |
35507
|
stefania.m
|
} else {
|
324 |
|
|
informationLabel.setVisible(false);
|
325 |
36946
|
stefania.m
|
errorLabel.setText(goldOAConstants.registerErrorPassFieldsDoNotMatch());
|
326 |
35507
|
stefania.m
|
errorLabel.setVisible(true);
|
327 |
35292
|
stefania.m
|
}
|
328 |
35507
|
stefania.m
|
} else {
|
329 |
|
|
updateUser(getPerson());
|
330 |
|
|
}
|
331 |
|
|
} else {
|
332 |
|
|
informationLabel.setVisible(false);
|
333 |
36946
|
stefania.m
|
errorLabel.setText(goldOAConstants.registerErrorAllFieldsAreRequired());
|
334 |
35507
|
stefania.m
|
errorLabel.setVisible(true);
|
335 |
|
|
}
|
336 |
35292
|
stefania.m
|
|
337 |
35507
|
stefania.m
|
} else {
|
338 |
35292
|
stefania.m
|
|
339 |
35507
|
stefania.m
|
informationLabel.setVisible(false);
|
340 |
|
|
errorLabel.setVisible(false);
|
341 |
36072
|
stefania.m
|
|
342 |
35507
|
stefania.m
|
if (isRegisterComplete()) {
|
343 |
|
|
if (passwordsMatch()) {
|
344 |
36072
|
stefania.m
|
if(isCaptchaCompleted()) {
|
345 |
|
|
|
346 |
|
|
registerUser(getPerson());
|
347 |
|
|
|
348 |
|
|
} else {
|
349 |
36946
|
stefania.m
|
errorLabel.setText(goldOAConstants.registerErrorCaptchaMissing());
|
350 |
36072
|
stefania.m
|
errorLabel.setVisible(true);
|
351 |
|
|
}
|
352 |
35507
|
stefania.m
|
} else {
|
353 |
36946
|
stefania.m
|
errorLabel.setText(goldOAConstants.registerErrorPassFieldsDoNotMatch());
|
354 |
35507
|
stefania.m
|
errorLabel.setVisible(true);
|
355 |
|
|
}
|
356 |
35292
|
stefania.m
|
} else {
|
357 |
36946
|
stefania.m
|
errorLabel.setText(goldOAConstants.registerErrorAllFieldsAreRequired());
|
358 |
35292
|
stefania.m
|
errorLabel.setVisible(true);
|
359 |
|
|
}
|
360 |
|
|
}
|
361 |
35007
|
stefania.m
|
}
|
362 |
|
|
});
|
363 |
|
|
}
|
364 |
|
|
|
365 |
|
|
@Override
|
366 |
|
|
public Widget asWidget() {
|
367 |
|
|
return userRegistrationFormPanel;
|
368 |
|
|
}
|
369 |
|
|
|
370 |
35507
|
stefania.m
|
private boolean isRegisterComplete() {
|
371 |
35292
|
stefania.m
|
|
372 |
|
|
if(!firstNameTextBox.getValue().trim().isEmpty() && !lastNameTextBox.getValue().trim().isEmpty()
|
373 |
|
|
&& !emailTextBox.getValue().trim().isEmpty() && !passwordTextBox.getValue().trim().isEmpty()
|
374 |
36432
|
stefania.m
|
&& !confirmPasswordTextBox.getValue().trim().isEmpty() && !selectedRoles.isEmpty()) {
|
375 |
35292
|
stefania.m
|
|
376 |
36432
|
stefania.m
|
boolean isPublisher = false;
|
377 |
35292
|
stefania.m
|
boolean isProjectCoordinator = false;
|
378 |
|
|
for(String role : selectedRoles) {
|
379 |
|
|
if(role.equals("project_coordinator")) {
|
380 |
|
|
isProjectCoordinator = true;
|
381 |
|
|
break;
|
382 |
|
|
}
|
383 |
36432
|
stefania.m
|
if(role.equals("publisher")) {
|
384 |
|
|
isPublisher = true;
|
385 |
|
|
break;
|
386 |
|
|
}
|
387 |
35292
|
stefania.m
|
}
|
388 |
35757
|
stefania.m
|
|
389 |
36705
|
stefania.m
|
if(isPublisher && isProjectCoordinator) {
|
390 |
36432
|
stefania.m
|
|
391 |
36705
|
stefania.m
|
if(isPublisherSelected && isProjectSelected)
|
392 |
36432
|
stefania.m
|
return true;
|
393 |
|
|
|
394 |
36705
|
stefania.m
|
} else if(isPublisher && !isProjectCoordinator) {
|
395 |
|
|
|
396 |
|
|
if(isPublisherSelected)
|
397 |
36432
|
stefania.m
|
return true;
|
398 |
36705
|
stefania.m
|
|
399 |
|
|
} else if(!isPublisher && isProjectCoordinator) {
|
400 |
|
|
|
401 |
|
|
if(isProjectSelected && !multipleAffiliationsWidget.getAffiliations().isEmpty())
|
402 |
36432
|
stefania.m
|
return true;
|
403 |
|
|
|
404 |
|
|
} else {
|
405 |
|
|
|
406 |
36705
|
stefania.m
|
if(!multipleAffiliationsWidget.getAffiliations().isEmpty())
|
407 |
|
|
return true;
|
408 |
36432
|
stefania.m
|
}
|
409 |
|
|
|
410 |
35757
|
stefania.m
|
} else {
|
411 |
|
|
|
412 |
|
|
// if(firstNameTextBox.getValue().trim().equals("") || lastNameTextBox.getValue().trim().equals(""))
|
413 |
|
|
// nameFormFieldSet.setControlGroupType(ControlGroupType.ERROR);
|
414 |
|
|
//
|
415 |
|
|
// if(emailTextBox.getValue().trim().equals(""))
|
416 |
|
|
// emailFormFieldSet.setControlGroupType(ControlGroupType.ERROR);
|
417 |
|
|
//
|
418 |
|
|
// if(passwordTextBox.getValue().trim().equals(""))
|
419 |
|
|
// passwordFormFieldSet.setControlGroupType(ControlGroupType.ERROR);
|
420 |
|
|
//
|
421 |
|
|
// if(confirmPasswordTextBox.getValue().trim().equals(""))
|
422 |
|
|
// confirmPasswordFormFieldSet.setControlGroupType(ControlGroupType.ERROR);
|
423 |
|
|
//
|
424 |
|
|
// if(selectedRoles.isEmpty())
|
425 |
|
|
// userRoleFormFieldSet.setControlGroupType(ControlGroupType.ERROR);
|
426 |
|
|
//
|
427 |
|
|
// if(multipleAffiliationsWidget.getAffiliations().isEmpty())
|
428 |
|
|
// affiliationsFormFieldSet.setControlGroupType(ControlGroupType.ERROR);
|
429 |
35292
|
stefania.m
|
}
|
430 |
|
|
|
431 |
|
|
return false;
|
432 |
35007
|
stefania.m
|
}
|
433 |
|
|
|
434 |
35507
|
stefania.m
|
private boolean isUpdateComplete() {
|
435 |
|
|
|
436 |
|
|
if(!firstNameTextBox.getValue().trim().isEmpty() && !lastNameTextBox.getValue().trim().isEmpty()
|
437 |
36432
|
stefania.m
|
&& !emailTextBox.getValue().trim().isEmpty() && !selectedRoles.isEmpty()) {
|
438 |
35507
|
stefania.m
|
|
439 |
36432
|
stefania.m
|
boolean isPublisher = false;
|
440 |
35507
|
stefania.m
|
boolean isProjectCoordinator = false;
|
441 |
|
|
for(String role : selectedRoles) {
|
442 |
|
|
if(role.equals("project_coordinator")) {
|
443 |
|
|
isProjectCoordinator = true;
|
444 |
|
|
break;
|
445 |
|
|
}
|
446 |
36432
|
stefania.m
|
if(role.equals("publisher")) {
|
447 |
|
|
isPublisher = true;
|
448 |
|
|
break;
|
449 |
|
|
}
|
450 |
35507
|
stefania.m
|
}
|
451 |
36432
|
stefania.m
|
|
452 |
36705
|
stefania.m
|
if(isPublisher && isProjectCoordinator) {
|
453 |
36432
|
stefania.m
|
|
454 |
36705
|
stefania.m
|
if(isPublisherSelected && isProjectSelected)
|
455 |
36432
|
stefania.m
|
return true;
|
456 |
|
|
|
457 |
36705
|
stefania.m
|
} else if(isPublisher && !isProjectCoordinator) {
|
458 |
|
|
|
459 |
|
|
if(isPublisherSelected)
|
460 |
36432
|
stefania.m
|
return true;
|
461 |
36705
|
stefania.m
|
|
462 |
|
|
} else if(!isPublisher && isProjectCoordinator) {
|
463 |
|
|
|
464 |
|
|
if(isProjectSelected && !multipleAffiliationsWidget.getAffiliations().isEmpty())
|
465 |
36432
|
stefania.m
|
return true;
|
466 |
|
|
|
467 |
|
|
} else {
|
468 |
|
|
|
469 |
36705
|
stefania.m
|
if(!multipleAffiliationsWidget.getAffiliations().isEmpty())
|
470 |
|
|
return true;
|
471 |
36432
|
stefania.m
|
}
|
472 |
35507
|
stefania.m
|
}
|
473 |
|
|
|
474 |
|
|
return false;
|
475 |
|
|
}
|
476 |
|
|
|
477 |
35292
|
stefania.m
|
private boolean passwordsMatch() {
|
478 |
35007
|
stefania.m
|
|
479 |
35292
|
stefania.m
|
if(passwordTextBox.getValue().trim().equals(confirmPasswordTextBox.getValue().trim()))
|
480 |
|
|
return true;
|
481 |
|
|
|
482 |
|
|
return false;
|
483 |
35007
|
stefania.m
|
}
|
484 |
35292
|
stefania.m
|
|
485 |
46304
|
panagiotis
|
private User getPerson() {
|
486 |
35292
|
stefania.m
|
|
487 |
46067
|
panagiotis
|
final User person;
|
488 |
41415
|
stefania.m
|
if(isEdit)
|
489 |
|
|
person = registeredPerson;
|
490 |
|
|
else
|
491 |
45767
|
panagiotis
|
person = new User();
|
492 |
35292
|
stefania.m
|
|
493 |
45767
|
panagiotis
|
person.setFirstname(firstNameTextBox.getValue().trim());
|
494 |
35292
|
stefania.m
|
person.setLastname(lastNameTextBox.getValue().trim());
|
495 |
45991
|
panagiotis
|
person.setInitials(initialsTextBox.getValue().trim());
|
496 |
35292
|
stefania.m
|
person.setEmail(emailTextBox.getValue().trim());
|
497 |
|
|
person.setPassword(passwordTextBox.getValue().trim());
|
498 |
|
|
person.setTelephone(telephoneTextBox.getValue().trim());
|
499 |
|
|
|
500 |
|
|
List<Affiliation> affiliations = multipleAffiliationsWidget.getAffiliations();
|
501 |
35507
|
stefania.m
|
for(Affiliation affiliation : affiliations) {
|
502 |
45991
|
panagiotis
|
affiliation.getUsers().add(person);
|
503 |
35507
|
stefania.m
|
}
|
504 |
35292
|
stefania.m
|
person.setAffiliations(affiliations);
|
505 |
|
|
|
506 |
45767
|
panagiotis
|
person.setOrcidid(orcidID.getValue().trim());
|
507 |
35347
|
stefania.m
|
|
508 |
|
|
List<Project> coordinatedProjects = new ArrayList<>();
|
509 |
46460
|
panagiotis
|
if(project!=null) {
|
510 |
|
|
Window.alert(project.getAcronym());
|
511 |
|
|
coordinatedProjects.add(project);
|
512 |
45767
|
panagiotis
|
}
|
513 |
|
|
|
514 |
35292
|
stefania.m
|
person.setCoordinatedProjects(coordinatedProjects);
|
515 |
|
|
|
516 |
36432
|
stefania.m
|
if(!publisherAutoComplete.getValue().equals("")) {
|
517 |
|
|
|
518 |
|
|
if(publisher!=null && publisher.getName().equals(publisherAutoComplete.getValue())) {
|
519 |
|
|
person.setPublisher(publisher);
|
520 |
|
|
} else {
|
521 |
|
|
Publisher publisher = new Publisher();
|
522 |
|
|
publisher.setName(publisherAutoComplete.getValue());
|
523 |
|
|
person.setPublisher(publisher);
|
524 |
|
|
}
|
525 |
|
|
}
|
526 |
|
|
|
527 |
45767
|
panagiotis
|
List<UserRole> personRoles = new ArrayList<>();
|
528 |
36631
|
stefania.m
|
|
529 |
46067
|
panagiotis
|
for(final String roleId : selectedRoles) {
|
530 |
45767
|
panagiotis
|
UserRole personRole = new UserRole();
|
531 |
|
|
UserRolePK urPk = new UserRolePK();
|
532 |
35292
|
stefania.m
|
|
533 |
45767
|
panagiotis
|
urPk.setUser(person);
|
534 |
46304
|
panagiotis
|
urPk.setRole(new Role(roleId,roles.get(roleId)));
|
535 |
45767
|
panagiotis
|
personRole.setPk(urPk);
|
536 |
|
|
|
537 |
35510
|
stefania.m
|
if(GoldOAPortal.currentUser==null) {
|
538 |
46067
|
panagiotis
|
if (roleId.equals("researcher"))
|
539 |
35510
|
stefania.m
|
personRole.setApproved(true);
|
540 |
|
|
else
|
541 |
|
|
personRole.setApproved(false);
|
542 |
|
|
} else {
|
543 |
46067
|
panagiotis
|
if(Utils.currentUserHasRole(roleId)) {
|
544 |
|
|
personRole.setApproved(Utils.isRoleApprovedForCurrentUser(roleId));
|
545 |
35510
|
stefania.m
|
} else {
|
546 |
46067
|
panagiotis
|
if (roleId.equals("researcher"))
|
547 |
35510
|
stefania.m
|
personRole.setApproved(true);
|
548 |
|
|
else
|
549 |
|
|
personRole.setApproved(false);
|
550 |
|
|
}
|
551 |
|
|
}
|
552 |
46329
|
panagiotis
|
personRoles.add(personRole);
|
553 |
35292
|
stefania.m
|
}
|
554 |
36631
|
stefania.m
|
|
555 |
46067
|
panagiotis
|
for(String roleId : notShownRoles) {
|
556 |
46421
|
panagiotis
|
|
557 |
45767
|
panagiotis
|
UserRole personRole = new UserRole();
|
558 |
|
|
UserRolePK urPk = new UserRolePK();
|
559 |
36631
|
stefania.m
|
|
560 |
45767
|
panagiotis
|
urPk.setUser(person);
|
561 |
46304
|
panagiotis
|
urPk.setRole(new Role(roleId,roles.get(roleId)));
|
562 |
45767
|
panagiotis
|
personRole.setPk(urPk);
|
563 |
|
|
|
564 |
36631
|
stefania.m
|
if(GoldOAPortal.currentUser==null) {
|
565 |
46067
|
panagiotis
|
if (roleId.equals("researcher"))
|
566 |
36631
|
stefania.m
|
personRole.setApproved(true);
|
567 |
|
|
else
|
568 |
|
|
personRole.setApproved(false);
|
569 |
|
|
} else {
|
570 |
46067
|
panagiotis
|
if(Utils.currentUserHasRole(roleId)) {
|
571 |
|
|
personRole.setApproved(Utils.isRoleApprovedForCurrentUser(roleId));
|
572 |
36631
|
stefania.m
|
} else {
|
573 |
46067
|
panagiotis
|
if (roleId.equals("researcher"))
|
574 |
36631
|
stefania.m
|
personRole.setApproved(true);
|
575 |
|
|
else
|
576 |
|
|
personRole.setApproved(false);
|
577 |
|
|
}
|
578 |
|
|
}
|
579 |
46329
|
panagiotis
|
personRoles.add(personRole);
|
580 |
36631
|
stefania.m
|
}
|
581 |
46329
|
panagiotis
|
person.setRole(personRoles);
|
582 |
46304
|
panagiotis
|
person.setActive(false);
|
583 |
35292
|
stefania.m
|
return person;
|
584 |
|
|
}
|
585 |
35507
|
stefania.m
|
|
586 |
45767
|
panagiotis
|
private void registerUser(User person) {
|
587 |
35507
|
stefania.m
|
|
588 |
36066
|
stefania.m
|
final HTML loadingWheel = new HTML("<div class=\"loader-big\"></div><div class=\"whiteFilm\"></div>");
|
589 |
|
|
userRegistrationFormPanel.addStyleName("loading");
|
590 |
|
|
userRegistrationFormPanel.add(loadingWheel);
|
591 |
|
|
|
592 |
36072
|
stefania.m
|
dataService.registerUser(person, captchaWidget.getChallenge(), captchaWidget.getResponse(), new AsyncCallback<Void>() {
|
593 |
35507
|
stefania.m
|
|
594 |
|
|
@Override
|
595 |
|
|
public void onFailure(Throwable throwable) {
|
596 |
36066
|
stefania.m
|
|
597 |
36110
|
stefania.m
|
Window.scrollTo(0, 0);
|
598 |
|
|
|
599 |
36066
|
stefania.m
|
userRegistrationFormPanel.remove(loadingWheel);
|
600 |
|
|
userRegistrationFormPanel.removeStyleName("loading");
|
601 |
|
|
|
602 |
35507
|
stefania.m
|
if (throwable instanceof PersonManagerException) {
|
603 |
|
|
PersonManagerException personManagerException = (PersonManagerException) throwable;
|
604 |
|
|
if (personManagerException.getErrorCause().equals(PersonManagerException.ErrorCause.ALREADY_EXISTS)) {
|
605 |
36946
|
stefania.m
|
errorLabel.setText(goldOAConstants.registerErrorUserAlreadyExists());
|
606 |
35507
|
stefania.m
|
errorLabel.setVisible(true);
|
607 |
|
|
} else {
|
608 |
36946
|
stefania.m
|
errorLabel.setText(goldOAConstants.registerErrorGeneral());
|
609 |
35507
|
stefania.m
|
errorLabel.setVisible(true);
|
610 |
|
|
}
|
611 |
|
|
} else {
|
612 |
36072
|
stefania.m
|
|
613 |
|
|
if(throwable.getMessage().equals("captcha")) {
|
614 |
|
|
errorLabel.setText("Incorrect captcha");
|
615 |
|
|
captchaWidget.reload();
|
616 |
|
|
} else {
|
617 |
36946
|
stefania.m
|
errorLabel.setText(goldOAConstants.registerErrorGeneral());
|
618 |
36072
|
stefania.m
|
}
|
619 |
35507
|
stefania.m
|
errorLabel.setVisible(true);
|
620 |
|
|
}
|
621 |
|
|
}
|
622 |
|
|
|
623 |
|
|
@Override
|
624 |
|
|
public void onSuccess(Void aVoid) {
|
625 |
|
|
|
626 |
36110
|
stefania.m
|
Window.scrollTo(0, 0);
|
627 |
|
|
|
628 |
36066
|
stefania.m
|
userRegistrationFormPanel.remove(loadingWheel);
|
629 |
|
|
userRegistrationFormPanel.removeStyleName("loading");
|
630 |
|
|
|
631 |
36946
|
stefania.m
|
String text = goldOAConstants.registerSuccessGeneral();
|
632 |
36110
|
stefania.m
|
|
633 |
|
|
boolean hasExtraRoles = false;
|
634 |
|
|
|
635 |
35507
|
stefania.m
|
for (String role : selectedRoles) {
|
636 |
|
|
if (role.equals("researcher"))
|
637 |
|
|
continue;
|
638 |
|
|
else {
|
639 |
36110
|
stefania.m
|
hasExtraRoles = true;
|
640 |
|
|
break;
|
641 |
35507
|
stefania.m
|
}
|
642 |
|
|
}
|
643 |
|
|
|
644 |
36110
|
stefania.m
|
if(hasExtraRoles)
|
645 |
36946
|
stefania.m
|
text += goldOAConstants.registerSuccessExtraRoles();
|
646 |
36110
|
stefania.m
|
|
647 |
35507
|
stefania.m
|
informationLabel.setText(text);
|
648 |
|
|
informationLabel.setVisible(true);
|
649 |
|
|
}
|
650 |
|
|
});
|
651 |
|
|
}
|
652 |
|
|
|
653 |
45767
|
panagiotis
|
private void updateUser(User person) {
|
654 |
35507
|
stefania.m
|
|
655 |
36066
|
stefania.m
|
final HTML loadingWheel = new HTML("<div class=\"loader-big\"></div><div class=\"whiteFilm\"></div>");
|
656 |
|
|
userRegistrationFormPanel.addStyleName("loading");
|
657 |
|
|
userRegistrationFormPanel.add(loadingWheel);
|
658 |
|
|
|
659 |
45767
|
panagiotis
|
dataService.updateUser(person, new AsyncCallback<User>() {
|
660 |
35507
|
stefania.m
|
|
661 |
|
|
@Override
|
662 |
|
|
public void onFailure(Throwable throwable) {
|
663 |
36066
|
stefania.m
|
|
664 |
|
|
userRegistrationFormPanel.remove(loadingWheel);
|
665 |
|
|
userRegistrationFormPanel.removeStyleName("loading");
|
666 |
|
|
|
667 |
36946
|
stefania.m
|
errorLabel.setText(goldOAConstants.updateAccountInfoError());
|
668 |
35507
|
stefania.m
|
errorLabel.setVisible(true);
|
669 |
|
|
}
|
670 |
|
|
|
671 |
|
|
@Override
|
672 |
45767
|
panagiotis
|
public void onSuccess(User person) {
|
673 |
35631
|
stefania.m
|
|
674 |
36066
|
stefania.m
|
userRegistrationFormPanel.remove(loadingWheel);
|
675 |
|
|
userRegistrationFormPanel.removeStyleName("loading");
|
676 |
|
|
|
677 |
35507
|
stefania.m
|
GoldOAPortal.currentUser = person;
|
678 |
35631
|
stefania.m
|
|
679 |
|
|
UserInfoElement userInfoElement = new UserInfoElement();
|
680 |
|
|
RootPanel.get("loginRegister").clear();
|
681 |
|
|
RootPanel.get("loginRegister").add(userInfoElement.asWidget());
|
682 |
|
|
|
683 |
35582
|
stefania.m
|
History.newItem(GoldOAPortal.previousToken);
|
684 |
35507
|
stefania.m
|
}
|
685 |
|
|
});
|
686 |
|
|
}
|
687 |
|
|
|
688 |
|
|
private void loadUserInfo() {
|
689 |
41415
|
stefania.m
|
registeredPerson = GoldOAPortal.currentUser;
|
690 |
35507
|
stefania.m
|
|
691 |
45767
|
panagiotis
|
firstNameTextBox.setValue(registeredPerson.getFirstname());
|
692 |
41415
|
stefania.m
|
lastNameTextBox.setValue(registeredPerson.getLastname());
|
693 |
35507
|
stefania.m
|
|
694 |
45991
|
panagiotis
|
if(registeredPerson.getInitials()!=null)
|
695 |
|
|
initialsTextBox.setValue(registeredPerson.getInitials());
|
696 |
35507
|
stefania.m
|
|
697 |
41415
|
stefania.m
|
emailTextBox.setValue(registeredPerson.getEmail());
|
698 |
|
|
passwordTextBox.setValue(registeredPerson.getPassword());
|
699 |
|
|
confirmPasswordTextBox.setValue(registeredPerson.getPassword());
|
700 |
35507
|
stefania.m
|
|
701 |
41415
|
stefania.m
|
if(registeredPerson.getTelephone()!=null)
|
702 |
|
|
telephoneTextBox.setValue(registeredPerson.getTelephone());
|
703 |
35507
|
stefania.m
|
|
704 |
41415
|
stefania.m
|
multipleAffiliationsWidget.loadAffiliations(registeredPerson.getAffiliations());
|
705 |
35507
|
stefania.m
|
|
706 |
45767
|
panagiotis
|
for(UserRole personRole : registeredPerson.getRoles()) {
|
707 |
|
|
if(personRole.getPk().getRole().getId().equals("administrator") || personRole.getPk().getRole().getId().equals("moderator")
|
708 |
|
|
|| personRole.getPk().getRole().getId().equals("accounting"))
|
709 |
|
|
notShownRoles.add(personRole.getPk().getRole().getId());
|
710 |
36631
|
stefania.m
|
else
|
711 |
45767
|
panagiotis
|
selectedRoles.add(personRole.getPk().getRole().getId());
|
712 |
35507
|
stefania.m
|
}
|
713 |
|
|
|
714 |
36432
|
stefania.m
|
orcidFormFieldSet.setVisible(false);
|
715 |
|
|
projectFormFieldSet.setVisible(false);
|
716 |
|
|
publisherFormFieldSet.setVisible(false);
|
717 |
|
|
affiliationsFormFieldSet.setVisible(true);
|
718 |
|
|
|
719 |
35507
|
stefania.m
|
for(String selectedValue : selectedRoles) {
|
720 |
|
|
if(selectedValue.equals("researcher")) {
|
721 |
45767
|
panagiotis
|
if(registeredPerson.getOrcidid()!=null)
|
722 |
|
|
orcidID.setValue(registeredPerson.getOrcidid());
|
723 |
36432
|
stefania.m
|
orcidFormFieldSet.setVisible(true);
|
724 |
35507
|
stefania.m
|
}
|
725 |
|
|
if(selectedValue.equals("project_coordinator")) {
|
726 |
35510
|
stefania.m
|
|
727 |
41415
|
stefania.m
|
Project coordinatedProject = registeredPerson.getCoordinatedProjects().get(0);
|
728 |
35510
|
stefania.m
|
String projectValue = coordinatedProject.getAcronym() + " - " + coordinatedProject.getGrant()
|
729 |
|
|
+ " (" + coordinatedProject.getTitle() + ")";
|
730 |
|
|
projectAutoComplete.setValue(projectValue);
|
731 |
36432
|
stefania.m
|
projectFormFieldSet.setVisible(true);
|
732 |
35507
|
stefania.m
|
isProjectSelected = true;
|
733 |
41415
|
stefania.m
|
projectId = registeredPerson.getCoordinatedProjects().get(0).getId();
|
734 |
35507
|
stefania.m
|
}
|
735 |
36432
|
stefania.m
|
if(selectedValue.equals("publisher")) {
|
736 |
|
|
|
737 |
41415
|
stefania.m
|
publisherAutoComplete.setValue(registeredPerson.getPublisher().getName());
|
738 |
36432
|
stefania.m
|
publisherFormFieldSet.setVisible(true);
|
739 |
|
|
affiliationsFormFieldSet.setVisible(false);
|
740 |
|
|
isPublisherSelected = true;
|
741 |
41415
|
stefania.m
|
publisher = registeredPerson.getPublisher();
|
742 |
36432
|
stefania.m
|
}
|
743 |
35507
|
stefania.m
|
}
|
744 |
|
|
|
745 |
35510
|
stefania.m
|
userRole.setMultipleSelect(true);
|
746 |
35507
|
stefania.m
|
for(String roleId : selectedRoles) {
|
747 |
46329
|
panagiotis
|
userRole.setItemSelected(rolesMap.get(roleId), true);
|
748 |
35507
|
stefania.m
|
}
|
749 |
|
|
}
|
750 |
|
|
|
751 |
|
|
private void clearUserInfo() {
|
752 |
|
|
|
753 |
|
|
firstNameTextBox.setValue("");
|
754 |
|
|
lastNameTextBox.setValue("");
|
755 |
|
|
initialsTextBox.setValue("");
|
756 |
|
|
emailTextBox.setValue("");
|
757 |
|
|
passwordTextBox.setValue("");
|
758 |
|
|
confirmPasswordTextBox.setValue("");
|
759 |
|
|
telephoneTextBox.setValue("");
|
760 |
|
|
|
761 |
|
|
multipleAffiliationsWidget.clear();
|
762 |
|
|
|
763 |
46367
|
panagiotis
|
|
764 |
35507
|
stefania.m
|
for(Map.Entry<String, Integer> entry : rolesMap.entrySet()) {
|
765 |
46367
|
panagiotis
|
userRole.setItemSelected(entry.getValue(), false);
|
766 |
35507
|
stefania.m
|
}
|
767 |
|
|
orcidID.setValue("");
|
768 |
|
|
projectAutoComplete.setValue("");
|
769 |
36432
|
stefania.m
|
publisherAutoComplete.setValue("");
|
770 |
35507
|
stefania.m
|
|
771 |
|
|
isProjectSelected = false;
|
772 |
|
|
projectId = null;
|
773 |
|
|
|
774 |
36432
|
stefania.m
|
isPublisherSelected = false;
|
775 |
|
|
publisher = null;
|
776 |
|
|
|
777 |
35507
|
stefania.m
|
selectedRoles = new ArrayList<>();
|
778 |
36631
|
stefania.m
|
notShownRoles = new ArrayList<>();
|
779 |
36432
|
stefania.m
|
|
780 |
|
|
orcidFormFieldSet.setVisible(false);
|
781 |
|
|
projectFormFieldSet.setVisible(false);
|
782 |
|
|
publisherFormFieldSet.setVisible(false);
|
783 |
|
|
affiliationsFormFieldSet.setVisible(true);
|
784 |
35507
|
stefania.m
|
}
|
785 |
|
|
|
786 |
|
|
@Override
|
787 |
|
|
public void clear() {
|
788 |
35842
|
stefania.m
|
|
789 |
35507
|
stefania.m
|
informationLabel.setVisible(false);
|
790 |
|
|
errorLabel.setVisible(false);
|
791 |
|
|
clearUserInfo();
|
792 |
|
|
if(isEdit)
|
793 |
|
|
loadUserInfo();
|
794 |
|
|
}
|
795 |
|
|
|
796 |
|
|
@Override
|
797 |
35665
|
stefania.m
|
public void reload() {
|
798 |
35842
|
stefania.m
|
|
799 |
36624
|
stefania.m
|
MyWidgetHelper.hideSidebar();
|
800 |
35842
|
stefania.m
|
|
801 |
36467
|
stefania.m
|
SidebarPanel helpPanel = new SidebarPanel("Help");
|
802 |
|
|
MyWidgetHelper.loadHelp(helpPanel, token.split("\\.")[0]);
|
803 |
|
|
|
804 |
35665
|
stefania.m
|
informationLabel.setVisible(false);
|
805 |
|
|
errorLabel.setVisible(false);
|
806 |
|
|
clearUserInfo();
|
807 |
|
|
if(isEdit)
|
808 |
|
|
loadUserInfo();
|
809 |
|
|
}
|
810 |
|
|
|
811 |
|
|
@Override
|
812 |
35507
|
stefania.m
|
public void setToken(String token) {
|
813 |
36467
|
stefania.m
|
this.token = token;
|
814 |
35507
|
stefania.m
|
}
|
815 |
35510
|
stefania.m
|
|
816 |
36054
|
stefania.m
|
@Override
|
817 |
|
|
public void afterAdditionToRootPanel() {
|
818 |
|
|
|
819 |
|
|
}
|
820 |
|
|
|
821 |
36072
|
stefania.m
|
private boolean isCaptchaCompleted() {
|
822 |
|
|
|
823 |
|
|
if(captchaWidget.getResponse()!=null && !captchaWidget.getResponse().equals(""))
|
824 |
|
|
return true;
|
825 |
|
|
|
826 |
|
|
return false;
|
827 |
|
|
}
|
828 |
35007
|
stefania.m
|
}
|