source: tapas/web/project/formTapas_script.jsp @ 401

Last change on this file since 401 was 401, checked in by vmipsl, 12 years ago

Request id --> Long

File size: 5.8 KB
Line 
1<script type="text/javascript">
2    var InterfaceTapas = Class.create( {
3
4        initialize: function()
5        {
6            /** *********** CONTAINERS *********** **/
7            this.containerForm = $( "#formulaire" );
8
9            this.createForm();
10
11        },
12
13        // CREATES ********************************************************
14        createForm: function()
15        {
16            // Create button elements
17            this.input1 = $( document.createElement( "input" ) );
18            var input2 = $( document.createElement( "input" ) );
19
20            this.input1.attr( {id:"1"} );
21            this.containerForm.append( this.input1 );
22
23            input2.attr( {id:"2"} );
24            this.containerForm.append( input2 );
25
26            var submitButton = new Button( {value:initTexts["label.submitButton"], parent:this.containerForm, id:"button_submit", className: "red_button", classNameText:"red_button_text", onClick:jQuery.proxy( this.onClickSubmit, this )} );
27
28        },
29
30        // REQUESTS ********************************************************
31        requestCreateXML: function()
32        {
33            var tapasForm = this.createTapasForm();
34            var jsonTapasForm = $.toJSON( tapasForm );
35
36            if( jsonTapasForm )
37                $.ajax( {
38                    url: "project?methodName=createUserRequest&jsonTapas=" + jsonTapasForm,
39                    success:jQuery.proxy( this.handleCreateXML, this )
40                } );
41        },
42
43        // HANDLES ******************************************************** = retours ajax
44        handleCreateXML: function( result )
45        {
46            var bob = jQuery.parseJSON( result ).result;
47//            alert( bob );
48        },
49
50
51        // EVENTS ********************************************************
52        onClickSubmit: function()
53        {
54            this.requestCreateXML();
55        },
56
57        // OTHERS ********************************************************
58        createTapasForm: function()
59        {
60            // PREFERENCE
61            var preference = new Object();
62
63            preference.format = new Object();
64            preference.format.firstValue = $( "#1" ).val();
65            preference.format.secondValue = $( "#2" ).val();
66
67            var pair = new Object();
68            pair.firstValue = "YES,NO";
69            pair.secondValue = "YES";
70
71            preference.rayleighExtinction = pair;
72            preference.h2oExtinction = pair;
73            preference.o3Extinction = pair;
74            preference.o2Extinction = pair;
75            preference.co2Extinction = pair;
76
77            // OBSERVATION
78            // Observatory
79            var observatory = new Object();
80            observatory.name = "SanFernandoObs.RSanFernando";
81
82            observatory.longitude = new Object();
83            observatory.longitude.min = "-180";
84            observatory.longitude.max = "180";
85            observatory.longitude.value = -118.491666666667;
86
87            observatory.latitude = new Object();
88            observatory.latitude.min = "-90";
89            observatory.latitude.max = "90";
90            observatory.latitude.value = 34.3083333333333;
91
92            observatory.altitude = new Object();
93            observatory.altitude.min = "0";
94            observatory.altitude.max = "10000";
95            observatory.altitude.value = 371;
96
97            // Los
98            var los = new Object();
99            los.raJ2000 = "04:32:43";
100            los.decJ2000 = "-43:12:10.22";
101
102            los.zenithAngle = new Object();
103            los.zenithAngle.min = "0";
104            los.zenithAngle.max = "90";
105            los.zenithAngle.value = 60;
106
107            // Instrument
108            var instrument = new Object();
109
110            instrument.spectralChoice = new Object();
111            instrument.spectralChoice.firstValue = "Vacuum Wavelength (nm),Standard Wavelength (nm),Wavenumber (cm-1)";
112            instrument.spectralChoice.secondValue = "Standard Wavelength (nm)";
113            instrument.spectralRange = "1180 1200";
114            instrument.ilsfChoice = new Object();
115            instrument.ilsfChoice.firstValue = "-1,0,1";
116            instrument.ilsfChoice.secondValue = 0;
117            instrument.ilsfPath = "/home/ferron/tmp/tapas/ilsf.txt";
118            instrument.resolvingPower = new Object();
119            instrument.resolvingPower.firstValue = "0";
120            instrument.resolvingPower.secondValue = 1000000;
121            instrument.samplingRatio = new Object();
122            instrument.samplingRatio.firstValue = "0";
123            instrument.samplingRatio.secondValue = 3;
124
125            var observation = new Object();
126            observation.date = "2012-02-24";
127            observation.observatory = observatory;
128            observation.los = los;
129            observation.instrument = instrument;
130
131            // ATMOSPHERE
132            var atmosphere = new Object();
133            atmosphere.reference = new Object();
134            atmosphere.reference.firstValue = "0,1,2,3,4,5,6";
135            atmosphere.reference.secondValue = 6;
136
137            atmosphere.arlettyFile = new Array();
138            atmosphere.arlettyFile[0] = "/home/ferron/tmp/tapas/Reims_070402.ARL.txt";
139            atmosphere.arlettyFile[1] = "/home/ferron/tmp/tapas/Reims_070402.ARL.txt22";
140
141            atmosphere.ecmwfFile = new Array();
142            atmosphere.ecmwfFile[0] = "/home/ferron/tmp/tapas/ecmwf12.txt";
143
144            // REQUEST
145            var request = new Object();
146            request.id = 1;
147            request.preference = preference;
148            request.observation = observation;
149            request.atmosphere = atmosphere;
150
151            var requests = new Array();
152            requests[0] = request;
153
154            // TAPAS
155            var tapas = new Object();
156            tapas.id = "Ether_TAPAS_0000001";
157            tapas.requests = requests;
158
159            return tapas;
160        }
161
162    } );
163
164
165</script>
Note: See TracBrowser for help on using the repository browser.