Source for file OverInfo.class.php
Documentation is available at OverInfo.class.php
* For including this file you have to define the constant "CLASSPATH".
* Because every include in the framework depends on the CLASSPATH definition.
* The CLASSPATH means the relative path to the folder that contains the
echo "<h3>You have to define the constant CLASSPATH!</h3>\n";
echo "Example: define( 'CLASSPATH', '../path/to/classes/' );\n";
require_once( CLASSPATH. "html/HTMLSpan.class.php" );
require_once( CLASSPATH. "html/HTMLLayer.class.php" );
* A class to generate a "<div>"-layer which makes a second layer visible
* when the user goes over it with the mousecursor.
* @author Daniel Plücken <daniel@debakel.net>
* @license http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
* @copyright Copyright (c) 2005 Daniel Plücken <daniel@debakel.net>
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
* @author Daniel Plücken <daniel@debakel.net>
* @param $style_pop_layer
* @param $style_base_layer
* @param $x_margin_to_cursor
* @param $y_margin_to_cursor
$x_margin_to_cursor = 20,
$hide_selects_on_over = true,
$move_popup_with_mouse = true
$this->pop_layer->setStyle( $style_pop_layer );
$this->pop_layer->setFreeStyle( "display:none" );
// $this->setOnMouseMove( "this.onmousemove=setCoords" );
* Order that the div-tag (popup layer) should be written directly to the
* body; otherwise the div-tag will be written onload-event of the body-tag.
* It is useful to keep the javascript function trough an ajax request, when
* the body is already loaded.
* @author Daniel Plücken <daniel@debakel.net>
* Stores the popup layer of this OverInfo to the next z-index.
* @author Daniel Plücken <daniel@debakel.net>
$this->setZIndex( $int );
$obj_ref->setZIndex( $int++ );
* Stores the needed javascript to output in the head of html-document.
* @author Daniel Plücken <daniel@debakel.net>
* @param $x_margin_to_cursor
* @param $y_margin_to_cursor
static $js_already_set = false;
$GLOBALS["javascript_content"][] =
window.oia_x = { $x_margin_to_cursor};
window.oia_y = { $y_margin_to_cursor};
window.setCoords = function( which2move_obj, referrer_obj, move_with_mouse, evt )
which2move_obj = document.getElementById( which2move_obj );
if ( !evt || evt == null )
if ( evt && ( evt.pageX || evt.pageY ) )
if ( evt && ( evt.clientX || evt.clientY ) )
if ( document.documentElement.scrollTop )
+ document.documentElement.scrollLeft;
+ document.documentElement.scrollTop;
pos_x = evt.clientX + document.body.scrollLeft;
pos_y = evt.clientY + document.body.scrollTop;
// Get the left position of the Element
while ( obj.offsetParent )
// Get the top position of the Element
while ( obj.offsetParent )
which2move_obj.style.display = 'block';
which2move_obj.style.top = (pos_y+window.oia_y) + 'px';
which2move_obj.style.left = (pos_x+window.oia_x) + 'px';
window.startOverInfo = function( which, ref_obj, no_select_hiding, move_with_mouse )
&& navigator.appName == "Microsoft Internet Explorer"
var aV = navigator.appVersion.replace( /^.+?MSIE ([0-9.]+).+$/, "$1" )
if ( parseFloat( aV ) < 7.0 )
var sel = document.getElementsByTagName( 'select' );
for ( var i = 0; i < sel.length; i++ )
sel[i].style.visibility = 'hidden';
var tmp_obj = document.getElementById( which );
window.setCoords( tmp_obj, ref_obj, move_with_mouse, null );
window.stopOverInfo = function( which, no_select_hiding )
&& navigator.appName == "Microsoft Internet Explorer"
var aV = navigator.appVersion.replace( /^.+?MSIE ([0-9.]+).+$/, "$1" )
if ( parseFloat( aV ) < 7.0 )
var sel = document.getElementsByTagName('select');
for ( var i = 0; i < sel.length; i++ )
sel[i].style.visibility = 'visible';
var tmp_obj = document.getElementById( which );
tmp_obj.style.left = -17378;
tmp_obj.style.top = -17378;
tmp_obj.style.display = 'none';
* Returns a generated string based on the attributes of this HTML-Object.
* @author Daniel Plücken <daniel@debakel.net>
static $firsttime = true;
$prepared_content_str = str_replace(
addslashes( $this->pop_layer->get() )
$this->setOnMouseOut( "window.stopOverInfo( '{$tmp_str}', false )" );
. "window.startOverInfo( '{$tmp_str}', this, false, "
"this.onmousemove=function(evt){window.setCoords( '{$tmp_str}', this, true, evt );}"
$this->setOnMouseOut( "window.stopOverInfo( '{$tmp_str}', true )" );
. "window.startOverInfo( '{$tmp_str}', this, true, "
"this.onmousemove=function(evt){window.setCoords( '{$tmp_str}', this, true, evt );}"
$tmp_str = $firsttime ? "" : "";
document.getElementsByTagName('body')[0].innerHTML += tmp_str;
$prepared_content_str = addslashes( $prepared_content_str );
if ( window.addEventListener )
window.addEventListener( "load", new Function( "document.getElementsByTagName('body')[0].innerHTML += '" + tmp_str + "';"), false );
if ( window.attachEvent )
window.attachEvent( 'onload', new Function( "document.getElementsByTagName('body')[0].innerHTML += '" + tmp_str + "';") );
// write the popuplayer, with the help of javascript, at the end of the document.
$poplayer_write_str = <<<JSCRIPT
<div style="position:absolute;top:-17318;left:-17318;z-index:-17378;display:hidden">
<script language="javascript" type="text/javascript">
var tmp_str = '{ $prepared_content_str}';
return $poplayer_write_str. parent::get();
} // END of class OverInfo
|