1 | <script type="text/javascript"> |
---|
2 | var InterfaceC = Class.create( { |
---|
3 | |
---|
4 | initialize: function() |
---|
5 | { |
---|
6 | // Container |
---|
7 | this.generalContainerResults = $( "containerResults" ); |
---|
8 | this.generalContainerResult = $( "containerResult" ); |
---|
9 | this.containerSelect = $( 'containerSelect' ); |
---|
10 | this.containerCalendar = $( "containerCalendar" ); |
---|
11 | this.containerRadio = $( 'containerRadio' ); |
---|
12 | |
---|
13 | /** *********** LOADING *********** **/ |
---|
14 | // Create loading object for plateforms |
---|
15 | var param = new Object(); |
---|
16 | param.id = "loadingForContent"; |
---|
17 | param.parent = this.generalContainerResults; |
---|
18 | this.loadingPlateforms = new Loading( param ); |
---|
19 | this.loadingPlateforms.hide(); |
---|
20 | |
---|
21 | /** *********** CREATE *********** **/ |
---|
22 | this.createSelect(); |
---|
23 | this.createRadio(); |
---|
24 | this.createCalendar(); |
---|
25 | |
---|
26 | /** *********** BUTTON *********** **/ |
---|
27 | this.addPlotButton = new Button( {value:"Download", parent:this.generalContainerResults, id:"button_download", onClick:this.onClickDownload.bind( this )} ); |
---|
28 | this.addPlotButton.enable(); |
---|
29 | }, |
---|
30 | |
---|
31 | // DISPLAYS ******************************************************** |
---|
32 | createSelect: function() |
---|
33 | { |
---|
34 | var paramSelect = new Object(); |
---|
35 | paramSelect.id = "selectStations"; |
---|
36 | paramSelect.parent = this.containerSelect; |
---|
37 | this.selectStations = new Select( paramSelect ); |
---|
38 | this.selectStations.add( "0", "station 0", this.onClickSelect.bind( this ) ); |
---|
39 | this.selectStations.add( "1", "station 1", this.onClickSelect.bind( this ) ); |
---|
40 | this.selectStations.add( "2", "station 2", this.onClickSelect.bind( this ) ); |
---|
41 | this.selectStations.selectFirst(); |
---|
42 | }, |
---|
43 | |
---|
44 | createRadio: function() |
---|
45 | { |
---|
46 | var paramRadio = new Object(); |
---|
47 | paramRadio.id = "radios"; |
---|
48 | paramRadio.parent = this.containerRadio; |
---|
49 | this.radio = new Radio( paramRadio ); |
---|
50 | this.radio.add( "P", "Profil", this.onClicKRadio.bind( this ) ); |
---|
51 | this.radio.add( "C", "Column", this.onClicKRadio.bind( this ) ); |
---|
52 | }, |
---|
53 | |
---|
54 | createCalendar: function() |
---|
55 | { |
---|
56 | this.calendarFormat = "%Y-%m-%d %H:%i"; |
---|
57 | this.calendarConverter = new AnyTime.Converter( { format: this.calendarFormat } ); |
---|
58 | |
---|
59 | AnyTime.picker( "beginDate", { format: this.calendarFormat, firstDOW: 1, |
---|
60 | labelTitle: "Select a date", labelYear: "Select a year", labelMonth: "Select a month", labelDayOfMonth: "Select a day", |
---|
61 | labelHour: "Select an hour", labelMinute: "Select a minute", |
---|
62 | methodToCall: this.onClickDate.bindAsEventListener( this ) |
---|
63 | } ); |
---|
64 | |
---|
65 | this.clearCalendarButton = new Button( {value:"Clear", parent:this.containerCalendar, id:"button_clear_calendar", className:"small", onClick:this.onClickClear.bind( this )} ); |
---|
66 | }, |
---|
67 | |
---|
68 | // EVENTS ******************************************************** |
---|
69 | onClickSelect: function() |
---|
70 | { |
---|
71 | this.generalContainerResult.innerHTML += this.selectStations.getName(); |
---|
72 | }, |
---|
73 | |
---|
74 | onClickDate: function() |
---|
75 | { |
---|
76 | this.beginDate = this.calendarConverter.parse( $( "beginDate" ).value ).getTime(); |
---|
77 | this.generalContainerResult.innerHTML += this.beginDate; |
---|
78 | this.generalContainerResult.innerHTML += $( "beginDate" ).value; |
---|
79 | }, |
---|
80 | |
---|
81 | onClickClear: function() |
---|
82 | { |
---|
83 | $( "beginDate" ).value = ""; |
---|
84 | this.beginDate = false; |
---|
85 | }, |
---|
86 | |
---|
87 | onClicKRadio: function() |
---|
88 | { |
---|
89 | this.generalContainerResult.innerHTML += this.radio.getName(); |
---|
90 | }, |
---|
91 | |
---|
92 | onClickDownload: function() |
---|
93 | { |
---|
94 | this.loadingPlateforms.display(); |
---|
95 | } |
---|
96 | } ); |
---|
97 | |
---|
98 | </script> |
---|