Umgestellt auf JQueryUI-Datepicker
Bernd Wurst

Bernd Wurst commited on 2014-02-08 04:09:28
Zeige 3 geänderte Dateien mit 48 Einfügungen und 11 Löschungen.

... ...
@@ -182,5 +182,44 @@ $(document).ready(function(){
182 182
   $('#more_forwards').click(moreForward);
183 183
 
184 184
   $('div.vmail-forward input').on("change keyup paste", checkForward);
185
+
186
+
187
+  $.datepicker.regional['de'] = {clearText: 'löschen', clearStatus: 'aktuelles Datum löschen',
188
+                closeText: 'schließen', closeStatus: 'ohne Änderungen schließen',
189
+                prevText: '< zurück', prevStatus: 'letzten Monat zeigen',
190
+                nextText: 'vor >', nextStatus: 'nächsten Monat zeigen',
191
+                currentText: 'heute', currentStatus: '',
192
+                monthNames: ['Januar','Februar','März','April','Mai','Juni',
193
+                'Juli','August','September','Oktober','November','Dezember'],
194
+                monthNamesShort: ['Jan','Feb','Mär','Apr','Mai','Jun',
195
+                'Jul','Aug','Sep','Okt','Nov','Dez'],
196
+                monthStatus: 'anderen Monat anzeigen', yearStatus: 'anderes Jahr anzeigen',
197
+                weekHeader: 'Wo', weekStatus: 'Woche des Monats',
198
+                dayNames: ['Sonntag','Montag','Dienstag','Mittwoch','Donnerstag','Freitag','Samstag'],
199
+                dayNamesShort: ['So','Mo','Di','Mi','Do','Fr','Sa'],
200
+                dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'],
201
+                dayStatus: 'Setze DD als ersten Wochentag', dateStatus: 'Wähle D, M d',
202
+                dateFormat: 'dd.mm.yy', firstDay: 1, 
203
+                initStatus: 'Wähle ein Datum', isRTL: false};
204
+  $.datepicker.setDefaults( $.datepicker.regional[ "de" ] );
205
+  $.datepicker.setDefaults({
206
+    dateFormat: 'yy-mm-dd',
207
+    minDate: 1,
208
+    maxDate: "+3y"
209
+
210
+    });
211
+
212
+  $('#ar_startdate').datepicker();
213
+  $('#ar_startdate').change(function () {
214
+    $('#ar_valid_from_date').attr('checked', true)
215
+    $('#ar_enddate').datepicker("option", "minDate", $('#ar_startdate').val());
185 216
     });
186 217
 
218
+  $('#ar_enddate').datepicker();
219
+  $('#ar_enddate').datepicker("option", "minDate", $('#ar_startdate').val());
220
+  $('#ar_enddate').change(function () {
221
+    $('#ar_valid_until_date').attr('checked', true)
222
+    });
223
+});
224
+
225
+
... ...
@@ -134,8 +134,8 @@ if (! $startdate || $startdate <= date('Y-m-d')) {
134 134
   $startdate = date('Y-m-d', time() + 1*24*60*60);
135 135
 }
136 136
 $form .= "<p><input type=\"radio\" name=\"ar_valid_from\" value=\"now\" id=\"ar_valid_from_now\"{$valid_from_now_checked} /> <label for=\"ar_valid_from_now\">Ab sofort</label><br />".
137
-  "<input type=\"radio\" name=\"ar_valid_from\" value=\"future\" id=\"ar_valid_from_future\"{$valid_from_future_checked} /> <label for=\"ar_valid_from_future\">Erst ab dem </label>".
138
-  html_datepicker("ar_valid_from", strtotime($startdate))."</p>";
137
+  "<input type=\"radio\" name=\"ar_valid_from\" value=\"date\" id=\"ar_valid_from_date\"{$valid_from_future_checked} /> <label for=\"ar_valid_from_date\">Erst ab dem </label>".
138
+  "<input type=\"text\" value=\"$startdate\" id=\"ar_startdate\" name=\"ar_startdate\" /></p>";
139 139
 
140 140
 $valid_until_infinity_checked = ($ar['valid_until'] == NULL) ? ' checked="checked"' : '';
141 141
 $valid_until_date_checked = ($ar['valid_until'] != NULL) ? ' checked="checked"' : '';
... ...
@@ -146,7 +146,7 @@ if (! $enddate) {
146 146
 $form .= "<h4>Deaktivierung</h4>";
147 147
 $form .= "<p><input type=\"radio\" name=\"ar_valid_until\" value=\"infinity\" id=\"ar_valid_until_infinity\"{$valid_until_infinity_checked} /> <label for=\"ar_valid_until_infinity\">Unbefristet</label><br />".
148 148
   "<input type=\"radio\" name=\"ar_valid_until\" value=\"date\" id=\"ar_valid_until_date\"{$valid_until_date_checked} /> <label for=\"ar_valid_until_date\">Keine Antworten mehr versenden ab dem </label>".
149
-  html_datepicker("ar_valid_until", strtotime($enddate))."</p>";
149
+  "<input type=\"text\" value=\"$enddate\" id=\"ar_enddate\" name=\"ar_enddate\" /></p>";
150 150
 
151 151
 
152 152
 $subject = filter_input_general($ar['subject']);
... ...
@@ -80,12 +80,11 @@ if ($_GET['action'] == 'edit')
80 80
   if (isset($_POST['ar_valid_from']) && ($_POST['ar_valid_from'] == 'now')) {
81 81
     $valid_from_date = time();
82 82
   } else {
83
-    if (isset($_POST['ar_valid_from_day']) && isset($_POST['ar_valid_from_month']) && isset($_POST['ar_valid_from_year'])) {
84
-      $tmpdate = $_POST['ar_valid_from_year'].'-'.$_POST['ar_valid_from_month'].'-'.$_POST['ar_valid_from_day'];
85
-      if (date('Y-n-j', strtotime($tmpdate)) != $tmpdate) {
83
+    if (isset($_POST['ar_startdate'])) {
84
+      if (date('Y-m-d', strtotime($_POST['ar_startdate'])) != $_POST['ar_startdate']) {
86 85
         system_failure('Das Aktivierungs-Datum scheint ungültig zu sein.');
87 86
       } else {
88
-        $valid_from_date = strtotime($tmpdate);
87
+        $valid_from_date = strtotime($_POST['ar_startdate']);
89 88
       }
90 89
     }
91 90
   }
... ...
@@ -99,12 +98,11 @@ if ($_GET['action'] == 'edit')
99 98
   if (isset($_POST['ar_valid_until']) && ($_POST['ar_valid_until'] == 'infinity')) {
100 99
     $valid_until_date = NULL;
101 100
   } else {
102
-    if (isset($_POST['ar_valid_until_day']) && isset($_POST['ar_valid_until_month']) && isset($_POST['ar_valid_until_year'])) {
103
-      $tmpdate = $_POST['ar_valid_until_year'].'-'.$_POST['ar_valid_until_month'].'-'.$_POST['ar_valid_until_day'];
104
-      if (date('Y-n-j', strtotime($tmpdate)) != $tmpdate) {
101
+    if (isset($_POST['ar_enddate'])) {
102
+      if (date('Y-m-d', strtotime($_POST['ar_enddate'])) != $_POST['ar_enddate']) {
105 103
         system_failure('Das Deaktivierungs-Datum scheint ungültig zu sein.');
106 104
       } else {
107
-        $valid_until_date = strtotime($tmpdate);
105
+        $valid_until_date = strtotime($_POST['ar_enddate']);
108 106
       }
109 107
     }
110 108
   }
111 109