1 | <!-- $Id$ --> |
---|
2 | [% poll = c.model('Vote').poll(voteid) %] |
---|
3 | |
---|
4 | [% INCLUDE 'includes/admin_menu.tt' %] |
---|
5 | |
---|
6 | <script> |
---|
7 | var cal1, cal2, newStyleSheet; |
---|
8 | |
---|
9 | var dateFrom = null; |
---|
10 | var dateTo = null; |
---|
11 | dhtmlxCalendarLangModules = new Array(); |
---|
12 | |
---|
13 | dhtmlxCalendarLangModules['locale'] = { |
---|
14 | langname: 'fr', |
---|
15 | dateformat: '%d/%m/%Y', |
---|
16 | monthesFNames: [ |
---|
17 | "[% l('January') %]", |
---|
18 | "[% l('February') %]", |
---|
19 | "[% l('March') %]", |
---|
20 | "[% l('April') %]", |
---|
21 | "[% l('May') %]", |
---|
22 | "[% l('June') %]", |
---|
23 | "[% l('July') %]", |
---|
24 | "[% l('August') %]", |
---|
25 | "[% l('September') %]", |
---|
26 | "[% l('October') %]", |
---|
27 | "[% l('November') %]", |
---|
28 | "[% l('December') %]" |
---|
29 | ], |
---|
30 | monthesSNames: [ |
---|
31 | "[% l('Jan') %]", |
---|
32 | "[% l('Feb') %]", |
---|
33 | "[% l('Mar') %]", |
---|
34 | "[% l('Apr') %]", |
---|
35 | "[% l('May') %]", |
---|
36 | "[% l('Jun') %]", |
---|
37 | "[% l('Jul') %]", |
---|
38 | "[% l('Aug') %]", |
---|
39 | "[% l('Sep') %]", |
---|
40 | "[% l('Oct') %]", |
---|
41 | "[% l('Nov') %]", |
---|
42 | "[% l('Dec') %]"], |
---|
43 | daysFNames: [ |
---|
44 | "[% l('Sunday') %]", |
---|
45 | "[% l('Monday') %]", |
---|
46 | "[% l('Tuesday') %]", |
---|
47 | "[% l('Wenesday') %]", |
---|
48 | "[% l('Thursday') %]", |
---|
49 | "[% l('Friday') %]", |
---|
50 | "[% l('Saturday') %]"], |
---|
51 | daysSNames: [[%l('"S", "M", "T", "W", "T", "F", "S"') %]], |
---|
52 | weekend: [0, 6], |
---|
53 | weekstart: 1, |
---|
54 | msgClose: "[% l('Close') %]", |
---|
55 | msgMinimize: "[% l('Minimize') %]", |
---|
56 | msgToday: "[% l('Today') %]", |
---|
57 | } |
---|
58 | |
---|
59 | window.onload = function () { |
---|
60 | cal1 = new dhtmlxCalendarObject('calendar1'); |
---|
61 | cal1.setYearsRange(2000, 2500); |
---|
62 | cal1.setOnClickHandler(selectDate1); |
---|
63 | cal1.setDateFormat('%d/%m/%Y'); |
---|
64 | cal1.loadUserLanguage('locale'); |
---|
65 | if (document.getElementById('calInput1').value != '') { |
---|
66 | cal1.setDate(document.getElementById('calInput1').value); |
---|
67 | } |
---|
68 | cal2 = new dhtmlxCalendarObject('calendar2'); |
---|
69 | cal2.setOnClickHandler(selectDate2); |
---|
70 | cal2.setDateFormat('%d/%m/%Y'); |
---|
71 | cal2.loadUserLanguage('locale'); |
---|
72 | if (document.getElementById('calInput2').value != '') { |
---|
73 | cal2.setDate(document.getElementById('calInput2').value); |
---|
74 | } |
---|
75 | } |
---|
76 | |
---|
77 | function selectDate1(date) { |
---|
78 | document.getElementById('calInput1').value = cal1.getFormatedDate(null,date); |
---|
79 | document.getElementById('calendar1').style.display = 'none'; |
---|
80 | dateFrom = new Date(date); |
---|
81 | return true; |
---|
82 | } |
---|
83 | function selectDate2(date) { |
---|
84 | document.getElementById('calInput2').value = cal2.getFormatedDate(null,date); |
---|
85 | document.getElementById('calendar2').style.display = 'none'; |
---|
86 | dateTo = new Date(date); |
---|
87 | return true; |
---|
88 | } |
---|
89 | |
---|
90 | function showCalendar(k) { |
---|
91 | if (document.getElementById('calendar'+k).style.display == 'none') { |
---|
92 | document.getElementById('calendar'+k).style.display = 'block'; |
---|
93 | } else { |
---|
94 | document.getElementById('calendar'+k).style.display = 'none'; |
---|
95 | } |
---|
96 | } |
---|
97 | |
---|
98 | function updatecal() { |
---|
99 | var newval1 = document.getElementById('calInput1').value; |
---|
100 | var newval2 = document.getElementById('calInput2').value; |
---|
101 | cal1.setDate(newval1); |
---|
102 | cal2.setDate(newval2); |
---|
103 | } |
---|
104 | |
---|
105 | </script> |
---|
106 | |
---|
107 | [% IF poll.status == 'BEFORE' %] |
---|
108 | <div class="box" style="float: left; width: 55%;"> |
---|
109 | |
---|
110 | <form action="[% c.uri_for(poll.uid, 'date') %]" method="POST" id="dateform"> |
---|
111 | |
---|
112 | <i>[% l('Date format is') _ ' ' %] [% l('DD/MM/YYYY HH:MM:SS') %]</i><br> |
---|
113 | [% IF dateerror %]<p class="alert">[% dateerror | html %]</p>[% END %] |
---|
114 | |
---|
115 | [% l('Poll start:') %]<br> |
---|
116 | [% l('date:') %] |
---|
117 | |
---|
118 | <input type="text" id="calInput1" name="dstart" value="[% c.req.param('dstart') |
---|
119 | || poll.info('dstart') | html %]" onkeyup="updatecal()"> |
---|
120 | <img style="cursor:pointer;" onClick="showCalendar(1)" src="[% c.uri_for('/static/dhtmlxCalendar/imgs', 'calendar.gif') %]" align="absmiddle"><div id="calendar1" style="position:absolute; left:199px; top:0px; display:none"></div> |
---|
121 | |
---|
122 | [% l('time:') %] <input type="text" size=9 name="hstart" value="[% c.req.param('hstart') || poll.info('hstart') || '8:00' | html %]"> |
---|
123 | <br> |
---|
124 | [% l('Poll end:') %]<br> |
---|
125 | [% l('date:') %] |
---|
126 | |
---|
127 | <input type="text" id="calInput2" name="dend" value="[% c.req.param('dend') || |
---|
128 | poll.info('dend') | html %]" onkeyup="updatecal()"> |
---|
129 | <img style="cursor:pointer;" onClick="showCalendar(2)" src="[% c.uri_for('/static/dhtmlxCalendar/imgs', 'calendar.gif') %]" align="absmiddle"><div id="calendar2" style="position:absolute; left:199px; top:0px; display:none"></div> |
---|
130 | |
---|
131 | [% l('time:') %] <input type="text" size=9 name="hend" value="[% c.req.param('hend') || poll.info('hend') || '18:00' | html %]"> |
---|
132 | <br> |
---|
133 | |
---|
134 | <hr> |
---|
135 | [% c.prototype.observe_form('dateform', |
---|
136 | url => c.uri_for('/ajax', 'datecheck'), |
---|
137 | update => 'datesub', |
---|
138 | frequency => 2, |
---|
139 | ) %] |
---|
140 | <div id="datesub"></div> |
---|
141 | </form> |
---|
142 | </div> |
---|
143 | |
---|
144 | [% ELSE %] |
---|
145 | [% END %] |
---|
146 | |
---|
147 | <div style="clear: both"></div> |
---|