diff --git a/calendar/inc/class.bocalendar.inc.php b/calendar/inc/class.bocalendar.inc.php index f0c1a572e2..95253650f6 100755 --- a/calendar/inc/class.bocalendar.inc.php +++ b/calendar/inc/class.bocalendar.inc.php @@ -129,19 +129,14 @@ { $this->grants = $GLOBALS['phpgw']->acl->get_grants('calendar'); @reset($this->grants); - if($this->debug) + while(list($grantor,$rights) = each($this->grants)) { - while(list($grantor,$rights) = each($this->grants)) - { - echo ''."\n"; - } - @reset($this->grants); + print_debug('Grantor',$grantor); + print_debug('Rights',$rights); } + @reset($this->grants); - if($this->debug) - { - echo ''."\n"; - } + print_debug('Read use_session',$session); if($session) { @@ -149,13 +144,20 @@ $this->use_session = True; } - if($this->debug) - { - echo ''."\n"; - echo ''."\n"; - } + print_debug('BO Filter',$this->filter); + print_debug('Owner',$this->owner); - $owner = get_var('owner',Array('GLOBAL','HTTP_GET_VARS','HTTP_POST_VARS')); + $this->prefs['calendar'] = $GLOBALS['phpgw_info']['user']['preferences']['calendar']; + + $owner = get_var('owner',Array('GLOBAL','GET','POST')); + + if ((!isset($owner) || $owner == '') + && MENUACTION == 'calendar.uicalendar.planner' + && get_var('from',Array('POST')) != 'calendar.uicalendar.planner' + && $this->prefs['calendar']['planner_start_with_group'] != '-1') + { + $owner = $this->prefs['calendar']['planner_start_with_group']; + } if(isset($owner) && $owner!='' && substr($owner,0,2) == 'g_') { @@ -175,7 +177,6 @@ } $this->prefs['common'] = $GLOBALS['phpgw_info']['user']['preferences']['common']; - $this->prefs['calendar'] = $GLOBALS['phpgw_info']['user']['preferences']['calendar']; if ($this->prefs['common']['timeformat'] == '12') { @@ -188,16 +189,26 @@ $this->holiday_color = (substr($GLOBALS['phpgw_info']['theme']['bg07'],0,1)=='#'?'':'#').$GLOBALS['phpgw_info']['theme']['bg07']; - $this->printer_friendly = (intval(get_var('friendly',Array('HTTP_GET_VARS','HTTP_POST_VARS','DEFAULT'),0)) == 1?True:False); + $this->printer_friendly = (intval(get_var('friendly',Array('GET','POST','DEFAULT'),0)) == 1?True:False); + + $this->filter = get_var('filter',Array('POST','DEFAULT'),' '.$this->prefs['calendar']['defaultfilter'].' '); + + $this->sortby = get_var('sortby',Array('POST')); + if(!isset($this->sortby)) + { + $default_calender = $this->prefs['calendar']['defaultcalendar']; + if ($default_calender == 'planner_cat' || $default_calender == 'planner_user') + { + $this->sortby = ($default_calender == 'planner_cat' ? 'category' : 'user'); + } + } - $this->filter = get_var('filter',Array('HTTP_POST_VARS','DEFAULT'),' '.$this->prefs['calendar']['defaultfilter'].' '); if($GLOBALS['phpgw']->accounts->get_type($this->owner)=='g') { $this->filter = ' all '; } - $this->sortby = get_var('sortby',Array('HTTP_POST_VARS','DEFAULT'),'category'); - $this->cat_id = get_var('cat_id',Array('HTTP_POST_VARS')); + $this->cat_id = get_var('cat_id',Array('POST')); $this->so = CreateObject('calendar.socalendar', Array( @@ -209,11 +220,11 @@ ); $localtime = $GLOBALS['phpgw']->datetime->users_localtime; - $date = get_var('date',Array('HTTP_GET_VARS','HTTP_POST_VARS','GLOBAL')); - $year = get_var('year',Array('HTTP_GET_VARS','HTTP_POST_VARS')); - $month = get_var('month',Array('HTTP_GET_VARS','HTTP_POST_VARS')); - $day = get_var('day',Array('HTTP_GET_VARS','HTTP_POST_VARS')); - $num_months = get_var('num_months',Array('HTTP_GET_VARS','HTTP_POST_VARS')); + $date = get_var('date',Array('GET','POST','GLOBAL')); + $year = get_var('year',Array('GET','POST')); + $month = get_var('month',Array('GET','POST')); + $day = get_var('day',Array('GET','POST')); + $num_months = get_var('num_months',Array('GET','POST')); if(isset($date) && $date!='') { diff --git a/calendar/inc/class.bopreferences.inc.php b/calendar/inc/class.bopreferences.inc.php index 1bba6ca66f..33ebb205e8 100755 --- a/calendar/inc/class.bopreferences.inc.php +++ b/calendar/inc/class.bopreferences.inc.php @@ -31,8 +31,9 @@ function preferences() { - if (isset($GLOBALS['HTTP_POST_VARS']['submit'])) + if (get_var('submit',Array('POST'))) { + $prefs = get_var('prefs',Array('POST')); $GLOBALS['phpgw']->preferences->read_repository(); $pref_list = Array( @@ -42,12 +43,13 @@ 'defaultcalendar', 'defaultfilter', 'interval', - 'planner_intervals_per_day' + 'planner_intervals_per_day', + 'planner_start_with_group' ); for($i=0;$ipreferences->add('calendar',$pref_list[$i],$GLOBALS['HTTP_POST_VARS']['prefs'][$pref_list[$i]]); + $GLOBALS['phpgw']->preferences->add('calendar',$pref_list[$i],$prefs[$pref_list[$i]]); } $pref_list = Array( @@ -62,9 +64,9 @@ for($i=0;$ipreferences->add('calendar',$pref_list[$i],$GLOBALS['HTTP_POST_VARS']['prefs'][$pref_list[$i]]); + $GLOBALS['phpgw']->preferences->add('calendar',$pref_list[$i],$prefs[$pref_list[$i]]); } else { @@ -79,4 +81,4 @@ } } } -?> \ No newline at end of file +?> diff --git a/calendar/inc/class.uicalendar.inc.php b/calendar/inc/class.uicalendar.inc.php index f1d8b5a958..d0641b9adc 100755 --- a/calendar/inc/class.uicalendar.inc.php +++ b/calendar/inc/class.uicalendar.inc.php @@ -1379,6 +1379,17 @@ $index = $d + $this->planner_days; $hdr[2][\'.\'.$index] = \'colspan="\'.$intervals_per_day.\'" align="center"\'; + + // highlight saturdays and sundays using bgcolor + // FIXME: what about holidays? + // + $dow = $GLOBALS[\'phpgw\']->datetime->day_of_week($y,$m,$d); + if ($dow == 0 || $dow == 6) + { + $hdr[2][\'.\'.$index] .= \'" bgcolor=\'; + $hdr[2][\'.\'.$index] .= $dow == 0 ? \'"#ff8866"\' : \'"#ffcccc"\'; + } + $hdr[2][$index] = \''.lang(date('F', $d)).strftime(' %Y', $d).''."\n"; } + $hidden_vars = ' '."\n"; + $var = Array( 'action_url' => $this->page($method,''), 'form_name' => 'SelectMonth', 'label' => lang('Month'), + 'hidden_vars' => $hidden_vars, 'form_label' => 'date', 'form_onchange' => 'document.SelectMonth.submit()', 'row' => $str, @@ -2304,6 +2322,7 @@ 'action_url' => $this->page($method,''), 'form_name' => 'SelectWeek', 'label' => lang('Week'), + 'hidden_vars' => $hidden_vars, 'form_label' => 'date', 'form_onchange' => 'document.SelectWeek.submit()', 'row' => $str, @@ -2323,6 +2342,7 @@ 'action_url' => $this->page($method,''), 'form_name' => 'SelectYear', 'label' => lang('Year'), + 'hidden_vars' => $hidden_vars, 'form_label' => 'year', 'form_onchange' => 'document.SelectYear.submit()', 'row' => $str, @@ -2349,11 +2369,13 @@ $str .= ''."\n"; } + $hidden_vars .= $date_str; + $var = Array( 'action_url' => $this->page($method,''), 'form_name' => 'SelectNumberOfMonths', 'label' => lang('Number of Months'), - 'hidden_vars' => $date_str, + 'hidden_vars' => $hidden_vars, 'form_label' => 'num_months', 'form_onchange' => 'document.SelectNumberOfMonths.submit()', 'action_extra_field' => $date_str, @@ -2406,7 +2428,7 @@ function no_edit() { - if(!$isset($GLOBALS['phpgw_info']['flags']['noheader'])) + if(!isset($GLOBALS['phpgw_info']['flags']['noheader'])) { unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); diff --git a/calendar/inc/class.uipreferences.inc.php b/calendar/inc/class.uipreferences.inc.php index bf4c3916ea..7d8da6f4e6 100755 --- a/calendar/inc/class.uipreferences.inc.php +++ b/calendar/inc/class.uipreferences.inc.php @@ -103,7 +103,8 @@ $selected['month'] = ' selected'; } $str = ''; $this->display_item(lang('default calendar view'),$str); + $user = $GLOBALS['phpgw_info']['user']['account_id']; + $groups = $GLOBALS['phpgw']->accounts->membership($user); + $str = ''."\n"; + while (list($key,$group) = each($groups)) + { + $str .= ''."\n"; + } + $this->display_item(lang('Preselected group for entering the planner'),''."\n"); + $selected = array(); $selected[$this->bo->prefs['calendar']['defaultfilter']] = ' selected'; if (!isset($this->bo->prefs['calendar']['defaultfilter']) || $this->bo->prefs['calendar']['defaultfilter'] == 'private') @@ -193,4 +203,4 @@ ); $this->output_template_array('row','pref_list',$var); } - } \ No newline at end of file + }