mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 15:18:58 +01:00
1) fix for bug #905284, etemplate does not show images if webserver_url contains protocoll and domain
2) added a new progress-bar
This commit is contained in:
parent
dcd1912a7b
commit
77fd33e471
@ -28,16 +28,9 @@
|
|||||||
list(,$this->user_agent,$this->ua_version) = $parts;
|
list(,$this->user_agent,$this->ua_version) = $parts;
|
||||||
$this->user_agent = strtolower($this->user_agent);
|
$this->user_agent = strtolower($this->user_agent);
|
||||||
|
|
||||||
$this->prefered_img_title = $this->user_agent == 'mozilla' && $this->ua_version < 5 ? 'alt' : 'title';
|
$this->netscape4 = $this->user_agent == 'mozilla' && $this->ua_version < 5;
|
||||||
//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";
|
$this->prefered_img_title = $this->netscape4 ? 'alt' : 'title';
|
||||||
|
//echo "<p>HTTP_USER_AGENT='$_SERVER[HTTP_USER_AGENT]', UserAgent: '$this->user_agent', Version: '$this->ua_version', img_title: '$this->prefered_img_title'</p>\n";
|
||||||
$this->document_root = $_SERVER['DOCUMENT_ROOT'];
|
|
||||||
// this is because some webservers report their docroot without the leading slash
|
|
||||||
if (!is_dir($this->document_root) && is_dir('/'.$this->document_root))
|
|
||||||
{
|
|
||||||
$this->document_root = '/' . $this->document_root;
|
|
||||||
}
|
|
||||||
//echo "<p>_SERVER[DOCUMENT_ROOT]='$_SERVER[DOCUMENT_ROOT]', this->document_root='$this->document_root'</p>\n";
|
|
||||||
|
|
||||||
if ($GLOBALS['phpgw']->translation)
|
if ($GLOBALS['phpgw']->translation)
|
||||||
{
|
{
|
||||||
@ -373,6 +366,24 @@
|
|||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function progressbar( $percent,$title='',$options='',$width='',$color='',$height='' )
|
||||||
|
{
|
||||||
|
$percent = (int) $percent;
|
||||||
|
if (!$width) $width = '30px';
|
||||||
|
if (!$height)$height= '5px';
|
||||||
|
if (!$color) $color = '#D00000';
|
||||||
|
$title = $title ? $this->htmlspecialchars($title) : $percent.'%';
|
||||||
|
|
||||||
|
if ($this->netscape4)
|
||||||
|
{
|
||||||
|
return $title;
|
||||||
|
}
|
||||||
|
return '<div title="'.$title.'" '.$options.
|
||||||
|
' style="height: '.$height.'; width: '.$width.'; border: 1px solid black; padding: 1px;'.
|
||||||
|
(stristr($options,'onclick="') ? ' cursor: pointer; cursor: hand;' : '').'">'."\n\t".
|
||||||
|
'<div style="height: '.$height.'; width: '.$percent.'%; background: '.$color.';" />'."\n</div>\n";
|
||||||
|
}
|
||||||
|
|
||||||
function image( $app,$name,$title='',$options='' )
|
function image( $app,$name,$title='',$options='' )
|
||||||
{
|
{
|
||||||
$name = str_replace(array('.gif','.GIF','.png','.PNG'),'',$name);
|
$name = str_replace(array('.gif','.GIF','.png','.PNG'),'',$name);
|
||||||
@ -381,8 +392,13 @@
|
|||||||
{
|
{
|
||||||
$path = $name; // name may already contain absolut path
|
$path = $name; // name may already contain absolut path
|
||||||
}
|
}
|
||||||
if (!@is_readable($this->document_root . $path))
|
if (!@is_readable(str_replace($GLOBALS['phpgw_info']['server']['webserver_url'],PHPGW_SERVER_ROOT,$path)))
|
||||||
{
|
{
|
||||||
|
// if the image-name is a percentage, use a progressbar
|
||||||
|
if (substr($name,-1) == '%' && is_numeric($percent = substr($name,0,-1)))
|
||||||
|
{
|
||||||
|
return $this->progressbar($percent,$title);
|
||||||
|
}
|
||||||
return $title;
|
return $title;
|
||||||
}
|
}
|
||||||
if ($title)
|
if ($title)
|
||||||
|
Loading…
Reference in New Issue
Block a user