2 if ( empty ( $PHP_SELF ) && ! empty ( $_SERVER ) &&
3 ! empty ( $_SERVER['PHP_SELF'] ) ) {
4 $PHP_SELF = $_SERVER['PHP_SELF'];
6 if ( ! empty ( $PHP_SELF ) && preg_match ( "/\/includes\//", $PHP_SELF ) ) {
7 die ( "You can't access this file directly!" );
10 <script type="text/javascript">
13 // The following code is used to support the small popups that
14 // give the full description of an event when the user move the
18 // I (Benoit Maisonny <benoit@synclude.com>) tested this code with Mozilla 0.8.1 (on Linux),
19 // with IE5.5 SP1 (on WinNT4) and with Netscape Communicator 4.74 (on Linux).
20 // Netscape 6.0 and 6.01 seem to have a bug related to the visibility attribute.
21 // I suppose it will be corrected as soon as they release a new version, based on
22 // a more recent Mozilla source code.
23 // I'm not able to test this javascript code with IE4. It'd be glad to know if it works.
26 NS4 = (document.layers) ? 1 : 0;
27 IE4 = (document.all) ? 1 : 0;
28 W3C = (document.getElementById) ? 1 : 0;
29 <?php // W3C stands for the W3C standard, implemented in Mozilla (and Netscape 6) and IE5
31 // Function show(evt, name)
32 // evt is a pointer to the Event object passed when the event occurs
33 // name is the ID attribute of the element to show
35 function show ( evt, name ) {
37 evt = window.event; //is it necessary?
40 var currentX, //mouse position on X axis
41 currentY, //mouse position on X axis
42 x, //layer target position on X axis
43 y, //layer target position on Y axis
44 docWidth, //width of current frame
45 docHeight, //height of current frame
46 layerWidth, //width of popup layer
47 layerHeight, //height of popup layer
48 ele; //points to the popup element
50 // First let's initialize our variables
52 ele = document.getElementById(name);
53 currentX = evt.clientX,
54 currentY = evt.clientY;
55 docWidth = document.width;
56 docHeight = document.height;
57 layerWidth = ele.style.width;
58 layerHeight = ele.style.height;
60 ele = document.layers[name];
63 docWidth = document.width;
64 docHeight = document.height;
65 layerWidth = ele.clip.width;
66 layerHeight = ele.clip.height;
67 } else { // meant for IE4
68 ele = document.all[name];
69 currentX = evt.clientX,
70 currentY = evt.clientY;
71 docHeight = document.body.offsetHeight;
72 docWidth = document.body.offsetWidth;
73 //var layerWidth = document.all[name].offsetWidth;
74 // for some reason, this doesn't seem to work... so set it to 200
76 layerHeight = ele.offsetHeight;
79 // Then we calculate the popup element's new position
80 if ( ( currentX + layerWidth ) > docWidth ) {
81 x = ( currentX - layerWidth );
85 if ( ( currentY + layerHeight ) >= docHeight ) {
86 y = ( currentY - layerHeight - 20 );
91 x += document.body.scrollLeft;
92 y += document.body.scrollTop;
95 x += window.pageXOffset;
96 y += window.pageYOffset;
98 // (for debugging purpose) alert("docWidth " + docWidth + ", docHeight " + docHeight + "\nlayerWidth " + layerWidth + ", layerHeight " + layerHeight + "\ncurrentX " + currentX + ", currentY " + currentY + "\nx " + x + ", y " + y);
100 // Finally, we set its position and visibility
102 //ele.xpos = parseInt ( x );
103 ele.left = parseInt ( x );
104 //ele.ypos = parseInt ( y );
105 ele.top = parseInt ( y );
106 ele.visibility = "show";
107 } else { // IE4 & W3C
108 ele.style.left = parseInt ( x );
109 ele.style.top = parseInt ( y );
110 ele.style.visibility = "visible";
114 function hide ( name ) {
116 document.getElementById(name).style.visibility = "hidden";
118 document.layers[name].visibility = "hide";
120 document.all[name].style.visibility = "hidden";
124 function unhide ( name ) {
126 document.getElementById(name).style.visibility = "visible";
128 document.layers[name].visibility = "show";
130 document.all[name].style.visibility = "visible";