Odyssey
adm_reports.prg
1 <?php
2 /**
3  * Change History:
4  * 05/01/13 mbl - Added fname, lname, decider to monitor_contact table.
5  * 11/16/15 SPB - updated to Kendo look
6  */
7 
8 $monLibrary= dirname(__FILE__) . "/../library";
9 $monIncludes= dirname(__FILE__) . "/../includes";
10 $sharedLibrary= dirname(__FILE__) . "/../../shared/library";
11 require_once("$monLibrary/cu_top.i");
12 require_once("$monLibrary/ck_hticket.i");
13 require_once("$monIncludes/cu_remote_top.prg");
14 require_once("$monLibrary/monitorView.i");
15 require_once("$sharedLibrary/reports.i");
16 require_once("$sharedLibrary/commonJsFunctions.i");
17 require_once("$sharedLibrary/commonPhpFunctions.i");
18 
19  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
20  // ** Permissions failed
21  // ** redirect to new page
22  header("Location: /hcuadm/hcu_noperm.prg");
23  exit;
24  }
25 
26 dms_import(array("report" => "string", "operation" => "string", "servers" => "string", "showServer" => "string"));
27 
28 // Configuration for data operations & presentation layer.
29 $showSQL= false;
30 $dataFile= $_SERVER["PHP_SELF"];
31 $presentationFile= $dataFile;
32 $defaultDateFormat= "MM/dd/yyyy";
33 
34 // Some reports use the cuusers table which is no cu
35 // specific, we must get a list of cu's before we can
36 // build the queries for the report list below.
37 
38 // Each of the 3 queries below reuiqred the livebatch <> 'C'
39 // so it was moved out.
40 $sql = "SELECT cu FROM cuadmin WHERE livebatch IN ('L', 'B');";
41 $sqlRs = db_query($sql, $dbh);
42 
43 $eStmtQuery = "";
44 $eStmtSatQuery = "";
45 $callahanQuery = "";
46 
47 $numRecords = db_num_rows($sqlRs);
48 for ($i = 0; $i < $numRecords; $i++) {
49  $row = db_fetch_assoc($sqlRs, $i);
50  $cu = strtoupper($row['cu']);
51  $cu = trim($cu);
52 
53  // Build eStatement query.
54  $eStmtQuery .= "select '{$cu}', a.vendor from {$cu}memberacct m, cuadmin a where m.estmnt_flag = 'Y' and a.cu = '{$cu}'";
55 
56  $eStmtSatQuery .= "select '{$cu}', estmt, members, (case when members > 0 then round(((estmt::float * 100 ) / members::float)::numeric,1) else 0 end) from (select COUNT(estmnt_flag) as estmt from {$cu}memberacct where estmnt_flag = 'Y') as estmt, (select COUNT(accountnumber) as members from {$cu}memberacct) as members";
57 
58  $callahanQuery .= "select '{$cu}', orgname, (case when exists (select estmnt_flag from {$cu}memberacct where estmnt_flag = 'Y') then 'ES' else '' end), (case when exists (select role from cuadmnotify where cu = '{$cu}' and role = 'txtbanking') then 'TXT' else '' end), (case when trim(bp_vendor) not in ('', 'NO') then bp_vendor else '' end) from cuadmin where cu = '{$cu}'";
59 
60  if ($i < $numRecords - 1) {
61  $eStmtQuery .= " UNION ";
62  $eStmtSatQuery .= " UNION ";
63  $callahanQuery .= " UNION ";
64  }
65 }
66 
67 // title => , sql => , cols =>
68 $reportList= array(
69  // 2
70  "estatementClients" => array("title" => "E-Statements Clients",
71  "sql" => "{$eStmtQuery}",
72  "cols" => array("Credit Union" => "string", "Vendor" => "string")),
73  // 3
74  "alphaCheck" => array("title" => "Alpha Check List",
75  "sql" => "select cu, user_name, orgname from cuadmin a where livebatch <> 'C' ",
76  "cols" => array("CU Code" => "string", "CU Home" => "string", "Org Name" => "string")),
77  // 4
78  "checkImaging" => array("title" => "Check Imaging Clients",
79  "sql" => "select cu, orgname, rt, img, case when (flagset & 2::int8)>0 then '+' else '' end, ckhexkey, ckorgid, ckurl from cuadmin where trim(img) not in ('','NO') and livebatch <> 'C' ",
80  "cols" => array("CU Code" => "string", "Org Name" => "string", "Routing#" => "number", "Image Vendor" => "string", "On" => "string", "Ck Hex Key" => "string",
81  "Ck ID" => "string", "Ck URL" => "string")),
82  // 5
83  "download" => array("title" => "Download Formats",
84  "sql" => "select cu, orgname, rt, tranformat::int, case when tranfldsep=1 then 'SP' else 'TAB' end,
85  case when traneol=1 then 'NONE' when traneol=2 then 'CRLF' else 'NL' end from cuadmin where livebatch <> 'C' ",
86  "cols" => array("CU Code" => "string", "Org Name" => "string", "R/T" => "number", "Format" => "number", "Fld" => "string", "EOL" => "string")),
87  // 6
88  "alertUsage" => array("title" => "Alert Usage Summary",
89  "sql" => "select cuadmin.cu, coalesce(sq_bal_join.bal_count, 0), coalesce(sq_chk_join.chk_count, 0), coalesce(sq_loan_join.ln_count, 0), coalesce(sq_trnx_join.trnx_count, 0) from cuadmin left join (select cu, count(*) as bal_count from cu_alerts where alerttype = 'B' group by cu) as sq_bal_join on cuadmin.cu = sq_bal_join.cu left join (select cu, count(*) as chk_count from cu_alerts where alerttype = 'C' group by cu) as sq_chk_join on cuadmin.cu = sq_chk_join.cu left join (select cu, count(*) as ln_count from cu_alerts where alerttype = 'L' group by cu) as sq_loan_join ON cuadmin.cu = sq_loan_join.cu left join (select cu, count(*) as trnx_count from cu_alerts where alerttype = 'T' group by cu) as sq_trnx_join ON cuadmin.cu = sq_trnx_join.cu where livebatch <> 'C' and (coalesce(sq_bal_join.bal_count, 0) > 0 or coalesce(sq_chk_join.chk_count, 0) > 0 or coalesce(sq_loan_join.ln_count, 0) > 0 or coalesce(sq_trnx_join.trnx_count, 0) > 0) ",
90  "cols" => array("CU" => "string", "Bal" => "number", "Check" => "number", "Loan" => "number", "Trans" => "number")),
91  // 7
92  "billPayCross" => array("title" => "Bill Pay Cross-Authentication Settings",
93  "sql" => "select cu, orgname, rt, bp_vendor, bp_cuid, bp_secret from cuadmin where trim(bp_vendor) > '' and trim(bp_vendor) <> 'NO' and livebatch <> 'C' ",
94  "cols" => array("CU Code" => "string", "Org Name" => "string", "RT Transit" => "number", "Bill Pay Vendor" => "string", "Bill Pay CUID" => "string", "Bill Pay Secret" => "string")),
95  // 8
96  "security" => array("title" => "Security Method Settings",
97  "sql" => "select cu, orgname, case when cookie_ver = 'L' then 'Legacy' else '2-Factor' end, loginscript, min_chlng_qst from cuadmin where livebatch <> 'C' ",
98  "cols" => array("CU Code" => "string", "Org Name" => "string", "Security Method" => "string", "Login Script" => "string", "Questions" => "string")),
99  // 9
100  "offlineStatus" => array("title" => "Offline Status Settings",
101  "sql" => "select cu, orgname, case when offlinestat = 'Y' then 'Offline (Stay Down)' when offlinestat = 'U' then 'Offline (Auto Up)' when offlinestat = 'R' then 'Read-Only' else 'Active' end,
102  offlineblurb from cuadmin where livebatch <> 'C' ",
103  "cols" => array("CU Code" => "string", "Org Name" => "string", "Offline Status" => "string", "Offline Message" => "string")),
104  // 10
105  "trustedAccess" => array("title" => "Trusted Access Settings",
106  "sql" => "select cu, orgname, ssovendor from cuadmin where trim(ssovendor) not in ('','NO') and livebatch <> 'C' ",
107  "cols" => array("CU Code" => "string", "Org Name" => "string", "Trusted Access Vendor" => "string")),
108  // 13
109  "loginFailure" => array("title" => "Admin User Login Failure Status",
110  "sql" => "select a.cu, u.user_name, lastlogin, failedlogin, case when coalesce(userflags, 0) & 8::int4 = 8 then 'Email' when coalesce(userflags, 0) & 16::int4 = 16 then 'Challenge'
111  when coalesce(userflags, 0) & 32::int4 = 32 then 'Password' else '' end from cuadminusers u, cuadmin a where u.cu = a.cu and a.livebatch <> 'C' and coalesce(userflags,0) & 56::int4 > 0 ",
112  "cols" => array("CU Code" => "string", "Admin User" => "string", "Last Login" => "date", "Last Failed" => "date", "Reason" => "string")),
113  // 14
114  "creditCard" => array("title" => "Credit Card Settings",
115  "sql" => "select cu, orgname, case when (flagset2 & 8::int8)>0 then '+' else '' end, case when (flagset2 & 16::int8)>0 then '+' else '' end, case when (flagset2 & 1024::int8)>0 then '+' else '' end, case when exists (select * from cuhavetrans where cu=cuadmin.cu and trancode='CC') then 'CC' else 'LP' end, ccinfourl from cuadmin where (flagset2 & 4::int8) > 0 and livebatch <> 'C' ",
116  "cols" => array("CU Code" => "string", "Org Name" => "string", "Show Interest" => "string", "Show Last Pd" => "string", "Show Stmnt Bal" => "string", "TranCode" => "string",
117  "Card Info URL" => "string")),
118  // 16
119  "txtBanking" => array("title" => "TXT Banking Clients",
120  "sql" => "select a.cu, a.orgname, n.email from cuadmnotify n join cuadmin a on a.cu = n.cu where a.livebatch <> 'C' and n.role = 'txtbanking' ",
121  "cols" => array("CU Code" => "string", "Org Name" => "string", "CU TXT Mail Address" => "string")),
122  // 17
123  "cuAlerts" => array("title" => "CU Alerts Clients",
124  "sql" => "select a.cu, a.orgname, n.email, a.liveserver from cuadmnotify n join cuadmin a on a.cu = n.cu where a.livebatch <> 'C' and n.role = 'alert' ",
125  "cols" => array("CU Code" => "string", "Org Name" => "string", "CU Alert Mail Address" => "string", "PGLoad Command" => "string")),
126  // 18
127  "callahan" => array("title" => "Callahan Details",
128  "sql" => "{$callahanQuery}",
129  "cols" => array("CU Code" => "string", "Name" => "string", "ES" => "string", "TXT" => "string", "Bill Pay" => "string")),
130  // 19
131  "fid" => array("title" => "FID Settings",
132  "sql" => "select cu, orgname, rt, fid, tz from cuadmin where livebatch in ('B','L') ",
133  "cols" => array("CU Code" => "string", "Name" => "string", "Routing" => "number", "FID" => "number", "TimeZone" => "date")),
134  // 20
135  "overrideMcir" => array("title" => "Override MICR Usage",
136  "sql" => "select om.cu, count(*) from cuovermicr om join cuadmin a on om.cu = a.cu where a.livebatch in ('B','L') group by om.cu ",
137  "cols" => array("CU Code" => "string", "Count" => "number")),
138  // 21
139  "classicMobile" => array("title" => "Clients using Classic Mobile Banking",
140  "sql" => "select cu, user_name, orgname from cuadmin where cu in ('#cus#')", "cols" => array("CU Code" => "string", "CU Home" => "string", "Org Name" => "string"),
141  "replaceString" => "#cus#", "replaceCode" => 'return implode("\', \'", runPipe("clmobile.mp"));'),
142  // 22
143  "mobileWeb" => array("title" => "Clients using Mobile Web Banking",
144  "sql" => "select cu, user_name, orgname from cuadmin where cu in ('#cus#')", "cols" => array("CU Code" => "string", "CU Home" => "string", "Org Name" => "string"),
145  "replaceString" => "#cus#", "replaceCode" => 'return implode("\', \'", runPipe("gomobile.mp"));'),
146  // 23
147  "estatementSat" => array("title" => "E-Statement Saturation",
148  "sql" => "{$eStmtSatQuery}",
149  "cols" => array("Credit Union" => "string", "E-Stmnt" => "string", "Members" => "string", "Percent" => "number"))
150  );
151 
152 $reportMenu= array("Administrative Info Reports" => array_keys($reportList));
153 
154 // Data layer
155 // **************************************
156 
157 // This ALWAYS returns an array like the original so there is no need checking to see if it is an array.
158 function runPipe($file)
159 {
160  $response= array();
161  if ($handle = popen("../usr-bin/$file", 'r'))
162  {
163  while (!feof ($handle))
164  {
165  $getLine = fgets($handle, 4096);
166  if (trim($getLine) != "")
167  $response[] = strtoupper(trim($getLine));
168  }
169  pclose($handle);
170  }
171  return $response;
172 }
173 
174 // All the internal functions are in reports.i
175 function readReport($dbh, $showSQL, &$errors, &$sqls, $reportList, $defaultDateFormat, $cookieName="")
176 {
177  $parameters= array();
178  dms_import_v2($parameters, "BOTTOM_LEVEL", array("report" => "string", "initial" => "string", "limit" => "string", "offset" => "string", "includeSchema" => "string", "includeCount" => "string",
179  "excludeData" => "string", "sortCols" => "string", "sortDirs" => "string", "filterCols" => "string", "filterOps" => "string", "filterValues" => "string", "dontIncludeId" => "string",
180  "servers" => "string", "showServer" => "string", "excludeSort" => "string", "limitId" => "string"));
181 
182  array_merge($errors, cleanValuesForDatabase($parameters["BOTTOM_LEVEL"],
183  array("initial" => array("type" => "boolean", "required" => false),
184  "report" => array("type" => "string", "required" => true),
185  "limit" => array("type" => "int", "required" => true, "allowNegatives" => true),
186  "offset" => array("type" => "int", "required" => false),
187  "includeSchema" => array("type" => "boolean", "required" => false),
188  "includeCount" => array("type" => "boolean", "required" => false),
189  "excludeData" => array("type" => "boolean", "required" => false),
190  "dontIncludeId" => array("type" => "boolean", "required" => false),
191  "showServer" => array("type" => "boolean", "required" => false),
192  "excludeSort" => array("type" => "boolean", "required" => false))));
193  $report= $parameters["BOTTOM_LEVEL"]["report"];
194  $limit= $parameters["BOTTOM_LEVEL"]["limit"];
195  $offset= intval($parameters["BOTTOM_LEVEL"]["offset"]);
196 
197  // Will be validated later
198  $sortCols= trim($parameters["BOTTOM_LEVEL"]["sortCols"]);
199  $sortDirs= trim($parameters["BOTTOM_LEVEL"]["sortDirs"]);
200  $filterCols= trim($parameters["BOTTOM_LEVEL"]["filterCols"]);
201  $filterOps= trim($parameters["BOTTOM_LEVEL"]["filterOps"]);
202  $filterValues= trim($parameters["BOTTOM_LEVEL"]["filterValues"]);
203  $servers= trim($parameters["BOTTOM_LEVEL"]["servers"]);
204  $limitId= trim($parameters["BOTTOM_LEVEL"]["limitId"]);
205 
206  $theseParameters= array("report" => $report, "includeSchema" => $parameters["BOTTOM_LEVEL"]["includeSchema"], "includeCount" => $parameters["BOTTOM_LEVEL"]["includeCount"],
207  "limit" => $limit, "offset" => $offset, "excludeData" => $parameters["BOTTOM_LEVEL"]["excludeData"], "sortCols" => $sortCols, "sortDirs" => $sortDirs, "servers" => $servers,
208  "filterCols" => $filterCols, "filterOps" => $filterOps, "filterValues" => $filterValues, "dontIncludeId" => $parameters["BOTTOM_LEVEL"]["dontIncludeId"],
209  "showServer" => $parameters["BOTTOM_LEVEL"]["showServer"], "excludeSort" => $parameters["BOTTOM_LEVEL"]["excludeSort"], "limitId" => $limitId);
210 
211  $printThis = readReportMonitor($dbh, $theseParameters, $errors, $sqls, $reportList, $defaultDateFormat, $cookieName);
212  header('Content-type: application/json');
213  print json_encode($printThis);
214 }
215 
216 function readReportMonitor($dbh, $theseParameters, &$errors, &$sqls, $reportList, $defaultDateFormat, $cookieName="")
217 {
218  // Must push local server name to match what's in the www_server
219  // value in cuinfo.
220  $validServers= array("www3", "www5", "www6", $_SERVER['SERVER_NAME']);
221  $serverArray= $validServers;
222  $serverCount= 3;
223 
224  $servers= $theseParameters["servers"];
225  $showServer= $theseParameters["showServer"] == "Y";
226  $limit= $theseParameters["limit"];
227  $offset= $theseParameters["offset"];
228  $sortCols= $theseParameters["sortCols"];
229  $sortDirs= $theseParameters["sortDirs"];
230 
231  global $SYS_TYPE_CLOSED;
232  $sql= "select trim(upper(user_name)) as user_name, trim(www_server) as www_server from cuinfo where system_options & $SYS_TYPE_CLOSED = 0 order by user_name";
233  $sqls[]= $sql;
234  $results= runSelectStatementMap($sql, $dbh);
235  $cuMap= $results["record"];
236  $errors= array_merge($errors, $results["error"]);
237 
238  if ($servers != "")
239  {
240  $theseServers= json_decode($servers, true);
241  if (!is_array($theseServers))
242  $errors[]= "Servers are not formatted correctly.";
243  else
244  {
245  $serverCount= count($theseServers);
246  if ($serverCount != 0)
247  $serverArray= $theseServers;
248  }
249  }
250 
251  unset($theseParameters["servers"]);
252  unset($theseParameters["showServer"]);
253 
254  $theseParameters["limit"]= -1;
255  $theseParameters["offset"]= 0;
256  $theseParameters["excludeSort"]= "Y";
257 
258  $serverData= array();
259  $columnData= array();
260  $modelData= array();
261  $reportData= array();
262  $response = null;
263  foreach($serverArray as $server)
264  {
265  if (!in_array($server, $validServers))
266  $errors[]= "$server is not a valid server.";
267  if (count($errors) == 0)
268  {
269  // Instead of making a curl call to get local data,
270  // check which server needs the curl call and default to local data
271  // because the local odyssey server can have different possible names.
272  if ($server == "www3" || $server == "www5" || $server == "www6") {
273  $response = runCurl($server, $theseParameters, $cookieName);
274  } else {
275  $response = readReportCommon($theseParameters["report"], $errors, $sqls, $dbh, $theseParameters["limit"], $theseParameters["offset"], $theseParameters["includeSchema"] == "Y", $theseParameters["includeCount"] == "Y", $theseParameters["excludeData"] == "Y", $theseParameters["dontIncludeId"] == "Y", $theseParameters["excludeSort"] == "Y", $theseParameters["sortCols"], $theseParameters["sortDirs"], $theseParameters["filterCols"], $theseParameters["filterOps"], $theseParameters["filterValues"], $reportList, "admReports", $cookieName);
276 
277  // Further code is expecting json encoded string
278  $response = HCU_JsonEncode($response);
279  }
280 
281  if (strpos($response, "<html>") !== false) // Redirected to permissions page
282  $errors[]= "You do not have the necessary rights to view the data from $server.";
283  else if (trim($response) == "") // No data found
284  $errors[]= "No data found from $server!";
285  else
286  {
287  $jsonResponse= json_decode($response, true);
288  $errors= array_merge($errors, $jsonResponse["error"]);
289  if (isset($jsonResponse["sql"]))
290  $sqls= array_merge($sqls, $jsonResponse["sql"]);
291 
292  foreach($jsonResponse["reportData"]["data"] as $record)
293  {
294  reset($record);
295  $cu= strtoupper(trim(next($record)));
296 
297  if (!isset($cuMap[$cu]) || trim($cuMap[$cu]) != $server)
298  continue; // Skip records not in the official CU server.
299  if ($showServer)
300  $record["server"]= $server;
301  $serverData[]= $record;
302  }
303 
304  if (count($columnData) == 0)
305  {
306  $columnData= $jsonResponse["columnData"];
307  $modelData= $jsonResponse["modelData"];
308 
309  if ($showServer)
310  {
311  $modelData["fields"]["server"]= array("type" => "string");
312  $columnData[]= array("field" => "server", "title" => "Server");
313  }
314  }
315  }
316  }
317  }
318 
319  return array("sql" => $sqls, "error" => $errors, "reportData" => array("data" => $serverData), "modelData" => $modelData, "columnData" => $columnData);
320 }
321 
322 function generateCSV($dbh, &$errors, &$sqls, $reportList, $defaultDateFormat, $cookieName="")
323 {
324  $parameters= array();
325  dms_import_v2($parameters, "BOTTOM_LEVEL", array("report" => "string", "sortCols" => "string", "sortDirs" => "string", "filterCols" => "string",
326  "filterOps" => "string", "filterValues" => "string"));
327 
328  array_merge($errors, cleanValuesForDatabase($parameters["BOTTOM_LEVEL"], array("report" => array("type" => "string", "required" => true))));
329 
330  $report= $parameters["BOTTOM_LEVEL"]["report"];
331 
332  // Will be validated later
333  $sortCols= $parameters["BOTTOM_LEVEL"]["sortCols"];
334  $sortDirs= $parameters["BOTTOM_LEVEL"]["sortDirs"];
335  $filterCols= $parameters["BOTTOM_LEVEL"]["filterCols"];
336  $filterOps= $parameters["BOTTOM_LEVEL"]["filterOps"];
337  $filterValues= $parameters["BOTTOM_LEVEL"]["filterValues"];
338 
339  $parameters= array();
340  dms_import_v2($parameters, "BOTTOM_LEVEL", array("report" => "string"));
341 
342  $sqls= array();
343  $errors= cleanValuesForDatabase($parameters["BOTTOM_LEVEL"],
344  array("report" => array("type" => "string", "required" => true)));
345  $report= $parameters["BOTTOM_LEVEL"]["report"];
346  $reportTitles= getReportTitles();
347  $reportName= $reportTitles[$report];
348 
349  $reportValues= readAdmReportCommon(array("report" => $report, "includeSchema" => "Y", "limit" => -1, "offset" => 0, "sortCols" => $sortCols, "sortDirs" => $sortDirs, "filterCols" => $filterCols,
350  "filterOps" => $filterOps, "filterValues" => $filterValues, "dontIncludeId" => "Y"), $dbh, $showSQL, $errors, $sqls, $reportList, $defaultDateFormat, $cookieName);
351 
352  printCSVData($reportValues, $report, $reportName, $reportList, $defaultDateFormat, "\t");
353 }
354 
355 if (isset($previousScript))
356  return;
357 
358 if (!isset($operation)) {$operation ="";}
359 if ($operation != "")
360 {
361  $errors= array();
362  $sqls= array();
363  switch ($operation)
364  {
365  case "readReport":
366  readReport($link, $showSQL, $errors, $sqls, $reportList, $defaultDateFormat, "adm_reports");
367  break;
368  case "readReportSQL":
369  readReport($link, true, $errors, $sqls, $reportList, $defaultDateFormat);
370  break;
371  case "generateCSV":
372  generateCSV($link, $errors, $sqls, $reportList, $defaultDateFormat);
373  break;
374  default: // Won't get here
375  header('Content-type: application/json');
376  $returnArray= array("error" => array("Operation not specified: '$operation'"), "record" => "", "operation" => "");
377  print json_encode($returnArray);
378  }
379 }
380 else
381 {
382 
383 // Presentation layer
384 // ************************************
385 
386 if (!isset($report)) {$report ="";}
387 $report= trim($report);
388 
389 $reports= getReportTitles();
390 
391 $reportDDL= array();
392 $reportMenuDDL= array();
393 foreach($reports as $value => $text)
394 {
395  $reportDDL[]= array("value" => $value, "text" => $text);
396 
397  //if ($value != $report)
398  $reportMenuDDL[$text]= array("url" => "$presentationFile?report=" . $value);
399 }
400 $reportMenuDDL= array("REDIRECT" => array("list" => array("Report List" => array("url" => $presentationFile))), "Other Reports" => array("list" => $reportMenuDDL),
401  "Download CSV" => array("id" => "downloadCSVBtn"), "Help &nbsp;<img src=\"/monitor/images/q1.gif\" border=\"0\" alt=\"View Help\" align=\"top\">" => array("id" => "helpBtn"));
402 
403 // Page for selecting the report.
404 // *****************************************************
405 if ($report == "")
406 {
407  $title= "Please Select Report";
408  printMonitorPageTop($title, $homecuKendoVersion, $cloudfrontDomainName, '', '', true); ?>
409 <style>
410  .grid_12 {
411  margin-top: 5px;
412  }
413  .reportMenu {
414  color: #595959;
415  width: 90%;
416  background: #fff;
417  border-width: 0px;
418 
419  }
420  .reportMenu .sectionHeader {
421  background:gray;
422  font-family:arial,helvetica;
423  font-size:14pt;
424  color:#fff
425  }
426 
427  /* copy from admin_master CSS to get styling. Adding CSS in monitorView.i will mess up a lot of stuff */
428  .reportMenu td {
429  font-size:12px;
430  padding: 2px;
431  margin: 2px;
432  }
433 
434  .reportMenu .odd {
435  background:#f7f8fa;
436  }
437 
438  .reportMenu .even {
439  background:#ededed;
440  }
441 
442  .serverCheck {
443  margin-left: 36px;
444  }
445 
446  #optionsRow > div {
447  display: inline;
448  }
449 </style>
450 <script type="text/javascript">
451 <?php
452 getErrorsAreShownFunction();
453 getEscapeHTMLFunction();
454 ?>
455 function initReportSelectPage()
456 {
457 
458  $("#serverMultiselect").prev().css({height: 25});
459 
460  $("#runReportBtn").click(function() {
461 
462  var data= {error: []};
463  if ($(".reportRadioButton:checked").length == 0)
464  data.error.push("Please select a report.");
465 
466  if (!errorsAreShown(data, "formValidateMainDiv"))
467  {
468  var url= $(".reportRadioButton:checked").val();
469  var showServer= $("#showServerCheckbox:checked").length > 0 ? "Y" : "N";
470  var servers= [];
471  if ($("#www3Checkbox").prop("checked"))
472  servers.push("www3");
473  if ($("#www5Checkbox").prop("checked"))
474  servers.push("www5");
475  if ($("#www6Checkbox").prop("checked"))
476  servers.push("www6");
477  if ($("#myCheckbox").prop("checked"))
478  servers.push("<?php echo $_SERVER['SERVER_NAME']; ?>");
479  servers= kendo.stringify(servers);
480  url+= "&showServer=" + showServer + "&servers=" + servers;
481  window.location.href= url;
482  }
483 
484  return false;
485  });
486 }
487 
488 $(document).ready(function () {
489  initReportSelectPage();
490 });
491 </script>
492 <?php printMonitorPageMiddle($title); ?>
493  <div id='hideSubmitWait' style='position:relative; left:-2000px;top:-2000px;'>
494  <div id='homecuSubmitWait' class='k-block' >
495  <div class='k-loading-image'></div>
496  </div>
497  </div>
498  <div class="container_12">
499  <div class="grid_12" style="margin-bottom:5px;">
500  <div id="formValidateMainDiv" class="k-block k-error-colored" style="display:none;"></div>
501  </div>
502  <div class="grid_12">
503  <?php echo compileMenu($reportMenu, $reportList, $dataFile, true); ?>
504  </div>
505  <div class="grid_12">Include Data from:</div>
506  <div class="grid_12">
507  <div class="serverCheck">www3: <input type="checkbox" id="www3Checkbox"></div>
508  </div>
509  <div class="grid_12">
510  <div class="serverCheck">www5: <input type="checkbox" id="www5Checkbox"></div>
511  </div>
512  <div class="grid_12">
513  <div class="serverCheck">www6: <input type="checkbox" id="www6Checkbox"></div>
514  </div>
515  <div class="grid_12">
516  <div class="serverCheck">Odyssey: <input type="checkbox" id="myCheckbox"></div>
517  </div>
518  <div class="grid_12">
519  Show Server: <input type="checkbox" id="showServerCheckbox">
520  </div>
521  <div class="grid_12">
522  <a href="#" class="k-button k-button-icontext" id="runReportBtn">Go</a>
523  </div>
524  </div>
525 <?php printMonitorPageBottom();
526 }
527 // Page for displaying the reports.
528 // **************************************************************
529 else
530 {
531  $title= isset($reports[$report]) ? $reports[$report] : "Unrecognized Report";
532  printMonitorPageTop($title, $homecuKendoVersion, $cloudfrontDomainName);
533 ?>
534 
535 <style>
536  .hide { position:absolute; top:-1px; left:-1px; width:1px; height:1px; }
537  #filterSettingsDiv {
538  width: 342px;
539  margin-bottom: 5px;
540  border: 1px solid black;
541  border-radius: 5px;
542  padding: 5px;
543  }
544  #filterSettingsDiv > div {
545  width: 33%;
546  display: inline;
547  }
548  #formValidateMainDiv li {
549  list-style-position: inside;
550  }
551 </style>
552 
553 <script type="text/javascript">
554 
555 <?php
556 if (!isset($showServer)) {$showServer = "";}
557 if (!isset($servers)) {$servers = "";}
558 
559 // Include common functions
560 getErrorsAreShownFunction();
561 getEscapeHTMLFunction();
562 getShowSQLFunction($showSQL);
563 getShowWaitFunctions();
564 getIsFilterChanged();
565 initReportClientSide($presentationFile, $report, $title, array("servers" => $servers, "showServer" => $showServer), true, "addWidthsPre"/*, "addWidthsPost"*/); // pass the variables down.
566 ?>
567 
568 function addWidthsPre(gridDefinition)
569 {
570  gridDefinition.columns[0].width= "150px"; // CU
571 }
572 
573 function addWidthsPost(grid)
574 {
575  for(var i=1, length=grid.columns.length; i!=length; i++)
576  {
577  grid.autoFitColumn(i);
578  }
579  var tableWidth= Number($("#reportGrid table").css("width").replace("px", ""));
580  var minWidth= 400;
581  var colWidth= 0;
582  if (tableWidth < minWidth)
583  {
584  tableWidth= minWidth;
585  colWidth= (minWidth-150)/(grid.columns.length-1);
586  $("#reportGrid .k-grid-header-wrap").find("colgroup col:not(:first)").width(colWidth);
587  $("#reportGrid .k-grid-content").find("colgroup col:not(:first)").width(colWidth);
588  }
589  $("#reportGrid").css({width: tableWidth});
590  grid.reorderColumn(1, grid.columns[0]);
591  grid.reorderColumn(1, grid.columns[0]);
592 }
593 
594 function showNote()
595 {
596  var notification = $("#notification").kendoNotification({
597  position: {
598  pinned: true,
599  top: 118,
600  left: 128
601  },
602  show: function ()
603  {
604  notificationIsShown= true;
605  },
606  hide: function ()
607  {
608  notificationIsShown= false;
609  }
610  }).data("kendoNotification");
611 
612  var notifificationIsShown= false;
613  var infoLine= "<span class=\"k-icon k-i-filter\"></span><b>To Filter:</b> Click on the (<span class=\"k-icon k-i-filter\"></span>) icon in a column that you want to filter. A dialog will pop up with filter value and options.<br>";
614  infoLine+= "<span class=\"k-icon k-i-arrow-n\"></span><b>To Sort:</b> Click on a column (not on the (<span class=\"k-icon k-i-filter\"></span>) icon). That column will sort ascending. ";
615  infoLine+= "Column will show with the (<span class=\"k-icon k-i-arrow-n\"></span>) icon. Click again and it will sort descending. ";
616  infoLine+= "Column will show with the (<span class=\"k-icon k-i-arrow-s\"></span>) icon. A third click will clear the sort.";
617  notification.info(infoLine);
618 }
619 
620 $(document).ready(function () {
621  initReport();
622  $("#helpBtn").click(function () {
623  showNote();
624  return false;
625  });
626 });
627 </script>
628 <?php printMonitorPageMiddle($title, $reportMenuDDL); ?>
629  <div id='hideSubmitWait' style='position:relative; left:-2000px;top:-2000px;'>
630  <div id='homecuSubmitWait' class='k-block' >
631  <div class='k-loading-image'></div>
632  </div>
633  </div>
634 
635  <div id="notification"></div>
636  <div class="container_12">
637  <div class="grid_12">
638  <div id="sqlOutput"></div>
639  </div>
640  <div class="grid_12" style="margin-bottom:5px;">
641  <div id="formValidateMainDiv" class="k-block k-error-colored" style="display:none;"></div>
642  </div>
643  <div class="grid_12">
644  <div id="reportGrid"></div>
645  </div>
646  </div>
647 <?php printMonitorPageBottom();
648 } // Report selected
649 } // No operation