Odyssey
cu_notify.prg
1 <?php
2 /**
3  * Manages the emails that the CU uses for particular functions.
4  */
5 require_once("$sharedLibrary/sFeatureMnu.i");
6 require_once(dirname(__FILE__) . "/cu_notify.data");
7 
8 $main = $menu_link;
9 $self = "$menu_link?ft=$ft";
10 
11 $parameters = array("a" => array("role" => "", "email" => ""));
12 $string = array("filter" => FILTER_SANITIZE_STRING);
13 $array = array("filter" => FILTER_DEFAULT);
14 HCU_ImportVars($parameters, "a", array("role" => $string, "email" => $string, "emailList" => $array));
15 extract($parameters["a"]); // dms_import doesn't work anymore because this isn't in global scope anymore.
16 
17 if ($operation != "") {
18  switch($operation) {
19  case "readEmailNotify":
20  $returnArray = ReadEmailNotify($dbh, $Cu);
21  break;
22  case "updateEmailNotify":
23  $returnArray = UpdateEmailNotify($dbh, $Cu, $Cn, $role, $email, false);
24  break;
25  case "readVerifiedEmailList":
26  $returnArray = ReadVerifiedEmailList($dbh, $Cu);
27  break;
28  case "updateVerifiedEmailList":
29  $returnArray = UpdateVerifiedEmailList($dbh, $Cu, $emailList);
30  break;
31  case "resendEmail":
32  $returnArray = ResendEmail($dbh, $Cu, $email);
33  break;
34  default: $returnArray = array("sql" => array(), "error" => array("Operation not recognized: $operation."), "record" => array());
35  break;
36  }
37 
38  header('Content-type: application/json');
39  print HCU_JsonEncode($returnArray);
40 } else {
41  PrintNotifyPage($self);
42 }
43 
44 /**
45  * function printPage($self)
46  * Prints the page. Slightly different: edits incell rather than a popup like usual. This works better for this grid.
47  *
48  * @param string $self The URL of the page
49  */
50 function PrintNotifyPage($self) { ?>
51  <style>
52  .removeTD, .resendTD {
53  cursor: pointer;
54  }
55 
56  .statusRow {
57  padding-left: 0;
58  }
59 
60  .statusRow .col-xs-1 {
61  padding-left: 5px;
62  }
63 
64  .statusRow .col-xs-11 {
65  padding-left: 0;
66  }
67 
68  [name='emailInput'] {
69  text-indent: 5px !important;
70  }
71 
72  #gridContainer {
73  max-width: 1000px;
74  }
75  </style>
76  <script type="text/javascript">
77 
78  <?php
79  // Library javascript functions
80  getShowWaitFunctions();
81  ?>
82 
83  var activeWindows = [];
84  var usedEmailList = {};
85  var mainGridChanged = false;
86  var previousVerifiedEmailData = null;
87  var noSESRole = false;
88  var ddlCounter = 0;
89  var multiCounter = 0;
90  var mainInitialized = false;
91  var emailDDLDataSource = null;
92  var emailNotifyDataSource = null;
93  var fromEmailDDLs = [];
94 
95  <?php
96  /**
97  * function InitEmailNotify()
98  * This function initializes all controls dealing with the main grid.
99  */
100  ?>
101  function InitEmailNotify() {
102  $.homecuValidator.setup({formValidate:'mainForm', formStatusField: 'formValidateMainDiv',
103  homecuCustomRules: {
104  customEmail: function(input) {
105  if (!$(input).is(".emailMultiCheck")) {
106  return true;
107  }
108  var value = $(input).val().trim();
109  if (value == "") {
110  if ($(input).data("hademail").trim() == "Y") {
111  $(input).attr("data-customEmail-msg", "Cannot clear email.");
112  return false;
113  } else {
114  return true;
115  }
116  }
117  var emails = value.split(/[;\s,]/);
118  var numEmails = 0; <?php // If the semicolon is at the end of the email string then no effect. ?>
119  for(var i = 0; i != emails.length; i++) {
120  var email = emails[i].trim();
121  if (email != "") {
122  if (!/^[A-Za-z0-9._-]*@[A-Za-z0-9._-]*\.[A-Za-z0-9_-]*$/.test(emails[i].trim())) {
123  $(input).attr("data-customEmail-msg", "One of the emails is not valid.");
124  return false;
125  }
126  numEmails++;
127  }
128  }
129 
130  if (numEmails == 0) {
131  $(input).attr("data-customEmail-msg", "Email is required.");
132  return false;
133  }
134 
135  return true;
136  }
137  }
138  });
139 
140  emailDDLDataSource = new kendo.data.DataSource({
141  data: []
142  });
143 
144  emailNotifyDataSource = new kendo.data.DataSource({
145  batch: true,
146  transport: {
147  read: {
148  url: "<?php echo $self; ?>&operation=readEmailNotify",
149  dataType: "json",
150  type: "POST"
151  },
152  <?php // Shouldn't be called. As far as kendo is concerned, all these notifications are updates but they really aren't.
153  // I determine at the data level whether it is an insert or update. ?>
154  create: {
155  url: "<?php echo $self; ?>&operation=updateEmailNotify",
156  dataType: "json",
157  type: "POST"
158  },
159  update: {
160  url: "<?php echo $self; ?>&operation=updateEmailNotify",
161  dataType: "json",
162  type: "POST"
163  },
164  parameterMap: function(data, type) {
165  showWaitWindow();
166  if (type == "read") {
167  return {};
168  } else if (type == "update") {
169  var record = data.models[0];
170  return {role: record.roleId, email: record.email};
171  }
172  }
173  },
174  schema: {
175  parse: function(results) {
176  hideWaitWindow();
177  if (results.status != "000") {
178  $.homecuValidator.displayMessage(results.error, $.homecuValidator.settings.statusError );
179  return false;
180  } else if (results.info != "") {
181  $.homecuValidator.displayMessage(results.info, $.homecuValidator.settings.statusInfo );
182  }
183 
184  if (results.action == "update") {
185  mainGridChanged = true;
186 
187  var updateInput = $(".roleTextLabel:contains("
188  + results.record[0].roleText.split("<br>")[0] + ")").closest(".mockTr").find("[name^='emailMulti_']");
189  $(updateInput).val(results.record[0].email);
190 
191  <?php // Reset deletable flag based on changes here. ?>
192  var distinctFromEmails = {};
193  var fromEmailData = emailNotifyDataSource.data();
194  for(var i = 0, length = fromEmailData.length; i != length; i++) {
195  var record = fromEmailData[i];
196 
197  if (record.single && $("[data-index='" + i + "'].unknownEmail").length == 0) {
198  distinctFromEmails[record.email.trim()] = true;
199  }
200  }
201 
202  <?php // Apply flag to manage email grid. ?>
203  var manageEmailGrid = $("#manageEmailGrid").data("kendoGrid");
204  var manageEmailData = manageEmailGrid.dataSource.data();
205  for(var i = 0, length = manageEmailData.length; i != length; i++) {
206  var record = manageEmailData[i];
207  manageEmailData[i].used = distinctFromEmails[record.email.trim()] === true;
208  }
209  manageEmailGrid.dataSource.data(manageEmailData);
210 
211  return results.record;
212  } else if (results.action == "read") {
213 
214  var template = kendo.template($("#gridTemplate").html());
215  $("#mainForm").append(template({gridData: results.data.gridData}));
216 
217  emailDDLDataSource.data(results.data.approvedEmails);
218 
219  $("[id^='emailDDL_']").each(function() { <?php // Destroy all custom DDLs that are created on the grid. ?>
220  var ddlDiv = this;
221  var email = $(ddlDiv).closest(".mockTr").data("email");
222  var ddl = $(ddlDiv).kendoDropDownList({
223  dataSource: emailDDLDataSource,
224  value: email,
225  dataTextField: "email",
226  dataValueField: "email",
227  optionLabel: "Select an email...",
228  select: function(e) {
229 
230  if (e.dataItem.email.trim() == "") {
231  $.homecuValidator.displayMessage("Email cannot be cleared.", $.homecuValidator.settings.statusError );
232  e.preventDefault();
233  } else {
234  $(ddlDiv).closest(".mockTr").removeClass("unknownEmail");
235  var tr = $(this.wrapper).closest(".mockTr");
236  var index = $(tr).data("index");
237  emailNotifyDataSource.at(index).set("email", e.dataItem.email);
238  emailNotifyDataSource.sync();
239  }
240  }
241  }).data("kendoDropDownList");
242 
243  if (email != "" && ddl.value() == "") {
244  $(ddlDiv).closest(".mockTr").addClass("unknownEmail");
245  }
246 
247  fromEmailDDLs.push(ddl);
248  });
249 
250  return results.data.gridData;
251  mainGridChanged = true;
252  }
253  },
254  model: {
255  id: "roleId",
256  fields: {
257  roleId: {type: "string"},
258  roleText: {type: "string"},
259  email: {type: "string"},
260  required: {type: "boolean"},
261  single: {type: "boolean"}
262  }
263  }
264  }
265  });
266 
267  emailNotifyDataSource.read();
268 
269  $("#mainForm").on("change", "[name^='emailMulti_']", function() {
270 
271  $(this).addClass("emailMultiCheck");
272 
273  var passed = $.homecuValidator.validate();
274 
275  if (passed) {
276  $(this).removeClass("emailMultiCheck");
277  var value = $(this).val().trim();
278  var tr = $(this).closest(".mockTr");
279  var index = $(tr).data("index");
280  emailNotifyDataSource.at(index).set("email", value);
281  emailNotifyDataSource.sync();
282  }
283  });
284  }
285 
286  <?php
287  /**
288  * function InitEmailVerify()
289  * Initializes all the controls associated with the popup.
290  */
291  ?>
292  function InitEmailVerify() {
293  var emailListBtn = $("#emailListBtn").kendoButton({
294  enable: false,
295  click: function(e) {
296  emailVerifyWindow.center().open();
297  }
298  }).data("kendoButton");
299 
300  var emailResendDataSource = new kendo.data.DataSource({
301  transport: {
302  read: {
303  url: "<?php echo $self; ?>&operation=resendEmail",
304  dataType: "json",
305  type: "POST"
306  },
307  parameterMap: function(data, type) {
308  showWaitWindow();
309  return data;
310  }
311  },
312  schema: {
313  parse: function(data) {
314  hideWaitWindow();
315  if (data.status !== "000") {
316  $.homecuValidator.displayMessage(data.error, $.homecuValidator.settings.statusError );
317  } else {
318  if (data.info != "") {
319  $.homecuValidator.displayMessage(data.info, $.homecuValidator.settings.statusInfo );
320  }
321 
322  <?php // Update grid so that status is pending and there is no resend button anymore. ?>
323  var email = data.email;
324  var grid = $("#manageEmailGrid").data("kendoGrid");
325  var gridData = grid.dataSource.data();
326 
327  for (var i = 0; i != gridData.length; i++) {
328  var record = gridData[i];
329  var recordEmail = record.email.trim();
330  if (recordEmail == email) {
331  gridData[i].status = "Pending";
332  gridData[i].resend = false;
333  break;
334  }
335  }
336 
337  grid.dataSource.data(gridData);
338  }
339 
340  return []; <?php // Save nothing in the datasource. ?>
341  }
342  }
343  });
344 
345  var emailVerifyValidator = {formValidate:'emailVerifyWindowForm', formStatusField: 'formValidatePopupDiv', homecuCustomRules: {
346  emailInput: function(input) {
347  if (!$(input).is("[name='emailInput']")) {
348  return true;
349  }
350  var value = $(input).val().trim();
351 
352  if (value == "") {
353  if ($.homecuValidator.isRequired) {
354  $(input).attr("data-emailInput-msg", "Email is required.");
355  return false;
356  }
357  } else {
358  if (value.toLowerCase() == "<?php echo GetTemporaryEmail(); ?>") {
359  $(input).attr("data-emailInput-msg", "Cannot add temporary email.");
360  return false;
361  }
362  if (!/^[A-Za-z0-9._-]*@[A-Za-z0-9._-]*\.[A-Za-z0-9_-]*$/.test(value)) {
363  $(input).attr("data-emailInput-msg", "Email is not valid.");
364  return false;
365  }
366 
367  var emailRegExp = new RegExp ("\\b" + value + "\\b", "i");
368  if ($("#manageEmailGrid").text().match(emailRegExp) != null) {
369  $(input).attr("data-emailInput-msg", "Email is a duplicate.");
370  return false;
371  }
372  }
373 
374  return true;
375  }
376  }};
377  var emailVerifyWindow = $("<div id='emailVerifyWindow'></div>").appendTo("body").kendoWindow({
378  modal: true,
379  title: "Manage Email List",
380  visible: false,
381  maxWidth: 600,
382  content: {
383  template: $("#emailVerifyWindowTemplate").html()
384  },
385  open: function() {
386  $("#emailVerifyWindow").data("resolved", false);
387  if ($("#emailVerifyWindow").data("first")) {
388  $("#emailVerifyWindow").data("first", false);
389  }
390 
391  $("#emailVerifyWindow").data("isUpdate", false);
392 
393  if (window.activeWindows != null) {
394  window.activeWindows.push(this);
395  }
396  $.homecuValidator.setup(emailVerifyValidator);
397  $.homecuValidator.validate(); <?php // Clear the red around the input. ?>
398  },
399  close: function(e) {
400  var resolved = $("#emailVerifyWindow").data("resolved");
401 
402  if (!resolved) {
403  var manageEmailGrid = $("#manageEmailGrid").data("kendoGrid");
404  var isUpdate = $("#emailVerifyWindow").data("isUpdate");
405  var hasChanges = $("#emailVerifyWindow").data("hasChanges");
406  var isNew = $("#emailVerifyWindow").data("isNew");
407  if (isNew) {
408  $("#emailVerifyWindow .prepopulatedMsg").show();
409  } else {
410  $("#emailVerifyWindow .prepopulatedMsg").hide();
411  }
412  if ((!hasChanges && !isNew) || (isNew && manageEmailGrid.dataSource.data().length == 0)) {
413  <?php // Close then. "Cancel" and "update" are the same at this instance. ?>
414  $("[name='emailInput']").val(null);
415  if (window.activeWindows != null) {
416  window.activeWindows.pop();
417  }
418  $.homecuValidator.setup({formValidate:'mainForm', formStatusField: 'formValidateMainDiv'});
419  } else {
420  if (isUpdate) {
421  manageEmailGrid.dataSource.read({operation: "updateVerifiedEmailList"}); <?php // Trigger update ?>
422  e.preventDefault(); <?php // Prevent it from closing until it can be verified that the grid updated. ?>
423  } else {
424  e.preventDefault();
425  $("[name='emailInput']").val(null);
426  var discardChangesDialog = $("#discardChangesDialog").data("kendoDialog");
427  if (discardChangesDialog == null) {
428  discardChangesDialog = $("<div id='discardChangesDialog'></div>").appendTo("body").kendoDialog({
429  title: "Discard Changes",
430  content: "<p>Changes have been made to the CU email list.</p><p>Do you wish to discard your changes?</p>",
431  actions: [
432  {text: "No"},
433  {text: "Yes", primary: true, action: function() {
434  var isNew = $("#emailVerifyWindow").data("isNew");
435  var hasChanges = $("#emailVerifyWindow").data("hasChanges");
436 
437  if (isNew) { <?php // Here, do not get the previous data on cancel. It is already created. ?>
438  if (hasChanges) {
439  mainGridChanged = true; <?php // Force a reread of the used emails on reopen. ?>
440  }
441  if (window.activeWindows != null) {
442  window.activeWindows.pop();
443  }
444  $.homecuValidator.setup({formValidate:'mainForm', formStatusField: 'formValidateMainDiv'});
445  } else {
446  manageEmailGrid.dataSource.data(previousVerifiedEmailData);
447  manageEmailGrid.dataSource.sync();
448 
449 
450  $.homecuValidator.setup({formValidate:'mainForm', formStatusField: 'formValidateMainDiv'});
451  }
452 
453  $("#emailVerifyWindow").data("hasChanges", false);
454  $("#emailVerifyWindow").data("resolved", true);
455  $("#emailVerifyWindow").data("kendoWindow").close();
456  }}
457  ],
458  visible: false,
459  open: function() {
460  if (window.activeWindows != null) {
461  window.activeWindows.push(this);
462  }
463  },
464  close: function() {
465  if (window.activeWindows != null) {
466  window.activeWindows.pop();
467  }
468 
469  }
470  }).data("kendoDialog");
471  }
472 
473  discardChangesDialog.open();
474  }
475  }
476  }
477 
478  },
479  }).data("kendoWindow");
480  $("#emailVerifyWindow").data("first", true);
481 
482  var iconWidth = 35;
483  var manageEmailGrid = $("#manageEmailGrid").kendoGrid({
484  dataSource: {
485  schema: {
486  parse: function(data) {
487  hideWaitWindow();
488  if (data.status != "000") {
489  $.homecuValidator.displayMessage(data.error, $.homecuValidator.settings.statusError );
490  $("#emailVerifyWindow").data("hasChanges", false);
491  } else {
492  noSESRole = false;
493  $("#emailVerifyWindow").data("isNew", false);
494 
495  if ($("#emailVerifyWindow:visible").length > 0) {
496  $("#emailVerifyWindow").data("hasChanges", false);
497  $("#emailVerifyWindow").data("kendoWindow").close();
498  } else {
499  $("#emailListBtn").data("kendoButton").enable(true);
500 
501  if (data.isNew === true) {
502  $("#emailVerifyWindow").data("isNew", true);
503 
504  if (data.verifiedEmailList.length > 0) {
505  $("#emailVerifyWindow .prepopulatedMsg").show();
506  }
507  noSESRole = true;
508  }
509  }
510 
511  if (data.info && data.info.length > 0) {
512  $.homecuValidator.displayMessage(data.info, $.homecuValidator.settings.statusInfo );
513  }
514  }
515  previousVerifiedEmailData = data.verifiedEmailList.slice(0);
516 
517  <?php // Update list for DDLs and Multiselects. ?>
518  var replacementList = [];
519  for(var i = 0; i != data.verifiedEmailList.length; i++) {
520  var record = data.verifiedEmailList[i];
521  if (record.status == "Success") {
522  replacementList.push({email: record.email});
523  }
524  }
525 
526  <?php // Add temporary email. ?>
527  replacementList.push({email: "<?php echo GetTemporaryEmail(); ?>"});
528 
529  emailDDLDataSource.data(replacementList);
530 
531  for(var i = 0; i != fromEmailDDLs.length; i++) {
532  fromEmailDDLs[i].refresh();
533  }
534 
535  return data.verifiedEmailList;
536  },
537  model: {
538  id: "email",
539  fields: {
540  email: {type: "string"},
541  status: {type: "string", defaultValue: ""},
542  deleted: {type: "boolean", defaultValue: false},
543  used: {type: "boolean", defaultValue: false},
544  itsNew: {type: "boolean", defaultValue: true},
545  isDirty: {type: "boolean", defaultValue: true},
546  resend: {type: "boolean", defaultValue: false}
547  }
548  }
549  },
550  transport: {
551  read: {
552  url: "<?php echo $self; ?>",
553  dataType: "json",
554  type: "POST",
555  data: {
556  operation: "readVerifiedEmailList"
557  }
558  },
559  parameterMap: function(data, type) {
560  showWaitWindow();
561  emailDDLDataSource.data(data.approvedEmails);
562  if (data.operation == "readVerifiedEmailList") {
563  return data;
564  } else if (data.operation == "updateVerifiedEmailList") {
565  var gridData = $("#manageEmailGrid").data("kendoGrid").dataSource.data();
566  gridData = $.grep(gridData, function (n, i) {
567  return !(n.itsNew === true && n.deleted === true);
568  });
569  data.emailList = kendo.stringify(gridData);
570  return data;
571  }
572  }
573  },
574  filter: {field: "deleted", operator: "neq", value: true}
575  },
576  columns: [
577  {field: "email", title: "Address"},
578  {field: "status", width: iconWidth, title: "Status"},
579  {width: iconWidth},
580  {width: iconWidth}
581  ],
582  rowTemplate: $("#manageEmailRowTemplate").html(),
583  noRecords: {
584  template: "<tr class='noRecordsDiv'><td colspan='4'>No Records Found</td></tr>"
585  },
586  }).data("kendoWindow");
587 
588  $("#manageEmailGrid .k-grid-header th:eq(2)").remove();
589  $("#manageEmailGrid .k-grid-header th:eq(1)").attr("colSpan", 2);
590 
591  <?php // Click events ?>
592 
593  $("#manageEmailGrid").on("click", ".removeTD", function() {
594  var removeDialog = $("#removeDialog").data("kendoDialog");
595 
596  if (removeDialog == null) {
597  removeDialog = $("<div id='removeDialog'></div>").appendTo("body").kendoDialog({
598  title: "Confirm Deletion",
599  content: "Are you sure you want to delete this email?",
600  actions: [
601  {text: "No"},
602  {text: "Yes", primary: true, action: function() {
603  $("#emailVerifyWindow").data("hasChanges", true);
604  var thisTr = $("#removeDialog").data("thisTr");
605  var grid = $("#manageEmailGrid").data("kendoGrid");
606  var dataItem = grid.dataItem($(thisTr));
607  dataItem.deleted = true;
608  grid.dataSource.sync();
609  }}
610  ],
611  open: function (e) {
612  if (window.activeWindows != null) {
613  window.activeWindows.push(this);
614  }
615  },
616  close: function (e) {
617  if (window.activeWindows != null) {
618  window.activeWindows.pop();
619  }
620  }
621  }).data("kendoDialog");
622  }
623 
624  $("#removeDialog").data("thisTr", $(this).closest("tr"));
625  removeDialog.open();
626  });
627 
628  $("#manageEmailGrid").on("click", ".resendTD", function() {
629  var email = $(this).closest("tr").find("td:eq(0)").text().trim();
630  emailResendDataSource.read({email: email});
631  });
632 
633  $("#emailVerifyWindow").on("click", ".cancelBtn", function() {
634  $("#emailVerifyWindow").data("kendoWindow").close();
635  });
636 
637  $("#emailVerifyWindow").on("click", ".updateBtn", function() {
638  if ($.homecuValidator.validate()) {
639 
640  <?php // If there is an email in the input, go ahead and add it to the grid because that was the user's intention. ?>
641  var newEmail = $("[name='emailInput']").val().trim();
642  if (newEmail != "") {
643  $("#emailVerifyWindow").data("hasChanges", true);
644  $("#manageEmailGrid").data("kendoGrid").dataSource.add({email: newEmail, status: "", used: false, itsNew: true,
645  isDirty: true, resend: false});
646  <?php // ASSUME that it is not in use. ?>
647  $("[name='emailInput']").val(null); <?php // Clear for next email. ?>
648  }
649 
650  $("#emailVerifyWindow").data("isUpdate", true);
651  $("#emailVerifyWindow").data("kendoWindow").close();
652  }
653 
654  });
655 
656  $("[name='emailInput']").on("keyup", function(e) { <?php // Needs the name attribute so it validates correctly. ?>
657  var code = e.which;
658  var enterCode = 13;
659  var commaCode = 188;
660 
661  if (code == enterCode) {
662  e.preventDefault();
663  } else if (code == commaCode) {
664  $(this).val($(this).val().trim().replace(",", ""));
665  }
666 
667  if (code == enterCode || code == commaCode) {
668  $.homecuValidator.isRequired = true;
669  if ($.homecuValidator.validate()) {
670  $("#emailVerifyWindow").data("hasChanges", true);
671  $("#manageEmailGrid").data("kendoGrid").dataSource.add({email: $(this).val(), status: "", used: false, itsNew: true,
672  isDirty: true, resend: false});
673  <?php // ASSUME that it is not in use. ?>
674  $(this).val(null); <?php // Clear for next email. ?>
675  }
676  $.homecuValidator.isRequired = false;
677 
678  }
679 
680  });
681 
682  <?php // Tooltips ?>
683 
684  <?php printExtendShowOverflown(); ?>
685 
686  var toolTipProps = homecuTooltip.defaults;
687  toolTipProps.filter = ".showEllipsis:visible:overflown";
688  toolTipProps.content = function(e) {
689  return $(e.target).text().trim();
690  };
691 
692  $("#manageEmailGrid").kendoTooltip(toolTipProps);
693 
694  toolTipProps.filter = ".statusTD";
695  toolTipProps.content = function(e) {
696  return $(e.target).data("status").trim();
697  }
698 
699  $("#manageEmailGrid").kendoTooltip(toolTipProps);
700  }
701 
702  $(document).ready(function() {
703  InitEmailNotify();
704  InitEmailVerify();
705  <?php printClickOverlayEvent(); ?>
706  });
707  </script>
708 
709  <script type="text/x-kendo-template" id="gridTemplate">
710  # var index = 0; #
711  <div class="row hcuSpacer h3">
712  <div class="col-xs-12">
713  CU Feature Emails
714  </div>
715  </div>
716  <div class="row hcuSpacer">
717  <div class="col-xs-12 hcu-secondary">
718  <div class="vsgSecondary">
719  Select an email address for each type of notification message shown below.
720  </div>
721  </div>
722  </div>
723  <div id="gridContainerFrom"><div class="container-fluid well well-sm">
724  # for (index; index != gridData.length; index++) { #
725  # var record = gridData[index]; #
726  # if (!record.single) { <?php // Records are sorted with the email that must be single at the top. Treat the singles differently. ?>
727  break;
728  } #
729  <div class="row hcuSpacer mockTr" data-index="#:index#" data-email="#:record.email#">
730  <div class="col-xs-12 col-sm-4 col-md-4">
731  <label>#= record.roleText #</label>
732  </div>
733  <div class="col-xs-12 col-sm-8 col-md-8">
734  <div id='emailDDL_#:index#' class='hcu-all-100'></div>
735  </div>
736  </div>
737  # } #
738  </div></div>
739 
740  <div class="row hcuSpacer h3">
741  <div class="col-xs-12">
742  Notification Emails From Homecu
743  </div>
744  </div>
745  <div class="row hcuSpacer">
746  <div class="col-xs-12 hcu-secondary">
747  <div class="vsgSecondary">
748  Select an email address for each type of notification message shown below.
749  To enter a list of addresses, use a semicolon (;) to separate multiple addresses.
750  </div>
751  </div>
752  </div>
753  <div class="row hcuSpacer">
754  <div class="col-xs-12 hcu-secondary">
755  <div class="vsgSecondary">
756  Existing addresses can be changed, but they cannot be left blank.
757  </div>
758  </div>
759  </div>
760  <div id="gridContainerTo"><div class="container-fluid well well-sm">
761  # for (index; index != gridData.length; index++) { #
762  # var record = gridData[index]; #
763  <div class="row hcuSpacer mockTr" data-index="#:index#">
764  <div class="col-xs-12 col-sm-4 col-md-4">
765  <label class='roleTextLabel'>#= record.roleText #</label>
766  </div>
767  <div class="col-xs-12 col-sm-8 col-md-8">
768  <input type='text' name='emailMulti_#:index#' class='hcu-all-100 k-input k-textbox' placeholder='Separate email addresses with semicolons.'
769  value="#:record.email#" data-hademail="# if (record.email.trim() == '') { # N # } else { # Y # } #">
770  </div>
771  </div>
772  # } #
773  </div></div>
774  </script>
775  <script type="text/x-kendo-template" id="emailVerifyWindowTemplate">
776  <div class="container-fluid hcu-template" id="emailVerifyWindowForm">
777  <div id="formValidatePopupDiv"></div>
778  <div class="row hcuSpacer">
779  <div class="col-xs-12 hcu-secondary">
780  <div class="vsgSecondary">
781  Add new emails to be verified here. Pressing update will start the email verification process.
782  Each address will receive an email with a web link to verify the address.
783  After verification, email addresses can be used as the notification from address.
784  <span class="prepopulatedMsg" style="display:none;">List was prepopulated from emails currently used. They are not verified.</span>
785  </div>
786  </div>
787  </div>
788  <div class="row hcuSpacer">
789  <div class="col-xs-12">
790  <input type="text" name="emailInput" class="k-textbox hcu-all-100" placeholder="Separate email addresses with commas.">
791  </div>
792  </div>
793  <div class="row hcuSpacer">
794  <div class="col-xs-12">
795  <div id="manageEmailGrid"></div>
796  </div>
797  </div>
798  <div class="row hcuSpacer">
799  <div class="col-xs-12">
800  &nbsp;
801  </div>
802  </div>
803  <div class="row hcuSpacer">
804  <div class="col-xs-12">
805  <div class="k-block k-shadow k-display-block container-fluid">
806  <span class="hcu-secondary col-xs-12 statusRow">
807  <span class="col-xs-1"><i class="fa fa-plus"></i></span>
808  <span class="vsgSecondary col-xs-11">New address, not verified</span>
809  </span>
810  <span class="hcu-secondary col-xs-12 statusRow">
811  <span class="col-xs-1"><i class="fa fa-times"></i></span>
812  <span class="vsgSecondary col-xs-11">Removes email from list</span>
813  </span>
814  <span class="hcu-secondary col-xs-12 statusRow">
815  <span class="col-xs-1"><i class="fa fa-paper-plane"></i></span>
816  <span class="vsgSecondary col-xs-11">Resends verification email (1 hour wait)</span>
817  </span>
818  <span class="hcu-secondary col-xs-12 statusRow">
819  <span class="col-xs-1 vsgSecondary">
820  <span class="restriction pending readonly hcu-all-100">
821  <i class="fa fa-circle"></i>
822  </span>
823  </span>
824  <span class="vsgSecondary col-xs-11">Verification pending</span>
825  </span>
826  <span class="hcu-secondary col-xs-12 statusRow">
827  <span class="col-xs-1 vsgSecondary">
828  <span class="restriction ban readonly hcu-all-100">
829  <i class="fa fa-ban"></i>
830  </span>
831  </span>
832  <span class="vsgSecondary col-xs-11">Verification failed</span>
833  </span>
834  <span class="hcu-secondary col-xs-12 statusRow">
835  <span class="col-xs-1 vsgSecondary">
836  <span class="restriction allow readonly hcu-all-100">
837  <i class="fa fa-check"></i>
838  </span>
839  </span>
840  <span class="vsgSecondary col-xs-11">Verification passed</span>
841  </span>
842  </div>
843  </div>
844  </div>
845 
846  <div class="hcu-edit-buttons k-state-default">
847  <a class="cancelBtn" href="\\#">Cancel</a>
848  &nbsp;&nbsp;&nbsp;
849  <a class="updateBtn k-button k-primary" href="\\#"><i class="fa fa-check"></i>Update</a>
850  </div>
851  </div>
852  </script>
853 
854  <script type="text/x-kendo-template" id="manageEmailRowTemplate">
855  # var statusImg = ""; var statusDescr = ""; #
856  # switch (status) {
857  case "Success":
858  statusDescr = "Verification passed";
859  statusImg = '<span class="vsgSecondary"> <div class="restriction allow readonly hcu-all-100"><i class="fa fa-check"></i></div> </span>';
860  break;
861  case "Pending":
862  case "NotStarted":
863  statusDescr = "Verification pending";
864  statusImg = '<span class="vsgSecondary"> <div class="restriction pending readonly hcu-all-100"><i class="fa fa-circle"></i></div> </span>';
865  break;
866  case "Failed":
867  case "TemporaryFailure":
868  statusDescr = "Verification failed";
869  statusImg = '<span class="vsgSecondary"> <div class="restriction ban readonly hcu-all-100"><i class="fa fa-ban"></i></div> </span>';
870  break;
871  case "":
872  default:
873  statusImg = '<span class="vsgSecondary"> <div class="readonly hcu-all-100"><i class="fa fa-plus"></i></div> </span>';
874  statusDescr = "New address, not verified";
875  break;
876  } #
877  # var dirtyClass = isDirty ? "k-dirty-cell" : ""; #
878  # var dirtySpan = isDirty ? "<span class='k-dirty'></span>" : ""; #
879 
880  <tr data-uid="#= uid #">
881  <td class="showEllipsis #= dirtyClass #">#= dirtySpan # #: email #</td>
882  <td class="statusTD" data-status="#: statusDescr #"> #= statusImg # </td>
883 
884  # if (resend) { #
885  <td class="resendTD"><i class="fa fa-paper-plane"></i></td>
886  # } else { #
887  <td></td>
888  # } #
889 
890  # if (!used) { #
891  <td class="removeTD"><i class="fa fa-times"></i></td>
892  # } else { #
893  <td></td>
894  # } #
895  </tr>
896  </script>
897  <div class="container-fluid" id="mainForm">
898  <div id="formValidateMainDiv"></div>
899  <div class="row hcuSpacer">
900  <div class="col-xs-12">
901  <a href="#" id="emailListBtn">Manage Email List</a>
902  </div>
903  </div>
904  </div>
905 
906 <?php }