Subversion Repositories eFlore/Archives.chorologie

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 jpm 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of MON_PROGRAMME.                                                                  |
9
// |                                                                                                      |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
11
// | it under the terms of the GNU General Public License as published by                                 |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
13
// | (at your option) any later version.                                                                  |
14
// |                                                                                                      |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
18
// | GNU General Public License for more details.                                                         |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: echoro_javascript.fonct.php,v 1.1 2005-02-22 12:03:14 jpm Exp $
25
/**
26
* Contient les fonctions enregistrant le javascript.
27
*
28
* Ces fonctions PHP permettent de paramètrer les fonctions Javascript avant de les insérer dans la page
29
* courante.
30
*
31
*@package eFlore
32
*@subpackage Chorologie
33
//Auteur original :
34
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
35
//Autres auteurs :
36
*@author        Aucun
37
*@copyright     Tela-Botanica 2000-2004
38
*@version       $Revision: 1.1 $ $Date: 2005-02-22 12:03:14 $
39
// +------------------------------------------------------------------------------------------------------+
40
*/
41
 
42
// +------------------------------------------------------------------------------------------------------+
43
// |                                           LISTE de FONCTIONS                                         |
44
// +------------------------------------------------------------------------------------------------------+
45
/**
46
* Fonction ajouterInfoBulleJs() - Ajoute javascript info bulle.
47
*
48
* Cette fonction permet de configurer une fonction javascript permettant d'afficher
49
* des infos bulles.
50
*
51
* @param string couleur du texte à afficher dans l'info bulle.
52
* @param string couleur du fond de l'info bulle.
53
* @param string couleur des contours de l'info bulle.
54
* @param string largeur en pixel des bordures de l'info bulle.
55
* @return string le javascript paramétré est renvoyé.
56
*/
57
function ajouterInfoBulleJs($couleur_de_texte = 'navy', $couleur_de_fond = '#FFCC66', $couleur_de_contour = 'orange', $taille_contour = '1')
58
{
59
    $code_javascript = "
60
        //D'autres scripts sur http://www.toutjavascript.com
61
        //Si vous utilisez ce script, merci de m'avertir !  < webmaster@toutjavascript.com >
62
        //Auteur original :Olivier Hondermarck  <webmaster@toutjavascript.com>
63
        //Modifs compatibilité Netscape 6/Mozilla : Cédric Lamalle 09/2001 <cedric@cpac.embrapa.br>
64
        //Correction Mac IE5 (Merci Fred)
65
        var IB=new Object;
66
        var posX=0;
67
        var posY=0;
68
        var xOffset=10;
69
        var yOffset=10;
70
 
71
        function AffBulle(texte)
72
        {
73
            contenu=\"<TABLE border=0 cellspacing=0 cellpadding=\"+IB.NbPixel+\"><TR bgcolor='\"+IB.ColContour+\"'><TD><TABLE border=0 cellpadding=2 cellspacing=0 bgcolor='\"+IB.ColFond+\"'><TR><TD><FONT size='-1' face='arial' color='\"+IB.ColTexte+\"'>\"+texte+\"</FONT></TD></TR></TABLE></TD></TR></TABLE>&nbsp;\";
74
 
75
            var finalPosX=posX-xOffset;
76
 
77
            if (finalPosX<0) {
78
                finalPosX=0;
79
            }
80
            if (document.layers) {
81
                document.layers['bulle'].document.write(contenu);
82
                document.layers['bulle'].document.close();
83
                document.layers['bulle'].top=posY+yOffset;
84
                document.layers['bulle'].left=finalPosX;
85
                document.layers['bulle'].visibility=\"show\";
86
            }
87
            if (document.all) {
88
                bulle.innerHTML=contenu;
89
                document.all['bulle'].style.top = posY+yOffset;
90
                document.all['bulle'].style.left = finalPosX;//f.x-xOffset;
91
                document.all['bulle'].style.visibility = \"visible\";
92
            }
93
            //modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
94
            else if (document.getElementById) {
95
                document.getElementById('bulle').innerHTML=contenu;
96
                document.getElementById('bulle').style.top=posY+yOffset;
97
                document.getElementById('bulle').style.left=finalPosX;
98
                document.getElementById('bulle').style.visibility=\"visible\";
99
            }
100
            //Nous vérifions que nous utilisons bien IE ou Mozilla pour supprimer les valeurs tiltes de images fournissant les infos bulles d'aides.
101
            //Cela pourrait être amélioré en vérifiant aussi les liens car l'aide pourrait être donnée par l'intermédiaire de lien.
102
            //alert(navigator.appName);
103
            if (navigator.appName == 'Netscape' || navigator.appName == 'Microsoft Internet Explorer') {
104
                for(i=1; i<document.images.length; i++) {
105
                    var nom = 'info'+i;
106
                    if (document.images[nom] != null ) {
107
                        document.images[nom].title = \"\";
108
                    }
109
                }
110
            }
111
        }
112
 
113
        function getMousePos(e)
114
        {
115
            if (document.all) {
116
                posX=event.x+document.body.scrollLeft; //modifs CL 09/2001 - IE : regrouper l'évènement
117
                posY=event.y+document.body.scrollTop;
118
            }
119
            else {
120
                posX=e.pageX; //modifs CL 09/2001 - NS6 : celui-ci ne supporte pas e.x et e.y
121
                posY=e.pageY;
122
            }
123
        }
124
 
125
        function HideBulle()
126
        {
127
            if (document.layers) {
128
                document.layers['bulle'].visibility= 'hide';
129
            }
130
 
131
            if (document.all) {
132
                document.all['bulle'].style.visibility= 'hidden';
133
            }
134
            else if (document.getElementById) {
135
                document.getElementById('bulle').style.visibility = 'hidden';
136
            }
137
        }
138
 
139
        function InitBulle(ColTexte,ColFond,ColContour,NbPixel)
140
        {
141
            IB.ColTexte=ColTexte;IB.ColFond=ColFond;IB.ColContour=ColContour;IB.NbPixel=NbPixel;
142
            if (document.layers) {
143
                window.captureEvents(Event.MOUSEMOVE);
144
                window.onMouseMove = getMousePos;
145
                document.write(\"<layer name='bulle' top=0 left=0 visibility='hide'></layer>\");
146
            }
147
            if (document.all) {
148
                document.write(\"<div id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></div>\");
149
                document.onmousemove = getMousePos;
150
            }
151
            //modif CL 09/2001 - NS6 : celui-ci ne supporte plus document.layers mais document.getElementById
152
            else if (document.getElementById) {
153
                document.onmousemove = getMousePos;
154
                document.write(\"<div id='bulle' style='position:absolute;top:0;left:0;visibility:hidden'></div>\");
155
            }
156
        }
157
 
158
        InitBulle(\"$couleur_de_texte\",\"$couleur_de_fond\",\"$couleur_de_contour\",$taille_contour);
159
        //// InitBulle(couleur de texte, couleur de fond, couleur de contour, taille contour);
160
    ";
161
    // Nous retournons le javascript une fois configuré.
162
    return $code_javascript;
163
}//Fin fonction ajouterInfoBulleJs().
164
 
165
/* +--Fin du code ----------------------------------------------------------------------------------------+
166
*
167
* $Log: not supported by cvs2svn $
168
*
169
* +-- Fin du code ----------------------------------------------------------------------------------------+
170
*/
171
?>