diff --git a/phpgwapi/inc/class.html.inc.php b/phpgwapi/inc/class.html.inc.php
index cb30d5be94..2b47fdf133 100644
--- a/phpgwapi/inc/class.html.inc.php
+++ b/phpgwapi/inc/class.html.inc.php
@@ -1,16 +1,16 @@
*
-* -------------------------------------------- *
-* This program is free software; you can redistribute it and/or modify it *
-* under the terms of the GNU General Public License as published by the *
-* Free Software Foundation; either version 2 of the License, or (at your *
-* option) any later version. *
-\**************************************************************************/
+ /**************************************************************************\
+ * eGroupWare - HTML creation class *
+ * http://www.eGroupWare.org *
+ * Written and (c) by Ralf Becker *
+ * -------------------------------------------- *
+ * This program is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU General Public License as published by the *
+ * Free Software Foundation; either version 2 of the License, or (at your *
+ * option) any later version. *
+ \**************************************************************************/
-/* $Id$ */
+ /* $Id$ */
/**
* generates html with methods representing html-tags or higher widgets
@@ -38,7 +38,7 @@ class html
*/
var $prefered_img_title;
/**
- * charset used by the page, as returned by $GLOBALS['phpgw']->translation->charset()
+ * charset used by the page, as returned by $GLOBALS['egw']->translation->charset()
* @var string
*/
var $charset;
@@ -53,7 +53,6 @@ class html
*/
var $wz_tooltip_included = False;
-
/**
* Constructor: initialised the class-vars
*/
@@ -67,16 +66,16 @@ class html
}
list(,$this->user_agent,$this->ua_version) = $parts;
$this->user_agent = strtolower($this->user_agent);
-
+
$this->netscape4 = $this->user_agent == 'mozilla' && $this->ua_version < 5;
$this->prefered_img_title = $this->netscape4 ? 'alt' : 'title';
//echo "
\n";
-
- if ($GLOBALS['phpgw']->translation)
+
+ if ($GLOBALS['egw']->translation)
{
- $this->charset = $GLOBALS['phpgw']->translation->charset();
+ $this->charset = $GLOBALS['egw']->translation->charset();
}
- $this->phpgwapi_js_url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/phpgwapi/js';
+ $this->phpgwapi_js_url = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js';
}
/**
@@ -97,7 +96,7 @@ class html
''.
'";
}
-
+
/**
* Handles tooltips via the wz_tooltip class from Walter Zorn
*
@@ -115,14 +114,14 @@ class html
{
if (!$this->wz_tooltip_included)
{
- if (!strstr('wz_tooltip',$GLOBALS['phpgw_info']['flags']['need_footer']))
+ if (!strstr('wz_tooltip',$GLOBALS['egw_info']['flags']['need_footer']))
{
- $GLOBALS['phpgw_info']['flags']['need_footer'] .= ''."\n";
+ $GLOBALS['egw_info']['flags']['need_footer'] .= ''."\n";
}
$this->wz_tooltip_included = True;
}
if ($do_lang) $text = lang($text);
-
+
$opt_out = 'this.T_WIDTH = 200;';
if (is_array($options))
{
@@ -133,10 +132,10 @@ class html
}
}
if ($text === False) return ' onmouseover="'.$opt_out.'return escape(this.innerHTML);"';
-
+
return ' onmouseover="'.$opt_out.'return escape(\''.str_replace(array("\n","\r","'",'"'),array('','',"\\'",'"'),$text).'\')"';
}
-
+
/**
* activates URLs in a text, URLs get replaced by html-links
*
@@ -147,34 +146,34 @@ class html
{
// Exclude everything which is already a link
$NotAnchor = '(?\\1 AT \\2 DOT \\3',
$content);
-
+
// First match things beginning with http:// (or other protocols)
$Protocol = '(http|ftp|https):\/\/';
$Domain = '([\w]+.[\w]+)';
$Subdir = '([\w\-\.,@?^=%&;:\/~\+#]*[\w\-\@?^=%&\/~\+#])?';
$Expr = '/' . $NotAnchor . $Protocol . $Domain . $Subdir . '/i';
-
+
$result = preg_replace( $Expr, "$2$3", $result );
-
+
// Now match things beginning with www.
$NotHTTP = '(?$0", $result );
}
-
+
/**
* escapes chars with special meaning in html as entities
*
* Allows to use and char in the html-output and prefents XSS attacks.
- * Some entities are allowed and get NOT escaped:
+ * Some entities are allowed and get NOT escaped:
* - some translations (AFAIK the arabic ones) need this
* - < > for convinience
*
@@ -185,13 +184,13 @@ class html
{
// add @ by lkneschke to supress warning about unknown charset
$str = @htmlspecialchars($str,ENT_COMPAT,$this->charset);
-
+
// we need '' unchanged, so we translate it back
$str = str_replace(array('&#',' ','<','>'),array('',' ','<','>'),$str);
return $str;
}
-
+
/**
* allows to show and select one item from an array
*
@@ -218,7 +217,7 @@ class html
}
}
$out = "\n";
-
+
return $out;
}
-
+
/**
* emulating a multiselectbox using checkboxes
*
@@ -276,7 +275,7 @@ class html
$name .= '[]';
}
$base_name = substr($name,0,-2);
-
+
if (!is_array($key))
{
// explode on ',' only if multiple values expected and the key contains just numbers and commas
@@ -284,7 +283,7 @@ class html
}
$html = '';
$options_no_id = preg_replace('/id="[^"]+"/i','',$options);
-
+
if ($selected_first)
{
$selected = $not_selected = array();
@@ -314,18 +313,18 @@ class html
}
if ($label && !$no_lang) $label = lang($label);
if ($title && !$no_lang) $title = lang($title);
-
+
if (strlen($label) > $max_len) $max_len = strlen($label);
-
+
$html .= $this->label($this->checkbox($name,in_array($val,$key),$val,$options_no_id.
' id="'.$base_name.'['.$val.']'.'" '.($title ? 'title="'.$this->htmlspecialchars($title).'" ':'')).
$this->htmlspecialchars($label),$base_name.'['.$val.']')." \n";
}
$style = 'height: '.(1.7*$multiple).'em; width: '.(4+$max_len*($max_len < 15 ? 0.65 : 0.50)).'em; background-color: white; overflow: auto; border: lightgray 2px inset;';
-
+
return $this->div($html,$options,'',$style);
}
-
+
/**
* generates an option-tag for a selectbox
*
@@ -354,7 +353,7 @@ class html
($title ? ' title="'.$this->htmlspecialchars($no_lang ? $title : lang($title)).'"' : '') . '>'.
$this->htmlspecialchars($no_lang || $label == '' ? $label : lang($label)) . "\n";
}
-
+
/**
* generates a div-tag
*
@@ -368,10 +367,10 @@ class html
{
if ($class) $options .= ' class="'.$class.'"';
if ($style) $options .= ' style="'.$style.'"';
-
+
return "
\n".($content ? "$content
\n" : '');
}
-
+
/**
* generate one or more hidden input tag(s)
*
@@ -399,12 +398,12 @@ class html
}
return $html;
}
-
+
/**
* generate a textarea tag
*
* @param string $name name attr. of the tag
- * @param string $value default
+ * @param string $value default
* @param boolean $ignore_empty if true all empty, zero (!) or unset values, plus filer=none
* @param string html
*/
@@ -412,7 +411,7 @@ class html
{
return "\n";
}
-
+
/**
* Checks if HTMLarea (or an other richtext editor) is availible for the used browser
*
@@ -430,7 +429,7 @@ class html
return False;
}
}
-
+
/**
* compability function for former used htmlarea. Please use function tinymce now!
*
@@ -450,17 +449,17 @@ class html
function init_tinymce()
{
/* do stuff once */
- if (!is_object($GLOBALS['phpgw']->js))
+ if (!is_object($GLOBALS['egw']->js))
{
- $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
+ $GLOBALS['egw']->js = CreateObject('phpgwapi.javascript');
}
- if (!strstr($GLOBALS['phpgw_info']['flags']['java_script'],'tinyMCE'))
+ if (!strstr($GLOBALS['egw_info']['flags']['java_script'],'tinyMCE'))
{
- $GLOBALS['phpgw']->js->validate_file('tinymce','jscripts/tiny_mce/tiny_mce');
+ $GLOBALS['egw']->js->validate_file('tinymce','jscripts/tiny_mce/tiny_mce');
}
}
-
+
/**
* creates a textarea inputfield for the tinymce js-widget (returns the necessary html and js)
*
@@ -468,7 +467,7 @@ class html
*
* @param string $name name and id of the input-field
* @param string $content='' of the tinymce (will be run through htmlspecialchars !!!), default ''
- * @param string $style='' initial css for the style attribute
+ * @param string $style='' initial css for the style attribute
* @param string $init_options='', see http://tinymce.moxiecode.com/ for all init options. mode and elements are allready set.
* to make things more easy, you also can just provide a comma seperated list here with the options you need.
* Supportet are: 'TableOperations','ContextMenu','ColorChooser'
@@ -478,7 +477,7 @@ class html
*/
function tinymce($name,$content='',$style='',$init_options='',$base_href='')
{
- if (!$style)
+ if (!$style)
{
$style = 'width:100%; min-width:500px; height:300px;';
}
@@ -486,10 +485,10 @@ class html
{
return $this->textarea($name,$content,'style="'.$style.'"');
}
-
+
/* do stuff once */
$this->init_tinymce();
-
+
if(strpos($init_options,':') === false)
{
$init = 'theme : "advanced", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left"';
@@ -539,28 +538,28 @@ class html
{
$init .= ',document_base_url : "'. $base_href. '", relative_urls : true';
}
-
+
$init_options = $init. ','. $tab1a. '",'. $tab2a. '",'. $tab3a. '",'. $plugs. '",'. $eve. '"';
}
-
+
/* do again and again */
return '
-
+
';
- }
-
+ }
+
/**
* represents html's input tag
*
@@ -577,7 +576,7 @@ class html
}
return "htmlspecialchars($value)."\" $options />\n";
}
-
+
/**
* represents html's button (input type submit or image)
*
@@ -600,8 +599,8 @@ class html
if ($image != '')
{
$image = str_replace(array('.gif','.GIF','.png','.PNG'),'',$image);
-
- if (!($path = $GLOBALS['phpgw']->common->image($app,$image)))
+
+ if (!($path = $GLOBALS['egw']->common->image($app,$image)))
{
$path = $image; // name may already contain absolut path
}
@@ -624,7 +623,7 @@ class html
$label_u = $label;
}
if ($onClick) $options .= ' onclick="'.str_replace('"','\\"',$onClick).'"';
-
+
// ';
}
-
+
/**
* creates an absolut link + the query / get-variables
*
@@ -657,9 +656,9 @@ class html
parse_str($v,$v);
$vars += $v;
}
- return $GLOBALS['phpgw']->link($url,$vars);
+ return $GLOBALS['egw']->link($url,$vars);
}
-
+
/**
* represents html checkbox
*
@@ -673,7 +672,7 @@ class html
{
return '\n";
}
-
+
/**
* represents a html form
*
@@ -691,7 +690,7 @@ class html
$url = $url ? $this->link($url,$url_vars) : $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
$html = "