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 | this.logoSizeBigger = 50; |
---|
21 | |
---|
22 | this.projectsArray = [ |
---|
23 | {id:"ETHER", img:"logo_Ether_50.jpg", top:"-16px", left:"125px"}, |
---|
24 | {id:"NDACC", img:"logo_Ndacc_50.jpg", top:"1.66667px", left:"46.3334px"}, |
---|
25 | {id:"ECCAD", img:"logo_ECCAD_50.gif", top:"39.3333px", left:"109.333px"}, |
---|
26 | {id:"IASI", img:"logo_iasi_50.jpg", top:"-78.6667px", left:"77.6666px"}, |
---|
27 | {id:"GOSAT", img:"logo_gosat_50.jpg", top:"-0.333328px", left:"200.667px"}, |
---|
28 | {id:"IAGOS", img:"logo_Iagos_50.jpg", top:"36px", left:"138px"}, |
---|
29 | {id:"TROPICO", img:"logo_tropico_50.jpg", top:"-74px", left:"45px"}, |
---|
30 | {id:"MEGAPOLI", img:"logo_Megapoli_50.png", top:"-74.3333px", left:"15.3333px"}, |
---|
31 | {id:"MIMOSA", img:"logo_mimosa_50.png", top:"-45.6667px", left:"76.3334px"}, |
---|
32 | {id:"REPROBUS", img:"logo_reprobus_50.png", top:"-48px", left:"161.667px"}, |
---|
33 | {id:"GEISA", img:"logo_geisa_50.jpg", top:"22px", left:"167.667px"}, |
---|
34 | {id:"TAPAS", img:"logo_tapas_50.png", top:"58.3333px", left:"125px"}, |
---|
35 | {id:"ACOMIDA", img:"logo_acomida_50.jpg", top:"-77.3333px", left:"225px"}, |
---|
36 | {id:"OMER7A", img:"logo_omer7A_50.jpg", top:"22.6667px", left:"76.3334px"}, |
---|
37 | {id:"GIRAFE", img:"logo_girafe_50.JPG", top:"-79.6667px", left:"192.333px"}, |
---|
38 | {id:"ARLETTY", img:"logo_arletty_50.jpg", top:"-79px", left:"161.667px"} |
---|
39 | ]; |
---|
40 | this.widthInitMentionsOrCredits = $( "#mentions" ).width(); |
---|
41 | |
---|
42 | this.xArray = ["2010-10", "2010-11", "2010-12", "2011-01", "2011-02"]; |
---|
43 | this.yArray = [0, 10, 30, 50, 100]; |
---|
44 | |
---|
45 | this.bindButtons(); |
---|
46 | this.createMenuLogo(); |
---|
47 | this.isMonthAndYearSelected = false; |
---|
48 | |
---|
49 | $( document ).ready( jQuery.proxy( function() |
---|
50 | { |
---|
51 | // Menu |
---|
52 | this.animateMenuLogos(); |
---|
53 | this.bindMenuLogos(); |
---|
54 | this.createRightSlide(); |
---|
55 | |
---|
56 | if( !this.jSONUser ) |
---|
57 | this.onClickHelp(); |
---|
58 | else |
---|
59 | this.handleLogin(); |
---|
60 | }, this ) ); |
---|
61 | }, |
---|
62 | |
---|
63 | |
---|
64 | // CREATES AND BINDS ******************************************************** |
---|
65 | bindButtons: function() |
---|
66 | { |
---|
67 | $( "#home_button" ).bind( "click", this.onClickHome ); |
---|
68 | $( "#language_button" ).bind( "click", jQuery.proxy( this.onClickLanguage, this ) ); |
---|
69 | $( "#mail_button" ).bind( "click", jQuery.proxy( this.onClickMail, this ) ); |
---|
70 | $( "#help" ).bind( "click", jQuery.proxy( this.onClickHelp, this ) ); |
---|
71 | $( "#credits" ).bind( "click", jQuery.proxy( this.onClickCredits, this ) ); |
---|
72 | $( "#mentions" ).bind( "click", jQuery.proxy( this.onClickMentions, this ) ); |
---|
73 | $( "#login_button" ).bind( "click", jQuery.proxy( this.onClickLogin, this ) ); |
---|
74 | $( "#logout_button" ).bind( "click", jQuery.proxy( this.onClickLogout, this ) ); |
---|
75 | }, |
---|
76 | |
---|
77 | createMenuLogo: function() |
---|
78 | { |
---|
79 | var initTop = this.projectsArray[0].top; |
---|
80 | var initLeft = this.projectsArray[0].left; |
---|
81 | |
---|
82 | jQuery.each( this.projectsArray, jQuery.proxy( function( i, logo ) |
---|
83 | { |
---|
84 | var divLogo = $( document.createElement( "div" ) ); |
---|
85 | divLogo.addClass( "divLogo" ); |
---|
86 | divLogo.attr( {id:logo.id, style:"position:absolute; top:" + initTop + "; left:" + initLeft} ); |
---|
87 | divLogo.html( '<img id="img_' + logo.id + '"src="resources/images/' + logo.img + '" width="' + this.logoSizeSmall + 'px" height="' + this.logoSizeSmall + 'px"/>' ); |
---|
88 | this.containerMenu.append( divLogo ); |
---|
89 | }, this ) ); |
---|
90 | }, |
---|
91 | |
---|
92 | createAllSlides: function() |
---|
93 | { |
---|
94 | this.middleSlide = new DragSlide( {id:"middle", parent:this.parent, width:"700", height:"550", top:"150px", left:"38px", |
---|
95 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); |
---|
96 | |
---|
97 | this.rightSlide = new DragSlide( {id:"right", parent:this.parent, width:"180", height:"325", top:"212px", left:"750px", |
---|
98 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); |
---|
99 | |
---|
100 | this.loginSlide = new DragSlide( {id:"loginMiddle", parent:this.parent, width:"150", height:"25", top:"115px", left:"39px", |
---|
101 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent", activeDbClick:"None"} ); |
---|
102 | |
---|
103 | this.projectsSlide = new DragSlide( {id:"projectsMiddle", parent:this.parent, width:"180", height:"390", top:"175px", left:"750px", |
---|
104 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); |
---|
105 | }, |
---|
106 | |
---|
107 | createRightSlide: function() |
---|
108 | { |
---|
109 | this.rightSlide = new DragSlide( {id:"right", parent:this.parent, width:"180", height:"320", top:"175px", left:"750px", |
---|
110 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent"} ); |
---|
111 | }, |
---|
112 | |
---|
113 | createProjectsSlide: function() |
---|
114 | { |
---|
115 | this.projectsSlide.setTitle( '<spring:message code="label.projects"/>' ); |
---|
116 | this.projectsSlide.getDivContent().empty(); |
---|
117 | |
---|
118 | jQuery.each( this.projectsArray, jQuery.proxy( function( i, logo ) |
---|
119 | { |
---|
120 | var divLogo = $( document.createElement( "div" ) ); |
---|
121 | divLogo.addClass( "divLogo" ); |
---|
122 | divLogo.attr( {id:logo.id} ); |
---|
123 | divLogo.html( '<img id="img_' + logo.id + '"src="resources/images/' + logo.img + '" width="' + this.logoSizeBigger + 'px" height="' + this.logoSizeBigger + 'px" title="' + logo.id + '"/>' ); |
---|
124 | this.projectsSlide.getDivContent().append( divLogo ); |
---|
125 | }, this ) ); |
---|
126 | this.projectsSlide.hideContainerContent(); |
---|
127 | }, |
---|
128 | |
---|
129 | createSelectMonths: function() |
---|
130 | { |
---|
131 | var div = $( document.createElement( "div" ) ); |
---|
132 | div.addClass( "selectDates" ); |
---|
133 | this.middleSlide.getDivContent().append( div ); |
---|
134 | |
---|
135 | var paramSelect = new Object(); |
---|
136 | paramSelect.id = "selectMonths"; |
---|
137 | paramSelect.parent = div; |
---|
138 | this.selectMonths = new Select( paramSelect ); |
---|
139 | this.selectMonths.add( 1, '<spring:message code="label.january"/>' ); |
---|
140 | this.selectMonths.add( 2, '<spring:message code="label.february"/>' ); |
---|
141 | this.selectMonths.add( 3, '<spring:message code="label.march"/>' ); |
---|
142 | this.selectMonths.add( 4, '<spring:message code="label.april"/>' ); |
---|
143 | this.selectMonths.add( 5, '<spring:message code="label.may"/>' ); |
---|
144 | this.selectMonths.add( 6, '<spring:message code="label.june"/>' ); |
---|
145 | this.selectMonths.add( 7, '<spring:message code="label.july"/>' ); |
---|
146 | this.selectMonths.add( 8, '<spring:message code="label.august"/>' ); |
---|
147 | this.selectMonths.add( 9, '<spring:message code="label.september"/>' ); |
---|
148 | this.selectMonths.add( 10, '<spring:message code="label.october"/>' ); |
---|
149 | this.selectMonths.add( 11, '<spring:message code="label.november"/>' ); |
---|
150 | this.selectMonths.add( 12, '<spring:message code="label.december"/>' ); |
---|
151 | }, |
---|
152 | |
---|
153 | createSelectYears: function() |
---|
154 | { |
---|
155 | var div = $( document.createElement( "div" ) ); |
---|
156 | div.addClass( "selectDates" ); |
---|
157 | this.middleSlide.getDivContent().append( div ); |
---|
158 | |
---|
159 | var paramSelect = new Object(); |
---|
160 | paramSelect.id = "selectYears"; |
---|
161 | paramSelect.parent = div; |
---|
162 | this.selectYears = new Select( paramSelect ); |
---|
163 | |
---|
164 | var currentYear = (new Date()).getFullYear(); |
---|
165 | for( var i = 0; i < 5; i++ ) |
---|
166 | this.selectYears.add( currentYear - i, currentYear - i ); |
---|
167 | }, |
---|
168 | |
---|
169 | // REQUESTS ******************************************************** |
---|
170 | requestChangeLocale: function() |
---|
171 | { |
---|
172 | $.ajax( { |
---|
173 | url: "project?methodName=setLocale&language=<spring:message code="label.language.value.to.switch"/>", |
---|
174 | success:function() |
---|
175 | { |
---|
176 | location.reload(); |
---|
177 | }, |
---|
178 | error: jQuery.proxy( this.showErrors, [this] ) |
---|
179 | } ); |
---|
180 | }, |
---|
181 | |
---|
182 | requestLogin: function() |
---|
183 | { |
---|
184 | var login = $( "#loginValue" ).val(); |
---|
185 | var pwd = $( "#pwdValue" ).val(); |
---|
186 | $.ajax( { |
---|
187 | url: "project?methodName=login&login=" + login + "&pwd=" + pwd, |
---|
188 | dataType: 'json', // Info needed since jquery.1.7 !! |
---|
189 | success:jQuery.proxy( this.handleLogin, this ), |
---|
190 | error: jQuery.proxy( this.showErrors, [this, "489px", "566px"] ) |
---|
191 | } ); |
---|
192 | }, |
---|
193 | |
---|
194 | requestLogout: function() |
---|
195 | { |
---|
196 | $.ajax( { |
---|
197 | url: "project?methodName=logout", |
---|
198 | dataType: 'json', // Info needed since jquery.1.7 !! |
---|
199 | success:jQuery.proxy( this.handleLogout, this ), |
---|
200 | error: jQuery.proxy( this.showErrors, [this] ) |
---|
201 | } ); |
---|
202 | }, |
---|
203 | |
---|
204 | requestDataByLogo: function() |
---|
205 | { |
---|
206 | if( !this.selectedLogo && !this.selectedLogo.id ) |
---|
207 | return; |
---|
208 | |
---|
209 | $.ajax( { |
---|
210 | url: "statistic?methodName=searchMainStatisticsByProject&name=" + this.selectedLogo.id, |
---|
211 | success:jQuery.proxy( this.handleDataByLogo, this ), |
---|
212 | error: jQuery.proxy( this.showLoginError, this ) |
---|
213 | } ); |
---|
214 | }, |
---|
215 | |
---|
216 | // HANDLES ******************************************************** |
---|
217 | handleDataByLogo: function( result ) |
---|
218 | { |
---|
219 | this.displaySummary(); |
---|
220 | }, |
---|
221 | |
---|
222 | handleLogin: function( result ) |
---|
223 | { |
---|
224 | this.containerErrors.empty(); |
---|
225 | this.containerErrors.css( "visibility", "hidden" ); |
---|
226 | |
---|
227 | if( result ) |
---|
228 | this.jSONUser = result.jSONUser; |
---|
229 | |
---|
230 | $( "#loginValue" ).val( "" ); |
---|
231 | $( "#pwdValue" ).val( "" ); |
---|
232 | $( "#login_text" ).css( "visibility", "hidden" ); |
---|
233 | $( "#login" ).animate( { |
---|
234 | top:'47px', |
---|
235 | left:'577px' |
---|
236 | }, 2000, function() |
---|
237 | { |
---|
238 | } ); |
---|
239 | |
---|
240 | $( "#login_bg" ).animate( { |
---|
241 | opacity: 1, |
---|
242 | height:'60px', |
---|
243 | width:'67px' |
---|
244 | }, 2000, function() |
---|
245 | { |
---|
246 | } ); |
---|
247 | |
---|
248 | $( "#login_img" ).animate( { |
---|
249 | top:'25px', |
---|
250 | left: '16px', |
---|
251 | width: '0', |
---|
252 | height: '0' |
---|
253 | }, 2000, jQuery.proxy( function() |
---|
254 | { |
---|
255 | // Slides |
---|
256 | this.parent.empty(); |
---|
257 | this.createAllSlides(); |
---|
258 | this.changeRightSlide(); |
---|
259 | |
---|
260 | // User |
---|
261 | if( this.jSONUser.name ) |
---|
262 | this.loginSlide.setTitle( this.jSONUser.name ); |
---|
263 | else |
---|
264 | this.loginSlide.setTitle( '<spring:message code="label.unknown"/>' ); |
---|
265 | $( "#logout_button" ).css( "visibility", "visible" ); |
---|
266 | |
---|
267 | // Awstats button |
---|
268 | if( "ADMINISTRATOR" == this.jSONUser.role ) |
---|
269 | { |
---|
270 | this.awstatsSlide = new DragSlide( {id:"awstats", parent:this.parent, width:"180", height:"25", top:"545px", left:"750px", |
---|
271 | specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent", |
---|
272 | title:'<spring:message code="label.awstats"/> ', activeDbClick:"None"} ); |
---|
273 | this.awstatsSlide.getDivContainer().click( jQuery.proxy( this.displayAwstatsStatistics, this ) ); |
---|
274 | } |
---|
275 | |
---|
276 | // Projects slide |
---|
277 | this.createProjectsSlide(); |
---|
278 | this.bindLogos(); |
---|
279 | |
---|
280 | // Logo |
---|
281 | this.selectedLogo = $( "#ETHER" )[0]; |
---|
282 | this.isSelectedLogoEther = true; |
---|
283 | this.onClickLogo(); |
---|
284 | }, this ) ); |
---|
285 | }, |
---|
286 | |
---|
287 | handleLogout: function() |
---|
288 | { |
---|
289 | this.jSONUser = false; |
---|
290 | this.parent.empty(); |
---|
291 | this.createRightSlide(); |
---|
292 | this.onClickHelp(); |
---|
293 | |
---|
294 | $( "#logout_button" ).css( "visibility", "hidden" ); |
---|
295 | $( "#login" ).css( { zIndex:1 } ).animate( { |
---|
296 | top:'79px', |
---|
297 | left:'88px' |
---|
298 | }, 2000, function() |
---|
299 | { |
---|
300 | } ); |
---|
301 | |
---|
302 | $( "#login_bg" ).animate( { |
---|
303 | opacity: 0.85, |
---|
304 | height:'500px', |
---|
305 | width:'500px' |
---|
306 | }, 2000, function() |
---|
307 | { |
---|
308 | $( "#login_text" ).css( "visibility", "visible" ); |
---|
309 | } ); |
---|
310 | |
---|
311 | $( "#login_img" ).animate( { |
---|
312 | top:'103px', |
---|
313 | left: '148px', |
---|
314 | width: '30px', |
---|
315 | height: '30px' |
---|
316 | }, 2000, function() |
---|
317 | { |
---|
318 | } ); |
---|
319 | }, |
---|
320 | |
---|
321 | // EVENTS ******************************************************** |
---|
322 | onClickHome: function() |
---|
323 | { |
---|
324 | location.reload(); |
---|
325 | }, |
---|
326 | |
---|
327 | onClickLanguage: function() |
---|
328 | { |
---|
329 | this.requestChangeLocale(); |
---|
330 | }, |
---|
331 | |
---|
332 | onClickMail: function() |
---|
333 | { |
---|
334 | document.location.href = "mailto:" + this.webmaster + "?subject=[STATISTICS]"; |
---|
335 | }, |
---|
336 | |
---|
337 | onClickMentions: function() |
---|
338 | { |
---|
339 | if( this.widthInitMentionsOrCredits == $( "#mentions" ).width() ) |
---|
340 | this.enlargeCreditsOrMentions( $( "#mentions" ), $( "#mentions_bg" ), $( "#mentions_text" ), $( "#mentions_title" ), "project/mentions_" + this.language + ".jsp" ); |
---|
341 | else |
---|
342 | this.reduceCreditsOrMentions( $( "#mentions" ), $( "#mentions_bg" ), $( "#mentions_text" ), $( "#mentions_title" ), "project/mentions_" + this.language + ".jsp" ); |
---|
343 | }, |
---|
344 | |
---|
345 | onClickCredits: function() |
---|
346 | { |
---|
347 | if( this.widthInitMentionsOrCredits == $( "#credits" ).width() ) |
---|
348 | this.enlargeCreditsOrMentions( $( "#credits" ), $( "#credits_bg" ), $( "#credits_text" ), $( "#credits_title" ), "project/credits_" + this.language + ".jsp" ); |
---|
349 | else |
---|
350 | this.reduceCreditsOrMentions( $( "#credits" ), $( "#credits_bg" ), $( "#credits_text" ), $( "#credits_title" ), "project/credits_" + this.language + ".jsp" ); |
---|
351 | }, |
---|
352 | |
---|
353 | onClickHelp: function() |
---|
354 | { |
---|
355 | this.rightSlide.setTitle( '<spring:message code="label.help"/>' ); |
---|
356 | this.rightSlide.setContent( "<spring:message code='label.help.content'/>" ); |
---|
357 | if( this.jSONUser ) |
---|
358 | 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 )} ); |
---|
359 | }, |
---|
360 | |
---|
361 | onClickLogin: function() |
---|
362 | { |
---|
363 | this.containerErrors.empty(); |
---|
364 | this.containerErrors.css( "visibility", "hidden" ); |
---|
365 | this.requestLogin(); |
---|
366 | }, |
---|
367 | |
---|
368 | onClickLogout: function() |
---|
369 | { |
---|
370 | this.requestLogout(); |
---|
371 | }, |
---|
372 | |
---|
373 | onClickLogo: function() |
---|
374 | { |
---|
375 | this.isSelectedLogoEther = (this.selectedLogo == $( "#ETHER" )[0]); |
---|
376 | this.isMonthAndYearSelected = false; |
---|
377 | |
---|
378 | if( this.jSONUser ) |
---|
379 | this.requestDataByLogo(); |
---|
380 | else |
---|
381 | { |
---|
382 | this.showErrors( "<spring:message code="error.connection.need"/>" ); |
---|
383 | this.containerErrors.css( {top:"489px", left:"566px"} ); |
---|
384 | this.containerErrors.css( "visibility", "visible" ); |
---|
385 | } |
---|
386 | }, |
---|
387 | |
---|
388 | onClickPrint: function() |
---|
389 | { |
---|
390 | var printContent = new PrintContent(); |
---|
391 | printContent.addContent( $( "#title" ).clone() ); |
---|
392 | printContent.addContent( this.middleSlide.getDivContainer().clone().animate( {'marginLeft' : "+=93px", 'width' : "667px"} ) ); |
---|
393 | printContent.displayPrintPreview(); |
---|
394 | }, |
---|
395 | |
---|
396 | onClickGo: function() |
---|
397 | { |
---|
398 | var url = this[0]; |
---|
399 | var context = this[1]; |
---|
400 | |
---|
401 | $( "divAwstats" ).load( url + context.selectedLogo.id + "&month=" + context.selectMonths.getValue() + "&year=" + context.selectYears.getValue() ); |
---|
402 | }, |
---|
403 | |
---|
404 | // OTHERS ******************************************************** |
---|
405 | showErrors: function( result ) |
---|
406 | { |
---|
407 | var context = this[0] ? this[0] : this; |
---|
408 | var topValue = this[1] ? this[1] : false; |
---|
409 | var leftValue = this[2] ? this[2] : false; |
---|
410 | context.containerErrors.show(); |
---|
411 | if( result.responseText && interfaceTexts[result.responseText] ) |
---|
412 | context.containerErrors.html( interfaceTexts[result.responseText] ); |
---|
413 | else if( result.responseText ) |
---|
414 | context.containerErrors.html( result.responseText ); |
---|
415 | else |
---|
416 | context.containerErrors.html( result ); |
---|
417 | if( topValue && leftValue ) |
---|
418 | context.containerErrors.css( {top: topValue, left: leftValue} ); |
---|
419 | context.containerErrors.css( "visibility", "visible" ); |
---|
420 | }, |
---|
421 | |
---|
422 | showLoginError: function( result ) |
---|
423 | { |
---|
424 | this.onClickLogout(); |
---|
425 | this.onClickLogo(); |
---|
426 | }, |
---|
427 | |
---|
428 | reduceCreditsOrMentions: function( div, div_bg, div_text, div_title ) |
---|
429 | { |
---|
430 | div.css( { zIndex:0 } ); |
---|
431 | div_text.css( "visibility", "hidden" ); |
---|
432 | div.animate( { |
---|
433 | left: '+=500', |
---|
434 | top: '+=500' |
---|
435 | }, 2000, function() |
---|
436 | { |
---|
437 | } ); |
---|
438 | div_bg.animate( { |
---|
439 | opacity: 1, |
---|
440 | height:'42px', |
---|
441 | width:this.widthInitMentionsOrCredits + 'px', |
---|
442 | zIndex:'0' |
---|
443 | }, 2000, function() |
---|
444 | { |
---|
445 | div_title.css( "visibility", "visible" ); |
---|
446 | } ); |
---|
447 | }, |
---|
448 | |
---|
449 | enlargeCreditsOrMentions: function( div, div_bg, div_text, div_title, pageToLoad ) |
---|
450 | { |
---|
451 | div_title.css( "visibility", "hidden" ); |
---|
452 | div.css( { zIndex:1 } ); |
---|
453 | div.animate( { |
---|
454 | left: '-=500', |
---|
455 | top: '-=500' |
---|
456 | }, 2000, function() |
---|
457 | { |
---|
458 | } ); |
---|
459 | |
---|
460 | div_bg.animate( { |
---|
461 | opacity: 0.95, |
---|
462 | height:'500px', |
---|
463 | width:'500px' |
---|
464 | }, 2000, function() |
---|
465 | { |
---|
466 | div_text.css( "visibility", "visible" ); |
---|
467 | div_text.load( pageToLoad ); |
---|
468 | } ); |
---|
469 | }, |
---|
470 | |
---|
471 | animateMenuLogos: function() |
---|
472 | { |
---|
473 | jQuery.each( this.projectsArray, jQuery.proxy( function( i, logo ) |
---|
474 | { |
---|
475 | $( "#" + logo.id ).animate( { |
---|
476 | top:logo.top, |
---|
477 | left:logo.left |
---|
478 | }, 5000, function() |
---|
479 | { |
---|
480 | } ); |
---|
481 | }, this ) ); |
---|
482 | }, |
---|
483 | |
---|
484 | bindMenuLogos: function() |
---|
485 | { |
---|
486 | var gap = (this.logoSizeBig - this.logoSizeSmall) / 2; |
---|
487 | var logoSizeBig = this.logoSizeBig + "px"; |
---|
488 | var logoSizeSmall = this.logoSizeSmall + "px"; |
---|
489 | var gridimage; |
---|
490 | |
---|
491 | $( '.divLogo' ).mouseover( function( element ) |
---|
492 | { |
---|
493 | gridimage = $( this ).find( 'img' ); //Define target as a variable |
---|
494 | gridimage.stop().animate( { |
---|
495 | width: logoSizeBig, |
---|
496 | height: logoSizeBig |
---|
497 | }, 150 ); |
---|
498 | $( this ).animate( { |
---|
499 | top: "-=10px", |
---|
500 | left: "-=10px" |
---|
501 | }, 150 ); |
---|
502 | } ); |
---|
503 | |
---|
504 | $( '.divLogo' ).mouseout( function( element ) |
---|
505 | { |
---|
506 | $( this ).animate( { |
---|
507 | top: "+=10px", |
---|
508 | left: "+=10px" |
---|
509 | }, 150 ); |
---|
510 | gridimage.stop().animate( { |
---|
511 | width: logoSizeSmall, |
---|
512 | height:logoSizeSmall |
---|
513 | }, 150 ); |
---|
514 | } ); |
---|
515 | this.bindLogos(); |
---|
516 | }, |
---|
517 | |
---|
518 | bindLogos:function() |
---|
519 | { |
---|
520 | $( '.divLogo' ).click( jQuery.proxy( function( element ) |
---|
521 | { |
---|
522 | this.selectedLogo = element.currentTarget; |
---|
523 | this.onClickLogo(); |
---|
524 | }, this ) ); |
---|
525 | }, |
---|
526 | |
---|
527 | changeRightSlide: function() |
---|
528 | { |
---|
529 | this.rightSlide.setTitle( '<spring:message code="label.actions"/>' ); |
---|
530 | this.rightSlide.getDivContent().empty(); |
---|
531 | new Button( {value:"<spring:message code="statistics.summary"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displaySummary, this )} ); |
---|
532 | new Button( {value:"<spring:message code="statistics.monthly"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayMonthly, this )} ); |
---|
533 | new Button( {value:"<spring:message code="statistics.daily"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayDaily, this )} ); |
---|
534 | new Button( {value:"<spring:message code="statistics.daysofweek"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayDaysOfWeek, this )} ); |
---|
535 | new Button( {value:"<spring:message code="statistics.hours"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayHours, this )} ); |
---|
536 | new Button( {value:"<spring:message code="statistics.visit.duration"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayVisitDuration, this )} ); |
---|
537 | |
---|
538 | new Button( {value:"<spring:message code="statistics.visit"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayVisit, this )} ); |
---|
539 | new Button( {value:"<spring:message code="statistics.domain"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayDomainCountry, this )} ); |
---|
540 | new Button( {value:"<spring:message code="statistics.data.download"/>", parent:this.rightSlide.getDivContent(), className: "positive action_button", onClick:jQuery.proxy( this.displayDownload, this )} ); |
---|
541 | |
---|
542 | new Button( {value:"<spring:message code="label.print"/>", parent:this.rightSlide.getDivContent(), className: "blue export_button print-preview", onClick:jQuery.proxy( this.onClickPrint, this )} ); |
---|
543 | }, |
---|
544 | |
---|
545 | changeMiddleSlide: function( title, url ) |
---|
546 | { |
---|
547 | var selectedMonth = this.selectMonths ? this.selectMonths.getValue() : false; |
---|
548 | var selectedYear = this.selectYears ? this.selectYears.getValue() : false; |
---|
549 | |
---|
550 | this.middleSlide.setTitle( this.selectedLogo.id + ' : ' + title ); |
---|
551 | this.middleSlide.getDivContent().empty(); |
---|
552 | |
---|
553 | // Button |
---|
554 | new Button( {value:"<spring:message code="label.go"/>", parent:this.middleSlide.getDivContent(), className: "blue selectDates", onClick:jQuery.proxy( this.onClickGo, [url, this] )} ); |
---|
555 | |
---|
556 | // Years |
---|
557 | this.createSelectYears(); |
---|
558 | if( !this.isMonthAndYearSelected ) |
---|
559 | this.selectYears.selectFirst( true ); |
---|
560 | else |
---|
561 | this.selectYears.select( selectedYear ); |
---|
562 | |
---|
563 | // Months |
---|
564 | this.createSelectMonths(); |
---|
565 | if( !this.isMonthAndYearSelected ) |
---|
566 | { |
---|
567 | var currentMonth = (new Date()).getMonth() + 1; |
---|
568 | this.selectMonths.select( currentMonth ); |
---|
569 | } |
---|
570 | else |
---|
571 | this.selectMonths.select( selectedMonth ); |
---|
572 | |
---|
573 | this.isMonthAndYearSelected = true; |
---|
574 | |
---|
575 | var div = $( document.createElement( "div" ) ); |
---|
576 | div.attr( {id:"divAwstats"} ); |
---|
577 | div.addClass( "containerAwstats" ); |
---|
578 | this.middleSlide.getDivContent().append( div ); |
---|
579 | |
---|
580 | div.load( url + this.selectedLogo.id + "&month=" + this.selectMonths.getValue() + "&year=" + this.selectYears.getValue() ); |
---|
581 | }, |
---|
582 | |
---|
583 | |
---|
584 | // STATISTICS ******************************************************** |
---|
585 | displaySummary: function() |
---|
586 | { |
---|
587 | this.changeMiddleSlide( '<spring:message code="statistics.summary"/>', <%=WebHelper.getProperty(request, "url.summary")%> ); |
---|
588 | }, |
---|
589 | |
---|
590 | displayMonthly: function() |
---|
591 | { |
---|
592 | this.changeMiddleSlide( '<spring:message code="statistics.monthly"/>', <%=WebHelper.getProperty(request, "url.monthly")%> ); |
---|
593 | }, |
---|
594 | |
---|
595 | displayDaily: function() |
---|
596 | { |
---|
597 | this.changeMiddleSlide( '<spring:message code="statistics.daily"/>', <%=WebHelper.getProperty(request, "url.daily")%> ); |
---|
598 | }, |
---|
599 | |
---|
600 | displayDaysOfWeek: function() |
---|
601 | { |
---|
602 | this.changeMiddleSlide( '<spring:message code="statistics.daysofweek"/>', <%=WebHelper.getProperty(request, "url.daysofweek")%> ); |
---|
603 | }, |
---|
604 | |
---|
605 | displayHours: function() |
---|
606 | { |
---|
607 | this.changeMiddleSlide( '<spring:message code="statistics.hours"/>', <%=WebHelper.getProperty(request, "url.hours")%> ); |
---|
608 | }, |
---|
609 | |
---|
610 | displayVisitDuration: function() |
---|
611 | { |
---|
612 | this.changeMiddleSlide( '<spring:message code="statistics.visit.duration"/>', <%=WebHelper.getProperty(request, "url.sessions")%> ); |
---|
613 | }, |
---|
614 | |
---|
615 | displayVisit: function() |
---|
616 | { |
---|
617 | this.changeMiddleSlide( '<spring:message code="statistics.visit"/>', <%=WebHelper.getProperty(request, "url.visited.pages")%> ); |
---|
618 | }, |
---|
619 | |
---|
620 | displayDomainCountry: function() |
---|
621 | { |
---|
622 | this.changeMiddleSlide( '<spring:message code="statistics.domain"/>', <%=WebHelper.getProperty(request, "url.domains")%> ); |
---|
623 | }, |
---|
624 | |
---|
625 | displayDownload: function() |
---|
626 | { |
---|
627 | this.changeMiddleSlide( '<spring:message code="statistics.data.download"/>', <%=WebHelper.getProperty(request, "url.downloads")%> ); |
---|
628 | }, |
---|
629 | |
---|
630 | displayAwstatsStatistics: function() |
---|
631 | { |
---|
632 | window.open( "http://www.pole-ether.fr/cgi-bin/awstats/awstats.pl?config=" + this.selectedLogo.id ); |
---|
633 | } |
---|
634 | |
---|
635 | } ); |
---|
636 | |
---|
637 | </script> |
---|