https://vpass.pcmcindia.gov.in:8443/VisitorToken/resources/org.apa…=E9CB4DB688D1020EA4ED6EEDDF96D567
1 2 3if (Function.prototype.bind == null) { 4Function.prototype.bind = function(object) { 5var __method = this; 6return function() { 7return __method.apply(object, arguments); 8} 9} 10} 11 12if (typeof(Wicket) == "undefined") 13Wicket = { }; 14Wicket.$ = function(arg) { 15if (arg == null || typeof(arg) == "undefined") { 16return null; 17} 18if (arguments.length > 1) { 19var e=[]; 20for (var i=0; i<arguments.length; i++) { 21e.push(Wicket.$(arguments[i])); 22} 23return e; 24} else if (typeof arg == 'string') { 25return document.getElementById(arg); 26} else { 27return arg; 28} 29} 30Wicket.$$ = function(element) { 31if (typeof(element) == "string") { 32element = Wicket.$(element); 33} 34if (element == null || typeof(element) == "undefined" || 35element.tagName == null || typeof(element.tagName) == "undefined") { 36return true; 37} 38var id = element.getAttribute('id'); 39if (typeof(id) == "undefined" || id == null || id == "") 40return element.ownerDocument == document; 41else 42return document.getElementById(id) == element; 43} 44Wicket.isPortlet = function() { 45return Wicket.portlet == true; 46} 47Wicket.emptyFunction = function() { }; 48Wicket.Class = { 49create: function() { 50return function() { 51this.initialize.apply(this, arguments); 52} 53} 54} 55 56if (typeof DOMParser == "undefined" && Wicket.Browser.isSafari()) { 57DOMParser = function () {} 58DOMParser.prototype.parseFromString = function (str, contentType) { 59alert('You are using an old version of Safari.\nTo be able to use this page you need at least version 2.0.1.'); 60} 61} 62 63Wicket.Log = { 64enabled: function() { 65return wicketAjaxDebugEnabled(); 66}, 67info: function(msg) { 68if (Wicket.Log.enabled()) 69WicketAjaxDebug.logInfo(msg); 70}, 71error: function(msg) { 72if (Wicket.Log.enabled()) 73WicketAjaxDebug.logError(msg); 74}, 75log: function(msg) { 76if(Wicket.Log.enabled()) 77WicketAjaxDebug.log(msg); 78} 79}, 80 81Wicket.FunctionsExecuter = Wicket.Class.create(); 82Wicket.FunctionsExecuter.prototype = { 83initialize: function(functions) { 84this.functions = functions; 85this.current = 0; 86this.depth = 0; }, 87processNext: function() { 88if (this.current < this.functions.length) { 89var f = this.functions[this.current]; 90var run = function() { 91f(this.notify.bind(this)); 92}.bind(this); 93this.current++; 94if (this.depth > 50 || Wicket.Browser.isKHTML() || Wicket.Browser.isSafari()) { 95 this.depth = 0; 96window.setTimeout(run, 1); 97} else { 98this.depth ++; 99run(); 100} 101} 102}, 103start: function() { 104this.processNext(); 105}, 106notify: function() { 107this.processNext(); 108} 109} 110Wicket.replaceOuterHtmlIE = function(element, text) { 111 var marker = "__WICKET_JS_REMOVE_X9F4A__"; 112function markIframe(text) { 113var t = text; 114var r = /<\s*iframe/i; 115while ((m = t.match(r)) != null) { 116t = Wicket.replaceAll(t, m[0], "<" + marker + m[0].substring(1)); 117} 118return t; 119} 120function removeIframeMark(text) { 121return Wicket.replaceAll(text, marker, ""); 122} 123if (element.tagName == "SCRIPT") { 124 var tempDiv = document.createElement("div"); 125tempDiv.innerHTML = "<table>
125" + text + "</table>"; 126var script = tempDiv.childNodes[0].childNodes[0].innerHTML; 127element.outerHtml = text; 128try { 129eval(script); 130} catch (e) { 131Wicket.Log.error("Wicket.replaceOuterHtmlIE: " + e + ": eval -> " + script); 132} 133return; 134} 135var parent = element.parentNode; 136var tn = element.tagName; 137var tempDiv = document.createElement("div"); 138var tempParent; 139 var scripts = new Array(); 140if (window.parent == window || window.parent == null) { 141document.body.appendChild(tempDiv); 142} 143if (tn != 'TBODY' && tn != 'TR' && tn != "TD" && tn != "THEAD" && tn != "TFOOT" && tn != "TH") { 144 145 tempDiv.innerHTML = '<table style="display:none">' + markIframe(text) + '</table>'; 146 var s = tempDiv.getElementsByTagName("script"); 147for (var i = 0; i < s.length; ++i) { 148scripts.push(s[i]); 149} 150 tempDiv.innerHTML = '<div style="display:none">' + text + '</div>'; 151 tempParent = tempDiv.childNodes[0]; 152tempParent.parentNode.removeChild(tempParent); 153} else { 154 tempDiv.innerHTML = '<div style="display:none">' + markIframe(text) + '</div>'; 155 var s = tempDiv.getElementsByTagName("script"); 156for (var i = 0; i < s.length; ++i) { 157scripts.push(s[i]); 158} 159 tempDiv.innerHTML = '<table style="display: none">
159' + text + '</table>'; 160 tempParent = tempDiv.getElementsByTagName(tn).item(0).parentNode; 161} 162 while(tempParent.childNodes.length > 0) { 163var tempElement = tempParent.childNodes[0]; 164parent.insertBefore(tempElement, element); 165tempElement = null; 166} 167 if(element.style.backgroundImage) 168element.style.backgroundImage = ""; 169parent.removeChild(element); 170element.outerHTML = ""; 171element = ""; 172if (window.parent == window || window.parent == null) { 173if(tempDiv.style.backgroundImage) 174tempDiv.style.backgroundImage = ""; 175document.body.removeChild(tempDiv); 176} 177tempDiv.outerHTML = ""; 178parent = null; 179tempDiv = null; 180tempParent = null; 181for (i = 0; i < scripts.length; ++i) { 182Wicket.Head.addJavascripts(scripts[i], removeIframeMark); 183} 184} 185Wicket.replaceOuterHtmlSafari = function(element, text) { 186 if (element.tagName == "SCRIPT") { 187 var tempDiv = document.createElement("div"); 188tempDiv.innerHTML = text; 189 var script = tempDiv.childNodes[0].innerHTML; 190if (typeof(script) != "string") { 191script = tempDiv.childNodes[0].text; 192} 193element.outerHTML = text; 194try { 195eval(script); 196} catch (e) { 197Wicket.Log.error("Wicket.replaceOuterHtmlSafari: " + e + ": eval -> " + script); 198} 199return; 200} 201var parent = element.parentNode; 202var next = element.nextSibling; 203var index = 0; 204while (parent.childNodes[index] != element) { 205++index; 206} 207element.outerHTML = text; 208element = parent.childNodes[index]; 209 while (element != next) { 210try { 211Wicket.Head.addJavascripts(element); 212} catch (ignore) { 213} 214element = element.nextSibling; 215} 216} 217 218Wicket.replaceOuterHtml = function(element, text) { 219if (Wicket.Browser.isIE()) { 220Wicket.replaceOuterHtmlIE(element, text); 221} else if (Wicket.Browser.isSafari() || Wicket.Browser.isOpera()) { 222Wicket.replaceOuterHtmlSafari(element, text); 223} else { 224 var range = element.ownerDocument.createRange(); 225range.selectNode(element); 226var fragment = range.createContextualFragment(text); 227element.parentNode.replaceChild(fragment, element); 228} 229} 230 231Wicket.decode = function(encoding, text) { 232if (encoding == "wicket1") { 233return Wicket.decode1(text); 234} 235} 236Wicket.decode1 = function(text) { 237return Wicket.replaceAll(text, "]^", "]"); 238} 239Wicket.replaceAll = function(str, from, to) { 240eval('var regex = /' + from.replace( /\W/g ,'\\$&' ) + '/g ;'); 241return str.replace(regex,to); 242} 243 244Wicket.Form = { } 245Wicket.Form.encode = function(text) { 246if (encodeURIComponent) { 247return encodeURIComponent(text); 248} else { 249return escape(text); 250} 251} 252Wicket.Form.serializeSelect = function(select){ 253 if (select.multiple == false){ 254return Wicket.Form.encode(select.name) + "=" + Wicket.Form.encode(select.value) + "&"; 255} 256 var result = ""; 257for (var i = 0; i < select.options.length; ++i) { 258var option = select.options[i]; 259if (option.selected) { 260result += Wicket.Form.encode(select.name) + "=" + Wicket.Form.encode(option.value) + "&"; 261} 262} 263return result; 264} 265Wicket.Form.serializeInput = function(input) { 266var type = input.type.toLowerCase(); 267if ((type == "checkbox" || type == "radio") && input.checked) { 268return Wicket.Form.encode(input.name) + "=" + Wicket.Form.encode(input.value) + "&"; 269} else if (type == "text" || type == "password" || type == "hidden" || type == "textarea" || type == "search") { 270return Wicket.Form.encode(input.name) + "=" + Wicket.Form.encode(input.value) + "&"; 271} else { 272return ""; 273} 274} 275Wicket.Form.excludeFromAjaxSerialization = {}; 276Wicket.Form.serializeElement = function(e) { 277if (Wicket.Form.excludeFromAjaxSerialization && e.id && Wicket.Form.excludeFromAjaxSerialization[e.id] == "true") { 278return ""; 279} 280var tag = e.tagName.toLowerCase(); 281if (tag == "select") { 282return Wicket.Form.serializeSelect(e); 283} else if (tag == "input" || tag == "textarea") { 284return Wicket.Form.serializeInput(e); 285} else { 286return ""; 287} 288} 289Wicket.Form.doSerialize = function(form) { 290var result = ""; 291for (var i = 0; i < form.elements.length; ++i) { 292var e = form.elements[i]; 293if (e.name && e.name != "" && !e.disabled) { 294result += Wicket.Form.serializeElement(e); 295} 296} 297return result; 298} 299Wicket.Form.serialize = function(element, dontTryToFindRootForm) { 300if (element.tagName.toLowerCase() == "form") { 301return Wicket.Form.doSerialize(element); 302} else { 303 var elementBck = element; 304if (dontTryToFindRootForm != true) { 305do { 306element = element.parentNode; 307} while(element.tagName.toLowerCase() != "form" && element.tagName.toLowerCase() != "body") 308} 309if (element.tagName.toLowerCase() == "form"){ 310 return Wicket.Form.doSerialize(element); 311} else { 312 var form = document.createElement("form"); 313var parent = elementBck.parentNode; 314parent.replaceChild(form, elementBck); 315form.appendChild(elementBck); 316var result = Wicket.Form.doSerialize(form); 317parent.replaceChild(elementBck, form); 318return result 319} 320} 321} 322 323Wicket.DOM = { } 324Wicket.DOM.serializeNodeChildren = function(node) { 325if (node == null) { 326return "" 327} 328var result = ""; 329for (var i = 0; i < node.childNodes.length; i++) { 330var thisNode = node.childNodes[i]; 331switch (thisNode.nodeType) { 332case 1: case 5: result += Wicket.DOM.serializeNode(thisNode); 333break; 334case 8: result += "<!--" + thisNode.nodeValue + "-->"; 335break; 336case 4: result += "<![CDATA[" + thisNode.nodeValue + "]]>"; 337break; 338case 3: case 2: result += thisNode.nodeValue; 339break; 340default: 341break; 342} 343} 344return result; 345} 346Wicket.DOM.serializeNode = function(node){ 347if (node == null) { 348return "" 349} 350var result = ""; 351result += '<' + node.nodeName; 352if (node.attributes && node.attributes.length > 0) { 353for (var i = 0; i < node.attributes.length; i++) { 354result += " " + node.attributes[i].name 355+ "=\"" + node.attributes[i].value + "\""; 356} 357} 358result += '>'; 359result += Wicket.DOM.serializeNodeChildren(node); 360result += '</' + node.nodeName + '>'; 361return result; 362} 363Wicket.DOM.containsElement = function(element) { 364var id = element.getAttribute("id"); 365if (id != null) 366return Wicket.$(id) != null; 367else 368return false;
369} 370 371Wicket.Channel = Wicket.Class.create(); 372Wicket.Channel.prototype = { 373initialize: function(name) { 374var res = name.match(/^([^|]+)\|(d|s)$/) 375if (res == null) 376this.type ='s'; else 377this.type = res[2]; 378this.callbacks = new Array(); 379this.busy = false; 380}, 381schedule: function(callback) { 382if (this.busy == false) { 383this.busy = true; 384return callback(); 385} else { 386Wicket.Log.info("Channel busy - postponing..."); 387if (this.type == 's') this.callbacks.push(callback); 388else 389this.callbacks[0] = callback; 390return null; 391} 392}, 393done: function() { 394var c = null; 395if (this.callbacks.length > 0) { 396c = this.callbacks.shift(); 397} 398if (c != null && typeof(c) != "undefined") { 399Wicket.Log.info("Calling posponed function..."); 400 window.setTimeout(c, 1); 401} else { 402this.busy = false; 403} 404} 405}; 406 407Wicket.ChannelManager = Wicket.Class.create(); 408Wicket.ChannelManager.prototype = { 409initialize: function() { 410this.channels = new Array(); 411}, 412 schedule: function(channel, callback) { 413var c = this.channels[channel]; 414if (c == null) { 415c = new Wicket.Channel(channel); 416this.channels[channel] = c; 417} 418return c.schedule(callback); 419}, 420 done: function(channel) { 421var c = this.channels[channel]; 422if (c != null) 423c.done(); 424} 425}; 426Wicket.channelManager = new Wicket.ChannelManager(); 427 428Wicket.Ajax = { 429 createTransport: function() { 430var transport = null; 431if (window.ActiveXObject) { 432transport = new ActiveXObject("Microsoft.XMLHTTP"); 433Wicket.Log.info("Using ActiveX transport"); 434} else if (window.XMLHttpRequest) { 435transport = new XMLHttpRequest(); 436Wicket.Log.info("Using XMLHttpRequest transport"); 437} 438if (transport == null) { 439Wicket.Log.error("Wicket.Ajax.createTransport: Could not locate ajax transport. Your browser does not support the required XMLHttpRequest object or wicket could not gain access to it."); 440} 441return transport; 442}, 443transports: [], 444 getTransport: function() { 445var t = Wicket.Ajax.transports; 446for (var i = 0; i < t.length; ++i) { 447if (t[i].readyState == 0) { 448return t[i]; 449} 450} 451t.push(Wicket.Ajax.createTransport()); 452return t[t.length-1]; 453}, 454preCallHandlers: [], 455postCallHandlers: [], 456failureHandlers: [], 457registerPreCallHandler: function(handler) { 458var h = Wicket.Ajax.preCallHandlers; 459h.push(handler); 460}, 461registerPostCallHandler: function(handler) { 462var h = Wicket.Ajax.postCallHandlers; 463h.push(handler); 464}, 465registerFailureHandler: function(handler) { 466var h = Wicket.Ajax.failureHandlers; 467h.push(handler); 468}, 469invokePreCallHandlers: function() { 470var h = Wicket.Ajax.preCallHandlers; 471if (h.length > 0) { 472Wicket.Log.info("Invoking pre-call handler(s)..."); 473} 474for (var i = 0; i < h.length; ++i) { 475h[i](); 476} 477}, 478invokePostCallHandlers: function() { 479var h = Wicket.Ajax.postCallHandlers; 480if (h.length > 0) { 481Wicket.Log.info("Invoking post-call handler(s)..."); 482} 483for (var i = 0; i < h.length; ++i) { 484h[i](); 485} 486}, 487invokeFailureHandlers: function() { 488var h = Wicket.Ajax.failureHandlers; 489if (h.length > 0) { 490Wicket.Log.info("Invoking failure handler(s)..."); 491} 492for (var i = 0; i < h.length; ++i) { 493h[i](); 494} 495} 496} 497 498Wicket.Ajax.Request = Wicket.Class.create(); 499Wicket.Ajax.Request.prototype = { 500 initialize: function(url, loadedCallback, parseResponse, randomURL, failureHandler, channel) { 501this.url = url; 502this.loadedCallback = loadedCallback; 503 this.parseResponse = parseResponse != null ? parseResponse : true; 504this.randomURL = randomURL != null ? randomURL : true; 505this.failureHandler = failureHandler != null ? failureHandler : function() { }; 506this.async = true; 507this.channel = channel; 508this.precondition = function() { return true; } 509 this.suppressDone = false; 510this.instance = Math.random(); 511this.debugContent = true; 512}, 513done: function() { 514Wicket.channelManager.done(this.channel); 515}, 516createUrl: function() { 517if (this.randomURL == false) 518return this.url; 519else 520return this.url + (this.url.indexOf("?")>-1 ? "&" : "?") + "random=" + Math.random(); 521}, 522log: function(method, url) { 523var log = Wicket.Log.info; 524log(""); 525log("Initiating Ajax "+method+" request on " + url); 526}, 527failure: function() { 528this.failureHandler(); 529Wicket.Ajax.invokePostCallHandlers(); 530Wicket.Ajax.invokeFailureHandlers(); 531}, 532 get: function() { 533if (Wicket.isPortlet()) { 534 var qs = this.url.indexOf('?'); 535if (qs==-1) { 536qs = this.url.indexOf('&'); 537} 538if (qs>-1) { 539var query = this.url.substring(qs+1); 540 if (query && query.length > 0) { 541 this.url = this.url.substring(0,qs); 542 if (query.charAt(query.length-1)!='&') { 543query += "&"; 544} 545 return this.post(query); 546} 547} 548} 549if (this.channel != null) { 550var res = Wicket.channelManager.schedule(this.channel, this.doGet.bind(this)); 551return res != null ? res : true; 552} else { 553return this.doGet(); 554} 555}, 556 doGet: function() {
557if (this.precondition()) { 558this.transport = Wicket.Ajax.getTransport(); 559var url = this.createUrl(); 560this.log("GET", url); 561Wicket.Ajax.invokePreCallHandlers(); 562var t = this.transport; 563if (t != null) { 564t.open("GET", url, this.async); 565t.onreadystatechange = this.stateChangeCallback.bind(this); 566 t.setRequestHeader("Wicket-Ajax", "true"); 567if (typeof(Wicket.Focus.lastFocusId) != "undefined" && Wicket.Focus.lastFocusId != "" && Wicket.Focus.lastFocusId != null) 568t.setRequestHeader("Wicket-FocusedElementId", Wicket.Focus.lastFocusId); 569t.setRequestHeader("Accept", "text/xml"); 570t.send(null); 571return true; 572} else { 573this.failure(); 574return false; 575} 576} else { 577Wicket.Log.info("Ajax GET stopped because of precondition check, url:" + this.url); 578this.done(); 579return true; 580} 581}, 582 post: function(body) { 583if (this.channel != null) { 584var res = Wicket.channelManager.schedule(this.channel, function() { this.doPost(body); }.bind(this)); 585return res != null ? res: true; 586} else { 587return this.doPost(body); 588} 589}, 590 doPost: function(body) { 591if (this.precondition()) { 592this.transport = Wicket.Ajax.getTransport(); 593var url = this.createUrl(); 594this.log("POST", url); 595Wicket.Ajax.invokePreCallHandlers(); 596var t = this.transport; 597if (t != null) { 598 if (typeof(body) == "function") { 599body = body(); 600} 601t.open("POST", url, this.async); 602t.onreadystatechange = this.stateChangeCallback.bind(this); 603t.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 604 t.setRequestHeader("Wicket-Ajax", "true"); 605if (typeof(Wicket.Focus.lastFocusId) != "undefined" && Wicket.Focus.lastFocusId != "" && Wicket.Focus.lastFocusId != null) 606t.setRequestHeader("Wicket-FocusedElementId", Wicket.Focus.lastFocusId); 607t.setRequestHeader("Accept", "text/xml"); 608t.send(body); 609return true; 610} else { 611this.failure(); 612return false; 613} 614} else { 615Wicket.Log.info("Ajax POST stopped because of precondition check, url:" + this.url); 616this.done(); 617return true; 618} 619}, 620 stateChangeCallback: function() { 621var t = this.transport; 622var status; 623if (t != null && t.readyState == 4) { 624try { 625status = t.status; 626} 627catch (e) { 628Wicket.Log.error("Wicket.Ajax.Request.stateChangeCallback: Exception evaluating AJAX status: " + e); 629status = "unavailable"; 630} 631if (status == 200 || status == "") { var responseAsText = t.responseText; 632 var redirectUrl; 633try { 634redirectUrl = t.getResponseHeader('Ajax-Location'); 635} catch (ignore) { } 636 if (typeof(redirectUrl) != "undefined" && redirectUrl != null && redirectUrl != "") { 637t.onreadystatechange = Wicket.emptyFunction; 638 this.done(); 639 if (redirectUrl.charAt(0)==('/')||redirectUrl.match("^http://")=="http://"||redirectUrl.match("^https://")=="https://") { 640window.location = redirectUrl; 641} 642else { 643var urlDepth = 0; 644while (redirectUrl.substring(0, 3) == "../") { 645urlDepth++; 646redirectUrl = redirectUrl.substring(3); 647} 648 var calculatedRedirect = window.location.pathname; 649while (urlDepth > -1) { 650urlDepth--; 651i = calculatedRedirect.lastIndexOf("/"); 652if (i > -1) { 653calculatedRedirect = calculatedRedirect.substring(0, i); 654} 655} 656calculatedRedirect += "/" + redirectUrl; 657if (Wicket.Browser.isGecko()) { 658 calculatedRedirect = window.location.protocol + "//" + window.location.host + calculatedRedirect; 659} 660window.location = calculatedRedirect; 661} 662} 663else { 664 var log = Wicket.Log.info; 665log("Received ajax response (" + responseAsText.length + " characters)"); 666if (this.debugContent != false) { 667log("\n" + responseAsText); 668} 669 if (this.parseResponse == true) { 670var xmldoc; 671if (typeof(window.XMLHttpRequest) != "undefined" && typeof(DOMParser) != "undefined") { 672var parser = new DOMParser(); 673xmldoc = parser.parseFromString(responseAsText, "text/xml"); 674} else if (window.ActiveXObject) { 675xmldoc = t.responseXML; 676} 677 this.loadedCallback(xmldoc); 678} else { 679 this.loadedCallback(responseAsText); 680} 681if (this.suppressDone == false) 682this.done(); 683} 684} else { 685 var log = Wicket.Log.error; 686log("Received Ajax response with code: " + status); 687if (status == 500) { 688log("500 error had text: " + t.responseText); 689} 690this.done(); 691this.failure(); 692} 693t.onreadystatechange = Wicket.emptyFunction; 694t.abort(); 695this.transport = null; 696} 697} 698}; 699 700Wicket.Ajax.Call = Wicket.Class.create(); 701Wicket.Ajax.Call.prototype = { 702 initialize: function(url, successHandler, failureHandler, channel) { 703this.successHandler = successHandler != null ? successHandler : function() { }; 704this.failureHandler = failureHandler != null ? failureHandler : function() { }; 705var c = channel != null ? channel : "0|s"; this.request = new Wicket.Ajax.Request(url, this.loadedCallback.bind(this), true, true, failureHandler, c); 706this.request.suppressDone = true; 707}, 708 failure: function(message) { 709if (message != null) 710Wicket.Log.error("Wicket.Ajax.Call.failure: Error while parsing response: " + message); 711this.request.done(); 712this.failureHandler(); 713Wicket.Ajax.invokePostCallHandlers(); 714Wicket.Ajax.invokeFailureHandlers(); 715}, 716 call: function() { 717return this.request.get(); 718}, 719 post: function(body) { 720return this.request.post(body); 721}, 722 submitFormById: function(formId, submitButton) { 723var form = Wicket.$(formId); 724if (form == null || typeof (form) == "undefined") 725Wicket.Log.error("Wicket.Ajax.Call.submitFormById: Trying to submit form with id '"+formId+"' that is not in document."); 726return this.submitForm(form, submitButton); 727}, 728 submitForm: function(form, submitButton) { 729if (this.handleMultipart(form, submitButton)) { 730return true; 731} 732var body = function() { 733var s = Wicket.Form.serialize(form); 734if (submitButton != null) { 735s += Wicket.Form.encode(submitButton) + "=1"; 736} 737return s; 738} 739return this.request.post(body); 740}, 741 handleMultipart: function (form, submitButton) { 742var multipart=false; 743 if (form.tagName.toLowerCase() != "form") { 744do { 745 if (multipart==false&&Wicket!=undefined&&Wicket.Forms!=undefined) { 746var meta=Wicket.Forms[form.id]; 747if (meta!=undefined) { 748if (meta["multipart"]!=undefined) { 749multipart=multipart||meta["multipart"]; 750} 751} 752} 753form = form.parentNode; 754} while(form.tagName.toLowerCase() != "form" && form.tagName.toLowerCase() != "body") 755} 756if (form.tagName.toLowerCase() != "form") { 757 return false;
758} 759multipart=multipart||form.enctype=="multipart/form-data"; 760if (multipart==false) { 761 return false; 762} 763var originalFormAction=form.action; 764var originalFormTarget=form.target; 765var originalFormMethod=form.method; 766var originalFormEnctype=form.enctype; 767var iframeName="wicket-submit-"+(""+Math.random()).substr(2); 768try { 769var iframe = document.createElement("<iframe name='"+iframeName+"' id='"+iframeName+"' src='about:blank'/>"); 770} catch (ex) { 771var iframe = document.createElement("iframe"); 772iframe.name=iframeName; 773iframe.id=iframe.name; 774iframe.src="about:blank"; 775} 776iframe.style.display="none"; 777iframe.style.visibility="hidden"; 778Wicket.Event.add(iframe, "load", this.handleMultipartComplete.bind(this)); 779document.body.appendChild(iframe); 780 form.target=iframe.name; 781form.action=this.request.url + "&wicket:ajax=true"; 782form.method="post"; 783form.enctype="multipart/form-data"; 784 if (submitButton!=null) { 785try { 786var btn = document.createElement("<input type='hidden' name='"+submitButton+"' id='"+iframe.id+"-btn' value='1'/>"); 787} catch (ex) { 788var btn = document.createElement("input"); 789btn.type="hidden"; 790btn.name=submitButton; 791btn.id=iframe.id+"-btn"; 792btn.value="1"; 793} 794form.appendChild(btn); 795} 796 form.submit(); 797 form.action=originalFormAction; 798form.target=originalFormTarget; 799form.method=originalFormMethod; 800form.enctype=originalFormEnctype; 801return true; 802}, 803 handleMultipartComplete: function (event) { 804if (event==null) { event=window.event; } 805if (event.target!=null) { 806var iframe=event.target; 807} else { 808var iframe=event.srcElement 809}; 810var envelope=iframe.contentWindow.document; 811if (envelope.XMLDocument!=null) { envelope=envelope.XMLDocument; } 812 this.loadedCallback(envelope); 813 if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble=true; } 814 if (iframe.detachEvent) 815iframe.detachEvent("onload", this.handleMultipartComplete); 816else 817iframe.removeEventListener("load", this.handleMultipartComplete, false); 818 setTimeout(function() { 819var e=document.getElementById(iframe.id+"-btn"); 820if (e!=null) { 821e.parentNode.removeChild(e); 822} 823iframe.parentNode.removeChild(iframe); 824}, 250); 825}, 826 loadedCallback: function(envelope) { 827 try { 828var root = envelope.getElementsByTagName("ajax-response")[0]; 829 if (root == null || root.tagName != "ajax-response") { 830this.failure("Could not find root <ajax-response> element"); 831return; 832} 833 var steps = new Array(); 834 steps.push(function(notify) { 835window.setTimeout(notify,2); 836}.bind(this)); 837if (Wicket.Browser.isKHTML()) { 838 steps.push = function(method) { 839method(function() { }); 840} 841} 842 var stepIndexOfLastReplacedComponent = -1; 843for (var i = 0; i < root.childNodes.length; ++i) { 844var node = root.childNodes[i]; 845if (node.tagName == "component") { 846if (stepIndexOfLastReplacedComponent == -1) { 847this.processFocusedComponentMark(steps); 848} 849stepIndexOfLastReplacedComponent = steps.length; 850this.processComponent(steps, node); 851} else if (node.tagName == "evaluate") { 852this.processEvaluation(steps, node); 853} else if (node.tagName == "header-contribution") { 854this.processHeaderContribution(steps, node); 855} else if (node.tagName == "redirect") { 856this.processRedirect(steps, node); 857} 858} 859if (stepIndexOfLastReplacedComponent != -1) { 860this.processFocusedComponentReplaceCheck(steps, stepIndexOfLastReplacedComponent); 861} 862 this.success(steps); 863if (Wicket.Browser.isKHTML() == false) { 864Wicket.Log.info("Response parsed. Now invoking steps..."); 865var executer = new Wicket.FunctionsExecuter(steps); 866executer.start(); 867} 868} catch (e) { 869this.failure(e.message); 870} 871}, 872 success: function(steps) { 873steps.push(function(notify) { 874Wicket.Log.info("Response processed successfully."); 875Wicket.Ajax.invokePostCallHandlers(); 876 Wicket.Focus.attachFocusEvent(); 877this.request.done(); 878this.successHandler(); 879 setTimeout("Wicket.Focus.requestFocus();", 0); 880 notify(); 881}.bind(this)); 882}, 883 processComponent: function(steps, node) { 884steps.push(function(notify) { 885 var compId = node.getAttribute("id"); 886var text=""; 887 if (node.hasChildNodes()) { 888text = node.firstChild.nodeValue; 889} 890 var encoding = node.getAttribute("encoding"); 891if (encoding != null && encoding!="") { 892text = Wicket.decode(encoding, text); 893} 894 var element = Wicket.$(compId); 895if (element == null || typeof(element) == "undefined") { 896Wicket.Log.error("Wicket.Ajax.Call.processComponent: Component with id [["+compId+"]] a was not found while trying to perform markup update. Make sure you called component.setOutputMarkupId(true) on the component whose markup you are trying to update."); 897} else { 898 Wicket.replaceOuterHtml(element, text); 899} 900 notify(); 901}); 902}, 903 processEvaluation: function(steps, node) { 904steps.push(function(notify) { 905 var text = node.firstChild.nodeValue; 906 var encoding = node.getAttribute("encoding"); 907if (encoding != null) { 908text = Wicket.decode(encoding, text); 909} 910 var res = text.match(new RegExp("^([a-z|A-Z_][a-z|A-Z|0-9_]*)\\|((.|\\n
910)*)$")); 911if (res != null) { 912text = "var f = function(" + res[1] + ") {" + res[2] +"};"; 913try { 914 eval(text); 915f(notify); 916} catch (exception) { 917Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: " + exception); 918} 919} else { 920 try { 921 eval(text); 922} catch (exception) { 923Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception evaluating javascript: " + exception); 924} 925 notify(); 926} 927}); 928}, 929 processHeaderContribution: function(steps, node) { 930var c = new Wicket.Head.Contributor(); 931c.processContribution(steps, node); 932}, 933 processRedirect: function(steps, node) { 934var text = node.firstChild.nodeValue; 935Wicket.Log.info("Redirecting to: "+text); 936window.location=text; 937}, 938 processFocusedComponentMark: function(steps) { 939steps.push(function(notify) { 940Wicket.Focus.markFocusedComponent(); 941 notify(); 942}); 943}, 944 processFocusedComponentReplaceCheck: function(steps, lastReplaceComponentStep) { 945 steps.splice(lastReplaceComponentStep + 1, 0, function(notify) { 946Wicket.Focus.checkFocusedComponentReplaced(); 947 notify(); 948}); 949} 950}; 951 952Wicket.Head = { }; 953Wicket.Head.Contributor = Wicket.Class.create(); 954Wicket.Head.Contributor.prototype = { 955initialize: function() { 956}, 957 parse: function(headerNode) { 958 959 var text = headerNode.firstChild.nodeValue; 960var encoding = headerNode.getAttribute("encoding"); 961if (encoding != null && encoding != "") { 962text = Wicket.decode(encoding, text); 963} 964if (Wicket.Browser.isKHTML()) { 965 text = text.replace(/<script/g,"<SCRIPT"); 966text = text.replace(/<\/script>/g,"</SCRIPT>"); 967} 968 var xmldoc; 969if (window.ActiveXObject) { 970xmldoc = new ActiveXObject("Microsoft.XMLDOM"); 971if (!xmldoc.loadXML(text)) { 972Wicket.Log.error("Error parsing response: "+text); 973} 974} else { 975var parser = new DOMParser(); 976xmldoc = parser.parseFromString(text, "text/xml"); 977} 978return xmldoc; 979}, 980 processContribution: function(steps, headerNode) { 981var xmldoc = this.parse(headerNode); 982var rootNode = xmldoc.documentElement; 983 for (var i = 0; i < rootNode.childNodes.length; i++) { 984var node = rootNode.childNodes[i]; 985if (node.tagName != null) { 986var name = node.tagName.toLowerCase(); 987 if (name == "wicket:link") { 988for (var j = 0; j < node.childNodes.length; ++j) { 989var childNode = node.childNodes[j]; 990 if (childNode.nodeType == 1) { 991node = childNode;
992name = node.tagName.toLowerCase(); 993break; 994} 995} 996} 997 if (name == "link") { 998this.processLink(steps, node); 999} else if (name == "script") { 1000this.processScript(steps, node); 1001} else if (name == "style") { 1002this.processStyle(steps, node); 1003} 1004} 1005} 1006}, 1007 processLink: function(steps, node) { 1008steps.push(function(notify) { 1009 if (Wicket.Head.containsElement(node, "href")) { 1010notify(); 1011return; 1012} 1013 var css = Wicket.Head.createElement("link"); 1014 css.id = node.getAttribute("id"); 1015css.rel = node.getAttribute("rel"); 1016css.href = node.getAttribute("href"); 1017css.type = node.getAttribute("type"); 1018 Wicket.Head.addElement(css); 1019 notify(); 1020}); 1021}, 1022 processStyle: function(steps, node) { 1023steps.push(function(notify) { 1024 if (Wicket.DOM.containsElement(node)) { 1025notify(); 1026return; 1027} 1028 var content = Wicket.DOM.serializeNodeChildren(node); 1029 var style = Wicket.Head.createElement("style"); 1030 style.id = node.getAttribute("id"); 1031 if (Wicket.Browser.isIE()) { 1032try { 1033document.createStyleSheet().cssText = content; 1034} 1035catch(ignore) { 1036var run = function() { 1037try { 1038document.createStyleSheet().cssText = content; 1039} 1040catch(e) { 1041Wicket.Log.error("Wicket.Head.Contributor.processStyle: " + e); 1042} 1043} 1044window.setTimeout(run, 1); 1045} 1046} else { 1047var textNode = document.createTextNode(content); 1048style.appendChild(textNode); 1049} 1050Wicket.Head.addElement(style); 1051 notify(); 1052}); 1053}, 1054 processScript: function(steps, node) { 1055steps.push(function(notify) { 1056 if (Wicket.DOM.containsElement(node) || 1057Wicket.Head.containsElement(node, "src")) { 1058notify(); 1059return; 1060} 1061 var src = node.getAttribute("src"); 1062if (src != null && src != "") { 1063 1064 var onLoad = function(content) { 1065Wicket.Head.addJavascript(content, null, src); 1066Wicket.Ajax.invokePostCallHandlers(); 1067 notify(); 1068} 1069 window.setTimeout(function() { 1070var req = new Wicket.Ajax.Request(src, onLoad, false, false); 1071req.debugContent = false; 1072if (Wicket.Browser.isKHTML()) 1073 req.async = false; 1074 req.get(); 1075},1); 1076} else { 1077 var text = Wicket.DOM.serializeNodeChildren(node); 1078 text = text.replace(/^<!--\/\*--><!\[CDATA\[\/\*><!--\*\//, ""); 1079text = text.replace(/\/\*-->]]>\*\/$/, ""); 1080var id = node.getAttribute("id"); 1081if (typeof(id) == "string" && id.length > 0) { 1082 Wicket.Head.addJavascript(text, id); 1083} else { 1084try { 1085eval(text); 1086} catch (e) { 1087Wicket.Log.error("Wicket.Head.Contributor.processScript: " + e + ": eval -> " + text); 1088} 1089} 1090 notify(); 1091} 1092}); 1093} 1094}; 1095 1096Wicket.Head.createElement = function(name) { 1097return document.createElement(name); 1098} 1099Wicket.Head.addElement = function(element) { 1100var head = document.getElementsByTagName("head"); 1101if (head[0]) { 1102head[0].appendChild(element); 1103} 1104} 1105Wicket.Head.containsElement = function(element, mandatoryAttribute) { 1106var attr = element.getAttribute(mandatoryAttribute); 1107if (attr == null || attr == "" || typeof(attr) == "undefined") 1108return false; 1109var head = document.getElementsByTagName("head")[0]; 1110if (element.tagName == "script") 1111head = document; 1112var nodes = head.getElementsByTagName(element.tagName); 1113for (var i = 0; i < nodes.length; ++i) { 1114var node = nodes[i]; 1115 if (node.tagName.toLowerCase() == element.tagName.toLowerCase() && 1116(node.getAttribute(mandatoryAttribute) == attr || 1117node.getAttribute(mandatoryAttribute+"_") == attr)) { 1118return true; 1119} 1120} 1121return false; 1122} 1123Wicket.Head.addJavascript = function(content, id, fakeSrc) { 1124var script = Wicket.Head.createElement("script"); 1125script.id = id; 1126script.setAttribute("src_", fakeSrc); 1127 if (null == script.canHaveChildren || script.canHaveChildren) { 1128var textNode = document.createTextNode(content); 1129script.appendChild(textNode); 1130} else { 1131script.text = content; 1132} 1133Wicket.Head.addElement(script); 1134} 1135Wicket.Head.addJavascripts = function(element, contentFilter) { 1136function add(element) { 1137var src = element.getAttribute("src"); 1138 if (src != null && src.length > 0) { 1139var e = document.createElement("script"); 1140e.setAttribute("type","text/javascript"); 1141e.setAttribute("src", src); 1142Wicket.Head.addElement(e); 1143} else { 1144var content = Wicket.DOM.serializeNodeChildren(element); 1145if (content == null || content == "") 1146content = element.text; 1147if (typeof(contentFilter) == "function") { 1148content = contentFilter(content); 1149} 1150Wicket.Head.addJavascript(content); 1151} 1152} 1153if (typeof(element) != "undefined" && 1154typeof(element.tagName) != "undefined" && 1155element.tagName.toLowerCase() == "script") { 1156add(element); 1157} else { 1158 if (element.childNodes.length > 0) { 1159var scripts = element.getElementsByTagName("script"); 1160for (var i = 0; i < scripts.length; ++i) { 1161add(scripts[i]); 1162} 1163} 1164} 1165} 1166 1167Wicket.ThrottlerEntry = Wicket.Class.create(); 1168Wicket.ThrottlerEntry.prototype = { 1169initialize: function(func) { 1170this.func = func; 1171this.timestamp = new Date().getTime(); 1172this.timeoutVar = undefined; 1173}, 1174getTimestamp: function() { 1175return this.timestamp; 1176}, 1177getFunc: function() { 1178return this.func; 1179}, 1180setFunc: function(func) { 1181this.func = func; 1182}, 1183getTimeoutVar: function() { 1184return this.timeoutVar; 1185}, 1186setTimeoutVar: function(timeoutVar) { 1187this.timeoutVar = timeoutVar; 1188} 1189}; 1190Wicket.Throttler = Wicket.Class.create(); 1191Wicket.Throttler.prototype = { 1192 1193initialize: function(postponeTimerOnUpdate) { 1194this.entries = new Array(); 1195if (postponeTimerOnUpdate != undefined) 1196this.postponeTimerOnUpdate = postponeTimerOnUpdate; 1197else 1198this.postponeTimerOnUpdate = false;
1199}, 1200throttle: function(id, millis, func) { 1201var entry = this.entries[id]; 1202var me = this; 1203if (entry == undefined) { 1204entry = new Wicket.ThrottlerEntry(func); 1205entry.setTimeoutVar(window.setTimeout(function() { me.execute(id); }, millis)); 1206this.entries[id] = entry; 1207} else { 1208entry.setFunc(func); 1209if (this.postponeTimerOnUpdate == true) 1210{ 1211window.clearTimeout(entry.getTimeoutVar()); 1212entry.setTimeoutVar(window.setTimeout(function() { me.execute(id); }, millis)); 1213} 1214} 1215}, 1216execute: function(id) { 1217var entry = this.entries[id]; 1218if (entry != undefined) { 1219var func = entry.getFunc(); 1220this.entries[id] = undefined; 1221var tmp = func(); 1222} 1223} 1224}; 1225Wicket.throttler = new Wicket.Throttler(); 1226 1227Wicket.stopEvent = function(e) { 1228e=Wicket.fixEvent(e); 1229e.cancelBubble = true; 1230if (e.stopPropagation) 1231e.stopPropagation(); 1232} 1233 1234Wicket.fixEvent = function(e) { 1235if (typeof e == 'undefined') 1236e = window.event; 1237return e; 1238} 1239 1240Wicket.Drag = { 1241 1242init: function(element, onDragBegin, onDragEnd, onDrag) { 1243if (typeof(onDragBegin) == "undefined") 1244onDragBegin = Wicket.emptyFunction; 1245if (typeof(onDragEnd) == "undefined") 1246onDragEnd = Wicket.emptyFunction; 1247if (typeof(onDrag) == "undefined") 1248onDrag = Wicket.emptyFunction; 1249element.wicketOnDragBegin = onDragBegin; 1250element.wicketOnDrag = onDrag; 1251element.wicketOnDragEnd = onDragEnd; 1252 Wicket.Event.add(element, "mousedown", Wicket.Drag.mouseDownHandler); 1253}, 1254mouseDownHandler: function(e) { 1255e = Wicket.fixEvent(e); 1256var element = this; 1257 if (typeof(e.ignore) == "undefined") { 1258Wicket.stopEvent(e); 1259if (e.preventDefault) { 1260e.preventDefault(); 1261} 1262element.wicketOnDragBegin(element); 1263element.lastMouseX = e.clientX; 1264element.lastMouseY = e.clientY; 1265element.old_onmousemove = document.onmousemove; 1266element.old_onmouseup = document.onmouseup; 1267element.old_onselectstart = document.onselectstart; 1268element.old_onmouseout = document.onmouseout; 1269document.onselectstart = function() { return false; } 1270document.onmousemove = Wicket.Drag.mouseMove; 1271document.onmouseup = Wicket.Drag.mouseUp; 1272document.onmouseout = Wicket.Drag.mouseOut; 1273Wicket.Drag.current = element; 1274return false; 1275} 1276}, 1277 1278clean: function(element) { 1279element.onmousedown = null; 1280}, 1281 1282mouseMove: function(e) { 1283e = Wicket.fixEvent(e); 1284var o = Wicket.Drag.current; 1285 if (e.clientX < 0 || e.clientY < 0) { 1286return; 1287} 1288if (o != null) { 1289var deltaX = e.clientX - o.lastMouseX; 1290var deltaY = e.clientY - o.lastMouseY; 1291var res = o.wicketOnDrag(o, deltaX, deltaY, e); 1292if (res == null) 1293res = [0, 0]; 1294o.lastMouseX = e.clientX + res[0]; 1295o.lastMouseY = e.clientY + res[1]; 1296} 1297return false; 1298}, 1299 1300mouseUp: function(e) { 1301e = Wicket.fixEvent(e); 1302var o = Wicket.Drag.current; 1303if (o != null && typeof(o) != "undefined") { 1304o.wicketOnDragEnd(o); 1305o.lastMouseX = null; 1306o.lastMouseY = null; 1307document.onmousemove = o.old_onmousemove; 1308document.onmouseup = o.old_onmouseup; 1309document.onselectstart = o.old_onselectstart; 1310document.onmouseout = o.old_onmouseout; 1311o.old_mousemove = null; 1312o.old_mouseup = null; 1313o.old_onselectstart = null; 1314o.old_onmouseout = null; 1315Wicket.Drag.current = null; 1316} 1317}, 1318 1319mouseOut: function(e) { 1320if (false && Wicket.Browser.isGecko()) { 1321 e = Wicket.fixEvent(e); 1322if (e.target.tagName == "HTML") { 1323Wicket.Drag.mouseUp(e); 1324} 1325} 1326} 1327}; 1328Wicket.ChangeHandler=function(elementId){ 1329var KEY_BACKSPACE=8; 1330var KEY_TAB=9; 1331var KEY_ENTER=13; 1332var KEY_ESC=27; 1333var KEY_LEFT=37; 1334var KEY_UP=38; 1335var KEY_RIGHT=39; 1336var KEY_DOWN=40; 1337var KEY_SHIFT=16; 1338var KEY_CTRL=17; 1339var KEY_ALT=18; 1340var obj = Wicket.$(elementId); 1341obj.setAttribute("autocomplete", "off"); 1342if (Wicket.Browser.isIE() || Wicket.Browser.isKHTML() || Wicket.Browser.isSafari()) { 1343var objonchange = obj.onchange; 1344obj.onkeyup = function(event) { 1345switch (wicketKeyCode(Wicket.fixEvent(event))) { 1346case KEY_ENTER: 1347case KEY_UP: 1348case KEY_DOWN: 1349case KEY_ESC: 1350case KEY_TAB: 1351case KEY_RIGHT: 1352case KEY_LEFT: 1353case KEY_SHIFT: 1354case KEY_ALT: 1355case KEY_CTRL: 1356return Wicket.stopEvent(event); 1357break; 1358default: 1359if (typeof objonchange == "function")objonchange(); 1360} 1361return null; 1362} 1363obj.onpaste = function(event) { 1364if (typeof objonchange == "function"){ 1365setTimeout(function() { 1366objonchange(); 1367}, 10); 1368} 1369return null; 1370} 1371obj.oncut = function(event) { 1372if (typeof objonchange == "function"){ 1373setTimeout(function() { 1374objonchange(); 1375}, 10); 1376} 1377return null; 1378} 1379} else { 1380obj.addEventListener('input', obj.onchange, true); 1381} 1382obj.onchange = function(event) { 1383Wicket.stopEvent(event); 1384} 1385} 1386 1387var wicketThrottler = Wicket.throttler; 1388function wicketAjaxGet(url, successHandler, failureHandler, precondition, channel) { 1389var call = new Wicket.Ajax.Call(url, successHandler, failureHandler, channel); 1390if (typeof(precondition) != "undefined" && precondition != null) { 1391call.request.precondition = precondition; 1392} 1393return call.call(); 1394} 1395function wicketAjaxPost(url, body, successHandler, failureHandler, precondition, channel) { 1396var call = new Wicket.Ajax.Call(url, successHandler, failureHandler, channel); 1397if (typeof(precondition) != "undefined" && precondition != null) { 1398call.request.precondition = precondition; 1399} 1400return call.post(body); 1401} 1402function wicketSubmitForm(form, url, submitButton, successHandler, failureHandler, precondition, channel) { 1403var call = new Wicket.Ajax.Call(url, successHandler, failureHandler, channel); 1404if (typeof(precondition) != "undefined" && precondition != null) { 1405call.request.precondition = precondition; 1406} 1407return call.submitForm(form, submitButton); 1408} 1409function wicketSubmitFormById(formId, url, submitButton, successHandler, failureHandler, precondition, channel) { 1410var call = new Wicket.Ajax.Call(url, successHandler, failureHandler, channel); 1411if (typeof(precondition) != "undefined" && precondition != null) { 1412call.request.precondition = precondition; 1413} 1414return call.submitFormById(formId, submitButton); 1415} 1416wicketSerialize = Wicket.Form.serializeElement; 1417wicketSerializeForm = Wicket.Form.serialize; 1418wicketEncode = Wicket.Form.encode; 1419wicketDecode = Wicket.decode; 1420wicketAjaxGetTransport = Wicket.Ajax.getTransport; 1421 1422Wicket.Ajax.registerPreCallHandler(function() { 1423if (typeof(window.wicketGlobalPreCallHandler) != "undefined") { 1424var global=wicketGlobalPreCallHandler; 1425if (global!=null) { 1426global(); 1427} 1428} 1429}); 1430Wicket.Ajax.registerPostCallHandler(function() { 1431if (typeof(window.wicketGlobalPostCallHandler) != "undefined") { 1432var global=wicketGlobalPostCallHandler; 1433if (global!=null) { 1434global(); 1435} 1436} 1437}); 1438Wicket.Ajax.registerFailureHandler(function() { 1439if (typeof(window.wicketGlobalFailureHandler) != "undefined") { 1440var global=wicketGlobalFailureHandler; 1441if (global!=null) { 1442global(); 1443} 1444} 1445}); 1446 1447Wicket.Focus = { 1448lastFocusId : "", 1449refocusLastFocusedComponentAfterResponse : false, 1450focusSetFromServer : false, 1451setFocus: function(event) 1452{ 1453event = Wicket.fixEvent(event); 1454 var target = event.target ? event.target : event.srcElement; 1455if (target) { 1456Wicket.Focus.refocusLastFocusedComponentAfterResponse = false;
1457Wicket.Focus.lastFocusId=target.id; 1458Wicket.Log.info("focus set on " + Wicket.Focus.lastFocusId); 1459} 1460}, 1461blur: function(event) 1462{ 1463event = Wicket.fixEvent(event); 1464 var target = event.target ? event.target : event.srcElement; 1465if (target && Wicket.Focus.lastFocusId==target.id) { 1466if (Wicket.Focus.refocusLastFocusedComponentAfterResponse) { 1467 Wicket.Log.info("focus removed from " + target.id + " but ignored because of component replacement"); 1468} else { 1469Wicket.Focus.lastFocusId=null; 1470Wicket.Log.info("focus removed from " + target.id); 1471} 1472} 1473}, 1474getFocusedElement: function() 1475{ 1476if (typeof(Wicket.Focus.lastFocusId) != "undefined" && Wicket.Focus.lastFocusId != "" && Wicket.Focus.lastFocusId != null) 1477{ 1478Wicket.Log.info("returned focused element: " + Wicket.$(Wicket.Focus.lastFocusId)); 1479return Wicket.$(Wicket.Focus.lastFocusId); 1480} 1481return; 1482}, 1483setFocusOnId: function(id) 1484{ 1485if (typeof(id) != "undefined" && id != "" && id != null) { 1486Wicket.Focus.refocusLastFocusedComponentAfterResponse = true; 1487Wicket.Focus.focusSetFromServer = true; 1488Wicket.Focus.lastFocusId=id; 1489Wicket.Log.info("focus set on " + Wicket.Focus.lastFocusId + " from serverside"); 1490} else { 1491Wicket.Focus.refocusLastFocusedComponentAfterResponse = false; 1492Wicket.Log.info("refocus focused component after request stopped from serverside"); 1493} 1494}, 1495 markFocusedComponent: function() 1496{ 1497var focusedElement = Wicket.Focus.getFocusedElement(); 1498if (typeof(focusedElement) != "undefined" && focusedElement != null) { 1499focusedElement.wasFocusedBeforeComponentReplacements = true; Wicket.Focus.refocusLastFocusedComponentAfterResponse = true; 1500Wicket.Focus.focusSetFromServer = false; 1501} else { 1502Wicket.Focus.refocusLastFocusedComponentAfterResponse = false; 1503} 1504}, 1505 checkFocusedComponentReplaced: function() 1506{ 1507var focusedElement = Wicket.Focus.getFocusedElement(); 1508if (Wicket.Focus.refocusLastFocusedComponentAfterResponse == true) 1509{ 1510if (typeof(focusedElement) != "undefined" && focusedElement != null) { 1511if (typeof(focusedElement.wasFocusedBeforeComponentReplacements) != "undefined") 1512{ 1513 Wicket.Focus.refocusLastFocusedComponentAfterResponse = false; 1514} 1515} else { 1516 Wicket.Focus.refocusLastFocusedComponentAfterResponse = false; 1517Wicket.Focus.lastFocusId = ""; 1518} 1519} 1520}, 1521requestFocus: function() 1522{ 1523 if (Wicket.Focus.refocusLastFocusedComponentAfterResponse && typeof(Wicket.Focus.lastFocusId) != "undefined" && Wicket.Focus.lastFocusId != "" && Wicket.Focus.lastFocusId != null) 1524{ 1525var toFocus = Wicket.$(Wicket.Focus.lastFocusId); 1526if (toFocus != null && typeof(toFocus) != "undefined") { 1527Wicket.Log.info("Calling focus on " + Wicket.Focus.lastFocusId); 1528try { 1529if (Wicket.Focus.focusSetFromServer) { 1530toFocus.focus(); 1531} else { 1532 var temp = toFocus.onfocus; 1533toFocus.onfocus = null; 1534toFocus.focus(); 1535setTimeout(function() { toFocus.onfocus = temp; }, 0); } 1536} catch (ignore) { 1537} 1538} 1539else 1540{ 1541Wicket.Focus.lastFocusId = ""; 1542Wicket.Log.info("Couldn't set focus on " + Wicket.Focus.lastFocusId + " not on the page anymore"); 1543} 1544} 1545else if (Wicket.Focus.refocusLastFocusedComponentAfterResponse) 1546{ 1547Wicket.Log.info("last focus id was not set"); 1548} 1549else 1550{ 1551Wicket.Log.info("refocus last focused component not needed/allowed"); 1552} 1553Wicket.Focus.refocusLastFocusedComponentAfterResponse = false; 1554}, 1555setFocusOnElements: function (elements) 1556{ 1557 var len=elements.length; 1558for (var i=0; i< len; i++) 1559{ 1560if (elements[i].wicketFocusSet != true) 1561{ 1562Wicket.Event.add(elements[i],'focus',Wicket.Focus.setFocus); 1563Wicket.Event.add(elements[i],'blur',Wicket.Focus.blur); 1564elements[i].wicketFocusSet = true; 1565} 1566} 1567}, 1568attachFocusEvent: function() 1569{ 1570Wicket.Focus.setFocusOnElements(document.getElementsByTagName("input")); 1571Wicket.Focus.setFocusOnElements(document.getElementsByTagName("select")); 1572Wicket.Focus.setFocusOnElements(document.getElementsByTagName("textarea")); 1573Wicket.Focus.setFocusOnElements(document.getElementsByTagName("button")); 1574Wicket.Focus.setFocusOnElements(document.getElementsByTagName("a")); 1575} 1576} 1577Wicket.Event.addDomReadyEvent(Wicket.Focus.attachFocusEvent); 1578function wicketAjaxDebugEnabled() { 1579if (typeof(wicketAjaxDebugEnable)=="undefined") { 1580return false; 1581} else { 1582return wicketAjaxDebugEnable==true; 1583} 1584} 1585function wicketKeyCode(event) { 1586if (typeof(event.keyCode)=="undefined") { 1587return event.which; 1588} else { 1589return event.keyCode; 1590} 1591} 1592function wicketGet(id) { 1593return Wicket.$(id); 1594} 1595function wicketShow(id) { 1596var e=wicketGet(id); 1597if (e!=null) { 1598e.style.display = ""; 1599} 1600} 1601function wicketHide(id) { 1602var e=wicketGet(id); 1603if (e!=null) { 1604e.style.display = "none"; 1605} 1606}
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.