1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
|
/* $Id: left.js,v 2.3 2004/06/23 14:32:46 lem9 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 Loc Chapeaux
// Test passed with:
// - Mozilla 0.8.1 to 1.0-RC1 for Windows (js enabled & disabled)
// - IE5, 5.01, 5.5, 6.0 for Windows
// - Netscape 4.75 to 4.78 for Windows
// Test failed (crappy DOM implementations) with:
// - Opera 5.02 for windows: 'getElementsByTagName' is unsupported
// - Opera 5.10 to 6.01 for windows, Opera 5+ for Linux: 'style.display' can't
// be changed
// - Konqueror 2+, 3: 'style.display' can't be changed
var isExpanded = false;
/**
* 2004-05-28: Michael Keck (mkkeck)
* modified for theme manager
* Please see left.php (line 264 and 265)
*/
var imgOpened = new Image(9,9);
imgOpened.src = imgUrlMinus;
var imgClosed = new Image(9,9);
imgClosed.src = imgUrlPlus;
/**
* Do reloads the frame if the window has been resized under Netscape4+
*
* @access private
*/
function reDo() {
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload(true);
} // end of the 'reDo()' function
/**
* Positioned element resize bug under NS4+
*/
if (isNS4) {
var origWidth = innerWidth;
var origHeight = innerHeight;
onresize = reDo;
}
/**
* Gets the id of the first collapsible room
*
* @param string the name of the first collapsible room
*
* @return integer the index number corresponding to this room
*
* @access public
*/
function nsGetIndex(el) {
var ind = null;
var theLayers = document.layers;
var layersCnt = theLayers.length;
for (var i = 0; i < layersCnt; i++) {
if (theLayers[i].id == el) {
ind = i;
break;
}
}
return ind;
} // end of the 'nsGetIndex()' function
/**
* Positions layers under NS4+
*
* @access public
*/
function nsArrangeList() {
if (typeof(firstInd) != 'undefined' && firstInd != null) {
var theLayers = document.layers;
var layersCnt = theLayers.length;
var nextY = theLayers[firstInd].pageY + theLayers[firstInd].document.height;
for (var i = firstInd + 1; i < layersCnt; i++) {
if (theLayers[i].visibility != 'hide') {
theLayers[i].pageY = nextY;
nextY += theLayers[i].document.height;
}
}
}
} // end of the 'nsArrangeList()' function
/**
* Expand databases at startup
*
* @access public
*/
function nsShowAll() {
var theLayers = document.layers;
var layersCnt = theLayers.length;
for (i = firstInd; i < layersCnt; i++) {
theLayers[i].visibility = 'show';
}
} // end of the 'nsShowAll()' function
/**
* Collapses databases at startup
*
* @access public
*/
function initIt()
{
if (!capable || !isServer)
return;
var tempColl = null;
var tempCollCnt = null;
var i = 0;
if (isDOM) {
tempColl = document.getElementsByTagName('DIV');
tempCollCnt = tempColl.length;
for (i = 0; i < tempCollCnt; i++) {
if (tempColl[i].id == expandedDb)
tempColl[i].style.display = 'block';
else if (tempColl[i].className == 'child' || tempColl[i].className == 'child nowrap')
tempColl[i].style.display = 'none';
}
} // end of the DOM case
else if (isIE4) {
tempColl = document.all.tags('DIV');
tempCollCnt = tempColl.length;
for (i = 0; i < tempCollCnt; i++) {
if (tempColl(i).id == expandedDb)
tempColl(i).style.display = 'block';
else if (tempColl(i).className == 'child' || tempColl(i).className == 'child nowrap')
tempColl(i).style.display = 'none';
}
} // end of the IE4 case
else if (isNS4) {
var theLayers = document.layers;
var layersCnt = theLayers.length;
for (i = 0; i < layersCnt; i++) {
if (theLayers[i].id == expandedDb)
theLayers[i].visibility = 'show';
else if (theLayers[i].id.indexOf('Child') != -1)
theLayers[i].visibility = 'hide';
else
theLayers[i].visibility = 'show';
}
nsArrangeList();
} // end of the NS4 case
} // end of the 'initIt()' function
/**
* Collapses/expands a database when the user require this to be done
*
* @param string the name of the database to act on
* @param boolean whether to expand or to collapse the database content
*
* @access public
*/
function expandBase(el, unexpand)
{
if (!capable)
return;
var whichEl = null;
var whichIm = null;
if (isDOM) {
whichEl = document.getElementById(el + 'Child');
whichIm = document.getElementById(el + 'Img');
if (whichEl.style.display == 'none' && whichIm) {
whichEl.style.display = 'block';
whichIm.src = imgOpened.src;
}
else if (unexpand) {
whichEl.style.display = 'none';
whichIm.src = imgClosed.src;
}
} // end of the DOM case
else if (isIE4) {
whichEl = document.all(el + 'Child');
whichIm = document.images.item(el + 'Img');
if (whichEl.style.display == 'none') {
whichEl.style.display = 'block';
whichIm.src = imgOpened.src;
}
else if (unexpand) {
whichEl.style.display = 'none';
whichIm.src = imgClosed.src;
}
} // end of the IE4 case
else if (isNS4) {
whichEl = document.layers[el + 'Child'];
whichIm = document.layers[el + 'Parent'].document.images['imEx'];
if (whichEl.visibility == 'hide') {
whichEl.visibility = 'show';
whichIm.src = imgOpened.src;
}
else if (unexpand) {
whichEl.visibility = 'hide';
whichIm.src = imgClosed.src;
}
nsArrangeList();
} // end of the NS4 case
} // end of the 'expandBase()' function
/**
* Hilight/un-hilight a database when the mouse pass over/out it
*
* @param string the name of the database to act on
* @param boolean the color to be used
*
* @access public
*/
function hilightBase(el, theColor)
{
if (!isDOM && !isIE4) {
return null;
}
var whichDb = null;
var whichTables = null;
if (isDOM) {
whichDb = document.getElementById(el + 'Parent');
whichTables = document.getElementById(el + 'Child');
}
else if (isIE4) {
whichDb = document.all(el + 'Parent');
whichTables = document.all(el + 'Child');
}
if (typeof(whichDb.style) == 'undefined') {
return null;
}
else if (whichTables) {
whichDb.style.backgroundColor = theColor;
whichTables.style.backgroundColor = theColor;
}
else {
whichDb.style.backgroundColor = theColor;
}
return true;
} // end of the 'hilightBase()' function
window.onload = initIt;
|