1 | <%@ page import="com.ether.WebHelper" %> |
---|
2 | <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> |
---|
3 | |
---|
4 | <script type="text/javascript"> |
---|
5 | |
---|
6 | var InterfaceStatistics = Class.create( { |
---|
7 | initialize: function() |
---|
8 | { |
---|
9 | /** *********** CONTAINERS *********** **/ |
---|
10 | this.parent = $( "#containerMiddle" ); |
---|
11 | this.containerMenu = $( "#menuLogo" ); |
---|
12 | this.containerErrors = $( "#errors" ); |
---|
13 | |
---|
14 | /** *********** VARIABLES *********** **/ |
---|
15 | this.language = '<spring:message code="language"/>'; |
---|
16 | this.webmaster = "<%=WebHelper.getProperty(request, "mail.webmaster")%>"; |
---|
17 | this.jSONUser = <%=WebHelper.getJSONUser( request )%> ? <%=WebHelper.getJSONUser( request )%> : false; |
---|
18 | this.logoSizeSmall = 30; |
---|
19 | this.logoSizeBig = 50; |
---|
20 | |
---|
21 | this.projectsArray = [ |
---|
22 | {id:"ETHER", img:"logo_Ether_50.jpg", top:"-16px", left:"125px"}, |
---|
23 | {id:"NDACC", img:"logo_Ndacc_50.jpg", top:"1.66667px", left:"46.3334px"}, |
---|
24 | {id:"ECCAD", img:"logo_ECCAD_50.gif", top:"39.3333px", left:"109.333px"}, |
---|
25 | {id:"IASI", img:"logo_iasi_50.jpg", top:"-78.6667px", left:"77.6666px"}, |
---|
26 | {id:"GOSAT", img:"logo_gosat_50.jpg", top:"-0.333328px", left:"200.667px"}, |
---|
27 | {id:"IAGOS", img:"logo_Iagos_50.jpg", top:"36px", left:"138px"}, |
---|
28 | {id:"TROPICO", img:"logo_tropico_50.jpg", top:"-74px", left:"45px"}, |
---|
29 | {id:"MEGAPOLI", img:"logo_Megapoli_50.png", top:"-74.3333px", left:"15.3333px"}, |
---|
30 | {id:"MIMOSA", img:"logo_mimosa_50.png", top:"-45.6667px", left:"76.3334px"}, |
---|
31 | {id:"REPROBUS", img:"logo_reprobus_50.png", top:"-48px", left:"161.667px"}, |
---|
32 | {id:"GEISA", img:"logo_geisa_50.jpg", top:"22px", left:"167.667px"}, |
---|
33 | {id:"TAPAS", img:"logo_tapas_50.png", top:"58.3333px", left:"125px"}, |
---|
34 | {id:"OUTREACH", img:"logo_acomida_50.jpg", top:"-77.3333px", left:"225px"}, |
---|
35 | {id:"OMER7A", img:"logo_omer7A_50.jpg", top:"22.6667px", left:"76.3334px"}, |
---|
36 | {id:"GIRAFE", img:"logo_girafe_50.JPG", top:"-79.6667px", left:"192.333px"}, |
---|
37 | {id:"ARLETTY", img:"logo_arletty_50.jpg", top:"-79px", left:"161.667px"} |
---|
38 | ]; |
---|
39 | this.widthInitMentionsOrCredits = $( "#mentions" ).width(); |
---|
40 | |
---|
41 | this.xArray = ["2010-10", "2010-11", "2010-12", "2011-01", "2011-02"]; |
---|
42 | this.yArray = [0, 10, 30, 50, 100]; |
---|
43 | |
---|
44 | this.bindButtons(); |
---|
45 | this.createMenuLogo(); |
---|
46 | |
---|
47 | $( document ).ready( jQuery.proxy( function() |
---|
48 | { |
---|
49 | $( ".containerToDrag" ).draggable(); |
---|
50 | // Menu |
---|
51 | this.animateMenuLogos(); |
---|
52 | this.bindMenuLogos(); |
---|
53 | this.createRightSlide(); |
---|
54 | |
---|
55 | if( !this.jSONUser ) |
---|
56 | this.onClickHelp(); |
---|
57 | else |
---|
58 | this.handleLogin(); |
---|
59 | }, this ) ); |
---|
60 | }, |
---|
61 | |
---|
62 | |
---|
63 | // CREATES AND BINDS ******************************************************** |
---|
64 | bindButtons: function() |
---|
65 | { |
---|
66 | $( "#home_button" ).bind( "dblclick", this.onClickHome ); |
---|
67 | $( "#language_button" ).bind( "dblclick", jQuery.proxy( this.onClickLanguage, this ) ); |
---|
68 | $( "#mail_button" ).bind( "dblclick", jQuery.proxy( this.onClickMail, this ) ); |
---|
69 | $( "#help" ).bind( "click", jQuery.proxy( this.onClickHelp, this ) ); |
---|
70 | $( "#credits" ).bind( "dblclick", jQuery.proxy( this.onClickCredits, this ) ); |
---|
71 | $( "#mentions" ).bind( "dblclick", jQuery.proxy( this.onClickMentions, this ) ); |
---|
72 | $( "#login_button" ).bind( "click", jQuery.proxy( this.onClickLogin, this ) ); |
---|
73 | $( "#logout_button" ).bind( "dblclick", jQuery.proxy( this.onClickLogout, this ) ); |
---|
74 | }, |
---|
75 | |
---|
76 | createMenuLogo: function() |
---|
77 | { |
---|
78 | var initTop = this.projectsArray[0].top; |
---|
79 | var initLeft = this.projectsArray[0].left; |
---|
80 | |
---|
81 | jQuery.each( this.projectsArray, jQuery.proxy( function( i, logo ) |
---|
82 | { |
---|
83 | var divLogo = $( document.createElement( "div" ) ); |
---|
84 | divLogo.addClass( "divLogo containerToDrag" ); |
---|
85 | divLogo.attr( {id:logo.id, style:"position:absolute; top:" + initTop + "; left:" + initLeft} ); |
---|
86 | divLogo.html( '<img id="img_' + logo.id + '"src="resources/images/' + logo.img + '" width="' + this.logoSizeSmall + 'px" height="' + this.logoSizeSmall + 'px"/>' ); |
---|
87 | this.containerMenu.append( divLogo ); |
---|
88 | }, this ) ); |
---|
89 | }, |
---|
90 | |
---|
91 | createAllSlides: function() |
---|
92 | { |
---|
93 | this.leftTopSlide = new DragSlide( {id:"leftTop", parent:this.parent, width:"170", height:"200", top:"140px", left:"53px", |
---|
94 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); |
---|
95 | |
---|
96 | this.leftMiddleSlide = new DragSlide( {id:"leftMiddleSlide", parent:this.parent, width:"170", height:"100", top:"355px", left:"53px", |
---|
97 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); |
---|
98 | this.leftMiddleSlide.setTitle( '<spring:message code="statistics.data"/>' ); |
---|
99 | |
---|
100 | this.leftBottomSlide = new DragSlide( {id:"leftBottomSlide", parent:this.parent, width:"170", height:"100", top:"470px", left:"53px", |
---|
101 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); |
---|
102 | this.leftBottomSlide.setTitle( '<spring:message code="statistics.duration"/>' ); |
---|
103 | |
---|
104 | this.middleSlide = new DragSlide( {id:"middle", parent:this.parent, width:"430", height:"430", top:"140px", left:"245px", |
---|
105 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); |
---|
106 | |
---|
107 | this.rightSlide = new DragSlide( {id:"right", parent:this.parent, width:"200", height:"270", top:"210px", left:"698px", |
---|
108 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); |
---|
109 | |
---|
110 | this.loginSlide = new DragSlide( {id:"loginRight", parent:this.parent, width:"200", height:"25", top:"170px", left:"697px", |
---|
111 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); |
---|
112 | }, |
---|
113 | |
---|
114 | createRightSlide: function() |
---|
115 | { |
---|
116 | this.rightSlide = new DragSlide( {id:"right", parent:this.parent, width:"200", height:"270", top:"210px", left:"698px", |
---|
117 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); |
---|
118 | }, |
---|
119 | |
---|
120 | // REQUESTS ******************************************************** |
---|
121 | requestChangeLocale: function() |
---|
122 | { |
---|
123 | $.ajax( { |
---|
124 | url: "project?methodName=setLocale&language=<spring:message code="label.language.value.to.switch"/>", |
---|
125 | success:function() |
---|
126 | { |
---|
127 | location.reload(); |
---|
128 | }, |
---|
129 | error: jQuery.proxy( this.showErrors, [this] ) |
---|
130 | } ); |
---|
131 | }, |
---|
132 | |
---|
133 | requestLogin: function() |
---|
134 | { |
---|
135 | var login = $( "#loginValue" ).val(); |
---|
136 | var pwd = $( "#pwdValue" ).val(); |
---|
137 | $.ajax( { |
---|
138 | url: "project?methodName=login&login=" + login + "&pwd=" + pwd, |
---|
139 | dataType: 'json', // Info needed since jquery.1.7 !! |
---|
140 | success:jQuery.proxy( this.handleLogin, this ), |
---|
141 | error: jQuery.proxy( this.showErrors, [this, "489px", "566px"] ) |
---|
142 | } ); |
---|
143 | }, |
---|
144 | |
---|
145 | requestLogout: function() |
---|
146 | { |
---|
147 | $.ajax( { |
---|
148 | url: "project?methodName=logout", |
---|
149 | dataType: 'json', // Info needed since jquery.1.7 !! |
---|
150 | success:jQuery.proxy( this.handleLogout, this ), |
---|
151 | error: jQuery.proxy( this.showErrors, [this] ) |
---|
152 | } ); |
---|
153 | }, |
---|
154 | |
---|
155 | requestDataByLogo: function() |
---|
156 | { |
---|
157 | if( !this.selectedLogo && !this.selectedLogo.id ) |
---|
158 | return; |
---|
159 | |
---|
160 | $.ajax( { |
---|
161 | url: "statistic?methodName=searchMainStatisticsByProject&name=" + this.selectedLogo.id, |
---|
162 | success:jQuery.proxy( this.handleDataByLogo, this ), |
---|
163 | error: jQuery.proxy( this.showLoginError, this ) |
---|
164 | } ); |
---|
165 | }, |
---|
166 | |
---|
167 | // HANDLES ******************************************************** |
---|
168 | handleDataByLogo: function( result ) |
---|
169 | { |
---|
170 | this.changeLeftTopSlide(); |
---|
171 | this.changeLeftMiddleSlide(); |
---|
172 | this.changeLeftBottomSlide(); |
---|
173 | this.displayVisit(); |
---|
174 | }, |
---|
175 | |
---|
176 | handleLogin: function( result ) |
---|
177 | { |
---|
178 | this.containerErrors.empty(); |
---|
179 | this.containerErrors.css( "visibility", "hidden" ); |
---|
180 | |
---|
181 | if( result ) |
---|
182 | this.jSONUser = result.jSONUser; |
---|
183 | |
---|
184 | $( "#loginValue" ).val( "" ); |
---|
185 | $( "#pwdValue" ).val( "" ); |
---|
186 | $( "#login_text" ).css( "visibility", "hidden" ); |
---|
187 | $( "#login" ).animate( { |
---|
188 | top:'47px', |
---|
189 | left:'126px' |
---|
190 | }, 2000, function() |
---|
191 | { |
---|
192 | } ); |
---|
193 | |
---|
194 | $( "#login_bg" ).animate( { |
---|
195 | opacity: 1, |
---|
196 | height:'60px', |
---|
197 | width:'67px' |
---|
198 | }, 2000, function() |
---|
199 | { |
---|
200 | } ); |
---|
201 | |
---|
202 | $( "#login_img" ).animate( { |
---|
203 | top:'25px', |
---|
204 | left: '16px', |
---|
205 | width: '0', |
---|
206 | height: '0' |
---|
207 | }, 2000, jQuery.proxy( function() |
---|
208 | { |
---|
209 | // Slides |
---|
210 | this.parent.empty(); |
---|
211 | this.createAllSlides(); |
---|
212 | this.changeRightSlide(); |
---|
213 | |
---|
214 | // User |
---|
215 | if( this.jSONUser.name ) |
---|
216 | this.loginSlide.setTitle( this.jSONUser.name ); |
---|
217 | else |
---|
218 | this.loginSlide.setTitle( '<spring:message code="label.unknown"/>' ); |
---|
219 | $( "#logout_button" ).css( "visibility", "visible" ); |
---|
220 | |
---|
221 | // Logo |
---|
222 | this.selectedLogo = $( "#ETHER" )[0]; |
---|
223 | this.isSelectedLogoEther = true; |
---|
224 | this.onClickLogo(); |
---|
225 | }, this ) ); |
---|
226 | }, |
---|
227 | |
---|
228 | handleLogout: function() |
---|
229 | { |
---|
230 | this.jSONUser = false; |
---|
231 | this.parent.empty(); |
---|
232 | this.createRightSlide(); |
---|
233 | this.onClickHelp(); |
---|
234 | |
---|
235 | $( "#logout_button" ).css( "visibility", "hidden" ); |
---|
236 | $( "#login" ).css( { zIndex:1 } ).animate( { |
---|
237 | top:'79px', |
---|
238 | left:'88px' |
---|
239 | }, 2000, function() |
---|
240 | { |
---|
241 | } ); |
---|
242 | |
---|
243 | $( "#login_bg" ).animate( { |
---|
244 | opacity: 0.85, |
---|
245 | height:'500px', |
---|
246 | width:'500px' |
---|
247 | }, 2000, function() |
---|
248 | { |
---|
249 | $( "#login_text" ).css( "visibility", "visible" ); |
---|
250 | } ); |
---|
251 | |
---|
252 | $( "#login_img" ).animate( { |
---|
253 | top:'103px', |
---|
254 | left: '148px', |
---|
255 | width: '30px', |
---|
256 | height: '30px' |
---|
257 | }, 2000, function() |
---|
258 | { |
---|
259 | } ); |
---|
260 | }, |
---|
261 | |
---|
262 | // EVENTS ******************************************************** |
---|
263 | onClickHome: function() |
---|
264 | { |
---|
265 | location.reload(); |
---|
266 | }, |
---|
267 | |
---|
268 | onClickLanguage: function() |
---|
269 | { |
---|
270 | this.requestChangeLocale(); |
---|
271 | }, |
---|
272 | |
---|
273 | onClickMail: function() |
---|
274 | { |
---|
275 | document.location.href = "mailto:" + this.webmaster + "?subject=[STATISTICS]"; |
---|
276 | }, |
---|
277 | |
---|
278 | onClickMentions: function() |
---|
279 | { |
---|
280 | if( this.widthInitMentionsOrCredits == $( "#mentions" ).width() ) |
---|
281 | this.enlargeCreditsOrMentions( $( "#mentions" ), $( "#mentions_bg" ), $( "#mentions_text" ), $( "#mentions_title" ), "project/mentions_" + this.language + ".jsp" ); |
---|
282 | else |
---|
283 | this.reduceCreditsOrMentions( $( "#mentions" ), $( "#mentions_bg" ), $( "#mentions_text" ), $( "#mentions_title" ), "project/mentions_" + this.language + ".jsp" ); |
---|
284 | }, |
---|
285 | |
---|
286 | onClickCredits: function() |
---|
287 | { |
---|
288 | if( this.widthInitMentionsOrCredits == $( "#credits" ).width() ) |
---|
289 | this.enlargeCreditsOrMentions( $( "#credits" ), $( "#credits_bg" ), $( "#credits_text" ), $( "#credits_title" ), "project/credits_" + this.language + ".jsp" ); |
---|
290 | else |
---|
291 | this.reduceCreditsOrMentions( $( "#credits" ), $( "#credits_bg" ), $( "#credits_text" ), $( "#credits_title" ), "project/credits_" + this.language + ".jsp" ); |
---|
292 | }, |
---|
293 | |
---|
294 | onClickHelp: function() |
---|
295 | { |
---|
296 | this.rightSlide.setTitle( '<spring:message code="label.help"/>' ); |
---|
297 | this.rightSlide.setContent( "<spring:message code='label.help.content'/>" ); |
---|
298 | if( this.jSONUser ) |
---|
299 | var backHelpButton = new Button( {value:"<spring:message code="label.display.actions"/>", parent:this.rightSlide.getDivContent(), className: "small positive back_button", onClick:jQuery.proxy( this.changeRightSlide, this )} ); |
---|
300 | }, |
---|
301 | |
---|
302 | onClickLogin: function() |
---|
303 | { |
---|
304 | this.containerErrors.empty(); |
---|
305 | this.containerErrors.css( "visibility", "hidden" ); |
---|
306 | this.requestLogin(); |
---|
307 | }, |
---|
308 | |
---|
309 | onClickLogout: function() |
---|
310 | { |
---|
311 | this.requestLogout(); |
---|
312 | }, |
---|
313 | |
---|
314 | onClickLogo: function() |
---|
315 | { |
---|
316 | this.isSelectedLogoEther = (this.selectedLogo == $( "#ETHER" )[0]); |
---|
317 | |
---|
318 | if( this.jSONUser ) |
---|
319 | this.requestDataByLogo(); |
---|
320 | else |
---|
321 | { |
---|
322 | this.showErrors( "<spring:message code="error.connection.need"/>" ); |
---|
323 | this.containerErrors.css( {top:"489px", left:"566px"} ); |
---|
324 | this.containerErrors.css( "visibility", "visible" ); |
---|
325 | } |
---|
326 | }, |
---|
327 | |
---|
328 | onClickPrint: function() |
---|
329 | { |
---|
330 | var printContent = new PrintContent(); |
---|
331 | printContent.addContent( $( "#title" ).clone() ); |
---|
332 | printContent.addContent( this.leftTopSlide.getDivContainer().clone().animate( {'marginLeft' : "+=80px"} ) ); |
---|
333 | printContent.addContent( this.leftMiddleSlide.getDivContainer().clone().animate( {'marginLeft' : "+=80px"} ) ); |
---|
334 | printContent.addContent( this.leftBottomSlide.getDivContainer().clone().animate( {'marginLeft' : "+=80px"} ) ); |
---|
335 | printContent.addContent( this.middleSlide.getDivContainer().clone().animate( {'marginLeft' : "+=120px"} ) ); |
---|
336 | printContent.displayPrintPreview(); |
---|
337 | }, |
---|
338 | |
---|
339 | // OTHERS ******************************************************** |
---|
340 | showErrors: function( result ) |
---|
341 | { |
---|
342 | var context = this[0] ? this[0] : this; |
---|
343 | var topValue = this[1] ? this[1] : false; |
---|
344 | var leftValue = this[2] ? this[2] : false; |
---|
345 | context.containerErrors.show(); |
---|
346 | if( result.responseText && interfaceTexts[result.responseText] ) |
---|
347 | context.containerErrors.html( interfaceTexts[result.responseText] ); |
---|
348 | else if( result.responseText ) |
---|
349 | context.containerErrors.html( result.responseText ); |
---|
350 | else |
---|
351 | context.containerErrors.html( result ); |
---|
352 | if( topValue && leftValue ) |
---|
353 | context.containerErrors.css( {top: topValue, left: leftValue} ); |
---|
354 | context.containerErrors.css( "visibility", "visible" ); |
---|
355 | }, |
---|
356 | |
---|
357 | showLoginError: function( result ) |
---|
358 | { |
---|
359 | this.onClickLogout(); |
---|
360 | this.onClickLogo(); |
---|
361 | }, |
---|
362 | |
---|
363 | reduceCreditsOrMentions: function( div, div_bg, div_text, div_title ) |
---|
364 | { |
---|
365 | div.css( { zIndex:0 } ); |
---|
366 | div_text.css( "visibility", "hidden" ); |
---|
367 | div.animate( { |
---|
368 | left: '+=500', |
---|
369 | top: '+=500' |
---|
370 | }, 2000, function() |
---|
371 | { |
---|
372 | } ); |
---|
373 | div_bg.animate( { |
---|
374 | opacity: 1, |
---|
375 | height:'42px', |
---|
376 | width:this.widthInitMentionsOrCredits + 'px', |
---|
377 | zIndex:'0' |
---|
378 | }, 2000, function() |
---|
379 | { |
---|
380 | div_title.css( "visibility", "visible" ); |
---|
381 | } ); |
---|
382 | }, |
---|
383 | |
---|
384 | enlargeCreditsOrMentions: function( div, div_bg, div_text, div_title, pageToLoad ) |
---|
385 | { |
---|
386 | div_title.css( "visibility", "hidden" ); |
---|
387 | div.css( { zIndex:1 } ); |
---|
388 | div.animate( { |
---|
389 | left: '-=500', |
---|
390 | top: '-=500' |
---|
391 | }, 2000, function() |
---|
392 | { |
---|
393 | } ); |
---|
394 | |
---|
395 | div_bg.animate( { |
---|
396 | opacity: 0.95, |
---|
397 | height:'500px', |
---|
398 | width:'500px' |
---|
399 | }, 2000, function() |
---|
400 | { |
---|
401 | div_text.css( "visibility", "visible" ); |
---|
402 | div_text.load( pageToLoad ); |
---|
403 | } ); |
---|
404 | }, |
---|
405 | |
---|
406 | animateMenuLogos: function() |
---|
407 | { |
---|
408 | jQuery.each( this.projectsArray, jQuery.proxy( function( i, logo ) |
---|
409 | { |
---|
410 | $( "#" + logo.id ).animate( { |
---|
411 | top:logo.top, |
---|
412 | left:logo.left |
---|
413 | }, 5000, function() |
---|
414 | { |
---|
415 | } ); |
---|
416 | }, this ) ); |
---|
417 | }, |
---|
418 | |
---|
419 | bindMenuLogos: function() |
---|
420 | { |
---|
421 | var gap = (this.logoSizeBig - this.logoSizeSmall) / 2; |
---|
422 | var logoSizeBig = this.logoSizeBig + "px"; |
---|
423 | var logoSizeSmall = this.logoSizeSmall + "px"; |
---|
424 | var gridimage; |
---|
425 | |
---|
426 | $( '.divLogo' ).mouseover( function( element ) |
---|
427 | { |
---|
428 | gridimage = $( this ).find( 'img' ); //Define target as a variable |
---|
429 | gridimage.stop().animate( { |
---|
430 | width: logoSizeBig, |
---|
431 | height: logoSizeBig |
---|
432 | }, 150 ); |
---|
433 | $( this ).animate( { |
---|
434 | top: "-=10px", |
---|
435 | left: "-=10px" |
---|
436 | }, 150 ); |
---|
437 | } ); |
---|
438 | |
---|
439 | $( '.divLogo' ).mouseout( function( element ) |
---|
440 | { |
---|
441 | $( this ).animate( { |
---|
442 | top: "+=10px", |
---|
443 | left: "+=10px" |
---|
444 | }, 150 ); |
---|
445 | gridimage.stop().animate( { |
---|
446 | width: logoSizeSmall, |
---|
447 | height:logoSizeSmall |
---|
448 | }, 150 ); |
---|
449 | } ); |
---|
450 | |
---|
451 | $( '.divLogo' ).dblclick( jQuery.proxy( function( element ) |
---|
452 | { |
---|
453 | this.selectedLogo = element.currentTarget; |
---|
454 | this.onClickLogo(); |
---|
455 | }, this ) ); |
---|
456 | }, |
---|
457 | |
---|
458 | changeLeftTopSlide: function() |
---|
459 | { |
---|
460 | this.leftTopSlide.setTitle( '<spring:message code="title"/> : ' + this.selectedLogo.id ); |
---|
461 | this.leftTopSlide.setContent( |
---|
462 | "<spring:message code="statistics.online"/> : 2006/05/08<BR/>" + |
---|
463 | "<span class='text1'><spring:message code="statistics.since"/> : 2009/05/08<BR/><BR/></span>" + |
---|
464 | "<spring:message code="statistics.user.registered"/> : 1500<BR/>" + |
---|
465 | "<spring:message code="statistics.visit"/> : 150<BR/>" ); |
---|
466 | }, |
---|
467 | |
---|
468 | changeLeftMiddleSlide: function() |
---|
469 | { |
---|
470 | this.leftMiddleSlide.setContent( "<spring:message code="statistics.data.download"/> : 15001<BR/><spring:message code="statistics.data.download.size"/> : 50To<BR/>" ); |
---|
471 | }, |
---|
472 | |
---|
473 | changeLeftBottomSlide: function() |
---|
474 | { |
---|
475 | this.leftBottomSlide.setContent( "<spring:message code="statistics.duration.total"/> : 15001''<BR/><spring:message code="statistics.duration.average"/> : 50''<BR/>" ); |
---|
476 | }, |
---|
477 | |
---|
478 | changeRightSlide: function() |
---|
479 | { |
---|
480 | this.rightSlide.setTitle( '<spring:message code="label.actions"/>' ); |
---|
481 | this.rightSlide.getDivContent().empty(); |
---|
482 | new Button( {value:"<spring:message code="statistics.visit"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayVisit, this )} ); |
---|
483 | new Button( {value:"<spring:message code="statistics.user.registered"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayRegisteredUserEvolution, this )} ); |
---|
484 | new Button( {value:"<spring:message code="statistics.user.connected"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayConnectedUserEvolution, this )} ); |
---|
485 | new Button( {value:"<spring:message code="statistics.data.download"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayDownload, this )} ); |
---|
486 | new Button( {value:"<spring:message code="statistics.map.distribution"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayMapDistribution, this )} ); |
---|
487 | new Button( {value:"AWSTATS", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayAwstatsStatistics, this )} ); |
---|
488 | new Button( {value:"<spring:message code="label.print"/>", parent:this.rightSlide.getDivContent(), className: "blue export_button print-preview", onClick:jQuery.proxy( this.onClickPrint, this )} ); |
---|
489 | }, |
---|
490 | |
---|
491 | changeMiddleSlide: function( titleEvolution, titleDistribution ) |
---|
492 | { |
---|
493 | if( this.isSelectedLogoEther ) |
---|
494 | this.middleSlide.setTitle( '<spring:message code="statistics.evolution.distribution"/> : ' + this.selectedLogo.id ); |
---|
495 | else |
---|
496 | this.middleSlide.setTitle( '<spring:message code="statistics.evolution"/> : ' + this.selectedLogo.id ); |
---|
497 | this.middleSlide.getDivContent().empty(); |
---|
498 | |
---|
499 | var linechart = $( document.createElement( "div" ) ); |
---|
500 | linechart.addClass( "ui-widget ui-widget-content ui-corner-all statisticsEther" ); |
---|
501 | linechart.attr( {id:"wijlinechart"} ); |
---|
502 | this.middleSlide.getDivContent().append( linechart ); |
---|
503 | |
---|
504 | var donut = $( document.createElement( "div" ) ); |
---|
505 | donut.addClass( "ui-widget ui-widget-content ui-corner-all statisticsEther" ); |
---|
506 | donut.attr( {id:"wijpiechart"} ); |
---|
507 | this.middleSlide.getDivContent().append( donut ); |
---|
508 | |
---|
509 | this.createLinechart( titleEvolution ); |
---|
510 | if( this.isSelectedLogoEther ) |
---|
511 | this.createDonut( titleDistribution ); |
---|
512 | }, |
---|
513 | |
---|
514 | changeMiddleSlideForMap: function() |
---|
515 | { |
---|
516 | this.middleSlide.setTitle( '<spring:message code="statistics.map.distribution"/> : ' + this.selectedLogo.id ); |
---|
517 | this.middleSlide.getDivContent().empty(); |
---|
518 | }, |
---|
519 | |
---|
520 | |
---|
521 | // STATISTICS ******************************************************** |
---|
522 | createDonut: function( title ) |
---|
523 | { |
---|
524 | $( "#wijpiechart" ).wijpiechart( { |
---|
525 | height: 210, |
---|
526 | width: 400, |
---|
527 | radius: 140, |
---|
528 | legend: { visible: true }, |
---|
529 | hint: { |
---|
530 | content: function () |
---|
531 | { |
---|
532 | return this.data.label + " : " + Globalize.format( this.value / this.total, "p2" ); |
---|
533 | } |
---|
534 | }, |
---|
535 | header: { |
---|
536 | text: title |
---|
537 | }, |
---|
538 | seriesList: [ |
---|
539 | { |
---|
540 | label: "MacBook Pro", |
---|
541 | legendEntry: true, |
---|
542 | data: 46.78, |
---|
543 | offset: 0 |
---|
544 | }, |
---|
545 | { |
---|
546 | label: "iMac", |
---|
547 | legendEntry: true, |
---|
548 | data: 23.18, |
---|
549 | offset: 0 |
---|
550 | }, |
---|
551 | { |
---|
552 | label: "MacBook", |
---|
553 | legendEntry: true, |
---|
554 | data: 20.25, |
---|
555 | offset: 0 |
---|
556 | }, |
---|
557 | { |
---|
558 | label: "Mac Pro", |
---|
559 | legendEntry: true, |
---|
560 | data: 5.41, |
---|
561 | offset: 0 |
---|
562 | }, |
---|
563 | { |
---|
564 | label: "Mac mini", |
---|
565 | legendEntry: true, |
---|
566 | data: 3.44, |
---|
567 | offset: 0 |
---|
568 | } |
---|
569 | ], |
---|
570 | seriesStyles: [ |
---|
571 | { |
---|
572 | fill: "180-rgb(195,255,0)-rgb(175,229,0)", stroke: "rgb(175,229,0)", "stroke-width": 1.5 |
---|
573 | }, |
---|
574 | { |
---|
575 | fill: "90-rgb(142,222,67)-rgb(127,199,60)", stroke: "rgb(127,199,60)", "stroke-width": 1.5 |
---|
576 | }, |
---|
577 | { |
---|
578 | fill: "90-rgb(106,171,167)-rgb(95,153,150)", stroke: "rgb(95,153,150)", "stroke-width": 1.5 |
---|
579 | }, |
---|
580 | { |
---|
581 | fill: "90-rgb(70,106,133)-rgb(62,95,119)", stroke: "rgb(62,95,119)", "stroke-width": 1.5 |
---|
582 | }, |
---|
583 | { |
---|
584 | fill: "90-rgb(166,166,166)-rgb(149,149,149)", stroke: "rgb(149,149,149)", "stroke-width": 1.5 |
---|
585 | } |
---|
586 | ] |
---|
587 | } ); |
---|
588 | }, |
---|
589 | |
---|
590 | createLinechart: function( title ) |
---|
591 | { |
---|
592 | $( "#wijlinechart" ).wijlinechart( { |
---|
593 | height: 200, |
---|
594 | width: 400, |
---|
595 | axis: { |
---|
596 | y: { |
---|
597 | origin: 0 |
---|
598 | } |
---|
599 | }, |
---|
600 | showChartLabels: false, |
---|
601 | header: { |
---|
602 | text: title |
---|
603 | }, |
---|
604 | hint: { |
---|
605 | content: function () |
---|
606 | { |
---|
607 | return this.data.lineSeries.label + '\n' + this.x + '\n' + this.y + ''; |
---|
608 | }, |
---|
609 | contentStyle: { "font-size": 10 }, |
---|
610 | offsetY: -10 |
---|
611 | }, |
---|
612 | legend: { |
---|
613 | visible: false |
---|
614 | }, |
---|
615 | seriesList: [ |
---|
616 | { |
---|
617 | label: "", |
---|
618 | legendEntry: true, |
---|
619 | data: { |
---|
620 | x: this.xArray, |
---|
621 | y: this.yArray |
---|
622 | }, |
---|
623 | markers: { |
---|
624 | visible: true, |
---|
625 | type: "circle" |
---|
626 | } |
---|
627 | } |
---|
628 | ] |
---|
629 | } ); |
---|
630 | }, |
---|
631 | |
---|
632 | displayVisit: function() |
---|
633 | { |
---|
634 | this.changeMiddleSlide( '<spring:message code="statistics.evolution.visit"/>', '<spring:message code="statistics.distribution.visit"/>' ); |
---|
635 | }, |
---|
636 | |
---|
637 | displayRegisteredUserEvolution: function() |
---|
638 | { |
---|
639 | this.changeMiddleSlide( '<spring:message code="statistics.evolution.user.registered"/>', '<spring:message code="statistics.distribution.user.registered"/>' ); |
---|
640 | }, |
---|
641 | |
---|
642 | displayConnectedUserEvolution: function() |
---|
643 | { |
---|
644 | this.changeMiddleSlide( '<spring:message code="statistics.evolution.user.connected"/>', '<spring:message code="statistics.distribution.user.connected"/>' ); |
---|
645 | }, |
---|
646 | |
---|
647 | displayDownload: function() |
---|
648 | { |
---|
649 | this.changeMiddleSlide( '<spring:message code="statistics.evolution.download"/>', '<spring:message code="statistics.distribution.download"/>' ); |
---|
650 | }, |
---|
651 | |
---|
652 | displayMapDistribution: function() |
---|
653 | { |
---|
654 | this.changeMiddleSlideForMap(); |
---|
655 | }, |
---|
656 | |
---|
657 | displayAwstatsStatistics: function() |
---|
658 | { |
---|
659 | |
---|
660 | // var url = 'http://www.pole-ether.fr/cgi-bin/awstats/awstats.pl?config=tapas'; |
---|
661 | var url = "/statistics/project/credits_en.jsp"; |
---|
662 | // var url = "http://localhost/cgi-bin/awstats/awstats.pl?config=megapoli"; |
---|
663 | |
---|
664 | // var jqxhr = jQuery.get( url, function() |
---|
665 | // { |
---|
666 | // } ) |
---|
667 | // .success( function( data ) |
---|
668 | // { |
---|
669 | // $( '#bob' ).html( data ); |
---|
670 | // } ) |
---|
671 | // .error( function( data ) |
---|
672 | // { |
---|
673 | // alert( "error" ); |
---|
674 | // } ) |
---|
675 | // .complete( function( data ) |
---|
676 | // { |
---|
677 | // } ); |
---|
678 | |
---|
679 | $( "#divDialog" ).load( url ); |
---|
680 | |
---|
681 | |
---|
682 | // var $dialog = $( '<div></div>' ) |
---|
683 | // .html( "http://www.pole-ether.fr/cgi-bin/awstats/awstats.pl?config=tapas" ) |
---|
684 | // .dialog( { |
---|
685 | // autoOpen: false, |
---|
686 | // title: "paf", |
---|
687 | // height: 50, |
---|
688 | // width: 400 |
---|
689 | // } ); |
---|
690 | // $dialog.dialog( 'open' ); |
---|
691 | |
---|
692 | // $( '<div>' ).dialog( { |
---|
693 | // modal: true, |
---|
694 | // open: function () |
---|
695 | // { |
---|
696 | // $( this ).load( 'http://www.google.fr' ); |
---|
697 | // }, |
---|
698 | // height: 400, |
---|
699 | // width: 400, |
---|
700 | // title: 'Dynamically Loaded Page' |
---|
701 | // } ); |
---|
702 | |
---|
703 | // $( "#divDialog" ).dialog( { |
---|
704 | // height: 400, |
---|
705 | // width: 500, |
---|
706 | // modal: true |
---|
707 | // } ); |
---|
708 | // $( "#divDialog" ).dialog( "option", "title", "paf" ); |
---|
709 | // $( "#divDialog" ).dialog( "option", "resizable", false ); |
---|
710 | // $( "#divDialog" ).dialog( "option", "buttons", { |
---|
711 | // "Close": function() |
---|
712 | // { |
---|
713 | // $( this ).dialog( "close" ); |
---|
714 | // $( this ).dialog( "destroy" ); |
---|
715 | // } |
---|
716 | // } ); |
---|
717 | // $( "#divDialog" ).load( "http://localhost:8080" ); |
---|
718 | // $( "#divDialog" ).load( "project/credits_en.jsp" ); |
---|
719 | |
---|
720 | // $( "#middle" ).load( 'http://www.google.fr' ); |
---|
721 | // var $dialog = $( '<div></div>' ) |
---|
722 | // .load( 'http://www.google.fr' ) |
---|
723 | // .dialog( { |
---|
724 | // autoOpen: true, |
---|
725 | // title: "hop", |
---|
726 | // height: 400, |
---|
727 | // width: 750 |
---|
728 | // } ); |
---|
729 | // $dialog.dialog( 'open' ); |
---|
730 | |
---|
731 | // $( '#report' ).dialog( { |
---|
732 | // autoOpen: true, |
---|
733 | // bgiframe: true, |
---|
734 | // resizable: true, |
---|
735 | // modal: false, |
---|
736 | // width: 500, |
---|
737 | // title: 'Signaler un problÚme' |
---|
738 | // } ); |
---|
739 | // |
---|
740 | // $( '#report' ).dialog( 'option', 'buttons', { |
---|
741 | // 'Signaler': function() |
---|
742 | // { |
---|
743 | // $( this ).dialog( 'close' ); |
---|
744 | // }, |
---|
745 | // 'Fermer': function() |
---|
746 | // { |
---|
747 | // $( this ).dialog( 'close' ); |
---|
748 | // } |
---|
749 | // } ); |
---|
750 | //// $( '#report' ).load( "http://www.pole-ether.fr/cgi-bin/awstats/awstats.pl?config=tapas" ).dialog( 'open' ); |
---|
751 | // $( '#report' ).load( "http://www.google.fr" ).dialog( 'open' ); |
---|
752 | |
---|
753 | // $.load( "http://www.pole-ether.fr/cgi-bin/awstats/awstats.pl?config=tapas" ).dialog( {modal:true} ); |
---|
754 | // var printContent = new PrintContent(); |
---|
755 | // |
---|
756 | // printContent.addContent( $( "#title" ).clone() ); |
---|
757 | // printContent.addContent( this.leftTopSlide.getDivContainer().clone().animate( {'marginLeft' : "+=80px"} ) ); |
---|
758 | // printContent.addContent( this.leftMiddleSlide.getDivContainer().clone().animate( {'marginLeft' : "+=80px"} ) ); |
---|
759 | // printContent.addContent( this.leftBottomSlide.getDivContainer().clone().animate( {'marginLeft' : "+=80px"} ) ); |
---|
760 | // printContent.addContent( this.middleSlide.getDivContainer().clone().animate( {'marginLeft' : "+=120px"} ) ); |
---|
761 | // printContent.displayPrintPreview(); |
---|
762 | } |
---|
763 | |
---|
764 | } ); |
---|
765 | |
---|
766 | </script> |
---|