[kronolith] feature request

Jan Schneider janmailing@gmx.de
Thu, 31 May 2001 01:25:35 +0200


---------------------- multipart/mixed attachment
And here it is.

Jan.

Zitat von Chuck Hagenbuch <chuck@horde.org>:

> Quoting Jan Kuipers <jrkuipers@lauwerscollege.nl>:
> 
> > Is it possible to switch between PM/AM and 24-hour timeindication in
> > Kronolith?
> 
> You can now use $prefs->getValue('24hr') to determine if the user wants to
> see 
> 24 hour times in Kronolith. If you want to submit a patch that uses this and
> 
> modifies the interface accordingly, that'd be great! I'll put it on my todo
> 
> list, but no idea when I can get to it.
> 
> -chuck
> 
> --
> Charles Hagenbuch, <chuck@horde.org>
> Black and white and grey, all the shades of truth.
> 
> -- 
> Kronolith mailing list: http://horde.org/kronolith/
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: kronolith-unsubscribe@lists.horde.org
> 
> 


::::::::::::::::::::::::::::::::::::::::
AMMMa AG - discover your knowledge
:::::::::::::::::::::::::::
Detmolder Str. 25-33 :: D-33604 Bielefeld
fon +49.521.96878-0 :: fax  +49.521.96878-20
http://www.ammma.de
::::::::::::::::::::::::::::::::::::::::::::::
---------------------- multipart/mixed attachment
Index: lib/DayView.php
===================================================================
RCS file: /cvs/horde/kronolith/lib/DayView.php,v
retrieving revision 1.35
diff -u -r1.35 DayView.php
--- lib/DayView.php	2001/03/27 19:25:48	1.35
+++ lib/DayView.php	2001/05/30 23:21:49
@@ -28,7 +28,10 @@
     }
     
     
-    function html ($template_path = './templates') {
+    function html ($template_path = './templates') 
+    {
+        global $prefs;
+        
         if (!$this->parsed) {
             $this->parse();
         }
@@ -47,7 +50,7 @@
             $hspan = 0;
             $row_set = false;
             $current = 0;
-            $time = date('g:ia', $hours[$i]['timestamp']);
+            $time = date(($prefs->getValue('24hr')) ? 'G:i' : 'g:ia', $hours[$i]['timestamp']);
             $style = (floor($i/2) % 2) ? 'item1' : 'item0';
         
             if (count($current_arr) > 0) {
Index: lib/WeekView.php
===================================================================
RCS file: /cvs/horde/kronolith/lib/WeekView.php,v
retrieving revision 1.6
diff -u -r1.6 WeekView.php
--- lib/WeekView.php	2001/03/27 20:12:32	1.6
+++ lib/WeekView.php	2001/05/30 23:21:49
@@ -52,6 +52,8 @@
     
     function html($template_path = './templates')
     {
+        global $prefs;
+        
         if (!$this->parsed) {
             $this->parse();
         }
@@ -76,7 +78,7 @@
             
             $started = true;
             $row = '';
-            $time = date('g:ia', $hours[$i]['timestamp']);
+            $time = date(($prefs->getValue('24hr')) ? 'G:i' : 'g:ia', $hours[$i]['timestamp']);
             $style = (floor($i/2) % 2) ? 'item1' : 'item0';
             
             for ($j = $this->startDay; $j <= $this->endDay; $j++) {
Index: lib/Driver/mcal.php
===================================================================
RCS file: /cvs/horde/kronolith/lib/Driver/mcal.php,v
retrieving revision 1.9
diff -u -r1.9 mcal.php
--- lib/Driver/mcal.php	2001/05/30 15:23:32	1.9
+++ lib/Driver/mcal.php	2001/05/30 23:21:49
@@ -148,6 +148,8 @@
     
     function readFormData($eventData)
     {
+        global $prefs;
+        
         // basic fields
         if (isset($eventData['title'])) {
             mcal_event_set_title($this->driver->stream, Horde::dispelMagicQuotes($eventData['title']));
@@ -171,12 +173,15 @@
             && isset($eventData['start_day'])
             && isset($eventData['start_hour'])
             && isset($eventData['start_min'])
-            && isset($eventData['am_pm'])) {
-            if ($eventData['am_pm'] == 'PM') {
-                if ($eventData['start_hour'] != 12)
-                    $eventData['start_hour'] += 12;
-            } elseif ($eventData['start_hour'] == 12) {
-                $eventData['start_hour'] = 0;
+            && (isset($eventData['am_pm'])
+            || ($prefs->getValue('24hr')))) {
+            if (!$prefs->getValue('24hr')) {
+                if ($eventData['am_pm'] == 'PM') {
+                    if ($eventData['start_hour'] != 12)
+                        $eventData['start_hour'] += 12;
+                } elseif ($eventData['start_hour'] == 12) {
+                    $eventData['start_hour'] = 0;
+                }
             }
             mcal_event_set_start($this->driver->stream,
                                  $eventData['start_year'],
Index: templates/edit/edit.inc
===================================================================
RCS file: /cvs/horde/kronolith/templates/edit/edit.inc,v
retrieving revision 1.18
diff -u -r1.18 edit.inc
--- templates/edit/edit.inc	2001/04/13 17:46:48	1.18
+++ templates/edit/edit.inc	2001/05/30 23:21:49
@@ -149,8 +149,10 @@
 <td class="item<?=($_i++ % 2)?>" align="left">
 <select name="start_hour">
 <?php
-$start_hour_match = $event->getStartDate('g');
-for ($i=1; $i<13; $i++) {
+$start_hour_match = $event->getStartDate(($prefs->getValue('24hr')) ? 'G' : 'g');
+$hour_min = ($prefs->getValue('24hr')) ? 0 : 1;
+$hour_max = ($prefs->getValue('24hr')) ? 25 : 13;
+for ($i=$hour_min; $i<$hour_max; $i++) {
     $sel = '';
     if ($i == $start_hour_match)
         $sel = ' selected="selected"';
@@ -172,15 +174,17 @@
 ?>
 </select>
 <?php
-if ($event->getStartDate('a') == 'am') {
-    $am = ' checked="checked"';
-    $pm = '';
-} else {
-    $am = '';
-    $pm = ' checked="checked"';
-}
+if (!$prefs->getValue('24hr')) {
+    if ($event->getStartDate('a') == 'am') {
+        $am = ' checked="checked"';
+        $pm = '';
+    } else {
+        $am = '';
+        $pm = ' checked="checked"';
+    }
 ?>
 <input type="radio" name="am_pm" value="AM"<?= $am ?>>AM <input type="radio" name="am_pm" value="PM"<?= $pm ?>>PM
+<?php } ?>
 </td>
 </tr>
 

---------------------- multipart/mixed attachment--