Odyssey
imp_menu.prg
1 <?php
2 $monLibrary= dirname(__FILE__) . "/../library";
3 require_once("$monLibrary/cu_top.i");
4 require_once("$monLibrary/ck_hticket.i");
5 require_once("$monLibrary/cu_pass.i");
6 
7  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
8  // ** Permissions failed
9  // ** redirect to new page
10  header("Location: /hcuadm/hcu_noperm.prg");
11  exit;
12  }
13 
14 $dms_ok=array('cunotes_'=>'prefix_s','type_opt'=>'digits',
15 'btnShowType'=>'string','msg'=>'string','ob'=>'digits','d'=>'string',
16 'action'=>'string','reset_cookie'=>'digits','setcu'=>'string','la'=>'string');
17 
18 dms_import($dms_ok);
19 
20  $dbh = $link;
21 
22  $use_cookie = false;
23  if (isset($reset_cookie) && $reset_cookie == 1) {
24  HCU_setcookie_env($SYSENV, "Imp_View", "", time());
25  } elseif (!isset($ob) && !isset($type_opt)) {
26  // ** Check for the cookie here -- If found then set the values I find
27  if (isset($_COOKIE['Imp_View'])) {
28  // ** This may give the following values
29  // ob :: cookie_type_opt
30  parse_str ($_COOKIE['Imp_View']);
31  }
32  $use_cookie = true;
33  }
34 
35  cu_header("Implementation");
36 
37  if (isset($setcu)) {
38  // We are probably trying to set a date, so do the different types
39  if (isset($la)) {
40  $sql = "UPDATE cuinfo
41  SET last_activity_date = CURRENT_TIMESTAMP
42  WHERE user_name = '" . $setcu . "'
43  AND date_live is null ";
44  $date_rs = db_query($sql, $dbh);
45 
46  db_free_result($date_rs);
47  }
48  }
49 
50  // Determine the order of the query
51  $desc = array();
52  $desc_val = 1;
53  $ob = isset($ob) ? $ob : 0;
54  switch (intval($ob)) {
55  case 2:
56  $orderby = "vendor";
57  $desc_val = 2;
58  break;
59  case 3:
60  $orderby = "name";
61  $desc_val = 3;
62  break;
63  case 4:
64  // *** Order by the System Type -- this will go in the order
65  // ** Batch :: Batch / ASP :: Batch / IVR :: Batch / VOIP :: Live :: Live / ASP :: Live / IVR :: Live / VOIP :: IVR :: VOIP :: Web Only :: Closed
66  $orderby = "
67  CASE
68  WHEN (coalesce(system_options, 0) & $SYS_TYPE_CLOSED) = $SYS_TYPE_CLOSED
69  THEN 99
70  WHEN (coalesce(system_options, 0) & ($SYS_TYPE_BATCH + $SYS_TYPE_ASP)) = ($SYS_TYPE_BATCH + $SYS_TYPE_ASP)
71  THEN 2
72  WHEN (coalesce(system_options, 0) & ($SYS_TYPE_BATCH + $SYS_TYPE_IVR)) = ($SYS_TYPE_BATCH + $SYS_TYPE_IVR)
73  THEN 3
74  WHEN (coalesce(system_options, 0) & ($SYS_TYPE_BATCH + $SYS_TYPE_VOIP)) = ($SYS_TYPE_BATCH + $SYS_TYPE_VOIP)
75  THEN 4
76  WHEN (coalesce(system_options, 0) & $SYS_TYPE_BATCH) = $SYS_TYPE_BATCH
77  THEN 1
78  WHEN (coalesce(system_options, 0) & ($SYS_TYPE_LIVE + $SYS_TYPE_ASP)) = ($SYS_TYPE_LIVE + $SYS_TYPE_ASP)
79  THEN 6
80  WHEN (coalesce(system_options, 0) & ($SYS_TYPE_LIVE + $SYS_TYPE_IVR)) = ($SYS_TYPE_LIVE + $SYS_TYPE_IVR)
81  THEN 7
82  WHEN (coalesce(system_options, 0) & ($SYS_TYPE_LIVE + $SYS_TYPE_VOIP)) = ($SYS_TYPE_LIVE + $SYS_TYPE_VOIP)
83  THEN 8
84  WHEN (coalesce(system_options, 0) & $SYS_TYPE_LIVE) = $SYS_TYPE_LIVE
85  THEN 5
86  WHEN (coalesce(system_options, 0) & $SYS_TYPE_IVR) = $SYS_TYPE_IVR
87  THEN 9
88  WHEN (coalesce(system_options, 0) & $SYS_TYPE_VOIP) = $SYS_TYPE_VOIP
89  THEN 10
90  WHEN (coalesce(system_options, 0) & $SYS_TYPE_WEBONLY) = $SYS_TYPE_WEBONLY
91  THEN 11
92  ELSE
93  100
94  END
95  ";
96 
97  $desc_val = 4;
98  break;
99  case 5:
100  $orderby = "target_launch";
101  $desc_val = 5;
102  break;
103  case 6:
104  $orderby = "coalesce(next_contact_date, '1/1/1990')";
105  $desc_val = 6;
106  break;
107  default:
108  $orderby = "user_name";
109  $desc_val = 1;
110  break;
111  }
112  if (isset($d) && $d == "1") {
113  $orderby .= " desc ";
114  } else {
115  $desc[$desc_val] = "&d=1";
116  }
117 
118  // add a secondary sort
119  $orderby .= ", user_name";
120 
121  $type_opt_link = "";
122  if (isset($type_opt)) {
123  $link_type_opt = "&type_opt=$type_opt";
124  } elseif (isset($cookie_type_opt)) {
125  $type_opt = $cookie_type_opt;
126  $link_type_opt = "&type_opt=$type_opt";
127  } else {
128  $type_opt=0;
129  $link_type_opt="";
130  }
131 
132  // *** SET THE COOKIE
133  $cookie_val = "ob=$ob&cookie_type_opt=$type_opt";
134  HCU_setcookie_env($SYSENV, "Imp_View", $cookie_val, time() + 86400);
135 
136  switch("$type_opt") {
137  case "1":
138  $sql_type_opt = " where date_live is null ";
139  break;
140  case "2":
141  $sql_type_opt = " where date_live is not null and (coalesce(system_options, 0) & $SYS_TYPE_UPGRADE) = $SYS_TYPE_UPGRADE ";
142  break;
143  case "0":
144  default:
145  $sql_type_opt = " where date_live is null
146  or ((coalesce(system_options, 0) & $SYS_TYPE_UPGRADE) = $SYS_TYPE_UPGRADE) ";
147  }
148 
149 
150  $sql = "select user_name, vendor, name,
151  trim(home_page_url), main_email,
152  misc_notes, target_launch as target_launch,
153  to_char(next_contact_date, 'MM/DD/YYYY') as next_contact_date, www_server,
154  comments, contract_notes, system_options
155  from cuinfo
156  $sql_type_opt
157  order by $orderby";
158 
159  $sth = db_query($sql, $dbh);
160 
161  if ($sth) {
162  print "
163  <script language=\"javascript\">
164  <!--
165  function open_notes(cuid) {
166  var newwin = null;
167  var settings = \"width=600, height=400, resizable=yes, scrollbars=yes, toolbar=no, status=no, menubar=no, location=no\";
168  var url = \"/hcuadm/imp_notes.prg?cuid=\" + cuid;
169 
170  newwin = window.open(url, \"notes\", settings);
171 
172  }
173  // -->
174  </script>
175  <script language='javascript' src='imp_menu.js'></script>
176  ";
177  print "<form name='ImpMenu'>";
178  print "<table border=0 width=\"95%\" cellpadding=3 cellspacing=1 align=center class=\"dmsbg\"><tr><td> ";
179  print "<table border=0 cellpadding=3 cellspacing=0 align=center width=\"100%\"> ";
180  if (isset($msg) && $msg != '') {
181  print "<tr><td colspan=7 class=msg align=center>{$msg}</td></tr>";
182  }
183  print "
184  <tr><td colspan=7 align=center class='bar'>
185  SELECT CREDIT UNION FOR IMPLEMENTATION
186  </td></tr>";
187 
188  spewmenu();
189  $d1 = HCU_array_key_exists(1, $desc) ? $desc[1] : "";
190  $d2 = HCU_array_key_exists(2, $desc) ? $desc[2] : "";
191  $d3 = HCU_array_key_exists(3, $desc) ? $desc[3] : "";
192  $d4 = HCU_array_key_exists(4, $desc) ? $desc[4] : "";
193  $d5 = HCU_array_key_exists(5, $desc) ? $desc[5] : "";
194  $d6 = HCU_array_key_exists(6, $desc) ? $desc[6] : "";
195  echo "<tr>
196  <td class='hdr'>
197  <a href=imp_menu.prg?action=list&ob=1{$d1}{$link_type_opt}>Credit Union</a></td>
198  <td class='hdr'>
199  <a href=imp_menu.prg?action=list&ob=2{$d2}{$link_type_opt}>Vendor</a></td>
200  <td class='hdr'>
201  <a href=imp_menu.prg?action=list&ob=3{$d3}{$link_type_opt}>CU Name</a></td>
202  <td class='hdr'>&nbsp;</td>
203  <td class='hdr'>
204  <a href=imp_menu.prg?action=list&ob=4{$d4}{$link_type_opt}>CU Type</a></td>
205  <td class='hdr'>
206  <a href=imp_menu.prg?action=list&ob=5{$d5}{$link_type_opt}>Target Date</a></td>
207  <td class='hdr'>
208  <a href=imp_menu.prg?action=list&ob=6{$d6}{$link_type_opt}>Next Contact Date</a></td>
209  </tr>";
210  $RGB = "odd";
211  for ($row=0;
212  list($user_name,
213  $vendor, $orgname, $homepage, $main_email,
214  $misc_notes, $target_launch, $next_contact_date,
215  $www_server, $notes, $contract_notes, $system_options
216  ) = db_fetch_array($sth,$row); $row++) {
217  $user_name = trim($user_name);
218 
219  // display list w/link to self ?action=fetch and ?action=delete
220 
221  // Create the Vendor link for the menu item
222  //$vendor_url = "<a href=\"javascript:view_vendor('" . trim($vendor) . "')\" onMouseOver=\"status='View " .
223  //trim($vendor) . " Information'; return true;\" onMouseOut=\"status='';\">" . trim($vendor) . "</a>";
224  $vendor_url = trim($vendor);
225 
226 # hover over orgname shows notes, mouse out closes
227  $show_org = "<a href='monitor_notes.prg?user_name={$user_name}' target='_blank'><img src='/monitor/images/quill.gif' border='0' alt='Show Notes'></a><span id=\"Notes_{$user_name}\" onMouseOut=\"closeNotes(); return false;\" onMouseOver=\"displayNotes('Notes_{$user_name}', '$user_name');\" >$orgname</span>";
228 # hover over tack shows notes; mouse out closes
229 // $show_org = "<span id=\"Notes_{$user_name}\" onMouseOut=\"closeNotes(); return false;\" onMouseOver=\"displayNotes('Notes_{$user_name}', '$user_name');\" ><img src='/monitor/images/admin_tack.gif' border=0 />&nbsp;</span>$orgname";
230 # hover over orgname shows notes; notes stay open until closed
231 // $show_org = "<span id=\"Notes_{$user_name}\" onMouseOver=\"displayNotes('Notes_{$user_name}', '$user_name');\" >$orgname</span>";
232 
233  $cu_notes = "<b><center>$user_name</center></b>";
234 /*
235  $cuNotes = "";
236  if (strlen(trim($notes)) > 0 || strlen(trim($misc_notes)) > 0 || strlen(trim($contract_notes)) > 0) {
237  $cuNotes .= "<b>Comments</b><br>" . dms_disphtml($notes) . "<br><b>Implementation Notes</b><br>" . dms_disphtml($misc_notes) . "<br><b>Contract Notes</b><br>" . dms_disphtml($contract_notes);
238  $cuNotes = str_replace("\n","<br>", $cuNotes);
239  $cuNotes = htmlspecialchars($cuNotes, ENT_QUOTES);
240  } else {
241  // We can fit all the notes in the box
242 // $cu_notes .= "<b>No Comments Found</b>";
243  }
244 */
245  // see if any notes exist
246  $Today = date( "Y-m-d" );
247  $sql = "select subject, messagetext, author, activitydate
248  from cuinfo_notes
249  where cu = '$user_name'
250  and (dontshowafter is null OR dontshowafter > '$Today')
251  order by activitydate DESC";
252 
253  $result = db_query($sql, $dbh);
254 
255  $newNotes = "";
256  while ( $Row = pg_fetch_array($result) ) {
257  $activityDate = date( "m-d-Y", strtotime( $Row["activitydate"] ) );
258  $newNotes .= "<br /><b>" . $Row["subject"] . "</b> (" . $Row["author"] . " / " . $activityDate . ")<br />" . dms_disphtml($Row["messagetext"]) . "<br />";
259  }
260 
261  $newNotes = str_replace("\n","<br>", $newNotes);
262  $newNotes = htmlspecialchars($newNotes, ENT_QUOTES);
263 
264  if ( strlen(trim($newNotes)) ) {
265  $cu_notes .= trim($newNotes);
266  } else {
267  $cu_notes .= "<br /><b>No Comments Found</b>";
268  }
269 
270  $show_org .= "<input type=hidden name='cunotes_{$user_name}' value='$cu_notes'>";
271 
272 
273 
274  $print_HomeCU_Type = "";
275  $print_HomeCU_Type .= ($system_options & $SYS_TYPE_BATCH ? "Batch" : "");
276  $print_HomeCU_Type .= ($system_options & $SYS_TYPE_LIVE ? (strlen($print_HomeCU_Type) > 0 ? " / " : "") . ($system_options & $SYS_TYPE_LIVE ? "Live" : "") : "");
277  $print_HomeCU_Type .= ($system_options & $SYS_TYPE_ASP ? (strlen($print_HomeCU_Type) > 0 ? " / " : "") . ($system_options & $SYS_TYPE_ASP ? "ASP" : "") : "");
278  $print_HomeCU_Type .= ($system_options & $SYS_TYPE_IVR ? (strlen($print_HomeCU_Type) > 0 ? " / " : "") . ($system_options & $SYS_TYPE_IVR ? "IVR" : "") : "");
279  $print_HomeCU_Type .= ($system_options & $SYS_TYPE_VOIP ? (strlen($print_HomeCU_Type) > 0 ? " / " : "") . ($system_options & $SYS_TYPE_VOIP ? "VOIP" : "") : "");
280  $print_HomeCU_Type .= ($system_options & $SYS_TYPE_WEBONLY ? (strlen($print_HomeCU_Type) > 0 ? " / " : "") . ($system_options & $SYS_TYPE_WEBONLY ? "Web Only" : "") : "");
281  $print_HomeCU_Type .= ($system_options & $SYS_TYPE_UPGRADE ? (strlen($print_HomeCU_Type) > 0 ? " / " : "") . ($system_options & $SYS_TYPE_UPGRADE ? "Upgrade / Conversion" : "") : "");
282  $print_HomeCU_Type .= ($system_options & $SYS_TYPE_CLOSED ? (strlen($print_HomeCU_Type) > 0 ? " / " : "") . ($system_options & $SYS_TYPE_CLOSED ? "Closed" : "") : "");
283 
284  $print_HomeCU_Type = (strlen($print_HomeCU_Type) > 0 ? $print_HomeCU_Type : "NOT SET");
285 
286  $documentServerIP = '192.168.169.33';
287  switch (strtoupper(substr($user_name, 0, 1))) {
288  case "X":
289  case "Y":
290  case "Z":
291  $directoryLetter = 'XYZ';
292  break;
293  default:
294  $directoryLetter = strtoupper(substr($user_name, 0, 1));
295  }
296  $cuDocumentLocation = "http://{$documentServerIP}/clientdocs/{$directoryLetter}/{$user_name}";
297 
298  $targetLaunchDate = "Not Set";
299  $target_launch = trim( $target_launch );
300  if ( $target_launch == "FLEX" || $target_launch == "TBD" ) {
301  $targetLaunchDate = $target_launch;
302  } else {
303  $tempDate = strtotime( $target_launch );
304  if ( $tempDate > 0 ) {
305  $targetLaunchDate = date('m/d/Y', $tempDate );
306  }
307  }
308  printf("<TR class=\"%s\" id=\"tr_$user_name\">
309  <td><font size=2><a href=\"imp_main.prg?cuid=%s\">%s</a>&nbsp;</font></td>
310  <td><font size=2>%s&nbsp;</td>
311  <td><font size=2>%s&nbsp;</td>
312  <td><a href='$cuDocumentLocation' target='_blank'><img src='https://www.homecu.net/images/folder.png' style='border:0px;' /></a></td>
313  <td><font size=2>%s&nbsp;</td>
314  <td><font size=2><a href=\"%s\">%s</a></td>
315  <td><font size=2>%s&nbsp;</td>
316  </tr>\n",$RGB,$user_name, $user_name,$vendor_url, $show_org, $print_HomeCU_Type,
317  $_SERVER['SCRIPT_NAME'] . "?setcu=$user_name&la=1" .
318  (isset($action) ? "&action=" . $action : "") .
319  (isset($ob) ? "&ob=" . $ob : ""),
320  $targetLaunchDate, $next_contact_date);
321  $RGB = ($RGB == "odd" ? "even" : "odd");
322  }
323  print "<tr>
324  <td colspan=7 align=center class='dtl'>
325  <font color='blue'>
326  There are " . ($row) . " credit unions in this implementation list.
327  </font>
328  </td>
329  </tr> ";
330  spewmenu();
331  echo "</table>";
332  echo "</td></tr></table>";
333  cu_footer();
334  print <<< print_html
335  <div id="NotesId" style="position:absolute;widthxx:250px;left:0px;top:0px;visibility:hidden">
336  <table border=0 cellpadding=0 cellspacing=0>
337  <tr>
338  <td width=35 height=18><img src='/hcuadm/caption_images/caption_rev_ul.gif' width=35 height=18 border=0></td>
339  <td width='%' height=18 style='background-repeat: repeat' background='/hcuadm/caption_images/caption_rev_top.gif' align='right'><a href='#' onClick='closeNotes();return false;'>Close</a></td>
340  <td width=18 height=18 background='/hcuadm/caption_images/caption_rev_ur.gif'></td>
341  </tr>
342 
343  <tr>
344  <td width=35 valign='top' background-repeat: repeat' background='/hcuadm/caption_images/caption_rev_left.gif'><img src='/hcuadm/caption_images/caption_rev_point.gif' width=35 height=19 border=0></td>
345 
346 
347  <td rowspan='1' bgcolor='white' valign='top'>
348  <table border="1" width="250" bgcolor="#FFFFFF" cellspacing="0" cellpadding="0">
349  <tr><td height=''>
350  <div id='NotesWrite' class='dtl' style='padding:3px;'></div>
351  </td></tr>
352  </table>
353  </td>
354 
355  <td width=18 rowspan='1' background='/hcuadm/caption_images/caption_rev_right.gif'></td>
356  </tr>
357 
358  <tr>
359  <td width=35 height=18><img src='/hcuadm/caption_images/caption_rev_ll.gif' width=35 height=18 border=0></td>
360  <td width='%' height=18 style='background-repeat: repeat' background='/hcuadm/caption_images/caption_rev_btm.gif'></td>
361  <td width=18 height=18><img src='/hcuadm/caption_images/caption_rev_lr.gif' width=18 height=18 border=0></td>
362  </tr>
363 <!--
364  <tr>
365  <td width=18 height=18><img src='/hcuadm/caption_images/caption_ul.gif' width=18 height=18 border=0></td>
366  <td width='%' height=18 style='background-repeat: repeat' background='/hcuadm/caption_images/caption_top.gif' align='right'><a href='#' onClick='closeNotes();return false;'>Close</a></td>
367  <td width=35 height=18 background='/hcuadm/caption_images/caption_ur.gif'></td>
368  </tr>
369  <tr>
370  <td width=18 rowspan='1' background='/hcuadm/caption_images/caption_left.gif'></td>
371  <td rowspan='1' bgcolor='white' valign='top'>
372  <table border="1" width="250" bgcolor="#FFFFFF" cellspacing="0" cellpadding="0">
373  <tr><td height=''>
374  <div id='NotesWrite' class='dtl'></div>
375  </td></tr>
376  </table>
377  </td>
378  <td width=35 valign='top' background-repeat: repeat' background='/hcuadm/caption_images/caption_right.gif'><img src='/hcuadm/caption_images/caption_point.gif' width=35 height=19 border=0></td>
379  </tr>
380  <tr>
381  <td width=18 height=18><img src='/hcuadm/caption_images/caption_ll.gif' width=18 height=18 border=0></td>
382  <td width='%' height=18 style='background-repeat: repeat' background='/hcuadm/caption_images/caption_btm.gif'></td>
383  <td width=35 height=18><img src='/hcuadm/caption_images/caption_lr.gif' width=35 height=18 border=0></td>
384  </tr>
385 -->
386  </table>
387  </div>
388  </form>
389 
390 <div id="ShowId" class="dtl" style="position:absolute;left:0px;top:0px;visibility:hidden;border:1px solid black;">
391  <form action="/hcuadm/imp_menu.prg?action=list&ob={$ob}" method="post">
392  <table border=0 cellpadding=0 cellspacing=0 width='%'>
393  <tr>
394  <td class='iright'>
395  <input type='radio' name='type_opt' value='1'>New Implementations
396  </td>
397  </tr>
398  <tr>
399  <td class='iright'>
400  <input type='radio' name='type_opt' value='2'>Upgrade / Conversions
401  </td>
402  </tr>
403  <tr>
404  <td class='iright'>
405  <input type='radio' name='type_opt' value='0'>ALL
406  </td>
407  </tr>
408  <tr>
409  <td class='iright'>
410  <hr>
411  </td>
412  </tr>
413  <tr>
414  <td class='iright' >
415  <a href='javascript:Close_DropDown("ShowId");'>Close</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
416  <input type='submit' name='btnShowType' value='Show'>
417  </td>
418  </tr>
419  </table>
420  </form>
421  </div>
422 print_html;
423  }
424 
425 function spewmenu() {
426  global $infourl;
427  echo "<tr><td class='ahd'>&nbsp;</td><td colspan=5 align='center' class='ahd'>
428  <a href=\"/hcuadm/imp_main.prg?cuid=NEW\">Add Credit Union</a>&nbsp;|&nbsp;
429  <a href=\"$infourl/monitor/mindex.html\">Main Credit Union List</a>&nbsp;|&nbsp;
430  <a href=\"/hcuadm/hcu_prod_list.prg\">Home CU Products</a>&nbsp;
431  <a href=\"/hcuadm/imp_cuissues.prg\">Implementation Issues</a>&nbsp;
432  </td><td align='right' class='ahd'>
433  <a href='imp_menu.prg?action=list&reset_cookie=1'>Reset View</a>&nbsp;&nbsp;
434  </td></tr>";
435 
436 }
437 ?>