rem
stringlengths 0
126k
| add
stringlengths 0
441k
| context
stringlengths 15
136k
|
---|---|---|
this.name = ''; this.needsUpdate = false; | function UrlClassifierTableDomain() { G_Map.call(this); this.debugZone = "trtable-domain";} |
|
G_Map.call(this); | function UrlClassifierTableEnchash() { G_Map.call(this); this.debugZone = "trtable-enchash"; this.enchashDecrypter_ = new PROT_EnchashDecrypter();} |
|
this.dbservice = Cc["@mozilla.org/url-classifier/dbservice;1"] .getService(Ci.nsIUrlClassifierDBService); this.name = ''; this.needsUpdate = false; | function UrlClassifierTableEnchash() { G_Map.call(this); this.debugZone = "trtable-enchash"; this.enchashDecrypter_ = new PROT_EnchashDecrypter();} |
|
G_Map.call(this); | function UrlClassifierTableUrl() { G_Map.call(this); this.debugZone = "trtable-url";} |
|
this.dbservice_ = Cc["@mozilla.org/url-classifier/dbservice;1"] .getService(Ci.nsIUrlClassifierDBService); this.name = ''; this.needsUpdate = false; | function UrlClassifierTableUrl() { G_Map.call(this); this.debugZone = "trtable-url";} |
|
var fileURL = Components.classes[nsStdURL_PROGID].createInstance().QueryInterface(nsIFileURL); | var fileURL = Components.classes[nsStdURL_CONTRACTID].createInstance().QueryInterface(nsIFileURL); | function URLpathToFile(aURLstr) { var fileURL = Components.classes[nsStdURL_PROGID].createInstance().QueryInterface(nsIFileURL); fileURL.spec = aURLstr; return fileURL.file;} |
var sourceWin = isDocumentFrame(focusedWindow) ? focusedWindow.location.href : focusedWindow._content.location.href; | var sourceURL = getContentFrameURI(focusedWindow); | function urlSecurityCheck(url, doc) { // URL Loading Security Check var focusedWindow = doc.commandDispatcher.focusedWindow; var sourceWin = isDocumentFrame(focusedWindow) ? focusedWindow.location.href : focusedWindow._content.location.href; const nsIScriptSecurityManager = Components.interfaces.nsIScriptSecurityManager; var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"].getService(). QueryInterface(nsIScriptSecurityManager); try { secMan.checkLoadURIStr(sourceWin, url, nsIScriptSecurityManager.STANDARD); } catch (e) { throw "Load of " + url + " denied."; }} |
var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"].getService(). QueryInterface(nsIScriptSecurityManager); | var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"] .getService(nsIScriptSecurityManager); | function urlSecurityCheck(url, doc) { // URL Loading Security Check var focusedWindow = doc.commandDispatcher.focusedWindow; var sourceWin = isDocumentFrame(focusedWindow) ? focusedWindow.location.href : focusedWindow._content.location.href; const nsIScriptSecurityManager = Components.interfaces.nsIScriptSecurityManager; var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"].getService(). QueryInterface(nsIScriptSecurityManager); try { secMan.checkLoadURIStr(sourceWin, url, nsIScriptSecurityManager.STANDARD); } catch (e) { throw "Load of " + url + " denied."; }} |
secMan.checkLoadURIStr(sourceWin, url, nsIScriptSecurityManager.STANDARD); | secMan.checkLoadURIStr(sourceURL, url, nsIScriptSecurityManager.STANDARD); | function urlSecurityCheck(url, doc) { // URL Loading Security Check var focusedWindow = doc.commandDispatcher.focusedWindow; var sourceWin = isDocumentFrame(focusedWindow) ? focusedWindow.location.href : focusedWindow._content.location.href; const nsIScriptSecurityManager = Components.interfaces.nsIScriptSecurityManager; var secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"].getService(). QueryInterface(nsIScriptSecurityManager); try { secMan.checkLoadURIStr(sourceWin, url, nsIScriptSecurityManager.STANDARD); } catch (e) { throw "Load of " + url + " denied."; }} |
if (message) DWRUtil._loadingMessage = message; else DWRUtil._loadingMessage = "Loading"; | var loadingMessage; if (message) loadingMessage = message; else loadingMessage = "Loading"; | DWRUtil.useLoadingMessage = function(message) { if (message) DWRUtil._loadingMessage = message; else DWRUtil._loadingMessage = "Loading"; DWREngine.setPreHook(DWRUtil._showLoadingMessage); DWREngine.setPostHook(DWRUtil._hideLoadingMessage);}; |
DWREngine.setPreHook(DWRUtil._showLoadingMessage); DWREngine.setPostHook(DWRUtil._hideLoadingMessage); }; | DWREngine.setPreHook(function() { var disabledZone = $('disabledZone'); if (!disabledZone) { disabledZone = document.createElement('div'); disabledZone.setAttribute('id', 'disabledZone'); disabledZone.style.position = "absolute"; disabledZone.style.zIndex = "1000"; disabledZone.style.left = "0px"; disabledZone.style.top = "0px"; disabledZone.style.width = "100%"; disabledZone.style.height = "100%"; document.body.appendChild(disabledZone); var messageZone = document.createElement('div'); messageZone.setAttribute('id', 'messageZone'); messageZone.style.position = "absolute"; messageZone.style.top = "0px"; messageZone.style.right = "0px"; messageZone.style.background = "red"; messageZone.style.color = "white"; messageZone.style.fontFamily = "Arial,Helvetica,sans-serif"; messageZone.style.padding = "4px"; disabledZone.appendChild(messageZone); var text = document.createTextNode(loadingMessage); messageZone.appendChild(text); } else { $('messageZone').innerHTML = loadingMessage; disabledZone.style.visibility = 'visible'; } }); DWREngine.setPostHook(function() { $('disabledZone').style.visibility = 'hidden'; }); } | DWRUtil.useLoadingMessage = function(message) { if (message) DWRUtil._loadingMessage = message; else DWRUtil._loadingMessage = "Loading"; DWREngine.setPreHook(DWRUtil._showLoadingMessage); DWREngine.setPostHook(DWRUtil._hideLoadingMessage);}; |
DWRUtil.useLoadingMessage = function() | DWRUtil.useLoadingMessage = function(message) | DWRUtil.useLoadingMessage = function(){ var disabledZone = document.createElement('div'); disabledZone.setAttribute('id', 'disabledZone'); disabledZone.style.position = "absolute"; disabledZone.style.zIndex = "1000"; disabledZone.style.left = "0px"; disabledZone.style.top = "0px"; disabledZone.style.width = "100%"; disabledZone.style.height = "100%"; document.body.appendChild(disabledZone); var messageZone = document.createElement('div'); messageZone.setAttribute('id', 'messageZone'); messageZone.style.position = "absolute"; messageZone.style.top = "0px"; messageZone.style.right = "0px"; messageZone.style.background = "red"; messageZone.style.color = "white"; messageZone.style.fontFamily = "Arial,Helvetica,sans-serif"; messageZone.style.padding = "4px"; disabledZone.appendChild(messageZone); var text = document.createTextNode('Loading'); messageZone.appendChild(text); $('disabledZone').style.visibility = 'hidden'; DWREngine.setPreHook(function() { $('disabledZone').style.visibility = 'visible'; }); DWREngine.setPostHook(function() { $('disabledZone').style.visibility = 'hidden'; });}; |
var disabledZone = document.createElement('div'); disabledZone.setAttribute('id', 'disabledZone'); disabledZone.style.position = "absolute"; disabledZone.style.zIndex = "1000"; disabledZone.style.left = "0px"; disabledZone.style.top = "0px"; disabledZone.style.width = "100%"; disabledZone.style.height = "100%"; document.body.appendChild(disabledZone); | if (message) { DWRUtil._loadingMessage = message; } else { DWRUtil._loadingMessage = "Loading"; } | DWRUtil.useLoadingMessage = function(){ var disabledZone = document.createElement('div'); disabledZone.setAttribute('id', 'disabledZone'); disabledZone.style.position = "absolute"; disabledZone.style.zIndex = "1000"; disabledZone.style.left = "0px"; disabledZone.style.top = "0px"; disabledZone.style.width = "100%"; disabledZone.style.height = "100%"; document.body.appendChild(disabledZone); var messageZone = document.createElement('div'); messageZone.setAttribute('id', 'messageZone'); messageZone.style.position = "absolute"; messageZone.style.top = "0px"; messageZone.style.right = "0px"; messageZone.style.background = "red"; messageZone.style.color = "white"; messageZone.style.fontFamily = "Arial,Helvetica,sans-serif"; messageZone.style.padding = "4px"; disabledZone.appendChild(messageZone); var text = document.createTextNode('Loading'); messageZone.appendChild(text); $('disabledZone').style.visibility = 'hidden'; DWREngine.setPreHook(function() { $('disabledZone').style.visibility = 'visible'; }); DWREngine.setPostHook(function() { $('disabledZone').style.visibility = 'hidden'; });}; |
var messageZone = document.createElement('div'); messageZone.setAttribute('id', 'messageZone'); messageZone.style.position = "absolute"; messageZone.style.top = "0px"; messageZone.style.right = "0px"; messageZone.style.background = "red"; messageZone.style.color = "white"; messageZone.style.fontFamily = "Arial,Helvetica,sans-serif"; messageZone.style.padding = "4px"; disabledZone.appendChild(messageZone); var text = document.createTextNode('Loading'); messageZone.appendChild(text); $('disabledZone').style.visibility = 'hidden'; DWREngine.setPreHook(function() { $('disabledZone').style.visibility = 'visible'; }); DWREngine.setPostHook(function() { $('disabledZone').style.visibility = 'hidden'; }); | DWREngine.setPreHook(DWRUtil._showLoadingMessage); DWREngine.setPostHook(DWRUtil._hideLoadingMessage); | DWRUtil.useLoadingMessage = function(){ var disabledZone = document.createElement('div'); disabledZone.setAttribute('id', 'disabledZone'); disabledZone.style.position = "absolute"; disabledZone.style.zIndex = "1000"; disabledZone.style.left = "0px"; disabledZone.style.top = "0px"; disabledZone.style.width = "100%"; disabledZone.style.height = "100%"; document.body.appendChild(disabledZone); var messageZone = document.createElement('div'); messageZone.setAttribute('id', 'messageZone'); messageZone.style.position = "absolute"; messageZone.style.top = "0px"; messageZone.style.right = "0px"; messageZone.style.background = "red"; messageZone.style.color = "white"; messageZone.style.fontFamily = "Arial,Helvetica,sans-serif"; messageZone.style.padding = "4px"; disabledZone.appendChild(messageZone); var text = document.createTextNode('Loading'); messageZone.appendChild(text); $('disabledZone').style.visibility = 'hidden'; DWREngine.setPreHook(function() { $('disabledZone').style.visibility = 'visible'; }); DWREngine.setPostHook(function() { $('disabledZone').style.visibility = 'hidden'; });}; |
function useLoadingMessage() | DWRUtil.useLoadingMessage = function() | function useLoadingMessage(){ var disabledZone = document.createElement('div'); disabledZone.setAttribute('id', 'disabledZone'); disabledZone.setAttribute('style', 'position:absolute; z-index:1000; left:0px; top:0px; width:100%; height:100%;'); document.body.appendChild(disabledZone); var messageZone = document.createElement('div'); messageZone.setAttribute('id', 'messageZone'); messageZone.setAttribute('style', 'position:absolute; top:0px; left:500px; background:red; color:white; font-family:Arial,Helvetica,sans-serif; padding:4px;'); disabledZone.appendChild(messageZone); var text = document.createTextNode('Loading'); messageZone.appendChild(text); hidePleaseWait(); dwrSetPreHook(showPleaseWait); dwrSetPostHook(hidePleaseWait)} |
disabledZone.setAttribute('style', 'position:absolute; z-index:1000; left:0px; top:0px; width:100%; height:100%;'); | disabledZone.style.position = "absolute"; disabledZone.style.zIndex = "1000"; disabledZone.style.left = "0px"; disabledZone.style.top = "0px"; disabledZone.style.width = "100%"; disabledZone.style.height = "100%"; | function useLoadingMessage(){ var disabledZone = document.createElement('div'); disabledZone.setAttribute('id', 'disabledZone'); disabledZone.setAttribute('style', 'position:absolute; z-index:1000; left:0px; top:0px; width:100%; height:100%;'); document.body.appendChild(disabledZone); var messageZone = document.createElement('div'); messageZone.setAttribute('id', 'messageZone'); messageZone.setAttribute('style', 'position:absolute; top:0px; left:500px; background:red; color:white; font-family:Arial,Helvetica,sans-serif; padding:4px;'); disabledZone.appendChild(messageZone); var text = document.createTextNode('Loading'); messageZone.appendChild(text); hidePleaseWait(); dwrSetPreHook(showPleaseWait); dwrSetPostHook(hidePleaseWait)} |
messageZone.setAttribute('style', 'position:absolute; top:0px; left:500px; background:red; color:white; font-family:Arial,Helvetica,sans-serif; padding:4px;'); | messageZone.style.position = "absolute"; messageZone.style.top = "0px"; messageZone.style.right = "0px"; messageZone.style.background = "red"; messageZone.style.color = "white"; messageZone.style.fontFamily = "Arial,Helvetica,sans-serif"; messageZone.style.padding = "4px"; | function useLoadingMessage(){ var disabledZone = document.createElement('div'); disabledZone.setAttribute('id', 'disabledZone'); disabledZone.setAttribute('style', 'position:absolute; z-index:1000; left:0px; top:0px; width:100%; height:100%;'); document.body.appendChild(disabledZone); var messageZone = document.createElement('div'); messageZone.setAttribute('id', 'messageZone'); messageZone.setAttribute('style', 'position:absolute; top:0px; left:500px; background:red; color:white; font-family:Arial,Helvetica,sans-serif; padding:4px;'); disabledZone.appendChild(messageZone); var text = document.createTextNode('Loading'); messageZone.appendChild(text); hidePleaseWait(); dwrSetPreHook(showPleaseWait); dwrSetPostHook(hidePleaseWait)} |
dwrSetPreHook(showPleaseWait); dwrSetPostHook(hidePleaseWait) | DWREngine.setPreHook(showPleaseWait); DWREngine.setPostHook(hidePleaseWait) | function useLoadingMessage(){ var disabledZone = document.createElement('div'); disabledZone.setAttribute('id', 'disabledZone'); disabledZone.setAttribute('style', 'position:absolute; z-index:1000; left:0px; top:0px; width:100%; height:100%;'); document.body.appendChild(disabledZone); var messageZone = document.createElement('div'); messageZone.setAttribute('id', 'messageZone'); messageZone.setAttribute('style', 'position:absolute; top:0px; left:500px; background:red; color:white; font-family:Arial,Helvetica,sans-serif; padding:4px;'); disabledZone.appendChild(messageZone); var text = document.createTextNode('Loading'); messageZone.appendChild(text); hidePleaseWait(); dwrSetPreHook(showPleaseWait); dwrSetPostHook(hidePleaseWait)} |
DWREngine.hidePleaseWait(); | DWRUtil.hidePleaseWait(); | DWRUtil.useLoadingMessage = function(){ var disabledZone = document.createElement('div'); disabledZone.setAttribute('id', 'disabledZone'); disabledZone.style.position = "absolute"; disabledZone.style.zIndex = "1000"; disabledZone.style.left = "0px"; disabledZone.style.top = "0px"; disabledZone.style.width = "100%"; disabledZone.style.height = "100%"; document.body.appendChild(disabledZone); var messageZone = document.createElement('div'); messageZone.setAttribute('id', 'messageZone'); messageZone.style.position = "absolute"; messageZone.style.top = "0px"; messageZone.style.right = "0px"; messageZone.style.background = "red"; messageZone.style.color = "white"; messageZone.style.fontFamily = "Arial,Helvetica,sans-serif"; messageZone.style.padding = "4px"; disabledZone.appendChild(messageZone); var text = document.createTextNode('Loading'); messageZone.appendChild(text); DWREngine.hidePleaseWait(); DWREngine.setPreHook(DWRUtil.showPleaseWait); DWREngine.setPostHook(DWRUtil.hidePleaseWait);}; |
unregisterDialogCloser(); | function userOnAfterPage(){ dlog('userOnAfterPage'); unregisterDialogCloser(); var win = gSpider.mDocument.defaultView; if (win.wrappedJSObject) { win = win.wrappedJSObject; } win.__Report = win.reportHTML; win.reportHTML = function () { win.__Report(); gPageCompleted = true; }; win.reportCallBack = function (testwin) { if (testwin.wrappedJSObject) { testwin = testwin.wrappedJSObject; } var testcases = testwin.testcases; if (typeof testcases == 'undefined') { return; } for (var i = 0; i < testcases.length; i++) { var testcase = testcases[i]; cdump('test: ' + testcase.path + ' ' + 'bug: ' + testcase.bugnumber + ' ' + 'result: ' + (testcase.passed ? 'PASSED':'FAILED') + ' ' + 'type: browser ' + 'description: ' + testcase.description + ' ' + 'expected: ' + testcase.expect + ' ' + 'actual: ' + testcase.actual + ' ' + 'reason: ' + testcase.reason); } };// only report failures win.document.forms.testCases.failures.checked = true;// use standards mode win.document.forms.testCases.doctype.value = "standards";// these calls are all async win.selectAll('ecma'); win.selectAll('ecma_2'); win.selectAll('ecma_3'); win.selectAll('js1_1'); win.selectAll('js1_2'); win.selectAll('js1_3'); win.selectAll('js1_4'); win.selectAll('js1_5'); win.selectAll('js1_6');// so need to delay this call to make // sure the previous ones have completed win.setTimeout("executeList()", 10000);} |
|
unregisterDialogCloser(); | function userOnAfterPage(){ dlog('userOnAfterPage'); unregisterDialogCloser(); var win = gSpider.mDocument.defaultView; if (win.wrappedJSObject) { win = win.wrappedJSObject; } win.__Report = win.reportHTML; win.reportHTML = function () { win.__Report(); gPageCompleted = true; }; win.reportCallBack = function (testwin) { if (testwin.wrappedJSObject) { testwin = testwin.wrappedJSObject; } var testcases = testwin.testcases; if (typeof testcases == 'undefined') { return; } for (var i = 0; i < testcases.length; i++) { var testcase = testcases[i]; cdump('test: ' + testcase.path + ' ' + 'bug: ' + testcase.bugnumber + ' ' + 'result: ' + (testcase.passed ? 'PASSED':'FAILED') + ' ' + 'type: browser ' + 'description: ' + testcase.description + ' ' + 'expected: ' + testcase.expect + ' ' + 'actual: ' + testcase.actual + ' ' + 'reason: ' + testcase.reason); } };// only report failures win.document.forms.testCases.failures.checked = true;// use standards mode win.document.forms.testCases.doctype.value = "standards";// these calls are all async win.selectAll('e4x');// so need to delay this call to make // sure the previous ones have completed win.setTimeout("executeList()", 10000);} |
|
registerDialogCloser(); | function userOnBeforePage(){ dlog('userOnBeforePage'); registerDialogCloser();} |
|
location.href = gotothisuri; | if (this.autosubmit == 1) location.href = gotothisuri; | this.useSuggestion = function() { if (this.highlighted > -1) { this.elem.value = this.eligible[this.highlighted]; var gotothisuri = this.actions[this.highlighted]; this.hideDiv(); //It's impossible to cancel the Tab key's default behavior. //So this undoes it by moving the focus back to our field right after //the event completes. setTimeout("document.getElementById('" + this.elem.id + "').focus()",0); //Same applies to Enter key. this.form.onsubmit = function () { return false; }; setTimeout("document.getElementById('" + this.form.id + "').onsubmit = function () { return true; }",10); //Go to search results. location.href = gotothisuri; } }; |
this.parent.actTo (this.nick, msg); | this.parent.actTo(this.nick, fromUnicode(msg, this)); | function usr_act (msg){ this.parent.actTo (this.nick, msg);} |
if (!this.host) return this.unicodeName + "!*@*"; | function usr_banmask(){ var hostmask = this.host; if (!/^\d+\.\d+\.\d+\.\d+$/.test(hostmask)) hostmask = hostmask.replace(/^[^.]+/, "*"); else hostmask = hostmask.replace(/[^.]+$/, "*"); return "*!" + this.name + "@" + hostmask;} |
|
if (typeof msg == "undefined") msg = ""; if (typeof type == "undefined") type = "PRIVMSG"; | msg = msg || ""; type = type || "PRIVMSG"; | function usr_ctcp (code, msg, type){ if (typeof msg == "undefined") msg = ""; if (typeof type == "undefined") type = "PRIVMSG"; this.parent.messageTo(type, this.name, fromUnicode(msg, this), code);} |
this.parent.messageTo (type, this.name, msg, code); | this.parent.messageTo(type, this.name, fromUnicode(msg, this), code); | function usr_ctcp (code, msg, type){ if (typeof msg == "undefined") msg = ""; if (typeof type == "undefined") type = "PRIVMSG"; this.parent.messageTo (type, this.name, msg, code);} |
if (o.server.isConnected && | if (o.server && o.server.isConnected && | function usr_display(message, msgtype, sourceObj, destObj){ if ("messages" in this) { this.displayHere (message, msgtype, sourceObj, destObj); } else { var o = getObjectDetails(client.currentObject); if (o.server.isConnected && o.network == this.parent.parent && client.currentObject.TYPE != "IRCUser") client.currentObject.display (message, msgtype, sourceObj, destObj); else this.parent.parent.displayHere (message, msgtype, sourceObj, destObj); }} |
return this.parent.getURL() + this.nick + "/"; | return this.parent.getURL() + this.nick + ",isnick"; | function usr_geturl (){ return this.parent.getURL() + this.nick + "/";} |
if (!this.rdfRes) | if (!("rdfRes" in this)) | function usr_graphres(){ if (this.TYPE != "IRCChanUser") dd ("** WARNING: cuser.getGraphResource called on wrong object **"); var rdf = client.rdf; if (!this.rdfRes) { if (!CIRCUser.nextResID) CIRCUser.nextResID = 0; this.rdfRes = rdf.GetResource (RES_PFX + "CUSER:" + this.parent.parent.parent.name + ":" + this.parent.name + ":" + CIRCUser.nextResID++); //dd ("created cuser resource " + this.rdfRes.Value); rdf.Assert (this.rdfRes, rdf.resNick, rdf.GetLiteral(this.properNick)); if (this.name) rdf.Assert (this.rdfRes, rdf.resUser, rdf.GetLiteral(this.name)); else rdf.Assert (this.rdfRes, rdf.resUser, rdf.litUnk); if (this.host) rdf.Assert (this.rdfRes, rdf.resHost, rdf.GetLiteral(this.host)); else rdf.Assert (this.rdfRes, rdf.resHost, rdf.litUnk); rdf.Assert (this.rdfRes, rdf.resOp, this.isOp ? rdf.litTrue : rdf.litFalse); rdf.Assert (this.rdfRes, rdf.resVoice, this.isVoice ? rdf.litTrue : rdf.litFalse); } return this.rdfRes;} |
if (!CIRCUser.nextResID) | if (!("nextResID" in CIRCUser)) | function usr_graphres(){ if (this.TYPE != "IRCChanUser") dd ("** WARNING: cuser.getGraphResource called on wrong object **"); var rdf = client.rdf; if (!this.rdfRes) { if (!CIRCUser.nextResID) CIRCUser.nextResID = 0; this.rdfRes = rdf.GetResource (RES_PFX + "CUSER:" + this.parent.parent.parent.name + ":" + this.parent.name + ":" + CIRCUser.nextResID++); //dd ("created cuser resource " + this.rdfRes.Value); rdf.Assert (this.rdfRes, rdf.resNick, rdf.GetLiteral(this.properNick)); if (this.name) rdf.Assert (this.rdfRes, rdf.resUser, rdf.GetLiteral(this.name)); else rdf.Assert (this.rdfRes, rdf.resUser, rdf.litUnk); if (this.host) rdf.Assert (this.rdfRes, rdf.resHost, rdf.GetLiteral(this.host)); else rdf.Assert (this.rdfRes, rdf.resHost, rdf.litUnk); rdf.Assert (this.rdfRes, rdf.resOp, this.isOp ? rdf.litTrue : rdf.litFalse); rdf.Assert (this.rdfRes, rdf.resVoice, this.isVoice ? rdf.litTrue : rdf.litFalse); } return this.rdfRes;} |
this.parent.noticeTo (this.nick, msg); | this.parent.noticeTo(this.nick, fromUnicode(msg, this)); | function usr_notice (msg){ this.parent.noticeTo (this.nick, msg);} |
this.parent.sayTo (this.nick, msg); | this.parent.sayTo(this.nick, fromUnicode(msg, this)); | function usr_say (msg){ this.parent.sayTo (this.nick, msg);} |
if (!this.rdfRes) | if (!("rdfRes" in this)) | function usr_updres(){ if (this.TYPE != "IRCChanUser") dd ("** WARNING: cuser.updateGraphResource called on wrong object **"); if (!this.rdfRes) this.getGraphResource(); var rdf = client.rdf; rdf.Change (this.rdfRes, rdf.resNick, rdf.GetLiteral(this.properNick)); if (this.name) rdf.Change (this.rdfRes, rdf.resUser, rdf.GetLiteral(this.name)); else rdf.Change (this.rdfRes, rdf.resUser, rdf.litUnk); if (this.host) rdf.Change (this.rdfRes, rdf.resHost, rdf.GetLiteral(this.host)); else rdf.Change (this.rdfRes, rdf.resHost, rdf.litUnk); rdf.Change (this.rdfRes, rdf.resOp, this.isOp ? rdf.litTrue : rdf.litFalse); rdf.Change (this.rdfRes, rdf.resVoice, this.isVoice ? rdf.litTrue : rdf.litFalse);} |
var sortname = String.fromCharCode(90 - modeLevel) + "-" + this.unicodeName; | var sortname = (9 - modeLevel) + "-" + this.unicodeName; | function usr_updres(){ if (!ASSERT(this.TYPE == "IRCChanUser", "cuser.updateGraphResource called on wrong object")) { return; } if (!("rdfRes" in this)) { this.getGraphResource(); return; } var rdf = client.rdf; rdf.Change (this.rdfRes, rdf.resUniName, rdf.GetLiteral(this.unicodeName)); if (this.name) rdf.Change (this.rdfRes, rdf.resUser, rdf.GetLiteral(this.name)); else rdf.Change (this.rdfRes, rdf.resUser, rdf.litUnk); if (this.host) rdf.Change (this.rdfRes, rdf.resHost, rdf.GetLiteral(this.host)); else rdf.Change (this.rdfRes, rdf.resHost, rdf.litUnk); // Check for the highest mode the user has. const userModes = this.parent.parent.userModes; var modeLevel = 0; var mode = ""; for (var i = 0; i < this.modes.length; i++) { for (var j = 0; j < userModes.length; j++) { if (userModes[j].mode == this.modes[i]) { if (userModes.length - j > modeLevel) { modeLevel = userModes.length - j; mode = userModes[j].symbol; } break; } } } // Counts up from Z to A. var sortname = String.fromCharCode(90 - modeLevel) + "-" + this.unicodeName; // We want to show mode symbols, but only those we don't 'style'. if (mode && !mode.match(/^[@%+]$/)) { rdf.Change(this.rdfRes, rdf.resNick, rdf.GetLiteral(mode + " " + this.unicodeName)); } else { rdf.Change (this.rdfRes, rdf.resNick, rdf.GetLiteral(this.unicodeName)); } rdf.Change(this.rdfRes, rdf.resSortName, rdf.GetLiteral(sortname)); rdf.Change(this.rdfRes, rdf.resOp, this.isOp ? rdf.litTrue : rdf.litFalse); rdf.Change(this.rdfRes, rdf.resHalfOp, this.isHalfOp ? rdf.litTrue : rdf.litFalse); rdf.Change(this.rdfRes, rdf.resVoice, this.isVoice ? rdf.litTrue : rdf.litFalse); rdf.Change(this.rdfRes, rdf.resAway, this.isAway ? rdf.litTrue : rdf.litFalse);} |
var prefService = Components.classes["@mozilla.org/preferences-service;1"]; prefService = prefService.getService(Components.interfaces.nsIPrefService); var prefBranch = prefService.getBranch(null); prefBranch.addObserver("network.proxy.type", proxyTypeObserver, false); | function utilityOnLoad(aEvent){ var broadcaster = document.getElementById("Communicator:WorkMode"); if (!broadcaster) return; var observerService = Components.classes[kObserverServiceProgID] .getService(Components.interfaces.nsIObserverService); observerService.addObserver(offlineObserver, "network:offline-status-changed", false); // make sure we remove this observer later addEventListener("unload", utilityOnUnload, false); // set the initial state var ioService = Components.classes[kIOServiceProgID] .getService(Components.interfaces.nsIIOService); setOfflineUI(ioService.offline);} |
|
var prefService = Components.classes["@mozilla.org/preferences-service;1"]; prefService = prefService.getService(Components.interfaces.nsIPrefService); var prefBranch = prefService.getBranch(null); prefBranch.removeObserver("network.proxy.type", proxyTypeObserver); | function utilityOnUnload(aEvent) { var observerService = Components.classes[kObserverServiceProgID] .getService(Components.interfaces.nsIObserverService); observerService.removeObserver(offlineObserver, "network:offline-status-changed");} |
|
return typeof h == 'undefined' && this.size() ? this.get(0).value : this.set( "value", h ); }, | return h == undefined && this.size() ? this.get(0).value : this.set( "value", h ); }, | val: function(h) { return typeof h == 'undefined' && this.size() ? this.get(0).value : this.set( "value", h ); }, |
var protocolinfo = Components.classes["component: | var protocolinfo = Components.classes["@mozilla.org/messenger/protocol/info;1?type=" + serverType].getService(Components.interfaces.nsIMsgProtocolInfo); | function validate() { var servername = document.getElementById("hostname"); var smtpserver = document.getElementById("smtphostname"); if ((servername && servername.value =="") || (smtpserver && smtpserver.value == "")) { var alertText = Bundle.GetStringFromName("enterValidHostname"); window.alert(alertText); return false; } /* if this is for a server that doesn't require a username, * check if the account exists. * for other types, we check after the user provides the username (see aw-login.js) */ var pageData = parent.GetPageData(); var serverType = parent.getCurrentServerType(pageData); var protocolinfo = Components.classes["component://netscape/messenger/protocol/info;type=" + serverType].getService(Components.interfaces.nsIMsgProtocolInfo); if (!protocolinfo.requiresUsername) { var userName = parent.getCurrentUserName(pageData); var hostName = servername.value; if (parent.AccountExists(userName,hostName,serverType)) { alertText = Bundle.GetStringFromName("accountExists"); window.alert(alertText); return false; } } return true;} |
SetTextfieldFocus(dialog.BackgroundImageInput); | SetTextboxFocus(dialog.BackgroundImageInput); | function ValidateAndPreviewImage(ShowErrorMessage){ // First make a string with just background color var styleValue = backColorStyle+previewBGColor+";"; var image = dialog.BackgroundImageInput.value.trimString(); if (image) { if (IsValidImage(image)) { backgroundImage = image; // Append image style styleValue += backImageStyle+backgroundImage+");"; } else { backgroundImage = ""; if (ShowErrorMessage) { SetTextfieldFocus(dialog.BackgroundImageInput); // Tell user about bad image ShowInputErrorMessage(GetString("MissingImageError")); } } } else backgroundImage = ""; // Set style on preview (removes image if not valid) dialog.ColorPreview.setAttribute(styleStr, styleValue); // Set the pref data so pref code saves it dialog.BackgroundImageData.setAttribute("value", backgroundImage ? backgroundImage : "");} |
SetTextfieldFocus(dialog.BackgroundImageInput); | SetTextboxFocus(dialog.BackgroundImageInput); | function ValidateAndPreviewImage(ShowErrorMessage){ // First make a string with just background color var styleValue = backColorStyle+previewBGColor+";"; var retVal = true; var image = dialog.BackgroundImageInput.value.trimString(); if (image) { if (IsValidImage(image)) { backgroundImage = image; // Append image style styleValue += backImageStyle+backgroundImage+");"; } else { backgroundImage = null; if (ShowErrorMessage) { SetTextfieldFocus(dialog.BackgroundImageInput); // Tell user about bad image ShowInputErrorMessage(GetString("MissingImageError")); } retVal = false; } } else backgroundImage = null;dump("Set preview background CSS: "+styleValue+"\n"); // Set style on preview (removes image if not valid) dialog.ColorPreview.setAttribute(styleStr, styleValue); // Note that an "empty" string is valid return retVal;} |
if (gValidationError) return false; } if (dialog.RowSpanCheckbox.checked && dialog.RowSpanCheckbox.disabled != "true") { ValidateNumber(dialog.RowSpanInput, null, 0, rowCount, globalCellElement, "rowspan"); if (gValidationError) return false; } if (dialog.ColSpanCheckbox.checked && dialog.ColSpanCheckbox.getAttribute("disabled") != "true") { ValidateNumber(dialog.ColSpanInput, null, 0, colCount, globalCellElement, "colspan"); | function ValidateCellData(){ validatePanel = CellPanel; if (dialog.CellHeightCheckbox.checked) { ValidateNumber(dialog.CellHeightInput, dialog.CellHeightUnits, 1, maxPixels, globalCellElement, "height"); if (gValidationError) return false; } if (dialog.CellWidthCheckbox.checked) { ValidateNumber(dialog.CellWidthInput, dialog.CellWidthUnits, 1, maxPixels, globalCellElement, "width"); if (gValidationError) return false; } if (dialog.RowSpanCheckbox.checked && dialog.RowSpanCheckbox.disabled != "true") { // Note that span = 0 is allowed and means "span entire row/col" ValidateNumber(dialog.RowSpanInput, null, 0, rowCount, globalCellElement, "rowspan"); if (gValidationError) return false; } if (dialog.ColSpanCheckbox.checked && dialog.ColSpanCheckbox.getAttribute("disabled") != "true") { ValidateNumber(dialog.ColSpanInput, null, 0, colCount, globalCellElement, "colspan"); if (gValidationError) return false; } if (dialog.CellHAlignCheckbox.checked) { var hAlign = dialog.CellHAlignList.selectedItem.value; // Horizontal alignment is complicated by "char" type // We don't change current values if user didn't edit alignment if (!alignWasChar) { globalCellElement.removeAttribute(charStr); // Always set "align" attribute, // so the default "left" is effective in a cell // when parent row has align set. globalCellElement.setAttribute("align", hAlign); } } if (dialog.CellVAlignCheckbox.checked) { // Always set valign (no default in 2nd param) so // the default "middle" is effective in a cell // when parent row has valign set. SetAlign("CellVAlignList", "", globalCellElement, "valign"); } if (dialog.TextWrapCheckbox.checked) { if (dialog.TextWrapList.selectedIndex == 1) globalCellElement.setAttribute("nowrap","true"); else globalCellElement.removeAttribute("nowrap"); } return true;} |
|
ValidateNumber("CellHeightInput", dialog.TableHeightUnits, | ValidateNumber("CellHeightInput", dialog.CellHeightUnits, | function ValidateCellData(){ validatePanel = CellPanel; if (dialog.CellHeightCheckbox.checked) { ValidateNumber("CellHeightInput", dialog.TableHeightUnits, 1, maxPixels, globalCellElement, "height"); if (error) return false; } if (dialog.CellWidthCheckbox.checked) { ValidateNumber("CellWidthInput", dialog.TableWidthUnits, 1, maxPixels, globalCellElement, "width"); if (error) return false; } if (dialog.RowSpanCheckbox.checked && dialog.RowSpanCheckbox.disabled != "true") { // Note that span = 0 is allowed and means "span entire row/col" ValidateNumber("RowSpanInput", null, 0, rowCount, globalCellElement, "rowspan"); if (error) return false; } if (dialog.ColSpanCheckbox.checked && dialog.ColSpanCheckbox.getAttribute("disabled") != "true") { ValidateNumber("ColSpanInput", null, 0, colCount, globalCellElement, "colspan"); if (error) return false; } if (dialog.CellHAlignCheckbox.checked) { // Vertical alignment is complicated by "char" type var hAlign = dialog.CellHAlignList.selectedItem.data;dump("Cell hAlign = "+hAlign+"\n"); if (hAlign != charStr) globalCellElement.removeAttribute(charStr); if (hAlign == "left") { globalCellElement.removeAttribute("align"); } else { if (hAlign == charStr) { var alignChar = dialog.CellAlignCharInput.value.trimString().charAt(0); globalCellElement.setAttribute(charStr, alignChar);dump("Alignment char="+alignChar+"\n"); } globalCellElement.setAttribute("align", hAlign); } } if (dialog.CellVAlignCheckbox.checked) SetAlign("CellVAlignList", defVAlign, globalCellElement, "valign"); if (dialog.TextWrapCheckbox.checked) { if (dialog.TextWrapList.selectedIndex == 1) globalCellElement.setAttribute("nowrap","true"); else globalCellElement.removeAttribute("nowrap"); } return true;} |
ValidateNumber("CellWidthInput", dialog.TableWidthUnits, | ValidateNumber("CellWidthInput", dialog.CellWidthUnits, | function ValidateCellData(){ validatePanel = CellPanel; if (dialog.CellHeightCheckbox.checked) { ValidateNumber("CellHeightInput", dialog.TableHeightUnits, 1, maxPixels, globalCellElement, "height"); if (error) return false; } if (dialog.CellWidthCheckbox.checked) { ValidateNumber("CellWidthInput", dialog.TableWidthUnits, 1, maxPixels, globalCellElement, "width"); if (error) return false; } if (dialog.RowSpanCheckbox.checked && dialog.RowSpanCheckbox.disabled != "true") { // Note that span = 0 is allowed and means "span entire row/col" ValidateNumber("RowSpanInput", null, 0, rowCount, globalCellElement, "rowspan"); if (error) return false; } if (dialog.ColSpanCheckbox.checked && dialog.ColSpanCheckbox.getAttribute("disabled") != "true") { ValidateNumber("ColSpanInput", null, 0, colCount, globalCellElement, "colspan"); if (error) return false; } if (dialog.CellHAlignCheckbox.checked) { // Vertical alignment is complicated by "char" type var hAlign = dialog.CellHAlignList.selectedItem.data;dump("Cell hAlign = "+hAlign+"\n"); if (hAlign != charStr) globalCellElement.removeAttribute(charStr); if (hAlign == "left") { globalCellElement.removeAttribute("align"); } else { if (hAlign == charStr) { var alignChar = dialog.CellAlignCharInput.value.trimString().charAt(0); globalCellElement.setAttribute(charStr, alignChar);dump("Alignment char="+alignChar+"\n"); } globalCellElement.setAttribute("align", hAlign); } } if (dialog.CellVAlignCheckbox.checked) SetAlign("CellVAlignList", defVAlign, globalCellElement, "valign"); if (dialog.TextWrapCheckbox.checked) { if (dialog.TextWrapList.selectedIndex == 1) globalCellElement.setAttribute("nowrap","true"); else globalCellElement.removeAttribute("nowrap"); } return true;} |
rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); if (rows == "") { dialog.rowsInput.focus(); | rows = ValidateNumber(dialog.rowsInput, null, 1, maxRows, null, null, true) if (gValidationError) | function ValidateData(){ rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); if (rows == "") { // Set focus to the offending control dialog.rowsInput.focus(); return false; } columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { // Set focus to the offending control SetTextboxFocus(dialog.columnsInput); return false; } // Set attributes: NOTE: These may be empty strings var borderText = TrimString(dialog.borderInput.value); if (borderText) { // Set the other attributes on the table if (ValidateNumberString(borderText, 0, maxPixels)) globalElement.setAttribute("border", borderText); } var maxLimit; var isPercent = (dialog.widthPixelOrPercentMenulist.selectedIndex == 1); var widthText = TrimString(dialog.widthInput.value); if (widthText.length > 0) { if (isPercent) maxLimit = 100; else // Upper limit when using pixels maxLimit = maxPixels; widthText = ValidateNumberString(widthText, 1, maxLimit); if (widthText.length == 0) return false; if (isPercent) widthText += "%"; globalElement.setAttribute("width", widthText); } return true;} |
} | function ValidateData(){ rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); if (rows == "") { // Set focus to the offending control dialog.rowsInput.focus(); return false; } columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { // Set focus to the offending control SetTextboxFocus(dialog.columnsInput); return false; } // Set attributes: NOTE: These may be empty strings var borderText = TrimString(dialog.borderInput.value); if (borderText) { // Set the other attributes on the table if (ValidateNumberString(borderText, 0, maxPixels)) globalElement.setAttribute("border", borderText); } var maxLimit; var isPercent = (dialog.widthPixelOrPercentMenulist.selectedIndex == 1); var widthText = TrimString(dialog.widthInput.value); if (widthText.length > 0) { if (isPercent) maxLimit = 100; else // Upper limit when using pixels maxLimit = maxPixels; widthText = ValidateNumberString(widthText, 1, maxLimit); if (widthText.length == 0) return false; if (isPercent) widthText += "%"; globalElement.setAttribute("width", widthText); } return true;} |
|
columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { SetTextboxFocus(dialog.columnsInput); | columns = ValidateNumber(dialog.columnsInput, null, 1, maxColumns, null, null, true) if (gValidationError) | function ValidateData(){ rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); if (rows == "") { // Set focus to the offending control dialog.rowsInput.focus(); return false; } columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { // Set focus to the offending control SetTextboxFocus(dialog.columnsInput); return false; } // Set attributes: NOTE: These may be empty strings var borderText = TrimString(dialog.borderInput.value); if (borderText) { // Set the other attributes on the table if (ValidateNumberString(borderText, 0, maxPixels)) globalElement.setAttribute("border", borderText); } var maxLimit; var isPercent = (dialog.widthPixelOrPercentMenulist.selectedIndex == 1); var widthText = TrimString(dialog.widthInput.value); if (widthText.length > 0) { if (isPercent) maxLimit = 100; else // Upper limit when using pixels maxLimit = maxPixels; widthText = ValidateNumberString(widthText, 1, maxLimit); if (widthText.length == 0) return false; if (isPercent) widthText += "%"; globalElement.setAttribute("width", widthText); } return true;} |
var borderText = TrimString(dialog.borderInput.value); if (borderText) { if (ValidateNumberString(borderText, 0, maxPixels)) globalElement.setAttribute("border", borderText); } | ValidateNumber(dialog.borderInput, null, 0, maxPixels, globalElement, "border", false); if (gValidationError) return false; | function ValidateData(){ rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); if (rows == "") { // Set focus to the offending control dialog.rowsInput.focus(); return false; } columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { // Set focus to the offending control SetTextboxFocus(dialog.columnsInput); return false; } // Set attributes: NOTE: These may be empty strings var borderText = TrimString(dialog.borderInput.value); if (borderText) { // Set the other attributes on the table if (ValidateNumberString(borderText, 0, maxPixels)) globalElement.setAttribute("border", borderText); } var maxLimit; var isPercent = (dialog.widthPixelOrPercentMenulist.selectedIndex == 1); var widthText = TrimString(dialog.widthInput.value); if (widthText.length > 0) { if (isPercent) maxLimit = 100; else // Upper limit when using pixels maxLimit = maxPixels; widthText = ValidateNumberString(widthText, 1, maxLimit); if (widthText.length == 0) return false; if (isPercent) widthText += "%"; globalElement.setAttribute("width", widthText); } return true;} |
var maxLimit; var isPercent = (dialog.widthPixelOrPercentMenulist.selectedIndex == 1); var widthText = TrimString(dialog.widthInput.value); if (widthText.length > 0) { if (isPercent) maxLimit = 100; else maxLimit = maxPixels; widthText = ValidateNumberString(widthText, 1, maxLimit); if (widthText.length == 0) return false; if (isPercent) widthText += "%"; globalElement.setAttribute("width", widthText); } | ValidateNumber(dialog.widthInput, dialog.widthPixelOrPercentMenulist, 1, maxPixels, globalElement, "width", false); if (gValidationError) return false; | function ValidateData(){ rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); if (rows == "") { // Set focus to the offending control dialog.rowsInput.focus(); return false; } columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { // Set focus to the offending control SetTextboxFocus(dialog.columnsInput); return false; } // Set attributes: NOTE: These may be empty strings var borderText = TrimString(dialog.borderInput.value); if (borderText) { // Set the other attributes on the table if (ValidateNumberString(borderText, 0, maxPixels)) globalElement.setAttribute("border", borderText); } var maxLimit; var isPercent = (dialog.widthPixelOrPercentMenulist.selectedIndex == 1); var widthText = TrimString(dialog.widthInput.value); if (widthText.length > 0) { if (isPercent) maxLimit = 100; else // Upper limit when using pixels maxLimit = maxPixels; widthText = ValidateNumberString(widthText, 1, maxLimit); if (widthText.length == 0) return false; if (isPercent) widthText += "%"; globalElement.setAttribute("width", widthText); } return true;} |
SetTextfieldFocus(dialog.columnsInput); | SetTextboxFocus(dialog.columnsInput); | function ValidateData(){ rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); if (rows == "") { // Set focus to the offending control dialog.rowsInput.focus(); return false; } columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { // Set focus to the offending control SetTextfieldFocus(dialog.columnsInput); return false; } // Set attributes: NOTE: These may be empty strings var borderText = TrimString(dialog.borderInput.value); if (borderText) { // Set the other attributes on the table if (ValidateNumberString(borderText, 0, maxPixels)) globalElement.setAttribute("border", borderText); } var maxLimit; var isPercent = (dialog.widthPixelOrPercentMenulist.selectedIndex == 1); var widthText = TrimString(dialog.widthInput.value); if (widthText.length > 0) { if (isPercent) maxLimit = 100; else // Upper limit when using pixels maxLimit = maxPixels; widthText = ValidateNumberString(widthText, 1, maxLimit); if (widthText.length == 0) return false; if (isPercent) widthText += "%"; globalElement.setAttribute("width", widthText); } return true;} |
var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; | function ValidateData(){ if ( !IsValidImage(dialog.srcInput.value )) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // Note: allow typing spaces, // Warn user if empty string just once per dialog session // but don't consider this a failure var alt = dialog.altTextInput.value; if (doAltTextError && !alt) { ShowInputErrorMessage(GetString("NoAltText")); SetTextboxFocus(dialog.altTextInput); doAltTextError = false; return false; } globalElement.setAttribute("alt", alt); var width = ""; var height = ""; var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if (dialog.actualSizeRadio.checked) { width = actualWidth ? actualWidth : ""; height = actualHeight ? actualHeight : ""; } else { isPercentWidth = (dialog.widthUnitsMenulist.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsMenulist.selectedIndex == 1); maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.widthInput); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.heightInput); return false; } if (isPercentHeight) height = height + "%"; } // We always set the width and height attributes, even if same as actual. // This speeds up layout of pages since sizes are known before image is downloaded // (But don't set if we couldn't obtain actual dimensions) if (width) globalElement.setAttribute("width", width); else globalElement.removeAttribute("width"); if (height) globalElement.setAttribute("height", height); else globalElement.removeAttribute("height"); // spacing attributes var amount; if ( dialog.imagelrInput.value ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute // Note that the attributes "left" and "right" are opposite // of what we use in the UI, which describes where the TEXT wraps, // not the image location (which is what the HTML describes) switch ( dialog.alignTypeSelect.value ) { case "top": case "center": case "right": case "left": globalElement.setAttribute( "align", dialog.alignTypeSelect.value ); break; default: globalElement.removeAttribute( "align" ); } return true;} |
|
if (dialog.actualSizeRadio.checked) | if (!dialog.actualSizeRadio.checked) | function ValidateData(){ if ( !IsValidImage(dialog.srcInput.value )) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // Note: allow typing spaces, // Warn user if empty string just once per dialog session // but don't consider this a failure var alt = dialog.altTextInput.value; if (doAltTextError && !alt) { ShowInputErrorMessage(GetString("NoAltText")); SetTextboxFocus(dialog.altTextInput); doAltTextError = false; return false; } globalElement.setAttribute("alt", alt); var width = ""; var height = ""; var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if (dialog.actualSizeRadio.checked) { width = actualWidth ? actualWidth : ""; height = actualHeight ? actualHeight : ""; } else { isPercentWidth = (dialog.widthUnitsMenulist.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsMenulist.selectedIndex == 1); maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.widthInput); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.heightInput); return false; } if (isPercentHeight) height = height + "%"; } // We always set the width and height attributes, even if same as actual. // This speeds up layout of pages since sizes are known before image is downloaded // (But don't set if we couldn't obtain actual dimensions) if (width) globalElement.setAttribute("width", width); else globalElement.removeAttribute("width"); if (height) globalElement.setAttribute("height", height); else globalElement.removeAttribute("height"); // spacing attributes var amount; if ( dialog.imagelrInput.value ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute // Note that the attributes "left" and "right" are opposite // of what we use in the UI, which describes where the TEXT wraps, // not the image location (which is what the HTML describes) switch ( dialog.alignTypeSelect.value ) { case "top": case "center": case "right": case "left": globalElement.setAttribute( "align", dialog.alignTypeSelect.value ); break; default: globalElement.removeAttribute( "align" ); } return true;} |
width = actualWidth ? actualWidth : ""; height = actualHeight ? actualHeight : ""; | width = ValidateNumber(dialog.widthInput, dialog.widthUnitsMenulist, 1, maxPixels, globalElement, "width", false, true); if (gValidationError) return false; height = ValidateNumber(dialog.heightInput, dialog.heightUnitsMenulist, 1, maxPixels, globalElement, "height", false, ture); if (gValidationError) return false; | function ValidateData(){ if ( !IsValidImage(dialog.srcInput.value )) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // Note: allow typing spaces, // Warn user if empty string just once per dialog session // but don't consider this a failure var alt = dialog.altTextInput.value; if (doAltTextError && !alt) { ShowInputErrorMessage(GetString("NoAltText")); SetTextboxFocus(dialog.altTextInput); doAltTextError = false; return false; } globalElement.setAttribute("alt", alt); var width = ""; var height = ""; var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if (dialog.actualSizeRadio.checked) { width = actualWidth ? actualWidth : ""; height = actualHeight ? actualHeight : ""; } else { isPercentWidth = (dialog.widthUnitsMenulist.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsMenulist.selectedIndex == 1); maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.widthInput); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.heightInput); return false; } if (isPercentHeight) height = height + "%"; } // We always set the width and height attributes, even if same as actual. // This speeds up layout of pages since sizes are known before image is downloaded // (But don't set if we couldn't obtain actual dimensions) if (width) globalElement.setAttribute("width", width); else globalElement.removeAttribute("width"); if (height) globalElement.setAttribute("height", height); else globalElement.removeAttribute("height"); // spacing attributes var amount; if ( dialog.imagelrInput.value ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute // Note that the attributes "left" and "right" are opposite // of what we use in the UI, which describes where the TEXT wraps, // not the image location (which is what the HTML describes) switch ( dialog.alignTypeSelect.value ) { case "top": case "center": case "right": case "left": globalElement.setAttribute( "align", dialog.alignTypeSelect.value ); break; default: globalElement.removeAttribute( "align" ); } return true;} |
else { isPercentWidth = (dialog.widthUnitsMenulist.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsMenulist.selectedIndex == 1); | function ValidateData(){ if ( !IsValidImage(dialog.srcInput.value )) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // Note: allow typing spaces, // Warn user if empty string just once per dialog session // but don't consider this a failure var alt = dialog.altTextInput.value; if (doAltTextError && !alt) { ShowInputErrorMessage(GetString("NoAltText")); SetTextboxFocus(dialog.altTextInput); doAltTextError = false; return false; } globalElement.setAttribute("alt", alt); var width = ""; var height = ""; var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if (dialog.actualSizeRadio.checked) { width = actualWidth ? actualWidth : ""; height = actualHeight ? actualHeight : ""; } else { isPercentWidth = (dialog.widthUnitsMenulist.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsMenulist.selectedIndex == 1); maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.widthInput); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.heightInput); return false; } if (isPercentHeight) height = height + "%"; } // We always set the width and height attributes, even if same as actual. // This speeds up layout of pages since sizes are known before image is downloaded // (But don't set if we couldn't obtain actual dimensions) if (width) globalElement.setAttribute("width", width); else globalElement.removeAttribute("width"); if (height) globalElement.setAttribute("height", height); else globalElement.removeAttribute("height"); // spacing attributes var amount; if ( dialog.imagelrInput.value ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute // Note that the attributes "left" and "right" are opposite // of what we use in the UI, which describes where the TEXT wraps, // not the image location (which is what the HTML describes) switch ( dialog.alignTypeSelect.value ) { case "top": case "center": case "right": case "left": globalElement.setAttribute( "align", dialog.alignTypeSelect.value ); break; default: globalElement.removeAttribute( "align" ); } return true;} |
|
maxLimitWidth = isPercentWidth ? 100 : maxPixels; width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.widthInput); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.heightInput); return false; } if (isPercentHeight) height = height + "%"; } | function ValidateData(){ if ( !IsValidImage(dialog.srcInput.value )) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // Note: allow typing spaces, // Warn user if empty string just once per dialog session // but don't consider this a failure var alt = dialog.altTextInput.value; if (doAltTextError && !alt) { ShowInputErrorMessage(GetString("NoAltText")); SetTextboxFocus(dialog.altTextInput); doAltTextError = false; return false; } globalElement.setAttribute("alt", alt); var width = ""; var height = ""; var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if (dialog.actualSizeRadio.checked) { width = actualWidth ? actualWidth : ""; height = actualHeight ? actualHeight : ""; } else { isPercentWidth = (dialog.widthUnitsMenulist.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsMenulist.selectedIndex == 1); maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.widthInput); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.heightInput); return false; } if (isPercentHeight) height = height + "%"; } // We always set the width and height attributes, even if same as actual. // This speeds up layout of pages since sizes are known before image is downloaded // (But don't set if we couldn't obtain actual dimensions) if (width) globalElement.setAttribute("width", width); else globalElement.removeAttribute("width"); if (height) globalElement.setAttribute("height", height); else globalElement.removeAttribute("height"); // spacing attributes var amount; if ( dialog.imagelrInput.value ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute // Note that the attributes "left" and "right" are opposite // of what we use in the UI, which describes where the TEXT wraps, // not the image location (which is what the HTML describes) switch ( dialog.alignTypeSelect.value ) { case "top": case "center": case "right": case "left": globalElement.setAttribute( "align", dialog.alignTypeSelect.value ); break; default: globalElement.removeAttribute( "align" ); } return true;} |
|
var amount; if ( dialog.imagelrInput.value ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); | function ValidateData(){ if ( !IsValidImage(dialog.srcInput.value )) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // Note: allow typing spaces, // Warn user if empty string just once per dialog session // but don't consider this a failure var alt = dialog.altTextInput.value; if (doAltTextError && !alt) { ShowInputErrorMessage(GetString("NoAltText")); SetTextboxFocus(dialog.altTextInput); doAltTextError = false; return false; } globalElement.setAttribute("alt", alt); var width = ""; var height = ""; var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if (dialog.actualSizeRadio.checked) { width = actualWidth ? actualWidth : ""; height = actualHeight ? actualHeight : ""; } else { isPercentWidth = (dialog.widthUnitsMenulist.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsMenulist.selectedIndex == 1); maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.widthInput); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.heightInput); return false; } if (isPercentHeight) height = height + "%"; } // We always set the width and height attributes, even if same as actual. // This speeds up layout of pages since sizes are known before image is downloaded // (But don't set if we couldn't obtain actual dimensions) if (width) globalElement.setAttribute("width", width); else globalElement.removeAttribute("width"); if (height) globalElement.setAttribute("height", height); else globalElement.removeAttribute("height"); // spacing attributes var amount; if ( dialog.imagelrInput.value ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute // Note that the attributes "left" and "right" are opposite // of what we use in the UI, which describes where the TEXT wraps, // not the image location (which is what the HTML describes) switch ( dialog.alignTypeSelect.value ) { case "top": case "center": case "right": case "left": globalElement.setAttribute( "align", dialog.alignTypeSelect.value ); break; default: globalElement.removeAttribute( "align" ); } return true;} |
|
if ( dialog.imagetbInput.value ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); | ValidateNumber(dialog.imagelrInput, null, 0, maxPixels, globalElement, "hspace", false, true, true); if (gValidationError) return false; ValidateNumber(dialog.imagetbInput, null, 0, maxPixels, globalElement, "vspace", false, true); if (gValidationError) return false; | function ValidateData(){ if ( !IsValidImage(dialog.srcInput.value )) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // Note: allow typing spaces, // Warn user if empty string just once per dialog session // but don't consider this a failure var alt = dialog.altTextInput.value; if (doAltTextError && !alt) { ShowInputErrorMessage(GetString("NoAltText")); SetTextboxFocus(dialog.altTextInput); doAltTextError = false; return false; } globalElement.setAttribute("alt", alt); var width = ""; var height = ""; var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if (dialog.actualSizeRadio.checked) { width = actualWidth ? actualWidth : ""; height = actualHeight ? actualHeight : ""; } else { isPercentWidth = (dialog.widthUnitsMenulist.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsMenulist.selectedIndex == 1); maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.widthInput); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.heightInput); return false; } if (isPercentHeight) height = height + "%"; } // We always set the width and height attributes, even if same as actual. // This speeds up layout of pages since sizes are known before image is downloaded // (But don't set if we couldn't obtain actual dimensions) if (width) globalElement.setAttribute("width", width); else globalElement.removeAttribute("width"); if (height) globalElement.setAttribute("height", height); else globalElement.removeAttribute("height"); // spacing attributes var amount; if ( dialog.imagelrInput.value ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute // Note that the attributes "left" and "right" are opposite // of what we use in the UI, which describes where the TEXT wraps, // not the image location (which is what the HTML describes) switch ( dialog.alignTypeSelect.value ) { case "top": case "center": case "right": case "left": globalElement.setAttribute( "align", dialog.alignTypeSelect.value ); break; default: globalElement.removeAttribute( "align" ); } return true;} |
if ( dialog.border.value ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); | ValidateNumber(dialog.border, null, 0, maxPixels, globalElement, "border", false, true); if (gValidationError) return false; | function ValidateData(){ if ( !IsValidImage(dialog.srcInput.value )) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // Note: allow typing spaces, // Warn user if empty string just once per dialog session // but don't consider this a failure var alt = dialog.altTextInput.value; if (doAltTextError && !alt) { ShowInputErrorMessage(GetString("NoAltText")); SetTextboxFocus(dialog.altTextInput); doAltTextError = false; return false; } globalElement.setAttribute("alt", alt); var width = ""; var height = ""; var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if (dialog.actualSizeRadio.checked) { width = actualWidth ? actualWidth : ""; height = actualHeight ? actualHeight : ""; } else { isPercentWidth = (dialog.widthUnitsMenulist.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsMenulist.selectedIndex == 1); maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.widthInput); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextboxFocus(dialog.heightInput); return false; } if (isPercentHeight) height = height + "%"; } // We always set the width and height attributes, even if same as actual. // This speeds up layout of pages since sizes are known before image is downloaded // (But don't set if we couldn't obtain actual dimensions) if (width) globalElement.setAttribute("width", width); else globalElement.removeAttribute("width"); if (height) globalElement.setAttribute("height", height); else globalElement.removeAttribute("height"); // spacing attributes var amount; if ( dialog.imagelrInput.value ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute // Note that the attributes "left" and "right" are opposite // of what we use in the UI, which describes where the TEXT wraps, // not the image location (which is what the HTML describes) switch ( dialog.alignTypeSelect.value ) { case "top": case "center": case "right": case "left": globalElement.setAttribute( "align", dialog.alignTypeSelect.value ); break; default: globalElement.removeAttribute( "align" ); } return true;} |
{ | function ValidateData(){ // Colors values are updated as they are picked, no validation necessary if (dialog.DefaultColorsRadio.checked) { globalElement.removeAttribute(textStr); globalElement.removeAttribute(linkStr); globalElement.removeAttribute(vlinkStr); globalElement.removeAttribute(alinkStr); globalElement.removeAttribute(bgcolorStr); } else { globalElement.setAttribute(textStr, customTextColor); globalElement.setAttribute(linkStr, customLinkColor); globalElement.setAttribute(vlinkStr, customVisitedColor); globalElement.setAttribute(alinkStr, customActiveColor); globalElement.setAttribute(bgcolorStr, customBackgroundColor); } if (ValidateAndPreviewImage(true)) { // A valid image may be null for no image if (backgroundImage) { globalElement.setAttribute(backgroundStr, backgroundImage); } else { globalElement.removeAttribute(backgroundStr); return false; } } return true;} |
|
} else { | else | function ValidateData(){ // Colors values are updated as they are picked, no validation necessary if (dialog.DefaultColorsRadio.checked) { globalElement.removeAttribute(textStr); globalElement.removeAttribute(linkStr); globalElement.removeAttribute(vlinkStr); globalElement.removeAttribute(alinkStr); globalElement.removeAttribute(bgcolorStr); } else { globalElement.setAttribute(textStr, customTextColor); globalElement.setAttribute(linkStr, customLinkColor); globalElement.setAttribute(vlinkStr, customVisitedColor); globalElement.setAttribute(alinkStr, customActiveColor); globalElement.setAttribute(bgcolorStr, customBackgroundColor); } if (ValidateAndPreviewImage(true)) { // A valid image may be null for no image if (backgroundImage) { globalElement.setAttribute(backgroundStr, backgroundImage); } else { globalElement.removeAttribute(backgroundStr); return false; } } return true;} |
return false; } | function ValidateData(){ // Colors values are updated as they are picked, no validation necessary if (dialog.DefaultColorsRadio.checked) { globalElement.removeAttribute(textStr); globalElement.removeAttribute(linkStr); globalElement.removeAttribute(vlinkStr); globalElement.removeAttribute(alinkStr); globalElement.removeAttribute(bgcolorStr); } else { globalElement.setAttribute(textStr, customTextColor); globalElement.setAttribute(linkStr, customLinkColor); globalElement.setAttribute(vlinkStr, customVisitedColor); globalElement.setAttribute(alinkStr, customActiveColor); globalElement.setAttribute(bgcolorStr, customBackgroundColor); } if (ValidateAndPreviewImage(true)) { // A valid image may be null for no image if (backgroundImage) { globalElement.setAttribute(backgroundStr, backgroundImage); } else { globalElement.removeAttribute(backgroundStr); return false; } } return true;} |
|
var isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); var maxLimitWidth = isPercentWidth ? 100 : maxPixels; var isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); var maxLimitHeight = isPercentHeight ? 100 : maxPixels; | function ValidateData(){ var imageTypeExtension = checkForImage(); if ( !imageTypeExtension ) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // TODO: Should we confirm with user if no alt tag? Or just set to empty string? var alt = dialog.altTextInput.value.trimString(); globalElement.setAttribute("alt", alt); var isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); var maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js var isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); var maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js //TODO: WE SHOULD ALWAYS SET WIDTH AND HEIGHT FOR FASTER IMAGE LAYOUT // IF USER DOESN'T SET IT, WE NEED TO GET VALUE FROM ORIGINAL IMAGE var width = ""; var height = ""; if ( dialog.customsizeRadio.checked ) { width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { dump("Image Width is empty\n"); dialog.widthInput.focus(); return false; } if (isPercentWidth) width = width + "%"; height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { dump("Image Height is empty\n"); dialog.heightInput.focus(); return false; } if (isPercentHeight) height = height + "%"; } if ( dialog.originalsizeRadio.checked ) { // for now (until we can get the actual image dimensions), clear the height/width attributes if not set globalElement.removeAttribute( "width" ); globalElement.removeAttribute( "height" ); } else { if (width.length > 0) globalElement.setAttribute("width", width); if (height.length > 0) globalElement.setAttribute("height", height); } // spacing attributes // All of these should use ValidateNumberString() to // ensure value is within acceptable range if ( dialog.imagelrInput.value.length > 0 ) { var hspace = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (hspace == "") return false; globalElement.setAttribute( "hspace", hspace ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: break; case 4: break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); return true;} |
|
if ( dialog.customsizeRadio.checked ) | var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if ( SeeMore ) | function ValidateData(){ var imageTypeExtension = checkForImage(); if ( !imageTypeExtension ) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // TODO: Should we confirm with user if no alt tag? Or just set to empty string? var alt = dialog.altTextInput.value.trimString(); globalElement.setAttribute("alt", alt); var isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); var maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js var isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); var maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js //TODO: WE SHOULD ALWAYS SET WIDTH AND HEIGHT FOR FASTER IMAGE LAYOUT // IF USER DOESN'T SET IT, WE NEED TO GET VALUE FROM ORIGINAL IMAGE var width = ""; var height = ""; if ( dialog.customsizeRadio.checked ) { width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { dump("Image Width is empty\n"); dialog.widthInput.focus(); return false; } if (isPercentWidth) width = width + "%"; height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { dump("Image Height is empty\n"); dialog.heightInput.focus(); return false; } if (isPercentHeight) height = height + "%"; } if ( dialog.originalsizeRadio.checked ) { // for now (until we can get the actual image dimensions), clear the height/width attributes if not set globalElement.removeAttribute( "width" ); globalElement.removeAttribute( "height" ); } else { if (width.length > 0) globalElement.setAttribute("width", width); if (height.length > 0) globalElement.setAttribute("height", height); } // spacing attributes // All of these should use ValidateNumberString() to // ensure value is within acceptable range if ( dialog.imagelrInput.value.length > 0 ) { var hspace = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (hspace == "") return false; globalElement.setAttribute( "hspace", hspace ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: break; case 4: break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); return true;} |
width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); | dialog.isCustomSize = dialog.customsizeRadio.checked; isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); width = dialog.widthInput.value; height = dialog.heightInput.value; } else { var tailindex; width = globalElement.getAttribute( "width" ); tailindex = width.lastIndexOf("%"); isPercentWidth = ( tailindex > 0 ); if ( isPercentWidth ) width = width.substring(0, tailindex); height = globalElement.getAttribute( "height" ); tailindex = height.lastIndexOf("%"); isPercentHeight = ( tailindex > 0 ); if ( isPercentHeight ) height = height.substring(0, tailindex); } if ( dialog.isCustomSize ) { maxLimitWidth = isPercentWidth ? 100 : maxPixels; width = ValidateNumberString(width, 1, maxLimitWidth); | function ValidateData(){ var imageTypeExtension = checkForImage(); if ( !imageTypeExtension ) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // TODO: Should we confirm with user if no alt tag? Or just set to empty string? var alt = dialog.altTextInput.value.trimString(); globalElement.setAttribute("alt", alt); var isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); var maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js var isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); var maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js //TODO: WE SHOULD ALWAYS SET WIDTH AND HEIGHT FOR FASTER IMAGE LAYOUT // IF USER DOESN'T SET IT, WE NEED TO GET VALUE FROM ORIGINAL IMAGE var width = ""; var height = ""; if ( dialog.customsizeRadio.checked ) { width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { dump("Image Width is empty\n"); dialog.widthInput.focus(); return false; } if (isPercentWidth) width = width + "%"; height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { dump("Image Height is empty\n"); dialog.heightInput.focus(); return false; } if (isPercentHeight) height = height + "%"; } if ( dialog.originalsizeRadio.checked ) { // for now (until we can get the actual image dimensions), clear the height/width attributes if not set globalElement.removeAttribute( "width" ); globalElement.removeAttribute( "height" ); } else { if (width.length > 0) globalElement.setAttribute("width", width); if (height.length > 0) globalElement.setAttribute("height", height); } // spacing attributes // All of these should use ValidateNumberString() to // ensure value is within acceptable range if ( dialog.imagelrInput.value.length > 0 ) { var hspace = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (hspace == "") return false; globalElement.setAttribute( "hspace", hspace ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: break; case 4: break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); return true;} |
dump("Image Width is empty\n"); | if ( !SeeMore ) onMoreFewer(); | function ValidateData(){ var imageTypeExtension = checkForImage(); if ( !imageTypeExtension ) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // TODO: Should we confirm with user if no alt tag? Or just set to empty string? var alt = dialog.altTextInput.value.trimString(); globalElement.setAttribute("alt", alt); var isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); var maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js var isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); var maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js //TODO: WE SHOULD ALWAYS SET WIDTH AND HEIGHT FOR FASTER IMAGE LAYOUT // IF USER DOESN'T SET IT, WE NEED TO GET VALUE FROM ORIGINAL IMAGE var width = ""; var height = ""; if ( dialog.customsizeRadio.checked ) { width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { dump("Image Width is empty\n"); dialog.widthInput.focus(); return false; } if (isPercentWidth) width = width + "%"; height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { dump("Image Height is empty\n"); dialog.heightInput.focus(); return false; } if (isPercentHeight) height = height + "%"; } if ( dialog.originalsizeRadio.checked ) { // for now (until we can get the actual image dimensions), clear the height/width attributes if not set globalElement.removeAttribute( "width" ); globalElement.removeAttribute( "height" ); } else { if (width.length > 0) globalElement.setAttribute("width", width); if (height.length > 0) globalElement.setAttribute("height", height); } // spacing attributes // All of these should use ValidateNumberString() to // ensure value is within acceptable range if ( dialog.imagelrInput.value.length > 0 ) { var hspace = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (hspace == "") return false; globalElement.setAttribute( "hspace", hspace ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: break; case 4: break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); return true;} |
height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); | maxLimitHeight = isPercentHeight ? 100 : maxPixels; height = ValidateNumberString(height, 1, maxLimitHeight); | function ValidateData(){ var imageTypeExtension = checkForImage(); if ( !imageTypeExtension ) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // TODO: Should we confirm with user if no alt tag? Or just set to empty string? var alt = dialog.altTextInput.value.trimString(); globalElement.setAttribute("alt", alt); var isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); var maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js var isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); var maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js //TODO: WE SHOULD ALWAYS SET WIDTH AND HEIGHT FOR FASTER IMAGE LAYOUT // IF USER DOESN'T SET IT, WE NEED TO GET VALUE FROM ORIGINAL IMAGE var width = ""; var height = ""; if ( dialog.customsizeRadio.checked ) { width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { dump("Image Width is empty\n"); dialog.widthInput.focus(); return false; } if (isPercentWidth) width = width + "%"; height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { dump("Image Height is empty\n"); dialog.heightInput.focus(); return false; } if (isPercentHeight) height = height + "%"; } if ( dialog.originalsizeRadio.checked ) { // for now (until we can get the actual image dimensions), clear the height/width attributes if not set globalElement.removeAttribute( "width" ); globalElement.removeAttribute( "height" ); } else { if (width.length > 0) globalElement.setAttribute("width", width); if (height.length > 0) globalElement.setAttribute("height", height); } // spacing attributes // All of these should use ValidateNumberString() to // ensure value is within acceptable range if ( dialog.imagelrInput.value.length > 0 ) { var hspace = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (hspace == "") return false; globalElement.setAttribute( "hspace", hspace ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: break; case 4: break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); return true;} |
dump("Image Height is empty\n"); | if ( !SeeMore ) onMoreFewer(); | function ValidateData(){ var imageTypeExtension = checkForImage(); if ( !imageTypeExtension ) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // TODO: Should we confirm with user if no alt tag? Or just set to empty string? var alt = dialog.altTextInput.value.trimString(); globalElement.setAttribute("alt", alt); var isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); var maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js var isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); var maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js //TODO: WE SHOULD ALWAYS SET WIDTH AND HEIGHT FOR FASTER IMAGE LAYOUT // IF USER DOESN'T SET IT, WE NEED TO GET VALUE FROM ORIGINAL IMAGE var width = ""; var height = ""; if ( dialog.customsizeRadio.checked ) { width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { dump("Image Width is empty\n"); dialog.widthInput.focus(); return false; } if (isPercentWidth) width = width + "%"; height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { dump("Image Height is empty\n"); dialog.heightInput.focus(); return false; } if (isPercentHeight) height = height + "%"; } if ( dialog.originalsizeRadio.checked ) { // for now (until we can get the actual image dimensions), clear the height/width attributes if not set globalElement.removeAttribute( "width" ); globalElement.removeAttribute( "height" ); } else { if (width.length > 0) globalElement.setAttribute("width", width); if (height.length > 0) globalElement.setAttribute("height", height); } // spacing attributes // All of these should use ValidateNumberString() to // ensure value is within acceptable range if ( dialog.imagelrInput.value.length > 0 ) { var hspace = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (hspace == "") return false; globalElement.setAttribute( "hspace", hspace ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: break; case 4: break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); return true;} |
if ( dialog.originalsizeRadio.checked ) | if ( !dialog.isCustomSize ) | function ValidateData(){ var imageTypeExtension = checkForImage(); if ( !imageTypeExtension ) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // TODO: Should we confirm with user if no alt tag? Or just set to empty string? var alt = dialog.altTextInput.value.trimString(); globalElement.setAttribute("alt", alt); var isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); var maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js var isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); var maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js //TODO: WE SHOULD ALWAYS SET WIDTH AND HEIGHT FOR FASTER IMAGE LAYOUT // IF USER DOESN'T SET IT, WE NEED TO GET VALUE FROM ORIGINAL IMAGE var width = ""; var height = ""; if ( dialog.customsizeRadio.checked ) { width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { dump("Image Width is empty\n"); dialog.widthInput.focus(); return false; } if (isPercentWidth) width = width + "%"; height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { dump("Image Height is empty\n"); dialog.heightInput.focus(); return false; } if (isPercentHeight) height = height + "%"; } if ( dialog.originalsizeRadio.checked ) { // for now (until we can get the actual image dimensions), clear the height/width attributes if not set globalElement.removeAttribute( "width" ); globalElement.removeAttribute( "height" ); } else { if (width.length > 0) globalElement.setAttribute("width", width); if (height.length > 0) globalElement.setAttribute("height", height); } // spacing attributes // All of these should use ValidateNumberString() to // ensure value is within acceptable range if ( dialog.imagelrInput.value.length > 0 ) { var hspace = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (hspace == "") return false; globalElement.setAttribute( "hspace", hspace ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: break; case 4: break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); return true;} |
if ( dialog.imagelrInput.value.length > 0 ) | var amount; if ( SeeMore ) | function ValidateData(){ var imageTypeExtension = checkForImage(); if ( !imageTypeExtension ) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // TODO: Should we confirm with user if no alt tag? Or just set to empty string? var alt = dialog.altTextInput.value.trimString(); globalElement.setAttribute("alt", alt); var isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); var maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js var isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); var maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js //TODO: WE SHOULD ALWAYS SET WIDTH AND HEIGHT FOR FASTER IMAGE LAYOUT // IF USER DOESN'T SET IT, WE NEED TO GET VALUE FROM ORIGINAL IMAGE var width = ""; var height = ""; if ( dialog.customsizeRadio.checked ) { width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { dump("Image Width is empty\n"); dialog.widthInput.focus(); return false; } if (isPercentWidth) width = width + "%"; height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { dump("Image Height is empty\n"); dialog.heightInput.focus(); return false; } if (isPercentHeight) height = height + "%"; } if ( dialog.originalsizeRadio.checked ) { // for now (until we can get the actual image dimensions), clear the height/width attributes if not set globalElement.removeAttribute( "width" ); globalElement.removeAttribute( "height" ); } else { if (width.length > 0) globalElement.setAttribute("width", width); if (height.length > 0) globalElement.setAttribute("height", height); } // spacing attributes // All of these should use ValidateNumberString() to // ensure value is within acceptable range if ( dialog.imagelrInput.value.length > 0 ) { var hspace = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (hspace == "") return false; globalElement.setAttribute( "hspace", hspace ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: break; case 4: break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); return true;} |
var hspace = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (hspace == "") return false; globalElement.setAttribute( "hspace", hspace ); | if ( dialog.imagelrInput.value.length > 0 ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: align = "left"; break; case 4: align = "right"; break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); | function ValidateData(){ var imageTypeExtension = checkForImage(); if ( !imageTypeExtension ) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // TODO: Should we confirm with user if no alt tag? Or just set to empty string? var alt = dialog.altTextInput.value.trimString(); globalElement.setAttribute("alt", alt); var isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); var maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js var isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); var maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js //TODO: WE SHOULD ALWAYS SET WIDTH AND HEIGHT FOR FASTER IMAGE LAYOUT // IF USER DOESN'T SET IT, WE NEED TO GET VALUE FROM ORIGINAL IMAGE var width = ""; var height = ""; if ( dialog.customsizeRadio.checked ) { width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { dump("Image Width is empty\n"); dialog.widthInput.focus(); return false; } if (isPercentWidth) width = width + "%"; height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { dump("Image Height is empty\n"); dialog.heightInput.focus(); return false; } if (isPercentHeight) height = height + "%"; } if ( dialog.originalsizeRadio.checked ) { // for now (until we can get the actual image dimensions), clear the height/width attributes if not set globalElement.removeAttribute( "width" ); globalElement.removeAttribute( "height" ); } else { if (width.length > 0) globalElement.setAttribute("width", width); if (height.length > 0) globalElement.setAttribute("height", height); } // spacing attributes // All of these should use ValidateNumberString() to // ensure value is within acceptable range if ( dialog.imagelrInput.value.length > 0 ) { var hspace = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (hspace == "") return false; globalElement.setAttribute( "hspace", hspace ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: break; case 4: break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); return true;} |
else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: break; case 4: break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); | function ValidateData(){ var imageTypeExtension = checkForImage(); if ( !imageTypeExtension ) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // TODO: Should we confirm with user if no alt tag? Or just set to empty string? var alt = dialog.altTextInput.value.trimString(); globalElement.setAttribute("alt", alt); var isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); var maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js var isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); var maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js //TODO: WE SHOULD ALWAYS SET WIDTH AND HEIGHT FOR FASTER IMAGE LAYOUT // IF USER DOESN'T SET IT, WE NEED TO GET VALUE FROM ORIGINAL IMAGE var width = ""; var height = ""; if ( dialog.customsizeRadio.checked ) { width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { dump("Image Width is empty\n"); dialog.widthInput.focus(); return false; } if (isPercentWidth) width = width + "%"; height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { dump("Image Height is empty\n"); dialog.heightInput.focus(); return false; } if (isPercentHeight) height = height + "%"; } if ( dialog.originalsizeRadio.checked ) { // for now (until we can get the actual image dimensions), clear the height/width attributes if not set globalElement.removeAttribute( "width" ); globalElement.removeAttribute( "height" ); } else { if (width.length > 0) globalElement.setAttribute("width", width); if (height.length > 0) globalElement.setAttribute("height", height); } // spacing attributes // All of these should use ValidateNumberString() to // ensure value is within acceptable range if ( dialog.imagelrInput.value.length > 0 ) { var hspace = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (hspace == "") return false; globalElement.setAttribute( "hspace", hspace ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: break; case 4: break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); return true;} |
|
if (widthText.length > 0) { if (isPercent) { | if (widthText.length > 0) { if (isPercent) | function ValidateData(){ rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); if (rows == "") { // Set focus to the offending control dialog.rowsInput.focus(); return false; } columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { // Set focus to the offending control dialog.columnsInput.focus(); return false; } // Set attributes: NOTE: These may be empty strings borderText = TrimString(dialog.borderInput.value); if (borderText) { // Set the other attributes on the table if (ValidateNumberString(borderText, 0, maxPixels)) globalElement.setAttribute("border", borderText); } var maxLimit; var isPercent = (dialog.widthPixelOrPercentMenulist.selectedIndex == 1); widthText = TrimString(dialog.widthInput.value); if (widthText.length > 0) { if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } widthText = ValidateNumberString(dialog.widthInput.value, 1, maxLimit); if (widthText.length == 0) return false; if (isPercent) widthText += "%"; globalElement.setAttribute("width", widthText); } isPercent = (dialog.heightPixelOrPercentMenulist.selectedIndex == 1); heightText = TrimString(dialog.widthInput.value); if (heightText.length > 0) { if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } heightText = ValidateNumberString(dialog.heightInput.value, 1, maxLimit); if (heightText.length == 0) return false; if (isPercent) heightText += "%"; globalElement.setAttribute("height", heightText); } return true;} |
} else { | else | function ValidateData(){ rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); if (rows == "") { // Set focus to the offending control dialog.rowsInput.focus(); return false; } columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { // Set focus to the offending control dialog.columnsInput.focus(); return false; } // Set attributes: NOTE: These may be empty strings borderText = TrimString(dialog.borderInput.value); if (borderText) { // Set the other attributes on the table if (ValidateNumberString(borderText, 0, maxPixels)) globalElement.setAttribute("border", borderText); } var maxLimit; var isPercent = (dialog.widthPixelOrPercentMenulist.selectedIndex == 1); widthText = TrimString(dialog.widthInput.value); if (widthText.length > 0) { if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } widthText = ValidateNumberString(dialog.widthInput.value, 1, maxLimit); if (widthText.length == 0) return false; if (isPercent) widthText += "%"; globalElement.setAttribute("width", widthText); } isPercent = (dialog.heightPixelOrPercentMenulist.selectedIndex == 1); heightText = TrimString(dialog.widthInput.value); if (heightText.length > 0) { if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } heightText = ValidateNumberString(dialog.heightInput.value, 1, maxLimit); if (heightText.length == 0) return false; if (isPercent) heightText += "%"; globalElement.setAttribute("height", heightText); } return true;} |
} | function ValidateData(){ rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); if (rows == "") { // Set focus to the offending control dialog.rowsInput.focus(); return false; } columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { // Set focus to the offending control dialog.columnsInput.focus(); return false; } // Set attributes: NOTE: These may be empty strings borderText = TrimString(dialog.borderInput.value); if (borderText) { // Set the other attributes on the table if (ValidateNumberString(borderText, 0, maxPixels)) globalElement.setAttribute("border", borderText); } var maxLimit; var isPercent = (dialog.widthPixelOrPercentMenulist.selectedIndex == 1); widthText = TrimString(dialog.widthInput.value); if (widthText.length > 0) { if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } widthText = ValidateNumberString(dialog.widthInput.value, 1, maxLimit); if (widthText.length == 0) return false; if (isPercent) widthText += "%"; globalElement.setAttribute("width", widthText); } isPercent = (dialog.heightPixelOrPercentMenulist.selectedIndex == 1); heightText = TrimString(dialog.widthInput.value); if (heightText.length > 0) { if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } heightText = ValidateNumberString(dialog.heightInput.value, 1, maxLimit); if (heightText.length == 0) return false; if (isPercent) heightText += "%"; globalElement.setAttribute("height", heightText); } return true;} |
|
widthText = ValidateNumberString(dialog.widthInput.value, 1, maxLimit); if (widthText.length == 0) return false; | widthText = ValidateNumberString(widthText, 1, maxLimit); if (widthText.length == 0) return false; | function ValidateData(){ rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); if (rows == "") { // Set focus to the offending control dialog.rowsInput.focus(); return false; } columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { // Set focus to the offending control dialog.columnsInput.focus(); return false; } // Set attributes: NOTE: These may be empty strings borderText = TrimString(dialog.borderInput.value); if (borderText) { // Set the other attributes on the table if (ValidateNumberString(borderText, 0, maxPixels)) globalElement.setAttribute("border", borderText); } var maxLimit; var isPercent = (dialog.widthPixelOrPercentMenulist.selectedIndex == 1); widthText = TrimString(dialog.widthInput.value); if (widthText.length > 0) { if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } widthText = ValidateNumberString(dialog.widthInput.value, 1, maxLimit); if (widthText.length == 0) return false; if (isPercent) widthText += "%"; globalElement.setAttribute("width", widthText); } isPercent = (dialog.heightPixelOrPercentMenulist.selectedIndex == 1); heightText = TrimString(dialog.widthInput.value); if (heightText.length > 0) { if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } heightText = ValidateNumberString(dialog.heightInput.value, 1, maxLimit); if (heightText.length == 0) return false; if (isPercent) heightText += "%"; globalElement.setAttribute("height", heightText); } return true;} |
heightText = TrimString(dialog.widthInput.value); if (heightText.length > 0) { if (isPercent) { | heightText = TrimString(dialog.heightInput.value); if (heightText.length > 0) { if (isPercent) | function ValidateData(){ rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); if (rows == "") { // Set focus to the offending control dialog.rowsInput.focus(); return false; } columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { // Set focus to the offending control dialog.columnsInput.focus(); return false; } // Set attributes: NOTE: These may be empty strings borderText = TrimString(dialog.borderInput.value); if (borderText) { // Set the other attributes on the table if (ValidateNumberString(borderText, 0, maxPixels)) globalElement.setAttribute("border", borderText); } var maxLimit; var isPercent = (dialog.widthPixelOrPercentMenulist.selectedIndex == 1); widthText = TrimString(dialog.widthInput.value); if (widthText.length > 0) { if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } widthText = ValidateNumberString(dialog.widthInput.value, 1, maxLimit); if (widthText.length == 0) return false; if (isPercent) widthText += "%"; globalElement.setAttribute("width", widthText); } isPercent = (dialog.heightPixelOrPercentMenulist.selectedIndex == 1); heightText = TrimString(dialog.widthInput.value); if (heightText.length > 0) { if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } heightText = ValidateNumberString(dialog.heightInput.value, 1, maxLimit); if (heightText.length == 0) return false; if (isPercent) heightText += "%"; globalElement.setAttribute("height", heightText); } return true;} |
heightText = ValidateNumberString(dialog.heightInput.value, 1, maxLimit); if (heightText.length == 0) return false; | heightText = ValidateNumberString(heightText, 1, maxLimit); if (heightText.length == 0) return false; | function ValidateData(){ rows = ValidateNumberString(dialog.rowsInput.value, 1, maxRows); if (rows == "") { // Set focus to the offending control dialog.rowsInput.focus(); return false; } columns = ValidateNumberString(dialog.columnsInput.value, 1, maxColumns); if (columns == "") { // Set focus to the offending control dialog.columnsInput.focus(); return false; } // Set attributes: NOTE: These may be empty strings borderText = TrimString(dialog.borderInput.value); if (borderText) { // Set the other attributes on the table if (ValidateNumberString(borderText, 0, maxPixels)) globalElement.setAttribute("border", borderText); } var maxLimit; var isPercent = (dialog.widthPixelOrPercentMenulist.selectedIndex == 1); widthText = TrimString(dialog.widthInput.value); if (widthText.length > 0) { if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } widthText = ValidateNumberString(dialog.widthInput.value, 1, maxLimit); if (widthText.length == 0) return false; if (isPercent) widthText += "%"; globalElement.setAttribute("width", widthText); } isPercent = (dialog.heightPixelOrPercentMenulist.selectedIndex == 1); heightText = TrimString(dialog.widthInput.value); if (heightText.length > 0) { if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } heightText = ValidateNumberString(dialog.heightInput.value, 1, maxLimit); if (heightText.length == 0) return false; if (isPercent) heightText += "%"; globalElement.setAttribute("height", heightText); } return true;} |
if (ListType == "ul") | if (gListType == "ul") | function ValidateData(){ var type = 0; // globalElement should already be of the correct type if (globalElement) { if (ListType == "ul") { switch (gDialog.BulletStyleList.selectedIndex) { // Index 0 = automatic, the default, so we don't set it explicitly case 1: type = "disc"; break; case 2: type = "circle"; break; case 3: type = "square"; break; } BulletStyleType = type; ChangeListType(type, gDialog.ChangeAllRadio.selected); } else if (ListType == "ol") { switch (gDialog.BulletStyleList.selectedIndex) { // Index 0 = automatic, the default, so we don't set it explicitly case 1: type = "1"; break; case 2: type = "I"; break; case 3: type = "i"; break; case 4: type = "A"; break; case 5: type = "a"; break; } BulletStyleType = type; ChangeListType(type, gDialog.ChangeAllRadio.selected); var startingNumber = TrimString(gDialog.StartingNumberInput.value); if (startingNumber) globalElement.setAttribute("start",startingNumber); else globalElement.removeAttribute("start"); } } return true;} |
BulletStyleType = type; ChangeListType(type, gDialog.ChangeAllRadio.selected); | gBulletStyleType = type; if (type && gDialog.ChangeAllRadio.selected) globalElement.setAttribute("type",type); else globalElement.removeAttribute("type"); | function ValidateData(){ var type = 0; // globalElement should already be of the correct type if (globalElement) { if (ListType == "ul") { switch (gDialog.BulletStyleList.selectedIndex) { // Index 0 = automatic, the default, so we don't set it explicitly case 1: type = "disc"; break; case 2: type = "circle"; break; case 3: type = "square"; break; } BulletStyleType = type; ChangeListType(type, gDialog.ChangeAllRadio.selected); } else if (ListType == "ol") { switch (gDialog.BulletStyleList.selectedIndex) { // Index 0 = automatic, the default, so we don't set it explicitly case 1: type = "1"; break; case 2: type = "I"; break; case 3: type = "i"; break; case 4: type = "A"; break; case 5: type = "a"; break; } BulletStyleType = type; ChangeListType(type, gDialog.ChangeAllRadio.selected); var startingNumber = TrimString(gDialog.StartingNumberInput.value); if (startingNumber) globalElement.setAttribute("start",startingNumber); else globalElement.removeAttribute("start"); } } return true;} |
else if (ListType == "ol") | else if (gListType == "ol") | function ValidateData(){ var type = 0; // globalElement should already be of the correct type if (globalElement) { if (ListType == "ul") { switch (gDialog.BulletStyleList.selectedIndex) { // Index 0 = automatic, the default, so we don't set it explicitly case 1: type = "disc"; break; case 2: type = "circle"; break; case 3: type = "square"; break; } BulletStyleType = type; ChangeListType(type, gDialog.ChangeAllRadio.selected); } else if (ListType == "ol") { switch (gDialog.BulletStyleList.selectedIndex) { // Index 0 = automatic, the default, so we don't set it explicitly case 1: type = "1"; break; case 2: type = "I"; break; case 3: type = "i"; break; case 4: type = "A"; break; case 5: type = "a"; break; } BulletStyleType = type; ChangeListType(type, gDialog.ChangeAllRadio.selected); var startingNumber = TrimString(gDialog.StartingNumberInput.value); if (startingNumber) globalElement.setAttribute("start",startingNumber); else globalElement.removeAttribute("start"); } } return true;} |
BulletStyleType = type; ChangeListType(type, gDialog.ChangeAllRadio.selected); var startingNumber = TrimString(gDialog.StartingNumberInput.value); | gBulletStyleType = type; if (type) globalElement.setAttribute("type", type); else globalElement.removeAttribute("type"); var startingNumber = ConvertUserStringToStartAttr(gDialog.BulletStyleList.selectedIndex); | function ValidateData(){ var type = 0; // globalElement should already be of the correct type if (globalElement) { if (ListType == "ul") { switch (gDialog.BulletStyleList.selectedIndex) { // Index 0 = automatic, the default, so we don't set it explicitly case 1: type = "disc"; break; case 2: type = "circle"; break; case 3: type = "square"; break; } BulletStyleType = type; ChangeListType(type, gDialog.ChangeAllRadio.selected); } else if (ListType == "ol") { switch (gDialog.BulletStyleList.selectedIndex) { // Index 0 = automatic, the default, so we don't set it explicitly case 1: type = "1"; break; case 2: type = "I"; break; case 3: type = "i"; break; case 4: type = "A"; break; case 5: type = "a"; break; } BulletStyleType = type; ChangeListType(type, gDialog.ChangeAllRadio.selected); var startingNumber = TrimString(gDialog.StartingNumberInput.value); if (startingNumber) globalElement.setAttribute("start",startingNumber); else globalElement.removeAttribute("start"); } } return true;} |
SetTextfieldFocus(dialog.linkTextInput); | SetTextboxFocus(dialog.linkTextInput); | function ValidateData(){ href = dialog.hrefInput.value.trimString(); if (href.length > 0) { // Set the HREF directly on the editor document's anchor node // or on the newly-created node if insertNew is true globalElement.setAttribute("href",href); } else if (insertNew) { // We must have a URL to insert a new link //NOTE: We accept an empty HREF on existing link to indicate removing the link ShowInputErrorMessage(GetString("EmptyHREFError")); return false; } if (dialog.linkTextInput) { // The text we will insert isn't really an attribute, // but it makes sense to validate it newLinkText = TrimString(dialog.linkTextInput.value); if (newLinkText.length == 0) { ShowInputErrorMessage(GetString("EmptyLinkTextError")); SetTextfieldFocus(dialog.linkTextInput); return false; } } return true;} |
align = "left"; | align = "right"; | function ValidateData(){ var imageTypeExtension = checkForImage(); if ( !imageTypeExtension ) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // TODO: Should we confirm with user if no alt tag? Or just set to empty string? var alt = dialog.altTextInput.value.trimString(); globalElement.setAttribute("alt", alt); //TODO: WE SHOULD ALWAYS SET WIDTH AND HEIGHT FOR FASTER IMAGE LAYOUT // IF USER DOESN'T SET IT, WE NEED TO GET VALUE FROM ORIGINAL IMAGE var width = ""; var height = ""; var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if ( SeeMore ) { dialog.isCustomSize = dialog.customsizeRadio.checked; isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); width = dialog.widthInput.value; height = dialog.heightInput.value; } else /* can't SeeMore */ { var tailindex; width = globalElement.getAttribute( "width" ); tailindex = width.lastIndexOf("%"); isPercentWidth = ( tailindex > 0 ); if ( isPercentWidth ) width = width.substring(0, tailindex); height = globalElement.getAttribute( "height" ); tailindex = height.lastIndexOf("%"); isPercentHeight = ( tailindex > 0 ); if ( isPercentHeight ) height = height.substring(0, tailindex); } if ( dialog.isCustomSize ) { maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js width = ValidateNumberString(width, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewer(); dialog.widthInput.focus(); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js height = ValidateNumberString(height, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewer(); dialog.heightInput.focus(); return false; } if (isPercentHeight) height = height + "%"; } if ( !dialog.isCustomSize ) { // for now (until we can get the actual image dimensions), clear the height/width attributes if not set globalElement.removeAttribute( "width" ); globalElement.removeAttribute( "height" ); } else { if (width.length > 0) globalElement.setAttribute("width", width); if (height.length > 0) globalElement.setAttribute("height", height); } // spacing attributes // All of these should use ValidateNumberString() to // ensure value is within acceptable range var amount; if ( SeeMore ) { if ( dialog.imagelrInput.value.length > 0 ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: align = "left"; break; case 4: align = "right"; break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); } return true;} |
align = "right"; | align = "left"; | function ValidateData(){ var imageTypeExtension = checkForImage(); if ( !imageTypeExtension ) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // TODO: Should we confirm with user if no alt tag? Or just set to empty string? var alt = dialog.altTextInput.value.trimString(); globalElement.setAttribute("alt", alt); //TODO: WE SHOULD ALWAYS SET WIDTH AND HEIGHT FOR FASTER IMAGE LAYOUT // IF USER DOESN'T SET IT, WE NEED TO GET VALUE FROM ORIGINAL IMAGE var width = ""; var height = ""; var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if ( SeeMore ) { dialog.isCustomSize = dialog.customsizeRadio.checked; isPercentWidth = (dialog.widthUnitsSelect.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsSelect.selectedIndex == 1); width = dialog.widthInput.value; height = dialog.heightInput.value; } else /* can't SeeMore */ { var tailindex; width = globalElement.getAttribute( "width" ); tailindex = width.lastIndexOf("%"); isPercentWidth = ( tailindex > 0 ); if ( isPercentWidth ) width = width.substring(0, tailindex); height = globalElement.getAttribute( "height" ); tailindex = height.lastIndexOf("%"); isPercentHeight = ( tailindex > 0 ); if ( isPercentHeight ) height = height.substring(0, tailindex); } if ( dialog.isCustomSize ) { maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js width = ValidateNumberString(width, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewer(); dialog.widthInput.focus(); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js height = ValidateNumberString(height, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewer(); dialog.heightInput.focus(); return false; } if (isPercentHeight) height = height + "%"; } if ( !dialog.isCustomSize ) { // for now (until we can get the actual image dimensions), clear the height/width attributes if not set globalElement.removeAttribute( "width" ); globalElement.removeAttribute( "height" ); } else { if (width.length > 0) globalElement.setAttribute("width", width); if (height.length > 0) globalElement.setAttribute("height", height); } // spacing attributes // All of these should use ValidateNumberString() to // ensure value is within acceptable range var amount; if ( SeeMore ) { if ( dialog.imagelrInput.value.length > 0 ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value.length > 0 ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value.length > 0 ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute var align = ""; switch ( dialog.alignTypeSelect.selectedIndex ) { case 0: align = "top"; break; case 1: align = "center"; break; case 3: align = "left"; break; case 4: align = "right"; break; } if (align == "") globalElement.removeAttribute( "align" ); else globalElement.setAttribute( "align", align ); } return true;} |
SetTextfieldFocus(nameInput); | SetTextboxFocus(nameInput); | function ValidateData(){ var name = TrimString(nameInput.value); if (!name) { ShowInputErrorMessage(GetString("MissingAnchorNameError")); SetTextfieldFocus(nameInput); return false; } else { // Replace spaces with "_" and strip other characters // Note: we could use ConvertAndEscape, but then we'd // have to UnConverAndEscape beforehand - too messy! name = ConvertToCDATAString(name); if (originalName != name && AnchorNameExists(name)) { ShowInputErrorMessage(GetString("DuplicateAnchorNameError").replace(/%name%/,name)); SetTextfieldFocus(nameInput); return false; } globalElement.setAttribute("name",name); } return true;} |
title = dialog.TitleInput.value.trimString(); | newTitle = dialog.TitleInput.value.trimString(); | function ValidateData(){ title = dialog.TitleInput.value.trimString(); author = dialog.AuthorInput.value.trimString(); description = dialog.DescriptionInput.value.trimString(); return true;} |
SetTextfieldFocus(dialog.altTextInput); | SetTextboxFocus(dialog.altTextInput); | function ValidateData(){ if ( !IsValidImage(dialog.srcInput.value )) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // Note: allow typing spaces, // Warn user if empty string just once per dialog session // but don't consider this a failure var alt = dialog.altTextInput.value; if (doAltTextError && !alt) { ShowInputErrorMessage(GetString("NoAltText")); SetTextfieldFocus(dialog.altTextInput); doAltTextError = false; return false; } globalElement.setAttribute("alt", alt); var width = ""; var height = ""; var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if (dialog.actualSizeRadio.checked) { width = actualWidth ? actualWidth : ""; height = actualHeight ? actualHeight : ""; } else { isPercentWidth = (dialog.widthUnitsMenulist.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsMenulist.selectedIndex == 1); maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextfieldFocus(dialog.widthInput); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextfieldFocus(dialog.heightInput); return false; } if (isPercentHeight) height = height + "%"; } // We always set the width and height attributes, even if same as actual. // This speeds up layout of pages since sizes are known before image is downloaded // (But don't set if we couldn't obtain actual dimensions) if (width) globalElement.setAttribute("width", width); else globalElement.removeAttribute("width"); if (height) globalElement.setAttribute("height", height); else globalElement.removeAttribute("height"); // spacing attributes var amount; if ( dialog.imagelrInput.value ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute // Note that the attributes "left" and "right" are opposite // of what we use in the UI, which describes where the TEXT wraps, // not the image location (which is what the HTML describes) switch ( dialog.alignTypeSelect.data ) { case "top": case "center": case "right": case "left": globalElement.setAttribute( "align", dialog.alignTypeSelect.data ); break; default: globalElement.removeAttribute( "align" ); } return true;} |
SetTextfieldFocus(dialog.widthInput); | SetTextboxFocus(dialog.widthInput); | function ValidateData(){ if ( !IsValidImage(dialog.srcInput.value )) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // Note: allow typing spaces, // Warn user if empty string just once per dialog session // but don't consider this a failure var alt = dialog.altTextInput.value; if (doAltTextError && !alt) { ShowInputErrorMessage(GetString("NoAltText")); SetTextfieldFocus(dialog.altTextInput); doAltTextError = false; return false; } globalElement.setAttribute("alt", alt); var width = ""; var height = ""; var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if (dialog.actualSizeRadio.checked) { width = actualWidth ? actualWidth : ""; height = actualHeight ? actualHeight : ""; } else { isPercentWidth = (dialog.widthUnitsMenulist.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsMenulist.selectedIndex == 1); maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextfieldFocus(dialog.widthInput); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextfieldFocus(dialog.heightInput); return false; } if (isPercentHeight) height = height + "%"; } // We always set the width and height attributes, even if same as actual. // This speeds up layout of pages since sizes are known before image is downloaded // (But don't set if we couldn't obtain actual dimensions) if (width) globalElement.setAttribute("width", width); else globalElement.removeAttribute("width"); if (height) globalElement.setAttribute("height", height); else globalElement.removeAttribute("height"); // spacing attributes var amount; if ( dialog.imagelrInput.value ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute // Note that the attributes "left" and "right" are opposite // of what we use in the UI, which describes where the TEXT wraps, // not the image location (which is what the HTML describes) switch ( dialog.alignTypeSelect.data ) { case "top": case "center": case "right": case "left": globalElement.setAttribute( "align", dialog.alignTypeSelect.data ); break; default: globalElement.removeAttribute( "align" ); } return true;} |
SetTextfieldFocus(dialog.heightInput); | SetTextboxFocus(dialog.heightInput); | function ValidateData(){ if ( !IsValidImage(dialog.srcInput.value )) { ShowInputErrorMessage(GetString("MissingImageError")); return false; } //TODO: WE NEED TO DO SOME URL VALIDATION HERE, E.G.: // We must convert to "file:///" or "http://" format else image doesn't load! var src = dialog.srcInput.value.trimString(); globalElement.setAttribute("src", src); // Note: allow typing spaces, // Warn user if empty string just once per dialog session // but don't consider this a failure var alt = dialog.altTextInput.value; if (doAltTextError && !alt) { ShowInputErrorMessage(GetString("NoAltText")); SetTextfieldFocus(dialog.altTextInput); doAltTextError = false; return false; } globalElement.setAttribute("alt", alt); var width = ""; var height = ""; var isPercentWidth, isPercentHeight; var maxLimitWidth, maxLimitHeight; if (dialog.actualSizeRadio.checked) { width = actualWidth ? actualWidth : ""; height = actualHeight ? actualHeight : ""; } else { isPercentWidth = (dialog.widthUnitsMenulist.selectedIndex == 1); isPercentHeight = (dialog.heightUnitsMenulist.selectedIndex == 1); maxLimitWidth = isPercentWidth ? 100 : maxPixels; // Defined in EdDialogCommon.js width = ValidateNumberString(dialog.widthInput.value, 1, maxLimitWidth); if (width == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextfieldFocus(dialog.widthInput); return false; } if (isPercentWidth) width = width + "%"; maxLimitHeight = isPercentHeight ? 100 : maxPixels; // Defined in EdDialogCommon.js height = ValidateNumberString(dialog.heightInput.value, 1, maxLimitHeight); if (height == "") { if ( !SeeMore ) onMoreFewerImage(); SetTextfieldFocus(dialog.heightInput); return false; } if (isPercentHeight) height = height + "%"; } // We always set the width and height attributes, even if same as actual. // This speeds up layout of pages since sizes are known before image is downloaded // (But don't set if we couldn't obtain actual dimensions) if (width) globalElement.setAttribute("width", width); else globalElement.removeAttribute("width"); if (height) globalElement.setAttribute("height", height); else globalElement.removeAttribute("height"); // spacing attributes var amount; if ( dialog.imagelrInput.value ) { amount = ValidateNumberString(dialog.imagelrInput.value, 0, maxPixels); if (amount == "") return false; globalElement.setAttribute( "hspace", amount ); } else globalElement.removeAttribute( "hspace" ); if ( dialog.imagetbInput.value ) { var vspace = ValidateNumberString(dialog.imagetbInput.value, 0, maxPixels); if (vspace == "") return false; globalElement.setAttribute( "vspace", vspace ); } else globalElement.removeAttribute( "vspace" ); // note this is deprecated and should be converted to stylesheets if ( dialog.border.value ) { var border = ValidateNumberString(dialog.border.value, 0, maxPixels); if (border == "") return false; globalElement.setAttribute( "border", border ); } else globalElement.removeAttribute( "border" ); // Default or setting "bottom" means don't set the attribute // Note that the attributes "left" and "right" are opposite // of what we use in the UI, which describes where the TEXT wraps, // not the image location (which is what the HTML describes) switch ( dialog.alignTypeSelect.data ) { case "top": case "center": case "right": case "left": globalElement.setAttribute( "align", dialog.alignTypeSelect.data ); break; default: globalElement.removeAttribute( "align" ); } return true;} |
height = ValidateNumberString(dialog.heightInput.value, 1, maxPixels); if (height) { globalElement.setAttribute("size", height); } else globalElement.removeAttribute("size"); | height = ValidateNumber(dialog.heightInput, null, 1, maxPixels, globalElement, "size", false); if (gValidationError) return false; | function ValidateData(){ // Height is always pixels height = ValidateNumberString(dialog.heightInput.value, 1, maxPixels); if (height) { globalElement.setAttribute("size", height); } else globalElement.removeAttribute("size"); var isPercent = (dialog.pixelOrPercentMenulist.selectedIndex == 1); var maxLimit; if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } width = ValidateNumberString(dialog.widthInput.value, 1, maxLimit); if (width) { if (isPercent) width = width + "%"; globalElement.setAttribute("width", width); } else globalElement.removeAttribute("width"); align = "left"; if (dialog.centerAlign.checked) { align = "center"; } else if (dialog.rightAlign.checked) { align = "right"; } globalElement.setAttribute("align", align); if (dialog.shading.checked) { shading = true; globalElement.removeAttribute("noshade"); } else { shading = false; globalElement.setAttribute("noshade", ""); } return true;} |
var isPercent = (dialog.pixelOrPercentMenulist.selectedIndex == 1); var maxLimit; if (isPercent) { maxLimit = 100; } else { maxLimit = maxPixels; } width = ValidateNumberString(dialog.widthInput.value, 1, maxLimit); if (width) { if (isPercent) width = width + "%"; globalElement.setAttribute("width", width); } else globalElement.removeAttribute("width"); | width = ValidateNumber(dialog.widthInput, dialog.pixelOrPercentMenulist, 1, maxPixels, globalElement, "width", false); if (gValidationError) return false; | function ValidateData(){ // Height is always pixels height = ValidateNumberString(dialog.heightInput.value, 1, maxPixels); if (height) { globalElement.setAttribute("size", height); } else globalElement.removeAttribute("size"); var isPercent = (dialog.pixelOrPercentMenulist.selectedIndex == 1); var maxLimit; if (isPercent) { maxLimit = 100; } else { // Upper limit when using pixels maxLimit = maxPixels; } width = ValidateNumberString(dialog.widthInput.value, 1, maxLimit); if (width) { if (isPercent) width = width + "%"; globalElement.setAttribute("width", width); } else globalElement.removeAttribute("width"); align = "left"; if (dialog.centerAlign.checked) { align = "center"; } else if (dialog.rightAlign.checked) { align = "right"; } globalElement.setAttribute("align", align); if (dialog.shading.checked) { shading = true; globalElement.removeAttribute("noshade"); } else { shading = false; globalElement.setAttribute("noshade", ""); } return true;} |
SetTextfieldFocus(dialog.ColorInput); | SetTextboxFocus(dialog.ColorInput); | function ValidateData(){ if (LastPickedIsDefault) color = LastPickedColor; else color = dialog.ColorInput.value; color = color.trimString().toLowerCase(); // TODO: Validate the color string! if (NoDefault && !color) { ShowInputErrorMessage(GetString("NoColorError")); SetTextfieldFocus(dialog.ColorInput); return false; } return true;} |
name = PrepareStringForURL(name); | name = ConvertToCDATAString(name); | function ValidateData(){ var name = TrimString(nameInput.value); if (!name) { ShowInputErrorMessage(GetString("MissingAnchorNameError")); SetTextfieldFocus(nameInput); return false; } else { // Replace spaces with "_" and strip other characters // Note: we could use ConvertAndEscape, but then we'd // have to UnConverAndEscape beforehand - too messy! name = PrepareStringForURL(name); if (originalName != name && AnchorNameExists(name)) { ShowInputErrorMessage(GetString("DuplicateAnchorNameError").replace(/%name%/,name)); SetTextfieldFocus(nameInput); return false; } globalElement.setAttribute("name",name); } return true;} |
SetTextfieldFocus(inputWidget); | SetTextboxFocus(inputWidget); | function ValidateNumber(inputWidgetID, listWidget, minVal, maxVal, element, attName){ var inputWidget = document.getElementById(inputWidgetID); // Global error return value error = false; var maxLimit = maxVal; var isPercent = false; var numString = inputWidget.value.trimString(); if (numString) { if (listWidget) isPercent = (listWidget.selectedIndex == 1); if (isPercent) maxLimit = 100; numString = ValidateNumberString(numString, minVal, maxLimit); if(!numString) { dump("Error returned from ValidateNumberString\n"); // Switch to appropriate panel for error reporting SwitchPanel(validatePanel); // Error - shift to offending input widget SetTextfieldFocus(inputWidget); error = true; } else { if (isPercent) numString += "%"; if (element) element.setAttribute(attName, numString); } } else if (element) { element.removeAttribute(attName); } return numString;} |
if (selectedItem && selectedItem.getAttribute("label") != siteName) | if (selectedItem && selectedItem.getAttribute("value") != siteName) | function ValidateSettings(){ var siteName = TrimString(gDialog.SiteNameInput.value); if (!siteName) { ShowErrorInPanel(gSettingsPanel, "MissingSiteNameError", gDialog.SiteNameInput); return false; } if (PublishSiteNameExists(siteName, gPublishSiteData, gDialog.SiteList.selectedIndex)) { SwitchPanel(gSettingsPanel); ShowInputErrorMessage(GetString("DuplicateSiteNameError").replace(/%name%/, siteName)); SetTextboxFocus(gDialog.SiteNameInput); return false; } // Extract username and password while removing them from publishingUrl var urlUserObj = {}; var urlPassObj = {}; var publishUrl = StripUsernamePassword(gDialog.PublishUrlInput.value, urlUserObj, urlPassObj); if (publishUrl) { publishUrl = FormatUrlForPublishing(publishUrl); gDialog.PublishUrlInput.value = publishUrl; } else { ShowErrorInPanel(gSettingsPanel, "MissingPublishUrlError", gDialog.PublishUrlInput); return false; } //TODO: If publish scheme = "ftp" we should encourage user to supply the http BrowseUrl var browseUrl = GetBrowseUrlInput(); var username = TrimString(gDialog.UsernameInput.value); var savePassword = gDialog.SavePassword.checked; var password = gDialog.PasswordInput.value; //XXX If there was a username and/or password in the publishUrl // AND in the input field, which do we use? // Let's use those in url only if input is empty if (!username) { username = urlUserObj.value; gDialog.UsernameInput.value = username; gSettingsChanged = true; } if (!password) { password = urlPassObj.value; gDialog.PasswordInput.value = password; gSettingsChanged = true; } // Update or add data for a site var siteIndex = gDialog.SiteList.selectedIndex; var newSite = false; if (siteIndex == -1) { // No site is selected, add a new site at the end if (gPublishSiteData) { siteIndex = gPublishSiteData.length; } else { gPublishSiteData = new Array(1); siteIndex = 0; gDefaultSiteIndex = 0; gDefaultSiteName = siteName; } gPublishSiteData[siteIndex] = {}; gPublishSiteData[siteIndex].docDir = ""; gPublishSiteData[siteIndex].otherDir = ""; gPublishSiteData[siteIndex].dirList = [""]; newSite = true; } gPublishSiteData[siteIndex].siteName = siteName; gPublishSiteData[siteIndex].publishUrl = publishUrl; gPublishSiteData[siteIndex].browseUrl = browseUrl; gPublishSiteData[siteIndex].username = username; // Don't save password in data that will be saved in prefs gPublishSiteData[siteIndex].password = savePassword ? password : ""; gPublishSiteData[siteIndex].savePassword = savePassword; gDialog.SiteList.selectedIndex = siteIndex; if (siteIndex == gDefaultSiteIndex) gDefaultSiteName = siteName; // Should never be empty, but be sure we have a default site if (!gDefaultSiteName) { gDefaultSiteName = gPublishSiteData[0].siteName; gDefaultSiteIndex = 0; } // Rebuild the site menulist if we added a new site if (newSite) { FillSiteList(); gDialog.SiteList.selectedIndex = siteIndex; } else { // Update selected item if sitename changed var selectedItem = gDialog.SiteList.selectedItem; if (selectedItem && selectedItem.getAttribute("label") != siteName) { selectedItem.setAttribute("label", siteName); gDialog.SiteList.setAttribute("label", siteName); } } // Get the directory name in site to publish to var docDir = GetDocDirInput(); // Because of the autoselect behavior in editable menulists, // selectedIndex = -1 means value in input field is not already in the list, // so add it to the list of site directories if (gDialog.DocDirList.selectedIndex == -1) AppendDirToSelectedSite(docDir); gPublishSiteData[siteIndex].docDir = docDir; // And directory for images and other files var otherDir = GetOtherDirInput(); if (gDialog.SameLocationRadio.selected) otherDir = docDir; else otherDir = GetOtherDirInput(); if (gDialog.OtherDirList.selectedIndex == -1) AppendDirToSelectedSite(otherDir); gPublishSiteData[siteIndex].otherDir = otherDir; // Fill return data object gReturnData.siteName = siteName; gReturnData.publishUrl = publishUrl; gReturnData.browseUrl = browseUrl; gReturnData.username = username; // Note that we use the password for the next publish action // even if savePassword is false; but we won't save it in PasswordManager database gReturnData.password = password; gReturnData.savePassword = savePassword; gReturnData.docDir = gPublishSiteData[siteIndex].docDir; // If "Other dir" is not checked, return empty string to indicate "don't save associated files" gReturnData.otherDir = gDialog.OtherDirCheckbox.checked ? gPublishSiteData[siteIndex].otherDir : ""; gReturnData.dirList = gPublishSiteData[siteIndex].dirList; return true;} |
selectedItem.setAttribute("value", siteName); | function ValidateSettings(){ var siteName = TrimString(gDialog.SiteNameInput.value); if (!siteName) { ShowErrorInPanel(gSettingsPanel, "MissingSiteNameError", gDialog.SiteNameInput); return false; } if (PublishSiteNameExists(siteName, gPublishSiteData, gDialog.SiteList.selectedIndex)) { SwitchPanel(gSettingsPanel); ShowInputErrorMessage(GetString("DuplicateSiteNameError").replace(/%name%/, siteName)); SetTextboxFocus(gDialog.SiteNameInput); return false; } // Extract username and password while removing them from publishingUrl var urlUserObj = {}; var urlPassObj = {}; var publishUrl = StripUsernamePassword(gDialog.PublishUrlInput.value, urlUserObj, urlPassObj); if (publishUrl) { publishUrl = FormatUrlForPublishing(publishUrl); gDialog.PublishUrlInput.value = publishUrl; } else { ShowErrorInPanel(gSettingsPanel, "MissingPublishUrlError", gDialog.PublishUrlInput); return false; } //TODO: If publish scheme = "ftp" we should encourage user to supply the http BrowseUrl var browseUrl = GetBrowseUrlInput(); var username = TrimString(gDialog.UsernameInput.value); var savePassword = gDialog.SavePassword.checked; var password = gDialog.PasswordInput.value; //XXX If there was a username and/or password in the publishUrl // AND in the input field, which do we use? // Let's use those in url only if input is empty if (!username) { username = urlUserObj.value; gDialog.UsernameInput.value = username; gSettingsChanged = true; } if (!password) { password = urlPassObj.value; gDialog.PasswordInput.value = password; gSettingsChanged = true; } // Update or add data for a site var siteIndex = gDialog.SiteList.selectedIndex; var newSite = false; if (siteIndex == -1) { // No site is selected, add a new site at the end if (gPublishSiteData) { siteIndex = gPublishSiteData.length; } else { gPublishSiteData = new Array(1); siteIndex = 0; gDefaultSiteIndex = 0; gDefaultSiteName = siteName; } gPublishSiteData[siteIndex] = {}; gPublishSiteData[siteIndex].docDir = ""; gPublishSiteData[siteIndex].otherDir = ""; gPublishSiteData[siteIndex].dirList = [""]; newSite = true; } gPublishSiteData[siteIndex].siteName = siteName; gPublishSiteData[siteIndex].publishUrl = publishUrl; gPublishSiteData[siteIndex].browseUrl = browseUrl; gPublishSiteData[siteIndex].username = username; // Don't save password in data that will be saved in prefs gPublishSiteData[siteIndex].password = savePassword ? password : ""; gPublishSiteData[siteIndex].savePassword = savePassword; gDialog.SiteList.selectedIndex = siteIndex; if (siteIndex == gDefaultSiteIndex) gDefaultSiteName = siteName; // Should never be empty, but be sure we have a default site if (!gDefaultSiteName) { gDefaultSiteName = gPublishSiteData[0].siteName; gDefaultSiteIndex = 0; } // Rebuild the site menulist if we added a new site if (newSite) { FillSiteList(); gDialog.SiteList.selectedIndex = siteIndex; } else { // Update selected item if sitename changed var selectedItem = gDialog.SiteList.selectedItem; if (selectedItem && selectedItem.getAttribute("label") != siteName) { selectedItem.setAttribute("label", siteName); gDialog.SiteList.setAttribute("label", siteName); } } // Get the directory name in site to publish to var docDir = GetDocDirInput(); // Because of the autoselect behavior in editable menulists, // selectedIndex = -1 means value in input field is not already in the list, // so add it to the list of site directories if (gDialog.DocDirList.selectedIndex == -1) AppendDirToSelectedSite(docDir); gPublishSiteData[siteIndex].docDir = docDir; // And directory for images and other files var otherDir = GetOtherDirInput(); if (gDialog.SameLocationRadio.selected) otherDir = docDir; else otherDir = GetOtherDirInput(); if (gDialog.OtherDirList.selectedIndex == -1) AppendDirToSelectedSite(otherDir); gPublishSiteData[siteIndex].otherDir = otherDir; // Fill return data object gReturnData.siteName = siteName; gReturnData.publishUrl = publishUrl; gReturnData.browseUrl = browseUrl; gReturnData.username = username; // Note that we use the password for the next publish action // even if savePassword is false; but we won't save it in PasswordManager database gReturnData.password = password; gReturnData.savePassword = savePassword; gReturnData.docDir = gPublishSiteData[siteIndex].docDir; // If "Other dir" is not checked, return empty string to indicate "don't save associated files" gReturnData.otherDir = gDialog.OtherDirCheckbox.checked ? gPublishSiteData[siteIndex].otherDir : ""; gReturnData.dirList = gPublishSiteData[siteIndex].dirList; return true;} |
|
ValidatorUpdateDisplay (v, false); | ValidatorUpdateDisplay (v, true); | function ValidatorSucceeded (v){ v.innerHTML = ""; ValidatorUpdateDisplay (v, false);} |
return stringSortFunction(x.valueCol, y.valueCol); | if (x.valueCol > y.valueCol) return gSortDirection; if (x.valueCol < y.valueCol) return -gSortDirection; return prefColSortFunction(x, y); | function valueColSortFunction(x,y){ return stringSortFunction(x.valueCol, y.valueCol);} |
if (openWizard || prefillAccount || (zeroIdCount && wizardcallback)) { | if (openWizard || prefillAccount || ((!gAnyValidIdentity) && wizardcallback)) { | function verifyAccounts(wizardcallback) {//check to see if the function is called with the callback and if so set the global variable returnmycall to true if(wizardcallback) returnmycall = true; var openWizard = false; var prefillAccount; var state=true; var ret = true; try { var am = Components.classes[accountManagerContractID].getService(Components.interfaces.nsIMsgAccountManager); var accounts = am.accounts; // as long as we have some accounts, we're fine. var accountCount = accounts.Count(); var invalidAccounts = getInvalidAccounts(accounts); if (invalidAccounts.length > 0) { prefillAccount = invalidAccounts[0]; } else { } // if there are no accounts, or all accounts are "invalid" // then kick off the account migration if (accountCount == invalidAccounts.length) { try { var messengerMigrator = Components.classes[messengerMigratorContractID].getService(Components.interfaces.nsIMessengerMigrator); messengerMigrator.UpgradePrefs(); // if there is a callback mechanism then inform parent window to shut itself down if (wizardcallback){ state = false; WizCallback(state); } ret = false; } catch (ex) { // upgrade prefs failed, so open account wizard openWizard = true; } } //We are doing openWizard if MessengerMigration returns some kind of error //(including those cases where there is nothing to migrate). //prefillAccount is valid, if there is an invalid account already //zeroIdCount is true when there is only one account and it has no identities //usually that happens only when it is a local folder account //wizardcallback is true only when verifyaccounts is called from compose window. //the last condition in the if is so that we call account wizard only when the user //has only a local folder and tries to compose mail. if (openWizard || prefillAccount || (zeroIdCount && wizardcallback)) { MsgAccountWizard(prefillAccount); ret = false; } // hack, set a time out to do this, so that the window can load first setTimeout("showMailIntegrationDialog();",0); return ret; } catch (ex) { dump("error verifying accounts " + ex + "\n"); return false; }} |
var am = Components.classes[accountManagerProgID].getService(Components.interfaces.nsIMsgAccountManager); | var am = Components.classes[accountManagerContractID].getService(Components.interfaces.nsIMsgAccountManager); | function verifyAccounts() { var openWizard = false; var prefillAccount; try { var am = Components.classes[accountManagerProgID].getService(Components.interfaces.nsIMsgAccountManager); var accounts = am.accounts; // as long as we have some accounts, we're fine. var accountCount = accounts.Count(); var invalidAccounts = getInvalidAccounts(accounts); if (invalidAccounts.length > 0) { prefillAccount = invalidAccounts[0]; dump("prefillAccount = " + prefillAccount + "\n"); } else { } // if there are no accounts, or all accounts are "invalid" // then kick off the account migration if (accountCount == invalidAccounts.length) { try { messengerMigrator = Components.classes[messengerMigratorProgID].getService(Components.interfaces.nsIMessengerMigrator); dump("attempt to UpgradePrefs. If that fails, open the account wizard.\n"); messengerMigrator.UpgradePrefs(); } catch (ex) { // upgrade prefs failed, so open account wizard openWizard = true; } } if (openWizard || prefillAccount) { MsgAccountWizard(prefillAccount); } } catch (ex) { dump("error verifying accounts " + ex + "\n"); return; }} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.