source: ether_visual/trunk/forge@cpipsl @ 17

Last change on this file since 17 was 17, checked in by cbipsl, 18 years ago

ajout V3

  • Property svn:executable set to *
File size: 97.3 KB
Line 
1<%@ page import="fr.acri.norm.*" %>
2<%@ page import="java.io.*" %>
3<%@ page import="java.util.*" %>
4<%@ page import="java.lang.*" %>
5<%@ include file="declarations.jsp" %>
6<%@ include file="affectations.jsp" %>
7<%@ include file="conf_visu.jsp" %>
8<%
9
10/********************************  LISTE DES EXPERIENCES  ***********************************************************/
11
12sql="SELECT distinct exp_name";
13sql+=" FROM ether.dcp_file_class, ether.ether_experiment, ether.dcp_descripteur, ether.dcp_parameter ";
14sql+="WHERE ether_experiment.exp_id=dcp_file_class.exp_id and dcp_descripteur.tpl_id=dcp_file_class.tpl_id ";
15sql+="and dcp_parameter.par_acronym = ether.dcp_descripteur.par_acronym and (isord=0 or isord=2) and associate=-1 and active=1";
16
17if (sel_temp_name!=null && !sel_temp_name.equals("")) sql+="and exp_name like '%"+sel_temp_name+"%' ";
18sql+=" and dcp_file_class.tpl_id NOT IN (1332,1333) ";
19
20sql+="and exp_name not like '%SMR_OF%' and exp_name not like '%LIDAR.AND%' and exp_name not like '%LIDAR.REU%'";
21
22sql+="ORDER BY exp_name";
23exp_list=req.get_list(sql,exp_columns0);
24
25if (exp_list==null || exp_list.size()==0) {
26        error_msg="No file class found in the database";
27}
28else {
29        nexp=exp_list.size()/exp_columns0.length;
30        exp_options0="";
31        if (nexp>0) {
32                k=0;
33                for(i=0;i<nexp;i++){
34                        selected="";
35                        if( isExp && exp_list.get(k).toString().equals(sel_tpl_name) ){
36                                selected="selected";
37                                sel_tpl_name=exp_list.get(k).toString();
38                        }
39                        exp_options0+="<OPTION class=grass VALUE=\""+exp_list.get(k)+"\" "+selected+">"+exp_list.get(k);
40                        exp_options0+="</OPTION>";
41                        k+=exp_columns0.length;
42                }
43
44        }
45        nexp=0;
46        exp_list=null; 
47}
48
49if (graph_sel.equals(VERTICAL_ANALYSIS) || graph_sel.equals(TIME_ANALYSIS) || graph_sel.equals(XY_PLOT) || graph_sel.equals(_2D_TRAJECTORY)) {
50        observation_height="40";
51}
52
53
54
55if (!graph_sel.equals("") && graph_sel!="") {
56//LISTE DES DIFFERENTES VERSION ET NIVEAUX DE L'EXPERIENCE CHOISIE
57
58/*sql="SELECT distinct ether_experiment.exp_id,exp_name,exp_mission,set_dataset_version,set_ceos_level,set_ceos_sublevel,set_format";
59        sql+=",dcp_file_class.tpl_id,exp_public,exp_alt_min,exp_alt_max FROM ether.dcp_file_class, ether.ether_experiment ";
60        sql+="WHERE ether_experiment.exp_id=dcp_file_class.exp_id ";
61        sql+="and dcp_file_class.tpl_id in (select dcp_file_class.tpl_id from ether.ether_experiment, ether.dcp_file_class ";
62        sql+="where ether_experiment.exp_id=dcp_file_class.exp_id and exp_name='"+sel_tpl_name+"' and set_format='ETHER') ";
63        sql+="ORDER BY exp_name, set_dataset_version";
64out.write(sql);*/
65
66if (!graph_sel.equals(_2D_TRAJECTORY)) {
67        sql="SELECT distinct ether_experiment.exp_id,exp_name,exp_mission,set_dataset_version,set_ceos_level,set_ceos_sublevel,set_format";
68        sql+=",dcp_file_class.tpl_id,exp_public,exp_alt_min,exp_alt_max FROM ether.dcp_file_class, ether.ether_experiment, ether.dcp_descripteur, ether.dcp_parameter ";
69        sql+="WHERE ether_experiment.exp_id=dcp_file_class.exp_id and dcp_descripteur.tpl_id=dcp_file_class.tpl_id ";
70        sql+="and dcp_parameter.par_acronym = ether.dcp_descripteur.par_acronym and (isord=0 or isord=2) and associate=-1 ";
71        sql+="and dcp_file_class.tpl_id NOT IN (1332,1333,1331) ";
72        sql+="and dcp_file_class.tpl_id in (select dcp_file_class.tpl_id from ether.ether_experiment, ether.dcp_file_class ";
73        sql+="where ether_experiment.exp_id=dcp_file_class.exp_id and exp_name='"+sel_tpl_name+"') ";
74}
75else {
76        sql="SELECT distinct ether_experiment.exp_id,exp_name,exp_mission,set_dataset_version,set_ceos_level,set_ceos_sublevel,set_format";
77        sql+=",dcp_file_class.tpl_id,exp_public,exp_alt_min,exp_alt_max FROM ether.dcp_file_class, ether.ether_experiment ";
78        sql+="WHERE ether_experiment.exp_id=dcp_file_class.exp_id and set_format='ETHER' ";
79        sql+="and dcp_file_class.tpl_id in (select dcp_file_class.tpl_id from ether.ether_experiment, ether.dcp_file_class ";
80        sql+="where ether_experiment.exp_id=dcp_file_class.exp_id and exp_name='"+sel_tpl_name+"' ) ";
81}
82
83
84sql+="ORDER BY exp_name, set_dataset_version";
85
86nreq=-1;
87exp_list=req.get_list(sql,exp_columns);
88
89if (exp_list==null || exp_list.size()==0) {
90        error_msg="No file class found in the database";
91}
92else{
93        nreq=exp_list.size()/exp_columns.length;
94        exp_options="";
95        if (nreq>0) {
96                k=0;
97                sel_tpl="";
98                for (i=0 ; i < nreq ; i++) {
99
100                        if(exp_list.get(k+7).toString().equals(sel_tpl_id) ){
101                                selected="selected";
102                                sel_tpl=exp_list.get(k+7).toString();
103                                sel_exp_id=exp_list.get(k).toString();
104                                sel_version=exp_list.get(k+3).toString();
105                                sel_level=exp_list.get(k+4).toString();
106                                sel_sublevel=exp_list.get(k+5).toString();
107                                sel_format=exp_list.get(k+6).toString();
108                                sel_exp_public=exp_list.get(k+8).toString();
109                                exp_alt_min=exp_list.get(k+9).toString();
110                                exp_alt_max=exp_list.get(k+10).toString();
111                               
112                                heightTexte="";
113                                //"<b>(Between "+exp_alt_min+" km and "+exp_alt_max+" km in altitude)</b>";
114                                lib_mission=exp_list.get(k+2).toString();
115                                lib_version=exp_list.get(k+3).toString();
116                                lib_level=exp_list.get(k+4).toString();
117                               
118                                lib_sublevel=exp_list.get(k+5).toString();
119                                if (lib_sublevel.equals(".")) lib_sublevel="None";
120
121
122                                lib_fileformat=exp_list.get(k+6).toString();
123                                lib_tpl_id=exp_list.get(k+2).toString()+" - "+exp_list.get(k+3).toString()+" - "+exp_list.get(k+4).toString()+" - "+lib_sublevel+" - "+exp_list.get(k+6).toString();
124                        }
125                        else selected="";
126
127                        exp_options+="<OPTION class=selection VALUE=\""+exp_list.get(k+7)+"\" "+selected+">"+exp_list.get(k+2);
128                        exp_options+=" - "+exp_list.get(k+3)+" - "+exp_list.get(k+4)+" - ";
129                        if (!exp_list.get(k+5).toString().equals(".")) exp_options+=exp_list.get(k+5).toString()+" - ";
130                        exp_options+=exp_list.get(k+6)+"</OPTION>";
131                        k+=exp_columns.length;
132                }
133
134        }
135        exp_list=null;
136}
137}
138
139exp_list=null; 
140
141if (!sel_tpl_id.equals("") && !sel_tpl_id.equals("null")) {
142sel_par_abs="Coordinates";
143listAbscisses absExp = new listAbscisses(sel_tpl_id, sel_exp_id, sel_par_abs,"");
144absExp.recupList();
145
146
147error_msg=absExp.error_msg;
148isParAbs=absExp.isParAbs;
149
150file_par_abs=absExp.file_par_abs;
151file_unit_abs=absExp.file_unit_abs;
152out.write("file_unit_abs="+file_unit_abs);
153file_nature_abs=absExp.file_nature_abs;
154file_type_abs=absExp.file_type_abs;
155form_par_abs=absExp.form_par_abs;
156form_legend=absExp.form_legend;
157form_par_id=absExp.form_par_id;
158lib_param=absExp.lib_param;
159par_options_abs=absExp.par_options_abs;
160
161idl_colour_table_id=absExp.idl_colour_table_id;
162imported_colour_table=absExp.imported_colour_table;
163val_min_bd=absExp.val_min_bd;
164val_max_bd=absExp.val_max_bd;
165unite_bd=absExp.unite_bd;
166
167if (graph_sel.equals(_2D_TRAJECTORY)) file_par_abs="Coordinates";
168/* LISTE DES SOUS-PARAMETRES ABSCISSE */
169
170if(isParAbs || graph_sel.equals(_2D_TRAJECTORY)) {// && !sel_par_abs.equals("") && !sel_par_abs.equals("null")) {
171        nreq=-1;
172
173        sel_par="";
174        if (graph_sel.equals(_2D_TRAJECTORY)) sel_par="Coordinates";
175        else if (sel_par_abs!=null) sel_par=(new stringSplit()).split(sel_par_abs,"%")[0];
176
177        // BORNES DE DATES
178        sql="SELECT DISTINCT set_first_date,set_last_date,set_lon_min,set_lon_max,set_lat_min,set_lat_max ";
179        sql+="FROM ether.ether_dataset,ether.dcp_file_class,set_parameter=par_acronym and set_id_experiment=exp_id and ";
180        sql+="(exp_id="+sel_exp_id+" or exp_id= ( select exp_id from ether.dcp_file_class where associate= "+sel_tpl_id+")) and set_parameter='";
181        sql+=sel_par+"' and ether_dataset.set_dataset_version='"+sel_version+"' "+ " and ether_dataset.set_ceos_level='"+sel_level+"' ";
182        sql+=" and ether_dataset.set_ceos_sublevel='"+sel_sublevel+"' "+" and ether_dataset.set_format='"+sel_format+"' ";
183        sspar_list=req.get_list(sql,sspar_columns1);
184        if (sspar_list!=null && sspar_list.size()>0) {
185                mindate_ms=Long.parseLong(sspar_list.get(0).toString());
186                maxdate_ms=Long.parseLong(sspar_list.get(1).toString());
187                DSMinDate=(new calDate(mindate_ms)).date_cal;
188                DSMaxDate=(new calDate(maxdate_ms)).date_cal;
189                date_time=DSMinDate.substring(0,10);
190                lonmin=sspar_list.get(2).toString();
191                lonmax=sspar_list.get(3).toString();
192                latmin=sspar_list.get(4).toString();
193                latmax=sspar_list.get(5).toString();
194        }
195
196        //LISTE DES SOUS-PARAMETRES PROPREMENT DIT
197        sql="select distinct subvariable from ether.dcp_descripteur, ether.dcp_file_class where par_acronym='"+sel_par+"'";
198        sql+=" and dcp_descripteur.tpl_id="+sel_tpl_id+" and dcp_descripteur.tpl_id=dcp_file_class.tpl_id and (exp_id="+sel_exp_id;
199        sql+=" or exp_id=( select exp_id from ether.dcp_file_class where associate= "+sel_tpl_id+"))";
200
201        out.write(sql);
202
203        sql="select distinct ether.dcp_descripteur.subvariable from ether.dcp_descripteur,ether.dcp_parameter param, ether.dcp_unit unit, ether.ether_dataset ds ";
204        sql+="WHERE param.par_acronym=dcp_descripteur.par_acronym and unit.unit_id=dcp_descripteur.unit_id " ;
205        sql+="and ds.set_parameter=dcp_descripteur.par_acronym and param.par_acronym='"+sel_par+"' ";
206        sql+="and (ds.set_id_experiment='"+sel_exp_id+"' or ds.set_id_experiment= (select exp_id from ether.dcp_file_class where associate='"+sel_tpl_id+"')) ";
207        sql+=" and (isord=0 or isord=2) and (tpl_id='"+sel_tpl_id+"' or tpl_id=(select tpl_id from ether.dcp_file_class ";
208        sql+="where associate='"+sel_tpl_id+"')) and par_name not like '%Temp%'";
209
210        sspar_list=req.get_list(sql,sspar_columns);
211        if (sspar_list==null || sspar_list.size()==0) isSspar=false;
212        else {
213                isSspar=true;
214                nreq=sspar_list.size()/sspar_columns.length;
215                sspar_options="";
216                if (nreq>0) {
217                     k=0;
218                     if (sel_sspar_abs=="" || sel_sspar_abs==null || sel_sspar_abs.equals("") || sel_sspar_abs.equals("null")) sel_sspar_abs=sspar_list.get(0).toString();
219                                for (i=0;i<nreq;i++) {
220                                        selected="";
221                                        if (isSspar && sspar_list.get(k).toString().equals(sel_sspar_abs)) selected="selected";
222                                        sspar_options+="<OPTION class=selection VALUE=\""+sspar_list.get(k).toString()+"\" "+selected+">";
223
224                                        if (sspar_list.get(k).toString().equals(".")) sspar_options+="None";
225                                        else sspar_options+=sspar_list.get(k);
226                                        sspar_options+="</OPTION>";
227                                        form_sspar_abs=sspar_list.get(k).toString();
228
229                                        k+=sspar_columns.length;
230                                }
231                }
232        }
233}
234
235
236/*LISTE DES PARAMETRES EN ORDONNEES*/
237
238if( isFile && isParAbs && sel_par_abs!=null && !sel_par_abs.equals("null") && !sel_par_abs.equals(""))  {
239if (graph_sel.equals(XY_PLOT)) {
240        listAbscisses ordExp = new listAbscisses(sel_tpl_id, sel_exp_id, sel_par_ord,sel_par_abs);
241        ordExp.recupList();
242
243        error_msg=ordExp.error_msg;
244        isParOrd=ordExp.isParAbs;
245
246        file_par_ord=ordExp.file_par_abs;
247        file_unit_ord=ordExp.file_unit_abs;
248        file_nature_ord=ordExp.file_nature_abs;
249        form_par_ord=ordExp.form_par_abs;
250
251        par_options_ord=ordExp.par_options_abs;
252
253        if (isParOrd && sel_par_ord!=null && sel_par_ord!="" && !sel_par_ord.equals("null") ) {
254        nreq=-1;
255
256        sel_par="";
257        if (sel_par_ord!=null) sel_par=(new stringSplit()).split(sel_par_ord,"%")[0];
258
259        // LISTE DES SOUS-PARAMETRES PROPREMENT DIT
260        sql="select distinct subvariable from ether.dcp_descripteur, ether.dcp_file_class where par_acronym='"+sel_par+"'";
261        sql+=" and dcp_descripteur.tpl_id="+sel_tpl_id+" and dcp_descripteur.tpl_id=dcp_file_class.tpl_id and (exp_id="+sel_exp_id;
262        sql+=" or exp_id=( select exp_id from ether.dcp_file_class where associate= "+sel_tpl_id+"))";
263
264
265        sspar_list=req.get_list(sql,sspar_columns);
266        if (sspar_list==null || sspar_list.size()==0) isSspar=false;
267        else {
268                isSspar=true;
269                nreq=sspar_list.size()/sspar_columns.length;
270                ssparord_options="";
271                if (nreq>0) {
272                        k=0;
273       if (sel_sspar_ord=="" || sel_sspar_ord==null || sel_sspar_ord.equals("") || sel_sspar_ord.equals("null")) sel_sspar_ord=sspar_list.get(0).toString();
274                                for (i=0;i<nreq;i++) {
275                                        selected="";
276                                        if (isSspar && sspar_list.get(k).toString().equals(sel_sspar_ord)) selected="selected";
277                                        ssparord_options+="<OPTION class=selection VALUE=\""+sspar_list.get(k).toString()+"\" "+selected+">";
278
279                                        if (sspar_list.get(k).toString().equals(".")) ssparord_options+="None";
280                                        else ssparord_options+=sspar_list.get(k);
281                                        ssparord_options+="</OPTION>";
282
283                                        k+=sspar_columns.length;
284                                }
285                }
286        }
287       
288               
289
290        }       
291       
292}
293else if (!graph_sel.equals(_2D_TRAJECTORY)) {
294        from=" from ";
295        TRF=new Transform(sel_tpl_id, sel_exp_id,lang, file_type_abs);
296        isParOrd=TRF.isPar;
297        par_options_ord="";
298
299        if( !isParOrd ) error_msg="";
300        else{
301        _parameters=new ArrayList();
302       
303        for(i=0;i<TRF.parameter.length;i++) {
304
305        if (!TRF.parameter[i].equals("Longitude") && !TRF.parameter[i].equals("Latitude") && !TRF.parameter[i].equals("Time")) {
306                selected="";
307                //TRF.ssparameter[i]=".";
308                svalue=TRF.par_acr[i]+"%"+TRF.nature[i]+"%"+TRF.ssparameter[i];
309                if ((selected.equals("") || selected.equals("null")) && (sel_par_ord.equals("") || sel_par_ord.equals("null"))) {
310                        if (file_type_abs.equals("densite") || graph_sel.equals(TIME_ANALYSIS)) sel_par_ord=svalue;
311                        //sel_par_ord=svalue;
312                       
313                }
314       
315       
316                if( sel_par_ord!=null && sel_par_ord!="" && !sel_par_ord.equals("null") && TRF.par_acr[i]!=null && svalue.equals(sel_par_ord) ){
317                        selected="selected";
318                        file_par_ord=TRF.par_acr[i];
319                        file_sspar_ord=TRF.ssparameter[i];
320                        file_unit_ord=TRF.unit[i];
321                      if (sel_unit_ord==null || sel_unit_ord.equals("") || sel_unit_ord.equals("null") ){
322                                sel_unit_ord=file_unit_ord;
323                                sel_unit_ord="12";
324                                isUnitOrd=true;
325                        }
326
327                        file_nature_ord=TRF.nature[i];
328                        display_type="available";
329                        form_par_ord=TRF.parameter[i];
330                }
331                par_options_ord+="<OPTION class=selection VALUE=\""+svalue+"\" "+selected+">"+TRF.parameter[i];
332
333                if (TRF.nature[i].equals("Mes")) par_options_ord+=" (Measured)";
334                else par_options_ord+=" ("+TRF.nature[i]+")";
335
336                if (!TRF.ssparameter[i].equals(".")) par_options_ord+=" (subparameter : "+TRF.ssparameter[i]+")</OPTION>";
337                //else par_options_ord+=" - "+TRF.ssparameter[i]+"</OPTION>";
338                //if (selected.equals("selected")) par_observation_height=TRF.parameter[i]+" - "+TRF.nature[i]+" - "+TRF.ssparameter[i];
339        if (selected.equals("selected")) {
340                        par_observation_height=TRF.parameter[i]+" - ";
341                        if (TRF.nature[i].equals("Mes")) par_observation_height+=" (Measured)";
342                        else par_observation_height+=" ("+TRF.nature[i]+")";
343                        if (!TRF.ssparameter[i].equals(".")) par_options_ord+="- (subparameter : "+TRF.ssparameter[i]+")";
344                }
345
346                _parameters.add(TRF.par_acr[i]);
347
348                }
349       
350        }
351       
352
353         // PARAMETRES OBTENUS PAR TRANSFORMATIONS SIMPLES
354         if( file_type_abs.equals("profil") && TRF.cal_parameter!=null ) {
355                for(i=0;i<TRF.cal_parameter.length;i++) {
356                        if (!TRF.cal_parameter[i].equals("Longitude") && !TRF.cal_parameter[i].equals("Latitude") && !TRF.cal_parameter[i].equals("Time")) {
357                       
358                        selected="";
359                        svalue=TRF.cal_par_acr[i]+"%"+TRF.cal_nature[i]+"%"+TRF.cal_par_acr_orig[i]+"%";
360                        svalue+=TRF.cal_ssparameter[i];
361                        if( sel_par_ord!=null && sel_par_ord!="" && !sel_par_ord.equals("null") && TRF.cal_par_acr[i]!=null && svalue.equals(sel_par_ord) )
362{
363                                selected="selected";
364                                file_par_ord=TRF.cal_par_acr[i];
365                                file_sspar_ord=TRF.cal_ssparameter[i];
366                                file_unit_ord=TRF.cal_unit[i];
367
368                                if( sel_unit_ord==null || sel_unit_ord.equals("") || sel_unit_ord.equals("null") ){
369                                        sel_unit_ord=file_unit_ord;
370                                        sel_unit_ord="12";
371                                        isUnitOrd=true;
372                                }
373
374                                file_nature_ord=TRF.cal_nature[i];
375                                display_type="transformed";
376
377                                file_par_aux=TRF.cal_par_acr_aux[i];
378                                file_unit_aux=TRF.cal_unit_aux[i];
379                                file_nature_aux=TRF.cal_nature_aux[i];
380                                file_par_aux1=TRF.cal_par_acr_aux1[i];
381                                file_unit_aux1=TRF.cal_unit_aux1[i];
382                                file_nature_aux1=TRF.cal_nature_aux1[i];
383
384                                file_trf_id=TRF.cal_trf_id[i];
385                                file_par_orig=TRF.cal_par_acr_orig[i];
386                                file_unit_orig=TRF.cal_unit_orig[i];
387                                file_nature_orig=TRF.cal_nature_orig[i];
388                        }
389
390                        if( !TRF.isRedundant[i] && !TRF.cal_trf_id[i].equals("999")) {// && !svalue.equals("Geopotential%Cal%Press%."))
391
392                                par_options_ord+="<OPTION class=selection VALUE=\""+svalue+"\" "+selected+">";
393                                par_options_ord+=TRF.cal_parameter[i]+from+TRF.cal_parameter_orig[i]+" (Calculated)</OPTION>";
394                                if (selected.equals("selected")) par_observation_height=TRF.cal_parameter[i]+from+TRF.cal_parameter_orig[i]+" (Calculated)";
395                        }
396
397                        _parameters.add(TRF.cal_par_acr[i]);
398                        }
399                }
400        }
401
402        // PARAMETRES OBTENUS PAR TRANSFORMATIONS COMBINEES
403/*        if( file_type_abs.equals("profil") && TRF.cbn_parameter!=null ){
404                for(i=0;i<TRF.cbn_parameter.length;i++){
405                        selected="";
406
407                        svalue=TRF.cbn_par_acr[i][TRF.cbn_parameter[i].length-1];
408                        svalue+="%"+TRF.cbn_nature[i][TRF.cbn_parameter[i].length-1]+"%";
409                        svalue+=TRF.cbn_par_acr_orig[i][0]+"%"+TRF.cbn_nature[i][TRF.cbn_ssparameter[i].length-1];
410
411                        if( sel_par_ord!=null && sel_par_ord!="" && !sel_par_ord.equals("null") && svalue.equals(sel_par_ord) ) {
412                                selected="selected";
413                                file_par_ord=TRF.cbn_par_acr[i][TRF.cbn_parameter[i].length-1];
414file_sspar_ord=TRF.cbn_ssparameter[i][TRF.cbn_parameter[i].length-1];
415                                file_unit_ord=TRF.cbn_unit[i][TRF.cbn_parameter[i].length-1];
416
417                                if( sel_unit_ord==null || sel_unit_ord.equals("") || sel_unit_ord.equals("null") ){
418                                        sel_unit_ord=file_unit_ord;
419                                        isUnitOrd=true;
420                                }
421                                file_nature_ord=TRF.cbn_nature[i][TRF.cbn_parameter[i].length-1];
422                                display_type="combined";
423                                file_trf_id=TRF.cbn_trf_id[i];
424                                file_par_orig=TRF.cbn_par_acr_orig[i][0];
425                                file_unit_orig=TRF.cbn_unit_orig[i][0];
426                                file_nature_orig=TRF.cbn_nature_orig[i][0];
427                         }
428
429                         // ON ECARTE LES TRANSFORMATIONS DONT LE PARAMETRE ORIGINE N'APPARTIENT PAS AU FICHIER
430                         // ON ECARTE EGALEMENT LES TRANSFORMATIONS REDONDANTES
431                         if( TRF.cbn_nature_orig[i][0]!=null && !TRF.cbn_nature_orig[i][0].equals("Cal") && !TRF.isRedundantCbn[i]) {
432                                par_options_ord+="<OPTION class=selection VALUE=\""+svalue+"\" "+selected+">";
433                                par_options_ord+=TRF.cbn_parameter[i][TRF.cbn_parameter[i].length-1]+from;
434                                par_options_ord+=TRF.cbn_parameter_orig[i][0];
435                                par_options_ord+=" (Calculated)</OPTION>";
436                                if (selected.equals("selected"))
437                                        par_observation_height=TRF.cbn_parameter[i][TRF.cbn_parameter[i].length-1]+from+TRF.cbn_parameter_orig[i][0]+" (Cal
438culated)";
439                        _parameters.add(TRF.cbn_par_acr[i][TRF.cbn_parameter[i].length-1]);
440                         }
441
442
443                }
444        }*/
445
446
447
448}
449}
450}
451
452
453
454
455//UNITES
456nunit_abs=-1;
457nunit_ord=-1;
458if (isFile) {
459        sql="select unit2.unit_acronym from ether.dcp_unit,ether.dcp_parameter,ether.dcp_unit unit2,ether.dcp_conversion ";
460        sql+="where par_acronym = '"+file_par_abs+"' and dcp_unit.unit_acronym = '"+file_unit_abs+"'";
461        sql+="and dcp_parameter.cls_acronym = dcp_unit.cls_acronym ";
462        sql+="and dcp_unit.unit_id = dcp_conversion.unit_orig and dcp_conversion.unit_final = unit2.unit_id";
463
464
465        unit_list_abs=req.get_list(sql,unit_columns);
466        isUnitAbs=true;
467        Object obs1=new Object();
468        obs1=file_unit_abs;
469        unit_list_abs.add(0,obs1);
470        nunit_abs=unit_list_abs.size()/unit_columns.length;
471        unit_options_abs="";
472
473        if( nunit_abs>0 ){
474                k=0;
475                if (!(sel_unit_abs!=null && !sel_unit_abs.equals("")) && sel_par_abs!=null
476                                && !sel_par_abs.equals("")) sel_unit_abs=unit_list_abs.get(0).toString();
477
478                for(i=0;i<nunit_abs;i++){
479                        selected="";
480                        if( isUnitAbs && unit_list_abs.get(k).toString().equals(sel_unit_abs)) selected="selected";
481
482                        unit_options_abs+="<OPTION class=selection VALUE=\"";
483                        unit_options_abs+=unit_list_abs.get(k)+"\" "+selected+">"+unit_list_abs.get(k)+"</OPTION>";
484                        k+=unit_columns.length;
485                }
486         }
487         if( isParOrd && file_par_ord!=null && !file_par_ord.equals("null") &&
488                                file_unit_ord!=null && !file_unit_ord.equals("null") && !file_unit_ord.equals("") ) {
489
490                sql="select unit2.unit_acronym from ether.dcp_unit, ether.dcp_parameter, ether.dcp_unit unit2,";
491                sql+="ether.dcp_conversion where par_acronym = '"+file_par_ord+"' and dcp_unit.unit_acronym = '"+file_unit_ord+"' ";
492                sql+="and dcp_parameter.cls_acronym = dcp_unit.cls_acronym and dcp_unit.unit_id = dcp_conversion.unit_orig ";
493                sql+="and dcp_conversion.unit_final = unit2.unit_id";
494                unit_list_ord=req.get_list(sql,unit_columns);
495
496                // RAJOUT DE L'UNITE DU FICHIER
497                Object obs=new Object();
498                obs=file_unit_ord;
499                unit_list_ord.add(0,obs);
500                isUnitOrd=true;
501                nunit_ord=unit_list_ord.size()/unit_columns.length;
502                unit_options_ord="";
503                if( nunit_ord>0 ){
504                        k=0;
505                        // ON FORCE LA SELECTION DE L'UNITE EN ORDONNEE A CELLE DU FICHIER PAR DEFAUT
506                        issel=false;
507                        for(i=0;i<nunit_ord;i++){
508                                if( isUnitOrd && unit_list_ord.get(k).toString().equals(sel_unit_ord) ){
509                                        issel=true;
510                                        break;
511                                }
512                                k+=unit_columns.length;
513                        }
514
515                        if( !issel ) sel_unit_ord=file_unit_ord;
516
517                        k=0;
518                        for(i=0;i<nunit_ord;i++){
519                                selected="";
520                                if( isUnitOrd && unit_list_ord.get(k).toString().equals(sel_unit_ord) )selected="selected";
521                                unit_options_ord+="<OPTION class=selection VALUE=\""+unit_list_ord.get(k)+"\" "+selected+">";
522                                unit_options_ord+=unit_list_ord.get(k)+"</OPTION>";
523                                k+=unit_columns.length;
524                        }
525                }
526        }
527
528}
529
530if (!afficheTrace.equals("null") && afficheTrace.equals("1")) {
531count=1;
532//UNITE DIFFERENTE
533//POUR L'ABSCISSE
534if( sel_unit_abs!=null && !sel_unit_abs.equals("") && !file_unit_abs.equals(sel_unit_abs) ){
535       
536        ids=get_conv("acr", file_unit_abs, sel_unit_abs,req);
537        cnv_id=(new stringSplit()).split(ids,"%")[0];
538        trf_id=(new stringSplit()).split(ids,"%")[1];
539        // EST-CE UNE CONVERSION OU/ET UNE TRANSFORMATION (EN ABSCISSE SEULE UNE TRANFO NON COMBINEE PEUT AVOIR LIEU
540
541        if( !trf_id.equals("999") ){
542                // LA CONVERSION POINTE VERS UNE TRANSFORMATION: ATTENTION DANS CE CAS LA VARIABLE N'EST PAS TRANSFORMEE
543                // CELA RESTE UN CHANGEMENT D'UNITE
544                // DONC LA VARIABLE A LIRE RESTE LA MEME (CONTRAIREMENT A L'ORDONNEE OU CELLE A LIRE EST
545                // LA VARIABLE ORIGINE DE LA TRANSFORMATION ET NON PAS LA VARIABLE CHOISIE PAR L'UTILISATEUR
546                // QUI N'EXISTE PAS DANS LE FICHIER DE MESURE PUISQUE CALCULEE)
547                result=treat_trf(trf_id, sel_tpl_id, count,"",sel_unit_abs,false,true,req);
548                spl=(new stringSplit()).split(result,"%");
549                Xtransfo=spl[1];
550                AUX0transfo=spl[2];
551                AUX1transfo=spl[3];
552                count=Integer.parseInt(spl[4]);
553                more_varid+=spl[5];
554         }
555         else if( !cnv_id.equals("-1") ){
556                // C'EST UNE CONVERSION SIMPLE
557                Xtransfo="conv"+cnv_id+",999,999";
558         }
559        else{
560                sel_unit_abs=file_unit_abs;
561                Xtransfo="t999,999,999";
562        }
563 }
564 else{
565        Xtransfo="t999,999,999";
566 }
567       
568
569//POUR ORDONNEE
570
571if(sel_unit_ord!=null && !sel_unit_ord.equals("")) {
572       
573
574        if (graph_sel.equals(XY_PLOT)) {
575                if(!file_unit_ord.equals(sel_unit_ord) ){
576                ids=get_conv("acr", file_unit_ord, sel_unit_ord,req);
577                cnv_id=(new stringSplit()).split(ids,"%")[0];
578                trf_id=(new stringSplit()).split(ids,"%")[1];
579                // EST-CE UNE CONVERSION OU/ET UNE TRANSFORMATION (EN ABSCISSE SEULE UNE TRANFO NON COMBINEE PEUT AVOIR LIEU
580   
581                if( !trf_id.equals("999") ){
582                        // LA CONVERSION POINTE VERS UNE TRANSFORMATION: ATTENTION DANS CE CAS LA VARIABLE N'EST PAS TRANSFORMEE
583                        // CELA RESTE UN CHANGEMENT D'UNITE
584                        // DONC LA VARIABLE A LIRE RESTE LA MEME (CONTRAIREMENT A L'ORDONNEE OU CELLE A LIRE EST
585                        // LA VARIABLE ORIGINE DE LA TRANSFORMATION ET NON PAS LA VARIABLE CHOISIE PAR L'UTILISATEUR
586                        // QUI N'EXISTE PAS DANS LE FICHIER DE MESURE PUISQUE CALCULEE)
587                        result=treat_trf(trf_id, sel_tpl_id, count,"",sel_unit_ord,false,true,req);
588                        spl=(new stringSplit()).split(result,"%");
589                        Ytransfo=spl[1];
590                        AUY0transfo=spl[2];
591                        AUY1transfo=spl[3];
592                        count=Integer.parseInt(spl[4]);
593                        more_varid+=spl[5];
594                 }
595                 else if( !cnv_id.equals("-1") ){
596                        // C'EST UNE CONVERSION SIMPLE
597                        Ytransfo="conv"+cnv_id+",999,999";
598                }
599                else{
600                     sel_unit_ord=file_unit_ord;
601                     Ytransfo="t999,999,999";
602                }
603                }
604                else{
605                      Ytransfo="t999,999,999";
606                }
607
608                varY=file_par_ord+","+file_nature_ord+","+sel_sspar_ord+","+sel_unit_ord;
609
610        }
611        else {
612 
613        ordonnee=file_par_ord;
614        sspar_ordonnee=file_sspar_ord;
615        numY_aux0=999;
616        numY_aux1=999;
617        isTransform=false;
618
619        // LA VARIABLE DEMANDEE EN ORDONNEE N'EST PAS DISPONIBLE DANS LE FICHIER
620        // ON CREE DE LA DONNEE VIA UNE TRANSFORMATION DE VARIABLE
621        if( !display_type.equals("available") ){
622
623                isTransform=true;
624                auxiliary=file_par_aux;
625                auxiliary_nature=file_nature_aux;
626                auxiliary1=file_par_aux1;
627                auxiliary_nature1="file_nature_aux1";
628                origin="file_par_orig";
629                origin_unit=file_unit_orig;
630                origin_nature=file_nature_orig;
631
632                // 2 POSSIBILITES :
633                // 1/ ON TRANSFORME LA VARIABLE INITIALE PAR UNE TRANSFORMATION SIMPLE
634                if( display_type.equals("transformed") ){
635                        if( !file_trf_id.equals("999") ){
636                                //LA CONVERSION POINTE VERS UNE TRANSFORMATION
637                                result=treat_trf(file_trf_id, sel_tpl_id, count,origin_unit,sel_unit_ord,true,true,req);
638                                spl=(new stringSplit()).split(result,"%");
639                                varY=spl[0];
640                                Ytransfo=spl[1];
641                                AUY0transfo=spl[2];
642                                //AUY0transfo=spl[2];
643                                AUY1transfo=spl[3];
644                                count=Integer.parseInt(spl[4]);
645
646                                more_varid+=spl[5];
647
648                         }else{
649                                sel_unit_ord=file_unit_ord;
650                                Ytransfo="t999,999,999";
651
652                         }
653                 // 2/ ON TRANSFORME LA VARIABLE INITIALE PAR UNE TRANSFORMATION COMBINEE
654                 }
655                else if( display_type.equals("combined") ){
656                        if( !file_trf_id.equals("999") ){
657                                //La conversion pointe vers une transformation
658                                result=treat_cbn(file_trf_id, sel_tpl_id, count,origin_unit,sel_unit_ord,req);
659                                spl=(new stringSplit()).split(result,"%");
660                                varY=spl[0];
661                               
662                                Ytransfo=spl[1];
663                                AUY0transfo=spl[2];
664                                AUY1transfo=spl[3];
665                                count=Integer.parseInt(spl[4]);
666                                more_varid+=spl[5];
667                        }else {
668                                sel_unit_ord=file_unit_ord;
669                                Ytransfo="t999,999,999";
670                        }
671                 }
672                 }else{
673                        // PAS DE TRANSFORMATION MAIS PEUT-ETRE UNE CONVERSION
674                      nature_ord=file_nature_ord;
675                      //varY=",{variable:'"+ordonnee+"', nature:'"+nature_ord+"', subvariable:'"+sspar_ordonnee+"', unite:'"+sel_unit_ord+"'}";
676                        varY=ordonnee+","+nature_ord+","+sspar_ordonnee+","+sel_unit_ord;
677                      if( !file_unit_ord.equals(sel_unit_ord) ){
678                                ids=get_conv("acr", file_unit_ord, sel_unit_ord,req);
679                                cnv_id=(new stringSplit()).split(ids,"%")[0];
680                                trf_id=(new stringSplit()).split(ids,"%")[1];
681
682                                //EST-CE UNE CONVERSION OU/ET UNE TRANSFORMATION (EN ORDONNEE TRANFO OU COMBINEE PEUVENT
683                                //AVOIR LIEU
684                                if( !trf_id.equals("999") ){
685                                        //LA CONVERSION POINTE VERS UNE TRANSFORMATION
686                                        result=treat_trf(trf_id, sel_tpl_id, count, "", sel_unit_ord,false,true,req);
687                                        spl=(new stringSplit()).split(result,"%");
688                                        varY=spl[0];
689                                        Ytransfo=spl[1];
690                                        AUY0transfo=spl[2];
691                                        AUY1transfo=spl[3];
692                                        count=Integer.parseInt(spl[4]);
693                                        more_varid+=spl[5];
694                                }
695                                else if( !cnv_id.equals("-1") ){
696                                        //C'EST UNE CONVERSION SIMPLE
697                                        Ytransfo="conv"+cnv_id+",999,999";
698
699                                }else{
700                                        sel_unit_ord=file_unit_ord;
701                                        Ytransfo="t999,999,999";
702                                }
703                        }else{
704                                        Ytransfo="t999,999,999";
705                        }
706                 }
707        }
708
709}
710TRANSFO="";
711TRANSFO+=Xtransfo+"&"+Ytransfo;
712if( !AUX0transfo.equals("") )TRANSFO+="&"+AUX0transfo;
713if( !AUX1transfo.equals("") )TRANSFO+="&"+AUX1transfo;
714if( !AUY0transfo.equals("") )TRANSFO+="&"+AUY0transfo;
715if( !AUY1transfo.equals("") )TRANSFO+="&"+AUY1transfo;
716}
717
718nfile=-1;
719
720if ((isParAbs && sel_par_abs!=null && isParOrd) || (graph_sel.equals(_2D_TRAJECTORY) && sel_tpl_id!=null) ) {
721        if ((sel_par_ord!=null && sel_par_ord!="") || graph_sel.equals(_2D_TRAJECTORY)) {
722        sel_par="";
723        if (graph_sel.equals(_2D_TRAJECTORY)) sel_par="Coordinates";
724        else if (sel_par_abs!=null) sel_par=(new stringSplit()).split(sel_par_abs,"%")[0];
725        //DETERMINATION DES BORNES SPATIO-TEMPROELLES
726                if ((sel_mindate==null || sel_mindate.equals("") || sel_mindate.equals("null")
727                        || sel_maxdate==null || sel_maxdate.equals("") || sel_maxdate.equals("null")
728                        || lonmin==null || lonmin.equals("") || lonmin.equals("null")
729                        || lonmax==null || lonmax.equals("") || lonmax.equals("null")
730                        || latmin==null || latmin.equals("") || latmin.equals("null")
731                        || latmax==null || latmax.equals("") || latmax.equals("null"))
732                        && sel_exp_id!=null && sel_sspar_abs!=null) {
733                        sql="SELECT min(eth_first_date) as mindate, max(eth_last_date) as maxdate,min(eth_lon_min) as lonmin";
734                        sql+=",max(eth_lon_max) as lonmax,min(eth_lat_min) as latmin, max(eth_lat_max) as latmax,min(eth_alt_min) as altmin";
735                        sql+=",max(eth_alt_max) as altmax ";
736                        sql+="FROM ether.ether_file where (eth_id_experiment="+sel_exp_id;
737                        sql+=" or eth_id_experiment=(select exp_id from ether.dcp_file_class where associate="+sel_tpl_id+")) ";
738                        sql+=" and (eth_subparameter='"+sel_sspar_abs+"' or eth_subparameter='.') and eth_parameter='"+sel_par+"'";
739                        sql+=" and eth_dataset_version='"+sel_version+"' ";
740                        sql+=" and eth_ceos_level='"+sel_level+"' ";
741                        //sql+=" and eth_ceos_sublevel='"+sel_sublevel+"' ";
742                        sql+=" and eth_format='"+sel_format+"'";
743
744       
745                        al1=req.get_list(sql,cols);
746                        exp_alt_min=al1.get(6).toString();
747                        exp_alt_max=al1.get(7).toString();
748                        if(al1!=null && al1.size()>0) {
749                                if (exp_alt_min!=null && !exp_alt_min.equals("") && exp_alt_max!=null && !exp_alt_min.equals("")) {
750                                        heightTexte="<b>(Between "+exp_alt_min+" km and "+exp_alt_max+" km in altitude)</b>";
751                                }
752
753                                if (sel_mindate==null || sel_mindate.equals("") || sel_mindate.equals("null")) {
754                                        mindate_ms=Long.parseLong(al1.get(0).toString());
755                                        DSMinDate=(new calDate(mindate_ms)).date_cal;
756                                       
757                                }
758                                else {
759                                        DSMinDate=sel_mindate;
760                                        mindate_ms=(new calDate()).invers(sel_mindate);
761
762                                }
763
764                                if (sel_maxdate==null || sel_maxdate.equals("") || sel_maxdate.equals("null")) {
765                                        maxdate_ms=Long.parseLong(al1.get(1).toString());
766                                        DSMaxDate=(new calDate(maxdate_ms)).date_cal;
767                               
768
769                                }
770                                else {
771                                        DSMaxDate=sel_maxdate;
772                                        maxdate_ms=(new calDate()).invers(sel_maxdate);
773
774                                }
775
776
777                                if (lonmin==null || lonmin.equals("") || lonmin.equals("null")) lonmin=al1.get(2).toString();
778                                if (lonmax==null || lonmax.equals("") || lonmax.equals("null")) lonmax=al1.get(3).toString();
779
780                                if (latmin==null || latmin.equals("") || latmin.equals("null")) latmin=al1.get(4).toString();
781                                if (latmax==null || latmax.equals("") || latmax.equals("null")) latmax=al1.get(5).toString();
782
783                                DSMinDate_file=DSMinDate;
784                                DSMaxDate_file=DSMaxDate;
785
786                                if (file_type_abs.equals("densite")) {
787                                        sel_date_time=DSMinDate.substring(0,10);
788                                }
789                                lonmin_file=lonmin;
790                                lonmax_file=lonmax;
791                                latmin_file=latmin;
792                                latmax_file=latmax;
793
794                        }
795               
796                               
797                        if (!all_data.equals("1") && !exp_nrecouv.equals("-1") && exp_nrecouv!=null) {
798                                calNRecouv pnrecouv = new calNRecouv((new calDate()).invers(DSMinDate),Integer.parseInt(exp_nrecouv),"jour");
799                                DSMaxDate=pnrecouv.date_cal;
800                                if ((new calDate()).invers(DSMaxDate) > (new calDate()).invers(DSMaxDate_file)) DSMaxDate=DSMaxDate_file;
801                        }
802
803
804        }
805        else if ((sel_mindate!=null && sel_maxdate!=null)) {
806                DSMinDate=sel_mindate;
807                DSMaxDate=sel_maxdate;
808
809                if (!file_type_abs.equals("densite")) {
810                        mindate_ms=(new calDate()).invers(sel_mindate);
811                        maxdate_ms=(new calDate()).invers(sel_maxdate);
812                }
813                else {
814                        mindate_ms=(new calDate()).invers(sel_date_time+"-00:00:00:000");
815                        maxdate_ms=(new calDate()).invers(sel_date_time+"-23:59:59:000");
816                }
817        }
818
819}
820
821}
822// LISTE DES FICHIERS diSponibles
823sel_file="";
824file_list=null;
825nfile=0;
826
827sql="select is_batch, exp_nrecouv from sil_experiment_attribut where exp_id='"+sel_exp_id+"'";
828exp_attribut_list=req.get_list(sql,exp_attribut_columns);
829
830if (exp_attribut_list==null || exp_attribut_list.size()==0) {
831        is_batch="0";
832        exp_nrecouv="-1";
833}
834else{
835        nreq=exp_attribut_list.size()/exp_attribut_columns.length;
836        if( nreq>0 ){
837            k=0;
838            is_batch=exp_attribut_list.get(k).toString();
839            if (!exp_attribut_list.get(k+1).toString().equals("") && exp_attribut_list.get(k+1).toString()!=null) exp_nrecouv=exp_attribut_list.get(k+1).toString();
840            else exp_nrecouv="-1";     
841        }
842}
843
844if (sel_exp_public.equals("1")) {
845        is_private="1";
846        private_data_flag="1";
847}
848else {
849        is_private="0";
850        private_data_flag="0";
851}
852
853
854if (is_private.equals("1")) {
855        if (is_batch.equals("0")) {
856                droit="1";
857                modei="none";
858        }
859        else {
860                modei="email";
861                if (cemail.equals("") || cemail.equals("null")) {
862                        droit="0";
863                }
864                else {
865                        droit="1";
866                }
867        }
868        download_auth="0";
869}
870if (is_private.equals("0")) {
871//      email="";
872        modei="loginu";
873
874        if (onlydata.equals("1")) {
875                download_auth="1";
876                droit="1";
877                rightTexte="Only data";
878        }
879        else {
880        if (is_batch.equals("1")) {
881                if (!cemail.equals("") && !cemail.equals("null")) {
882                        download_auth="1";
883                        email=cemail;
884                        droit="1";
885                        continuer="0";
886                }
887                else continuer="1";
888        }
889        else continuer="1";
890
891        if (continuer.equals("1")) {
892
893        if (!login.equals("") && !passu.equals("")) {
894
895        //recherche donnees utilisateur
896        sql="select id,email,name,first_name from ether_user where login='"+login+"' and password='"+passu+"'";
897        user_list=req.get_list(sql,user_columns);
898
899        if (user_list==null || user_list.size()==0) {
900                droit="0";
901                login="";
902                passu="";
903                lance="0";
904                name="Login non-existent in Ether base";
905                modei="err";
906
907        }
908        else{
909                nreq=user_list.size()/user_columns.length;
910                if( nreq>0 ){
911                        k=0;
912                        userid=user_list.get(k).toString();
913                        email=user_list.get(k+1).toString();
914                        name=user_list.get(k+2).toString();
915                        first_name=user_list.get(k+3).toString();
916
917                }
918
919        }
920
921
922        //recherche group_id de l'experience
923        sql="select eri_group_id from ether_experiment_right where eri_experiment_id='"+sel_exp_id+"'";
924        group_list=req.get_list(sql,group_columns);
925
926        if (group_list==null || group_list.size()==0) {
927        }
928        else{
929               nreq=group_list.size()/group_columns.length;
930               if( nreq>0 ){
931                        k=0;
932                        group=group_list.get(k).toString();
933                }
934
935        }
936
937        //recherche droit utilisateur
938        sql="select id from ether_group_user where user_id='"+userid+"' and group_id='"+group+"'";
939        priv_list=req.get_list(sql,priv_columns);
940
941        if (priv_list==null || priv_list.size()==0) {
942                download_auth="1";
943                login="";
944                passu="";
945        }
946        else{
947                nreq=priv_list.size()/priv_columns.length;
948                if( nreq>0 ){
949                        droit="1";
950                        download_auth="0";
951                }
952                else {
953                        download_auth="1";
954                }
955
956        }
957
958        }
959        droit="1";
960        }
961        if (download_auth.equals("0")) rightTexte="Data and download";
962        else rightTexte="Only data";
963
964        }
965
966}
967
968if (download_auth.equals("0")) rightTexte="Data and download";
969else rightTexte="Only data";
970
971
972if (is_batch.equals("1")) modeTexte="BATCH";
973else modeTexte="DIRECT";
974
975ftitle=request.getParameter("ftitle");
976if (ftitle==null || ftitle.equals("") || ftitle.equals("null")) {
977                ftitle="";
978}
979
980if (colour_bar_title==null || colour_bar_title.equals("") || colour_bar_title.equals("null")) {
981        colour_bar_title=form_legend;
982}
983
984if (droit.equals("1") && !afficheTrace.equals("null") && afficheTrace.equals("1")) {
985
986        sql="SELECT * ";
987        sql+="FROM ether.ether_file where (eth_id_experiment="+sel_exp_id;
988        sql+=" or eth_id_experiment=(select exp_id from ether.dcp_file_class where associate="+sel_tpl_id+")) ";
989        sql+=" and (eth_subparameter='"+sel_sspar_abs+"' or eth_subparameter='.') and eth_parameter='"+file_par_abs+"'";
990        sql+=" and eth_dataset_version='"+sel_version+"' ";
991        sql+=" and eth_ceos_level='"+sel_level+"' ";
992        //sql+=" and eth_ceos_sublevel='"+sel_sublevel+"' ";
993        sql+=" and eth_format='"+sel_format+"' and ";
994        sql+=" (eth_last_date>="+mindate_ms+" and eth_first_date<="+maxdate_ms+") ";
995        sql+="and (eth_lon_max>="+lonmin+" and eth_lon_min<="+lonmax+") and (eth_lat_max>="+latmin+" and eth_lat_min<="+latmax+") ";
996
997        out.write(sql);
998
999        file_list=req.get_list(sql,file_columns2);
1000
1001        if (file_list==null || file_list.size()==0) {
1002                out.write("<script>alert('No experiment files found for this selection');</script>");
1003                isFile=false;
1004        }else{
1005                isFile=true;
1006                nfile=file_list.size()/file_columns2.length;
1007                if( nfile>0 ){
1008                        if (is_batch.equals("1")) mode="BATCH";
1009                        else mode="DIRECT";
1010                        k=0;
1011                        for(i=0;i<nfile;i++){
1012                                String testsel="";
1013                                sel_file+=file_list.get(k+2)+","+file_list.get(k+5)+","+file_list.get(k+6)+","+file_list.get(k+7);
1014                                sel_file+=","+file_list.get(k+8)+"&";
1015                               
1016                                testsel=file_list.get(k+2)+","+file_list.get(k+5)+","+file_list.get(k+6)+","+file_list.get(k+7)+","+file_list.get(k+8)+"<br>";
1017                                k+=file_columns2.length;
1018                        }
1019                }
1020
1021        }
1022
1023
1024
1025pageMode="";
1026
1027if (sel_tpl_id!=null && !sel_tpl_id.equals("") && isFile==true) {
1028        pageMode="";
1029        reader=file_reader(sel_tpl_id,req);
1030        if (sel_file!=null && !sel_file.equals("")) {
1031
1032                files=sel_file;
1033                varid="[{variable:'"+file_par_abs+"', nature:'"+file_nature_abs+"', subvariable:'"+sel_sspar_abs+"', unite:'"+sel_unit_abs+"'}"+varY;
1034                varid+=more_varid;
1035                varid+="]";
1036
1037                typeOrdonnee=file_par_ord;
1038
1039                reader_param_varid=file_par_abs+","+file_nature_abs+","+sel_sspar_abs+","+sel_unit_abs;
1040                reader_param_varid+="&";
1041                reader_param_varid+=varY+more_varid;
1042
1043                tt=(new stringSplit()).split(files,"&");
1044                len=tt.length;
1045                if( tt[len-1].equals("")) len=len-1;
1046                filename=new String[len];
1047                auxfile=new String[len];
1048                infofile="";
1049
1050                for(i=0; i<len;i++){
1051                        filename[i]=(new stringSplit()).split(tt[i],",")[0];
1052                        tab_file_name+=rep_data+filename[i];
1053                        if( i<len-1 )tab_file_name+=",";
1054
1055                        assoc=scanAssociates("info",sel_tpl_id,filename[i],rep_data,req);
1056                        if( assoc!=null && assoc.length>0 ){
1057                                infofile+=assoc[0];
1058                        }else{
1059                                infofile+="none";
1060                        }
1061
1062                        if (i<len-1) infofile+=",";
1063                        ///////////////////////////////////////////////
1064                        assoc=scanAssociates("paramaux",sel_tpl_id,filename[i],rep_data,req);
1065                        if( assoc!=null && assoc.length>0 ){
1066                                for(int p=0;p<assoc.length;p++){
1067                                        reponse=(new stringSplit()).split(assoc[p],"%");
1068                                        nomfile=reponse[0];
1069
1070                                        nomvariable=reponse[1];
1071                                        nomsubvariable=reponse[2];
1072                                        src=reponse[3];
1073
1074                                        tab_paux=nomfile+",";
1075                                        tab_paux+=nomvariable+",";
1076                                        tab_paux+=nomsubvariable+",";
1077                                        tab_paux+=src;
1078                                        nassoc=scanAssociates("info",sel_tpl_id,(new File(nomfile)).getName(),rep_data,req);
1079                                        if (nassoc!=null && nassoc.length>0) tab_paux+=","+nassoc[0];
1080                                        else tab_paux+=",.";
1081
1082                                        auxstruct+=tab_paux;
1083                                        if( p<assoc.length-1 )auxstruct+="&";
1084
1085                                }
1086                        }
1087                        else{
1088                                tab_paux="none,";
1089                                tab_paux+="none,";
1090                                tab_paux+="none,";
1091                                tab_paux+="none,";
1092                                tab_paux+=".";
1093                                auxstruct+=tab_paux;
1094                                isParamaux=false;
1095                        }
1096
1097
1098                        if (i<len-1) auxstruct+="@";
1099
1100                }
1101        }
1102        /**************************CREATION FICHIER XML*********************************************/
1103
1104
1105        structureXML docXML = new structureXML();
1106       
1107        docXML.rep_xml=rep_xml;
1108
1109        docXML.id_session=id_session;
1110        docXML.uniqueid=uniqueid;
1111        docXML.mode=mode;
1112
1113        docXML.private_data_flag=private_data_flag;
1114        docXML.download_auth=download_auth;
1115        docXML.flag_extrapolate_auth=flag_extrapolate_auth;
1116
1117        docXML._1d_interpolator_method=_1d_interpolator_method;
1118        docXML._1d_spacing=_1d_spacing;
1119        docXML._1d_Nmax=_1d_Nmax;
1120        docXML._1d_Nmin=_1d_Nmin;
1121
1122        docXML.irreg_grid_method=irreg_grid_method;
1123        docXML.reg_grid_method=reg_grid_method;
1124        docXML._2d_xspacing=_2d_xspacing;
1125        docXML._2d_yspacing=_2d_yspacing;
1126        docXML._2d_NXmax=_2d_NXmax;
1127        docXML._2d_NXmin=_2d_NXmin;
1128        docXML._2d_NYmax=_2d_NYmax;
1129        docXML._2d_NYmin=_2d_NYmin;
1130        docXML.flag_validity_mask=flag_validity_mask;
1131
1132        if (file_type_abs.equals("densite")) {
1133                densite="1";
1134                docXML.profil_flag="1";
1135        }
1136        else docXML.profil_flag="0";
1137
1138        docXML.densite=densite;
1139
1140        docXML.experiment_name=sel_tpl_name;
1141
1142        docXML.plot_type=graph_sel;
1143        docXML.reader=reader;
1144        docXML.tab_file=tab_file_name;
1145        docXML.tab_infofile=infofile;
1146
1147        if (!file_type_abs.equals("densite")) {
1148                docXML.mindate=DSMinDate;
1149                docXML.maxdate=DSMaxDate;
1150
1151        }
1152        else {
1153                docXML.mindate=sel_date_time+"-00:00:00:000";
1154                docXML.maxdate=sel_date_time+"-23:59:59:000";
1155
1156        }
1157
1158        docXML.latmin=latmin;
1159        docXML.latmax=latmax;
1160        docXML.lonmin=lonmin;
1161        docXML.lonmax=lonmax;
1162
1163        if (graph_sel.equals(VERTICAL_ANALYSIS) || graph_sel.equals(TIME_ANALYSIS) || graph_sel.equals(XY_PLOT)) {
1164                docXML.observation_height=exp_alt_max;
1165                if (sel_unit_ord.equals("m") && !exp_alt_max.equals("0")) docXML.observation_height+="000";
1166                docXML.flag_extrapolate_auth="0";
1167
1168        }
1169        else  {
1170                docXML.observation_height=observation_height;
1171                docXML.flag_extrapolate_auth="1";
1172        }       
1173        docXML.num_version=sel_version;
1174        docXML.map_projection=map_projection;
1175
1176        docXML.hemisphere=hemisphere;
1177
1178        docXML.title=ftitle;
1179        docXML.sub_title=ftitle;
1180
1181        docXML.colour_bar_title=colour_bar_title;
1182        docXML.map_information_level=map_information_level;
1183        docXML.map_filling=map_filling;
1184        docXML.map_axes_type=map_axes_type;
1185        docXML.grid_linestyle=grid_linestyle;
1186        docXML.latitude_posting=latitude_posting;
1187        docXML.longitude_posting=longitude_posting;
1188        docXML.colour_bar_grid=colour_bar_grid;
1189        docXML.colour_bar_nb_value=colour_bar_nb_value;
1190
1191        docXML.auxstruct=auxstruct;
1192
1193        docXML.read_param_varid=reader_param_varid;
1194
1195        docXML.parameter_name=form_par_abs;
1196        docXML.vertical_scale_name=file_par_ord;
1197
1198        docXML.vertical_scale_unit=sel_unit_ord;
1199        docXML.parameter_unit=sel_unit_abs;
1200        docXML.sub_parameter=form_sspar_abs;
1201
1202        docXML.xvariable=file_par_abs;
1203        docXML.xnature=file_nature_abs;
1204        if (sel_sspar_abs.equals(".")) docXML.xsubvariable="none";
1205        else docXML.xsubvariable=sel_sspar_abs;
1206        docXML.xunite=sel_unit_abs;
1207
1208        docXML.contour_display_mode=contour_display_mode;
1209        docXML.contour_default_colour_flag=contour_default_colour_flag;
1210        docXML.contour_default_colour=contour_default_colour;
1211        docXML.contour_default_linestyle=contour_default_linestyle;
1212        docXML.contour_default_line_thickness=contour_default_line_thickness;
1213        docXML.contour_default_label_flag=contour_default_label_flag;
1214
1215        if (graph_sel.equals("3")) {
1216                docXML.dot_plot_dotsize=dot_plot_dotsize;
1217                docXML.dot_plot_dot_style=dot_plot_dot_style;
1218
1219        }       
1220
1221        if (graph_sel.equals(CONTOUR) && contour_default_colour_flag.equals("0")) {
1222                if (contour_display_mode.equals("0")) {
1223                        if (contour_default_colour_flag.equals("0") && contour_default_colour.equals("0,0,0")) {
1224                                docXML.idl_colour_table_id="";
1225                                docXML.contour_default_colour_flag="1";
1226                        }
1227                        else {
1228                                docXML.line_colour=contour_default_colour;
1229                        }
1230                }
1231                else {
1232                        docXML.idl_colour_table_id="";
1233                        docXML.contour_default_colour_flag="1";
1234                }
1235
1236        }
1237        else if ((graph_sel.equals(DOT_PLOT) && dot_plot_colour_flag.equals("1")) ||
1238                        (graph_sel.equals(CONTOUR) && contour_default_colour_flag.equals("1"))
1239                               
1240                ) {
1241                docXML.idl_colour_table_id=idl_colour_table_id;
1242
1243                if (!imported_colour_table.equals("") && !imported_colour_table.equals("null") && imported_colour_table!="" && imported_colour_table!=null)
1244                {
1245                        docXML.imported_colour_table=imported_colour_table;
1246                }
1247               
1248                if (graph_sel.equals(DOT_PLOT)) docXML.dot_colour_flag="1";
1249                docXML.val_min_bd=val_min_bd;
1250                docXML.val_max_bd=val_max_bd;
1251                docXML.unite_bd=unite_bd;
1252
1253        }
1254        else if (graph_sel.equals(VERTICAL_ANALYSIS) || graph_sel.equals(TIME_ANALYSIS) || graph_sel.equals(XY_PLOT) || graph_sel.equals(_2D_TRAJECTORY)) {
1255                if (!vertical_line_colour_flag.equals("0") && !vertical_line_colour_flag.equals("1") && !vertical_line_colour_flag.equals("2")) {
1256                        docXML.line_colour_flag="3";//vertical_line_colour_flag;
1257                        docXML.line_colour=vertical_line_colour;
1258                }
1259                else {
1260                        docXML.line_colour="";
1261                        docXML.line_colour_flag=vertical_line_colour_flag;
1262                }
1263       
1264                docXML.dot_style=vertical_dot_style;
1265                docXML.dot_size=vertical_dot_size;
1266                docXML.line_style=vertical_line_style;
1267                docXML.line_thickness=vertical_line_thickness;
1268
1269                docXML.max_line_number=max_line_number;
1270       
1271        }
1272
1273
1274        sql="SELECT mt_id ";
1275        sql+="FROM sil_type_trace WHERE tt_id="+graph_sel;
1276        file_list=null;
1277        file_list=req.get_list(sql,metat_columns);
1278
1279        if (file_list==null || file_list.size()==0) {
1280        }else{
1281                nfile=file_list.size()/metat_columns.length;
1282                if (nfile>0) {
1283                        k=0;
1284                        docXML.meta_type=file_list.get(k).toString();
1285                }
1286        }
1287
1288        docXML.transfo=TRANSFO;
1289
1290        docXML.dot_plot_dot_style=dot_plot_dot_style;
1291        if (dot_plot_colour_flag.equals("0")) docXML.dot_plot_colour_flag="1";
1292        else docXML.dot_plot_colour_flag=dot_plot_colour_flag;
1293
1294        docXML.dot_plot_dotcolour=dot_plot_dotcolour;
1295        docXML.dot_plot_dotsize=dot_plot_dotsize;
1296
1297        if (levels.equals("1") && !userLevels.equals("") && !userLevels.equals("null")) {
1298                docXML.userLevels=userLevels;
1299                docXML.contour_level_setting_mode=levels;
1300        }
1301        else {
1302                docXML.userLevels="";
1303                docXML.contour_level_setting_mode="0";
1304        }
1305       
1306        if (file_par_ord.equals("Press")) {
1307                docXML.y_scale_format="2";
1308        }
1309
1310
1311        String ret=docXML.generate();
1312        if (mode.equals("BATCH")) {
1313               
1314                pageMode="lanceEnTacheDeFond.jsp";
1315                if (!login.equals("") && !passu.equals("")) {
1316                        chainePageMode="?id="+id_session+"&uniqueid="+uniqueid+"&mode="+mode+"&email="+email;
1317                }
1318                else {
1319                        chainePageMode="?id="+id_session+"&uniqueid="+uniqueid+"&mode="+mode+"&email="+cemail;
1320                }
1321        }
1322        else {
1323               
1324                pageMode="lanceAppletEtherVisu.html";
1325                chainePageMode="?id="+id_session+"&uniqueid="+uniqueid+"&mode="+mode+"&email=";
1326        }
1327
1328}
1329}
1330}
1331par_options_abs+="<option class=selection value=''>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>";
1332
1333par_options_abs0+="<option class=selection value=''>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>";
1334
1335par_options_ord+="<option class=selection value=''>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>";
1336
1337unit_options_abs+="<option class=selection value=''>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>";
1338
1339//if (sspar_options.equals("") || sspar_options.equals("null") || sspar_options=="" || sspar_options==null) sspar_options="<OPTION class=selection VALUE=\".
1340//\" selected>None</OPTION>";
1341
1342sspar_options+="<option class=selection value=''>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>";
1343
1344ssparord_options+="<option class=selection value=''>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>";
1345
1346unit_options_ord+="<option class=selection value=''>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>";
1347
1348exp_options+="<option class=selection value=''>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>";
1349
1350
1351req.close_connection();
1352%>
1353<html>
1354<head>
1355<title>setAttribute et tableaux</title>
1356<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
1357<link rel="stylesheet" href="ether.css" type="text/css">
1358<script language="Javascript" type="text/javascript">
1359//<!--
1360var longdate="";
1361var regExpEmpty=/^(\s)*$/g;
1362
1363function updateCreation(mode) {
1364parent.creation.document.thisForm.active.value=mode;
1365parent.creation.document.thisForm.submit();
1366return true;
1367}
1368
1369function lancerMode(page,chainePage) {
1370if (page!='' && chainePage!='') {
1371Newfen(page+chainePage,'Visualisation_V3','800','800');
1372}
1373
1374return true;
1375
1376}
1377
1378function updateAllData() {
1379        document.thisForm.mindate.value="";
1380        document.thisForm.temp_mindate.value="";
1381        document.thisForm.maxdate.value="";
1382        document.thisForm.temp_maxdate.value="";
1383        blocForm();
1384}
1385
1386function initForm(niv) {
1387var obj=document.thisForm;
1388if (niv=='5') {
1389        if (obj.file_type_abs.value=='densite') niv='6b';
1390        //updateTitle('');
1391}
1392
1393if (niv=='2') {
1394        obj.class_data_set.value="ssrubrique";
1395        obj.dis_data_set.value="";
1396
1397        obj.class_component.value="inactif";
1398        obj.dis_component.value="disabled";
1399
1400        obj.class_axis.value="inactif";
1401
1402        obj.class_vertical_scale.value="inactif";
1403        obj.dis_vertical_scale.value="disabled";
1404               
1405        obj.class_time.value="inactif";
1406        obj.dis_time.value="disabled";
1407
1408        obj.class_ho.value="inactif";
1409        obj.dis_ho.value="disabled";
1410       
1411        obj.class_location.value="inactif";
1412        obj.class_location2.value="inactif";
1413       
1414        obj.sel_tpl_id.value="";
1415        obj.graph_sel.value="";
1416       
1417        openListGraph('1','1','');
1418}
1419
1420
1421if (obj.graph_sel.value=='' && niv!='2') {
1422        openListGraph('1','1');
1423        niv='2';
1424        obj.sel_tpl_id.value="";
1425}
1426
1427if (obj.graph_sel.value!='' && niv=='2') {
1428        //niv='3';
1429}
1430
1431
1432if (niv=='4' || niv=='1' || niv=='2') {
1433        obj.sel_par_abs.value="";
1434        obj.sel_par_ord.value="";
1435        obj.sel_unit_abs.value="";
1436        obj.sel_unit_ord.value="";
1437        obj.sel_sspar_abs.value="";
1438        obj.observation_height.value="";
1439        obj.latmin.value="";
1440        obj.lonmin.value="";
1441        obj.latmax.value="";
1442        obj.lonmax.value="";
1443
1444        obj.class_data_set.value="ssrubrique";
1445        obj.dis_data_set.value="";
1446
1447        obj.class_component.value="inactif";
1448        obj.dis_component.value="disabled";
1449        obj.class_axis.value="inactif";
1450
1451        obj.class_vertical_scale.value="inactif";
1452        obj.dis_vertical_scale.value="disabled";
1453
1454        obj.class_time.value="inactif";
1455        obj.dis_time.value="disabled";
1456
1457        obj.class_ho.value="inactif";
1458        obj.dis_ho.value="disabled";
1459        obj.class_location.value="inactif";
1460        obj.class_location2.value="inactif";
1461
1462}
1463
1464if (niv=='4') {
1465       
1466        obj.class_component.value="ssrubrique";
1467        obj.dis_component.value="";
1468        obj.class_axis.value="rubrique";
1469}
1470
1471if (niv=='5') {
1472        obj.sel_par_ord.value="";
1473        obj.sel_unit_ord.value="";
1474        obj.observation_height.value="";
1475        obj.latmin.value="";
1476        obj.lonmin.value="";
1477        obj.latmax.value="";
1478        obj.lonmax.value="";
1479
1480        obj.class_data_set.value="ssrubrique";
1481        obj.dis_data_set.value="";
1482
1483        obj.class_component.value="ssrubrique";
1484        obj.dis_component.value="";
1485        obj.class_axis.value="rubrique";
1486
1487        obj.class_vertical_scale.value="ssrubrique";
1488        obj.dis_vertical_scale.value="";
1489
1490        obj.class_time.value="ssrubrique";
1491        obj.dis_time.value="";
1492
1493        obj.class_ho.value="inactif";
1494        obj.dis_ho.value="disabled";
1495        obj.class_location.value="inactif";
1496        obj.class_location2.value="rubrique";
1497
1498}
1499if (niv=='6') {
1500        obj.observation_height.value="";       
1501
1502        obj.class_data_set.value="ssrubrique";
1503        obj.dis_data_set.value="";
1504
1505        obj.class_component.value="ssrubrique";
1506        obj.dis_component.value="";
1507        obj.class_axis.value="rubrique";
1508
1509        obj.class_vertical_scale.value="ssrubrique";
1510        obj.dis_vertical_scale.value="";
1511
1512        obj.class_time.value="ssrubrique";
1513        obj.dis_time.value="";
1514
1515        obj.class_ho.value="ssrubrique";
1516        obj.dis_ho.value="";
1517        obj.class_location.value="rubrique";
1518}
1519
1520if (niv=='6b') {
1521       obj.observation_height.value="";
1522
1523       obj.class_data_set.value="ssrubrique";
1524       obj.dis_data_set.value="";
1525 
1526       obj.class_component.value="ssrubrique";
1527       obj.dis_component.value="";
1528       obj.class_axis.value="rubrique";
1529 
1530       obj.class_vertical_scale.value="ssrubrique";
1531       obj.dis_vertical_scale.value="";
1532
1533       obj.class_time.value="ssrubrique";
1534       obj.dis_time.value="";
1535 
1536       obj.class_ho.value="ssrubrique";
1537       obj.dis_ho.value="";
1538       obj.class_location.value="rubrique";
1539}
1540
1541//if (document.thisForm.graph_sel.value=='<%=_2D_TRAJECTORY%>') obj.dis_ho.value="disabled";
1542
1543
1544if (niv=='6' || niv=='6b') updateCreation('1');
1545else updateCreation('0');
1546
1547parent.user_info.location.href='user_info.jsp?num_step='+niv+'&is_private='+<%=is_private%>;
1548
1549return true;
1550}
1551
1552function blocForm() {
1553document.thisForm.submit();
1554
1555document.thisForm.sel_tpl_id.disabled=true;
1556document.thisForm.sel_par_abs.disabled=true;
1557document.thisForm.sel_unit_abs.disabled=true;
1558document.thisForm.sel_sspar_abs.disabled=true;
1559if (document.thisForm.sel_par_ord) {
1560        document.thisForm.sel_par_ord.disabled=true;
1561        document.thisForm.sel_unit_ord.disabled=true;
1562}
1563document.thisForm.latmin.disabled=true;
1564document.thisForm.latmax.disabled=true;
1565document.thisForm.lonmin.disabled=true;
1566document.thisForm.lonmax.disabled=true;
1567document.thisForm.mindate.disabled=true;
1568document.thisForm.maxdate.disabled=true;
1569document.thisForm.observation_height.disabled=true;
1570document.thisForm.ftitle.disabled=true;
1571document.thisForm.colour_bar_title.disabled=true;
1572
1573
1574}
1575
1576function updateLegend() {
1577document.thisForm.colour_bar_title.value="";
1578
1579abs=document.thisForm.form_par_abs.value;
1580unit=document.thisForm.sel_unit_abs.value;
1581
1582legend=abs+' ('+unit+')';
1583
1584document.thisForm.colour_bar_title.value=legend;
1585
1586return true;
1587
1588}
1589
1590function updateTitle(mode) {
1591if (mode=='clear') {
1592        document.thisForm.ftitle.value="";
1593}
1594
1595if (document.thisForm.ftitle.value=='') {
1596
1597oh=document.thisForm.observation_height.value;
1598
1599exp=document.thisForm.sel_tpl_name.value;
1600mid=document.thisForm.mindate.value;
1601mad=document.thisForm.maxdate.value;
1602par_observation_height=document.thisForm.par_observation_height.value;
1603sel_unit_ord=document.thisForm.sel_unit_ord.value;
1604
1605tt=exp;
1606if (document.thisForm.file_type_abs.value!="densite" && (document.thisForm.graph_sel.value=='<%=DOT_PLOT%>' || document.thisForm.graph_sel.value=='<%=CONTOUR%>')) {
1607if (oh!='' && !matchRegExp(oh, regExpEmpty)) {
1608        tt+=' - '+oh+' '+sel_unit_ord+' - ';
1609        tt+=document.thisForm.mindate.value.substring(0,10)+' to '+document.thisForm.maxdate.value.substring(0,10);
1610}
1611}
1612else if (document.thisForm.file_type_abs.value=="densite") {
1613        tt+=' - '+document.thisForm.sel_date_time.value;
1614}
1615else if (document.thisForm.graph_sel.value=='<%=XY_PLOT%>') {
1616        tt+='';
1617}
1618else {
1619        tt+='';
1620
1621}
1622document.thisForm.ftitle.value=tt;
1623}
1624
1625return true;
1626
1627}
1628
1629function choixIdent(is_batch) {
1630if (document.thisForm.modei.value=="email") {
1631        //Newfen('email.jsp?cemail=&modifye=0&is_batch=','Email','400','300');
1632}
1633else if (document.thisForm.modei.value=="loginu") {
1634        //Newfen('loginu.jsp?modifye=0&is_batch='+is_batch,'Authentification','650','550');
1635}
1636document.thisForm.lance.value="1";
1637return true;
1638}
1639
1640function updateOverview() {
1641        graph_sel=document.thisForm.graph_sel.value;
1642        chaineURL="overview.jsp?graph_sel="+graph_sel;
1643        chaineURL+="&meta_type="+document.thisForm.lib_meta_type.value;
1644        chaineURL+="&file_type_abs="+document.thisForm.file_type_abs.value;
1645       
1646        if (document.thisForm.mindate.value!='') chaineURL+="&datemin="+document.thisForm.mindate.value;
1647        if (document.thisForm.maxdate.value!='') chaineURL+="&datemax="+document.thisForm.maxdate.value;
1648        if (document.thisForm.latmin.value!='') chaineURL+="&latmin="+document.thisForm.latmin.value;
1649        if (document.thisForm.latmax.value!='') chaineURL+="&latmax="+document.thisForm.latmax.value;
1650        if (document.thisForm.lonmin.value!='') chaineURL+="&lonmin="+document.thisForm.lonmin.value;
1651        if (document.thisForm.lonmax.value!='') chaineURL+="&lonmax="+document.thisForm.lonmax.value;
1652        if (document.thisForm.ftitle.value!='') chaineURL+="&title="+document.thisForm.ftitle.value;
1653        if (document.thisForm.sel_tpl_name.value!='') chaineURL+="&sel_tpl_name="+document.thisForm.sel_tpl_name.value;
1654        if (document.thisForm.sel_tpl_id.value!='') chaineURL+="&sel_tpl_id="+document.thisForm.lib_tpl_id.value;
1655        if (document.thisForm.sel_par_abs.value!='') chaineURL+="&sel_par_abs="+document.thisForm.lib_param.value;
1656        if (document.thisForm.sel_sspar_abs.value!='') chaineURL+="&sel_sspar_abs="+document.thisForm.sel_sspar_abs.value;
1657        if (document.thisForm.sel_par_ord.value!='') chaineURL+="&sel_par_ord="+document.thisForm.form_par_ord.value;
1658        if (document.thisForm.sel_unit_ord.value!='') chaineURL+="&sel_unit_ord="+document.thisForm.sel_unit_ord.value;
1659        if (document.thisForm.sel_unit_abs.value!='') chaineURL+="&sel_unit_abs="+document.thisForm.sel_unit_abs.value;
1660        if (document.thisForm.colour_bar_title!='') chaineURL+="&colour_bar_title="+document.thisForm.colour_bar_title.value;
1661        if (document.thisForm.observation_height!='') chaineURL+="&observation_height="+document.thisForm.observation_height.value;
1662
1663        parent.overview.location.href=chaineURL;
1664        return true;
1665}
1666
1667function showTrace(id_session,uniqueid,mode) {
1668var chaine='pop_upapplet.jsp?id_session='+id_session+'&uniqueid='+uniqueid+'&mode='+mode;
1669
1670Newfen(chaine,'Visualisation_V3','600','600');
1671
1672return true;
1673}
1674
1675
1676function checkObservationHeight(type_abs) {
1677if (type_abs!='profil') return false;
1678if (checkOH()) {
1679        return false;
1680}
1681else return true;
1682
1683}
1684
1685function checkOH() {
1686        if (!checkValue(document.thisForm.observation_height.value,'The height observation','','1')) {
1687                return false;
1688        }
1689        else {
1690                if (!matchRegExp(document.thisForm.observation_height.value, regExpEmpty) && document.thisForm.observation_height.value!='') {
1691                        return true;
1692                }
1693                else {
1694                        alert("You must enter an observation height");
1695                        return false;
1696                }
1697        }
1698
1699}
1700
1701function checkValue(valeur,texte,def,mode) {
1702if (isNaN(valeur)) {
1703        if (mode=='1') alert(texte+' must be numeric');
1704        if (texte=="Level value") document.thisForm.level_value.value=def;
1705        else if (mode=='1') document.thisForm.observation_height.value=def;
1706        return false;
1707}
1708return true;
1709}
1710
1711
1712function matchRegExp(valeur, regularExpression) {
1713        var resultat = valeur.match(regularExpression);
1714        if(resultat!=null && resultat.length==1) return true;
1715        else return false;
1716}
1717
1718function checkLongitude(minL,maxL){
1719        var text='';
1720
1721        if (isNaN(document.thisForm.lonmin.value) || isNaN(document.thisForm.lonmax.value)) {
1722                alert("Error : Invalid longitude format");
1723                document.thisForm.lonmin.value=minL;
1724                document.thisForm.lonmax.value=maxL;
1725                return false;
1726        }
1727
1728        minlon=parseFloat(document.thisForm.lonmin.value);
1729        maxlon=parseFloat(document.thisForm.lonmax.value);
1730        if( minlon > maxlon ){
1731                alert("Error : Latitude min is greater than latitude max");
1732                document.thisForm.lonmin.value=minL;
1733                document.thisForm.lonmax.value=maxL;
1734                return false;
1735        }
1736        if( minlon<-180 || maxlon>180 ){
1737                alert("Error : the selected longitude is out of range [-180,180]");
1738                if (minlon<-180) document.thisForm.lonmin.value=minL;
1739                if (maxlon>180) document.thisForm.lonmax.value=maxL;
1740                return false;
1741        }
1742        if( minlon<minL || maxlon>maxL ){
1743                alert("Error : the selected longitude is out of range of the experiment files ["+minL+","+maxL+"]");
1744                if (minlon<minL) document.thisForm.lonmin.value=minL;
1745                if (maxlon>maxL) document.thisForm.lonmax.value=maxL;
1746                return false;
1747        }
1748
1749        if (matchRegExp(document.thisForm.lonmax.value, regExpEmpty) || document.thisForm.lonmax.value=='') {
1750                document.thisForm.lonmax.value=maxL;
1751        }
1752        if (matchRegExp(document.thisForm.lonmin.value, regExpEmpty) || document.thisForm.lonmin.value=='') {
1753                document.thisForm.lonmin.value=minL;
1754        }
1755        updateOverview();
1756        return true;
1757}
1758
1759
1760function checkLatitude(minL,maxL) {
1761
1762        if (isNaN(document.thisForm.latmin.value) || isNaN(document.thisForm.latmax.value)) {
1763                alert("Error : Invalid latitude format");
1764                document.thisForm.latmin.value=minL;
1765                document.thisForm.latmax.value=maxL;
1766                return false;
1767        }
1768
1769        minlat=parseFloat(document.thisForm.latmin.value);
1770        maxlat=parseFloat(document.thisForm.latmax.value);
1771
1772
1773        if( minlat > maxlat ){
1774                alert("Error : Latitude min is greater than latitude max");
1775                document.thisForm.latmin.value=minL;
1776                document.thisForm.latmax.value=maxL;
1777                return false;
1778        }
1779        if( minlat<-90 || maxlat>90 ){
1780                alert("Error : the selected latitude is out of range [-90,90]");
1781                if (minlat<-90) document.thisForm.latmin.value=minL;
1782                if (maxlat>90) document.thisForm.latmax.value=maxL;
1783                return false;
1784        }
1785        if (minlat<minL || maxlat>maxL) {
1786                alert("Error : the selected latitude is out of range of the experiment files ["+minL+","+maxL+"]");
1787                if (minlat<minL) document.thisForm.latmin.value=minL;
1788                if (maxlat>maxL) document.thisForm.latmax.value=maxL;
1789                return false;
1790        }
1791
1792
1793        if (matchRegExp(document.thisForm.latmax.value, regExpEmpty) || document.thisForm.latmax.value=='') {
1794                document.thisForm.latmax.value=maxL;
1795        }
1796        if (matchRegExp(document.thisForm.latmin.value, regExpEmpty) || document.thisForm.latmin.value=='') {
1797                document.thisForm.latmin.value=minL;
1798        }
1799        updateOverview();
1800        return true;
1801}
1802
1803function isDate2(s) {
1804        // Verification de la date
1805        var a1=s.split("/");
1806        var e=true;
1807        if( (a1.length!=3) && (a1[0].length!=4 || a1[1].length!=2 || a1[2].length!=2)) {
1808               e=false;
1809        }else{
1810                var y=a1[0],m=a1[1],d=a1[2];
1811                if (isPositiveInteger(a1[0]) && isPositiveInteger(a1[1]) && isPositiveInteger(a1[2])){
1812                if ( (y<1000)||(y.length>4) )e=false
1813                        if (e) {
1814                                v=new Date(m+"/"+d+"/"+y);
1815                                longdate=y+m+d;
1816                                if (v.getMonth()!=m-1)e=false;
1817                        }
1818                }
1819                else {
1820                       e=false;
1821                }
1822        }
1823       
1824        return e
1825}
1826
1827
1828function isDate(s) {
1829        var a0=s.split("-");
1830        if ((a0.length!=2)){
1831                e=false;
1832        }else{
1833        // Verification de la date
1834                var a1=a0[0].split("/");
1835                var a2=a0[1].split(":");
1836                var e=true;
1837                if( (a1.length!=3) && (a2.length!=4) && (a1[0].length!=4 || a1[1].length!=2 || a1[2].length!=2 || a2[0].length!=2 || a2[1].length!=2 || a2[2
1838].length!=2 || a2[3].length!=3 )){
1839                        e=false;
1840                }else{
1841                        var y=a1[0],m=a1[1],d=a1[2];
1842                        if (isPositiveInteger(a1[0]) && isPositiveInteger(a1[1]) && isPositiveInteger(a1[2])){
1843                                if ( (y<1000)||(y.length>4) )e=false
1844                                if (e) {
1845                                        v=new Date(m+"/"+d+"/"+y);
1846                                        if (v.getMonth()!=m-1)e=false;
1847                                }
1848                        }else{
1849                                e=false;
1850                        }
1851                // Verification de l'heure
1852                        if( e ){
1853                                if (isPositiveInteger(a2[0]) && isPositiveInteger(a2[1]) && isPositiveInteger(a2[2])){
1854                                        var hh=a2[0],mm=a2[1],ss=a2[2],ms=a2[3];
1855                                        if( ms.length<3 )e=false;
1856                                        if (e) {
1857                                                v=new Date(m+"/"+d+"/"+y+" "+hh+":"+mm+":"+ss);
1858                                                longdate=y+m+d+hh+mm+ss+ms;
1859                                                if (v.getMonth()!=m-1)e=false;
1860                                        }
1861                                }else{
1862                                        e=false;
1863                                }
1864                        }
1865                }
1866        }
1867        return e
1868}
1869
1870
1871function isDigit(theDigit)
1872{
1873        var digitArray = new Array('0','1','2','3','4','5','6','7','8','9'),j;
1874
1875        for (j = 0; j < digitArray.length; j++)
1876        {
1877                if (theDigit == digitArray[j])return true
1878        }
1879        return false
1880
1881}
1882
1883function isPositiveInteger(theString){
1884        var theData = new String(theString)
1885
1886        if (!isDigit(theData.charAt(0)))
1887                if (!(theData.charAt(0)== '+'))return false
1888
1889        for (var i = 1; i < theData.length; i++)
1890                if (!isDigit(theData.charAt(i)))return false
1891        return true
1892}
1893
1894function checkDate(minDT,maxDT) {
1895        var minD="";
1896        mindate=document.thisForm.mindate.value;
1897
1898
1899        isDate(minDT);
1900        long_minDT=longdate;
1901
1902        isDate(maxDT);
1903        long_maxDT=longdate;
1904       
1905        if (document.thisForm.file_type_abs!='densite') {       
1906        if( !isDate(mindate) ){
1907                alert("Warning : The format of the Date min is not correct, it should be YYYY/MM/DD-HH:MM:SS:MSC");
1908                document.thisForm.mindate.value=minDT;
1909                return false;
1910        }
1911        longdatemin=longdate;
1912        maxdate=document.thisForm.maxdate.value;
1913        if( !isDate(maxdate) ){
1914                alert("Warning : The format of the Date max is not correct, it should be YYYY/MM/DD-HH:MM:SS:MSC");
1915                document.thisForm.maxdate.value=maxDT;
1916                return false;
1917        }
1918        longdatemax=longdate;
1919        if (parseFloat(longdatemin)<parseFloat(long_minDT)) {
1920                alert("Warning: Date min can not be less than the Date min of the experiment files ("+minDT+")");
1921                document.thisForm.mindate.value=minDT;
1922                return false;
1923        }
1924
1925        if (parseFloat(longdatemax)>parseFloat(long_maxDT)) {
1926                alert("Warning: Date max can not be greater than the Date max of the experiment files ("+maxDT+")");
1927                document.thisForm.maxdate.value=maxDT;
1928                return false;
1929        }
1930
1931        if( parseFloat(longdatemin)>parseFloat(longdatemax) ){
1932                alert("Warning : Date min can not be greater than the Date max");
1933                document.thisForm.maxdate.value=maxDT;
1934                document.thisForm.mindate.value=minDT;
1935                return false;
1936        }
1937       
1938        }
1939
1940        //document.thisForm.mindate.focus();
1941        updateOverview();
1942       
1943        //updateTitle('');
1944        return true;
1945}
1946
1947function checkDate2(minDT,maxDT) {
1948        var minD="";
1949        seldate=document.thisForm.sel_date_time.value;
1950
1951        minDT=minDT.substr(0,10);
1952        maxDT=maxDT.substr(0,10);
1953       
1954        isDate2(minDT);
1955        long_minDT=longdate;
1956
1957        isDate2(maxDT);
1958        long_maxDT=longdate;
1959
1960        if( !isDate2(seldate) ){
1961                alert("Warning : The format of the Date is not correct, it should be YYYY/MM/DD");
1962                document.thisForm.sel_date_time.value=minDT;
1963                return false;
1964        }
1965
1966        longdatetime=longdate;
1967        if (parseFloat(longdatetime)<parseFloat(long_minDT) || parseFloat(longdatetime)>parseFloat(long_maxDT)) {
1968                alert("Warning: Date is out of range. Range : ["+minDT+","+maxDT+"]");
1969                document.thisForm.sel_date_time.value=minDT;
1970                return false;
1971        }
1972
1973        //document.thisForm.mindate.focus();
1974        updateOverview();
1975
1976        //updateTitle('');
1977        return true;
1978}
1979
1980
1981function Newfen (URL,NAME,W,H)
1982{
1983  var wconf = 'scrollbars=yes,toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=yes,width=' + W + ',height=' + H;
1984  var w = window.open (URL, NAME, wconf);
1985
1986}
1987
1988function lancerTrace(type_abs,is_batch) {
1989var ok='0';
1990if (document.thisForm.modei.value=='email') {
1991        if (document.thisForm.email.value!='') ok='1';
1992        else ok='0';
1993}
1994else if (document.thisForm.modei.value=='loginu') {
1995
1996        if (document.thisForm.login.value!='' && document.thisForm.passu.value!='') ok='1';
1997        else if (document.thisForm.email.value!='') ok='1';
1998        else if (document.thisForm.onlydata.value=="1") ok='1';
1999        else ok='0';
2000        ok='1';
2001}
2002
2003if (document.thisForm.modei.value=='none' || document.thisForm.modei.value=='err') {
2004        ok='1';
2005}
2006
2007
2008if (ok=='1') {
2009if ((document.thisForm.sel_par_abs.value=='' || document.thisForm.sel_unit_abs.value=='' || document.thisForm.sel_sspar_abs.value=='' || document.thisForm.sel_par_ord.value=='' || document.thisForm.sel_unit_ord.value=='') && document.thisForm.graph_sel.value!='<%=_2D_TRAJECTORY%>') {
2010        alert("The parameters information are not complete");
2011        return false;
2012}
2013else if (checkObservationHeight(type_abs) && document.thisForm.graph_sel.value!='<%=_2D_TRAJECTORY%>') {
2014        return false;
2015}
2016else if (confirm('Confirm your selection ?')) {
2017        updateTitle('');
2018        document.thisForm.afficheTrace.value="1";
2019        blocForm();
2020}
2021else {
2022        return false;
2023}
2024}
2025else return false;
2026return true;
2027
2028}
2029
2030function openListGraph(mode,appel,graph) {
2031var page='';
2032if (document.thisForm.sel_tpl_name.value!='') {
2033page="list_graphiques.jsp?sel_tpl_name="+document.thisForm.sel_tpl_name.value+"&modef="+mode+"&appel="+appel+"&graph_sel="+graph;
2034//window.blur();
2035Newfen(page,'Graphicslist','800','600');
2036return true;
2037}
2038
2039return false;
2040
2041}
2042
2043function attach() {
2044        var element = document.getElementById('ligne1');
2045        element.setAttribute("class","gros");
2046}
2047
2048function updateUser(rt,n,fn,ib,ip,l,m,sei) {
2049var chaineURL='';
2050var obj=parent.user_info.document.thisForm;
2051//chaineURL='user_info.jsp?rightText='+rt+'&name='+n+'&first_name='+fn+'&email='+e+'&is_batch='+ib+'&is_private='+ip+'&lance='+l;
2052//obj.rightTexte.value=rt;
2053obj.name.value=n;
2054obj.first_name.value=fn;
2055//obj.email.value=e;
2056obj.is_batch.value=ib;
2057obj.is_private.value=ip;
2058obj.lance.value=l;
2059obj.modei.value=m;
2060obj.sel_exp_id.value=sei;
2061
2062obj.submit();
2063               
2064}
2065 
2066//window.onload = attach;
2067</script>
2068</head>
2069<body onLoad="updateUser('<%=rightTexte%>','<%=name%>','<%=first_name%>','<%=is_batch%>','<%=is_private%>','<%=lance%>','<%=modei%>','<%=sel_exp_id%>');updateOverview();lancerMode('<%=pageMode%>','<%=chainePageMode%>'); if (document.thisForm.file_type_abs.value=='densite') {initForm('5');}">
2070<%!
2071boolean isUnitIdentique(String param1, String param2, String isord,send_request req) {
2072
2073String list="";
2074String[] cols1={"cls_acronym"};
2075ArrayList _list1=req.get_list("select cls_acronym from ether.dcp_parameter where par_acronym='"+param1+"' and (isord=2 or isord=1)",cols1);
2076if( _list1==null || _list1.size()<1 ) return false;
2077else {
2078        String[] cols2={"cls_acronym"};
2079        ArrayList _list2=req.get_list("select cls_acronym from ether.dcp_parameter where par_acronym='"+param2+"' and (isord=2 or isord=1)",cols2);
2080        if( _list2==null || _list2.size()<1 ) return false;
2081        else {
2082                if (_list1.get(0).equals(_list2.get(0))) return true;
2083                else return false;
2084        }
2085}
2086}
2087
2088String getTransform(String trf_id,send_request req){
2089        String list="";
2090
2091  String columns[]={"par_orig", "par_acr_orig", "unit_orig", "unit_acr_orig","par_final", "par_acr_final", "unit_final", "unit_acr_final","par_aux0", "par_acr_aux0", "unit_aux0", "unit_acr_aux0","par_aux1", "par_acr_aux1", "unit_aux1", "unit_acr_aux1"};
2092            ArrayList _list=req.get_list(
2093                    "select "+
2094                  "par_orig, "+
2095                    "param0.par_acronym as par_acr_orig, "+
2096                    "unit_orig,  "+
2097                    "unit0.unit_acronym as unit_acr_orig, "+
2098                    "par_final,  "+
2099                    "param3.par_acronym as par_acr_final, "+
2100                    "unit_final, "+
2101                    "unit3.unit_acronym as unit_acr_final, "+
2102                    "par_aux0,  "+
2103                    "param1.par_acronym as par_acr_aux0, "+
2104                    "unit_aux0,  "+
2105                    "unit1.unit_acronym as unit_acr_aux0,  "+
2106                    "par_aux1,  "+
2107                    "param2.par_acronym as par_acr_aux1, "+
2108                    "unit_aux1,  "+
2109                    "unit2.unit_acronym as unit_acr_aux1 "+
2110                    "from  "+
2111                    "ether.dcp_transformation, "+
2112                    "ether.dcp_parameter param0, "+
2113                    "ether.dcp_parameter param1,  "+
2114                    "ether.dcp_parameter param2,  "+
2115                    "ether.dcp_unit unit0,  "+
2116                    "ether.dcp_unit unit1, "+
2117                    "ether.dcp_parameter param3, "+
2118                    "ether.dcp_unit unit2,  "+
2119                    "ether.dcp_unit unit3 "+
2120                    "where  "+
2121                    "param0.par_id = dcp_transformation.par_orig "+
2122                    "and param3.par_id=dcp_transformation.par_final "+
2123                    "and param1.par_id=dcp_transformation.par_aux0 "+
2124                    "and unit0.unit_id=dcp_transformation.unit_orig "+
2125                    "and unit3.unit_id=dcp_transformation.unit_final "+
2126                    "and unit1.unit_id=dcp_transformation.unit_aux0 "+
2127                    "and unit2.unit_id=dcp_transformation.unit_aux1 "+
2128                    "and param2.par_id=dcp_transformation.par_aux1 "+
2129                    "and trf_id= "+trf_id,
2130                    columns);
2131            if( _list==null || _list.size()<1 ){
2132                    return "-1";
2133          }else{
2134                  for(int i=0;i<_list.size();i++)
2135                           list+=_list.get(i).toString()+"%";
2136            }
2137            return list;
2138    }
2139
2140String getCombin(String combin_id,send_request req){
2141        String list="";
2142
2143        String[] cols1={"trf_id"};
2144        ArrayList _list=req.get_list(
2145                "select trf_id from ether.dcp_transf_comb where id="+combin_id+" order by trf_order",
2146                cols1);
2147        if( _list==null || _list.size()<1 ){
2148                return "999";
2149        }else{
2150                for(int i=0;i<_list.size();i++)
2151                        list+=_list.get(i).toString()+"%";
2152        }
2153        return list;
2154}
2155
2156/******************************************************/
2157String convert(String date){
2158String[] ddt=(new stringSplit()).split(date,"-");
2159String[] dates=(new stringSplit()).split(ddt[0],"/");
2160String[] times=(new stringSplit()).split(ddt[1],":");
2161return dates[0]+dates[1]+dates[2]+times[0]+times[1]+times[2];
2162}
2163
2164
2165/*******************************************************/
2166
2167// Traitement des combinaisons de transformations unitaires
2168String treat_cbn(String cbn_id, String sel_tpl_id, int count, String origin_unit, String selected_unit, send_request req){
2169        String varX="", more_varid="", Xtransfo="", AUX0transfo="", AUX1transfo="";
2170        int num_aux0=999, num_aux1=999;
2171// Liste des transformations unitaires \340 appliquer
2172        String list=getCombin(cbn_id,req);
2173        System.err.println(" LIST CBN : "+list);
2174        String[] cblist=(new stringSplit()).split(list,"%");
2175        String mess="",result="";       
2176        int len=cblist.length;
2177        if( cblist[cblist.length-1].equals("") )len=len-1;
2178        mess="";
2179        for(int i=0;i<len;i++){
2180                String trf_id=cblist[i];
2181                boolean testUnit=false;
2182                if(i==cblist.length-1 )testUnit=true;
2183                //mess+="<br>trf_id="+cblist[i]+"->sel_tpl_id="+sel_tpl_id+"->count="+count+"->origin_unit="+origin_unit+"->selected_unit="+selected_unit+"->testUnit="+testUnit;
2184                       
2185                result=treat_trf(trf_id, sel_tpl_id, count, origin_unit, selected_unit, true, testUnit,req);
2186                //mess+="<br>";
2187                //mess+=result;
2188                String[] spl=(new stringSplit()).split(result,"%");
2189
2190                // Seule la variable origine de la 1ere transformation est retenue
2191                if(i==0 ) {
2192                        varX+=spl[0];
2193                       
2194                }
2195                // Ajout d'une commande de transformation en bout de ligne
2196               
2197                if( i>0 ){
2198                               
2199                        Xtransfo=Xtransfo.substring(0,Xtransfo.length()-2)+",";
2200                        //spl[1]=spl[1].substring(9);
2201                }
2202                Xtransfo+=spl[1];
2203                //mess+="@@"+spl[1];
2204                AUX0transfo=spl[2];
2205                AUX1transfo=spl[3];
2206                count=Integer.parseInt(spl[4]);
2207                more_varid+=spl[5];
2208        }
2209
2210       
2211        return varX+"%"+Xtransfo+"%"+AUX0transfo+"%"+AUX1transfo+"%"+count+"%"+more_varid;
2212
2213}
2214
2215
2216// Recherche des fichiers associ\351s au tuple tpl_id
2217String[] scanAssociates(String type, String tpl_id, String file, String rep_data,send_request req) {
2218
2219        String[] retour=null;
2220        String sfile=new File(file).getName();
2221
2222        String columns[]={"type", "command"};
2223        ArrayList _list=req.get_list(
2224                "select * from ether.dcp_associate "+
2225                "where type='"+type+"' and tpl_id="+tpl_id,
2226                columns);
2227        if( _list==null || _list.size()<1 ){
2228                return retour;
2229        }
2230        else{
2231                int nrow=_list.size()/columns.length;
2232                retour=new String[nrow];
2233                int k=0;
2234                for(int j=0;j<nrow;j++){
2235                        String stype=_list.get(k).toString();
2236                        String command=_list.get(k+1).toString();
2237                        String new_command=(new stringReplace(command,"%",sfile)).newstring;
2238                        new_command=(new stringReplace(new_command,"$","'")).newstring;
2239                        String cols[]={"eth_tar_file"};
2240                        String cols1[]={"eth_tar_file", "eth_parameter", "eth_subparameter", "src"};
2241                        ArrayList _list0=null;
2242                        if( type.equals("info" ) )
2243                                _list0=req.get_list(new_command,cols);
2244                        else
2245                                _list0=req.get_list(new_command,cols1);
2246                        if( _list0==null || _list0.size()<1 ){
2247                                retour=null;
2248                                return retour;
2249                        }else{
2250                                if( type.equals("info") )retour[j]=rep_data+_list0.get(0).toString();
2251                                else retour[j]=rep_data+_list0.get(0).toString()+"%"+_list0.get(1).toString()+"%"+_list0.get(2).toString()+"%"+_list0.get(3).toString();
2252
2253                        }
2254                        k+=columns.length;
2255                }
2256        }
2257        return retour;
2258}
2259
2260boolean isDef(String valeur) {
2261        if (valeur==null || valeur.equals("") || valeur.equals("null")) return false;
2262        else return true;
2263}
2264
2265int occurence(String string, String search){
2266        int z=0, zcount=0;
2267        while( true ){
2268                z=string.indexOf(search,z);
2269                if( z>=0 ){
2270                        zcount++;
2271                        z+=search.length();
2272                }else{
2273                        break;
2274                }
2275        }
2276        return zcount;
2277}
2278
2279
2280      String treat_trf(String trf_id, String sel_tpl_id, int count, String origin_unit,
2281                String selected_unit, boolean testUnit0, boolean testUnit1 ,send_request req){
2282                String more_varid="", Xtransfo="", AUX0transfo="", AUX1transfo="";
2283                int num_aux0=999, num_aux1=999;
2284                String list=getTransform(trf_id,req);
2285                String[] tlist=(new stringSplit()).split(list,"%"); //(0:par_id,1:par_acr,2:unit_id,3:unit_acr)
2286               
2287                String natx=getField(sel_tpl_id,"src_acronym",tlist[1],req);
2288                String sspar0=getField(sel_tpl_id,"subvariable",tlist[1],req);
2289               
2290                //return "tlist1="+tlist[1]+"--> natx="+natx;
2291               
2292//                String varX=",{variable:'"+tlist[1]+"', nature:'"+natx+
2293//                        "', subvariable:'.', unite:'"+tlist[3]+"'}";
2294String varX=tlist[1]+","+natx+","+sspar0+","+tlist[3];
2295
2296//              V\351rification de l'unit\351 de la variable origine : est-ce la m\352me que celle requise par la transformation
2297                 String before_trf="";
2298                 if( testUnit0 && !origin_unit.equals(tlist[3]) ){
2299                         String ids=get_conv("acr", origin_unit, tlist[3],req);
2300                         String cnv_id=(new stringSplit()).split(ids,"%")[0];
2301                         before_trf="conv"+cnv_id+",999,999#";
2302                 }
2303//              V\351rification de l'unit\351 de la variable finale / s\351lectionn\351e
2304                 String more_trf="";
2305                 if( testUnit1 && !selected_unit.equals(tlist[7]) ){
2306                         String ids=get_conv("acr", tlist[7], selected_unit,req);
2307                         String cnv_id=(new stringSplit()).split(ids,"%")[0];
2308                         more_trf="#conv"+cnv_id+",999,999";
2309                 }
2310
2311        // Il y a une variable auxiliaire (0)
2312                AUX0transfo="";
2313                if( tlist.length>3 && !tlist[8].equals("999") ){
2314                        String nat=getField(sel_tpl_id,"src_acronym",tlist[9],req);
2315                        String unit_id=getField(sel_tpl_id,"unit_id",tlist[9],req);
2316                        String sspar1=getField(sel_tpl_id,"subvariable",tlist[9],req);
2317                        more_varid+="&"+tlist[9]+","+nat+","+sspar1+","+tlist[11];
2318                        count++;
2319                        num_aux0=count;
2320                // Changement d'unit\351 pour la variable auxiliaire 0
2321                        if( !unit_id.equals("-1") && !unit_id.equals(tlist[10]) ){
2322                                String ids0=get_conv("id", unit_id, tlist[10],req);
2323                                String cnv_id0=(new stringSplit()).split(ids0,"%")[0];
2324                                if( !Xtransfo.equals("") )Xtransfo+=",";
2325                                AUX0transfo="conv"+cnv_id0+",999,999";
2326                        }else{
2327                                AUX0transfo="t999,999,999";
2328                        }
2329                }
2330        // Il y a une autre variable auxiliaire (1)
2331                AUX1transfo="";
2332                if( tlist.length>7 && !tlist[12].equals("999") ){
2333                        String nat=getField(sel_tpl_id,"src_acronym",tlist[13],req);
2334                        String unit_id=getField(sel_tpl_id,"unit_id",tlist[13],req);
2335                        String sspar2=getField(sel_tpl_id,"subvariable",tlist[13],req);
2336                        more_varid+="&"+tlist[13]+","+nat+","+sspar2+","+tlist[15];
2337
2338                        count++;
2339                        num_aux1=count;
2340                // Changement d'unit\351 pour la variable auxiliaire 1
2341                        if( !unit_id.equals("-1") && !unit_id.equals(tlist[14]) ){
2342                                String ids1=get_conv("id", unit_id, tlist[14],req);
2343                                String cnv_id1=(new stringSplit()).split(ids1,"%")[0];
2344
2345                                AUX1transfo="conv"+cnv_id1+",999,999";
2346                        }else{
2347                                AUX1transfo="t999,999,999";
2348                        }
2349                }
2350
2351                Xtransfo=before_trf+"t"+trf_id+","+num_aux0+","+num_aux1+more_trf;
2352//
2353                return varX+"%"+Xtransfo+"%"+AUX0transfo+"%"+AUX1transfo+"%"+count+"%"+more_varid;
2354        }
2355
2356String getField(String tpl_id, String field, String parameter,send_request req){
2357        String list="";
2358        String columns[]={field};
2359        ArrayList _list=req.get_list(
2360                "select "+field+" from ether.dcp_descripteur where (tpl_id="+tpl_id+
2361                " or tpl_id=(select tpl_id from ether.dcp_file_class where associate="+tpl_id+
2362                ")) and par_acronym='"+parameter+"'",columns);
2363        if( _list==null || _list.size()<1 ){
2364                //_list="select "+field+" from ether.dcp_descripteur where (tpl_id="+tpl_id;
2365                //_list+=" or tpl_id=(select tpl_id from ether.dcp_file_class where associate="+tpl_id;
2366                //_list+=")) and par_acronym='"+parameter+"'";
2367                return "-1";
2368        }else{
2369                list=_list.get(0).toString();
2370        }
2371        return list;
2372}
2373
2374
2375
2376
2377String get_conv(String type, String unit_orig, String unit_final,send_request req){
2378String cnv_id="", trf_id="";
2379        String unit_id_orig="", unit_id_final="";
2380        ArrayList _list;
2381        if( type.equals("acr") ){
2382                String columns[]={"unit_id"};
2383                _list=req.get_list(
2384                        "SELECT * FROM ether.dcp_unit where unit_acronym='"+unit_orig+"'",columns);
2385                if( _list==null || _list.size()!=1 ){
2386                        return "-1%-1";
2387                }
2388                unit_id_orig=_list.get(0).toString();
2389                _list=req.get_list(
2390                        "SELECT * FROM ether.dcp_unit where unit_acronym='"+unit_final+"'",columns);
2391                if( _list==null || _list.size()!=1 ){
2392                        return "-1%-1";
2393                }
2394                unit_id_final=_list.get(0).toString();
2395        }else if( type.equals("id") ){
2396                unit_id_orig=unit_orig;
2397                unit_id_final=unit_final;
2398        }
2399        String cols[]={"cnv_id", "trf_id"};
2400        _list=req.get_list(
2401                "SELECT * FROM ether.dcp_conversion where unit_orig="+unit_id_orig+
2402                " and unit_final="+unit_id_final,cols);
2403        if( _list==null || _list.size()!=cols.length ){
2404                return "-1%-1";
2405        }else{
2406                cnv_id=_list.get(0).toString();
2407                trf_id=_list.get(1).toString();
2408        }
2409        return cnv_id+"%"+trf_id;
2410}
2411
2412
2413/**********************************/
2414
2415String file_reader(String sel_tpl_id, send_request req) {
2416
2417String rd_function="";
2418String columns[]={"rd_function"};
2419
2420ArrayList _list=req.get_list("SELECT * from ether.dcp_reader, ether.dcp_file_class where dcp_file_class.rd_acronym=dcp_reader.rd_acronym and tpl_id="+sel_tpl_id,columns);
2421if(_list==null || _list.size()<1 ) return "-1";
2422else rd_function=_list.get(0).toString();
2423
2424return rd_function;
2425}
2426
2427String getValueParam(String nameParam, String defaultValueParam, ServletRequest request) {
2428
2429String var=request.getParameter(nameParam);
2430if (var==null || var.equals("") || var.equals("null")) {
2431        var=defaultValueParam;
2432}
2433
2434return var;
2435}
2436%>
2437<form name="thisForm" method="POST">
2438<table border="0" cellpadding="2" cellspacing="2" width="800">
2439<tr>
2440<td colspan=4>
2441<%@ include file="hidden_values.jsp" %>
2442</td>
2443</tr>
2444<tr>
2445<td>
2446<table border="0" cellpadding="2" cellspacing="2" width="800">
2447<tr><td class='titreN'><b>DATA SETTINGS</b></td></tr>
2448</table>
2449</td>
2450</tr>
2451<tr>
2452<td>
2453<%@ include file="form_data_selection.jsp" %>
2454</td>
2455</tr>
2456
2457<%@ include file="form_parameters.jsp" %>
2458
2459<%@ include file="form_location.jsp" %>
2460
2461<%@ include file="form_ho.jsp" %>
2462
2463<tr><td>&nbsp;</td></tr>
2464<tr>
2465<td>
2466<table border="0" cellpadding="2" cellspacing="2" width="800">
2467<tr><td class='titreN'><b>GRAPHIC SETTINGS</b></td></tr>
2468
2469<%@ include file="form_interpolation.jsp" %>
2470
2471<%@ include file="form_projection.jsp" %>
2472
2473<%@ include file="form_graph_sel.jsp" %>
2474
2475<%@ include file="form_legends.jsp" %>
2476
2477</table>
2478</form>
2479</body>
2480</form>
2481</html>
2482
Note: See TracBrowser for help on using the repository browser.