mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
Added an id tag to templates, contact and infolog widget
New js_pseudo_function to fetch the styles of a template: template::styles('template.name')
This commit is contained in:
parent
2bb4fd1df1
commit
60a65bb560
@ -80,7 +80,7 @@ class contact_widget
|
||||
function pre_process($name,&$value,&$cell,&$readonlys,&$extension_data,&$tmpl)
|
||||
{
|
||||
//echo "<p>contact_widget::pre_process('$name','$value',".print_r($cell,true).",...)</p>\n";
|
||||
switch($cell['type'])
|
||||
switch($type = $cell['type'])
|
||||
{
|
||||
case 'contact-fields':
|
||||
$GLOBALS['egw']->translation->add_app('addressbook');
|
||||
@ -158,6 +158,8 @@ class contact_widget
|
||||
}
|
||||
break;
|
||||
}
|
||||
$cell['id'] = ($cell['id'] ? $cell['id'] : $cell['name'])."[$type]";
|
||||
|
||||
return True; // extra label ok
|
||||
}
|
||||
}
|
||||
|
@ -615,8 +615,8 @@ foreach($sess as $key => $val)
|
||||
}
|
||||
// make the content availible as class-var for extensions
|
||||
$this->content =& $content;
|
||||
|
||||
$html = "\n\n<!-- BEGIN eTemplate $this->name -->\n\n";
|
||||
|
||||
$html = "\n\n<!-- BEGIN eTemplate $this->name -->\n<div id=\"$this->name\">\n\n";
|
||||
if (!$GLOBALS['egw_info']['etemplate']['styles_included'][$this->name])
|
||||
{
|
||||
$GLOBALS['egw_info']['etemplate']['styles_included'][$this->name] = True;
|
||||
@ -631,7 +631,7 @@ foreach($sess as $key => $val)
|
||||
$child['align'],
|
||||
),'class,align')) : $h;
|
||||
}
|
||||
return $html."<!-- END eTemplate $this->name -->\n\n";
|
||||
return $html."\n</div>\n<!-- END eTemplate $this->name -->\n\n";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1118,7 +1118,7 @@ foreach($sess as $key => $val)
|
||||
if ($value != '' && $style && strpos($style,'b')!==false) $value = $this->html->bold($value);
|
||||
if ($value != '' && $style && strpos($style,'i')!==false) $value = $this->html->italic($value);
|
||||
// if the label has a name, use it as id in a span, to allow addressing it via javascript
|
||||
$html .= ($name ? '<span id="'.$name.'">' : '').$value.($name ? '</span>' : '');
|
||||
$html .= ($name ? '<span id="'.($cell['id']?$cell['id']:$name).'">' : '').$value.($name ? '</span>' : '');
|
||||
if ($help)
|
||||
{
|
||||
$class = array(
|
||||
@ -1860,6 +1860,13 @@ foreach($sess as $key => $val)
|
||||
$str = lang($matches[1]);
|
||||
$on = str_replace($matches[0],'\''.addslashes($str).'\'',$on);
|
||||
}
|
||||
|
||||
// inserts the styles of a named template
|
||||
if (preg_match('/template::styles\(["\']{1}(.*)["\']{1}\)/U',$on,$matches))
|
||||
{
|
||||
$tpl = $matches[1] == $this->name ? $this : new etemplate($matches[1]);
|
||||
$on = str_replace($matches[0],"'<style>".str_replace(array("\n","\r"),'',$tpl->style)."</style>'",$on);
|
||||
}
|
||||
}
|
||||
if (strpos($on,'confirm(') !== false && preg_match('/confirm\(["\']{1}(.*)["\']{1}\)/',$on,$matches)) {
|
||||
$question = lang($matches[1]).(substr($matches[1],-1) != '?' ? '?' : ''); // add ? if not there, saves extra phrase
|
||||
|
@ -200,6 +200,8 @@ class infolog_widget
|
||||
}
|
||||
break;
|
||||
}
|
||||
$cell['id'] = ($cell['id'] ? $cell['id'] : $cell['name'])."[$type]";
|
||||
|
||||
return True; // extra label ok
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user