ability to specifiy a suffix for select-numbers, to eg. add "h" to the label of each option

This commit is contained in:
Ralf Becker 2007-12-16 23:13:32 +00:00
parent 25bcc36a02
commit 18790b1362
2 changed files with 5 additions and 4 deletions

View File

@ -624,9 +624,9 @@ implement only a subset of XUL. Here are the main differences:</p>
years from now or if > 100 a absolut year)<br />
<b>select-number</b>:<br />
Select a number out of a range specified by the options-field:<br />
,{start (default=1)},{end (incl., default=10)},{decrement (default={padding zeros}1)}.<br />
,{start (default=1)},{end (incl., default=10)},{decrement (default={padding zeros}1)},{suffix}.<br />
Example with padding zeros: options=',0,59,05' will give values: 00, 05, 10, ..., 55
(like you would use it for minutes in a time-field)<br />
(like you would use it for minutes in a time-field). The suffix get's added to the label of each option.<br />
<b>select-dow</b>:<br />
Select one or multiple weekdays, keys are as defined in MCAL_M_... (1=Sun, 2=Mon, 4=Tue, ...)<br />
<b>select-app</b>:<br />

View File

@ -103,7 +103,7 @@
*/
function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
{
list($rows,$type,$type2,$type3) = explode(',',$cell['size']);
list($rows,$type,$type2,$type3,$type4) = explode(',',$cell['size']);
$extension_data['type'] = $cell['type'];
@ -386,7 +386,7 @@
$type3 = 1;
// fall-through
case 'select-number': // options: rows,min,max,decrement
case 'select-number': // options: rows,min,max,decrement,suffix
$type = $type === '' ? 1 : intval($type); // min
$type2 = $type2 === '' ? 10 : intval($type2); // max
$format = '%d';
@ -399,6 +399,7 @@
{
$type3 = -$type3; // void infinite loop
}
if (!empty($type4)) $format .= lang($type4);
for ($i=0,$n=$type; $n <= $type2 && $i <= 100; $n += $type3,++$i)
{
$cell['sel_options'][$n] = sprintf($format,$n);