Produced by Araxis Merge on 8/16/2019 12:02:06 PM Eastern 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Direct_DSM.zip\Direct_DSM\webmail\jscripts | dpii.compose.js | Tue Aug 13 17:30:02 2019 UTC |
| 2 | Direct_DSM.zip\Direct_DSM\webmail\jscripts | dpii.compose.js | Thu Aug 15 19:32:58 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1330 |
| 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 | /*jslint d evel: true , white: t rue, debug : true, no men: true* / | |
| 2 | ||
| 3 | /* JAVASCR IPT ONLY A PPLICABLE TO THE COM POSE PAGE | |
| 4 | * | |
| 5 | * This cod e is slowl y getting organized into modul es, primar ily using closures. We're runn ing JSHint on new co de to try to keep it conformin g to some standard b est practi ces. | |
| 6 | * | |
| 7 | * More inf o on modul es and clo sures: htt ps://mediu m.freecode camp.com/j avascript- modules-a- beginner-s -guide-783 f7d7a5fcc | |
| 8 | * htt p://eloque ntjavascri pt.net/10_ modules.ht ml | |
| 9 | * | |
| 10 | * How to m ake the *t his* keywo rd consist ently poin t to what you want i t to: http s://www.sm ashingmaga zine.com/2 014/01/und erstanding -javascrip t-function -prototype -bind | |
| 11 | * | |
| 12 | * Goal for the futur e is to ac tually kee p these mo dules in s eparate fi les and us e somethin g like req uire.js to grab them as needed . Possibl y we could even go c razy and s tart | |
| 13 | * minifyin g our js a s part of the deploy ment proce ss so that we can ad d tons of comments w ithout inc reasing pa geweight. Time to p arty like it's 2003! - MG 2016 -08-26 */ | |
| 14 | ||
| 15 | ||
| 16 | //define n amespaces for this f ile | |
| 17 | var dpii = dpii || { }; //defin e a namesp ace for ou r js | |
| 18 | var $ = $ || console .error('Jq uery is no t availabl e for this script'); | |
| 19 | //dpii.dss _provider_ email = "v arouting@d irect-ehea lth.com"; // Email address us ed for the DSS prodi ver search integrati on. | |
| 20 | dpii.dss_p rovider_em ail = " DNS . URL "; // Email a ddress use d for the DSS prodiv er search integratio n. | |
| 21 | dpii.dss_p rovider_se arch_websi te = "http s://direct -ehealth.n et/"; | |
| 22 | dpii.compo se = (func tion() { | |
| 23 | "u se strict" ; | |
| 24 | ||
| 25 | re turn { | |
| 26 | mess ageId: fun ction(){ | |
| 27 | return $('input[ name="msg_ id"]').val (); | |
| 28 | }, | |
| 29 | ||
| 30 | hasM essageId: function() { | |
| 31 | var me ssageID = this.messa geId(); | |
| 32 | return ($.isNume ric(messag eID) && me ssageID > 0 && Math. floor(mess ageID) == messageID) ; | |
| 33 | }, | |
| 34 | ||
| 35 | _ini t: functio n(){ | |
| 36 | //call on the _i nit method for any o bject insi de of dpii .compose t hat has on e | |
| 37 | for(va r property in this){ | |
| 38 | if(!this .hasOwnPro perty(prop erty) || p roperty == '_init') | |
| 39 | continue; | |
| 40 | if(typeo f this[pro perty] === 'object') { | |
| 41 | this[prope rty].paren t = this; | |
| 42 | if(this[pr operty].ha sOwnProper ty('_init' )){ | |
| 43 | th is[propert y]._init() ; | |
| 44 | } | |
| 45 | } | |
| 46 | } | |
| 47 | ||
| 48 | initRi chTextEdit or(); | |
| 49 | }, | |
| 50 | }; | |
| 51 | })(); | |
| 52 | ||
| 53 | ////////// ////////// ////////// ////////// ////////// ////////// ////////// //// | |
| 54 | // CHANGES | |
| 55 | // trackin g changes that the u ser has ma de since l ast saving the messa ge | |
| 56 | ////////// ////////// ////////// ////////// ////////// ////////// ////////// //// | |
| 57 | dpii.compo se.changes = (functi on() { | |
| 58 | va r dataAttr ibutes = { 'exist': ' altered-si nce-save'} ; | |
| 59 | ||
| 60 | re turn { | |
| 61 | inte rval: null , | |
| 62 | ||
| 63 | exis t: functio n(){ | |
| 64 | return $('#main_ form').dat a(dataAttr ibutes.exi st) === 1; | |
| 65 | }, | |
| 66 | ||
| 67 | mark : function (){ | |
| 68 | return $('#main_ form').dat a(dataAttr ibutes.exi st, 1); | |
| 69 | }, | |
| 70 | ||
| 71 | clea r: functio n(){ | |
| 72 | return $('#main_ form').dat a(dataAttr ibutes.exi st, 0); | |
| 73 | }, | |
| 74 | ||
| 75 | _ini t: functio n(){ | |
| 76 | this.c lear(); | |
| 77 | ||
| 78 | this.i nterval = setInterva l(function () { | |
| 79 | if(this. exist()){ | |
| 80 | $("#main_f orm").trig ger('autos ave'); | |
| 81 | } | |
| 82 | }.bind (this), 60 000); | |
| 83 | ||
| 84 | //chan ges to any input in the main c ompose for m | |
| 85 | $('#ma in_form :i nput').cha nge(functi on(){ | |
| 86 | this.mar k(); | |
| 87 | }.bind (this)); | |
| 88 | ||
| 89 | //chan ges to mes sage body will trigg er autosav e (special case sinc e it's not a normal form field ) | |
| 90 | $("#ti nyeditorfr ame").cont ents().fin d("#editor ").on('blu r keyup pa ste', func tion() { | |
| 91 | if(w indow.pare nt.$('#mes sage_body' ).val() != $(this).h tml()) { | |
| 92 | this.mar k(); | |
| 93 | window.p arent.$('# message_bo dy').val($ (this).htm l()); | |
| 94 | } | |
| 95 | }.bind (this)); | |
| 96 | }, | |
| 97 | }; | |
| 98 | })(); | |
| 99 | ||
| 100 | ||
| 101 | ////////// ////////// ////////// ///// | |
| 102 | // CSRF | |
| 103 | ////////// ////////// ////////// ///// | |
| 104 | ||
| 105 | dpii.compo se.csrf = (function( ) { | |
| 106 | va r tokenIde ntifier = 'input[typ e=hidden]. token'; | |
| 107 | ||
| 108 | re turn { | |
| 109 | name : function (){ | |
| 110 | return $(tokenId entifier). attr('name '); | |
| 111 | }, | |
| 112 | ||
| 113 | valu e: functio n(){ | |
| 114 | return $(tokenId entifier). val(); | |
| 115 | }, | |
| 116 | ||
| 117 | quer yString: f unction(){ | |
| 118 | return '?' + thi s.name() + '=' + thi s.value(); | |
| 119 | }, | |
| 120 | ||
| 121 | upda te: functi on(value){ | |
| 122 | return $(tokenId entifier). val(value) ; | |
| 123 | ||
| 124 | } | |
| 125 | }; | |
| 126 | })(); | |
| 127 | ||
| 128 | ////////// ////////// ////////// ///// | |
| 129 | // FEEDBAC K | |
| 130 | ////////// ////////// ////////// ///// | |
| 131 | ||
| 132 | dpii.compo se.feedbac k = (funct ion() { | |
| 133 | ||
| 134 | func tion show( alertType, message, alertFor, header){ | |
| 135 | var cont ainer = $( '.alert-da nger.clone -me').clon e().remove Class('clo ne-me').cs s('display ', 'block' ); | |
| 136 | ||
| 137 | containe r.find('.m essage-tex t').text(m essage); | |
| 138 | if(heade r) | |
| 139 | container. find('.mes sage-heade r').html(' <strong>' + header + '</strong >'); | |
| 140 | if(alert Type != 'd anger') | |
| 141 | container. removeClas s('alert-d anger').ad dClass('al ert-'+aler tType); | |
| 142 | if(alert For) | |
| 143 | container. data('for' , alertFor ); | |
| 144 | ||
| 145 | $('.aler t-danger.c lone-me'). after(cont ainer); | |
| 146 | dpii.com pose.files .adjustInp utTrigger( ); | |
| 147 | } | |
| 148 | ||
| 149 | re turn { | |
| 150 | info : function (message, identifier ){ | |
| 151 | return show('inf o', messag e, identif ier); | |
| 152 | }, | |
| 153 | ||
| 154 | erro r: functio n(message, identifie r){ | |
| 155 | return show('dan ger', mess age, ident ifier, 'An error was encounter ed. '); | |
| 156 | }, | |
| 157 | ||
| 158 | succ ess: funct ion(messag e, identif ier){ | |
| 159 | return show('suc cess', mes sage, iden tifier, 'S uccess! ') ; | |
| 160 | }, | |
| 161 | ||
| 162 | warn ing: funct ion(messag e, identif ier){ | |
| 163 | return show('war ning', mes sage, iden tifier, 'W arning: ') ; | |
| 164 | }, | |
| 165 | ||
| 166 | remo ve: functi on(identif ier){ | |
| 167 | $('.al ert[data-f or="'+iden tifier+'"] ').remove( ); | |
| 168 | }, | |
| 169 | ||
| 170 | setV alidation: function( input, mes sage){ | |
| 171 | this.e rror(messa ge, $(inpu t).attr('n ame')); | |
| 172 | $(inpu t).addClas s('has-err or'); | |
| 173 | }, | |
| 174 | ||
| 175 | remo veValidati on: functi on(input){ | |
| 176 | this.r emove($(in put).attr( 'name')); | |
| 177 | $(inpu t).removeC lass('has- error'); | |
| 178 | }, | |
| 179 | }; | |
| 180 | })(); | |
| 181 | ||
| 182 | ////////// ////////// ////////// ///// | |
| 183 | // RECIPIE NTS | |
| 184 | ////////// ////////// ////////// ///// | |
| 185 | ||
| 186 | dpii.compo se.recipie nts = (fun ction() { | |
| 187 | ||
| 188 | va r applyTok ensToExist ingRecipie nts = func tion(field Name, fiel dText){ | |
| 189 | html _entity_de code(field Text).spli t(';').for Each(funct ion(addres s){ | |
| 190 | addres s = addres s.replace( /'/g,"\'") ; // Escap e apostrop hes before trimming | |
| 191 | addres s = $.trim (address); | |
| 192 | if(add ress.lengt h > 0){ | |
| 193 | var extr acted = ad dress.matc h(/([a-zA- Z0-9\'._-] +@[a-zA-Z0 -9._-]+\.[ a-zA-Z0-9. _-]+)/gi); //Apostro phe added | |
| 194 | $('texta rea[name=" '+ fieldNa me+'"]').t okenInput( 'add', { n ame : html entities(a ddress,'EN T_NOQUOTES '), id : h tmlentitie s(extracte d), uid: u niqid() }) ; | |
| 195 | } | |
| 196 | }.bi nd(this)); | |
| 197 | }; | |
| 198 | ||
| 199 | va r markupFo rValidated Recipient = function (item){ | |
| 200 | var email = it em.id; | |
| 201 | if(i tem.descri pton != nu ll) | |
| 202 | email = item.des cription; | |
| 203 | retu rn '<li><d iv style=" display: i nline-bloc k; padding -left: 10p x;"><div c lass="full _name"> ' + item.nam e + '</div ><div clas s="email"> ' + email + '</div>< /div></li> '; | |
| 204 | }; | |
| 205 | ||
| 206 | va r markupFo rUnvalidat edRecipien t = functi on(item){ | |
| 207 | item .uid = uni qid(); | |
| 208 | var markup = ' <li class= "unvalidat ed"><p cla ss="unvali dated" id= "'+item.ui d+'" data- address="' + item.id + '"'; | |
| 209 | if(i tem.descri ption == n ull) { | |
| 210 | markup += 'title ="' + item .id + '" d ata-addres s="' +item .id+ '">'; | |
| 211 | }els e{ | |
| 212 | markup += " oncl ick=\"view DistList(' " + item.u id + "','" + htmlent ities(base 64_encode( json_encod e(item))) + "','mess age_to');\ " title=\" " + item.d escription +"\" ><im g src=\"/i mages/grou p.png\" cl ass=\"hove r_pointer\ " alt=\"Di stribution List\"> " ; | |
| 213 | } | |
| 214 | mark up += item .name + '< /p></li>'; | |
| 215 | retu rn markup; | |
| 216 | }; | |
| 217 | ||
| 218 | va r tokenSet tings = { | |
| 219 | them e: 'dpii', | |
| 220 | sear chDelay: 5 00, | |
| 221 | hint Text: 'Ent er a Direc t address' , | |
| 222 | toke nDelimiter : ';', | |
| 223 | onAd d: functio n(e) { if( !multipleA ddressSpli t(e)) { ve rifyAddres s(e); } }, | |
| 224 | noRe sultsText: 'This is not a trus ted addres s', | |
| 225 | resu ltsFormatt er: markup ForValidat edRecipien t, | |
| 226 | toke nFormatter : markupFo rUnvalidat edRecipien t, | |
| 227 | }; | |
| 228 | ||
| 229 | ||
| 230 | re turn { | |
| 231 | _ini t: functio n(){ | |
| 232 | var me ssage_to_t ext = $('t extarea[na me="messag e_to"]').t ext(); | |
| 233 | var me ssage_cc_t ext = $('t extarea[na me="messag e_cc"]').t ext(); | |
| 234 | $('tex tarea[name ="message_ to"], text area[name= "message_c c"]').read y(function (){ | |
| 235 | $("#mess age_to").t okenInput( '/inbox/ge t_contacts _search/', tokenSett ings); | |
| 236 | $("#mess age_cc").t okenInput( '/inbox/ge t_contacts _search/', tokenSett ings); | |
| 237 | applyTok ensToExist ingRecipie nts('messa ge_to', me ssage_to_t ext); | |
| 238 | applyTok ensToExist ingRecipie nts('messa ge_cc', me ssage_cc_t ext); | |
| 239 | }); | |
| 240 | } | |
| 241 | }; | |
| 242 | })(); | |
| 243 | ||
| 244 | ////////// ////////// ////////// ////////// ////////// ////////// /////// | |
| 245 | // SAVE | |
| 246 | ////////// ////////// ////////// ////////// ////////// ////////// /////// | |
| 247 | ||
| 248 | dpii.compo se.save = (function( options) { | |
| 249 | va r inProgre ss = false ; | |
| 250 | ||
| 251 | re turn { | |
| 252 | inPr ogress: fu nction(){ | |
| 253 | return inProgres s; | |
| 254 | }, | |
| 255 | run: function( options){ | |
| 256 | if(!th is.parent. changes.ex ist() && ( !$.isPlain Object(opt ions) || ! options.fo rceSave)) | |
| 257 | return f alse; | |
| 258 | ||
| 259 | if(thi s.inProgre ss()) | |
| 260 | return f alse; | |
| 261 | ||
| 262 | if(dpi i.compose. ui.dialogI sOpen()) | |
| 263 | return f alse; //th e user is working on something besides t he draft, and saving may cause problms | |
| 264 | ||
| 265 | inProg ress = tru e; | |
| 266 | ||
| 267 | if($(' #message_b ody').css( 'display') == 'none' ) { | |
| 268 | $('texta rea[name=" message_bo dy"]').val (editor.ge tEditorCon tent()); | |
| 269 | } | |
| 270 | ||
| 271 | var se ttings = { | |
| 272 | type: 'P OST', | |
| 273 | url: '/i nbox/ajax_ draft_save /', | |
| 274 | data: $( '#main_for m').serial ize(), | |
| 275 | dataType : 'html', | |
| 276 | complete : function (jqXHR, st atus){ | |
| 277 | ||
| 278 | inProgress = false; | |
| 279 | $('.autosa ve').remov e(); | |
| 280 | ||
| 281 | if(userIsN otAuthoriz ed(jqXHR)) { | |
| 282 | wi ndow.locat ion = '/au th/logout' ; | |
| 283 | re turn false ; | |
| 284 | } | |
| 285 | ||
| 286 | if(!isJSON (jqXHR.res ponseText) ){ | |
| 287 | re turn false ; | |
| 288 | } | |
| 289 | ||
| 290 | var parsed Response = $.parseJS ON(jqXHR.r esponseTex t); | |
| 291 | this.paren t.csrf.upd ate(parsed Response.t oken); | |
| 292 | if(status == 'succes s'){ | |
| 293 | va r id = par sedRespons e.id; | |
| 294 | if ($.isNumer ic(id) && id > 1 && Math.floor (id) == id ){ | |
| 295 | $('i nput[name= "msg_id"]' ).val(id); | |
| 296 | this .parent.ch anges.clea r(); | |
| 297 | } | |
| 298 | } | |
| 299 | }.bind(t his), | |
| 300 | }; | |
| 301 | ||
| 302 | if($.i sPlainObje ct(options )){ | |
| 303 | if(optio ns.forceSa ve) | |
| 304 | setti ngs.data + = '&force_ save=true' ; | |
| 305 | if(optio ns.async = == false) | |
| 306 | settings.a sync = fal se; | |
| 307 | } | |
| 308 | ||
| 309 | return $.ajax(se ttings); | |
| 310 | } | |
| 311 | }; | |
| 312 | })(); | |
| 313 | ||
| 314 | ||
| 315 | ||
| 316 | ////////// ////////// ////////// ////////// ////////// ////////// /////// | |
| 317 | // USER IN TERFACE | |
| 318 | ////////// ////////// ////////// ////////// ////////// ////////// /////// | |
| 319 | dpii.compo se.ui = (f unction(op tions) { | |
| 320 | ||
| 321 | re turn { | |
| 322 | dial ogIsOpen: function() { | |
| 323 | return ($('.over lay').leng th > 0 || $('.form-d ialog-cont ainer').le ngth > 0); | |
| 324 | }, | |
| 325 | ||
| 326 | _ini t: functio n(){ | |
| 327 | $('a.c ancel').on ('click', function(e vent) { | |
| 328 | if(!this .parent.ch anges.exis t()) retur n true; // if there a re no unsa ved change s, go ahea d and canc el without prompting | |
| 329 | if(event .preventDe fault) eve nt.prevent Default(); else even t.returnVa lue = fals e; | |
| 330 | var dial og = $('<p >This draf t has unsa ved change s. Would you like t o save you r changes? </p>').dia log({ | |
| 331 | buttons: { | |
| 332 | "Y es": funct ion() {$(' #save_btn' ).click(); }, | |
| 333 | "N o": funct ion() {win dow.locati on.href = "/inbox";} , | |
| 334 | "C ancel": f unction() { | |
| 335 | dial og.dialog( 'close'); | |
| 336 | } | |
| 337 | } | |
| 338 | }); | |
| 339 | }.bind (this)); | |
| 340 | ||
| 341 | $("#sh ow-cc").on ('click', function(e vent) { | |
| 342 | if(event .preventDe fault) eve nt.prevent Default(); else even t.returnVa lue = fals e; | |
| 343 | if($('te xtarea[nam e="message _cc"]').le ngth) { | |
| 344 | $('textare a[name="me ssage_cc"] ').parent( ).parent() .css('disp lay','tabl e-row'); | |
| 345 | $('textare a[name="me ssage_cc"] ').focus() ; | |
| 346 | $('#show-c c').remove (); | |
| 347 | } | |
| 348 | }); | |
| 349 | ||
| 350 | $(".ps-a ddress-boo k").on('cl ick', func tion(event ) { | |
| 351 | //if(eve nt.prevent Default) e vent.preve ntDefault( ); else ev ent.return Value = fa lse; | |
| 352 | ||
| 353 | // Launc h Provider Search Bo x (DSS) // | |
| 354 | // Link is https:/ /direct-eh ealth.com: 449/ // | |
| 355 | ||
| 356 | var $thi s = $(this ); | |
| 357 | ||
| 358 | var url = dpii.dss _provider_ search_web site; | |
| 359 | var wind owName = " Provider S earch";//$ (this).att r("name"); | |
| 360 | var wind owSize = $ this.data( "popup"); | |
| 361 | ||
| 362 | // Addin g support to center the popup page. // | |
| 363 | // Fixes dual-scre en positio n Most browsers Firef ox | |
| 364 | var dual ScreenLeft = window. screenLeft != undefi ned ? wind ow.screenL eft : wind ow.screenX ; | |
| 365 | var dual ScreenTop = window.s creenTop ! = undefine d ? window .screenTop : window. screenY; | |
| 366 | ||
| 367 | var w = 800; // de fault; | |
| 368 | var h = 600; | |
| 369 | var widt h = window .innerWidt h ? window .innerWidt h : docume nt.documen tElement.c lientWidth ? documen t.document Element.cl ientWidth : screen.w idth; | |
| 370 | var heig ht = windo w.innerHei ght ? wind ow.innerHe ight : doc ument.docu mentElemen t.clientHe ight ? doc ument.docu mentElemen t.clientHe ight : scr een.height ; | |
| 371 | ||
| 372 | w = widt h - (width * .20); | |
| 373 | var left = ((width / 2) - (w / 2)) + d ualScreenL eft; | |
| 374 | var top = ((height / 2) - (h / 2)) + d ualScreenT op; | |
| 375 | ||
| 376 | var $dss window = w indow.open (url, wind owName, 's crollbars= yes, width =' + w + ' , height=' + h + ', top=' + to p + ', lef t=' + left ); | |
| 377 | ||
| 378 | // Popul ate TO fie ld with DS S provider email. / / | |
| 379 | // varou ting@direc t-ehealth. com | |
| 380 | ||
| 381 | ||
| 382 | //event. preventDef ault(); | |
| 383 | ||
| 384 | $('#toke n-input-me ssage_to') .val(dpii. dss_provid er_email); | |
| 385 | // $('#to ken-input- message_to ').parent( ).parent() .val(dpii. dss_provid er_email); | |
| 386 | $('texta rea[name=" message_to "]').val(d pii.dss_pr ovider_ema il); | |
| 387 | ||
| 388 | ||
| 389 | $('#toke n-input-me ssage_to') .prop("dis abled", tr ue); | |
| 390 | $('#toke n-input-me ssage_to') .parent(). parent().c ss({"borde r":'none', "color":"# 000000"}); | |
| 391 | $('#toke n-input-me ssage_to') .prop("col or", '#000 000'); | |
| 392 | $('#toke n-input-me ssage_to') .css("widt h", 300); | |
| 393 | $('#from _field').c ss("paddin g-left", " 5px"); | |
| 394 | /* | |
| 395 | if($('te xtarea[nam e="message _pscc"]'). length) { | |
| 396 | $('textare a[name="me ssage_pscc "]').paren t().parent ().css('di splay','ta ble-row'); | |
| 397 | $('textare a[name="me ssage_pscc "]').focus (); | |
| 398 | //$('#show -pscc').re move(); | |
| 399 | }*/ | |
| 400 | }); | |
| 401 | ||
| 402 | // Add input val idation of message_p scc. // | |
| 403 | // unc omment onc e merged w ith 1.11.3 where fil terXSS is added to t he project . // | |
| 404 | /* | |
| 405 | $('tex tarea[name ="message_ pscc"]').o n('change' , function (){ | |
| 406 | $( 'textarea[ name="mess age_pscc"] ').val(fil terXSS($(' textarea[n ame="messa ge_pscc"]' ).val())); | |
| 407 | }); | |
| 408 | */ | |
| 409 | ||
| 410 | ||
| 411 | ||
| 412 | } | |
| 413 | }; | |
| 414 | ||
| 415 | })(); | |
| 416 | ||
| 417 | ||
| 418 | ////////// ////////// ////////// ////////// ////////// ////////// ////////// // | |
| 419 | // NOT YET ORGANIZED | |
| 420 | ////////// ////////// ////////// ////////// ////////// ////////// ////////// // | |
| 421 | ||
| 422 | //previous ly just a giant mass of code i n the wind ow.load fu nction - n eeds to be broken do wn and org anized | |
| 423 | function c omposeForm IsValid(){ | |
| 424 | cl earInterva l(dpii.com pose.chang es.interva l); | |
| 425 | ||
| 426 | if ($('button #search_bt n').attr(' clicked') == "true") { | |
| 427 | $('b utton#sear ch').remov eAttr('cli cked'); | |
| 428 | retu rn true; | |
| 429 | } | |
| 430 | ||
| 431 | ||
| 432 | if ($('#messa ge_body'). css('displ ay') == 'n one') { | |
| 433 | $('t extarea[na me="messag e_body"]') .val(edito r.getEdito rContent() ); //need to set tex tarea cont ent on sub mit | |
| 434 | } | |
| 435 | ||
| 436 | // Clear data | |
| 437 | $( '#7332_dat a_question ').css("co lor",""); | |
| 438 | $( '#7332_aut h_question ').css("co lor",""); | |
| 439 | ||
| 440 | va r validate = true; | |
| 441 | va r message = ""; | |
| 442 | if ($('textar ea[name="m essage_to" ]').val(). length === 0 && $('# save_btn') .attr('cli cked') != 'true') { | |
| 443 | dpii.c ompose.fee dback.setV alidation( $('#token- input-mess age_to').p arent().pa rent(), 'P lease spec ify at lea st one rec ipient for the To fi eld.'); | |
| 444 | ||
| 445 | $('#to ken-input- message_to ').css("ba ckground", "none repe at scroll 0 0 #f8e0e 0"); | |
| 446 | valida te = false ; | |
| 447 | messag e += 'At l east one r ecipient m ust be spe cified. '; | |
| 448 | $('#to ken-input- message_to ').on('blu r', functi on(){ | |
| 449 | if($('.t oken-input -token-dpi i').length !== 0){ | |
| 450 | removeErro rMessage($ ('#token-i nput-messa ge_to').pa rent().par ent(),'to' ); | |
| 451 | $('#token- input-mess age_to').c ss('backgr ound',''); | |
| 452 | } | |
| 453 | }); | |
| 454 | } | |
| 455 | ||
| 456 | /* var patien t_auth_val idation_me ssage = dp ii.compose .patientau th.get_val idation_me ssage(); | |
| 457 | if (patient_ auth_valid ation_mess age !== '' ) { | |
| 458 | validate = false; | |
| 459 | message += patient _auth_vali dation_mes sage; | |
| 460 | }* / | |
| 461 | ||
| 462 | if (!validate ){ | |
| 463 | $("# pros_modal ").css('di splay','no ne'); | |
| 464 | $('. overlay'). remove(); | |
| 465 | $('# save_btn') .removeAtt r('clicked '); | |
| 466 | $('# send_btn') .removeAtt r('clicked '); | |
| 467 | $('# StatusUpda ter').html (message); | |
| 468 | retu rn false; | |
| 469 | } | |
| 470 | ||
| 471 | if ($('p.untr usted').le ngth && $( '#save_btn ').attr('c licked') ! = 'true') { | |
| 472 | $("# pros_modal ").css('di splay','no ne'); | |
| 473 | $('. overlay'). remove(); | |
| 474 | $('# untrusted- dialog').r emove(); | |
| 475 | var addresses = ''; | |
| 476 | var to_remove = []; | |
| 477 | var i = 1; | |
| 478 | var j = 0; | |
| 479 | $('p .untrusted ').each(fu nction() { | |
| 480 | addres ses += $(t his).attr( 'data-addr ess'); | |
| 481 | to_rem ove[j] = $ (this).att r('data-ad dress'); | |
| 482 | if(i < $('p.untr usted').le ngth && $( 'p.untrust ed').lengt h > 1) { a ddresses + = ', '; } | |
| 483 | i++; | |
| 484 | j++; | |
| 485 | }); | |
| 486 | $('< div id=\"u ntrusted-d ialog\" ti tle="Untru sted Recip ients">'+ | |
| 487 | '<a cl ass="hidde n_context" href="#"> Untrusted Recipients </a>'+ | |
| 488 | '<p>Th e followin g recipien ts are unt rusted: '+ addresses+ | |
| 489 | '.</p> <p>Untrust ed recipie nts must b e removed before sen ding.</p>< p>Click "R emove All" to remove all untru sted recip ients,'+ | |
| 490 | ' or " Cancel" to cancel se nd and rev iew recipi ents indiv idually.</ p>'+ | |
| 491 | ' </div>').d ialog({ | |
| 492 | buttons: [ | |
| 493 | { text: 'R emove All' , click : function() { | |
| 494 | va r i = 0; | |
| 495 | $( to_remove) .each(func tion() { | |
| 496 | $("# message_to ").tokenIn put('remov e', { id : to_remove [i] }); | |
| 497 | $("# message_cc ").tokenIn put('remov e', { id : to_remove [i] }); | |
| 498 | i++; | |
| 499 | }) ; | |
| 500 | $( this).dial og('close' ); } | |
| 501 | }, | |
| 502 | { text: 'C ancel', cl ick : func tion() { $ (this).dia log('close '); } } | |
| 503 | ], | |
| 504 | close: f unction() { $('#menu Content'). focus(); $ ('#menuCon tent').rem oveClass(' visible'); } | |
| 505 | } ); | |
| 506 | $('# save_btn') .removeAtt r('clicked '); | |
| 507 | $('# send_btn') .removeAtt r('clicked '); | |
| 508 | retu rn false; | |
| 509 | }e lse if($(' p.unvalida ted').leng th && $('# save_btn') .attr('cli cked') != 'true') { | |
| 510 | $("# pros_modal ").css('di splay','no ne'); | |
| 511 | $('. overlay'). remove(); | |
| 512 | var addresses = ''; | |
| 513 | var i = 1; | |
| 514 | $('p .unvalidat ed').each( function() { | |
| 515 | addres ses += $(t his).attr( 'title'); | |
| 516 | if(i < $('p.unva lidated'). length && $('p.unval idated').l ength > 1) { address es += ', ' ; } | |
| 517 | i++; | |
| 518 | }); | |
| 519 | if(c onfirm('Th e followin g recipien ts have no t been val idated for trust: '+ addresses+ '. Message will fail to send i f any of t he unvalid ated recip ients are not truste d. Attempt to send a nyway?')) { | |
| 520 | //do t he check f or missing subject t oo if we a re plannin g on sendi ng it anyw ay | |
| 521 | if($(' input[name ="message_ subject"]' ).val().le ngth === 0 && $('#sa ve_btn').a ttr('click ed') != 't rue') { | |
| 522 | if(confi rm('No sub ject speci fied, send anyway?') ){ | |
| 523 | $("#pros_m odal").css ('display' ,'inline') ; | |
| 524 | $(document .body).app end("<div class=\"ov erlay\"></ div>"); | |
| 525 | return tru e; | |
| 526 | } | |
| 527 | else{ | |
| 528 | $('#send_b tn').remov eAttr('cli cked'); | |
| 529 | return fal se; | |
| 530 | } | |
| 531 | } | |
| 532 | else { | |
| 533 | $("#pros _modal").c ss('displa y','inline '); | |
| 534 | $(docume nt.body).a ppend("<di v class=\" overlay\"> </div>"); | |
| 535 | return t rue; | |
| 536 | } | |
| 537 | } | |
| 538 | else { | |
| 539 | $('#se nd_btn').r emoveAttr( 'clicked') ; | |
| 540 | return false; | |
| 541 | } | |
| 542 | } | |
| 543 | el se if($('i nput[name= "message_s ubject"]') .val().len gth === 0 && $('#sav e_btn').at tr('clicke d') != 'tr ue') { | |
| 544 | $("#pr os_modal") .css('disp lay','none '); | |
| 545 | $('.ov erlay').re move(); | |
| 546 | $('#sa ve_btn').r emoveAttr( 'clicked') ; | |
| 547 | if(con firm('You haven\'t s pecified a subject - would you like to s end this m essage any way?')){ | |
| 548 | $("#pros _modal").c ss('displa y','inline '); | |
| 549 | $(docume nt.body).a ppend("<di v class=\" overlay\"> </div>"); | |
| 550 | return t rue; | |
| 551 | } | |
| 552 | else{ | |
| 553 | $('#send _btn').rem oveAttr('c licked'); | |
| 554 | return f alse; | |
| 555 | } | |
| 556 | } | |
| 557 | el se if(dpii .compose.a ttachments .size() > 0) { | |
| 558 | if(d pii.compos e.attachme nts.size() > dpii.co mpose.atta chments.ma xSize()) { | |
| 559 | $("#pr os_modal") .css('disp lay','none '); | |
| 560 | $('.ov erlay').re move(); | |
| 561 | dpii.c ompose.fee dback.erro r('The tot al attachm ent size e xceeds the '+dpii.co mpose.atta chments.ma xSizeForDi splay()+' limit. Ple ase remove attachmen ts before trying aga in.'); | |
| 562 | $('#sa ve_btn').r emoveAttr( 'clicked') ; | |
| 563 | $('#se nd_btn').r emoveAttr( 'clicked') ; | |
| 564 | return false; | |
| 565 | } | |
| 566 | else { | |
| 567 | return true; | |
| 568 | } | |
| 569 | } | |
| 570 | el se if(edit or.getEdit orContent( ).toLowerC ase().inde xOf('attac hed') >= 0 && $('#sa ve_btn').a ttr('click ed') != 't rue') { | |
| 571 | if($ ('tr.attac h_input'). length) { | |
| 572 | if($(' tr#attach0 ').html(). length <= 0) { | |
| 573 | $("#pros _modal").c ss('displa y','none') ; | |
| 574 | $('#save _btn').rem oveAttr('c licked'); | |
| 575 | if(confi rm('Did yo u mean to attach fil es?\n\n Yo u wrote "a ttached" i n your mes sage but h ave not at tached any files, se nd anyway? ')){ | |
| 576 | $("#pros_m odal").css ('display' ,'inline') ; | |
| 577 | $(document .body).app end("<div class=\"ov erlay\"></ div>"); | |
| 578 | return tru e; | |
| 579 | } | |
| 580 | else{ | |
| 581 | $('#send_b tn').remov eAttr('cli cked'); | |
| 582 | return fal se; | |
| 583 | } | |
| 584 | } | |
| 585 | } | |
| 586 | else { | |
| 587 | $("#pr os_modal") .css('disp lay','none '); | |
| 588 | $('.ov erlay').re move(); | |
| 589 | $('#sa ve_btn').r emoveAttr( 'clicked') ; | |
| 590 | if(con firm('Did you mean t o attach f iles?\n\n You wrote "attached" in your m essage but have not attached a ny files, send anywa y?')){ | |
| 591 | $("#pros _modal").c ss('displa y','inline '); | |
| 592 | $(docume nt.body).a ppend("<di v class=\" overlay\"> </div>"); | |
| 593 | return t rue; | |
| 594 | } | |
| 595 | else{ | |
| 596 | return f alse; | |
| 597 | } | |
| 598 | } | |
| 599 | } | |
| 600 | el se { $('#s ave_btn'). removeAttr ('clicked' ); return true; } | |
| 601 | } | |
| 602 | ||
| 603 | ||
| 604 | ||
| 605 | function r emoveError Message(in put ,error _id){ | |
| 606 | $( '.alert-er ror.'+erro r_id).remo ve(); | |
| 607 | in put.css("b order","") ; | |
| 608 | in put.css("b ackground" ,""); | |
| 609 | } | |
| 610 | ||
| 611 | //sets err ors messag e for comp ose screen | |
| 612 | function s etErrorMes sage(messa ge, input, error_id) { | |
| 613 | // showFeedba ckForm(mes sage, erro r_id); | |
| 614 | in put.css("b ackground" ,"none rep eat scroll 0 0 #f8e0 e0"); | |
| 615 | in put.css("b order"," 2 px solid # c00"); | |
| 616 | } | |
| 617 | ||
| 618 | ||
| 619 | ////////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// //// | |
| 620 | // INITIAL IZATION FU NCTIONS - Things tha t will be run by doc ument.read y when the page is f irst loade d | |
| 621 | ////////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// //// | |
| 622 | ||
| 623 | function i nitRichTex tEditor(){ | |
| 624 | // Disabling TinyMCE i nclusion f or the mom ent. | |
| 625 | /* tinyMCE.in it({ | |
| 626 | sele ctor: 'mes sage_body' , | |
| 627 | body _id: 'edit or', | |
| 628 | bran ding: fals e, | |
| 629 | elem entpath: f alse, | |
| 630 | elem ent_format : 'xhtml', | |
| 631 | enti ty_encodin g: 'raw', | |
| 632 | titl e: 'Messag e Body Ric h Text Edi tor', | |
| 633 | widt h: $("#mes sage_body" ).css('wid th'), | |
| 634 | heig ht: $("#me ssage_body ").css('he ight'), | |
| 635 | font _formats: 'Verdana, Arial, Geo rgia, Treb uchet MS', | |
| 636 | menu bar: false , | |
| 637 | tool bar: 'code | bold it alic under line strik ethrough | subscript superscri pt | order edlist uno rderedlist | outdent indent | ' + | |
| 638 | 'leftalign centerali gn rightal ign blockj ustify | u nformat | undo redo n font siz e style | image hr l ink unlink | ' + | |
| 639 | 'cut copy paste prin t', | |
| 640 | plug ins: 'code ' | |
| 641 | }) ; */ | |
| 642 | ne w TINY.edi tor.edit(' editor',{ | |
| 643 | id:' message_bo dy', | |
| 644 | titl e:'Message Body Rich Text Edit or', | |
| 645 | widt h: $("#mes sage_body" ).css('wid th'), | |
| 646 | heig ht: $("#me ssage_body ").css('he ight'), | |
| 647 | cssc lass:'te', | |
| 648 | cont rolclass:' tecontrol' , | |
| 649 | rowc lass:'tehe ader', | |
| 650 | divi derclass:' tedivider' , | |
| 651 | cont rols:['tog gle','|',' bold','ita lic','unde rline','st rikethroug h','|','su bscript',' superscrip t','|', | |
| 652 | 'order edlist','u norderedli st','|','o utdent','i ndent','|' ,'leftalig n', | |
| 653 | 'cente ralign','r ightalign' ,'blockjus tify','|', 'unformat' ,'|','undo ','redo',' n', | |
| 654 | 'font' ,'size','s tyle','|', 'image','h r','link', 'unlink',' |','cut',' copy','pas te','print '], | |
| 655 | foot er:true, | |
| 656 | font s:['Verdan a','Arial' ,'Georgia' ,'Trebuche t MS'], | |
| 657 | xhtm l:true, | |
| 658 | cssf ile:'/css/ tinyeditor .css', | |
| 659 | body id:'editor ', | |
| 660 | foot erclass:'t efooter', | |
| 661 | togg le:{text:' source',ac tivetext:' wysiwyg',c ssclass:'t oggle'}, | |
| 662 | resi ze:{csscla ss:'resize '}, | |
| 663 | enti ty_encodin g : "raw" | |
| 664 | }) ; | |
| 665 | $( 'textarea[ name="mess age_body"] ').val('') ; | |
| 666 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.