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.numberProjects = {"logo_acomida.jpg", "logo_ECCAD.gif", "logo_gosat.jpg", "logo_Megapoli.png", "logo_Ether.jpg", "logo_mimosa.png"}; |
---|
17 | |
---|
18 | this.bindButtons(); |
---|
19 | this.createDivs(); |
---|
20 | this.createCircleMenu(); |
---|
21 | $( ".containerToDrag" ).draggable(); |
---|
22 | }, |
---|
23 | |
---|
24 | |
---|
25 | // CREATES AND BINDS ******************************************************** |
---|
26 | bindButtons: function() |
---|
27 | { |
---|
28 | $( "#home_button" ).bind( "dblclick", this.onClickHome ); |
---|
29 | $( "#language_button" ).bind( "dblclick", jQuery.proxy( this.onClickLanguage, this ) ); |
---|
30 | $( "#mail_button" ).bind( "dblclick", this.onClickMail ); |
---|
31 | $( "#login_button" ).bind( "dblclick", jQuery.proxy( this.onClickLogin, this ) ); |
---|
32 | }, |
---|
33 | |
---|
34 | createDivs: function() |
---|
35 | { |
---|
36 | var div1 = this.createDiv( "div1", "150", "200", "200", "100", "Main statistics", "content" ); |
---|
37 | this.parent.append( div1 ); |
---|
38 | var div2 = this.createDiv( "div2", "250", "200", "150", "300", "MEGAPOLI Statistics", "content" ); |
---|
39 | this.parent.append( div2 ); |
---|
40 | var div3 = this.createDiv( "div3", "150", "200", "300", "600", "TAPAS Statistics", "content" ); |
---|
41 | this.parent.append( div3 ); |
---|
42 | }, |
---|
43 | |
---|
44 | createDiv: function( id, width, height, top, left, title, content ) |
---|
45 | { |
---|
46 | var divContainer = $( document.createElement( "div" ) ); |
---|
47 | divContainer.addClass( "containerStatistics containerToDrag" ); |
---|
48 | divContainer.attr( {id:id, style:"width:" + width + "px; height:" + height + "px; top:" + top + "px; left:" + left + "px"} ); |
---|
49 | var divTitle = $( document.createElement( "div" ) ); |
---|
50 | divTitle.addClass( "containerStatisticsTitle" ); |
---|
51 | divTitle.html( title ); |
---|
52 | divTitle.attr( {style:"width:" + (width - 7) + "px"} ); |
---|
53 | divContainer.append( divTitle ); |
---|
54 | var divContent = $( document.createElement( "div" ) ); |
---|
55 | divContent.addClass( "containerStatisticsContent" ); |
---|
56 | divContent.html( content ); |
---|
57 | divContainer.append( divContent ); |
---|
58 | return divContainer; |
---|
59 | }, |
---|
60 | |
---|
61 | createCircleMenu: function() |
---|
62 | { |
---|
63 | var menuWidth = 300; |
---|
64 | var nbLogosForWidth = (this.numberProjects / 2) + 1; |
---|
65 | var logoWidth = menuWidth / nbLogosForWidth; |
---|
66 | |
---|
67 | }, |
---|
68 | |
---|
69 | // REQUESTS ******************************************************** |
---|
70 | requestChangeLocale: function() |
---|
71 | { |
---|
72 | $.ajax( { |
---|
73 | url: "project?methodName=setLocale&language=<spring:message code="label.language.value.to.switch"/>", |
---|
74 | success:function() |
---|
75 | { |
---|
76 | location.reload(); |
---|
77 | } |
---|
78 | } ); |
---|
79 | }, |
---|
80 | |
---|
81 | // HANDLES ******************************************************** = retours ajax |
---|
82 | handleCreateXML: function( result ) |
---|
83 | { |
---|
84 | this.loadingRequest.hide(); |
---|
85 | //this.loadingRequest.display(); |
---|
86 | |
---|
87 | var res = jQuery.parseJSON( result ).result; |
---|
88 | alert( res ); |
---|
89 | }, |
---|
90 | |
---|
91 | |
---|
92 | // EVENTS ******************************************************** |
---|
93 | onClickHome: function() |
---|
94 | { |
---|
95 | location.reload(); |
---|
96 | }, |
---|
97 | |
---|
98 | onClickLanguage: function() |
---|
99 | { |
---|
100 | this.requestChangeLocale(); |
---|
101 | }, |
---|
102 | |
---|
103 | onClickMail: function() |
---|
104 | { |
---|
105 | document.location.href = "mailto:" + this.webmaster + "?subject=[STATISTICS]"; |
---|
106 | }, |
---|
107 | |
---|
108 | onClickLogin: function() |
---|
109 | { |
---|
110 | if( 88 == $( "#login_bg" ).width() ) |
---|
111 | this.enlargeLogin(); |
---|
112 | else |
---|
113 | this.reduceLogin(); |
---|
114 | }, |
---|
115 | |
---|
116 | onClickButtonLogin: function() |
---|
117 | { |
---|
118 | // TODO reduce cloud |
---|
119 | |
---|
120 | }, |
---|
121 | |
---|
122 | // OTHERS ******************************************************** |
---|
123 | reduceLogin: function() |
---|
124 | { |
---|
125 | $( "#login_text" ).css( "visibility", "hidden" ); |
---|
126 | $( "#login_bg" ).animate( { |
---|
127 | opacity: 1, |
---|
128 | height:'60px', |
---|
129 | width:'78px' |
---|
130 | }, 5000, function() |
---|
131 | { |
---|
132 | } ); |
---|
133 | |
---|
134 | $( "#login_button" ).animate( { |
---|
135 | top:'16px', |
---|
136 | left: '20px' |
---|
137 | }, 5000, function() |
---|
138 | { |
---|
139 | } ); |
---|
140 | }, |
---|
141 | |
---|
142 | enlargeLogin: function() |
---|
143 | { |
---|
144 | $( "#login_bg" ).animate( { |
---|
145 | opacity: 0.45, |
---|
146 | height:'500px', |
---|
147 | width:'500px' |
---|
148 | }, 5000, function() |
---|
149 | { |
---|
150 | $( "#login_text" ).css( "visibility", "visible" ); |
---|
151 | } ); |
---|
152 | |
---|
153 | $( "#login_button" ).animate( { |
---|
154 | top:'82px', |
---|
155 | left: '155px' |
---|
156 | }, 5000, function() |
---|
157 | { |
---|
158 | } ); |
---|
159 | } |
---|
160 | |
---|
161 | } ); |
---|
162 | |
---|
163 | </script> |
---|