1 | <%--<script src="js/library/jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min.js"></script>--%> |
---|
2 | <script type="text/javascript"> |
---|
3 | |
---|
4 | |
---|
5 | var InterfaceTapas; |
---|
6 | InterfaceTapas = Class.create( { |
---|
7 | initialize: function( jsonFileFormats, jsonYesNos, jsonObservatories, jsonSpectralUnits, jsonInstrumentalFunctions, jsonClimatoReferences ) |
---|
8 | { |
---|
9 | /** *********** CONTAINERS *********** **/ |
---|
10 | this.containerForm = $( "#formulaire" ); |
---|
11 | //this.containerErrors = $( "#errForm" ); |
---|
12 | //this.divE= $( "#divErreurs"); |
---|
13 | this.containerCenter = $( "#containerCenter" ); |
---|
14 | this.containerTabs = $( "#tab" ); |
---|
15 | |
---|
16 | /** *********** VARIABLES *********** **/ |
---|
17 | this.jSonFileFormats = jsonFileFormats || null; |
---|
18 | this.selectFileFormatsList = new Object(); |
---|
19 | |
---|
20 | this.jSonYesNos = jsonYesNos || null; |
---|
21 | this.select_ih2oeList = new Object(); |
---|
22 | this.select_io2eList = new Object(); |
---|
23 | this.select_io3eList = new Object(); |
---|
24 | this.select_ico2eList = new Object(); |
---|
25 | this.select_ich4eList = new Object(); |
---|
26 | this.select_in2oeList = new Object(); |
---|
27 | this.select_irextinctionList = new Object(); |
---|
28 | this.select_ibervCList = new Object(); |
---|
29 | this.select_iOneTransmissionList = new Object(); |
---|
30 | |
---|
31 | this.jSonObservatories = jsonObservatories || false; |
---|
32 | this.selectObservatoriesList = new Object(); |
---|
33 | this.jSonSpectralUnits = jsonSpectralUnits || null; |
---|
34 | this.selectSpectralUnitsList = new Object(); |
---|
35 | this.jSonInstrumentalFunctions = jsonInstrumentalFunctions || null; |
---|
36 | this.selectInstrumentalFunctionsList = new Object(); |
---|
37 | this.jSonClimatoReferences = jsonClimatoReferences || null; |
---|
38 | this.selectClimatoReferencesList = new Object(); |
---|
39 | this.dateTemp = "zz"; |
---|
40 | this.nbRequest = 1; |
---|
41 | this.tabActive = false; |
---|
42 | this.numRequest = 1; |
---|
43 | |
---|
44 | |
---|
45 | this.language = tapasTexts["language"]; |
---|
46 | this.browser = "Firefox"; |
---|
47 | |
---|
48 | if( navigator.userAgent.indexOf( 'Firefox' ) != -1 && parseFloat( navigator.userAgent.substring( navigator.userAgent.indexOf( 'Firefox' ) + 8 ) ) >= 3.6 ) |
---|
49 | { |
---|
50 | this.browser = "Firefox"; |
---|
51 | } |
---|
52 | else if( navigator.userAgent.indexOf( 'Chrome' ) != -1 && parseFloat( navigator.userAgent.substring( navigator.userAgent.indexOf( 'Chrome' ) + 7 ).split( ' ' )[0] ) >= 15 ) |
---|
53 | { |
---|
54 | this.browser = "Chrome"; |
---|
55 | } |
---|
56 | else if( navigator.userAgent.indexOf( 'Safari' ) != -1 && navigator.userAgent.indexOf( 'Version' ) != -1 && parseFloat( navigator.userAgent.substring( navigator.userAgent.indexOf( 'Version' ) + 8 ).split( ' ' )[0] ) >= 5 ) |
---|
57 | { |
---|
58 | this.browser = "Safari"; |
---|
59 | } |
---|
60 | |
---|
61 | // Buttons |
---|
62 | var submitButton = new Button( {value:tapasTexts["label.submitButton"], parent:this.containerCenter, id:"button_submit", className: "tapas1", classNameText:"tapas1_text", onClick:jQuery.proxy( this.onClickSubmit, this )} ); |
---|
63 | this.addRequestButton = new Button( {title:tapasTexts["label.title.add"],value:tapasTexts["label.addButton"], parent:this.containerCenter, id:"button_add", className: "positive", onClick:jQuery.proxy( this.onClickAdd, this )} ); |
---|
64 | this.delRequestButton = new Button( {title:tapasTexts["label.title.del"],value:tapasTexts["label.delButton"], parent:this.containerCenter, id:"button_del", className: "negative", onClick:jQuery.proxy( this.onClickDel, this )} ); |
---|
65 | this.delRequestButton.disable(); |
---|
66 | |
---|
67 | this.createForm(); |
---|
68 | |
---|
69 | this.tabActive = this.createTab(); |
---|
70 | this.divE = $( document.createElement( "div" ) ); |
---|
71 | this.divE.attr( {id:"divErrors", class:"errorsForm"} ); |
---|
72 | /*var fieldSetE = $( document.createElement( "fieldset" ) ); |
---|
73 | fieldSetE.addClass( "cfs3" ); |
---|
74 | this.divE.append( fieldSetE );*/ |
---|
75 | |
---|
76 | this.containerForm.append( this.divE ); |
---|
77 | //this.containerErrors.hide(); |
---|
78 | this.divE.hide(); |
---|
79 | |
---|
80 | /** *********** LOADING *********** **/ |
---|
81 | var param = new Object(); |
---|
82 | param.id = "loadingForRequest"; |
---|
83 | param.parent = this.containerForm; |
---|
84 | param.className = "loading-classic"; |
---|
85 | this.loadingRequest = new Loading( param ); |
---|
86 | |
---|
87 | var nbr=1; |
---|
88 | |
---|
89 | $( '#select_iobservatory_'+this.nbRequest ).bind( 'focus', ["1"], jQuery.proxy(this.locationChoice,this)); |
---|
90 | |
---|
91 | //this.loadingRequest.display(); |
---|
92 | }, |
---|
93 | |
---|
94 | |
---|
95 | // CREATES ******************************************************** |
---|
96 | createTab:function() |
---|
97 | { |
---|
98 | var ntab = new Tab( {value:tapasTexts["label.requete"] + " " + this.nbRequest, parent:this.containerTabs, numTab: this.nbRequest, id:"tab_request" + this.nbRequest, className: "tab_class", onClick:jQuery.proxy( this.onClickTab, this )} ); |
---|
99 | ntab.active(); |
---|
100 | return ntab; |
---|
101 | }, |
---|
102 | |
---|
103 | |
---|
104 | createCalendar: function( containerCalendar, texte, texte2, inputDateId, inputDateId2, currentDate, isTrToCreate ) |
---|
105 | { |
---|
106 | if( isTrToCreate ) |
---|
107 | { |
---|
108 | // Create input for date text |
---|
109 | var tr = $( document.createElement( "tr" ) ); |
---|
110 | var td1 = $( document.createElement( "td" ) ); |
---|
111 | var td2 = $( document.createElement( "td" ) ); |
---|
112 | var td3 = $( document.createElement( "td" ) ); |
---|
113 | var td4 = $( document.createElement( "td" ) ); |
---|
114 | var inputDate = $( document.createElement( "input" ) ); |
---|
115 | inputDate.attr( {id:inputDateId, size:"17"} ); |
---|
116 | |
---|
117 | var inputDate2 = $( document.createElement( "input" ) ); |
---|
118 | inputDate2.attr( {id:inputDateId2, size:"17"} ); |
---|
119 | |
---|
120 | td1.html( texte ); |
---|
121 | td1.attr( { class:"containerLabel" } ); |
---|
122 | tr.append( td1 ); |
---|
123 | |
---|
124 | td2.attr( {colspan:3} ); |
---|
125 | td2.append( inputDate ); |
---|
126 | tr.append( td2 ); |
---|
127 | containerCalendar.append( tr ); |
---|
128 | |
---|
129 | td3.html( texte2 ); |
---|
130 | td3.attr( { class:"containerLabel" } ); |
---|
131 | td3.attr( {colspan:2} ); |
---|
132 | tr.append( td3 ); |
---|
133 | |
---|
134 | td4.attr( {colspan:5} ); |
---|
135 | td4.append( inputDate2 ); |
---|
136 | inputDate2.bind( "change", jQuery.proxy(this.checkDate,this)); |
---|
137 | inputDate.bind( "focusin", jQuery.proxy(this.tempDate,this)); |
---|
138 | inputDate.bind( "focusout", jQuery.proxy(this.emptyCpyDate,this)); |
---|
139 | tr.append( td4 ); |
---|
140 | containerCalendar.append( tr ); |
---|
141 | |
---|
142 | } |
---|
143 | |
---|
144 | // Calendar |
---|
145 | this.calendarFormat = "%Y-%m-%d %H:%i:%s"; |
---|
146 | this.calendarConverter = new AnyTime.Converter( { format: this.calendarFormat } ); |
---|
147 | |
---|
148 | AnyTime.picker( inputDateId, { format: this.calendarFormat, firstDOW: 1, |
---|
149 | labelTitle: "Select Date", labelYear: "Year", labelMonth: "Month", labelDayOfMonth: "Day", |
---|
150 | labelHour: "Hour", labelMinute: "Minute", labelSecond: "Second" |
---|
151 | } ); |
---|
152 | |
---|
153 | // Ajout de la date courrante ds le calendrier SI currentDate non précisée |
---|
154 | if( !currentDate ) |
---|
155 | currentDate = new Date(); |
---|
156 | |
---|
157 | |
---|
158 | $( "#" + inputDateId ).val( this.calendarConverter.format( currentDate ) ); |
---|
159 | $( "#" + inputDateId ).addClass( "calendar" ); |
---|
160 | |
---|
161 | }, |
---|
162 | |
---|
163 | |
---|
164 | // CREATES ******************************************************** |
---|
165 | createTime: function( containerCalendar, texte, inputDateId, currentTime, isTrToCreate, text2 ) |
---|
166 | { |
---|
167 | if( isTrToCreate ) |
---|
168 | { |
---|
169 | |
---|
170 | // Create input for date text |
---|
171 | var tr = $( document.createElement( "tr" ) ); |
---|
172 | var td1 = $( document.createElement( "td" ) ); |
---|
173 | var td2 = $( document.createElement( "td" ) ); |
---|
174 | var td3 = $( document.createElement( "td" ) ); |
---|
175 | var inputDate = $( document.createElement( "input" ) ); |
---|
176 | inputDate.attr( {id:inputDateId, size:"10"} ); |
---|
177 | |
---|
178 | td1.html( texte ); |
---|
179 | td1.attr( { class:"containerLabel" } ); |
---|
180 | tr.append( td1 ); |
---|
181 | |
---|
182 | td2.attr( {colspan:1} ); |
---|
183 | td2.append( inputDate ); |
---|
184 | tr.append( td2 ); |
---|
185 | |
---|
186 | td3.html( text2 ); |
---|
187 | td3.attr( { class:"containerLabel2" } ); |
---|
188 | tr.append( td3 ); |
---|
189 | |
---|
190 | containerCalendar.append( tr ); |
---|
191 | } |
---|
192 | |
---|
193 | // Time |
---|
194 | this.timeFormat = "%H:%i:%s"; |
---|
195 | this.timeConverter = new AnyTime.Converter( { format: this.timeFormat } ); |
---|
196 | |
---|
197 | AnyTime.picker( inputDateId, { format: this.timeFormat, firstDOW: 1, |
---|
198 | labelTitle: "Select hour", labelHour: "Hour", labelMinute: "Minute", labelSecond: "Second" |
---|
199 | } ); |
---|
200 | |
---|
201 | if( !currentTime ) |
---|
202 | currentTime = "00:00:00"; |
---|
203 | // TODO : voir si besoin de convertir format des heures |
---|
204 | // $( "#" + inputDateId ).val( this.timeConverter.format( currentTime ) ); |
---|
205 | $( "#" + inputDateId ).val( currentTime ); |
---|
206 | $( "#" + inputDateId ).addClass( "time" ); |
---|
207 | }, |
---|
208 | |
---|
209 | |
---|
210 | createTr: function( texte, inputId, container, textesup, event, champ, ctnb, info ) |
---|
211 | { |
---|
212 | var tr = $( document.createElement( "tr" ) ); |
---|
213 | var td1 = $( document.createElement( "td" ) ); |
---|
214 | var td2 = $( document.createElement( "td" ) ); |
---|
215 | var td3 = $( document.createElement( "td" ) ); |
---|
216 | var input = $( document.createElement( "input" ) ); |
---|
217 | |
---|
218 | input.attr( {id: inputId, class:"containerText" + ctnb, size:11} ); |
---|
219 | |
---|
220 | |
---|
221 | if( event.length > 0 ) input.bind( event, [this, champ], this.angleChoice ); |
---|
222 | |
---|
223 | |
---|
224 | td1.attr( {class:"containerLabel"} ); |
---|
225 | |
---|
226 | td3.html( textesup ); |
---|
227 | td3.attr( {class:"containerLabel2", colspan:3} ); |
---|
228 | tr.append( td1 ); |
---|
229 | td2.append( input ); |
---|
230 | |
---|
231 | td2.attr( {colspan:2} ); |
---|
232 | |
---|
233 | tr.append( td2 ); |
---|
234 | tr.append( td3 ); |
---|
235 | container.append( tr ); |
---|
236 | |
---|
237 | |
---|
238 | |
---|
239 | var re1 = new RegExp( "isr_" ); |
---|
240 | var re2 = new RegExp( "irp_" ); |
---|
241 | |
---|
242 | if( info && (inputId.match( re1 ) || inputId.match( re2 )) ) |
---|
243 | { |
---|
244 | |
---|
245 | var img = $( document.createElement( "img" ) ); |
---|
246 | var a = $( document.createElement( "a" ) ); |
---|
247 | var div = $( document.createElement( "div" ) ); |
---|
248 | img.attr( "src", "resources/images/info.png" ); |
---|
249 | img.attr( "width", "19" ); |
---|
250 | a.attr( "style", "cursor:pointer" ); |
---|
251 | |
---|
252 | img.bind( "click", [inputId,450,100,this], this.onClickInfos ); |
---|
253 | a.append( img ); |
---|
254 | div.append( a ); |
---|
255 | |
---|
256 | td1.append( a ); |
---|
257 | td1.append( texte ); |
---|
258 | tr.append( div ); |
---|
259 | |
---|
260 | if (inputId.match( re2 )) { |
---|
261 | input.css("backgroundColor", "#bfafd6"); |
---|
262 | input.attr('disabled','disabled'); |
---|
263 | } |
---|
264 | |
---|
265 | } |
---|
266 | else if( info ) |
---|
267 | { |
---|
268 | var img = $( document.createElement( "img" ) ); |
---|
269 | var a = $( document.createElement( "a" ) ); |
---|
270 | img.attr( "src", "resources/images/info.png" ); |
---|
271 | img.attr( "width", "19" ); |
---|
272 | a.attr( "style", "cursor:pointer" ); |
---|
273 | img.bind( "click", [inputId,450,100,this], this.onClickInfos ); |
---|
274 | a.append( img ); |
---|
275 | td1.append( a ); |
---|
276 | td1.append( texte ); |
---|
277 | |
---|
278 | } |
---|
279 | |
---|
280 | |
---|
281 | }, |
---|
282 | |
---|
283 | |
---|
284 | createTrTxt: function( texte, container ) |
---|
285 | { |
---|
286 | |
---|
287 | var tr = $( document.createElement( "tr" ) ); |
---|
288 | var td1 = $( document.createElement( "td" ) ); |
---|
289 | |
---|
290 | td1.html( texte ); |
---|
291 | td1.attr( {class:"containerLabelT", colspan:4} ); |
---|
292 | |
---|
293 | tr.append( td1 ); |
---|
294 | container.append( tr ); |
---|
295 | |
---|
296 | }, |
---|
297 | |
---|
298 | |
---|
299 | createTr2Input: function( texte1, texte2, inputId1, inputId2, container, textesup ) |
---|
300 | { |
---|
301 | var tr = $( document.createElement( "tr" ) ); |
---|
302 | var td1 = $( document.createElement( "td" ) ); |
---|
303 | var td2 = $( document.createElement( "td" ) ); |
---|
304 | var td3 = $( document.createElement( "td" ) ); |
---|
305 | var td4 = $( document.createElement( "td" ) ); |
---|
306 | var td5 = $( document.createElement( "td" ) ); |
---|
307 | var td6 = $( document.createElement( "td" ) ); |
---|
308 | var input1 = $( document.createElement( "input" ) ); |
---|
309 | var input2 = $( document.createElement( "input" ) ); |
---|
310 | |
---|
311 | input1.attr( {id: inputId1,class:"containerText",size:11} ); |
---|
312 | input2.attr( {id: inputId2,class:"containerText",size:11} ); |
---|
313 | |
---|
314 | td3.html( texte2 ); |
---|
315 | td5.html( textesup ); |
---|
316 | var img = $( document.createElement( "img" ) ); |
---|
317 | var a = $( document.createElement( "a" ) ); |
---|
318 | img.attr( "src", "resources/images/info.png" ); |
---|
319 | img.attr( "width", "19" ); |
---|
320 | a.attr( "style", "cursor:pointer" ); |
---|
321 | img.bind( "click", ["spectral_range",450,100,this], this.onClickInfos ); |
---|
322 | a.append( img ); |
---|
323 | td1.append( a ); |
---|
324 | td1.append( texte1 ); |
---|
325 | |
---|
326 | //img.onclick(this.onClickInfos("spectral_range",1200,440)); |
---|
327 | |
---|
328 | td1.attr( {class:"containerLabel"} ); |
---|
329 | td3.attr( {class:"containerLabel4"} ); |
---|
330 | td5.attr( {class:"containerLabel2"} ); |
---|
331 | |
---|
332 | td2.append( input1 ); |
---|
333 | //td2.html( texte2 ); |
---|
334 | td4.append( input2 ); |
---|
335 | td4.attr( {colspan:2} ); |
---|
336 | td5.attr( {colspan:2} ); |
---|
337 | |
---|
338 | tr.append( td1 ); |
---|
339 | tr.append( td2 ); |
---|
340 | tr.append( td3 ); |
---|
341 | tr.append( td4 ); |
---|
342 | tr.append( td5 ); |
---|
343 | tr.append( td6 ); |
---|
344 | container.append( tr ); |
---|
345 | }, |
---|
346 | |
---|
347 | |
---|
348 | createTr3Input: function( texte1, texte2, texte3, texte4, inputId1, inputId2, inputId3, inputId4, container, textesup, textesup2 ) |
---|
349 | { |
---|
350 | var tr = $( document.createElement( "tr" ) ); |
---|
351 | var td1 = $( document.createElement( "td" ) ); |
---|
352 | var td2 = $( document.createElement( "td" ) ); |
---|
353 | var td3 = $( document.createElement( "td" ) ); |
---|
354 | var td4 = $( document.createElement( "td" ) ); |
---|
355 | var td5 = $( document.createElement( "td" ) ); |
---|
356 | var td6 = $( document.createElement( "td" ) ); |
---|
357 | var td7 = $( document.createElement( "td" ) ); |
---|
358 | var td8 = $( document.createElement( "td" ) ); |
---|
359 | var td9 = $( document.createElement( "td" ) ); |
---|
360 | |
---|
361 | |
---|
362 | var input1 = $( document.createElement( "input" ) ); |
---|
363 | var input2 = $( document.createElement( "input" ) ); |
---|
364 | var input3 = $( document.createElement( "input" ) ); |
---|
365 | var input4 = $( document.createElement( "input" ) ); |
---|
366 | |
---|
367 | |
---|
368 | input1.attr( {id: inputId1,class:"containerText",size:14} ); |
---|
369 | input2.attr( {id: inputId2,class:"containerText",size:4} ); |
---|
370 | input3.attr( {id: inputId3,class:"containerText",size:4} ); |
---|
371 | input4.attr( {id: inputId4,class:"containerText",size:4} ); |
---|
372 | |
---|
373 | input1.bind( "change", ["2"], jQuery.proxy(this.locationChoice,this)); |
---|
374 | input2.bind( "change", ["2"], jQuery.proxy(this.locationChoice,this)); |
---|
375 | input3.bind( "change", ["2"], jQuery.proxy(this.locationChoice,this)); |
---|
376 | input4.bind( "change", ["2"], jQuery.proxy(this.locationChoice,this)); |
---|
377 | |
---|
378 | td3.html( texte2 ); |
---|
379 | td5.html( texte3 ); |
---|
380 | td7.html( texte4 ); |
---|
381 | td9.html( textesup ); |
---|
382 | |
---|
383 | |
---|
384 | |
---|
385 | var img = $( document.createElement( "img" ) ); |
---|
386 | var a = $( document.createElement( "a" ) ); |
---|
387 | img.attr( "src", "resources/images/info.png" ); |
---|
388 | img.attr( "width", "19" ); |
---|
389 | a.attr( "style", "cursor:pointer" ); |
---|
390 | img.bind( "click", ["spectral_range",450,100,this], this.onClickInfos ); |
---|
391 | a.append( img ); |
---|
392 | td1.append( a ); |
---|
393 | td1.append( texte1 ); |
---|
394 | |
---|
395 | //img.onclick(this.onClickInfos("spectral_range",1200,440)); |
---|
396 | |
---|
397 | td1.attr( {class:"containerLabel"} ); |
---|
398 | td3.attr( {class:"containerLabel4"} ); |
---|
399 | td5.attr( {class:"containerLabel2"} ); |
---|
400 | td7.attr( {class:"containerLabel2"} ); |
---|
401 | td9.attr( {class:"containerLabel2"} ); |
---|
402 | |
---|
403 | |
---|
404 | |
---|
405 | td2.append( input1 ); |
---|
406 | td4.append( input2 ); |
---|
407 | td6.append( input3 ); |
---|
408 | td8.append( input4 ); |
---|
409 | td4.append( textesup2 ); |
---|
410 | |
---|
411 | td2.attr( {colspan:2} ); |
---|
412 | |
---|
413 | tr.append( td1 ); |
---|
414 | tr.append( td2 ); |
---|
415 | tr.append( td3 ); |
---|
416 | tr.append( td4 ); |
---|
417 | tr.append( td5 ); |
---|
418 | tr.append( td6 ); |
---|
419 | tr.append( td7 ); |
---|
420 | tr.append( td8 ); |
---|
421 | tr.append( td9 ); |
---|
422 | |
---|
423 | container.append( tr ); |
---|
424 | }, |
---|
425 | |
---|
426 | |
---|
427 | createTrList: function( texte, inputId, index, container, type, info, event ) |
---|
428 | { |
---|
429 | var tr = $( document.createElement( "tr" ) ); |
---|
430 | var td1 = $( document.createElement( "td" ) ); |
---|
431 | var td2 = $( document.createElement( "td" ) ); |
---|
432 | var td3 = $( document.createElement( "td" ) ); |
---|
433 | var input = $( document.createElement( "input" ) ); |
---|
434 | var champ = ""; |
---|
435 | |
---|
436 | var div = $( document.createElement( "div" ) ); |
---|
437 | |
---|
438 | input.attr( {id: inputId} ); |
---|
439 | |
---|
440 | if( 'format' == type ) |
---|
441 | { |
---|
442 | this.displaySelect( td2, inputId, index, this.jSonFileFormats, this.selectFileFormatsList, false, null ); |
---|
443 | info = true; |
---|
444 | champ = "iformat_"; |
---|
445 | } |
---|
446 | else |
---|
447 | if( 'yesno' == type ) |
---|
448 | { |
---|
449 | if( (/^(ih2oe_[1-9]+)$/.test( inputId ) ) ) |
---|
450 | this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_ih2oeList, false, "yesNos" ); |
---|
451 | else if( (/^(io2e_[1-9]+)$/.test( inputId ) ) ) |
---|
452 | this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_io2eList, false, "yesNos" ); |
---|
453 | else if( (/^(io3e_[1-9]+)$/.test( inputId ) ) ) |
---|
454 | this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_io3eList, false, "yesNos" ); |
---|
455 | else if( (/^(ico2e_[1-9]+)$/.test( inputId ) ) ) |
---|
456 | this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_ico2eList, false, "yesNos" ); |
---|
457 | else if( (/^(ich4e_[1-9]+)$/.test( inputId ) ) ) |
---|
458 | this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_ich4eList, false, "yesNos" ); |
---|
459 | else if( (/^(in2oe_[1-9]+)$/.test( inputId ) ) ) |
---|
460 | this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_in2oeList, false, "yesNos" ); |
---|
461 | else if( (/^(iOneTransmission_[1-9]+)$/.test( inputId ) ) ) |
---|
462 | this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_iOneTransmissionList, false, "yesNos" ); |
---|
463 | else if( (/^(irextinction_[1-9]+)$/.test( inputId ) ) ) |
---|
464 | { |
---|
465 | |
---|
466 | this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_irextinctionList, false, "yesNos" ); |
---|
467 | info = true; |
---|
468 | champ = inputId; |
---|
469 | } |
---|
470 | else if( (/^(ibervC_[1-9]+)$/.test( inputId ) ) ) |
---|
471 | { |
---|
472 | this.displaySelect( td2, inputId, index, this.jSonYesNos, this.select_ibervCList, false, "yesNos" ); |
---|
473 | info = true; |
---|
474 | champ = inputId; |
---|
475 | |
---|
476 | } |
---|
477 | } |
---|
478 | else if( 'observatories' == type ) |
---|
479 | { |
---|
480 | this.displaySelect1( td2, inputId, index, this.jSonObservatories, this.selectObservatoriesList, true, "observatories" ); |
---|
481 | //this.displaySelect( td2, inputId, index, this.jSonObservatories, this.selectObservatoriesList, true, "observatories" ); |
---|
482 | champ = "iobservatory_"; |
---|
483 | //input.bind( 'click', [this, 'select_iobservatory_1'], this.locationChoice ); |
---|
484 | } |
---|
485 | else if( 'spectralUnit' == type ) |
---|
486 | { |
---|
487 | this.displaySelect( td2, inputId, index, this.jSonSpectralUnits, this.selectSpectralUnitsList, true, "spectralUnits" ); |
---|
488 | info = true; |
---|
489 | |
---|
490 | champ = "ispectral_choice_"; |
---|
491 | } |
---|
492 | else if( 'ilsf' == type ) |
---|
493 | { |
---|
494 | this.displaySelect( td2, inputId, index, this.jSonInstrumentalFunctions, this.selectInstrumentalFunctionsList, false, "instrumentalFunctions" ); |
---|
495 | info = true; |
---|
496 | champ = "ifunction_"; |
---|
497 | } |
---|
498 | else if( 'climatoReference' == type ) |
---|
499 | { |
---|
500 | this.displaySelect( td2, inputId, index, this.jSonClimatoReferences, this.selectClimatoReferencesList, false, "climatoReferences" ); |
---|
501 | info = true; |
---|
502 | champ = "icr_"; |
---|
503 | } |
---|
504 | |
---|
505 | |
---|
506 | |
---|
507 | td1.attr( {class:"containerLabel"} ); |
---|
508 | tr.append( td1 ); |
---|
509 | |
---|
510 | |
---|
511 | |
---|
512 | |
---|
513 | if( info ) |
---|
514 | { |
---|
515 | var img = $( document.createElement( "img" ) ); |
---|
516 | var a = $( document.createElement( "a" ) ); |
---|
517 | img.attr( "src", "resources/images/info.png" ); |
---|
518 | img.attr( "width", "19" ); |
---|
519 | a.attr( "style", "cursor:pointer" ); |
---|
520 | img.bind( "click", [champ,450,100,this], this.onClickInfos ); |
---|
521 | a.append( img ); |
---|
522 | div.append( a ); |
---|
523 | |
---|
524 | |
---|
525 | td2.attr( {colspan:10} ); |
---|
526 | td1.append( a ); |
---|
527 | td1.append( texte ); |
---|
528 | |
---|
529 | tr.append( td2 ); |
---|
530 | |
---|
531 | } |
---|
532 | else |
---|
533 | { |
---|
534 | td1.append( texte ); |
---|
535 | td2.attr( {colspan:3} ); |
---|
536 | tr.append( td2 ); |
---|
537 | } |
---|
538 | container.append( tr ); |
---|
539 | |
---|
540 | }, |
---|
541 | |
---|
542 | |
---|
543 | // REQUESTS ******************************************************** |
---|
544 | requestCreateXML: function() |
---|
545 | { |
---|
546 | var tapasForm = this.createTapasObject(); |
---|
547 | //passage de javascript a json grace au jquery |
---|
548 | var jsonTapasForm = $.toJSON( tapasForm ); |
---|
549 | |
---|
550 | |
---|
551 | if( jsonTapasForm ) |
---|
552 | $.ajax( { |
---|
553 | url: "data?methodName=createUserRequest&jsonTapas=" + jsonTapasForm, |
---|
554 | success:jQuery.proxy( this.handleCreateXML, this ), |
---|
555 | error: jQuery.proxy( this.showErrors, this ) |
---|
556 | } ); |
---|
557 | |
---|
558 | }, |
---|
559 | |
---|
560 | |
---|
561 | // HANDLES ******************************************************** = retours ajax |
---|
562 | handleCreateXML: function( result ) |
---|
563 | { |
---|
564 | this.loadingRequest.hide(); |
---|
565 | //this.loadingRequest.display(); |
---|
566 | |
---|
567 | var res = jQuery.parseJSON( result ).result; |
---|
568 | |
---|
569 | }, |
---|
570 | |
---|
571 | |
---|
572 | // EVENTS ******************************************************** |
---|
573 | onClickInfos: function( param ) |
---|
574 | { |
---|
575 | |
---|
576 | var parametre = param.data[0]; |
---|
577 | var width = param.data[1]; |
---|
578 | var height = param.data[2]; |
---|
579 | var context = param.data[3]; |
---|
580 | |
---|
581 | if( "spectral_range" == parametre ) |
---|
582 | { |
---|
583 | width = 600; |
---|
584 | height = 120; |
---|
585 | var titre = "Définition de l'intervalle spectral pour le calcul."; |
---|
586 | var pageInfo = "resources/doc/infosSpectralRange_fr.txt"; |
---|
587 | |
---|
588 | if( "fr" != context.language ) |
---|
589 | { |
---|
590 | titre = "Definition of spectral interval for the computation."; |
---|
591 | pageInfo = "resources/doc/infosSpectralRange_en.txt"; |
---|
592 | width = 600; |
---|
593 | height = 100; |
---|
594 | } |
---|
595 | |
---|
596 | } |
---|
597 | |
---|
598 | if( "ispectral_choice_" == parametre ) |
---|
599 | { |
---|
600 | var titre = "Unité spectrale"; |
---|
601 | var pageInfo = "resources/doc/infosSpectralUnit_fr.txt"; |
---|
602 | width = 600; |
---|
603 | height = 450; |
---|
604 | if( "fr" != context.language ) |
---|
605 | { |
---|
606 | titre = "Spectral unit"; |
---|
607 | pageInfo = "resources/doc/infosSpectralUnit_en.txt"; |
---|
608 | width = 500; |
---|
609 | height = 450; |
---|
610 | } |
---|
611 | } |
---|
612 | |
---|
613 | var re = new RegExp( "irp_" ); |
---|
614 | if( parametre.match( re ) ) |
---|
615 | { |
---|
616 | var titre = "Résolution"; |
---|
617 | var pageInfo = "resources/doc/infosResolution_fr.txt"; |
---|
618 | width = 600; |
---|
619 | height = 200; |
---|
620 | if( "fr" != context.language ) |
---|
621 | { |
---|
622 | titre = "Resolution power"; |
---|
623 | pageInfo = "resources/doc/infosResolution_en.txt"; |
---|
624 | width = 500; |
---|
625 | height = 200; |
---|
626 | } |
---|
627 | } |
---|
628 | |
---|
629 | var re = new RegExp( "isr_" ); |
---|
630 | if( parametre.match( re ) ) |
---|
631 | { |
---|
632 | var titre = "Taux d'échantillonnage"; |
---|
633 | var pageInfo = "resources/doc/infosSamplingRatio_fr.txt"; |
---|
634 | width = 600; |
---|
635 | height = 100; |
---|
636 | if( "fr" != context.language ) |
---|
637 | { |
---|
638 | titre = "Sampling ratio"; |
---|
639 | pageInfo = "resources/doc/infosSamplingRatio_en.txt"; |
---|
640 | width = 500; |
---|
641 | height = 100; |
---|
642 | } |
---|
643 | } |
---|
644 | |
---|
645 | var re = new RegExp( "ibervC_" ); |
---|
646 | if( parametre.match( re ) ) |
---|
647 | { |
---|
648 | var titre = "Correction BERV"; |
---|
649 | var pageInfo = "resources/doc/infosBERV_fr.txt"; |
---|
650 | width = 950; |
---|
651 | height = 700; |
---|
652 | if( "fr" != context.language ) |
---|
653 | { |
---|
654 | titre = "BERV correction"; |
---|
655 | pageInfo = "resources/doc/infosBERV_en.txt"; |
---|
656 | width = 950; |
---|
657 | height = 680; |
---|
658 | } |
---|
659 | } |
---|
660 | |
---|
661 | var re = new RegExp( "ira_" ); |
---|
662 | if( parametre.match( re ) ) |
---|
663 | { |
---|
664 | var titre = "LOS Ascension Droite"; |
---|
665 | var pageInfo = "resources/doc/infosLOSRA_fr.txt"; |
---|
666 | width = 600; |
---|
667 | height = 150; |
---|
668 | if( "fr" != context.language ) |
---|
669 | { |
---|
670 | titre = "LOS Right Ascension"; |
---|
671 | pageInfo = "resources/doc/infosLOSRA_en.txt"; |
---|
672 | width = 500; |
---|
673 | height = 150; |
---|
674 | } |
---|
675 | } |
---|
676 | |
---|
677 | var re = new RegExp( "ide_" ); |
---|
678 | if( parametre.match( re ) ) |
---|
679 | { |
---|
680 | var titre = "LOS Déclinaison"; |
---|
681 | var pageInfo = "resources/doc/infosLOSD_fr.txt"; |
---|
682 | width = 600; |
---|
683 | height = 100; |
---|
684 | if( "fr" != context.language ) |
---|
685 | { |
---|
686 | titre = "LOS Declination"; |
---|
687 | pageInfo = "resources/doc/infosLOSD_en.txt"; |
---|
688 | width = 600; |
---|
689 | height = 100; |
---|
690 | } |
---|
691 | } |
---|
692 | |
---|
693 | var re = new RegExp( "iza_" ); |
---|
694 | if( parametre.match( re ) ) |
---|
695 | { |
---|
696 | var titre = "Angle zénithal"; |
---|
697 | var pageInfo = "resources/doc/infosZenithalAngle_fr.txt"; |
---|
698 | width = 600; |
---|
699 | height = 100; |
---|
700 | if( "fr" != context.language ) |
---|
701 | { |
---|
702 | titre = "Zenithal angle"; |
---|
703 | pageInfo = "resources/doc/infosZenithalAngle_en.txt"; |
---|
704 | width = 600; |
---|
705 | height = 100; |
---|
706 | } |
---|
707 | } |
---|
708 | |
---|
709 | var re = new RegExp( "isr_" ); |
---|
710 | if( parametre.match( re ) ) |
---|
711 | { |
---|
712 | var titre = "Taux d'échantillonnage"; |
---|
713 | var pageInfo = "resources/doc/infosSamplingRatio_fr.txt"; |
---|
714 | width = 600; |
---|
715 | height = 150; |
---|
716 | if( "fr" != context.language ) |
---|
717 | { |
---|
718 | titre = "Sampling Ratio"; |
---|
719 | pageInfo = "resources/doc/infosSamplingRatio_en.txt"; |
---|
720 | width = 500; |
---|
721 | height = 150; |
---|
722 | } |
---|
723 | } |
---|
724 | |
---|
725 | var re = new RegExp( "irextinction_" ); |
---|
726 | if( parametre.match( re ) ) |
---|
727 | { |
---|
728 | var titre = "Sélection des composants atmosphériques"; |
---|
729 | var pageInfo = "resources/doc/infosSpecies_fr.txt"; |
---|
730 | width = 600; |
---|
731 | height = 350; |
---|
732 | if( "fr" != context.language ) |
---|
733 | { |
---|
734 | titre = "Selection of atmospheric constituents"; |
---|
735 | pageInfo = "resources/doc/infosSpecies_en.txt"; |
---|
736 | width = 600; |
---|
737 | height = 360; |
---|
738 | } |
---|
739 | } |
---|
740 | |
---|
741 | if( "icr_" == parametre ) |
---|
742 | { |
---|
743 | var titre = "Modèle atmosphérique"; |
---|
744 | var pageInfo = "resources/doc/infosAtmosphericModel_fr.txt"; |
---|
745 | width = 600; |
---|
746 | height = 400; |
---|
747 | if( "fr" != context.language ) |
---|
748 | { |
---|
749 | titre = "Atmospheric model"; |
---|
750 | pageInfo = "resources/doc/infosAtmosphericModel_en.txt"; |
---|
751 | width = 500; |
---|
752 | height = 400; |
---|
753 | } |
---|
754 | } |
---|
755 | |
---|
756 | if( "iobservatory_" == parametre ) |
---|
757 | { |
---|
758 | var titre = "Observatoire"; |
---|
759 | var pageInfo = "resources/doc/infosObservatory_fr.txt"; |
---|
760 | width = 600; |
---|
761 | height = 100; |
---|
762 | if( "fr" != context.language ) |
---|
763 | { |
---|
764 | titre = "Observatory"; |
---|
765 | pageInfo = "resources/doc/infosObservatory_en.txt"; |
---|
766 | width = 500; |
---|
767 | height = 100; |
---|
768 | } |
---|
769 | } |
---|
770 | |
---|
771 | if( "iformat_" == parametre ) |
---|
772 | { |
---|
773 | var titre = "Format fichier"; |
---|
774 | var pageInfo = "resources/doc/infosFileFomat_fr.txt"; |
---|
775 | width = 600; |
---|
776 | height = 100; |
---|
777 | if( "fr" != context.language ) |
---|
778 | { |
---|
779 | titre = "File format"; |
---|
780 | pageInfo = "resources/doc/infosFileFomat_en.txt"; |
---|
781 | width = 500; |
---|
782 | height = 80; |
---|
783 | } |
---|
784 | } |
---|
785 | |
---|
786 | if( "ifunction_" == parametre ) |
---|
787 | { |
---|
788 | var titre = "Fonction instrumentale"; |
---|
789 | var pageInfo = "resources/doc/infosInstrumentalFunction_fr.txt"; |
---|
790 | width = 600; |
---|
791 | height = 230; |
---|
792 | if( "fr" != context.language ) |
---|
793 | { |
---|
794 | titre = "Instrumental function"; |
---|
795 | pageInfo = "resources/doc/infosInstrumentalFunction_en.txt"; |
---|
796 | width = 500; |
---|
797 | height = 240; |
---|
798 | } |
---|
799 | } |
---|
800 | |
---|
801 | |
---|
802 | var $dialog = $( '<div></div>' ) |
---|
803 | .load( pageInfo ) |
---|
804 | .dialog( { |
---|
805 | autoOpen: false, |
---|
806 | title:titre, |
---|
807 | height:height, |
---|
808 | width:width |
---|
809 | } ); |
---|
810 | |
---|
811 | $dialog.dialog( 'open' ); |
---|
812 | |
---|
813 | }, |
---|
814 | |
---|
815 | onClickSubmit: function() |
---|
816 | { |
---|
817 | if( this.validFields() ) |
---|
818 | { |
---|
819 | this.divE.hide(); |
---|
820 | if( confirm( tapasTexts["confirm"] ) ) |
---|
821 | { |
---|
822 | this.loadingRequest.display(); |
---|
823 | this.requestCreateXML(); |
---|
824 | } |
---|
825 | } |
---|
826 | }, |
---|
827 | |
---|
828 | |
---|
829 | onClickAdd: function() |
---|
830 | { |
---|
831 | this.divE.hide(); |
---|
832 | this.nbRequest++; |
---|
833 | |
---|
834 | //tabs |
---|
835 | $( ".tab_class" ).removeClass( "activated" ); |
---|
836 | this.tabActive = this.createTab(); |
---|
837 | this.numRequest = this.tabActive.numTab; |
---|
838 | |
---|
839 | //formulaires |
---|
840 | $( ".divAll" ).hide(); |
---|
841 | this.createForm(); |
---|
842 | |
---|
843 | this.updateButtons(); |
---|
844 | }, |
---|
845 | |
---|
846 | |
---|
847 | onClickDel: function() |
---|
848 | { |
---|
849 | if( confirm( tapasTexts["label.confirm.del"] ) ) |
---|
850 | { |
---|
851 | var numCurrent = this.numRequest; |
---|
852 | |
---|
853 | var z = 1; |
---|
854 | |
---|
855 | //suppression onglet et form et controles calendrier caché |
---|
856 | $( "#all_" + numCurrent ).remove(); |
---|
857 | $( "#tab_request" + numCurrent ).remove(); |
---|
858 | AnyTime.noPicker( "iobservation_date_" + numCurrent ); |
---|
859 | AnyTime.noPicker( "iobservation_cpydate_" + numCurrent ); |
---|
860 | AnyTime.noPicker( "ira_" + numCurrent ); |
---|
861 | |
---|
862 | this.tabActive.numTab = "1"; |
---|
863 | this.numRequest = "1"; |
---|
864 | |
---|
865 | this.selectClimatoReferencesList[numCurrent] = null; |
---|
866 | |
---|
867 | for( var i = 1; i <= this.nbRequest; i++ ) |
---|
868 | { |
---|
869 | if( i > numCurrent ) |
---|
870 | { |
---|
871 | z = i - 1; |
---|
872 | document.getElementById( "all_" + i ).id = "all_" + z; |
---|
873 | $( "#tab_request" + i ).html( "Request " + z ); |
---|
874 | //$( "#tab_request" + i ).html( "toto"); |
---|
875 | $( "#tab_request" + i ).attr( {name:z} ); |
---|
876 | $( "#tab_request" + i ).attr( {id:"tab_request" + z} ); //this.angleChoice |
---|
877 | $( "#tabObservation_" + i ).attr( {id:"tabObservation_" + z} ); |
---|
878 | // $( "#select_iobservatory_" + i ).attr( {id:"select_iobservatory_" + z} ); |
---|
879 | this.selectObservatoriesList[z] = this.selectObservatoriesList[i]; |
---|
880 | this.selectObservatoriesList[i] = null; |
---|
881 | // $( "#select_ispectral_choice_" + i ).attr( {id:"select_ispectral_choice_" + z} ); |
---|
882 | this.selectSpectralUnitsList[z] = this.selectSpectralUnitsList[i]; |
---|
883 | this.selectSpectralUnitsList[i] = null; |
---|
884 | $( "#iminspectral_ranger_" + i ).attr( {id:"iminspectral_ranger_" + z} ); |
---|
885 | $( "#imaxspectral_ranger_" + i ).attr( {id:"imaxspectral_ranger_" + z} ); |
---|
886 | // $( "#select_ifunction_" + i ).attr( {id:"select_ifunction_" + z} ); |
---|
887 | this.selectInstrumentalFunctionsList[z] = this.selectInstrumentalFunctionsList[i]; |
---|
888 | this.selectInstrumentalFunctionsList[i] = null; |
---|
889 | // $( "#select_icr_" + i ).attr( {id:"select_icr_" + z} ); |
---|
890 | this.selectClimatoReferencesList[z] = this.selectClimatoReferencesList[i]; |
---|
891 | this.selectClimatoReferencesList[i] = null; |
---|
892 | // le $ n'intervient qu en html. $() remplace le document.element |
---|
893 | $( "#ide_" + i ).attr( {id:"ide_" + z} ); |
---|
894 | $( "#iza_" + i ).attr( {id:"iza_" + z} ); |
---|
895 | $( "#irp_" + i ).attr( {id:"irp_" + z} ); |
---|
896 | $( "#isr_" + i ).attr( {id:"isr_" + z} ); |
---|
897 | $( "#ira_" + i ).attr( {id:"ira_" + z} ); |
---|
898 | // $( "#select_iformat_" + i ).attr( {id:"select_iformat_" + z} ); |
---|
899 | this.selectFileFormatsList[z] = this.selectFileFormatsList[i]; |
---|
900 | this.selectFileFormatsList[i] = null; |
---|
901 | // $( "#select_irextinction_" + i ).attr( {id:"select_irextinction_" + z} ); |
---|
902 | this.select_irextinctionList[z] = this.select_irextinctionList[i]; |
---|
903 | this.select_irextinctionList[i] = null; |
---|
904 | // $( "#select_ih2oe_" + i ).attr( {id:"select_ih2oe_" + z} ); |
---|
905 | this.select_ih2oeList[z] = this.select_ih2oeList[i]; |
---|
906 | this.select_ih2oeList[i] = null; |
---|
907 | // $( "#select_io2e_" + i ).attr( {id:"select_io2e_" + z} ); |
---|
908 | this.select_io2eList[z] = this.select_io2eList[i]; |
---|
909 | this.select_io2eList[i] = null; |
---|
910 | // $( "#select_io3e_" + i ).attr( {id:"select_io3e_" + z} ); |
---|
911 | this.select_io3eList[z] = this.select_io3eList[i]; |
---|
912 | this.select_io3eList[i] = null; |
---|
913 | // $( "#select_ico2e_" + i ).attr( {id:"select_ico2e_" + z} ); |
---|
914 | this.select_ico2eList[z] = this.select_ico2eList[i]; |
---|
915 | this.select_ico2eList[i] = null; |
---|
916 | |
---|
917 | this.select_ich4eList[z] = this.select_ich4eList[i]; |
---|
918 | this.select_ich4eList[i] = null; |
---|
919 | |
---|
920 | this.select_in2oeList[z] = this.select_in2oeList[i]; |
---|
921 | this.select_in2oeList[i] = null; |
---|
922 | |
---|
923 | this.select_iOneTransmissionList[z] = this.select_iOneTransmissionList[i]; |
---|
924 | this.select_iOneTransmissionList[i] = null; |
---|
925 | |
---|
926 | this.select_ibervCList[z] = this.select_ibervCList[i]; |
---|
927 | this.select_ibervCList[i] = null; |
---|
928 | |
---|
929 | // Supression du calendrier puis re-création en insérant l'ancienne date |
---|
930 | var oldDate = this.calendarConverter.parse( $( "#iobservation_date_" + i ).val() ); |
---|
931 | AnyTime.noPicker( "iobservation_date_" + i ); |
---|
932 | |
---|
933 | if (!isEmpty($( "#iobservation_cpydate_" + i ).val())) { |
---|
934 | var oldDate2 = this.calendarConverter.parse( $( "#iobservation_cpydate_" + i ).val() ); |
---|
935 | AnyTime.noPicker( "iobservation_cpydate_" + i ); |
---|
936 | } |
---|
937 | |
---|
938 | //this.createCalendar( $( "#tabObservation_" + z ), tapasTexts["label.datemesure"], "iobservation_date_" + z, oldDate, false ); |
---|
939 | |
---|
940 | $( "#iobservation_date_" + i ).attr( {id:"iobservation_date_" + z} ); |
---|
941 | $( "#iobservation_cpydate_" + i ).attr( {id:"iobservation_cpydate_" + z} ); |
---|
942 | this.createCalendar( $( "#tabObservation_" + z ), tapasTexts["label.datemesure"], tapasTexts["label.cpydatemesure"], "iobservation_date_" + z, "iobservation_cpydate_" + z, oldDate, false ); |
---|
943 | |
---|
944 | |
---|
945 | |
---|
946 | // Idem pour les heures !!! |
---|
947 | // TODO : voir si besoin de parser les heures ou non |
---|
948 | // var oldTime = this.timeConverter.parse( $( "#ira_" + i ).val() ); |
---|
949 | /*var oldTime = $( "#ira_" + i ).val(); |
---|
950 | AnyTime.noPicker( "ira_" + i ); |
---|
951 | this.createTime( $( "#tabObservation_" + z ), tapasTexts["label.ira"], "ira_" + z, oldTime, false,"j2000" ); |
---|
952 | $( "#ira_" + i ).attr( {id:"ira_" + z} );*/ |
---|
953 | } |
---|
954 | } |
---|
955 | |
---|
956 | this.nbRequest--; |
---|
957 | |
---|
958 | // Mise à jour des boutons |
---|
959 | this.updateButtons(); |
---|
960 | |
---|
961 | //tabs |
---|
962 | $( ".tab_class" ).removeClass( "activated" ); |
---|
963 | $( "#tab_request1" ).addClass( "activated" ); |
---|
964 | |
---|
965 | //formulaires |
---|
966 | $( ".divAll" ).hide(); |
---|
967 | $( "#all_1" ).show(); |
---|
968 | } |
---|
969 | }, |
---|
970 | |
---|
971 | |
---|
972 | onClickTab: function( event ) |
---|
973 | { |
---|
974 | var realTabId = $( "#" + event.currentTarget.id ).attr( "name" ); |
---|
975 | var clickedDiv = event.data; |
---|
976 | |
---|
977 | //tabs |
---|
978 | $( ".tab_class" ).removeClass( "activated" ); |
---|
979 | clickedDiv.divContainer.addClass( "activated" ); |
---|
980 | |
---|
981 | //forms |
---|
982 | $( ".divAll" ).hide(); |
---|
983 | $( "#all_" + realTabId ).show(); |
---|
984 | |
---|
985 | this.numRequest = realTabId; |
---|
986 | this.tabActive.numTab = realTabId; |
---|
987 | |
---|
988 | this.updateButtons(); |
---|
989 | }, |
---|
990 | |
---|
991 | |
---|
992 | // OTHERS ******************************************************** |
---|
993 | // General method to display select |
---|
994 | displaySelect: function( container, id, index, jsonList, selectList, nullValueIsNeeded, contentManage ) |
---|
995 | { |
---|
996 | var paramSelect = new Object(); |
---|
997 | paramSelect.id = "select_" + id; |
---|
998 | paramSelect.parent = container; |
---|
999 | var select = new Select( paramSelect ); |
---|
1000 | |
---|
1001 | |
---|
1002 | //select.add( "tt", "bob " + tapasTexts["text.select"] + " --",this.ifunctionChoice); |
---|
1003 | |
---|
1004 | if( nullValueIsNeeded ) |
---|
1005 | select.add( "-1", "-- " + tapasTexts["text.select"] + " --" ); |
---|
1006 | jQuery.each( jsonList, jQuery.proxy( function ( i, jsonElement ) |
---|
1007 | { |
---|
1008 | switch( contentManage ) |
---|
1009 | { |
---|
1010 | case "observatories": |
---|
1011 | select.add( jsonElement.id, jsonElement.name ); |
---|
1012 | break; |
---|
1013 | case "spectralUnits": |
---|
1014 | select.add( jsonElement.value, tapasTexts[jsonElement.value] ); |
---|
1015 | break; |
---|
1016 | case "instrumentalFunctions" : |
---|
1017 | select.add( jsonElement.value, tapasTexts[jsonElement.text],jQuery.proxy(this.ifunctionChoice,this) ); // passe le gros this |
---|
1018 | break; |
---|
1019 | case "climatoReferences" : |
---|
1020 | case "yesNos" : |
---|
1021 | select.add( jsonElement.value, tapasTexts[jsonElement.text] ); |
---|
1022 | break; |
---|
1023 | default: |
---|
1024 | select.add( jsonElement.value, jsonElement.text ); |
---|
1025 | |
---|
1026 | break; |
---|
1027 | } |
---|
1028 | }, this ) ); |
---|
1029 | select.selectFirst( false ); |
---|
1030 | selectList[index] = select; |
---|
1031 | }, |
---|
1032 | |
---|
1033 | createAutoCompleteMenuForRegions: function() |
---|
1034 | { |
---|
1035 | |
---|
1036 | $( "#select_iobservatory_" + this.nbRequest ).autocomplete( { |
---|
1037 | source: this.listObs, |
---|
1038 | appendTo: "#regionContent" + this.nbRequest, |
---|
1039 | minLength: 0, |
---|
1040 | autoFocus: true, |
---|
1041 | autoSelect: true, |
---|
1042 | select: jQuery.proxy( function( event, ui ) |
---|
1043 | { |
---|
1044 | this.regionLabel = ui.item.value; |
---|
1045 | }, this ) |
---|
1046 | } ).focus( function( event ) |
---|
1047 | { |
---|
1048 | $( this ).autocomplete( "search", "" ); |
---|
1049 | } ); |
---|
1050 | |
---|
1051 | //$( "#regionTags" ).focus(); |
---|
1052 | }, |
---|
1053 | |
---|
1054 | |
---|
1055 | // OTHERS ******************************************************** |
---|
1056 | // General method to display select |
---|
1057 | displaySelect1: function( container, id, index, jsonList, selectList, nullValueIsNeeded, contentManage ) |
---|
1058 | { |
---|
1059 | var iselect = $( document.createElement( "select" ) ); |
---|
1060 | var option = document.createElement( "option" ); |
---|
1061 | |
---|
1062 | var paramSelect = new Object(); |
---|
1063 | paramSelect.id = "select_" + id; |
---|
1064 | paramSelect.parent = container; |
---|
1065 | |
---|
1066 | var observatoryArray = new Array(); |
---|
1067 | this.listObs = new Array(); |
---|
1068 | |
---|
1069 | |
---|
1070 | //var bob =$('<div id="region" class="containerField"><div class="containerTitle"><div class="containerTitleText">Region</div><div class="containerTitleClose"><img src="img/close.png"></div></div><div class="containerRegion"><input id="regionTags" size="23"/></div><div id="regionContent"></div></div> '); |
---|
1071 | var bob = $( '<div class="containerField"><input id="select_' + id + '" size="42"/></div><div id="regionContent' + this.nbRequest + '" class="regionContent"></div> ' ); |
---|
1072 | |
---|
1073 | var option = new Option(); |
---|
1074 | option.text = "-- " + tapasTexts["text.select"] + " --"; |
---|
1075 | option.value = "-1"; |
---|
1076 | |
---|
1077 | |
---|
1078 | jQuery.each( jsonList, jQuery.proxy( function ( i, jsonElement ) |
---|
1079 | { |
---|
1080 | //ajouter fonction |
---|
1081 | |
---|
1082 | /*var option = new Option(); |
---|
1083 | option.text = jsonElement.name; |
---|
1084 | option.value = jsonElement.id;*/ |
---|
1085 | //observatoryArray.push(jsonElement.name); |
---|
1086 | this.listObs.push( jsonElement.name ); |
---|
1087 | //console.log(option.value+"-"+option.text); |
---|
1088 | //iselect.append(option); |
---|
1089 | |
---|
1090 | }, this ) ); |
---|
1091 | //iselect.selectFirst( false ); |
---|
1092 | /*selectList[index] = select;*/ |
---|
1093 | //container.append(iselect); |
---|
1094 | |
---|
1095 | container.append( bob ); |
---|
1096 | selectList[index] = "select_" + id; |
---|
1097 | |
---|
1098 | |
---|
1099 | }, |
---|
1100 | |
---|
1101 | |
---|
1102 | showErrors: function( result ) |
---|
1103 | { |
---|
1104 | //this.containerErrors.show(); |
---|
1105 | // this.containerErrors.html( tapasTexts[result.responseText] ); |
---|
1106 | }, |
---|
1107 | |
---|
1108 | createForm: function() |
---|
1109 | { |
---|
1110 | |
---|
1111 | var divAll = $( document.createElement( "div" ) ); |
---|
1112 | divAll.attr( {id:"all_" + this.nbRequest, class:"divAll"} ); |
---|
1113 | |
---|
1114 | |
---|
1115 | //Creation div |
---|
1116 | var divPreference = $( document.createElement( "div" ) ); |
---|
1117 | var tabPreference = $( document.createElement( "table" ) ); |
---|
1118 | tabPreference.attr( {cellspacing:3} ); |
---|
1119 | |
---|
1120 | var divObservation = $( document.createElement( "div" ) ); |
---|
1121 | var tabObservation = $( document.createElement( "table" ) ); |
---|
1122 | //tabObservation.attr({border:1}); |
---|
1123 | tabObservation.attr( {id:"tabObservation_" + this.nbRequest, cellspacing:3} ); |
---|
1124 | |
---|
1125 | |
---|
1126 | var divAtmosphere = $( document.createElement( "div" ) ); |
---|
1127 | var tabAtmosphere = $( document.createElement( "table" ) ); |
---|
1128 | |
---|
1129 | |
---|
1130 | var fieldSetObservation = $( document.createElement( "fieldset" ) ); |
---|
1131 | fieldSetObservation.addClass( "cfs1" ); |
---|
1132 | divObservation.append( fieldSetObservation ); |
---|
1133 | |
---|
1134 | var legendObservation = $( document.createElement( "legend" ) ); |
---|
1135 | legendObservation.html( "Observation" ); |
---|
1136 | fieldSetObservation.append( legendObservation ); |
---|
1137 | legendObservation.addClass( "containerField" ); |
---|
1138 | |
---|
1139 | var fieldSetPreference = $( document.createElement( "fieldset" ) ); |
---|
1140 | fieldSetPreference.addClass( "cfs2" ); |
---|
1141 | divPreference.append( fieldSetPreference ); |
---|
1142 | |
---|
1143 | var legendPreference = $( document.createElement( "legend" ) ); |
---|
1144 | legendPreference.html( tapasTexts["label.preferences"] ); |
---|
1145 | fieldSetPreference.append( legendPreference ); |
---|
1146 | legendPreference.addClass( "containerField" ); |
---|
1147 | |
---|
1148 | fieldSetObservation.append( tabObservation ); |
---|
1149 | divObservation.addClass( "divObservation" ); |
---|
1150 | divAll.append( divObservation ); |
---|
1151 | |
---|
1152 | divAtmosphere.append( tabAtmosphere ); |
---|
1153 | //divAtmosphere.addClass("divAtmosphere"); |
---|
1154 | //this.containerForm.append( divAtmosphere ); |
---|
1155 | fieldSetObservation.append( divAtmosphere ); |
---|
1156 | |
---|
1157 | fieldSetPreference.append( tabPreference ); |
---|
1158 | divPreference.addClass( "divPreference" ); |
---|
1159 | divAll.append( divPreference ); |
---|
1160 | |
---|
1161 | this.containerForm.append( divAll ); |
---|
1162 | this.containerForm.append( this.divE ); |
---|
1163 | //this.tabInput = new Array(3); |
---|
1164 | |
---|
1165 | this.createTrList( tapasTexts["label.format"], "iformat_" + this.nbRequest, this.nbRequest, tabPreference, 'format',false,"" ); |
---|
1166 | this.createTrList( tapasTexts["label.berv"], "ibervC_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); |
---|
1167 | this.createTrList( tapasTexts["label.era"], "irextinction_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); |
---|
1168 | this.createTrList( tapasTexts["label.eh2o"], "ih2oe_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); |
---|
1169 | this.createTrList( tapasTexts["label.eo3"], "io3e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); |
---|
1170 | this.createTrList( tapasTexts["label.eo2"], "io2e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); |
---|
1171 | this.createTrList( tapasTexts["label.eco2"], "ico2e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); |
---|
1172 | this.createTrList( tapasTexts["label.ech4"], "ich4e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); |
---|
1173 | this.createTrList( tapasTexts["label.en2o"], "in2oe_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); |
---|
1174 | this.createTrList( tapasTexts["label.onetransmission"], "iOneTransmission_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno',false,"" ); |
---|
1175 | |
---|
1176 | |
---|
1177 | |
---|
1178 | this.createTrList( tapasTexts["label.observatory"], "iobservatory_" + this.nbRequest, this.nbRequest, tabObservation, 'observatories', true, "" ); |
---|
1179 | this.createTrTxt( tapasTexts["label.or"], tabObservation ); |
---|
1180 | this.createTr3Input( tapasTexts["label.locality"], tapasTexts["label.altitude"], tapasTexts["label.latitude"],tapasTexts["label.longitude"],"ilocality_" + this.nbRequest, "ialtitude_" + this.nbRequest, "ilatitude_" + this.nbRequest, "ilongitude_" + this.nbRequest , tabObservation, "[decimal]"," m" ); |
---|
1181 | |
---|
1182 | this.createCalendar( tabObservation, tapasTexts["label.datemesure"], tapasTexts["label.cpydatemesure"], "iobservation_date_" + this.nbRequest, "iobservation_cpydate_" + this.nbRequest, false, true ); |
---|
1183 | |
---|
1184 | |
---|
1185 | //unite |
---|
1186 | this.createTrList( tapasTexts["label.spectralUnit"], "ispectral_choice_" + this.nbRequest, this.nbRequest, tabObservation, 'spectralUnit', false, "" ); |
---|
1187 | this.createTr2Input( tapasTexts["label.spectralRange"], tapasTexts["label.to"], "iminspectral_ranger_" + this.nbRequest, "imaxspectral_ranger_" + this.nbRequest, tabObservation, "[350,2500] nm" ); |
---|
1188 | |
---|
1189 | //fonction instrumentale |
---|
1190 | this.createTrList( tapasTexts["label.ifunction"], "ifunction_" + this.nbRequest, this.nbRequest, tabObservation, "ilsf", false, "select"); |
---|
1191 | //reference climato |
---|
1192 | //this.createTrList( tapasTexts["label.climato"], "icr", tabAtmosphere, "climatoReference" ); |
---|
1193 | this.createTrList( tapasTexts["label.climato"], "icr_" + this.nbRequest, this.nbRequest, tabObservation, "climatoReference", false, ""); |
---|
1194 | |
---|
1195 | this.createTr( tapasTexts["label.resolution"], "irp_" + this.nbRequest, tabObservation, "", "", "", "", true ); |
---|
1196 | this.createTr( tapasTexts["label.ratio"], "isr_" + this.nbRequest, tabObservation, "", "", "", "", true ); |
---|
1197 | |
---|
1198 | this.createTr( tapasTexts["label.ira"], "ira_" + this.nbRequest, tabObservation, "hh:mm:ss (J2000)", "keypress", "ra", "2", true ); |
---|
1199 | //this.createTime( tabObservation, tapasTexts["label.ira"], "ira_" + this.nbRequest, false, true,"hh:mm:ss (J2000)" ); |
---|
1200 | this.createTr( tapasTexts["label.ide"], "ide_" + this.nbRequest, tabObservation, "deg:':''", "keypress", "de", "2", true ); |
---|
1201 | this.createTrTxt( tapasTexts["label.or"], tabObservation ); |
---|
1202 | this.createTr( tapasTexts["label.iza"], "iza_" + this.nbRequest, tabObservation, "[0,90] °", "keypress", "za", "2", true ); |
---|
1203 | |
---|
1204 | this.createAutoCompleteMenuForRegions(); |
---|
1205 | |
---|
1206 | this.initRequestFields(); |
---|
1207 | |
---|
1208 | |
---|
1209 | |
---|
1210 | |
---|
1211 | //jQuery.proxy permet d'envoyer le contexte this courant |
---|
1212 | |
---|
1213 | }, |
---|
1214 | |
---|
1215 | |
---|
1216 | |
---|
1217 | createTapasObject: function() |
---|
1218 | { |
---|
1219 | |
---|
1220 | var requests = new Array(); |
---|
1221 | var i = 1; |
---|
1222 | |
---|
1223 | |
---|
1224 | |
---|
1225 | for( var i = 1; i <= this.nbRequest; i++ ) |
---|
1226 | { |
---|
1227 | // PREFERENCE |
---|
1228 | var preference = new Object(); |
---|
1229 | |
---|
1230 | preference.format = new Object(); |
---|
1231 | //toutes les valeurs possibles |
---|
1232 | preference.format.firstValue = this.selectFileFormatsList[i].getValuesInString(); |
---|
1233 | //la valeur selectionnee |
---|
1234 | preference.format.secondValue = this.selectFileFormatsList[i].getValue(); |
---|
1235 | |
---|
1236 | preference.rayleighExtinction = new Object(); |
---|
1237 | preference.rayleighExtinction.firstValue = this.select_irextinctionList[i].getValuesInString(); |
---|
1238 | preference.rayleighExtinction.secondValue = this.select_irextinctionList[i].getValue(); |
---|
1239 | |
---|
1240 | preference.h2oExtinction = new Object(); |
---|
1241 | preference.h2oExtinction.firstValue = this.select_ih2oeList[i].getValuesInString(); |
---|
1242 | preference.h2oExtinction.secondValue = this.select_ih2oeList[i].getValue(); |
---|
1243 | |
---|
1244 | preference.o3Extinction = new Object(); |
---|
1245 | preference.o3Extinction.firstValue = this.select_io3eList[i].getValuesInString(); |
---|
1246 | preference.o3Extinction.secondValue = this.select_io3eList[i].getValue(); |
---|
1247 | |
---|
1248 | preference.o2Extinction = new Object(); |
---|
1249 | preference.o2Extinction.firstValue = this.select_io2eList[i].getValuesInString(); |
---|
1250 | preference.o2Extinction.secondValue = this.select_io2eList[i].getValue(); |
---|
1251 | |
---|
1252 | preference.co2Extinction = new Object(); |
---|
1253 | preference.co2Extinction.firstValue = this.select_ico2eList[i].getValuesInString(); |
---|
1254 | preference.co2Extinction.secondValue = this.select_ico2eList[i].getValue(); |
---|
1255 | |
---|
1256 | preference.ch4Extinction = new Object(); |
---|
1257 | preference.ch4Extinction.firstValue = this.select_ich4eList[i].getValuesInString(); |
---|
1258 | preference.ch4Extinction.secondValue = this.select_ich4eList[i].getValue(); |
---|
1259 | |
---|
1260 | preference.n2oExtinction = new Object(); |
---|
1261 | preference.n2oExtinction.firstValue = this.select_in2oeList[i].getValuesInString(); |
---|
1262 | preference.n2oExtinction.secondValue = this.select_in2oeList[i].getValue(); |
---|
1263 | |
---|
1264 | preference.bervCorrection = new Object(); |
---|
1265 | preference.bervCorrection.firstValue = this.select_ibervCList[i].getValuesInString(); |
---|
1266 | preference.bervCorrection.secondValue = this.select_ibervCList[i].getValue(); |
---|
1267 | |
---|
1268 | preference.oneTransmission = new Object(); |
---|
1269 | preference.oneTransmission.firstValue = this.select_iOneTransmissionList[i].getValuesInString(); |
---|
1270 | preference.oneTransmission.secondValue = this.select_iOneTransmissionList[i].getValue(); |
---|
1271 | |
---|
1272 | |
---|
1273 | // OBSERVATION |
---|
1274 | var observatory = new Object(); |
---|
1275 | //observatory.id = "European Southern Obs R La Serena Cerro La Silla";//this.selectObservatoriesList[i].getValue(); |
---|
1276 | //observatory.id = this.selectObservatoriesList[i].getValue(); |
---|
1277 | //observatory.id = 2; |
---|
1278 | observatory.name = $( "#select_iobservatory_" + i ).val(); |
---|
1279 | |
---|
1280 | |
---|
1281 | var location = new Object(); |
---|
1282 | location.name = $( "#ilocality_" + i ).val(); |
---|
1283 | location.longitude = $( "#ilongitude_" + i ).val(); |
---|
1284 | location.latitude = $( "#ilatitude_" + i ).val(); |
---|
1285 | location.altitude = $( "#ialtitude_" + i ).val(); |
---|
1286 | location.shortName = $( "#ilocality_" + i ).val(); |
---|
1287 | |
---|
1288 | // Los |
---|
1289 | var los = new Object(); |
---|
1290 | |
---|
1291 | //if ($( "#iza_" + i ).val().toString() != null) |
---|
1292 | los.zenithAngle = $( "#iza_" + i ).val(); |
---|
1293 | //else { |
---|
1294 | los.raJ2000 = $( "#ira_" + i ).val(); |
---|
1295 | los.decJ2000 = $( "#ide_" + i ).val(); |
---|
1296 | //} |
---|
1297 | |
---|
1298 | |
---|
1299 | //los.raJ2000 = "22:22:22";//$( "#ira_" + i ).val(); |
---|
1300 | //los.decJ2000 = "22:22:22";//$( "#ide_" + i ).val(); |
---|
1301 | //los.zenithAngle = "12";//$( "#iza_" + i ).val("12"); |
---|
1302 | |
---|
1303 | |
---|
1304 | // Instrument |
---|
1305 | var instrument = new Object(); |
---|
1306 | instrument.ilsfChoice = new Object(); |
---|
1307 | instrument.ilsfChoice.firstValue = "-1,0,1";//this.selectInstrumentalFunctionsList[i].getValuesInString(); |
---|
1308 | instrument.ilsfChoice.secondValue = this.selectInstrumentalFunctionsList[i].getValue(); |
---|
1309 | |
---|
1310 | this.selectSpectralUnitsList[i].remove( "-1" ); |
---|
1311 | instrument.spectralChoice = new Object(); |
---|
1312 | instrument.spectralChoice.firstValue = this.selectSpectralUnitsList[i].getValuesInString(); |
---|
1313 | instrument.spectralChoice.secondValue = this.selectSpectralUnitsList[i].getValue(); |
---|
1314 | |
---|
1315 | instrument.spectralRange = $( "#iminspectral_ranger_" + i ).val() + ' ' + $( "#imaxspectral_ranger_" + i ).val(); |
---|
1316 | |
---|
1317 | instrument.resolvingPower = new Object(); |
---|
1318 | instrument.resolvingPower.firstValue = "0"; |
---|
1319 | instrument.resolvingPower.secondValue = $( "#irp_" + i ).val(); |
---|
1320 | |
---|
1321 | instrument.samplingRatio = new Object(); |
---|
1322 | instrument.samplingRatio.firstValue = "0"; |
---|
1323 | instrument.samplingRatio.secondValue = $( "#isr_" + i ).val(); |
---|
1324 | |
---|
1325 | var observation = new Object(); |
---|
1326 | |
---|
1327 | if (!isEmpty($( "#iobservation_cpydate_" + i ).val()) && isDate($("#iobservation_cpydate_" + i ).val()) ) |
---|
1328 | { |
---|
1329 | observation.date = this.calendarConverter.parse( $( "#iobservation_cpydate_" + i ).val() ).getTime(); |
---|
1330 | } |
---|
1331 | else |
---|
1332 | { |
---|
1333 | observation.date = this.calendarConverter.parse( $( "#iobservation_date_" + i ).val() ).getTime(); |
---|
1334 | } |
---|
1335 | |
---|
1336 | |
---|
1337 | observation.observatory = observatory; |
---|
1338 | |
---|
1339 | observation.location = location; |
---|
1340 | |
---|
1341 | observation.los = los; |
---|
1342 | observation.instrument = instrument; |
---|
1343 | |
---|
1344 | // ATMOSPHERE |
---|
1345 | var atmosphere = new Object(); |
---|
1346 | |
---|
1347 | atmosphere.reference = new Object(); |
---|
1348 | atmosphere.reference.firstValue = this.selectClimatoReferencesList[i].getValuesInString(); |
---|
1349 | atmosphere.reference.secondValue = this.selectClimatoReferencesList[i].getValue(); |
---|
1350 | |
---|
1351 | |
---|
1352 | // REQUEST |
---|
1353 | var request = new Object(); |
---|
1354 | request.id = i; |
---|
1355 | request.preference = preference; |
---|
1356 | request.observation = observation; |
---|
1357 | request.atmosphere = atmosphere; |
---|
1358 | |
---|
1359 | requests[i - 1] = request; |
---|
1360 | } |
---|
1361 | |
---|
1362 | // TAPAS |
---|
1363 | var tapas = new Object(); |
---|
1364 | tapas.requests = requests; |
---|
1365 | return tapas; |
---|
1366 | }, |
---|
1367 | |
---|
1368 | validFields: function() |
---|
1369 | { |
---|
1370 | |
---|
1371 | for( var i = 1; i <= this.nbRequest; i++ ) |
---|
1372 | { |
---|
1373 | |
---|
1374 | var chaine = tapasTexts["text.erreur.saisie"] + " " + i + "<br>"; |
---|
1375 | var testOk1 = false; |
---|
1376 | var testOk2 = false; |
---|
1377 | var testOk3 = false; |
---|
1378 | |
---|
1379 | testOk1 = isDate( $( "#iobservation_cpydate_" + this.nbRequest ).val() ) || isEmpty( $( "#iobservation_cpydate_" + this.nbRequest ).val() ); |
---|
1380 | if( !testOk1 ) |
---|
1381 | { |
---|
1382 | this.divE.hide(); |
---|
1383 | this.divE.html( chaine + " : " + tapasTexts["text.errcpydate"] ); |
---|
1384 | this.divE.show(); |
---|
1385 | return false; |
---|
1386 | } |
---|
1387 | |
---|
1388 | |
---|
1389 | //var testOk = isSup( this.selectObservatoriesList[i].getValue(), 0 ); |
---|
1390 | var testOk = isEmpty( $( "#select_iobservatory_" + i ).val() ) || this.listObs.indexOf( $( "#select_iobservatory_" + i ).val() ) < 0; |
---|
1391 | testOk2 = !isEmpty( $( "#ilocality_" + i ).val() ) && isValidNum( $( "#ialtitude_" + i ).val() ) && isValidNum( $( "#ilatitude_" + i ).val() ) && isValidNum( $( "#ilongitude_" + i ).val() ) |
---|
1392 | |
---|
1393 | if( testOk && !testOk2) |
---|
1394 | { |
---|
1395 | this.divE.hide(); |
---|
1396 | this.divE.html( chaine + " " + tapasTexts["text.selectlocation"] ); |
---|
1397 | this.divE.show(); |
---|
1398 | return false; |
---|
1399 | } |
---|
1400 | |
---|
1401 | testOk = isDiff( this.selectSpectralUnitsList[i].getValue(), -1 ); |
---|
1402 | if( !testOk ) |
---|
1403 | { |
---|
1404 | this.divE.html( chaine + tapasTexts["label.spectralUnit"] + " : " + tapasTexts["text.toselect"] ); |
---|
1405 | this.divE.show(); |
---|
1406 | return false; |
---|
1407 | } |
---|
1408 | |
---|
1409 | testOk = isValidRange( $( "#iminspectral_ranger_" + i ).val(), $( "#imaxspectral_ranger_" + i ).val(), this.selectSpectralUnitsList[i].getValue() ); |
---|
1410 | if( !testOk ) |
---|
1411 | { |
---|
1412 | this.divE.html( chaine + tapasTexts["label.spectralRange"] + " : " + tapasTexts["text.badvalue"] ); |
---|
1413 | this.divE.show(); |
---|
1414 | return false; |
---|
1415 | } |
---|
1416 | |
---|
1417 | /*testOk = isDeg( $( "#ide_" + i ).val() ); |
---|
1418 | if( !testOk ) |
---|
1419 | { |
---|
1420 | this.divE.html( chaine + tapasTexts["label.ide"] + " : " + tapasTexts["text.badvalue"] ); |
---|
1421 | this.divE.show(); |
---|
1422 | return false; |
---|
1423 | } */ |
---|
1424 | |
---|
1425 | |
---|
1426 | testOk = isBetween( $( "#iza_" + i ).val(), 0, 90 ); |
---|
1427 | testOk1 = isValidNum( $( "#iza_" + i ).val() ); |
---|
1428 | testOk2 = isDeg( $( "#ide_" + i ).val() ); |
---|
1429 | testOk3 = isHourDeg( $( "#ira_" + i ).val() ); |
---|
1430 | if( !((testOk && testOk1) || (testOk2 && testOk3)) ) |
---|
1431 | { |
---|
1432 | if( !(testOk && testOk1) ) |
---|
1433 | this.divE.html( chaine + "LOS : " + tapasTexts["text.badvalue"] ); |
---|
1434 | else |
---|
1435 | this.divE.html( chaine + tapasTexts["label.iza"] + " : " + tapasTexts["text.badvalue"] ); |
---|
1436 | this.divE.show(); |
---|
1437 | return false; |
---|
1438 | } |
---|
1439 | |
---|
1440 | /*testOk = isBetween( $( "#iza_" + i ).val(), 0, 90 ); |
---|
1441 | if( !testOk ) |
---|
1442 | { |
---|
1443 | this.divE.html( chaine + tapasTexts["label.iza"] + " : " + tapasTexts["text.badvalue"] ); |
---|
1444 | this.divE.show(); |
---|
1445 | return false; |
---|
1446 | } */ |
---|
1447 | |
---|
1448 | |
---|
1449 | testOk = isValidNum( $( "#irp_" + i ).val() ); |
---|
1450 | testOk2 = isSupS( this.selectInstrumentalFunctionsList[i].getValue() , -1 ); |
---|
1451 | |
---|
1452 | |
---|
1453 | if (testOk2) |
---|
1454 | { |
---|
1455 | if( !testOk ) |
---|
1456 | { |
---|
1457 | this.divE.html( chaine + tapasTexts["label.resolution"] + " : " + tapasTexts["text.badvalue"] ); |
---|
1458 | this.divE.show(); |
---|
1459 | return false; |
---|
1460 | } |
---|
1461 | |
---|
1462 | testOk = isSup( $( "#irp_" + i ).val(), 1 ); |
---|
1463 | if( !testOk ) |
---|
1464 | { |
---|
1465 | this.divE.html( chaine + tapasTexts["label.resolution"] + " : " + tapasTexts["text.badvalue"] ); |
---|
1466 | this.divE.show(); |
---|
1467 | return false; |
---|
1468 | } |
---|
1469 | } |
---|
1470 | |
---|
1471 | |
---|
1472 | testOk = isValidNum( $( "#isr_" + i ).val() ); |
---|
1473 | if( !testOk ) |
---|
1474 | { |
---|
1475 | this.divE.html( chaine + tapasTexts["label.ratio"] + " : " + tapasTexts["text.badvalue"] ); |
---|
1476 | this.divE.show(); |
---|
1477 | return false; |
---|
1478 | } |
---|
1479 | |
---|
1480 | testOk = isSup( $( "#isr_" + i ).val(), 1 ); |
---|
1481 | if( !testOk ) |
---|
1482 | { |
---|
1483 | this.divE.html( chaine + tapasTexts["label.ratio"] + " : " + tapasTexts["text.badvalue"] ); |
---|
1484 | this.divE.show(); |
---|
1485 | return false; |
---|
1486 | } |
---|
1487 | } |
---|
1488 | |
---|
1489 | return true; |
---|
1490 | }, |
---|
1491 | |
---|
1492 | |
---|
1493 | |
---|
1494 | updateButtons: function() |
---|
1495 | { |
---|
1496 | if( 1 < this.nbRequest ) |
---|
1497 | this.delRequestButton.enable(); |
---|
1498 | else |
---|
1499 | this.delRequestButton.disable(); |
---|
1500 | |
---|
1501 | if( 9 <= this.nbRequest ) |
---|
1502 | this.addRequestButton.disable(); |
---|
1503 | else |
---|
1504 | this.addRequestButton.enable(); |
---|
1505 | }, |
---|
1506 | |
---|
1507 | |
---|
1508 | |
---|
1509 | angleChoice: function( params ) |
---|
1510 | { |
---|
1511 | |
---|
1512 | var context = params.data[0]; |
---|
1513 | var champ = params.data[1]; |
---|
1514 | var indice = context.nbRequest; |
---|
1515 | if( champ == "za" ) |
---|
1516 | { |
---|
1517 | $( "#ira_" + indice ).val( "" ); |
---|
1518 | $( "#ide_" + indice ).val( "" ); |
---|
1519 | //} |
---|
1520 | } |
---|
1521 | else |
---|
1522 | { |
---|
1523 | $( "#iza_" + indice ).val( "" ); |
---|
1524 | } |
---|
1525 | |
---|
1526 | }, |
---|
1527 | |
---|
1528 | |
---|
1529 | ifunctionChoice: function() |
---|
1530 | { |
---|
1531 | //this.selectInstrumentalFunctionsList[indice].select(this.selectInstrumentalFunctionsList[indice-1].getValue(),false); |
---|
1532 | //var context = params.data[0]; |
---|
1533 | //var champ = params.data[1]; |
---|
1534 | var valeur = this.selectInstrumentalFunctionsList[this.nbRequest].getValue(); |
---|
1535 | |
---|
1536 | if ( valeur == -1 ) { |
---|
1537 | $( "#irp_" + this.nbRequest ).val(""); |
---|
1538 | $( "#irp_" + this.nbRequest ).css("backgroundColor", "#bfafd6"); |
---|
1539 | $( "#irp_" + this.nbRequest ).attr('disabled','disabled'); |
---|
1540 | } |
---|
1541 | else { |
---|
1542 | $( "#irp_" + this.nbRequest ).css("backgroundColor", "#FFFFFF"); |
---|
1543 | $( "#irp_" + this.nbRequest ).removeAttr('disabled'); |
---|
1544 | } |
---|
1545 | |
---|
1546 | |
---|
1547 | //var indice = context.nbRequest; |
---|
1548 | |
---|
1549 | }, |
---|
1550 | |
---|
1551 | |
---|
1552 | locationChoice: function(ind) |
---|
1553 | { |
---|
1554 | var option = ind.data[0].toString(); |
---|
1555 | |
---|
1556 | if ("1" == option) |
---|
1557 | { |
---|
1558 | $( '#ilocality_' + this.nbRequest).val(""); |
---|
1559 | $( '#ialtitude_' + this.nbRequest).val(""); |
---|
1560 | $( '#ilatitude_' + this.nbRequest).val(""); |
---|
1561 | $( '#ilongitude_' + this.nbRequest).val(""); |
---|
1562 | } |
---|
1563 | else |
---|
1564 | { |
---|
1565 | $( '#select_iobservatory_' + this.nbRequest).val(""); |
---|
1566 | } |
---|
1567 | }, |
---|
1568 | |
---|
1569 | |
---|
1570 | |
---|
1571 | checkDate: function() |
---|
1572 | { |
---|
1573 | var testOk1 = isDate( $( "#iobservation_cpydate_" + this.nbRequest ).val() ) || isEmpty( $( "#iobservation_cpydate_" + this.nbRequest ).val()) ; |
---|
1574 | if( !testOk1 ) |
---|
1575 | { |
---|
1576 | alert( tapasTexts["text.errcpydate"] ); |
---|
1577 | return false; |
---|
1578 | } |
---|
1579 | return true; |
---|
1580 | }, |
---|
1581 | |
---|
1582 | |
---|
1583 | |
---|
1584 | emptyCpyDate: function() |
---|
1585 | { |
---|
1586 | if ( this.dateTemp != $( "#iobservation_cpydate_" + this.nbRequest ).val("") ) { |
---|
1587 | $( "#iobservation_cpydate_" + this.nbRequest ).val(""); |
---|
1588 | } |
---|
1589 | return true; |
---|
1590 | }, |
---|
1591 | |
---|
1592 | |
---|
1593 | tempDate: function() |
---|
1594 | { |
---|
1595 | this.dateTemp = "1234"; |
---|
1596 | return true; |
---|
1597 | }, |
---|
1598 | |
---|
1599 | /*this.createTrList( tapasTexts["label.format"], "iformat_" + this.nbRequest, this.nbRequest, tabPreference, 'format' ); |
---|
1600 | this.createTrList( tapasTexts["label.era"], "irextinction_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); |
---|
1601 | this.createTrList( tapasTexts["label.eh2o"], "ih2oe_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); |
---|
1602 | this.createTrList( tapasTexts["label.eo3"], "io3e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); |
---|
1603 | this.createTrList( tapasTexts["label.eo2"], "io2e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); |
---|
1604 | this.createTrList( tapasTexts["label.eco2"], "ico2e_" + this.nbRequest, this.nbRequest, tabPreference, 'yesno' ); |
---|
1605 | |
---|
1606 | this.createTrList( tapasTexts["label.observatory"], "iobservatory_" + this.nbRequest, this.nbRequest, tabObservation, 'observatories' ); |
---|
1607 | this.createCalendar( tabObservation, tapasTexts["label.datemesure"], "iobservation_date_" + this.nbRequest, false, true ); |
---|
1608 | |
---|
1609 | //unite |
---|
1610 | this.createTrList( tapasTexts["label.spectralUnit"], "ispectral_choice_" + this.nbRequest, this.nbRequest, tabObservation, 'spectralUnit' ); |
---|
1611 | this.createTr2Input( tapasTexts["label.spectralRange"], tapasTexts["label.to"], "iminspectral_ranger_" + this.nbRequest, "imaxspectral_ranger_" + this.nbRequest, tabObservation, "[350,2500] nm" ); |
---|
1612 | |
---|
1613 | //fonction instrumentale |
---|
1614 | this.createTrList( tapasTexts["label.ifunction"], "ifunction_" + this.nbRequest, this.nbRequest, tabObservation, "ilsf" ); |
---|
1615 | //reference climato |
---|
1616 | //this.createTrList( tapasTexts["label.climato"], "icr", tabAtmosphere, "climatoReference" ); |
---|
1617 | this.createTrList( tapasTexts["label.climato"], "icr_" + this.nbRequest, this.nbRequest, tabObservation, "climatoReference" ); |
---|
1618 | |
---|
1619 | |
---|
1620 | this.createTr( tapasTexts["label.ira"], "ira_" + this.nbRequest,tabObservation,"hh:mm:ss (J2000)","keypress","ra","2" ); |
---|
1621 | //this.createTime( tabObservation, tapasTexts["label.ira"], "ira_" + this.nbRequest, false, true,"hh:mm:ss (J2000)" ); |
---|
1622 | this.createTr( tapasTexts["label.ide"], "ide_" + this.nbRequest, tabObservation, "deg:':''","keypress","de","2" ); |
---|
1623 | |
---|
1624 | this.createTrTxt( "or", tabObservation ); |
---|
1625 | this.createTr( tapasTexts["label.iza"], "iza_" + this.nbRequest, tabObservation, "[0,90] °","keypress","za","2" ); |
---|
1626 | |
---|
1627 | this.createTr( tapasTexts["label.resolution"], "irp_" + this.nbRequest, tabObservation, "", "", "","" ); |
---|
1628 | this.createTr( tapasTexts["label.ratio"], "isr_" + this.nbRequest, tabObservation, "", "","","" ); |
---|
1629 | */ |
---|
1630 | |
---|
1631 | |
---|
1632 | initRequestFields: function() |
---|
1633 | { |
---|
1634 | if( this.nbRequest > 1 && this.nbRequest <= 9 ) |
---|
1635 | { |
---|
1636 | var indice = this.nbRequest; |
---|
1637 | var indice0 = indice - 1; |
---|
1638 | |
---|
1639 | //this.selectObservatoriesList[indice].select( this.selectObservatoriesList[indice - 1].getValue(), false ); |
---|
1640 | $( "#iobservation_date_" + indice ).val( $( "#iobservation_date_" + indice0 ).val() ); |
---|
1641 | $( "#iobservation_cpydate_" + indice ).val( $( "#iobservation_cpydate_" + indice0 ).val() ); |
---|
1642 | this.selectSpectralUnitsList[indice].select( this.selectSpectralUnitsList[indice - 1].getValue(), false ); |
---|
1643 | |
---|
1644 | this.selectInstrumentalFunctionsList[indice].select( this.selectInstrumentalFunctionsList[indice - 1].getValue(), false ); |
---|
1645 | this.selectClimatoReferencesList[indice].select( this.selectClimatoReferencesList[indice - 1].getValue(), false ); |
---|
1646 | |
---|
1647 | this.selectFileFormatsList[indice].select( this.selectFileFormatsList[indice - 1].getValue(), false ); |
---|
1648 | this.select_irextinctionList[indice].select( this.select_irextinctionList[indice - 1].getValue(), false ); |
---|
1649 | this.select_ih2oeList[indice].select( this.select_ih2oeList[indice - 1].getValue(), false ); |
---|
1650 | this.select_io3eList[indice].select( this.select_io3eList[indice - 1].getValue(), false ); |
---|
1651 | this.select_io2eList[indice].select( this.select_io2eList[indice - 1].getValue(), false ); |
---|
1652 | this.select_ico2eList[indice].select( this.select_ico2eList[indice - 1].getValue(), false ); |
---|
1653 | this.select_ich4eList[indice].select( this.select_ich4eList[indice - 1].getValue(), false ); |
---|
1654 | this.select_in2oeList[indice].select( this.select_in2oeList[indice - 1].getValue(), false ); |
---|
1655 | this.select_iOneTransmissionList[indice].select( this.select_iOneTransmissionList[indice - 1].getValue(), false ); |
---|
1656 | this.select_ibervCList[indice].select( this.select_ibervCList[indice - 1].getValue(), false ); |
---|
1657 | |
---|
1658 | $( "#iminspectral_ranger_" + indice ).val( $( "#iminspectral_ranger_" + indice0 ).val() ); |
---|
1659 | $( "#imaxspectral_ranger_" + indice ).val( $( "#imaxspectral_ranger_" + indice0 ).val() ); |
---|
1660 | |
---|
1661 | $( "#irp_" + indice ).val( $( "#irp_" + indice0 ).val() ); |
---|
1662 | $( "#isr_" + indice ).val( $( "#isr_" + indice0 ).val() ); |
---|
1663 | $( "#ira_" + indice ).val( $( "#ira_" + indice0 ).val() ); |
---|
1664 | $( "#ide_" + indice ).val( $( "#ide_" + indice0 ).val() ); |
---|
1665 | $( "#iza_" + indice ).val( $( "#iza_" + indice0 ).val() ); |
---|
1666 | |
---|
1667 | |
---|
1668 | // $( "#iobservatory_date_" + indice ).val( $( "#iobservatory_date_" + indice0 ).val() ); |
---|
1669 | // $( "#iobservatory_date_" + indice ).val( this.calendarConverter.format( currentDate ) ); |
---|
1670 | |
---|
1671 | //$( "#iobservatory_date_" + indice ).val( this.calendarConverter.format( this.calendarConverter.parse( $( "#iobservation_date_" + indice0 ).val() ).getTime() ) ); |
---|
1672 | // this.selectSpectralUnitsList[z] = this.selectSpectralUnitsList[i]; |
---|
1673 | /*this.selectSpectralUnitsList[i] = null; |
---|
1674 | $( "#iminspectral_ranger_" + i ).attr( {id:"iminspectral_ranger_" + z} ); |
---|
1675 | $( "#imaxspectral_ranger_" + i ).attr( {id:"imaxspectral_ranger_" + z} );*/ |
---|
1676 | |
---|
1677 | //$( "#irp_"+indice ).val($( "#irp_"+(indice-1)).val() ); |
---|
1678 | |
---|
1679 | } |
---|
1680 | } |
---|
1681 | |
---|
1682 | } ); |
---|
1683 | |
---|
1684 | </script> |
---|