From a66d0149f909961b5f99d6423237378ca19caa5a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 8 Oct 2004 16:04:50 +0000 Subject: [PATCH] fixed to minor problems in the freetime search: - for existing events, the own event is now excluded from the busy-time - a warning is given, if the freetime search is called for a recuring event: Only the initial date of that recuring event is checked! --- calendar/inc/class.uicalendar.inc.php | 2 +- calendar/inc/class.uiforms.inc.php | 20 +++++++++++++++++--- calendar/setup/etemplates.inc.php | 5 +++-- calendar/setup/phpgw_de.lang | 3 ++- calendar/setup/phpgw_en.lang | 3 ++- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/calendar/inc/class.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php index 20eff16324..af9a15e05d 100755 --- a/calendar/inc/class.uicalendar.inc.php +++ b/calendar/inc/class.uicalendar.inc.php @@ -4211,7 +4211,7 @@ return; } $fts_link = $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'calendar.uiforms.freetimesearch')); - $fields = array('start[str]','start[hour]','start[min]','end[str]','end[hour]','end[min]'); + $fields = array('start[str]','start[hour]','start[min]','end[str]','end[hour]','end[min]','cal[id]','cal[recur_type]'); if ($this->bo->prefs['common']['timeformat'] == '12') { $fields[] = 'start[ampm]'; diff --git a/calendar/inc/class.uiforms.inc.php b/calendar/inc/class.uiforms.inc.php index 49374836af..00b6a2517c 100644 --- a/calendar/inc/class.uiforms.inc.php +++ b/calendar/inc/class.uiforms.inc.php @@ -76,6 +76,9 @@ class uiforms extends uical { if ((int) $uid) $content['participants'][] = (int) $uid; } + $content['cal_id'] = $_GET['cal']['id']; + $content['recur_type'] = $_GET['cal']['recur_type']; + // default search parameters $content['start_time'] = $this->cal_prefs['workdaystarts']; $content['end_time'] = $this->cal_prefs['workdayends']; @@ -138,8 +141,12 @@ class uiforms extends uical \n"; exit; } - } - $content['freetime'] = $this->freetime($content['participants'],$content['start'],$content['start']+$content['search_window'],$duration); + } + if ($content['recur_type']) + { + $content['msg'] .= lang('Only the initial date of that recuring event is checked!'); + } + $content['freetime'] = $this->freetime($content['participants'],$content['start'],$content['start']+$content['search_window'],$duration,$content['cal_id']); $content['freetime'] = $this->split_freetime_daywise($content['freetime'],$duration,$content['weekdays'],$content['start_time'],$content['end_time'],$sel_options); $sel_options['search_window'] = array( 7*DAY_s => lang('one week'), @@ -153,9 +160,13 @@ class uiforms extends uical //echo "
".print_r($content,true)."
\n"; $GLOBALS['phpgw_info']['flags']['app_header'] = lang('calendar') . ' - ' . lang('freetime search'); + // let the window popup, if its already there + $GLOBALS['phpgw_info']['flags']['java_script'] .= "\n"; $etpl->exec('calendar.uiforms.freetimesearch',$content,$sel_options,'',array( 'participants' => $content['participants'], + 'cal_id' => $content['cal_id'], + 'recur_type' => $content['recur_type'], ),2); } @@ -166,9 +177,10 @@ class uiforms extends uical * @param $end int end-time timestamp in user-time * @param $participants array of user-id's * @param $duration int min. duration in sec, default 1 + * @param $cal_id int own id for existing events, to exclude them from being busy-time, default 0 * @return array of free time-slots: array with start and end values */ - function freetime($participants,$start,$end,$duration=1) + function freetime($participants,$start,$end,$duration=1,$cal_id=0) { $busy = $this->bo->search(array( 'start' => $start, @@ -184,6 +196,8 @@ class uiforms extends uical $n = 0; foreach($busy as $event) { + if ((int)$cal_id && $event['id'] == (int)$cal_id) continue; // ignore our own event + if ($this->debug) { echo "

ft_start=".date('D d.m.Y H:i',$ft_start)."
\n"; diff --git a/calendar/setup/etemplates.inc.php b/calendar/setup/etemplates.inc.php index 5f13bb0538..3861746d78 100644 --- a/calendar/setup/etemplates.inc.php +++ b/calendar/setup/etemplates.inc.php @@ -1,9 +1,10 @@ 'calendar.freetimesearch','template' => '','lang' => '','group' => '0','version' => '1.0.1.001','data' => 'a:7:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"span";s:12:"all,size120b";s:5:"label";s:15:"Freetime Search";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:17:"Startdate / -time";}s:1:"B";a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:5:"start";s:4:"help";s:33:"Startdate and -time of the search";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Duration";}s:1:"B";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"4";i:1;a:4:{s:4:"type";s:13:"select-number";s:4:"size";s:5:",0,12";s:4:"name";s:10:"duration_h";s:4:"help";s:23:"Duration of the meeting";}i:2;a:5:{s:4:"type";s:13:"select-number";s:4:"size";s:8:",0,59,05";s:5:"label";s:1:":";s:4:"name";s:12:"duration_min";s:4:"help";s:19:"Timeframe to search";}i:3;a:2:{s:4:"type";s:5:"label";s:5:"label";s:18:"or Enddate / -time";}i:4;a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:3:"end";s:4:"help";s:57:"Enddate / -time of the meeting, eg. for more then one day";}}}i:4;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Timeframe";}s:1:"B";a:7:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"5";i:1;a:3:{s:4:"type";s:13:"date-houronly";s:4:"name";s:10:"start_time";s:4:"help";s:19:"Timeframe to search";}i:2;a:2:{s:4:"type";s:5:"label";s:5:"label";s:3:"til";}i:3;a:3:{s:4:"type";s:13:"date-houronly";s:4:"name";s:8:"end_time";s:4:"help";s:19:"Timeframe to search";}i:4;a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Weekdays";}i:5;a:4:{s:4:"type";s:10:"select-dow";s:4:"size";s:1:"3";s:4:"name";s:8:"weekdays";s:4:"help";s:25:"Weekdays to use in search";}}}i:5;a:2:{s:1:"A";a:4:{s:4:"type";s:6:"button";s:5:"label";s:10:"New search";s:4:"name";s:6:"search";s:4:"help";s:36:"new search with the above parameters";}s:1:"B";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:13:"search_window";s:4:"help";s:34:"how far to search (from startdate)";}}i:6;a:2:{s:1:"A";a:4:{s:4:"type";s:8:"template";s:4:"size";s:8:"freetime";s:4:"span";s:3:"all";s:4:"name";s:4:"rows";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}','size' => '','style' => '.size120b { text-size: 120%; font-weight: bold;}','modified' => '1097184234',); +$templ_data[] = array('name' => 'calendar.freetimesearch','template' => '','lang' => '','group' => '0','version' => '1.0.1.001','data' => 'a:7:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"span";s:9:",size120b";s:5:"label";s:15:"Freetime Search";}s:1:"B";a:4:{s:4:"type";s:5:"label";s:4:"span";s:5:",ired";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:17:"Startdate / -time";}s:1:"B";a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:5:"start";s:4:"help";s:33:"Startdate and -time of the search";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Duration";}s:1:"B";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"4";i:1;a:4:{s:4:"type";s:13:"select-number";s:4:"size";s:5:",0,12";s:4:"name";s:10:"duration_h";s:4:"help";s:23:"Duration of the meeting";}i:2;a:5:{s:4:"type";s:13:"select-number";s:4:"size";s:8:",0,59,05";s:5:"label";s:1:":";s:4:"name";s:12:"duration_min";s:4:"help";s:19:"Timeframe to search";}i:3;a:2:{s:4:"type";s:5:"label";s:5:"label";s:18:"or Enddate / -time";}i:4;a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:3:"end";s:4:"help";s:57:"Enddate / -time of the meeting, eg. for more then one day";}}}i:4;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Timeframe";}s:1:"B";a:7:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"5";i:1;a:3:{s:4:"type";s:13:"date-houronly";s:4:"name";s:10:"start_time";s:4:"help";s:19:"Timeframe to search";}i:2;a:2:{s:4:"type";s:5:"label";s:5:"label";s:3:"til";}i:3;a:3:{s:4:"type";s:13:"date-houronly";s:4:"name";s:8:"end_time";s:4:"help";s:19:"Timeframe to search";}i:4;a:2:{s:4:"type";s:5:"label";s:5:"label";s:8:"Weekdays";}i:5;a:4:{s:4:"type";s:10:"select-dow";s:4:"size";s:1:"3";s:4:"name";s:8:"weekdays";s:4:"help";s:25:"Weekdays to use in search";}}}i:5;a:2:{s:1:"A";a:4:{s:4:"type";s:6:"button";s:5:"label";s:10:"New search";s:4:"name";s:6:"search";s:4:"help";s:36:"new search with the above parameters";}s:1:"B";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:13:"search_window";s:4:"help";s:34:"how far to search (from startdate)";}}i:6;a:2:{s:1:"A";a:4:{s:4:"type";s:8:"template";s:4:"size";s:8:"freetime";s:4:"span";s:3:"all";s:4:"name";s:4:"rows";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}}','size' => '','style' => '.size120b { text-size: 120%; font-weight: bold; } +.ired { color: red; font-style: italic; }','modified' => '1097251203',); $templ_data[] = array('name' => 'calendar.freetimesearch.rows','template' => '','lang' => '','group' => '0','version' => '1.0.1.001','data' => 'a:3:{i:0;a:2:{s:2:"c1";s:2:"th";s:2:"c2";s:3:"row";}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Date";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Time";}s:1:"C";a:2:{s:4:"type";s:5:"label";s:5:"label";s:6:"Select";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Enddate";}}i:2;a:4:{s:1:"A";a:4:{s:4:"type";s:4:"date";s:4:"size";s:3:",16";s:4:"name";s:13:"${row}[start]";s:8:"readonly";s:1:"1";}s:1:"B";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:13:"${row}[start]";s:4:"help";s:13:"select a time";}s:1:"C";a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Select";s:4:"name";s:12:"select[$row]";s:4:"help";s:41:"use the selected time and close the popup";}s:1:"D";a:3:{s:4:"type";s:9:"date-time";s:4:"name";s:11:"${row}[end]";s:8:"readonly";s:1:"1";}}}','size' => '','style' => '','modified' => '1097183756',); diff --git a/calendar/setup/phpgw_de.lang b/calendar/setup/phpgw_de.lang index 16d2417c8e..ac6a6f599a 100644 --- a/calendar/setup/phpgw_de.lang +++ b/calendar/setup/phpgw_de.lang @@ -164,7 +164,7 @@ load [iv]cal calendar de [iv]Cal Laden location calendar de Ort location to autoload from admin de Von wo sollen sie geladen werden low calendar de niedrig -make freebusy information availible to not loged in persons? calendar de Die Belegtzeiten für nicht angemeldete Personen verfügbar machen? +make freebusy information available to not loged in persons? calendar de Die Belegtzeiten für nicht angemeldete Personen verfügbar machen? matrixview calendar de Matrixansicht minutes calendar de Minuten mo calendar de Mo @@ -211,6 +211,7 @@ on time change of time of more than 4 hours (and above options) calendar de wenn one month calendar de ein Monat one week calendar de eine Woche one year calendar de ein Jahr +only the initial date of that recuring event is checked! calendar de Nur das Startdatum diese wiederholenden Termins wird geprüft! open todo's: calendar de unerledigte Aufgaben: or enddate / -time calendar de oder Enddatum / -zeit order calendar de Reihenfolge diff --git a/calendar/setup/phpgw_en.lang b/calendar/setup/phpgw_en.lang index 25422e50c9..22f2f88202 100644 --- a/calendar/setup/phpgw_en.lang +++ b/calendar/setup/phpgw_en.lang @@ -154,7 +154,7 @@ list all categories. calendar en List all categories. load [iv]cal calendar en Load [iv]Cal location calendar en Location location to autoload from admin en Location to autoload from -make freebusy information availible to not loged in persons? calendar en Make freebusy information availible to not loged in persons? +make freebusy information available to not loged in persons? calendar en Make freebusy information available to not loged in persons? matrixview calendar en Matrix View minutes calendar en minutes mo calendar en M @@ -196,6 +196,7 @@ on time change of more than 4 hours too calendar en on time change of more than one month calendar en one month one week calendar en one week one year calendar en one year +only the initial date of that recuring event is checked! calendar en Only the initial date of that recuring event is checked! open todo's: calendar en Open To Do Items: or enddate / -time calendar en or Enddate / -time order calendar en Order