Subversion Repositories eFlore/Archives.eflore-consultation-v1

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7 jpm 1
/* $Id: eflore.js,v 1.1 2005-06-01 18:25:42 jpm Exp $ */
2
// These scripts were originally found on cooltype.com.
3
// Modified 01/01/1999 by Tobias Ratschiller for linuxapps.com
4
// Modified 7th June 2000 by Brian Birtles for Mozilla 5.0
5
// compatibility for phpMyAdmin
6
// Rewritten and put in a libray 2nd May 2001 by Loïc Chapeaux
7
// Traduit en français et utilisé dans Tela-Botanica fin octobre 2000
8
// par Alexandre Granier et Jean-Pascal Milcent.
9
// Test réussi avec : (Test passed with:)
10
// - Mozilla 0.8.1, 0.9.0, 0.9.1, 0.9.2 for Windows (js enabled & disabled)
11
// - IE5, 5.01, 5.5 for Windows
12
// - Netscape 4.75 for Windows
13
// - Opera 8
14
// - Konqueror 3.3.2
15
// Test échoué avec : ((crappy DOM implementations) with:)
16
// - Opera 5.02 for windows: 'getElementsByTagName' is unsupported
17
// - Opera 5.10 to 5.12 for windows, Opera 5+ for Linux: 'style.display' can't be changed
18
// - Konqueror 2+: 'style.display' can't be changed
19
 
20
// inclusion intempestive
21
/**
22
 * Variables et test normalement présent dans le fichier html dans le head entre
23
 * des balises <script></script>
24
 */
25
var isDOM   = (typeof(document.getElementsByTagName) != 'undefined') ? 1 : 0;
26
var capable = (isDOM) ? 1 : 0;
27
 
28
var fontFamily = 'arial, geneva, sans-serif';
29
var isServer   = true;
30
var isExpanded = false;
31
var imgOpened  = new Image(9,9);
32
imgOpened.src  = 'client/eflore_ancien/presentations/images/fermer.png';
33
imgOpened.alt  = '-';
34
imgOpened.title  = 'Cacher les informations complémentaires';
35
var imgClosed  = new Image(9,9);
36
imgClosed.src  = 'client/eflore_ancien/presentations/images/ouvrir.png';
37
imgClosed.alt  = '+';
38
imgClosed.title  = 'Voir les informations complémentaires';
39
 
40
/**
41
 * Pliage des données au démarrage.
42
 * (Collapses databases at startup)
43
 *
44
 * @access  public
45
 */
46
function initIt()
47
{
48
  if (!capable || !isServer) {
49
    return;
50
  }
51
  if (isDOM) {
52
    var tempColl    = document.getElementsByTagName('span');
53
    var tempCollCnt = tempColl.length;
54
    for (var i = 0; i < tempCollCnt; i++) {
55
      if (tempColl[i].id == expandedDb)
56
        tempColl[i].style.display = 'inline';
57
      else if (tempColl[i].className == 'child')
58
        tempColl[i].style.display = 'none';
59
    }
60
    // Fin du cas DOM (end of the DOM case)
61
  }
62
} // Fin de la fonction 'initIt()' (end of the 'initIt()' function)
63
 
64
 
65
/**
66
 * Plier/Déplier les données quand l'utilisateur le demande.
67
 * (Collapses/expands a database when the user require this to be done)
68
 *
69
 * @param  string  le nom de l'élément à activer (the  name of the room to act on)
70
 * @param  boolean si oui ou non le contenu des données doit être affiché (whether to expand or to collapse the database content)
71
 *
72
 * @access  public
73
 */
74
function expandBase(el, unexpand)
75
{
76
  if (!capable)
77
    return;
78
 
79
  if (isDOM) {
80
    var whichEl = document.getElementById(el + 'Child');
81
    var whichIm = document.getElementById(el + 'Img');
82
    if (whichEl.style.display == 'none' && whichIm) {
83
      whichEl.style.display  = 'inline';
84
      whichIm.src            = imgOpened.src;
85
      whichIm.alt            = imgOpened.alt;
86
      whichIm.title          = imgOpened.title;
87
    }
88
    else if (unexpand) {
89
      whichEl.style.display  = 'none';
90
      whichIm.src            = imgClosed.src;
91
      whichIm.alt            = imgClosed.alt;
92
      whichIm.title          = imgClosed.title;
93
 
94
    }
95
  }
96
} // fin de la fonction 'expandBase()' (end of the 'expandBase()' function)
97
 
98
/**
99
 * Affiche l'image permettant le Plier/Déplier
100
 *
101
 * @access  public
102
 */
103
function afficherImage(numero, type)
104
{
105
  with (document) {
106
    if (isDOM) {
107
      var image = '<img name="imEx" '+
108
                  'id="el'+numero+type+'Img" '+
109
                  'src="'+imgClosed.src+'" '+
110
                  'alt="'+imgClosed.alt+'" '+
111
                  'title="'+imgClosed.title+'" '+
112
                  'height="'+imgClosed.height+'" '+
113
                  'width="'+imgClosed.width+'">';
114
      write(image);
115
    }
116
  }
117
} // fin de la fonction 'afficherImage()'
118
 
119
/**
120
 * Ajout des styles permettant le positionnement des calques.
121
 * Le style display est important pour afficher ou masquer les calques.
122
 * Les styles child et parent doivent être utilisé pour les div du fichier html.
123
 * (Add styles for positioned layers)
124
 */
125
if (capable) {
126
  with (document) {
127
    // Brian Birtles : This is not the ideal method of doing this
128
    // but under the 7th June '00 Mozilla build (and many before
129
    // it) Mozilla did not treat text between <style> tags as
130
    // style information unless it was written with the one call
131
    // to write().
132
    if (isDOM) {
133
      var lstyle = '<style type="text/css">'
134
              + '.child {display: none}'
135
              + '<\/style>';
136
      write(lstyle);
137
    }
138
  }
139
} // Fin de l'ajout des styles (end of adding styles)
140
 
141
onload = initIt;
142
expandedDb = '';