fixed readonly display of select-dow and add a new option if and where the summaries (workday, weekend) should be displayed

This commit is contained in:
Ralf Becker 2005-06-19 11:10:38 +00:00
parent a9d1b9f5b4
commit 1e3124d099

View File

@ -323,7 +323,7 @@
$value = intval($value); $value = intval($value);
break; break;
case 'select-dow': case 'select-dow': // options: rows[,0=summaries befor days, 1=summaries after days, 2=no summaries
if (!defined('MCAL_M_SUNDAY')) if (!defined('MCAL_M_SUNDAY'))
{ {
define('MCAL_M_SUNDAY',1); define('MCAL_M_SUNDAY',1);
@ -340,7 +340,7 @@
} }
$weekstart = $GLOBALS['phpgw_info']['user']['preferences']['calendar']['weekdaystarts']; $weekstart = $GLOBALS['phpgw_info']['user']['preferences']['calendar']['weekdaystarts'];
$cell['sel_options'] = array(); $cell['sel_options'] = array();
if ($rows >= 2) if ($rows >= 2 && !$type)
{ {
$cell['sel_options'] = array( $cell['sel_options'] = array(
MCAL_M_ALLDAYS => 'all days', MCAL_M_ALLDAYS => 'all days',
@ -359,6 +359,14 @@
); );
if ($weekstart != 'Saturday') $cell['sel_options'][MCAL_M_SATURDAY] = 'saturday'; if ($weekstart != 'Saturday') $cell['sel_options'][MCAL_M_SATURDAY] = 'saturday';
if ($weekstart == 'Monday') $cell['sel_options'][MCAL_M_SUNDAY] = 'sunday'; if ($weekstart == 'Monday') $cell['sel_options'][MCAL_M_SUNDAY] = 'sunday';
if ($rows >= 2 && $type == 1)
{
$cell['sel_options'] += array(
MCAL_M_ALLDAYS => 'all days',
MCAL_M_WEEKDAYS => 'working days',
MCAL_M_WEEKEND => 'weekend',
);
}
$value_in = $value; $value_in = $value;
$value = array(); $value = array();
$readonly = $cell['readonly'] || $readonlys; $readonly = $cell['readonly'] || $readonlys;
@ -366,7 +374,7 @@
{ {
if (($value_in & $val) == $val) if (($value_in & $val) == $val)
{ {
$value[] = $readonly ? lang($lable) : $val; $value[] = $val;
if ($val == MCAL_M_ALLDAYS || if ($val == MCAL_M_ALLDAYS ||
$val == MCAL_M_WEEKDAYS && $value_in == MCAL_M_WEEKDAYS || $val == MCAL_M_WEEKDAYS && $value_in == MCAL_M_WEEKDAYS ||
@ -376,11 +384,7 @@
} }
} }
} }
if ($readonly) if (!$readonly)
{
$cell['type'] = 'lable';
}
else
{ {
$GLOBALS['phpgw_info']['etemplate']['to_process'][$name] = 'ext-select-dow'; $GLOBALS['phpgw_info']['etemplate']['to_process'][$name] = 'ext-select-dow';
} }