source: geisa/web/initGeisa_script.jsp @ 564

Last change on this file since 564 was 564, checked in by npipsl, 12 years ago

Modifications de l'interface demandees par ara version1

File size: 98.7 KB
Line 
1<%@ page import="com.ether.Controller" %>
2<%@ page import="com.ether.IsotopeG03" %>
3<%@ page import="com.ether.IsotopeIasiG03" %>
4<%@ page import="com.ether.IsotopeG09" %>
5<%@ page import="com.ether.IsotopeIasiG09" %>
6
7<script type="text/javascript">
8
9
10
11//permet de deselectionner la molecule quand on deselectionne un isotope (toutes les options sauf lst)
12/*function decliquemol( name )
13 {
14
15 var inputs = document.getElementsByTagName( 'input' );
16 var count = inputs.length;
17 for( i = 0; i < count; i++ )
18 {
19 input = inputs.item( i );
20 if( input.type == 'checkbox' && input.id == (name + '-all') && input.checked == true )
21 {
22 input.checked = false;
23 }
24 }
25 } */
26
27
28var InterfaceInit = Class.create( {
29
30            initialize: function()
31            {
32                /** *********** CONTAINERS *********** **/
33                this.containerFormSpectralRangeLower = $( "#spectralRangeLower" );
34                this.containerFormSpectralRangeUpper = $( "#spectralRangeUpper" );
35                this.containerFormIntensityLower = $( "#intensityLower" );
36                this.containerFormIntensityUpper = $( "#intensityUpper" );
37                this.containerFormMeanValue1 = $( "#meanValue1" );
38                this.containerDownload = $( "#downloadContainer" );
39                this.containerLoading = $( "#loading" );
40                /** *********** VARIABLE *********** **/
41                <%--this.pathImg = <%=Controller.PATH_IMAGES%>;--%>
42
43                this.initializeMolecules();
44                this.createForm();
45
46                var downloadButton = new Button( {value:"Download", parent:$( "#downloadContainer" ), id:"button_submit_2", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickDownload, this )} );
47            },
48
49            initializeMolecules: function()
50            {
51                this.arrayGeisa2011 = new Array();
52                this.arrayGeisa2003 = new Array();
53                this.arrayGeisaIasi2011 = new Array();
54                this.arrayGeisaIasi2003 = new Array();
55
56                var molecule = new Object();
57                molecule.id="h2o";
58                molecule.name="H<sub>2</sub>O";
59                molecule.isotopesArray = ["161", "162", "171", "181", "182", "172"];
60                this.arrayGeisa2011.push(molecule);
61                this.arrayGeisa2003.push(molecule);
62                this.arrayGeisaIasi2011.push(molecule);
63                this.arrayGeisaIasi2003.push(molecule);
64
65                var molecule = new Object();
66                molecule.id="co2";
67                molecule.name="CO<sub>2</sub>";
68                molecule.isotopesArray = ["626", "627", "628", "636", "637", "638", "728", "828", "838"];
69                this.arrayGeisa2003.push(molecule);
70                this.arrayGeisa2011.push(molecule);
71                this.arrayGeisaIasi2011.push(molecule);
72                this.arrayGeisaIasi2003.push(molecule);
73
74                var molecule = new Object();
75                molecule.id="o3";
76                molecule.name="O<sub>3</sub>";
77                molecule.isotopesArray = ["666", "668", "686", "667", "676"];
78                this.arrayGeisa2003.push(molecule);
79                this.arrayGeisa2011.push(molecule);
80                this.arrayGeisaIasi2011.push(molecule);
81                this.arrayGeisaIasi2003.push(molecule);
82
83                var molecule = new Object();
84                molecule.id="n2o";
85                molecule.name="N<sub>2</sub>O";
86                molecule.isotopesArray = ["446", "447", "448", "456","458", "546", "548", "556"];
87                this.arrayGeisa2011.push(molecule);
88                this.arrayGeisaIasi2011.push(molecule);
89
90                var molecule = new Object();
91                molecule.id="n2o";
92                molecule.name="N<sub>2</sub>O";
93                molecule.isotopesArray = ["446", "447", "448", "456", "546"];
94                this.arrayGeisa2003.push(molecule);
95                this.arrayGeisaIasi2003.push(molecule);
96
97                var molecule = new Object();
98                molecule.id="co";
99                molecule.name="CO";
100                molecule.isotopesArray = ["26", "36", "28", "27", "38", "37"];
101                this.arrayGeisa2011.push(molecule);
102                this.arrayGeisa2003.push(molecule);
103                this.arrayGeisaIasi2011.push(molecule);
104                this.arrayGeisaIasi2003.push(molecule);
105
106                var molecule = new Object();
107                molecule.id="ch4";
108                molecule.name="CH<sub>4</sub>";
109                molecule.isotopesArray = ["211", "311"];
110                this.arrayGeisa2011.push(molecule);
111                this.arrayGeisa2003.push(molecule);
112
113                var molecule = new Object();
114                molecule.id="ch4";
115                molecule.name="CH<sub>4</sub>";
116                molecule.isotopesArray = ["211", "311", "212", "312"];
117                this.arrayGeisaIasi2011.push(molecule);
118
119                var molecule = new Object();
120                molecule.id="ch4";
121                molecule.name="CH<sub>4</sub>";
122                molecule.isotopesArray = ["211", "311", "212"];
123                this.arrayGeisaIasi2003.push(molecule);
124
125                var molecule = new Object();
126                molecule.id="o2";
127                molecule.name="O<sub>2</sub>";
128                molecule.isotopesArray = ["66", "67", "68"];
129                this.arrayGeisa2011.push(molecule);
130                this.arrayGeisa2003.push(molecule);
131
132                var molecule = new Object();
133                molecule.id="o2";
134                molecule.name="O<sub>2</sub>";
135                molecule.isotopesArray = ["66"];
136                this.arrayGeisaIasi2011.push(molecule);
137                this.arrayGeisaIasi2003.push(molecule);
138
139                var molecule = new Object();
140                molecule.id="no";
141                molecule.name="NO";
142                molecule.isotopesArray = ["46", "48", "56"];
143                this.arrayGeisa2011.push(molecule);
144                this.arrayGeisa2003.push(molecule);
145                this.arrayGeisaIasi2011.push(molecule);
146                this.arrayGeisaIasi2003.push(molecule);
147
148                var molecule = new Object();
149                molecule.id="so2";
150                molecule.name="SO<sub>2</sub>";
151                molecule.isotopesArray = ["626", "646"];
152                this.arrayGeisa2011.push(molecule);
153                this.arrayGeisa2003.push(molecule);
154                this.arrayGeisaIasi2011.push(molecule);
155                this.arrayGeisaIasi2003.push(molecule);
156
157                var molecule = new Object();
158                molecule.id="no2";
159                molecule.name="NO<sub>2</sub>";
160                molecule.isotopesArray = ["646"];
161                this.arrayGeisa2011.push(molecule);
162                this.arrayGeisa2003.push(molecule);
163                this.arrayGeisaIasi2011.push(molecule);
164                this.arrayGeisaIasi2003.push(molecule);
165
166                var molecule = new Object();
167                molecule.id="nh3";
168                molecule.name="NH<sub>3</sub>";
169                molecule.isotopesArray = ["411", "511" ];
170                this.arrayGeisa2011.push(molecule);
171                this.arrayGeisa2003.push(molecule);
172                this.arrayGeisaIasi2011.push(molecule);
173
174                var molecule = new Object();
175                molecule.id="ph3";
176                molecule.name="PH<sub>3</sub>";
177                molecule.isotopesArray = ["131" ];
178                this.arrayGeisa2011.push(molecule);
179                this.arrayGeisa2003.push(molecule);
180
181                var molecule = new Object();
182                molecule.id="hno3";
183                molecule.name="HNO<sub>3</sub>";
184                molecule.isotopesArray = ["146" ];
185                this.arrayGeisa2011.push(molecule);
186                this.arrayGeisa2003.push(molecule);
187                this.arrayGeisaIasi2011.push(molecule);
188                this.arrayGeisaIasi2003.push(molecule);
189
190                var molecule = new Object();
191                molecule.id="oh";
192                molecule.name="OH";
193                molecule.isotopesArray = ["61", "62", "81" ];
194                this.arrayGeisa2011.push(molecule);
195                this.arrayGeisa2003.push(molecule);
196
197                var molecule = new Object();
198                molecule.id="hf";
199                molecule.name="HF";
200                molecule.isotopesArray = ["19" ];
201                this.arrayGeisa2011.push(molecule);
202                this.arrayGeisa2003.push(molecule);
203
204                var molecule = new Object();
205                molecule.id="hcl";
206                molecule.name="HCL";
207                molecule.isotopesArray = ["15", "17" ];
208                this.arrayGeisa2011.push(molecule);
209                this.arrayGeisa2003.push(molecule);
210
211                var molecule = new Object();
212                molecule.id="hbr";
213                molecule.name="HBR";
214                molecule.isotopesArray = ["11", "19" ];
215                this.arrayGeisa2011.push(molecule);
216                this.arrayGeisa2003.push(molecule);
217
218                var molecule = new Object();
219                molecule.id="hi";
220                molecule.name="HI";
221                molecule.isotopesArray = ["17" ];
222                this.arrayGeisa2011.push(molecule);
223                this.arrayGeisa2003.push(molecule);
224
225                var molecule = new Object();
226                molecule.id="clo";
227                molecule.name="ClO";
228                molecule.isotopesArray = ["56", "76" ];
229                this.arrayGeisa2011.push(molecule);
230                this.arrayGeisa2003.push(molecule);
231
232                var molecule = new Object();
233                molecule.id="ocs";
234                molecule.name="OCS";
235                molecule.isotopesArray = ["622", "624", "632", "623", "822", "634"];
236                this.arrayGeisa2011.push(molecule);
237                this.arrayGeisa2003.push(molecule);
238                this.arrayGeisaIasi2011.push(molecule);
239                this.arrayGeisaIasi2003.push(molecule);
240
241                var molecule = new Object();
242                molecule.id="h2co";
243                molecule.name="H<sub>2</sub>CO";
244                molecule.isotopesArray = ["126", "128", "136"];
245                this.arrayGeisa2011.push(molecule);
246                this.arrayGeisa2003.push(molecule);
247
248                var molecule = new Object();
249                molecule.id="h2co";
250                molecule.name="H<sub>2</sub>CO";
251                molecule.isotopesArray = ["126"];
252                this.arrayGeisaIasi2011.push(molecule);
253
254                var molecule = new Object();
255                molecule.id="c2h6";
256                molecule.name="C<sub>2</sub>H<sub>6</sub>";
257                molecule.isotopesArray = ["226", "236"];
258                this.arrayGeisa2011.push(molecule);
259                this.arrayGeisa2003.push(molecule);
260
261                var molecule = new Object();
262                molecule.id="ch3d";
263                molecule.name="CH<sub>3</sub>D";
264                molecule.isotopesArray = ["212", "312"];
265                this.arrayGeisa2011.push(molecule);
266
267                var molecule = new Object();
268                molecule.id="ch3d";
269                molecule.name="CH<sub>3</sub>D";
270                molecule.isotopesArray = ["212"];
271                this.arrayGeisa2003.push(molecule);
272
273                var molecule = new Object();
274                molecule.id="c2h2";
275                molecule.name="C<sub>2</sub>H<sub>2</sub>";
276                molecule.isotopesArray = ["221", "231"];
277                this.arrayGeisa2011.push(molecule);
278                this.arrayGeisa2003.push(molecule);
279                this.arrayGeisaIasi2011.push(molecule);
280                this.arrayGeisaIasi2003.push(molecule);
281
282                var molecule = new Object();
283                molecule.id="c2h4";
284                molecule.name="C<sub>2</sub>H<sub>4</sub>";
285                molecule.isotopesArray = ["211", "311"];
286                this.arrayGeisa2011.push(molecule);
287                this.arrayGeisa2003.push(molecule);
288                this.arrayGeisaIasi2011.push(molecule);
289
290                var molecule = new Object();
291                molecule.id="geh4";
292                molecule.name="GeH<sub>4</sub>";
293                molecule.isotopesArray = ["411"];
294                this.arrayGeisa2011.push(molecule);
295                this.arrayGeisa2003.push(molecule);
296
297                var molecule = new Object();
298                molecule.id="hcn";
299                molecule.name="HCN";
300                molecule.isotopesArray = ["124", "125", "134", "224"];
301                this.arrayGeisa2011.push(molecule);
302                this.arrayGeisaIasi2011.push(molecule);
303
304                var molecule = new Object();
305                molecule.id="hcn";
306                molecule.name="HCN";
307                molecule.isotopesArray = ["124", "125", "134"];
308                this.arrayGeisa2003.push(molecule);
309
310                var molecule = new Object();
311                molecule.id="c3h8";
312                molecule.name="C<sub>3</sub>H<sub>8</sub>";
313                molecule.isotopesArray = ["221"];
314                this.arrayGeisa2011.push(molecule);
315                this.arrayGeisa2003.push(molecule);
316
317                var molecule = new Object();
318                molecule.id="c2n2";
319                molecule.name="C<sub>2</sub>N<sub>2</sub>";
320                molecule.isotopesArray = ["224"];
321                this.arrayGeisa2011.push(molecule);
322                this.arrayGeisa2003.push(molecule);
323
324                var molecule = new Object();
325                molecule.id="c4h2";
326                molecule.name="C<sub>4</sub>H<sub>2</sub>";
327                molecule.isotopesArray = ["211"];
328                this.arrayGeisa2011.push(molecule);
329                this.arrayGeisa2003.push(molecule);
330
331                var molecule = new Object();
332                molecule.id="hc3n";
333                molecule.name="HC<sub>3</sub>N";
334                molecule.isotopesArray = ["124"];
335                this.arrayGeisa2011.push(molecule);
336                this.arrayGeisa2003.push(molecule);
337
338                var molecule = new Object();
339                molecule.id="hocl";
340                molecule.name="HOCl";
341                molecule.isotopesArray = ["165", "167"];
342                this.arrayGeisa2011.push(molecule);
343                this.arrayGeisa2003.push(molecule);
344
345                var molecule = new Object();
346                molecule.id="n2";
347                molecule.name="N<sub>2</sub>";
348                molecule.isotopesArray = ["44"];
349                this.arrayGeisa2011.push(molecule);
350                this.arrayGeisa2003.push(molecule);
351                this.arrayGeisaIasi2011.push(molecule);
352                this.arrayGeisaIasi2003.push(molecule);
353
354                var molecule = new Object();
355                molecule.id="ch3cl";
356                molecule.name="CH<sub>3</sub>Cl";
357                molecule.isotopesArray = ["215", "217"];
358                this.arrayGeisa2011.push(molecule);
359                this.arrayGeisa2003.push(molecule);
360
361                var molecule = new Object();
362                molecule.id="h2o2";
363                molecule.name="H<sub>2</sub>O<sub>2</sub>";
364                molecule.isotopesArray = ["166"];
365                this.arrayGeisa2011.push(molecule);
366                this.arrayGeisa2003.push(molecule);
367
368                var molecule = new Object();
369                molecule.id="h2s";
370                molecule.name="H<sub>2</sub>S";
371                molecule.isotopesArray = ["121", "141", "131"];
372                this.arrayGeisa2011.push(molecule);
373                this.arrayGeisa2003.push(molecule);
374
375                var molecule = new Object();
376                molecule.id="hcooh";
377                molecule.name="HCOOH";
378                molecule.isotopesArray = ["261"];
379                this.arrayGeisa2011.push(molecule);
380                this.arrayGeisa2003.push(molecule);
381                this.arrayGeisaIasi2011.push(molecule);
382
383                var molecule = new Object();
384                molecule.id="cof2";
385                molecule.name="COF<sub>2</sub>";
386                molecule.isotopesArray = ["269"];
387                this.arrayGeisa2011.push(molecule);
388                this.arrayGeisa2003.push(molecule);
389
390                var molecule = new Object();
391                molecule.id="sf6";
392                molecule.name="SF<sub>6</sub>";
393                molecule.isotopesArray = ["29"];
394                this.arrayGeisa2011.push(molecule);
395                this.arrayGeisa2003.push(molecule);
396
397                var molecule = new Object();
398                molecule.id="c3h4";
399                molecule.name="C<sub>3</sub>H<sub>4</sub>";
400                molecule.isotopesArray = ["341"];
401                this.arrayGeisa2011.push(molecule);
402                this.arrayGeisa2003.push(molecule);
403
404                var molecule = new Object();
405                molecule.id="ho2";
406                molecule.name="HO<sub>2</sub>";
407                molecule.isotopesArray = ["166"];
408                this.arrayGeisa2011.push(molecule);
409                this.arrayGeisa2003.push(molecule);
410
411                var molecule = new Object();
412                molecule.id="clono2";
413                molecule.name="ClONO<sub>2</sub>";
414                molecule.isotopesArray = ["564", "764"];
415                this.arrayGeisa2011.push(molecule);
416                this.arrayGeisa2003.push(molecule);
417
418                var molecule = new Object();
419                molecule.id="ch3br";
420                molecule.name="CH<sub>3</sub>Br";
421                molecule.isotopesArray = ["79", "81"];
422                this.arrayGeisa2011.push(molecule);
423
424                var molecule = new Object();
425                molecule.id="ch3oh";
426                molecule.name="CH<sub>3</sub>OH";
427                molecule.isotopesArray = ["216"];
428                this.arrayGeisa2011.push(molecule);
429                this.arrayGeisaIasi2011.push(molecule);
430
431                var molecule = new Object();
432                molecule.id="noplus";
433                molecule.name="NO<sup>+</sup>";
434                molecule.isotopesArray = ["46"];
435                this.arrayGeisa2011.push(molecule);
436
437                var molecule = new Object();
438                molecule.id="hnc";
439                molecule.name="HNC";
440                molecule.isotopesArray = ["142"];
441                this.arrayGeisa2011.push(molecule);
442
443                var molecule = new Object();
444                molecule.id="c6h6";
445                molecule.name="C<sub>6</sub>H<sub>6</sub>";
446                molecule.isotopesArray = ["266"];
447                this.arrayGeisa2011.push(molecule);
448
449                var molecule = new Object();
450                molecule.id="c2hd";
451                molecule.name="C<sub>2</sub>HD";
452                molecule.isotopesArray = ["122"];
453                this.arrayGeisa2011.push(molecule);
454
455                var molecule = new Object();
456                molecule.id="cf4";
457                molecule.name="CF<sub>4</sub>";
458                molecule.isotopesArray = ["291"];
459                this.arrayGeisa2011.push(molecule);
460
461                var molecule = new Object();
462                molecule.id="ch3cn";
463                molecule.name="CH<sub>3</sub>CN";
464                molecule.isotopesArray = ["234"];
465                this.arrayGeisa2011.push(molecule);
466
467
468            },
469
470// CREATES ********************************************************
471            createForm: function()
472            {
473                //Titre de la page
474                var titlePage = document.createTextNode("Graphic vizualisation of the  GEISA  database");
475                document.getElementById("titlePage").appendChild(titlePage);
476
477                // Create menu deroulant  choix de la base
478                var paramDatabase = new Object();
479                paramDatabase.id = "selectDatabase";
480                paramDatabase.parent = $("#database1");
481                this.selectDatabase = new Select( paramDatabase );
482                this.selectDatabase.add( 'GEISA2011', "GEISA 2011", jQuery.proxy(this.onClickSelectDatabase, this), '<%=IsotopeG09.class%>' );
483                this.selectDatabase.add( 'GEISAIASI2011', "GEISA-IASI 2011", jQuery.proxy(this.onClickSelectDatabase, this), '<%=IsotopeIasiG09.class%>' );
484                this.selectDatabase.add( 'GEISA2003', "GEISA 2003", jQuery.proxy(this.onClickSelectDatabase, this), '<%=IsotopeG03.class%>' );
485                this.selectDatabase.add( 'GEISAIASI2003', "GEISA-IASI 2003", jQuery.proxy(this.onClickSelectDatabase, this), '<%=IsotopeIasiG03.class%>' );
486                this.selectDatabase.selectFirst( false );
487
488
489                this.createMolecules($('#BDD-GEISA2011'), this.arrayGeisa2011, "GEISA2011");
490                this.createMolecules($('#BDD-GEISA2003'), this.arrayGeisa2003, "GEISA2003");
491                this.createMolecules($('#BDD-GEISAIASI2011'), this.arrayGeisaIasi2011, "GEISAIASI2011");
492                this.createMolecules($('#BDD-GEISAIASI2003'), this.arrayGeisaIasi2003, "GEISAIASI2003");
493
494
495                //Zone texte  SpectralRange
496                //Titre général (qui changera en fonction de la base geisa choisie)
497                document.getElementById('spectralRangeTitre').innerHTML = "";
498                document.getElementById('spectralRangeTitre').innerHTML = "Choosing the spectral range from 0 to 35877.030506 cm<sup>-1</sup>";
499
500                //Titre
501                //var titleSpectralRangeLower = document.createTextNode("Upper Bound :");
502               // document.getElementById("spectralRangeLower").appendChild(titleSpectralRangeLower);
503                document.getElementById("spectralRangeLower").innerHTML = "Lower value, cm<sup>-1</sup> : ";
504                //var titleSpectralRangeUpper = document.createTextNode("Upper Bound :");
505               // document.getElementById("spectralRangeUpper").appendChild(titleSpectralRangeUpper);
506                document.getElementById("spectralRangeUpper").innerHTML = "Upper value, cm<sup>-1</sup> : ";
507                //zone texte  SpectralRangeLower
508                var inputSpectralRangeLower = $( document.createElement( "input" ) );
509                inputSpectralRangeLower.attr( {id:"RangeLower", class:"styleInputs"} );
510                inputSpectralRangeLower.val(0);
511                //pour mettre à jour le menu déroulant des transitions
512                inputSpectralRangeLower.bind( 'blur', this, jQuery.proxy( this.requestTransition, this ));
513                this.containerFormSpectralRangeLower.append( inputSpectralRangeLower );
514                //zone texte   SpectralRangeUpper
515                var inputSpectralRangeUpper = $( document.createElement( "input" ) );
516                inputSpectralRangeUpper.attr( {id:"RangeUpper"} );
517                inputSpectralRangeUpper.val(35877.030506);
518                //pour mettre à jour le menu déroulant des transitions lorsque l'on change la valeur du spectral range
519                inputSpectralRangeUpper.bind( 'blur', this, jQuery.proxy( this.requestTransition, this ));
520                this.containerFormSpectralRangeUpper.append( inputSpectralRangeUpper );
521
522
523                 //Zone texte Intensity
524                //Titre
525                //var titleIntensityLower = document.createTextNode("Lower Bound :");
526                //document.getElementById("intensityLower").appendChild(titleIntensityLower);
527                //var titleIntensityUpper = document.createTextNode("Upper Bound :");
528                //document.getElementById("intensityUpper").appendChild(titleIntensityUpper);
529                  document.getElementById("intensityLower").innerHTML = "Lower value, cm/mol. : "
530                  document.getElementById("intensityUpper").innerHTML = "Upper value, cm/mol. : "
531
532                //zone texte    IntensityLower
533                var inputIntensityLower = $( document.createElement( "input" ) );
534                inputIntensityLower.attr( {id:"intensityLo", class:"styleInputs"} );
535                inputIntensityLower.val(0);
536                this.containerFormIntensityLower.append( inputIntensityLower );
537                //zone texte    IntensityUpper
538                var inputIntensityUpper = $( document.createElement( "input" ) );
539                inputIntensityUpper.attr( {id:"intensityUp"} );
540                inputIntensityUpper.val(1e-16);
541                this.containerFormIntensityUpper.append( inputIntensityUpper );
542
543
544                // Create menu deroulant  1er choix axe des y
545                //Titre
546                var titleAxeY1 = document.createTextNode("Select parameter (left Y-axis)");
547                document.getElementById("axeY1").appendChild(titleAxeY1);
548                var spaceBr = document.createElement ("br");
549                document.getElementById("axeY1").appendChild(spaceBr);
550                //menu déroulant
551                var paramSelectAxeY1 = new Object();
552                paramSelectAxeY1.id = "selectAxeY1";
553                paramSelectAxeY1.parent = $("#axeY1");
554                this.selectTraceAxeY1 = new Select( paramSelectAxeY1 );
555                this.selectTraceAxeY1.add( 'B', "Intensity", jQuery.proxy(this.onClickSelectTraceAxeY1, this ));
556                this.selectTraceAxeY1.add( 'C', "Air broadening pressure halfwidth", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
557                this.selectTraceAxeY1.add( 'D', "Energy of the lower transition level", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
558                this.selectTraceAxeY1.add( 'F', "Temperature dependence coefficient n of the air broadening halfwidth ", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
559                this.selectTraceAxeY1.add( 'N', "Self broadening pressure halfwidth (HWHM)", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
560                this.selectTraceAxeY1.add( 'O', "Air pressure shift of the line transition", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
561                this.selectTraceAxeY1.add( 'R', "Temperature dependence coefficient of the air pressure shift ", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
562                this.selectTraceAxeY1.selectFirst( false );
563
564
565                // Create menu deroulant  type de graphe
566                 //Titre
567                var titleTypeTrace = document.createTextNode("Type of graph");
568                document.getElementById("NbCourbes").appendChild(titleTypeTrace);
569                var spaceBr = document.createElement ("br");
570                document.getElementById("NbCourbes").appendChild(spaceBr);
571                //menu déroulant
572                var paramNbCourbes = new Object();
573                paramNbCourbes.id = "SelectNbCourbes";
574                paramNbCourbes.parent = $("#NbCourbes");
575                this.SelectNbCourbes = new Select( paramNbCourbes );
576                this.SelectNbCourbes.add( 'ca', "One curve for all selection", jQuery.proxy(this.onClickSelectNbCourbes, this ) );
577                this.SelectNbCourbes.add( 'cm', "One curve for each molecule selected", jQuery.proxy(this.onClickSelectNbCourbes, this ) );
578                this.SelectNbCourbes.add( 'ci', "One curve for each isotopologue selected", jQuery.proxy(this.onClickSelectNbCourbes, this ) );
579                this.SelectNbCourbes.add( 'gm', "One graph for each molecule selected", jQuery.proxy(this.onClickSelectNbCourbes, this ) );
580                this.SelectNbCourbes.add( 'gi', "One graph for each isotopologue selected", jQuery.proxy(this.onClickSelectNbCourbes, this ) );
581                this.SelectNbCourbes.selectFirst( false );
582
583
584
585
586                // Create menu deroulant  type d'échelle linéaire ou logarithmique  pour le choix y1
587                //Titre
588                var titleScaleY1 = document.createTextNode("Select the type of Scale (if intensity is choosen)");
589                document.getElementById("scaleY1Titre").appendChild(titleScaleY1);
590                //menu déroulant
591                var paramSelectScaleY1 = new Object();
592                paramSelectScaleY1.id = "SelectScaleY1";
593                paramSelectScaleY1.parent = $("#scaleY1");
594                this.selectScaleY1 = new Select( paramSelectScaleY1 );
595                this.selectScaleY1.add( 'l', "Linear" );
596                this.selectScaleY1.add( '-log_scale', "Logarithmic" );
597                this.selectScaleY1.selectFirst( false );
598
599                // Create menu deroulant  style de tracer   Y1
600                //Titre
601                var titleTypeTrace = document.createTextNode("Select the type of plot");
602                document.getElementById("typePlotY1").appendChild(titleTypeTrace);
603                var spaceBr = document.createElement ("br");
604                document.getElementById("typePlotY1").appendChild(spaceBr);
605                //menu déroulant
606                var paramSelectTypeTraceY1 = new Object();
607                paramSelectTypeTraceY1.id = "SelectTypePlotY1";
608                paramSelectTypeTraceY1.parent = $("#typePlotY1");
609                this.selectTypeTraceY1 = new Select( paramSelectTypeTraceY1 );
610                this.selectTypeTraceY1.add( 'l', "Lines" );
611                this.selectTypeTraceY1.add( 'p', "Dots" );
612                this.selectTypeTraceY1.add( 'i', "Peaks" );
613                this.selectTypeTraceY1.add( 'lp', "Lines and Dots" );
614                this.selectTypeTraceY1.selectFirst( false );
615
616                // Show/Hide advanced options
617               // document.getElementById('showAdvancedOptions').innerHTML = "";
618               // document.getElementById('showAdvancedOptions').innerHTML = "Show advanced options";
619
620
621var showHide = document.createElement('a');
622showHide.setAttribute('href',jQuery.proxy( this.onClickShowAdvancedOptions, this ));
623showHide.setAttribute('title',"caption");
624showHide.innerHTML="Show advanced options";
625document.getElementById('showAdvancedOptions').appendChild(showHide);
626
627// var showHide = $( document.createElement( "a" ) );
628// showHide.attr( {href:"url", title:"caption",  } );
629// showHide.innerHTML= "Show advanced options";
630 //showHide.bind( 'click', this, jQuery.proxy( this.onClickShowAdvancedOptions, this ));
631// $("#showAdvancedOptions").append( showHide );
632
633
634
635
636
637                //titre  menu deroulant  transition upper
638               var titleTransitionUpper = document.createTextNode("Upper state : ");
639               document.getElementById("transitionUpper").appendChild(titleTransitionUpper);
640
641
642                // Create menu deroulant  transition upper
643//                var paramSelectTransitionUpper = new Object();
644//                paramSelectTransitionUpper.id = "transition1";
645//                paramSelectTransitionUpper.parent = $("#transitionUpper");
646//                this.selectTransitionUpper = new Select( paramSelectTransitionUpper );
647//                this.selectTransitionUpper.add( '-1', "Select a molecule" );
648//                this.selectTransitionUpper.selectFirst( false );
649
650                this.selectTransitionUpper = $( document.createElement( "select" ) );
651                this.selectTransitionUpper.attr( {id:"transition1"} );
652                var optTransitionUpper = $( document.createElement( "option" ) );
653                optTransitionUpper.attr( {value:"-1", text:"Select a molecule"} );
654                //var  transitionsLower ="000";
655                // opt2.bind( 'click', jQuery.proxy(this.requestTransitionByTransitionLower, [this, transitionsLower ]));
656                this.selectTransitionUpper.append(optTransitionUpper);
657                $("#transitionUpper").append(this.selectTransitionUpper);
658
659
660                //titre  menu deroulant  transition lower
661                var titleTransitionLower = document.createTextNode("Lower state : ");
662                document.getElementById("transitionLower").appendChild(titleTransitionLower);
663
664                // Create menu deroulant  transition lower
665//                var paramSelectTransitionLower = new Object();
666//                paramSelectTransitionLower.id = "transition2";
667//                paramSelectTransitionLower.parent = $("#transitionLower");
668//                this.selectTransitionLower = new Select( paramSelectTransitionLower );
669//                this.selectTransitionLower.add( '-1', "Select a molecule");
670//                this.selectTransitionLower.selectFirst( false );
671                this.selectTransitionLower = $( document.createElement( "select" ) );
672                this.selectTransitionLower.attr( {id:"transition2"} );
673                var optTransitionLower = $( document.createElement( "option" ) );
674                optTransitionLower.attr( {value:"-1", text:"Select a molecule"} );
675                this.selectTransitionLower.append(optTransitionLower);
676                $("#transitionLower").append(this.selectTransitionLower);
677
678                //bouton reset pour les transition
679                var resetButton = new Button( {value:"Reset", parent:$( "#transitionReset" ), id:"buttonReset", className: "gray_button", onClick:jQuery.proxy( this.requestTransition, this )} );
680
681
682//                //menu déroulant  js   en javascript    sans passer par le modele
683//                var select = document.createElement('select');
684//                select.id = "transiEssai";
685//                select.name ="transiEssai";
686//
687//                var opt = document.createElement('option');
688//                opt.setAttribute('value','id1');
689//                var theText = document.createTextNode("id1");
690//                opt.appendChild(theText);
691//                select.appendChild(opt);
692//
693//                var opt = document.createElement('option');
694//                opt.setAttribute('value','id2');
695//                var theText = document.createTextNode("id2");
696//                opt.appendChild(theText);
697//
698//                //opt.onclick=jQuery.proxy(this.requestTransitionByTransitionLower, [this, transitionsLower ]);
699//                    select.appendChild(opt);
700//                    document.getElementById("transitionLower").appendChild(select);
701
702
703                //menu déroulant en jquery    sans passer par le modele
704//                this.select2 = $( document.createElement( "select" ) );
705//                this.select2.attr( {id:"transiEssai2", name:"transiEssai2"} );
706//                var opt2 = $( document.createElement( "option" ) );
707//                opt2.attr( {value:"id3", text:"zzz"} );
708//                //var  transitionsLower ="000";
709//                // opt2.bind( 'click', jQuery.proxy(this.requestTransitionByTransitionLower, [this, transitionsLower ]));
710//                this.select2.append(opt2);
711//                $("#transitionLower").append(this.select2);
712
713
714
715
716                //Zone text Mean Value
717                //Titre
718                var titleMeanValue = document.createTextNode("Step : ");
719                document.getElementById("meanValue1").appendChild(titleMeanValue);
720                //champ input
721                var inputMeanValue = $( document.createElement( "input" ) );
722                inputMeanValue.attr( {id:"meanValue2"} );
723                inputMeanValue.val(0);
724                this.containerFormMeanValue1.append( inputMeanValue );
725                inputMeanValue.bind( 'blur', this, jQuery.proxy( this.onBlurInputMeanValue, this ));
726
727
728                // Create menu deroulant  2eme choix axe des y
729                //Titre
730                var titleAxeY2 = document.createTextNode("Select secondary parameter (right Y-axis)");
731                document.getElementById("axeY2Titre").appendChild(titleAxeY2);
732                //menu déroulant
733                var paramSelectAxeY2 = new Object();
734                paramSelectAxeY2.id = "selectAxeY2";
735                paramSelectAxeY2.parent = $("#axeY2");
736                this.selectTraceAxeY2 = new Select( paramSelectAxeY2 );
737                this.selectTraceAxeY2.add( 'no', "None", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
738                this.selectTraceAxeY2.add( 'B', "Intensity", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
739                this.selectTraceAxeY2.add( 'C', "Air broadening pressure halfwidth", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
740                this.selectTraceAxeY2.add( 'D', "Energy of the lower transition level", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
741                this.selectTraceAxeY2.add( 'F', "Temperature dependence coefficient n of the air broadening halfwidth ", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
742                this.selectTraceAxeY2.add( 'N', "Self broadening pressure halfwidth (HWHM)", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
743                this.selectTraceAxeY2.add( 'O', "Air pressure shift of the line transition", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
744                this.selectTraceAxeY2.add( 'R', "Temperature dependence coefficient of the air pressure shift ", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
745                this.selectTraceAxeY2.selectFirst( false );
746
747                // Create menu deroulant  type d'échelle linéaire ou logarithmique  pour le choix y2
748                //Titre
749                var titleScaleY2 = document.createTextNode("Select the type of Scale (if intensity is choosen)");
750                document.getElementById("scaleY2Titre").appendChild(titleScaleY2);
751                //menu déroulant
752                var paramSelectScaleY2 = new Object();
753                paramSelectScaleY2.id = "SelectScaleY2";
754                paramSelectScaleY2.parent = $("#scaleY2");
755                this.selectScaleY2 = new Select( paramSelectScaleY2 );
756                this.selectScaleY2.add( 'l', "Linear" );
757                this.selectScaleY2.add( '-log_scale2', "Logarithmic" );
758                this.selectScaleY2.selectFirst( false );
759                //est inactif par defaut car selectTraceAxeY2 est positionne a none par defaut
760                document.getElementById("scaleY2Titre").className = "notActiveText";
761                this.selectScaleY2.disable();
762
763                // Create menu deroulant  style de tracer       Y2
764                //Titre
765                var titleTypeTrace = document.createTextNode("Select the type of plot");
766                document.getElementById("typePlotY2Titre").appendChild(titleTypeTrace);
767                //menu déroulant
768                var paramSelectTypeTraceY2 = new Object();
769                paramSelectTypeTraceY2.id = "SelectTypePlotY2";
770                paramSelectTypeTraceY2.parent = $("#typePlotY2");
771                this.selectTypeTraceY2 = new Select( paramSelectTypeTraceY2 );
772                this.selectTypeTraceY2.add( 'l', "Lines" );
773                this.selectTypeTraceY2.add( 'p', "Dots" );
774                this.selectTypeTraceY2.add( 'i', "Peaks" );
775                this.selectTypeTraceY2.add( 'lp', "Lines and Dots" );
776                this.selectTypeTraceY2.selectFirst( false );
777                //est inactif par defaut car selectTraceAxeY2 est positionne a none par defaut
778                document.getElementById("typePlotY2Titre").className = "notActiveText";
779                this.selectTypeTraceY2.disable();
780
781
782
783
784                //création de l'image d'attente
785                var param = new Object();
786               param.id = "loadingForGraphics";
787               param.parent = this.containerLoading;
788               this.loadingGraphics = new Loading( param );
789              // this.loadingGraphics.display();
790               //this.loadingGraphics.hide();
791
792
793                // var submitButton = new Button( {value:"Submit", parent:$( "#boutonSubmit" ), id:"button_submit_3", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickSubmit, this )} );
794                var submitButton = new Button( {value:"Submit", parent:$( "#boutonSubmit" ), id:"button_submit_3", className: "positive", onClick:jQuery.proxy( this.onClickSubmit, this )} );
795            },
796
797
798
799
800            /**
801             * This method creates the case to check for the moles
802             * create cases à cocher pour les molécules
803             * @param container
804             * @param moleculesArray
805             */
806                //createMolecules: function(container, moleculesArray)
807            createMolecules: function(container, moleculesArray, BddVersion)
808            {
809                var table = $(document.createElement("table"));
810                container.append(table);
811                // var tr = $(document.createElement("tr"));
812                // tr.attr({valign: "top"});
813                // table.append(tr);
814                var i=0;
815                //nombre de molecules par ligne
816                var l=10;
817                //taille du tableau
818                //alert("l" +moleculesArray.length);
819                // parseInt : partie entiÚre
820                // var res =  parseInt(8/3);
821                //alert("res="+res);
822
823                $.each(moleculesArray, jQuery.proxy( function(index, moleculeElement )
824                {
825
826
827                    //this.tr et non var tr pour que tr existe encore à la sortie du if
828                    if ( index == (i*l))
829                    {
830                        //alert(index);
831                        this.tr = $(document.createElement("tr"));
832                        this.tr.attr({valign: "top"});
833                        table.append(this.tr);
834                        i=i+1;
835
836                    }
837                    var td = $(document.createElement("td"));
838                    this.tr.append(td);
839
840                    var span= $(document.createElement("span"));
841                    span.addClass("molecule");
842                    td.append(span);
843
844                    var input = $(document.createElement("input"));
845                    input.attr({type:"checkbox", id:"all-"+moleculeElement.id+"-"+BddVersion});
846                    input.bind( 'click', this, jQuery.proxy( this.cliquetout, [this, moleculeElement.id, BddVersion ] ));
847                    span.append(input);
848
849                    var a = $(document.createElement("a"));
850                    a.html("<b>"+moleculeElement.name+"</b>");
851
852                    a.bind( 'click', this, jQuery.proxy( this.visibilite, [this,"Cache-"+ moleculeElement.id] ));
853                    span.append(a);
854
855                    var div= $(document.createElement("div"));
856                    div.addClass("divViolet");
857                    div.attr({id:"Cache-"+moleculeElement.id, style: "display:none"});
858                    td.append(div);
859
860                    var spanIsotopes= $(document.createElement("span"));
861                    spanIsotopes.addClass("isotope");
862                    spanIsotopes.attr({id:moleculeElement.id+"Isotope"+BddVersion});
863                    div.append(spanIsotopes);
864
865
866                    this.createIsotopes($("#"+moleculeElement.id+"Isotope"+BddVersion), moleculeElement.isotopesArray, moleculeElement.id, BddVersion);
867
868
869                }, this) );
870
871
872            },
873
874            createIsotopes: function(container, isotopesArray, moleculeElement, BddVersion )
875            {
876
877
878                $.each(isotopesArray, jQuery.proxy( function( index, isotopeElement )
879                {
880                    container.append("&nbsp;&nbsp;&nbsp;");
881                    var inputIsotopes = $(document.createElement("input"));
882                    inputIsotopes.attr({type:"checkbox", id:"chk-"+moleculeElement+"_"+isotopeElement+"-"+BddVersion, name:"moles", value:moleculeElement+"_"+isotopeElement});
883                    inputIsotopes.bind( 'click', this, jQuery.proxy( this.cliqueIsotope, [this, moleculeElement+"_"+isotopeElement, moleculeElement, BddVersion ] ));
884                    container.append(inputIsotopes);
885                    container.append(isotopeElement);
886                    var br = $(document.createElement("br"));
887                    container.append(br);
888
889                }, this) );
890            },
891
892            // <table><tr><td>
893            // <span class="molecule"><input type=checkbox id=all-ch3cn-GEISA2011 onclick="cliquetout('this, ch3cn, GEISA2011');">
894            //          <a href="javascript:visibilite('this, Cache-ch3cn');"><B>CH<sub>3</sub>CN</a></B>
895            // </span>
896            // <div class="divViolet" id="Cache-ch3cn" style="display:none;">
897            //          <span class="isotope" id="ch3cnIsotopeGEISA2011">&nbsp;&nbsp;&nbsp;<input type=checkbox id=chk-ch3cn_234-GEISA2011 name=moles value=ch3cn_234 onclick="cliqueIsotope('this, ch3cn_234, GEISA2011');">234<br></span>
898            // </div>
899            // </td></tr></table>
900
901// REQUESTS ********************************************************
902            //récupération de toutes les valeurs choisies par l'utilisateur et transformation de ces valeurs pour les inclure dans la requête fortran
903            requestGeisa: function()
904            {
905
906                //on va chercher les chemin déclaré dans le controller
907                this.pathProcess = "<%=Controller.PATH_PROCESS%>";
908                this.LongPathImages = "<%=Controller.LONG_PATH_IMAGES%>";
909
910
911
912                 //sélection du fichier binaire de la base geisa sélectionnée
913                var paramBase = "";
914                switch (this.selectDatabase.getValue()) {
915                    case 'GEISA2003':
916                        paramBase = " -dirin "+this.pathProcess+" -dirout "+this.LongPathImages+" -filein "+this.pathProcess+"line_GEISA2003_asc_gs03_v1.0 -input_format asc -database_name GEISA2003 -database_type gs03";
917                        break;
918                    case 'GEISA2011':
919                        paramBase = " -dirin "+this.pathProcess+" -dirout "+this.LongPathImages+" -filein "+this.pathProcess+"line_GEISA2009_bin -database_name GEISA2011 -database_type gs08";
920                        break;
921                    case 'GEISAIASI2003':
922                        paramBase = " -dirin "+this.pathProcess+" -dirout "+this.LongPathImages+" -filein "+this.pathProcess+"line_GEISAIASI2003_asc_gsi03_v1.0 -input_format asc -database_name GEISAIASI2003 -database_type gsi03";
923                        break;
924                    case 'GEISAIASI2011':
925                        paramBase = " -dirin "+this.pathProcess+" -dirout "+this.LongPathImages+" -filein "+this.pathProcess+"line_GEISAIASI2011_bin_gsi08_v1.0 -database_name GEISAIASI2011 -database_type gsi08";
926                        break;
927                }
928
929
930                //molécules
931                //récupération des molécules sélectionnées
932                var inputs = document.getElementsByTagName( 'input' );
933                var count = inputs.length;
934                var isotopesSelectedName ="";
935              //  alert(this.selectDatabase.getValue());
936                var i=0;
937                this.nbIsotopes = 0;
938                this.nbMolecules = 0;
939                this.nbGraph = 0;
940                for( i = 0; i < count; i++ )
941                {
942                    var input = inputs.item( i );
943                    //ne prendre que les isotopes sélectionnés dans la base de données sélectionnée  (rechercher des id du type :  "chk-ch3cn-GEISA-11")
944                    if( input.type == 'checkbox' && input.checked == true && input.id.indexOf("chk-")!= -1 && input.id.indexOf(this.selectDatabase.getValue())!= -1)
945                    {
946                        //nombre d'isotopes sélectionnés
947                        this.nbIsotopes =  this.nbIsotopes + 1;
948
949                        var molN=input.value;
950                        var molN1=molN.replace("_", ":");
951                        // exemple : -moleisot h2o:161 -moleisot h2o:162 -moleisot co2:626 -moleisot co2:627 -moleisot o3:666 -moleisot o3:668
952                        isotopesSelectedName = isotopesSelectedName+"-moleisot "+molN1+" ";
953                    }
954                    //récupération du nombre de molécules sélectionnées
955                    if( input.type == 'checkbox' && input.checked == true && input.id.indexOf("all-")!= -1 && input.id.indexOf(this.selectDatabase.getValue())!= -1)
956                    {
957                        //nombre d'isotopes sélectionnés
958                        this.nbMolecules =  this.nbMolecules + 1;
959                    }
960                }
961
962
963                //averti l'utilisateur qu'il faut au moins sélectionner un isotope
964                if (this.nbIsotopes ==  0) {
965                    alert("Error : no molecule or isotopoloque was selected");
966                    return;
967                }
968
969
970
971                //sélection du nombre de courbes ou de graphs
972
973                var nbCourbes = "";
974                switch (this.SelectNbCourbes.getValue()) {
975                    case 'cm':
976                        nbCourbes = "-separate_mol -same_graph ";
977                        this.nbGraph = 1;
978                        this.nbCourbe =  this.nbMolecules;
979                        if (this.nbCourbe > 8) {
980                            alert("Too much molecules selected to draw one curve for each molecule selected");
981                            return;
982                        }
983                        break;
984                    case 'ci':
985                        nbCourbes = "-separate_iso -same_graph ";
986                        this.nbGraph = 1;
987                        this.nbCourbe =  this.nbIsotopes;
988                        if (this.nbCourbe > 8) {
989                            alert("Too much isotopologues selected to draw one curve for each isotopologues selected");
990                            return;
991                        }
992                        break;
993                    case 'gm':
994                        nbCourbes = "-separate_mol ";
995                        this.nbGraph = this.nbMolecules;
996                        if (this.nbGraph > 20) {
997                            alert("Too much molecules selected to draw one graph for each molecules selected");
998                            return;
999                        }
1000                        break;
1001                    case 'gi':
1002                        nbCourbes = "-separate_iso ";
1003                        this.nbGraph = this.nbIsotopes;
1004                        if (this.nbGraph > 20) {
1005                            alert("Too much isotopologues selected to draw one graph for each isotopologues selected");
1006                            return;
1007                        }
1008                        break;
1009                    default:
1010                        nbCourbes = "";
1011                        this.nbGraph = 1;
1012                        break;
1013                }
1014
1015
1016                //Spectral range
1017                var rangeLower="-wavenb_min "+$("#RangeLower").val();
1018                var rangeUpper="-wavenb_max "+$("#RangeUpper").val();
1019
1020                //controle des valeurs entrées par l'utilisateur
1021
1022                switch (this.selectDatabase.getValue()) {
1023                    case 'GEISA2003':
1024                        //isNaN = n'est pas un nombre
1025                        if(isNaN($("#RangeLower").val()) == true ||   parseInt($("#RangeLower").val()) < 0  || parseInt($("#RangeLower").val()) > 35877.030506)
1026                        {
1027                            alert("Error: Invalid value for lower spectral range area");
1028                            return;
1029                        }
1030
1031                        if(isNaN($("#RangeUpper").val()) == true ||   parseInt( $("#RangeUpper").val()) == 0 || parseInt( $("#RangeUpper").val()) < 0  || parseInt($("#RangeUpper").val()) > 35877.030506)
1032                        {
1033                            alert("Error: Invalid value for upper spectral range area");
1034                            return;
1035                        }
1036                        break;
1037                    case 'GEISA2011':
1038                        //isNaN = n'est pas un nombre
1039                        if(isNaN($("#RangeLower").val()) == true ||   parseInt($("#RangeLower").val()) < 0  || parseInt($("#RangeLower").val()) > 35877.030506)
1040                        {
1041                            alert("Error: Invalid value for lower spectral range area");
1042                            return;
1043                        }
1044
1045                        if(isNaN($("#RangeUpper").val()) == true ||   parseInt( $("#RangeUpper").val()) == 0 || parseInt( $("#RangeUpper").val()) < 0  || parseInt($("#RangeUpper").val()) > 35877.030506)
1046                        {
1047                            alert("Error: Invalid value for upper spectral range area");
1048                            return;
1049                        }
1050                        break;
1051                    case 'GEISAIASI2003':
1052                        //isNaN = n'est pas un nombre
1053                        if(isNaN($("#RangeLower").val()) == true ||   parseInt($("#RangeLower").val()) < 0 || parseInt($("#RangeLower").val()) < 599.000793 || parseInt($("#RangeLower").val()) > 3000.998767)
1054                        {
1055                            alert("Error: Invalid value for lower spectral range area");
1056                            return;
1057                        }
1058
1059                        if(isNaN($("#RangeUpper").val()) == true ||   parseInt( $("#RangeUpper").val()) == 0 || parseInt( $("#RangeUpper").val()) < 0  ||  parseInt($("#RangeUpper").val()) < 599.000793 || parseInt($("#RangeUpper").val()) > 3000.998767)
1060                        {
1061                            alert("Error: Invalid value for upper spectral range area");
1062                            return;
1063                        }
1064                        break;
1065                    case 'GEISAIASI2011':
1066                        //isNaN = n'est pas un nombre
1067                        if(isNaN($("#RangeLower").val()) == true ||   parseInt($("#RangeLower").val()) < 0 || parseInt($("#RangeLower").val()) < 599.000793 || parseInt($("#RangeLower").val()) > 3000.998767)
1068                        {
1069                            alert("Error: Invalid value for lower spectral range area");
1070                            return;
1071                        }
1072
1073                        if(isNaN($("#RangeUpper").val()) == true ||   parseInt( $("#RangeUpper").val()) == 0 || parseInt( $("#RangeUpper").val()) < 0  ||  parseInt($("#RangeUpper").val()) < 599.000793 || parseInt($("#RangeUpper").val()) > 3000.998767)
1074                        {
1075                            alert("Error: Invalid value for upper spectral range area");
1076                            return;
1077                        }
1078                        break;
1079                }
1080
1081
1082                if ($("#RangeLower").val() == ""  )
1083                {
1084                    rangeLower="";
1085                }
1086
1087                if ($("#RangeUpper").val() == ""  )
1088                {
1089                    rangeUpper="";
1090                }
1091                if( parseInt($("#RangeLower").val())  > parseInt($("#RangeUpper").val()) )
1092                {
1093                    alert("Error: lower spectral range area is superior to upper spectral range area ");
1094                    return;
1095                }
1096
1097
1098                //Transitions  to do
1099                //exemple de requete avec transition
1100                //./all -filein line_GEISA2009_bin -moleisot h2o:161 -wavenb_min 1 -wavenb_max 1000 -database_name "GEISA2011" -vib_ident_lower '[000]'
1101                //var TransitionUpper ="-vib_ident_upper '[ "+this.selectTransitionUpper.getValue()+" ]'";
1102                var transitionUpper=document.getElementById('transition1').options[document.getElementById('transition1').selectedIndex].value;
1103                //Enlever les espaces blancs
1104               // TransitionUp= TransitionUp.replace(/ /g,"");
1105               //var TransitionUpper ="-vib_ident_upper ["+TransitionUp+"]";
1106                // var transitionUpper = "["+transitionUp+"]";
1107               // alert ("transitionUpper"+transitionUpper);
1108
1109                // var TransitionLower ="-vib_ident_lower '[ "+this.selectTransitionLower.getValue()+" ]'";
1110                  var transitionLower=document.getElementById('transition2').options[document.getElementById('transition2').selectedIndex].value;
1111                //  TransitionLo= TransitionLo.replace(/ /g,"");
1112                 // var TransitionLower ="-vib_ident_lower ["+TransitionLo+"]";
1113                //var transitionLower ="["+transitionLo+"]";
1114
1115                 //pas de transition sélectionnée
1116                // if (( this.selectTransitionUpper.getValue()== -1) ||  (this.selectTransitionUpper.getValue() == "transition" ))
1117                // {
1118                // TransitionUpper ="";
1119                // }
1120                // if (( this.selectTransitionLower.getValue()== -1) ||  (this.selectTransitionLower.getValue() == "transition" ))
1121                // {
1122                // TransitionLower ="";
1123                // }
1124                if (( document.getElementById('transition1').options[document.getElementById('transition1').selectedIndex].value == -1) ||  (document.getElementById('transition1').options[document.getElementById('transition1').selectedIndex].value == "transition" ))
1125                {
1126                    transitionUpper ="no";
1127                }
1128                if (( document.getElementById('transition2').options[document.getElementById('transition2').selectedIndex].value == -1) ||  (document.getElementById('transition2').options[document.getElementById('transition2').selectedIndex].value == "transition" ))
1129                {
1130                    transitionLower ="no";
1131                }
1132
1133                if ( document.getElementById('transition1').options[document.getElementById('transition1').selectedIndex].value == "")
1134                {
1135                    transitionUpper ="noValue";
1136                }
1137
1138                if ( document.getElementById('transition2').options[document.getElementById('transition2').selectedIndex].value == "")
1139                {
1140                    transitionLower ="noValue";
1141                }
1142
1143                 var sel = document.getElementById('transition1');
1144                 var idupper = sel.options[sel.selectedIndex].value;
1145                  //alert("idupper"+idupper);
1146
1147                //Intensity range
1148                var intensityLower="-int_min "+$("#intensityLo").val();
1149                var intensityUpper="-int_max "+$("#intensityUp").val();
1150
1151                //controle des valeurs entrées par l'utilisateur
1152                 if(isNaN($("#intensityLo").val()) == true ||   $("#intensityLo").val() < 0  )
1153                {
1154                    alert("Error: Invalid value for lower intensity range area");
1155                    return;
1156                }
1157                if ($("#intensityLo").val() == ""  )
1158                {
1159                    intensityLower="";
1160                }
1161                if(isNaN($("#intensityUp").val()) == true ||   $("#intensityUp").val() < 0  )
1162                {
1163                    alert("Error: Invalid value for upper intensity range area");
1164                    return;
1165                }
1166                if ($("#intensityUp").val() == ""  )
1167                {
1168                    intensityUpper="";
1169                }
1170
1171                //to do javascript ne sait comparer des exponenciels
1172              // if( $("#intensityLo").val()  > $("#intensityUp").val() )
1173
1174               // {
1175               //     alert("Error: lower intensity range area is superior to upper intensity range area ");
1176               //     return;
1177               // }
1178
1179
1180                //Valeur de mean value
1181                var meanValue = "-step "+$("#meanValue2").val();
1182                //controle des valeurs entrées par l'utilisateur
1183                //Si ce n'est pas un nombre ou si il est négatif
1184                if(isNaN($("#meanValue2").val()) == true ||   $("#meanValue2").val() < 0  )
1185                {
1186                    alert("Error: Invalid value for Average calculation area");
1187                    return;
1188                }
1189                //si aucune valeur
1190                if ($("#meanValue2").val() == ""  )
1191                {
1192                    meanValue="";
1193                }
1194
1195                //sélection du premier choix pour l'axe des Y
1196                var field="-field "+this.selectTraceAxeY1.getValue();
1197
1198
1199                 //sélection du type d'échelle pour le parametre Y1 (il y a une valeur pour ce champ que si logaritmic est choisi et si l'option est activée)
1200                if  (this.selectScaleY1.getValue() == '-log_scale' && this.selectScaleY1.isDisable == false)
1201                {
1202                    var logScale = this.selectScaleY1.getValue();
1203                }
1204                else
1205                {
1206                    var logScale = ""
1207                }
1208
1209                //sélection du type de tracé pour Y1
1210                var lineType="-line_type "+this.selectTypeTraceY1.getValue();
1211
1212
1213                //sélection ou non d'un 2eme choix pour l'axe des Y   (pas de valeur pour ce champ si choix none ou si l'option n'est pas activée)
1214                if  (this.selectTraceAxeY2.getValue() == 'no' ||  this.selectTraceAxeY2.isDisable == true)
1215                {
1216                    var field2 = "";
1217                }
1218                else
1219                {
1220                    var field2 = "-field2 "+this.selectTraceAxeY2.getValue();
1221                }
1222
1223                //sélection du type d'échelle pour le parametre Y2 (il y a une valeur pour ce champ que si logaritmic est choisi et si l'option est activée)
1224                if  (this.selectScaleY2.getValue() == '-log_scale2' && this.selectScaleY2.isDisable == false)
1225                {
1226                    var logScale2 =this.selectScaleY2.getValue();
1227                }
1228                else
1229                {
1230                    var logScale2 = "";
1231                }
1232
1233
1234                //sélection du type de tracé pour Y2  (pas de valeur  si l'option n'est pas activée)
1235                if  ( this.selectTypeTraceY2.isDisable == true)
1236                {
1237                    var lineType2 = "";
1238                }
1239                else
1240                {
1241                    var lineType2 = "-line_type2 "+this.selectTypeTraceY2.getValue();
1242                }
1243
1244
1245                //ouverture de la div de l'image d'attente
1246                this.loadingGraphics.display();
1247
1248
1249
1250
1251                //construction de la requête Fortran
1252               // var parameters = "&fortranRequest="+paramBase+" "+isotopesSelectedName+" "+rangeLower+" "+rangeUpper+" "+TransitionUpper+" "+TransitionLower+" "+intensityLower+" "+intensityUpper+" "+
1253                                      // meanValue+" "+nbCourbes+" "+field+" "+logScale+" "+lineType+" "+field2+" "+logScale2+" "+lineType2;
1254
1255                var parameters = "&fortranRequest="+paramBase+" "+isotopesSelectedName+" "+rangeLower+" "+rangeUpper+" "+intensityLower+" "+intensityUpper+" "+
1256                                       meanValue+" "+nbCourbes+" "+field+" "+logScale+" "+lineType+" "+field2+" "+logScale2+" "+lineType2;
1257
1258
1259                //remplacement de espace par "EEE" pour que le shell script ne voit qu'un seul argument en entrée
1260                parameters=parameters.replace(/ /g,"EEE");
1261                transitionUpper=transitionUpper.replace(/ /g,"EEE");
1262                //le + est interprété comme un espace (plus sera retransformé en + dans le shell)
1263                transitionUpper=transitionUpper.replace(/\+/g,"plus");
1264                transitionLower=transitionLower.replace(/ /g,"EEE");
1265                transitionLower=transitionLower.replace(/\+/g,"plus");
1266
1267
1268                //envoie de la requête au controller
1269                //en cas de succes appel de la fonction "handleGeisa"
1270                $.ajax( {
1271                            //url: "project?methodName=createUserRequest&"+parameters+"&nbGraph="+ this.nbGraph,
1272                            url: "project?methodName=createUserRequest&"+parameters+"&transitionUpper="+ transitionUpper+"&transitionLower="+ transitionLower+"&nbGraph="+ this.nbGraph,
1273                            success:jQuery.proxy( this.handleGeisa, this )
1274                        } );
1275            },
1276
1277
1278            //requête pour interrogation de la base de données des transitions
1279            requestTransition: function()
1280            {
1281
1282                var  nbMolecules=0;
1283
1284                //Récupération du spectral range
1285                var spectralRangeLower = $("#RangeLower").val();
1286                var spectralRangeUpper = $("#RangeUpper").val();
1287
1288                //Récupération des isotopes sélectionnés
1289                var inputs = document.getElementsByTagName( 'input' );
1290                var count = inputs.length;
1291                var isotopesSelectedNameArray = new Array();
1292                var i=0;
1293
1294                for( i = 0; i < count; i++ )
1295                {
1296                    var input = inputs.item( i );
1297                    //ne prendre que les isotopes sélectionnés dans la base de données sélectionnée  (rechercher des id du type :  "chk-ch3cn-GEISA-11")
1298                    if( input.type == 'checkbox' && input.checked == true && input.id.indexOf("chk-")!= -1 && input.id.indexOf(this.selectDatabase.getValue())!= -1)
1299                    {
1300                        var molN=input.value;
1301                        var molN1=molN.replace("_", ":");
1302                        //tous les isotopes sélectionnés sont placés dans un tableau
1303                        isotopesSelectedNameArray.push(molN1);
1304                    }
1305
1306                    //récupération du nombre de molécules sélectionnées
1307                    if( input.type == 'checkbox' && input.checked == true && input.id.indexOf("all-")!= -1 && input.id.indexOf(this.selectDatabase.getValue())!= -1)
1308                    {
1309                       nbMolecules =  nbMolecules + 1;
1310                    }
1311
1312                }
1313                //alert ("nbMolecules"+nbMolecules);
1314                //si le nombre de molécule sélectionnées est supérieure Ã  1 les menus des transition sont inactifs
1315                if (nbMolecules > 1)
1316                {
1317
1318                    //this.selectTransitionLower.disable();
1319                    //this.selectTransitionUpper.disable();
1320                    //ajoute une classe à celle déjà existante de transitionUpperTitle
1321                    $("#transitionUpperTitle").addClass("notActiveText");
1322                    $("#transitionLowerTitle").addClass("notActiveText");
1323                }
1324                else
1325                {
1326                    //this.selectTransitionLower.enable();
1327                    //this.selectTransitionUpper.enable();
1328                    $("#transitionUpperTitle").removeClass("notActiveText");
1329                    $("#transitionLowerTitle").removeClass("notActiveText");
1330                }
1331
1332
1333                //On ne fait appel à la BDD des transitions    et si au plus 1 molécule est sélectionnée
1334                if (nbMolecules == 1 )
1335                {
1336//                    $.ajax( {
1337//                                url: "project?methodName=getTransitionByIsotopeName&isotopesSelectedName="+isotopesSelectedName+"&GeisaSelectedDatabase="+GeisaSelectedDatabase+"&spectralRangeLower="+spectralRangeLower+"&spectralRangeUpper="+spectralRangeUpper,
1338//                                success:jQuery.proxy( this.handleRequestTransition, this )
1339//                            } );
1340
1341                    $.ajax( {
1342                                url: "project?methodName=getTransitionByIsotopeName&isotopesSelectedNameArray="+isotopesSelectedNameArray+"&geisaSelectedDatabase="+this.selectDatabase.getValue2()+"&spectralRangeLower="+spectralRangeLower+"&spectralRangeUpper="+spectralRangeUpper,
1343                                success:jQuery.proxy( this.handleRequestTransition, this )
1344                            } );
1345
1346                }
1347                else
1348                {
1349                    //pour réinitialiser le menu déroulant si aucune ou plusieurs molécules sont sélectionnées
1350                    document.getElementById("transition2").length=0;
1351                    //this.selectTransitionUpper.clear();
1352                    document.getElementById("transition1").length=0;
1353
1354                    if (nbMolecules == 0 )
1355                    {
1356                        //this.selectTransitionLower.add('-1', "Select a molecule");
1357                        this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:"-1", text:"Select a molecule", selected:"selected"} ));
1358                        //this.selectTransitionUpper.add('-1', "Select a molecule");
1359                        this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:"-1", text:"Select a molecule", selected:"selected"} ));
1360                        //pour forcer à afficher le premier élément (et non le premier élément précédent)
1361                        //this.selectTransitionLower.selectFirst();
1362                        //this.selectTransitionUpper.selectFirst();
1363                    }
1364
1365                    if (nbMolecules > 1 )
1366                    {
1367                        //this.selectTransitionLower.add('-1', "Select a molecule");
1368                        this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:"-1", text:"", selected:"selected", disabled:"disabled"} ));
1369                        //this.selectTransitionUpper.add('-1', "Select a molecule");
1370                        this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:"-1", text:"", selected:"selected", disabled:"disabled"} ));
1371                        //pour forcer à afficher le premier élément (et non le premier élément précédent)
1372                        //this.selectTransitionLower.selectFirst();
1373                        //this.selectTransitionUpper.selectFirst();
1374                    }
1375                }
1376            },
1377
1378
1379
1380
1381            //requête pour interrogation de la base de données des transitions en fonction d'une transition lower
1382            requestTransitionByTransitionLower: function()
1383            {
1384                var context  = this[0];
1385                //exemple transitionLower="                      000" : il y a 25 caractÚres dans chaque transition
1386                 context.transitionLower = this[1];
1387
1388                //Récupération de la Base Geisa sélectionnée
1389                var GeisaSelectedDatabase = context.selectDatabase.getValue();
1390
1391                //Récupération du spectral range
1392                var spectralRangeLower = $("#RangeLower").val();
1393                var spectralRangeUpper = $("#RangeUpper").val();
1394
1395                //Récupération des isotopes sélectionnés
1396                var inputs = document.getElementsByTagName( 'input' );
1397                var count = inputs.length;
1398                var isotopesSelectedNameArray = new Array();
1399                var i=0;
1400
1401                for( i = 0; i < count; i++ )
1402                {
1403                    var input = inputs.item( i );
1404                    //ne prendre que les isotopes sélectionnés dans la base de données sélectionnée  (rechercher des id du type :  "chk-ch3cn-GEISA-11")
1405                    if( input.type == 'checkbox' && input.checked == true && input.id.indexOf("chk-")!= -1 && input.id.indexOf(context.selectDatabase.getValue())!= -1)
1406                    {
1407                        var molN=input.value;
1408                        var molN1=molN.replace("_", ":");
1409                        //tous les isotopes sélectionnés sont placés dans un tableau
1410                        isotopesSelectedNameArray.push(molN1);
1411                    }
1412
1413                }
1414
1415                 //le passage de javascript Ã  java par ajax transforme les + en espace donc transformation des + en plus et dans le controller on fait l'inverse
1416                 var transitionLowerReplaced = context.transitionLower.replace(/\+/g,"plus");
1417
1418                //Appel Ã  la BDD
1419
1420                $.ajax( {
1421                            url: "project?methodName=getTransitionByIsotopeNameByTransitionLower&isotopesSelectedNameArray="+isotopesSelectedNameArray+"&geisaSelectedDatabase="+context.selectDatabase.getValue2()+"&spectralRangeLower="+spectralRangeLower+"&spectralRangeUpper="+spectralRangeUpper+"&transitionLower="+transitionLowerReplaced,
1422                            success:jQuery.proxy( context.handleRequestTransitionByTransitionLower, context)
1423                        } );
1424
1425
1426
1427            },
1428
1429
1430            //requête pour interrogation de la base de données des transitions en fonction d'une transition upper
1431            requestTransitionByTransitionUpper: function()
1432            {
1433                var context  = this[0];
1434                //exemple transitionLower="                      000" : il y a 25 caractÚres dans chaque transition
1435                 context.transitionUpper = this[1];
1436
1437                //Récupération de la Base Geisa sélectionnée
1438                var GeisaSelectedDatabase = context.selectDatabase.getValue();
1439
1440                //Récupération du spectral range
1441                var spectralRangeLower = $("#RangeLower").val();
1442                var spectralRangeUpper = $("#RangeUpper").val();
1443
1444                //Récupération des isotopes sélectionnés
1445                var inputs = document.getElementsByTagName( 'input' );
1446                var count = inputs.length;
1447                var isotopesSelectedNameArray = new Array();
1448                var i=0;
1449
1450                for( i = 0; i < count; i++ )
1451                {
1452                    var input = inputs.item( i );
1453                    //ne prendre que les isotopes sélectionnés dans la base de données sélectionnée  (rechercher des id du type :  "chk-ch3cn-GEISA-11")
1454                    if( input.type == 'checkbox' && input.checked == true && input.id.indexOf("chk-")!= -1 && input.id.indexOf(context.selectDatabase.getValue())!= -1)
1455                    {
1456                        var molN=input.value;
1457                        var molN1=molN.replace("_", ":");
1458                        //tous les isotopes sélectionnés sont placés dans un tableau
1459                        isotopesSelectedNameArray.push(molN1);
1460                    }
1461
1462                }
1463                //le passage de javascript Ã  java par ajax transforme les + en espace donc transformation des + en plus et dans le controller on fait l'inverse
1464                var transitionUpperReplaced = context.transitionUpper.replace(/\+/g,"plus");
1465
1466                //Appel Ã  la BDD
1467                $.ajax( {
1468                            url: "project?methodName=getTransitionByIsotopeNameByTransitionUpper&isotopesSelectedNameArray="+isotopesSelectedNameArray+"&geisaSelectedDatabase="+context.selectDatabase.getValue2()+"&spectralRangeLower="+spectralRangeLower+"&spectralRangeUpper="+spectralRangeUpper+"&transitionUpper="+transitionUpperReplaced,
1469                            success:jQuery.proxy( context.handleRequestTransitionByTransitionUpper, context)
1470                        } );
1471
1472
1473
1474            },
1475
1476
1477
1478//            requestTransition: function()
1479//            {
1480//                $.ajax( {
1481//                            url: "project?methodName=transition&transitionValue="+ this.selectTransitionUpper.getValue(),
1482//                            success:jQuery.proxy( this.handleRequestTransition, this )
1483//                        } );
1484//            },
1485
1486            // HANDLES ******************************************************** = retours ajax
1487            //affichage sur l'interface
1488
1489            handleGeisa: function( result )
1490            {
1491
1492
1493                //chemin de l'image
1494//                this.pathImg = jQuery.parseJSON( result ).pathImg;
1495                this.pathImg = "<%=Controller.PATH_IMAGES%>";
1496                //numéro unique pour le nom du graph
1497                this.nb = jQuery.parseJSON( result ).nb;
1498                //Pour tracer le bon nombre de graphe et de bouton download
1499                var i=1;
1500                var content = '';
1501                for (i=1; i<this.nbGraph+1; i++) {
1502                    content = content + '<img src=' + this.pathImg + "graph" + this.nb +"-"+i+ ".png"+ ' /><a href="project?methodName=downloadFile&fileName='  + "graph" + this.nb+"-"+i + ".png"+ '"><button class="dataProtocolDownloadButton">Download</button></a>';
1503                }
1504
1505                this.displayWindow(content);
1506            },
1507
1508
1509//            handleRequestTransition: function( result )
1510//            {
1511//                alert("youpi");
1512//            },
1513
1514
1515            handleRequestTransition: function( result )
1516            {
1517
1518
1519//                var transitions = jQuery.parseJSON( result ).transitions;
1520                 var transitionsLower = jQuery.parseJSON( result ).transitionsLower;
1521                 var transitionsUpper = jQuery.parseJSON( result ).transitionsUpper;
1522
1523                 //pour vider les menus déroulant des transitions précédentes
1524                 // this.selectTransitionLower.clear();
1525                document.getElementById("transition2").length=0;
1526                //this.selectTransitionUpper.clear();
1527                document.getElementById("transition1").length=0;
1528                // this.selectTransitionLower.add('transition', "Choose a transition");
1529                this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:"transition", text:"Choose a transition", disabled:"disabled", selected:"selected"} ));
1530
1531                // this.selectTransitionUpper.add('transition', "Choose a transition");
1532                this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:"transition", text:"Choose a transition", disabled:"disabled", selected:"selected"} ));
1533
1534                 //pour forcer à afficher le premier élément (et non le premier élément précédent)
1535                // this.selectTransitionLower.selectFirst();
1536                // this.selectTransitionUpper.selectFirst();
1537
1538                // alert ("transitionsUpper"+transitionsUpper);
1539                $.each(transitionsLower, jQuery.proxy( function(index, transitionsLower )
1540                {
1541                   //  this.selectTransitionLower.add(transitionsLower, transitionsLower,jQuery.proxy(this.requestTransitionByTransitionLower, [this, transitionsLower ]));
1542
1543
1544                    this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:transitionsLower, text:transitionsLower} ).bind( 'click', jQuery.proxy(this.requestTransitionByTransitionLower, [this, transitionsLower ])));
1545
1546                }, this));
1547
1548                $.each(transitionsUpper, jQuery.proxy( function(index, transitionsUpper )
1549                {
1550                    //this.selectTransitionUpper.add(transitionsUpper, transitionsUpper,jQuery.proxy(this.requestTransitionByTransitionUpper, [this, transitionsUpper ]));
1551                    this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:transitionsUpper, text:transitionsUpper} ).bind( 'click', jQuery.proxy(this.requestTransitionByTransitionUpper, [this, transitionsUpper ])));
1552
1553                }, this));
1554
1555            },
1556
1557            handleRequestTransitionByTransitionLower : function( result )
1558            {
1559                //alert("transitionLower"+this.transitionLower);
1560                var transitionsUpperBis = jQuery.parseJSON( result ).transitionsUpperBis;
1561                //alert("transitionsUpper"+transitionsUpper);
1562
1563                //pour vider les menus déroulant des transitions précédentes
1564               // this.selectTransitionLower.clear();
1565                document.getElementById("transition2").length=0;
1566                //this.selectTransitionUpper.clear();
1567                document.getElementById("transition1").length=0;
1568               // while(0 < document.getElementById("transition1").length)
1569               // {
1570               //     document.getElementById("transition1").options[0] = null;
1571               // }
1572
1573
1574                //this.selectTransitionLower.add(this.transitionLower, this.transitionLower);
1575                this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:"transition", text:"Choose a transition", disabled:"disabled"} ));
1576                this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:this.transitionLower, text:this.transitionLower,  selected:"selected"} ));
1577                //this.selectTransitionUpper.add('transition', "Choose a transition");
1578                //rajout du text "Choose a transition" selectionné en premier mais on ne peut pa cliquer dessus
1579                this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:"transition", text:"Choose a transition", disabled:"disabled", selected:"selected"} ));
1580
1581
1582                //pour forcer Ã  afficher le premier Ã©lément (et non le premier Ã©lément précédent)
1583                //this.selectTransitionLower.selectFirst();
1584                //this.selectTransitionUpper.selectFirst();
1585
1586
1587
1588                $.each(transitionsUpperBis, jQuery.proxy( function(index, transitionsUpperBis )
1589                {
1590                   // this.selectTransitionUpper.add(transitionsUpper, transitionsUpper);
1591                     this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:transitionsUpperBis, text:transitionsUpperBis} ));
1592
1593                }, this));
1594
1595            },
1596
1597
1598            handleRequestTransitionByTransitionUpper : function( result )
1599            {
1600               // alert("transitionUpper"+this.transitionUpper);
1601                var transitionsLowerBis = jQuery.parseJSON( result ).transitionsLowerBis;
1602                //alert("transitionsLower"+transitionsLower);
1603
1604                //pour vider les menus déroulant des transitions précédentes
1605               // this.selectTransitionLower.clear();
1606                document.getElementById("transition2").length=0;
1607                //this.selectTransitionUpper.clear();
1608                document.getElementById("transition1").length=0;
1609
1610               // this.selectTransitionLower.add('transition', "Choose a transition");
1611                this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:"transition", text:"Choose a transition", disabled:"disabled", selected:"selected"} ));
1612
1613               // this.selectTransitionUpper.add(this.transitionUpper, this.transitionUpper);
1614                this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:"transition", text:"Choose a transition", disabled:"disabled"} ));
1615                this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:this.transitionUpper, text:this.transitionUpper,  selected:"selected"} ));
1616
1617
1618                //pour forcer Ã  afficher le premier Ã©lément (et non le premier Ã©lément précédent)
1619                //this.selectTransitionLower.selectFirst();
1620                //this.selectTransitionUpper.selectFirst();
1621
1622
1623
1624                $.each(transitionsLowerBis, jQuery.proxy( function(index, transitionsLowerBis )
1625                {
1626                    //this.selectTransitionLower.add(transitionsLower, transitionsLower);
1627                    this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:transitionsLowerBis, text:transitionsLowerBis} ));
1628                }, this));
1629
1630            },
1631            // EVENTS ********************************************************
1632            //
1633            onClickShowAdvancedOptions: function()
1634            {
1635                document.getElementById( "showAdvancedOptions" ).style.display = "none";
1636            },
1637
1638
1639
1640            //affichage de la valeur du spectral range et affichage du bloc des molecules en fonction de la base de donnees selectionnee
1641            onClickSelectDatabase: function(value)
1642            {
1643
1644                if  ('GEISA2011' == value)
1645                {
1646                    document.getElementById('spectralRangeTitre').innerHTML = "";
1647                    document.getElementById('spectralRangeTitre').innerHTML = "Choosing the spectral range from 0 to 35877.030506 cm<sup>-1</sup>";
1648                    $("#RangeLower").val(0);
1649                    $("#RangeUpper").val(35877.030506);
1650
1651                    document.getElementById( "BDD-GEISA2011" ).style.display = "";
1652                    document.getElementById( "BDD-GEISAIASI2011" ).style.display = "none";
1653                    document.getElementById( "BDD-GEISA2003" ).style.display = "none";
1654                    document.getElementById( "BDD-GEISAIASI2003" ).style.display = "none";
1655                }
1656
1657                if  ('GEISAIASI2011' == value)
1658                {
1659                    document.getElementById('spectralRangeTitre').innerHTML = "";
1660                    document.getElementById('spectralRangeTitre').innerHTML = "Choosing spectral range (599.000793 to 3000.998767 cm<sup>-1</sup>)";
1661                    $("#RangeLower").val(599.000793);
1662                    $("#RangeUpper").val(3000.998767);
1663
1664                    document.getElementById( "BDD-GEISA2011" ).style.display = "none";
1665                    document.getElementById( "BDD-GEISAIASI2011" ).style.display = "";
1666                    document.getElementById( "BDD-GEISA2003" ).style.display = "none";
1667                    document.getElementById( "BDD-GEISAIASI2003" ).style.display = "none";
1668                }
1669
1670                if  ('GEISA2003' == value)
1671                {
1672                    document.getElementById('spectralRangeTitre').innerHTML = "";
1673                    document.getElementById('spectralRangeTitre').innerHTML = "Choosing the spectral range from 0 to 35877.030506 cm<sup>-1</sup>";
1674                    $("#RangeLower").val(0);
1675                    $("#RangeUpper").val(35877.030506);
1676
1677                    document.getElementById( "BDD-GEISA2011" ).style.display = "none";
1678                    document.getElementById( "BDD-GEISAIASI2011" ).style.display = "none";
1679                    document.getElementById( "BDD-GEISA2003" ).style.display = "";
1680                    document.getElementById( "BDD-GEISAIASI2003" ).style.display = "none";
1681                }
1682                if  ('GEISAIASI2003' == value)
1683                {
1684                    document.getElementById('spectralRangeTitre').innerHTML = "";
1685                    document.getElementById('spectralRangeTitre').innerHTML = "Choosing spectral range (599.000793 to 3000.998767 cm<sup>-1</sup>)";
1686                    $("#RangeLower").val(599.000793);
1687                    $("#RangeUpper").val(3000.998767);
1688
1689                    document.getElementById( "BDD-GEISA2011" ).style.display = "none";
1690                    document.getElementById( "BDD-GEISAIASI2011" ).style.display = "none";
1691                    document.getElementById( "BDD-GEISA2003" ).style.display = "none";
1692                    document.getElementById( "BDD-GEISAIASI2003" ).style.display = "";
1693                }
1694
1695                //mettre a jour le menu déroulant des transitions en fonction des isotopes sélectionnés, de la longueur d'onde et de la base geisa
1696                this.requestTransition();
1697            },
1698
1699
1700
1701            //Actions déclenchées quand on clique sur le nom d'une molécule
1702            cliquetout: function()
1703            {
1704                var context = this[0];
1705                // exemple :moleculeName = ch3ch
1706                var moleculeName = this[1];
1707                var bddVersion = this[2];
1708                var inputs = document.getElementsByTagName( 'input' );
1709                var count = inputs.length;
1710                for( i = 0; i < count; i++ )
1711                {
1712                    var  input = inputs.item( i );
1713                    //cliquer toutes les molécules et isotopes du meme nom dans toutes les bases
1714                    //if( input.type == 'checkbox' && ( input.id == ('chk-' + name + '-GEISA-11') || input.id == ('chk-' + name + '-GEISA-03') || input.id == ('chk-' + name + '-GEISA-IASI-11') || input.id == ('chk-' + name + '-GEISA-IASI-03')
1715                    // || input.id == (name + '-all-GEISA-03') || input.id == (name + '-all-GEISA-11') || input.id == (name + '-all-GEISA-IASI-03') || input.id == (name + '-all-GEISA-IASI-11')))
1716
1717                    if( input.type == 'checkbox' && ( input.id.indexOf('chk-' + moleculeName + '_') != -1 || input.id.indexOf('all-'+moleculeName+'-')!= -1 ))
1718
1719                    {
1720                        input.checked = document.getElementById( 'all-'+ moleculeName + '-' + bddVersion ).checked;
1721                    }
1722                }
1723                //mettre a jour le menu déroulant des transitions en fonction des isotopes sélectionnés, de la longueur d'onde et de la base geisa
1724                context.requestTransition();
1725            },
1726
1727            //actions déclenchées quand on clique sur un isotope
1728            cliqueIsotope: function()
1729            {
1730                var context = this[0];
1731                //exemple isotopeName = ch3cn_134
1732                var isotopeName = this[1];
1733                // exemple  moleculeName= ch3cn
1734                var moleculeName = this[2];
1735                var bddVersion = this[3];
1736                var inputs = document.getElementsByTagName( 'input' );
1737                var count = inputs.length;
1738                var i = 0;
1739                for( i = 0; i < count; i++ )
1740                {
1741                    input = inputs.item( i );
1742
1743                    //id=chk-ch3cn_234-GEISA2011
1744                    //cliquer ou decliquer le meme isotope dans toutes les bases
1745                    if( input.type == 'checkbox' &&  input.id.indexOf('chk-' + isotopeName) != -1)
1746                    {
1747                        input.checked = document.getElementById( 'chk-' + isotopeName + '-' + bddVersion ).checked;
1748
1749                    }
1750                     // id=all-ch3cn-GEISA2011
1751                    //pour décocher la case de la molecule quand on décoche un isotope
1752                   // if( input.type == 'checkbox' && input.id.indexOf('all-'+ moleculeName) != -1 && input.checked == true )
1753                    // {
1754                    //     input.checked = false;
1755                    // }
1756                }
1757
1758
1759                //pour cocher molecule quand on clique sur un isotope et décocher molécule quand tous les isotopes de la molécule sont décochés
1760                var nbIsotopeSelected=0;
1761
1762                for( i = 0; i < count; i++ )
1763                {
1764                    input = inputs.item( i );
1765                    if( input.type == 'checkbox' &&  input.id.indexOf('chk-'+moleculeName+'_') != -1  && input.id.indexOf(bddVersion) != -1 && input.checked == true )
1766                    {
1767                     nbIsotopeSelected=nbIsotopeSelected+1;
1768                    }
1769
1770                }
1771
1772
1773                for( i = 0; i < count; i++ )
1774                {
1775                    input = inputs.item( i );
1776                    if (input.type == 'checkbox' && input.id.indexOf('all-'+ moleculeName+'-') != -1 && nbIsotopeSelected == 0)
1777                    {
1778                        input.checked = false;
1779                    }
1780
1781                     if (input.type == 'checkbox' && input.id.indexOf('all-'+ moleculeName+'-') != -1 && nbIsotopeSelected > 0)
1782                    {
1783                        input.checked = true;
1784                    }
1785
1786                }
1787
1788                // alert("database"+context.selectDatabase.getSize());
1789
1790                //mettre a jour le menu déroulant des transitions en fonction des isotopes sélectionnés, de la longueur d'onde et de la base geisa
1791                context.requestTransition();
1792
1793            },
1794
1795
1796
1797            //pour cacher ou voir les isotopes d'une molecule
1798            visibilite: function(  )
1799            {
1800                var context = this[0];
1801                var thingId = this[1];
1802                var divs = document.getElementsByTagName( 'div' );
1803                var count = divs.length;
1804                var i = 0;
1805                for( i = 0; i < count; i++ )
1806                {
1807                    var div = divs.item( i );
1808
1809
1810                    if  (  div.id ==   thingId)
1811                    {
1812                        if( div.style.display == "none" )
1813                        {
1814                            div.style.display = "";
1815                        }
1816                        else
1817                        {
1818                            div.style.display = "none";
1819                        }
1820                    }
1821                }
1822            },
1823
1824
1825            onBlurInputMeanValue: function()
1826            {
1827                //si step est sup a 0,   ajout d'une ligne Z aux parametres Y1 et y2  si elle n'est pas déjà présente
1828                // !this.selectTraceAxeY1.content('Z') indique que "Z" n'exite pas dans le menu déroulant  selectTraceAxeY1
1829                if  ($("#meanValue2").val() > 0 && !this.selectTraceAxeY1.content('Z'))
1830
1831                {
1832
1833                    this.selectTraceAxeY1.add( 'Z', "Number of lines ", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
1834                    this.selectTraceAxeY2.add( 'Z', "Number of lines ", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
1835                }
1836                //si step = a 0     et autres valeurs (a faire) , retrait de la ligne Z aux parametres Y1 et y2
1837                if  ($("#meanValue2").val() == 0)
1838                {
1839                    this.selectTraceAxeY1.remove( 'Z', "Number of lines ", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
1840                    this.selectTraceAxeY2.remove( 'Z', "Number of lines ", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
1841                    //Selection par defaut du 1er element (pour que  "Number of lines"  ne soit plus selectionne par defaut si il n'existe plus)
1842                    this.selectTraceAxeY1.selectFirst();
1843                    this.selectTraceAxeY2.selectFirst();
1844                }
1845            },
1846
1847            onClickSelectNbCourbes: function(value)
1848            {
1849
1850                //si plusieurs courbes ou graphe choisis pour les isotopes et ou molecules, les choix pour Y2 sont inactifs
1851                if  ('ca' != value)
1852                {
1853                    //transformer le texte en gris
1854                    document.getElementById("axeY2Titre").className = "notActiveText";
1855                    document.getElementById("scaleY2Titre").className = "notActiveText";
1856                    document.getElementById("typePlotY2Titre").className = "notActiveText";
1857                    //pour rendre le menu déroulant inactif
1858                    this.selectTraceAxeY2.disable();
1859                    this.selectScaleY2.disable();
1860                    this.selectTypeTraceY2.disable();
1861                }
1862                //si une seule courbe choisie pour les isotopes et ou molecules, les choix pour Y2 sont actifs
1863                if  ('ca' == value)
1864                {
1865                    //remet le texte en couleur active
1866                    document.getElementById("axeY2Titre").className = "activeText";
1867                    //rendre actif l'echelle que si l'intensite est choisie dans les parametres
1868                    if (this.selectTraceAxeY2.getValue() == 'B')
1869                    {
1870                        document.getElementById("scaleY2Titre").className = "activeText";
1871                    }
1872                    //rendre actif le type de plot si ce n'est pas la valeur none qui est choisie
1873                    if (this.selectTraceAxeY2.getValue() != 'no')
1874                    {
1875                        document.getElementById("typePlotY2Titre").className = "activeText";
1876                    }
1877                    //pour rendre les menu déroulant actifs
1878                    this.selectTraceAxeY2.enable();
1879                    //rendre actif l'echelle que si l'intensite est choisie dans les parametres
1880                    if (this.selectTraceAxeY2.getValue() == 'B')
1881                    {
1882                        this.selectScaleY2.enable();
1883                    }
1884                    //rendre actif le type de plot si ce n'est pas la valeur none qui est choisie
1885                    if (this.selectTraceAxeY2.getValue() != 'no')
1886                    {
1887                        this.selectTypeTraceY2.enable();
1888                    }
1889                }
1890            },
1891
1892
1893            onClickSelectTraceAxeY1: function(value)
1894            {
1895                //si intensite n'est pas choisi pour Y1, le type d'échelle est inactif
1896                if  (this.selectTraceAxeY1.getValue() != 'B')
1897                {
1898                    //transformer le texte en gris
1899                    document.getElementById("scaleY1Titre").className = "notActiveText";
1900                    //pour rendre le menu déroulant inactif
1901                    this.selectScaleY1.disable();
1902                }
1903                //si intensite est  choisi pour Y1, le type d'échelle est actif
1904                if  (this.selectTraceAxeY1.getValue() == 'B')
1905                {
1906                    //transformer le texte en gris
1907                    document.getElementById("scaleY1Titre").className = "activeText";
1908                    //pour rendre le menu déroulant inactif
1909                    this.selectScaleY1.enable();
1910                }
1911            },
1912
1913            onClickSelectTraceAxeY2: function(value)
1914            {
1915                //si intensite n'est pas choisi pour Y2, le type d'échelle est inactif
1916                if  (this.selectTraceAxeY2.getValue() != 'B')
1917                {
1918                    //transformer le texte en gris
1919                    document.getElementById("scaleY2Titre").className = "notActiveText";
1920                    //pour rendre le menu déroulant inactif
1921                    this.selectScaleY2.disable();
1922                }
1923                //si intensite est  choisi pour Y2, le type d'échelle est actif
1924                if  (this.selectTraceAxeY2.getValue() == 'B')
1925                {
1926                    //transformer le texte en gris
1927                    document.getElementById("scaleY2Titre").className = "activeText";
1928                    //pour rendre le menu déroulant inactif
1929                    this.selectScaleY2.enable();
1930                }
1931                //si aucun parametre est  choisi pour Y2, le type de plot est inactif
1932                if  (this.selectTraceAxeY2.getValue() == 'no')
1933                {
1934                    //transformer le texte en gris
1935                    document.getElementById("typePlotY2Titre").className = "notActiveText";
1936                    //pour rendre le menu déroulant inactif
1937                    this.selectTypeTraceY2.disable();
1938                }
1939                //si un parametre est  choisi pour Y2, le type de plot est actif
1940                if  (this.selectTraceAxeY2.getValue() != 'no')
1941                {
1942                    //transformer le texte en gris
1943                    document.getElementById("typePlotY2Titre").className = "activeText";
1944                    //pour rendre le menu déroulant inactif
1945                    this.selectTypeTraceY2.enable();
1946                }
1947
1948            },
1949
1950            onClickSubmit: function()
1951            {
1952                this.requestGeisa();
1953            },
1954
1955            displayWindow: function(content)
1956            {
1957                //fermeture de la div de l'image d'attente
1958                this.loadingGraphics.hide();
1959
1960                // var content = '<img src=' + this.pathImg + ' /><a href="project?methodName=downloadFile&fileName='  + this.nameImg + '"><button class="dataProtocolDownloadButton">Download</button></a>';
1961
1962                //alert(content);
1963                var $dialog = $( '<div></div>' )
1964
1965                        .html( content )
1966
1967                        .dialog( {
1968                            autoOpen: false,
1969                            title: "GEISA : spectroscopic database",
1970                            //minHeight: 500,
1971                            // minWidth: 660,
1972                            height: 560,
1973                            width:700,
1974                            //Exemple de  valeurs possible pour position : "middle", "top",  [200, 100]
1975                            position: "middle"
1976
1977                        } );
1978                $dialog.dialog( 'open' )
1979            },
1980
1981            // displayWindow: function(coordinate)
1982            //{
1983            //var content = '<img src=' + this.pathImg + ' /><a href="project?methodName=downloadFile&fileName=bib.txt"><button class="dataProtocolDownloadButton">Download</button></a>';
1984            // var content = '<img src=' + this.pathImg + ' /><a href="project?methodName=downloadFile&fileName='  + this.nameImg + '"><button class="dataProtocolDownloadButton">Download</button></a>';
1985
1986            //alert(content);
1987            // var $dialog = $( '<div></div>' )
1988            // .html( content + content1 )
1989
1990            // .dialog( {
1991            //    autoOpen: false,
1992            //    title: "GEISA : spectroscopic database",
1993            //    minHeight: 500,
1994            //    minWidth: 660,
1995
1996            //coordonnee y y
1997            //   position:coordinate
1998
1999            // } );
2000            // $dialog.dialog( 'open' )
2001            //},
2002
2003
2004            onClickDownload: function()
2005            {
2006                document.location.href = "project?methodName=downloadFile&fileName=bib.txt";
2007            }
2008
2009
2010        } );
2011
2012
2013</script>
2014
2015
2016
Note: See TracBrowser for help on using the repository browser.