Revision 49691
Added by Antonis Lempesis over 6 years ago
InstructionsForMetricsWidget.java | ||
---|---|---|
5 | 5 |
import com.google.gwt.event.dom.client.ClickEvent; |
6 | 6 |
import com.google.gwt.event.dom.client.ClickHandler; |
7 | 7 |
import com.google.gwt.user.client.History; |
8 |
import com.google.gwt.user.client.Window; |
|
8 | 9 |
import com.google.gwt.user.client.rpc.AsyncCallback; |
9 | 10 |
import com.google.gwt.user.client.ui.FlowPanel; |
10 | 11 |
import com.google.gwt.user.client.ui.HTML; |
... | ... | |
94 | 95 |
@Override |
95 | 96 |
public void onSuccess(final Repository repository) { |
96 | 97 |
|
97 |
repositoryService.getPiwikScriptForRepository(repositoryId, new AsyncCallback<String>() {
|
|
98 |
instructionsForMetricsBoxContent.add(showInstructions());
|
|
98 | 99 |
|
99 |
@Override
|
|
100 |
public void onFailure(Throwable caught) {
|
|
100 |
instructionsForMetricsBoxContent.removeStyleName("loading-big");
|
|
101 |
instructionsForMetricsBoxContent.remove(loadingWheel);
|
|
101 | 102 |
|
102 |
instructionsForMetricsBoxContent.removeStyleName("loading-big"); |
|
103 |
instructionsForMetricsBoxContent.remove(loadingWheel); |
|
103 |
Window.moveTo(0,0); |
|
104 | 104 |
|
105 |
errorAlert.setText("System error retrieving piwik script for this repository"); |
|
106 |
errorAlert.setVisible(true); |
|
107 |
} |
|
108 |
|
|
109 |
@Override |
|
110 |
public void onSuccess(String piwikScript) { |
|
111 |
|
|
112 |
// RepositoryManager.pageHeader.clear(); |
|
113 |
// String logoURLSource = ""; |
|
114 |
// if(repository.getLogoUrl()==null || repository.getLogoUrl().isEmpty()) |
|
115 |
// logoURLSource = "img/yourLogoHere.jpg"; |
|
116 |
// else |
|
117 |
// logoURLSource = repository.getLogoUrl(); |
|
105 |
// repositoryService.getPiwikScriptForRepository(repositoryId, new AsyncCallback<String>() { |
|
118 | 106 |
// |
119 |
// RepositoryManager.pageHeader.add(new HTML("<div class=\"col-sm-9\"><h2><img src=\"" + logoURLSource + "\" alt=[Repo Logo]" + |
|
120 |
// "width=\"35px\" height=\"35px\" style=\"margin-right: 15px; margin-top:-2px\">Enable metrics for " + repository.getOfficialName() + "</h2>" + |
|
121 |
// "<ol class=\"breadcrumb\"><li><a href=\"#dashboard\">Home</a></li><li><a href=\"#" + parentToken + |
|
122 |
// "\">Metrics</a></li><li><a href=\"#" + parentToken + "/" + repositoryId + "\">" + repository.getOfficialName() + "</a>" + |
|
123 |
// "</li><li class=\"active\"><strong>Instructions</strong></li></ol></div><div class=\"col-sm-3\"></div>")); |
|
124 |
|
|
125 |
instructionsForMetricsBoxContent.removeStyleName("loading-big"); |
|
126 |
instructionsForMetricsBoxContent.remove(loadingWheel); |
|
127 |
|
|
128 |
if(piwikScript!=null) |
|
129 |
instructionsForMetricsBoxContent.add(showInstructions(piwikScript)); |
|
130 |
else { |
|
131 |
|
|
132 |
Alert infoAlert = new Alert(); |
|
133 |
infoAlert.setType(AlertType.WARNING); |
|
134 |
infoAlert.setDismissable(false); |
|
135 |
infoAlert.setText("Metrics have not yet been enabled for this repository."); |
|
136 |
instructionsForMetricsBoxContent.add(infoAlert); |
|
137 |
|
|
138 |
Button goToEnableMetrics = new Button(); |
|
139 |
goToEnableMetrics.setText("I would like to enable metrics"); |
|
140 |
goToEnableMetrics.setType(ButtonType.PRIMARY); |
|
141 |
goToEnableMetrics.addClickHandler(new ClickHandler() { |
|
142 |
|
|
143 |
@Override |
|
144 |
public void onClick(ClickEvent event) { |
|
145 |
History.newItem("getImpact/" + repository.getId()); |
|
146 |
} |
|
147 |
}); |
|
148 |
instructionsForMetricsBoxContent.add(goToEnableMetrics); |
|
149 |
} |
|
150 |
} |
|
151 |
}); |
|
107 |
// @Override |
|
108 |
// public void onFailure(Throwable caught) { |
|
109 |
// |
|
110 |
// instructionsForMetricsBoxContent.removeStyleName("loading-big"); |
|
111 |
// instructionsForMetricsBoxContent.remove(loadingWheel); |
|
112 |
// |
|
113 |
// errorAlert.setText("System error retrieving piwik script for this repository"); |
|
114 |
// errorAlert.setVisible(true); |
|
115 |
// } |
|
116 |
// |
|
117 |
// @Override |
|
118 |
// public void onSuccess(String piwikScript) { |
|
119 |
// |
|
120 |
//// RepositoryManager.pageHeader.clear(); |
|
121 |
//// String logoURLSource = ""; |
|
122 |
//// if(repository.getLogoUrl()==null || repository.getLogoUrl().isEmpty()) |
|
123 |
//// logoURLSource = "img/yourLogoHere.jpg"; |
|
124 |
//// else |
|
125 |
//// logoURLSource = repository.getLogoUrl(); |
|
126 |
//// |
|
127 |
//// RepositoryManager.pageHeader.add(new HTML("<div class=\"col-sm-9\"><h2><img src=\"" + logoURLSource + "\" alt=[Repo Logo]" + |
|
128 |
//// "width=\"35px\" height=\"35px\" style=\"margin-right: 15px; margin-top:-2px\">Enable metrics for " + repository.getOfficialName() + "</h2>" + |
|
129 |
//// "<ol class=\"breadcrumb\"><li><a href=\"#dashboard\">Home</a></li><li><a href=\"#" + parentToken + |
|
130 |
//// "\">Metrics</a></li><li><a href=\"#" + parentToken + "/" + repositoryId + "\">" + repository.getOfficialName() + "</a>" + |
|
131 |
//// "</li><li class=\"active\"><strong>Instructions</strong></li></ol></div><div class=\"col-sm-3\"></div>")); |
|
132 |
// |
|
133 |
// instructionsForMetricsBoxContent.removeStyleName("loading-big"); |
|
134 |
// instructionsForMetricsBoxContent.remove(loadingWheel); |
|
135 |
// |
|
136 |
// if(piwikScript!=null) |
|
137 |
// instructionsForMetricsBoxContent.add(showInstructions(piwikScript)); |
|
138 |
// else { |
|
139 |
// |
|
140 |
// Alert infoAlert = new Alert(); |
|
141 |
// infoAlert.setType(AlertType.WARNING); |
|
142 |
// infoAlert.setDismissable(false); |
|
143 |
// infoAlert.setText("Metrics have not yet been enabled for this repository."); |
|
144 |
// instructionsForMetricsBoxContent.add(infoAlert); |
|
145 |
// |
|
146 |
// Button goToEnableMetrics = new Button(); |
|
147 |
// goToEnableMetrics.setText("I would like to enable metrics"); |
|
148 |
// goToEnableMetrics.setType(ButtonType.PRIMARY); |
|
149 |
// goToEnableMetrics.addClickHandler(new ClickHandler() { |
|
150 |
// |
|
151 |
// @Override |
|
152 |
// public void onClick(ClickEvent event) { |
|
153 |
// History.newItem("getImpact/" + repository.getId()); |
|
154 |
// } |
|
155 |
// }); |
|
156 |
// instructionsForMetricsBoxContent.add(goToEnableMetrics); |
|
157 |
// } |
|
158 |
// } |
|
159 |
// }); |
|
152 | 160 |
} |
153 | 161 |
}); |
154 | 162 |
} |
... | ... | |
167 | 175 |
|
168 | 176 |
} |
169 | 177 |
|
170 |
private FlowPanel showInstructions(String piwikScript) {
|
|
178 |
private FlowPanel showInstructions() { |
|
171 | 179 |
|
172 | 180 |
FlowPanel instructionsPanel = new FlowPanel(); |
173 | 181 |
|
174 |
String instructions = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac nulla eget ligula " + |
|
175 |
"ultrices finibus. Integer eu convallis sapien. Fusce sit amet quam lacus. In dictum, ante sed mattis vulputate, " + |
|
176 |
"orci dolor suscipit quam, faucibus blandit enim tellus et tellus. Duis quis sem orci. Integer non tortor sed " + |
|
177 |
"elit sagittis vestibulum. Aenean pulvinar accumsan turpis, ut aliquam dolor aliquam eu. Integer enim dui, " + |
|
178 |
"mollis in lacinia id, sagittis interdum nibh. Suspendisse ullamcorper, diam sed consequat finibus, justo odio " + |
|
179 |
"iaculis elit, non bibendum mauris sem ut dolor.</p>"; |
|
182 |
String instructions = "<p>OpenAIRE's usage statistics service tracking code is maintained on Github as a patch for " + |
|
183 |
"various versions of DSpace (<a target=\"_blank\" href=\"https://github.com/dimitrispie/OpenAIRE-Piwik-DSpace\">" + |
|
184 |
"https://github.com/dimitrispie/OpenAIRE-Piwik-DSpace</a>) and as an Eprints plugin for version 3 " + |
|
185 |
"(<a target=\"_blank\" href=\"https://github.com/dimitrispie/EPrints-OAPiwik\">https://github.com/dimitrispie/EPrints-OAPiwik</a>).</p>"; |
|
180 | 186 |
|
181 |
instructions += "<pre>" + piwikScript + "</pre>"; |
|
182 |
|
|
183 |
instructions += "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac nulla eget ligula " + |
|
184 |
"ultrices finibus. Integer eu convallis sapien. Fusce sit amet quam lacus. In dictum, ante sed mattis vulputate, " + |
|
185 |
"orci dolor suscipit quam, faucibus blandit enim tellus et tellus. Duis quis sem orci. Integer non tortor sed " + |
|
186 |
"elit sagittis vestibulum. Aenean pulvinar accumsan turpis, ut aliquam dolor aliquam eu. Integer enim dui, " + |
|
187 |
"mollis in lacinia id, sagittis interdum nibh. Suspendisse ullamcorper, diam sed consequat finibus, justo odio " + |
|
188 |
"iaculis elit, non bibendum mauris sem ut dolor.</p>"; |
|
189 |
|
|
190 | 187 |
HTML instructionsHTML = new HTML(); |
191 | 188 |
instructionsHTML.setHTML(instructions); |
192 | 189 |
instructionsPanel.add(instructionsHTML); |
193 | 190 |
|
194 | 191 |
return instructionsPanel; |
195 | 192 |
} |
193 |
|
|
194 |
// private FlowPanel showInstructions(String piwikScript) { |
|
195 |
// |
|
196 |
// FlowPanel instructionsPanel = new FlowPanel(); |
|
197 |
// |
|
198 |
// String instructions = "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac nulla eget ligula " + |
|
199 |
// "ultrices finibus. Integer eu convallis sapien. Fusce sit amet quam lacus. In dictum, ante sed mattis vulputate, " + |
|
200 |
// "orci dolor suscipit quam, faucibus blandit enim tellus et tellus. Duis quis sem orci. Integer non tortor sed " + |
|
201 |
// "elit sagittis vestibulum. Aenean pulvinar accumsan turpis, ut aliquam dolor aliquam eu. Integer enim dui, " + |
|
202 |
// "mollis in lacinia id, sagittis interdum nibh. Suspendisse ullamcorper, diam sed consequat finibus, justo odio " + |
|
203 |
// "iaculis elit, non bibendum mauris sem ut dolor.</p>"; |
|
204 |
// |
|
205 |
// instructions += "<pre>" + piwikScript + "</pre>"; |
|
206 |
// |
|
207 |
// instructions += "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac nulla eget ligula " + |
|
208 |
// "ultrices finibus. Integer eu convallis sapien. Fusce sit amet quam lacus. In dictum, ante sed mattis vulputate, " + |
|
209 |
// "orci dolor suscipit quam, faucibus blandit enim tellus et tellus. Duis quis sem orci. Integer non tortor sed " + |
|
210 |
// "elit sagittis vestibulum. Aenean pulvinar accumsan turpis, ut aliquam dolor aliquam eu. Integer enim dui, " + |
|
211 |
// "mollis in lacinia id, sagittis interdum nibh. Suspendisse ullamcorper, diam sed consequat finibus, justo odio " + |
|
212 |
// "iaculis elit, non bibendum mauris sem ut dolor.</p>"; |
|
213 |
// |
|
214 |
// HTML instructionsHTML = new HTML(); |
|
215 |
// instructionsHTML.setHTML(instructions); |
|
216 |
// instructionsPanel.add(instructionsHTML); |
|
217 |
// |
|
218 |
// return instructionsPanel; |
|
219 |
// } |
|
196 | 220 |
} |
Also available in: Unified diff
svn merge -r49522:HEAD https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-repository-manager-gui/trunk .