source: geisa/web/initGeisa_script.jsp @ 543

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

Menu déroulant sans utiliser le modele select.js

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