11. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 7/25/2018 3:40:54 PM Central Daylight 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.

11.1 Files compared

# Location File Last Modified
1 Pain_Coach_v3.0_Jun_2018.zip\vpc-patient-web.zip\vpc-patient-web\app\veteran\cordova\grunt_merge\android\common\lib app_utils.js Fri Jun 1 14:26:04 2018 UTC
2 Pain_Coach_v3.0_Jun_2018.zip\vpc-patient-web.zip\vpc-patient-web\app\veteran\cordova\grunt_merge\android\common\lib app_utils.js Tue Jul 24 19:09:07 2018 UTC

11.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1236
Changed 1 2
Inserted 0 0
Removed 0 0

11.3 Comparison options

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

11.4 Active regular expressions

No regular expressions were active.

11.5 Comparison detail

  1   var roaWin dow = null ;
  2   var submit Roa = fals e;
  3  
  4   var App_Ut ils = {
  5  
  6       GetDom ainPath: f unction ()  {
  7           // if (docume nt.locatio n.hostname  == "local host" || w indow.loca tion.proto col == "fi le:") {
  8           Ap p.debug =  true;
  9           if  (!App.Deb ugMode) {
  10                App.Debu gMode = tr ue;
  11                App_Util s.DebugMod e();
  12           }
  13           re turn App_U tils.GetRe ferencePat h();
  14           // }
  15           /* else {
  16            A pp.debug =  false;
  17            r eturn wind ow.locatio n.protocol  + "//" +  window.loc ation.host  + "/";
  18            } */
  19       },
  20       /**
  21        * @re turn {stri ng}
  22        */
  23       GetRef erencePath : function  () {
  24           if  (document .location. hostname = == "localh ost" || wi ndow.locat ion.protoc ol === "fi le:" ) {
  25                return e ncodeURI(A pp_Resourc es.hostnam e);
  26           }
  27       },
  28       SetReq uestHeader : function  () {
  29           va r sync = B ackbone.sy nc;
  30           Ba ckbone.syn c = functi on (method , model, o ptions) {
  31                options. beforeSend  = functio n (xhr) {
  32                    if ( App_Utils. GetSession Token() !=  null) {
  33                         xhr.setReq uestHeader ('Authoriz ation', 'B earer ' +  App_Utils. GetSession Token());
  34                    }
  35                };
  36                sync(met hod, model , options) ;
  37           };
  38       },
  39       DebugM ode: funct ion() {
  40           if  (document .location. hostname = = "localho st" && App _Utils.Get SessionTok en() === n ull){
  41                //Quick  and dirty  input to a dd token i f developi ng and tok en is not  present
  42                var html  = '<form  class="for m-inline"> ' +
  43                    '<di v class="f orm-group" >' +
  44                    '<la bel for="t okenInput" >Token:</l abel> ' +
  45                    '<in put type=" text" clas s="form-co ntrol inpu t-sm" id=" tokenInput " placehol der="Enter  Token">'  +
  46                    '</d iv>' +
  47                    '<bu tton type= "button" c lass="btn- default bt n-sm" id=" setToken"> Set Token< /button>'  +
  48                    '</f orm>';
  49                if (!$(" #debug").l ength) {
  50                    $("b ody").appe nd("<div i d='token'  style='pos ition:abso lute; righ t:10px; to p:0;'>" +  html + "</ div>");
  51                }
  52                $("#setT oken").on( "click", f unction ()  {
  53                    var  token = $( "#tokenInp ut").val() ;
  54                    App_ Utils.SetS essionToke n('token',  token);
  55                    loca tion.reloa d();
  56                });
  57           }
  58           if  (document .location. hostname = = "localho st" && App _Utils.Get LocalStora ge('VPC_Eu la')) {
  59                //Add bu tton to cl ear Eula l ocalStorag e value
  60                var html 2 = '<butt on type="b utton" cla ss="btn-de fault btn- sm" id="eu laBtn" sty le="positi on:absolut e; right:3 35px; top: 0;">Delete  Eula</but ton>';
  61                if (!$(" #eulaBtn") .length) {
  62                    $("b ody").appe nd(html2);
  63                }
  64                $("#eula Btn").on(" click", fu nction ()  {
  65                    App_ Utils.Dele teLocalSto rage('VPC_ Eula');
  66                    loca tion.reloa d();
  67                });
  68           }
  69  
  70           if  (document .location. hostname = = "localho st" && App _Utils.Get SessionTok en() != nu ll) {
  71                //Add bu tton to cl ear user t oken
  72                var html 3 = '<butt on type="b utton" cla ss="btn-de fault btn- sm" id="to kenBtn" st yle="posit ion:absolu te; right: 425px; top :0px;">Del ete Token< /button>';
  73                if (!$(" #tokenBtn" ).length)  {
  74                    $("b ody").appe nd(html3);
  75                }
  76                $("#toke nBtn").on( "click", f unction ()  {
  77                    App_ Utils.Clea rSessionTo ken('token ');
  78                    loca tion.reloa d();
  79                });
  80           }
  81  
  82           // Any other  code to qu ickly aid  in develop ment
  83       },
  84       /**
  85        * Def ault focus  on page l oad
  86        */
  87       FocusO nLoad: fun ction () {
  88           $( '#header-l ogin-link' ).focus();
  89       },
  90       /**
  91        * For  modals in side <head er>, e.g.  About, Hel p
  92        * @pa ram modalI d - the ac tive modal  id
  93        */
  94       Header ModalShown : function  (modalId)  {
  95           $( ".va-title -area, .ap p-title-ar ea, #error Section, # content, f ooter, .sc rollbar-gr adient").a ttr("aria- hidden", t rue);
  96           $( "#" + moda lId).remov eAttr('ari a-hidden') ;   // ari a-hidden=f alse can b e unreliab le
  97           th is.FocusOn Modal();
  98       },
  99  
  100       Header ModalHidde n: functio n (modalId ) {
  101           $( ".va-title -area, .ap p-title-ar ea, #error Section, # content, f ooter, .sc rollbar-gr adient").r emoveAttr( "aria-hidd en");
  102           $( "#" + moda lId).attr( "aria-hidd en", true) ;
  103       },
  104       /**
  105        * For  modals in side <foot er>, e.g.  Too Early  To Take Wa rning Moda ls
  106        */
  107       Footer ModalShown : function  (modalId)  {
  108           $( "header, # errorSecti on, #conte nt, .foote r-content,  .scrollba r-gradient ").attr("a ria-hidden ", "true") ;
  109           $( "#" + moda lId).remov eAttr('ari a-hidden') ;   // ari a-hidden=f alse can b e unreliab le
  110           th is.FocusOn Modal();
  111       },
  112       Footer ModalHidde n: functio n (modalId ) {
  113           $( "header, # errorSecti on, #conte nt, .foote r-content,  .scrollba r-gradient ").removeA ttr("aria- hidden");
  114           $( "#" + moda lId).attr( "aria-hidd en", true) ;
  115       },
  116       /**
  117        * For  modals th at are emb edded in < main> as p art of the  invoking  view,
  118        * @pa ram modal  - ID of th e modal be ing manipu lated
  119        * @pa ram focus  - optional : the HTML  element t o get focu s when mod al is dism issed;
  120        *         can be  either a  CSS class  name (if u nique) or  an element  ID; defau lt
  121        *         to '.m odal-title ' if not p rovided
  122        */
  123       SetMai nModal: fu nction (mo dal, focus ) {
  124           //  on displa y
  125           $( modal).on( 'shown.bs. modal', fu nction ()  {
  126                $("heade r, #errorS ection, #m ain-conten t, footer,  .scrollba r-gradient ").attr('a ria-hidden ', 'true') ;
  127                var targ et = focus  ? focus :  '.modal-t itle';     // default  to .modal -title (us ually <h4> )
  128                $(target ).focus();
  129           }) ;
  130  
  131           //  on dismis s
  132           $( modal).on( 'hidden.bs .modal', f unction ()  {
  133                $("heade r, #errorS ection, #m ain-conten t, footer,  .scrollba r-gradient ").removeA ttr('aria- hidden');
  134           }) ;
  135       },
  136       /**
  137        * For  modals th at are NOT  part of s ame templa te as its  invoking v iew, e.g.  About, Hel p,
  138        * Tim eout, and  EULA. Moda l code seg ment is en closed wit hin the .m odal-conta iner that  is
  139        * out side of th e core ele ments (hea der, main,  footer).  See HTML s tructure i n layout.h tml.
  140        * @pa ram modal  - The moda l ID (pref ixed with  '#") or un ique CSS s elector (p refixed wi th '.')
  141        */
  142       SetMod alContaine r: functio n (modal)  {
  143           $( modal).on( 'shown.bs. modal', fu nction ()  {
  144                $("heade r, #errorS ection, #c ontent, fo oter, .scr ollbar-gra dient").at tr('aria-h idden', 't rue');
  145                $(".moda l-title"). focus();
  146           }) ;
  147           $( modal).on( 'hidden.bs .modal', f unction ()  {
  148                $("heade r, #errorS ection, #c ontent, fo oter, .scr ollbar-gra dient").re moveAttr(' aria-hidde n');
  149                $(modal) .attr('ari a-hidden',  'true');   // hide t he modal
  150           }) ;
  151       },
  152       /**
  153        * Def ault focus  on modal  display
  154        * @pa ram elemen t - the HT ML element  to get fo cus; can b e either a  CSS class  name (if  unique)
  155        *         or an  element ID ; default  to '.modal -title' if  not provi ded
  156        */
  157       FocusO nModal: fu nction (el ement) {
  158           va r target =  element ?  element :  '.modal-t itle';     // default  to .modal -title (us ually <h4> )
  159           $( target).fo cus();
  160       },
  161       /**
  162        * For  the Selec t Report m enu
  163        * @pa ram contai ner - ID o f the list  container  unique to  each view , e.g. #hi storyListC ontainer
  164        */
  165       Select TitleMenu:  function  (appView,  container)  {
  166           va r _self =  this;
  167           //  On dropdo wn open
  168           $( '#titleMen u').on('sh own.bs.dro pdown', fu nction() {
  169                // Set a ria-expand ed to true
  170                $('#sele ctBtn').at tr('aria-e xpanded',  true);
  171  
  172                // Set f ocus on th e first li nk in the  dropdown
  173                // delay ed by 0.5  second to  allow VO a nnouncemen t of expan ded state
  174                setTimeo ut(functio n() {
  175                    $('# titleMenu  .dropdown- menu li:fi rst-child  a').focus( );
  176                }, 500);
  177  
  178                // hide  other elem ents
  179                _self.Se lectMenuOn ShownAria( appView, c ontainer);
  180           }) ;
  181  
  182           //  On dropdo wn close
  183           $( '#titleMen u').on('hi dden.bs.dr opdown', f unction()  {
  184                // Set a ria-expand ed to fals e
  185                $('#sele ctBtn').at tr('aria-e xpanded',  false);
  186  
  187                // un-hi de other e lements
  188                _self.Se lectMenuOn HiddenAria (appView,  container) ;
  189           }) ;
  190       },
  191  
  192       /**
  193        * The  elements  to hide wh en user in teracts wi th the Sel ect Menu
  194        * @pa ram contai ner - ID o f the list  container  unique to  each view
  195        * @pa ram appVie w - whethe r this fun ction is t riggered o n the Vete ran or Pro vider view . Elements  to hide a re unique  per view.
  196        */
  197       Select MenuOnShow nAria: fun ction (app View, cont ainer) {
  198           if  (appView  == 'provid erView') {
  199                $('heade r, #errorS ection, .t itle-back- btn, #cont ent-title,  #patientH eaderSecti on, footer , .scrollb ar-gradien t').attr(' aria-hidde n', 'true' );
  200                $(contai ner).attr( 'aria-hidd en', 'true ');
  201           }  else {  //  Veteran V iew
  202                $('heade r, #errorS ection, .t itle-back- btn, #cont ent-title,  footer, . scrollbar- gradient') .attr('ari a-hidden',  'true');
  203                $(contai ner).attr( 'aria-hidd en', 'true ');
  204           }
  205       },
  206       /**
  207        * The  elements  to un-hide  when user  interacts  with the  Select Men u
  208        * @pa ram contai ner - ID o f the list  container  unique to  each view
  209        * @pa ram appVie w - whethe r this fun ction is t riggered o n the Vete ran or Pro vider view . Elements  to hide a re unique  per view.
  210        */
  211       Select MenuOnHidd enAria: fu nction (ap pView, con tainer) {
  212           if  (appView  == 'provid erView') {
  213                $('heade r, #errorS ection, .t itle-back- btn, #cont ent-title,  #patientH eaderSecti on, footer , .scrollb ar-gradien t').remove Attr('aria -hidden');
  214                $(contai ner).remov eAttr('ari a-hidden') ;
  215           }  else {  //  Veteran V iew
  216                $('heade r, #errorS ection, .t itle-back- btn, #cont ent-title,  footer, . scrollbar- gradient') .removeAtt r('aria-hi dden');
  217                $(contai ner).remov eAttr('ari a-hidden') ;
  218           }
  219       },
  220       ErrorH andling: f unction ()  {
  221           va r sync = B ackbone.sy nc;
  222           Ba ckbone.syn c = functi on (method , model, o ptions) {
  223                var erro r = option s.error;
  224                options. error = fu nction (xh r, statusT xt, thrown ) {
  225                    cons ole.log('I n global e rror handl er. key='  + model.ke y + ' XHR' , xhr);
  226                    cons ole.log('e rror: ' +  statusTxt) ;
  227                    if ( !VPC.View. Header) {/ /early err ors before  full star t
  228                         VPC.Layout .header.sh ow(VPC.Vie w.Header =  new VPC.V iew.header ());
  229                    }
  230                    if ( xhr.status  === 401)  {
  231                         //User in  not authen ticated
  232                         //App_Util s.Launchpa dLogin();
  233                         App_Utils. VAMFLogout ();
  234  
  235                         if (App.de bug) {
  236                             if (mo del.key == = "Last Ac cessed Tim e") {
  237                                 cl earInterva l(App.Keep AliveInter val); //st op the loo p for heav ens sake
  238                             }
  239                         }
  240                         /* if (mod el.key ===  "Last Acc essed Time ") {
  241                          clearInte rval(App.K eepAliveIn terval); / /stop the  loop for h eavens sak e
  242                          }
  243                          else {
  244                          App.login Utils.chec kForAuthCo de();
  245                          }*/
  246                    }
  247                    if ( xhr.status  === 404 & & model.ke y === "Rig ht of Acce ss") {
  248                         //User has  not accep ted Right  of Access,  redirect  so they ca n be promp ted.
  249                         App_Utils. ROARedirec t();
  250                    }
  251                    /*
  252                     els e if (xhr. status = 2 04 && (mod el.key ==  "Reminder"  || model. key == 'Mo nthly Asse ssment' ||  model.key  == 'Pain  Diary')) {
  253                     //  ignore
  254                     //r eturn;
  255                     App .vent.trig ger('ignor e:error');
  256                     }
  257                     els e if (xhr. statusText  == 'Not F ound' && ( model.key  == 'Monthl y Assessme nt' || mod el.key ==  'Pain Diar y')) {
  258                     //  ignore
  259                     //r eturn;
  260                     App .vent.trig ger('ignor e:error');
  261                     }
  262                     els e if (xhr. statusText  == 'Not F ound' && m odel.key = = 'Monthly  Assessmen ts') {
  263                     App .vent.trig ger('asses sments:mis sing');
  264                     }
  265                     els e if (xhr. statusText  == 'Not F ound' && m odel.key = = 'Pain Di aries') {
  266                     //  ignore
  267                     App .vent.trig ger('daily :missing') ;
  268                     }
  269                     els e if (xhr. statusText  == 'Not F ound' && m odel.key = = 'Latest  Monthly')  {
  270                     App .vent.trig ger("lates t-monthly: loaded", u ndefined);
  271                     }
  272                     els e if (xhr. statusText  == 'Not F ound' && m odel.key = = 'Latest  Daily') {
  273                     App .vent.trig ger("lates t-daily:lo aded", und efined);
  274                     }
  275                     els e if (xhr. statusText  == 'Not F ound' && m odel.key = = 'Activit y Pacing')  {
  276                     App .vent.trig ger("ap:lo ad-error") ;
  277                     }
  278                     els e if (xhr. status = 2 04 && (mod el.key ==  "Monthly A ssessments " || model .key == "A ssessments ")) {
  279                     //P ass error  to model
  280                     err or(xhr, st atusTxt, n ull);
  281                     }
  282                     */
  283                    else  if (model .key == 'r esource-di rectory-pv s' || mode l.key == ' resource-d irectory-v pc') {
  284                         App.vent.t rigger('re sources:fa iled', mod el.key);
  285                    }
  286                    else  {
  287                         //Broadcas t model er ror
  288                         App.vent.t rigger(((m odel.key ?  model.key  : "genera l") + ":fa iled"), {  model: mod el, xhr: x hr });
  289                         //Let form at this fo r a human
  290                         App_Utils. FormatErro rMSG(model , xhr);
  291                         //Pass err or to mode l
  292                         error(xhr,  statusTxt , thrown);
  293                    }
  294                };
  295                sync(met hod, model , options) ;
  296           };
  297       },
  298       Format ErrorMSG:  function ( model, xhr ) {
  299           va r key, res , status,  statustext , msg, dev msg;
  300           ke y = res =  status = s tatustext  = msg = '' ;
  301           ke y = model. key ? mode l.key : "" ;
  302           if  (xhr.resp onseJSON)  {
  303                res = xh r.response JSON.devel operMessag e ? xhr.re sponseJSON .developer Message :  "";
  304                devmsg =  xhr.respo nseJSON.me ssage ? xh r.response JSON.messa ge : "";
  305           }
  306  
  307           st atus = xhr .status ?  xhr.status  : "No sta tus";
  308           st atustext =  xhr.statu sText ? xh r.statusTe xt : "No s tatus text ";
  309           ms g = key +  " encounte red the fo llowing er ror: " + r es + " (St atus: " +  status + "  / " + sta tustext+")  " + devms g;
  310           Ap p.vent.tri gger('webs ite:error' , msg);
  311       },
  312       BackBu tton: func tion () {
  313           //  first loo k for back  button on  page
  314           va r backButt on = $('a. back');
  315           va r backButt on2 = $('a  .back');
  316           va r backButt on3 = $('b utton .bac k');
  317           if  (backButt on.length  == 1) {
  318                // if fo und, click  it
  319                backButt on.click() ;
  320           }
  321           el se if (bac kButton2.l ength == 1 ) {
  322                backButt on2.click( );
  323           }
  324           el se if (bac kButton3.l ength ===  1) {
  325                backButt on3.click( );
  326           }
  327           el se {
  328                window.h istory.bac k();
  329           }
  330       },
  331       RightO fAccess: f unction ()  {
  332           // console.lo g("RightOf Access " +  App.debug );
  333           // if (App.de bug) {   / / bypass i f running  locally
  334           //     App.ve nt.trigger ('roa:acce pted');
  335           // }
  336           // else {
  337           //  store old  value of  emulate
  338           va r oldEmula teHTTP = B ackbone.em ulateHTTP;
  339           Ba ckbone.emu lateHTTP =  true;
  340           VP C.Model.RO A = new VP C.Model.ro a;
  341           VP C.Model.RO A.fetch({
  342                success:  function  (model, re sponse) {
  343                    //co nsole.log( "ROA succe ss");
  344                    resp onse.right OfAccessAc cepted ? A pp.vent.tr igger('roa :accepted' ) : App_Ut ils.ROARed irect();
  345                },
  346                error: f unction (m odel, resp onse, opti ons) {
  347                    //co nsole.log( "ROA faile d");
  348                    if ( response.s tatus == 2 00)  {
  349                         response.r ightOfAcce ssAccepted  ? App.ven t.trigger( 'roa:accep ted') : Ap p_Utils.RO ARedirect( );
  350                    }
  351                }
  352           }) ;
  353           Ba ckbone.emu lateHTTP =  oldEmulat eHTTP;  //  reset bac k to old v alue after  fetch
  354           // }
  355       },
  356       /*
  357        ROARe direct: fu nction ()  {
  358        var u rl = App_U tils.GetDo mainPath()  + 'Mobile HealthPlat formWeb/ro a/index.ht ml?url=' +  App_Utils .GetDomain Path()+"rx -refill/";
  359        conso le.log("Re directing  to roa sit e " + url) ;
  360        windo w.location  = encodeU RI(url);
  361        },
  362        */
  363       ROARed irect: fun ction () {
  364           // App_Utils. SetRequest Header();
  365             //var temp Url = 'htt ps:// URL /MobileHea lthPlatfor mWeb/roa/i ndex.html? url=https: // URL /mhpro/';
  366           va r tempUrl  = App_Util s.GetDomai nPath() +  'MobileHea lthPlatfor mWeb/roa/i ndex.html? url=' + Ap p_Utils.Ge tDomainPat h() + 'pai ncoach/';
  367           va r urlx =   encodeURI( tempUrl);
  368  
  369           ro aWindow =  cordova.In AppBrowser .open(urlx , '_blank' , 'locatio n=no,toolb ar=no');
  370  
  371           va r pathName ;
  372  
  373           ro aWindow.ad dEventList ener('load start', fu nction(eve nt) {
  374  
  375                App_Util s.setRemot eReqHeader ();
  376                App_Util s.setRemot eEULA();
  377  
  378                var xurl  = event.u rl;
  379                var urlP arser = do cument.cre ateElement ('a');
  380                urlParse r.href = x url;
  381  
  382                pathName  = urlPars er.pathnam e;
  383                pathName  = pathNam e.replace( /\//g, '') ;
  384  
  385                // alert ('loadstar t -> url:  ' + event. url + '\np athname: '  + pathNam e);
  386  
  387                // var h ashValue =  xurl.spli t('#')[1];
  388                // if (h ashValue)  {
  389                //     i f(hashValu e === 'for m-review') {
  390                //          submitR oa = true;
  391                //     } else{
  392                //          submitR oa = false ;
  393                //     }
  394                // }
  395  
  396                // alert ('pathname : ' + urlP arser.path name + '<b r>\ -> pat hName: ' +  pathName  + ' <br>\  Token: ' +  App_Utils .GetSessio nToken());
  397                //consol e.log(xurl );
  398  
  399                if (subm itRoa && p athName == = 'paincoa ch'){
  400                    VPC. Data.Track ing.isRoaA ccepted =  true;
  401                    VPC. Data.Track ing.isUser PressedCan celOnROA =  false;
  402                    //ro aWindow.cl ose();
  403                    App. vent.trigg er('roa:cl ose');
  404                    //Ap p.vent.tri gger('iab: close');
  405                    App. vent.trigg er('load:u ser', { in it: true } );
  406                }
  407  
  408                if (path Name === ' launchpad' ){
  409                    //al ert('direc t to launc hpad');
  410                    VPC. Data.Track ing.isRoaA ccepted =  false;
  411                    VPC. Data.Track ing.isUser PressedCan celOnROA =  true;
  412                    App_ Utils.remo veRemoteRe qHeader();
  413                    App_ Utils.remo veRemoteEU LA();
  414                    App_ Utils.VAMF Logout();
  415                    App. loginUtils .authorize ();
  416                }
  417  
  418           }) ;
  419  
  420           ro aWindow.ad dEventList ener('load stop', fun ction(even t) {
  421                console. log('loads top: ' + e vent.url);
  422                if (even t.url.inde xOf('#form -review')  > 0) {
  423                    subm itRoa = tr ue;
  424                }
  425           }) ;
  426  
  427           Ap p.vent.on( 'roa:close ', functio n(){
  428                roaWindo w.close();
  429           }) ;
  430  
  431           Ap p.vent.on( 'roa:exit' , function (){
  432                //alert( '......roa ...exit');
  433           }) ;
  434       },
  435       setRem oteReqHead er: functi on(){
  436           ro aWindow.ex ecuteScrip t(
  437                {code :  "xhr.setRe questHeade r('Authori zation', ' Bearer '"  + App_Util s.GetSessi onToken()  + ");"},
  438                function (data){
  439                    if(d ata){}
  440                });
  441       },
  442       setRem oteEULA: f unction(){
  443           ro aWindow.ex ecuteScrip t({code :  "localStor age.setIte m('VPC_Eul a', " + Ap p_Utils.Ge tLocalStor age('VPC_E ula') + ") ;"},
  444                function (data){
  445                    if(d ata){}
  446                });
  447       },
  448       remove RemoteReqH eader: fun ction(){
  449           ro aWindow.ex ecuteScrip t(
  450                {code :  "sessionSt orage.setI tem('token ', null);" },
  451                function (data){
  452                    if(d ata){}
  453                });
  454       },
  455       remove RemoteEULA : function (){
  456           ro aWindow.ex ecuteScrip t(
  457                {code :  "localStor age.remove Item('VPC_ Eula');"},
  458                function (data){
  459                    if(d ata){}
  460                });
  461       },
  462       GetLoc alStorage:  function  (key) {
  463           re turn local Storage.ge tItem(key) ;
  464       },
  465       SetLoc alStorage:  function  (key, valu e) {
  466           lo calStorage .setItem(k ey, JSON.s tringify(v alue));
  467       },
  468       Delete LocalStora ge: functi on (key) {
  469           lo calStorage .removeIte m(key);
  470       },
  471       Cookie Exists: fu nction (co okieName)  {
  472           re turn docum ent.cookie .indexOf(c ookieName)  > 0;
  473       },
  474       Delete Cookie: fu nction (co okieName)  {
  475           do cument.coo kie = enco deURICompo nent(cooki eName) + " =deleted;  expires="  + new Date (0).toUTCS tring();
  476       },
  477       SetSes sionToken:  function  (name, val ue) {
  478           va lue = valu e.replace( /"/g, ""). replace(/' /g, "");
  479           se ssionStora ge.setItem (name, '"'  + value.t oString()  +'"');
  480       },
  481       ClearS essionToke n: functio n (name) {
  482           se ssionStora ge.setItem (name, nul l);
  483       },
  484       Retrie veToken: f unction (n ame) {
  485           va r token =  sessionSto rage.getIt em(name);
  486           if  (token !=  'null' &&  token !=  null) {
  487                return t oken.repla ce(/"/g, " ");
  488           }
  489           el se { retur n null; }
  490       },
  491       GetSes sionToken:  function  () {
  492           re turn App_U tils.Retri eveToken(' token');
  493       },
  494       GetMHV Token: fun ction () {
  495           re turn App_U tils.Retri eveToken(' mhvToken') ;
  496       },
  497       AppCle anup: func tion () {
  498           // console.lo g("In appU tils.appCl eanup...") ;
  499           if  (App_Util s.GetSessi onToken()  != null) {
  500                VPC.Mode l.DeleteTo ken = new  VPC.Model. deleteToke n();
  501                VPC.Mode l.DeleteTo ken.destro y({
  502                    data Type: "tex t",
  503                    cont entType: f alse,
  504                    proc essData: f alse,
  505                    comp lete: func tion (mode l, respons e) {
  506                         App.vent.t rigger('to ken:delete d');
  507                    }
  508                });
  509                App_Util s.ClearSes sionToken( 'token');
  510                App_Util s.ClearSes sionToken( 'mhvToken' );
  511           }
  512           el se {
  513                App.vent .trigger(' token:dele ted');
  514           }
  515           Ap p.vent.on( 'token:del eted', fun ction (dat a) {
  516                //consol e.log("tok en deleted ...");
  517                if (App_ Utils.Cook ieExists(' JSESSIONID ')) {
  518                    App_ Utils.Dele teCookie(' JSESSIONID ');
  519                    App. vent.trigg er('cookie :deleted') ;
  520                }
  521                else { A pp.vent.tr igger('coo kie:delete d'); }
  522                App.vent .trigger(' AppCleanup :complete' );
  523           }) ;
  524       },
  525       GetUrl Parameter:  function  (sParam) {
  526           va r sPageURL  = window. location.s earch.subs tring(1);
  527           va r sURLVari ables = sP ageURL.spl it('&');
  528           fo r (var i =  0; i < sU RLVariable s.length;  i++)
  529           {
  530                var sPar ameterName  = sURLVar iables[i]. split('=') ;
  531                if (sPar ameterName [0] == sPa ram)
  532                {
  533                    retu rn sParame terName[1] ;
  534                }
  535           }
  536       },
  537       SetUrl : function  () {
  538           va r url = wi ndow.locat ion.href;
  539           ur l = url.sl ice(0, url .indexOf(' ?'));
  540           re turn url;
  541       },
  542       Return ToLaunchpa d: functio n () {
  543           // Redirect b ack to Lau nchpad her e.
  544           wi ndow.locat ion = App_ Utils.GetD omainPath( ) + "launc hpad";
  545       },
  546       Launch padLogin:  function ( ) {
  547           // Redirect b ack to Lau nchpad Log in. User i s not logg edin
  548           if  (App.debu g) {
  549                console. log("Redir ect back t o Launchpa d Login.")
  550                console. log(VPC.Re sources.HA Resources. get('oauth -login').t oJSON().hr ef + '?&re direct_uri =' + App_U tils.GetRe ferencePat h() + 'pai ncoach/')
  551           }
  552           el se { windo w.location  = VPC.Res ources.HAR esources.g et('oauth- login').to JSON().hre f + '?&red irect_uri= ' + App_Ut ils.GetRef erencePath (); }
  553  
  554       },
  555       VAMFLo gout: func tion () {
  556           $( ".containe r-fluid"). hide();
  557           va r url = Ap p_Utils.Ge tDomainPat h() + 'sso eproxy/log out' + '?'  + new Dat e().getTim e();
  558           va r ref = co rdova.InAp pBrowser.o pen(url, ' _blank', ' location=n o');
  559  
  560           re f.addEvent Listener(' loadstop',  function( ) {
  561                //window .location. reload();
  562                window.l ocation =  "file:///a ndroid_ass et/www/ind ex.html";
  563  
  564                if (roaW indow !==  null) {
  565                    roaW indow.clos e();
  566                }
  567                ref.clos e();
  568           }) ;
  569       },
  570  
  571       /**
  572        * For  modals in side the . modal-cont ainer div,  e.g. EULA , Timeout,  Exit, Pre scription  successful ly refille d
  573        */
  574       ModalC ontainerSh own: funct ion (eleme nt) {
  575           $( "header, m ain, foote r, .scroll bar-gradie nt").attr( "aria-hidd en", "true ");
  576           th is.FocusOn Modal(elem ent);
  577       },
  578       ModalC ontainerHi dden: func tion () {
  579           $( "header, m ain, foote r, .scroll bar-gradie nt").remov eAttr("ari a-hidden") ;
  580       },
  581       /**
  582        * For  the Sort  menu/subme nu
  583        */
  584       SetSor t: functio n () {
  585           va r _self =  this;
  586           //  On dropdo wn open
  587           $( '#sortMenu ').on('sho wn.bs.drop down', fun ction() {
  588                // Set a ria-expand ed to true
  589                $('#sort Btn').attr ('aria-exp anded', tr ue);
  590  
  591                // Set f ocus on th e first li nk in the  dropdown
  592                // delay ed by 0.5  second to  allow VO a nnouncemen t of expan ded state
  593                setTimeo ut(functio n() {
  594                    $('# sortMenu . dropdown-m enu li:fir st-child a ').focus() ;
  595                }, 500);
  596  
  597                // hide  other elem ents
  598                $('heade r, #errorS ection, .s ort-hide,  footer, .s crollbar-g radient'). attr('aria -hidden',  'true');
  599           }) ;
  600  
  601           //  On dropdo wn close
  602           $( '#sortMenu ').on('hid den.bs.dro pdown', fu nction() {
  603                // Set a ria-expand ed to fals e
  604                $('#sort Btn').attr ('aria-exp anded', fa lse);
  605  
  606                // un-hi de other e lements
  607                $('heade r, #errorS ection, .s ort-hide,  footer, .s crollbar-g radient'). removeAttr ('aria-hid den');
  608           }) ;
  609       },
  610       Initia lizeAffix:  function  (element)  {
  611           $( element).a ffix({
  612                offset:  {
  613                    top:  function  () {
  614                         return ( t his.top =  $(element) .offset(). top ); //  this retur ns whateve r is set i n data-off set-top in  html
  615                    }
  616                }
  617           }) ;
  618       }
  619   };