11 $serviceShowInfo =
true;
12 $serviceLoadMenu =
true;
13 $serviceShowMenu =
true;
16 require_once(dirname(__FILE__) .
'/../library/hcuService.i');
22 PermCheckFeatureScreen($dbh, $HB_ENV, $MC, FEATURE_SECURE_MSG);
28 $chome = $HB_ENV[
"chome"];
29 $Flang = $HB_ENV[
"Flang"];
34 require_once(dirname(__FILE__) .
'/../includes/hcuPreContent.i');
40 if ( ($HB_ENV[
'Fset2'] & GetFlagsetValue(
"CU2_ALLOWMESSAGE")) != GetFlagsetValue(
"CU2_ALLOWMESSAGE") ) {
42 $serviceErrorTitle = $MC->msg(
"Feature Unavailable", HCU_DISPLAY_AS_HTML);
43 $serviceErrorMsg = $MC->msg(
'Feature Not Set', HCU_DISPLAY_AS_HTML) .
". " . $MC->msg(
'Contact CU', HCU_DISPLAY_AS_HTML);
45 $serviceErrorCode = 915;
46 require(dirname(__FILE__) .
"/../includes/hcuErrorPage.i");
54 $gridHeaders = array( $MC->msg(
'Topic', HCU_DISPLAY_AS_RAW), $MC->msg(
'Date', HCU_DISPLAY_AS_RAW) );
64 <div
class=
"container-fluid">
65 <h2><?php echo $MC->msg(
'Secure Messages', HCU_DISPLAY_AS_HTML) ?></h2>
66 <div
id=
"hcuTableMessages"></div>
67 <div
id=
"messageWindow" name=
"messageWindow"></div>
68 <div
id=
"alertWindow" name=
"alertWindow"></div>
72 var hcuGridHeaders = <?php echo HCU_JsonEncode($gridHeaders); ?>;
75 $(document).ready(
function(){
78 var dsMessages =
new kendo.data.DataSource({
83 url:
"hcuSecureMail.data?cu=<?php echo $HB_ENV['cu']; ?>",
84 contentType:
"application/x-www-form-urlencoded",
92 url:
"hcuSecureMail.data?cu=<?php echo $HB_ENV['cu']; ?>",
94 contentType:
"application/x-www-form-urlencoded",
96 action:
"read_messages",
104 url:
"hcuSecureMail.data?cu=<?php echo $HB_ENV['cu']; ?>",
105 contentType:
"application/x-www-form-urlencoded",
113 url:
"hcuSecureMail.data?cu=<?php echo $HB_ENV['cu']; ?>",
114 contentType:
"application/x-www-form-urlencoded",
122 requestStart:
function( e ) {
125 requestEnd:
function( e ) {
129 if ( e.response && e.response.homecuErrors )
130 error = e.response.homecuErrors;
132 if ( error && error.length > 0 ) {
135 dsMessages.cancelChanges();
137 $.homecuValidator.displayMessage(error, $.homecuValidator.settings.statusError);
149 error:
function( e ) {
151 this.cancelChanges();
157 threadId: {type:
"number"},
158 newPic: {type:
"string"},
159 subject: {type:
"string"},
160 date: {type:
"string"}
163 parse:
function(response) {
165 if ( response.homecuData ) {
166 for (var i = 0; i < response.homecuData.length; i++) {
167 display.push(response.homecuData[i]);
170 $(
"#hcuTableMessages").data(
"kendoGrid").dataSource.data(display);
174 errors:
"homecuError" 179 var dsThread =
new kendo.data.DataSource({
182 url:
"hcuSecureMail.data?cu=<?php echo $HB_ENV['cu']; ?>",
184 contentType:
"application/json",
186 action:
"read_thread",
194 parse:
function(response) {
196 if ( response.homecuData ) {
197 for (var i = 0; i < response.homecuData.length; i++) {
198 display.push(response.homecuData[i]);
204 requestEnd:
function( e ) {
207 if ( e.response && e.response.error )
208 error = e.response.error;
210 if ( error && error.length > 0 ) {
213 this.cancelChanges();
215 $.homecuValidator.displayMessage(error, $.homecuValidator.settings.statusError);
217 if ( e.response && e.response.homecuData ) {
219 var threadList = e.response.homecuData;
222 for ( var i = 0; i < threadList.length; i++ ) {
224 var builtMessage =
"";
226 if ( threadList[i].origination == 0 ) {
227 className =
"k-info-colored threadCU";
228 orig =
"<?php echo $MC->msg('CU Said', HCU_DISPLAY_AS_JS) ?>";
230 className =
"k-success-colored threadMember";
231 orig =
"<?php echo $MC->msg('User', HCU_DISPLAY_AS_JS) ?>";
234 builtMessage +=
"<div class='k-block k-shadow " + className +
"' style='margin-top:5px;'>";
235 builtMessage +=
"<span style='display:block; float:left; width:50%; text-align:left; font-weight:bold;'>" + orig +
"</span>";
236 builtMessage +=
"<span style='display:block; float:right; width:50%; text-align:right; font-size:x-small;'>" + threadList[i].date +
"</span>";
237 builtMessage +=
"<br />" + threadList[i].message;
238 builtMessage +=
"</div>";
239 $(
"#showThread").append(builtMessage);
243 $(
"#showThread").append(
"<span id='bottomOfScroll' />" );
246 window.setTimeout( scrollThread, 100 );
249 var appInfo = JSON.stringify( { status:
true } );
251 <?php
if ( $HB_ENV[
"platform"] ==
"ADA" ) : ?>
252 AndroidController.notifyCommand(
"READ_MESSAGE", appInfo);
253 <?php elseif ( $HB_ENV[
"platform"] ==
"APP" ) : ?>
260 window.webkit.messageHandlers.interOp.postMessage(postObject);
263 <?php
if ( $HB_ENV[
"platform"] ==
"ADA" ) : ?>
264 AndroidController.notifyCommand(
"READ_MESSAGE", appInfo);
265 <?php elseif ( $HB_ENV[
"platform"] ==
"APP" ) : ?>
272 window.webkit.messageHandlers.interOp.postMessage(postObject);
280 function scrollThread( ) {
281 var show = $(
"#showThread").height();
282 var test = $(
'#showThread').prop(
'scrollHeight');
283 $(
"#showThread").animate({ scrollTop: test }, { duration: 2000 } );
286 $(
'#hcuTableMessages').kendoGrid({
292 toolbar: [{
template: kendo.template($(
"#gridToolbarTemplate").html()) }],
294 { field:
"origination",
297 template:
function( dataItem ) {
299 var columnValue =
"";
301 if ( dataItem.origination ===
"1" ) {
302 columnValue +=
"<span class=\"fa fa-arrow-left directionOut\"></span>";
304 columnValue +=
"<span class=\"fa fa-arrow-right directionIn\"></span>";
311 title:
"<?php echo $MC->msg('Date', HCU_DISPLAY_AS_JS) ?>",
313 template:
function( dataItem ) {
315 var columnValue =
"";
317 if ( dataItem.unread ) {
318 columnValue +=
"<div style='font-weight:bold;'>";
320 columnValue += dataItem.date;
322 if ( dataItem.unread ) {
323 columnValue +=
"</div>";
330 title:
"<?php echo $MC->msg('Topic', HCU_DISPLAY_AS_JS) ?>",
331 template:
function( dataItem ) {
333 var columnValue =
"";
335 if ( dataItem.unread ) {
336 columnValue +=
"<div style='font-weight:bold;'>";
338 columnValue += dataItem.subject;
340 if ( dataItem.unread ) {
341 columnValue +=
"</div>";
349 change:
function(e) {
350 var selectedRow = this.dataItem(this.select());
353 selectedRow.unread = 0;
356 StartMessage( selectedRow.threadId, selectedRow.subject );
358 var grid = $(
"#hcuTableMessages").data(
"kendoGrid");
361 dataBound:
function(e) {
362 $(
"#hcuTableMessages").find(
"tbody tr").each(
function(i) {
363 $(
this).removeClass(
"k-alt");
364 $(
this).css(
"cursor",
"pointer");
374 $(
'#inBox').click(
function() {
375 $(
'#inBox').addClass(
"k-state-focused");
376 $(
"#outBox").removeClass(
"k-state-focused");
377 $(
"#unread").removeClass(
"k-state-focused");
380 $(
"#findText").val(
"");
381 var request = { show: currShow };
382 dsMessages.read( request );
386 $(
'#outBox').click(
function() {
387 $(
'#outBox').addClass(
"k-state-focused");
388 $(
"#inBox").removeClass(
"k-state-focused");
389 $(
"#unread").removeClass(
"k-state-focused");
392 $(
"#findText").val(
"");
393 var request = { show: currShow };
394 dsMessages.read( request );
398 $(
'#findTopic').click(
function() {
399 var request = { what: $(
'#findText').val(), show: currShow };
400 dsMessages.read( request );
404 $(
'#createNew').click(
function() {
405 StartMessage( 0,
"" );
409 $(
"#showFind").on(
"click",
function() {
410 $(
".optionsFind").toggle();
413 var messageTemplate = kendo.template($(
"#messageTemplate").html());
416 var currMessage = kendo.observable({
423 what: $(
'#findText').val(),
425 var grid = $(
"#hcuTableMessages").data(
"kendoGrid");
427 var ds = grid.dataSource;
429 var sort = ds.sort();
433 if ( sort[0].field ===
"date" ) {
439 if ( sort[0].dir ===
"desc" )
440 sortVal = sortVal.toUpperCase();
445 messageSend:
function(e) {
448 if ( $.homecuValidator.validate() ) {
449 request = { action:
"send_message", parentid: this.threadId, subject: this.subject,
450 message: this.message, show: this.show, what: this.what, order: this.order };
452 dsMessages.transport.read.type =
"POST";
453 dsMessages.read( request );
456 closeThis:
function(e) {
459 confirmDelete:
function(e) {
460 StartDelete( this.threadId );
464 var deleteConfirm = kendo.observable({
468 what: $(
'#findText').val(),
470 var grid = $(
"#hcuTableMessages").data(
"kendoGrid");
472 var ds = grid.dataSource;
474 var sort = ds.sort();
478 if ( sort[0].field ===
"date" ) {
484 if ( sort[0].dir ===
"desc" )
485 sortVal = sortVal.toUpperCase();
490 deleteConfirm:
function(e) {
493 request = { action:
"delete_message", parentid: this.threadId,
494 show: this.show, what: this.what, order: this.order };
496 dsMessages.transport.type =
"POST";
497 dsMessages.read( request );
503 function StartMessage( threadId, subject ) {
505 if ( threadId > 0 ) {
506 messageType =
"read";
509 var re =
"<?php echo $MC->msg('Re', HCU_DISPLAY_AS_JS) ?>";
510 var test = subject.substr( 0, re.length );
512 subject = re +
": " + subject;
518 currMessage.threadId = threadId;
519 currMessage.subject = subject;
520 currMessage.message =
"";
522 wnd = $(
'#messageWindow').kendoWindow({
538 activate:
function(e) {
540 kendo.bind($(
"#messageDisplay"), currMessage);
543 $.homecuValidator.setup({formValidate:
"formSubmitMsg", validateOnClick:
"sendMsg",
544 formErrorTitle:
"<?php echo $MC->msg("Error Occurred
", HCU_DISPLAY_AS_JS) ?>",
545 formStatusField:
"secureMsgErrors"});
548 if ( currMessage.threadId > 0 ) {
550 var request = { action:
"read_thread", parentid: currMessage.threadId };
551 dsThread.read( request );
556 var latestWindow = $(
"#messageWindow").data(
"kendoWindow");
557 openWindow.push( latestWindow );
563 }).data(
'kendoWindow');
567 if ( threadId === 0 )
568 title =
"<?php echo $MC->msg("Create New Message
", HCU_DISPLAY_AS_JS) ?>";
570 title =
"<?php echo $MC->msg("User Messages
", HCU_DISPLAY_AS_JS) ?>";
572 wnd.content( messageTemplate( { messageType: messageType } ) );
574 wnd.setOptions({title: title});
576 wnd.center().open().toFront();
580 function onResize(e) {
581 var height = $(
'#messageWindow').height();
585 function StartDelete( threadId ) {
586 deleteConfirm.threadId = threadId;
588 var wndDelete= $(
"#alertWindow").data(
"kendoDialog");
589 if (wndDelete ==
null)
591 wndDelete = $(
'#alertWindow').kendoDialog({
594 title:
"<?php echo $MC->msg('Confirmation', HCU_DISPLAY_AS_JS) ?>",
595 content:
"<p><?php echo $MC->msg('Delete All Messages', HCU_DISPLAY_AS_JS) ?></p><p><?php echo $MC->msg("ACH Continue
", HCU_DISPLAY_AS_JS) ?></p>",
598 var latestWindow = $(
"#alertWindow").data(
"kendoDialog");
599 openWindow.push( latestWindow );
606 {text:
"<?php echo $MC->msg("Yes
", HCU_DISPLAY_AS_JS); ?>", primary:
true, action:
function() { deleteConfirm.deleteConfirm(); }},
607 {text:
"<?php echo $MC->msg("No
", HCU_DISPLAY_AS_JS); ?>"}
609 }).data(
'kendoDialog');
614 $(document).on(
"click",
".k-overlay",
function () {
616 if ( openWindow.length > 0 ) {
617 openWindow[openWindow.length-1].close();
622 if ($(window).width() > 767) {
623 $(
".optionsFind").show();
624 $(
".optionsAdd #showFind").hide();
626 $(
".optionsFind").hide();
627 $(
".optionsAdd #showFind").show();
631 var windowLastSize = $(window).width();
632 $(window).resize(
function(e) {
633 var windowSize = $(window).width();
634 if (windowSize > 767) {
635 $(
".optionsFind").show();
636 $(
".optionsAdd #showFind").hide();
638 if ($(
".optionsFind").is(
":visible")) {
639 if (windowLastSize >= 768) {
640 $(
".optionsFind").hide();
642 $(
".optionsFind").show();
645 $(
".optionsAdd #showFind").show();
647 windowLastSize = windowSize;
650 var height = screen.height - 200;
651 $(
"#hcuTableMessages .k-grid-content").css({maxHeight: height});
657 <style type=
"text/css">
683 display:
inline-block;
694 <script type=
"text/x-kendo-template" id=
"gridToolbarTemplate">
695 <div
class=
"optionsAdd">
696 <a
class=
"k-button" href=
"\#" id=
"createNew">
697 <span
class=
"fa fa-plus btn-icon-custom btn-icon-custom"></span>
698 <span> <?php echo $MC->msg(
'Add Message', HCU_DISPLAY_AS_JS) ?></span>
701 <a
class=
"optionsShowFind k-button" href=
"\#" id=
"showFind">
702 <span
class=
"fa fa-search btn-icon-custom"></span>
705 <div
class=
"optionsFind">
706 <span><?php echo $MC->msg(
'Find', HCU_DISPLAY_AS_JS) .
" " . $MC->msg(
'Topic', HCU_DISPLAY_AS_JS) ?>:</span><br>
707 <input type=
"text" id=
"findText" class=
"k-textbox" value=
"" />
708 <a
class=
"k-button" href=
"\#" id=
"findTopic">
709 <span
class=
"fa fa-search btn-icon-custom"></span>
710 <span><?php echo $MC->msg(
'Find', HCU_DISPLAY_AS_JS) .
" " . $MC->msg(
'Topic', HCU_DISPLAY_AS_JS) ?></span>
713 <!--<div
id=
"options">
716 <div
class=
"k-block" style=
"border:0;">
718 <a
class=
"k-button" href=
"\#" id=
"createNew"><span
class=
"fa fa-plus btn-icon-custom btn-icon-custom"></span> <?php echo $MC->msg(
'Add Message', HCU_DISPLAY_AS_JS) ?></a>
721 <li
class=
"small-find">
722 <div
class=
"k-block" style=
"border:0;">
724 <a
class=
"k-button" href=
"\#" id=
"showFind"><span
class=
"fa fa-search btn-icon-custom"></span></a>
727 <li
class=
"big-find">
728 <div
class=
"k-block">
729 <?php echo $MC->msg(
'Find', HCU_DISPLAY_AS_JS) .
" " . $MC->msg(
'Topic', HCU_DISPLAY_AS_JS) ?>:<br />
730 <input type=
"text" id=
"findText" class=
"k-textbox" value=
"" />
731 <a
class=
"k-button" href=
"\#" id=
"findTopic"><span
class=
"fa fa-search btn-icon-custom"></span> <?php echo $MC->msg(
'Find', HCU_DISPLAY_AS_JS) .
" " . $MC->msg(
'Topic', HCU_DISPLAY_AS_JS) ?></a>
736 <span
id=
"displayStatus"></span>
738 <script type=
"text/x-kendo-template" id=
"messageTemplate">
739 <div
class=
"container-fluid hcu-template">
740 <div
id=
"messageDisplay">
741 <div
id=
"secureMsgErrors" class=
"homecu-formStatus k-block k-error-colored" style=
"display: none;"></div>
742 <div
class=
"row" style=
"height:100%">
743 <div
class=
"col-xs-12 nopadding" style=
"height:100%;">
744 <div
id=
"panes" style=
"height:100%; border:0;">
746 # if ( messageType === "read" ) { # 747 <div
id=
"showThread" />
749 <div style=
"text-align:center;"><?php echo $MC->msg(
"Create New Message", HCU_DISPLAY_AS_JS); ?></div>
752 <div
id=
"middlePane" class=
"well well-sm">
753 <form
id=
"formSubmitMsg" style=
"width:100%">
754 <div
class=
"row" style=
"width:100%;">
755 <label
for=
"msgTopic" class=
"control-label col-xs-12 col-sm-2 nopadding"><?php echo $MC->msg(
'Topic', HCU_DISPLAY_AS_JS); ?></label>
756 <div
class=
"col-xs-12 col-sm-10 nopadding">
757 <input type=
"text" id=
"msgTopic" name=
"msgTopic" class=
"k-textbox" #
if ( messageType ==
"read" ) {#readonly#}# data-bind=
"value: subject" style=
"width:100%;" placeholder=
"<?php echo $MC->msg("Topic
", HCU_DISPLAY_AS_JS) ?>" required data-required-msg=
"<?php echo $MC->msg('Message subject cannot be blank', HCU_DISPLAY_AS_JS) ?>" />
758 <span
class=
"k-invalid-msg" data-
for=
"msgTopic"></span>
761 <div
class=
"row" style=
"width:100%;">
762 <label
for=
"msgMessage" class=
"control-label col-xs-12 col-sm-2 nopadding"><?php echo $MC->msg(
'Message', HCU_DISPLAY_AS_JS) ?></label>
763 <div
class=
"col-xs-12 col-sm-10 nopadding">
764 <textarea
class=
"k-textbox" id=
'msgMessage' name=
"msgMessage" rows=
'9' cols=
'75' wrap=
'physical' 765 style=
'width:100%; height:100%; padding:3px;' 766 placeholder=
"<?php echo $MC->msg('Message', HCU_DISPLAY_AS_JS) ?>" 767 data-bind=
"value: message" 768 required data-required-msg=
"<?php echo $MC->msg('Message body cannot be blank', HCU_DISPLAY_AS_JS) ?>" ></textarea>
769 <span
class=
"k-invalid-msg" data-
for=
"msgMessage"></span>
775 <?php $send= $MC->msg(
"Send", HCU_DISPLAY_AS_JS); $cancel= $MC->msg(
"Cancel", HCU_DISPLAY_AS_JS); ?>
777 <div
id=
"bottomPane">
778 <div
class=
"hcu-edit-buttons k-state-default row">
779 # if (messageType == "read") { # 780 <span
class=
"hcu-icon-delete">
781 <a
class=
"deleteBtn" data-bind=
"events:{ click: confirmDelete }"><i
class=
"fa fa-trash-o fa-lg"></i></a>
784 <a
class=
"cancelBtn" data-bind=
"events:{ click: closeThis }"><?php echo $cancel; ?></a>
786 <a
id=
"sendMsg" class=
"sendBtn k-button k-primary" data-bind=
"events:{ click: messageSend }"><i
class=
"fa fa-check"></i><?php echo $send; ?></a>
803 require_once(dirname(__FILE__) .
'/../includes/hcuPostContent.i');