source: geisa/web/initGeisa_script.jsp @ 553

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

transitions

File size: 96.9 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                //création de l'image d'attente
478                var param = new Object();
479               param.id = "loadingForGraphics";
480               param.parent = this.containerLoading;
481               this.loadingGraphics = new Loading( param );
482              // this.loadingGraphics.display();
483               //this.loadingGraphics.hide();
484
485
486                // Create menu deroulant  choix de la base
487                var paramDatabase = new Object();
488                paramDatabase.id = "selectDatabase";
489                paramDatabase.parent = $("#database1");
490                this.selectDatabase = new Select( paramDatabase );
491                this.selectDatabase.add( 'GEISA2011', "GEISA 2011", jQuery.proxy(this.onClickSelectDatabase, this), '<%=IsotopeG09.class%>' );
492                this.selectDatabase.add( 'GEISAIASI2011', "GEISA-IASI 2011", jQuery.proxy(this.onClickSelectDatabase, this), '<%=IsotopeIasiG09.class%>' );
493                this.selectDatabase.add( 'GEISA2003', "GEISA 2003", jQuery.proxy(this.onClickSelectDatabase, this), '<%=IsotopeG03.class%>' );
494                this.selectDatabase.add( 'GEISAIASI2003', "GEISA-IASI 2003", jQuery.proxy(this.onClickSelectDatabase, this), '<%=IsotopeIasiG03.class%>' );
495                this.selectDatabase.selectFirst( false );
496
497                //Zone texte  SpectralRange
498                //Titre général (qui changera en fonction de la base geisa choisie)
499                document.getElementById('spectralRangeTitre').innerHTML = "";
500                document.getElementById('spectralRangeTitre').innerHTML = "Choosing the spectral range from 0 to 35877.030506 cm<sup>-1</sup>";
501
502                //Titre
503                var titleSpectralRangeLower = document.createTextNode("Lower Bound :");
504                document.getElementById("spectralRangeLower").appendChild(titleSpectralRangeLower);
505                var titleSpectralRangeUpper = document.createTextNode("Upper Bound :");
506                document.getElementById("spectralRangeUpper").appendChild(titleSpectralRangeUpper);
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
519                inputSpectralRangeUpper.bind( 'blur', this, jQuery.proxy( this.requestTransition, this ));
520                this.containerFormSpectralRangeUpper.append( inputSpectralRangeUpper );
521
522                //titre  menu deroulant  transition upper
523                var titleTransitionUpper = document.createTextNode("Upper Bound :");
524                document.getElementById("transitionUpperTitle").appendChild(titleTransitionUpper);
525                // Create menu deroulant  transition upper
526//                var paramSelectTransitionUpper = new Object();
527//                paramSelectTransitionUpper.id = "transition1";
528//                paramSelectTransitionUpper.parent = $("#transitionUpper");
529//                this.selectTransitionUpper = new Select( paramSelectTransitionUpper );
530//                this.selectTransitionUpper.add( '-1', "Select a molecule" );
531//                this.selectTransitionUpper.selectFirst( false );
532
533                this.selectTransitionUpper = $( document.createElement( "select" ) );
534                this.selectTransitionUpper.attr( {id:"transition1"} );
535                var optTransitionUpper = $( document.createElement( "option" ) );
536                optTransitionUpper.attr( {value:"-1", text:"Select a molecule"} );
537                //var  transitionsLower ="000";
538                // opt2.bind( 'click', jQuery.proxy(this.requestTransitionByTransitionLower, [this, transitionsLower ]));
539                this.selectTransitionUpper.append(optTransitionUpper);
540                $("#transitionUpper").append(this.selectTransitionUpper);
541
542
543                //titre  menu deroulant  transition lower
544                var titleTransitionLower = document.createTextNode("Lower Bound :");
545                document.getElementById("transitionLowerTitle").appendChild(titleTransitionLower);
546                // Create menu deroulant  transition lower
547//                var paramSelectTransitionLower = new Object();
548//                paramSelectTransitionLower.id = "transition2";
549//                paramSelectTransitionLower.parent = $("#transitionLower");
550//                this.selectTransitionLower = new Select( paramSelectTransitionLower );
551//                this.selectTransitionLower.add( '-1', "Select a molecule");
552//                this.selectTransitionLower.selectFirst( false );
553                this.selectTransitionLower = $( document.createElement( "select" ) );
554                this.selectTransitionLower.attr( {id:"transition2"} );
555                var optTransitionLower = $( document.createElement( "option" ) );
556                optTransitionLower.attr( {value:"-1", text:"Select a molecule"} );
557                this.selectTransitionLower.append(optTransitionLower);
558                $("#transitionLower").append(this.selectTransitionLower);
559
560                //bouton reset pour les transition
561                var resetButton = new Button( {value:"Reset", parent:$( "#transitionReset" ), id:"buttonReset", className: "gray_button", onClick:jQuery.proxy( this.requestTransition, this )} );
562
563
564//                //menu déroulant  js   en javascript    sans passer par le modele
565//                var select = document.createElement('select');
566//                select.id = "transiEssai";
567//                select.name ="transiEssai";
568//
569//                var opt = document.createElement('option');
570//                opt.setAttribute('value','id1');
571//                var theText = document.createTextNode("id1");
572//                opt.appendChild(theText);
573//                select.appendChild(opt);
574//
575//                var opt = document.createElement('option');
576//                opt.setAttribute('value','id2');
577//                var theText = document.createTextNode("id2");
578//                opt.appendChild(theText);
579//
580//                //opt.onclick=jQuery.proxy(this.requestTransitionByTransitionLower, [this, transitionsLower ]);
581//                    select.appendChild(opt);
582//                    document.getElementById("transitionLower").appendChild(select);
583
584
585                //menu déroulant en jquery    sans passer par le modele
586//                this.select2 = $( document.createElement( "select" ) );
587//                this.select2.attr( {id:"transiEssai2", name:"transiEssai2"} );
588//                var opt2 = $( document.createElement( "option" ) );
589//                opt2.attr( {value:"id3", text:"zzz"} );
590//                //var  transitionsLower ="000";
591//                // opt2.bind( 'click', jQuery.proxy(this.requestTransitionByTransitionLower, [this, transitionsLower ]));
592//                this.select2.append(opt2);
593//                $("#transitionLower").append(this.select2);
594
595
596                //Zone texte Intensity
597                //Titre
598                var titleIntensityLower = document.createTextNode("Lower Bound :");
599                document.getElementById("intensityLower").appendChild(titleIntensityLower);
600                var titleIntensityUpper = document.createTextNode("Upper Bound :");
601                document.getElementById("intensityUpper").appendChild(titleIntensityUpper);
602                //zone texte    IntensityLower
603                var inputIntensityLower = $( document.createElement( "input" ) );
604                inputIntensityLower.attr( {id:"intensityLo", class:"styleInputs"} );
605                inputIntensityLower.val(0);
606                this.containerFormIntensityLower.append( inputIntensityLower );
607                //zone texte    IntensityUpper
608                var inputIntensityUpper = $( document.createElement( "input" ) );
609                inputIntensityUpper.attr( {id:"intensityUp"} );
610                inputIntensityUpper.val(1e-16);
611                this.containerFormIntensityUpper.append( inputIntensityUpper );
612
613                //Zone text Mean Value
614                //Titre
615                var titleMeanValue = document.createTextNode("Step :");
616                document.getElementById("meanValue1").appendChild(titleMeanValue);
617                //champ input
618                var inputMeanValue = $( document.createElement( "input" ) );
619                inputMeanValue.attr( {id:"meanValue2"} );
620                inputMeanValue.val(0);
621                this.containerFormMeanValue1.append( inputMeanValue );
622                inputMeanValue.bind( 'blur', this, jQuery.proxy( this.onBlurInputMeanValue, this ));
623
624                // Create menu deroulant  type de graphe
625                var paramNbCourbes = new Object();
626                paramNbCourbes.id = "SelectNbCourbes";
627                paramNbCourbes.parent = $("#NbCourbes");
628                this.SelectNbCourbes = new Select( paramNbCourbes );
629                this.SelectNbCourbes.add( 'ca', "One curve for all selection", jQuery.proxy(this.onClickSelectNbCourbes, this ) );
630                this.SelectNbCourbes.add( 'cm', "One curve for each molecule selected", jQuery.proxy(this.onClickSelectNbCourbes, this ) );
631                this.SelectNbCourbes.add( 'ci', "One curve for each isotopologue selected", jQuery.proxy(this.onClickSelectNbCourbes, this ) );
632                this.SelectNbCourbes.add( 'gm', "One graph for each molecule selected", jQuery.proxy(this.onClickSelectNbCourbes, this ) );
633                this.SelectNbCourbes.add( 'gi', "One graph for each isotopologue selected", jQuery.proxy(this.onClickSelectNbCourbes, this ) );
634                this.SelectNbCourbes.selectFirst( false );
635
636                // Create menu deroulant  1er choix axe des y
637                //Titre
638                var titleAxeY1 = document.createTextNode("Choose the first vertical axis");
639                document.getElementById("axeY1").appendChild(titleAxeY1);
640                var spaceBr = document.createElement ("br");
641                document.getElementById("axeY1").appendChild(spaceBr);
642                //menu déroulant
643                var paramSelectAxeY1 = new Object();
644                paramSelectAxeY1.id = "selectAxeY1";
645                paramSelectAxeY1.parent = $("#axeY1");
646                this.selectTraceAxeY1 = new Select( paramSelectAxeY1 );
647                this.selectTraceAxeY1.add( 'B', "Intensity", jQuery.proxy(this.onClickSelectTraceAxeY1, this ));
648                this.selectTraceAxeY1.add( 'C', "Air broadening pressure halfwidth", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
649                this.selectTraceAxeY1.add( 'D', "Energy of the lower transition level", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
650                this.selectTraceAxeY1.add( 'F', "Temperature dependence coefficient n of the air broadening halfwidth ", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
651                this.selectTraceAxeY1.add( 'N', "Self broadening pressure halfwidth (HWHM)", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
652                this.selectTraceAxeY1.add( 'O', "Air pressure shift of the line transition", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
653                this.selectTraceAxeY1.add( 'R', "Temperature dependence coefficient of the air pressure shift ", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
654                this.selectTraceAxeY1.selectFirst( false );
655
656
657                // Create menu deroulant  type d'échelle linéaire ou logarithmique  pour le choix y1
658                //Titre
659                var titleScaleY1 = document.createTextNode("Select the type of Scale (if intensity is choosen)");
660                document.getElementById("scaleY1Titre").appendChild(titleScaleY1);
661                //menu déroulant
662                var paramSelectScaleY1 = new Object();
663                paramSelectScaleY1.id = "SelectScaleY1";
664                paramSelectScaleY1.parent = $("#scaleY1");
665                this.selectScaleY1 = new Select( paramSelectScaleY1 );
666                this.selectScaleY1.add( 'l', "Linear" );
667                this.selectScaleY1.add( '-log_scale', "Logarithmic" );
668                this.selectScaleY1.selectFirst( false );
669
670                // Create menu deroulant  style de tracer   Y1
671                //Titre
672                var titleTypeTrace = document.createTextNode("Select the type of plot");
673                document.getElementById("typePlotY1").appendChild(titleTypeTrace);
674                var spaceBr = document.createElement ("br");
675                document.getElementById("typePlotY1").appendChild(spaceBr);
676                //menu déroulant
677                var paramSelectTypeTraceY1 = new Object();
678                paramSelectTypeTraceY1.id = "SelectTypePlotY1";
679                paramSelectTypeTraceY1.parent = $("#typePlotY1");
680                this.selectTypeTraceY1 = new Select( paramSelectTypeTraceY1 );
681                this.selectTypeTraceY1.add( 'l', "Lines" );
682                this.selectTypeTraceY1.add( 'p', "Dots" );
683                this.selectTypeTraceY1.add( 'i', "Peaks" );
684                this.selectTypeTraceY1.add( 'lp', "Lines and Dots" );
685                this.selectTypeTraceY1.selectFirst( false );
686
687
688                // Create menu deroulant  2eme choix axe des y
689                //Titre
690                var titleAxeY2 = document.createTextNode("Choose the second vertical axis");
691                document.getElementById("axeY2Titre").appendChild(titleAxeY2);
692                //menu déroulant
693                var paramSelectAxeY2 = new Object();
694                paramSelectAxeY2.id = "selectAxeY2";
695                paramSelectAxeY2.parent = $("#axeY2");
696                this.selectTraceAxeY2 = new Select( paramSelectAxeY2 );
697                this.selectTraceAxeY2.add( 'no', "None", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
698                this.selectTraceAxeY2.add( 'B', "Intensity", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
699                this.selectTraceAxeY2.add( 'C', "Air broadening pressure halfwidth", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
700                this.selectTraceAxeY2.add( 'D', "Energy of the lower transition level", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
701                this.selectTraceAxeY2.add( 'F', "Temperature dependence coefficient n of the air broadening halfwidth ", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
702                this.selectTraceAxeY2.add( 'N', "Self broadening pressure halfwidth (HWHM)", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
703                this.selectTraceAxeY2.add( 'O', "Air pressure shift of the line transition", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
704                this.selectTraceAxeY2.add( 'R', "Temperature dependence coefficient of the air pressure shift ", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
705                this.selectTraceAxeY2.selectFirst( false );
706
707                // Create menu deroulant  type d'échelle linéaire ou logarithmique  pour le choix y2
708                //Titre
709                var titleScaleY2 = document.createTextNode("Select the type of Scale (if intensity is choosen)");
710                document.getElementById("scaleY2Titre").appendChild(titleScaleY2);
711                //menu déroulant
712                var paramSelectScaleY2 = new Object();
713                paramSelectScaleY2.id = "SelectScaleY2";
714                paramSelectScaleY2.parent = $("#scaleY2");
715                this.selectScaleY2 = new Select( paramSelectScaleY2 );
716                this.selectScaleY2.add( 'l', "Linear" );
717                this.selectScaleY2.add( '-log_scale2', "Logarithmic" );
718                this.selectScaleY2.selectFirst( false );
719                //est inactif par defaut car selectTraceAxeY2 est positionne a none par defaut
720                document.getElementById("scaleY2Titre").className = "notActiveText";
721                this.selectScaleY2.disable();
722
723                // Create menu deroulant  style de tracer       Y2
724                //Titre
725                var titleTypeTrace = document.createTextNode("Select the type of plot");
726                document.getElementById("typePlotY2Titre").appendChild(titleTypeTrace);
727                //menu déroulant
728                var paramSelectTypeTraceY2 = new Object();
729                paramSelectTypeTraceY2.id = "SelectTypePlotY2";
730                paramSelectTypeTraceY2.parent = $("#typePlotY2");
731                this.selectTypeTraceY2 = new Select( paramSelectTypeTraceY2 );
732                this.selectTypeTraceY2.add( 'l', "Lines" );
733                this.selectTypeTraceY2.add( 'p', "Dots" );
734                this.selectTypeTraceY2.add( 'i', "Peaks" );
735                this.selectTypeTraceY2.add( 'lp', "Lines and Dots" );
736                this.selectTypeTraceY2.selectFirst( false );
737                //est inactif par defaut car selectTraceAxeY2 est positionne a none par defaut
738                document.getElementById("typePlotY2Titre").className = "notActiveText";
739                this.selectTypeTraceY2.disable();
740
741
742                this.createMolecules($('#BDD-GEISA2011'), this.arrayGeisa2011, "GEISA2011");
743                this.createMolecules($('#BDD-GEISA2003'), this.arrayGeisa2003, "GEISA2003");
744                this.createMolecules($('#BDD-GEISAIASI2011'), this.arrayGeisaIasi2011, "GEISAIASI2011");
745                this.createMolecules($('#BDD-GEISAIASI2003'), this.arrayGeisaIasi2003, "GEISAIASI2003");
746
747
748                // 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 )} );
749                var submitButton = new Button( {value:"Submit", parent:$( "#boutonSubmit" ), id:"button_submit_3", className: "positive", onClick:jQuery.proxy( this.onClickSubmit, this )} );
750            },
751
752
753
754
755            /**
756             * This method creates the case to check for the moles
757             * create cases à cocher pour les molécules
758             * @param container
759             * @param moleculesArray
760             */
761                //createMolecules: function(container, moleculesArray)
762            createMolecules: function(container, moleculesArray, BddVersion)
763            {
764                var table = $(document.createElement("table"));
765                container.append(table);
766                // var tr = $(document.createElement("tr"));
767                // tr.attr({valign: "top"});
768                // table.append(tr);
769                var i=0;
770                //nombre de molecules par ligne
771                var l=10;
772                //taille du tableau
773                //alert("l" +moleculesArray.length);
774                // parseInt : partie entiÚre
775                // var res =  parseInt(8/3);
776                //alert("res="+res);
777
778                $.each(moleculesArray, jQuery.proxy( function(index, moleculeElement )
779                {
780
781
782                    //this.tr et non var tr pour que tr existe encore à la sortie du if
783                    if ( index == (i*l))
784                    {
785                        //alert(index);
786                        this.tr = $(document.createElement("tr"));
787                        this.tr.attr({valign: "top"});
788                        table.append(this.tr);
789                        i=i+1;
790
791                    }
792                    var td = $(document.createElement("td"));
793                    this.tr.append(td);
794
795                    var span= $(document.createElement("span"));
796                    span.addClass("molecule");
797                    td.append(span);
798
799                    var input = $(document.createElement("input"));
800                    input.attr({type:"checkbox", id:"all-"+moleculeElement.id+"-"+BddVersion});
801                    input.bind( 'click', this, jQuery.proxy( this.cliquetout, [this, moleculeElement.id, BddVersion ] ));
802                    span.append(input);
803
804                    var a = $(document.createElement("a"));
805                    a.html("<b>"+moleculeElement.name+"</b>");
806
807                    a.bind( 'click', this, jQuery.proxy( this.visibilite, [this,"Cache-"+ moleculeElement.id] ));
808                    span.append(a);
809
810                    var div= $(document.createElement("div"));
811                    div.addClass("divViolet");
812                    div.attr({id:"Cache-"+moleculeElement.id, style: "display:none"});
813                    td.append(div);
814
815                    var spanIsotopes= $(document.createElement("span"));
816                    spanIsotopes.addClass("isotope");
817                    spanIsotopes.attr({id:moleculeElement.id+"Isotope"+BddVersion});
818                    div.append(spanIsotopes);
819
820
821                    this.createIsotopes($("#"+moleculeElement.id+"Isotope"+BddVersion), moleculeElement.isotopesArray, moleculeElement.id, BddVersion);
822
823
824                }, this) );
825
826
827            },
828
829            createIsotopes: function(container, isotopesArray, moleculeElement, BddVersion )
830            {
831
832
833                $.each(isotopesArray, jQuery.proxy( function( index, isotopeElement )
834                {
835                    container.append("&nbsp;&nbsp;&nbsp;");
836                    var inputIsotopes = $(document.createElement("input"));
837                    inputIsotopes.attr({type:"checkbox", id:"chk-"+moleculeElement+"_"+isotopeElement+"-"+BddVersion, name:"moles", value:moleculeElement+"_"+isotopeElement});
838                    inputIsotopes.bind( 'click', this, jQuery.proxy( this.cliqueIsotope, [this, moleculeElement+"_"+isotopeElement, moleculeElement, BddVersion ] ));
839                    container.append(inputIsotopes);
840                    container.append(isotopeElement);
841                    var br = $(document.createElement("br"));
842                    container.append(br);
843
844                }, this) );
845            },
846
847            // <table><tr><td>
848            // <span class="molecule"><input type=checkbox id=all-ch3cn-GEISA2011 onclick="cliquetout('this, ch3cn, GEISA2011');">
849            //          <a href="javascript:visibilite('this, Cache-ch3cn');"><B>CH<sub>3</sub>CN</a></B>
850            // </span>
851            // <div class="divViolet" id="Cache-ch3cn" style="display:none;">
852            //          <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>
853            // </div>
854            // </td></tr></table>
855
856// REQUESTS ********************************************************
857            //récupération de toutes les valeurs choisies par l'utilisateur et transformation de ces valeurs pour les inclure dans la requête fortran
858            requestGeisa: function()
859            {
860
861                //on va chercher les chemin déclaré dans le controller
862                this.pathProcess = "<%=Controller.PATH_PROCESS%>";
863                this.LongPathImages = "<%=Controller.LONG_PATH_IMAGES%>";
864
865
866
867                 //sélection du fichier binaire de la base geisa sélectionnée
868                var paramBase = "";
869                switch (this.selectDatabase.getValue()) {
870                    case 'GEISA2003':
871                        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";
872                        break;
873                    case 'GEISA2011':
874                        paramBase = " -dirin "+this.pathProcess+" -dirout "+this.LongPathImages+" -filein "+this.pathProcess+"line_GEISA2009_bin -database_name GEISA2011 -database_type gs08";
875                        break;
876                    case 'GEISAIASI2003':
877                        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";
878                        break;
879                    case 'GEISAIASI2011':
880                        paramBase = " -dirin "+this.pathProcess+" -dirout "+this.LongPathImages+" -filein "+this.pathProcess+"line_GEISAIASI2011_bin_gsi08_v1.0 -database_name GEISAIASI2011 -database_type gsi08";
881                        break;
882                }
883
884
885                //molécules
886                //récupération des molécules sélectionnées
887                var inputs = document.getElementsByTagName( 'input' );
888                var count = inputs.length;
889                var isotopesSelectedName ="";
890              //  alert(this.selectDatabase.getValue());
891                var i=0;
892                this.nbIsotopes = 0;
893                this.nbMolecules = 0;
894                this.nbGraph = 0;
895                for( i = 0; i < count; i++ )
896                {
897                    var input = inputs.item( i );
898                    //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")
899                    if( input.type == 'checkbox' && input.checked == true && input.id.indexOf("chk-")!= -1 && input.id.indexOf(this.selectDatabase.getValue())!= -1)
900                    {
901                        //nombre d'isotopes sélectionnés
902                        this.nbIsotopes =  this.nbIsotopes + 1;
903
904                        var molN=input.value;
905                        var molN1=molN.replace("_", ":");
906                        // exemple : -moleisot h2o:161 -moleisot h2o:162 -moleisot co2:626 -moleisot co2:627 -moleisot o3:666 -moleisot o3:668
907                        isotopesSelectedName = isotopesSelectedName+"-moleisot "+molN1+" ";
908                    }
909                    //récupération du nombre de molécules sélectionnées
910                    if( input.type == 'checkbox' && input.checked == true && input.id.indexOf("all-")!= -1 && input.id.indexOf(this.selectDatabase.getValue())!= -1)
911                    {
912                        //nombre d'isotopes sélectionnés
913                        this.nbMolecules =  this.nbMolecules + 1;
914                    }
915                }
916
917
918                //averti l'utilisateur qu'il faut au moins sélectionner un isotope
919                if (this.nbIsotopes ==  0) {
920                    alert("Error : no molecule or isotopoloque was selected");
921                    return;
922                }
923
924
925
926                //sélection du nombre de courbes ou de graphs
927
928                var nbCourbes = "";
929                switch (this.SelectNbCourbes.getValue()) {
930                    case 'cm':
931                        nbCourbes = "-separate_mol -same_graph ";
932                        this.nbGraph = 1;
933                        this.nbCourbe =  this.nbMolecules;
934                        if (this.nbCourbe > 8) {
935                            alert("Too much molecules selected to draw one curve for each molecule selected");
936                            return;
937                        }
938                        break;
939                    case 'ci':
940                        nbCourbes = "-separate_iso -same_graph ";
941                        this.nbGraph = 1;
942                        this.nbCourbe =  this.nbIsotopes;
943                        if (this.nbCourbe > 8) {
944                            alert("Too much isotopologues selected to draw one curve for each isotopologues selected");
945                            return;
946                        }
947                        break;
948                    case 'gm':
949                        nbCourbes = "-separate_mol ";
950                        this.nbGraph = this.nbMolecules;
951                        if (this.nbGraph > 20) {
952                            alert("Too much molecules selected to draw one graph for each molecules selected");
953                            return;
954                        }
955                        break;
956                    case 'gi':
957                        nbCourbes = "-separate_iso ";
958                        this.nbGraph = this.nbIsotopes;
959                        if (this.nbGraph > 20) {
960                            alert("Too much isotopologues selected to draw one graph for each isotopologues selected");
961                            return;
962                        }
963                        break;
964                    default:
965                        nbCourbes = "";
966                        this.nbGraph = 1;
967                        break;
968                }
969
970
971                //Spectral range
972                var rangeLower="-wavenb_min "+$("#RangeLower").val();
973                var rangeUpper="-wavenb_max "+$("#RangeUpper").val();
974
975                //controle des valeurs entrées par l'utilisateur
976
977                switch (this.selectDatabase.getValue()) {
978                    case 'GEISA2003':
979                        //isNaN = n'est pas un nombre
980                        if(isNaN($("#RangeLower").val()) == true ||   parseInt($("#RangeLower").val()) < 0  || parseInt($("#RangeLower").val()) > 35877.030506)
981                        {
982                            alert("Error: Invalid value for lower spectral range area");
983                            return;
984                        }
985
986                        if(isNaN($("#RangeUpper").val()) == true ||   parseInt( $("#RangeUpper").val()) == 0 || parseInt( $("#RangeUpper").val()) < 0  || parseInt($("#RangeUpper").val()) > 35877.030506)
987                        {
988                            alert("Error: Invalid value for upper spectral range area");
989                            return;
990                        }
991                        break;
992                    case 'GEISA2011':
993                        //isNaN = n'est pas un nombre
994                        if(isNaN($("#RangeLower").val()) == true ||   parseInt($("#RangeLower").val()) < 0  || parseInt($("#RangeLower").val()) > 35877.030506)
995                        {
996                            alert("Error: Invalid value for lower spectral range area");
997                            return;
998                        }
999
1000                        if(isNaN($("#RangeUpper").val()) == true ||   parseInt( $("#RangeUpper").val()) == 0 || parseInt( $("#RangeUpper").val()) < 0  || parseInt($("#RangeUpper").val()) > 35877.030506)
1001                        {
1002                            alert("Error: Invalid value for upper spectral range area");
1003                            return;
1004                        }
1005                        break;
1006                    case 'GEISAIASI2003':
1007                        //isNaN = n'est pas un nombre
1008                        if(isNaN($("#RangeLower").val()) == true ||   parseInt($("#RangeLower").val()) < 0 || parseInt($("#RangeLower").val()) < 599.000793 || parseInt($("#RangeLower").val()) > 3000.998767)
1009                        {
1010                            alert("Error: Invalid value for lower spectral range area");
1011                            return;
1012                        }
1013
1014                        if(isNaN($("#RangeUpper").val()) == true ||   parseInt( $("#RangeUpper").val()) == 0 || parseInt( $("#RangeUpper").val()) < 0  ||  parseInt($("#RangeUpper").val()) < 599.000793 || parseInt($("#RangeUpper").val()) > 3000.998767)
1015                        {
1016                            alert("Error: Invalid value for upper spectral range area");
1017                            return;
1018                        }
1019                        break;
1020                    case 'GEISAIASI2011':
1021                        //isNaN = n'est pas un nombre
1022                        if(isNaN($("#RangeLower").val()) == true ||   parseInt($("#RangeLower").val()) < 0 || parseInt($("#RangeLower").val()) < 599.000793 || parseInt($("#RangeLower").val()) > 3000.998767)
1023                        {
1024                            alert("Error: Invalid value for lower spectral range area");
1025                            return;
1026                        }
1027
1028                        if(isNaN($("#RangeUpper").val()) == true ||   parseInt( $("#RangeUpper").val()) == 0 || parseInt( $("#RangeUpper").val()) < 0  ||  parseInt($("#RangeUpper").val()) < 599.000793 || parseInt($("#RangeUpper").val()) > 3000.998767)
1029                        {
1030                            alert("Error: Invalid value for upper spectral range area");
1031                            return;
1032                        }
1033                        break;
1034                }
1035
1036
1037                if ($("#RangeLower").val() == ""  )
1038                {
1039                    rangeLower="";
1040                }
1041
1042                if ($("#RangeUpper").val() == ""  )
1043                {
1044                    rangeUpper="";
1045                }
1046                if( parseInt($("#RangeLower").val())  > parseInt($("#RangeUpper").val()) )
1047                {
1048                    alert("Error: lower spectral range area is superior to upper spectral range area ");
1049                    return;
1050                }
1051
1052
1053                //Transitions  to do
1054                //exemple de requete avec transition
1055                //./all -filein line_GEISA2009_bin -moleisot h2o:161 -wavenb_min 1 -wavenb_max 1000 -database_name "GEISA2011" -vib_ident_lower '[000]'
1056                //var TransitionUpper ="-vib_ident_upper '[ "+this.selectTransitionUpper.getValue()+" ]'";
1057                var transitionUpper=document.getElementById('transition1').options[document.getElementById('transition1').selectedIndex].value;
1058                //Enlever les espaces blancs
1059               // TransitionUp= TransitionUp.replace(/ /g,"");
1060               //var TransitionUpper ="-vib_ident_upper ["+TransitionUp+"]";
1061                // var transitionUpper = "["+transitionUp+"]";
1062                alert ("transitionUpper"+transitionUpper);
1063
1064                // var TransitionLower ="-vib_ident_lower '[ "+this.selectTransitionLower.getValue()+" ]'";
1065                  var transitionLower=document.getElementById('transition2').options[document.getElementById('transition2').selectedIndex].value;
1066                //  TransitionLo= TransitionLo.replace(/ /g,"");
1067                 // var TransitionLower ="-vib_ident_lower ["+TransitionLo+"]";
1068                //var transitionLower ="["+transitionLo+"]";
1069
1070                 //pas de transition sélectionnée
1071                // if (( this.selectTransitionUpper.getValue()== -1) ||  (this.selectTransitionUpper.getValue() == "transition" ))
1072                // {
1073                // TransitionUpper ="";
1074                // }
1075                // if (( this.selectTransitionLower.getValue()== -1) ||  (this.selectTransitionLower.getValue() == "transition" ))
1076                // {
1077                // TransitionLower ="";
1078                // }
1079                if (( document.getElementById('transition1').options[document.getElementById('transition1').selectedIndex].value == -1) ||  (document.getElementById('transition1').options[document.getElementById('transition1').selectedIndex].value == "transition" ))
1080                {
1081                    transitionUpper ="no";
1082                }
1083                if (( document.getElementById('transition2').options[document.getElementById('transition2').selectedIndex].value == -1) ||  (document.getElementById('transition2').options[document.getElementById('transition2').selectedIndex].value == "transition" ))
1084                {
1085                    transitionLower ="no";
1086                }
1087
1088                if ( document.getElementById('transition1').options[document.getElementById('transition1').selectedIndex].value == "")
1089                {
1090                    transitionUpper ="noValue";
1091                }
1092
1093                if ( document.getElementById('transition2').options[document.getElementById('transition2').selectedIndex].value == "")
1094                {
1095                    transitionLower ="noValue";
1096                }
1097
1098                 var sel = document.getElementById('transition1');
1099                 var idupper = sel.options[sel.selectedIndex].value;
1100                  //alert("idupper"+idupper);
1101
1102                //Intensity range
1103                var intensityLower="-int_min "+$("#intensityLo").val();
1104                var intensityUpper="-int_max "+$("#intensityUp").val();
1105
1106                //controle des valeurs entrées par l'utilisateur
1107                 if(isNaN($("#intensityLo").val()) == true ||   $("#intensityLo").val() < 0  )
1108                {
1109                    alert("Error: Invalid value for lower intensity range area");
1110                    return;
1111                }
1112                if ($("#intensityLo").val() == ""  )
1113                {
1114                    intensityLower="";
1115                }
1116                if(isNaN($("#intensityUp").val()) == true ||   $("#intensityUp").val() < 0  )
1117                {
1118                    alert("Error: Invalid value for upper intensity range area");
1119                    return;
1120                }
1121                if ($("#intensityUp").val() == ""  )
1122                {
1123                    intensityUpper="";
1124                }
1125
1126                //to do javascript ne sait comparer des exponenciels
1127              // if( $("#intensityLo").val()  > $("#intensityUp").val() )
1128
1129               // {
1130               //     alert("Error: lower intensity range area is superior to upper intensity range area ");
1131               //     return;
1132               // }
1133
1134
1135                //Valeur de mean value
1136                var meanValue = "-step "+$("#meanValue2").val();
1137                //controle des valeurs entrées par l'utilisateur
1138                //Si ce n'est pas un nombre ou si il est négatif
1139                if(isNaN($("#meanValue2").val()) == true ||   $("#meanValue2").val() < 0  )
1140                {
1141                    alert("Error: Invalid value for Average calculation area");
1142                    return;
1143                }
1144                //si aucune valeur
1145                if ($("#meanValue2").val() == ""  )
1146                {
1147                    meanValue="";
1148                }
1149
1150                //sélection du premier choix pour l'axe des Y
1151                var field="-field "+this.selectTraceAxeY1.getValue();
1152
1153
1154                 //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)
1155                if  (this.selectScaleY1.getValue() == '-log_scale' && this.selectScaleY1.isDisable == false)
1156                {
1157                    var logScale = this.selectScaleY1.getValue();
1158                }
1159                else
1160                {
1161                    var logScale = ""
1162                }
1163
1164                //sélection du type de tracé pour Y1
1165                var lineType="-line_type "+this.selectTypeTraceY1.getValue();
1166
1167
1168                //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)
1169                if  (this.selectTraceAxeY2.getValue() == 'no' ||  this.selectTraceAxeY2.isDisable == true)
1170                {
1171                    var field2 = "";
1172                }
1173                else
1174                {
1175                    var field2 = "-field2 "+this.selectTraceAxeY2.getValue();
1176                }
1177
1178                //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)
1179                if  (this.selectScaleY2.getValue() == '-log_scale2' && this.selectScaleY2.isDisable == false)
1180                {
1181                    var logScale2 =this.selectScaleY2.getValue();
1182                }
1183                else
1184                {
1185                    var logScale2 = "";
1186                }
1187
1188
1189                //sélection du type de tracé pour Y2  (pas de valeur  si l'option n'est pas activée)
1190                if  ( this.selectTypeTraceY2.isDisable == true)
1191                {
1192                    var lineType2 = "";
1193                }
1194                else
1195                {
1196                    var lineType2 = "-line_type2 "+this.selectTypeTraceY2.getValue();
1197                }
1198
1199
1200                //ouverture de la div de l'image d'attente
1201                this.loadingGraphics.display();
1202
1203
1204
1205
1206                //construction de la requête Fortran
1207               // var parameters = "&fortranRequest="+paramBase+" "+isotopesSelectedName+" "+rangeLower+" "+rangeUpper+" "+TransitionUpper+" "+TransitionLower+" "+intensityLower+" "+intensityUpper+" "+
1208                                      // meanValue+" "+nbCourbes+" "+field+" "+logScale+" "+lineType+" "+field2+" "+logScale2+" "+lineType2;
1209
1210                var parameters = "&fortranRequest="+paramBase+" "+isotopesSelectedName+" "+rangeLower+" "+rangeUpper+" "+intensityLower+" "+intensityUpper+" "+
1211                                       meanValue+" "+nbCourbes+" "+field+" "+logScale+" "+lineType+" "+field2+" "+logScale2+" "+lineType2;
1212
1213
1214                //remplacement de espace par "EEE" pour que le shell script ne voit qu'un seul argument en entrée
1215                parameters=parameters.replace(/ /g,"EEE");
1216                transitionUpper=transitionUpper.replace(/ /g,"EEE");
1217                //le + est interprété comme un espace (plus sera retransformé en + dans le shell)
1218                transitionUpper=transitionUpper.replace(/\+/g,"plus");
1219                transitionLower=transitionLower.replace(/ /g,"EEE");
1220                transitionLower=transitionLower.replace(/\+/g,"plus");
1221
1222
1223                //envoie de la requête au controller
1224                //en cas de succes appel de la fonction "handleGeisa"
1225                $.ajax( {
1226                            //url: "project?methodName=createUserRequest&"+parameters+"&nbGraph="+ this.nbGraph,
1227                            url: "project?methodName=createUserRequest&"+parameters+"&transitionUpper="+ transitionUpper+"&transitionLower="+ transitionLower+"&nbGraph="+ this.nbGraph,
1228                            success:jQuery.proxy( this.handleGeisa, this )
1229                        } );
1230            },
1231
1232
1233            //requête pour interrogation de la base de données des transitions
1234            requestTransition: function()
1235            {
1236
1237                var  nbMolecules=0;
1238
1239                //Récupération du spectral range
1240                var spectralRangeLower = $("#RangeLower").val();
1241                var spectralRangeUpper = $("#RangeUpper").val();
1242
1243                //Récupération des isotopes sélectionnés
1244                var inputs = document.getElementsByTagName( 'input' );
1245                var count = inputs.length;
1246                var isotopesSelectedNameArray = new Array();
1247                var i=0;
1248
1249                for( i = 0; i < count; i++ )
1250                {
1251                    var input = inputs.item( i );
1252                    //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")
1253                    if( input.type == 'checkbox' && input.checked == true && input.id.indexOf("chk-")!= -1 && input.id.indexOf(this.selectDatabase.getValue())!= -1)
1254                    {
1255                        var molN=input.value;
1256                        var molN1=molN.replace("_", ":");
1257                        //tous les isotopes sélectionnés sont placés dans un tableau
1258                        isotopesSelectedNameArray.push(molN1);
1259                    }
1260
1261                    //récupération du nombre de molécules sélectionnées
1262                    if( input.type == 'checkbox' && input.checked == true && input.id.indexOf("all-")!= -1 && input.id.indexOf(this.selectDatabase.getValue())!= -1)
1263                    {
1264                       nbMolecules =  nbMolecules + 1;
1265                    }
1266
1267                }
1268                //alert ("nbMolecules"+nbMolecules);
1269                //si le nombre de molécule sélectionnées est supérieure Ã  1 les menus des transition sont inactifs
1270                if (nbMolecules > 1)
1271                {
1272
1273                    //this.selectTransitionLower.disable();
1274                    //this.selectTransitionUpper.disable();
1275                    //ajoute une classe à celle déjà existante de transitionUpperTitle
1276                    $("#transitionUpperTitle").addClass("notActiveText");
1277                    $("#transitionLowerTitle").addClass("notActiveText");
1278                }
1279                else
1280                {
1281                    //this.selectTransitionLower.enable();
1282                    //this.selectTransitionUpper.enable();
1283                    $("#transitionUpperTitle").removeClass("notActiveText");
1284                    $("#transitionLowerTitle").removeClass("notActiveText");
1285                }
1286
1287
1288                //On ne fait appel à la BDD des transitions    et si au plus 1 molécule est sélectionnée
1289                if (nbMolecules == 1 )
1290                {
1291//                    $.ajax( {
1292//                                url: "project?methodName=getTransitionByIsotopeName&isotopesSelectedName="+isotopesSelectedName+"&GeisaSelectedDatabase="+GeisaSelectedDatabase+"&spectralRangeLower="+spectralRangeLower+"&spectralRangeUpper="+spectralRangeUpper,
1293//                                success:jQuery.proxy( this.handleRequestTransition, this )
1294//                            } );
1295
1296                    $.ajax( {
1297                                url: "project?methodName=getTransitionByIsotopeName&isotopesSelectedNameArray="+isotopesSelectedNameArray+"&geisaSelectedDatabase="+this.selectDatabase.getValue2()+"&spectralRangeLower="+spectralRangeLower+"&spectralRangeUpper="+spectralRangeUpper,
1298                                success:jQuery.proxy( this.handleRequestTransition, this )
1299                            } );
1300
1301                }
1302                else
1303                {
1304                    //pour réinitialiser le menu déroulant si aucune ou plusieurs molécules sont sélectionnées
1305                    document.getElementById("transition2").length=0;
1306                    //this.selectTransitionUpper.clear();
1307                    document.getElementById("transition1").length=0;
1308
1309                    if (nbMolecules == 0 )
1310                    {
1311                        //this.selectTransitionLower.add('-1', "Select a molecule");
1312                        this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:"-1", text:"Select a molecule", selected:"selected"} ));
1313                        //this.selectTransitionUpper.add('-1', "Select a molecule");
1314                        this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:"-1", text:"Select a molecule", selected:"selected"} ));
1315                        //pour forcer à afficher le premier élément (et non le premier élément précédent)
1316                        //this.selectTransitionLower.selectFirst();
1317                        //this.selectTransitionUpper.selectFirst();
1318                    }
1319
1320                    if (nbMolecules > 1 )
1321                    {
1322                        //this.selectTransitionLower.add('-1', "Select a molecule");
1323                        this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:"-1", text:"", selected:"selected", disabled:"disabled"} ));
1324                        //this.selectTransitionUpper.add('-1', "Select a molecule");
1325                        this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:"-1", text:"", selected:"selected", disabled:"disabled"} ));
1326                        //pour forcer à afficher le premier élément (et non le premier élément précédent)
1327                        //this.selectTransitionLower.selectFirst();
1328                        //this.selectTransitionUpper.selectFirst();
1329                    }
1330                }
1331            },
1332
1333
1334
1335
1336            //requête pour interrogation de la base de données des transitions en fonction d'une transition lower
1337            requestTransitionByTransitionLower: function()
1338            {
1339                var context  = this[0];
1340                //exemple transitionLower="                      000" : il y a 25 caractÚres dans chaque transition
1341                 context.transitionLower = this[1];
1342
1343                //Récupération de la Base Geisa sélectionnée
1344                var GeisaSelectedDatabase = context.selectDatabase.getValue();
1345
1346                //Récupération du spectral range
1347                var spectralRangeLower = $("#RangeLower").val();
1348                var spectralRangeUpper = $("#RangeUpper").val();
1349
1350                //Récupération des isotopes sélectionnés
1351                var inputs = document.getElementsByTagName( 'input' );
1352                var count = inputs.length;
1353                var isotopesSelectedNameArray = new Array();
1354                var i=0;
1355
1356                for( i = 0; i < count; i++ )
1357                {
1358                    var input = inputs.item( i );
1359                    //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")
1360                    if( input.type == 'checkbox' && input.checked == true && input.id.indexOf("chk-")!= -1 && input.id.indexOf(context.selectDatabase.getValue())!= -1)
1361                    {
1362                        var molN=input.value;
1363                        var molN1=molN.replace("_", ":");
1364                        //tous les isotopes sélectionnés sont placés dans un tableau
1365                        isotopesSelectedNameArray.push(molN1);
1366                    }
1367
1368                }
1369
1370                 //le passage de javascript Ã  java par ajax transforme les + en espace donc transformation des + en plus et dans le controller on fait l'inverse
1371                 var transitionLowerReplaced = context.transitionLower.replace(/\+/g,"plus");
1372
1373                //Appel Ã  la BDD
1374
1375                $.ajax( {
1376                            url: "project?methodName=getTransitionByIsotopeNameByTransitionLower&isotopesSelectedNameArray="+isotopesSelectedNameArray+"&geisaSelectedDatabase="+context.selectDatabase.getValue2()+"&spectralRangeLower="+spectralRangeLower+"&spectralRangeUpper="+spectralRangeUpper+"&transitionLower="+transitionLowerReplaced,
1377                            success:jQuery.proxy( context.handleRequestTransitionByTransitionLower, context)
1378                        } );
1379
1380
1381
1382            },
1383
1384
1385            //requête pour interrogation de la base de données des transitions en fonction d'une transition upper
1386            requestTransitionByTransitionUpper: function()
1387            {
1388                var context  = this[0];
1389                //exemple transitionLower="                      000" : il y a 25 caractÚres dans chaque transition
1390                 context.transitionUpper = this[1];
1391
1392                //Récupération de la Base Geisa sélectionnée
1393                var GeisaSelectedDatabase = context.selectDatabase.getValue();
1394
1395                //Récupération du spectral range
1396                var spectralRangeLower = $("#RangeLower").val();
1397                var spectralRangeUpper = $("#RangeUpper").val();
1398
1399                //Récupération des isotopes sélectionnés
1400                var inputs = document.getElementsByTagName( 'input' );
1401                var count = inputs.length;
1402                var isotopesSelectedNameArray = new Array();
1403                var i=0;
1404
1405                for( i = 0; i < count; i++ )
1406                {
1407                    var input = inputs.item( i );
1408                    //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")
1409                    if( input.type == 'checkbox' && input.checked == true && input.id.indexOf("chk-")!= -1 && input.id.indexOf(context.selectDatabase.getValue())!= -1)
1410                    {
1411                        var molN=input.value;
1412                        var molN1=molN.replace("_", ":");
1413                        //tous les isotopes sélectionnés sont placés dans un tableau
1414                        isotopesSelectedNameArray.push(molN1);
1415                    }
1416
1417                }
1418                //le passage de javascript Ã  java par ajax transforme les + en espace donc transformation des + en plus et dans le controller on fait l'inverse
1419                var transitionUpperReplaced = context.transitionUpper.replace(/\+/g,"plus");
1420
1421                //Appel Ã  la BDD
1422                $.ajax( {
1423                            url: "project?methodName=getTransitionByIsotopeNameByTransitionUpper&isotopesSelectedNameArray="+isotopesSelectedNameArray+"&geisaSelectedDatabase="+context.selectDatabase.getValue2()+"&spectralRangeLower="+spectralRangeLower+"&spectralRangeUpper="+spectralRangeUpper+"&transitionUpper="+transitionUpperReplaced,
1424                            success:jQuery.proxy( context.handleRequestTransitionByTransitionUpper, context)
1425                        } );
1426
1427
1428
1429            },
1430
1431
1432
1433//            requestTransition: function()
1434//            {
1435//                $.ajax( {
1436//                            url: "project?methodName=transition&transitionValue="+ this.selectTransitionUpper.getValue(),
1437//                            success:jQuery.proxy( this.handleRequestTransition, this )
1438//                        } );
1439//            },
1440
1441            // HANDLES ******************************************************** = retours ajax
1442            //affichage sur l'interface
1443
1444            handleGeisa: function( result )
1445            {
1446
1447
1448                //chemin de l'image
1449//                this.pathImg = jQuery.parseJSON( result ).pathImg;
1450                this.pathImg = "<%=Controller.PATH_IMAGES%>";
1451                //numéro unique pour le nom du graph
1452                this.nb = jQuery.parseJSON( result ).nb;
1453                //Pour tracer le bon nombre de graphe et de bouton download
1454                var i=1;
1455                var content = '';
1456                for (i=1; i<this.nbGraph+1; i++) {
1457                    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>';
1458                }
1459
1460                this.displayWindow(content);
1461            },
1462
1463
1464//            handleRequestTransition: function( result )
1465//            {
1466//                alert("youpi");
1467//            },
1468
1469
1470            handleRequestTransition: function( result )
1471            {
1472
1473
1474//                var transitions = jQuery.parseJSON( result ).transitions;
1475                 var transitionsLower = jQuery.parseJSON( result ).transitionsLower;
1476                 var transitionsUpper = jQuery.parseJSON( result ).transitionsUpper;
1477
1478                 //pour vider les menus déroulant des transitions précédentes
1479                 // this.selectTransitionLower.clear();
1480                document.getElementById("transition2").length=0;
1481                //this.selectTransitionUpper.clear();
1482                document.getElementById("transition1").length=0;
1483                // this.selectTransitionLower.add('transition', "Choose a transition");
1484                this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:"transition", text:"Choose a transition", disabled:"disabled", selected:"selected"} ));
1485
1486                // this.selectTransitionUpper.add('transition', "Choose a transition");
1487                this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:"transition", text:"Choose a transition", disabled:"disabled", selected:"selected"} ));
1488
1489                 //pour forcer à afficher le premier élément (et non le premier élément précédent)
1490                // this.selectTransitionLower.selectFirst();
1491                // this.selectTransitionUpper.selectFirst();
1492
1493                // alert ("transitionsUpper"+transitionsUpper);
1494                $.each(transitionsLower, jQuery.proxy( function(index, transitionsLower )
1495                {
1496                   //  this.selectTransitionLower.add(transitionsLower, transitionsLower,jQuery.proxy(this.requestTransitionByTransitionLower, [this, transitionsLower ]));
1497
1498
1499                    this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:transitionsLower, text:transitionsLower} ).bind( 'click', jQuery.proxy(this.requestTransitionByTransitionLower, [this, transitionsLower ])));
1500
1501                }, this));
1502
1503                $.each(transitionsUpper, jQuery.proxy( function(index, transitionsUpper )
1504                {
1505                    //this.selectTransitionUpper.add(transitionsUpper, transitionsUpper,jQuery.proxy(this.requestTransitionByTransitionUpper, [this, transitionsUpper ]));
1506                    this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:transitionsUpper, text:transitionsUpper} ).bind( 'click', jQuery.proxy(this.requestTransitionByTransitionUpper, [this, transitionsUpper ])));
1507
1508                }, this));
1509
1510            },
1511
1512            handleRequestTransitionByTransitionLower : function( result )
1513            {
1514                //alert("transitionLower"+this.transitionLower);
1515                var transitionsUpperBis = jQuery.parseJSON( result ).transitionsUpperBis;
1516                //alert("transitionsUpper"+transitionsUpper);
1517
1518                //pour vider les menus déroulant des transitions précédentes
1519               // this.selectTransitionLower.clear();
1520                document.getElementById("transition2").length=0;
1521                //this.selectTransitionUpper.clear();
1522                document.getElementById("transition1").length=0;
1523               // while(0 < document.getElementById("transition1").length)
1524               // {
1525               //     document.getElementById("transition1").options[0] = null;
1526               // }
1527
1528
1529                //this.selectTransitionLower.add(this.transitionLower, this.transitionLower);
1530                this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:"transition", text:"Choose a transition", disabled:"disabled"} ));
1531                this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:this.transitionLower, text:this.transitionLower,  selected:"selected"} ));
1532                //this.selectTransitionUpper.add('transition', "Choose a transition");
1533                //rajout du text "Choose a transition" selectionné en premier mais on ne peut pa cliquer dessus
1534                this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:"transition", text:"Choose a transition", disabled:"disabled", selected:"selected"} ));
1535
1536
1537                //pour forcer Ã  afficher le premier Ã©lément (et non le premier Ã©lément précédent)
1538                //this.selectTransitionLower.selectFirst();
1539                //this.selectTransitionUpper.selectFirst();
1540
1541
1542
1543                $.each(transitionsUpperBis, jQuery.proxy( function(index, transitionsUpperBis )
1544                {
1545                   // this.selectTransitionUpper.add(transitionsUpper, transitionsUpper);
1546                     this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:transitionsUpperBis, text:transitionsUpperBis} ));
1547
1548                }, this));
1549
1550            },
1551
1552
1553            handleRequestTransitionByTransitionUpper : function( result )
1554            {
1555               // alert("transitionUpper"+this.transitionUpper);
1556                var transitionsLowerBis = jQuery.parseJSON( result ).transitionsLowerBis;
1557                //alert("transitionsLower"+transitionsLower);
1558
1559                //pour vider les menus déroulant des transitions précédentes
1560               // this.selectTransitionLower.clear();
1561                document.getElementById("transition2").length=0;
1562                //this.selectTransitionUpper.clear();
1563                document.getElementById("transition1").length=0;
1564
1565               // this.selectTransitionLower.add('transition', "Choose a transition");
1566                this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:"transition", text:"Choose a transition", disabled:"disabled", selected:"selected"} ));
1567
1568               // this.selectTransitionUpper.add(this.transitionUpper, this.transitionUpper);
1569                this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:"transition", text:"Choose a transition", disabled:"disabled"} ));
1570                this.selectTransitionUpper.append($( document.createElement( "option" ) ).attr( {value:this.transitionUpper, text:this.transitionUpper,  selected:"selected"} ));
1571
1572
1573                //pour forcer Ã  afficher le premier Ã©lément (et non le premier Ã©lément précédent)
1574                //this.selectTransitionLower.selectFirst();
1575                //this.selectTransitionUpper.selectFirst();
1576
1577
1578
1579                $.each(transitionsLowerBis, jQuery.proxy( function(index, transitionsLowerBis )
1580                {
1581                    //this.selectTransitionLower.add(transitionsLower, transitionsLower);
1582                    this.selectTransitionLower.append($( document.createElement( "option" ) ).attr( {value:transitionsLowerBis, text:transitionsLowerBis} ));
1583                }, this));
1584
1585            },
1586            // EVENTS ********************************************************
1587
1588
1589            //affichage de la valeur du spectral range et affichage du bloc des molecules en fonction de la base de donnees selectionnee
1590            onClickSelectDatabase: function(value)
1591            {
1592
1593                if  ('GEISA2011' == value)
1594                {
1595                    document.getElementById('spectralRangeTitre').innerHTML = "";
1596                    document.getElementById('spectralRangeTitre').innerHTML = "Choosing the spectral range from 0 to 35877.030506 cm<sup>-1</sup>";
1597                    $("#RangeLower").val(0);
1598                    $("#RangeUpper").val(35877.030506);
1599
1600                    document.getElementById( "BDD-GEISA2011" ).style.display = "";
1601                    document.getElementById( "BDD-GEISAIASI2011" ).style.display = "none";
1602                    document.getElementById( "BDD-GEISA2003" ).style.display = "none";
1603                    document.getElementById( "BDD-GEISAIASI2003" ).style.display = "none";
1604                }
1605
1606                if  ('GEISAIASI2011' == value)
1607                {
1608                    document.getElementById('spectralRangeTitre').innerHTML = "";
1609                    document.getElementById('spectralRangeTitre').innerHTML = "Choosing spectral range (599.000793 to 3000.998767 cm<sup>-1</sup>)";
1610                    $("#RangeLower").val(599.000793);
1611                    $("#RangeUpper").val(3000.998767);
1612
1613                    document.getElementById( "BDD-GEISA2011" ).style.display = "none";
1614                    document.getElementById( "BDD-GEISAIASI2011" ).style.display = "";
1615                    document.getElementById( "BDD-GEISA2003" ).style.display = "none";
1616                    document.getElementById( "BDD-GEISAIASI2003" ).style.display = "none";
1617                }
1618
1619                if  ('GEISA2003' == value)
1620                {
1621                    document.getElementById('spectralRangeTitre').innerHTML = "";
1622                    document.getElementById('spectralRangeTitre').innerHTML = "Choosing the spectral range from 0 to 35877.030506 cm<sup>-1</sup>";
1623                    $("#RangeLower").val(0);
1624                    $("#RangeUpper").val(35877.030506);
1625
1626                    document.getElementById( "BDD-GEISA2011" ).style.display = "none";
1627                    document.getElementById( "BDD-GEISAIASI2011" ).style.display = "none";
1628                    document.getElementById( "BDD-GEISA2003" ).style.display = "";
1629                    document.getElementById( "BDD-GEISAIASI2003" ).style.display = "none";
1630                }
1631                if  ('GEISAIASI2003' == value)
1632                {
1633                    document.getElementById('spectralRangeTitre').innerHTML = "";
1634                    document.getElementById('spectralRangeTitre').innerHTML = "Choosing spectral range (599.000793 to 3000.998767 cm<sup>-1</sup>)";
1635                    $("#RangeLower").val(599.000793);
1636                    $("#RangeUpper").val(3000.998767);
1637
1638                    document.getElementById( "BDD-GEISA2011" ).style.display = "none";
1639                    document.getElementById( "BDD-GEISAIASI2011" ).style.display = "none";
1640                    document.getElementById( "BDD-GEISA2003" ).style.display = "none";
1641                    document.getElementById( "BDD-GEISAIASI2003" ).style.display = "";
1642                }
1643
1644                //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
1645                this.requestTransition();
1646            },
1647
1648
1649
1650            //Actions déclenchées quand on clique sur le nom d'une molécule
1651            cliquetout: function()
1652            {
1653                var context = this[0];
1654                // exemple :moleculeName = ch3ch
1655                var moleculeName = this[1];
1656                var bddVersion = this[2];
1657                var inputs = document.getElementsByTagName( 'input' );
1658                var count = inputs.length;
1659                for( i = 0; i < count; i++ )
1660                {
1661                    var  input = inputs.item( i );
1662                    //cliquer toutes les molécules et isotopes du meme nom dans toutes les bases
1663                    //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')
1664                    // || 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')))
1665
1666                    if( input.type == 'checkbox' && ( input.id.indexOf('chk-' + moleculeName + '_') != -1 || input.id.indexOf('all-'+moleculeName+'-')!= -1 ))
1667
1668                    {
1669                        input.checked = document.getElementById( 'all-'+ moleculeName + '-' + bddVersion ).checked;
1670                    }
1671                }
1672                //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
1673                context.requestTransition();
1674            },
1675
1676            //actions déclenchées quand on clique sur un isotope
1677            cliqueIsotope: function()
1678            {
1679                var context = this[0];
1680                //exemple isotopeName = ch3cn_134
1681                var isotopeName = this[1];
1682                // exemple  moleculeName= ch3cn
1683                var moleculeName = this[2];
1684                var bddVersion = this[3];
1685                var inputs = document.getElementsByTagName( 'input' );
1686                var count = inputs.length;
1687                var i = 0;
1688                for( i = 0; i < count; i++ )
1689                {
1690                    input = inputs.item( i );
1691
1692                    //id=chk-ch3cn_234-GEISA2011
1693                    //cliquer ou decliquer le meme isotope dans toutes les bases
1694                    if( input.type == 'checkbox' &&  input.id.indexOf('chk-' + isotopeName) != -1)
1695                    {
1696                        input.checked = document.getElementById( 'chk-' + isotopeName + '-' + bddVersion ).checked;
1697
1698                    }
1699                     // id=all-ch3cn-GEISA2011
1700                    //pour décocher la case de la molecule quand on décoche un isotope
1701                   // if( input.type == 'checkbox' && input.id.indexOf('all-'+ moleculeName) != -1 && input.checked == true )
1702                    // {
1703                    //     input.checked = false;
1704                    // }
1705                }
1706
1707
1708                //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
1709                var nbIsotopeSelected=0;
1710
1711                for( i = 0; i < count; i++ )
1712                {
1713                    input = inputs.item( i );
1714                    if( input.type == 'checkbox' &&  input.id.indexOf('chk-'+moleculeName+'_') != -1  && input.id.indexOf(bddVersion) != -1 && input.checked == true )
1715                    {
1716                     nbIsotopeSelected=nbIsotopeSelected+1;
1717                    }
1718
1719                }
1720
1721
1722                for( i = 0; i < count; i++ )
1723                {
1724                    input = inputs.item( i );
1725                    if (input.type == 'checkbox' && input.id.indexOf('all-'+ moleculeName+'-') != -1 && nbIsotopeSelected == 0)
1726                    {
1727                        input.checked = false;
1728                    }
1729
1730                     if (input.type == 'checkbox' && input.id.indexOf('all-'+ moleculeName+'-') != -1 && nbIsotopeSelected > 0)
1731                    {
1732                        input.checked = true;
1733                    }
1734
1735                }
1736
1737                // alert("database"+context.selectDatabase.getSize());
1738
1739                //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
1740                context.requestTransition();
1741
1742            },
1743
1744
1745
1746            //pour cacher ou voir les isotopes d'une molecule
1747            visibilite: function(  )
1748            {
1749                var context = this[0];
1750                var thingId = this[1];
1751                var divs = document.getElementsByTagName( 'div' );
1752                var count = divs.length;
1753                var i = 0;
1754                for( i = 0; i < count; i++ )
1755                {
1756                    var div = divs.item( i );
1757
1758
1759                    if  (  div.id ==   thingId)
1760                    {
1761                        if( div.style.display == "none" )
1762                        {
1763                            div.style.display = "";
1764                        }
1765                        else
1766                        {
1767                            div.style.display = "none";
1768                        }
1769                    }
1770                }
1771            },
1772
1773
1774            onBlurInputMeanValue: function()
1775            {
1776                //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
1777                // !this.selectTraceAxeY1.content('Z') indique que "Z" n'exite pas dans le menu déroulant  selectTraceAxeY1
1778                if  ($("#meanValue2").val() > 0 && !this.selectTraceAxeY1.content('Z'))
1779
1780                {
1781
1782                    this.selectTraceAxeY1.add( 'Z', "Number of lines ", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
1783                    this.selectTraceAxeY2.add( 'Z', "Number of lines ", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
1784                }
1785                //si step = a 0     et autres valeurs (a faire) , retrait de la ligne Z aux parametres Y1 et y2
1786                if  ($("#meanValue2").val() == 0)
1787                {
1788                    this.selectTraceAxeY1.remove( 'Z', "Number of lines ", jQuery.proxy(this.onClickSelectTraceAxeY1, this ) );
1789                    this.selectTraceAxeY2.remove( 'Z', "Number of lines ", jQuery.proxy(this.onClickSelectTraceAxeY2, this ) );
1790                    //Selection par defaut du 1er element (pour que  "Number of lines"  ne soit plus selectionne par defaut si il n'existe plus)
1791                    this.selectTraceAxeY1.selectFirst();
1792                    this.selectTraceAxeY2.selectFirst();
1793                }
1794            },
1795
1796            onClickSelectNbCourbes: function(value)
1797            {
1798
1799                //si plusieurs courbes ou graphe choisis pour les isotopes et ou molecules, les choix pour Y2 sont inactifs
1800                if  ('ca' != value)
1801                {
1802                    //transformer le texte en gris
1803                    document.getElementById("axeY2Titre").className = "notActiveText";
1804                    document.getElementById("scaleY2Titre").className = "notActiveText";
1805                    document.getElementById("typePlotY2Titre").className = "notActiveText";
1806                    //pour rendre le menu déroulant inactif
1807                    this.selectTraceAxeY2.disable();
1808                    this.selectScaleY2.disable();
1809                    this.selectTypeTraceY2.disable();
1810                }
1811                //si une seule courbe choisie pour les isotopes et ou molecules, les choix pour Y2 sont actifs
1812                if  ('ca' == value)
1813                {
1814                    //remet le texte en couleur active
1815                    document.getElementById("axeY2Titre").className = "activeText";
1816                    //rendre actif l'echelle que si l'intensite est choisie dans les parametres
1817                    if (this.selectTraceAxeY2.getValue() == 'B')
1818                    {
1819                        document.getElementById("scaleY2Titre").className = "activeText";
1820                    }
1821                    //rendre actif le type de plot si ce n'est pas la valeur none qui est choisie
1822                    if (this.selectTraceAxeY2.getValue() != 'no')
1823                    {
1824                        document.getElementById("typePlotY2Titre").className = "activeText";
1825                    }
1826                    //pour rendre les menu déroulant actifs
1827                    this.selectTraceAxeY2.enable();
1828                    //rendre actif l'echelle que si l'intensite est choisie dans les parametres
1829                    if (this.selectTraceAxeY2.getValue() == 'B')
1830                    {
1831                        this.selectScaleY2.enable();
1832                    }
1833                    //rendre actif le type de plot si ce n'est pas la valeur none qui est choisie
1834                    if (this.selectTraceAxeY2.getValue() != 'no')
1835                    {
1836                        this.selectTypeTraceY2.enable();
1837                    }
1838                }
1839            },
1840
1841
1842            onClickSelectTraceAxeY1: function(value)
1843            {
1844                //si intensite n'est pas choisi pour Y1, le type d'échelle est inactif
1845                if  (this.selectTraceAxeY1.getValue() != 'B')
1846                {
1847                    //transformer le texte en gris
1848                    document.getElementById("scaleY1Titre").className = "notActiveText";
1849                    //pour rendre le menu déroulant inactif
1850                    this.selectScaleY1.disable();
1851                }
1852                //si intensite est  choisi pour Y1, le type d'échelle est actif
1853                if  (this.selectTraceAxeY1.getValue() == 'B')
1854                {
1855                    //transformer le texte en gris
1856                    document.getElementById("scaleY1Titre").className = "activeText";
1857                    //pour rendre le menu déroulant inactif
1858                    this.selectScaleY1.enable();
1859                }
1860            },
1861
1862            onClickSelectTraceAxeY2: function(value)
1863            {
1864                //si intensite n'est pas choisi pour Y2, le type d'échelle est inactif
1865                if  (this.selectTraceAxeY2.getValue() != 'B')
1866                {
1867                    //transformer le texte en gris
1868                    document.getElementById("scaleY2Titre").className = "notActiveText";
1869                    //pour rendre le menu déroulant inactif
1870                    this.selectScaleY2.disable();
1871                }
1872                //si intensite est  choisi pour Y2, le type d'échelle est actif
1873                if  (this.selectTraceAxeY2.getValue() == 'B')
1874                {
1875                    //transformer le texte en gris
1876                    document.getElementById("scaleY2Titre").className = "activeText";
1877                    //pour rendre le menu déroulant inactif
1878                    this.selectScaleY2.enable();
1879                }
1880                //si aucun parametre est  choisi pour Y2, le type de plot est inactif
1881                if  (this.selectTraceAxeY2.getValue() == 'no')
1882                {
1883                    //transformer le texte en gris
1884                    document.getElementById("typePlotY2Titre").className = "notActiveText";
1885                    //pour rendre le menu déroulant inactif
1886                    this.selectTypeTraceY2.disable();
1887                }
1888                //si un parametre est  choisi pour Y2, le type de plot est actif
1889                if  (this.selectTraceAxeY2.getValue() != 'no')
1890                {
1891                    //transformer le texte en gris
1892                    document.getElementById("typePlotY2Titre").className = "activeText";
1893                    //pour rendre le menu déroulant inactif
1894                    this.selectTypeTraceY2.enable();
1895                }
1896
1897            },
1898
1899            onClickSubmit: function()
1900            {
1901                this.requestGeisa();
1902            },
1903
1904            displayWindow: function(content)
1905            {
1906                //fermeture de la div de l'image d'attente
1907                this.loadingGraphics.hide();
1908
1909                // var content = '<img src=' + this.pathImg + ' /><a href="project?methodName=downloadFile&fileName='  + this.nameImg + '"><button class="dataProtocolDownloadButton">Download</button></a>';
1910
1911                //alert(content);
1912                var $dialog = $( '<div></div>' )
1913
1914                        .html( content )
1915
1916                        .dialog( {
1917                            autoOpen: false,
1918                            title: "GEISA : spectroscopic database",
1919                            //minHeight: 500,
1920                            // minWidth: 660,
1921                            height: 560,
1922                            width:700,
1923                            //Exemple de  valeurs possible pour position : "middle", "top",  [200, 100]
1924                            position: "middle"
1925
1926                        } );
1927                $dialog.dialog( 'open' )
1928            },
1929
1930            // displayWindow: function(coordinate)
1931            //{
1932            //var content = '<img src=' + this.pathImg + ' /><a href="project?methodName=downloadFile&fileName=bib.txt"><button class="dataProtocolDownloadButton">Download</button></a>';
1933            // var content = '<img src=' + this.pathImg + ' /><a href="project?methodName=downloadFile&fileName='  + this.nameImg + '"><button class="dataProtocolDownloadButton">Download</button></a>';
1934
1935            //alert(content);
1936            // var $dialog = $( '<div></div>' )
1937            // .html( content + content1 )
1938
1939            // .dialog( {
1940            //    autoOpen: false,
1941            //    title: "GEISA : spectroscopic database",
1942            //    minHeight: 500,
1943            //    minWidth: 660,
1944
1945            //coordonnee y y
1946            //   position:coordinate
1947
1948            // } );
1949            // $dialog.dialog( 'open' )
1950            //},
1951
1952
1953            onClickDownload: function()
1954            {
1955                document.location.href = "project?methodName=downloadFile&fileName=bib.txt";
1956            }
1957
1958
1959        } );
1960
1961
1962</script>
1963
1964
1965
Note: See TracBrowser for help on using the repository browser.