/*jslint nomen: false, evil: false, browser: true, eqeqeq: false, white: false, undef: false */ /* Oracle Database Application Express, Release 3.1 B32468-02 Copyright © 2003, 2008, Oracle. All rights reserved. Primary Author: Carl Backstrom The Programs (which include both the software and documentation) contain proprietary information; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent, and other intellectual and industrial property laws. Reverse engineering, disassembly, or decompilation of the Programs, except to the extent required to obtain interoperability with other independently created software or as specified by law, is prohibited. The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. This document is not warranted to be error-free. Except as may be expressly permitted in your license agreement for these Programs, no part of these Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose. If the Programs are delivered to the United States Government or anyone licensing or using the Programs on behalf of the United States Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the Programs, including documentation and technical data, shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement, and, to the extent applicable, the additional rights set forth in FAR 52.227-19, Commercial Computer Software--Restricted Rights (June 1987). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065. The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup, redundancy and other measures to ensure the safe use of such applications if the Programs are used for such purposes, and we disclaim liability for any damages caused by such use of the Programs. Oracle, JD Edwards, PeopleSoft, and Siebel are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. The Programs may provide links to Web sites and access to content, products, and services from third parties. Oracle is not responsible for the availability of, or any content provided on, third-party Web sites. You bear all risks associated with the use of such content. If you choose to purchase any products or services from a third party, the relationship is directly between you and the third party. Oracle is not responsible for: (a) the quality of third-party products or services; or (b) fulfilling any of the terms of the agreement with the third party, including delivery of products or services and warranty obligations related to purchased products or services. Oracle is not responsible for any loss or damage of any sort that you may incur from dealing with any third party. */ /** * @fileOverview * This file holds Application Express + AXAX framework specific functionality * * */ /* str should be in the form of a valid f?p= syntax */ /** * @constructor * @param {Dom node | String} [obj] object to put in the partial page * @param {String} [flow] flow id * @param {String} [req] request value * @param {String} [page] page id * @param {String} [instance] instance * @param {String} [proc] process to call * @param {String} [queryString] hodler for quesry string * * */ function htmldb_Get(obj,flow,req,page,instance,proc,queryString) { /* setup variables */ this.obj = $x(obj); // object to put in the partial page this.proc = (!!proc) ?proc :'wwv_flow.show'; // proc to call this.flow = (!!flow) ?flow : $v('pFlowId'); // flowid this.request = (!!req) ?req :''; // request this.page = (!!page) ?page :'0'; this.queryString = (!!queryString)?queryString:null; // holder for passing in f? syntax this.params = ''; // holder for params this.response = ''; // holder for the response this.base = null; // holder fot the base url this.syncMode = false; // declare methods this.addParam = htmldb_Get_addParam; this.add = htmldb_Get_addItem; this.getPartial = htmldb_Get_trimPartialPage; /** * function return the full response * */ this.getFull = function(obj){ var result; var node; if (obj){this.obj = $x(obj);} if (this.obj){ if(this.obj.nodeName == 'INPUT'){ this.obj.value = this.response; }else{ if(document.all){ result = this.response; node = this.obj; setTimeout(function() {htmldb_get_WriteResult(node, result)},100); }else{ $s(this.obj,this.response); } } } return this.response; } ; /** * Desc * @param {Dom Node | String | Array | Dom Array | String id}[] * @return {} * */ this.get = function(mode,startTag,endTag){ var p; try { p = new XMLHttpRequest(); } catch (e) { p = new ActiveXObject("Msxml2.XMLHTTP"); } try { var startTime = new Date(); p.open("POST", this.base, this.syncMode); p.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); p.send(this.queryString == null ? this.params : this.queryString ); this.response = p.responseText; if (this.node){this.replaceNode(p.responseXML);} if ( mode == null || mode =='PPR' ) { return this.getPartial(startTag,endTag); } if ( mode == "XML" ) { return p.responseXML; } else { return this.getFull(); } } catch (e) { return; } } this.url = htmldb_Get_getUrl; this.escape = htmldb_Get_escape; this.clear = htmldb_Get_clear; this.sync = htmldb_Get_sync; this.setNode = setNode; this.replaceNode = replaceNode; // setup the base url var u = (window.location.href.indexOf("?") > 0) ? window.location.href.substring(0,window.location.href.indexOf("?")) : window.location.href; this.base = u.substring(0,u.lastIndexOf("/")); if (!!!this.proc){this.proc = u.substring(u.lastIndexOf("/")+1);} this.base = this.base +"/" + this.proc; // grab the instance form the page form if(instance==null||instance==""){ this.instance = $v('pInstance'); }else{ this.instance = instance; } // finish setiing up the base url and params if ( ! queryString ) { this.addParam('p_request', this.request) ; this.addParam('p_instance', this.instance); this.addParam('p_flow_id', this.flow); this.addParam('p_flow_step_id',this.page); } function setNode(id) { this.node = $x(id); } function replaceNode(newNode){ var i=0; for(i=this.node.childNodes.length-1;i>=0;i--){ this.node.removeChild(this.node.childNodes[i]); } this.node.appendChild(newNode); } } function htmldb_Get_sync(s){ this.syncMode=s; } function htmldb_Get_clear(val){ this.addParam('p_clear_cache',val); } // // return the queryString // function htmldb_Get_getUrl(){ return this.queryString == null ? this.base +'?'+ this.params : this.queryString; } function htmldb_Get_escape(val){ // force to be a string val = val + ""; val = val.replace(/\%/g, "%25"); val = val.replace(/\+/g, "%2B"); val = val.replace(/\ /g, "%20"); val = val.replace(/\./g, "%2E"); val = val.replace(/\*/g, "%2A"); val = val.replace(/\?/g, "%3F"); val = val.replace(/\\/g, "%5C"); val = val.replace(/\//g, "%2F"); val = val.replace(/\>/g, "%3E"); val = val.replace(/\'}; if(!endTag){endTag = ''}; var start = this.response.indexOf(startTag); var part; var result; var node; if(start>0){ this.response = this.response.substring(start+startTag.length); var end = this.response.indexOf(endTag); this.response = this.response.substring(0,end); } if(this.obj){ if(document.all){ result = this.response; node = this.obj; setTimeout(function() {htmldb_get_WriteResult(node, result)},100); }else{ $s(this.obj,this.response); } } return this.response; } var gResult = null; var gNode = null; function htmldb_get_WriteResult(node, result){ $s(node,result); return; } function html_Doneprocessing(){} function html_processing(){} /** * Adds asyncronous AJAX to the htmldb_Get object pVar is the function that you want to call when the xmlhttp state changes in the function specified by pVar the xmlhttp object can be referenced by the variable p * @extends * {Javascript Function} pVar */ htmldb_Get.prototype.GetAsync = function(pVar){ try{ p = new XMLHttpRequest(); }catch(e){ p = new ActiveXObject("Msxml2.XMLHTTP"); } try { var startTime = new Date(); p.open("POST", this.base, true); if(p) { p.onreadystatechange = pVar; p.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); p.send(this.queryString == null ? this.params : this.queryString ); return p; } }catch(e){ return false; } } /** * Gets PDF src XML * */ function htmldb_ExternalPost(pThis,pRegion,pPostUrl){ var pURL = 'f?p='+$x('pFlowId').value+':'+$x('pFlowStepId').value+':'+$x('pInstance').value+':FLOW_FOP_OUTPUT_R'+pRegion document.body.innerHTML = document.body.innerHTML + '
'; var l_El = $x('vXML'); var get = new htmldb_Get(l_El,null,null,null,null,'f',pURL.substring(2)); get.get(); get = null; setTimeout('$x("xmlFormPost").submit()',10); return; } /** * Simple XML Control * */ function $xml_Control(pThis){ this.xsl_string = '