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 = $( "#menuCircle" ); |
---|
12 | |
---|
13 | /** *********** VARIABLES *********** **/ |
---|
14 | this.language = '<spring:message code="language"/>'; |
---|
15 | this.webmaster = "<%=WebHelper.getProperty(request, "mail.webmaster")%>"; |
---|
16 | this.projectsPath = "resources/images/"; |
---|
17 | this.projectsArray = [ |
---|
18 | {id:"ETHER", img:"logo_Ether_50.jpg", top:"-16px", left:"125px"}, |
---|
19 | {id:"NDACC", img:"logo_Ndacc_50.jpg", top:"1.66667px", left:"46.3334px"}, |
---|
20 | {id:"ECCAD", img:"logo_ECCAD_50.gif", top:"39.3333px", left:"109.333px"}, |
---|
21 | {id:"IASI", img:"logo_iasi_50.jpg", top:"-78.6667px", left:"77.6666px"}, |
---|
22 | {id:"GOSAT", img:"logo_gosat_50.jpg", top:"-0.333328px", left:"200.667px"}, |
---|
23 | {id:"IAGOS", img:"logo_Iagos_50.jpg", top:"36px", left:"138px"}, |
---|
24 | {id:"TROPICO", img:"logo_tropico_50.jpg", top:"-74px", left:"45px"}, |
---|
25 | {id:"MEGAPOLI", img:"logo_Megapoli_50.png", top:"-74.3333px", left:"15.3333px"}, |
---|
26 | {id:"MIMOSA", img:"logo_mimosa_50.png", top:"-45.6667px", left:"76.3334px"}, |
---|
27 | {id:"REPROBUS", img:"logo_reprobus_50.png", top:"-48px", left:"161.667px"}, |
---|
28 | {id:"GEISA", img:"logo_geisa_50.jpg", top:"22px", left:"167.667px"}, |
---|
29 | {id:"TAPAS", img:"logo_tapas_50.png", top:"58.3333px", left:"125px"}, |
---|
30 | {id:"OUTREACH", img:"logo_acomida_50.jpg", top:"-77.3333px", left:"225px"}, |
---|
31 | {id:"OMER7A", img:"logo_omer7A_50.jpg", top:"22.6667px", left:"76.3334px"}, |
---|
32 | {id:"GIRAFE", img:"logo_girafe_50.JPG", top:"-79.6667px", left:"192.333px"}, |
---|
33 | {id:"ARLETTY", img:"logo_arletty_50.jpg", top:"-79px", left:"161.667px"} |
---|
34 | ] |
---|
35 | this.selectedLogo = false; |
---|
36 | |
---|
37 | this.bindButtons(); |
---|
38 | this.createDivs(); |
---|
39 | this.animateMenuCircle(); |
---|
40 | $( document ).ready( jQuery.proxy( function() |
---|
41 | { |
---|
42 | $( ".containerToDrag" ).draggable(); |
---|
43 | this.bindMenuCircle(); |
---|
44 | }, this ) ); |
---|
45 | }, |
---|
46 | |
---|
47 | |
---|
48 | // CREATES AND BINDS ******************************************************** |
---|
49 | bindButtons: function() |
---|
50 | { |
---|
51 | $( "#home_button" ).bind( "dblclick", this.onClickHome ); |
---|
52 | $( "#language_button" ).bind( "dblclick", jQuery.proxy( this.onClickLanguage, this ) ); |
---|
53 | $( "#mail_button" ).bind( "dblclick", this.onClickMail ); |
---|
54 | $( "#login_button" ).bind( "dblclick", jQuery.proxy( this.onClickLogin, this ) ); |
---|
55 | }, |
---|
56 | |
---|
57 | createDivs: function() |
---|
58 | { |
---|
59 | this.leftTopSlide = new DragSlide( {id:"leftTop", parent:this.parent, width:"150", height:"200", top:"140px", left:"53px", |
---|
60 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent", |
---|
61 | title:"Main statistics", contentSlide:"leftTop"} ); |
---|
62 | |
---|
63 | this.leftBottomSlide = new DragSlide( {id:"leftBottom", parent:this.parent, width:"430", height:"430", top:"140px", left:"230px", |
---|
64 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent", |
---|
65 | title:"MEGAPOLI statistics", contentSlide:"leftBottom"} ); |
---|
66 | |
---|
67 | this.middleSlide = new DragSlide( {id:"middle", parent:this.parent, width:"200", height:"300", top:"180px", left:"700px", |
---|
68 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent", |
---|
69 | title:"TAPAS statistics", contentSlide:"middle"} ); |
---|
70 | |
---|
71 | this.rightSlide = new DragSlide( {id:"right", parent:this.parent, width:"150", height:"200", top:"370px", left:"53px", |
---|
72 | specificClass:"containerStatistics", specificTitleClass:"containerStatisticsTitle", specificContentClass:"containerStatisticsContent", |
---|
73 | title:"Hop hop hop", contentSlide:"right"} ); |
---|
74 | |
---|
75 | }, |
---|
76 | |
---|
77 | createDiv: function( id, width, height, top, left, title, content ) |
---|
78 | { |
---|
79 | var divContainer = $( document.createElement( "div" ) ); |
---|
80 | divContainer.addClass( "containerStatistics containerToDrag" ); |
---|
81 | divContainer.attr( {id:id, style:"width:" + width + "px; height:" + height + "px; top:" + top + "px; left:" + left + "px"} ); |
---|
82 | var divTitle = $( document.createElement( "div" ) ); |
---|
83 | divTitle.addClass( "containerStatisticsTitle" ); |
---|
84 | divTitle.html( title ); |
---|
85 | divTitle.attr( {style:"width:" + (this.width - 7) + "px"} ); |
---|
86 | divContainer.append( divTitle ); |
---|
87 | var divContent = $( document.createElement( "div" ) ); |
---|
88 | divContent.addClass( "containerStatisticsContent" ); |
---|
89 | divContent.html( content ); |
---|
90 | divContainer.append( divContent ); |
---|
91 | return divContainer; |
---|
92 | }, |
---|
93 | |
---|
94 | // REQUESTS ******************************************************** |
---|
95 | requestChangeLocale: function() |
---|
96 | { |
---|
97 | $.ajax( { |
---|
98 | url: "project?methodName=setLocale&language=<spring:message code="label.language.value.to.switch"/>", |
---|
99 | success:function() |
---|
100 | { |
---|
101 | location.reload(); |
---|
102 | } |
---|
103 | } ); |
---|
104 | }, |
---|
105 | |
---|
106 | // HANDLES ******************************************************** = retours ajax |
---|
107 | handleCreateXML: function( result ) |
---|
108 | { |
---|
109 | this.loadingRequest.hide(); |
---|
110 | //this.loadingRequest.display(); |
---|
111 | |
---|
112 | var res = jQuery.parseJSON( result ).result; |
---|
113 | alert( res ); |
---|
114 | }, |
---|
115 | |
---|
116 | |
---|
117 | // EVENTS ******************************************************** |
---|
118 | onClickHome: function() |
---|
119 | { |
---|
120 | location.reload(); |
---|
121 | }, |
---|
122 | |
---|
123 | onClickLanguage: function() |
---|
124 | { |
---|
125 | this.requestChangeLocale(); |
---|
126 | }, |
---|
127 | |
---|
128 | onClickMail: function() |
---|
129 | { |
---|
130 | document.location.href = "mailto:" + this.webmaster + "?subject=[STATISTICS]"; |
---|
131 | }, |
---|
132 | |
---|
133 | onClickLogin: function() |
---|
134 | { |
---|
135 | if( 88 == $( "#login_bg" ).width() ) |
---|
136 | this.enlargeLogin(); |
---|
137 | else |
---|
138 | this.reduceLogin(); |
---|
139 | }, |
---|
140 | |
---|
141 | onClickButtonLogin: function() |
---|
142 | { |
---|
143 | // TODO reduce cloud |
---|
144 | |
---|
145 | }, |
---|
146 | |
---|
147 | onClickLogo: function() |
---|
148 | { |
---|
149 | if( !this.selectedLogo ) |
---|
150 | return; |
---|
151 | |
---|
152 | this.leftTopSlide.html( this.selectedLogo.id ); |
---|
153 | }, |
---|
154 | |
---|
155 | // OTHERS ******************************************************** |
---|
156 | reduceLogin: function() |
---|
157 | { |
---|
158 | $( "#login" ).css( { zIndex:0 } ); |
---|
159 | $( "#login_text" ).css( "visibility", "hidden" ); |
---|
160 | $( "#login_bg" ).animate( { |
---|
161 | opacity: 1, |
---|
162 | height:'60px', |
---|
163 | width:'78px', |
---|
164 | zIndex:'0' |
---|
165 | }, 2000, function() |
---|
166 | { |
---|
167 | } ); |
---|
168 | |
---|
169 | $( "#login_button" ).animate( { |
---|
170 | top:'16px', |
---|
171 | left: '20px' |
---|
172 | }, 2000, function() |
---|
173 | { |
---|
174 | } ); |
---|
175 | }, |
---|
176 | |
---|
177 | enlargeLogin: function() |
---|
178 | { |
---|
179 | $( "#login" ).css( { zIndex:1 } ); |
---|
180 | $( "#login_bg" ).animate( { |
---|
181 | opacity: 0.45, |
---|
182 | height:'500px', |
---|
183 | width:'500px' |
---|
184 | }, 2000, function() |
---|
185 | { |
---|
186 | $( "#login_text" ).css( "visibility", "visible" ); |
---|
187 | } ); |
---|
188 | |
---|
189 | $( "#login_button" ).animate( { |
---|
190 | top:'82px', |
---|
191 | left: '155px' |
---|
192 | }, 2000, function() |
---|
193 | { |
---|
194 | } ); |
---|
195 | }, |
---|
196 | |
---|
197 | animateMenuCircle: function() |
---|
198 | { |
---|
199 | var menuSize = this.containerMenu.width(); |
---|
200 | var nbLogosForSize = (this.projectsArray.length / 2) + 1; |
---|
201 | var divLogoSize = menuSize / nbLogosForSize; |
---|
202 | this.logoSize = divLogoSize - 5; |
---|
203 | |
---|
204 | var initTop = this.projectsArray[0].top; |
---|
205 | var initLeft = this.projectsArray[0].left; |
---|
206 | |
---|
207 | jQuery.each( this.projectsArray, jQuery.proxy( function( i, logo ) |
---|
208 | { |
---|
209 | var divLogo = $( document.createElement( "div" ) ); |
---|
210 | divLogo.addClass( "divLogo containerToDrag" ); |
---|
211 | divLogo.attr( {id:logo.id, style:"position:absolute; top:" + initTop + "; left:" + initLeft} ); |
---|
212 | divLogo.html( '<img id="img_' + logo.id + '"src="' + this.projectsPath + '' + logo.img + '" width="' + this.logoSize + 'px" height="' + this.logoSize + 'px"/>' ); |
---|
213 | $( "#menuCircle" ).append( divLogo ); |
---|
214 | }, this ) ); |
---|
215 | |
---|
216 | jQuery.each( this.projectsArray, jQuery.proxy( function( i, logo ) |
---|
217 | { |
---|
218 | $( "#" + logo.id ).animate( { |
---|
219 | top:logo.top, |
---|
220 | left:logo.left |
---|
221 | }, 5000, function() |
---|
222 | { |
---|
223 | } ); |
---|
224 | }, this ) ); |
---|
225 | }, |
---|
226 | |
---|
227 | bindMenuCircle: function() |
---|
228 | { |
---|
229 | var gridimage; |
---|
230 | $( '.divLogo' ).mouseover( |
---|
231 | function() |
---|
232 | { |
---|
233 | gridimage = $( this ).find( 'img' ); //Define target as a variable |
---|
234 | gridimage.stop().animate( {width: 50, height:50}, 150 ); |
---|
235 | } ).mouseout( |
---|
236 | jQuery.proxy( function( element ) |
---|
237 | { |
---|
238 | this.selectedLogo = element.currentTarget; |
---|
239 | gridimage.stop().animate( {width: this.logoSize, height:this.logoSize}, 150 ); |
---|
240 | }, this ) ).dblclick( |
---|
241 | jQuery.proxy( function() |
---|
242 | { |
---|
243 | this.onClickLogo(); |
---|
244 | }, this ) ); |
---|
245 | } |
---|
246 | |
---|
247 | } ); |
---|
248 | |
---|
249 | </script> |
---|