[903] | 1 | /****************************************** Public variables *************************************************/ |
---|
| 2 | var debug_controller =false; |
---|
| 3 | var files = new Array(); |
---|
| 4 | var progressBar; |
---|
| 5 | |
---|
| 6 | if (document.all) |
---|
| 7 | { |
---|
| 8 | navigator.userAgent.toLowerCase().indexOf('msie 5') != -1 ? is_ie5 = true : is_ie5 = false; |
---|
| 9 | is_ie = true; |
---|
| 10 | is_moz1_6 = false; |
---|
| 11 | is_mozilla = false; |
---|
| 12 | is_ns4 = false; |
---|
| 13 | } |
---|
| 14 | else if (document.getElementById) |
---|
| 15 | { |
---|
| 16 | navigator.userAgent.toLowerCase().match('mozilla.*rv[:]1\.6.*gecko') ? is_moz1_6 = true : is_moz1_6 = false; |
---|
| 17 | is_ie = false; |
---|
| 18 | is_ie5 = false; |
---|
| 19 | is_mozilla = true; |
---|
| 20 | is_ns4 = false; |
---|
| 21 | } |
---|
| 22 | else if (document.layers) |
---|
| 23 | { |
---|
| 24 | is_ie = false; |
---|
| 25 | is_ie5 = false; |
---|
| 26 | is_moz1_6 = false; |
---|
| 27 | is_mozilla = false; |
---|
| 28 | is_ns4 = true; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | /****************************************** Connector Class *************************************************/ |
---|
| 32 | // Constructor |
---|
| 33 | function cConnector() |
---|
| 34 | { |
---|
| 35 | this.requests = new Array(); |
---|
| 36 | this.oxmlhttp = null; |
---|
| 37 | this.isVisibleBar = false; |
---|
| 38 | this.tid = 0; |
---|
| 39 | this.progressBar = null; |
---|
| 40 | this.oldX = 0; |
---|
| 41 | this.oldY = 0; |
---|
| 42 | }; |
---|
| 43 | |
---|
| 44 | cConnector.prototype.buildBar = function() |
---|
| 45 | { |
---|
| 46 | div = document.getElementById('divProgressBar'); |
---|
| 47 | |
---|
| 48 | if(! div) { |
---|
| 49 | div = document.createElement("DIV"); |
---|
| 50 | div.style.visibility = "hidden"; |
---|
| 51 | div.style.width = "103px"; |
---|
| 52 | div.id = 'divProgressBar'; |
---|
| 53 | div.align = "center"; |
---|
| 54 | div.innerHTML = ' <font face="Verdana" size="2" color="WHITE">'+document.getElementById('txt_loading').value+'...</font> '; |
---|
| 55 | div.style.background = "#cc4444"; |
---|
| 56 | div.style.position = 'fixed'; |
---|
| 57 | div.style.top = '0px'; |
---|
| 58 | div.style.right = '0px'; |
---|
| 59 | document.body.appendChild(div); |
---|
| 60 | div = document.getElementById('divProgressBar'); |
---|
| 61 | |
---|
| 62 | if(is_ie) { |
---|
| 63 | var elem = document.all[div.id]; |
---|
| 64 | elem.style.position="absolute"; |
---|
| 65 | var root = document.body; |
---|
| 66 | var posX = elem.offsetLeft-root.scrollLeft; |
---|
| 67 | var posY = elem.offsetTop-root.scrollTop; |
---|
| 68 | root.onscroll = function() { |
---|
| 69 | //elem.style.left = (posX + root.scrollLeft) + "px"; |
---|
| 70 | elem.style.right = '0px'; |
---|
| 71 | elem.style.top = (posY + root.scrollTop) + "px"; |
---|
| 72 | }; |
---|
| 73 | document.body.insertAdjacentHTML("beforeEnd", '<iframe id="divBlank" src="about:blank" style="position:absolute; visibility:hidden" scrolling="no" frameborder="0"></iframe>'); |
---|
| 74 | |
---|
| 75 | } |
---|
| 76 | |
---|
| 77 | if(debug_controller) { |
---|
| 78 | div = document.createElement("DIV"); |
---|
| 79 | div.style.width = "800px"; |
---|
| 80 | div.style.height= "400px"; |
---|
| 81 | div.id = "debug_controller"; |
---|
| 82 | div.align='right'; |
---|
| 83 | document.body.appendChild(div); |
---|
| 84 | } |
---|
| 85 | } |
---|
| 86 | }; |
---|
| 87 | //------------------------------------ BEGIN: Functions for Connector HTTPRequest -------------------------------------------------// |
---|
| 88 | // Serialize Data Method |
---|
| 89 | cConnector.prototype.serialize = function(data) |
---|
| 90 | { var _thisObject = this; |
---|
| 91 | var f = function(data) |
---|
| 92 | { |
---|
| 93 | var str_data; |
---|
| 94 | |
---|
| 95 | if (data == null || |
---|
| 96 | (typeof(data) == 'string' && data == '')) |
---|
| 97 | { |
---|
| 98 | str_data = 'N;'; |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | else switch(typeof(data)) |
---|
| 102 | { |
---|
| 103 | case 'object': |
---|
| 104 | var arrayCount = 0; |
---|
| 105 | |
---|
| 106 | str_data = ''; |
---|
| 107 | |
---|
| 108 | for (i in data) |
---|
| 109 | { |
---|
| 110 | if (i == 'length') |
---|
| 111 | { |
---|
| 112 | continue; |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | arrayCount++; |
---|
| 116 | switch (typeof(i)) |
---|
| 117 | { |
---|
| 118 | case 'number': |
---|
| 119 | str_data += 'i:' + i + ';' + _thisObject.serialize(data[i]); |
---|
| 120 | break; |
---|
| 121 | |
---|
| 122 | case 'string': |
---|
| 123 | str_data += 's:' + i.length + ':"' + i + '";' + _thisObject.serialize(data[i]); |
---|
| 124 | break; |
---|
| 125 | |
---|
| 126 | default: |
---|
| 127 | showMessage(Element('cc_msg_err_serialize_data_unknown').value); |
---|
| 128 | break; |
---|
| 129 | } |
---|
| 130 | } |
---|
| 131 | |
---|
| 132 | if (!arrayCount) |
---|
| 133 | { |
---|
| 134 | str_data = 'N;'; |
---|
| 135 | } |
---|
| 136 | else |
---|
| 137 | { |
---|
| 138 | str_data = 'a:' + arrayCount + ':{' + str_data + '}'; |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | break; |
---|
| 142 | |
---|
| 143 | case 'string': |
---|
| 144 | str_data = 's:' + data.length + ':"' + data + '";'; |
---|
| 145 | break; |
---|
| 146 | |
---|
| 147 | case 'number': |
---|
| 148 | str_data = 'i:' + data + ';'; |
---|
| 149 | break; |
---|
| 150 | |
---|
| 151 | case 'boolean': |
---|
| 152 | str_data = 'b:' + (data ? '1' : '0') + ';'; |
---|
| 153 | break; |
---|
| 154 | |
---|
| 155 | default: |
---|
| 156 | showMessage(Element('cc_msg_err_serialize_data_unknown').value); |
---|
| 157 | return null; |
---|
| 158 | } |
---|
| 159 | |
---|
| 160 | return str_data; |
---|
| 161 | }; |
---|
| 162 | |
---|
| 163 | var sdata = f(data); |
---|
| 164 | return sdata; |
---|
| 165 | }; |
---|
| 166 | cConnector.prototype.matchBracket = function(strG, iniPosG) |
---|
| 167 | { |
---|
| 168 | _thisObject = this; |
---|
| 169 | var f = function (str, iniPos) |
---|
| 170 | { |
---|
| 171 | var nOpen, nClose = iniPos; |
---|
| 172 | |
---|
| 173 | do |
---|
| 174 | { |
---|
| 175 | nOpen = str.indexOf('{', nClose+1); |
---|
| 176 | nClose = str.indexOf('}', nClose+1); |
---|
| 177 | |
---|
| 178 | if (nOpen == -1) |
---|
| 179 | { |
---|
| 180 | return nClose; |
---|
| 181 | } |
---|
| 182 | |
---|
| 183 | if (nOpen < nClose ) |
---|
| 184 | { |
---|
| 185 | nClose = _thisObject.matchBracket(str, nOpen); |
---|
| 186 | } |
---|
| 187 | |
---|
| 188 | } while (nOpen < nClose); |
---|
| 189 | |
---|
| 190 | return nClose; |
---|
| 191 | }; |
---|
| 192 | |
---|
| 193 | return f(strG, iniPosG); |
---|
| 194 | }; |
---|
| 195 | |
---|
| 196 | |
---|
| 197 | //Unserialize Data Method |
---|
| 198 | cConnector.prototype.unserialize = function(str) |
---|
| 199 | { |
---|
| 200 | |
---|
| 201 | _thisObject = this; |
---|
| 202 | |
---|
| 203 | var f = function (str) |
---|
| 204 | { |
---|
| 205 | switch (str.charAt(0)) |
---|
| 206 | { |
---|
| 207 | case 'a': |
---|
| 208 | |
---|
| 209 | var data = new Array(); |
---|
| 210 | var n = parseInt( str.substring( str.indexOf(':')+1, str.indexOf(':',2) ) ); |
---|
| 211 | var arrayContent = str.substring(str.indexOf('{')+1, str.lastIndexOf('}')); |
---|
| 212 | |
---|
| 213 | for (var i = 0; i < n; i++) |
---|
| 214 | { |
---|
| 215 | var pos = 0; |
---|
| 216 | |
---|
| 217 | /* Process Index */ |
---|
| 218 | var indexStr = arrayContent.substr(pos, arrayContent.indexOf(';')+1); |
---|
| 219 | var index = _thisObject.unserialize(indexStr); |
---|
| 220 | pos = arrayContent.indexOf(';', pos)+1; |
---|
| 221 | |
---|
| 222 | /* Process Content */ |
---|
| 223 | var part = null; |
---|
| 224 | switch (arrayContent.charAt(pos)) |
---|
| 225 | { |
---|
| 226 | case 'a': |
---|
| 227 | var pos_ = _thisObject.matchBracket(arrayContent, arrayContent.indexOf('{', pos))+1; |
---|
| 228 | part = arrayContent.substring(pos, pos_); |
---|
| 229 | pos = pos_; |
---|
| 230 | data[index] = _thisObject.unserialize(part); |
---|
| 231 | break; |
---|
| 232 | |
---|
| 233 | case 's': |
---|
| 234 | var pval = arrayContent.indexOf(':', pos+2); |
---|
| 235 | var val = parseInt(arrayContent.substring(pos+2, pval)); |
---|
| 236 | pos = pval + val + 4; |
---|
| 237 | data[index] = arrayContent.substr(pval+2, val); |
---|
| 238 | break; |
---|
| 239 | |
---|
| 240 | default: |
---|
| 241 | part = arrayContent.substring(pos, arrayContent.indexOf(';', pos)+1); |
---|
| 242 | pos = arrayContent.indexOf(';', pos)+1; |
---|
| 243 | data[index] = _thisObject.unserialize(part); |
---|
| 244 | break; |
---|
| 245 | } |
---|
| 246 | arrayContent = arrayContent.substr(pos); |
---|
| 247 | } |
---|
| 248 | break; |
---|
| 249 | |
---|
| 250 | case 's': |
---|
| 251 | var pos = str.indexOf(':', 2); |
---|
| 252 | var val = parseInt(str.substring(2,pos)); |
---|
| 253 | var data = str.substr(pos+2, val); |
---|
| 254 | str = str.substr(pos + 4 + val); |
---|
| 255 | break; |
---|
| 256 | |
---|
| 257 | case 'i': |
---|
| 258 | ; |
---|
| 259 | case 'd': |
---|
| 260 | var pos = str.indexOf(';'); |
---|
| 261 | var data = parseInt(str.substring(2,pos)); |
---|
| 262 | str = str.substr(pos + 1); |
---|
| 263 | break; |
---|
| 264 | |
---|
| 265 | case 'N': |
---|
| 266 | var data = null; |
---|
| 267 | str = str.substr(str.indexOf(';') + 1); |
---|
| 268 | break; |
---|
| 269 | |
---|
| 270 | case 'b': |
---|
| 271 | var data = str.charAt(2) == '1' ? true : false; |
---|
| 272 | break; |
---|
| 273 | } |
---|
| 274 | |
---|
| 275 | return data; |
---|
| 276 | }; |
---|
| 277 | |
---|
| 278 | return f(str); |
---|
| 279 | }; |
---|
| 280 | |
---|
| 281 | //Create XMLHTTP object Method |
---|
| 282 | cConnector.prototype.createXMLHTTP = function () |
---|
| 283 | { |
---|
| 284 | try |
---|
| 285 | { |
---|
| 286 | this.oxmlhttp = new XMLHttpRequest(); |
---|
| 287 | this.oxmlhttp.overrideMimeType('text/xml'); |
---|
| 288 | } |
---|
| 289 | catch (e) |
---|
| 290 | { |
---|
| 291 | try |
---|
| 292 | { |
---|
| 293 | this.oxmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); |
---|
| 294 | } |
---|
| 295 | catch (e1) |
---|
| 296 | { |
---|
| 297 | try |
---|
| 298 | { |
---|
| 299 | this.oxmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); |
---|
| 300 | } |
---|
| 301 | catch (e2) |
---|
| 302 | { |
---|
| 303 | this.oxmlhttp = null; |
---|
| 304 | } |
---|
| 305 | } |
---|
| 306 | } |
---|
| 307 | |
---|
| 308 | }; |
---|
| 309 | |
---|
| 310 | // Request Constructor Connector |
---|
| 311 | cConnector.prototype.newRequest = function (id, target, method, handler, data) |
---|
| 312 | { |
---|
| 313 | |
---|
| 314 | if (this.requests[id]) { |
---|
| 315 | return false; |
---|
| 316 | } |
---|
| 317 | |
---|
| 318 | this.createXMLHTTP(); |
---|
| 319 | var oxmlhttp = this.oxmlhttp; |
---|
| 320 | var _thisObject = this; |
---|
| 321 | |
---|
| 322 | if (! oxmlhttp) |
---|
| 323 | return false; |
---|
| 324 | |
---|
| 325 | this.requests[id] = oxmlhttp; |
---|
| 326 | this.buildBar(); |
---|
| 327 | this.showProgressBar(); |
---|
| 328 | |
---|
| 329 | var sub_handler = function () |
---|
| 330 | { |
---|
| 331 | var progressBar = _thisObject.progressBar; |
---|
| 332 | |
---|
| 333 | try |
---|
| 334 | { |
---|
| 335 | if (oxmlhttp.readyState == 4 ) |
---|
| 336 | { |
---|
| 337 | |
---|
| 338 | switch (oxmlhttp.status) |
---|
| 339 | { |
---|
| 340 | |
---|
| 341 | case 200: |
---|
| 342 | if (typeof(handler) == 'function') |
---|
| 343 | { |
---|
| 344 | _thisObject.hideProgressBar(); |
---|
| 345 | var data = _thisObject.unserialize(oxmlhttp.responseText); |
---|
| 346 | if(debug_controller) { |
---|
| 347 | document.getElementById("debug_controller").innerHTML += oxmlhttp.responseText; |
---|
| 348 | document.getElementById("debug_controller").innerHTML += "<br>-------------------------------------------------------------------------------------<br>"; |
---|
| 349 | } |
---|
| 350 | handler(data, oxmlhttp); |
---|
| 351 | delete _thisObject.requests[id]; |
---|
| 352 | _thisObject.requests[id] = null; |
---|
| 353 | } |
---|
| 354 | |
---|
| 355 | break; |
---|
| 356 | |
---|
| 357 | case 404: |
---|
| 358 | |
---|
| 359 | alert('Page Not Found!'); |
---|
| 360 | break; |
---|
| 361 | |
---|
| 362 | default: |
---|
| 363 | } |
---|
| 364 | } |
---|
| 365 | } |
---|
| 366 | catch (e) |
---|
| 367 | { |
---|
| 368 | _thisObject.hideProgressBar(); |
---|
| 369 | if(debug_controller) |
---|
| 370 | alert(e+"\n"+oxmlhttp.responseText); |
---|
| 371 | } |
---|
| 372 | |
---|
| 373 | }; |
---|
| 374 | |
---|
| 375 | try |
---|
| 376 | { |
---|
| 377 | |
---|
| 378 | if (method == '' || method == 'GET') |
---|
| 379 | { |
---|
| 380 | oxmlhttp.open("GET",target,true); |
---|
| 381 | if (typeof(handler) == 'function') |
---|
| 382 | { |
---|
| 383 | oxmlhttp.onreadystatechange = sub_handler; |
---|
| 384 | oxmlhttp.send(null); |
---|
| 385 | } |
---|
| 386 | |
---|
| 387 | } |
---|
| 388 | else if (method == 'POST') |
---|
| 389 | { |
---|
| 390 | oxmlhttp.open("POST",target, true); |
---|
| 391 | oxmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); |
---|
| 392 | if (typeof(handler) == 'function') |
---|
| 393 | { |
---|
| 394 | oxmlhttp.onreadystatechange = sub_handler; |
---|
| 395 | oxmlhttp.send(data); |
---|
| 396 | } |
---|
| 397 | |
---|
| 398 | } |
---|
| 399 | } |
---|
| 400 | catch(e) |
---|
| 401 | { |
---|
| 402 | _thisObject.hideProgressBar(); |
---|
| 403 | if(debug_controller) |
---|
| 404 | alert(e); |
---|
| 405 | } |
---|
| 406 | |
---|
| 407 | return true; |
---|
| 408 | }; |
---|
| 409 | // Cancel Request Connector |
---|
| 410 | cConnector.prototype.cancelRequest = function (id) |
---|
| 411 | { |
---|
| 412 | if (!this.requests[id]) |
---|
| 413 | { |
---|
| 414 | return false; |
---|
| 415 | } |
---|
| 416 | |
---|
| 417 | this.requests[id].abort(); |
---|
| 418 | }; |
---|
| 419 | //------------------------------------ END: Functions for Connector HTTPRequest -------------------------------------------------// |
---|
| 420 | |
---|
| 421 | // ----------------------------------- BEGIN: Functions for build Bar Progress ---------------------------------------------------------// |
---|
| 422 | cConnector.prototype.hideProgressBar = function () |
---|
| 423 | { |
---|
| 424 | div = document.getElementById('divProgressBar'); |
---|
| 425 | div.style.visibility = 'hidden'; |
---|
| 426 | |
---|
| 427 | if(is_ie) { |
---|
| 428 | divB = document.getElementById('divBlank'); |
---|
| 429 | divB.style.visibility = 'hidden'; |
---|
| 430 | } |
---|
| 431 | this.isVisibleBar = false; |
---|
| 432 | }; |
---|
| 433 | |
---|
| 434 | cConnector.prototype.showProgressBar = function(){ |
---|
| 435 | div.style.visibility = 'visible'; |
---|
| 436 | |
---|
| 437 | this.isVisibleBar = true; |
---|
| 438 | }; |
---|
| 439 | //------------------------------------ END: Functions for Progress Bar -------------------------------------------------// |
---|
| 440 | |
---|
| 441 | |
---|
| 442 | |
---|
| 443 | // Default Controller File |
---|
| 444 | var DEFAULT_URL = _web_server_url + '/workflow/controller.php?action='; |
---|
| 445 | // connector object |
---|
| 446 | var connector = new cConnector(); |
---|
| 447 | var isExecuteForm = false; |
---|
| 448 | var id = null; |
---|
| 449 | |
---|
| 450 | // Function executes AJAX |
---|
| 451 | // cExecute (url, handler, params) |
---|
| 452 | // url: 'module.class.method' |
---|
| 453 | // handle: function handle() receive response. |
---|
| 454 | // params: parameters for POST method |
---|
| 455 | // form: form element (for upload files) |
---|
| 456 | function cExecute(url, handler, params, form) { |
---|
| 457 | isExecuteForm = false; |
---|
| 458 | if(form) { |
---|
| 459 | cExecuteForm(url, form); |
---|
| 460 | return; |
---|
| 461 | } |
---|
| 462 | |
---|
| 463 | url = DEFAULT_URL + url; |
---|
| 464 | |
---|
| 465 | if(params) |
---|
| 466 | method = "POST"; |
---|
| 467 | |
---|
| 468 | else |
---|
| 469 | method = "GET"; |
---|
| 470 | |
---|
| 471 | id = url; |
---|
| 472 | connector.newRequest(id, url, method, handler, params); |
---|
| 473 | } |
---|
| 474 | |
---|
| 475 | /* |
---|
| 476 | Esta função pode ser utilizada para executar um submit de uma form de forma |
---|
| 477 | transparente para o usuário, de forma que o retorno do submit seja tratado pelo |
---|
| 478 | handler ajax |
---|
| 479 | */ |
---|
| 480 | function cExecuteFormData(url, form, handler){ |
---|
| 481 | connector.buildBar(); |
---|
| 482 | isExecuteForm = true; |
---|
| 483 | connector.showProgressBar(); |
---|
| 484 | if(! (divUpload = document.getElementById('divUpload'))) { |
---|
| 485 | divUpload = document.createElement('DIV'); |
---|
| 486 | divUpload.id = 'divUpload'; |
---|
| 487 | document.body.appendChild(divUpload); |
---|
| 488 | } |
---|
| 489 | |
---|
| 490 | if(! (el = document.getElementById('_form_data'))) { |
---|
| 491 | el = document.createElement('input'); |
---|
| 492 | el.type = 'hidden'; |
---|
| 493 | el.id = '_form_data'; |
---|
| 494 | el.name = '_form_data'; |
---|
| 495 | form.appendChild(el); |
---|
| 496 | } |
---|
| 497 | |
---|
| 498 | form._form_data.value = url; |
---|
| 499 | divUpload.innerHTML= "<iframe onload=\"cExecute('$this.ajax.getLastAjaxResponse',"+handler+");\" style='display:"+(debug_controller ? "" : "none")+";width:"+(debug_controller ? 400 : 0)+";height:"+(debug_controller ? 400 : 0)+";' name='ifrmAjax'></iframe>"; |
---|
| 500 | form.action =_web_server_url + '/workflow/controller.php'; |
---|
| 501 | form.target = 'ifrmAjax'; |
---|
| 502 | form.submit(); |
---|
| 503 | } |
---|
| 504 | |
---|
| 505 | |
---|
| 506 | // This function executes submit values to Controller (POST) |
---|
| 507 | // The return is void. |
---|
| 508 | // cExecuteForm (url, form) |
---|
| 509 | // url: 'module.class.method' |
---|
| 510 | // form: form element (for upload files) |
---|
| 511 | function cExecuteForm(url, form, handler){ |
---|
| 512 | connector.buildBar(); |
---|
| 513 | isExecuteForm = true; |
---|
| 514 | connector.showProgressBar(); |
---|
| 515 | if(! (divUpload = document.getElementById('divUpload'))) { |
---|
| 516 | divUpload = document.createElement('DIV'); |
---|
| 517 | divUpload.id = 'divUpload'; |
---|
| 518 | document.body.appendChild(divUpload); |
---|
| 519 | } |
---|
| 520 | |
---|
| 521 | if(! (el = document.getElementById('_action'))) { |
---|
| 522 | el = document.createElement('input'); |
---|
| 523 | el.type = 'hidden'; |
---|
| 524 | el.id = '_action'; |
---|
| 525 | el.name = '_action'; |
---|
| 526 | form.appendChild(el); |
---|
| 527 | } |
---|
| 528 | |
---|
| 529 | if(countFiles) { |
---|
| 530 | el = document.createElement('input'); |
---|
| 531 | el.type = 'hidden'; |
---|
| 532 | el.name = 'countFiles'; |
---|
| 533 | el.value = countFiles; |
---|
| 534 | form.appendChild(el); |
---|
| 535 | } |
---|
| 536 | |
---|
| 537 | form._action.value = url; |
---|
| 538 | divUpload.innerHTML= "<iframe onload=\"cExecute('$this.functions.getReturnExecuteForm',"+handler+");\" style='display:"+(debug_controller ? "" : "none")+";width:"+(debug_controller ? 400 : 0)+";height:"+(debug_controller ? 400 : 0)+";' name='uploadFile'></iframe>"; |
---|
| 539 | form.action ="controller.php"; |
---|
| 540 | form.target ="uploadFile"; |
---|
| 541 | form.submit(); |
---|
| 542 | } |
---|
| 543 | |
---|
| 544 | |
---|
| 545 | document.onmousedown=alertBut; |
---|
| 546 | |
---|
| 547 | function alertBut( e, evElement ) { |
---|
| 548 | if( !e ) { |
---|
| 549 | if( window.event ) { |
---|
| 550 | //DOM |
---|
| 551 | e = window.event; |
---|
| 552 | } else { |
---|
| 553 | //TOTAL FAILURE, WE HAVE NO WAY OF REFERENCING THE EVENT |
---|
| 554 | return; |
---|
| 555 | } |
---|
| 556 | } |
---|
| 557 | if( typeof( e.which ) == 'number' ) { |
---|
| 558 | //Netscape compatible |
---|
| 559 | e = e.which; |
---|
| 560 | } else { |
---|
| 561 | if( typeof( e.button ) == 'number' ) { |
---|
| 562 | //DOM |
---|
| 563 | e = e.button; |
---|
| 564 | } |
---|
| 565 | else { |
---|
| 566 | //TOTAL FAILURE, WE HAVE NO WAY OF OBTAINING THE BUTTON |
---|
| 567 | return; |
---|
| 568 | } |
---|
| 569 | } |
---|
| 570 | if( !evElement ) { evElement = this; } |
---|
| 571 | |
---|
| 572 | if(isExecuteForm) { |
---|
| 573 | if(confirm("Existe uma ação que ainda está sendo processada. Suspender ação?")) { |
---|
| 574 | connector.hideProgressBar(); |
---|
| 575 | isExecuteForm = false; |
---|
| 576 | delete connector.requests[id]; |
---|
| 577 | connector.requests[id] = null; |
---|
| 578 | stop(); |
---|
| 579 | return; |
---|
| 580 | } |
---|
| 581 | else |
---|
| 582 | return false; |
---|
| 583 | } |
---|
| 584 | |
---|
| 585 | |
---|
| 586 | } |
---|