Added GNU Feature Request #100744.

This commit is contained in:
skeeter 2002-04-17 23:43:29 +00:00
parent 264313338f
commit 4f422d4608
4 changed files with 169 additions and 112 deletions

View File

@ -34,63 +34,41 @@
if (isset($GLOBALS['HTTP_POST_VARS']['submit'])) if (isset($GLOBALS['HTTP_POST_VARS']['submit']))
{ {
$GLOBALS['phpgw']->preferences->read_repository(); $GLOBALS['phpgw']->preferences->read_repository();
$GLOBALS['phpgw']->preferences->add('calendar','weekdaystarts',$GLOBALS['HTTP_POST_VARS']['prefs']['weekdaystarts']);
$GLOBALS['phpgw']->preferences->add('calendar','workdaystarts',intval($GLOBALS['HTTP_POST_VARS']['prefs']['workdaystarts'])); $pref_list = Array(
$GLOBALS['phpgw']->preferences->add('calendar','workdayends',intval($GLOBALS['HTTP_POST_VARS']['prefs']['workdayends'])); 'weekdaystarts',
$GLOBALS['phpgw']->preferences->add('calendar','defaultcalendar',$GLOBALS['HTTP_POST_VARS']['prefs']['defaultcalendar']); 'workdaystarts',
$GLOBALS['phpgw']->preferences->add('calendar','defaultfilter',$GLOBALS['HTTP_POST_VARS']['prefs']['defaultfilter']); 'workdayends',
$GLOBALS['phpgw']->preferences->add('calendar','interval',intval($GLOBALS['HTTP_POST_VARS']['prefs']['interval'])); 'defaultcalendar',
if ($GLOBALS['HTTP_POST_VARS']['prefs']['mainscreen_showevents'] == True) 'defaultfilter',
'interval'
);
for($i=0;$i<count($pref_list);$i++)
{ {
$GLOBALS['phpgw']->preferences->add('calendar','mainscreen_showevents',$GLOBALS['HTTP_POST_VARS']['prefs']['mainscreen_showevents']); $GLOBALS['phpgw']->preferences->add('calendar',$pref_list[$i],$GLOBALS['HTTP_POST_VARS']['prefs'][$pref_list[$i]]);
}
else
{
$GLOBALS['phpgw']->preferences->delete('calendar','mainscreen_showevents');
}
if ($GLOBALS['HTTP_POST_VARS']['prefs']['send_updates'] == True)
{
$GLOBALS['phpgw']->preferences->add('calendar','send_updates',$GLOBALS['HTTP_POST_VARS']['prefs']['send_updates']);
}
else
{
$GLOBALS['phpgw']->preferences->delete('calendar','send_updates');
}
if ($GLOBALS['HTTP_POST_VARS']['prefs']['display_status'] == True)
{
$GLOBALS['phpgw']->preferences->add('calendar','display_status',$GLOBALS['HTTP_POST_VARS']['prefs']['display_status']);
}
else
{
$GLOBALS['phpgw']->preferences->delete('calendar','display_status');
} }
if ($GLOBALS['HTTP_POST_VARS']['prefs']['default_private'] == True) $pref_list = Array(
{ 'mainscreen_showevents',
$GLOBALS['phpgw']->preferences->add('calendar','default_private',$GLOBALS['HTTP_POST_VARS']['prefs']['default_private']); 'send_updates',
} 'display_status',
else 'default_private',
{ 'display_minicals',
$GLOBALS['phpgw']->preferences->delete('calendar','default_private'); 'print_black_white',
} 'weekdays_only'
);
if ($GLOBALS['HTTP_POST_VARS']['prefs']['display_minicals'] == True) for($i=0;$i<count($pref_list);$i++)
{ {
$GLOBALS['phpgw']->preferences->add('calendar','display_minicals',$GLOBALS['HTTP_POST_VARS']['prefs']['display_minicals']); if ($GLOBALS['HTTP_POST_VARS']['prefs'][$pref_list[$i]] == True)
} {
else $GLOBALS['phpgw']->preferences->add('calendar',$pref_list[$i],$GLOBALS['HTTP_POST_VARS']['prefs'][$pref_list[$i]]);
{ }
$GLOBALS['phpgw']->preferences->delete('calendar','display_minicals'); else
} {
$GLOBALS['phpgw']->preferences->delete('calendar',$pref_list[$i]);
if ($GLOBALS['HTTP_POST_VARS']['prefs']['print_black_white'] == True) }
{
$GLOBALS['phpgw']->preferences->add('calendar','print_black_white',$GLOBALS['HTTP_POST_VARS']['prefs']['print_black_white']);
}
else
{
$GLOBALS['phpgw']->preferences->delete('calendar','print_black_white');
} }
$GLOBALS['phpgw']->preferences->save_repository(True); $GLOBALS['phpgw']->preferences->save_repository(True);
@ -100,4 +78,4 @@
} }
} }
} }
?>

View File

@ -206,7 +206,7 @@
for($i=0;$i<7;$i++) for($i=0;$i<7;$i++)
{ {
$var = Array( $var = Array(
'dayname' => '<b>' . substr(lang($this->datetime->days[$i]),0,2) . '</b>', 'dayname' => '<b>' . substr(lang($this->datetime->days[$i]['name']),0,2) . '</b>',
'day_image' => '' 'day_image' => ''
); );
$this->output_template_array($p,'daynames','mini_day',$var); $this->output_template_array($p,'daynames','mini_day',$var);
@ -373,12 +373,6 @@
function week() function week()
{ {
if (!$this->bo->printer_friendly)
{
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw']->common->phpgw_header();
}
echo $this->printer_friendly($this->get_week()); echo $this->printer_friendly($this->get_week());
} }
@ -546,16 +540,6 @@
function year() function year()
{ {
if(!$this->bo->printer_friendly)
{
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw']->common->phpgw_header();
}
else
{
$GLOBALS['phpgw_info']['flags']['nofooter'] = True;
}
echo $this->printer_friendly($this->get_year()); echo $this->printer_friendly($this->get_year());
} }
@ -1156,9 +1140,6 @@
if (!$this->bo->printer_friendly) if (!$this->bo->printer_friendly)
{ {
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw']->common->phpgw_header();
$printer = ''; $printer = '';
$param = '&date='.sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day).'&friendly=1'; $param = '&date='.sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day).'&friendly=1';
$print = '<a href="'.$this->page('day'.$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; $print = '<a href="'.$this->page('day'.$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>';
@ -1963,11 +1944,11 @@
. ' A.bminicalhol { background: '.$this->holiday_color.'; color: #336699; font: italic bold xx-small '.$this->theme['font'].' }'."\n" . ' A.bminicalhol { background: '.$this->holiday_color.'; color: #336699; font: italic bold xx-small '.$this->theme['font'].' }'."\n"
. ' A.minicalgreyhol { background: '.$this->holiday_color.'; color: #999999; font: xx-small '.$this->theme['font'].' }'."\n" . ' A.minicalgreyhol { background: '.$this->holiday_color.'; color: #999999; font: xx-small '.$this->theme['font'].' }'."\n"
. ' A.bminicalgreyhol { background: '.$this->holiday_color.'; color: #999999; font: italic bold xx-small '.$this->theme['font'].' }'."\n" . ' A.bminicalgreyhol { background: '.$this->holiday_color.'; color: #999999; font: italic bold xx-small '.$this->theme['font'].' }'."\n"
. ' .event-on { background: '.$this->theme['row_on'].'; color: '.$this->theme['bg_text'].'; font: 100 80%/110% '.$this->theme['font'].'; vertical-align: middle; }'."\n" . ' .event-on { background: '.$this->theme['row_on'].'; color: '.$this->theme['bg_text'].'; font: 100 80%/110% '.$this->theme['font'].'; vertical-align: middle }'."\n"
. ' .event-off { background: '.$this->theme['row_off'].'; color: '.$this->theme['bg_text'].'; font: 100 80%/110% '.$this->theme['font'].'; vertical-align: middle; }'."\n" . ' .event-off { background: '.$this->theme['row_off'].'; color: '.$this->theme['bg_text'].'; font: 100 80%/110% '.$this->theme['font'].'; vertical-align: middle }'."\n"
. ' .event-holiday { background: '.$this->theme['bg04'].'; color: '.$this->theme['bg_text'].'; font: 100 80%/110% '.$this->theme['font'].'; vertical-align: middle; }'."\n" . ' .event-holiday { background: '.$this->theme['bg04'].'; color: '.$this->theme['bg_text'].'; font: 100 80%/110% '.$this->theme['font'].'; vertical-align: middle }'."\n"
. ' .time { background: '.$this->theme['navbar_bg'].'; color: '.$this->theme['bg_text'].'; font: 65%/100% '.$this->theme['font'].'; width: '.$time_width.'%; border: 1px '.$this->theme['navbar_text'].'; vertical-align: middle; }'."\n" . ' .time { background: '.$this->theme['navbar_bg'].'; color: '.$this->theme['bg_text'].'; font: 65%/100% '.$this->theme['font'].'; width: '.$time_width.'%; border: 1px '.$this->theme['navbar_text'].'; vertical-align: middle; }'."\n"
. ' .tablecell { width: 80px; height: 80px }'."\n"; . ' .tablecell { width: 80px; height: 80px }';
} }
function no_edit() function no_edit()
@ -2156,7 +2137,7 @@
$overlap = ''; $overlap = '';
for($i=0;$i<count($overlapping_events);$i++) for($i=0;$i<count($overlapping_events);$i++)
{ {
$overlapped_event = $this->bo->read_entry($overlapping_events[$i]) $overlapped_event = $this->bo->read_entry($overlapping_events[$i]);
$overlap .= '<li> ['.$GLOBALS['phpgw']->common->grab_owner_name($overlapped_event['owner']).'] '.$this->link_to_entry($overlapped_event,$month,$mday,$year); $overlap .= '<li> ['.$GLOBALS['phpgw']->common->grab_owner_name($overlapped_event['owner']).'] '.$this->link_to_entry($overlapped_event,$month,$mday,$year);
} }
@ -2280,26 +2261,48 @@
); );
} }
$p->set_var($var); $p->set_var($var);
$col_width = 14;
$p->set_var('col_width','14'); $p->set_var('col_width','14');
if($display_name == True) if($display_name == True)
{ {
$p->set_var('col_title',lang('name')); $p->set_var('col_title',lang('name'));
$p->parse('column_header','column_title',True); $p->parse('column_header','column_title',True);
$p->set_var('col_width','12'); $col_width = 12;
} }
if($this->datetime->days[$i]['weekday'])
{
switch($col_width)
{
case 12:
$col_width = 16;
break;
case 14:
$col_width = 20;
break;
}
}
$p->set_var('col_width',$col_width);
for($i=0;$i<7;$i++) for($i=0;$i<7;$i++)
{ {
$p->set_var('col_title',lang($this->datetime->days[$i])); if($this->bo->prefs['calendar']['weekdays_only'] && $this->datetime->days[$i]['weekday'])
$p->parse('column_header','column_title',True); {
$p->set_var('col_title',lang($this->datetime->days[$i]['name']));
$p->parse('column_header','column_title',True);
}
} }
return $p->fp('out','monthly_header'); return $p->fp('out','monthly_header');
} }
function display_week($startdate,$weekly,$cellcolor,$display_name = False,$owner=0,$monthstart=0,$monthend=0) function display_week($startdate,$weekly,$cellcolor,$display_name = False,$owner=0,$monthstart=0,$monthend=0)
{ {
if($owner == 0) { $owner = $GLOBALS['phpgw_info']['user']['account_id']; } if($owner == 0)
{
$owner = $GLOBALS['phpgw_info']['user']['account_id'];
}
$temp_owner = $this->bo->owner; $temp_owner = $this->bo->owner;
$this->bo->owner = $owner; $this->bo->owner = $owner;
@ -2336,6 +2339,11 @@
$year = intval(substr($date,0,4)); $year = intval(substr($date,0,4));
$month = intval(substr($date,4,2)); $month = intval(substr($date,4,2));
$day = intval(substr($date,6,2)); $day = intval(substr($date,6,2));
$dow = $this->datetime->day_of_week($year,$month,$day);
if($this->bo->prefs['calendar']['weekdays_only'] && ($dow == 0 || $dow == 6))
{
continue;
}
$var = Array( $var = Array(
'column_data' => '', 'column_data' => '',
'extra' => '' 'extra' => ''
@ -2515,6 +2523,10 @@
$owners_array[0] = $owners; $owners_array[0] = $owners;
$cols = 7; $cols = 7;
} }
if($this->bo->prefs['calendar']['weekdays_only'])
{
$cols -= 2;
}
$var = Array( $var = Array(
'cols' => $cols, 'cols' => $cols,
'day_events' => $this->week_header($month,$year,$display_name) 'day_events' => $this->week_header($month,$year,$display_name)

View File

@ -144,15 +144,19 @@
} }
$this->display_item(lang('Display interval in Day View'),'<select name="prefs[interval]">'."\n".$str.'</select>'."\n"); $this->display_item(lang('Display interval in Day View'),'<select name="prefs[interval]">'."\n".$str.'</select>'."\n");
$this->display_item(lang('Send/receive updates via email'),'<input type="checkbox" name="prefs[send_updates]" value="True"'.(@$this->bo->prefs['calendar']['send_updates']?' checked':'').'>'."\n"); $checkboxes = Array(
'send_updates' => lang('Send/receive updates via email'),
'weekdays_only' => lang('Display week days only in Month/Week View'),
'display_status' => lang('Display status of events'),
'default_private' => lang('When creating new events default set to private'),
'display_minicals' => lang('Display mini calendars when printing'),
'print_black_white' => lang('Print calendars in black & white')
);
$this->display_item(lang('Display status of events'),'<input type="checkbox" name="prefs[display_status]" value="True"'.(@$this->bo->prefs['calendar']['display_status']?' checked':'').'>'."\n"); while(list($pref_var,$desc) = each($checkboxes))
{
$this->display_item(lang('When creating new events default set to private'),'<input type="checkbox" name="prefs[default_private]" value="True"'.(@$this->bo->prefs['calendar']['default_private']?' checked':'').'>'."\n"); $this->display_item($desc,'<input type="checkbox" name="prefs['.$pref_var.']" value="True"'.(@$this->bo->prefs['calendar'][$pref_var]?' checked':'').'>'."\n");
}
$this->display_item(lang('Display mini calendars when printing'),'<input type="checkbox" name="prefs[display_minicals]" value="True"'.(@$this->bo->prefs['calendar']['display_minicals']?' checked':'').'>'."\n");
$this->display_item(lang('Print calendars in black & white'),'<input type="checkbox" name="prefs[print_black_white]" value="True"'.(@$this->bo->prefs['calendar']['print_black_white']?' checked':'').'>'."\n");
$this->template->pparse('out','pref'); $this->template->pparse('out','pref');
} }

View File

@ -120,13 +120,34 @@
// Saturday is for arabic support // Saturday is for arabic support
case 'Saturday': case 'Saturday':
$this->days = Array( $this->days = Array(
0 => 'Sat', 0 => Array(
1 => 'Sun', 'name' => 'Sat',
2 => 'Mon', 'weekday' => 0
3 => 'Tue', ),
4 => 'Wed', 1 => Array(
5 => 'Thu', 'name' => 'Sun',
6 => 'Fri' 'weekday' => 0
),
2 => Array(
'name' => 'Mon',
'weekday' => 1
),
3 => Array(
'name' => 'Tue',
'weekday' => 1
),
4 => Array(
'name' => 'Wed',
'weekday' => 1
),
5 => Array(
'name' => 'Thu',
'weekday' => 1
),
6 => Array(
'name' => 'Fri',
'weekday' => 1
)
); );
switch($weekday) switch($weekday)
{ {
@ -143,13 +164,34 @@
break; break;
case 'Monday': case 'Monday':
$this->days = Array( $this->days = Array(
0 => 'Mon', 0 => Array(
1 => 'Tue', 'name' => 'Mon',
2 => 'Wed', 'weekday' => 1
3 => 'Thu', ),
4 => 'Fri', 1 => Array(
5 => 'Sat', 'name' => 'Tue',
6 => 'Sun' 'weekday' => 1
),
2 => Array(
'name' => 'Wed',
'weekday' => 1
),
3 => Array(
'name' => 'Thu',
'weekday' => 1
),
4 => Array(
'name' => 'Fri',
'weekday' => 1
),
5 => Array(
'name' => 'Sat',
'weekday' => 0
),
6 => Array(
'name' => 'Sun',
'weekday' => 0
)
); );
switch($weekday) switch($weekday)
{ {
@ -167,13 +209,34 @@
case 'Sunday': case 'Sunday':
default: default:
$this->days = Array( $this->days = Array(
0 => 'Sun', 0 => Array(
1 => 'Mon', 'name' => 'Sun',
2 => 'Tue', 'weekday' => 0
3 => 'Wed', ),
4 => 'Thu', 1 => Array(
5 => 'Fri', 'name' => 'Mon',
6 => 'Sat' 'weekday' => 1
),
2 => Array(
'name' => 'Tue',
'weekday' => 1
),
3 => Array(
'name' => 'Wed',
'weekday' => 1
),
4 => Array(
'name' => 'Thu',
'weekday' => 1
),
5 => Array(
'name' => 'Fri',
'weekday' => 1
),
6 => Array(
'name' => 'Sat',
'weekday' => 0
)
); );
$sday = mktime(2,0,0,$month,$day - $weekday,$year); $sday = mktime(2,0,0,$month,$day - $weekday,$year);
break; break;