From 081393aecf98b070e418b176b40990130f4b29a7 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Fri, 19 Jun 2009 17:48:41 +0200 Subject: [PATCH] Move portal block configuration from prefs to block params. --- kronolith/config/prefs.php.dist | 36 ----------------------------------- kronolith/lib/Block/monthlist.php | 7 +++++-- kronolith/lib/Block/prevmonthlist.php | 7 +++++-- kronolith/lib/Block/summary.php | 24 +++++++++++++++++++---- 4 files changed, 30 insertions(+), 44 deletions(-) diff --git a/kronolith/config/prefs.php.dist b/kronolith/config/prefs.php.dist index b062e00e5..5e31eb975 100644 --- a/kronolith/config/prefs.php.dist +++ b/kronolith/config/prefs.php.dist @@ -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'); diff --git a/kronolith/lib/Block/monthlist.php b/kronolith/lib/Block/monthlist.php index a108c423d..9bf66cff4 100644 --- a/kronolith/lib/Block/monthlist.php +++ b/kronolith/lib/Block/monthlist.php @@ -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; } diff --git a/kronolith/lib/Block/prevmonthlist.php b/kronolith/lib/Block/prevmonthlist.php index 0ccad9724..854af8010 100644 --- a/kronolith/lib/Block/prevmonthlist.php +++ b/kronolith/lib/Block/prevmonthlist.php @@ -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) { diff --git a/kronolith/lib/Block/summary.php b/kronolith/lib/Block/summary.php index ef3bb2b36..71401e8ba 100644 --- a/kronolith/lib/Block/summary.php +++ b/kronolith/lib/Block/summary.php @@ -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 && -- 2.11.0