Produced by Araxis Merge on 12/4/2017 8:32:29 AM Central Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | VCCM.zip\VCCM\CRM_solutions\FTPResources\FTPResources_3_35.zip\WebResources | ftp_VistAMultiNoteVistaLoginControljsVistaLoginCon810D6C09-5423-E611-9437-0050568D743D | Thu Nov 17 16:48:12 2016 UTC |
| 2 | VCCM.zip\VCCM\CRM_solutions\FTPResources\FTPResources_3_35.zip\WebResources | ftp_VistAMultiNoteVistaLoginControljsVistaLoginCon810D6C09-5423-E611-9437-0050568D743D | Thu Nov 30 18:15:00 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 608 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | /// <refer ence path= '../../../ triipcrm_/ TR_KU_V201 5_2_902/js /jquery.mi n.js' /> | |
| 2 | ||
| 3 | //VistaLog inControlS criptLib.j s | |
| 4 | //Contains variables and funct ions used by the Vis taLoginCon trol.html page | |
| 5 | ||
| 6 | //Static V ariables | |
| 7 | var vlc_cr mOdataEndP oint = '/X RMServices /2011/Orga nizationDa ta.svc'; | |
| 8 | var vlc_co ntext = Ge tGlobalCon text(); | |
| 9 | var vlc_se rverUrl = vlc_contex t.getClien tUrl(); | |
| 10 | var vlc_or gName = vl c_context. getOrgUniq ueName(); | |
| 11 | var vlc_us erId = vlc _context.g etUserId() ; | |
| 12 | ||
| 13 | //var vlc_ ViaLoginUr l = 'https ://qacrmda c.np.crm.v rm.vba. DNS /WebParts/ dev/api/VI A/LoginVIA /1.0/json' ; //OLD MANU AL DEV URL | |
| 14 | var vlc_Vi aLoginUrl = ''; | |
| 15 | var vlc_us erSiteId = ''; | |
| 16 | var vlc_Us erSiteNo = ''; | |
| 17 | var vlc_Vi aLoginMinu tes = 1; //Populate d from set tings, but should ty pically be 230 minut es (3 hour s 50 Minut es) | |
| 18 | ||
| 19 | function v lc_Setting sWebServic eURL_respo nse(vlc_se ttingData, vlc_lastS kip, vlc_V iaLoginUrl _NA) { | |
| 20 | try { | |
| 21 | // vlc_lastSk ip is the starting p oint in th e result ( use if mor e than 50 records) / /Not used in this sc enario | |
| 22 | va r vlc_DacU rl = null; | |
| 23 | va r vlc_ViaL oginApiUrl = null; | |
| 24 | fo r (var i = 0; i <= v lc_setting Data.d.res ults.lengt h - 1; i++ ) { | |
| 25 | //Get in fo | |
| 26 | if (vlc_ settingDat a.d.result s[i].ftp_D ACURL != n ull) { vlc _DacUrl = vlc_settin gData.d.re sults[i].f tp_DACURL; } | |
| 27 | if (vlc_ settingDat a.d.result s[i].ftp_V IALoginURL != null) { vlc_ViaL oginApiUrl = vlc_set tingData.d .results[i ].ftp_VIAL oginURL; } | |
| 28 | if (vlc_ settingDat a.d.result s[i].ftp_V IALoginMin utes != nu ll) { vlc_ ViaLoginMi nutes = vl c_settingD ata.d.resu lts[i].ftp _VIALoginM inutes; } | |
| 29 | break; | |
| 30 | } | |
| 31 | if (vlc_DacU rl != null && vlc_Vi aLoginApiU rl != null ) { | |
| 32 | //Constr uct full w eb service URL | |
| 33 | vlc_ViaL oginUrl = vlc_DacUrl + vlc_Via LoginApiUr l; | |
| 34 | } | |
| 35 | el se { | |
| 36 | parent.X rm.Page.ui .setFormNo tification ("ERROR: T HE VIA LOG IN SERVICE URL IS MI SSING, PLE ASE CONTAC T TECHNICA L SUPPORT! ", "ERROR" , "VIASERV ICE"); | |
| 37 | } | |
| 38 | } | |
| 39 | catch (err) { | |
| 40 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_Set tingsWebSe rviceURL_r esponse): ' + err.me ssage); | |
| 41 | } | |
| 42 | } | |
| 43 | ||
| 44 | function v lc_formLoa d() { | |
| 45 | try { | |
| 46 | // Determine the status of the pa rent recor d | |
| 47 | if (parent.X rm.Page.ui .getFormTy pe() > 2) { | |
| 48 | //The fo rm is disa bled, hide login tab | |
| 49 | parent.X rm.Page.ui .tabs.get( 'Tab_VistA Login').se tVisible(f alse); | |
| 50 | return f alse; | |
| 51 | } | |
| 52 | ||
| 53 | // Check if V IA Login c ookie exis t (not exp ired) | |
| 54 | va r vlc_ViaL oginCookie = vlc_get Cookie("vi asessionli nk"); | |
| 55 | ||
| 56 | // Hide Vista Login Tab and exit if cookie exist | |
| 57 | if (vlc_ViaL oginCookie != "") { | |
| 58 | parent.X rm.Page.ui .tabs.get( 'Tab_VistA Login').se tVisible(f alse); | |
| 59 | //**TRIG GER FORM S CRIPT CODE TO RECREA TE DEPENDE NT WEB RES OURCES** | |
| 60 | parent.v cmn_initVi aDropdownC ontrols(); | |
| 61 | return f alse; | |
| 62 | } | |
| 63 | ||
| 64 | // GET CRM SE TTINGS WEB SERVICE U RLS | |
| 65 | va r vlc_cond itionalFil ter = "(mc s_name eq 'Active Se ttings')"; | |
| 66 | vl c_getMulti pleEntityD ataAsync(' mcs_settin gSet', 'ft p_DACURL, ftp_VIALog inURL, ftp _VIALoginM inutes', v lc_conditi onalFilter , 'mcs_nam e', 'asc', 0, vlc_Se ttingsWebS erviceURL_ response, vlc_ViaLog inUrl); | |
| 67 | // Notify Use r to Login To VistA | |
| 68 | pa rent.Xrm.P age.ui.set FormNotifi cation("ER ROR: YOUR VISTA SESS ION HAS EX PIRED, PLE ASE LOGIN BELOW!", " ERROR", "V IASERVICE" ); | |
| 69 | // Set focus to the log in control | |
| 70 | pa rent.Xrm.P age.getCon trol("WebR esource_Vi staLoginCo ntrol").se tFocus(); | |
| 71 | ||
| 72 | // Get the cu rrent CRM User's ass igned site /facility | |
| 73 | va r vlc_user Data = vlc _getSingle EntityData Sync('Syst emUserSet' , 'ftp_Fac ilitySiteI d', vlc_us erId); | |
| 74 | if (vlc_user Data != nu ll) { | |
| 75 | if (vlc_ userData.d .ftp_Facil itySiteId != null) { | |
| 76 | vlc_ userSiteId = vlc_use rData.d.ft p_Facility SiteId.Id; | |
| 77 | } | |
| 78 | } | |
| 79 | ||
| 80 | // Lookup the Facility/ Site # | |
| 81 | if (vlc_user SiteId != null && vl c_userSite Id != '') { | |
| 82 | var vlc_ facilityDa ta = vlc_g etSingleEn tityDataSy nc('ftp_fa cilitySet' , 'ftp_fac ilitycode' , vlc_user SiteId); | |
| 83 | if (vlc_ facilityDa ta != null ) { | |
| 84 | if ( vlc_facili tyData.d.f tp_facilit ycode != n ull) { vlc _UserSiteN o = vlc_fa cilityData .d.ftp_fac ilitycode; } | |
| 85 | } | |
| 86 | } | |
| 87 | } | |
| 88 | catch (err) { | |
| 89 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_for mLoad): ' + err.mess age); | |
| 90 | } | |
| 91 | } | |
| 92 | ||
| 93 | function v lc_vistaLo gin() { | |
| 94 | try { | |
| 95 | // Get Login Field data | |
| 96 | va r vlc_acce ssCode = $ ('#vlc_acc essCode'). val(); | |
| 97 | va r vlc_veri fyCode = $ ('#vlc_ver ifyCode'). val(); | |
| 98 | // Verify tha t fields a re not emp ty | |
| 99 | if (vlc_acce ssCode == null || vl c_accessCo de == "") { alert("P lease ente r your VIS TA User Id !"); retur n false; } | |
| 100 | if (vlc_veri fyCode == null || vl c_verifyCo de == "") { alert("P lease ente r your VIS TA Passwor d!"); retu rn false; } | |
| 101 | ||
| 102 | // Disable lo gin fields and butto n | |
| 103 | do cument.get ElementByI d('vlc_acc essCode'). disabled = true; | |
| 104 | do cument.get ElementByI d('vlc_ver ifyCode'). disabled = true; | |
| 105 | do cument.get ElementByI d('vlc_log inbuttonid ').disable d = true; | |
| 106 | ||
| 107 | // Process Vi stA Login using VIA web servic e | |
| 108 | va r vlc_viaL ogin = new Object(); | |
| 109 | vl c_viaLogin .AccessCod e = vlc_ac cessCode; | |
| 110 | vl c_viaLogin .VerifyCod e = vlc_ve rifyCode; | |
| 111 | vl c_viaLogin .SiteId = vlc_UserSi teNo.toStr ing(); | |
| 112 | vl c_viaLogin .Target = ""; | |
| 113 | ||
| 114 | va r vlc_logi nResponse = ""; | |
| 115 | ||
| 116 | $. ajax({ | |
| 117 | type: "P OST", | |
| 118 | url: vlc _ViaLoginU rl, | |
| 119 | data: JS ON.stringi fy(vlc_via Login), | |
| 120 | contentT ype: "appl ication/js on; charse t=utf-8", | |
| 121 | dataType : "json", | |
| 122 | success: function (data) { | |
| 123 | vlc_ loginRespo nse = data ; | |
| 124 | vlc_ vistaLogin _response( null, vlc_ loginRespo nse); | |
| 125 | }, | |
| 126 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 127 | //Sy stem Error | |
| 128 | vlc_ vistaLogin _response( errorThrow n, null); | |
| 129 | }, | |
| 130 | async: f alse, | |
| 131 | cache: f alse | |
| 132 | }) ; | |
| 133 | } | |
| 134 | catch (err) { | |
| 135 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_vis taLogin): ' + err.me ssage); | |
| 136 | } | |
| 137 | } | |
| 138 | ||
| 139 | function v lc_vistaLo gin_respon se(vlc_err orThrown, vlc_loginR esponse) { | |
| 140 | try { | |
| 141 | if (vlc_erro rThrown != null) { | |
| 142 | //Genera l Web Serv ice Error | |
| 143 | alert("E rror: The VISTA Logi n Web Serv ice Failed with erro r(" + vlc_ errorThrow n + ") Pl ease try y our login again!"); | |
| 144 | //Enable login fie lds and bu tton | |
| 145 | document .getElemen tById('vlc _accessCod e').disabl ed = false ; | |
| 146 | document .getElemen tById('vlc _verifyCod e').disabl ed = false ; | |
| 147 | document .getElemen tById('vlc _loginbutt onid').dis abled = fa lse; | |
| 148 | return f alse; | |
| 149 | } | |
| 150 | if (vlc_logi nResponse. ErrorOccur red == tru e) { | |
| 151 | alert("E rror: The VISTA Logi n Web Serv ice Failed with erro r(" + vlc_ loginRespo nse.ErrorM essage + " ) Please try your l ogin again !"); | |
| 152 | //Enable login fie lds and bu tton | |
| 153 | document .getElemen tById('vlc _accessCod e').disabl ed = false ; | |
| 154 | document .getElemen tById('vlc _verifyCod e').disabl ed = false ; | |
| 155 | document .getElemen tById('vlc _loginbutt onid').dis abled = fa lse; | |
| 156 | return f alse; | |
| 157 | } | |
| 158 | el se { | |
| 159 | //Get se ssionid/to ken and fu ll VistA u ser name | |
| 160 | var vlc_ duz = ""; | |
| 161 | var vlc_ providerna me = ""; | |
| 162 | if (vlc_ loginRespo nse.Data[0 ].Duz != n ull) { vlc _duz = vlc _loginResp onse.Data[ 0].Duz; } | |
| 163 | if (vlc_ loginRespo nse.Data[0 ].Provider Name != nu ll) { var vlc_provid ername = v lc_loginRe sponse.Dat a[0].Provi derName; } | |
| 164 | ||
| 165 | //Check that there are value s returned | |
| 166 | if (vlc_ duz == "" || vlc_pro vidername == "") { | |
| 167 | //Ch eck for Fa ult, set d efault mes sage | |
| 168 | var vlc_viaLog inFault = "The Login is invali d, please try your l ogin again !"; | |
| 169 | if ( vlc_loginR esponse.Da ta[0].Faul t != null) { vlc_via LoginFault = "The Lo gin is inv alid, " + vlc_loginR esponse.Da ta[0].Faul t.Message; } | |
| 170 | aler t("Error: " + vlc_vi aLoginFaul t); | |
| 171 | //En able login fields an d button | |
| 172 | docu ment.getEl ementById( 'vlc_acces sCode').di sabled = f alse; | |
| 173 | docu ment.getEl ementById( 'vlc_verif yCode').di sabled = f alse; | |
| 174 | docu ment.getEl ementById( 'vlc_login buttonid') .disabled = false; | |
| 175 | retu rn false; | |
| 176 | } | |
| 177 | ||
| 178 | //Write values to Browser Co okie | |
| 179 | vlc_setC ookie("via sessionlin k", vlc_du z + "~~~~" + vlc_pro vidername, vlc_ViaLo ginMinutes ); | |
| 180 | ||
| 181 | //Clear login fiel ds and hid e control | |
| 182 | parent.X rm.Page.ui .clearForm Notificati on("VIASER VICE"); | |
| 183 | document .getElemen tById('vlc _accessCod e').disabl ed = false ; | |
| 184 | document .getElemen tById('vlc _verifyCod e').disabl ed = false ; | |
| 185 | document .getElemen tById('vlc _loginbutt onid').dis abled = fa lse; | |
| 186 | document .getElemen tById('vlc _accessCod e').value = ''; | |
| 187 | document .getElemen tById('vlc _verifyCod e').value = ''; | |
| 188 | //Hide t he login t ab | |
| 189 | parent.X rm.Page.ui .tabs.get( 'Tab_VistA Login').se tVisible(f alse); | |
| 190 | ||
| 191 | //**TRIG GER FORM S CRIPT CODE TO RECREA TE DEPENDE NT WEB RES OURCES** | |
| 192 | parent.v cmn_initVi aDropdownC ontrols(); | |
| 193 | } | |
| 194 | } | |
| 195 | catch (err) { | |
| 196 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_vis taLogin_re sponse): ' + err.mes sage); | |
| 197 | } | |
| 198 | } | |
| 199 | ||
| 200 | function v lc_getCook ie(cname) { | |
| 201 | try { | |
| 202 | va r name = c name + "=" ; | |
| 203 | va r ca = doc ument.cook ie.split(' ;'); | |
| 204 | fo r (var i = 0; i < ca .length; i ++) { | |
| 205 | var c = ca[i]; | |
| 206 | while (c .charAt(0) == ' ') { | |
| 207 | c = c.substrin g(1); | |
| 208 | } | |
| 209 | if (c.in dexOf(name ) == 0) { | |
| 210 | retu rn c.subst ring(name. length, c. length); | |
| 211 | } | |
| 212 | } | |
| 213 | re turn ""; | |
| 214 | } | |
| 215 | catch (err) { | |
| 216 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_get Cookie): ' + err.mes sage); | |
| 217 | } | |
| 218 | } | |
| 219 | ||
| 220 | function v lc_setCook ie(cname, cvalue, ex minutes) { | |
| 221 | try { | |
| 222 | va r d = new Date(); | |
| 223 | d. setMinutes (d.getMinu tes() + (e xminutes)) ; | |
| 224 | va r expires = "expires =" + d.toU TCString() ; | |
| 225 | do cument.coo kie = cnam e + "=" + cvalue + " ; " + expi res + "; p ath=/" + v lc_orgName + "/"; | |
| 226 | } | |
| 227 | catch (err) { | |
| 228 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_get Cookie): ' + err.mes sage); | |
| 229 | } | |
| 230 | } | |
| 231 | ||
| 232 | ||
| 233 | function v lc_execute CrmOdataGe tRequest(v lc_jsonQue ry, vlc_aS ync, vlc_a SyncCallba ck, vlc_sk ipCount, v lc_optionA rray) { | |
| 234 | //This function executes a CRM Odata web servi ce call to retrieve Crm data | |
| 235 | //*vlc _jsonQuery * - a prop erly forma tted CRM O data Query string (r equired) | |
| 236 | //*vlc _aSync* - specify 't rue' to ex ecute asyn chronously otherwise 'false' ( required) | |
| 237 | //*vlc _aSyncCall back* - sp ecify the name of th e return f unction to call upon completio n (require d if vlc_a Sync = tru e. Otherw ise '') | |
| 238 | //*vlc _skipCount * - Initia l setting is always '0', incre ments by 5 0 per CRM SDK Odata standards (required) | |
| 239 | //*vlc _optionArr ay* - is a n optional array or single val ue, that c ontains ad ditional t ask specif ic variabl es that ca n be passe d between functions (pass 'nul l' if not used) | |
| 240 | try { | |
| 241 | va r vlc_enti tyData = n ull; | |
| 242 | $. ajax({ | |
| 243 | type: 'G ET', | |
| 244 | contentT ype: 'appl ication/js on; charse t=utf-8', | |
| 245 | datatype : 'json', | |
| 246 | url: vlc _jsonQuery , | |
| 247 | beforeSe nd: functi on (XMLHtt pRequest) { | |
| 248 | XMLH ttpRequest .setReques tHeader('A ccept', 'a pplication /json'); | |
| 249 | }, | |
| 250 | success: function (data, tex tStatus, X mlHttpRequ est) { | |
| 251 | vlc_ entityData = data; | |
| 252 | if ( vlc_aSync == true) { | |
| 253 | vlc_aSyncC allback(vl c_entityDa ta, vlc_sk ipCount, v lc_optionA rray); | |
| 254 | } | |
| 255 | }, | |
| 256 | error: f unction (X MLHttpRequ est, textS tatus, err orThrown) { | |
| 257 | aler t('Fail: A jax Error in vlc_exe cuteCrmOda taGetReque st: ' + er rorThrown + " Reques t: " + vlc _jsonQuery ); | |
| 258 | }, | |
| 259 | async: v lc_aSync, | |
| 260 | cache: f alse | |
| 261 | }) ; | |
| 262 | re turn vlc_e ntityData; | |
| 263 | } | |
| 264 | catch (err) { | |
| 265 | al ert('An er ror occure d in the v lc_execute CrmOdataGe tRequest f unction. Error Deta il Message : ' + err) ; | |
| 266 | } | |
| 267 | } | |
| 268 | ||
| 269 | function v lc_getMult ipleEntity DataAsync( vlc_entity SetName, v lc_attribu teSet, vlc _condition alFilter, vlc_sortAt tribute, v lc_sortDir ection, vl c_skipCoun t, vlc_aSy ncCallback , vlc_opti onArray) { | |
| 270 | //This function returns a CRM JSON d ataset for all entit y records matching c riteria pr ovided Asy ncronously | |
| 271 | //*vlc _entitySet Name* - is the name of the ent ity set e. g 'Contact Set' | |
| 272 | //*vlc _attribute Set* - is a string containing the Crm A ttributes to retriev e e.g. 'Fi rstName, L astName, T elephone1, EMailAddr ess1' | |
| 273 | //*vlc _condition alFilter* - is the c onditional filter va lue placed on the da ta values retrived e .g. 'State Code/Value eq 0' to retrieve active con tact recor ds only | |
| 274 | //*vlc _sortAttri bute* - is a string containing the name of the att ribute to sort the r esult set by e.g. 'L astName' | |
| 275 | //*vlc _sortDirec tion* - is a string specifying the sort as Ascendi ng or Desc ending e.g . 'asc' or 'desc' | |
| 276 | //*vlc _skipCount * - is the starting point in t he result (use if mo re than 50 ), (Put 0 if not use d) | |
| 277 | //*vlc _aSyncCall back* - is the name of the fun ction to c all when r eturning t he result | |
| 278 | //*vlc _optionArr ay* - is a n optional array, th at contain s addition al task sp ecific var iables tha t can be p assed betw een functi ons | |
| 279 | ||
| 280 | try { | |
| 281 | va r vlc_json Query = vl c_serverUr l + vlc_cr mOdataEndP oint + '/' + vlc_ent itySetName + '?$sele ct=' + vlc _attribute Set + '&$f ilter=' + vlc_condit ionalFilte r + '&$ord erby=' + v lc_sortAtt ribute + ' ' + vlc_s ortDirecti on + '&$sk ip=' + vlc _skipCount ; | |
| 282 | vl c_executeC rmOdataGet Request(vl c_jsonQuer y, true, v lc_aSyncCa llback, vl c_skipCoun t, vlc_opt ionArray); | |
| 283 | } | |
| 284 | catch (err) { | |
| 285 | al ert('An er ror occure d in the v lc_getMult ipleEntity DataAsync function. Error Det ail Messag e: ' + err ); | |
| 286 | } | |
| 287 | } | |
| 288 | ||
| 289 | function v lc_getSing leEntityDa taSync(vlc _entitySet Name, vlc_ attributeS et, vlc_en tityId) { | |
| 290 | //This function returns a CRM JSON d ataset for a single entity rec ord based on the ent ity id pro vided Sync ronously | |
| 291 | //*vlc _entitySet Name* - is the name of the ent ity set e. g 'Contact Set' | |
| 292 | //*vlc _attribute Set* - is a string containing the Crm A ttributes to retriev e e.g. 'Fi rstName, L astName, T elephone1, EMailAddr ess1' | |
| 293 | //*vlc _entityId* - is the Guid for t he entity record | |
| 294 | ||
| 295 | try { | |
| 296 | va r vlc_enti tyIdNoBrac ket = vlc_ entityId.r eplace(/({ |})/g, '') ; | |
| 297 | va r vlc_sele ctString = '(guid' + "'" + vlc _entityIdN oBracket + "'" + ')? $select=' + vlc_attr ibuteSet; | |
| 298 | va r vlc_json Query = vl c_serverUr l + vlc_cr mOdataEndP oint + '/' + vlc_ent itySetName + vlc_sel ectString; | |
| 299 | va r vlc_enti tyData = v lc_execute CrmOdataGe tRequest(v lc_jsonQue ry, false, '', 0, nu ll); | |
| 300 | re turn vlc_e ntityData; | |
| 301 | } | |
| 302 | catch (err) { | |
| 303 | al ert('An er ror occure d in the v lc_getSing leEntityDa taSync fun ction. Er ror Detail Message: ' + err); | |
| 304 | } | |
| 305 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.