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) function checkSqlQuery(theForm)
{ {
var sqlQuery = theForm.elements['sql_query']; var sqlQuery = theForm.elements['sql_query'];
var isEmpty = 1;
// The replace function (js1.2) isn't supported -> basic tests // The replace function (js1.2) isn't supported -> basic tests
if (typeof(sqlQuery.value.replace) == 'undefined') { 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') { if (isEmpty && typeof(theForm.elements['sql_file']) != 'undefined') {
isEmpty = (theForm.elements['sql_file'].value == '') ? 1 : 0; isEmpty = (theForm.elements['sql_file'].value == '') ? 1 : 0;
} }
@@ -123,7 +124,7 @@ function checkSqlQuery(theForm)
// js1.2+ -> validation with regular expressions // js1.2+ -> validation with regular expressions
else { else {
var space_re = new RegExp('\\s+'); 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 // Checks for "DROP/DELETE/ALTER" statements
if (!isEmpty && !confirmQuery(theForm, sqlQuery)) { if (!isEmpty && !confirmQuery(theForm, sqlQuery)) {
return false; return false;
@@ -162,15 +163,16 @@ function checkSqlQuery(theForm)
*/ */
function emptyFormElements(theForm, theFieldName) function emptyFormElements(theForm, theFieldName)
{ {
var isEmpty = 1;
var theField = theForm.elements[theFieldName]; var theField = theForm.elements[theFieldName];
// Whether the replace function (js1.2) is supported or not // Whether the replace function (js1.2) is supported or not
var isRegExp = (typeof(theField.value.replace) != 'undefined'); var isRegExp = (typeof(theField.value.replace) != 'undefined');
if (!isRegExp) { if (!isRegExp) {
var isEmpty = (theField.value == '') ? 1 : 0; isEmpty = (theField.value == '') ? 1 : 0;
} else { } else {
var space_re = new RegExp('\\s+'); 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) { if (isEmpty) {
theForm.reset(); theForm.reset();
@@ -305,14 +307,16 @@ function checkTransmitDump(theForm, theAction)
*/ */
function setPointer(theRow, thePointerColor) function setPointer(theRow, thePointerColor)
{ {
var theCells = null;
if (thePointerColor == '' || typeof(theRow.style) == 'undefined') { if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
return false; return false;
} }
if (typeof(document.getElementsByTagName) != 'undefined') { if (typeof(document.getElementsByTagName) != 'undefined') {
var theCells = theRow.getElementsByTagName('td'); theCells = theRow.getElementsByTagName('td');
} }
else if (typeof(theRow.cells) != 'undefined') { else if (typeof(theRow.cells) != 'undefined') {
var theCells = theRow.cells; theCells = theRow.cells;
} }
else { else {
return false; return false;
@@ -361,7 +365,7 @@ function setSelectOptions(the_form, the_select, do_check)
{ {
var selectObject = document.forms[the_form].elements[the_select]; var selectObject = document.forms[the_form].elements[the_select];
var selectCount = selectObject.length; var selectCount = selectObject.length;
for (var i = 0; i < selectCount; i++) { for (var i = 0; i < selectCount; i++) {
selectObject.options[i].selected = do_check; selectObject.options[i].selected = do_check;
} // end for } // end for

View File

@@ -113,13 +113,17 @@ function nsShowAll() {
*/ */
function initIt() function initIt()
{ {
if (!capable || !isServer) if (!capable || !isServer || typeof(expandedDb) == 'undefined')
return; return;
var tempColl = null;
var tempCollCnt = null;
var i = 0;
if (isDOM) { if (isDOM) {
var tempColl = document.getElementsByTagName('DIV'); tempColl = document.getElementsByTagName('DIV');
var tempCollCnt = tempColl.length; tempCollCnt = tempColl.length;
for (var i = 0; i < tempCollCnt; i++) { for (i = 0; i < tempCollCnt; i++) {
if (tempColl[i].id == expandedDb) if (tempColl[i].id == expandedDb)
tempColl[i].style.display = 'block'; tempColl[i].style.display = 'block';
else if (tempColl[i].className == 'child') else if (tempColl[i].className == 'child')
@@ -127,9 +131,9 @@ function initIt()
} }
} // end of the DOM case } // end of the DOM case
else if (isIE4) { else if (isIE4) {
tempColl = document.all.tags('DIV'); tempColl = document.all.tags('DIV');
var tempCollCnt = tempColl.length; tempCollCnt = tempColl.length;
for (var i = 0; i < tempCollCnt; i++) { for (i = 0; i < tempCollCnt; i++) {
if (tempColl(i).id == expandedDb) if (tempColl(i).id == expandedDb)
tempColl(i).style.display = 'block'; tempColl(i).style.display = 'block';
else if (tempColl(i).className == 'child') else if (tempColl(i).className == 'child')
@@ -139,7 +143,7 @@ function initIt()
else if (isNS4) { else if (isNS4) {
var theLayers = document.layers; var theLayers = document.layers;
var layersCnt = theLayers.length; var layersCnt = theLayers.length;
for (var i = 0; i < layersCnt; i++) { for (i = 0; i < layersCnt; i++) {
if (theLayers[i].id == expandedDb) if (theLayers[i].id == expandedDb)
theLayers[i].visibility = 'show'; theLayers[i].visibility = 'show';
else if (theLayers[i].id.indexOf('Child') != -1) else if (theLayers[i].id.indexOf('Child') != -1)
@@ -165,9 +169,12 @@ function expandBase(el, unexpand)
if (!capable) if (!capable)
return; return;
var whichEl = null;
var whichIm = null;
if (isDOM) { if (isDOM) {
var whichEl = document.getElementById(el + 'Child'); whichEl = document.getElementById(el + 'Child');
var whichIm = document.getElementById(el + 'Img'); whichIm = document.getElementById(el + 'Img');
if (whichEl.style.display == 'none' && whichIm) { if (whichEl.style.display == 'none' && whichIm) {
whichEl.style.display = 'block'; whichEl.style.display = 'block';
whichIm.src = imgOpened.src; whichIm.src = imgOpened.src;
@@ -178,8 +185,8 @@ function expandBase(el, unexpand)
} }
} // end of the DOM case } // end of the DOM case
else if (isIE4) { else if (isIE4) {
var whichEl = document.all(el + 'Child'); whichEl = document.all(el + 'Child');
var whichIm = document.images.item(el + 'Img'); whichIm = document.images.item(el + 'Img');
if (whichEl.style.display == 'none') { if (whichEl.style.display == 'none') {
whichEl.style.display = 'block'; whichEl.style.display = 'block';
whichIm.src = imgOpened.src; whichIm.src = imgOpened.src;
@@ -190,8 +197,8 @@ function expandBase(el, unexpand)
} }
} // end of the IE4 case } // end of the IE4 case
else if (isNS4) { else if (isNS4) {
var whichEl = document.layers[el + 'Child']; whichEl = document.layers[el + 'Child'];
var whichIm = document.layers[el + 'Parent'].document.images['imEx']; whichIm = document.layers[el + 'Parent'].document.images['imEx'];
if (whichEl.visibility == 'hide') { if (whichEl.visibility == 'hide') {
whichEl.visibility = 'show'; whichEl.visibility = 'show';
whichIm.src = imgOpened.src; whichIm.src = imgOpened.src;
@@ -216,20 +223,23 @@ function expandBase(el, unexpand)
function hilightBase(el, theColor) function hilightBase(el, theColor)
{ {
if (!isDOM && !isIE4) { if (!isDOM && !isIE4) {
return; return null;
} }
var whichDb = null;
var whichTables = null;
if (isDOM) { if (isDOM) {
var whichDb = document.getElementById(el + 'Parent'); whichDb = document.getElementById(el + 'Parent');
var whichTables = document.getElementById(el + 'Child'); whichTables = document.getElementById(el + 'Child');
} }
else if (isIE4) { else if (isIE4) {
var whichDb = document.all(el + 'Parent'); whichDb = document.all(el + 'Parent');
var whichTables = document.all(el + 'Child'); whichTables = document.all(el + 'Child');
} }
if (typeof(whichDb.style) == 'undefined') { if (typeof(whichDb.style) == 'undefined') {
return; return null;
} }
else if (whichTables) { else if (whichTables) {
whichDb.style.backgroundColor = theColor; whichDb.style.backgroundColor = theColor;
@@ -247,7 +257,6 @@ function hilightBase(el, theColor)
* Add styles for positioned layers * Add styles for positioned layers
*/ */
if (capable) { if (capable) {
with (document) {
// Brian Birtles : This is not the ideal method of doing this // Brian Birtles : This is not the ideal method of doing this
// but under the 7th June '00 Mozilla build (and many before // but under the 7th June '00 Mozilla build (and many before
// it) Mozilla did not treat text between <style> tags as // it) Mozilla did not treat text between <style> tags as
@@ -265,45 +274,42 @@ if (capable) {
+ '.tblItem:hover {color: #FF0000; text-decoration: underline}' + '.tblItem:hover {color: #FF0000; text-decoration: underline}'
+ '\/\/-->' + '\/\/-->'
+ '<\/style>'; + '<\/style>';
write(lstyle); document.write(lstyle);
} }
else { else {
writeln('<style type="text\/css">'); document.writeln('<style type="text\/css">');
writeln('<!--'); document.writeln('<!--');
writeln('div {color: #000000}'); document.writeln('div {color: #000000}');
writeln('.heada {font-family: ' + fontFamily + '; font-size: ' + fontSize + '; color: #000000}'); document.writeln('.heada {font-family: ' + fontFamily + '; font-size: ' + fontSize + '; color: #000000}');
writeln('.headaCnt {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #000000}'); document.writeln('.headaCnt {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #000000}');
if (isIE4) { if (isIE4) {
writeln('.parent {font-family: ' + fontFamily + '; color: #000000; text-decoration: none; display: block}'); document.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}'); document.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}'); document.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('.tblItem:hover {color: #FF0000; text-decoration: underline}');
} }
else { else {
writeln('.parent {font-family: ' + fontFamily + '; color: #000000; text-decoration: none; position: absolute; visibility: hidden}'); document.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}'); document.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('.item, .tblItem {font-size: ' + fontSmall + '; color: #333399; text-decoration: none}');
} }
writeln('\/\/-->'); document.writeln('\/\/-->');
writeln('<\/style>'); document.writeln('<\/style>');
} }
}
} }
else { else {
with (document) { document.writeln('<style type="text\/css">');
writeln('<style type="text\/css">'); document.writeln('<!--');
writeln('<!--'); document.writeln('div {color: #000000}');
writeln('div {color: #000000}'); document.writeln('.heada {font-family: ' + fontFamily + '; font-size: ' + fontSize + '; color: #000000}');
writeln('.heada {font-family: ' + fontFamily + '; font-size: ' + fontSize + '; color: #000000}'); document.writeln('.headaCnt {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #000000}');
writeln('.headaCnt {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #000000}'); document.writeln('.parent {font-family: ' + fontFamily + '; color: #000000; text-decoration: none}');
writeln('.parent {font-family: ' + fontFamily + '; color: #000000; text-decoration: none}'); document.writeln('.child {font-family: ' + fontFamily + '; font-size: ' + fontSmall + '; color: #333399; text-decoration: none}');
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}');
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}');
writeln('.tblItem:hover {color: #FF0000; text-decoration: underline}'); document.writeln('\/\/-->');
writeln('\/\/-->'); document.writeln('<\/style>');
writeln('<\/style>');
}
} // end of adding styles } // 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 pswd1_name = 'pma_pw';
var pswd2_name = 'pma_pw2'; var pswd2_name = 'pma_pw2';
} else { } else {
var pswd_index = 2; pswd_index = 2;
var pswd1_name = 'new_pw'; pswd1_name = 'new_pw';
var pswd2_name = 'new_pw2'; pswd2_name = 'new_pw2';
} }
// Validates // Validates
@@ -135,7 +135,7 @@ function change(the_field) {
if (sel_idx > 0) { if (sel_idx > 0) {
l += '&dbgrant=' + escape(the_form['dbgrant'].options[sel_idx].text); 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) { if (sel_idx > 0) {
l += '&tablegrant=' + escape(the_form['tablegrant'].options[sel_idx].text); l += '&tablegrant=' + escape(the_form['tablegrant'].options[sel_idx].text);
} }