/** * @fileoverview MasterQuery is a client side library written in * JavaScript designed to simplify the development on CUIs by * creating a common interface into LexisNexis APIs for developers. * Many tasks that would normally require a significant amount of * coding time can now be done simply by updating the site’s * properties file. The new interactive developer information window * allows for Lexis Nexis employees to easily see what is being sent * through the CUI and test alternative syntax. *

* One of the biggest advantages is that a site can be prepared for * conversion over to Rosetta simply by implementing the site using * MasterQuery. Once the Nexis.com URL API is released a developer * updates the site’s properties and you’re good to go. *

* Note that since MasterQuery is a code library it is not meant to * have any effect on the customer’s user experience. *

* CONVERTING A SITE OVER TO MasterQuery
  1. Create a properties file

    A good place to look for examples is in the directory /clients/controls/MasterQuery/lib/propertyFiles/

    It is possible for a site to have multiple properties files for different instances of MasterQuery. See /clients/controls/MasterQuery/demos/_loader/ for an example.

  2. Include the required libraries

    <script language="javascript" src="/clients/jslib/utils.js"></script>
    <script language="javascript" src="/clients/controls/MasterQuery/MQInclude.asp"></script>
  3. Set the API in the properties file

    api=1 CUI Builder
    api=2 CUI International
    api=3 Dossier
    api=5 Professional
    api=6 URL API
    api=7 V1 Portfolio
    api=8 V1 Search
    api=9 V1 Search Form
    api=10 V1 SNews
    api=11 XLink
    api=12 Seisint
    api=13 Dossier Forms
    api=14 Nexis Search Form
    api=18 Lexis Public Records
    api=19 Rosetta Public Records

  4. Set the common API paramaters in the properties file
    target=_blank
    originationCode=00004
    menu=126NC9
    mj=1
    MIDDLEWARE_CODE=NP
    client=seisinttest
    In the past these would be either hidden fields in the CUI search form or link paramaters.

  5. Instantiate a MasterQuery Object and punch in the forms values that you want to send to the API
    var chunnel = LNParser.propertyFactory("properties.txt");
    chunnel.setSearch(query.value);
    chunnel.setAfter(after.value);
    chunnel.setSource(src.value);
    chunnel.setClient(clientid.value);
    chunnel.submit();
    See the Class documentation for other usage examples.

  6. Advanced Options
    There are several demo CUIs that demonstrate other techiniques using MasterQuery:

    Seisint: /clients/controls/MasterQuery/demos/_seisint/
    This shows how to use XLink's Seisint sources. Normal L/N query syntax does not apply. For examples of MasterQuery Seisint in production see {@link http://csdev:8080/clients/controls/MasterQuery/docs/checklist.xls this spreadsheet}.
    Embedded ID: /clients/controls/MasterQuery/demos/_chain/
    This demo CUI takes a MasterQuery Object, redirects it to another page where the ID is included and sent on it's way.
    Rosetta URL API: /clients/controls/MasterQuery/demos/_url_api/

    Loading Multiple Property Files: /clients/controls/MasterQuery/demos/_loader/

  7. Smart Tools Verbs
    The Implelentor for Nexis.com Smart Tools has been redone so as to support a framework that matches the verb concept under Rosetta. Instead of their being six different implementors, there is instead just one that in which the API can be changed depending on the verb passed in. The verb matches the filename of the url passed in.

    The Smart Tools verb used can be set through various methods. The LNParser.factory() method determines the verb automatically based upon the URL passed in. For forms one needs to set the verb property either through MasterQuery's set() method or via a passed in property file.
    	verb=v1_search (default)
    	verb=v1_portfolio
    	verb=v1_searchform
    	verb=v1_snews
    	verb=v1_dossier_launch_forms
    	verb=search/searchform
    	
    	chunnel.set("verb", "v1_searchform")
    	
    	var chunnel = LNParser("http://web.lexis-nexis.com/api.universe/search/searchform?id=1928")
    
    If no verb is set v1_search is used by default.
* @author Christopher Baker * @version 0.1 */ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // CONSTANTS var NEW_WINDOW_FEATURES = 'status=yes,resizable=yes,menubar=yes,scrollbars=yes,toolbar=yes,directories=yes,location=yes' /** * MasterQuery * * @class Core data class for the MasterQuery API. MasterQuery Objects are * used by various Implementors to create specific LexisNexis calls. The main * task of the class is to hold values used by L/N APIs. *

* USAGE: *
 *     var chunnel = new MasterQuery(MasterQuery.API_XLINK);
 *     chunnel.setSearch("Bush and AWOL");
 *     chunnel.setSource("NEWS;90DAYS");
 *     chunnel.setClient("999-5465");
 *     chunnel.setAfter("5:DY");
 *     chunnel.set("LNAUTHSCHEME", "CP");
 *     chunnel.submit();
* * The recommended way to create a MasterQuery Object is through the * {@link LNParser} factory methods. * * @param {int} The implementor that the Builder will call * @version 0.1 * @constructor */ function MasterQuery(intAPI) { // Set the API if (intAPI) { this.setAPI(intAPI); } else { this.setAPI(MasterQuery.DEFAULT_API); } this.search = ""; this.source = ""; this.originationCode = ""; this.method = "GET"; this.target = "_self"; this.protocol = "http:"; } MasterQuery.NO_DEBUG = false; /** * LexisNexis API Constant for CUI Builder * @type int */ MasterQuery.API_CUI_BUILDER = 1; /** * LexisNexis API Constant for CUI International * @type int */ MasterQuery.API_CUI_INTERNATIONAL = 2; /** * LexisNexis API Constant for Dossier Searches * @type int */ MasterQuery.API_DOSSIER = 3; /** * LexisNexis API Constant for Get and Print * @type int */ MasterQuery.API_GET_AND_PRINT = 4; /** * LexisNexis API Constant for LN Professional * @type int */ MasterQuery.API_PROFESSIONAL = 5; /** * LexisNexis API Constant for the Rosetta URL API * @type int */ MasterQuery.API_URL_API = 6; /** * @deprecated * @type int */ MasterQuery.API_V1_PORTFOLIO = 7; /** * LexisNexis API Constant for v1 Search * @type int */ MasterQuery.API_V1_SEARCH = 8; /** * Constant casts into v1_search with searchform verb. * @type int */ MasterQuery.API_V1_SEARCHFORM = 9; /** * @type int */ MasterQuery.API_V1_SNEWS = 10; /** * LexisNexis API Constant for XLink * @type int */ MasterQuery.API_XLINK = 11; /** * LexisNexis API Constant for XLink Seisint * @type int */ MasterQuery.API_XLINK_SEISINT = 12; /** * @type int */ MasterQuery.API_DOSSIER_FORMS = 13; /** * Constant casts into v1_search with nexis searchform verb. * @type int */ MasterQuery.API_NEXIS_SEARCHFORM = 14; /** * Constants for LNDB IA */ MasterQuery.API_IA_LNDB_ACTIVATION = 15; MasterQuery.API_IA_LNDB_LOGOUT = 16; MasterQuery.API_IA_LNDB_LOGIN = 17; /** * LexisNexis API Constant for XLink Seisint * @type int */ MasterQuery.API_XLINK_PUBREC = 18; /** * LexisNexis API Constant for XLink Seisint * @type int */ MasterQuery.API_URL_API_PUBREC = 19; /** * @type int */ MasterQuery.DEFAULT_API = MasterQuery.API_XLINK; /** * The version number of the API * @type long */ MasterQuery.version = 1.0; /** * The name of the API * @type String */ MasterQuery.name = "MasterQuery"; /** * The base URL location for the library * @type String */ MasterQuery.baseURL = "/clients/controls/MasterQuery/"; //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // Accessors /** * Returns the protocol being used for the query * * @type String */ MasterQuery.prototype.getProtocol = function() { return this.protocol; } /** * Sets the protocol being used for the query * @param {String} */ MasterQuery.prototype.setProtocol = function(strProtocol) { switch(strProtocol) { case "http": case "http:": this.protocol = "http:"; break; case "https": case "https:": this.protocol = "https:"; break; } } /** * Returns the domain set for the query, if there is one. * This mainly applies for XLink, which sometimes needs to * be called from several different domains because of cookie * and zone issues. * * @return the domain being used for the object * @type String */ MasterQuery.prototype.getDomain = function() { return this.domain; } /** * Sets the domain set for the query, if there is one. * This mainly applies for XLink, which sometimes needs to * be called from several different domains because of cookie * and zone issues. * * @param {String} */ MasterQuery.prototype.setDomain = function(strDomain) { if (strDomain.indexOf("exis.com") != -1) { this.domain = strDomain; return; } var re = /[01][01][01][01]/g; if (strDomain.match(re)) { this.domain = strDomain; } } /** * Returns the integer representing the API being used. * * @type int */ MasterQuery.prototype.getAPI = function() { return this.api; } /** * Sets the integer representing the API being used. * * @param {String} */ MasterQuery.prototype.setAPI = function(intAPI) { intAPI = parseInt(intAPI, 10); this.api = intAPI; } /** * Gets the query. * * @type String */ MasterQuery.prototype.getSearch = function() { return this.search; } /** * Sets the LN query * * @param {String} */ MasterQuery.prototype.setSearch = function(strSearch) { this.search = strSearch; } /** * Gets the value of searchtype. * * @type String */ MasterQuery.prototype.getSearchtype = function() { return this.searchtype; } /** * The searchtype to use. get for both xlink and CUIBuilder. In the case of * CUIBuilder, citation is eliminated and case is passed with setSearch(). * @param {String} */ MasterQuery.prototype.setSearchtype = function(strSearchtype) { this.searchtype = strSearchtype; } /** * Gets the value of TOCTarget. * * @type String */ MasterQuery.prototype.getTOCTarget = function() { return this["c_TOCTarget"]; } /** * The value of "target" to be used to access tocs. get for both xlink. * @param {String} */ MasterQuery.prototype.setTOCTarget = function(strTOCTarget) { this["c_TOCTarget"] = strTOCTarget; } /** * Gets the value of the source. * * @type String */ MasterQuery.prototype.getSource = function() { return this.source; } /** * The source(s) to be used. * @param {String} */ MasterQuery.prototype.setSource = function(strSource) { this.source = strSource.toUpperCase(); } // DATE METHODS /** * Gets the value of relativedate. * * @type String */ MasterQuery.prototype.getAfter = function() { return this.after; } /** * The relativedate value to be used. * * This method handles SmartLink (1:WK) and XLink style (previous_3_days) * relative dates and translates all of them to SmartLink format. * @param {String} */ MasterQuery.prototype.setAfter = function(strAfter) { // alert(strAfter) this.after = LNParser.parseAfter(strAfter) } /** * Gets the value of fromDate. * * @type String */ MasterQuery.prototype.getFromDate = function() { return this.fromDate; } /** * fromDate to be appended to search string. * @param {String} */ MasterQuery.prototype.setFromDate = function(strFromDate) { this.fromDate = DateUtil.parse(strFromDate); } /** * Gets the value of toDate. * * @type String */ MasterQuery.prototype.getToDate = function() { return this.toDate; } /** * toDate to be appended to search string. * @param {String} */ MasterQuery.prototype.setToDate = function(strToDate) { this.toDate = DateUtil.parse(strToDate); } /** * Gets the value of client. * * @type String */ MasterQuery.prototype.getClient = function() { return this.client; } /** * Sets the client ID. * @param {String} */ MasterQuery.prototype.setClient = function(strClient) { this.client = strClient; } /** * Gets the value of maxDocs. * * @type int */ MasterQuery.prototype.getMaxdocs = function() { return this.maxdocs; } /** * Sets the number of documents to return. * @param {String} */ MasterQuery.prototype.setMaxdocs = function(intMaxdocs) { intMaxdocs = parseInt(intMaxdocs, 10); if (intMaxdocs > 0) { this.maxdocs = intMaxdocs; } } /** * Gets the menu. * * @type String */ MasterQuery.prototype.getMenu = function() { return this.menu; } /** * Sets the customer menu. * @param {String} */ MasterQuery.prototype.setMenu = function(strMenu) { this.menu = strMenu; } /** * Gets the OriginationCode. * * @type String */ MasterQuery.prototype.getOriginationCode = function() { return this.originationCode; } /** * Sets the OriginationCode. * @param {String} */ MasterQuery.prototype.setOriginationCode = function(strOriginationCode) { this.originationCode = strOriginationCode; } /** * Gets the value of sort. * * @type String */ MasterQuery.prototype.getSort = function() { return this.sort; } /** * Sets the sort order. * @param {String} */ MasterQuery.prototype.setSort = function(strSort) { this.sort = strSort; } /** * Gets the UID value. * * @type String */ MasterQuery.prototype.getUID = function() { return this.uid; } /** * Sets the user ID. * @param {String} */ MasterQuery.prototype.setUID = function(strUID) { this.uid = strUID; } /** * Gets the PWD. * * @type String */ MasterQuery.prototype.getPWD = function() { return this.pwd; } /** * Sets the PWD. * @param {String} */ MasterQuery.prototype.setPWD = function(strPWD) { this.pwd = strPWD; } /** * Gets the zone value. * * @type String */ MasterQuery.prototype.getZone = function() { return this.zone; } /** * Sets the zone. * @type String */ MasterQuery.prototype.setZone = function(strZone) { this.zone = strZone; } //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // Target Form Methods /** * Returns the method that the internal post form will be used. * This is an internal method used by the implementors. * * @type String */ MasterQuery.prototype.getMethod = function() { return this.method; } /** * Sets the method that the internal post form will be used. * This is an internal method used by the implementors. * * @param {String} */ MasterQuery.prototype.setMethod = function(strMethod) { this.method = strMethod; } /** * Used to override the action for the MQ object. * * @type String */ MasterQuery.prototype.getOverride = function() { return this.override; } /** * Used to override the action for the MQ object. * * @param {String} */ MasterQuery.prototype.setOverride = function(strOverride) { this.override = strOverride; } /** * Returns the window target used by the internet MasterQuery form. * * @type String */ MasterQuery.prototype.getTarget = function() { return this.target; } /** * Sets the window target used by the internet MasterQuery form. * * @param {String} */ MasterQuery.prototype.setTarget = function(strTarget) { this.target = strTarget; } //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // METHODS /** * Generic method for getting a MasterQuery value. * return the value of the key passed in * @param {String} The key for the value to be returned */ MasterQuery.prototype.get = function(strParam) { if (MasterQuery._isStandardField(strParam)) { return this[strParam]; } else { return this["c_" + strParam]; } }; /** * Generic method for setting a MasterQuery value. * For standard MasterQuery values set or the specific setter can be * used interchangably. * * Much of the headache behind this is to deal with the debug window. * @param {String} The key for the value to be set * @param {String} The value to be set */ MasterQuery.prototype.set = function(strParam, strValue) { /* * NOTE: Adding a new MQ field: * 1) create the getter and accessor for the parameter * 2) add it to getMQFieldNames list * 3) If hidden add it to getAdditionalFields() hidden switch statement * 4) add to set switch statement * 5) add to _isStandardField */ var myRegExp = /^c_/; if (myRegExp.test(strParam)) { strParam = strParam.substring(2); } switch(strParam.toLowerCase()) { case "": break; case "api": this.setAPI(strValue) break; case "search": case "query": case "searchterm": case "sr": this.setSearch(strValue); break; case "name": if (this.api == MasterQuery.API_URL_API) { this.set("nm", strValue); } else { this.setSearch(strValue); } break; case "source": case "src": this.setSource(strValue); break; case "searchtype": case "stp": this.setSearchtype(strValue); break; case "relativedate": case "after": case "daterelative": this.setAfter(strValue); break; case "client": case "clientid": case "pi": this.setClient(strValue); break; case "domain": this.setDomain(strValue); break; case "maxdocs": case "limit": this.setMaxdocs(strValue); break; case "menu": case "_menu": this.setMenu(strValue); break; case "method": this.setMethod(strValue); break; case "originationcode": case "origination_code": case "origincode": this.setOriginationCode(strValue); break; case "override": this.setOverride(strValue); break; case "protocol": this.setProtocol(strValue); break; case "newsortmode": case "sortby": this.setSort(strValue); break; case "target": this.setTarget(strValue); break; case "user_id": case "uid": this.setUID(strValue); break; case "password": case "pwd": case "psw": this.setPWD(strValue); break; case "zone": this.setZone(strValue); break; case "company": if (this.api == MasterQuery.API_V1_SEARCH) { if (Truth.isTrue(strValue)) { this.setSearch("company" + QueryUtil.segment(strValue)); } break; } default: if (strValue == "") { this["c_" + strParam] = null; } else { this["c_" + strParam] = strValue; } } }; /** * * * @private * @param {String} * @return is the field standard to MasterQuery * @type boolean */ MasterQuery._isStandardField = function(strParam) { switch(strParam) { case "api": case "search": case "searchtype": case "source": case "after": case "fromDate": case "toDate": case "client": case "maxdocs": case "menu": case "originationCode": case "sort": case "uid": case "pwd": case "zone": case "target": case "method": case "domain": case "protocol": case "override": return true; break; } return false; }; /** * * @param {boolean} optional value that if true disables the debug window. * @private */ MasterQuery.prototype.submit = function(forceNoDebug, OverrideWindowProps) { var type = "regular"; if (arguments.length > 0) { if (arguments[0].isAuthObject) type="auth"; } if (type == "auth") this.authSubmit(arguments[0]); else SearchImplementor.go(this, forceNoDebug, OverrideWindowProps); }; /** * Displays all of the values in the MasterQuery object. * @type String */ MasterQuery.prototype.toString = function() { var s = "MasterQuery\n"; if (this.api) s += " API: " + LNParser.getAPIName(this.api) + "\n"; if (this.search) s += " SEARCH: " + this.search + "\n"; if (this.searchtype) s += " SEARCH TYPE: " + this.searchtype + "\n"; if (this.source) s += " SOURCE: " + this.source + "\n"; if (this.after) s += " AFTER: " + this.after + "\n"; if (this.fromDate) s += " FROM: " + this.fromDate + "\n"; if (this.toDate) s += " TO: " + this.toDate + "\n"; if (this.client) s += " CLIENT: " + this.client + "\n"; if (this.maxdocs) s += " MAX DOCS: " + this.maxdocs + "\n"; if (this.menu) s += " MENU: " + this.menu + "\n"; if (this.originationCode) s += " ORIGINATION_CODE: " + this.originationCode + "\n"; if (this.sort) s += " SORT: " + this.sort + "\n"; if (this.uid) s += " UID: " + this.uid + "\n"; if (this.pwd) s += " PWD: ********\n"; if (this.zone) s += " ZONE: " + this.zone + "\n"; if (this.domain) s += " DOMAIN: " + this.domain + "\n"; if (this.target) s += " TARGET: " + this.target + "\n"; if (this.method) s += " METHOD: " + this.method + "\n"; if (this.override) s += " OVERRIDE: " + this.override + "\n"; for (var i in this) { val = this[i]; switch (typeof val) { case ("string"): if (/^c_/.test(i)) s += " " + i.substr(2).toUpperCase() + ": " + val + "\n"; break; default: break; } } return s; }; /** * Sets the user id and password which are pulled from the auth db. * authObject Parameters: * siteID: The cui's site encrypted id number. ie. "1ce5ecc8ab642ac0" * authType: Determines whether the auth info is selected by ip address or by id name. * Sample Inputs: * "ip" * "name" * IDName: If the authType is "name" then the name to be selected must be passed. * devOverride: By default, pages in dev select the dev id instead of the prod id. Passing "true" in this * parameter will override that functionality and always select the prod id. * isCert: Returns cert id/pwd * forceNoDebug: Parameter passed through to submit function * OverrideWindowProps: Parameter passed through to submit function * IDParameterName: Determins parameter name used for ID * PWDParameterName: Determines parameter name used for Password */ MasterQuery.prototype.authSubmit = function(authObject) { var siteID, authType, IDName, devOverride, isCert, forceNoDebug, OverrideWindowProps, IDParameterName, PWDParameterName; siteID = authObject.siteID; authType = authObject.authType.toLowerCase(); IDName = authObject.IDName; devOverride = authObject.devOverride; isCert = authObject.isCert; forceNoDebug = authObject.forceNoDebug; OverrideWindowProps = authObject.OverrideWindowProps; IDParameterName = authObject.IDParameterName; PWDParameterName = authObject.PWDParameterName; if ((siteID == "") || (authType == "")) return false; if ((authType == "name") && (IDName == "")) return false; if (devOverride != true) devOverride = false; var MQObj = this; var xmlObj = null; if(window.ActiveXObject) { try { xmlObj = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { xmlObj = new ActiveXObject("Microsoft.XMLHTTP"); } } else if(window.XMLHttpRequest) { xmlObj = new XMLHttpRequest(); } else { return false; } xmlObj.onreadystatechange = function() { if(xmlObj.readyState == 4) { var temp, UID, PWD; temp = xmlObj.responseText; temp = temp.split(" "); UID = temp[0] PWD = temp[1]; if (PWD == undefined) PWD = ""; if(IDParameterName == "") MQObj.uid = UID; else eval("MQObj." + IDParameterName + " = UID"); if(PWDParameterName == "") MQObj.pwd = PWD; else eval("MQObj." + PWDParameterName + " = PWD"); MQObj.submit(forceNoDebug, OverrideWindowProps); return true; } } var file = "/clients/controls/auth/authHelper.asp"; file = file + "?siteID=" + siteID + "&authType=" + authType + "&IDName=" + IDName + "&devOverride=" + devOverride + "&isCert=" + isCert; xmlObj.open ('GET', file, true); xmlObj.send (''); return true; }; function authObject() { this.isAuthObject = true; this.siteID = ""; this.authType = ""; this.IDName = ""; this.devOverride = false; this.isCert = false; this.forceNoDebug = ""; this.OverrideWindowProps = ""; this.IDParameterName = ""; this.PWDParameterName = ""; } authObject.prototype.setSiteID = function(id) { this.siteID = id; } authObject.prototype.getSiteID = function() { return this.siteID; } authObject.prototype.setAuthType = function(type) { this.authType = type; } authObject.prototype.getAuthType = function() { return this.authType; } authObject.prototype.setIDName = function(IDName) { this.IDName = IDName; } authObject.prototype.getIDName = function() { return this.IDName; } authObject.prototype.setDevOverride = function(devOverride) { this.devOverride = devOverride; } authObject.prototype.getDevOverride = function() { return this.devOverride; } authObject.prototype.setIsCert = function(isCert) { this.isCert = isCert; } authObject.prototype.getIsCert = function() { return this.isCert; } authObject.prototype.setForceNoDebug = function(forceNoDebug) { this.forceNoDebug = forceNoDebug; } authObject.prototype.getForceNoDebug = function() { return this.forceNoDebug; } authObject.prototype.setOverrideWindowProps = function(OverrideWindowProps) { this.OverrideWindowProps = OverrideWindowProps; } authObject.prototype.getOverrideWindowProps = function() { return this.OverrideWindowProps; } authObject.prototype.setIDParameterName = function(IDParameterName) { this.IDParameterName = IDParameterName; } authObject.prototype.getIDParameterName = function() { return this.IDParameterName; } authObject.prototype.setPWDParameterName = function(PWDParameterName) { this.PWDParameterName = PWDParameterName; } authObject.prototype.getPWDParameterName = function() { return this.PWDParameterName; }// =================================================================== // Author: Matt Kruse // WWW: http://www.mattkruse.com/ // // NOTICE: You may use this code for any purpose, commercial or // private, without any further permission from the author. You may // remove this notice from your final code if you wish, however it is // appreciated by the author if at least my web site address is kept. // // You may *NOT* re-distribute this code in any way except through its // use. That means, you can include it in your product, or your web // site, or any other form where the code is actually being used. You // may not put the plain javascript up on your site for download or // include it in your javascript libraries for download. // If you wish to share this code with others, please just point them // to the URL instead. // Please DO NOT link directly to my .js files from your site. Copy // the files to your server and use them there. Thank you. // =================================================================== // HISTORY // ------------------------------------------------------------------ // March 18, 2004: Updated to include max depth limit, ignoring standard // objects, ignoring references to itself, and following only // certain object properties. // March 17, 2004: Created /* DESCRIPTION: These functions let you easily and quickly view the data structure of javascript objects and variables COMPATABILITY: Will work in any javascript-enabled browser USAGE: // Return the output as a string, and you can do with it whatever you want var out = Dumper(obj); // When starting to traverse through the object, only follow certain top- // level properties. Ignore the others var out = Dumper(obj,'value','text'); // Sometimes the object you are dumping has a huge number of properties, like // form fields. If you are only interested in certain properties of certain // types of tags, you can restrict that like Below. Then if DataDumper finds // an object that is a tag of type "OPTION" it will only examine the properties // of that object that are specified. DumperTagProperties["OPTION"] = [ 'text','value','defaultSelected' ] // View the structure of an object in a window alert DumperAlert(obj); // Popup a new window and write the Dumper output to that window DumperPopup(obj); // Write the Dumper output to a document using document.write() DumperWrite(obj); // Optionall, give it a different document to write to DumperWrite(obj,documentObject); NOTES: Be Careful! Some objects hold references to their parent nodes, other objects, etc. Data Dumper will keep traversing these nodes as well, until you have a really, really huge tree built up. If the object you are passing in has references to other document objects, you should either: 1) Set the maximum depth that Data Dumper will search (set DumperMaxDepth) or 2) Pass in only certain object properties to traverse or 3) Set the object properties to traverse for each type of tag */ var DumperIndent = 1; var DumperIndentText = " "; var DumperNewline = "\n"; var DumperObject = null; // Keeps track of the root object passed in var DumperMaxDepth = -1; // Max depth that Dumper will traverse in object var DumperIgnoreStandardObjects = true; // Ignore top-level objects like window, document var DumperProperties = null; // Holds properties of top-level object to traverse - others are igonred var DumperTagProperties = new Object(); // Holds properties to traverse for certain HTML tags /** * @private */ function DumperGetArgs(a,index) { var args = new Array(); // This is kind of ugly, but I don't want to use js1.2 functions, just in case... for (var i=index; i
");
	w.document.writeln(Dumper(o,DumperGetArgs(arguments,1)));
	w.document.writeln("
"); w.document.close(); } /** * @private */ function DumperAlert(o) { alert(Dumper(o,DumperGetArgs(arguments,1))); } /** * @private */ function DumperWrite(o) { var argumentsIndex = 1; var d = document; if (arguments.length>1 && arguments[1]==window.document) { d = arguments[1]; argumentsIndex = 2; } var temp = DumperIndentText; var args = DumperGetArgs(arguments,argumentsIndex) DumperIndentText = " "; d.write(Dumper(o,args)); DumperIndentText = temp; } /** * @private */ function DumperPad(len) { var ret = ""; for (var i=0; i1 && typeof(arguments[1])=="number") { level = arguments[1]; indentLevel = arguments[2]; if (o == DumperObject) { return "[original object]"; } } else { DumperObject = o; // If a list of properties are passed in if (arguments.length>1) { var list = arguments; var listIndex = 1; if (typeof(arguments[1])=="object") { list = arguments[1]; listIndex = 0; } for (var i=listIndex; i DumperMaxDepth) { return "..."; } if (DumperIgnoreStandardObjects) { if (o==window || o==window.document) { return "[Ignored Object]"; } } // NULL if (o==null) { ret = "[null]"; return ret; } // FUNCTION if (typeof(o)=="function") { ret = "[function]"; return ret; } // BOOLEAN if (typeof(o)=="boolean") { ret = (o)?"true":"false"; return ret; } // STRING if (typeof(o)=="string") { ret = "'" + o + "'"; return ret; } // NUMBER if (typeof(o)=="number") { ret = o; return ret; } if (typeof(o)=="object") { if (typeof(o.length)=="number" ) { // ARRAY ret = "["; for (var i=0; i0) { ret += "," + DumperNewline + DumperPad(indentLevel); } else { ret += DumperNewline + DumperPad(indentLevel); } ret += Dumper(o[i],level+1,indentLevel-0+DumperIndent); } if (i > 0) { ret += DumperNewline + DumperPad(indentLevel-DumperIndent); } ret += "]"; return ret; } else { // OBJECT ret = "{"; var count = 0; for (i in o) { if (o==DumperObject && DumperProperties!=null && DumperProperties[i]!=1) { // do nothing with this node } else { if (typeof(o[i]) != "unknown") { var processAttribute = true; // Check if this is a tag object, and if so, if we have to limit properties to look at if (typeof(o.tagName)!="undefined") { if (typeof(DumperTagProperties[o.tagName])!="undefined") { processAttribute = false; for (var p=0; p0) { ret += "," + DumperNewline + DumperPad(indentLevel); } else { ret += DumperNewline + DumperPad(indentLevel); } ret += "'" + i + "' => " + Dumper(o[i],level+1,indentLevel-0+i.length+6+DumperIndent); } } } } if (count > 0) { ret += DumperNewline + DumperPad(indentLevel-DumperIndent); } ret += "}"; return ret; } } } /* Copyright (c) 2005 JSON.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The Software shall be used for Good, not Evil. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. http://www.crockford.com/JSON/js.html */ var JSON = { org: 'http://www.JSON.org', copyright: '(c)2005 JSON.org', license: 'http://www.crockford.com/JSON/license.html', stringify: function (arg) { var c, i, l, s = '', v; switch (typeof arg) { case 'object': if (arg) { if (arg.constructor == Array) { for (i = 0; i < arg.length; ++i) { v = this.stringify(arg[i]); if (s) { s += ','; } s += v; } return '[' + s + ']'; } else if (typeof arg.toString != 'undefined') { for (i in arg) { v = arg[i]; if (typeof v != 'undefined' && typeof v != 'function') { v = this.stringify(v); if (s) { s += ','; } s += this.stringify(i) + ':' + v; } } return '{' + s + '}'; } } return 'null'; case 'number': return isFinite(arg) ? String(arg) : 'null'; case 'string': l = arg.length; s = '"'; for (i = 0; i < l; i += 1) { c = arg.charAt(i); if (c >= ' ') { if (c == '\\' || c == '"') { s += '\\'; } s += c; } else { switch (c) { case '\b': s += '\\b'; break; case '\f': s += '\\f'; break; case '\n': s += '\\n'; break; case '\r': s += '\\r'; break; case '\t': s += '\\t'; break; default: c = c.charCodeAt(); s += '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); } } } return s + '"'; case 'boolean': return String(arg); default: return 'null'; } }, parse: function (text) { var at = 0; var ch = ' '; function error(m) { throw { name: 'JSONError', message: m, at: at - 1, text: text }; } function next() { ch = text.charAt(at); at += 1; return ch; } function white() { while (ch) { if (ch <= ' ') { next(); } else if (ch == '/') { switch (next()) { case '/': while (next() && ch != '\n' && ch != '\r') {} break; case '*': next(); for (;;) { if (ch) { if (ch == '*') { if (next() == '/') { next(); break; } } else { next(); } } else { error("Unterminated comment"); } } break; default: error("Syntax error"); } } else { break; } } } function string() { var i, s = '', t, u; if (ch == '"') { outer: while (next()) { if (ch == '"') { next(); return s; } else if (ch == '\\') { switch (next()) { case 'b': s += '\b'; break; case 'f': s += '\f'; break; case 'n': s += '\n'; break; case 'r': s += '\r'; break; case 't': s += '\t'; break; case 'u': u = 0; for (i = 0; i < 4; i += 1) { t = parseInt(next(), 16); if (!isFinite(t)) { break outer; } u = u * 16 + t; } s += String.fromCharCode(u); break; default: s += ch; } } else { s += ch; } } } error("Bad string"); } function array() { var a = []; if (ch == '[') { next(); white(); if (ch == ']') { next(); return a; } while (ch) { // a.push(value()); a[a.length] = value(); white(); if (ch == ']') { next(); return a; } else if (ch != ',') { break; } next(); white(); } } error("Bad array"); } function object() { var k, o = {}; if (ch == '{') { next(); white(); if (ch == '}') { next(); return o; } while (ch) { k = string(); white(); if (ch != ':') { break; } next(); o[k] = value(); white(); if (ch == '}') { next(); return o; } else if (ch != ',') { break; } next(); white(); } } error("Bad object"); } function number() { var n = '', v; if (ch == '-') { n = '-'; next(); } while (ch >= '0' && ch <= '9') { n += ch; next(); } if (ch == '.') { n += '.'; while (next() && ch >= '0' && ch <= '9') { n += ch; } } v = +n; if (!isFinite(v)) { error("Bad number"); } else { return v; } } function word() { switch (ch) { case 't': if (next() == 'r' && next() == 'u' && next() == 'e') { next(); return true; } break; case 'f': if (next() == 'a' && next() == 'l' && next() == 's' && next() == 'e') { next(); return false; } break; case 'n': if (next() == 'u' && next() == 'l' && next() == 'l') { next(); return null; } break; } error("Syntax error"); } function value() { white(); switch (ch) { case '{': return object(); case '[': return array(); case '"': return string(); case '-': return number(); default: return ch >= '0' && ch <= '9' ? number() : word(); } } return value(); } }; /** * @class Static Class for parsing LexisNexis API data and turning it into MasterQuery Objects. *

* EXAMPLES:
{@link #propertyFactory PROPERTY FACTORY}
var chunnel = LNParser.propertyFactory('properties.txt');
{@link #queryStringFactory QUERY STRING}
var chunnel = LNParser.queryStringFactory("client=FEDTAX02&source=718dis;dguide&search=file-name(fedday)&view=full&ORIGINATION_CODE=00004");
   chunnel.submit();
{@link #factory EMBEDDED IN LINK}
<a href="http://www.lexis.com/research/xlink?client=FEDTAX02&source=718dis;dguide&search=file-name(fedday)&view=full&ORIGINATION_CODE=00004" 
   onclick="LNParser.factory(this).submit(); return false;">link</a>
You can also override any of the links value by passing in a properties file:
<a href="http://www.lexis.com/research/xlink?client=FEDTAX02&source=718dis;dguide&search=file-name(fedday)&view=full&ORIGINATION_CODE=00004" 
   onclick="LNParser.propertyFactory('properties.txt', LNParser.factory(this)).submit(); return false;">link loader</a>

* @author Christopher Baker * @version 0.1 * @constructor */ function LNParser() { throw new Error("LNParser is a static class. Do not instantiate."); } /** * Regular expression for stripping off the query string from a URL * @type String */ LNParser.queryStringRE = /\?(.+)$/; /** * Factory method that takes an Anchor Object with a L/N Query as the HREF or * a L/N link string and returns a MasterQuery object based upon it. * * @return A MasterQuery Object based upon the link * @param {Object} * @type MasterQuery */ LNParser.factory = function(link, props) { var strurl; var lnAPI; var target = ""; // Check to see if it is an HREF String or an ANCHOR tag that is passed in. if (typeof link == "object") { /* Might be useful later for adding web form parsing. // are we a web form if (link.action) { with (myForm) { strurl = action //check for text boxes for (elem = 0; elem < elements.length; elem++) { } } }*/ strurl = link.href; target = link.target; } else { strurl = link; } lnAPI = LNParser.getAPI(strurl); // Set default API to XLink if (lnAPI === null) { lnAPI == MasterQuery.API_XLINK; } var m = strurl.match(LNParser.queryStringRE); var chunnel = new MasterQuery(lnAPI); chunnel.setTarget(target); if (props) { try { // if it's a Properties Object, get the values props = props.getProperties(); } catch(e) { // otherwise do nothing. } try{ for (var prop in props) { chunnel.set(prop, props[prop]); } } catch(e) { if (isDev()) alert(e.message) } } if (strurl.indexOf("https://") != -1) { chunnel.isUsingSSL = true; } /* doesn't seem to be working // Determine the domain that is being used. // For xlink to maintain var mm = strurl.match(new RegExp("^https?:\/\/([A-Za-z]*\.?lexisnexis|lexis-nexis|lexis|nexis\.com)", "i")) if (mm) { chunnel.setDomain(m[1]); } */ if (lnAPI === MasterQuery.API_DOSSIER) { chunnel.set("verb", "accessGW"); chunnel.set("gw", "FC"); chunnel.set("nm", chunnel.get("name")); } // http://www.lexisnexis.com/api.universe/v1_dossier_launch_forms?ORIGINATION_CODE=00004&prod=CD&host=nexis_com_r2&searchType=advancedFind chunnel = LNParser.queryStringFactory(m[1], chunnel); if (lnAPI === MasterQuery.API_DOSSIER_FORMS) { // http://www.lexisnexis.com/api.universe/v1_dossier_launch_forms?prod=CD // http://www.lexisnexis.com/api.universe/v1_dossier_launch_forms?prod=ID // http://www.lexisnexis.com/api.universe/v1_dossier_launch_forms?prod=CD&searchType=advancedFind // http://www.lexisnexis.com/api.universe/v1_dossier_launch_forms?prod=CD&searchType=quickFind chunnel.set("verb", "accessGW"); if (chunnel.get("prod") == "ID") { chunnel.set("gw", "FI"); } else { if (chunnel.getSearchtype() == "quickFind") { chunnel.set("gw", "FC"); } else { chunnel.set("gw", "CL"); } } } return chunnel; }; /** * Takes a querystring and returns a MasterQuery Object. If * a MasterQuery Object is passed in as the second parameter * then the data is folded into that object. * * See the overview for usage examples. * * @return A MasterQuery Object based upon the Query String * @param {String} A URL QueryString to be based * @param {MasterQuery} Optional MasterQuery Object for the values to be folded into * @type MasterQuery */ LNParser.queryStringFactory = function(queryString, chunnel) { if (!chunnel) { chunnel = new MasterQuery(); } var queryArray = queryString.split("&"); for (var i = 0; i < queryArray.length; i++) { var sp = queryArray[i].split("="); var key = sp[0]; var val = ""; try { if (sp[1]) val = decodeURIComponent(sp[1]); } catch(e) { try { if (sp[1]) val = unescape(sp[1]); } catch(e) { if (isDev()) { prompt("",e.message) } } } chunnel.set(key, val); } return chunnel; }; /** * Takes a JSProperties Object and returns a MasterQuery Object. If * a MasterQuery Object is passed in as the second parameter * then the data is folded into that object. *

* This method includes support for a special property value * __TIME_DELAY__. Setting this property allows a developer * to override a specific value at a specific time. This allows you * to change from one API to another when the time is reached. *

* The format is Y:M:D:H:M:S;key;value * * @return A MasterQuery Object based upon the properties file pased in * @param {Object} JSProperties Object or file name for the properties file. * @param {MasterQuery} Optional MasterQuery Object for the values to be folded into * @type MasterQuery */ LNParser.propertyFactory = function(props, chunnel) { if (props) { if (typeof props == "string") { props = new JSProperties(props); } } else { // Otherwise create a default JSProperties object props = new JSProperties(); } // Create the object that will be if it isn't already passed in. if (!chunnel) { chunnel = new MasterQuery(); } // Make sure that the var passed in is an object. if ((arguments.length > 0)) { if (typeof arguments[0] == "object") { props = arguments[0]; } else { props = new JSProperties(arguments[0]); } } // Now punch in the properties that match the MQ object main fields var properties = props.getProperties(); try{ for (var prop in properties) { switch(prop) { case "__TIME_DELAY__": // format for the var split is date;varName;varValue var pOver = properties[prop].split(";"); var dOver = pOver[0].split(":"); // alert(dOver[0] + " " + dOver[1] + " " + dOver[2] + " " + dOver[3] + " " + dOver[4]) // new Date(aYear, aMonth, aDate, anHour, aMinute, aSecond) var dDate = new Date(dOver[0], dOver[1] - 1, dOver[2], dOver[3], dOver[4], dOver[5]); dDate.setFullYear(dOver[0]); var currentDate = new Date(); // alert(dDate + " " + currentDate); // prompt("", dDate.getTime() + " " + currentDate.getTime()) if (dDate.getTime() < currentDate.getTime()) { // alert() chunnel.set(pOver[1], pOver[2]); } break; default: chunnel.set(prop, properties[prop]); break; } } } catch(e) { if (isDev()) alert(e.message) } return chunnel; }; /** * Returns the API being used by a specific LN link. * @param {String} QueryString to determine what L/N API is being used. * @type int */ LNParser.getAPI = function(strURL) { if(strURL) { strURL = strURL.toLowerCase(); } else { return null; } if (strURL.lastIndexOf(".com/clients/cui/search.asp") != -1) { return MasterQuery.API_CUI_BUILDER; } else if (strURL.lastIndexOf(".com/clients/cuiint/search.asp") != -1) { return MasterQuery.API_CUI_INTERNATIONAL; } else if ((strURL.lastIndexOf("lexis-nexis.com/professional") != -1) || (strURL.lastIndexOf("lexisnexis.com/professional") != -1)) { return MasterQuery.API_PROFESSIONAL; } else if ((strURL.lastIndexOf("lexisnexis.com/api.universe/v1_dossier_launch_results") != -1) || (strURL.lastIndexOf("lexis-nexis.com/api.universe/v1_dossier_launch_results") != -1)) { return MasterQuery.API_DOSSIER; } else if ((strURL.lastIndexOf("lexisnexis.com/api.universe/v1_portfolio") != -1) || (strURL.lastIndexOf("lexis-nexis.com/api.universe/v1_portfolio") != -1)) { return MasterQuery.API_V1_PORTFOLIO; } else if (strURL.lastIndexOf("nexis.com/api.universe/v1_searchform") != -1) { return MasterQuery.API_V1_SEARCHFORM; } else if ((strURL.lastIndexOf("lexisnexis.com/api.universe/v1_search") != -1) || (strURL.lastIndexOf("lexis-nexis.com/api.universe/v1_search") != -1)) { return MasterQuery.API_V1_SEARCH; } else if ((strURL.lastIndexOf("nexis.com/api.universe/v1_snews") != -1) || (strURL.lastIndexOf("lexis-nexis.com/api.universe/v1_snews") != -1)) { return MasterQuery.API_V1_SNEWS; } // else if ((strURL.lastIndexOf("exis.com/xlink") != -1) || (strURL.lastIndexOf("exis.com/research/xlink" != -1))) // { // return MasterQuery.API_XLINK; // } // ADDED else if (strURL.lastIndexOf("nexis.com/api.universe/v1_dossier_launch_forms") != -1) { // http://www.lexis-nexis.com/api.universe/v1_dossier_launch_forms return MasterQuery.API_DOSSIER_FORMS; } else if (strURL.lastIndexOf("nexis.com/api.universe/search/searchform") != -1) { return MasterQuery.API_NEXIS_SEARCHFORM; } // ADDED for IA else if ((strURL.lastIndexOf("exis.com/auth/lnu/activate.asp") != -1) || (strURL.lastIndexOf("exis.com/auth/lnu/activateLexis.asp") != -1) || (strURL.lastIndexOf("exis.com/auth/lnu/activatenexis.asp") != -1) || (strURL.lastIndexOf("exis.com/auth/lnu/activatenexisorgid.asp") != -1)) { return MasterQuery.API_IA_LNDB_ACTIVATION; } else if ((strURL.lastIndexOf("exis.com/auth/lnu/lckill.asp") != -1) || (strURL.lastIndexOf("exis.com/auth/lnu/nckill.asp") != -1) || (strURL.lastIndexOf("exis.com/auth/lnu/lnckill.asp") != -1)) { return MasterQuery.API_IA_LNDB_LOGOUT; } else if (strURL.lastIndexOf("exis.com/auth/lnu/setCookie.asp") != -1) { return MasterQuery.API_IA_LNDB_LOGIN; } return null; }; MasterQuery.API_IA_LNDB_LOGOUT = 16; /** * Returns a human readable version of a LN Api names. Used for debugging window. * @param {int} QueryString to determine what L/N API is being used. * @type String */ LNParser.getAPIName = function(strAPI) { switch(strAPI) { case MasterQuery.API_CUI_BUILDER: return "CUI Builder"; break; case MasterQuery.API_CUI_INTERNATIONAL: return "CUI International"; break; case MasterQuery.API_DOSSIER: return "Dossier"; break; case MasterQuery.API_DOSSIER_FORMS: return "Dossier Launch Forms"; break; case MasterQuery.API_GET_AND_PRINT: return "Get and Print"; break; case MasterQuery.API_NEXIS_SEARCHFORM: return "Nexis Search Form"; break; case MasterQuery.API_PROFESSIONAL: return "Professional"; break; case MasterQuery.API_URL_API: return "Rosetta"; break; case MasterQuery.API_V1_PORTFOLIO: return "Smart Tools v1_portfolio"; break; case MasterQuery.API_V1_SEARCH: return "Smart Tools v1_search"; break; case MasterQuery.API_V1_SEARCHFORM: return "Smart Tools v1_searchform"; break; case MasterQuery.API_V1_SNEWS: return "Smart Tools v1_snews"; break; case MasterQuery.API_XLINK: return "XLink"; break; case MasterQuery.API_XLINK_SEISINT: return "XLink Seisint"; break; case MasterQuery.API_IA_LNDB_ACTIVATION: return "LNDB Instant Activation"; break; case MasterQuery.API_IA_LNDB_LOGOUT: return "LNDB IA Logout"; break; case MasterQuery.API_IA_LNDB_LOGIN: return "LNDB IA Login"; break; case MasterQuery.API_XLINK_PUBREC: return "XLink Public Records"; break; case MasterQuery.API_URL_API_PUBREC: return "Rosetta Public Records"; break; } return ""; }; /** * Parses various after/relative date values and returns an after value. * @param {String} Any relative date/after value * @type String */ LNParser.parseAfter = function(strAfter) { if (!Truth.isTrue(strAfter)) { return ""; } try { strAfter = strAfter.toUpperCase(); } catch(e) { strAfter = strAfter.toString(); } // /^\d+:DY|WK|MO|YR$/ if (strAfter.search(/^\d+:(DY|WK|MO|YR)$/i) != -1) { return strAfter; } strAfter = strAfter.toLowerCase(); switch(strAfter) { case "today": return "1:DY"; break; case "this_week": case "previous_week": return "1:WK"; break; case "this_month": case "previous_month": return "1:MO"; break; case "this_year": case "previous_year": return "1:YR"; break; } if (strAfter.lastIndexOf("_") != -1) { var relAr = strAfter.split("_"); // The number for the relative date var relInt = relAr[1]; // The type, such as days or weeks var relPeriod = relAr[2]; if (relInt.search(/^\d+$/) == -1) { return null; } switch(relPeriod) { case "days": return relInt + ":DY"; break; case "weeks": return relInt + ":WK"; break; case "months": return relInt + ":MO"; break; case "years": return relInt + ":YR"; break; } } return null; }; /** * Takes a valid after date value and returns it in the relative date format * @param {String} After date value * @type String */ LNParser.convertAfterToRelative = function(after) { if (!Truth.isTrue(after)) { return ""; } var dArray = after.split(":") // The integer for the length var dInt = dArray[0]; var dPeriod = dArray[1]; switch(dPeriod) { case "DY": if (dInt == 1) { return "today"; } return "previous_" + dInt + "_days"; break; case "WK": if (dInt == 1) { return "previous_week"; } return "previous_" + dInt + "_weeks"; break; case "MO": if (dInt == 1) { return "previous_month"; } return "previous_" + dInt + "_months"; break; case "YR": if (dInt == 1) { return "previous_year"; } return "previous_" + dInt + "_years"; break; } return ""; }; /** * Takes a MasterQuery Object and converts any date properties to L/N Query syntax. * Used for implementors whose APIs don't support relative date paramaters. * @param {MasterQuery} * @type MasterQuery */ LNParser.convertDateToQuery = function(mq, format) { if (mq.after) { var dRange = mq.after.substring(0, mq.after.length - 3); var dRangeType = mq.after.substring(mq.after.length - 2); var theDate = new Date(); var currDate = new Date(); switch(dRangeType) { case "DY": theDate.setDate(theDate.getDate() - dRange); break; case "WK": theDate.setDate(theDate.getDate() - (dRange * 7)); break; case "MO": theDate.setMonth(theDate.getMonth() - dRange); break; case "YR": theDate.setFullYear(theDate.getFullYear() - dRange); break; } var oneDay = 86400000; var dayDiff = Math.ceil((currDate.getTime()-theDate.getTime())/(oneDay)); dayDiff = dayDiff + 1; var dStr = "date aft(%currdate-" + dayDiff + "%)"; LNParser.foldIn(mq, dStr); mq.after = ""; } else if (mq.fromDate && mq.toDate) { var dStr = "date(geq (" + mq.fromDate + ") and leq (" + mq.toDate + "))"; LNParser.foldIn(mq, dStr); mq.fromDate = ""; mq.toDate = ""; } else if (mq.fromDate) { var dStr = "date(geq (" + mq.fromDate + ")"; LNParser.foldIn(mq, dStr); mq.fromDate = ""; } else if (mq.toDate) { var dStr = "date(leq (" + mq.toDate + "))"; LNParser.foldIn(mq, dStr); mq.toDate = ""; } return mq; }; /** * Method to fold in a LN Query version of a date. Determines if the * date should be at the beginning or the end of the query depending * upon if it has a NOT value in the Query. This is to avoid a bug * in certain LN APIs. * @param {MasterQuery} * @param {String} Date String * @type MasterQuery */ LNParser.foldIn = function(mq, dStr) { var searchIncludesNot = mq.search.match(new RegExp("NOT", "i")); if (mq.search) { if (searchIncludesNot) { mq.search = dStr + " and " + mq.search; } else { mq.search = mq.search + " and " + dStr; } } else { mq.search = dStr; } return mq; }; /** * @class Static Class that acts as the traffic cop for MasterQuery Objects. Determines * where it goes and if there needs to be a debug window displayed. * * @author Christopher Baker * @version 0.1 */ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // CONSTANTS var NEW_WINDOW_FEATURES = 'status=yes,resizable=yes,menubar=yes,scrollbars=yes,toolbar=yes,directories=yes,location=yes' var searchImplementorCount = 0 /** * @constructor * @private */ function SearchImplementor() { throw new Error("SearchImplementor is a static class. Do not instantiate."); } /** * Set to true to force a debug popup even in prod. */ SearchImplementor.debugOn = false; /** * That action method. Should we do a popup, or assign the Object to an * implementor? */ SearchImplementor.go = function(mq, forceNoDebug) { if (MasterQuery.NO_DEBUG) { forceNoDebug = true; } if (forceNoDebug) { SearchImplementor.assign(mq); return; } if (isDev() || SearchImplementor.debugOn) { SearchImplementor.popup(mq); } else { SearchImplementor.assign(mq); } } /** * Open up the debug popup window. */ SearchImplementor.popup = function(mq) { newWindow = window.open("","_blank","status,height=400,width=520,scrollbars=yes"); SearchImplementor.mqRef = mq; // newWindow.document.write(SearchImplementor.getNewDebugWindow(mq)); newWindow.document.write(SearchImplementor.getDebugPopupHMTL(mq)); newWindow.document.close( ); // close layout stream } /** * Used to test if we can see the object */ SearchImplementor.BOOP = function() { alert("BOOP!") } /** * Returns the HTML for the debug popup window. */ SearchImplementor.getDebugPopupHMTL = function(mq) { var str = ''; str += '\n'; str += '\n'; str += 'Development Information: Master Query<\/title>\n'; // Our stylesheet str += '<link href="'; str += MasterQuery.baseURL str += 'debugWindow.css" rel="stylesheet" type="text\/css">\n'; // our javascript files str += '<script type="text/javascript" language="javascript" src="'; str += MasterQuery.baseURL str += 'MQInclude.asp"></script>\n'; str += '<script type="text/javascript" language="javascript" src="'; str += MasterQuery.baseURL str += 'MasterQueryDebug.js"></script>\n'; str += '<\/head>\n'; str += '<body onload="init();">'; str += '<form action="/clients/controls/MasterQuery/test/testSearchImplementor.htm" onsubmit="callBack();" name="MasterQuerySearchImplementor" ID="Form1">'; str += '<input type="hidden" name="__mqJsonStore__" value=\'' + escape(JSON.stringify(mq)) + '\'>\n' // str += '<input type="hidden" name="originationCode" value=\'' + mq.getOriginationCode() + '\'>\n' str += '<br clear="all" /><fieldset>\n'; str += '<legend>\n'; str += ' Development Information: MasterQuery<\/legend>\n'; str += '<div class="sublegend">This development only popup will not be displayed in production.'; if (SearchImplementor.mqRef.uid != undefined) str += '      <a href="#" onclick="alert(\'Authentication Values:\\n\\nUser ID: ' + SearchImplementor.mqRef.uid + '\\nPassword: ' + SearchImplementor.mqRef.pwd + '\');return false;"><font color=black>Show ID/PWD</font></a>'; str += '<\/div>\n<br>\n'; str += '<input type="submit" value="SUBMIT" id="smit" style="margin-left: 120px;" class="b">\n'; str += '<input type="button" value="CANCEL" class="b" onclick="cancelPopup()">\n'; str += '<input type="button" value="NO DEBUG" class="b" onclick="cancelPopup();window.opener.MasterQuery.NO_DEBUG = true">\n'; str += '<br>\n'; str += '<label for="search">QUERY:<\/label> \n'; str += '<textarea id="search" name="search" rows="3" cols="40">\n'; str += SearchImplementor.mqRef.getSearch() str += '<\/textarea>\n'; str += '<br>\n'; str += '<br>\n'; str += '<div id="additionFields">\n'; str += SearchImplementor.getAdditionalFields(mq); str += '<\/div>'; str += '<label for="link">LINK:<\/label> \n'; str += '<input type="text" class="visible" id="link" name="link" value="' + SearchImplementor.getLink(mq) + '">\n'; str += '<br>\n'; str += '<label for="api">API:<\/label>\n'; str += '<select name="api" id="api">\n'; str += SearchImplementor.getAPIOptions(mq.getAPI()) str += '<\/select>\n'; str += '<br>\n'; str += '<hr>\n'; str += '<div class="debug">debug<\/div>\n'; str += '<\/fieldset>\n'; str += '<\/form>\n'; str += '<\/body>\n'; str += '<\/html>\n'; // prompt("",str) return str; } SearchImplementor.getLink = function(mq) { switch(mq.getAPI()) { case 1: case 2: return CUIBuilderImp.getLink(CUIBuilderImp._preprocessor(mq)) break; case 3: return DossierImp.getLink(DossierImp._preprocessor(mq)); break; case 5: return LNProfImp.getLink(LNProfImp._preprocessor(mq)); break; case 6: return UrlApiImp.getLink(UrlApiImp.preprocessor(mq)); break; case 7: case 8: case 9: case 10: case 13: case 14: return V1SearchImp.getLink(V1SearchImp._preprocessor(mq)); break; case 12: return SeisintImp.getLink(SeisintImp._preprocessor(mq)); break; case 18: return XLinkPubRecImp.getLinkWithXML(XLinkPubRecImp._preprocessor(mq)); break; case 19: return UrlApiPubRecImp.getLink(UrlApiPubRecImp.preprocessor(mq)); break; case 4: case 11: default: return XLinkImp.getLink(XLinkImp._preprocessor(mq)); break; } return XLinkImp.getLink(XLinkImp._preprocessor(mq)) } /** * Gets all of the additional custom fields for the MasterQuery Object * and determines which ones to display. */ SearchImplementor.getAdditionalFields = function(mq) { var fields = SearchImplementor.getMQFieldNames(mq); var html = ""; for (var x = 0; x < fields.length; x++) { var val; if (mq[fields[x]]) { val = mq[fields[x]]; } else { val = mq.get(fields[x]); } if (val !== null) { // var fieldName = "MQ" + fields[x]; // var fieldName = fields[x]; var fieldName = fields[x]; var inputType = "text" var inputLabel = '<label for="' + fieldName + '">' + fields[x].toUpperCase() + ':</label>' var linefeed = "<br clear='all'>"; var cssClass = "visible" //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // SET DEBUG HIDDEN FIELDS HERE switch(fieldName) { case "method": case "target": case "override": case "protocol": case "domain": case "lexislogo": case "lexislogo": case "interface": case "powernav": case "topframe": case "docinfo": case "mj": case "MIDDLEWARE_CODE": case "submit": case "uid": case "pwd": inputType = "hidden"; cssClass = "hidden"; inputLabel = ""; linefeed = ""; } html += inputLabel; html += '<input class="' + cssClass + '" type="' + inputType + '" name="' + fieldName + '" id="' + fieldName + '" value="' + val + '">' + linefeed; } } return html; } /** * Grabs the name for a specific field. Needed to avoid name collision with * core MasterQuery fields. */ SearchImplementor.getMQFieldNames = function(mq) { // var fields = new Array("searchtype", "source", "after", "fromDate", "toDate", "client", "maxdocs", "menu", "sort","uid","pwd","zone", "originationCode", "target", "method", "protocol", "domain", "override"); var setArray = new Array() // Add existing standard fields for (var x = 0; x < fields.length; x++) { // if (mq[fields[x]] || mq[fields[x]] == "") if (mq[fields[x]]) { // setArray.push(fields[x]) setArray[setArray.length] = fields[x]; } } // Add custom SET fields for (var i in mq) { if (i.lastIndexOf("c_") == 0) { // setArray.push(i.substring(2)); setArray[setArray.length] = i.substring(2); } } return setArray; } /** * Returns the API switcher dropdown for the debug popup. */ SearchImplementor.getAPIOptions = function(selected) { var ret = "" for (var x = 1; x < 20; x++) { switch(x) { case 1: case 2: case 3: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19: if (x == selected) { ret += '<option value="' + x + '" selected>' + LNParser.getAPIName(x) + '</option>\n'; } else { ret += '<option value="' + x + '">' + LNParser.getAPIName(x) + '</option>\n'; } break; } } return ret; } /** * Returns a DOM Option object * DEPRECATED */ SearchImplementor.getOption = function(newwin, winame, val) { var dFormOption = newwin.document.createElement("option"); dFormOption.name = name dFormOption.value = name dFormOption.text = val return dFormOption } /** * Sends the MasterQuery Object to a specific implementor. */ SearchImplementor.assign = function(mq) { switch(mq.getAPI()) { case 1: CUIBuilderImp.submit(mq); break; case 2: CUIBuilderImp.submit(mq); // CUIIntBuilderImp(mq); break; case 3: // Add URL API vars DossierImp.submit(mq); break; case 4: XLinkImp.submit(mq); // GetAndPrintImp.submit(mq) break; case 5: LNProfImp.submit(mq); break; case 6: UrlApiImp.submit(mq); break; case 7: if (!Truth.isTrue(mq.get("verb"))) { mq.set("verb", "v1_portfolio") } V1SearchImp.submit(mq); break; case 8: V1SearchImp.submit(mq); break; case 9: if (!Truth.isTrue(mq.get("verb"))) { mq.set("verb", "v1_searchform") } V1SearchImp.submit(mq); break; case 10: if (!Truth.isTrue(mq.get("verb"))) { mq.set("verb", "v1_snews") } V1SearchImp.submit(mq); break; break; case 12: // V1SearchImp.submit(mq); SeisintImp.submit(mq) break; case 13: if (!Truth.isTrue(mq.get("verb"))) { mq.set("verb", "v1_dossier_launch_forms") } V1SearchImp.submit(mq); break; case 14: if (!Truth.isTrue(mq.get("verb"))) { mq.set("verb", "search/searchform") } V1SearchImp.submit(mq); break; case 15: IaLndbImp.submit(mq); break; case 16: if (!Truth.isTrue(mq.get("verb"))) { mq.set("verb", "removecookie.do") } IaLndbImp.submit(mq); break; case 17: if (!Truth.isTrue(mq.get("verb"))) { mq.set("verb", "setcookie.do") } IaLndbImp.submit(mq); break; case 18: XLinkPubRecImp.submit(mq); // GetAndPrintImp.submit(mq) break; case 19: UrlApiPubRecImp.submit(mq); break; case 11: default: XLinkImp.submit(mq) } }; /** * Takes a MasteryQuery object and its API matrix and converts it into * a query string. */ SearchImplementor.getQueryString = function(mq, matrix) { var divider = ""; var ret = ""; for (var prop in mq) { if ((typeof mq[prop] != "object") && typeof mq[prop] != "function") { var key if (prop.substring(0, 2) == "c_") { key = prop.substring(2) } else { key = prop } if ((matrix[key] != -1) && (matrix[key] != -2)) { if (!SearchImplementor.isNonAPIField(key) && Truth.isTrue(mq[prop])) { if (typeof matrix[key] == "string") { key = matrix[key]; } try { // ret += divider + key + "=" + encodeURIComponent(mq[prop].toString()) ret += divider + key + "=" + escape(mq[prop].toString()) } catch(e) { ret += divider + key + "=" + escape(mq[prop].toString()) } divider = "&"; } } } } return ret; }; /** * Takes a MasteryQuery object and its API matrix and converts it into * a query string. */ SearchImplementor.getQueryStringCaseInsensative = function(mq, matrix) { var divider = ""; var ret = ""; for (var prop in mq) { if ((typeof mq[prop] != "object") && typeof mq[prop] != "function") { var key if (prop.substring(0, 2) == "c_") { key = prop.substring(2) } else { key = prop } if ((matrix[key.toLowerCase()] != -1) && (matrix[key.toLowerCase()] != -2)) { if (!SearchImplementor.isNonAPIField(key.toLowerCase() && Truth.isTrue(mq[prop]))) { if (typeof matrix[key.toLowerCase()] == "string") { key = matrix[key.toLowerCase()]; } try { // ret += divider + key + "=" + encodeURIComponent(mq[prop].toString()) ret += divider + key + "=" + escape(mq[prop].toString()) } catch(e) { ret += divider + key + "=" + escape(mq[prop].toString()) } divider = "&"; } } } } return ret; }; /** * Takes a MasteryQuery object and its API matrix and converts it into * the HTML for a hidden form post. */ SearchImplementor.getPostFields = function(mq, matrix) { var ret = ""; for (var prop in mq) { if ((typeof mq[prop] != "object") && typeof mq[prop] != "function") { var key if (prop.substring(0, 2) == "c_") { key = prop.substring(2) } else { key = prop } if ((matrix[key] != -1) && (matrix[key] != -2)) { if (!SearchImplementor.isNonAPIField(key) && Truth.isTrue(mq[prop])) { if (typeof matrix[key] == "string") { key = matrix[key]; } ret += FormUtil.getHiddenFieldVal(key, mq[prop].toString()); } } } } return ret; }; /** * Returns true for field names that are used for MasterQuery and not any specific * LN API */ SearchImplementor.isNonAPIField = function(field) { switch(field) { case "api": case "method": case "target": case "override": return true; default: return false; } }; /** * postit takes a MasterQuery Object, its API matrix and form action * and dynamically gererate a form out of it that will be posted to the * API. */ SearchImplementor.postit = function(mq, matrix, action) { searchImplementorCount++ mq = LNParser.convertDateToQuery(mq) var dForm = document.createElement("form") dForm.name = "mqdynaform" + searchImplementorCount dForm.id = "mqdynaform" + searchImplementorCount dForm.action = action dForm.method = mq.method dForm.method = "GET" dForm.target = mq.target for (var prop in mq) { if (typeof mq[prop] != "object") { var key = prop; if (!SearchImplementor.isNonAPIField(key)) { if (typeof matrix[prop] == "string") { key = matrix[prop]; } var inp = document.createElement("input"); inp.type = "hidden"; inp.name = key; inp.value = mq[prop].toString(); dForm.appendChild(inp); } } } document.body.appendChild(dForm); dForm.submit(); }; SearchImplementor.submitDiv = function(formHTML) { var diver = document.getElementById("masterQueryDynaFormDiv"); // Only create a new div if the existing div doesn't exist if (diver == null) { diver = document.createElement("div"); diver.id = "masterQueryDynaFormDiv"; } diver.innerHTML = formHTML; document.body.appendChild(diver); var dForm = document.getElementById("masterQueryDynaForm"); dForm.submit(); } /** * JavaScript Properties Class * * @class Class that takes a java-like properties file and turns it into * a JavaScript object. * <br /><br /> * Only parses variables that are a key=value combination in which * the variable name is made up of alphanumeric characters. Otherwise * the line is ignored. * <br /><br /> * A sample property file: * <pre> search=Paul Hackett * after=8:DY * source=NEWS;90days * protocol=https: * target=_blank * override=chain2send.asp * originationCode=00004 * api=8 * __TIME_DELAY__=2005:8:12:5:0:0;api;12</pre> * * USAGE: * <pre>var props = new JSProperties("properties.txt").getProperties(); *alert(props.after);</pre> * * @version 0.1 * @requires HttpRequest HttpRequest Preferences Class * @author Christopher Baker <Christopher.Baker@lexisnexis.com> * @param {String} The filename for the properties file * @constructor */ function JSProperties() { this.filename = "js.properties.txt"; if (arguments.length > 0) { this.filename = arguments[0]; } } /** * Use XMLHttpRequest to read the properties file * * @return The properties as an Object * @type Object */ JSProperties.prototype.getProperties = function() { var http = new HttpRequest(); http.setTarget(this.filename); var pingGet = http.get(); if (pingGet !== "") { return JSProperties.parseProps(pingGet); } http.setTarget("../" + this.filename); pingGet = http.get(); if (pingGet !== "") { return JSProperties.parseProps(pingGet); } throw new Error("Unable to find property file " + this.filename + ". Please verify that it is available."); return pingGet; }; /** * Method to parse an individual line. * * @private * @param {String} The raw properties file * @return The properties as an Object * @type Object */ JSProperties.parseProps = function(raw) { var props = new Object(); var lineArray = raw.split("\n"); for (var i = 0; i < lineArray.length; i++) { var splitLine = lineArray[i].split("="); var key = trimAll(splitLine[0]); var val = trimAll(splitLine[1]); if (key) { // if the line begins with something other than a character or a number, do nothing. if (key.search(/^[_A-Za-z0-9]/) != -1) { props[key] = val; } } } return props; };//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // DateUtil /** * Utility methods related to dates. * @constructor * @private */ function DateUtil(strRaw) { throw new Error("DateUtil is a static class. Do not instantiate."); } /** * Converts common acceptable L/N Date formats into a standard mm/dd/yyyy format * * Valid Formats * * 01/01/1999 * * 01/01/99 * * 1/1/1999 * * 1/1/99 * * Jan. 1, 1999 * * jan. 1, 1999 * * Jan. 1, 99 * * Jan 1, 1999 * * jan 1, 1999 * * Jan 1, 99 * * January 1, 1999 * * january 1, 1999 * * January 1, 99 */ DateUtil.parse = function(strRaw) { var m = strRaw.match(/^([01]?\d|\w+)(\/|\.?\s+)([0123]?\d)(\/|,\s+)(\d{4}|\d{2})$/i); if (m !== null) { return DateUtil.parseMonth(m[1]) + "/" + DateUtil.parseNumericDay(m[3]) + "/" + DateUtil.parseYear(m[5]); } return; }; /** * Converts numeric days into two digit absolute numbers. * For instance "1" returns "01" */ DateUtil.parseNumericDay = function(strRaw) { if (strRaw.search(/^\d\d$/) != -1) return strRaw; return "0" + strRaw; }; /** * */ DateUtil.parseYear = function(strRaw) { // If it is a four digit year, just return ut if (strRaw.toString().search(/\d{4}/) != -1) { return strRaw; } var intValue = parseInt(strRaw, 10); if (intValue < 20) { return "20" + strRaw; } else { return "19" + strRaw; } }; /** * */ DateUtil.parseMonth = function(strRaw) { // Make sure that it is a string var str = strRaw.toString(); str = str.toLowerCase(); switch(str) { case("jan"): case("january"): case("1"): case("01"): return "01"; break; case("feb"): case("february"): case("2"): case("02"): return "02"; break; case("mar"): case("march"): case("3"): case("03"): return "03"; break; case("apr"): case("april"): case("4"): case("04"): return "04"; break; case("may"): case("5"): case("05"): return "05"; break; case("jun"): case("june"): case("6"): case("06"): return "06"; break; case("jul"): case("july"): case("7"): case("07"): return "07"; break; case("aug"): case("august"): case("8"): case("08"): return "08"; break; case("sep"): case("september"): case("9"): case("09"): return "09"; break; case("oct"): case("october"): case("10"): return "10"; break; case("nov"): case("november"): case("11"): return "11"; break; case("dec"): case("december"): case("12"): return "12"; break; default: return; } return; }; //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // FormUtil /** * @constructor * @private */ function FormUtil() { throw new Error("FormUtil is a static class. Do not instantiate."); } FormUtil.getHiddenFieldVal = function(fieldName, val) { if (!Truth.isTrue(val)) { return ""; } while (val.indexOf("'") > -1) { val = val.replace("'", "'"); } return "<input type='hidden' name='" + fieldName + "' value='" + val + "' />"; }; //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // QueryUtil /** * @constructor * @private */ function QueryUtil() { throw new Error("QueryUtil is a static class. Do not instantiate."); } QueryUtil.segment = function(strSeg) { return "(" + strSeg + ")" }; //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // Truth /** * @constructor * @private */ function Truth() { } /** * Static method to test truth from a Perl perspective */ Truth.isTrue = function(o) { if (o) { if (o === "") { return false; } return true; } return false; }; /** * @private */ function escapeQuote(str) { var re = new RegExp("'" , "g"); return str.replace(re, "\'"); } /** * Trim whitespace from the beginning and ending of a value. * * @param {String} The string to be trimmed * @return The string minus leading and trailing white space * @type String * @private */ function trimAll(sString) { if (sString) { return sString.replace(/^\s*|\s*$/g,''); } else { return sString; } }function HttpRequest(returnType) { // Are we returning XML or Text if (returnType) { this._returnType = returnType } else { this._returnType = HttpRequest.RESPONSE_TEXT } this.xmlhttp = new XMLHttpRequest(); this.requestHeaders = new Object(); // Target defaults to self this._target = document.URL this._form } /** * Constant for returning XML */ HttpRequest.RESPONSE_XML = "responseXML" /** * Constant for returning Text */ HttpRequest.RESPONSE_TEXT = "responseText" HttpRequest.prototype.getTarget = function() { return this._target } HttpRequest.prototype.setTarget = function(target) { this._target = target } HttpRequest.prototype.getForm = function() { return this._form } HttpRequest.prototype.setForm = function(form) { if (typeof(form) == "object") { this._form = form.toString() } else { this._form = form } } HttpRequest.prototype._getURI = function() { if (this._form) { return this._target + "?" + this._form } return this._target } HttpRequest.prototype.get = function(closure) { if (closure) { this.asynchronousGet(closure) } return this.synchronousGet() } HttpRequest.prototype.post = function(closure) { if (closure) { this.asynchronousPost(closure) } return this.synchronousPost() } HttpRequest.prototype.asynchronousGet = function(closure) { // This, as in the this Object, no longer refers to this in closures, // so we need to copy it. // A good article on this is // http://w3future.com/html/stories/callbacks.xml var me = this // For asynchronous calls you can't use on var http = new XMLHttpRequest(); http.open("GET", this._getURI(), true) http.onreadystatechange = function() { if(http.readyState == 4) { http.onreadystatechange = function(){} if (closure != null) { closure(http[me._returnType]) } } }; http.send(null) } HttpRequest.prototype.asynchronousPost = function(closure) { var me = this var http = new XMLHttpRequest(); http.open("POST", this.getTarget(), true); http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8") http.onreadystatechange = function() { if(http.readyState == 4) { http.onreadystatechange = function(){} closure(http[me._returnType]) } }; http.send(this.getForm()) } HttpRequest.prototype.synchronousGet = function() { var ret = "" this.xmlhttp.open("GET", this._getURI(), false) for(header in this.requestHeaders) { this.xmlhttp.setRequestHeader(header, this.requestHeaders[header]) } this.xmlhttp.send(null) if (this.xmlhttp.status == 200) { ret = this.xmlhttp.responseText } return ret } HttpRequest.prototype.synchronousPost = function(target, content) { var ret = "" this.xmlhttp.open("POST", this.getTarget(), false); // Needed for form posting this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8") for(header in this.requestHeaders) { this.xmlhttp.setRequestHeader(header, this.requestHeaders[header]) } this.xmlhttp.send(this.getForm()) if (this.xmlhttp.status == 200) { ret = this.xmlhttp.responseText } return ret } //////////////////////////////////////////////////////////////////////////////// // XMLHttpRequest /** * Cross-browser XMLHttpRequest instantiation. Posted by Gyoung-Yoon Noh * on the Ruby on Rails mailing list. * * Usage: * * xmlhttp = new XMLHttpRequest() * * @author Gyoung-Yoon Noh * @link http://hieraki.goodlad.ca/read/chapter/8#page16 */ if ((typeof XMLHttpRequest == 'undefined') || (typeof XMLHttpRequest == null) || (typeof XMLHttpRequest == undefined)) { XMLHttpRequest = function () { var msxmls = ['MSXML3', 'MSXML2', 'Microsoft'] for (var i=0; i < msxmls.length; i++) { try { return new ActiveXObject(msxmls[i]+'.XMLHTTP') } catch (e) { } } //throw new Error("No XML component installed!") } } // XMLHttpRequest //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // URLBuilder /** * Class to facilitate GET and POST query strings. * * Vars can be passed in through the constructor: * * var u = new URLBuilder("word", "ping", "name", "pang") * * u.toString() returns "word=ping&name=pang" */ function URLBuilder() { this._vars = new Object() if (arguments.length > 0) { for (var x = 0; x < arguments.length; x = x + 2) { if (arguments[x + 1] == undefined) { arguments[x + 1] = "" } this.addVar(arguments[x], arguments[x + 1]) } } } URLBuilder.prototype.addVar = function(key, val) { this._vars[encodeURIComponent(key)] = encodeURIComponent(val) } URLBuilder.prototype.toString = function() { var delim = ''; var url = ''; for (key in this._vars) { url += delim + key + '=' + this._vars[key]; delim = '&' } return url }/** * @constructor * @private */ function CUIBuilderImp() { throw new Error("CUIBuilderImp is a static class. Do not instantiate."); } CUIBuilderImp.DEFAULT_DOMAIN = "www.lexisnexis.com"; CUIBuilderImp.DEFAULT_VERB = "CUI"; CUIBuilderImp.DEFAULT_LAYOUT = "ss1"; // Create API Matrix // The matrix is used to cast object elements into those used by the API. CUIBuilderImp.matrix = new Object(); // Filter out MQ fields that we don't want in the query string // CUIBuilderImp.matrix.pwd = -1; // CUIBuilderImp.matrix.uid = -1; CUIBuilderImp.matrix.domain = -1; CUIBuilderImp.matrix.protocol = -1; CUIBuilderImp.matrix.lastName = -1; CUIBuilderImp.matrix.firstName = -1; CUIBuilderImp.matrix.companyName = -1; CUIBuilderImp.matrix.ssn = -1; CUIBuilderImp.matrix.streetAddress = -1; CUIBuilderImp.matrix.city = -1; CUIBuilderImp.matrix.state = -1; CUIBuilderImp.matrix.zip = -1; CUIBuilderImp.matrix.apinoadf = -1; CUIBuilderImp.matrix.verb = -1; CUIBuilderImp.matrix.TOCTarget = -1; // Describe which field names you need to cast into other values // specific to the API. CUIBuilderImp.matrix.client = "clientID"; CUIBuilderImp.matrix.originationCode = "OriginCode"; CUIBuilderImp.matrix.search = "query"; CUIBuilderImp.matrix.source = "src"; CUIBuilderImp.matrix.uid = "UID"; CUIBuilderImp.matrix.pwd = "PWD"; /** * This matric */ CUIBuilderImp.submit = function(chunnel) { // Preprocessor needs to convert generic after field // to XLink's relativedate field chunnel = CUIBuilderImp._preprocessor(chunnel); var linker = CUIBuilderImp.getLink(chunnel); // If no target, set the target for the same window. if (!Truth.isTrue(chunnel.target)) { chunnel.target = "_self"; } // prompt("", linker) // And send it on its merry way var w = window.open(linker, chunnel.target, NEW_WINDOW_FEATURES); }; /** * Take any actions that need to be made on the MQ object before it gets * submitted to its specific API. */ CUIBuilderImp._preprocessor = function(chunnel) { if (Truth.isTrue(chunnel.pwd)) { chunnel.protocol = "https:"; } if (!Truth.isTrue(chunnel.get("layout"))) { chunnel.set("layout", CUIBuilderImp.DEFAULT_LAYOUT) } if (!Truth.isTrue(chunnel.get("verb"))) { chunnel.set("verb", CUIBuilderImp.DEFAULT_VERB) } // If CUI Token isn't set, set it. if (!Truth.isTrue(chunnel.get("cuiToken"))) { var http = new HttpRequest(); http.setTarget(MasterQuery.baseURL + "getCUIToken.asp"); chunnel.set("cuiToken", http.get()); } return chunnel; } CUIBuilderImp.getLink = function(chunnel) { var domain = CUIBuilderImp.DEFAULT_DOMAIN; if (Truth.isTrue(chunnel.domain)) { domain = chunnel.domain; } var action; if (Truth.isTrue(chunnel.override)) { action = chunnel.override; } else { action = chunnel.protocol + "//" + domain + "/clients/"; switch(chunnel.get("verb").toUpperCase()) { case "CUIINT": action += "CUIInt/search.asp"; break; case "PQS": action += "CUIInt/pqs.asp"; break; case "CUI": default: action += "CUI/search.asp"; break; } } return action + "?" + SearchImplementor.getQueryString(chunnel, CUIBuilderImp.matrix); };/** * @constructor * @private */ function DossierImp() { throw new Error("DossierImp is a static class. Do not instantiate."); } DossierImp.DEFAULT_DOMAIN = "web.lexis-nexis.com"; // Create API Matrix // The matrix is used to cast object elements into those used by the API. DossierImp.matrix = new Object(); // Filter out MQ fields that we don't want in the query string // DossierImp.matrix.pwd = -1; // DossierImp.matrix.uid = -1; DossierImp.matrix.domain = -1; DossierImp.matrix.protocol = -1; DossierImp.matrix.lastName = -1; DossierImp.matrix.firstName = -1; // DossierImp.matrix.companyName = -1; DossierImp.matrix.ssn = -1; DossierImp.matrix.streetAddress = -1; // DossierImp.matrix.city = -1; DossierImp.matrix.apinoadf = -1; DossierImp.matrix.TOCTarget = -1; // Describe which field names you need to cast into other values // specific to the API. DossierImp.matrix.client = "clientid"; DossierImp.matrix.menu = -1; DossierImp.matrix.originationCode = "ORIGINATION_CODE"; DossierImp.matrix.search = "name"; DossierImp.matrix.source = -1; DossierImp.matrix.uid = "USER_ID"; DossierImp.matrix.pwd = "PASSWORD"; DossierImp.matrix.state = "StateList"; DossierImp.matrix.zip = "zipcode"; /** * This matric */ DossierImp.submit = function(chunnel) { // Preprocessor needs to convert generic after field // to XLink's relativedate field chunnel = DossierImp._preprocessor(chunnel); var linker = DossierImp.getLink(chunnel); // If no target, set the target for the same window. if (!Truth.isTrue(chunnel.target)) { chunnel.target = "_self"; } // prompt("", linker) // And send it on its merry way var w = window.open(linker, chunnel.target, NEW_WINDOW_FEATURES); }; /** * Take any actions that need to be made on the MQ object before it gets * submitted to its specific API. */ DossierImp._preprocessor = function(chunnel) { if (Truth.isTrue(chunnel.pwd)) { chunnel.protocol = "https:"; if (!Truth.isTrue(chunnel.get("LNAUTHSCHEME"))) { chunnel.set("LNAUTHSCHEME", "C"); } } if (!Truth.isTrue(chunnel.get("prod"))) { chunnel.set("prod", "CD") } return chunnel; } DossierImp.getLink = function(chunnel) { var domain = DossierImp.DEFAULT_DOMAIN; if (chunnel.domain && chunnel.domain !== "") { domain = chunnel.domain; } var action; if (Truth.isTrue(chunnel.override)) { action = chunnel.override; } else { action = chunnel.protocol + "//" + domain + "/api.universe/v1_dossier_launch_results"; } return action + "?" + SearchImplementor.getQueryString(chunnel, DossierImp.matrix); };/** * * * The LexisNexis Professional API implementor employs a verb interface the same * as the Rosetta URL API. Setting the verb paramater dictates which Professional * API that MQ hits. There are the following verbs available: * * - apisearch * - apibrowse * - hushlogin * - logout * - source * - sourcelist * @constructor * @private */ function LNProfImp() { throw new Error("LNProfImp is a static class. Do not instantiate."); } LNProfImp.DEFAULT_DOMAIN = "web.lexis-nexis.com/professional/"; LNProfImp.DEFAULT_VERB = "apisearch"; // Create API Matrix // The matrix is used to cast object elements into those used by the API. LNProfImp.matrix = new Object(); // Filter out MQ fields that we don't want in the query string LNProfImp.matrix.pwd = -1; LNProfImp.matrix.uid = -1; LNProfImp.matrix.domain = -1; LNProfImp.matrix.protocol = -1; LNProfImp.matrix.lastName = -1; LNProfImp.matrix.firstName = -1; LNProfImp.matrix.companyName = -1; LNProfImp.matrix.ssn = -1; LNProfImp.matrix.streetAddress = -1; LNProfImp.matrix.city = -1; LNProfImp.matrix.state = -1; LNProfImp.matrix.zip = -1; LNProfImp.matrix.apinoadf = -1; LNProfImp.matrix.verb = -1; LNProfImp.matrix.TOCTarget = -1; // Describe which field names you need to cast into other values // specific to the API. LNProfImp.matrix.client = "clientid"; LNProfImp.matrix.originationCode = "ORIGINATION_CODE"; LNProfImp.matrix.search = "searchTerm"; LNProfImp.matrix.sort = "sortby"; LNProfImp.matrix.fromDate = "dateFrom"; LNProfImp.matrix.toDate = "dateTo"; LNProfImp.matrix.after = "dateRelative"; /** * This matric */ LNProfImp.submit = function(chunnel) { LNProfImp._preprocessor(chunnel); var linker = LNProfImp.getLink(chunnel); // prompt("", linker) // If no target, set the target for the same window. if (!Truth.isTrue(chunnel.getTarget())) { chunnel.target = "_self"; } var w; if (Truth.isTrue(chunnel.getPWD())) { var aT = "https://" + LNProfImp.DEFAULT_DOMAIN + "hushlogin"; aT = aT + "?USER_ID=" + chunnel.getUID(); aT = aT + "&PASSWORD=" + chunnel.getPWD(); if (Truth.isTrue(chunnel.get("keep"))) { aT = aT + "&keep=" + chunnel.get("keep"); } if (Truth.isTrue(chunnel.get("language"))) { aT = aT + "&language=" + chunnel.get("language"); } if (chunnel.get("verb") == "hushlogin") { if (Truth.isTrue(chunnel.get("redirect"))) { aT = aT + "&redirect=" + escape(chunnel.get("redirect")); } } else { aT = aT + "&redirect=" + escape(linker); } // prompt("", aT); w = window.open(aT, chunnel.target, NEW_WINDOW_FEATURES); } else { // prompt("", linker); // And send it on its merry way w = window.open(linker, chunnel.target, NEW_WINDOW_FEATURES); } }; /** * Take any actions that need to be made on the MQ object before it gets * submitted to its specific API. */ LNProfImp._preprocessor = function(chunnel) { if (!Truth.isTrue(chunnel.get("verb"))) { chunnel.set("verb", "apisearch") } return chunnel; }; LNProfImp.getLink = function(chunnel) { var domain = LNProfImp.DEFAULT_DOMAIN; if (Truth.isTrue(chunnel.getDomain())) { domain = chunnel.domain; } var action; if (Truth.isTrue(chunnel.override)) { action = chunnel.override; } else { var verb = LNProfImp.DEFAULT_VERB; if (Truth.isTrue(chunnel.get("verb"))) { verb = chunnel.get("verb"); } action = chunnel.protocol + "//" + domain + verb; } var r = action + "?" + SearchImplementor.getQueryString(chunnel, LNProfImp.matrix); return r; };/** * @constructor * @private */ function SeisintImp() { throw new Error("SeisintImp is a static class. Do not instantiate."); } // CONSTANTS SeisintImp.DEFAULT_DOMAIN = "www.lexis.com"; // SeisintImp.DEFAULT_DOMAIN = "cert-2610.lexis.com"; // SeisintImp.DEFAULT_DOMAIN = "wmitzjx.lexis.com"; SeisintImp.SMRTLX_COMPANY_LIBFILE = "SMRTLX;BSNRPT" SeisintImp.SMRTLX_PERSONAL_LIBFILE = "SMRTLX;PERRPT" SeisintImp.SMRTLX_LOCATION_LIBFILE = "SMRTLX;LOCRPT" SeisintImp.SMRTLX_COMPANY_CSI = "174612" SeisintImp.SMRTLX_PERSONAL_CSI = "174611" SeisintImp.SMRTLX_LOCATION_CSI = "174613" SeisintImp.SEISNT_COMPANY_LIBFILE = "SMRTLX;BSNRPT" SeisintImp.SEISNT_PERSONAL_LIBFILE = "SMRTLX;PERRPT" SeisintImp.SEISNT_LOCATION_LIBFILE = "SMRTLX;LOCRPT" // Create API Matrix // The matrix is used to cast object elements into those used by the API. SeisintImp.matrix = new Object(); // Filter out MQ fields that we don't want in the query string SeisintImp.matrix.pwd = -1; SeisintImp.matrix.uid = -1; SeisintImp.matrix.domain = -1; SeisintImp.matrix.protocol = -1; SeisintImp.matrix.lastName = -1; SeisintImp.matrix.firstName = -1; SeisintImp.matrix.companyName = -1; SeisintImp.matrix.ssn = -1; SeisintImp.matrix.streetAddress = -1; SeisintImp.matrix.state = -1; SeisintImp.matrix.zip = -1; SeisintImp.matrix.telephone = -1; SeisintImp.matrix.birthDate = -1; SeisintImp.matrix.searchRadius = -1; SeisintImp.matrix.TOCTarget = -1; // Describe which field names you need to cast into other values // specific to the API. SeisintImp.matrix.originationCode = "ORIGINATION_CODE"; /** * This matric */ SeisintImp.submit = function(chunnel) { // Preprocessor needs to convert generic after field // to XLink's relativedate field SeisintImp._preprocessor(chunnel); // If no target, set the target for the same window. if (!Truth.isTrue(chunnel.target)) { chunnel.target = "_self"; } // Get the XML var xml; SeisintImp.SMRTLX_COMPANY_CSI = "174612" switch(chunnel.getSource()) { case SeisintImp.SMRTLX_COMPANY_LIBFILE: case SeisintImp.SMRTLX_COMPANY_CSI: xml = SeisintImp.getBusinessXML(chunnel); chunnel.set("reporttype", "BUS"); break; case SeisintImp.SMRTLX_LOCATION_LIBFILE: case SeisintImp.SMRTLX_LOCATION_CSI: xml = SeisintImp.getLocationXML(chunnel); chunnel.set("reporttype", "LOC"); break; case SeisintImp.SMRTLX_PERSONAL_LIBFILE: case SeisintImp.SMRTLX_PERSONAL_CSI: default: xml = SeisintImp.getPersonXML(chunnel); chunnel.set("reporttype", "PER"); break; } chunnel.setSearchtype("seisint"); chunnel.setSearch(""); chunnel.setMenu(""); // chunnel.setSource(""); // chunnel.set("mj", ""); // chunnel.setMenu("MIDDLEWARE_CODE", ""); var linker = SeisintImp.getLink(chunnel); var f = "<form method='post' action='"; f += linker; f += "' id='masterQueryDynaForm' name='masterQueryDynaForm' target='" f += chunnel.target f += "'>"; f += FormUtil.getHiddenFieldVal('USER_ID', chunnel.getUID()); f += FormUtil.getHiddenFieldVal('PASSWORD', chunnel.getPWD()); f += FormUtil.getHiddenFieldVal('LNAUTHSCHEME', 'CP'); f += FormUtil.getHiddenFieldVal('xsearch', xml); f += "</form>"; var diver = document.getElementById("masterQueryDynaFormDiv"); // Only create a new div if the existing div doesn't exist if (diver == null) { diver = document.createElement("div"); diver.id = "masterQueryDynaFormDiv" } diver.innerHTML = f; document.body.appendChild(diver); var dForm = document.getElementById("masterQueryDynaForm"); // prompt("", linker) dForm.submit(); chunnel = null; }; /** * Take any actions that need to be made on the MQ object before it gets * submitted to its specific API. */ SeisintImp._preprocessor = function(chunnel) { var relativedate = LNParser.convertAfterToRelative(chunnel.getAfter()); chunnel.c_relativedate = relativedate; chunnel.after = ""; if (Truth.isTrue(chunnel.pwd)) { chunnel.protocol = "https:"; } return chunnel; } SeisintImp.getLink = function(chunnel) { var domain = SeisintImp.DEFAULT_DOMAIN; if (chunnel.domain && chunnel.domain !== "") { domain = chunnel.domain; } var action if (Truth.isTrue(chunnel.override)) { action = chunnel.override } else { action = chunnel.protocol + "//" + domain + "/research/xlink"; } return action + "?" + SearchImplementor.getQueryString(chunnel, SeisintImp.matrix); }; /** * <search type="person"> * <fieldList> * <field type="firstName" formId="First Name">George</field> * <field type="lastName" formId="Last Name">Washington</field> * <field type="middleName" formId="Middle Name">W</field> * <field type="similiarLastName" formId="Sounds Like">true</field> * <field type="streetAddress" formId="Street">1600 Penn st.</field> * <field type="city" formId="City">Washington</field> * <field type="state" formId="State">DC</field> * <field type="zip" formId="ZIP">10019</field> * <field type="searchRadius" formId="Search Radius">30</field> * <field type="telephone" formId="Telephone">800-865-6800</field> * <field type="ssn" formId="SSN">000-000-0001</field> * <field type="birthDate" formId="Birth Date">12-5-1745</field> * </fieldList> * </search> */ SeisintImp.getPersonXML = function(chunnel) { var xml = '<search type="person"><fieldList>'; if (Truth.isTrue(chunnel.get("firstName"))) { xml += SeisintImp.getField(chunnel.get("firstName"), "firstName", "First Name"); } if (Truth.isTrue(chunnel.get("lastName"))) { xml += SeisintImp.getField(chunnel.get("lastName"), "lastName", "Last Name"); } if (Truth.isTrue(chunnel.get("middleName"))) { xml += SeisintImp.getField(chunnel.get("middleName"), "middleName", "Middle Name"); } if (Truth.isTrue(chunnel.get("similiarLastName"))) { xml += SeisintImp.getField(chunnel.get("similiarLastName"), "similiarLastName", "Sounds Like"); } if (Truth.isTrue(chunnel.get("streetAddress"))) { xml += SeisintImp.getField(chunnel.get("streetAddress"), "streetAddress", "Street"); } if (Truth.isTrue(chunnel.get("city"))) { xml += SeisintImp.getField(chunnel.get("city"), "city", "City"); } if (Truth.isTrue(chunnel.get("state"))) { xml += SeisintImp.getField(chunnel.get("state"), "state", "State"); } if (Truth.isTrue(chunnel.get("zip"))) { xml += SeisintImp.getField(chunnel.get("zip"), "zip", "ZIP"); } if (Truth.isTrue(chunnel.get("searchRadius"))) { xml += SeisintImp.getField(chunnel.get("searchRadius"), "searchRadius", "Search Radius"); } if (Truth.isTrue(chunnel.get("telephone"))) { xml += SeisintImp.getField(chunnel.get("telephone"), "telephone", "Telephone"); } if (Truth.isTrue(chunnel.get("ssn"))) { xml += SeisintImp.getField(chunnel.get("ssn"), "ssn", "SSN"); } if (Truth.isTrue(chunnel.get("birthDate"))) { xml += SeisintImp.getField(chunnel.get("birthDate"), "birthDate", "Birth Date"); } return xml + '</fieldList></search>'; }; /** * <search type="business"> * <fieldList> * <field type="companyName" formId="Company Name">LexisNexis</field> * <field type="streetAddress" formId="Street">Springboro Pike</field> * <field type="city" formId="City">Miamisburg/field> * <field type="state" formId="State">OH</field> * <field type="zip" formId="ZIP">45342</field> * <field type="telephone" formId="Telephone">937-865-6800</field> * <field type="firstName" formId="First Name">Mr.</field> * <field type="lastName" formId="Last Name">LN</field> * </fieldList> * </search> */ SeisintImp.getBusinessXML = function(chunnel) { var xml = '<search type="business"><fieldList>'; if (Truth.isTrue(chunnel.get("companyName"))) { xml += SeisintImp.getField(chunnel.get("companyName"), "companyName", "Company Name"); } if (Truth.isTrue(chunnel.get("streetAddress"))) { xml += SeisintImp.getField(chunnel.get("streetAddress"), "streetAddress", "Street"); } if (Truth.isTrue(chunnel.get("city"))) { xml += SeisintImp.getField(chunnel.get("city"), "city", "City"); } if (Truth.isTrue(chunnel.get("state"))) { xml += SeisintImp.getField(chunnel.get("state"), "state", "State"); } if (Truth.isTrue(chunnel.get("zip"))) { xml += SeisintImp.getField(chunnel.get("zip"), "zip", "ZIP"); } if (Truth.isTrue(chunnel.get("telephone"))) { xml += SeisintImp.getField(chunnel.get("telephone"), "telephone", "Telephone"); } if (Truth.isTrue(chunnel.get("firstName"))) { xml += SeisintImp.getField(chunnel.get("firstName"), "firstName", "First Name"); } if (Truth.isTrue(chunnel.get("lastName"))) { xml += SeisintImp.getField(chunnel.get("lastName"), "lastName", "Last Name"); } return xml + '</fieldList></search>'; }; /** * <search type="location"> * <fieldList> * <field type="streetAddress" formId="Street">9595 Springboro Pike</field> * <field type="city" formId="City">Miamisburg</field> * <field type="state" formId="State">OH</field> * <field type="zip" formId="ZIP">45342</field> * </fieldList> * </search> */ SeisintImp.getLocationXML = function(chunnel) { var xml = '<search type="location"><fieldList>'; if (Truth.isTrue(chunnel.get("streetAddress"))) { xml += SeisintImp.getField(chunnel.get("streetAddress"), "streetAddress", "Street"); } if (Truth.isTrue(chunnel.get("city"))) { xml += SeisintImp.getField(chunnel.get("city"), "city", "City"); } if (Truth.isTrue(chunnel.get("state"))) { xml += SeisintImp.getField(chunnel.get("state"), "state", "State"); } if (Truth.isTrue(chunnel.get("zip"))) { xml += SeisintImp.getField(chunnel.get("zip"), "zip", "ZIP"); } return xml + '</fieldList></search>'; }; /** quote (") " apostrophe (') ' ampersand (&) & less than (<) < greater than (>) > */ SeisintImp.getField = function(value, type, formId) { if (formId === null) { formId = type; } value = value.replace(/\W/g, " "); return '<field type="' + type + '" formId="' + formId + '">' + value + '</field>'; }; SeisintImp.useGet = function(chunnel) { if (Truth.isTrue(chunnel.pwd) && Truth.isTrue(chunnel.uid)) { return false; } if (Truth.isTrue(chunnel.getSearch())) { return false; } return true; } /** * Please use ppcmixed2/ppccpwd77 as id/pwd for uk/legal. * * http://www.lexisnexis.com/uk/legal/api/version1/sr?csi=267991&sr=police and legal&hd=t * @constructor * @private - */ function UrlApiImp() { throw new Error("V1SearchImp is a static class. Do not instantiate."); } UrlApiImp.DEBUG = true; UrlApiImp.DEFAULT_DOMAIN = "www.lexisnexis.com"; UrlApiImp.DEFAULT_NEXIS_DOMAIN = "w3.nexis.com"; // UrlApiImp.DEFAULT_DOMAIN = "w5cdc12.lexisnexis.com"; UrlApiImp.DEFAULT_ADAPTION = "uk"; UrlApiImp.DEFAULT_TYPE = "legal"; UrlApiImp.DEFAULT_API_VERSION = "api/version1"; UrlApiImp.DEFAULT_VERB = "sr"; // Create API Matrix // The matrix is used to cast object elements into those used by the API. UrlApiImp.matrix = new Object(); // Filter out MQ fields that we don't want in the query string UrlApiImp.matrix.adaption = -1; UrlApiImp.matrix.domain = -1; UrlApiImp.matrix.protocol = -1; UrlApiImp.matrix.type = -1; UrlApiImp.matrix.apiVersion = -1; UrlApiImp.matrix.verb = -1; //UrlApiImp.matrix.searchtype = -1; UrlApiImp.matrix.TOCTarget = -1; UrlApiImp.matrix.host = -1; UrlApiImp.matrix.pwd = "pw"; UrlApiImp.matrix.uid = "ui"; // These fields don't exist in Rosetta UrlApiImp.matrix.maxdocs = -1; UrlApiImp.matrix.zone = -1; UrlApiImp.matrix.citation = -1; UrlApiImp.matrix.prod = -1; // Describe which field names you need to cast into other values // specific to the API. UrlApiImp.matrix.originationCode = "oc"; UrlApiImp.matrix.client = "pi"; UrlApiImp.matrix.search = "sr"; UrlApiImp.matrix.searchtype = "stp"; UrlApiImp.matrix.source = "csi"; UrlApiImp.matrix.sort = "so"; // DOSSIER FIELDS UrlApiImp.matrix.ticker = "tr"; UrlApiImp.matrix.name = "nm"; // api.universe/search/searchform UrlApiImp.matrix.id = -1; /** * Takes a chunnel object and submits it. The last step in the journey * of a chunnel object before it becomes a LN search result. */ UrlApiImp.submit = function(chunnel) { try { // Preprocessor needs to convert generic after field // to XLink's relativedate field UrlApiImp.preprocessor(chunnel); // If no target, set the target for the same window. if (!Truth.isTrue(chunnel.target)) { chunnel.target = "_self"; } if (chunnel.get("verb") == "au") { UrlApiImp._submitAu(chunnel); return; } var linker = UrlApiImp.getLink(chunnel); if (((!Truth.isTrue(chunnel.pwd) && chunnel.get("verb") != "activate") || Truth.isTrue(chunnel.override)) && chunnel.method != "POST") { var w = window.open(linker, chunnel.target, NEW_WINDOW_FEATURES); } else { var f = UrlApiImp.getPostForm(chunnel); if (chunnel.get("robtest")) {if (!confirm("1: " + f)) return false}; SearchImplementor.submitDiv(f); } chunnel = null; } catch(ex) { if (UrlApiImp.DEBUG) { alert(ex.message) } } }; UrlApiImp.libfileToCSI = function(libfile) { if (libfile.lastIndexOf(";") != -1) { var http = new HttpRequest(); http.setTarget(MasterQuery.baseURL + "getCSI.asp"); http.setForm(new URLBuilder("libfile", libfile)) var csi = http.get(); if (csi) { return csi; } } return libfile; } /** * Submit using the authentication verb */ UrlApiImp._submitAu = function(chunnel) { chunnel.setProtocol("https:") var f = UrlApiImp.getPostForm(chunnel); if (chunnel.get("robtest")) {if (!confirm("2: " + f)) return false}; SearchImplementor.submitDiv(f); } UrlApiImp._submitSo = function(chunnel) { window.open(UrlApiImp.getVerbPath(chunnel), chunnel.target, NEW_WINDOW_FEATURES); } /** * Take any actions that need to be made on the MQ object before it gets * submitted to its specific API. */ UrlApiImp.preprocessor = function(chunnel) { if (!Truth.isTrue(chunnel.get("adaption"))) { chunnel.set("adaption", UrlApiImp.DEFAULT_ADAPTION); } format = "us"; if (chunnel.get("adaption") != "nexis") { format = "uk"; } chunnel = LNParser.convertDateToQuery(chunnel, format); if (Truth.isTrue(chunnel.getSort())) { chunnel.setSort("da"); } if (Truth.isTrue(chunnel.pwd)) { // not working for auth // chunnel.protocol = "https:"; } if (!Truth.isTrue(chunnel.get("type"))) { chunnel.set("type", UrlApiImp.DEFAULT_TYPE); } if (!Truth.isTrue(chunnel.get("verb"))) { chunnel.set("verb", UrlApiImp.DEFAULT_VERB); } // For UK Rebranding. Changes uk/business mq calls to use uk/nexis if ((chunnel.get("adaption") == "uk") && (chunnel.get("type") == "business")) { chunnel.set("type", "nexis"); } if (chunnel.get("rt")) chunnel.set("rt", chunnel.get("rt").toLowerCase().replace(new RegExp("uk/business", "g"), "uk/nexis").replace("sourceinfo.do", "sourceInfo.do")); //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // Auto-convert libfile to CSI numbers //chunnel.setSource(UrlApiImp.libfileToCSI(chunnel.getSource())); //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // LEXSEE & LEXSTAT var type = chunnel.getSearchtype(); switch(type) { case "get": case "lexsee": case "lxe": case "lexstat": // Make sure that the source isn't already set if (!Truth.isTrue(chunnel.getSource())) { // http://psc744:6060/ssdf/guide/dynmff/bin/dynmff.pl?type=library&csi=12660&lvl=3 // Source: MEGA // chunnel.setSource("12660") chunnel.setSource("138150") // } break; default: break; } //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // CUI BUILDER CITATION // &citation=1+us+1 if (Truth.isTrue(chunnel.get("citation"))) { if (!Truth.isTrue(chunnel.getSource()) && !Truth.isTrue(chunnel.getSearch())) { chunnel.setSearch(chunnel.get("citation")) chunnel.setSource("12660") } } //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // Nexis searchforms if (chunnel.get("id")) { chunnel.set("verb", "sf") switch(chunnel.get("id")) { // Power Search case "-99": chunnel.set("sfi", "US00NBGenSrch"); break; // US Reports // Company Profile Page case "1928": chunnel.set("sfi", "US02NBCmpSrch"); break; // SEC Filings case "1940": case "2378": chunnel.set("sfi", "US02NBSECFilSrch"); break; // Mergers & Acquisitions case "1945": chunnel.set("sfi", "US02NBMergAcqSrch"); break; // Business Locator/Assets case "1930": chunnel.set("sfi", "US04NBBusLocSrch"); break; // Asset Locator case "2515": chunnel.set("sfi", "US04NBAssetLocSrch"); break; // Bankruptcy Filings case "1375": case "2517": chunnel.set("sfi", "US04NBBankrupSrch"); break; // Judgments case "2519": chunnel.set("sfi", "US04NBJudLiensSrch"); break; // Licenses case "2522": chunnel.set("sfi", "US04NBLicensesSrch"); break; // Civil & Criminal Filings case "2523": chunnel.set("sfi", "US04NBCivCrimSrch"); break; // D&B case "2524": chunnel.set("sfi", "US02NBDunBradSrch"); break; // Motor Vehicles Registrations case "2727": chunnel.set("sfi", "US04NBDriverSrch"); break; // Motor Vehicle Registrations case "2729": chunnel.set("sfi", "US04NBMotVehSrch"); break; // General News case "2888": chunnel.set("sfi", "US01NBSimplSrch"); break; // Edgar - SEC Real Time Filings case "2911": chunnel.set("sfi", "US02NBEdgarSrch"); break; } } return chunnel; }; /** * Returns the link that is the target for the API call. * This can be used as the action for a form or as the location * for a called to window.open. * * The query string is return based upon the chunnel values filtered * through the implementor's matrix */ UrlApiImp.getLink = function(chunnel) { var qs = SearchImplementor.getQueryString(chunnel, UrlApiImp.matrix); if (Truth.isTrue(qs)) { return UrlApiImp.getVerbPath(chunnel) + "?" + qs; } else { return UrlApiImp.getVerbPath(chunnel); } }; /** * Returns the form HTML to be used for a Post call. **/ UrlApiImp.getPostForm = function(chunnel) { var f = "<form method='post' action='"; f += UrlApiImp.getVerbPath(chunnel); f += "' id='masterQueryDynaForm' name='masterQueryDynaForm' target='"; f += chunnel.target; f += "'>"; f += SearchImplementor.getPostFields(chunnel, UrlApiImp.matrix) f += "</form>"; return f; }; /** * Returns the link that is the target for the API call. * This can be used as the action for a form or as the location * for a called to window.open. * * The query string is return based upon the chunnel values filtered * through the implementor's matrix */ UrlApiImp.getVerbPath = function(chunnel) { var domain = UrlApiImp.DEFAULT_DOMAIN; if (chunnel.domain !== "" && chunnel.get("adaption") == "nexis") { domain = UrlApiImp.DEFAULT_NEXIS_DOMAIN; } if (chunnel.domain && chunnel.domain !== "") { domain = chunnel.domain; } if (Truth.isTrue(chunnel.override)) { return chunnel.override; } else { var adaption = chunnel.get("adaption") if (adaption == "nexis") { adaption = "new" } var adLink = chunnel.protocol + "//" + domain + "/" + adaption; if (chunnel.get("adaption") != "nexis") { adLink += "/" + chunnel.get("type") } if (chunnel.get("verb") == "home") { return adLink + "/home/home.do"; } else { var apiVersion = UrlApiImp.DEFAULT_API_VERSION; if (chunnel.get("verb") == "accessGW") { var apiVersion = "api"; } if (Truth.isTrue(chunnel.get("apiVersion"))) { apiVersion = chunnel.get("apiVersion"); } return adLink + "/" + apiVersion + "/" + chunnel.get("verb"); } } }; /** * @constructor * @private */ function V1SearchImp() { throw new Error("V1SearchImp is a static class. Do not instantiate."); } V1SearchImp.DEFAULT_DOMAIN = "web.lexis-nexis.com"; V1SearchImp.DEFAULT_VERB = "v1_search"; // Create API Matrix // The matrix is used to cast object elements into those used by the API. V1SearchImp.matrix = new Object(); // Filter out MQ fields that we don't want in the query string // V1SearchImp.matrix.pwd = -1; // V1SearchImp.matrix.uid = -1; V1SearchImp.matrix.domain = -1; V1SearchImp.matrix.protocol = -1; V1SearchImp.matrix.lastName = -1; V1SearchImp.matrix.firstName = -1; V1SearchImp.matrix.companyName = -1; V1SearchImp.matrix.ssn = -1; V1SearchImp.matrix.streetAddress = -1; V1SearchImp.matrix.city = -1; V1SearchImp.matrix.state = -1; V1SearchImp.matrix.zip = -1; V1SearchImp.matrix.apinoadf = -1; V1SearchImp.matrix.verb = -1; V1SearchImp.matrix.TOCTarget = -1; // Describe which field names you need to cast into other values // specific to the API. V1SearchImp.matrix.client = "clientid"; V1SearchImp.matrix.menu = "_menu"; V1SearchImp.matrix.originationCode = "ORIGINATION_CODE"; V1SearchImp.matrix.search = "query"; V1SearchImp.matrix.sort = "newSortMode"; V1SearchImp.matrix.source = "src"; V1SearchImp.matrix.uid = "USER_ID"; V1SearchImp.matrix.pwd = "PASSWORD"; /** * This matric */ V1SearchImp.submit = function(chunnel) { // Preprocessor needs to convert generic after field // to XLink's relativedate field chunnel = V1SearchImp._preprocessor(chunnel); var linker = V1SearchImp.getLink(chunnel); // prompt("",linker); // If no target, set the target for the same window. if (!Truth.isTrue(chunnel.target)) { chunnel.target = "_self"; } // prompt("", linker) // And send it on its merry way var w = window.open(linker, chunnel.target, NEW_WINDOW_FEATURES); }; /** * Take any actions that need to be made on the MQ object before it gets * submitted to its specific API. */ V1SearchImp._preprocessor = function(chunnel) { if (Truth.isTrue(chunnel.pwd) || (chunnel.source.indexOf("SMRTLX") != -1)) { chunnel.protocol = "https:"; if (!Truth.isTrue(chunnel.get("LNAUTHSCHEME"))) { chunnel.set("LNAUTHSCHEME", "C"); } } if (!Truth.isTrue(chunnel.get("verb"))) { chunnel.set("verb", V1SearchImp.DEFAULT_VERB); } return chunnel; } V1SearchImp.getLink = function(chunnel) { var domain = V1SearchImp.DEFAULT_DOMAIN; if (chunnel.domain && chunnel.domain !== "") { domain = chunnel.domain; } var action; if (Truth.isTrue(chunnel.override)) { action = chunnel.override; } else { action = chunnel.protocol + "//" + domain + "/api.universe/" + chunnel.get("verb"); } return action + "?" + SearchImplementor.getQueryString(chunnel, V1SearchImp.matrix); };/** * MasterQuery Implementor for XLink. * @constructor * @private */ function XLinkImp() { throw new Error("XLinkImp is a static class. Do not instantiate."); } XLinkImp.DEFAULT_DOMAIN = "www.lexis.com"; XLinkImp.DEFAULT_ZONE_DOMAIN = "web.lexis-nexis.com"; // XLinkImp.DEFAULT_DOMAIN = "cert-2610.lexis.com"; // Create API Matrix // The matrix is used to cast object elements into those used by the API. XLinkImp.matrix = new Object(); // Filter out MQ fields that we don't want in the query string XLinkImp.matrix.pwd = -1; XLinkImp.matrix.uid = -1; XLinkImp.matrix.domain = -1; XLinkImp.matrix.protocol = -1; // Describe which field names you need to cast into other values // specific to the API. XLinkImp.matrix.originationCode = "ORIGINATION_CODE"; XLinkImp.matrix.sort = "sortby"; XLinkImp.matrix.TOCTarget = "target"; /** * Takes a chunnel object and submits it. The last step in the journey * of a chunnel object before it becomes a LN search result. */ XLinkImp.submit = function(chunnel) { //alert(SearchImplementor.getQueryString(chunnel, XLinkImp.matrix)); // Preprocessor needs to convert generic after field // to XLink's relativedate field XLinkImp._preprocessor(chunnel); var linker = XLinkImp.getLink(chunnel); // If no target, set the target for the same window. if (!Truth.isTrue(chunnel.target)) { chunnel.target = "_self"; } // prompt("", linker) if (XLinkImp.useGet(chunnel)) { var w = window.open(linker, chunnel.target, NEW_WINDOW_FEATURES); } else { var f = "<form method='post' action='"; f += linker; f += "' id='masterQueryDynaForm' name='masterQueryDynaForm' target='"; f += chunnel.target; f += "'>"; f += FormUtil.getHiddenFieldVal('USER_ID', chunnel.getUID()); f += FormUtil.getHiddenFieldVal('PASSWORD', chunnel.getPWD()); f += FormUtil.getHiddenFieldVal('LNAUTHSCHEME', 'CP'); f += "</form>"; SearchImplementor.submitDiv(f); } chunnel = null; }; /** * Take any actions that need to be made on the MQ object before it gets * submitted to its specific API. */ XLinkImp._preprocessor = function(chunnel) { var relativedate = LNParser.convertAfterToRelative(chunnel.getAfter()); chunnel.c_relativedate = relativedate; chunnel.after = ""; if (Truth.isTrue(chunnel.pwd)) { chunnel.protocol = "https:"; } return chunnel; }; /** * Returns the link that is the target for the API call. * This can be used as the action for a form or as the location * for a called to window.open. * * The query string is return based upon the chunnel values filtered * through the implementor's matrix */ XLinkImp.getLink = function(chunnel) { var domain; if (chunnel.zone && chunnel.zone !== "") { domain = XLinkImp.DEFAULT_ZONE_DOMAIN; } else { domain = XLinkImp.DEFAULT_DOMAIN; } if (chunnel.domain && chunnel.domain !== "") { domain = chunnel.domain; } var action if (Truth.isTrue(chunnel.override)) { action = chunnel.override; } else { action = chunnel.protocol + "//" + domain + "/research/xlink"; } return action + "?" + SearchImplementor.getQueryString(chunnel, XLinkImp.matrix); }; /** * Should we use get or post. If there's a username/pwd use post. */ XLinkImp.useGet = function(chunnel) { if (Truth.isTrue(chunnel.pwd) && Truth.isTrue(chunnel.uid)) { return false; } return true; } /** * Please use ppcmixed2/ppccpwd77 as id/pwd for uk/legal. * * http://www.lexisnexis.com/uk/legal/api/version1/sr?csi=267991&sr=police and legal&hd=t * @constructor * @private */ function UrlApiPubRecImp() { throw new Error("UrlApiPubRecImp is a static class. Do not instantiate."); } UrlApiPubRecImp.DEBUG = true; UrlApiPubRecImp.DEFAULT_DOMAIN = "www.lexisnexis.com"; UrlApiPubRecImp.DEFAULT_NEXIS_DOMAIN = "w3.nexis.com"; //UrlApiPubRecImp.DEFAULT_DOMAIN = "cdc1-www.lexisnexis.com"; //UrlApiPubRecImp.DEFAULT_NEXIS_DOMAIN = "cdc1-www.lexisnexis.com"; UrlApiPubRecImp.DEFAULT_ADAPTION = "uk"; UrlApiPubRecImp.DEFAULT_TYPE = "legal"; UrlApiPubRecImp.DEFAULT_API_VERSION = "api"; UrlApiPubRecImp.DEFAULT_VERB = "sr"; // Create API Matrix // The matrix is used to cast object elements into those used by the API. UrlApiPubRecImp.matrix = new Object(); // Filter out MQ fields that we don't want in the query string UrlApiPubRecImp.matrix.adaption = -1; UrlApiPubRecImp.matrix.domain = -1; UrlApiPubRecImp.matrix.protocol = -1; UrlApiPubRecImp.matrix.type = -1; UrlA