Subversion Repositories eFlore/Archives.eflore-consultation-v1

Compare Revisions

Ignore whitespace Rev 6 → Rev 7

/trunk/presentations/scripts/eflore.js
New file
0,0 → 1,142
/* $Id: eflore.js,v 1.1 2005-06-01 18:25:42 jpm Exp $ */
// These scripts were originally found on cooltype.com.
// Modified 01/01/1999 by Tobias Ratschiller for linuxapps.com
// Modified 7th June 2000 by Brian Birtles for Mozilla 5.0
// compatibility for phpMyAdmin
// Rewritten and put in a libray 2nd May 2001 by Loïc Chapeaux
// Traduit en français et utilisé dans Tela-Botanica fin octobre 2000
// par Alexandre Granier et Jean-Pascal Milcent.
// Test réussi avec : (Test passed with:)
// - Mozilla 0.8.1, 0.9.0, 0.9.1, 0.9.2 for Windows (js enabled & disabled)
// - IE5, 5.01, 5.5 for Windows
// - Netscape 4.75 for Windows
// - Opera 8
// - Konqueror 3.3.2
// Test échoué avec : ((crappy DOM implementations) with:)
// - Opera 5.02 for windows: 'getElementsByTagName' is unsupported
// - Opera 5.10 to 5.12 for windows, Opera 5+ for Linux: 'style.display' can't be changed
// - Konqueror 2+: 'style.display' can't be changed
 
// inclusion intempestive
/**
* Variables et test normalement présent dans le fichier html dans le head entre
* des balises <script></script>
*/
var isDOM = (typeof(document.getElementsByTagName) != 'undefined') ? 1 : 0;
var capable = (isDOM) ? 1 : 0;
 
var fontFamily = 'arial, geneva, sans-serif';
var isServer = true;
var isExpanded = false;
var imgOpened = new Image(9,9);
imgOpened.src = 'client/eflore_ancien/presentations/images/fermer.png';
imgOpened.alt = '-';
imgOpened.title = 'Cacher les informations complémentaires';
var imgClosed = new Image(9,9);
imgClosed.src = 'client/eflore_ancien/presentations/images/ouvrir.png';
imgClosed.alt = '+';
imgClosed.title = 'Voir les informations complémentaires';
 
/**
* Pliage des données au démarrage.
* (Collapses databases at startup)
*
* @access public
*/
function initIt()
{
if (!capable || !isServer) {
return;
}
if (isDOM) {
var tempColl = document.getElementsByTagName('span');
var tempCollCnt = tempColl.length;
for (var i = 0; i < tempCollCnt; i++) {
if (tempColl[i].id == expandedDb)
tempColl[i].style.display = 'inline';
else if (tempColl[i].className == 'child')
tempColl[i].style.display = 'none';
}
// Fin du cas DOM (end of the DOM case)
}
} // Fin de la fonction 'initIt()' (end of the 'initIt()' function)
 
 
/**
* Plier/Déplier les données quand l'utilisateur le demande.
* (Collapses/expands a database when the user require this to be done)
*
* @param string le nom de l'élément à activer (the name of the room to act on)
* @param boolean si oui ou non le contenu des données doit être affiché (whether to expand or to collapse the database content)
*
* @access public
*/
function expandBase(el, unexpand)
{
if (!capable)
return;
if (isDOM) {
var whichEl = document.getElementById(el + 'Child');
var whichIm = document.getElementById(el + 'Img');
if (whichEl.style.display == 'none' && whichIm) {
whichEl.style.display = 'inline';
whichIm.src = imgOpened.src;
whichIm.alt = imgOpened.alt;
whichIm.title = imgOpened.title;
}
else if (unexpand) {
whichEl.style.display = 'none';
whichIm.src = imgClosed.src;
whichIm.alt = imgClosed.alt;
whichIm.title = imgClosed.title;
 
}
}
} // fin de la fonction 'expandBase()' (end of the 'expandBase()' function)
 
/**
* Affiche l'image permettant le Plier/Déplier
*
* @access public
*/
function afficherImage(numero, type)
{
with (document) {
if (isDOM) {
var image = '<img name="imEx" '+
'id="el'+numero+type+'Img" '+
'src="'+imgClosed.src+'" '+
'alt="'+imgClosed.alt+'" '+
'title="'+imgClosed.title+'" '+
'height="'+imgClosed.height+'" '+
'width="'+imgClosed.width+'">';
write(image);
}
}
} // fin de la fonction 'afficherImage()'
 
/**
* Ajout des styles permettant le positionnement des calques.
* Le style display est important pour afficher ou masquer les calques.
* Les styles child et parent doivent être utilisé pour les div du fichier html.
* (Add styles for positioned layers)
*/
if (capable) {
with (document) {
// Brian Birtles : This is not the ideal method of doing this
// but under the 7th June '00 Mozilla build (and many before
// it) Mozilla did not treat text between <style> tags as
// style information unless it was written with the one call
// to write().
if (isDOM) {
var lstyle = '<style type="text/css">'
+ '.child {display: none}'
+ '<\/style>';
write(lstyle);
}
}
} // Fin de l'ajout des styles (end of adding styles)
 
onload = initIt;
expandedDb = '';