1
|
package eu.dnetlib.client;
|
2
|
|
3
|
import com.github.gwtbootstrap.client.ui.Button;
|
4
|
import com.github.gwtbootstrap.client.ui.base.IconAnchor;
|
5
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
6
|
import com.google.gwt.core.client.GWT;
|
7
|
import com.google.gwt.dom.client.Document;
|
8
|
import com.google.gwt.dom.client.Style;
|
9
|
import com.google.gwt.event.dom.client.ClickEvent;
|
10
|
import com.google.gwt.event.dom.client.ClickHandler;
|
11
|
import com.google.gwt.user.client.History;
|
12
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
13
|
import com.google.gwt.user.client.ui.FlowPanel;
|
14
|
import com.google.gwt.user.client.ui.HTML;
|
15
|
import com.google.gwt.user.client.ui.Label;
|
16
|
import com.google.gwt.user.client.ui.Widget;
|
17
|
import eu.dnetlib.client.fundingrequest.newrequest.EligibilityDisplayWidget;
|
18
|
import eu.dnetlib.client.fundingrequest.newrequest.EligibilityService;
|
19
|
import eu.dnetlib.client.fundingrequest.newrequest.EligibilityServiceAsync;
|
20
|
import eu.dnetlib.client.widgets.AutoCompleteWidget;
|
21
|
import eu.dnetlib.goldoa.domain.Eligibility;
|
22
|
import eu.dnetlib.goldoa.domain.Request;
|
23
|
import eu.dnetlib.goldoa.domain.Vocabulary;
|
24
|
|
25
|
/**
|
26
|
* Created by stefania on 3/6/15.
|
27
|
*/
|
28
|
public class HomeWidget implements MyWidget {
|
29
|
|
30
|
private FlowPanel homePagePanel = new FlowPanel();
|
31
|
|
32
|
private FlowPanel mainBlock = new FlowPanel();
|
33
|
private FlowPanel mainGrid = new FlowPanel();
|
34
|
|
35
|
private FlowPanel pilotAbout = new FlowPanel();
|
36
|
private Label pilotAboutTitleLabel = new Label();
|
37
|
private HTML pilotAboutContent = new HTML();
|
38
|
private IconAnchor seeDetailedGuidelines = new IconAnchor();
|
39
|
|
40
|
private FlowPanel projectEligibleAndSignIn = new FlowPanel();
|
41
|
private Label projectEligibleTitleLabel = new Label();
|
42
|
private Label projectEligibleInfoLabel = new Label();
|
43
|
private FlowPanel eligibilityPanel = new FlowPanel();
|
44
|
private AutoCompleteWidget projectAutoComplete = new AutoCompleteWidget("project", "Search...");
|
45
|
|
46
|
private Button signIn = new Button();
|
47
|
|
48
|
private FlowPanel secondaryBlock = new FlowPanel();
|
49
|
|
50
|
private FlowPanel researchersPanel = new FlowPanel();
|
51
|
private Label researcherTitleLabel = new Label();
|
52
|
private Label researcherSubTitleLabel = new Label();
|
53
|
private Label researcherInfoLabel = new Label();
|
54
|
|
55
|
private FlowPanel institutionsPanel = new FlowPanel();
|
56
|
private Label institutionTitleLabel = new Label();
|
57
|
private Label institutionSubTitleLabel = new Label();
|
58
|
private Label institutionInfoLabel = new Label();
|
59
|
private IconAnchor viewAllInstitutions = new IconAnchor();
|
60
|
|
61
|
private FlowPanel publishersPanel = new FlowPanel();
|
62
|
private Label publisherTitleLabel = new Label();
|
63
|
private Label publisherSubTitleLabel = new Label();
|
64
|
private Label publisherInfoLabel = new Label();
|
65
|
|
66
|
private EligibilityServiceAsync eligibilityService = GWT.create(EligibilityService.class);
|
67
|
|
68
|
public HomeWidget() {
|
69
|
|
70
|
homePagePanel.addStyleName("homePage");
|
71
|
|
72
|
mainBlock.addStyleName("content");
|
73
|
mainGrid.addStyleName("uk-grid");
|
74
|
mainGrid.addStyleName("uk-grid-divider");
|
75
|
|
76
|
pilotAbout.addStyleName("uk-width-medium-2-3");
|
77
|
|
78
|
pilotAboutTitleLabel.addStyleName("contentTitleLabel");
|
79
|
pilotAboutTitleLabel.setText("What is the pilot about?");
|
80
|
|
81
|
pilotAboutContent.addStyleName("contentInfoLabel");
|
82
|
String pilotAboutContentHTML = "<p>The EC is making <span class=\"strong\">4 million Euros</span> available to support " +
|
83
|
"Open Access publications arising from post-grant FP7 projects (i.e. past their nominal end-date).</p>" +
|
84
|
"<p>Up to three publications will be funded of FP7 projects that are invoiced no more than 2 years after end of the project. " +
|
85
|
"These can be research articles, conference proceedings, book chapters or monographs.</p>" +
|
86
|
"<p>The Pilot, to be launched at the end of April, will support eligible funding claims arriving both " +
|
87
|
"from institutions and researchers.</p>";
|
88
|
pilotAboutContent.setHTML(pilotAboutContentHTML);
|
89
|
|
90
|
seeDetailedGuidelines.setText("See the detailed guidelines and technical requirements for funding collection");
|
91
|
seeDetailedGuidelines.addStyleName("emphasis");
|
92
|
|
93
|
pilotAbout.add(pilotAboutTitleLabel);
|
94
|
pilotAbout.add(pilotAboutContent);
|
95
|
pilotAbout.add(seeDetailedGuidelines);
|
96
|
|
97
|
projectEligibleAndSignIn.addStyleName("uk-width-medium-1-3");
|
98
|
|
99
|
projectEligibleTitleLabel.addStyleName("contentTitleLabel");
|
100
|
projectEligibleTitleLabel.setText("Is your project eligible?");
|
101
|
|
102
|
projectEligibleInfoLabel.addStyleName("contentInfoLabel");
|
103
|
projectEligibleInfoLabel.setText("Type your FP7 project name or grant id and see if you can request funding for " +
|
104
|
"your publication");
|
105
|
|
106
|
AutoCompleteWidget.AutoCompleteListener projectAutoCompleteListener = new AutoCompleteWidget.AutoCompleteListener() {
|
107
|
@Override
|
108
|
public void valueSelected(Vocabulary vocabulary) {
|
109
|
|
110
|
final HTML loadingWheel = new HTML("<div class=\"loader\"></div><div class=\"whiteFilm\"></div>");
|
111
|
eligibilityPanel.addStyleName("loading-small");
|
112
|
eligibilityPanel.add(loadingWheel);
|
113
|
|
114
|
Request request = new Request();
|
115
|
request.setProject(vocabulary.getId());
|
116
|
|
117
|
eligibilityService.validate(request, new AsyncCallback<Eligibility>() {
|
118
|
|
119
|
@Override
|
120
|
public void onFailure(Throwable throwable) {
|
121
|
|
122
|
eligibilityPanel.removeStyleName("loading-small");
|
123
|
|
124
|
eligibilityPanel.clear();
|
125
|
EligibilityDisplayWidget eligibilityDisplayWidget = new EligibilityDisplayWidget(null);
|
126
|
eligibilityPanel.add(eligibilityDisplayWidget.asWidget());
|
127
|
}
|
128
|
|
129
|
@Override
|
130
|
public void onSuccess(Eligibility eligibility) {
|
131
|
|
132
|
eligibilityPanel.removeStyleName("loading-small");
|
133
|
|
134
|
eligibilityPanel.clear();
|
135
|
EligibilityDisplayWidget eligibilityDisplayWidget = new EligibilityDisplayWidget(eligibility);
|
136
|
eligibilityPanel.add(eligibilityDisplayWidget.asWidget());
|
137
|
}
|
138
|
});
|
139
|
}
|
140
|
};
|
141
|
projectAutoComplete.setAutoCompleteListener(projectAutoCompleteListener);
|
142
|
|
143
|
signIn.addStyleName("signIn");
|
144
|
signIn.setText("Sign In");
|
145
|
signIn.setType(ButtonType.PRIMARY);
|
146
|
signIn.addClickHandler(new ClickHandler() {
|
147
|
@Override
|
148
|
public void onClick(ClickEvent clickEvent) {
|
149
|
History.newItem("login");
|
150
|
}
|
151
|
});
|
152
|
|
153
|
projectEligibleAndSignIn.add(projectEligibleTitleLabel);
|
154
|
projectEligibleAndSignIn.add(projectEligibleInfoLabel);
|
155
|
projectEligibleAndSignIn.add(projectAutoComplete);
|
156
|
projectEligibleAndSignIn.add(eligibilityPanel);
|
157
|
|
158
|
mainGrid.add(pilotAbout);
|
159
|
mainGrid.add(projectEligibleAndSignIn);
|
160
|
|
161
|
mainBlock.add(mainGrid);
|
162
|
|
163
|
|
164
|
researchersPanel.addStyleName("inlineBlock");
|
165
|
researchersPanel.addStyleName("width25");
|
166
|
researchersPanel.addStyleName("content");
|
167
|
researchersPanel.addStyleName("smallContentPanel");
|
168
|
|
169
|
researcherTitleLabel.addStyleName("contentTitleLabel");
|
170
|
researcherTitleLabel.setText("Researchers");
|
171
|
|
172
|
researcherSubTitleLabel.addStyleName("contentTitleLabel");
|
173
|
researcherSubTitleLabel.setText("What's in it for you?");
|
174
|
|
175
|
researcherInfoLabel.addStyleName("contentInfoLabel");
|
176
|
researcherInfoLabel.setText("If you have post-grant FP7 publications in the pipeline, there is funding available " +
|
177
|
"for publishing them Open Access. Check with your Library/Research Office for more details and for the " +
|
178
|
"possibility of adding this funding to any other already available funding option at your institution.");
|
179
|
|
180
|
researchersPanel.add(researcherTitleLabel);
|
181
|
researchersPanel.add(researcherSubTitleLabel);
|
182
|
researchersPanel.add(researcherInfoLabel);
|
183
|
|
184
|
|
185
|
institutionsPanel.addStyleName("inlineBlock");
|
186
|
institutionsPanel.addStyleName("width25");
|
187
|
institutionsPanel.addStyleName("content");
|
188
|
institutionsPanel.addStyleName("smallContentPanel");
|
189
|
|
190
|
institutionTitleLabel.addStyleName("contentTitleLabel");
|
191
|
institutionTitleLabel.setText("Institutions");
|
192
|
|
193
|
institutionSubTitleLabel.addStyleName("contentTitleLabel");
|
194
|
institutionSubTitleLabel.setText("How to get involved");
|
195
|
|
196
|
institutionInfoLabel.addStyleName("contentInfoLabel");
|
197
|
institutionInfoLabel.setText("Ten universities and research centres across Europe have been selected for collaborating " +
|
198
|
"in the Pilot kick-off stage by aligning their outreach strategies towards researchers and their reporting " +
|
199
|
"standards. These institutions will also test the workflows for collecting funding requests and managing " +
|
200
|
"APC payments. Feedback will be provided from them on a specific Gold OA Pilot Workshop next June. In the " +
|
201
|
"meantime, OpenAIRE NOADs will be able to provide more information.");
|
202
|
|
203
|
viewAllInstitutions.setText("View all participating institutions...");
|
204
|
|
205
|
institutionsPanel.add(institutionTitleLabel);
|
206
|
institutionsPanel.add(institutionSubTitleLabel);
|
207
|
institutionsPanel.add(institutionInfoLabel);
|
208
|
institutionsPanel.add(viewAllInstitutions);
|
209
|
|
210
|
|
211
|
publishersPanel.addStyleName("inlineBlock");
|
212
|
publishersPanel.addStyleName("width25");
|
213
|
publishersPanel.addStyleName("content");
|
214
|
publishersPanel.addStyleName("smallContentPanel");
|
215
|
|
216
|
publisherTitleLabel.addStyleName("contentTitleLabel");
|
217
|
publisherTitleLabel.setText("Publishers");
|
218
|
|
219
|
publisherSubTitleLabel.addStyleName("contentTitleLabel");
|
220
|
publisherSubTitleLabel.setText("Get in contact");
|
221
|
|
222
|
publisherInfoLabel.addStyleName("contentInfoLabel");
|
223
|
publisherInfoLabel.setText("The Pilot will closely work with publishers in order to make sure the technical requirements " +
|
224
|
"are met for collecting the funding and to rely on them for dissemination purposes towards their authors. " +
|
225
|
"Please get in contact in order to express your interest in this initiative and find out more about the " +
|
226
|
"opportunities for funding it provides.");
|
227
|
|
228
|
publishersPanel.add(publisherTitleLabel);
|
229
|
publishersPanel.add(publisherSubTitleLabel);
|
230
|
publishersPanel.add(publisherInfoLabel);
|
231
|
|
232
|
|
233
|
secondaryBlock.addStyleName("secondaryBlock");
|
234
|
secondaryBlock.add(researchersPanel);
|
235
|
secondaryBlock.add(institutionsPanel);
|
236
|
secondaryBlock.add(publishersPanel);
|
237
|
|
238
|
|
239
|
homePagePanel.add(mainBlock);
|
240
|
homePagePanel.add(secondaryBlock);
|
241
|
}
|
242
|
|
243
|
@Override
|
244
|
public Widget asWidget() {
|
245
|
return homePagePanel;
|
246
|
}
|
247
|
|
248
|
@Override
|
249
|
public void clear() {
|
250
|
|
251
|
}
|
252
|
|
253
|
@Override
|
254
|
public void reload() {
|
255
|
|
256
|
Document.get().getElementById("content").removeClassName("uk-width-medium-3-4");
|
257
|
Document.get().getElementById("content").addClassName("uk-width-medium-1-1");
|
258
|
Document.get().getElementById("sidebar").getStyle().setDisplay(Style.Display.NONE);
|
259
|
|
260
|
if(GoldOAPortal.currentUser==null) {
|
261
|
projectEligibleAndSignIn.add(signIn);
|
262
|
} else {
|
263
|
projectEligibleAndSignIn.remove(signIn);
|
264
|
}
|
265
|
}
|
266
|
|
267
|
@Override
|
268
|
public void setToken(String token) {
|
269
|
|
270
|
}
|
271
|
}
|