added <button image=".." ro_image=".."/> to have an image instead of a button

updated referenz.html
This commit is contained in:
Ralf Becker 2002-09-17 12:29:01 +00:00
parent 93f54049cc
commit 4214452471
4 changed files with 35 additions and 10 deletions

View File

@ -427,15 +427,20 @@ implement only a subset of XUL. Here are the main differences:</p>
</tr>
<tr>
<td><b>Submitbutton</b></td>
<td>&lt;button/></td>
<td>&lt;button image="img.gif" ro_image="img-grey.gif"/></td>
<td>yes</td>
<td>button</td>
<td>
<b>a button to submit the form / end the dialog</b><br>
In the html-UI this is rendered as &lt;input type="submit" ...><br>
If <b>onchanged</b> is set and the user has JavaScript enabled
In the html-UI this is rendered as &lt;input type="submit" ...>.<br>
If a button is set readonly (via seting its id in the $readonlys array passed to exec) it is not rendered
at all (if no ro_image is given), like it would be diabled.<p>
<b>onChange</b> xml: <b>onchange</b>: if set and the user has JavaScript enabled
the button is renderd as a link around the label and a hidden
input to set if the link is clicked.
input to set id if the link is clicked.<br>
<b>Options</b> xml: <b>image, ro_image</b>: Image to use instead of a Button with a label. There will
be no button around the image. If a ro_image is given (separated by a comma in the editors options)
it will be used if the button is set readonly (else the button is no rendered at all) .
</td>
</tr>
<tr>

View File

@ -48,16 +48,22 @@ class html
function input($name,$value='',$type='',$options='' )
{
if ($type) $type = "TYPE=$type";
if ($type) $type = 'TYPE="'.$type.'"';
return "<INPUT $type NAME=\"$name\" VALUE=\"$value\" $options>\n";
}
function submit_button($name,$lang,$onClick='',$no_lang=0,$options='')
function submit_button($name,$lang,$onClick='',$no_lang=0,$options='',$image='')
{
if ($image != '')
{
if (!($path = $GLOBALS['phpgw']->common->image($app,$image)))
$path = $image; // name may already contain absolut path
$options .= ' src="'.$path.'"';
}
if (!$no_lang) $lang = lang($lang);
if ($onClick) $options .= " onClick=\"$onClick\"";
return $this->input($name,$lang,'SUBMIT',$options);
return $this->input($name,$lang,$image != '' ? 'IMAGE' : 'SUBMIT',$options);
}
/*!

View File

@ -351,7 +351,7 @@
{
$options .= ' READONLY';
}
if ($cell['disabled'] || $cell['type'] == 'button' && $readonly)
if ($cell['disabled'] || $readonly && $cell['type'] == 'button' && !strstr($cell['size'],','))
{
if ($this->rows == 1) {
return ''; // if only one row omit cell
@ -462,8 +462,11 @@
}
else
{
$html .= $this->html->submit_button($form_name,$label,'',
strlen($label) <= 1 || $cell['no_lang'],$options);
list($img,$ro_img) = explode(',',$cell['size']);
$html .= !$readonly ? $this->html->submit_button($form_name,$label,'',
strlen($label) <= 1 || $cell['no_lang'],$options,$img) :
$this->html->image(substr($this->name,0,strpos($this->name,'.')),$ro_img);
}
$extra_label = False;
break;

View File

@ -73,6 +73,10 @@
),
'tab' => array(
'.name' => 'tabbox,tabs,tabpanels'
),
'button' => array(
'.name' => 'button',
'size' => 'image,ro_image'
)
);
$this->xul2widget = array(
@ -445,6 +449,13 @@
$attr += $menulist_attr;
}
break;
case 'button':
if ($attr['image'] || $attr['ro_image'])
{
$attr['size'] = $attr['image'] . ($attr['ro_image'] ? ','.$attr['ro_image'] : '');
unset($attr['image']); unset($attr['ro_image']);
}
break;
}
$attr['help'] = $attr['statustext']; unset($attr['statustext']);
$spanned = $attr['span'] == 'all' ? $etempl->cols - $col : $attr['span'];