10 $serviceShowInfo =
true;
11 $serviceLoadMenu =
true;
12 $serviceShowMenu =
true;
15 require_once(dirname(__FILE__) .
'/../library/hcuService.i');
21 PermCheckFeatureScreen($dbh, $HB_ENV, $MC, FEATURE_BASIC);
26 $EMAIL_FLAG = GetMsgTxValue(
'MSGTX_FORCE_EM');
29 require_once(dirname(__FILE__) .
'/../includes/hcuPreContent.i');
35 $emailRequired = ($HB_ENV[
'Fmsg_tx'] & $EMAIL_FLAG);
40 $sql =
"SELECT email, egenl_flag FROM {$HB_ENV['Cu']}user WHERE user_name='{$HB_ENV['Cn']}'";
41 $profileRS = db_query( $sql, $dbh );
42 if ( $profileRow = db_fetch_array( $profileRS, 0 ) ) {
43 $defaultEmail = trim( $profileRow[
'email'] );
44 $defaultEgenl = trim( $profileRow[
'egenl_flag'] );
46 db_free_result($profileRS);
49 $alertInfo = Get_AlertsDetailed( $dbh, $HB_ENV[
"Cu"], $HB_ENV[
"Uid"], $HB_ENV[
"Fset3"]);
50 $alertData = $alertInfo[
'data'];
52 $hasAlertEmail = count( $alertData ) > 0;
55 <script type=
"text/javascript">
56 $(document).ready(
function() {
57 var dsProfileEmail =
new kendo.data.DataSource({
65 url:
"hcuProfile.data?cu=<?php echo $HB_ENV["Cu
"] ?>",
67 contentType:
"application/json",
70 action:
"thisshouldgetoverwritten" 76 parse:
function(response) {
82 requestStart:
function(e) {
85 requestEnd:
function(e) {
92 if ( e.response && e.response.homecuErrors )
93 error = e.response.homecuErrors;
95 if ( error && error.length > 0 ) {
100 $.homecuValidator.displayMessage(error, $.homecuValidator.settings.statusError);
102 if ( e.response && e.response.homecuInfo && (e.response.homecuInfo.message.length > 0) ) {
103 ShowStatus( e.response.homecuInfo.message );
107 if ( e.response.homecuData &&
108 e.response.homecuData.homecuKey &&
109 (e.response.homecuData.homecuKey.length > 0) ) {
110 var appInfo = JSON.stringify( { deviceKey: e.response.homecuData.homecuKey } );
112 <?php
if ( $HB_ENV[
"platform"] ==
"ADA" ) : ?>
113 AndroidController.notifyCommand(
"NEW_DEVICE_KEY", appInfo);
114 <?php elseif ( $HB_ENV[
"platform"] ==
"APP" ) : ?>
117 cmd:
"NEW_DEVICE_KEY",
121 window.webkit.messageHandlers.interOp.postMessage(postObject);
125 var grid = $(
"#gridAlertEmails").data(
"kendoGrid");
129 grid_ds = grid.dataSource;
136 if ( $HB_ENV[
"platform"] ==
"APP" || $HB_ENV[
"platform"] ==
"ADA" ) {
137 $paramsForApps = array(
"script" =>
"ProfileEmail" );
138 $paramsJSON = HCU_JsonEncode($paramsForApps);
140 var appInfo =
'<?php echo $paramsJSON; ?>';
142 <?php
if ( $HB_ENV[
"platform"] ==
"ADA" ) : ?>
143 AndroidController.notifyCommand(
"PROFILE_UPDATE", appInfo);
144 <?php elseif ( $HB_ENV[
"platform"] ==
"APP" ) : ?>
147 cmd:
"PROFILE_UPDATE",
151 window.webkit.messageHandlers.interOp.postMessage(postObject);
165 function ShowStatus( statusMessage ) {
166 $.homecuValidator.settings.formStatusField =
"formStatus";
167 $.homecuValidator.settings.formInfoTitle =
"";
168 $.homecuValidator.displayMessage(statusMessage);
171 function ClearStatus( ) {
172 $.homecuValidator.settings.formStatusField =
"formStatus";
173 $.homecuValidator.settings.formInfoTitle =
"";
174 $.homecuValidator.displayMessage(
null);
177 $(
"#btnUpdate").click(
function() {
178 if ($.homecuValidator.validate()) {
179 var alertEmails =
"";
182 var grid = $(
"#gridAlertEmails").data(
"kendoGrid");
184 var grid_ds = grid.dataSource;
185 var grid_nr = grid_ds.total();
189 for(var i = 0; i < grid_nr; i++) {
192 var row = grid_ds.at(i);
193 if($(
"#email"+row.id).prop(
'checked')) {
195 if(alertEmails.length > 0) {
196 alertEmails = alertEmails +
"|";
198 alertEmails = alertEmails + row[
"email"];
205 action:
"email_save",
206 email: $(
"#emailAddress").val(),
207 emailValid: ($(
"#profileEmailValid").prop(
"checked") ?
"Y" :
"N"),
208 egenl: ($(
"#profileEgenl").prop(
"checked") ?
"Y" :
"N"),
209 alertEmails: alertEmails
214 dsProfileEmail.transport.type =
"POST";
215 dsProfileEmail.read( request );
222 var mobile_column_data =
"";
223 mobile_column_data +=
"<div class=\"account_cell_desc\"><strong><?php echo $MC->msg("Alert Type
", HCU_DISPLAY_AS_JS); ?>:</strong></div> <div class=\"account_cell_value\">#= type #</div>";
225 mobile_column_data +=
"<div class=\"account_cell_desc\"><strong><?php echo $MC->msg("Alert Email Address
", HCU_DISPLAY_AS_JS); ?>:</strong></div> <div class=\"account_cell_value\">#= email #</div>";
227 $(
'#gridAlertEmails').kendoGrid({
231 url:
"hcuProfile.data?cu=<?php echo $HB_ENV["Cu
"] ?>",
233 contentType:
"application/json",
236 action:
"read_alert_emails" 241 requestStart:
function() {
244 requestEnd:
function() {
248 parse:
function(data) {
249 return data.homecuData;
264 title:
"<?php echo $MC->msg("Alert Type
", HCU_DISPLAY_AS_JS); ?>",
270 title:
"<?php echo $MC->msg("Alert Email Address
", HCU_DISPLAY_AS_JS); ?>",
275 title:
"<?php echo $MC->msg("Alerts
", HCU_DISPLAY_AS_JS); ?>",
276 template: mobile_column_data
280 title:
"<?php echo $MC->msg("Update
", HCU_DISPLAY_AS_JS); ?>",
282 template:
"<input type='checkbox' id='email#=id#' #= choice === 'Y' ? 'checked=checked' : '' #></input>",
286 change:
function(e) {
289 var selectedRow = this.dataItem(this.select());
290 var rowChecked = $(
"#email"+selectedRow[
"id"]).prop(
"checked");
292 $(
"#email"+selectedRow[
"id"]).prop(
"checked", !rowChecked);
298 dataBound:
function () {
299 $(
"table tbody tr").hover(
301 $(
this).toggleClass(
"k-state-hover");
310 $.homecuValidator.setup({formValidate:
"formProfile",
311 formErrorTitle:
"<?php echo $MC->msg("Error Occurred
", HCU_DISPLAY_AS_JS) ?>"});
322 $(
"#emailConfirmSection").hide();
323 $(
"#emailAddress").change(
function(){
324 $(
"#profileEmailValid").prop(
"checked",
true);
325 $(
"#profileEmailValid").prop(
"disabled",
true);
326 $(
"#emailConfirmSection").show();
327 $(
"#emailAddressConfirm").attr(
"required",
"required");
328 $(
"#emailAddressConfirm").attr(
"homecu-match",
"email");
329 $(
"#emailAddressConfirm").attr(
"homecu-equals",
"email_match");
335 var width = $(window).width();
336 var grid = $(
"#gridAlertEmails").data(
"kendoGrid");
340 if ($(window).width() >= 768) {
347 $(window).resize(
function() {
348 width = $(window).width();
362 <style type=
"text/css">
363 .hcuProfileEmailDiv {
370 .container-fluid-margin {
374 .k-block > .k-header {
379 .hcu-info-margin, .hcu-error-margin {
383 .hcu-info-padding, .hcu-error-padding {
391 .hcu-container-margin {
398 .hcu-cursor-pointer {
409 .account_cell_value {
416 @media only screen and (max-width: 500px) {
422 .account_cell_value {
429 <!-- HTML CONTENT -->
430 <div
class=
"container-fluid hcuProfileEmailDiv">
431 <div
class=
"well well-sm">
435 <h3><?php echo $MC->msg(
'Change Email Settings', HCU_DISPLAY_AS_HTML); ?></h3>
438 <!-- FORM ELEMENTS -->
439 <form
id=
"formProfile" name=
"formProfile">
441 <div
class=
"col-xs-12 col-sm-6 hcu-container-margin">
443 <label
for=
"emailAddress" class=
"hcu-full-width">
444 <?php echo $MC->msg(
"Email Address", HCU_DISPLAY_AS_HTML); ?>:
447 <input type=
"email" name=
"emailAddress" 449 class=
"k-textbox hcu-full-width email_match" 450 value=
"<?php echo $defaultEmail ?>" 451 placeholder=
"<?php echo $MC->msg('Email Address', HCU_DISPLAY_AS_HTML); ?>" 453 data-email-msg=
"<?php echo $MC->msg('Email appears invalid', HCU_DISPLAY_AS_HTML) ?>" 454 data-homecuCustomMatch-msg=
"<?php echo $MC->msg('Email appears invalid', HCU_DISPLAY_AS_HTML) ?>" 455 data-required-msg=
"<?php echo $MC->msg('EMail Missing', HCU_DISPLAY_AS_HTML) ?>" 460 <div
class=
"col-xs-12 col-sm-6 hcu-container-margin" id=
"emailConfirmSection">
462 <label
for=
"emailAddressConfirm" class=
"hcu-full-width">
463 <?php echo $MC->msg(
"Confirm Email Address", HCU_DISPLAY_AS_HTML); ?>:
466 <input type=
"email" name=
"emailAddressConfirm" 467 id=
"emailAddressConfirm" 468 class=
"k-textbox hcu-full-width email_match" 469 placeholder=
"<?php echo $MC->msg('Confirm Email Address', HCU_DISPLAY_AS_HTML); ?>" 470 data-email-msg=
"<?php echo $MC->msg('Email appears invalid', HCU_DISPLAY_AS_HTML) ?>" 471 data-homecuCustomMatch-msg=
"<?php echo $MC->msg('Email appears invalid', HCU_DISPLAY_AS_HTML) ?>" 472 data-homecuCustomEquals-msg=
"<?php echo $MC->msg('Email Confirm Mismatch', HCU_DISPLAY_AS_HTML); ?>" 473 data-required-msg=
"<?php echo $MC->msg('Please confirm email', HCU_DISPLAY_AS_HTML) ?>">
478 <?php
if ($emailRequired): ?>
479 <div
class=
"col-xs-12 hcu-container-margin checkbox">
481 <label
for=
"profileEmailValid" id=
"profileEmailValidTxt" class=
"hcu-cursor-pointer">
482 <input type=
"checkbox" name=
"profileEmailValid" 483 id=
"profileEmailValid" 485 data-required-msg=
"<?php echo $MC->msg("Please confirm email
", HCU_DISPLAY_AS_HTML); ?>" 487 <?php echo $MC->msg(
'Bad Email Flag 2', HCU_DISPLAY_AS_HTML); ?>
493 <div
class=
"col-xs-12 hcu-container-margin checkbox">
495 <label
for=
"profileEgenl" id=
"profileEgenlTxt" class=
"hcu-cursor-pointer">
496 <input type=
"checkbox" name=
"profileEgenl" 499 <?php echo ($defaultEgenl ==
"N" ?
"" :
"checked") ?>>
500 <?php echo $MC->msg(
'Yes Email List', HCU_DISPLAY_AS_HTML); ?>
506 <?php
if ($hasAlertEmail): ?>
507 <fieldset
id=
"updateAlertEmails">
508 <div
class=
"col-xs-12 hcu-container-margin">
510 <i><?php echo $MC->msg(
"Alert email message.", HCU_DISPLAY_AS_HTML ); ?></i>
512 <div
id=
"gridAlertEmails"></div>
520 <div
class=
"hcu-template">
521 <div
class=
"hcu-edit-buttons k-state-default">
523 <a href=
"##" id=
"btnUpdate" class=
"k-button k-primary">
524 <i
class=
"fa fa-check fa-lg"></i><?php echo $MC->msg(
"Update", HCU_DISPLAY_AS_HTML); ?>
535 require_once(dirname(__FILE__) .
'/../includes/hcuPostContent.i');