- added function to create tooltips with the wz_tooltip class

- reformatted the file, it was totaly messed up
This commit is contained in:
Ralf Becker 2004-05-07 21:21:20 +00:00
parent 218a56178e
commit 5a008e6768

View File

@ -1,22 +1,23 @@
<?php <?php
/**************************************************************************\ /**************************************************************************\
* eGroupWare - HTML creation class * * eGroupWare - HTML creation class *
* http://www.eGroupWare.org * * http://www.eGroupWare.org *
* Written and (c) by Ralf Becker <RalfBecker@outdoor-training.de> * * Written and (c) by Ralf Becker <RalfBecker@outdoor-training.de> *
* -------------------------------------------- * * -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it * * 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 * * 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 * * Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. * * option) any later version. *
\**************************************************************************/ \**************************************************************************/
/* $Id$ */ /* $Id$ */
class html class html
{ {
var $user_agent,$ua_version; // 'mozilla','msie','konqueror' var $user_agent,$ua_version; // 'mozilla','msie','konqueror'
var $prefered_img_title; var $prefered_img_title;
var $charset,$phpgwapi_js_url; var $charset,$phpgwapi_js_url;
var $need_footer = False; // do we need to be called at the end of the page
function html() function html()
{ {
@ -39,6 +40,21 @@
$this->phpgwapi_js_url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/phpgwapi/js'; $this->phpgwapi_js_url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/phpgwapi/js';
} }
function tooltip($text,$do_lang=False)
{
if (!$this->wz_tooltip_included)
{
if (!strstr('wz_tooltip',$GLOBALS['phpgw_info']['flags']['need_footer']))
{
$GLOBALS['phpgw_info']['flags']['need_footer'] .= '<script language="JavaScript" type="text/javascript" src="'.$this->phpgwapi_js_url.'/wz_tooltip/wz_tooltip.js"></script>'."\n";
}
$this->wz_tooltip_included = True;
}
if ($do_lang) $text = lang($text);
return ' onmouseover="return escape(\''.addslashes(@htmlentities($text,ENT_COMPAT,$this->charset)).'\')"';
}
function activate_links($content) function activate_links($content)
{ {
// Exclude everything which is already a link // Exclude everything which is already a link
@ -198,17 +214,18 @@
else else
{ {
$GLOBALS['phpgw_info']['flags']['java_script'] .= $GLOBALS['phpgw_info']['flags']['java_script'] .=
'<script type="text/javascript" src="'.ereg_replace('[?&]*click_history=[0-9a-f]*','',$GLOBALS['phpgw']->link('/phpgwapi/inc/htmlarea-lang.php',array('lang'=>$lang))).'"></script>'."\n"; '<script type="text/javascript" src="'.ereg_replace('[?&]*click_history=[0-9a-f]*','',
$GLOBALS['phpgw']->link('/phpgwapi/inc/htmlarea-lang.php',array('lang'=>$lang))).'"></script>'."\n";
} }
$GLOBALS['phpgw_info']['flags']['java_script_thirst'] .= $GLOBALS['phpgw_info']['flags']['java_script_thirst'] .=
'<style type="text/css">@import url(/egroupware/phpgwapi/js/htmlarea/htmlarea.css);</style> '<style type="text/css">@import url(/egroupware/phpgwapi/js/htmlarea/htmlarea.css);</style>
<script type="text/javascript"> <script type="text/javascript">
_editor_url = "'."$this->phpgwapi_js_url/htmlarea/".'"; _editor_url = "'."$this->phpgwapi_js_url/htmlarea/".'";
// var htmlareaConfig = new HTMLArea.Config(); // var htmlareaConfig = new HTMLArea.Config();
// htmlareaConfig.editorURL = '."'$this->phpgwapi_js_url/htmlarea/'; // htmlareaConfig.editorURL = '."'$this->phpgwapi_js_url/htmlarea/';
</script>\n"; </script>\n";
// set a base href to get relative image-pathes working // set a base href to get relative image-pathes working
if ($base_href && $this->user_agent != 'msie') // HTMLarea does not work in IE with base href set !!! if ($base_href && $this->user_agent != 'msie') // HTMLarea does not work in IE with base href set !!!
@ -230,11 +247,11 @@
} }
$GLOBALS['phpgw_info']['flags']['java_script'] .= $GLOBALS['phpgw_info']['flags']['java_script'] .=
'<script type="text/javascript"> '<script type="text/javascript">
/** Replacement for the replace-helperfunction to make it possible to include plugins. */ /** Replacement for the replace-helperfunction to make it possible to include plugins. */
HTMLArea.replace = function(id, config) HTMLArea.replace = function(id, config)
{ {
var ta = HTMLArea.getElementById("textarea", id); var ta = HTMLArea.getElementById("textarea", id);
if(ta) if(ta)
@ -248,12 +265,12 @@
{ {
return null; return null;
} }
}; };
'.$load_plugin_string.' '.$load_plugin_string.'
var htmlareaConfig = new HTMLArea.Config(); var htmlareaConfig = new HTMLArea.Config();
htmlareaConfig.editorURL = '."'$this->phpgwapi_js_url/htmlarea/';"; htmlareaConfig.editorURL = '."'$this->phpgwapi_js_url/htmlarea/';";
$GLOBALS['phpgw_info']['flags']['java_script'] .="</script>\n"; $GLOBALS['phpgw_info']['flags']['java_script'] .="</script>\n";
} }
@ -419,8 +436,7 @@
function sbox_submit( $sbox,$no_script=0 ) function sbox_submit( $sbox,$no_script=0 )
{ {
$html = str_replace('<select','<select onchange="this.form.submit()" ', $html = str_replace('<select','<select onchange="this.form.submit()" ',$sbox);
$sbox);
if ($no_script) if ($no_script)
{ {
$html .= '<noscript>'.$this->submit_button('send','>').'</noscript>'; $html .= '<noscript>'.$this->submit_button('send','>').'</noscript>';
@ -540,8 +556,7 @@
*/ */
function theme2css() function theme2css()
{ {
return return ".th { background: ".$GLOBALS['phpgw_info']['theme']['th_bg']."; }\n".
".th { background: ".$GLOBALS['phpgw_info']['theme']['th_bg']."; }\n".
".row_on,.th_bright { 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"; ".row_off { background: ".$GLOBALS['phpgw_info']['theme']['row_off']."; }\n";
} }
@ -563,4 +578,4 @@
} }
return "<label$id$accesskey $options>$content</label>"; return "<label$id$accesskey $options>$content</label>";
} }
} }