1//////////////////////////////////////////// 2// PostBack and AjaxPostBack 3//////////////////////////////////////////// 4 5 qcodo.postBack = function(strForm, strControl, strEvent, strParameter) { 6 var objForm = document.getElementById(strForm); 7 objForm.Qform__FormControl.value = strControl; 8 objForm.Qform__FormEvent.value = strEvent; 9 objForm.Qform__FormParameter.value = strParameter; 10 objForm.Qform__FormCallType.value = "Server"; 11 objForm.Qform__FormUpdates.value = this.formUpdates(); 12 objForm.Qform__FormCheckableControls.value = this.formCheckableControls(strForm, "Server"); 13 objForm.submit(); 14 }; 15 16 qcodo.formUpdates = function() { 17 var strToReturn = ""; 18 19 for (var strControlId in qcodo.controlModifications) 20 for (var strProperty in qcodo.controlModifications[strControlId]) 21 if (strProperty !== "prototype" || strControlId !== "$family") //added by Ken to help out with prototype problems 22 if (qcodo.controlModifications[strControlId].hasOwnProperty(strProperty)) { 23 strToReturn += strControlId + " " + strProperty + " " + qcodo.controlModifications[strControlId][strProperty] + "\n"; 24 } 25 26 qcodo.controlModifications = new Array(); 27 return strToReturn; 28 }; 29 30 qcodo.formCheckableControls = function(strForm, strCallType) { 31 var objForm = document.getElementById(strForm); 32 var strToReturn = ""; 33 34 for (var intIndex = 0; intIndex < objForm.elements.length; intIndex++) { 35 if (((objForm.elements[intIndex].type == "checkbox") || 36 (objForm.elements[intIndex].type == "radio")) && 37 ((strCallType == "Ajax") || 38 (!objForm.elements[intIndex].disabled))) { 39 40 // CheckBoxList 41 if (objForm.elements[intIndex].id.indexOf('[') >= 0) { 42 if (objForm.elements[intIndex].id.indexOf('[0]') >= 0) 43 strToReturn += " " + objForm.elements[intIndex].id.substring(0, objForm.elements[intIndex].id.length - 3); 44 45 // RadioButtonList 46 } else if (objForm.elements[intIndex].id.indexOf('_') >= 0) { 47 if (objForm.elements[intIndex].id.indexOf('_0') >= 0) 48 strToReturn += " " + objForm.elements[intIndex].id.substring(0, objForm.elements[intIndex].id.length - 2); 49 50 // Standard Radio or Checkbox 51 } else { 52 strToReturn += " " + objForm.elements[intIndex].id; 53 }; 54 }; 55 }; 56 57 if (strToReturn.length > 0) 58 return strToReturn.substring(1); 59 else 60 return ""; 61 }; 62 63 qcodo.ajaxQueue = new Array(); 64 65 qcodo.postAjax = function(strForm, strControl, strEvent, strParameter, strWaitIconControlId) { 66 // alert(strForm + " " + strControl + " " + strEvent + " " + strParameter); 67 68 // Figure out if Queue is Empty 69 var blnQueueEmpty = false; 70 if (qcodo.ajaxQueue.length == 0) 71 blnQueueEmpty = true; 72 73 // Enqueue the AJAX Request 74 qcodo.ajaxQueue.push(new Array(strForm, strControl, strEvent, strParameter, strWaitIconControlId)); 75 76 // If the Queue was originally empty, call the Dequeue 77 if (blnQueueEmpty) 78 qcodo.dequeueAjaxQueue(); 79 }; 80 81 qcodo.clearAjaxQueue = function() { 82 qcodo.ajaxQueue = new Array(); 83 }; 84 85 qcodo.objAjaxWaitIcon = null; 86 87 qcodo.dequeueAjaxQueue = function() { 88 if (qcodo.ajaxQueue.length > 0) { 89 strForm = this.ajaxQueue[0][0]; 90 strControl = this.ajaxQueue[0][1]; 91 strEvent = this.ajaxQueue[0][2]; 92 strParameter = this.ajaxQueue[0][3]; 93 strWaitIconControlId = this.ajaxQueue[0][4]; 94 95 // Display WaitIcon (if applicable) 96 if (strWaitIconControlId) { 97 this.objAjaxWaitIcon = this.getWrapper(strWaitIconControlId); 98 if (this.objAjaxWaitIcon) 99 this.objAjaxWaitIcon.style.display = 'inline'; 100 }; 101 102 var objForm = document.getElementById(strForm); 103 objForm.Qform__FormControl.value = strControl; 104 objForm.Qform__FormEvent.value = strEvent; 105 objForm.Qform__FormParameter.value = strParameter; 106 objForm.Qform__FormCallType.value = "Ajax"; 107 objForm.Qform__FormUpdates.value = qcodo.formUpdates(); 108 objForm.Qform__FormCheckableControls.value = this.formCheckableControls(strForm, "Ajax"); 109 110 var strPostData = ""; 111 for (var i = 0; i < objForm.elements.length; i++) { 112 switch (objForm.elements[i].type) { 113 case "checkbox": 114 case "radio": 115 if (objForm.elements[i].checked) { 116 var strTestName = objForm.elements[i].name + "_"; 117 if (objForm.elements[i].id.substring(0, strTestName.length) == strTestName) 118 strPostData += "&" + objForm.elements[i].name + "=" + objForm.elements[i].id.substring(strTestName.length); 119 else 120// strPostData += "&" + objForm.elements[i].id + "=" + "1"; 121 strPostData += "&" + objForm.elements[i].id + "=" + objForm.elements[i].value; 122 }; 123 break; 124 125 case "select-multiple": 126 var blnOneSelected = false;
127 for (var intIndex = 0; intIndex < objForm.elements[i].options.length; intIndex++) 128 if (objForm.elements[i].options[intIndex].selected) { 129 strPostData += "&" + objForm.elements[i].name + "="; 130 strPostData += objForm.elements[i].options[intIndex].value; 131 }; 132 break; 133 134 default: 135 strPostData += "&" + objForm.elements[i].id + "="; 136 137 // For Internationalization -- we must escape the element's value properly 138 var strPostValue = objForm.elements[i].value; 139 if (strPostValue) { 140 strPostValue = strPostValue.replace(/\%/g, "%25"); 141 strPostValue = strPostValue.replace(/&/g, escape('&')); 142 strPostValue = strPostValue.replace(/\+/g, "%2B"); 143 }; 144 strPostData += strPostValue; 145 break; 146 }; 147 }; 148 149 var strUri = objForm.action; 150 151 var objRequest; 152 if (window.XMLHttpRequest) { 153 objRequest = new XMLHttpRequest(); 154 } else if (typeof ActiveXObject != "undefined") { 155 objRequest = new ActiveXObject("Microsoft.XMLHTTP"); 156 }; 157 158 if (objRequest) { 159 objRequest.open("POST", strUri, true); 160 objRequest.setRequestHeader("Method", "POST " + strUri + " HTTP/1.1"); 161 objRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 162 163 objRequest.onreadystatechange = function() { 164 if (!qcodo.unloadFlag && objRequest.readyState == 4) { 165 try { 166 var objXmlDoc = objRequest.responseXML; 167// qcodo.logMessage(objRequest.responseText, true); 168// alert('AJAX Response Received'); 169 170 if (!objXmlDoc) { 171 alert("An error occurred during AJAX Response parsing.\r\n\r\nThe error response will appear in a new popup."); 172 var objErrorWindow = window.open('about:blank', 'qcodo_error','menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=1000,height=700,left=50,top=50'); 173 objErrorWindow.focus(); 174 objErrorWindow.document.write(objRequest.responseText); 175 return; 176 } else { 177 var intLength = 0; 178 179 // Go through Controls 180 var objXmlControls = objXmlDoc.getElementsByTagName('control'); 181 intLength = objXmlControls.length; 182 183 for (var intIndex = 0; intIndex < intLength; intIndex++) { 184 var strControlId = objXmlControls[intIndex].attributes.getNamedItem('id').nodeValue; 185 186 var strControlHtml = ""; 187 if (objXmlControls[intIndex].textContent) 188 strControlHtml = objXmlControls[intIndex].textContent; 189 else if (objXmlControls[intIndex].firstChild) 190 strControlHtml = objXmlControls[intIndex].firstChild.nodeValue; 191 192 // Perform Callback Responsibility 193 if (strControlId == "Qform__FormState") { 194 var objFormState = document.getElementById(strControlId); 195 objFormState.value = strControlHtml; 196 } else { 197 var objSpan = document.getElementById(strControlId + "_ctl"); 198 if (objSpan) 199 objSpan.innerHTML = strControlHtml; 200 }; 201 }; 202 203 // Go through Commands 204 var objXmlCommands = objXmlDoc.getElementsByTagName('command'); 205 intLength = objXmlCommands.length; 206 207 for (var intIndex = 0; intIndex < intLength; intIndex++) { 208 if (objXmlCommands[intIndex] && objXmlCommands[intIndex].firstChild) { 209 var strCommand = ""; 210 intChildLength = objXmlCommands[intIndex].childNodes.length; 211 for (var intChildIndex = 0; intChildIndex < intChildLength; intChildIndex++) 212 strCommand += objXmlCommands[intIndex].childNodes[intChildIndex].nodeValue; 213 eval(strCommand); 214 }; 215 }; 216 }; 217 } catch (objExc) { 218 alert(objExc.message + "\r\non line number " + objExc.lineNumber + "\r\nin file " + objExc.fileName); 219 alert("An error occurred during AJAX Response handling.\r\n\r\nThe error response will appear in a new popup."); 220 var objErrorWindow = window.open('about:blank', 'qcodo_error','menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=1000,height=700,left=50,top=50'); 221 objErrorWindow.focus(); 222 objErrorWindow.document.write(objRequest.responseText); 223 return; 224 }; 225 226 // Perform the Dequeue 227 qcodo.ajaxQueue.shift(); 228 229 // Hid the WaitIcon (if applicable) 230 if (qcodo.objAjaxWaitIcon) 231 qcodo.objAjaxWaitIcon.style.display = 'none'; 232 233 // If there are still AjaxEvents in the queue, go ahead and process/dequeue them 234 if (qcodo.ajaxQueue.length > 0) 235 qcodo.dequeueAjaxQueue(); 236 }; 237 }; 238 239 objRequest.send(strPostData); 240 }; 241 }; 242 }; 243 244 245 246////////////////// 247// Qcodo Shortcuts 248////////////////// 249 250 qc.pB = qcodo.postBack; 251 qc.pA = qcodo.postAjax;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.