Odyssey
ivr_mntc_msg.prg
1 <?php
2 
3 /*
4  * Script: ivr_mntc_msg
5  *
6  * Purpose: This will maintain the table ars_audio_message on the AWS IVR Database
7  * This table is a list of all the possible message codes used in the IVR
8  *
9  * CHANGES:
10  * SPB 10/30/2015-- now uses monitorView.i
11  */
12  // ** DEFAULTS
13  $HB_ENV = Array();
14 
15  $monLibrary= dirname(__FILE__) . "/../library";
16  $sharedLibrary= dirname(__FILE__) . "/../../shared/library";
17  require_once("$monLibrary/cu_top.i");
18  require_once("$monLibrary/ck_hticket.i");
19  require_once("$monLibrary/cu_pass.i");
20  require_once("$monLibrary/monitorView.i");
21  require_once("$sharedLibrary/cu_flagconst.i");
22 
23  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
24  // ** Permissions failed
25  // ** redirect to new page
26  header("Location: /hcuadm/hcu_noperm.prg");
27  exit;
28  }
29 
30  /*
31  * LOAD the current values from the ars_audio_message file
32  */
33  $sql = "SELECT *
34  FROM ars_audio_message
35  ORDER BY msg_code ";
36  $title= "Home Banking IVR Message Codes";
37  printMonitorPageTop($title, $homecuKendoVersion, $cloudfrontDomainName);
38 ?>
39 
40  <style>
41  body {
42  font-size: .9em;
43  }
44  .k-grid td {
45  padding: .2em .6em .2em .6em;
46  }
47 
48  </style>
49  <script>
50  var msgLevels = [ {'value':'', 'text':'...Choose...'}, {'value':'1', 'text':'Primary'}, {'value':'2', 'text':'Digits'}, {'value':'3', 'text':'Letters'}];
51  var isCreating;
52 
53  $(document).ready(function() {
54  var popupNotification = $("#popupNotification").kendoNotification().data("kendoNotification");
55  popupNotification.setOptions({
56  position: {
57  top: 10,
58  left: 200
59  }
60  });
61 
62 
63  var crudServiceBaseUrl = "ivr_mntc_msg.data",
64  dataSource = new kendo.data.DataSource({
65  autoSync: false,
66  batch: false,
67  serverFiltering: false,
68  serverPaging: false,
69  page: 1,
70  pageSize: 15,
71  cache: false,
72  transport: {
73  read: {
74  type: "GET",
75  url: crudServiceBaseUrl + "?action=read",
76  dataType: "json"
77  },
78  update: {
79  type: "POST",
80  url: crudServiceBaseUrl + "?action=update",
81  dataType: "json"
82  },
83  destroy: {
84  type: "POST",
85  url: crudServiceBaseUrl + "?action=delete",
86  dataType: "json"
87  },
88  create: {
89  type: "POST",
90  url: crudServiceBaseUrl + "?action=new",
91  dataType: "json"
92  },
93  parameterMap: function(options, operation) {
94  if (operation !== "read" && options.models) {
95  return {models: kendo.stringify(options.models)};
96  } else if (operation === 'create' || operation === 'update' || operation === 'destroy') {
97  return options;
98  }
99  }
100  },
101  schema: {
102  type: 'json',
103  data: function(response) {
104 
105  var returnData = Array();
106  var responseInfo;
107  if (response.homecuInfo) {
108  if (response.homecuInfo.length > 0) {
109  responseInfo = response.homecuInfo;
110  popupNotification.show(responseInfo, "info");
111  }
112  }
113 
114  try {
115  if (response.homecuErrors !== undefined) {
116  if (response.homecuErrors.length > 0) {
117  var errMsg = '';
118  for (var i = 0; i < response.homecuErrors.length; i++) {
119  errMsg += (errMsg.length > 0 ? '<br/>' : '') + response.homecuErrors[i];
120  }
121  throw errMsg;
122  }
123  }
124  if (response.homecuData !== undefined) {
125  if (response.homecuData) {
126  returnData = response.homecuData;
127  }
128  } else {
129  throw "Error occurred while parsing the data.";
130  }
131  } catch (err) {
132  // ** Need to report the message to the main screen
133  popupNotification.show(err, "error");
134  returnData = [];
135  }
136 
137  return returnData;
138  },
139  total: function(response) {
140  return response.homecuData.length;
141  },
142  parse: function(response) {
143  var responsePass = false;
144  var returnData = [];
145  // ** Verify the response packet is well formed, if it is NOT, then
146  // * Simply return a homecuError with that message
147  try {
148  returnData = response.Results[0];
149  } catch(err) {
150  returnData = [{homecuErrors: "Error parsing server"}];
151  }
152  return returnData;
153  },
154  model: {
155  id: "msg_code",
156  fields: {
157  msg_code: { type: 'string', validation: {required: true}},
158  msg_desc: { type: 'string', validation: { required: true } },
159  msg_filename: { type: 'string', validation: { required: true} },
160  msg_level: { type: "string", validation: {required: true} }
161  }
162  }
163  }
164  });
165  $("#gridMsg").kendoGrid({
166  dataSource: dataSource,
167  pageable: {
168  pageSizes: [15, 30, 45],
169  info: true,
170  refresh: true,
171  messages: {
172  display: "Showing {0}-{1} from {2} data items"
173  }
174  },
175  filterable: true,
176  sortable: true,
177  batch: false,
178  toolbar: ["create"],
179  columns: [
180  { field:"msg_code", title: "Code", width: "120px"},
181  { field: "msg_desc", title:"Message", width: "350px" },
182  { field: "msg_filename", title:"File Name", width: "120px" },
183  { field: "msg_level", title:"Level", values: msgLevels, width: "120px" },
184  { command: ["edit", "destroy"], title: "&nbsp;", width: "200px" }],
185  editable: "popup",
186  edit: function (e) {
187  if (isCreating) {
188  isCreating = false;
189  } else {
190  $('input[name *= "msg_code"]').attr('disabled', true);
191  }
192  }
193  });
194  $('.k-grid-add').on('click', function(e) {
195  isCreating = true;
196  $('input[name *= "msg_code"]').attr('disabled', false);
197  });
198  });
199  </script>
200  <?php printMonitorPageMiddle($title); ?>
201  <span id="popupNotification"></span>
202  <div id='gridMsg'></div>
203  <?php printMonitorPageBottom(); ?>