source: tapas/web/project/formTapas_script.jsp

Last change on this file was 825, checked in by rboipsl, 9 years ago

changement logo
champs locality/lieu desactives
+modif sur tapas.css et bas page frontend
+ ajout textes info xml et one transmission

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