(function(){ var _1=ibmCfg.portalConfig.contentHandlerURI+"?uri=menu:${id}"; var _2=false; var _3=function(){ return i$.hasClass(document.getElementsByTagName("body")[0],"edit-mode"); }; if(typeof wptheme==="undefined"||!wptheme){ wptheme={}; } i$.mash(wptheme,{getWindowIDFromSkin:function(_4){ while((_4=_4.parentNode)!=null){ if(i$.hasClass(_4,"component-control")){ var m=_4&&(_4.className||"").match(/id-([\S]+)/); return m&&m[1]; } } return null; },getPortletState:function(_5){ var _6=i$.byId("portletState"); if(_6){ if(!_6._cache){ _6._cache=i$.fromJson(_6.innerHTML); _6._cache._defaults={"windowState":"normal","portletMode":"view"}; } if(_6._cache[_5]){ return _6._cache[_5]; }else{ return _6._cache._defaults; } } return {}; },isValidOp:function(_7){ if(_7.visibility===false){ return false; } var _8=_7.metadata||{}; switch(_7.id){ case "ibm.portal.operations.changePortletMode": return wptheme.getPortletState(_8.wid).portletMode!=_8.portletMode; case "ibm.portal.operations.changeWindowState": return wptheme.getPortletState(_8.wid).windowState!=_8.windowState; default: } return true; },operation:{changeToHelpMode:function(_9){ var _a=window.location.href; if(_9.actionUrl){ if(_9.actionUrl.indexOf("?")==0){ var _b=_a.indexOf("#"); if(_b!=-1){ var _c=_a.substring(0,_b); var _d=_a.substring(_b); _a=_c+(_c.indexOf("?")==-1?"?":"&")+_9.actionUrl.substring(1); _a+=_d; }else{ _a+=(_a.indexOf("?")==-1?"?":"&")+_9.actionUrl.substring(1); } }else{ _a=_9.actionUrl; } } window.open(_a,"","resizable=yes,scrollbars=yes,menubar=no,toolbar=no,status=no,width=800,height=600,screenX=10,screenY=10,top=10,left=10"); }},contextMenu:{cache:{},css:{focus:"wpthemeMenuFocus",disabled:"wpthemeMenuDisabled",show:"wpthemeMenuShow",error:"wpthemeMenuError",menuTemplate:"wpthemeTemplateMenu",submenuTemplate:"wpthemeTemplateSubmenu",loadingTemplate:"wpthemeTemplateLoading"},init:function(_e,_f,_10){ _e._contextMenu=_e._contextMenu||{}; _e._contextMenu.id=_e._contextMenu.id||Math.round(Math.random()*1000000000); _e.setAttribute("id",_e._contextMenu.id); _e._contextMenu.menuId=_f; _e._contextMenu.jsonQuery=_10; var _11=_e._contextMenu; var _12=function(){ i$.addClass(i$.byId(_11.id),wptheme.contextMenu.css.show); var _13=i$.byId(_11.id)._firstSelectable; if(_13){ _13.focus(); i$.byId(_11.id)._currentSelected=_13; } i$.bindDomEvt(i$.byId(_11.id),"onmouseleave",function(){ var _14=i$.byId(_11.id); i$.removeClass(_14,wptheme.contextMenu.css.show); var _15=_14._currentSelected; if(_15){ _15.blur(); } var _16=wptheme.contextMenu._findFocusNode(_14); ((_16)?_16:_14).focus(); }); }; wptheme.contextMenu._initialize(_e).then(_12,_12); _e=null; },initSubmenu:function(_17,_18,_19){ _17._contextMenu=_17._contextMenu||{}; _17._contextMenu._submenu=true; _17._contextMenu._menuitemTemplate=_19._menuitemTemplate; _17._contextMenu._subMenuTemplate=_19._subMenuTemplate; _17._contextMenu._loadingTemplate=_19._loadingTemplate; wptheme.contextMenu.init(_17,_18,_19.jsonQuery); },_findFocusNode:function(_1a){ var _1b,i,_1c; var _1d=function(_1e,_1f){ var l=_1e.childNodes.length; for(i=0;i=0;i--){ _24=_26.childNodes[i]; if(i$.hasClass(_24,wptheme.contextMenu.css.menuTemplate)){ _21=_24; continue; } if(i$.hasClass(_24,wptheme.contextMenu.css.submenuTemplate)){ _22=_24; continue; } if(i$.hasClass(_24,wptheme.contextMenu.css.loadingTemplate)){ _23=_24; continue; } if(_24.childNodes){ i=_25(_24,i); } } return _27; }; _25(_20); return {"menu":_21,"submenu":_22,"loading":_23}; },_invalidateCallback:function(){ wptheme.contextMenu.cache={}; },_initialize:function(_28){ var _29=_28._contextMenu; if(wptheme.contextMenu.cache[_29.id]||_29._inProgress){ return i$.promise.resolved(null); } _29._inProgress=true; i$.addListener("wptheme/contextMenu/invalidate/all",wptheme.contextMenu._invalidateCallback); var _2a,_2b,tmp=i$.createDom("div"); if(_29._submenu){ tmp.innerHTML=_29._subMenuTemplate.replace(/\$\{submenu-id\}/g,_29.id+"_menu"); _28.appendChild(tmp.firstChild); _2a=i$.byId(_29.id+"_menu"); _2b=i$.createDom("div"); _2b.innerHTML=_29._loadingTemplate; }else{ var _2c=wptheme.contextMenu._findNodes(_28); _2a=_2c.menu; if(!_29._menuitemTemplate){ _29._menuitemTemplate=i$.trim(_2a.innerHTML); } if(!_29._loadingTemplate){ _2b=i$.createDom("div"); _2b.appendChild(_2c.loading); _29._loadingTemplate=i$.trim(_2b.innerHTML); _2b=null; } _2b=i$.createDom("div"); _2b.innerHTML=_29._loadingTemplate; tmp.appendChild(_2c.submenu.cloneNode(true)); if(!_29._subMenuTemplate){ _29._subMenuTemplate=i$.trim(tmp.innerHTML); } } while(_2a.firstChild){ _2a.removeChild(_2a.firstChild); } _2a.appendChild(_2b); i$.addClass(_28,wptheme.contextMenu.css.show); return wptheme.contextMenu._load(_29).then(function(_2d){ var _2e=wptheme.contextMenu._parseData(_2d).then(function(_2f){ _2f=wptheme.contextMenu._filterMenu(_2f); if(!_2f||_2f.length==0){ var tmp=i$.createDom("div"); tmp.innerHTML=wptheme.contextMenu._fromTemplate(_29._menuitemTemplate,wptheme.contextMenu.css.error,"No items to display."); while(_2a.firstChild){ _2a.removeChild(_2a.firstChild); } _2a.appendChild(tmp); }else{ wptheme.contextMenu._buildMenu(_29,_2a,_2f); } wptheme.contextMenu.cache[_29.id]=true; }); _29._inProgress=false; return _2e; },function(){ var tmp=i$.createDom("div"); tmp.innerHTML=wptheme.contextMenu._fromTemplate(_29._menuitemTemplate,wptheme.contextMenu.css.error,"Error happened while loading the menu."); while(_2a.firstChild){ _2a.removeChild(_2a.firstChild); } _2a.appendChild(tmp); _29._inProgress=false; wptheme.contextMenu.cache[_29.id]=true; }); },_load:function(_30){ var _31=_1.replace(/\$\{id\}/g,_30.menuId); if(_30.jsonQuery){ _31+=(_31.indexOf("?")==-1?"?":"&")+i$.toQuery(_30.jsonQuery); } return i$.xhrGet({url:_31,headers:{"X-IBM-XHR":"true"},responseType:"json"}).then(function(_32){ return _32.data; },function(_33){ var _34=_33.xhr.getResponseHeader("Content-Type")||""; if((_34.indexOf("text/html")==0)||(_33.xhr.status==401)){ window.setTimeout(function(){ document.location.reload(); },0); } console.log("Error trying to load the context menu feed for '"+_30.menuId+"': "+_33); return null; }); },_parseData:function(_35){ var _36=[]; i$.each(_35,function(_37){ var _38=i$.fromPath("moduleInfo.deferred",false,_37)?i$.modules.loadDeferred():i$.promise.resolved(true); _36.push(_38.then(function(){ var _39=wptheme.contextMenu._checkFunction(_37,_37.visibilityFn,_37,(typeof _37.visibility!="undefined")?_37.visibility:true); var _3a=wptheme.contextMenu._checkFunction(_37,_37.enableFn,_37,(typeof _37.enabled!="undefined")?_37.enabled:true); return i$.whenAll(_39,_3a).then(function(_3b){ _37._visible=_3b[0]; _37._enabled=_3b[1]; return _37; }); })); }); return i$.whenAll.apply(i$,_36); },_filterMenu:function(_3c){ var _3d=[],_3e,_3f={"type":"Separator"}; for(var i=_3c.length-1;i>=0;i--){ _3e=_3c[i]; if(!_3e._visible){ continue; } if(_3e.type=="Separator"){ if(_3f.type=="Separator"){ continue; } }else{ if(_3e.type=="Header"){ if((_3f.type=="Separator")||(_3f.type=="Header")){ continue; } } } _3f=_3e; _3d.unshift(_3e); } while(_3d.length>0&&_3d[0].type=="Separator"){ _3d=_3d.slice(1); } return _3d; },_buildMenu:function(_40,_41,_42){ var _43=document.createDocumentFragment(),tmp=i$.createDom("div"),_44,_45,_46,_47; for(var i=0,l=_42.length;i= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.validate.regexp"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. dojo._hasResource["dojox.validate.regexp"] = true; dojo.provide("dojox.validate.regexp"); dojo.require("dojo.regexp"); dojo.mixin(dojox.validate.regexp, { ipAddress: function(/*Object?*/flags){ // summary: Builds a RE that matches an IP Address // // description: // Supports 5 formats for IPv4: dotted decimal, dotted hex, dotted octal, decimal and hexadecimal. // Supports 2 formats for Ipv6. // // flags An object. All flags are boolean with default = true. // flags.allowDottedDecimal Example, 207.142.131.235. No zero padding. // flags.allowDottedHex Example, 0x18.0x11.0x9b.0x28. Case insensitive. Zero padding allowed. // flags.allowDottedOctal Example, 0030.0021.0233.0050. Zero padding allowed. // flags.allowDecimal Example, 3482223595. A decimal number between 0-4294967295. // flags.allowHex Example, 0xCF8E83EB. Hexadecimal number between 0x0-0xFFFFFFFF. // Case insensitive. Zero padding allowed. // flags.allowIPv6 IPv6 address written as eight groups of four hexadecimal digits. // FIXME: ipv6 can be written multiple ways IIRC // flags.allowHybrid IPv6 address written as six groups of four hexadecimal digits // followed by the usual 4 dotted decimal digit notation of IPv4. x:x:x:x:x:x:d.d.d.d // assign default values to missing paramters flags = (typeof flags == "object") ? flags : {}; if(typeof flags.allowDottedDecimal != "boolean"){ flags.allowDottedDecimal = true; } if(typeof flags.allowDottedHex != "boolean"){ flags.allowDottedHex = true; } if(typeof flags.allowDottedOctal != "boolean"){ flags.allowDottedOctal = true; } if(typeof flags.allowDecimal != "boolean"){ flags.allowDecimal = true; } if(typeof flags.allowHex != "boolean"){ flags.allowHex = true; } if(typeof flags.allowIPv6 != "boolean"){ flags.allowIPv6 = true; } if(typeof flags.allowHybrid != "boolean"){ flags.allowHybrid = true; } // decimal-dotted IP address RE. var dottedDecimalRE = // Each number is between 0-255. Zero padding is not allowed. "((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])"; // dotted hex IP address RE. Each number is between 0x0-0xff. Zero padding is allowed, e.g. 0x00. var dottedHexRE = "(0[xX]0*[\\da-fA-F]?[\\da-fA-F]\\.){3}0[xX]0*[\\da-fA-F]?[\\da-fA-F]"; // dotted octal IP address RE. Each number is between 0000-0377. // Zero padding is allowed, but each number must have at least 4 characters. var dottedOctalRE = "(0+[0-3][0-7][0-7]\\.){3}0+[0-3][0-7][0-7]"; // decimal IP address RE. A decimal number between 0-4294967295. var decimalRE = "(0|[1-9]\\d{0,8}|[1-3]\\d{9}|4[01]\\d{8}|42[0-8]\\d{7}|429[0-3]\\d{6}|" + "4294[0-8]\\d{5}|42949[0-5]\\d{4}|429496[0-6]\\d{3}|4294967[01]\\d{2}|42949672[0-8]\\d|429496729[0-5])"; // hexadecimal IP address RE. // A hexadecimal number between 0x0-0xFFFFFFFF. Case insensitive. Zero padding is allowed. var hexRE = "0[xX]0*[\\da-fA-F]{1,8}"; // IPv6 address RE. // The format is written as eight groups of four hexadecimal digits, x:x:x:x:x:x:x:x, // where x is between 0000-ffff. Zero padding is optional. Case insensitive. var ipv6RE = "([\\da-fA-F]{1,4}\\:){7}[\\da-fA-F]{1,4}"; // IPv6/IPv4 Hybrid address RE. // The format is written as six groups of four hexadecimal digits, // followed by the 4 dotted decimal IPv4 format. x:x:x:x:x:x:d.d.d.d var hybridRE = "([\\da-fA-F]{1,4}\\:){6}" + "((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])"; // Build IP Address RE var a = []; if(flags.allowDottedDecimal){ a.push(dottedDecimalRE); } if(flags.allowDottedHex){ a.push(dottedHexRE); } if(flags.allowDottedOctal){ a.push(dottedOctalRE); } if(flags.allowDecimal){ a.push(decimalRE); } if(flags.allowHex){ a.push(hexRE); } if(flags.allowIPv6){ a.push(ipv6RE); } if(flags.allowHybrid){ a.push(hybridRE); } var ipAddressRE = ""; if(a.length > 0){ ipAddressRE = "(" + a.join("|") + ")"; } return ipAddressRE; // String }, host: function(/*Object?*/flags){ // summary: Builds a RE that matches a host // description: A host is a named host (A-z0-9_- but not starting with -), a domain name or an IP address, possibly followed by a port number. // flags: An object. // flags.allowNamed Allow a named host for local networks. Default is false. // flags.allowIP Allow an IP address for hostname. Default is true. // flags.allowLocal Allow the host to be "localhost". Default is false. // flags.allowPort Allow a port number to be present. Default is true. // flags in regexp.ipAddress can be applied. // assign default values to missing paramters flags = (typeof flags == "object") ? flags : {}; if(typeof flags.allowIP != "boolean"){ flags.allowIP = true; } if(typeof flags.allowLocal != "boolean"){ flags.allowLocal = false; } if(typeof flags.allowPort != "boolean"){ flags.allowPort = true; } if(typeof flags.allowNamed != "boolean"){ flags.allowNamed = false; } //TODO: support unicode hostnames? // Domain name labels can not end with a dash. var domainLabelRE = "(?:[\\da-zA-Z](?:[-\\da-zA-Z]{0,61}[\\da-zA-Z])?)"; var domainNameRE = "(?:[a-zA-Z](?:[-\\da-zA-Z]{0,6}[\\da-zA-Z])?)"; // restricted version to allow backwards compatibility with allowLocal, allowIP // port number RE var portRE = flags.allowPort ? "(\\:\\d+)?" : ""; // build host RE var hostNameRE = "((?:" + domainLabelRE + "\\.)+" + domainNameRE + "\\.?)"; if(flags.allowIP){ hostNameRE += "|" + dojox.validate.regexp.ipAddress(flags); } if(flags.allowLocal){ hostNameRE += "|localhost"; } if(flags.allowNamed){ hostNameRE += "|^[^-][a-zA-Z0-9_-]*"; } return "(" + hostNameRE + ")" + portRE; // String }, url: function(/*Object?*/flags){ // summary: Builds a regular expression that matches a URL // // flags: An object // flags.scheme Can be true, false, or [true, false]. // This means: required, not allowed, or match either one. // flags in regexp.host can be applied. // flags in regexp.ipAddress can be applied. // assign default values to missing paramters flags = (typeof flags == "object") ? flags : {}; if(!("scheme" in flags)){ flags.scheme = [true, false]; } // Scheme RE var protocolRE = dojo.regexp.buildGroupRE(flags.scheme, function(q){ if(q){ return "(https?|ftps?)\\://"; } return ""; } ); // Path and query and anchor RE var pathRE = "(/(?:[^?#\\s/]+/)*(?:[^?#\\s/]+(?:\\?[^?#\\s/]*)?(?:#[A-Za-z][\\w.:-]*)?)?)?"; return protocolRE + dojox.validate.regexp.host(flags) + pathRE; }, emailAddress: function(/*Object?*/flags){ // summary: Builds a regular expression that matches an email address // //flags: An object // flags.allowCruft Allow address like . Default is false. // flags in regexp.host can be applied. // flags in regexp.ipAddress can be applied. // assign default values to missing paramters flags = (typeof flags == "object") ? flags : {}; if (typeof flags.allowCruft != "boolean") { flags.allowCruft = false; } flags.allowPort = false; // invalid in email addresses // user name RE per rfc5322 var usernameRE = "([!#-'*+\\-\\/-9=?A-Z^-~]+[.])*[!#-'*+\\-\\/-9=?A-Z^-~]+"; // build emailAddress RE var emailAddressRE = usernameRE + "@" + dojox.validate.regexp.host(flags); // Allow email addresses with cruft if ( flags.allowCruft ) { emailAddressRE = "?"; } return emailAddressRE; // String }, emailAddressList: function(/*Object?*/flags){ // summary: Builds a regular expression that matches a list of email addresses. // // flags: An object. // flags.listSeparator The character used to separate email addresses. Default is ";", ",", "\n" or " ". // flags in regexp.emailAddress can be applied. // flags in regexp.host can be applied. // flags in regexp.ipAddress can be applied. // assign default values to missing paramters flags = (typeof flags == "object") ? flags : {}; if(typeof flags.listSeparator != "string"){ flags.listSeparator = "\\s;,"; } // build a RE for an Email Address List var emailAddressRE = dojox.validate.regexp.emailAddress(flags); var emailAddressListRE = "(" + emailAddressRE + "\\s*[" + flags.listSeparator + "]\\s*)*" + emailAddressRE + "\\s*[" + flags.listSeparator + "]?\\s*"; return emailAddressListRE; // String }, numberFormat: function(/*Object?*/flags){ // summary: Builds a regular expression to match any sort of number based format // description: // Use this method for phone numbers, social security numbers, zip-codes, etc. // The RE can match one format or one of multiple formats. // // Format // # Stands for a digit, 0-9. // ? Stands for an optional digit, 0-9 or nothing. // All other characters must appear literally in the expression. // // Example // "(###) ###-####" -> (510) 542-9742 // "(###) ###-#### x#???" -> (510) 542-9742 x153 // "###-##-####" -> 506-82-1089 i.e. social security number // "#####-####" -> 98225-1649 i.e. zip code // // flags: An object // flags.format A string or an Array of strings for multiple formats. // assign default values to missing paramters flags = (typeof flags == "object") ? flags : {}; if(typeof flags.format == "undefined"){ flags.format = "###-###-####"; } // Converts a number format to RE. var digitRE = function(format){ // escape all special characters, except '?' return dojo.regexp.escapeString(format, "?") // Now replace '?' with Regular Expression .replace(/\?/g, "\\d?") // replace # with Regular Expression .replace(/#/g, "\\d") ; }; // build RE for multiple number formats return dojo.regexp.buildGroupRE(flags.format, digitRE); //String } }); dojox.validate.regexp.ca = { postalCode: function(){ // summary: String regular Express to match Canadain Postal Codes return "([A-Z][0-9][A-Z] [0-9][A-Z][0-9])"; }, province: function(){ // summary: a regular expression to match Canadian Province Abbreviations return "(AB|BC|MB|NB|NL|NS|NT|NU|ON|PE|QC|SK|YT)"; } }; dojox.validate.regexp.us = { state: function(/*Object?*/flags){ // summary: A regular expression to match US state and territory abbreviations // // flags An object. // flags.allowTerritories Allow Guam, Puerto Rico, etc. Default is true. // flags.allowMilitary Allow military 'states', e.g. Armed Forces Europe (AE). Default is true. // assign default values to missing paramters flags = (typeof flags == "object") ? flags : {}; if(typeof flags.allowTerritories != "boolean"){ flags.allowTerritories = true; } if(typeof flags.allowMilitary != "boolean"){ flags.allowMilitary = true; } // state RE var statesRE = "AL|AK|AZ|AR|CA|CO|CT|DE|DC|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|" + "NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY"; // territories RE var territoriesRE = "AS|FM|GU|MH|MP|PW|PR|VI"; // military states RE var militaryRE = "AA|AE|AP"; // Build states and territories RE if(flags.allowTerritories){ statesRE += "|" + territoriesRE; } if(flags.allowMilitary){ statesRE += "|" + militaryRE; } return "(" + statesRE + ")"; // String } }; } /* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.validate._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. dojo._hasResource["dojox.validate._base"] = true; dojo.provide("dojox.validate._base"); dojo.experimental("dojox.validate"); dojo.require("dojo.regexp"); // dojo core expressions dojo.require("dojo.number"); // dojo number expressions dojo.require("dojox.validate.regexp"); // additional expressions dojox.validate.isText = function(/*String*/value, /*Object?*/flags){ // summary: // Checks if a string has non whitespace characters. // Parameters allow you to constrain the length. // // value: A string // flags: {length: Number, minlength: Number, maxlength: Number} // flags.length If set, checks if there are exactly flags.length number of characters. // flags.minlength If set, checks if there are at least flags.minlength number of characters. // flags.maxlength If set, checks if there are at most flags.maxlength number of characters. flags = (typeof flags == "object") ? flags : {}; // test for text if(/^\s*$/.test(value)){ return false; } // Boolean // length tests if(typeof flags.length == "number" && flags.length != value.length){ return false; } // Boolean if(typeof flags.minlength == "number" && flags.minlength > value.length){ return false; } // Boolean if(typeof flags.maxlength == "number" && flags.maxlength < value.length){ return false; } // Boolean return true; // Boolean } dojox.validate._isInRangeCache = {}; dojox.validate.isInRange = function(/*String*/value, /*Object?*/flags){ // summary: // Validates whether a string denoting a number // is between a max and min. // // value: A string // flags: {max:Number, min:Number, decimal:String} // flags.max A number, which the value must be less than or equal to for the validation to be true. // flags.min A number, which the value must be greater than or equal to for the validation to be true. // flags.decimal The character used for the decimal point. Default is ".". value = dojo.number.parse(value, flags); if(isNaN(value)){ return false; // Boolean } // assign default values to missing paramters flags = (typeof flags == "object") ? flags : {}; var max = (typeof flags.max == "number") ? flags.max : Infinity, min = (typeof flags.min == "number") ? flags.min : -Infinity, dec = (typeof flags.decimal == "string") ? flags.decimal : ".", cache = dojox.validate._isInRangeCache, cacheIdx = value + "max" + max + "min" + min + "dec" + dec ; if(typeof cache[cacheIdx] != "undefined"){ return cache[cacheIdx]; } cache[cacheIdx] = !(value < min || value > max); return cache[cacheIdx]; // Boolean } dojox.validate.isNumberFormat = function(/* String */value, /* Object? */flags){ // summary: Validates any sort of number based format // // description: // Validates any sort of number based format. Use it for phone numbers, // social security numbers, zip-codes, etc. The value can be validated // against one format or one of multiple formats. // // Format Definition // | # Stands for a digit, 0-9. // | ? Stands for an optional digit, 0-9 or nothing. // All other characters must appear literally in the expression. // // example: // | "(###) ###-####" -> (510) 542-9742 // | "(###) ###-#### x#???" -> (510) 542-9742 x153 // | "###-##-####" -> 506-82-1089 i.e. social security number // | "#####-####" -> 98225-1649 i.e. zip code // // value: A string // // flags: Object? // FIXME: make pseudo-object for this // format: String // // flags.format A string or an Array of strings for multiple formats. // // example: // | // returns true: // | dojox.validate.isNumberFormat("123-45", { format:"###-##" }); // // example: // Check Multiple formats: // | dojox.validate.isNumberFormat("123-45", { // | format:["### ##","###-##","## ###"] // | }); // var re = new RegExp("^" + dojox.validate.regexp.numberFormat(flags) + "$", "i"); return re.test(value); // Boolean } dojox.validate.isValidLuhn = function(/* String */value){ // summary: Validate a String value against the Luhn algorithm. // description: // Validate a String value against the Luhn algorithm to verify // its integrity. var sum = 0, parity, curDigit; if(!dojo.isString(value)){ value = String(value); } value = value.replace(/[- ]/g,''); //ignore dashes and whitespaces parity = value.length % 2; for(var i = 0; i < value.length; i++){ curDigit = parseInt(value.charAt(i)); if(i % 2 == parity){ curDigit *= 2; } if(curDigit > 9){ curDigit -= 9; } sum += curDigit; } return !(sum % 10); // Boolean } } /* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.validate"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. dojo._hasResource["dojox.validate"] = true; dojo.provide("dojox.validate"); dojo.require("dojox.validate._base"); } /* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.validate.creditCard"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. dojo._hasResource["dojox.validate.creditCard"] = true; dojo.provide("dojox.validate.creditCard"); /*===== dojox.validate.creditCard = { // summary: // Module provides validation functions for Credit Cards, using account number // rules in conjunction with the Luhn algorigthm, with a plugable card info database. }; =====*/ dojo.require("dojox.validate._base"); dojox.validate._cardInfo = { // summary: A dictionary list of credit card abbreviations // // description: // // A hash of valid CC abbreviations and regular expressions // // mc: Mastercard // ec: Eurocard // vi: Visa // ax: American Express // dc: Diners Club // bl: Carte Blanch // di: Discover // jcb: JCB // er: Enroute // // example: // Define your own card, gift-card, whatever. Starts with 7, // is 15 total length. // | dojo.mixin(dojox.validate._cardInfo, { // | "my":"7[0-9]{14}" // | }); 'mc':'5[1-5][0-9]{14}', 'ec':'5[1-5][0-9]{14}', 'vi':'4(?:[0-9]{12}|[0-9]{15})', 'ax':'3[47][0-9]{13}', 'dc':'3(?:0[0-5][0-9]{11}|[68][0-9]{12})', 'bl':'3(?:0[0-5][0-9]{11}|[68][0-9]{12})', 'di':'6011[0-9]{12}', 'jcb':'(?:3[0-9]{15}|(2131|1800)[0-9]{11})', 'er':'2(?:014|149)[0-9]{11}' } dojox.validate.isValidCreditCard = function(value, ccType){ // summary: Validate a credit card number by type with Luhn checking. // // description: // Checks if a credit card type matches the # scheme in a passed value, and if // the Luhn checksum is accurate (unless its an Enroute card, in which case // the checkSum is skipped), returning a Boolean to check against. // // value: String|Int // A Value (credit card number) to validate // // ccType: String // A credit-card abbreviation. // // example: // | if(dojox.validate.isValidCreditCard("12345", "mc")){ // | console.log('inconceivable'); // | } return ((ccType.toLowerCase() == 'er' || dojox.validate.isValidLuhn(value)) && dojox.validate.isValidCreditCardNumber(value, ccType.toLowerCase())); // Boolean } dojox.validate.isValidCreditCardNumber = function(value, ccType){ // summary: // Checks if value matches the pattern for that card or any card types if none is specified // // value: String|Int // CC #, white spaces and dashes are ignored // // ccType: String? // One of the abbreviation values in `dojox.validate._cardInfo` -- // if Omitted, function returns a `|` delimited string of matching card types, // or false if no matches found. value = String(value).replace(/[- ]/g,''); //ignore dashes and whitespaces var cardinfo = dojox.validate._cardInfo, results = []; if(ccType){ var expr = '^' + cardinfo[ccType.toLowerCase()] + '$'; return expr ? !!value.match(expr) : false; // boolean } for(var p in cardinfo){ if(value.match('^' + cardinfo[p] + '$')){ results.push(p); } } return results.length ? results.join('|') : false; // String | boolean } dojox.validate.isValidCvv = function(/* String|Int */value, /* String */ccType) { // summary: // Validate the security code (CCV) for a passed credit-card type. // // description: // // value: if(!dojo.isString(value)){ value = String(value); } var format; switch (ccType.toLowerCase()){ case 'mc': case 'ec': case 'vi': case 'di': format = '###'; break; case 'ax': format = '####'; break; } return !!format && value.length && dojox.validate.isNumberFormat(value, { format: format }); // Boolean } } /* Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.validate.web"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. dojo._hasResource["dojox.validate.web"] = true; dojo.provide("dojox.validate.web"); dojo.require("dojox.validate._base"); dojox.validate.isIpAddress = function(/*String*/value, /*Object?*/flags) { // summary: Validates an IP address // // description: // Supports 5 formats for IPv4: dotted decimal, dotted hex, dotted octal, decimal and hexadecimal. // Supports 2 formats for Ipv6. // // value A string. // flags An object. All flags are boolean with default = true. // flags.allowDottedDecimal Example, 207.142.131.235. No zero padding. // flags.allowDottedHex Example, 0x18.0x11.0x9b.0x28. Case insensitive. Zero padding allowed. // flags.allowDottedOctal Example, 0030.0021.0233.0050. Zero padding allowed. // flags.allowDecimal Example, 3482223595. A decimal number between 0-4294967295. // flags.allowHex Example, 0xCF8E83EB. Hexadecimal number between 0x0-0xFFFFFFFF. // Case insensitive. Zero padding allowed. // flags.allowIPv6 IPv6 address written as eight groups of four hexadecimal digits. // flags.allowHybrid IPv6 address written as six groups of four hexadecimal digits // followed by the usual 4 dotted decimal digit notation of IPv4. x:x:x:x:x:x:d.d.d.d var re = new RegExp("^" + dojox.validate.regexp.ipAddress(flags) + "$", "i"); return re.test(value); // Boolean } dojox.validate.isUrl = function(/*String*/value, /*Object?*/flags) { // summary: Checks if a string could be a valid URL // value: A string // flags: An object // flags.scheme Can be true, false, or [true, false]. // This means: required, not allowed, or either. // flags in regexp.host can be applied. // flags in regexp.ipAddress can be applied. // flags in regexp.tld can be applied. var re = new RegExp("^" + dojox.validate.regexp.url(flags) + "$", "i"); return re.test(value); // Boolean } dojox.validate.isEmailAddress = function(/*String*/value, /*Object?*/flags) { // summary: Checks if a string could be a valid email address // // value: A string // flags: An object // flags.allowCruft Allow address like . Default is false. // flags in regexp.host can be applied. // flags in regexp.ipAddress can be applied. // flags in regexp.tld can be applied. var re = new RegExp("^" + dojox.validate.regexp.emailAddress(flags) + "$", "i"); return re.test(value); // Boolean } dojox.validate.isEmailAddressList = function(/*String*/value, /*Object?*/flags) { // summary: Checks if a string could be a valid email address list. // // value A string. // flags An object. // flags.listSeparator The character used to separate email addresses. Default is ";", ",", "\n" or " ". // flags in regexp.emailAddress can be applied. // flags in regexp.host can be applied. // flags in regexp.ipAddress can be applied. // flags in regexp.tld can be applied. var re = new RegExp("^" + dojox.validate.regexp.emailAddressList(flags) + "$", "i"); return re.test(value); // Boolean } dojox.validate.getEmailAddressList = function(/*String*/value, /*Object?*/flags) { // summary: Check if value is an email address list. If an empty list // is returned, the value didn't pass the test or it was empty. // // value: A string // flags: An object (same as dojo.validate.isEmailAddressList) if(!flags) { flags = {}; } if(!flags.listSeparator) { flags.listSeparator = "\\s;,"; } if ( dojox.validate.isEmailAddressList(value, flags) ) { return value.split(new RegExp("\\s*[" + flags.listSeparator + "]\\s*")); // Array } return []; // Array } } /************************************************************* * Replacement for missing Array methods in IE<9 *************************************************************/ 'use strict'; try { // Add ECMA262-5 method binding if not supported natively // if (!('bind' in Function.prototype)) { Function.prototype.bind= function(owner) { var that= this; if (arguments.length<=1) { return function() { return that.apply(owner, arguments); }; } else { var args= Array.prototype.slice.call(arguments, 1); return function() { return that.apply(owner, arguments.length===0? args : args.concat(Array.prototype.slice.call(arguments))); }; } }; } // Add ECMA262-5 string trim if not supported natively // if (!('trim' in String.prototype)) { String.prototype.trim= function() { return this.replace(/^\s+/, '').replace(/\s+$/, ''); }; } // Add ECMA262-5 Array methods if not supported natively // if (!('indexOf' in Array.prototype)) { Array.prototype.indexOf= function(find, i /*opt*/) { if (i===undefined) i= 0; if (i<0) i+= this.length; if (i<0) i= 0; for (var n= this.length; ithis.length-1) i= this.length-1; for (i++; i-->0;) /* i++ because from-argument is sadly inclusive */ if (i in this && this[i]===find) return i; return -1; }; } if (!('forEach' in Array.prototype)) { Array.prototype.forEach= function(action, that /*opt*/) { for (var i= 0, n= this.length; i " + e); } } /************************************************************* * End replacement for missing Array methods in IE<9 *************************************************************/ /************************ Logout Diaglog *******************************************/ try { dojo.addOnLoad(function() { if (djConfig.parseOnLoad != true) { dojo.parser.parse("header-logo-myrta"); } }); dojo.require("dijit.Dialog"); function displayPopup() { var modalQuery = dojo.query("#logoutPopup"); var winW = dojo.position(dojo.query('body')[0], true).w; var popW = modalQuery.style('width'); if (popW == 0) { /* fixed for ie8 WAI */ popW = 254; } modalQuery.style('left', ((winW - popW) / 2) + 'px'); modalQuery.style('width', popW + 'px'); dijit.byId("logoutConfirmPopup").show(); } } catch (e) { if (window.console) { console.log("Error initialising Logout Dialog: " + e); } } /************************ End Logout Diaglog *******************************************/ /* finding and doing things to html objects */ dojo.require("dojo._base.query"); dojo.require("dojo.NodeList-traverse"); dojo.require("dojo.NodeList-manipulate"); dojo.require("dojo.NodeList-fx"); dojo.require("dojo.NodeList-data"); /* effects like sliding */ dojo.require("dojo.fx"); /* form validation */ dojo.require("dojox.validate"); dojo.require("dojox.validate.web"); //load the parser dojo.require('dojo.parser'); var submitHelpers = new Array(); dojo.declare("LocationSelect", [dijit.form.FilteringSelect], { _onBlur: function(){ //do nothing } }); dojo.extend(dijit.form.RadioButton, { startup : function() { //allow for input looping in chrome (which currently does not support automatically) if( dojo.query('.rms_expandArea input[type="radio"]') && dojo.isChrome) { dojo.connect(dijit.byId(this.id),'onKeyDown', function(e) { var lastElement = null; var firstElement = null; var closestArea = dojo.query("#"+this.id).closest('.rms_expandArea')[0]; if(dojo.query(closestArea).query('input[name="'+this.name+'"]').length == 1) { lastElement = dojo.query('input[name="'+this.name+'"]')[dojo.query('input[name="'+this.name+'"]').length-1]; firstElement = dojo.query('input[name="'+this.name+'"]')[0]; } else { lastElement = dojo.query(closestArea).query('input[name="'+this.name+'"]:enabled')[dojo.query(closestArea).query('input[name="'+this.name+'"]:enabled').length-1]; firstElement = dojo.query(closestArea).query('input[name="'+this.name+'"]:enabled')[0]; } if (this.id == lastElement.id && e.keyCode == 40) { firstElement.focus(); dijit.byId(firstElement.id).set('checked', true); } if (this.id == firstElement.id && e.keyCode == 38) { lastElement.focus(); dijit.byId(lastElement.id).set('checked', true); } }); } //allow for tabindexing on IE if( dojo.query('.rms_expandArea input[type="radio"]') && dojo.isIE) { var rb = this; dojo.connect(this.domNode, 'onkeypress', function(e) { var widgetList = dijit.findWidgets(dojo.query(rb.domNode).closest('.rms_inner')[0]); if(e.keyCode == 9 && !e.shiftKey && (dojo.hasClass(this, 'rms_batItem') || dojo.hasClass(this, 'rms_subformItem')) ) { //search for next tabindex within rms_inner and focus to it if(!dojo.some(widgetList, function(w) { if(w.tabIndex > rb.tabIndex) { dojo.stopEvent(e); dijit.byId(w.id).focus(); return true; } })) { //if no next item found, check for nextbutton and focus it if(!dojo.byId('nextButton').disabled) { dojo.stopEvent(e); dijit.byId('nextButton').focus(); } else { dojo.stopEvent(e); dijit.byId(dojo.query('#container').query('a')[0]).focus(); } } } if(e.keyCode == 9 && e.shiftKey && (dojo.hasClass(this, 'rms_batItem') || dojo.hasClass(this, 'rms_subformItem')) ) { //search for previous tabindex within rms_inner and focus to it if(!dojo.some(widgetList, function(w) { if(w.tabIndex < rb.tabIndex && w.tabIndex != -1) { dojo.stopEvent(e); dijit.byId(w.id).focus(); return true; } })) { dojo.stopEvent(e); dijit.byId(dojo.query(rb.domNode).closest('.rms_expandArea').query('.rms_testGroup input')[0]).focus() } } if(e.keyCode == 9 && !e.shiftKey && !dijit.byId(this).disabled && dojo.hasClass(this, 'rms_testGroup') ) { //as tabbing isn't from accordion headers also fix header tabs dojo.stopEvent(e); dijit.byId(dojo.query(this).closest('.rms_expandArea').query('.rms_expContent input')[0]).focus(); } }); } } }); dojo.ready(function(){ /* add events to radios with .rms_forceRadioGroup, forces other radios with same group name but in other forms to act like radios */ dojo.query('.rms_forceRadioGroup input[type=radio]').forEach(function(node, index, array){ var radioId = dojo.query(node).attr('id').toString(); var radioDijit = dijit.byId(radioId); var groupName = dojo.query(node).attr('name'); var groupList = dojo.query('input[type=radio][name='+groupName.toString()+']'); //add onchange event, when checked, uncheck other checked radios in group dojo.connect(radioDijit,'onChange',function(e){ if(radioDijit.checked){ groupList.forEach(function(node, index, array){ if(radioId != dojo.query(node).attr('id').toString()){ dijit.byId(dojo.query(node).attr('id').toString()).setChecked(false); } }); } }); }); /* end .rms_forceRadioGroup */ /* start code for expanding collapsing radio button areas */ dojo.query('.rms_initChecked').forEach(function(node, index, array){ var checkboxObj = dijit.byId(dojo.query(node).query('input').attr('id').toString()); checkboxObj.setChecked(true); }); dojo.query(".rms_expandArea h2 .dijitRadio input, .rms_expLink .dijitCheckBox input").forEach(function(node, index, array){ attachEventsExpander(node); }); //close any options with class closed dojo.query('.rms_expLink.closed').next(".rms_expContent").style({"display":"none","overflow":"hidden"}); //set required selects to disabled, and other inputs too dojo.query('.rms_expLink.closed').next(".rms_expContent").query('select.rms_select.required').forEach(function(node, index, array){ dojo.query(node).attr('disabled',true); }); dojo.query('.rms_expLink.closed').next(".rms_expContent").forEach(function(node, index, array){ var widgets = dijit.findWidgets(node); dojo.forEach(widgets, function(w) { w.set("disabled", true); }); }); /* end code for expanding collapsing radio button areas */ /* setup steps scrolling actions - for when there are too many steps to fit on a page */ //move steps to left function stepsMoveLeft(n){ var m = 1; if(n){ m = n; } stepMover.style('left',(parseInt(stepMover.style('left')) - (m*stepWidth))+'px'); stepsOffset+=m; stepsShowLeft(); stepsShowRight(); } //move steps to right function stepsMoveRight(n){ stepMover.style('left',(parseInt(stepMover.style('left')) + stepWidth)+'px'); stepsOffset-=1; stepsShowLeft(); stepsShowRight(); } //check and show left button function stepsShowLeft(){ if(stepsOffset>0){ dojo.query(stepsLeftBtn).text('<< '+stepsOffset); stepsLeftBtn.parent().style('display','block'); stepMover.addClass('hasLeftBtn'); }else{ stepsLeftBtn.parent().style('display','none'); stepMover.removeClass('hasLeftBtn'); } } //check and show right button function stepsShowRight(){ //console.log(stepsTotalCount - stepsOffset); dojo.query(stepsRightBtn).text(stepsTotalCount - (stepsVisible + stepsOffset) + ' >>'); if((stepsTotalCount - stepsOffset) > stepsVisible){ stepsRightBtn.parent().style('display','block'); }else{ stepsRightBtn.parent().style('display','none'); } } //init, create extra div etc. var stepsList = dojo.query('#rms_stepsRow a:not(:first-child)'); var stepsVisible = 6; if(stepsList.length > stepsVisible){ stepsList.wrapAll('') var stepMover = dojo.query('#rms_stepsScrollInner'); var stepsOffset = 0; var stepsTotalCount = stepsList.length; var stepsRightBtn = dojo.query('#ssbRight a'); var stepsLeftBtn = dojo.query('#ssbLeft a'); var stepWidth = 120; //move to position current and next onscreen (current +1 should be right most visible - if off screen); var selectedPos = dojo.indexOf(stepsList,dojo.query('#rms_stepsScrollInner .black')[0]) + 1; if(selectedPos > stepsVisible){ var stepMove = selectedPos - stepsVisible; if(stepsTotalCount - selectedPos >= 1){ stepMove += 1; } stepsMoveLeft(stepMove); } dojo.connect(stepsRightBtn[0],'onclick',function(e){ stepsMoveLeft(); }); dojo.connect(stepsLeftBtn[0],'onclick',function(e){ stepsMoveRight(); }); stepsShowLeft(); stepsShowRight(); } /* end steps scrolling actions */ /* start expand collapse help page items */ dojo.query(".rms_helpSection h2.rms_expLink").forEach(function(node, index, array) { //wrap a link around contents var textStr = dojo.query(node).text(); textStr = textStr.replace(/^[ \s]+|[ \s]+$/g, ''); var contentObj = dojo.query(node).next(".rms_expContent"); if(!dojo.hasAttr(contentObj, 'id')){ contentObj.attr('id','expContent'+index); contentObj.attr('role','region'); contentObj.attr('aria-labelledby','expLink'+index); } dojo.query(node).wrapInner(""); }); //add click to link dojo.query('.rms_helpSection h2 a').forEach(function(node, index, array){ dojo.connect(node, 'onclick', function(e){ //console.log('open this one'); var sel = dojo.query(e.target).closest('.rms_expLink').text(); //expand next and hide others dojo.query('.rms_expLink').forEach(function(node, index, array){ if(sel == dojo.query(node).text() && !dojo.hasClass(node,'open')){ if(!dojo.hasClass(node,'open')){ dojo.query(node).query('a').attr('aria-expanded','true'); var t = dojo.query(node).addClass('open').next(".rms_expContent").removeClass('hiddenContent').wipeIn({ }).play(); } }else{ if(dojo.hasClass(node,'open')){ dojo.query(node).query('a').attr('aria-expanded','false'); var t = dojo.query(node).removeClass('open').next(".rms_expContent").wipeOut({ }).play(); } } }); dojo.stopEvent(e); return false; }); }); //hide the expands on start dojo.query('.rms_helpSection .rms_expLink').removeClass('open').query('a').attr('aria-expanded','false').closest('.rms_expLink').next(".rms_expContent").wipeOut({ duration:0 }).play(); //add expand all link to title dojo.query('.rms_addExpAll h2').prepend("Show all +"); //setup default toggle var if(dojo.query('#rms_expAll').length>0){ dojo.byId('rms_expAll').setAttribute('showingall', 'false'); dojo.connect(dojo.byId('rms_expAll'),'onclick', function(e){ //set a toggle var var linkObj = dojo.byId('rms_expAll'); var s = linkObj.getAttribute('showingall'); if(s == 'true'){ //hide items dojo.query('.rms_helpSection .rms_expLink').removeClass('open').query('a').attr('aria-expanded','false').closest('.rms_expLink').next(".rms_expContent").wipeOut({ }).play(); dojo.query(linkObj).innerHTML("Show all +"); linkObj.setAttribute('showingall','false'); }else{ //show items dojo.query('.rms_helpSection .rms_expLink').addClass('open').query('a').attr('aria-expanded','true').closest('.rms_expLink').next(".rms_expContent").wipeIn({ }).play(); dojo.query(linkObj).innerHTML("Hide all -"); linkObj.setAttribute('showingall','true'); } dojo.stopEvent(e); return false; }); } /* look for # variable in url and expand id */ var expVar = document.location.toString().substring(document.location.toString().indexOf('#')); //dojo.queryToObject(dojo.doc.location.search.substr((dojo.doc.location.search[0] === "?" ? 1 : 0))); //console.log('got url var?'+expVar); if(expVar.indexOf('#') == 0 && expVar.length>1){ var idString = expVar; dojo.query('h2'+idString).addClass('open').next(".rms_expContent").wipeIn({}).play(); } /* end expand collapse help page items */ /* terms and conditions checkbox */ dojo.query('.checkTerms').forEach(function(node, index, array){ var vId = dojo.query(node).query('input').attr('id'); var thisCheck = dijit.byId(vId.toString()); var formObj = dijit.byId( dojo.query(node).closest('form').attr('id').toString()); dojo.connect(thisCheck, "onChange", function(e){ formObj.enableNextCheck(); //if inside a h2, set the ht style to 'open' when checked parentHeaders = dojo.query(thisCheck.domNode).closest('h2'); if(parentHeaders.length>0){ if(thisCheck.checked){ parentHeaders.addClass('open'); }else{ parentHeaders.removeClass('open'); } } }); }); /* start open in popup window (eg. links to reports) */ dojo.query('.openInWindow').forEach(function(node, index, array){ var linkUrl = dojo.query(node).attr('href'); dojo.query(node).attr('href','javascript:;') //dojo.query(node).attr('onClick','openWindow("'+linkUrl+'","report","menubar=1,resizable=1,scrollbars=1,width=700,height=600");'); dojo.connect(node, "onclick", null, function(e){ window.open(linkUrl,"report","menubar=1,resizable=1,scrollbars=1,width=700,height=600"); return false; //dojo.stopEvent(e); }); }); //seperate solution for the multiple selection report link dojo.query('.openInWindowMultiple').forEach(function(node, index, array){ dojo.connect(node, "onclick", null, function(e){ //get the selected url var fId = dojo.query('form.expContent').attr('id'); var linkUrl = dijit.byId(fId.toString()).attr('value').expgroup; //if no url, show an error if(linkUrl == null){ dojo.query(node).before("
Please select a report to view
"); dojo.stopEvent(e); return false; }else{ //if a url, hide error and open report window.open(linkUrl,"report","menubar=1,resizable=1,scrollbars=1,width=700,height=600"); dojo.stopEvent(e); return false; } dojo.stopEvent(e); return false; }); }); /* end open in popup window */ /* add click to labels containing images for ie */ if(document.all && navigator.appVersion.indexOf("MSIE")>-1 && navigator.appVersion.indexOf("Windows")>-1) { var a = document.getElementsByTagName("label"); for(var i=0,j=a.length;i0){ nextBtnWidgit = dijit.byId('nextButton'); }else if(dojo.query('#'+objId+ ' .rms_submit ').length > 0){ nextBtnWidgit = dijit.byId(dojo.query('#'+objId+ ' .rms_submit button').attr('id').toString()); } } if(nextBtnWidgit){ nextBtnWidgit.set("disabled", true); } } /* end call to disable next button */ /* start display modal popup */ function displayModalById(mId,uId,stylesString){ //set width and position dojo.query('#'+mId).attr('style',stylesString); var winW = dojo.position(dojo.query('body')[0],true).w; var popW = dojo.query('#'+mId).style('width'); dojo.query('#'+mId).style('left',((winW-popW)/2)+'px'); dojo.query('#'+uId).removeClass('rms_hiddenContent'); var winH = dojo.position(dojo.byId(uId),true).h; var popH = dojo.query('#'+mId).style('height'); dojo.query('#'+mId).style('top',((winH-popH)/2)+'px'); //set to show dojo.query('#'+mId).removeClass('rms_hiddenOffscreen'); dojo.query('#'+mId).removeClass('rms_hiddenContent'); dojo.query('#'+mId).attr('aria-hidden','false'); //add close functionality etc like displayModal function //add click to close buttons dojo.query('#'+mId+' .modalClose').forEach(function(node, index, array){ dojo.connect(node,'onclick',function(e){ dojo.destroy(dojo.query(this).closest('.rms_modal').next('.rms_underlay')[0]); dojo.destroy(dojo.query(this).closest('.rms_modal')[0]); dojo.stopEvent(e); return false; }); }); var exitFunction; if(dojo.query('#'+mId+' .rms_btnClose').length > 0){ exitFunction = dojo.connect(dojo.query('.rms_modal .rms_btnClose')[0],'onclick',function(e){ goHome(); dojo.stopEvent(e); return false; }); } var modalWin = dojo.query('.rms_modal')[0]; modalWin.forceRefresh = function(){ dojo.query('#'+mId+'.rms_inner').style('height','100%'); } modalWin.closeWin = function(){ dojo.destroy(dojo.query(modalWin).next('.rms_underlay')[0]); dojo.destroy(modalWin); } modalWin.addSubmit = function(classBtn, idForm){ dojo.query(modalWin).query('.'+classBtn).connect('onclick',function(e){ document.getElementById(idForm).submit(); dojo.stopEvent(e); return false; }); } modalWin.setExitUrl = function(urlString){ if(dojo.query(modalWin).query('.rms_btnClose').length > 0){ dojo.disconnect(exitFunction); dojo.connect(dojo.query(modalWin).query('.rms_btnClose')[0],'onclick',function(e){ window.location = urlString; dojo.stopEvent(e); return false; }); } } return modalWin; } var modalCount = 0; function displayModal(titleVar,styleVar,classVar,contentVar){ //create the html, outer background div, modal divs var titleHtml = ''; if (titleVar && titleVar != ''){ titleHtml = '

'+titleVar+'

'; } modalCount++; var modalId="modalPop_"+modalCount; var modalCloseButtonId="modalCloseButton_"+modalCount; var h = "
close"+"
"+titleHtml+"
"+contentVar+"
 
"; dojo.query('body').append(h); var modalQuery = dojo.query('#'+modalId); if(classVar!='rms_timer minimalPopup' && modalQuery.query('.modalClose').style('display') != 'none'){ document.getElementById(modalCloseButtonId).focus(); } var winW = dojo.position(dojo.query('body')[0],true).w; var popW = modalQuery.style('width'); modalQuery.style('left',((winW-popW)/2)+'px'); var winH = dojo.position(dojo.byId('underlay'),true).h; var popH = modalQuery.style('height'); var modelTop = (winH-popH)/2; modelTop = (modelTop > 0) ? modelTop : 50; modalQuery.style('top',modelTop +'px'); //add click to close buttons modalQuery.query('.modalClose').forEach(function(node, index, array){ dojo.connect(node,'onclick',function(e){ dojo.destroy(dojo.query(this).closest('.rms_modal').next('.rms_underlay')[0]); dojo.destroy(dojo.query(this).closest('.rms_modal')[0]); dojo.stopEvent(e); return false; }); }); var exitFunction; if(modalQuery.query('.rms_btnClose').length > 0){ exitFunction = dojo.connect(modalQuery.query('.rms_btnClose')[0],'onclick',function(e){ goHome(); dojo.stopEvent(e); return false; }); } var modalWin = modalQuery[0]; modalWin.domNode = modalWin; modalWin.resetPosition = function(){ var popW = modalQuery.style('width'); modalQuery.style('left',((winW-popW)/2)+'px'); var popH = modalQuery.style('height'); modalQuery.style('top',((winH-popH)/2)+'px'); } modalWin.resetPositionCenterScreen = function(){ dojo.require("dijit._base.place"); var vp = dijit.getViewport(); var mW = modalQuery.style('width'); var heightOfViewPort = dijit.getViewport().h; if(dojo.style(dojo.byId('modalWithScroll'),'height') >= (0.7*heightOfViewPort)) { dojo.style(dojo.byId('modalWithScroll'),'height',((0.7)*heightOfViewPort)+'px'); } var mH = dojo.style(dojo.byId('modalWithScroll'),'height'); modalQuery.style('left',((vp.w - mW)/ 2)+'px'); modalQuery.style('top',((vp.h - mH)/ 2)+'px'); } modalWin.closeWin = function(){ dojo.destroy(dojo.query(modalWin).next('.rms_underlay')[0]); dojo.destroy(modalWin); } modalWin.addSubmit = function(classBtn, idForm){ modalQuery.query('.'+classBtn).connect('onclick',function(e){ document.getElementById(idForm).submit(); dojo.stopEvent(e); return false; }); } modalWin.setExitUrl = function(urlString){ if(modalQuery.query('.rms_btnClose').length > 0){ dojo.disconnect(exitFunction); dojo.connect(modalQuery.query('.rms_btnClose')[0],'onclick',function(e){ window.location = urlString; dojo.stopEvent(e); return false; }); } } return modalWin; } function goHome() { window.location = '/'; } /* end modal popup functions */ /* Start Accordion animation and trigger functions */ var ContentHeight = 235; var TimeToSlide = 350; function initAccordionOpen(divObj, digObj) { if(dojo.query(divObj[0]).query('.rms_inner').length>0){ //style changes before animation dojo.query(divObj[0]).style({"display":"block", "overflow":"hidden"}); dojo.query(divObj[0]).query('> .rms_inner').style({'display':'block', 'overflow':'visible'}); //set marginBoxes and disable next button var marginBox = dojo.marginBox(divObj[0]); dojo.marginBox(dojo.query(divObj[0]).query('.rms_inner')[0], {h: 0}); disableNextButton(digObj); if(divObj.data('anims')[0]){ divObj.data('anims')[0].stop(); } if (dojo.query('#inputSuburbName').length > 0) { dijit.byId('inputSuburbName').closeDropDown(); } divObj.data( 'anims', //the animation dojo.animateProperty({ node: divObj[0], properties: { height: {start: 0, end: marginBox.h }}, duration: TimeToSlide, onEnd: function(n) { //apply styles after animation dojo.query(divObj[0]).style({"overflow":"visible", 'height':'auto'}); dojo.query(divObj[0]).style("height","auto"); dojo.query(divObj[0]).parent().style("overflow","visible"); dojo.query(divObj[0]).query('> .rms_inner').style({'height':'auto','display':'block'}); setTimeout("enableFromParts('"+digObj+"')",50); } }) ) divObj.data('anims')[0].play(); } } function initAccordionClose(divObj,digObj){ if(dojo.query(divObj[0]).query('.rms_inner').length>0) { //style changes before animation dojo.query(divObj[0]).style("overflow", "hidden"); dojo.query(divObj[0]).query('> .rms_inner').style({"overflow":"hidden", 'height':'auto','display':'block'}); //set marginBoxes and disable next button var marginBox = dojo.marginBox(divObj[0]); disableNextButton(digObj); if(divObj.data('anims')[0]){ divObj.data('anims')[0].stop(); } divObj.data( 'anims', dojo.animateProperty({ node: divObj[0], properties: { height: {start: marginBox.h, end: 0 }}, duration: TimeToSlide, onEnd: function(n) { //apply styles after animation dojo.query(divObj[0]).style("height","auto"); dojo.query(divObj[0]).style("display","none"); setTimeout("disableFromParts('"+digObj+"')",150); } }) ) divObj.data('anims')[0].play(); } } /* end accordion functions */ /* start expand collapse events (rms_greyOnly stays expanded) */ function attachEventsExpander(node) { var checkedRadio = dojo.query(node).attr('id'); node.thisFormObj = dijit.byId(dojo.query(node).closest('form').attr('id').toString()); var mainLink = dojo.query(node).closest('.rms_expLink'); node.contentObj = dojo.query(node).closest('.rms_expLink').next(".rms_expContent"); if(node.contentObj.length > 0) { node.widgetList = dojo.query("[widgetid]", node.contentObj[0].id).map(dijit.byNode).filter(function(wid){ return wid;}); } else { node.widgetList = false; node.contentObj = false; } var dijitObj = dijit.byId(checkedRadio.toString()); var htmlObj = dojo.query(dijitObj.domNode); if(node.contentObj.length > 0) { if(dojo.hasClass(mainLink[0],'open')) { htmlObj.attr('aria-expanded','true'); } else { htmlObj.attr('aria-expanded','false'); } htmlObj.attr('aria-controls',node.contentObj.attr('id')); var labelObj = htmlObj.next('label') labelObj.attr('id','label'+labelObj.attr('for')); node.contentObj.attr('role','region'); node.contentObj.attr('aria-labelledby',labelObj.attr('id')); } dojo.connect(dijitObj,"onChange",function(e) { if(e){ var sel = dojo.query(this).attr('value'); if((mainLink.length > 0 && !dojo.hasClass(mainLink[0],'open')) || (node.contentObj.length > 0 && dojo.hasClass(node.contentObj[0],'hiddenContent'))) { mainLink.addClass('open'); if(node.contentObj.length>0) { if(dojo.hasClass(mainLink[0],'rms_greyOnly')) { enableFromParts(node.id); node.contentObj.removeClass('rms_isGrey'); } else { htmlObj.attr('aria-expanded','true'); initAccordionOpen(node.contentObj, node.id); } } else if(node.thisFormObj != null) { node.thisFormObj.enableNextCheck(); } } } else { mainLink.removeClass('open') if(node.contentObj.length > 0) { if(dojo.hasClass(mainLink[0],'rms_greyOnly')) { disableFromParts(node.id); node.contentObj.addClass('rms_isGrey'); } else { htmlObj.attr('aria-expanded','false'); initAccordionClose(node.contentObj, node.id); } } else if(node.thisFormObj != null) { node.thisFormObj.enableNextCheck(); } } hadSpan = false; }); if(!node.checked && (mainLink.length > 0 && !dojo.hasClass(mainLink[0],'open'))) dijitObj.onChange(); // fire to disable collapsed section elements on load var hadSpan = false; dojo.connect(mainLink[0],"onclick",function(e) { if(dojo.hasClass(mainLink[0],'rms_greyOnly')) return false; var dijitObj = dijit.byId(dojo.query(e.target).closest('h2').query('input').attr('id').toString()); if(e.target.nodeName.toLowerCase() == 'span') hadSpan = true; if(dijitObj && e.target && hadSpan) { if(!dijitObj.checked && !dijitObj.disabled) { dijitObj.setChecked(true); } else if (dijitObj.checked && !dijitObj.disabled && dojo.hasClass(dojo.query(e.target).closest('h2.rms_expLink')[0],'open')) { dijitObj.setChecked(false); } } }); } /* end expand collapse events */ /**************************************************START MYRMS CHANGES- ERROR REPORTER ***********************************/ function displayErrRpt(appCode, subAppCode, errRptURL) { if (appCode && trim(appCode).length != 0) { errRptURL += "?appcode=" + appCode; errRptURL += "&subAppCode=" + subAppCode; // Get usid from cookie var usidStr = getCookie('universalSessionId'); var usid = parseInt(usidStr); if (isNumber(usid)) { errRptURL += "&usid=" + usid; } popup = window .open(errRptURL, 'popupWin', 'dependent=yes, scrollbars=1, menubar=0, toolbar=0, height=780, width=950, resizable=yes'); popup.focus(); } else { alert("No application code - cannot submit report"); } } function isNumber(x) { return ((typeof x === typeof 1) && (null !== x) && isFinite(x)); } function trim(str) { return str.replace(/^\s+|\s+$/g, ""); } function getCookie(c_name) { if (document.cookie.length > 0) { c_start = document.cookie.indexOf(c_name + "="); if (c_start != -1) { c_start = c_start + c_name.length + 1; c_end = document.cookie.indexOf(";", c_start); if (c_end == -1) { c_end = document.cookie.length; } return unescape(document.cookie.substring(c_start, c_end)); } } return ""; } /* RadioForceGroup class - inherits dijit radio button - allows radio button groups to work when in different forms - usage: login pages */ dojo.declare("RadioForceGroup", [dijit.form.RadioButton], { constructor : function(obj,node){ this.inherited(arguments); //custom setup this.radioId = obj.id.toString(); this.radioDijit = dijit.byId(this.radioId); this.groupName = node.name; this.groupList = dojo.query('input[type=radio][name='+this.groupName.toString()+']'); }, //add onchange event onChange : function(e){ if(this.checked){ var radioId = this.radioId; this.groupList.forEach(function(node, index, array){ if(radioId != dojo.query(node).attr('id').toString()){ dijit.byId(dojo.query(node).attr('id').toString()).setChecked(false); } }); } } }); /* end RadioForceGroup class */ //**************************************************END RMS CHANGES - ERROR REPORTER************************************ /** * Navigates to given location by form submission. Page should include a form * with id "hiddenNavForm" and hidden field "dest". * * @param arg * Location to open in the browser */ var navToView = function( arg ) { var form = document.getElementById( "hiddenNavForm" ); form.dest.value = arg; form.submit(); }; /** * This function opens a new window (1024/768 default) with the specified url in the * specified target window with the specified width and height. The new window * will have a toolbar and menubar only if those parameters are set to "yes" * * @param urlName * Url to open in the popup * @param target * Name of popup window * @param wid * Width of window * @param ht * Height of window * @param toolbar * Add toolbar if set to 'yes' * @param menubar * Add menu bar if set to 'yes' */ function openWin (urlName, target, wid, ht, toolbar, menubar) { wid = (wid == undefined) ? 1024 : wid; ht = (ht == undefined) ? 768 : ht; if (toolbar==null || toolbar.length==0) toolbar='no'; if (menubar==null || menubar.length==0) menubar='no'; this.focus(); newWin=window.open(urlName, target,'top=0,left=0,width='+wid+',height='+ht+',resizable=yes,location=no,directories=no,scrollbars=yes,menubar='+menubar+',toolbar='+toolbar+',history=no,status=no'); if (newWin != null) { newWin.focus(); } return newWin; } /** * Extracts the browser name and version number from user agent string. * * @param userAgent * The user agent string to parse. If not specified, the contents of * navigator.userAgent are parsed. * @param elements * How many elements of the version number should be returned. A * value of 0 means the whole version. If not specified, defaults to * 2 (major and minor release number). * @return A string containing the browser name and version number, or null if * the user agent string is unknown. */ function identifyBrowser(userAgent, elements) { var regexps = { 'Chrome': [ /Chrome\/(\S+)/ ], 'Firefox': [ /Firefox\/(\S+)/ ], 'MSIE': [ /MSIE (\S+);/ ], 'Opera': [ /Opera\/.*?Version\/(\S+)/, /Opera\/(\S+)/ ], 'Safari': [ /Version\/(\S+).*?Safari\// ] }, re, m, browser, version; if (userAgent === undefined) userAgent = navigator.userAgent; if (elements === undefined) elements = 2; else if (elements === 0) elements = 1337; for (browser in regexps) while (re = regexps[browser].shift()) if (m = userAgent.match(re)) { version = (m[1].match(new RegExp('[^.]+(?:\.[^.]+){0,' + --elements + '}')))[0]; return browser + version; } return null; } /** * Sends the response time (and other parameters, e.g. sessionid) to the portal http server * * @param param * The response time (and other parameters, e.g. sessionid) formatted as query string * e.g. ?JSESSIONID=00009-TempKAqpT-3arDCLQZ5Vr&Browser=Chrome23&Transaction=Home&Step=undefined&ResponseTime=2007ms * */ function logToHttpServer(param){ var xhr; try { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xhr=new XMLHttpRequest(); } else { // code for IE6, IE5 xhr=new ActiveXObject("Microsoft.XMLHTTP"); } xhr.open("GET", "/myRTAApps/Performance/perf-tracker.html" + param, true); xhr.onreadystatechange = function() { if (xhr.readyState==4 && xhr.status==200){ } }; xhr.send(); } catch(err){} } /** * Formats the response time * * @return the formatted response time * */ function formatResponseTime(){ var responseTimes; if (window.performance) { var _oTime = Date.now() - performance.timing.navigationStart || 0, responseTimes = "&ResponseTime=" + _oTime + "ms"; } else { responseTimes = "&ResponseTime=0ms"; } return responseTimes; } /** * Formats the sessionId * * * @return the formatted session id * */ function getSessionId() { var sessionId = null; var allcookies = document.cookie; // Get all the cookies pairs in an array var cookiearray = allcookies.split(';'); // Now take key value pair out of this array var name; for(var i=0; i