forked from extern/egroupware
made labels with accesskey work
changed name for html-widget from raw to html fixed some error/warnings
This commit is contained in:
parent
eea5281759
commit
0a02c90ac7
@ -30,18 +30,18 @@
|
||||
'text' => 'Text', // Textfield 1 Line (size = [length][,maxlength])
|
||||
'int' => 'Integer', // like text, but only numbers (size = [min][,max])
|
||||
'float' => 'Floating Point', // --------------- " --------------------------
|
||||
'textarea' => 'Textarea', // Multiline Text Input (size = [rows][,cols])
|
||||
'textarea'=> 'Textarea', // Multiline Text Input (size = [rows][,cols])
|
||||
'checkbox'=> 'Checkbox',
|
||||
'radio' => 'Radiobutton', // Radiobutton (size = value if checked)
|
||||
'button' => 'Submitbutton',
|
||||
'hrule' => 'Horizontal Rule',
|
||||
'template' => 'Template', // $cell['name'] contains template-name, $cell['size'] index into $content,$cname,$readonlys
|
||||
'image' => 'Image', // label = url, name=link or method, help=alt or title
|
||||
'date' => '', // Datefield, size='' timestamp or size=format like 'm/d/Y'
|
||||
'template'=> 'Template', // $cell['name'] contains template-name, $cell['size'] index into $content,$cname,$readonlys
|
||||
'image' => 'Image', // label = url, name=link or method, help=alt or title
|
||||
'date' => '', // Datefield, size='' timestamp or size=format like 'm/d/Y'
|
||||
'select' => 'Selectbox', // Selectbox ($sel_options[$name] or $content[options-$name] is array with options)
|
||||
// if size > 1 then multiple selections, size lines showed
|
||||
'raw' => 'Raw', // Raw html in $content[$cell['name']]
|
||||
'file' => 'FileUpload' // show an input type='file', set the local name as ${name}_path
|
||||
'html' => 'Html', // Raw html in $content[$cell['name']]
|
||||
'file' => 'FileUpload' // show an input type='file', set the local name as ${name}_path
|
||||
);
|
||||
/*!
|
||||
@function boetemplate
|
||||
|
@ -14,15 +14,18 @@
|
||||
|
||||
class html
|
||||
{
|
||||
var $user_agent,$ua_version;
|
||||
var $user_agent,$ua_version; // 'mozilla','msie','konqueror'
|
||||
var $prefered_img_title;
|
||||
|
||||
function html()
|
||||
{ // should be Ok for all HTML 4 compatible browsers
|
||||
if (!eregi('compatible; ([a-z_]+)[/ ]+([0-9.]+)',$GLOBALS['HTTP_USER_AGENT'],$parts))
|
||||
{
|
||||
eregi('^([a-z_]+)/([0-9.]+)',$GLOBALS['HTTP_USER_AGENT'],$parts);
|
||||
}
|
||||
list(,$this->user_agent,$this->ua_version) = $parts;
|
||||
$this->user_agent = strtolower($this->user_agent);
|
||||
|
||||
$this->prefered_img_title = $this->user_agent == 'mozilla' && $this->ua_version < 5 ? 'ALT' : 'TITLE';
|
||||
//echo "<p>HTTP_USER_AGENT='$GLOBALS[HTTP_USER_AGENT]', UserAgent: '$this->user_agent', Version: '$this->ua_version', img_title: '$this->prefered_img_title'</p>\n";
|
||||
}
|
||||
@ -112,11 +115,32 @@ class html
|
||||
{
|
||||
if (!($path = $GLOBALS['phpgw']->common->image($app,$image)))
|
||||
$path = $image; // name may already contain absolut path
|
||||
$options .= ' src="'.$path.'"';
|
||||
$image = ' SRC="'.$path.'"';
|
||||
}
|
||||
if (!$no_lang)
|
||||
{
|
||||
$lang = lang($lang);
|
||||
}
|
||||
if (($accesskey = strstr($lang,'&')) && $accesskey[1] != ' ')
|
||||
{
|
||||
$lang_u = str_replace('&'.$accesskey[1],'<u>'.$accesskey[1].'</u>',$lang);
|
||||
$lang = str_replace('&','',$lang);
|
||||
$options = 'ACCESSKEY="'.$accesskey[1].'" '.$options;
|
||||
}
|
||||
else
|
||||
{
|
||||
$accesskey = '';
|
||||
$lang_u = $lang;
|
||||
}
|
||||
if (!$no_lang) $lang = lang($lang);
|
||||
if ($onClick) $options .= " onClick=\"$onClick\"";
|
||||
return $this->input($name,$lang,$image != '' ? 'IMAGE' : 'SUBMIT',$options);
|
||||
|
||||
// <button> is not working in all cases if ($this->user_agent == 'mozilla' && $this->ua_version < 5 || $image)
|
||||
{
|
||||
return $this->input($name,$lang,$image != '' ? 'IMAGE' : 'SUBMIT',$options.$image);
|
||||
}
|
||||
return '<button TYPE="submit" NAME="'.$name.'" VALUE="'.$lang.'" '.$options.'>'.
|
||||
($image != '' ? "<img$image $this->prefered_img_title=\"$lang\"> " : '').
|
||||
($image == '' || $accesskey ? $lang_u : '').'</button>';
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -282,7 +306,7 @@ class html
|
||||
{
|
||||
return $this->style(
|
||||
".th { background: ".$GLOBALS['phpgw_info']['theme']['th_bg']."; }\n".
|
||||
".row_on { background: ".$GLOBALS['phpgw_info']['theme']['row_on']."; }\n".
|
||||
".row_on,.th_bright { background: ".$GLOBALS['phpgw_info']['theme']['row_on']."; }\n".
|
||||
".row_off { background: ".$GLOBALS['phpgw_info']['theme']['row_off']."; }\n"
|
||||
);
|
||||
}
|
||||
@ -292,8 +316,16 @@ class html
|
||||
return $styles ? "<STYLE type=\"text/css\">\n<!--\n$styles\n-->\n</STYLE>" : '';
|
||||
}
|
||||
|
||||
function label($content,$options='')
|
||||
function label($content,$id='',$accesskey='',$options='')
|
||||
{
|
||||
return "<LABEL $options>$content</LABEL>";
|
||||
if ($id != '')
|
||||
{
|
||||
$id = " FOR=\"$id\"";
|
||||
}
|
||||
if ($accesskey != '')
|
||||
{
|
||||
$accesskey = " ACCESSKEY=\"$accesskey\"";
|
||||
}
|
||||
return "<LABEL$id$accesskey $options>$content</LABEL>";
|
||||
}
|
||||
}
|
||||
|
@ -405,6 +405,10 @@
|
||||
$options .= ' onChange="'.($cell['onchange']=='1'?'this.form.submit();':$cell['onchange']).'"';
|
||||
}
|
||||
}
|
||||
if ($form_name != '')
|
||||
{
|
||||
$options = "ID=\"$form_name\" $options";
|
||||
}
|
||||
list($type,$sub_type) = explode('-',$cell['type']);
|
||||
switch ($type)
|
||||
{
|
||||
@ -414,7 +418,7 @@
|
||||
if ($value != '' && strstr($cell['size'],'i')) $value = $this->html->italic($value);
|
||||
$html .= $value;
|
||||
break;
|
||||
case 'raw':
|
||||
case 'html':
|
||||
$html .= $value;
|
||||
break;
|
||||
case 'int': // size: [min][,[max][,len]]
|
||||
@ -641,9 +645,9 @@
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ($ext_type && !$readonly && // extension-processing need to be after all other and only with diff. name
|
||||
!isset($GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]))
|
||||
{
|
||||
if ($ext_type && !$readonly) // extension-processing need to be after all other and only with diff. name
|
||||
{ // unset it first, if it is already set, to be after the other widgets of the ext.
|
||||
unset($GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name]);
|
||||
$GLOBALS['phpgw_info']['etemplate']['to_process'][$form_name] = 'ext-'.$ext_type;
|
||||
}
|
||||
if ($extra_label && ($label != '' || $html == ''))
|
||||
@ -652,8 +656,11 @@
|
||||
{
|
||||
$label = lang($label);
|
||||
}
|
||||
$html_label = $html != '' && $label != '';
|
||||
|
||||
if (($accesskey = strstr($label,'&')) && $accesskey[1] != ' ' && $form_name != '')
|
||||
{
|
||||
$label = str_replace('&'.$accesskey[1],'<u>'.$accesskey[1].'</u>',$label);
|
||||
$label = $this->html->label($label,$form_name,$accesskey[1]);
|
||||
}
|
||||
if (strstr($label,'%s'))
|
||||
{
|
||||
$html = str_replace('%s',$html,$label);
|
||||
@ -662,10 +669,6 @@
|
||||
{
|
||||
$html = ' ';
|
||||
}
|
||||
if ($html_label)
|
||||
{
|
||||
$html = $this->html->label($html);
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
@ -683,7 +686,7 @@
|
||||
*/
|
||||
function process_show(&$content,$to_process,$cname='')
|
||||
{
|
||||
if (!isset($content) || !is_array($content))
|
||||
if (!isset($content) || !is_array($content) || !is_array($to_process))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user