From 6382f1127e0361402c3020936aa213dac9e803b8 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 9 Mar 2007 11:30:59 +0000 Subject: [PATCH] listview: some new columns (week, project, category), plus the ability to display fixed timeranges: week & month via the navigation calendar and free start- and enddates --- calendar/inc/class.uilist.inc.php | 129 ++++++++++++++++++++++++------ calendar/setup/phpgw_de.lang | 5 ++ calendar/setup/phpgw_en.lang | 5 ++ 3 files changed, 116 insertions(+), 23 deletions(-) diff --git a/calendar/inc/class.uilist.inc.php b/calendar/inc/class.uilist.inc.php index de098e847a..3f8f60d771 100644 --- a/calendar/inc/class.uilist.inc.php +++ b/calendar/inc/class.uilist.inc.php @@ -1,16 +1,14 @@ * -* -------------------------------------------- * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 2 of the License, or (at your * -* option) any later version. * -\**************************************************************************/ - -/* $Id$ */ +/** + * eGroupWare - Calendar's Listview and Search + * + * @link http://www.egroupware.org + * @package calendar + * @author Ralf Becker + * @copyright (c) 2005-7 by RalfBecker-At-outdoor-training.de + * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License + * @version $Id$ + */ include_once(EGW_INCLUDE_ROOT . '/calendar/inc/class.uical.inc.php'); @@ -25,11 +23,6 @@ include_once(EGW_INCLUDE_ROOT . '/calendar/inc/class.uical.inc.php'); * The state of the UI elements is managed in the uical class, which all UI classes extend. * * All permanent debug messages of the calendar-code should done via the debug-message method of the bocal class !!! - * - * @package calendar - * @author Ralf Becker - * @copyright (c) 2004/5 by RalfBecker-At-outdoor-training.de - * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License */ class uilist extends uical { @@ -37,9 +30,22 @@ class uilist extends uical 'listview' => True, ); /** - * @var $debug mixed integer level or string function- or widget-name + * integer level or string function- or widget-name + * + * @var mixed */ var $debug=false; + /** + * Filternames + * + * @var array + */ + var $date_filters = array( + 'after' => 'After current date', + 'before' => 'Before current date', + 'all' => 'All events', + 'custom' => 'Selected range', + ); /** * Constructor @@ -54,11 +60,10 @@ class uilist extends uical // for a single owner we add it's name to the app-header (count(explode(',',$this->owner)) == 1 ? ': '.$this->bo->participant_name($this->owner) : ''); - $this->date_filters = array( - 'after' => lang('After current date'), - 'before' => lang('Before current date'), - 'all' => lang('All events'), - ); + foreach($this->date_filters as $name => $label) + { + $this->date_filters[$name] = lang($label); + } $this->check_owners_access(); } @@ -118,6 +123,9 @@ class uilist extends uical 'filter' => 'after', 'order' => 'cal_start',// IO name of the column to sort after (optional for the sortheaders) 'sort' => 'ASC',// IO direction of the sort: 'ASC' or 'DESC' + 'default_cols' => '!week,cat_id,pm_id', + 'filter_onchange' => "set_style_by_class('*','custom_hide','visibility',this.value == 'custom' ? 'visible' : 'hidden'); if (this.value != 'custom') this.form.submit();", + 'header_left' => 'calendar.list.dates', ); } if (isset($_REQUEST['keywords'])) // new search => set filters so every match is shown @@ -161,6 +169,27 @@ class uilist extends uical function get_rows(&$params,&$rows,&$readonlys) { //echo "uilist::get_rows() params="; _debug_array($params); + if (isset($_GET['listview_days']) && is_numeric($_GET['listview_days'])) + { + $params['filter'] = 'fixed'; + } + if ($params['filter'] == 'custom') + { + if (!$params['startdate'] && !$params['enddate']) + { + $params['filter'] = 'all'; + } + elseif (!$params['startdate']) + { + $params['filter'] = 'before'; + $this->manage_states(array('date' => $this->bo->date2string($params['enddate']))); + } + elseif (!$params['enddate']) + { + $params['filter'] = 'after'; + $this->manage_states(array('date' => $this->bo->date2string($params['startdate']))); + } + } $old_params = $GLOBALS['egw']->session->appsession('calendar_list','calendar'); if ($old_params['filter'] && $old_params['filter'] != $params['filter']) // filter changed => order accordingly { @@ -186,12 +215,56 @@ class uilist extends uical break; case 'before': $search_params['end'] = $this->date; + $label = lang('Before %1',$this->bo->long_date($this->date)); break; + case 'custom': + if (!is_object($GLOBALS['egw']->js)) + { + $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); + } + $GLOBALS['egw']->js->set_onload("set_style_by_class('*','custom_hide','visibility','visible');"); + $this->first = $search_params['start'] = $params['startdate']; + $this->last = $search_params['end'] = $params['enddate']; + $label = $this->bo->long_date($this->first,$this->last); + break; + case 'fixed': + if ($this->listview_days == 5 || $this->listview_days == 7) // weekview + { + $this->first = $this->datetime->get_weekday_start($this->year,$this->month,$this->day); + $this->last = $this->bo->date2array($this->first); + $this->last['day'] += (int) $this->planner_days - 1; + $this->last['hour'] = 23; $this->last['minute'] = $this->last['sec'] = 59; + unset($this->last['raw']); + $this->last = $this->bo->date2ts($this->last); + $this->date_filters['fixed'] = $label = lang('Week').' '.adodb_date('W',$this->first).': '.$this->bo->long_date($this->first,$this->last); + $search_params['start'] = $this->first; + $search_params['end'] = $this->last; + break; + } + elseif ((string)$this->listview_days === '0') // monthview + { + $this->first = $this->bo->date2array($this->date); + $this->first['day'] = 1; + unset($this->first['raw']); + $this->last = $this->first; + $this->last['month'] += 1; + $this->first = $this->bo->date2ts($this->first); + $this->last = $this->bo->date2ts($this->last); + $this->last--; + $this->date_filters['fixed'] = $label = lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year; + break; + } + // fall through to after given date case 'after': default: + $label = lang('After %1',$this->bo->long_date($this->date)); $search_params['start'] = $this->date; break; } + if ($label) + { + $GLOBALS['egw_info']['flags']['app_header'] .= ': '.$label; + } if ((int) $params['col_filter']['participant']) { $search_params['users'] = (int) $params['col_filter']['participant']; @@ -213,6 +286,16 @@ class uilist extends uical if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment $rows[] = $event; } + $params['options-selectcols']['week'] = lang('Week'); + if (substr($this->cal_prefs['nextmatch-calendar.list.rows'],0,4) == 'week') + { + $rows['format'] = '32'; // prefix date with week-number + } + if ($this->cat_id) $rows['no_cat_id'] = true; + if (!$GLOBALS['egw_info']['user']['apps']['projectmanager']) + { + $params['options-selectcols']['pm_id'] = false; + } //_debug_array($rows); return $this->bo->total; } diff --git a/calendar/setup/phpgw_de.lang b/calendar/setup/phpgw_de.lang index 2be26e7bed..2d4eb6519e 100644 --- a/calendar/setup/phpgw_de.lang +++ b/calendar/setup/phpgw_de.lang @@ -11,6 +11,7 @@ actions calendar de Befehle actions... calendar de Befehle... add alarm calendar de Alarm zufügen added calendar de Neuer Termin +after %1 calendar de Nach dem %1 after current date calendar de Nach dem aktuellen Datum alarm calendar de Alarm alarm added calendar de Alarm zugefügt @@ -28,6 +29,7 @@ are you sure you want to delete this country ? calendar de Sind Sie sicher, dass are you sure you want to delete this holiday ? calendar de Sind Sie sicher, dass Sie diesen Feiertag löschen wollen ? back half a month calendar de einen halben Monat zurück back one month calendar de einen Monat zurück +before %1 calendar de Vor dem %1 before current date calendar de Vor dem aktuellen Datum before the event calendar de vor dem Termin birthday calendar de Geburtstag @@ -242,13 +244,16 @@ select a %1 calendar de %1 ausw select a time calendar de eine Zeit auswählen select resources calendar de Ressourcen auswählen select who should get the alarm calendar de Auswählen wer den Alarm erhalten soll +selected range calendar de Ausgewählter Zeitraum set a year only for one-time / non-regular holidays. calendar de Nur für einmalige/unregelmäßige Feiertage das Jahr angeben. set new events to private calendar de Neue Termine als private Termine eintragen should invitations you rejected still be shown in your calendar ?
you can only accept them later (eg. when your scheduling conflict is removed), if they are still shown in your calendar! calendar de Sollen Einladungen welche von Ihnen abgelehnt wurden in Ihrem Kalender angezeigt werden?
Sie können diese Einladungen dann später akzeptieren (z. B. wenn Sie eine Terminkolission gelöst haben), wenn Sie in Ihrem Kalender noch vorhanden sind! should new events created as private by default ? calendar de Sollen neue Termine generell als Privat angelegt werden? should not loged in persons be able to see your freebusy information? you can set an extra password, different from your normal password, to protect this informations. the freebusy information is in ical format and only include the times when you are busy. it does not include the event-name, description or locations. the url to your freebusy information is %1. calendar de Sollen nicht angemeldete Personen ihre Belegtzeiten einsehen können? Sie können ein Passwort setzen um diese Informationen zu schützen. Das Passwort sollte sich von Ihrem normalen Passwort unterscheiden. Die Belegtzeiten sind im iCal Format und enthalten ausschließlich die Zeiten an denen sie nicht verfügbar sind. Sie enthalten NICHT den Namen, die Beschreibung oder den Ort des Termins. Die Adresse (URL) Ihrer Belegtzeiten ist %1. +should the planner display an empty row for users or categories without any appointment. calendar de Soll der Planer eine leere Zeile für Benutzer oder Kategorien ohne einen Termin anzeigen. should the status of the event-participants (accept, reject, ...) be shown in brakets after each participants name ? calendar de Soll der Status (Zugesagt,Abgesagt ...)der Termin- Teilnehmer in Klammern hinter jeden Teilnehmer angezeigt werden? show default view on main screen calendar de Standardansicht auf der Startseite anzeigen +show empty rows in planner calendar de Zeige leere Zeilen im Planer show invitations you rejected calendar de Zeige Einladungen welche abgelehnt wurden an show list of upcoming events calendar de Zeige eine Liste der kommenden Termine show this month calendar de Diesen Monat anzeigen diff --git a/calendar/setup/phpgw_en.lang b/calendar/setup/phpgw_en.lang index b7076c6bda..5716e4e095 100644 --- a/calendar/setup/phpgw_en.lang +++ b/calendar/setup/phpgw_en.lang @@ -11,6 +11,7 @@ actions calendar en Actions actions... calendar en Actions... add alarm calendar en Add alarm added calendar en Added +after %1 calendar en After %1 after current date calendar en After current date alarm calendar en Alarm alarm added calendar en Alarm added @@ -28,6 +29,7 @@ are you sure you want to delete this country ? calendar en Are you sure you want are you sure you want to delete this holiday ? calendar en Are you sure you want to delete this holiday ? back half a month calendar en back half a month back one month calendar en back one month +before %1 calendar en Before %1 before current date calendar en Before current date before the event calendar en before the event birthday calendar en Birthday @@ -242,13 +244,16 @@ select a %1 calendar en select a %1 select a time calendar en select a time select resources calendar en Select resources select who should get the alarm calendar en Select who should get the alarm +selected range calendar en Selected range set a year only for one-time / non-regular holidays. calendar en Set a Year only for one-time / non-regular holidays. set new events to private calendar en Set new events to private should invitations you rejected still be shown in your calendar ?
you can only accept them later (eg. when your scheduling conflict is removed), if they are still shown in your calendar! calendar en Should invitations you rejected still be shown in your calendar ?
You can only accept them later (eg. when your scheduling conflict is removed), if they are still shown in your calendar! should new events created as private by default ? calendar en Should new events created as private by default ? should not loged in persons be able to see your freebusy information? you can set an extra password, different from your normal password, to protect this informations. the freebusy information is in ical format and only include the times when you are busy. it does not include the event-name, description or locations. the url to your freebusy information is %1. calendar en Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is %1. +should the planner display an empty row for users or categories without any appointment. calendar en Should the planner display an empty row for users or categories without any appointment. should the status of the event-participants (accept, reject, ...) be shown in brakets after each participants name ? calendar en Should the status of the event-participants (accept, reject, ...) be shown in brakets after each participants name ? show default view on main screen calendar en show default view on main screen +show empty rows in planner calendar en Show empty rows in Planner show invitations you rejected calendar en Show invitations you rejected show list of upcoming events calendar en show list of upcoming events show this month calendar en show this month