Move portal block configuration from prefs to block params.
authorJan Schneider <jan@horde.org>
Fri, 19 Jun 2009 15:48:41 +0000 (17:48 +0200)
committerJan Schneider <jan@horde.org>
Fri, 19 Jun 2009 15:48:41 +0000 (17:48 +0200)
kronolith/config/prefs.php.dist
kronolith/lib/Block/monthlist.php
kronolith/lib/Block/prevmonthlist.php
kronolith/lib/Block/summary.php

index b062e00..5e31eb9 100644 (file)
@@ -17,13 +17,6 @@ $prefGroups['view'] = array(
                        'show_shared_side_by_side'),
 );
 
-$prefGroups['summary'] = array(
-    'column' => _("Display Options"),
-    'label' => _("Portal Options"),
-    'desc' => _("Select which events to show in the portal."),
-    'members' => array('summary_days', 'summary_alarms'),
-);
-
 $prefGroups['share'] = array(
     'column' => _("Calendars"),
     'label' => _("Default Calendar"),
@@ -233,35 +226,6 @@ $_prefs['show_shared_side_by_side'] = array(
     'desc' => _("Show shared calendars side-by-side?"),
 );
 
-// days to show in summary
-$_prefs['summary_days'] = array(
-    'value' => 7,
-    'locked' => false,
-    'shared' => false,
-    'type' => 'enum',
-    'desc' => _("Select the time span to show:"),
-    'enum' => array(1 => '1 ' . _("day"),
-                    2 => '2 ' . _("days"),
-                    3 => '3 ' . _("days"),
-                    4 => '4 ' . _("days"),
-                    5 => '5 ' . _("days"),
-                    6 => '6 ' . _("days"),
-                    7 => '1 ' . _("week"),
-                    14 => '2 ' . _("weeks"),
-                    21 => '3 ' . _("weeks"),
-                    28 => '4 ' . _("weeks"),
-    ),
-);
-
-// show alarms in summary?
-$_prefs['summary_alarms'] = array(
-    'value' => 0,
-    'locked' => false,
-    'shared' => false,
-    'type' => 'checkbox',
-    'desc' => _("Show only events that have an alarm set?"),
-);
-
 // default calendar selection widget
 $_prefs['shareselect'] = array('type' => 'special');
 
index a108c42..9bf66cf 100644 (file)
@@ -26,7 +26,10 @@ class Horde_Block_Kronolith_monthlist extends Horde_Block {
                                             'default' => 2),
                         'maxevents' => array('name' => _("Maximum number of events to display (0 = no limit)"),
                                              'type' => 'int',
-                                             'default' => 0));
+                                             'default' => 0),
+                        'alarms' => array('name' => _("Show only events that have an alarm set?"),
+                                          'type' => 'checkbox',
+                                          'default' => 0));
         $params['calendar']['values']['__all'] = _("All Visible");
         foreach (Kronolith::listCalendars() as $id => $cal) {
             $params['calendar']['values'][$id] = $cal->get('name');
@@ -123,7 +126,7 @@ class Horde_Block_Kronolith_monthlist extends Horde_Block {
                     $event->end = $tomorrow;
                 }
                 if (($event->end->compareDate($now) < 0 && !$event->isAllDay()) ||
-                    ($prefs->getValue('summary_alarms') && !$event->alarm)) {
+                    ($this->_parmas['alarms'] && !$event->alarm)) {
                     continue;
                 }
 
index 0ccad97..854af80 100644 (file)
@@ -23,7 +23,10 @@ class Horde_Block_Kronolith_prevmonthlist extends Horde_Block {
                                             'default' => '__all'),
                         'months' => array('name' => _("Months Before"),
                                           'type' => 'int',
-                                          'default' => 2));
+                                          'default' => 2),
+                        'alarms' => array('name' => _("Show only events that have an alarm set?"),
+                                          'type' => 'checkbox',
+                                          'default' => 0));
         $params['calendar']['values']['__all'] = _("All Visible");
         foreach (Kronolith::listCalendars() as $id => $cal) {
             $params['calendar']['values'][$id] = $cal->get('name');
@@ -117,7 +120,7 @@ class Horde_Block_Kronolith_prevmonthlist extends Horde_Block {
                     continue;
                 }
 
-                if ($prefs->getValue('summary_alarms') && !$event->alarm) {
+                if ($this->_parmas['alarms'] && !$event->alarm) {
                     continue;
                 }
                 if ($firstevent) {
index ef3bb2b..71401e8 100644 (file)
@@ -23,9 +23,25 @@ class Horde_Block_Kronolith_summary extends Horde_Block {
         $params = array('calendar' => array('name' => _("Calendar"),
                                             'type' => 'enum',
                                             'default' => '__all'),
+                        'days' => array('name' => _("The time span to show"),
+                                        'type' => 'enum',
+                                        'default' => 7,
+                                        'values' => array(1 => '1 ' . _("day"),
+                                                          2 => '2 ' . _("days"),
+                                                          3 => '3 ' . _("days"),
+                                                          4 => '4 ' . _("days"),
+                                                          5 => '5 ' . _("days"),
+                                                          6 => '6 ' . _("days"),
+                                                          7 => '1 ' . _("week"),
+                                                          14 => '2 ' . _("weeks"),
+                                                          21 => '3 ' . _("weeks"),
+                                                          28 => '4 ' . _("weeks"))),
                         'maxevents' => array('name' => _("Maximum number of events to display (0 = no limit)"),
                                              'type' => 'int',
-                                             'default' => 0));
+                                             'default' => 0),
+                        'alarms' => array('name' => _("Show only events that have an alarm set?"),
+                                          'type' => 'checkbox',
+                                          'default' => 0));
         $params['calendar']['values']['__all'] = _("All Visible");
         foreach (Kronolith::listCalendars() as $id => $cal) {
             $params['calendar']['values'][$id] = $cal->get('name');
@@ -71,7 +87,7 @@ class Horde_Block_Kronolith_summary extends Horde_Block {
         $today = date('j');
 
         $startDate = new Horde_Date(array('year' => date('Y'), 'month' => date('n'), 'mday' => date('j')));
-        $endDate = new Horde_Date(array('year' => date('Y'), 'month' => date('n'), 'mday' => date('j') + $prefs->getValue('summary_days')));
+        $endDate = new Horde_Date(array('year' => date('Y'), 'month' => date('n'), 'mday' => date('j') + $this->_params['days']));
 
         if (isset($this->_params['calendar']) &&
             $this->_params['calendar'] != '__all') {
@@ -95,7 +111,7 @@ class Horde_Block_Kronolith_summary extends Horde_Block {
         }
 
         $html = '';
-        $iMax = $today + $prefs->getValue('summary_days');
+        $iMax = $today + $this->_params['days'];
         $firstday = true;
         $totalevents = 0;
         for ($i = $today; $i < $iMax; ++$i) {
@@ -122,7 +138,7 @@ class Horde_Block_Kronolith_summary extends Horde_Block {
                 if ($event->end->compareDate($now) < 0) {
                     continue;
                 }
-                if ($prefs->getValue('summary_alarms') && !$event->alarm) {
+                if ($this->_parmas['alarms'] && !$event->alarm) {
                     continue;
                 }
                 $event_active = $event->start->compareDateTime($now) < 0 &&