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

View File

@ -206,7 +206,7 @@
for($i=0;$i<7;$i++)
{
$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' => ''
);
$this->output_template_array($p,'daynames','mini_day',$var);
@ -373,12 +373,6 @@
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());
}
@ -546,16 +540,6 @@
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());
}
@ -1156,9 +1140,6 @@
if (!$this->bo->printer_friendly)
{
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw']->common->phpgw_header();
$printer = '';
$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>';
@ -1963,11 +1944,11 @@
. ' 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.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-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-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-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"
. ' .tablecell { width: 80px; height: 80px }'."\n";
. ' .tablecell { width: 80px; height: 80px }';
}
function no_edit()
@ -2156,7 +2137,7 @@
$overlap = '';
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);
}
@ -2281,25 +2262,47 @@
}
$p->set_var($var);
$col_width = 14;
$p->set_var('col_width','14');
if($display_name == True)
{
$p->set_var('col_title',lang('name'));
$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++)
{
$p->set_var('col_title',lang($this->datetime->days[$i]));
if($this->bo->prefs['calendar']['weekdays_only'] && $this->datetime->days[$i]['weekday'])
{
$p->set_var('col_title',lang($this->datetime->days[$i]['name']));
$p->parse('column_header','column_title',True);
}
}
return $p->fp('out','monthly_header');
}
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;
$this->bo->owner = $owner;
@ -2336,6 +2339,11 @@
$year = intval(substr($date,0,4));
$month = intval(substr($date,4,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(
'column_data' => '',
'extra' => ''
@ -2515,6 +2523,10 @@
$owners_array[0] = $owners;
$cols = 7;
}
if($this->bo->prefs['calendar']['weekdays_only'])
{
$cols -= 2;
}
$var = Array(
'cols' => $cols,
'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('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");
$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(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");
while(list($pref_var,$desc) = each($checkboxes))
{
$this->display_item($desc,'<input type="checkbox" name="prefs['.$pref_var.']" value="True"'.(@$this->bo->prefs['calendar'][$pref_var]?' checked':'').'>'."\n");
}
$this->template->pparse('out','pref');
}

View File

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