Odyssey
cuimage.prg
1 <?php
2 
3  $monLibrary= dirname(__FILE__) . "/../library";
4  $monIncludes= dirname(__FILE__) . "/../includes";
5  require_once("$monLibrary/cu_top.i");
6  require_once("$monLibrary/ck_hticket.i");
7  require_once("$monIncludes/cu_remote_top.prg");
8 
9  if (!CheckPerm($link, $Hu, basename($_SERVER['SCRIPT_NAME']), $_SERVER['REMOTE_ADDR'])) {
10  // ** Permissions failed
11  // ** redirect to new page
12  header("Location: /hcuadm/hcu_noperm.prg");
13  exit;
14  }
15 
16 $dms_ok=array('act'=>'string','addr1'=>'string', 'addr2'=>'string',
17 'city'=>'string', 'comments'=>'string', 'contact1'=>'string',
18 'contact2'=>'string', 'contact3'=>'string', 'datespec'=>'string',
19 'email1'=>'string', 'email2'=>'string', 'email3'=>'string', 'fax1'=>'string',
20 'fax2'=>'string', 'fax3'=>'string', 'form_err'=>'string', 'imgdesc'=>'string',
21 'img'=>'string', 'phone1'=>'string', 'phone2'=>'string', 'phone3'=>'string',
22 'role1'=>'string', 'role2'=>'string', 'role3'=>'string', 'Save'=>'string',
23 'st'=>'string', 'vc'=>'string', 'zip'=>'string','msg'=>'string','Remote_Update'=>'array');
24 dms_import($dms_ok);
25 
26 #case "1": // Edit Cu Image Vendors (vc=code sets edit mode, otherwise add)
27 #case "2": // Contacts list
28 #case "3": // Save add/change edits
29 #case "4": // Pop-up requirements list - all vendors
30 #case "5": // Pop-up requirements card - selected vendor
31 
32  if (!isset($act)) $act = "2";
33 
34  switch ($act):
35  case "1": // Edit Cu Image Vendors
36  cu_header("Edit CU Image Vendors");
37 ?>
38  <form action="cuimage.prg?act=3" method="post">
39  <?php
40  // Connect to the database - get the team information from the database
41  $num_rows = 0;
42  if (isset($vc)) {
43  $query = "select *
44  from cuimagevendors
45  where img = '$vc'";
46  $result = db_query($query, $link);
47  // Now fetch the row
48  $cuimage_row = db_fetch_object($result);
49  $num_rows = db_num_rows($result);
50  }
51  if (isset($form_err) && strlen($form_err) > 0)
52  printf("\n<font color=\"red\">Errors found before saving the information. Please review errors at bottom of screen.\n<p></font>");
53  ?>
54  <center>
55  <table cellpadding="3" cellspacing="0" border="0" width="50%" class="dmsbg"><tr><td>
56  <table cellpadding="1" cellspacing="0" border="0" bgcolor=white>
57  <tr>
58  <td colspan="4" class="bar" align="center">
59  <?php if($num_rows > 0): ?>
60  EDIT CU IMAGE VENDOR
61  <?php else: ?>
62  ADD CU IMAGE VENDOR
63  <?php endif; ?>
64  </td>
65  </tr>
66  <?php if (isset($msg)): ?>
67  <tr>
68  <td colspan="4" class="msg" align="center">
69  <?php echo $msg; ?>
70  </td>
71  </tr>
72  <?php endif; ?>
73  <tr>
74  <td nowrap align="right" class="hdr">
75  Image Code:
76  </td>
77  <td nowrap colspan="3" class='dtl'>
78  <?php
79  if ($num_rows > 0) {
80  $cu_info = htmlspecialchars(trim($cuimage_row->img));
81  } else {
82  $cu_info = isset($img) ? set_string($img) : "";
83  }
84  ?>
85  <input type="text" name="img" size="10" maxlength="10" value="<?php echo $cu_info ?>">
86  </td>
87  </tr>
88  <tr>
89  <td nowrap valign="top" align="right" class="hdr">
90  Name:
91  </td>
92  <td nowrap colspan="3" class='dtl'>
93  <?php
94  if ($num_rows > 0) {
95  $cu_info = htmlspecialchars(trim($cuimage_row->imgdesc));
96  } else {
97  $cu_info = isset($imgdesc) ? set_string($imgdesc) : "";
98  }
99  ?>
100  <input type="text" name="imgdesc" size="20" maxlength="30" value="<?php echo $cu_info ?>">
101  </td>
102  </tr>
103  <tr>
104  <td nowrap valign="top" align="right" class="hdr">
105  Address:
106  </td>
107  <td nowrap colspan="3" class='dtl'>
108  <?php
109  if ($num_rows > 0) {
110  $cu_info = htmlspecialchars(trim($cuimage_row->addr1));
111  } else {
112  $cu_info = isset($addr1) ? set_string($addr1) : "";
113  }
114  ?>
115  <input type="text" name="addr1" size="25" maxlength="40" value="<?php echo $cu_info ?>">
116  <br>
117  <?php
118  if ($num_rows > 0) {
119  $cu_info = htmlspecialchars(trim($cuimage_row->addr2));
120  } else {
121  $cu_info = isset($addr2) ? set_string($addr2) : "";
122  }
123  ?>
124  <input type="text" name="addr2" size="25" maxlength="40" value="<?php echo $cu_info ?>">
125  <br>
126  <?php
127  if ($num_rows > 0) {
128  $cu_info = htmlspecialchars(trim($cuimage_row->city));
129  } else {
130  $cu_info = isset($city) ? set_string($city) : "";
131  }
132  ?>
133  <input type="text" name="city" size="16" maxlength="25" value="<?php echo $cu_info ?>">
134  &nbsp;&nbsp;
135  <?php
136  if ($num_rows > 0) {
137  $cu_info = htmlspecialchars(trim($cuimage_row->st));
138  } else {
139  $cu_info = isset($st) ? set_string($st) : "";
140  }
141  ?>
142  <select name="st" size=1>
143  <OPTION VALUE="">&lt;Select&gt;
144  <OPTION VALUE="AL" <?php if ($cu_info == "AL")echo "SELECTED" ?>> Alabama
145  <OPTION VALUE="AK" <?php if ($cu_info == "AK")echo "SELECTED" ?>> Alaska
146  <OPTION VALUE="AZ" <?php if ($cu_info == "AZ")echo "SELECTED" ?>> Arizona
147  <OPTION VALUE="AR" <?php if ($cu_info == "AR")echo "SELECTED" ?>> Arkansas
148  <OPTION VALUE="CA" <?php if ($cu_info == "CA")echo "SELECTED" ?>> California
149  <OPTION VALUE="CO" <?php if ($cu_info == "CO")echo "SELECTED" ?>> Colorado
150  <OPTION VALUE="CT" <?php if ($cu_info == "CT")echo "SELECTED" ?>> Connecticut
151  <OPTION VALUE="DE" <?php if ($cu_info == "DE")echo "SELECTED" ?>> Delaware
152  <OPTION VALUE="DC" <?php if ($cu_info == "DC")echo "SELECTED" ?>> District of Columbia
153  <OPTION VALUE="FL" <?php if ($cu_info == "FL")echo "SELECTED" ?>> Florida
154  <OPTION VALUE="GA" <?php if ($cu_info == "GA")echo "SELECTED" ?>> Georgia
155  <OPTION VALUE="HI" <?php if ($cu_info == "HI")echo "SELECTED" ?>> Hawaii
156  <OPTION VALUE="ID" <?php if ($cu_info == "ID")echo "SELECTED" ?>> Idaho
157  <OPTION VALUE="IL" <?php if ($cu_info == "IL")echo "SELECTED" ?>> Illinois
158  <OPTION VALUE="IN" <?php if ($cu_info == "IN")echo "SELECTED" ?>> Indiana
159  <OPTION VALUE="IA" <?php if ($cu_info == "IA")echo "SELECTED" ?>> Iowa
160  <OPTION VALUE="KS" <?php if ($cu_info == "KS")echo "SELECTED" ?>> Kansas
161  <OPTION VALUE="KY" <?php if ($cu_info == "KY")echo "SELECTED" ?>> Kentucky
162  <OPTION VALUE="LA" <?php if ($cu_info == "LA")echo "SELECTED" ?>> Louisiana
163  <OPTION VALUE="ME" <?php if ($cu_info == "ME")echo "SELECTED" ?>> Maine
164  <OPTION VALUE="MD" <?php if ($cu_info == "MD")echo "SELECTED" ?>> Maryland
165  <OPTION VALUE="MA" <?php if ($cu_info == "MA")echo "SELECTED" ?>> Massachusetts
166  <OPTION VALUE="MI" <?php if ($cu_info == "MI")echo "SELECTED" ?>> Michigan
167  <OPTION VALUE="MN" <?php if ($cu_info == "MN")echo "SELECTED" ?>> Minnesota
168  <OPTION VALUE="MS" <?php if ($cu_info == "MS")echo "SELECTED" ?>> Mississippi
169  <OPTION VALUE="MO" <?php if ($cu_info == "MO")echo "SELECTED" ?>> Missouri
170  <OPTION VALUE="MT" <?php if ($cu_info == "MT")echo "SELECTED" ?>> Montana
171  <OPTION VALUE="NE" <?php if ($cu_info == "NE")echo "SELECTED" ?>> Nebraska
172  <OPTION VALUE="NV" <?php if ($cu_info == "NV")echo "SELECTED" ?>> Nevada
173  <OPTION VALUE="NH" <?php if ($cu_info == "NH")echo "SELECTED" ?>> New Hampshire
174  <OPTION VALUE="NJ" <?php if ($cu_info == "NJ")echo "SELECTED" ?>> New Jersey
175  <OPTION VALUE="NM" <?php if ($cu_info == "NM")echo "SELECTED" ?>> New Mexico
176  <OPTION VALUE="NY" <?php if ($cu_info == "NY")echo "SELECTED" ?>> New York
177  <OPTION VALUE="NC" <?php if ($cu_info == "NC")echo "SELECTED" ?>> North Carolina
178  <OPTION VALUE="ND" <?php if ($cu_info == "ND")echo "SELECTED" ?>> North Dakota
179  <OPTION VALUE="OH" <?php if ($cu_info == "OH")echo "SELECTED" ?>> Ohio
180  <OPTION VALUE="OK" <?php if ($cu_info == "OK")echo "SELECTED" ?>> Oklahoma
181  <OPTION VALUE="OR" <?php if ($cu_info == "OR")echo "SELECTED" ?>> Oregon
182  <OPTION VALUE="PA" <?php if ($cu_info == "PA")echo "SELECTED" ?>> Pennsylvania
183  <OPTION VALUE="RI" <?php if ($cu_info == "RI")echo "SELECTED" ?>> Rhode Island
184  <OPTION VALUE="SC" <?php if ($cu_info == "SC")echo "SELECTED" ?>> South Carolina
185  <OPTION VALUE="SD" <?php if ($cu_info == "SD")echo "SELECTED" ?>> South Dakota
186  <OPTION VALUE="TN" <?php if ($cu_info == "TN")echo "SELECTED" ?>> Tennessee
187  <OPTION VALUE="TX" <?php if ($cu_info == "TX")echo "SELECTED" ?>> Texas
188  <OPTION VALUE="UT" <?php if ($cu_info == "UT")echo "SELECTED" ?>> Utah
189  <OPTION VALUE="VT" <?php if ($cu_info == "VT")echo "SELECTED" ?>> Vermont
190  <OPTION VALUE="VA" <?php if ($cu_info == "VA")echo "SELECTED" ?>> Virginia
191  <OPTION VALUE="WA" <?php if ($cu_info == "WA")echo "SELECTED" ?>> Washington
192  <OPTION VALUE="WV" <?php if ($cu_info == "WV")echo "SELECTED" ?>> West Virginia
193  <OPTION VALUE="WI" <?php if ($cu_info == "WI")echo "SELECTED" ?>> Wisconsin
194  <OPTION VALUE="WY" <?php if ($cu_info == "WY")echo "SELECTED" ?>> Wyoming
195  <OPTION VALUE="VI" <?php if ($cu_info == "VI")echo "SELECTED" ?>> U.S. Virgin Islands
196  </select>
197  &nbsp;&nbsp;&nbsp;
198  <?php
199  if ($num_rows > 0) {
200  $cu_info = htmlspecialchars(trim($cuimage_row->zip));
201  } else {
202  $cu_info = isset($zip) ? set_string($zip) : "";
203  }
204  ?>
205  <input type="text" name="zip" size="10" maxlength="15" value="<?php echo $cu_info ?>">
206  </td>
207  </tr>
208  <tr>
209  <td nowrap align="center" class='dtl'>
210  &nbsp;
211  </td>
212  <td nowrap align="center" class="dtl">
213  1st Contact:
214  </td>
215  <td nowrap align="center" class="dtl">
216  2nd Contact:
217  </td>
218  <td nowrap align="center" class="dtl">
219  3rd Contact:
220  </td>
221  </tr>
222  <tr>
223  <td nowrap align="right" class="hdr">
224  Contact:
225  </td>
226  <td nowrap class='dtl'>
227  <?php
228  if ($num_rows > 0) {
229  $cu_info = htmlspecialchars(trim($cuimage_row->contact1));
230  } else {
231  $cu_info = isset($contact1) ? set_string($contact1) : "";
232  }
233  ?>
234  <input type="text" name="contact1" size="24" maxlength="40" value="<?php echo $cu_info ?>">
235  </td>
236  <td nowrap class='dtl'>
237  <?php
238  if ($num_rows > 0) {
239  $cu_info = htmlspecialchars(trim($cuimage_row->contact2));
240  } else {
241  $cu_info = isset($contact2) ? set_string($contact2) : "";
242  }
243  ?>
244  <input type="text" name="contact2" size="24" maxlength="40" value="<?php echo $cu_info ?>">
245  </td>
246  <td nowrap class='dtl'>
247  <?php
248  if ($num_rows > 0) {
249  $cu_info = htmlspecialchars(trim($cuimage_row->contact3));
250  } else {
251  $cu_info = isset($contact3) ? set_string($contact3) : "";
252  }
253  ?>
254  <input type="text" name="contact3" size="24" maxlength="40" value="<?php echo $cu_info ?>">
255  </td>
256  </tr>
257  <tr>
258  <td nowrap align="right" class="hdr">
259  Email:
260  </td>
261  <td nowrap class='dtl' >
262  <?php
263  if ($num_rows > 0) {
264  $cu_info = htmlspecialchars(trim($cuimage_row->email1));
265  } else {
266  $cu_info = isset($email1) ? set_string($email1) : "";
267  }
268  ?>
269  <input type="text" name="email1" size="24" maxlength="50" value="<?php echo $cu_info ?>">
270  </td>
271  <td nowrap class='dtl'>
272  <?php
273  if ($num_rows > 0) {
274  $cu_info = htmlspecialchars(trim($cuimage_row->email2));
275  } else {
276  $cu_info = isset($email2) ? set_string($email2) : "";
277  }
278  ?>
279  <input type="text" name="email2" size="24" maxlength="50" value="<?php echo $cu_info ?>">
280  </td>
281  <td nowrap class='dtl'>
282  <?php
283  if ($num_rows > 0) {
284  $cu_info = htmlspecialchars(trim($cuimage_row->email3));
285  } else {
286  $cu_info = isset($email3) ? set_string($email3) : "";
287  }
288  ?>
289  <input type="text" name="email3" size="24" maxlength="50" value="<?php echo $cu_info ?>">
290  </td>
291  </tr>
292  <tr>
293  <td nowrap align="right" class="hdr">
294  Phone:
295  </td>
296  <td nowrap class='dtl'>
297  <?php
298  if ($num_rows > 0) {
299  $cu_info = htmlspecialchars(trim($cuimage_row->phone1));
300  } else {
301  $cu_info = isset($phone1) ? set_string($phone1) : "";
302  }
303  ?>
304  <input type="text" name="phone1" size="15" maxlength="20" value="<?php echo $cu_info ?>">
305  </td>
306  <td nowrap class='dtl'>
307  <?php
308  if ($num_rows > 0) {
309  $cu_info = htmlspecialchars(trim($cuimage_row->phone2));
310  } else {
311  $cu_info = isset($phone2) ? set_string($phone2) : "";
312  }
313  ?>
314  <input type="text" name="phone2" size="15" maxlength="20" value="<?php echo $cu_info ?>">
315  </td>
316  <td nowrap class='dtl'>
317  <?php
318  if ($num_rows > 0) {
319  $cu_info = htmlspecialchars(trim($cuimage_row->phone3));
320  } else {
321  $cu_info = isset($phone3) ? set_string($phone3) : "";
322  }
323  ?>
324  <input type="text" name="phone3" size="15" maxlength="20" value="<?php echo $cu_info ?>">
325  </td>
326  </tr>
327  <tr>
328  <td nowrap align="right" class="hdr">
329  Fax:
330  </td>
331  <td nowrap class='dtl'>
332  <?php
333  if ($num_rows > 0) {
334  $cu_info = htmlspecialchars(trim($cuimage_row->fax1));
335  } else {
336  $cu_info = isset($fax1) ? set_string($fax1) : "";
337  }
338  ?>
339  <input type="text" name="fax1" size="15" maxlength="20" value="<?php echo $cu_info ?>">
340  </td>
341  <td nowrap class='dtl'>
342  <?php
343  if ($num_rows > 0) {
344  $cu_info = htmlspecialchars(trim($cuimage_row->fax2));
345  } else {
346  $cu_info = isset($fax2) ? set_string($fax2) : "";
347  }
348  ?>
349  <input type="text" name="fax2" size="15" maxlength="20" value="<?php echo $cu_info ?>">
350  </td>
351  <td nowrap class='dtl'>
352  <?php
353  if ($num_rows > 0) {
354  $cu_info = htmlspecialchars(trim($cuimage_row->fax3));
355  } else {
356  $cu_info = isset($fax3) ? set_string($fax3) : "";
357  }
358  ?>
359  <input type="text" name="fax3" size="15" maxlength="20" value="<?php echo $cu_info ?>">
360  </td>
361  </tr>
362  <tr>
363  <td nowrap align="right" class="hdr">
364  Role:
365  </td>
366  <td nowrap class='dtl'>
367  <?php
368  if ($num_rows > 0) {
369  $cu_info = htmlspecialchars(trim($cuimage_row->role1));
370  } else {
371  $cu_info = isset($role1) ? set_string($role1) : "";
372  }
373  ?>
374  <input type="text" name="role1" size="24" maxlength="40" value="<?php echo $cu_info ?>">
375  </td>
376  <td nowrap class='dtl'>
377  <?php
378  if ($num_rows > 0) {
379  $cu_info = htmlspecialchars(trim($cuimage_row->role2));
380  } else {
381  $cu_info = isset($role2) ? set_string($role2) : "";
382  }
383  ?>
384  <input type="text" name="role2" size="24" maxlength="40" value="<?php echo $cu_info ?>">
385  </td>
386  <td nowrap class='dtl'>
387  <?php
388  if ($num_rows > 0) {
389  $cu_info = htmlspecialchars(trim($cuimage_row->role3));
390  } else {
391  $cu_info = isset($role3) ? set_string($role3) : "";
392  }
393  ?>
394  <input type="text" name="role3" size="24" maxlength="40" value="<?php echo $cu_info ?>">
395  </td>
396  </tr>
397  <tr>
398  <td colspan="4" class='dtl'>
399  <hr>
400  </td>
401  </tr>
402  <tr>
403  <td nowrap align="right" class="hdr" valign="top">
404  Comments:
405  </td>
406  <td nowrap colspan="3" class='dtl'>
407  <?php
408  if ($num_rows > 0) {
409  $cu_info = htmlspecialchars(trim($cuimage_row->comments));
410  } else {
411  $cu_info = isset($comments) ? set_string($comments) : "";
412  }
413  ?>
414  <textarea name="comments" rows=3 cols=65 wrap="physical"><?php echo $cu_info; ?></textarea>
415  </td>
416  </tr>
417  <tr>
418  <td nowrap align="right" class="hdr" valign="top">
419  Corp Requires:
420  </td>
421  <td nowrap colspan="3" class='dtl'>
422  <?php
423  if ($num_rows > 0) {
424  $cu_info = htmlspecialchars(trim($cuimage_row->datespec));
425  } else {
426  $cu_info = isset($datespec) ? set_string($datespec) : "";
427  }
428  ?>
429  <textarea name="datespec" rows=3 cols=65 wrap="physical"><?php echo $cu_info; ?></textarea>
430  </td>
431  </tr>
432  <tr>
433  <td class='dtl'>&nbsp;</td>
434  <td nowrap class='dtl' colspan='3'>
435  <?php remote_update_list(); ?>
436  </td>
437  </tr>
438  <tr>
439  <td nowrap colspan="4" align="center" class='dtl'>
440  <input type="submit" name="Save" Value="Save">&nbsp;&nbsp;
441  <input type="button" name="Cancel" Value="Cancel" onClick="document.location='cuimage.prg'">
442  </td>
443  </table>
444 
445  <?php // If the error value is here then print it at the end
446  if (isset($form_err))
447  {
448  echo $form_err;
449  echo "<hr>";
450  }
451  echo "</td></tr></table>";
452  break;
453  case "2":
454  cu_header("CU Image Vendors");
455  ?>
456  <form>
457 
458  <?php
459  // Connect to the data and retrieve the current list of Image vendors
460  $query = "SELECT * FROM cuimagevendors ORDER BY img";
461  $prod_result = db_query($query, $link);
462 
463  ?>
464 
465  <!-- Print out the top of the table -->
466 
467  <table border="0" cellpadding="3" cellspacing="0" align="center" width="50%" class="dmsbg"><tr><td>
468  <table border="0" cellpadding="1" cellspacing="0" align="center" bgcolor=white>
469  <tr>
470  <td colspan="4" class="bar" align="center">
471  CU IMAGE VENDORS LIST
472  </td>
473  </tr>
474  <?php if (isset($msg)): ?>
475  <tr>
476  <td colspan="4" class="msg" align="center">
477  <?php echo $msg; ?>
478  </td>
479  </tr>
480  <?php endif; ?>
481  <tr>
482  <td class="hdr" align="left">
483  CU Image Vendor
484  </td>
485  <td class="hdr" align="left">
486  Name
487  </td>
488  <td class="hdr" align="left">
489  Contact
490  </td>
491  <td class="hdr" align="left">
492  Phone
493  </td>
494  </tr>
495  <?php
496  $RGB = "odd";
497  $row = 0;
498  while ($prod_row = db_fetch_object($prod_result, $row)):
499  $row++;
500  ?>
501  <tr class="<?php echo $RGB; ?>">
502  <td class='usul' nowrap >
503  <a href="cuimage.prg?act=1&vc=<?php echo trim($prod_row->img) ?>"><?php echo trim($prod_row->img) ?></a>
504  </td>
505  <td class='usul' nowrap >
506  <?php echo trim($prod_row->imgdesc) ?>
507  </td>
508  <td class='usul' nowrap>
509  <?php echo trim($prod_row->contact1) ?>
510  </td>
511  <td class='usul' nowrap>
512  <?php echo trim($prod_row->phone1) ?>
513  </td>
514  </tr>
515  <?php
516  $RGB = ($RGB == "odd" ? "even" : "odd");
517  endwhile; ?>
518 
519  <tr>
520  <td>&nbsp;</td>
521  <td colspan="3">
522  <a href="cuimage.prg?act=1" >Add CU Image Vendor</a>
523  &nbsp;|&nbsp;
524  <a href="cuimage.prg?act=4">Corporate Requirements List</a>
525  <!--&nbsp;|&nbsp;
526  <a href="<?php echo $infourl ?>/hcuadm/cuilist.prg" target="parent">Credit Union List</a>-->
527  </td>
528  </tr>
529  </table>
530  </td></tr></table>
531 <?php
532  break;
533  case "3":
534  cu_header("Save Image Vendor");
535  // Setup a function to go back to the CU Edit form, if anything went wrong
536  function save_fail($msg){
537  global $img;
538  printf("<script language=\"javascript\">\n");
539  printf("document.forms[0].elements[\"form_err\"].value = '%s';\n", $msg);
540  printf("document.forms[0].action=\"cuimage.prg?act=1&vc=%s\";\n", $img);
541  printf("document.forms[0].method=\"post\";\n");
542  printf("document.forms[0].submit();\n");
543  printf("</script>");
544  printf("\n</form>\n </body>\n </html>\n");
545  exit();
546  }
547 
548  ?>
549 
550  <form action="cuimage.prg?act=1" method="post">
551  <?php
552  $errors_found = "No";
553  $err_msg = "";
554 
555 
556  /* VALIDATE THE INFORMATION - whether it's been saved before or NOT
557  After validation fails it will send the information back to the edit form
558  So it looks like it did before, the fail information will be at the bottom of the
559  screen.
560 
561  */
562  $err_msg="";
563 
564  // Now we need to load all the fields from the CU form, and post them back
565  // So the user does not have to press the back button.
566  // Load all the Fields from the previous form into hidden fields on this form
567  ?>
568  <!-- LOAD ALL HIDDEN FIELDS -->
569 
570  <!-- Description -->
571  <input type="hidden" name="img" value="<?php echo set_string($img) ?>">
572  <input type="hidden" name="imgdesc" value="<?php echo set_string($imgdesc) ?>">
573  <input type="hidden" name="addr1" value="<?php echo set_string($addr1) ?>">
574  <input type="hidden" name="addr2" value="<?php echo set_string($addr2) ?>">
575  <input type="hidden" name="city" value="<?php echo set_string($city) ?>">
576  <input type="hidden" name="st" value="<?php echo set_string($st) ?>">
577  <input type="hidden" name="zip" value="<?php echo set_string($zip) ?>">
578  <input type="hidden" name="contact1" value="<?php echo set_string($contact1) ?>">
579  <input type="hidden" name="email1" value="<?php echo set_string($email1) ?>">
580  <input type="hidden" name="phone1" value="<?php echo set_string($phone1) ?>">
581  <input type="hidden" name="fax1" value="<?php echo set_string($fax1) ?>">
582  <input type="hidden" name="role1" value="<?php echo set_string($role1) ?>">
583  <input type="hidden" name="contact2" value="<?php echo set_string($contact2) ?>">
584  <input type="hidden" name="email2" value="<?php echo set_string($email2) ?>">
585  <input type="hidden" name="phone2" value="<?php echo set_string($phone2) ?>">
586  <input type="hidden" name="fax2" value="<?php echo set_string($fax2) ?>">
587  <input type="hidden" name="role2" value="<?php echo set_string($role2) ?>">
588  <input type="hidden" name="contact3" value="<?php echo set_string($contact3) ?>">
589  <input type="hidden" name="email3" value="<?php echo set_string($email3) ?>">
590  <input type="hidden" name="phone3" value="<?php echo set_string($phone3) ?>">
591  <input type="hidden" name="fax3" value="<?php echo set_string($fax3) ?>">
592  <input type="hidden" name="role3" value="<?php echo set_string($role3) ?>">
593  <input type="hidden" name="comments" value="<?php echo set_string($comments) ?>">
594 
595  <!-- Create a hidden field for the form error -->
596  <input type="hidden" name="form_err" value="">
597 
598  <?php if (strlen($err_msg) > 0): ?>
599  <?php
600  //If an error was found post the information back to the CU edit form here
601  $form_err = sprintf("<font size=\"+1\">ERROR! Problems with the credit union information found: <BR></font>");
602  $form_err .= sprintf("The following errors will need to be corrected before you will be allowed to save the form.");
603  $form_err .= sprintf("<P> <font color=red>%s</font>", $err_msg);
604  save_fail($form_err);
605  ?>
606  <?php else: ?>
607 
608  <?php
609  // Everything was validated, we now need to save the information, either insert for new or update for edited.
610 
611  $save_sql = "SELECT img FROM cuimagevendors WHERE img = '$img'";
612  // Execute the query and find out how many rows are in the query
613  $db_result = db_query($save_sql, $link);
614 
615  $num_rows = db_num_rows($db_result);
616  if ($num_rows > 0 ) {
617  // UPDATE the information into the table
618  $qry_stmt = sprintf("UPDATE cuimagevendors ");
619  $qry_stmt .= sprintf("SET imgdesc ='%s', ",prep_save($imgdesc));
620  $qry_stmt .= sprintf("addr1 ='%s', ",prep_save($addr1));
621  $qry_stmt .= sprintf("addr2 ='%s', ",prep_save($addr2));
622  $qry_stmt .= sprintf("city ='%s', ",prep_save($city));
623  $qry_stmt .= sprintf("st ='%s', ",prep_save($st));
624  $qry_stmt .= sprintf("zip ='%s', ",prep_save($zip));
625  $qry_stmt .= sprintf("contact1 ='%s', ",prep_save($contact1));
626  $qry_stmt .= sprintf("email1 ='%s', ",prep_save($email1));
627  $qry_stmt .= sprintf("phone1 ='%s', ",prep_save($phone1));
628  $qry_stmt .= sprintf("fax1 ='%s', ",prep_save($fax1));
629  $qry_stmt .= sprintf("role1 ='%s', ",prep_save($role1));
630  $qry_stmt .= sprintf("contact2 ='%s', ",prep_save($contact2));
631  $qry_stmt .= sprintf("email2 ='%s', ",prep_save($email2));
632  $qry_stmt .= sprintf("phone2 ='%s', ",prep_save($phone2));
633  $qry_stmt .= sprintf("fax2 ='%s', ",prep_save($fax2));
634  $qry_stmt .= sprintf("role2 ='%s', ",prep_save($role2));
635  $qry_stmt .= sprintf("contact3 ='%s', ",prep_save($contact3));
636  $qry_stmt .= sprintf("email3 ='%s', ",prep_save($email3));
637  $qry_stmt .= sprintf("phone3 ='%s', ",prep_save($phone3));
638  $qry_stmt .= sprintf("fax3 ='%s', ",prep_save($fax3));
639  $qry_stmt .= sprintf("role3 ='%s', ",prep_save($role3));
640  $qry_stmt .= sprintf("comments = '%s', ", prep_save($comments));
641  $qry_stmt .= sprintf("datespec = '%s' ", prep_save($datespec));
642  $qry_stmt .= sprintf("WHERE img = '%s'; ",$img);
643  } else {
644  $qry_stmt = sprintf("INSERT INTO cuimagevendors ");
645  $qry_stmt .= sprintf("(img, imgdesc, addr1, addr2, city, st, zip,");
646  $qry_stmt .= sprintf(" contact1, email1, phone1, fax1, role1,");
647  $qry_stmt .= sprintf(" contact2, email2, phone2, fax2, role2,");
648  $qry_stmt .= sprintf(" contact3, email3, phone3, fax3, role3,");
649  $qry_stmt .= sprintf(" comments, datespec) ");
650  $qry_stmt .= sprintf(" VALUES (");
651  $qry_stmt .= sprintf("'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'); ",
652  strtoupper(prep_save($img)),
653  prep_save($imgdesc),
654  prep_save($addr1),
655  prep_save($addr2),
656  prep_save($city),
657  prep_save($st),
658  prep_save($zip),
659  prep_save($contact1),
660  prep_save($email1),
661  prep_save($phone1),
662  prep_save($fax1),
663  prep_save($role1),
664  prep_save($contact2),
665  prep_save($email2),
666  prep_save($phone2),
667  prep_save($fax2),
668  prep_save($role2),
669  prep_save($contact3),
670  prep_save($email3),
671  prep_save($phone3),
672  prep_save($fax3),
673  prep_save($role3),
674  prep_save($comments),
675  prep_save($datespec));
676  }
677  // Now pass the query to the Database
678  if (!($db_result=db_query($qry_stmt, $link))) {
679  // A problem was encoutered with saving the data - report the message
680  $form_err = sprintf("<br>");
681  $form_err .= sprintf("<font face=\"Arial\" size=\"2\">Unable to Save Home CU Image Vendor!</font><br>");
682  save_fail($form_err);
683  } else {
684  printError(sprintf("Image Vendor Saved Successfully.<br>
685  <a href=\"cuimage.prg?act=2\" target=\"CONTENT\">CU Image Vendor List</a>"));
686 
687  // Only need to do this if at least one remote server was selected
688  if (Remote_Update_Selected()) {
689  // ** NOW CHECK FOR SAVING TO A REMOTE SERVER
690  // ** Add Each field that will be updated
691  Remote_Field_Add("cuimgvnd", "imgcode", $img);
692  Remote_Field_Add("cuimgvnd", "imgdesc", $imgdesc);
693  Remote_Field_Add("cuimgvnd", "imgaddr1", $addr1);
694  Remote_Field_Add("cuimgvnd", "imgaddr2", $addr2);
695  Remote_Field_Add("cuimgvnd", "imgcity", $city);
696  Remote_Field_Add("cuimgvnd", "imgst", $st);
697  Remote_Field_Add("cuimgvnd", "imgzip", $zip);
698  Remote_Field_Add("cuimgvnd", "imgcnt1", $contact1);
699  Remote_Field_Add("cuimgvnd", "imgrol1", $role1);
700  Remote_Field_Add("cuimgvnd", "imgphn1", $phone1);
701  Remote_Field_Add("cuimgvnd", "imgem1", $email1);
702  Remote_Field_Add("cuimgvnd", "imgfx1", $fax1);
703  Remote_Field_Add("cuimgvnd", "imgcnt2", $contact2);
704  Remote_Field_Add("cuimgvnd", "imgrol2", $role2);
705  Remote_Field_Add("cuimgvnd", "imgphn2", $phone2);
706  Remote_Field_Add("cuimgvnd", "imgem2", $email2);
707  Remote_Field_Add("cuimgvnd", "imgfx2", $fax2);
708  Remote_Field_Add("cuimgvnd", "imgcnt3", $contact3);
709  Remote_Field_Add("cuimgvnd", "imgrol3", $role3);
710  Remote_Field_Add("cuimgvnd", "imgphn3", $phone3);
711  Remote_Field_Add("cuimgvnd", "imgem3", $email3);
712  Remote_Field_Add("cuimgvnd", "imgfx3", $fax3);
713  Remote_Field_Add("cuimgvnd", "imgcomm", $comments);
714  Remote_Field_Add("cuimgvnd", "imgdate", $datespec);
715 
716 
717  // ** Need to create the url I am going to send to the remote server
718  $Remote_Results = Remote_Update_Send("U", "cuimgvnd");
719  }
720  }
721  header ("Location: " . $_SERVER['PHP_SELF'] . "?msg=" . urlencode($Remote_Results));
722 
723 
724  /*
725  print <<< js
726  <script language="javascript">
727  document.location = "cuimage";
728  </script>
729 js;
730 */
731  ?>
732  <?php endif; ?>
733 
734  <?php
735  break;
736  case "4":
737 # display corporate requirements list for monitor pop-up help
738  cu_header("CU Image Vendors");
739  ?>
740  <form>
741 
742  <?php
743  // Connect to the data and retrieve the current list of Image vendors
744  $query = "SELECT * FROM cuimagevendors ORDER BY img";
745  $prod_result = db_query($query, $link);
746 
747  ?>
748 
749  <!-- Print out the top of the table -->
750 
751  <table border="0" cellpadding="3" cellspacing="0" align="center" width="80%" clas="dmsbg"><tr><td>
752  <table border="0" cellpadding="1" cellspacing="0" align="center" bgcolor=white>
753  <tr>
754  <td colspan="3" class="bar" align="center">
755  CU IMAGE VENDORS REQUIREMENTS
756  </td>
757  </tr>
758  <tr>
759  <td class="hdr" align="left" width="17%">
760  CU Image Vendor
761  </td>
762  <td class="hdr" align="left" width="35%">
763  Name
764  </td>
765  <td class="hdr" align="left" width="*">
766  Requirements
767  </td>
768  </tr>
769  <?php
770  $RGB = "odd";
771  $row = 0;
772  while ($prod_row = db_fetch_object($prod_result, $row)):
773  $row++;
774  ?>
775  <tr class="<?php echo $RGB; ?>">
776  <td class='usul' nowrap>
777  <a href="cuimage.prg?act=1&vc=<?php echo trim($prod_row->img) ?>"><?php echo trim($prod_row->img) ?></a>
778  </td>
779  <td class='usul'>
780  <?php echo trim($prod_row->imgdesc) ?>
781  </td>
782  <td class='usul'>
783  <?php echo trim($prod_row->datespec) ?>
784  </td>
785  </tr>
786  <?php
787  $RGB = ($RGB == "odd" ? "even" : "odd");
788  endwhile; ?>
789  <tr>
790  <td>&nbsp;</td>
791  <td colspan="2">
792  <a href="cuimage.prg?act=2">CU Image Vendors List</a>
793  </td>
794  </tr>
795 
796  </table>
797  </td></tr></table>
798  <?php
799 
800  break;
801  case "5":
802 # display corporate requirements & contact card for monitor pop-up help
803  cu_header("CU Image Vendors");
804  ?>
805  <form>
806 
807  <?php
808  // Connect to the data and retrieve the current list of Image vendors
809  $query = "SELECT * FROM cuimagevendors where img='$vc'";
810  $prod_result = db_query($query, $link);
811 
812  $prod_row = db_fetch_object($prod_result, 0);
813 
814  ?>
815 
816  <!-- Print out the top of the table -->
817 
818  <table border="0" cellpadding="3" cellspacing="0" align="center" width="80%" class="dmsbg"><tr><td>
819  <table border="0" cellpadding="1" cellspacing="0" align="center" bgcolor='white' width='100%'>
820  <tr>
821  <td colspan="4" class="bar" align="center">
822  CU IMAGE VENDOR <?php echo $vc; ?>
823  </td>
824  </tr>
825  <tr class="dtll">
826  <td class='usul' nowrap>
827  <a href="cuimage.prg?act=1&vc=<?php echo trim($prod_row->img) ?>"><?php echo trim($prod_row->img) ?></a>
828  </td>
829  <td class='usul'>
830  <?php echo trim($prod_row->imgdesc) ?>
831  </td>
832  <td class='usul'>
833  <?php echo trim($prod_row->contact1) ?>
834  </td>
835  <td class='usul'>
836  <?php echo trim($prod_row->phone1) ?>
837  </td>
838  </tr>
839  <tr>
840  <td colspan='4' class='usul'>
841  <?php echo trim($prod_row->comments) ?>
842  </td>
843  </tr>
844  <tr>
845  <td colspan='4' class='usul' align='center'>
846  <hr width='80%'>
847  </td>
848  </tr>
849  <tr>
850  <td colspan='4' class='usul'>
851  <?php echo trim($prod_row->datespec) ?>
852  </td>
853  </tr>
854  <tr>
855  <td colspan="4" class='dtlr'>
856  <a href="cuimage.prg?act=4">Show All Image Vendors</a>
857  </td>
858  </tr>
859  </table>
860  </td></tr></table>
861  <?php
862 
863  break;
864  default:
865  cu_header("Error Displaying Form");
866  print ("<form>");
867  printError("Requested form not found!<br>Cancelling action.");
868  endswitch;
869  ?>
870  </form>
871  </body>
872 </html>
873