rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
15
136k
|| ex.type.indexOf("org.directwebremoting.auth.") != 0
|| ex.type.indexOf(DWRAuthentication._exceptionPackage) != 0
DWRAuthentication.authWarningHandler = function(batch, ex) { if( batch == null || typeof ex != "object" || ex.type == null || ex.type.indexOf("org.directwebremoting.auth.") != 0 ) { DWRAuthentication._dwrHandleBatchExeption(batch, ex); return; } DWRAuthentication._batch = DWRAuthentication._cloneBatch(batch); var errorType = ex.type.substring(27); //alert("errorCode="+errorType); switch( errorType ) { case "InvalidSessionException": if( DWRAuthentication._invalidSessionHandler(batch,ex) ) { DWRAuthentication._replayBatch(); } break; case "AuthenticationRequiredException": if( DWRAuthentication._authRequiredHandler(batch,ex) ) { DWRAuthentication._replayBatch(); } break; case "AccessDeniedException": if( DWRAuthentication._accessDeniedHandler(batch,ex) ) { DWRAuthentication._replayBatch(); } break; default: alert("Received unknown error code: '"+errorCode+"';"+errorCode.length); }}
DWRAuthentication._batch = DWRAuthentication._cloneBatch(batch); var errorType = ex.type.substring(27);
var errorType = ex.type.substring(DWRAuthentication._exceptionPackage.length);
DWRAuthentication.authWarningHandler = function(batch, ex) { if( batch == null || typeof ex != "object" || ex.type == null || ex.type.indexOf("org.directwebremoting.auth.") != 0 ) { DWRAuthentication._dwrHandleBatchExeption(batch, ex); return; } DWRAuthentication._batch = DWRAuthentication._cloneBatch(batch); var errorType = ex.type.substring(27); //alert("errorCode="+errorType); switch( errorType ) { case "InvalidSessionException": if( DWRAuthentication._invalidSessionHandler(batch,ex) ) { DWRAuthentication._replayBatch(); } break; case "AuthenticationRequiredException": if( DWRAuthentication._authRequiredHandler(batch,ex) ) { DWRAuthentication._replayBatch(); } break; case "AccessDeniedException": if( DWRAuthentication._accessDeniedHandler(batch,ex) ) { DWRAuthentication._replayBatch(); } break; default: alert("Received unknown error code: '"+errorCode+"';"+errorCode.length); }}
case "InvalidSessionException": if( DWRAuthentication._invalidSessionHandler(batch,ex) ) { DWRAuthentication._replayBatch(); } break; case "AuthenticationRequiredException":
case "LoginRequiredException": DWRAuthentication._batch = DWRAuthentication._cloneBatch(batch);
DWRAuthentication.authWarningHandler = function(batch, ex) { if( batch == null || typeof ex != "object" || ex.type == null || ex.type.indexOf("org.directwebremoting.auth.") != 0 ) { DWRAuthentication._dwrHandleBatchExeption(batch, ex); return; } DWRAuthentication._batch = DWRAuthentication._cloneBatch(batch); var errorType = ex.type.substring(27); //alert("errorCode="+errorType); switch( errorType ) { case "InvalidSessionException": if( DWRAuthentication._invalidSessionHandler(batch,ex) ) { DWRAuthentication._replayBatch(); } break; case "AuthenticationRequiredException": if( DWRAuthentication._authRequiredHandler(batch,ex) ) { DWRAuthentication._replayBatch(); } break; case "AccessDeniedException": if( DWRAuthentication._accessDeniedHandler(batch,ex) ) { DWRAuthentication._replayBatch(); } break; default: alert("Received unknown error code: '"+errorCode+"';"+errorCode.length); }}
alert("Received unknown error code: '"+errorCode+"';"+errorCode.length);
DWRAuthentication._dwrHandleBatchExeption(batch, ex);
DWRAuthentication.authWarningHandler = function(batch, ex) { if( batch == null || typeof ex != "object" || ex.type == null || ex.type.indexOf("org.directwebremoting.auth.") != 0 ) { DWRAuthentication._dwrHandleBatchExeption(batch, ex); return; } DWRAuthentication._batch = DWRAuthentication._cloneBatch(batch); var errorType = ex.type.substring(27); //alert("errorCode="+errorType); switch( errorType ) { case "InvalidSessionException": if( DWRAuthentication._invalidSessionHandler(batch,ex) ) { DWRAuthentication._replayBatch(); } break; case "AuthenticationRequiredException": if( DWRAuthentication._authRequiredHandler(batch,ex) ) { DWRAuthentication._replayBatch(); } break; case "AccessDeniedException": if( DWRAuthentication._accessDeniedHandler(batch,ex) ) { DWRAuthentication._replayBatch(); } break; default: alert("Received unknown error code: '"+errorCode+"';"+errorCode.length); }}
var ac = Components.classes['component:
var ac = Components.classes['@mozilla.org/messenger/autocomplete;1?type=addrbook'];
function AutoCompleteAddress(inputElement){ ///////////// (select_doc_id, doc_id) dump("inputElement = " + inputElement + "\n"); //Do we really have to autocomplete? if (inputElement.lastValue && inputElement.lastValue == inputElement.value) return; var row = awGetRowByInputElement(inputElement); var select = awGetPopupElement(row); dump("select = " + select + "\n"); dump("select.value = " + select.value + "\n"); if (select.value == "") return; if (select.value == "addr_newsgroups") { dump("don't autocomplete, it's a newsgroup"); return; } var ac = Components.classes['component://netscape/messenger/autocomplete&type=addrbook']; if (ac) { ac = ac.getService(); } if (ac) { ac = ac.QueryInterface(Components.interfaces.nsIAbAutoCompleteSession); } if (!identityElement) identityElement = document.getElementById("msgIdentity"); var identity=null; if (identityElement) { idKey = identityElement.value; identity = accountManager.getIdentity(idKey); } ac.autoComplete(identity, inputElement, inputElement.value, AddressAutoCompleteListener);}
ac.autoComplete(inputElement, inputElement.value, AddressAutoCompleteListener);
if (!identityElement) identityElement = document.getElementById("msgIdentity"); var identity=null; if (identityElement) { idKey = identityElement.value; identity = accountManager.getIdentity(idKey); } ac.autoComplete(identity, inputElement, inputElement.value, AddressAutoCompleteListener);
function AutoCompleteAddress(inputElement){ ///////////// (select_doc_id, doc_id) dump("inputElement = " + inputElement + "\n"); var row = awGetRowByInputElement(inputElement); var select = awGetPopupElement(row); dump("select = " + select + "\n"); dump("select.value = " + select.value + "\n"); if (select.value == "") return; if (select.value == "addr_newsgroups") { dump("don't autocomplete, it's a newsgroup"); return; } var ac = Components.classes['component://netscape/messenger/autocomplete&type=addrbook']; if (ac) { ac = ac.getService(); } if (ac) { ac = ac.QueryInterface(Components.interfaces.nsIAutoCompleteSession); } ac.autoComplete(inputElement, inputElement.value, AddressAutoCompleteListener);}
if (inputElement.lastValue && inputElement.lastValue == inputElement.value) return;
function AutoCompleteAddress(inputElement){ ///////////// (select_doc_id, doc_id) dump("inputElement = " + inputElement + "\n"); var row = awGetRowByInputElement(inputElement); var select = awGetPopupElement(row); dump("select = " + select + "\n"); dump("select.value = " + select.value + "\n"); if (select.value == "") return; if (select.value == "addr_newsgroups") { dump("don't autocomplete, it's a newsgroup"); return; } var ac = Components.classes['component://netscape/messenger/autocomplete&type=addrbook']; if (ac) { ac = ac.getService(); } if (ac) { ac = ac.QueryInterface(Components.interfaces.nsIAutoCompleteSession); } if (!identityElement) identityElement = document.getElementById("msgIdentity"); var identity=null; if (identityElement) { idKey = identityElement.value; identity = accountManager.getIdentity(idKey); } ac.autoComplete(identity, inputElement, inputElement.value, AddressAutoCompleteListener);}
li.onclick = function() { location.href = dest; }
li.onclick = function() { me.useSuggestion(); }
function AutoSuggest(form,elem,uri,autosubmit) { //The 'me' variable allow you to access the AutoSuggest object //from the elem's event handlers defined below. var me = this; //A reference to the element we're binding the list to. this.elem = elem; this.form = form; this.uri = uri; this.autosubmit = autosubmit; //Arrow to store a subset of eligible suggestions that match the user's input this.eligible = new Array(); //The text input by the user. this.inputText = null; //A pointer to the index of the highlighted eligible item. -1 means nothing highlighted. this.highlighted = -1; //A div to use to create the dropdown. this.div = document.getElementById("autosuggest"); //Do you want to remember what keycode means what? Me neither. var ENT = 3; var RET = 13; var TAB = 9; var ESC = 27; var KEYUP = 38; var KEYDN = 40; //The browsers' own autocomplete feature can be problematic, since it will //be making suggestions from the users' past input. //Setting this attribute should turn it off. elem.setAttribute("autocomplete","off"); //We need to be able to reference the elem by id. If it doesn't have an id, set one. if(!elem.id) { var id = "autosuggest" + idCounter; idCounter++; elem.id = id; } /******************************************************** onkeydown event handler for the input elem. Tab key = use the highlighted suggestion, if there is one. Esc key = get rid of the autosuggest dropdown Up/down arrows = Move the highlight up and down in the suggestions. ********************************************************/ elem.onkeydown = function(ev) { var key = me.getKeyCode(ev); switch(key) { case ENT: case RET: me.useSuggestion(); break; case TAB: me.useSuggestion(); break; case ESC: me.hideDiv(); break; case KEYUP: if (me.highlighted > 0) { me.highlighted--; } me.changeHighlight(key); break; case KEYDN: if (me.highlighted < (me.eligible.length - 1)) { me.highlighted++; } me.changeHighlight(key); break; } }; /******************************************************** onkeyup handler for the elem If the text is of sufficient length, and has been changed, then display a list of eligible suggestions. ********************************************************/ elem.onkeyup = function(ev) { var key = me.getKeyCode(ev); switch(key) { //The control keys were already handled by onkeydown, so do nothing. case ENT: case RET: case TAB: case ESC: case KEYUP: case KEYDN: return; default: if (this.value != me.inputText && this.value.length > 0) { me.HTTPpreload(); } else { me.hideDiv(); } } }; this.HTTPloaded = function () { if ((xmlhttp)&&(xmlhttp.readyState == 4)) { me.inputText = this.value; me.getEligible(); if (me.eligible.length>0) { me.createDiv(); me.positionDiv(); me.showDiv(); } else { me.hideDiv(); } } } /******************************************************** Insert the highlighted suggestion into the input box, and remove the suggestion dropdown. ********************************************************/ 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. if (this.autosubmit == 1) location.href = gotothisuri; } }; /******************************************************** Display the dropdown. Pretty straightforward. ********************************************************/ this.showDiv = function() { this.div.style.display = 'block'; }; /******************************************************** Hide the dropdown and clear any highlight. ********************************************************/ this.hideDiv = function() { this.div.style.display = 'none'; this.highlighted = -1; }; /******************************************************** Modify the HTML in the dropdown to move the highlight. ********************************************************/ this.changeHighlight = function() { var lis = this.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if (this.highlighted == i) { li.className = "selected"; } else { li.className = ""; } } }; /******************************************************** Position the dropdown div below the input text field. ********************************************************/ this.positionDiv = function() { var el = this.elem; var x = 0; var y = el.offsetHeight; //Walk up the DOM and add up all of the offset positions. while (el.offsetParent && el.tagName.toUpperCase() != 'BODY') { x += el.offsetLeft; y += el.offsetTop; el = el.offsetParent; } x += el.offsetLeft; y += el.offsetTop; this.div.style.left = x + 'px'; this.div.style.top = y + 'px'; }; /******************************************************** Build the HTML for the dropdown div ********************************************************/ this.createDiv = function() { var ul = document.createElement('ul'); //Create an array of LI's for the words. for (i in this.eligible) { var word = this.eligible[i]; var desc = (this.descriptions[i])?this.descriptions[i]:''; var dest = (this.actions[i])?this.actions[i]:''; var ds = document.createElement('span'); var li = document.createElement('li'); var a = document.createElement('a'); if ((dest)&&(this.autosubmit)) { a.href = dest; a.innerHTML = word; li.onclick = function() { location.href = dest; } li.appendChild(a); } else { li.innerHTML = word; li.onclick = function() { me.useSuggestion(); } } ds.innerHTML = desc; li.appendChild(ds); if (me.highlighted == i) { li.className = "selected"; } ul.appendChild(li); } this.div.replaceChild(ul,this.div.childNodes[0]); /******************************************************** mouseover handler for the dropdown ul move the highlighted suggestion with the mouse ********************************************************/ ul.onmouseover = function(ev) { //Walk up from target until you find the LI. var target = me.getEventSource(ev); while (target.parentNode && target.tagName.toUpperCase() != 'LI') { target = target.parentNode; } var lis = me.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if(li == target) { me.highlighted = i; break; } } me.changeHighlight(); }; this.div.className="suggestion_list"; this.div.style.position = 'absolute'; }; /******************************************************** determine which of the suggestions matches the input (ajaxized) ********************************************************/ //Construct XMLHTTP handler. this.setXMLHTTP = function () { var x=null; try { x=new ActiveXObject("Msxml2.XMLHTTP") } catch(e) { try { x=new ActiveXObject("Microsoft.XMLHTTP") } catch(ee) { x=null } } if(!x && typeof XMLHttpRequest != "undefined") { x=new XMLHttpRequest() } return x } this.HTTPpreload = function() { xmlhttp=me.setXMLHTTP(); xmlhttp.onreadystatechange = this.HTTPloaded; xmlhttp.open("GET", this.uri + encodeURI(this.elem.value), true); xmlhttp.send(null); } this.getEligible = function() { this.eligible = Array(); this.descriptions = Array(); this.actions = Array(); try { eval(xmlhttp.responseText); } catch(x) { this.eligible = Array(); } for (i in this.suggestions) { var suggestion = this.suggestions[i]; if(suggestion.toLowerCase().indexOf(this.inputText.toLowerCase()) == "0") { this.eligible[this.eligible.length]=suggestion; } } }; /******************************************************** Helper function to determine the keycode pressed in a browser-independent manner. ********************************************************/ this.getKeyCode = function(ev) { if(ev) { //Moz return ev.keyCode; } if(window.event) { //IE return window.event.keyCode; } }; /******************************************************** Helper function to determine the event source element in a browser-independent manner. ********************************************************/ this.getEventSource = function(ev) { if(ev) { //Moz return ev.target; } if(window.event) { //IE return window.event.srcElement; } }; /******************************************************** Helper function to cancel an event in a browser-independent manner. (Returning false helps too). ********************************************************/ this.cancelEvent = function(ev) { if(ev) { //Moz ev.preventDefault(); ev.stopPropagation(); } if(window.event) { //IE window.event.returnValue = false; } }}
function AutoSuggest(form,elem,uri) {
function AutoSuggest(form,elem,uri,autosubmit) {
function AutoSuggest(form,elem,uri) { //The 'me' variable allow you to access the AutoSuggest object //from the elem's event handlers defined below. var me = this; //A reference to the element we're binding the list to. this.elem = elem; this.form = form; this.uri = uri; //Arrow to store a subset of eligible suggestions that match the user's input this.eligible = new Array(); //The text input by the user. this.inputText = null; //A pointer to the index of the highlighted eligible item. -1 means nothing highlighted. this.highlighted = -1; //A div to use to create the dropdown. this.div = document.getElementById("autosuggest"); //Do you want to remember what keycode means what? Me neither. var ENT = 3; var RET = 13; var TAB = 9; var ESC = 27; var KEYUP = 38; var KEYDN = 40; //The browsers' own autocomplete feature can be problematic, since it will //be making suggestions from the users' past input. //Setting this attribute should turn it off. elem.setAttribute("autocomplete","off"); //We need to be able to reference the elem by id. If it doesn't have an id, set one. if(!elem.id) { var id = "autosuggest" + idCounter; idCounter++; elem.id = id; } /******************************************************** onkeydown event handler for the input elem. Tab key = use the highlighted suggestion, if there is one. Esc key = get rid of the autosuggest dropdown Up/down arrows = Move the highlight up and down in the suggestions. ********************************************************/ elem.onkeydown = function(ev) { var key = me.getKeyCode(ev); switch(key) { case ENT: case RET: me.useSuggestion(); break; case TAB: me.useSuggestion(); break; case ESC: me.hideDiv(); break; case KEYUP: if (me.highlighted > 0) { me.highlighted--; } me.changeHighlight(key); break; case KEYDN: if (me.highlighted < (me.eligible.length - 1)) { me.highlighted++; } me.changeHighlight(key); break; } }; /******************************************************** onkeyup handler for the elem If the text is of sufficient length, and has been changed, then display a list of eligible suggestions. ********************************************************/ elem.onkeyup = function(ev) { var key = me.getKeyCode(ev); switch(key) { //The control keys were already handled by onkeydown, so do nothing. case ENT: case RET: case TAB: case ESC: case KEYUP: case KEYDN: return; default: if (this.value != me.inputText && this.value.length > 0) { me.HTTPpreload(); } else { me.hideDiv(); } } }; this.HTTPloaded = function () { if (xmlhttp.readyState == 4) { me.inputText = this.value; me.getEligible(); if (me.eligible.length>0) { me.createDiv(); me.positionDiv(); me.showDiv(); } else { me.hideDiv(); } } } /******************************************************** Insert the highlighted suggestion into the input box, and remove the suggestion dropdown. ********************************************************/ 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; } }; /******************************************************** Display the dropdown. Pretty straightforward. ********************************************************/ this.showDiv = function() { this.div.style.display = 'block'; }; /******************************************************** Hide the dropdown and clear any highlight. ********************************************************/ this.hideDiv = function() { this.div.style.display = 'none'; this.highlighted = -1; }; /******************************************************** Modify the HTML in the dropdown to move the highlight. ********************************************************/ this.changeHighlight = function() { var lis = this.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if (this.highlighted == i) { li.className = "selected"; } else { li.className = ""; } } }; /******************************************************** Position the dropdown div below the input text field. ********************************************************/ this.positionDiv = function() { var el = this.elem; var x = 0; var y = el.offsetHeight; //Walk up the DOM and add up all of the offset positions. while (el.offsetParent && el.tagName.toUpperCase() != 'BODY') { x += el.offsetLeft; y += el.offsetTop; el = el.offsetParent; } x += el.offsetLeft; y += el.offsetTop; this.div.style.left = x + 'px'; this.div.style.top = y + 'px'; }; /******************************************************** Build the HTML for the dropdown div ********************************************************/ this.createDiv = function() { var ul = document.createElement('ul'); //Create an array of LI's for the words. for (i in this.eligible) { var word = this.eligible[i]; var desc = this.descriptions[i]; var dest = this.actions[i]; var ds = document.createElement('span'); var li = document.createElement('li'); var a = document.createElement('a'); a.href = dest; a.innerHTML = word; ds.innerHTML = desc; li.appendChild(a); a.appendChild(ds); if (me.highlighted == i) { li.className = "selected"; } ul.appendChild(li); } this.div.replaceChild(ul,this.div.childNodes[0]); /******************************************************** mouseover handler for the dropdown ul move the highlighted suggestion with the mouse ********************************************************/ ul.onmouseover = function(ev) { //Walk up from target until you find the LI. var target = me.getEventSource(ev); while (target.parentNode && target.tagName.toUpperCase() != 'LI') { target = target.parentNode; } var lis = me.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if(li == target) { me.highlighted = i; break; } } me.changeHighlight(); }; this.div.className="suggestion_list"; this.div.style.position = 'absolute'; }; /******************************************************** determine which of the suggestions matches the input (ajaxized) ********************************************************/ //Construct XMLHTTP handler. this.setXMLHTTP = function () { var x=null; try { x=new ActiveXObject("Msxml2.XMLHTTP") } catch(e) { try { x=new ActiveXObject("Microsoft.XMLHTTP") } catch(ee) { x=null } } if(!x && typeof XMLHttpRequest != "undefined") { x=new XMLHttpRequest() } return x } this.HTTPpreload = function() { xmlhttp=me.setXMLHTTP(); xmlhttp.onreadystatechange = this.HTTPloaded; xmlhttp.open("GET", this.uri + encodeURI(this.elem.value), true); xmlhttp.send(null); } this.getEligible = function() { this.eligible = Array(); this.descriptions = Array(); this.actions = Array(); try { eval(xmlhttp.responseText); } catch(x) { this.eligible = Array(); } for (i in this.suggestions) { var suggestion = this.suggestions[i]; if(suggestion.toLowerCase().indexOf(this.inputText.toLowerCase()) == "0") { this.eligible[this.eligible.length]=suggestion; } } }; /******************************************************** Helper function to determine the keycode pressed in a browser-independent manner. ********************************************************/ this.getKeyCode = function(ev) { if(ev) { //Moz return ev.keyCode; } if(window.event) { //IE return window.event.keyCode; } }; /******************************************************** Helper function to determine the event source element in a browser-independent manner. ********************************************************/ this.getEventSource = function(ev) { if(ev) { //Moz return ev.target; } if(window.event) { //IE return window.event.srcElement; } }; /******************************************************** Helper function to cancel an event in a browser-independent manner. (Returning false helps too). ********************************************************/ this.cancelEvent = function(ev) { if(ev) { //Moz ev.preventDefault(); ev.stopPropagation(); } if(window.event) { //IE window.event.returnValue = false; } }}
if (xmlhttp.readyState == 4) {
if ((xmlhttp)&&(xmlhttp.readyState == 4)) {
function AutoSuggest(form,elem,uri) { //The 'me' variable allow you to access the AutoSuggest object //from the elem's event handlers defined below. var me = this; //A reference to the element we're binding the list to. this.elem = elem; this.form = form; this.uri = uri; //Arrow to store a subset of eligible suggestions that match the user's input this.eligible = new Array(); //The text input by the user. this.inputText = null; //A pointer to the index of the highlighted eligible item. -1 means nothing highlighted. this.highlighted = -1; //A div to use to create the dropdown. this.div = document.getElementById("autosuggest"); //Do you want to remember what keycode means what? Me neither. var ENT = 3; var RET = 13; var TAB = 9; var ESC = 27; var KEYUP = 38; var KEYDN = 40; //The browsers' own autocomplete feature can be problematic, since it will //be making suggestions from the users' past input. //Setting this attribute should turn it off. elem.setAttribute("autocomplete","off"); //We need to be able to reference the elem by id. If it doesn't have an id, set one. if(!elem.id) { var id = "autosuggest" + idCounter; idCounter++; elem.id = id; } /******************************************************** onkeydown event handler for the input elem. Tab key = use the highlighted suggestion, if there is one. Esc key = get rid of the autosuggest dropdown Up/down arrows = Move the highlight up and down in the suggestions. ********************************************************/ elem.onkeydown = function(ev) { var key = me.getKeyCode(ev); switch(key) { case ENT: case RET: me.useSuggestion(); break; case TAB: me.useSuggestion(); break; case ESC: me.hideDiv(); break; case KEYUP: if (me.highlighted > 0) { me.highlighted--; } me.changeHighlight(key); break; case KEYDN: if (me.highlighted < (me.eligible.length - 1)) { me.highlighted++; } me.changeHighlight(key); break; } }; /******************************************************** onkeyup handler for the elem If the text is of sufficient length, and has been changed, then display a list of eligible suggestions. ********************************************************/ elem.onkeyup = function(ev) { var key = me.getKeyCode(ev); switch(key) { //The control keys were already handled by onkeydown, so do nothing. case ENT: case RET: case TAB: case ESC: case KEYUP: case KEYDN: return; default: if (this.value != me.inputText && this.value.length > 0) { me.HTTPpreload(); } else { me.hideDiv(); } } }; this.HTTPloaded = function () { if (xmlhttp.readyState == 4) { me.inputText = this.value; me.getEligible(); if (me.eligible.length>0) { me.createDiv(); me.positionDiv(); me.showDiv(); } else { me.hideDiv(); } } } /******************************************************** Insert the highlighted suggestion into the input box, and remove the suggestion dropdown. ********************************************************/ 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; } }; /******************************************************** Display the dropdown. Pretty straightforward. ********************************************************/ this.showDiv = function() { this.div.style.display = 'block'; }; /******************************************************** Hide the dropdown and clear any highlight. ********************************************************/ this.hideDiv = function() { this.div.style.display = 'none'; this.highlighted = -1; }; /******************************************************** Modify the HTML in the dropdown to move the highlight. ********************************************************/ this.changeHighlight = function() { var lis = this.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if (this.highlighted == i) { li.className = "selected"; } else { li.className = ""; } } }; /******************************************************** Position the dropdown div below the input text field. ********************************************************/ this.positionDiv = function() { var el = this.elem; var x = 0; var y = el.offsetHeight; //Walk up the DOM and add up all of the offset positions. while (el.offsetParent && el.tagName.toUpperCase() != 'BODY') { x += el.offsetLeft; y += el.offsetTop; el = el.offsetParent; } x += el.offsetLeft; y += el.offsetTop; this.div.style.left = x + 'px'; this.div.style.top = y + 'px'; }; /******************************************************** Build the HTML for the dropdown div ********************************************************/ this.createDiv = function() { var ul = document.createElement('ul'); //Create an array of LI's for the words. for (i in this.eligible) { var word = this.eligible[i]; var desc = this.descriptions[i]; var dest = this.actions[i]; var ds = document.createElement('span'); var li = document.createElement('li'); var a = document.createElement('a'); a.href = dest; a.innerHTML = word; ds.innerHTML = desc; li.appendChild(a); a.appendChild(ds); if (me.highlighted == i) { li.className = "selected"; } ul.appendChild(li); } this.div.replaceChild(ul,this.div.childNodes[0]); /******************************************************** mouseover handler for the dropdown ul move the highlighted suggestion with the mouse ********************************************************/ ul.onmouseover = function(ev) { //Walk up from target until you find the LI. var target = me.getEventSource(ev); while (target.parentNode && target.tagName.toUpperCase() != 'LI') { target = target.parentNode; } var lis = me.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if(li == target) { me.highlighted = i; break; } } me.changeHighlight(); }; this.div.className="suggestion_list"; this.div.style.position = 'absolute'; }; /******************************************************** determine which of the suggestions matches the input (ajaxized) ********************************************************/ //Construct XMLHTTP handler. this.setXMLHTTP = function () { var x=null; try { x=new ActiveXObject("Msxml2.XMLHTTP") } catch(e) { try { x=new ActiveXObject("Microsoft.XMLHTTP") } catch(ee) { x=null } } if(!x && typeof XMLHttpRequest != "undefined") { x=new XMLHttpRequest() } return x } this.HTTPpreload = function() { xmlhttp=me.setXMLHTTP(); xmlhttp.onreadystatechange = this.HTTPloaded; xmlhttp.open("GET", this.uri + encodeURI(this.elem.value), true); xmlhttp.send(null); } this.getEligible = function() { this.eligible = Array(); this.descriptions = Array(); this.actions = Array(); try { eval(xmlhttp.responseText); } catch(x) { this.eligible = Array(); } for (i in this.suggestions) { var suggestion = this.suggestions[i]; if(suggestion.toLowerCase().indexOf(this.inputText.toLowerCase()) == "0") { this.eligible[this.eligible.length]=suggestion; } } }; /******************************************************** Helper function to determine the keycode pressed in a browser-independent manner. ********************************************************/ this.getKeyCode = function(ev) { if(ev) { //Moz return ev.keyCode; } if(window.event) { //IE return window.event.keyCode; } }; /******************************************************** Helper function to determine the event source element in a browser-independent manner. ********************************************************/ this.getEventSource = function(ev) { if(ev) { //Moz return ev.target; } if(window.event) { //IE return window.event.srcElement; } }; /******************************************************** Helper function to cancel an event in a browser-independent manner. (Returning false helps too). ********************************************************/ this.cancelEvent = function(ev) { if(ev) { //Moz ev.preventDefault(); ev.stopPropagation(); } if(window.event) { //IE window.event.returnValue = false; } }}
location.href = gotothisuri;
if (this.autosubmit == 1) location.href = gotothisuri;
function AutoSuggest(form,elem,uri) { //The 'me' variable allow you to access the AutoSuggest object //from the elem's event handlers defined below. var me = this; //A reference to the element we're binding the list to. this.elem = elem; this.form = form; this.uri = uri; //Arrow to store a subset of eligible suggestions that match the user's input this.eligible = new Array(); //The text input by the user. this.inputText = null; //A pointer to the index of the highlighted eligible item. -1 means nothing highlighted. this.highlighted = -1; //A div to use to create the dropdown. this.div = document.getElementById("autosuggest"); //Do you want to remember what keycode means what? Me neither. var ENT = 3; var RET = 13; var TAB = 9; var ESC = 27; var KEYUP = 38; var KEYDN = 40; //The browsers' own autocomplete feature can be problematic, since it will //be making suggestions from the users' past input. //Setting this attribute should turn it off. elem.setAttribute("autocomplete","off"); //We need to be able to reference the elem by id. If it doesn't have an id, set one. if(!elem.id) { var id = "autosuggest" + idCounter; idCounter++; elem.id = id; } /******************************************************** onkeydown event handler for the input elem. Tab key = use the highlighted suggestion, if there is one. Esc key = get rid of the autosuggest dropdown Up/down arrows = Move the highlight up and down in the suggestions. ********************************************************/ elem.onkeydown = function(ev) { var key = me.getKeyCode(ev); switch(key) { case ENT: case RET: me.useSuggestion(); break; case TAB: me.useSuggestion(); break; case ESC: me.hideDiv(); break; case KEYUP: if (me.highlighted > 0) { me.highlighted--; } me.changeHighlight(key); break; case KEYDN: if (me.highlighted < (me.eligible.length - 1)) { me.highlighted++; } me.changeHighlight(key); break; } }; /******************************************************** onkeyup handler for the elem If the text is of sufficient length, and has been changed, then display a list of eligible suggestions. ********************************************************/ elem.onkeyup = function(ev) { var key = me.getKeyCode(ev); switch(key) { //The control keys were already handled by onkeydown, so do nothing. case ENT: case RET: case TAB: case ESC: case KEYUP: case KEYDN: return; default: if (this.value != me.inputText && this.value.length > 0) { me.HTTPpreload(); } else { me.hideDiv(); } } }; this.HTTPloaded = function () { if (xmlhttp.readyState == 4) { me.inputText = this.value; me.getEligible(); if (me.eligible.length>0) { me.createDiv(); me.positionDiv(); me.showDiv(); } else { me.hideDiv(); } } } /******************************************************** Insert the highlighted suggestion into the input box, and remove the suggestion dropdown. ********************************************************/ 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; } }; /******************************************************** Display the dropdown. Pretty straightforward. ********************************************************/ this.showDiv = function() { this.div.style.display = 'block'; }; /******************************************************** Hide the dropdown and clear any highlight. ********************************************************/ this.hideDiv = function() { this.div.style.display = 'none'; this.highlighted = -1; }; /******************************************************** Modify the HTML in the dropdown to move the highlight. ********************************************************/ this.changeHighlight = function() { var lis = this.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if (this.highlighted == i) { li.className = "selected"; } else { li.className = ""; } } }; /******************************************************** Position the dropdown div below the input text field. ********************************************************/ this.positionDiv = function() { var el = this.elem; var x = 0; var y = el.offsetHeight; //Walk up the DOM and add up all of the offset positions. while (el.offsetParent && el.tagName.toUpperCase() != 'BODY') { x += el.offsetLeft; y += el.offsetTop; el = el.offsetParent; } x += el.offsetLeft; y += el.offsetTop; this.div.style.left = x + 'px'; this.div.style.top = y + 'px'; }; /******************************************************** Build the HTML for the dropdown div ********************************************************/ this.createDiv = function() { var ul = document.createElement('ul'); //Create an array of LI's for the words. for (i in this.eligible) { var word = this.eligible[i]; var desc = this.descriptions[i]; var dest = this.actions[i]; var ds = document.createElement('span'); var li = document.createElement('li'); var a = document.createElement('a'); a.href = dest; a.innerHTML = word; ds.innerHTML = desc; li.appendChild(a); a.appendChild(ds); if (me.highlighted == i) { li.className = "selected"; } ul.appendChild(li); } this.div.replaceChild(ul,this.div.childNodes[0]); /******************************************************** mouseover handler for the dropdown ul move the highlighted suggestion with the mouse ********************************************************/ ul.onmouseover = function(ev) { //Walk up from target until you find the LI. var target = me.getEventSource(ev); while (target.parentNode && target.tagName.toUpperCase() != 'LI') { target = target.parentNode; } var lis = me.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if(li == target) { me.highlighted = i; break; } } me.changeHighlight(); }; this.div.className="suggestion_list"; this.div.style.position = 'absolute'; }; /******************************************************** determine which of the suggestions matches the input (ajaxized) ********************************************************/ //Construct XMLHTTP handler. this.setXMLHTTP = function () { var x=null; try { x=new ActiveXObject("Msxml2.XMLHTTP") } catch(e) { try { x=new ActiveXObject("Microsoft.XMLHTTP") } catch(ee) { x=null } } if(!x && typeof XMLHttpRequest != "undefined") { x=new XMLHttpRequest() } return x } this.HTTPpreload = function() { xmlhttp=me.setXMLHTTP(); xmlhttp.onreadystatechange = this.HTTPloaded; xmlhttp.open("GET", this.uri + encodeURI(this.elem.value), true); xmlhttp.send(null); } this.getEligible = function() { this.eligible = Array(); this.descriptions = Array(); this.actions = Array(); try { eval(xmlhttp.responseText); } catch(x) { this.eligible = Array(); } for (i in this.suggestions) { var suggestion = this.suggestions[i]; if(suggestion.toLowerCase().indexOf(this.inputText.toLowerCase()) == "0") { this.eligible[this.eligible.length]=suggestion; } } }; /******************************************************** Helper function to determine the keycode pressed in a browser-independent manner. ********************************************************/ this.getKeyCode = function(ev) { if(ev) { //Moz return ev.keyCode; } if(window.event) { //IE return window.event.keyCode; } }; /******************************************************** Helper function to determine the event source element in a browser-independent manner. ********************************************************/ this.getEventSource = function(ev) { if(ev) { //Moz return ev.target; } if(window.event) { //IE return window.event.srcElement; } }; /******************************************************** Helper function to cancel an event in a browser-independent manner. (Returning false helps too). ********************************************************/ this.cancelEvent = function(ev) { if(ev) { //Moz ev.preventDefault(); ev.stopPropagation(); } if(window.event) { //IE window.event.returnValue = false; } }}
var desc = this.descriptions[i]; var dest = this.actions[i];
var desc = (this.descriptions[i])?this.descriptions[i]:''; var dest = (this.actions[i])?this.actions[i]:'';
function AutoSuggest(form,elem,uri) { //The 'me' variable allow you to access the AutoSuggest object //from the elem's event handlers defined below. var me = this; //A reference to the element we're binding the list to. this.elem = elem; this.form = form; this.uri = uri; //Arrow to store a subset of eligible suggestions that match the user's input this.eligible = new Array(); //The text input by the user. this.inputText = null; //A pointer to the index of the highlighted eligible item. -1 means nothing highlighted. this.highlighted = -1; //A div to use to create the dropdown. this.div = document.getElementById("autosuggest"); //Do you want to remember what keycode means what? Me neither. var ENT = 3; var RET = 13; var TAB = 9; var ESC = 27; var KEYUP = 38; var KEYDN = 40; //The browsers' own autocomplete feature can be problematic, since it will //be making suggestions from the users' past input. //Setting this attribute should turn it off. elem.setAttribute("autocomplete","off"); //We need to be able to reference the elem by id. If it doesn't have an id, set one. if(!elem.id) { var id = "autosuggest" + idCounter; idCounter++; elem.id = id; } /******************************************************** onkeydown event handler for the input elem. Tab key = use the highlighted suggestion, if there is one. Esc key = get rid of the autosuggest dropdown Up/down arrows = Move the highlight up and down in the suggestions. ********************************************************/ elem.onkeydown = function(ev) { var key = me.getKeyCode(ev); switch(key) { case ENT: case RET: me.useSuggestion(); break; case TAB: me.useSuggestion(); break; case ESC: me.hideDiv(); break; case KEYUP: if (me.highlighted > 0) { me.highlighted--; } me.changeHighlight(key); break; case KEYDN: if (me.highlighted < (me.eligible.length - 1)) { me.highlighted++; } me.changeHighlight(key); break; } }; /******************************************************** onkeyup handler for the elem If the text is of sufficient length, and has been changed, then display a list of eligible suggestions. ********************************************************/ elem.onkeyup = function(ev) { var key = me.getKeyCode(ev); switch(key) { //The control keys were already handled by onkeydown, so do nothing. case ENT: case RET: case TAB: case ESC: case KEYUP: case KEYDN: return; default: if (this.value != me.inputText && this.value.length > 0) { me.HTTPpreload(); } else { me.hideDiv(); } } }; this.HTTPloaded = function () { if (xmlhttp.readyState == 4) { me.inputText = this.value; me.getEligible(); if (me.eligible.length>0) { me.createDiv(); me.positionDiv(); me.showDiv(); } else { me.hideDiv(); } } } /******************************************************** Insert the highlighted suggestion into the input box, and remove the suggestion dropdown. ********************************************************/ 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; } }; /******************************************************** Display the dropdown. Pretty straightforward. ********************************************************/ this.showDiv = function() { this.div.style.display = 'block'; }; /******************************************************** Hide the dropdown and clear any highlight. ********************************************************/ this.hideDiv = function() { this.div.style.display = 'none'; this.highlighted = -1; }; /******************************************************** Modify the HTML in the dropdown to move the highlight. ********************************************************/ this.changeHighlight = function() { var lis = this.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if (this.highlighted == i) { li.className = "selected"; } else { li.className = ""; } } }; /******************************************************** Position the dropdown div below the input text field. ********************************************************/ this.positionDiv = function() { var el = this.elem; var x = 0; var y = el.offsetHeight; //Walk up the DOM and add up all of the offset positions. while (el.offsetParent && el.tagName.toUpperCase() != 'BODY') { x += el.offsetLeft; y += el.offsetTop; el = el.offsetParent; } x += el.offsetLeft; y += el.offsetTop; this.div.style.left = x + 'px'; this.div.style.top = y + 'px'; }; /******************************************************** Build the HTML for the dropdown div ********************************************************/ this.createDiv = function() { var ul = document.createElement('ul'); //Create an array of LI's for the words. for (i in this.eligible) { var word = this.eligible[i]; var desc = this.descriptions[i]; var dest = this.actions[i]; var ds = document.createElement('span'); var li = document.createElement('li'); var a = document.createElement('a'); a.href = dest; a.innerHTML = word; ds.innerHTML = desc; li.appendChild(a); a.appendChild(ds); if (me.highlighted == i) { li.className = "selected"; } ul.appendChild(li); } this.div.replaceChild(ul,this.div.childNodes[0]); /******************************************************** mouseover handler for the dropdown ul move the highlighted suggestion with the mouse ********************************************************/ ul.onmouseover = function(ev) { //Walk up from target until you find the LI. var target = me.getEventSource(ev); while (target.parentNode && target.tagName.toUpperCase() != 'LI') { target = target.parentNode; } var lis = me.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if(li == target) { me.highlighted = i; break; } } me.changeHighlight(); }; this.div.className="suggestion_list"; this.div.style.position = 'absolute'; }; /******************************************************** determine which of the suggestions matches the input (ajaxized) ********************************************************/ //Construct XMLHTTP handler. this.setXMLHTTP = function () { var x=null; try { x=new ActiveXObject("Msxml2.XMLHTTP") } catch(e) { try { x=new ActiveXObject("Microsoft.XMLHTTP") } catch(ee) { x=null } } if(!x && typeof XMLHttpRequest != "undefined") { x=new XMLHttpRequest() } return x } this.HTTPpreload = function() { xmlhttp=me.setXMLHTTP(); xmlhttp.onreadystatechange = this.HTTPloaded; xmlhttp.open("GET", this.uri + encodeURI(this.elem.value), true); xmlhttp.send(null); } this.getEligible = function() { this.eligible = Array(); this.descriptions = Array(); this.actions = Array(); try { eval(xmlhttp.responseText); } catch(x) { this.eligible = Array(); } for (i in this.suggestions) { var suggestion = this.suggestions[i]; if(suggestion.toLowerCase().indexOf(this.inputText.toLowerCase()) == "0") { this.eligible[this.eligible.length]=suggestion; } } }; /******************************************************** Helper function to determine the keycode pressed in a browser-independent manner. ********************************************************/ this.getKeyCode = function(ev) { if(ev) { //Moz return ev.keyCode; } if(window.event) { //IE return window.event.keyCode; } }; /******************************************************** Helper function to determine the event source element in a browser-independent manner. ********************************************************/ this.getEventSource = function(ev) { if(ev) { //Moz return ev.target; } if(window.event) { //IE return window.event.srcElement; } }; /******************************************************** Helper function to cancel an event in a browser-independent manner. (Returning false helps too). ********************************************************/ this.cancelEvent = function(ev) { if(ev) { //Moz ev.preventDefault(); ev.stopPropagation(); } if(window.event) { //IE window.event.returnValue = false; } }}
a.href = dest; a.innerHTML = word;
if (dest) { a.href = dest; a.innerHTML = word; li.onclick = function() { location.href = dest; } li.appendChild(a); } else { li.innerHTML = word; }
function AutoSuggest(form,elem,uri) { //The 'me' variable allow you to access the AutoSuggest object //from the elem's event handlers defined below. var me = this; //A reference to the element we're binding the list to. this.elem = elem; this.form = form; this.uri = uri; //Arrow to store a subset of eligible suggestions that match the user's input this.eligible = new Array(); //The text input by the user. this.inputText = null; //A pointer to the index of the highlighted eligible item. -1 means nothing highlighted. this.highlighted = -1; //A div to use to create the dropdown. this.div = document.getElementById("autosuggest"); //Do you want to remember what keycode means what? Me neither. var ENT = 3; var RET = 13; var TAB = 9; var ESC = 27; var KEYUP = 38; var KEYDN = 40; //The browsers' own autocomplete feature can be problematic, since it will //be making suggestions from the users' past input. //Setting this attribute should turn it off. elem.setAttribute("autocomplete","off"); //We need to be able to reference the elem by id. If it doesn't have an id, set one. if(!elem.id) { var id = "autosuggest" + idCounter; idCounter++; elem.id = id; } /******************************************************** onkeydown event handler for the input elem. Tab key = use the highlighted suggestion, if there is one. Esc key = get rid of the autosuggest dropdown Up/down arrows = Move the highlight up and down in the suggestions. ********************************************************/ elem.onkeydown = function(ev) { var key = me.getKeyCode(ev); switch(key) { case ENT: case RET: me.useSuggestion(); break; case TAB: me.useSuggestion(); break; case ESC: me.hideDiv(); break; case KEYUP: if (me.highlighted > 0) { me.highlighted--; } me.changeHighlight(key); break; case KEYDN: if (me.highlighted < (me.eligible.length - 1)) { me.highlighted++; } me.changeHighlight(key); break; } }; /******************************************************** onkeyup handler for the elem If the text is of sufficient length, and has been changed, then display a list of eligible suggestions. ********************************************************/ elem.onkeyup = function(ev) { var key = me.getKeyCode(ev); switch(key) { //The control keys were already handled by onkeydown, so do nothing. case ENT: case RET: case TAB: case ESC: case KEYUP: case KEYDN: return; default: if (this.value != me.inputText && this.value.length > 0) { me.HTTPpreload(); } else { me.hideDiv(); } } }; this.HTTPloaded = function () { if (xmlhttp.readyState == 4) { me.inputText = this.value; me.getEligible(); if (me.eligible.length>0) { me.createDiv(); me.positionDiv(); me.showDiv(); } else { me.hideDiv(); } } } /******************************************************** Insert the highlighted suggestion into the input box, and remove the suggestion dropdown. ********************************************************/ 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; } }; /******************************************************** Display the dropdown. Pretty straightforward. ********************************************************/ this.showDiv = function() { this.div.style.display = 'block'; }; /******************************************************** Hide the dropdown and clear any highlight. ********************************************************/ this.hideDiv = function() { this.div.style.display = 'none'; this.highlighted = -1; }; /******************************************************** Modify the HTML in the dropdown to move the highlight. ********************************************************/ this.changeHighlight = function() { var lis = this.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if (this.highlighted == i) { li.className = "selected"; } else { li.className = ""; } } }; /******************************************************** Position the dropdown div below the input text field. ********************************************************/ this.positionDiv = function() { var el = this.elem; var x = 0; var y = el.offsetHeight; //Walk up the DOM and add up all of the offset positions. while (el.offsetParent && el.tagName.toUpperCase() != 'BODY') { x += el.offsetLeft; y += el.offsetTop; el = el.offsetParent; } x += el.offsetLeft; y += el.offsetTop; this.div.style.left = x + 'px'; this.div.style.top = y + 'px'; }; /******************************************************** Build the HTML for the dropdown div ********************************************************/ this.createDiv = function() { var ul = document.createElement('ul'); //Create an array of LI's for the words. for (i in this.eligible) { var word = this.eligible[i]; var desc = this.descriptions[i]; var dest = this.actions[i]; var ds = document.createElement('span'); var li = document.createElement('li'); var a = document.createElement('a'); a.href = dest; a.innerHTML = word; ds.innerHTML = desc; li.appendChild(a); a.appendChild(ds); if (me.highlighted == i) { li.className = "selected"; } ul.appendChild(li); } this.div.replaceChild(ul,this.div.childNodes[0]); /******************************************************** mouseover handler for the dropdown ul move the highlighted suggestion with the mouse ********************************************************/ ul.onmouseover = function(ev) { //Walk up from target until you find the LI. var target = me.getEventSource(ev); while (target.parentNode && target.tagName.toUpperCase() != 'LI') { target = target.parentNode; } var lis = me.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if(li == target) { me.highlighted = i; break; } } me.changeHighlight(); }; this.div.className="suggestion_list"; this.div.style.position = 'absolute'; }; /******************************************************** determine which of the suggestions matches the input (ajaxized) ********************************************************/ //Construct XMLHTTP handler. this.setXMLHTTP = function () { var x=null; try { x=new ActiveXObject("Msxml2.XMLHTTP") } catch(e) { try { x=new ActiveXObject("Microsoft.XMLHTTP") } catch(ee) { x=null } } if(!x && typeof XMLHttpRequest != "undefined") { x=new XMLHttpRequest() } return x } this.HTTPpreload = function() { xmlhttp=me.setXMLHTTP(); xmlhttp.onreadystatechange = this.HTTPloaded; xmlhttp.open("GET", this.uri + encodeURI(this.elem.value), true); xmlhttp.send(null); } this.getEligible = function() { this.eligible = Array(); this.descriptions = Array(); this.actions = Array(); try { eval(xmlhttp.responseText); } catch(x) { this.eligible = Array(); } for (i in this.suggestions) { var suggestion = this.suggestions[i]; if(suggestion.toLowerCase().indexOf(this.inputText.toLowerCase()) == "0") { this.eligible[this.eligible.length]=suggestion; } } }; /******************************************************** Helper function to determine the keycode pressed in a browser-independent manner. ********************************************************/ this.getKeyCode = function(ev) { if(ev) { //Moz return ev.keyCode; } if(window.event) { //IE return window.event.keyCode; } }; /******************************************************** Helper function to determine the event source element in a browser-independent manner. ********************************************************/ this.getEventSource = function(ev) { if(ev) { //Moz return ev.target; } if(window.event) { //IE return window.event.srcElement; } }; /******************************************************** Helper function to cancel an event in a browser-independent manner. (Returning false helps too). ********************************************************/ this.cancelEvent = function(ev) { if(ev) { //Moz ev.preventDefault(); ev.stopPropagation(); } if(window.event) { //IE window.event.returnValue = false; } }}
li.appendChild(a); a.appendChild(ds);
li.appendChild(ds);
function AutoSuggest(form,elem,uri) { //The 'me' variable allow you to access the AutoSuggest object //from the elem's event handlers defined below. var me = this; //A reference to the element we're binding the list to. this.elem = elem; this.form = form; this.uri = uri; //Arrow to store a subset of eligible suggestions that match the user's input this.eligible = new Array(); //The text input by the user. this.inputText = null; //A pointer to the index of the highlighted eligible item. -1 means nothing highlighted. this.highlighted = -1; //A div to use to create the dropdown. this.div = document.getElementById("autosuggest"); //Do you want to remember what keycode means what? Me neither. var ENT = 3; var RET = 13; var TAB = 9; var ESC = 27; var KEYUP = 38; var KEYDN = 40; //The browsers' own autocomplete feature can be problematic, since it will //be making suggestions from the users' past input. //Setting this attribute should turn it off. elem.setAttribute("autocomplete","off"); //We need to be able to reference the elem by id. If it doesn't have an id, set one. if(!elem.id) { var id = "autosuggest" + idCounter; idCounter++; elem.id = id; } /******************************************************** onkeydown event handler for the input elem. Tab key = use the highlighted suggestion, if there is one. Esc key = get rid of the autosuggest dropdown Up/down arrows = Move the highlight up and down in the suggestions. ********************************************************/ elem.onkeydown = function(ev) { var key = me.getKeyCode(ev); switch(key) { case ENT: case RET: me.useSuggestion(); break; case TAB: me.useSuggestion(); break; case ESC: me.hideDiv(); break; case KEYUP: if (me.highlighted > 0) { me.highlighted--; } me.changeHighlight(key); break; case KEYDN: if (me.highlighted < (me.eligible.length - 1)) { me.highlighted++; } me.changeHighlight(key); break; } }; /******************************************************** onkeyup handler for the elem If the text is of sufficient length, and has been changed, then display a list of eligible suggestions. ********************************************************/ elem.onkeyup = function(ev) { var key = me.getKeyCode(ev); switch(key) { //The control keys were already handled by onkeydown, so do nothing. case ENT: case RET: case TAB: case ESC: case KEYUP: case KEYDN: return; default: if (this.value != me.inputText && this.value.length > 0) { me.HTTPpreload(); } else { me.hideDiv(); } } }; this.HTTPloaded = function () { if (xmlhttp.readyState == 4) { me.inputText = this.value; me.getEligible(); if (me.eligible.length>0) { me.createDiv(); me.positionDiv(); me.showDiv(); } else { me.hideDiv(); } } } /******************************************************** Insert the highlighted suggestion into the input box, and remove the suggestion dropdown. ********************************************************/ 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; } }; /******************************************************** Display the dropdown. Pretty straightforward. ********************************************************/ this.showDiv = function() { this.div.style.display = 'block'; }; /******************************************************** Hide the dropdown and clear any highlight. ********************************************************/ this.hideDiv = function() { this.div.style.display = 'none'; this.highlighted = -1; }; /******************************************************** Modify the HTML in the dropdown to move the highlight. ********************************************************/ this.changeHighlight = function() { var lis = this.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if (this.highlighted == i) { li.className = "selected"; } else { li.className = ""; } } }; /******************************************************** Position the dropdown div below the input text field. ********************************************************/ this.positionDiv = function() { var el = this.elem; var x = 0; var y = el.offsetHeight; //Walk up the DOM and add up all of the offset positions. while (el.offsetParent && el.tagName.toUpperCase() != 'BODY') { x += el.offsetLeft; y += el.offsetTop; el = el.offsetParent; } x += el.offsetLeft; y += el.offsetTop; this.div.style.left = x + 'px'; this.div.style.top = y + 'px'; }; /******************************************************** Build the HTML for the dropdown div ********************************************************/ this.createDiv = function() { var ul = document.createElement('ul'); //Create an array of LI's for the words. for (i in this.eligible) { var word = this.eligible[i]; var desc = this.descriptions[i]; var dest = this.actions[i]; var ds = document.createElement('span'); var li = document.createElement('li'); var a = document.createElement('a'); a.href = dest; a.innerHTML = word; ds.innerHTML = desc; li.appendChild(a); a.appendChild(ds); if (me.highlighted == i) { li.className = "selected"; } ul.appendChild(li); } this.div.replaceChild(ul,this.div.childNodes[0]); /******************************************************** mouseover handler for the dropdown ul move the highlighted suggestion with the mouse ********************************************************/ ul.onmouseover = function(ev) { //Walk up from target until you find the LI. var target = me.getEventSource(ev); while (target.parentNode && target.tagName.toUpperCase() != 'LI') { target = target.parentNode; } var lis = me.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if(li == target) { me.highlighted = i; break; } } me.changeHighlight(); }; this.div.className="suggestion_list"; this.div.style.position = 'absolute'; }; /******************************************************** determine which of the suggestions matches the input (ajaxized) ********************************************************/ //Construct XMLHTTP handler. this.setXMLHTTP = function () { var x=null; try { x=new ActiveXObject("Msxml2.XMLHTTP") } catch(e) { try { x=new ActiveXObject("Microsoft.XMLHTTP") } catch(ee) { x=null } } if(!x && typeof XMLHttpRequest != "undefined") { x=new XMLHttpRequest() } return x } this.HTTPpreload = function() { xmlhttp=me.setXMLHTTP(); xmlhttp.onreadystatechange = this.HTTPloaded; xmlhttp.open("GET", this.uri + encodeURI(this.elem.value), true); xmlhttp.send(null); } this.getEligible = function() { this.eligible = Array(); this.descriptions = Array(); this.actions = Array(); try { eval(xmlhttp.responseText); } catch(x) { this.eligible = Array(); } for (i in this.suggestions) { var suggestion = this.suggestions[i]; if(suggestion.toLowerCase().indexOf(this.inputText.toLowerCase()) == "0") { this.eligible[this.eligible.length]=suggestion; } } }; /******************************************************** Helper function to determine the keycode pressed in a browser-independent manner. ********************************************************/ this.getKeyCode = function(ev) { if(ev) { //Moz return ev.keyCode; } if(window.event) { //IE return window.event.keyCode; } }; /******************************************************** Helper function to determine the event source element in a browser-independent manner. ********************************************************/ this.getEventSource = function(ev) { if(ev) { //Moz return ev.target; } if(window.event) { //IE return window.event.srcElement; } }; /******************************************************** Helper function to cancel an event in a browser-independent manner. (Returning false helps too). ********************************************************/ this.cancelEvent = function(ev) { if(ev) { //Moz ev.preventDefault(); ev.stopPropagation(); } if(window.event) { //IE window.event.returnValue = false; } }}
me.createDiv(); me.positionDiv(); me.showDiv();
if (me.eligible.length>0) { me.createDiv(); me.positionDiv(); me.showDiv(); } else { me.hideDiv(); }
function AutoSuggest(form,elem,uri) { //The 'me' variable allow you to access the AutoSuggest object //from the elem's event handlers defined below. var me = this; //A reference to the element we're binding the list to. this.elem = elem; this.form = form; this.uri = uri; //Arrow to store a subset of eligible suggestions that match the user's input this.eligible = new Array(); //The text input by the user. this.inputText = null; //A pointer to the index of the highlighted eligible item. -1 means nothing highlighted. this.highlighted = -1; //A div to use to create the dropdown. this.div = document.getElementById("autosuggest"); //Do you want to remember what keycode means what? Me neither. var ENT = 3; var RET = 13; var TAB = 9; var ESC = 27; var KEYUP = 38; var KEYDN = 40; //The browsers' own autocomplete feature can be problematic, since it will //be making suggestions from the users' past input. //Setting this attribute should turn it off. elem.setAttribute("autocomplete","off"); //We need to be able to reference the elem by id. If it doesn't have an id, set one. if(!elem.id) { var id = "autosuggest" + idCounter; idCounter++; elem.id = id; } /******************************************************** onkeydown event handler for the input elem. Tab key = use the highlighted suggestion, if there is one. Esc key = get rid of the autosuggest dropdown Up/down arrows = Move the highlight up and down in the suggestions. ********************************************************/ elem.onkeydown = function(ev) { var key = me.getKeyCode(ev); switch(key) { case ENT: case RET: me.useSuggestion(); break; case TAB: me.useSuggestion(); break; case ESC: me.hideDiv(); break; case KEYUP: if (me.highlighted > 0) { me.highlighted--; } me.changeHighlight(key); break; case KEYDN: if (me.highlighted < (me.eligible.length - 1)) { me.highlighted++; } me.changeHighlight(key); break; } }; /******************************************************** onkeyup handler for the elem If the text is of sufficient length, and has been changed, then display a list of eligible suggestions. ********************************************************/ elem.onkeyup = function(ev) { var key = me.getKeyCode(ev); switch(key) { //The control keys were already handled by onkeydown, so do nothing. case ENT: case RET: case TAB: case ESC: case KEYUP: case KEYDN: return; default: if (this.value != me.inputText && this.value.length > 0) { //me.inputText = this.value; me.HTTPpreload(); //me.getEligible(); //me.createDiv(); //me.positionDiv(); //me.showDiv(); } else { me.hideDiv(); } } }; this.HTTPloaded = function () { if (xmlhttp.readyState == 4) { me.inputText = this.value; me.getEligible(); me.createDiv(); me.positionDiv(); me.showDiv(); } } /******************************************************** Insert the highlighted suggestion into the input box, and remove the suggestion dropdown. ********************************************************/ 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; } }; /******************************************************** Display the dropdown. Pretty straightforward. ********************************************************/ this.showDiv = function() { this.div.style.display = 'block'; }; /******************************************************** Hide the dropdown and clear any highlight. ********************************************************/ this.hideDiv = function() { this.div.style.display = 'none'; this.highlighted = -1; }; /******************************************************** Modify the HTML in the dropdown to move the highlight. ********************************************************/ this.changeHighlight = function() { var lis = this.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if (this.highlighted == i) { li.className = "selected"; } else { li.className = ""; } } }; /******************************************************** Position the dropdown div below the input text field. ********************************************************/ this.positionDiv = function() { var el = this.elem; var x = 0; var y = el.offsetHeight; //Walk up the DOM and add up all of the offset positions. while (el.offsetParent && el.tagName.toUpperCase() != 'BODY') { x += el.offsetLeft; y += el.offsetTop; el = el.offsetParent; } x += el.offsetLeft; y += el.offsetTop; this.div.style.left = x + 'px'; this.div.style.top = y + 'px'; }; /******************************************************** Build the HTML for the dropdown div ********************************************************/ this.createDiv = function() { var ul = document.createElement('ul'); //Create an array of LI's for the words. for (i in this.eligible) { var word = this.eligible[i]; var desc = this.descriptions[i]; var dest = this.actions[i]; var ds = document.createElement('span'); var li = document.createElement('li'); var a = document.createElement('a'); a.href = dest; a.innerHTML = word; ds.innerHTML = desc; li.appendChild(a); a.appendChild(ds); if (me.highlighted == i) { li.className = "selected"; } ul.appendChild(li); } this.div.replaceChild(ul,this.div.childNodes[0]); /******************************************************** mouseover handler for the dropdown ul move the highlighted suggestion with the mouse ********************************************************/ ul.onmouseover = function(ev) { //Walk up from target until you find the LI. var target = me.getEventSource(ev); while (target.parentNode && target.tagName.toUpperCase() != 'LI') { target = target.parentNode; } var lis = me.div.getElementsByTagName('LI'); for (i in lis) { var li = lis[i]; if(li == target) { me.highlighted = i; break; } } me.changeHighlight(); }; /******************************************************** click handler for the dropdown ul insert the clicked suggestion into the input ********************************************************///We want to go directly to search results, so skip this event handler.// ul.onclick = function(ev) {// me.useSuggestion();// me.hideDiv();// me.cancelEvent(ev);// return false;// }; this.div.className="suggestion_list"; this.div.style.position = 'absolute'; }; /******************************************************** determine which of the suggestions matches the input (ajaxized) ********************************************************/ //Construct XMLHTTP handler. this.setXMLHTTP = function () { var x=null; try { x=new ActiveXObject("Msxml2.XMLHTTP") } catch(e) { try { x=new ActiveXObject("Microsoft.XMLHTTP") } catch(ee) { x=null } } if(!x && typeof XMLHttpRequest != "undefined") { x=new XMLHttpRequest() } return x } this.HTTPpreload = function() { xmlhttp=me.setXMLHTTP(); xmlhttp.onreadystatechange = this.HTTPloaded; xmlhttp.open("GET", this.uri + this.elem.value, true); xmlhttp.send(null); } this.getEligible = function() { this.eligible = Array(); eval(xmlhttp.responseText); for (i in this.suggestions) { var suggestion = this.suggestions[i]; if(suggestion.toLowerCase().indexOf(this.inputText.toLowerCase()) == "0") { this.eligible[this.eligible.length]=suggestion; } } }; /******************************************************** Helper function to determine the keycode pressed in a browser-independent manner. ********************************************************/ this.getKeyCode = function(ev) { if(ev) { //Moz return ev.keyCode; } if(window.event) { //IE return window.event.keyCode; } }; /******************************************************** Helper function to determine the event source element in a browser-independent manner. ********************************************************/ this.getEventSource = function(ev) { if(ev) { //Moz return ev.target; } if(window.event) { //IE return window.event.srcElement; } }; /******************************************************** Helper function to cancel an event in a browser-independent manner. (Returning false helps too). ********************************************************/ this.cancelEvent = function(ev) { if(ev) { //Moz ev.preventDefault(); ev.stopPropagation(); } if(window.event) { //IE window.event.returnValue = false; } }}
if (awGetInputElement(row).value == "")
if (awGetInputElement(row).input.value == "")
function awAddRecipients(msgCompFields, recipientType, recipientsList){ if (!msgCompFields) return; var recipientArray = msgCompFields.SplitRecipients(recipientsList, false); if (! recipientArray) return; for ( var index = 0; index < recipientArray.count; index++ ) { for (var row = 1; row <= top.MAX_RECIPIENTS; row ++) { if (awGetInputElement(row).value == "") break; } if (row > top.MAX_RECIPIENTS) awAppendNewRow(false); awSetInputAndPopupValue(awGetInputElement(row), recipientArray.StringAt(index), awGetPopupElement(row), recipientType, row); /* be sure we still have an empty row left at the end */ if (row == top.MAX_RECIPIENTS) { awAppendNewRow(true); awSetInputAndPopupValue(awGetInputElement(top.MAX_RECIPIENTS), "", awGetPopupElement(top.MAX_RECIPIENTS), "addr_to", top.MAX_RECIPIENTS); } }}
input[0].syncSessions(document.getElementById('msgRecipient#1'));
function awAppendNewRow(setFocus){ var body = document.getElementById('addressWidgetBody'); var treeitem1 = awGetTreeItem(1); if ( body && treeitem1 ) { var lastRecipientType = awGetPopupElement(top.MAX_RECIPIENTS).selectedItem.getAttribute("value"); var nextDummy = awGetNextDummyRow(); if (nextDummy) { body.removeChild(nextDummy); nextDummy = awGetNextDummyRow(); } var newNode = awCopyNode(treeitem1, body, nextDummy); top.MAX_RECIPIENTS++; var input = newNode.getElementsByTagName(awInputElementName()); if ( input && input.length == 1 ) { input[0].setAttribute("value", ""); input[0].setAttribute("id", "msgRecipient#" + top.MAX_RECIPIENTS); // We always clone the first row. The problem is that the first row // could be focused. When we clone that row, we end up with a cloned // XUL textbox that has a focused attribute set. Therefore we think // we're focused and don't properly refocus. The best solution to this // would be to clone a template row that didn't really have any presentation, // rather than using the real visible first row of the tree. // // For now we'll just put in a hack that ensures the focused attribute // is never copied when the node is cloned. if (input[0].getAttribute('focused') != '') input[0].removeAttribute('focused'); } var select = newNode.getElementsByTagName(awSelectElementName()); if ( select && select.length == 1 ) { select[0].selectedItem = select[0].childNodes[0].childNodes[awGetSelectItemIndex(lastRecipientType)]; select[0].setAttribute("id", "msgRecipientType#" + top.MAX_RECIPIENTS); if (input) _awSetAutoComplete(select[0], input[0]); } // focus on new input widget if (setFocus && input[0] ) awSetFocus(top.MAX_RECIPIENTS, input[0]); }}
function awAppendNewRow()
function awAppendNewRow(setFocus)
function awAppendNewRow(){ var body = document.getElementById('addressWidgetBody'); var treeitem1 = awGetTreeItem(1); if ( body && treeitem1 ) { awCopyNode(treeitem1, body, 0); top.MAX_RECIPIENTS++; // focus on new input widget var newInput = awGetInputElement(top.MAX_RECIPIENTS); if ( newInput ) awSetFocus(top.MAX_RECIPIENTS, newInput); }}
var newInput = awGetInputElement(top.MAX_RECIPIENTS); if ( newInput ) awSetFocus(top.MAX_RECIPIENTS, newInput);
if (setFocus) { var newInput = awGetInputElement(top.MAX_RECIPIENTS); if ( newInput ) awSetFocus(top.MAX_RECIPIENTS, newInput); }
function awAppendNewRow(){ var body = document.getElementById('addressWidgetBody'); var treeitem1 = awGetTreeItem(1); if ( body && treeitem1 ) { awCopyNode(treeitem1, body, 0); top.MAX_RECIPIENTS++; // focus on new input widget var newInput = awGetInputElement(top.MAX_RECIPIENTS); if ( newInput ) awSetFocus(top.MAX_RECIPIENTS, newInput); }}
input[0].showCommentColumn = document.getElementById("msgRecipient#1").showCommentColumn;
function awAppendNewRow(setFocus){ var body = document.getElementById('addressWidgetBody'); var treeitem1 = awGetTreeItem(1); if ( body && treeitem1 ) { var lastRecipientType = awGetPopupElement(top.MAX_RECIPIENTS).selectedItem.getAttribute("value"); var nextDummy = awGetNextDummyRow(); if (nextDummy) { body.removeChild(nextDummy); nextDummy = awGetNextDummyRow(); } var newNode = awCopyNode(treeitem1, body, nextDummy); top.MAX_RECIPIENTS++; var input = newNode.getElementsByTagName(awInputElementName()); if ( input && input.length == 1 ) { input[0].setAttribute("value", ""); input[0].setAttribute("id", "msgRecipient#" + top.MAX_RECIPIENTS); //this copies the autocomplete sessions list from recipient#1 input[0].syncSessions(document.getElementById('msgRecipient#1')); // We always clone the first row. The problem is that the first row // could be focused. When we clone that row, we end up with a cloned // XUL textbox that has a focused attribute set. Therefore we think // we're focused and don't properly refocus. The best solution to this // would be to clone a template row that didn't really have any presentation, // rather than using the real visible first row of the tree. // // For now we'll just put in a hack that ensures the focused attribute // is never copied when the node is cloned. if (input[0].getAttribute('focused') != '') input[0].removeAttribute('focused'); } var select = newNode.getElementsByTagName(awSelectElementName()); if ( select && select.length == 1 ) { select[0].selectedItem = select[0].childNodes[0].childNodes[awGetSelectItemIndex(lastRecipientType)]; select[0].setAttribute("id", "msgRecipientType#" + top.MAX_RECIPIENTS); if (input) _awSetAutoComplete(select[0], input[0]); } // focus on new input widget if (setFocus && input[0] ) awSetFocus(top.MAX_RECIPIENTS, input[0]); }}
var body = document.getElementById('addressList');
var body = document.getElementById('addressWidgetBody');
function awAppendNewRow(setFocus){ var body = document.getElementById('addressList'); var treeitem1 = awGetTreeItem(1); if ( body && treeitem1 ) { var newNode = awCopyNode(treeitem1, body, 0); top.MAX_RECIPIENTS++; var input = newNode.getElementsByTagName(awInputElementName()); if ( input && input.length == 1 ) { input[0].setAttribute("value", ""); input[0].setAttribute("id", "address#" + top.MAX_RECIPIENTS); } // focus on new input widget if (setFocus && input ) awSetFocus(top.MAX_RECIPIENTS, input[0]); }}
{ var newNode = awCopyNode(treeitem1, body, 0);
{ var nextDummy = awGetNextDummyRow(); if (nextDummy) { body.removeChild(nextDummy); nextDummy = awGetNextDummyRow(); } var newNode = awCopyNode(treeitem1, body, nextDummy);
function awAppendNewRow(setFocus){ var body = document.getElementById('addressList'); var treeitem1 = awGetTreeItem(1); if ( body && treeitem1 ) { var newNode = awCopyNode(treeitem1, body, 0); top.MAX_RECIPIENTS++; var input = newNode.getElementsByTagName(awInputElementName()); if ( input && input.length == 1 ) { input[0].setAttribute("value", ""); input[0].setAttribute("id", "address#" + top.MAX_RECIPIENTS); } // focus on new input widget if (setFocus && input ) awSetFocus(top.MAX_RECIPIENTS, input[0]); }}
var input = newNode.getElementsByTagName(awInputElementName()); if ( input && input.length == 1 ) { input[0].setAttribute("value", ""); input[0].setAttribute("id", "address#" + top.MAX_RECIPIENTS); }
var input = newNode.getElementsByTagName(awInputElementName()); if ( input && input.length == 1 ) { input[0].setAttribute("value", ""); input[0].setAttribute("id", "addressCol1#" + top.MAX_RECIPIENTS); if (input[0].getAttribute('focused') != '') input[0].removeAttribute('focused'); }
function awAppendNewRow(setFocus){ var body = document.getElementById('addressList'); var treeitem1 = awGetTreeItem(1); if ( body && treeitem1 ) { var newNode = awCopyNode(treeitem1, body, 0); top.MAX_RECIPIENTS++; var input = newNode.getElementsByTagName(awInputElementName()); if ( input && input.length == 1 ) { input[0].setAttribute("value", ""); input[0].setAttribute("id", "address#" + top.MAX_RECIPIENTS); } // focus on new input widget if (setFocus && input ) awSetFocus(top.MAX_RECIPIENTS, input[0]); }}
var input = newNode.getElementsByTagName('INPUT');
var input = newNode.getElementsByTagName(awInputElementName());
function awAppendNewRow(setFocus){ var body = document.getElementById('addressWidgetBody'); var treeitem1 = awGetTreeItem(1); if ( body && treeitem1 ) { var lastRecipientType = awGetPopupElement(top.MAX_RECIPIENTS).value; newNode = awCopyNode(treeitem1, body, 0); top.MAX_RECIPIENTS++; var input = newNode.getElementsByTagName('INPUT'); if ( input && input.length == 1 ) { input[0].setAttribute("value", ""); input[0].setAttribute("id", "msgRecipient#" + top.MAX_RECIPIENTS); } var select = newNode.getElementsByTagName('SELECT'); if ( select && select.length == 1 ) {//doesn't work! select[0].setAttribute("value", lastRecipientType); select[0].value = lastRecipientType; select[0].setAttribute("id", "msgRecipientType#" + top.MAX_RECIPIENTS); } // focus on new input widget if (setFocus && input[0] ) awSetFocus(top.MAX_RECIPIENTS, input[0]); }}
var select = newNode.getElementsByTagName('SELECT');
var select = newNode.getElementsByTagName(awSelectElementName());
function awAppendNewRow(setFocus){ var body = document.getElementById('addressWidgetBody'); var treeitem1 = awGetTreeItem(1); if ( body && treeitem1 ) { var lastRecipientType = awGetPopupElement(top.MAX_RECIPIENTS).value; newNode = awCopyNode(treeitem1, body, 0); top.MAX_RECIPIENTS++; var input = newNode.getElementsByTagName('INPUT'); if ( input && input.length == 1 ) { input[0].setAttribute("value", ""); input[0].setAttribute("id", "msgRecipient#" + top.MAX_RECIPIENTS); } var select = newNode.getElementsByTagName('SELECT'); if ( select && select.length == 1 ) {//doesn't work! select[0].setAttribute("value", lastRecipientType); select[0].value = lastRecipientType; select[0].setAttribute("id", "msgRecipientType#" + top.MAX_RECIPIENTS); } // focus on new input widget if (setFocus && input[0] ) awSetFocus(top.MAX_RECIPIENTS, input[0]); }}
input[0].setAttribute("id", "msgRecipient#" + top.MAX_RECIPIENTS);
input[0].setAttribute("id", "addressCol2#" + top.MAX_RECIPIENTS);
function awAppendNewRow(setFocus){ var body = document.getElementById('addressWidgetBody'); var treeitem1 = awGetTreeItem(1); if ( body && treeitem1 ) { var lastRecipientType = awGetPopupElement(top.MAX_RECIPIENTS).selectedItem.getAttribute("value"); var nextDummy = awGetNextDummyRow(); if (nextDummy) { body.removeChild(nextDummy); nextDummy = awGetNextDummyRow(); } var newNode = awCopyNode(treeitem1, body, nextDummy); top.MAX_RECIPIENTS++; var input = newNode.getElementsByTagName(awInputElementName()); if ( input && input.length == 1 ) { input[0].setAttribute("value", ""); input[0].setAttribute("id", "msgRecipient#" + top.MAX_RECIPIENTS); //this copies the autocomplete sessions list from recipient#1 input[0].syncSessions(document.getElementById('msgRecipient#1')); // also clone the showCommentColumn setting // input[0].showCommentColumn = document.getElementById("msgRecipient#1").showCommentColumn; // We always clone the first row. The problem is that the first row // could be focused. When we clone that row, we end up with a cloned // XUL textbox that has a focused attribute set. Therefore we think // we're focused and don't properly refocus. The best solution to this // would be to clone a template row that didn't really have any presentation, // rather than using the real visible first row of the tree. // // For now we'll just put in a hack that ensures the focused attribute // is never copied when the node is cloned. if (input[0].getAttribute('focused') != '') input[0].removeAttribute('focused'); } var select = newNode.getElementsByTagName(awSelectElementName()); if ( select && select.length == 1 ) { select[0].selectedItem = select[0].childNodes[0].childNodes[awGetSelectItemIndex(lastRecipientType)]; select[0].setAttribute("id", "msgRecipientType#" + top.MAX_RECIPIENTS); if (input) _awSetAutoComplete(select[0], input[0]); } // focus on new input widget if (setFocus && input[0] ) awSetFocus(top.MAX_RECIPIENTS, input[0]); }}
input[0].syncSessions(document.getElementById('msgRecipient#1'));
input[0].syncSessions(document.getElementById('addressCol2#1'));
function awAppendNewRow(setFocus){ var body = document.getElementById('addressWidgetBody'); var treeitem1 = awGetTreeItem(1); if ( body && treeitem1 ) { var lastRecipientType = awGetPopupElement(top.MAX_RECIPIENTS).selectedItem.getAttribute("value"); var nextDummy = awGetNextDummyRow(); if (nextDummy) { body.removeChild(nextDummy); nextDummy = awGetNextDummyRow(); } var newNode = awCopyNode(treeitem1, body, nextDummy); top.MAX_RECIPIENTS++; var input = newNode.getElementsByTagName(awInputElementName()); if ( input && input.length == 1 ) { input[0].setAttribute("value", ""); input[0].setAttribute("id", "msgRecipient#" + top.MAX_RECIPIENTS); //this copies the autocomplete sessions list from recipient#1 input[0].syncSessions(document.getElementById('msgRecipient#1')); // also clone the showCommentColumn setting // input[0].showCommentColumn = document.getElementById("msgRecipient#1").showCommentColumn; // We always clone the first row. The problem is that the first row // could be focused. When we clone that row, we end up with a cloned // XUL textbox that has a focused attribute set. Therefore we think // we're focused and don't properly refocus. The best solution to this // would be to clone a template row that didn't really have any presentation, // rather than using the real visible first row of the tree. // // For now we'll just put in a hack that ensures the focused attribute // is never copied when the node is cloned. if (input[0].getAttribute('focused') != '') input[0].removeAttribute('focused'); } var select = newNode.getElementsByTagName(awSelectElementName()); if ( select && select.length == 1 ) { select[0].selectedItem = select[0].childNodes[0].childNodes[awGetSelectItemIndex(lastRecipientType)]; select[0].setAttribute("id", "msgRecipientType#" + top.MAX_RECIPIENTS); if (input) _awSetAutoComplete(select[0], input[0]); } // focus on new input widget if (setFocus && input[0] ) awSetFocus(top.MAX_RECIPIENTS, input[0]); }}
document.getElementById("msgRecipient#1").showCommentColumn;
document.getElementById("addressCol2#1").showCommentColumn;
function awAppendNewRow(setFocus){ var body = document.getElementById('addressWidgetBody'); var treeitem1 = awGetTreeItem(1); if ( body && treeitem1 ) { var lastRecipientType = awGetPopupElement(top.MAX_RECIPIENTS).selectedItem.getAttribute("value"); var nextDummy = awGetNextDummyRow(); if (nextDummy) { body.removeChild(nextDummy); nextDummy = awGetNextDummyRow(); } var newNode = awCopyNode(treeitem1, body, nextDummy); top.MAX_RECIPIENTS++; var input = newNode.getElementsByTagName(awInputElementName()); if ( input && input.length == 1 ) { input[0].setAttribute("value", ""); input[0].setAttribute("id", "msgRecipient#" + top.MAX_RECIPIENTS); //this copies the autocomplete sessions list from recipient#1 input[0].syncSessions(document.getElementById('msgRecipient#1')); // also clone the showCommentColumn setting // input[0].showCommentColumn = document.getElementById("msgRecipient#1").showCommentColumn; // We always clone the first row. The problem is that the first row // could be focused. When we clone that row, we end up with a cloned // XUL textbox that has a focused attribute set. Therefore we think // we're focused and don't properly refocus. The best solution to this // would be to clone a template row that didn't really have any presentation, // rather than using the real visible first row of the tree. // // For now we'll just put in a hack that ensures the focused attribute // is never copied when the node is cloned. if (input[0].getAttribute('focused') != '') input[0].removeAttribute('focused'); } var select = newNode.getElementsByTagName(awSelectElementName()); if ( select && select.length == 1 ) { select[0].selectedItem = select[0].childNodes[0].childNodes[awGetSelectItemIndex(lastRecipientType)]; select[0].setAttribute("id", "msgRecipientType#" + top.MAX_RECIPIENTS); if (input) _awSetAutoComplete(select[0], input[0]); } // focus on new input widget if (setFocus && input[0] ) awSetFocus(top.MAX_RECIPIENTS, input[0]); }}
select[0].setAttribute("id", "msgRecipientType#" + top.MAX_RECIPIENTS);
select[0].setAttribute("id", "addressCol1#" + top.MAX_RECIPIENTS);
function awAppendNewRow(setFocus){ var body = document.getElementById('addressWidgetBody'); var treeitem1 = awGetTreeItem(1); if ( body && treeitem1 ) { var lastRecipientType = awGetPopupElement(top.MAX_RECIPIENTS).selectedItem.getAttribute("value"); var nextDummy = awGetNextDummyRow(); if (nextDummy) { body.removeChild(nextDummy); nextDummy = awGetNextDummyRow(); } var newNode = awCopyNode(treeitem1, body, nextDummy); top.MAX_RECIPIENTS++; var input = newNode.getElementsByTagName(awInputElementName()); if ( input && input.length == 1 ) { input[0].setAttribute("value", ""); input[0].setAttribute("id", "msgRecipient#" + top.MAX_RECIPIENTS); //this copies the autocomplete sessions list from recipient#1 input[0].syncSessions(document.getElementById('msgRecipient#1')); // also clone the showCommentColumn setting // input[0].showCommentColumn = document.getElementById("msgRecipient#1").showCommentColumn; // We always clone the first row. The problem is that the first row // could be focused. When we clone that row, we end up with a cloned // XUL textbox that has a focused attribute set. Therefore we think // we're focused and don't properly refocus. The best solution to this // would be to clone a template row that didn't really have any presentation, // rather than using the real visible first row of the tree. // // For now we'll just put in a hack that ensures the focused attribute // is never copied when the node is cloned. if (input[0].getAttribute('focused') != '') input[0].removeAttribute('focused'); } var select = newNode.getElementsByTagName(awSelectElementName()); if ( select && select.length == 1 ) { select[0].selectedItem = select[0].childNodes[0].childNodes[awGetSelectItemIndex(lastRecipientType)]; select[0].setAttribute("id", "msgRecipientType#" + top.MAX_RECIPIENTS); if (input) _awSetAutoComplete(select[0], input[0]); } // focus on new input widget if (setFocus && input[0] ) awSetFocus(top.MAX_RECIPIENTS, input[0]); }}
if (inputElem.value == "" && row < maxRecipients)
if (inputElem.input.value == "" && row < maxRecipients)
function awCleanupRows(){ var maxRecipients = top.MAX_RECIPIENTS; var rowID = 1; for (var row = 1; row <= maxRecipients; row ++) { var inputElem = awGetInputElement(row); if (inputElem.value == "" && row < maxRecipients) awRemoveRow(row); else { inputElem.setAttribute("id", "msgRecipient#" + rowID); awGetPopupElement(row).setAttribute("id", "msgRecipientType#" + rowID); rowID ++; } } awTestRowSequence();}
awRemoveRow(row);
awRemoveRow(row, 1);
function awCleanupRows(){ var maxRecipients = top.MAX_RECIPIENTS; var rowID = 1; for (var row = 1; row <= maxRecipients; row ++) { var inputElem = awGetInputElement(row); if (inputElem.value == "" && row < maxRecipients) awRemoveRow(row); else { inputElem.setAttribute("id", "msgRecipient#" + rowID); awGetPopupElement(row).setAttribute("id", "msgRecipientType#" + rowID); rowID ++; } } awTestRowSequence();}
inputElem.setAttribute("id", "msgRecipient#" + rowID); awGetPopupElement(row).setAttribute("id", "msgRecipientType#" + rowID);
inputElem.setAttribute("id", "addressCol2#" + rowID); awGetPopupElement(row).setAttribute("id", "addressCol1#" + rowID);
function awCleanupRows(){ var maxRecipients = top.MAX_RECIPIENTS; var rowID = 1; for (var row = 1; row <= maxRecipients; row ++) { var inputElem = awGetInputElement(row); if (inputElem.value == "" && row < maxRecipients) awRemoveRow(row); else { inputElem.setAttribute("id", "msgRecipient#" + rowID); awGetPopupElement(row).setAttribute("id", "msgRecipientType#" + rowID); rowID ++; } } awTestRowSequence();}
function awClickEmptySpace()
function awClickEmptySpace(setFocus)
function awClickEmptySpace(){ // FIX ME - not currently using this because of a bug in the tree var lastInput = awGetInputElement(top.MAX_RECIPIENTS); if ( lastInput && lastInput.value ) awAppendNewRow(); else awSetFocus(top.MAX_RECIPIENTS, lastInput);}
awAppendNewRow();
awAppendNewRow(setFocus);
function awClickEmptySpace(){ // FIX ME - not currently using this because of a bug in the tree var lastInput = awGetInputElement(top.MAX_RECIPIENTS); if ( lastInput && lastInput.value ) awAppendNewRow(); else awSetFocus(top.MAX_RECIPIENTS, lastInput);}
awSetFocus(top.MAX_RECIPIENTS, lastInput);
if (setFocus) awSetFocus(top.MAX_RECIPIENTS, lastInput);
function awClickEmptySpace(){ // FIX ME - not currently using this because of a bug in the tree var lastInput = awGetInputElement(top.MAX_RECIPIENTS); if ( lastInput && lastInput.value ) awAppendNewRow(); else awSetFocus(top.MAX_RECIPIENTS, lastInput);}
dump("awClickEmptySpace\n");
function awClickEmptySpace(setFocus){ var lastInput = awGetInputElement(top.MAX_RECIPIENTS); if ( lastInput && lastInput.value ) awAppendNewRow(setFocus); else if (setFocus) awSetFocus(top.MAX_RECIPIENTS, lastInput);}
if ( lastInput && lastInput.value )
if ( lastInput && lastInput.input.value )
function awClickEmptySpace(targ, setFocus){ if (targ.localName != 'treechildren') return; dump("awClickEmptySpace\n"); var lastInput = awGetInputElement(top.MAX_RECIPIENTS); if ( lastInput && lastInput.value ) awAppendNewRow(setFocus); else if (setFocus) awSetFocus(top.MAX_RECIPIENTS, lastInput);}
return false;
if (! top.notAnEmptyArea) awClickEmptySpace(true); top.notAnEmptyArea=false; return;
function awClickRow(){ dump("awClickRow\n"); return false;}
function awCreateDummyItem(aParent)
function awCreateDummyItem(aParent, cols)
function awCreateDummyItem(aParent){ var titem = document.createElement("treeitem"); titem.setAttribute("_isDummyRow", "true"); var trow = document.createElement("treerow"); trow.setAttribute("class", "dummy-row"); trow.setAttribute("onclick", "awDummyRow_onclick()"); titem.appendChild(trow); awCreateDummyCell(trow); awCreateDummyCell(trow); if (aParent) aParent.appendChild(titem); return titem;}
awCreateDummyCell(trow); awCreateDummyCell(trow);
for (var i = 0; i < cols; i++) { awCreateDummyCell(trow); }
function awCreateDummyItem(aParent){ var titem = document.createElement("treeitem"); titem.setAttribute("_isDummyRow", "true"); var trow = document.createElement("treerow"); trow.setAttribute("class", "dummy-row"); trow.setAttribute("onclick", "awDummyRow_onclick()"); titem.appendChild(trow); awCreateDummyCell(trow); awCreateDummyCell(trow); if (aParent) aParent.appendChild(titem); return titem;}
function awCreateDummyItem(aParent, cols)
function awCreateDummyItem(aParent)
function awCreateDummyItem(aParent, cols){ var titem = document.createElement("listitem"); titem.setAttribute("_isDummyRow", "true"); titem.setAttribute("class", "dummy-row"); awCreateDummyCell(titem); awCreateDummyCell(titem); if (aParent) aParent.appendChild(titem); return titem;}
awCreateDummyCell(titem); awCreateDummyCell(titem);
for (var i = awGetNumberOfCols(); i > 0; i--) awCreateDummyCell(titem);
function awCreateDummyItem(aParent, cols){ var titem = document.createElement("listitem"); titem.setAttribute("_isDummyRow", "true"); titem.setAttribute("class", "dummy-row"); awCreateDummyCell(titem); awCreateDummyCell(titem); if (aParent) aParent.appendChild(titem); return titem;}
function awCreateOrRemoveDummyRows()
function awCreateOrRemoveDummyRows(cols)
function awCreateOrRemoveDummyRows(){ var body = document.getElementById("addressWidgetBody"); var bodyHeight = body.boxObject.height; // remove rows to remove scrollbar var kids = body.childNodes; for (var i = kids.length-1; gAWContentHeight > bodyHeight && i >= 0; --i) { if (kids[i].hasAttribute("_isDummyRow")) { gAWContentHeight -= gAWRowHeight; body.removeChild(kids[i]); } } // add rows to fill space if (gAWRowHeight) { while (gAWContentHeight+gAWRowHeight < bodyHeight) { awCreateDummyItem(body); gAWContentHeight += gAWRowHeight; } }}
awCreateDummyItem(body);
awCreateDummyItem(body, cols);
function awCreateOrRemoveDummyRows(){ var body = document.getElementById("addressWidgetBody"); var bodyHeight = body.boxObject.height; // remove rows to remove scrollbar var kids = body.childNodes; for (var i = kids.length-1; gAWContentHeight > bodyHeight && i >= 0; --i) { if (kids[i].hasAttribute("_isDummyRow")) { gAWContentHeight -= gAWRowHeight; body.removeChild(kids[i]); } } // add rows to fill space if (gAWRowHeight) { while (gAWContentHeight+gAWRowHeight < bodyHeight) { awCreateDummyItem(body); gAWContentHeight += gAWRowHeight; } }}
function awCreateOrRemoveDummyRows(cols)
function awCreateOrRemoveDummyRows()
function awCreateOrRemoveDummyRows(cols){ var listbox = document.getElementById("addressingWidget"); var listboxHeight = listbox.boxObject.height; // remove rows to remove scrollbar var kids = listbox.childNodes; for (var i = kids.length-1; gAWContentHeight > listboxHeight && i >= 0; --i) { if (kids[i].hasAttribute("_isDummyRow")) { gAWContentHeight -= gAWRowHeight; listbox.removeChild(kids[i]); } } // add rows to fill space if (gAWRowHeight) { while (gAWContentHeight+gAWRowHeight < listboxHeight) { awCreateDummyItem(listbox, cols); gAWContentHeight += gAWRowHeight; } }}
awCreateDummyItem(listbox, cols);
awCreateDummyItem(listbox);
function awCreateOrRemoveDummyRows(cols){ var listbox = document.getElementById("addressingWidget"); var listboxHeight = listbox.boxObject.height; // remove rows to remove scrollbar var kids = listbox.childNodes; for (var i = kids.length-1; gAWContentHeight > listboxHeight && i >= 0; --i) { if (kids[i].hasAttribute("_isDummyRow")) { gAWContentHeight -= gAWRowHeight; listbox.removeChild(kids[i]); } } // add rows to fill space if (gAWRowHeight) { while (gAWContentHeight+gAWRowHeight < listboxHeight) { awCreateDummyItem(listbox, cols); gAWContentHeight += gAWRowHeight; } }}
inputElement.value = "";
inputElement.input.value = "";
function awDeleteHit(inputElement){ var row = awGetRowByInputElement(inputElement); /* 1. don't delete the row if it's the last one remaining, just reset it! */ if (top.MAX_RECIPIENTS <= 1) { inputElement.value = ""; return; } /* 2. Set the focus to the previous field if possible */ if (row > 1) awSetFocus(row - 1, awGetInputElement(row - 1)) else awSetFocus(1, awGetInputElement(2)) /* We have to cheat a little bit because the focus will */ /* be set asynchronusly after we delete the current row, */ /* therefore the row number still the same! */ /* 3. Delete the row */ awDeleteRow(row);}
function awDeleteHit(inputElement)
function awDeleteHit(inputElement, cols)
function awDeleteHit(inputElement){ var row = awGetRowByInputElement(inputElement); /* 1. don't delete the row if it's the last one remaining, just reset it! */ if (top.MAX_RECIPIENTS <= 1) { inputElement.value = ""; return; } /* 2. Set the focus to the previous field if possible */ if (row > 1) awSetFocus(row - 1, awGetInputElement(row - 1)) else awSetFocus(1, awGetInputElement(2)) /* We have to cheat a little bit because the focus will */ /* be set asynchronusly after we delete the current row, */ /* therefore the row number still the same! */ /* 3. Delete the row */ awDeleteRow(row);}
awDeleteRow(row);
awDeleteRow(row, cols);
function awDeleteHit(inputElement){ var row = awGetRowByInputElement(inputElement); /* 1. don't delete the row if it's the last one remaining, just reset it! */ if (top.MAX_RECIPIENTS <= 1) { inputElement.value = ""; return; } /* 2. Set the focus to the previous field if possible */ if (row > 1) awSetFocus(row - 1, awGetInputElement(row - 1)) else awSetFocus(1, awGetInputElement(2)) /* We have to cheat a little bit because the focus will */ /* be set asynchronusly after we delete the current row, */ /* therefore the row number still the same! */ /* 3. Delete the row */ awDeleteRow(row);}
function awDeleteHit(inputElement, cols)
function awDeleteHit(inputElement)
function awDeleteHit(inputElement, cols){ var row = awGetRowByInputElement(inputElement); /* 1. don't delete the row if it's the last one remaining, just reset it! */ if (top.MAX_RECIPIENTS <= 1) { inputElement.value = ""; return; } /* 2. Set the focus to the previous field if possible */ if (row > 1) awSetFocus(row - 1, awGetInputElement(row - 1)) else awSetFocus(1, awGetInputElement(2)) /* We have to cheat a little bit because the focus will */ /* be set asynchronusly after we delete the current row, */ /* therefore the row number still the same! */ /* 3. Delete the row */ awDeleteRow(row, cols);}
awDeleteRow(row, cols);
awDeleteRow(row);
function awDeleteHit(inputElement, cols){ var row = awGetRowByInputElement(inputElement); /* 1. don't delete the row if it's the last one remaining, just reset it! */ if (top.MAX_RECIPIENTS <= 1) { inputElement.value = ""; return; } /* 2. Set the focus to the previous field if possible */ if (row > 1) awSetFocus(row - 1, awGetInputElement(row - 1)) else awSetFocus(1, awGetInputElement(2)) /* We have to cheat a little bit because the focus will */ /* be set asynchronusly after we delete the current row, */ /* therefore the row number still the same! */ /* 3. Delete the row */ awDeleteRow(row, cols);}
function awDeleteRow(rowToDelete)
function awDeleteRow(rowToDelete, cols)
function awDeleteRow(rowToDelete){ /* When we delete a row, we must reset the id of others row in order to not break the sequence */ var maxRecipients = top.MAX_RECIPIENTS; var rowID = rowToDelete; awRemoveRow(rowToDelete); for (var row = rowToDelete + 1; row <= maxRecipients; row ++) { awGetInputElement(row).setAttribute("id", "msgRecipient#" + rowID); awGetPopupElement(row).setAttribute("id", "msgRecipientType#" + rowID); rowID ++; } awTestRowSequence();}
var rowID = rowToDelete;
function awDeleteRow(rowToDelete){ /* When we delete a row, we must reset the id of others row in order to not break the sequence */ var maxRecipients = top.MAX_RECIPIENTS; var rowID = rowToDelete; awRemoveRow(rowToDelete); for (var row = rowToDelete + 1; row <= maxRecipients; row ++) { awGetInputElement(row).setAttribute("id", "msgRecipient#" + rowID); awGetPopupElement(row).setAttribute("id", "msgRecipientType#" + rowID); rowID ++; } awTestRowSequence();}
awRemoveRow(rowToDelete);
awRemoveRow(rowToDelete, cols);
function awDeleteRow(rowToDelete){ /* When we delete a row, we must reset the id of others row in order to not break the sequence */ var maxRecipients = top.MAX_RECIPIENTS; var rowID = rowToDelete; awRemoveRow(rowToDelete); for (var row = rowToDelete + 1; row <= maxRecipients; row ++) { awGetInputElement(row).setAttribute("id", "msgRecipient#" + rowID); awGetPopupElement(row).setAttribute("id", "msgRecipientType#" + rowID); rowID ++; } awTestRowSequence();}
awGetInputElement(row).setAttribute("id", "msgRecipient#" + rowID); awGetPopupElement(row).setAttribute("id", "msgRecipientType#" + rowID); rowID ++;
for (var col = 0; col < cols; col++) { awGetElementByCol(row, col+1).setAttribute("id", "addressCol" + (col+1) + "#" + (row-1)); }
function awDeleteRow(rowToDelete){ /* When we delete a row, we must reset the id of others row in order to not break the sequence */ var maxRecipients = top.MAX_RECIPIENTS; var rowID = rowToDelete; awRemoveRow(rowToDelete); for (var row = rowToDelete + 1; row <= maxRecipients; row ++) { awGetInputElement(row).setAttribute("id", "msgRecipient#" + rowID); awGetPopupElement(row).setAttribute("id", "msgRecipientType#" + rowID); rowID ++; } awTestRowSequence();}
function awDeleteRow(rowToDelete, cols)
function awDeleteRow(rowToDelete)
function awDeleteRow(rowToDelete, cols){ /* When we delete a row, we must reset the id of others row in order to not break the sequence */ var maxRecipients = top.MAX_RECIPIENTS; awRemoveRow(rowToDelete, cols); for (var row = rowToDelete + 1; row <= maxRecipients; row ++) { for (var col = 0; col < cols; col++) { awGetElementByCol(row, col+1).setAttribute("id", "addressCol" + (col+1) + "#" + (row-1)); } } awTestRowSequence();}
awRemoveRow(rowToDelete, cols);
var numberOfCols = awGetNumberOfCols();
function awDeleteRow(rowToDelete, cols){ /* When we delete a row, we must reset the id of others row in order to not break the sequence */ var maxRecipients = top.MAX_RECIPIENTS; awRemoveRow(rowToDelete, cols); for (var row = rowToDelete + 1; row <= maxRecipients; row ++) { for (var col = 0; col < cols; col++) { awGetElementByCol(row, col+1).setAttribute("id", "addressCol" + (col+1) + "#" + (row-1)); } } awTestRowSequence();}
{ for (var col = 0; col < cols; col++) { awGetElementByCol(row, col+1).setAttribute("id", "addressCol" + (col+1) + "#" + (row-1)); } }
for (var col = 1; col <= numberOfCols; col++) awGetElementByCol(row, col).setAttribute("id", "addressCol" + (col) + "#" + (row-1));
function awDeleteRow(rowToDelete, cols){ /* When we delete a row, we must reset the id of others row in order to not break the sequence */ var maxRecipients = top.MAX_RECIPIENTS; awRemoveRow(rowToDelete, cols); for (var row = rowToDelete + 1; row <= maxRecipients; row ++) { for (var col = 0; col < cols; col++) { awGetElementByCol(row, col+1).setAttribute("id", "addressCol" + (col+1) + "#" + (row-1)); } } awTestRowSequence();}
function awFitDummyRows()
function awFitDummyRows(cols)
function awFitDummyRows(){ awCalcContentHeight(); awCreateOrRemoveDummyRows();}
awCreateOrRemoveDummyRows();
awCreateOrRemoveDummyRows(cols);
function awFitDummyRows(){ awCalcContentHeight(); awCreateOrRemoveDummyRows();}
function awFitDummyRows(cols)
function awFitDummyRows()
function awFitDummyRows(cols){ awCalcContentHeight(); awCreateOrRemoveDummyRows(cols);}
awCreateOrRemoveDummyRows(cols);
awCreateOrRemoveDummyRows();
function awFitDummyRows(cols){ awCalcContentHeight(); awCreateOrRemoveDummyRows(cols);}
return document.getElementById("address#" + row);
return document.getElementById("addressCol1#" + row);
function awGetInputElement(row){ return document.getElementById("address#" + row);}
return document.getElementById("msgRecipient#" + row);
return document.getElementById("addressCol2#" + row);
function awGetInputElement(row){ return document.getElementById("msgRecipient#" + row);}
return document.getElementById("msgRecipientType#" + row);
return document.getElementById("addressCol1#" + row);
function awGetPopupElement(row){ return document.getElementById("msgRecipientType#" + row);}
var selectElem = document.getElementById("msgRecipientType#1");
var selectElem = document.getElementById("addressCol1#1");
function awGetSelectItemIndex(itemData){ if (selectElementIndexTable == null) { selectElementIndexTable = new Object(); var selectElem = document.getElementById("msgRecipientType#1"); for (var i = 0; i < selectElem.childNodes[0].childNodes.length; i ++) { var aData = selectElem.childNodes[0].childNodes[i].getAttribute("value"); selectElementIndexTable[aData] = i; } } return selectElementIndexTable[itemData];}
awClickEmptySpace(false);
var lastInput = awGetInputElement(top.MAX_RECIPIENTS); if ( lastInput && lastInput.value && !top.doNotCreateANewRow) awAppendNewRow(false); top.doNotCreateANewRow = false;
function awInputChanged(inputElement){ dump("awInputChanged\n"); AutoCompleteAddress(inputElement); //call awClickEmptySpace to add a new row if needed awClickEmptySpace(false);}
if ( lastInput && lastInput.value && !top.doNotCreateANewRow)
if ( lastInput && lastInput.input.value && !top.doNotCreateANewRow)
function awInputChanged(inputElement){ dump("awInputChanged\n");// AutoCompleteAddress(inputElement); //Do we need to add a new row? var lastInput = awGetInputElement(top.MAX_RECIPIENTS); if ( lastInput && lastInput.value && !top.doNotCreateANewRow) awAppendNewRow(false); top.doNotCreateANewRow = false;}
AutoCompleteAddress(inputElement);
function awInputChanged(inputElement){ dump("awInputChanged\n"); AutoCompleteAddress(inputElement); //Do we need to add a new row? var lastInput = awGetInputElement(top.MAX_RECIPIENTS); if ( lastInput && lastInput.value && !top.doNotCreateANewRow) awAppendNewRow(false); top.doNotCreateANewRow = false;}
inputElementType = document.getElementById("address#1").localName;
inputElementType = document.getElementById("addressCol1#1").localName;
function awInputElementName(){ if (inputElementType == "") inputElementType = document.getElementById("address#1").localName; return inputElementType;}
inputElementType = document.getElementById("msgRecipient#1").localName;
inputElementType = document.getElementById("addressCol2#1").localName;
function awInputElementName(){ if (inputElementType == "") inputElementType = document.getElementById("msgRecipient#1").localName; return inputElementType;}
awDeleteHit(inputs[0]);
awDeleteHit(inputs[0], 2);
function awKeyDown(event, treeElement){ switch(event.keyCode) { case 46: case 8: /* Warning, the treeElement.selectedItems will change everytime we delete a row */ var selItems = treeElement.selectedItems; var length = treeElement.selectedItems.length; for (var i = 1; i <= length; i++) { var inputs = treeElement.selectedItems[0].getElementsByTagName(awInputElementName()); if (inputs && inputs.length == 1) awDeleteHit(inputs[0]); } break; }}
awDeleteHit(inputs[0], 2);
awDeleteHit(inputs[0]);
function awKeyDown(event, listboxElement){ switch(event.keyCode) { case 46: case 8: /* Warning, the listboxElement.selectedItems will change everytime we delete a row */ var selItems = listboxElement.selectedItems; var length = listboxElement.selectedItems.length; for (var i = 1; i <= length; i++) { var inputs = listboxElement.selectedItems[0].getElementsByTagName(awInputElementName()); if (inputs && inputs.length == 1) awDeleteHit(inputs[0], 2); } break; }}
function awNotAnEmptyArea()
function awNotAnEmptyArea(event)
function awNotAnEmptyArea(){ dump("awNotAnEmptyArea\n"); top.notAnEmptyArea=true; return;}
top.notAnEmptyArea=true; return;
var lastInput = awGetInputElement(top.MAX_RECIPIENTS); if ( lastInput && lastInput.value ) awAppendNewRow(false); event.preventBubble();
function awNotAnEmptyArea(){ dump("awNotAnEmptyArea\n"); top.notAnEmptyArea=true; return;}
if (!element.value)
if (!element.input.value)
function awRecipientKeyDown(event, element){ switch(event.keyCode) { case 46: case 8: if (!element.value) awDeleteHit(element); event.preventBubble(); //We need to stop the event else the tree will receive it and the function //awKeyDown will be executed! break; }}
function awRecipientKeyDown(event, element)
function awRecipientKeyDown(event, element, cols)
function awRecipientKeyDown(event, element){ switch(event.keyCode) { case 46: case 8: /* do not query directly the value of the text field else the autocomplete widget could potentially alter it value while doing some internal cleanup, instead, query the value through the first child */ if (!element.value) awDeleteHit(element); event.preventBubble(); //We need to stop the event else the tree will receive it and the function //awKeyDown will be executed! break; }}
awDeleteHit(element);
awDeleteHit(element, cols);
function awRecipientKeyDown(event, element){ switch(event.keyCode) { case 46: case 8: /* do not query directly the value of the text field else the autocomplete widget could potentially alter it value while doing some internal cleanup, instead, query the value through the first child */ if (!element.value) awDeleteHit(element); event.preventBubble(); //We need to stop the event else the tree will receive it and the function //awKeyDown will be executed! break; }}
function awRecipientKeyDown(event, element, cols)
function awRecipientKeyDown(event, element)
function awRecipientKeyDown(event, element, cols){ switch(event.keyCode) { case 46: case 8: /* do not query directly the value of the text field else the autocomplete widget could potentially alter it value while doing some internal cleanup, instead, query the value through the first child */ if (!element.value) awDeleteHit(element, cols); event.preventBubble(); //We need to stop the event else the listbox will receive it and the function //awKeyDown will be executed! break; }}
awDeleteHit(element, cols);
awDeleteHit(element);
function awRecipientKeyDown(event, element, cols){ switch(event.keyCode) { case 46: case 8: /* do not query directly the value of the text field else the autocomplete widget could potentially alter it value while doing some internal cleanup, instead, query the value through the first child */ if (!element.value) awDeleteHit(element, cols); event.preventBubble(); //We need to stop the event else the listbox will receive it and the function //awKeyDown will be executed! break; }}
if (input.value == recipientArray.StringAt(index))
if (input.input.value == recipientArray.StringAt(index))
function awRemoveRecipients(msgCompFields, recipientType, recipientsList){ if (!msgCompFields) return; var recipientArray = msgCompFields.SplitRecipients(recipientsList, false); if (! recipientArray) return; for ( var index = 0; index < recipientArray.count; index++ ) for (var row = 1; row <= top.MAX_RECIPIENTS; row ++) { var popup = awGetPopupElement(row); if (popup.selectedItem.getAttribute("data") == recipientType) { var input = awGetInputElement(row); if (input.value == recipientArray.StringAt(index)) { awSetInputAndPopupValue(input, "", popup, "addr_to", -1); break; } } } }
function awRemoveRow(row)
function awRemoveRow(row, cols)
function awRemoveRow(row){ var body = document.getElementById('addressWidgetBody'); awRemoveNodeAndChildren(body, awGetTreeItem(row)); awFitDummyRows(); top.MAX_RECIPIENTS --;}
awFitDummyRows();
awFitDummyRows(cols);
function awRemoveRow(row){ var body = document.getElementById('addressWidgetBody'); awRemoveNodeAndChildren(body, awGetTreeItem(row)); awFitDummyRows(); top.MAX_RECIPIENTS --;}
function awRemoveRow(row, cols)
function awRemoveRow(row)
function awRemoveRow(row, cols){ var listbox = document.getElementById('addressingWidget'); awRemoveNodeAndChildren(listbox, awGetListItem(row)); awFitDummyRows(cols); top.MAX_RECIPIENTS --;}
awFitDummyRows(cols);
awFitDummyRows();
function awRemoveRow(row, cols){ var listbox = document.getElementById('addressingWidget'); awRemoveNodeAndChildren(listbox, awGetListItem(row)); awFitDummyRows(cols); top.MAX_RECIPIENTS --;}
awAppendNewRow();
awAppendNewRow(true);
function awReturnHit(inputElement){ var row = awGetRowByInputElement(inputElement); if ( inputElement.value ) { var nextInput = awGetInputElement(row+1); if ( !nextInput ) awAppendNewRow(); else awSetFocus(row+1, nextInput); } else { // FIX ME - should tab to next field after addressing widget...probably subjec }}
else { }
function awReturnHit(inputElement){ var row = awGetRowByInputElement(inputElement); if ( inputElement.value ) { var nextInput = awGetInputElement(row+1); if ( !nextInput ) awAppendNewRow(); else awSetFocus(row+1, nextInput); } else { // FIX ME - should tab to next field after addressing widget...probably subjec }}
if ( inputElement.value )
if ( inputElement.input.value )
function awReturnHit(inputElement){ var row = awGetRowByInputElement(inputElement); var nextInput = awGetInputElement(row+1); if ( !nextInput ) { if ( inputElement.value ) awAppendNewRow(true); else // No adress entered, switch to Subject field { var subjectField = document.getElementById( 'msgSubject' ); subjectField.select(); subjectField.focus(); } } else { nextInput.select(); awSetFocus(row+1, nextInput); }}
selectElementType = document.getElementById("msgRecipientType#1").localName;
selectElementType = document.getElementById("addressCol1#1").localName;
function awSelectElementName(){ if (selectElementType == "") selectElementType = document.getElementById("msgRecipientType#1").localName; return selectElementType;}
inputElem.setAttribute("id", "msgRecipient#" + rowNumber); popupElem.setAttribute("id", "msgRecipientType#" + rowNumber);
inputElem.setAttribute("id", "addressCol2#" + rowNumber); popupElem.setAttribute("id", "addressCol1#" + rowNumber);
function awSetInputAndPopupValue(inputElem, inputValue, popupElem, popupValue, rowNumber){ // remove leading spaces while (inputValue && inputValue[0] == " " ) inputValue = inputValue.substring(1, inputValue.length); inputElem.setAttribute("value", inputValue); inputElem.value = inputValue; popupElem.selectedItem = popupElem.childNodes[0].childNodes[awGetSelectItemIndex(popupValue)]; if (rowNumber >= 0) { inputElem.setAttribute("id", "msgRecipient#" + rowNumber); popupElem.setAttribute("id", "msgRecipientType#" + rowNumber); } _awSetAutoComplete(popupElem, inputElem);}
awCreateOrRemoveDummyRows();
awCreateOrRemoveDummyRows(2);
function awSizerMouseMove(){ awCreateOrRemoveDummyRows();}
var row = awGetRowByInputElement(element); if (!event.shiftKey && row < top.MAX_RECIPIENTS) { var listBoxRow = row - 1; var listBox = document.getElementById("addressingWidget"); listBox.listBoxObject.ensureIndexIsVisible(listBoxRow + 1); }
function awTabFromRecipient(element, event){ //If we are le last element in the listbox, we don't want to create a new row. if (element == awGetInputElement(top.MAX_RECIPIENTS)) top.doNotCreateANewRow = true;}
var body = document.getElementById('addressWidgetBody'); var treeitems = body.getElementsByTagName('treeitem'); if (treeitems.length == top.MAX_RECIPIENTS )
var listbox = document.getElementById('addressingWidget'); var listitems = listbox.getElementsByTagName('listitem'); if (listitems.length >= top.MAX_RECIPIENTS )
function awTestRowSequence(){ /* This function is for debug and testing purpose only, normal user should not run it! Everytime we insert or delete a row, we must be sure we didn't break the ID sequence of the addressing widget rows. This function will run a quick test to see if the sequence still ok You need to define the pref mail.debug.test_addresses_sequence to true in order to activate it */ if (! test_addresses_sequence) return true; /* debug code to verify the sequence still good */ var body = document.getElementById('addressWidgetBody'); var treeitems = body.getElementsByTagName('treeitem'); if (treeitems.length == top.MAX_RECIPIENTS ) { for (var i = 1; i <= treeitems.length; i ++) { var item = treeitems[i - 1]; var inputID = item.getElementsByTagName(awInputElementName())[0].getAttribute("id").split("#")[1]; var popupID = item.getElementsByTagName(awSelectElementName())[0].getAttribute("id").split("#")[1]; if (inputID != i || popupID != i) { dump("#ERROR: sequence broken at row " + i + ", inputID=" + inputID + ", popupID=" + popupID + "\n"); break; } } dump("---SEQUENCE OK---\n"); return true; } else dump("#ERROR: treeitems.length(" + treeitems.length + ") != top.MAX_RECIPIENTS(" + top.MAX_RECIPIENTS + ")\n"); return false;}
for (var i = 1; i <= treeitems.length; i ++)
for (var i = 1; i <= listitems.length; i ++)
function awTestRowSequence(){ /* This function is for debug and testing purpose only, normal user should not run it! Everytime we insert or delete a row, we must be sure we didn't break the ID sequence of the addressing widget rows. This function will run a quick test to see if the sequence still ok You need to define the pref mail.debug.test_addresses_sequence to true in order to activate it */ if (! test_addresses_sequence) return true; /* debug code to verify the sequence still good */ var body = document.getElementById('addressWidgetBody'); var treeitems = body.getElementsByTagName('treeitem'); if (treeitems.length == top.MAX_RECIPIENTS ) { for (var i = 1; i <= treeitems.length; i ++) { var item = treeitems[i - 1]; var inputID = item.getElementsByTagName(awInputElementName())[0].getAttribute("id").split("#")[1]; var popupID = item.getElementsByTagName(awSelectElementName())[0].getAttribute("id").split("#")[1]; if (inputID != i || popupID != i) { dump("#ERROR: sequence broken at row " + i + ", inputID=" + inputID + ", popupID=" + popupID + "\n"); break; } } dump("---SEQUENCE OK---\n"); return true; } else dump("#ERROR: treeitems.length(" + treeitems.length + ") != top.MAX_RECIPIENTS(" + top.MAX_RECIPIENTS + ")\n"); return false;}
var item = treeitems[i - 1];
var item = listitems [i - 1];
function awTestRowSequence(){ /* This function is for debug and testing purpose only, normal user should not run it! Everytime we insert or delete a row, we must be sure we didn't break the ID sequence of the addressing widget rows. This function will run a quick test to see if the sequence still ok You need to define the pref mail.debug.test_addresses_sequence to true in order to activate it */ if (! test_addresses_sequence) return true; /* debug code to verify the sequence still good */ var body = document.getElementById('addressWidgetBody'); var treeitems = body.getElementsByTagName('treeitem'); if (treeitems.length == top.MAX_RECIPIENTS ) { for (var i = 1; i <= treeitems.length; i ++) { var item = treeitems[i - 1]; var inputID = item.getElementsByTagName(awInputElementName())[0].getAttribute("id").split("#")[1]; var popupID = item.getElementsByTagName(awSelectElementName())[0].getAttribute("id").split("#")[1]; if (inputID != i || popupID != i) { dump("#ERROR: sequence broken at row " + i + ", inputID=" + inputID + ", popupID=" + popupID + "\n"); break; } } dump("---SEQUENCE OK---\n"); return true; } else dump("#ERROR: treeitems.length(" + treeitems.length + ") != top.MAX_RECIPIENTS(" + top.MAX_RECIPIENTS + ")\n"); return false;}
break;
return false;
function awTestRowSequence(){ /* This function is for debug and testing purpose only, normal user should not run it! Everytime we insert or delete a row, we must be sure we didn't break the ID sequence of the addressing widget rows. This function will run a quick test to see if the sequence still ok You need to define the pref mail.debug.test_addresses_sequence to true in order to activate it */ if (! test_addresses_sequence) return true; /* debug code to verify the sequence still good */ var body = document.getElementById('addressWidgetBody'); var treeitems = body.getElementsByTagName('treeitem'); if (treeitems.length == top.MAX_RECIPIENTS ) { for (var i = 1; i <= treeitems.length; i ++) { var item = treeitems[i - 1]; var inputID = item.getElementsByTagName(awInputElementName())[0].getAttribute("id").split("#")[1]; var popupID = item.getElementsByTagName(awSelectElementName())[0].getAttribute("id").split("#")[1]; if (inputID != i || popupID != i) { dump("#ERROR: sequence broken at row " + i + ", inputID=" + inputID + ", popupID=" + popupID + "\n"); break; } } dump("---SEQUENCE OK---\n"); return true; } else dump("#ERROR: treeitems.length(" + treeitems.length + ") != top.MAX_RECIPIENTS(" + top.MAX_RECIPIENTS + ")\n"); return false;}
dump("---SEQUENCE OK---\n"); return true;
function awTestRowSequence(){ /* This function is for debug and testing purpose only, normal user should not run it! Everytime we insert or delete a row, we must be sure we didn't break the ID sequence of the addressing widget rows. This function will run a quick test to see if the sequence still ok You need to define the pref mail.debug.test_addresses_sequence to true in order to activate it */ if (! test_addresses_sequence) return true; /* debug code to verify the sequence still good */ var body = document.getElementById('addressWidgetBody'); var treeitems = body.getElementsByTagName('treeitem'); if (treeitems.length == top.MAX_RECIPIENTS ) { for (var i = 1; i <= treeitems.length; i ++) { var item = treeitems[i - 1]; var inputID = item.getElementsByTagName(awInputElementName())[0].getAttribute("id").split("#")[1]; var popupID = item.getElementsByTagName(awSelectElementName())[0].getAttribute("id").split("#")[1]; if (inputID != i || popupID != i) { dump("#ERROR: sequence broken at row " + i + ", inputID=" + inputID + ", popupID=" + popupID + "\n"); break; } } dump("---SEQUENCE OK---\n"); return true; } else dump("#ERROR: treeitems.length(" + treeitems.length + ") != top.MAX_RECIPIENTS(" + top.MAX_RECIPIENTS + ")\n"); return false;}
dump("#ERROR: treeitems.length(" + treeitems.length + ") != top.MAX_RECIPIENTS(" + top.MAX_RECIPIENTS + ")\n");
dump("#ERROR: listitems.length(" + listitems.length + ") < top.MAX_RECIPIENTS(" + top.MAX_RECIPIENTS + ")\n");
function awTestRowSequence(){ /* This function is for debug and testing purpose only, normal user should not run it! Everytime we insert or delete a row, we must be sure we didn't break the ID sequence of the addressing widget rows. This function will run a quick test to see if the sequence still ok You need to define the pref mail.debug.test_addresses_sequence to true in order to activate it */ if (! test_addresses_sequence) return true; /* debug code to verify the sequence still good */ var body = document.getElementById('addressWidgetBody'); var treeitems = body.getElementsByTagName('treeitem'); if (treeitems.length == top.MAX_RECIPIENTS ) { for (var i = 1; i <= treeitems.length; i ++) { var item = treeitems[i - 1]; var inputID = item.getElementsByTagName(awInputElementName())[0].getAttribute("id").split("#")[1]; var popupID = item.getElementsByTagName(awSelectElementName())[0].getAttribute("id").split("#")[1]; if (inputID != i || popupID != i) { dump("#ERROR: sequence broken at row " + i + ", inputID=" + inputID + ", popupID=" + popupID + "\n"); break; } } dump("---SEQUENCE OK---\n"); return true; } else dump("#ERROR: treeitems.length(" + treeitems.length + ") != top.MAX_RECIPIENTS(" + top.MAX_RECIPIENTS + ")\n"); return false;}
fp.appendFilter("PKCS12 Files", "*.p12");
fp.appendFilter(bundle.GetStringFromName("file_browse_PKCS12_spec"), "*.p12");
function backupCerts(){ getSelectedCerts(); var numcerts = selected_certs.length; if (!numcerts) return; var bundle = srGetStrBundle("chrome://pippki/locale/pippki.properties"); var fp = Components.classes[nsFilePicker].createInstance(nsIFilePicker); fp.init(window, bundle.GetStringFromName("chooseP12BackupFileDialog"), nsIFilePicker.modeSave); fp.appendFilter("PKCS12 Files", "*.p12"); fp.appendFilters(nsIFilePicker.filterAll); var rv = fp.show(); if (rv == nsIFilePicker.returnOK || rv == nsIFilePicker.returnReplace) { certdb.exportPKCS12File(null, fp.file, selected_certs.length, selected_certs); }}
dump("Exception caught in 'backupData': " + ex + "\n");
backupData: function (categoryNameFix) { var currentColor; try { currentColor = categoryPrefBranch.getCharPref(categoryNameFix); } catch (ex) { currentColor = "##NEW"; } for (var i=0; i < parent.backupPrefList.length; i++) { if (categoryNameFix == parent.backupPrefList[i].name) { return; } } parent.backupPrefList[parent.backupPrefList.length] = { name : categoryNameFix, color : currentColor }; },