From c357aa9976b524b045a841806670d877d8a45f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Sat, 19 Jan 2002 23:21:00 +0000 Subject: [PATCH] patch #501282 - JavaScript strict warnings --- libraries/functions.js | 18 ++++--- libraries/left.js | 108 ++++++++++++++++++++------------------ libraries/user_details.js | 8 +-- 3 files changed, 72 insertions(+), 62 deletions(-) diff --git a/libraries/functions.js b/libraries/functions.js index b29933df3..0bba98714 100644 --- a/libraries/functions.js +++ b/libraries/functions.js @@ -109,10 +109,11 @@ function confirmQuery(theForm1, sqlQuery1) function checkSqlQuery(theForm) { var sqlQuery = theForm.elements['sql_query']; + var isEmpty = 1; // The replace function (js1.2) isn't supported -> basic tests if (typeof(sqlQuery.value.replace) == 'undefined') { - var isEmpty = (sqlQuery.value == '') ? 1 : 0; + isEmpty = (sqlQuery.value == '') ? 1 : 0; if (isEmpty && typeof(theForm.elements['sql_file']) != 'undefined') { isEmpty = (theForm.elements['sql_file'].value == '') ? 1 : 0; } @@ -123,7 +124,7 @@ function checkSqlQuery(theForm) // js1.2+ -> validation with regular expressions else { var space_re = new RegExp('\\s+'); - var isEmpty = (sqlQuery.value.replace(space_re, '') == '') ? 1 : 0; + isEmpty = (sqlQuery.value.replace(space_re, '') == '') ? 1 : 0; // Checks for "DROP/DELETE/ALTER" statements if (!isEmpty && !confirmQuery(theForm, sqlQuery)) { return false; @@ -162,15 +163,16 @@ function checkSqlQuery(theForm) */ function emptyFormElements(theForm, theFieldName) { + var isEmpty = 1; var theField = theForm.elements[theFieldName]; // Whether the replace function (js1.2) is supported or not var isRegExp = (typeof(theField.value.replace) != 'undefined'); if (!isRegExp) { - var isEmpty = (theField.value == '') ? 1 : 0; + isEmpty = (theField.value == '') ? 1 : 0; } else { var space_re = new RegExp('\\s+'); - var isEmpty = (theField.value.replace(space_re, '') == '') ? 1 : 0; + isEmpty = (theField.value.replace(space_re, '') == '') ? 1 : 0; } if (isEmpty) { theForm.reset(); @@ -305,14 +307,16 @@ function checkTransmitDump(theForm, theAction) */ function setPointer(theRow, thePointerColor) { + var theCells = null; + if (thePointerColor == '' || typeof(theRow.style) == 'undefined') { return false; } if (typeof(document.getElementsByTagName) != 'undefined') { - var theCells = theRow.getElementsByTagName('td'); + theCells = theRow.getElementsByTagName('td'); } else if (typeof(theRow.cells) != 'undefined') { - var theCells = theRow.cells; + theCells = theRow.cells; } else { return false; @@ -361,7 +365,7 @@ function setSelectOptions(the_form, the_select, do_check) { var selectObject = document.forms[the_form].elements[the_select]; var selectCount = selectObject.length; - + for (var i = 0; i < selectCount; i++) { selectObject.options[i].selected = do_check; } // end for diff --git a/libraries/left.js b/libraries/left.js index 8ec169593..abc426234 100644 --- a/libraries/left.js +++ b/libraries/left.js @@ -113,13 +113,17 @@ function nsShowAll() { */ function initIt() { - if (!capable || !isServer) + if (!capable || !isServer || typeof(expandedDb) == 'undefined') return; + var tempColl = null; + var tempCollCnt = null; + var i = 0; + if (isDOM) { - var tempColl = document.getElementsByTagName('DIV'); - var tempCollCnt = tempColl.length; - for (var i = 0; i < tempCollCnt; i++) { + 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') @@ -127,9 +131,9 @@ function initIt() } } // end of the DOM case else if (isIE4) { - tempColl = document.all.tags('DIV'); - var tempCollCnt = tempColl.length; - for (var i = 0; i < tempCollCnt; i++) { + 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') @@ -139,7 +143,7 @@ function initIt() else if (isNS4) { var theLayers = document.layers; var layersCnt = theLayers.length; - for (var i = 0; i < layersCnt; i++) { + for (i = 0; i < layersCnt; i++) { if (theLayers[i].id == expandedDb) theLayers[i].visibility = 'show'; else if (theLayers[i].id.indexOf('Child') != -1) @@ -165,9 +169,12 @@ function expandBase(el, unexpand) if (!capable) return; + var whichEl = null; + var whichIm = null; + if (isDOM) { - var whichEl = document.getElementById(el + 'Child'); - var whichIm = document.getElementById(el + 'Img'); + whichEl = document.getElementById(el + 'Child'); + whichIm = document.getElementById(el + 'Img'); if (whichEl.style.display == 'none' && whichIm) { whichEl.style.display = 'block'; whichIm.src = imgOpened.src; @@ -178,8 +185,8 @@ function expandBase(el, unexpand) } } // end of the DOM case else if (isIE4) { - var whichEl = document.all(el + 'Child'); - var whichIm = document.images.item(el + 'Img'); + whichEl = document.all(el + 'Child'); + whichIm = document.images.item(el + 'Img'); if (whichEl.style.display == 'none') { whichEl.style.display = 'block'; whichIm.src = imgOpened.src; @@ -190,8 +197,8 @@ function expandBase(el, unexpand) } } // end of the IE4 case else if (isNS4) { - var whichEl = document.layers[el + 'Child']; - var whichIm = document.layers[el + 'Parent'].document.images['imEx']; + whichEl = document.layers[el + 'Child']; + whichIm = document.layers[el + 'Parent'].document.images['imEx']; if (whichEl.visibility == 'hide') { whichEl.visibility = 'show'; whichIm.src = imgOpened.src; @@ -216,20 +223,23 @@ function expandBase(el, unexpand) function hilightBase(el, theColor) { if (!isDOM && !isIE4) { - return; + return null; } + var whichDb = null; + var whichTables = null; + if (isDOM) { - var whichDb = document.getElementById(el + 'Parent'); - var whichTables = document.getElementById(el + 'Child'); + whichDb = document.getElementById(el + 'Parent'); + whichTables = document.getElementById(el + 'Child'); } else if (isIE4) { - var whichDb = document.all(el + 'Parent'); - var whichTables = document.all(el + 'Child'); + whichDb = document.all(el + 'Parent'); + whichTables = document.all(el + 'Child'); } if (typeof(whichDb.style) == 'undefined') { - return; + return null; } else if (whichTables) { whichDb.style.backgroundColor = theColor; @@ -247,7 +257,6 @@ function hilightBase(el, theColor) * 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