This commit is contained in:
skeeter 2002-09-19 23:45:19 +00:00
parent 96e1343a59
commit 53704f7ef1
4 changed files with 82 additions and 37 deletions

View File

@ -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 '<!-- Grantor: '.$grantor.' Rights: '.$rights.' -->'."\n";
}
@reset($this->grants);
print_debug('Grantor',$grantor);
print_debug('Rights',$rights);
}
@reset($this->grants);
if($this->debug)
{
echo '<!-- Read Use_Session : ('.$session.') -->'."\n";
}
print_debug('Read use_session',$session);
if($session)
{
@ -149,13 +144,20 @@
$this->use_session = True;
}
if($this->debug)
{
echo '<!-- BO Filter : ('.$this->filter.') -->'."\n";
echo '<!-- Owner : '.$this->owner.' -->'."\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!='')
{

View File

@ -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;$i<count($pref_list);$i++)
{
$GLOBALS['phpgw']->preferences->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;$i<count($pref_list);$i++)
{
if ($GLOBALS['HTTP_POST_VARS']['prefs'][$pref_list[$i]] == True)
if ($prefs[$pref_list[$i]] == True)
{
$GLOBALS['phpgw']->preferences->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 @@
}
}
}
?>
?>

View File

@ -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] = \'<a href="\'.$this->planner_html->link(\'/index.php\',
array(
\'menuaction\' => \'calendar.uicalendar.add\',
@ -2197,7 +2208,11 @@
{
$page_ = explode('.',$this->bo->prefs['calendar']['defaultcalendar']);
$_page = $page_[0];
if ($_page=='index' || ($_page != 'day' && $_page != 'week' && $_page != 'month' && $_page != 'year' && $_page != 'planner'))
if ($_page=='planner_cat' || $_page=='planner_user')
{
$_page = 'planner';
}
elseif ($_page=='index' || ($_page != 'day' && $_page != 'week' && $_page != 'month' && $_page != 'year' && $_page != 'planner'))
{
$_page = 'month';
$GLOBALS['phpgw']->preferences->add('calendar','defaultcalendar','month');
@ -2273,10 +2288,13 @@
$str .= '<option value="'.$d_ymd.'"'.($d_ymd == $thisdate?' selected':'').'>'.lang(date('F', $d)).strftime(' %Y', $d).'</option>'."\n";
}
$hidden_vars = ' <input type="hidden" name="from" value="'.MENUACTION.'">'."\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 .= '<option value="'.$i.'"'.($i == $this->bo->num_months?' selected':'').'>'.$i.'</option>'."\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']);

View File

@ -103,7 +103,8 @@
$selected['month'] = ' selected';
}
$str = '<select name="prefs[defaultcalendar]">'
. '<option value="planner"'.$selected['planner'].'>'.lang('Planner').'</option>'
. '<option value="planner_cat"'.$selected['planner_cat'].'>'.lang('Planner by category').'</option>'
. '<option value="planner_user"'.$selected['planner_user'].'>'.lang('Planner by user').'</option>'
. '<option value="year"'.$selected['year'].'>'.lang('Yearly').'</option>'
. '<option value="month"'.$selected['month'].'>'.lang('Monthly').'</option>'
. '<option value="week"'.$selected['week'].'>'.lang('Weekly').'</option>'
@ -111,6 +112,15 @@
. '</select>';
$this->display_item(lang('default calendar view'),$str);
$user = $GLOBALS['phpgw_info']['user']['account_id'];
$groups = $GLOBALS['phpgw']->accounts->membership($user);
$str = '<option value="-1"'.(intval($this->bo->prefs['calendar']['planner_start_with__group'])==-1?' selected':'').'>none</option>'."\n";
while (list($key,$group) = each($groups))
{
$str .= '<option value="'.$key.'"'.(intval($this->bo->prefs['calendar']['planner_start_with_group'])==$key?' selected':'').'>'.$GLOBALS['phpgw']->common->grab_owner_name($group['account_id']).'</option>'."\n";
}
$this->display_item(lang('Preselected group for entering the planner'),'<select name="prefs[planner_start_with_group]">'."\n".$str.'</select>'."\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);
}
}
}