patch #501282 - JavaScript strict warnings

This commit is contained in:
Loïc Chapeaux
2002-01-19 23:21:00 +00:00
parent b4bb48e981
commit c357aa9976
3 changed files with 72 additions and 62 deletions

View File

@@ -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

View File

@@ -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 <style> tags as
@@ -265,45 +274,42 @@ if (capable) {
+ '.tblItem:hover {color: #FF0000; text-decoration: underline}'
+ '\/\/-->'
+ '<\/style>';
write(lstyle);
document.write(lstyle);
}
else {
writeln('<style type="text\/css">');
writeln('<!--');
writeln('div {color: #000000}');
writeln('.heada {font-family: ' + fontFamily + '; font-size: ' + fontSize + '; color: #000000}');
writeln('.headaCnt {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #000000}');
document.writeln('<style type="text\/css">');
document.writeln('<!--');
document.writeln('div {color: #000000}');
document.writeln('.heada {font-family: ' + fontFamily + '; font-size: ' + fontSize + '; color: #000000}');
document.writeln('.headaCnt {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #000000}');
if (isIE4) {
writeln('.parent {font-family: ' + fontFamily + '; color: #000000; text-decoration: none; display: block}');
writeln('.child {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #333399; text-decoration: none; display: none}');
writeln('.item, .item:active, .item:hover, .tblItem, .tblItem:active {font-size: ' + fontSmall + '; color: #333399; text-decoration: none}');
writeln('.tblItem:hover {color: #FF0000; text-decoration: underline}');
document.writeln('.parent {font-family: ' + fontFamily + '; color: #000000; text-decoration: none; display: block}');
document.writeln('.child {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #333399; text-decoration: none; display: none}');
document.writeln('.item, .item:active, .item:hover, .tblItem, .tblItem:active {font-size: ' + fontSmall + '; color: #333399; text-decoration: none}');
document.writeln('.tblItem:hover {color: #FF0000; text-decoration: underline}');
}
else {
writeln('.parent {font-family: ' + fontFamily + '; color: #000000; text-decoration: none; position: absolute; visibility: hidden}');
writeln('.child {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #333399; position: absolute; visibility: hidden}');
writeln('.item, .tblItem {font-size: ' + fontSmall + '; color: #333399; text-decoration: none}');
document.writeln('.parent {font-family: ' + fontFamily + '; color: #000000; text-decoration: none; position: absolute; visibility: hidden}');
document.writeln('.child {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #333399; position: absolute; visibility: hidden}');
document.writeln('.item, .tblItem {font-size: ' + fontSmall + '; color: #333399; text-decoration: none}');
}
writeln('\/\/-->');
writeln('<\/style>');
document.writeln('\/\/-->');
document.writeln('<\/style>');
}
}
}
else {
with (document) {
writeln('<style type="text\/css">');
writeln('<!--');
writeln('div {color: #000000}');
writeln('.heada {font-family: ' + fontFamily + '; font-size: ' + fontSize + '; color: #000000}');
writeln('.headaCnt {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #000000}');
writeln('.parent {font-family: ' + fontFamily + '; color: #000000; text-decoration: none}');
writeln('.child {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #333399; text-decoration: none}');
writeln('.item, .item:active, .item:hover, .tblItem, .tblItem:active {font-size: ' + fontSmall + '; color: #333399; text-decoration: none}');
writeln('.tblItem:hover {color: #FF0000; text-decoration: underline}');
writeln('\/\/-->');
writeln('<\/style>');
}
document.writeln('<style type="text\/css">');
document.writeln('<!--');
document.writeln('div {color: #000000}');
document.writeln('.heada {font-family: ' + fontFamily + '; font-size: ' + fontSize + '; color: #000000}');
document.writeln('.headaCnt {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #000000}');
document.writeln('.parent {font-family: ' + fontFamily + '; color: #000000; text-decoration: none}');
document.writeln('.child {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #333399; text-decoration: none}');
document.writeln('.item, .item:active, .item:hover, .tblItem, .tblItem:active {font-size: ' + fontSmall + '; color: #333399; text-decoration: none}');
document.writeln('.tblItem:hover {color: #FF0000; text-decoration: underline}');
document.writeln('\/\/-->');
document.writeln('<\/style>');
} // end of adding styles
onload = initIt;
window.onload = initIt;

View File

@@ -16,9 +16,9 @@ function checkPassword(the_form)
var pswd1_name = 'pma_pw';
var pswd2_name = 'pma_pw2';
} else {
var pswd_index = 2;
var pswd1_name = 'new_pw';
var pswd2_name = 'new_pw2';
pswd_index = 2;
pswd1_name = 'new_pw';
pswd2_name = 'new_pw2';
}
// Validates
@@ -135,7 +135,7 @@ function change(the_field) {
if (sel_idx > 0) {
l += '&dbgrant=' + escape(the_form['dbgrant'].options[sel_idx].text);
}
var sel_idx = the_form['tablegrant'].selectedIndex;
sel_idx = the_form['tablegrant'].selectedIndex;
if (sel_idx > 0) {
l += '&tablegrant=' + escape(the_form['tablegrant'].options[sel_idx].text);
}