/[libdata]/trunk/admin/include/forms.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/admin/include/forms.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 71 by dpavlin, Thu Mar 4 22:43:50 2004 UTC revision 72 by dpavlin, Thu Mar 18 20:33:37 2004 UTC
# Line 1  Line 1 
1  <?php  <?php
2  /**********************************************************  /**********************************************************
3  Function Library: forms.php  Function Library: forms.php
4  Original Author: Paul Bramscher <brams006@tc.umn.edu>  Original Author: Paul Bramscher <brams006@umn.edu>
5  Last Modified: 11.06.2003 by Paul Bramscher  Last Modified: 03.16.2004 by Paul Bramscher
6  ***********************************************************  ***********************************************************
7  Comments:  Comments:
8  Functions here include most data-entry forms.  Note that  Functions here include most data-entry forms.  Note that
# Line 35  formAssignSubMaster Line 35  formAssignSubMaster
35  formAssignSubOtherSub  formAssignSubOtherSub
36  formAssignSubPage  formAssignSubPage
37  formAssignSubStaff  formAssignSubStaff
 formEditSingleField  
38  formCoursesub  formCoursesub
39    formEditSingleField
40  formFaculty  formFaculty
41  formFeature  formFeature
42  formInfotype  formInfotype
# Line 49  formService Line 49  formService
49  formStaff  formStaff
50  formStyle  formStyle
51  formSubject  formSubject
52    formVendor
53  **********************************************************/  **********************************************************/
54    
55    
56  /**********************************************************  /**********************************************************
57    Function: formAssignLibunitStaff
58    Author: Paul Bramscher
59    Last Modified: 03.10.2004
60    ***********************************************************
61    Purpose:
62    Assigns staff (possibly multiple) to a given library unit.
63    **********************************************************/
64    function formAssignLibunitStaff($libunit_id){
65                    
66            // Table definition
67            printf("<br><table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n");
68    
69            // Form
70            printf("<form method = \"POST\" action = \"assign.phtml\" >\n");
71            printf("<input type = \"Hidden\" name = \"libunit_id\" value = \"%d\" >\n", $libunit_id);
72            printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignLibunitStaff\" >\n");
73            
74            // Available staff
75            // Omit the '(N/A)' staff
76            $omit_string = "WHERE staff_id > 1";
77                    
78            // Omit any pre-selected staff in libunit_staff
79            $in_string = getNotIn("staff_id", "libunit_id", $libunit_id, "libunit_staff");
80            if (strlen($in_string) > 0) $omit_string .= " AND staff_id NOT IN " . $in_string;
81            
82            // Draw the box
83            printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
84            printf("Assign Staff to Library Unit");
85            printf("</td></tr>\n");
86            printf("<tr><td valign = \"top\" >\n");
87            printf("<br><b>Available Staff:<br></b>\n");
88            printf("<select name = \"staff_id_array[]\" multiple size = \"5\" >\n");
89            dropDownStaffOmit($omit_string);
90            printf("</select><br><br>\n");  
91    
92            // Close off form
93            printf("<center>\n");
94            printf("<input type = \"Submit\" value = \" >> \" >\n");
95            printf("</form>\n");
96            printf("</center>\n");
97            printf("</td>\n");
98    
99            // Current staff
100            printf("<td valign = \"top\" >\n");
101            printf("<form method = \"POST\" action = \"delete.phtml\" >\n");
102            printf("<input type = \"Hidden\" name = \"libunit_id\" value = \"%d\" >\n", $libunit_id);
103            printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteLibunitStaff\" >\n");
104            printf("<br><b>Selected Staff:</b><br>\n");
105            printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n");
106    
107            $sql = "SELECT s.staff_id, s.last_name, s.first_name FROM
108                    staff s,
109                    libunit_staff ls
110                    WHERE
111                    ls.libunit_id = " . $libunit_id . " AND
112                    s.staff_id = ls.staff_id
113                    ORDER BY last_name, first_name";
114            $rs = xx_tryquery($sql);
115            
116            while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
117                    $first_name = $row["first_name"];
118                    $last_name = $row["last_name"];
119                    $staff_id = $row["staff_id"];
120                    printf("<option value = \"%d\">%s, %s</option>\n", $staff_id, $last_name, $first_name);
121            }
122    
123            printf("</select><br><br>\n");
124            printf("<center>\n");  
125            printf("<input type = \"Submit\" value =\" << \">\n");
126            printf("</center>\n");
127            printf("</form>\n");
128            printf("</td></tr>\n");
129    
130            // Close off table
131            printf("</td></tr></table>\n");
132    
133    }
134    
135    
136    /**********************************************************
137  Function: formAssignResFeature  Function: formAssignResFeature
138  Author: Paul Bramscher  Author: Paul Bramscher
139  Last Modified: 07.03.2003  Last Modified: 03.10.2004
140  ***********************************************************  ***********************************************************
141  Purpose:  Purpose:
142  Draws an HTML combo box with multiple selection capability  Draws an HTML combo box with multiple selection capability
143  to assign features to the supplied resource id.    to assign features to the supplied resource id.  
144  **********************************************************/  **********************************************************/
145  function formAssignResFeature($con, $resource_id){  function formAssignResFeature($resource_id){
146                                    
147          // Table definition          // Table definition
148          printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >");          printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >\n");
149    
150          // Form of available features to select          // Form of available features to select
151          printf("<form method = \"POST\" action = \"assign.phtml#ResFea\" >");          printf("<form method = \"POST\" action = \"assign.phtml#ResFea\" >\n");
152          printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >", $resource_id);          printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >\n", $resource_id);
153          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignResFeature\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignResFeature\" >\n");
154    
155          // Omit the '(N/A)' feature          // Omit the '(N/A)' feature
156          $omit_string = "WHERE feature_id > 1";          $omit_string = "WHERE feature_id > 1";
157                                    
158          // Omit any pre-selected features in res_feature          // Omit any pre-selected features in res_feature
159          $in_string = getNotIn($con, "feature_id", "resource_id", $resource_id, "res_feature");          $in_string = getNotIn("feature_id", "resource_id", $resource_id, "res_feature");
160          if (strlen($in_string) > 0) $omit_string .= " AND feature_id NOT IN " . $in_string;          if (strlen($in_string) > 0) $omit_string .= " AND feature_id NOT IN " . $in_string;
161                    
162          // Draw the combo box          // Draw the combo box
# Line 83  function formAssignResFeature($con, $res Line 164  function formAssignResFeature($con, $res
164          printf("Assign Features");          printf("Assign Features");
165          printf("</td></tr>\n");          printf("</td></tr>\n");
166          printf("<tr><td valign = \"top\" >\n");          printf("<tr><td valign = \"top\" >\n");
167          printf("<br><strong>Available Features(s):<br></strong>\n");          printf("<br><b>Available Features(s):<br></b>\n");
168          printf("<select name = \"feature_id_array[]\" multiple size = \"5\" >");          printf("<select name = \"feature_id_array[]\" multiple size = \"5\" >\n");
169          dropDownFieldOmit($con, "feature", "feature", "feature_id", $omit_string);          dropDownFieldOmit("feature", "feature", "feature_id", $omit_string);
170          printf("</select><br><br>");              printf("</select><br><br>\n");  
171    
172          // Close things          // Close things
173          printf("<center>");          printf("<center>\n");
174          printf("<input type = \"Submit\" value = \" >> \" >");          printf("<input type = \"Submit\" value = \" >> \" >\n");
175          printf("</form>");          printf("</form>\n");
176          printf("</center>");          printf("</center>\n");
177          printf("</td>");          printf("</td>\n");
178    
179          // Form of current features to deselect          // Form of current features to deselect
180          printf("<td valign = \"top\" >\n");          printf("<td valign = \"top\" >\n");
181          printf("<form method = \"POST\" action = \"delete.phtml\" >");          printf("<form method = \"POST\" action = \"delete.phtml\" >\n");
182          printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >", $resource_id);          printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >\n", $resource_id);
183          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteResFeature\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteResFeature\" >\n");
184          printf("<br><strong>Selected feature(s):</strong><br>\n");          printf("<br><b>Selected feature(s):</b><br>\n");
185          printf("<select name =\"key_list_array[]\" multiple size = 5>");          printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n");
186    
187          $sql = "SELECT f.feature, f.feature_id FROM          $sql = "SELECT f.feature, f.feature_id FROM
188                  feature f,                  feature f,
# Line 111  function formAssignResFeature($con, $res Line 192  function formAssignResFeature($con, $res
192                  r.resource_id = " . $resource_id . " AND                  r.resource_id = " . $resource_id . " AND
193                  rf.resource_id = r.resource_id AND                  rf.resource_id = r.resource_id AND
194                  rf.feature_id = f.feature_id ORDER BY feature";                  rf.feature_id = f.feature_id ORDER BY feature";
195            $rs = xx_tryquery($sql);
196          // Fetch the current selections          
197          $rs = xx_query($sql, $con);          while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
         while ($row = xx_fetch_array ($rs)) {  
198                  $feature = $row["feature"];                  $feature = $row["feature"];
199                  $feature_id = $row["feature_id"];                  $feature_id = $row["feature_id"];
200                  printf("<option value = \"%s\">%s</option>", $feature_id, $feature);                  printf("<option value = \"%s\">%s</option>\n", $feature_id, $feature);
201          }          }
202    
203          // Close things          // Close things
204          printf("</select><br><br>");          printf("</select><br><br>\n");
205          printf("<center>");              printf("<center>\n");  
206          printf("<input type = \"Submit\" value =\" << \">");          printf("<input type = \"Submit\" value =\" << \">\n");
207          printf("</center>");          printf("</center>\n");
208          printf("</form>");          printf("</form>\n");
209          printf("</td></tr>");          printf("</td></tr>\n");
210    
211          // Close off table          // Close off table
212          printf("</td></tr></table>");          printf("</td></tr></table>\n");
213  }  }
214    
215    
216  /**********************************************************  /**********************************************************
217  Function: formAssignResLoc  Function: formAssignResLoc
218  Author: Paul Bramscher  Author: Paul Bramscher
219  Last Modified: 07.03.2003  Last Modified: 03.10.2004
220  ***********************************************************  ***********************************************************
221  Purpose:  Purpose:
222  Draws an HTML combo box with multiple selection capability  Draws an HTML combo box with multiple selection capability
223  to assign locations to the supplied resource id.    to assign locations to the supplied resource id.  
224  **********************************************************/  **********************************************************/
225  function formAssignResLoc($con, $resource_id){  function formAssignResLoc($resource_id){
226                                    
227          // Table definition          // Table definition
228          printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >");          printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >\n");
229                    
230          // Form of available locations to select          // Form of available locations to select
231          printf("<form method = \"POST\" action = \"assign.phtml#ResLoc\" >");          printf("<form method = \"POST\" action = \"assign.phtml#ResLoc\" >\n");
232          printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >", $resource_id);          printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >\n", $resource_id);
233          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignResLoc\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignResLoc\" >\n");
234    
235          // Omit the '(N/A)' location          // Omit the '(N/A)' location
236          $omit_string = "WHERE location_id > 1";          $omit_string = "WHERE location_id > 1";
237                    
238          // Omit any pre-selected locations in res_loc          // Omit any pre-selected locations in res_loc
239          $in_string = getNotIn($con, "location_id", "resource_id", $resource_id, "res_loc");          $in_string = getNotIn("location_id", "resource_id", $resource_id, "res_loc");
240          if (strlen($in_string) > 0) $omit_string .= " AND location_id NOT IN " . $in_string;          if (strlen($in_string) > 0) $omit_string .= " AND location_id NOT IN " . $in_string;
241    
242          // Draw the combo box          // Draw the combo box
# Line 164  function formAssignResLoc($con, $resourc Line 244  function formAssignResLoc($con, $resourc
244          printf("Assign Locations");          printf("Assign Locations");
245          printf("</td></tr>\n");          printf("</td></tr>\n");
246          printf("<tr><td valign = \"top\" >\n");          printf("<tr><td valign = \"top\" >\n");
247          printf("<br><strong>Available Location(s):<br></strong>\n");          printf("<br><b>Available Location(s):<br></b>\n");
248          printf("<select name = \"location_id_array[]\" multiple size = \"5\" >");          printf("<select name = \"location_id_array[]\" multiple size = \"5\" >\n");
249          dropDownFieldOmit($con, "location", "location", "location_id", $omit_string);          dropDownFieldOmit("location", "location", "location_id", $omit_string);
250          printf("</select><br><br>");          printf("</select><br><br>\n");
251    
252          // Close things          // Close things
253          printf("<center>");          printf("<center>\n");
254          printf("<input type = \"Submit\" value = \" >> \" >");          printf("<input type = \"Submit\" value = \" >> \" >\n");
255          printf("</center>");          printf("</center>\n");
256          printf("</form>");          printf("</form>\n");
257          printf("</td>");          printf("</td>\n");
258    
259          // Current locations to deselect          // Current locations to deselect
260          printf("<td valign = \"top\" >\n");          printf("<td valign = \"top\" >\n");
261          printf("<form method = \"POST\" action = \"delete.phtml\" >");          printf("<form method = \"POST\" action = \"delete.phtml\" >\n");
262          printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >", $resource_id);          printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >\n", $resource_id);
263          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteResLoc\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteResLoc\" >\n");
264          printf("<br><strong>Selected Location(s):</strong><br>\n");          printf("<br><b>Selected Location(s):</b><br>\n");
265          printf("<select name =\"key_list_array[]\" multiple size = 5>");          printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n");
266    
267          $sql = "SELECT l.location, l.location_id FROM          $sql = "SELECT l.location, l.location_id FROM
268                  location l,                  location l,
# Line 192  function formAssignResLoc($con, $resourc Line 272  function formAssignResLoc($con, $resourc
272                  r.resource_id = " . $resource_id . " AND                  r.resource_id = " . $resource_id . " AND
273                  rl.resource_id = r.resource_id AND                  rl.resource_id = r.resource_id AND
274                  rl.location_id = l.location_id ORDER BY location";                  rl.location_id = l.location_id ORDER BY location";
275            $rs = xx_tryquery($sql);
276          // Fetch the values          
277          $rs = xx_query($sql, $con);          while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
         while ($row = xx_fetch_array ($rs)) {  
278                  $location = $row["location"];                  $location = $row["location"];
279                  $location_id = $row["location_id"];                  $location_id = $row["location_id"];
280                  printf("<option value = \"%s\">%s</option>", $location_id, $location);                  printf("<option value = \"%s\">%s</option>\n", $location_id, $location);
281          }          }
282    
283          // Close things          // Close things
284          printf("</select><br><br>");          printf("</select><br><br>\n");
285          printf("<center>");              printf("<center>\n");  
286          printf("<input type = \"Submit\" value =\" << \">");          printf("<input type = \"Submit\" value =\" << \">\n");
287          printf("</center>");          printf("</center>\n");
288          printf("</form>");          printf("</form>\n");
289          printf("</td></tr>");          printf("</td></tr>\n");
290    
291          // Close off table          // Close off table
292          printf("</td></tr></table>");          printf("</td></tr></table>\n");
293  }  }
294    
295    
296  /**********************************************************  /**********************************************************
297  Function: formAssignResMastersubject  Function: formAssignResMastersubject
298  Author: Paul Bramscher  Author: Paul Bramscher
299  Last Modified: 07.03.2003  Last Modified: 03.10.2004
300  ***********************************************************  ***********************************************************
301  Purpose:  Purpose:
302  Draws an HTML combo box with multiple selection capability  Draws an HTML combo box with multiple selection capability
303  to assign master subjects to the supplied resource id.    to assign master subjects to the supplied resource id.  
304  **********************************************************/  **********************************************************/
305  function formAssignResMastersubject($con, $resource_id){  function formAssignResMastersubject($resource_id){
306                                    
307          // Table definition          // Table definition
308          printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >");          printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >\n");
309                    
310          // Form of available master subjects to select          // Form of available master subjects to select
311          printf("<form method = \"POST\" action = \"assign.phtml#ResMaster\" >");          printf("<form method = \"POST\" action = \"assign.phtml#ResMaster\" >\n");
312          printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >", $resource_id);          printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >\n", $resource_id);
313          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignResMastersubject\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignResMastersubject\" >\n");
314    
315          // Omit the '(N/A)' mastersubjects          // Omit the '(N/A)' mastersubjects
316          $omit_string = "WHERE mastersubject_id > 2";          $omit_string = "WHERE mastersubject_id > 2";
317                    
318          // Omit any pre-selected locations in res_mastersubject          // Omit any pre-selected locations in res_mastersubject
319          $in_string = getNotIn($con, "mastersubject_id", "resource_id", $resource_id, "res_mastersubject");          $in_string = getNotIn("mastersubject_id", "resource_id", $resource_id, "res_mastersubject");
320          if (strlen($in_string) > 0) $omit_string .= " AND mastersubject_id NOT IN " . $in_string;          if (strlen($in_string) > 0) $omit_string .= " AND mastersubject_id NOT IN " . $in_string;
321    
322          // Draw the combo box          // Draw the combo box
# Line 245  function formAssignResMastersubject($con Line 324  function formAssignResMastersubject($con
324          printf("Assign Master Subjects");          printf("Assign Master Subjects");
325          printf("</td></tr>\n");          printf("</td></tr>\n");
326          printf("<tr><td valign = \"top\" >\n");          printf("<tr><td valign = \"top\" >\n");
327          printf("<br><strong>Available Mastersubjects(s):<br></strong>\n");          printf("<br><b>Available Mastersubjects(s):<br></b>\n");
328          printf("<select name = \"mastersubject_id_array[]\" multiple size = \"5\" >");          printf("<select name = \"mastersubject_id_array[]\" multiple size = \"5\" >\n");
329          dropDownFieldOmit($con, "mastersubject", "mastersubject", "mastersubject_id", $omit_string);          dropDownFieldOmit("mastersubject", "mastersubject", "mastersubject_id", $omit_string);
330          printf("</select><br><br>");          printf("</select><br><br>\n");
331    
332          // Close things          // Close things
333          printf("<center>");          printf("<center>\n");
334          printf("<input type = \"Submit\" value = \" >> \" >");          printf("<input type = \"Submit\" value = \" >> \" >");
335          printf("</center>");          printf("</center>");
336          printf("</form>");          printf("</form>");
# Line 259  function formAssignResMastersubject($con Line 338  function formAssignResMastersubject($con
338    
339          // Current master subjects to deselect          // Current master subjects to deselect
340          printf("<td valign = \"top\" >\n");          printf("<td valign = \"top\" >\n");
341          printf("<form method = \"POST\" action = \"delete.phtml\" >");          printf("<form method = \"POST\" action = \"delete.phtml\" >\n");
342          printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >", $resource_id);          printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >\n", $resource_id);
343          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteResMastersubject\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteResMastersubject\" >\n");
344          printf("<br><strong>Selected Mastersubjects(s):</strong><br>\n");          printf("<br><b>Selected Mastersubjects(s):</b><br>\n");
345          printf("<select name =\"key_list_array[]\" multiple size = 5>");          printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n");
346    
347          $sql = "SELECT m.mastersubject, m.mastersubject_id FROM          $sql = "SELECT m.mastersubject, m.mastersubject_id FROM
348                  mastersubject m,                  mastersubject m,
# Line 273  function formAssignResMastersubject($con Line 352  function formAssignResMastersubject($con
352                  r.resource_id = " . $resource_id . " AND                  r.resource_id = " . $resource_id . " AND
353                  rm.resource_id = r.resource_id AND                  rm.resource_id = r.resource_id AND
354                  rm.mastersubject_id = m.mastersubject_id ORDER BY mastersubject";                  rm.mastersubject_id = m.mastersubject_id ORDER BY mastersubject";
355            $rs = xx_tryquery($sql);
356          // Fetch the values          
357          $rs = xx_query($sql, $con);          while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
         while ($row = xx_fetch_array ($rs)) {  
358                  $mastersubject = $row["mastersubject"];                  $mastersubject = $row["mastersubject"];
359                  $mastersubject_id = $row["mastersubject_id"];                  $mastersubject_id = $row["mastersubject_id"];
360                  printf("<option value = \"%s\">%s</option>", $mastersubject_id, $mastersubject);                  printf("<option value = \"%s\">%s</option>\n", $mastersubject_id, $mastersubject);
361          }          }
362    
363          // Close things          // Close things
364          printf("</select><br><br>");          printf("</select><br><br>\n");
365          printf("<center>");              printf("<center>\n");  
366          printf("<input type = \"Submit\" value =\" << \">");          printf("<input type = \"Submit\" value =\" << \">\n");
367          printf("</center>");          printf("</center>\n");
368          printf("</form>");          printf("</form>\n");
369          printf("</td></tr>");          printf("</td></tr>\n");
370    
371          // Close off table          // Close off table
372          printf("</td></tr></table>");          printf("</td></tr></table>\n");
373  }  }
374    
375    
376  /**********************************************************  /**********************************************************
377  Function: formAssignServLoc  Function: formAssignServLoc
378  Author: Paul Bramscher  Author: Paul Bramscher
379  Last Modified: 07.02.2003  Last Modified: 03.10.2004
380  ***********************************************************  ***********************************************************
381  Purpose:  Purpose:
382  Draws an HTML combo box with multiple selection capability  Draws an HTML combo box with multiple selection capability
383  to assign locations to the supplied service id.    to assign locations to the supplied service id.  
384  **********************************************************/  **********************************************************/
385  function formAssignServLoc($con, $service_id){  function formAssignServLoc($service_id){
386    
387          // Table definition          // Table definition
388          printf("<br><br><table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">");          printf("<br><br><table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n");
389    
390          // Form of available locations to select          // Form of available locations to select
391          printf("<form method = \"POST\" action = \"assign.phtml\" >");          printf("<form method = \"POST\" action = \"assign.phtml\" >\n");
392          printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >", $service_id);          printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >\n", $service_id);
393          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignServLoc\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignServLoc\" >\n");
394    
395          // Box header          // Box header
396          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
# Line 323  function formAssignServLoc($con, $servic Line 401  function formAssignServLoc($con, $servic
401          $omit_string = "WHERE location_id > 1";          $omit_string = "WHERE location_id > 1";
402                                                    
403          // Omit any pre-selected locations in service_location          // Omit any pre-selected locations in service_location
404          $in_string = getNotIn($con, "location_id", "service_id", $service_id, "serv_loc");          $in_string = getNotIn("location_id", "service_id", $service_id, "serv_loc");
405          if (strlen($in_string) > 0) $omit_string .= " AND location_id NOT IN " . $in_string;          if (strlen($in_string) > 0) $omit_string .= " AND location_id NOT IN " . $in_string;
406                                    
407          // Draw the combo box          // Draw the combo box
408          printf("<tr><td valign = \"top\" >\n");          printf("<tr><td valign = \"top\" >\n");
409          printf("<br><strong>Available Location(s):<br></strong>\n");          printf("<br><b>Available Location(s):<br></b>\n");
410          printf("<select name = \"location_id_array[]\" multiple size = \"5\" >");          printf("<select name = \"location_id_array[]\" multiple size = \"5\" >\n");
411          dropDownFieldOmit($con, "location", "location", "location_id", $omit_string);          dropDownFieldOmit("location", "location", "location_id", $omit_string);
412          printf("</select><br><br>");              printf("</select><br><br>\n");
413                    
414          // Close things          // Close things
415          printf("<center>");          printf("<center>\n");
416          printf("<input type = \"Submit\" value = \" >> \" >");          printf("<input type = \"Submit\" value = \" >> \" >\n");
417          printf("</form>");          printf("</form>\n");
418          printf("</center>");          printf("</center>\n");
419          printf("</td>");          printf("</td>\n");
420                    
421          // Current locations to deselect          // Current locations to deselect
422          printf("<td valign = \"top\" >\n");          printf("<td valign = \"top\" >\n");
423          printf("<form method = \"POST\" action = \"delete.phtml\" >");          printf("<form method = \"POST\" action = \"delete.phtml\" >\n");
424          printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >", $service_id);          printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >\n", $service_id);
425          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteServLoc\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteServLoc\" >\n");
426          printf("<br><strong>Selected Location(s):</strong><br>\n");          printf("<br><b>Selected Location(s):</b><br>\n");
427          printf("<select name =\"key_list_array[]\" multiple size = 5>");          printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n");
428                    
429          $sql = "SELECT l.location, l.location_id FROM          $sql = "SELECT l.location, l.location_id FROM
430                  location l,                  location l,
# Line 356  function formAssignServLoc($con, $servic Line 434  function formAssignServLoc($con, $servic
434                  s.service_id = " . $service_id . " AND                  s.service_id = " . $service_id . " AND
435                  sl.service_id = s.service_id AND                  sl.service_id = s.service_id AND
436                  sl.location_id = l.location_id ORDER BY location";                  sl.location_id = l.location_id ORDER BY location";
437            $rs = xx_tryquery($sql);
438                    
439          // Fetch the values          while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
         $rs = xx_query($sql, $con);  
         while ($row = xx_fetch_array ($rs)) {  
440                  $location = $row["location"];                  $location = $row["location"];
441                  $location_id = $row["location_id"];                  $location_id = $row["location_id"];
442                  printf("<option value = \"%s\">%s</option>", $location_id, $location);                  printf("<option value = \"%s\">%s</option>\n", $location_id, $location);
443          }          }
444                    
445          // Close things          // Close things
446          printf("</select><br><br>");          printf("</select><br><br>\n");
447          printf("<center>");              printf("<center>\n");  
448          printf("<input type = \"Submit\" value =\" << \">");          printf("<input type = \"Submit\" value =\" << \">\n");
449          printf("</center>");          printf("</center>\n");
450          printf("</form>");          printf("</form>\n");
451          printf("</td></tr>");          printf("</td></tr>\n");
452    
453          // Close off the table          // Close off the table
454          printf("</td></tr></table>");          printf("</td></tr></table>\n");
455  }  }
456    
457    
458  /**********************************************************  /**********************************************************
459  Function: formAssignServServtype  Function: formAssignServServtype
460  Author: Paul Bramscher  Author: Paul Bramscher
461  Last Modified: 07.02.2003  Last Modified: 03.10.2004
462  ***********************************************************  ***********************************************************
463  Purpose:  Purpose:
464  Draws an HTML combo box with multiple selection capability  Draws an HTML combo box with multiple selection capability
465  to assign service types to the supplied service id.    to assign service types to the supplied service id.  
466  **********************************************************/  **********************************************************/
467  function formAssignServServtype($con, $service_id){  function formAssignServServtype($service_id){
468    
469          // Table definition          // Table definition
470          printf("<br><br><table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">");          printf("<br><br><table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n");
471    
472          // Form of available service types to select          // Form of available service types to select
473          printf("<form method = \"POST\" action = \"assign.phtml\" >");          printf("<form method = \"POST\" action = \"assign.phtml\" >\n");
474          printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >", $service_id);          printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >\n", $service_id);
475          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignServServtype\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignServServtype\" >\n");
476    
477          // Box header          // Box header
478          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
# Line 406  function formAssignServServtype($con, $s Line 483  function formAssignServServtype($con, $s
483          $omit_string = "WHERE servicetype_id > 1";          $omit_string = "WHERE servicetype_id > 1";
484                                                    
485          // Omit any pre-selected servive types in serv_servtype          // Omit any pre-selected servive types in serv_servtype
486          $in_string = getNotIn($con, "servicetype_id", "service_id", $service_id, "serv_servtype");          $in_string = getNotIn("servicetype_id", "service_id", $service_id, "serv_servtype");
487          if (strlen($in_string) > 0) $omit_string .= " AND servicetype_id NOT IN " . $in_string;          if (strlen($in_string) > 0) $omit_string .= " AND servicetype_id NOT IN " . $in_string;
488                                    
489          // Draw the combo box          // Draw the combo box
490          printf("<tr><td valign = \"top\" >\n");          printf("<tr><td valign = \"top\" >\n");
491          printf("<br><strong>Available Service Types(s):<br></strong>\n");          printf("<br><b>Available Service Types(s):<br></b>\n");
492          printf("<select name = \"servicetype_id_array[]\" multiple size = \"5\" >");          printf("<select name = \"servicetype_id_array[]\" multiple size = \"5\" >\n");
493          dropDownFieldOmit($con, "servicetype", "servicetype", "servicetype_id", $omit_string);          dropDownFieldOmit("servicetype", "servicetype", "servicetype_id", $omit_string);
494          printf("</select><br><br>");              printf("</select><br><br>\n");  
495                    
496          // Close things          // Close things
497          printf("<center>");          printf("<center>\n");
498          printf("<input type = \"Submit\" value = \" >> \" >");          printf("<input type = \"Submit\" value = \" >> \" >\n");
499          printf("</form>");          printf("</form>\n");
500          printf("</center>");          printf("</center>\n");
501          printf("</td>");          printf("</td>\n");
502                    
503          // Current servicetypes to deselect          // Current servicetypes to deselect
504          printf("<td valign = \"top\" >\n");          printf("<td valign = \"top\" >\n");
505          printf("<form method = \"POST\" action = \"delete.phtml\" >");          printf("<form method = \"POST\" action = \"delete.phtml\" >\n");
506          printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >", $service_id);          printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >\n", $service_id);
507          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteServServtype\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteServServtype\" >\n");
508          printf("<br><strong>Selected Service Types(s):</strong><br>\n");          printf("<br><b>Selected Service Types(s):</b><br>\n");
509          printf("<select name =\"key_list_array[]\" multiple size = 5>");          printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n");
510                    
511          $sql = "SELECT t.servicetype, t.servicetype_id FROM          $sql = "SELECT t.servicetype, t.servicetype_id FROM
512                  servicetype t,                  servicetype t,
# Line 439  function formAssignServServtype($con, $s Line 516  function formAssignServServtype($con, $s
516                  s.service_id = " . $service_id . " AND                  s.service_id = " . $service_id . " AND
517                  st.service_id = s.service_id AND                  st.service_id = s.service_id AND
518                  st.servicetype_id = t.servicetype_id ORDER BY servicetype";                  st.servicetype_id = t.servicetype_id ORDER BY servicetype";
519            $rs = xx_tryquery($sql);
520                    
521          // Fetch the values          while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
         $rs = xx_query($sql, $con);  
         while ($row = xx_fetch_array ($rs)) {  
522                  $servicetype = $row["servicetype"];                  $servicetype = $row["servicetype"];
523                  $servicetype_id = $row["servicetype_id"];                  $servicetype_id = $row["servicetype_id"];
524                  printf("<option value = \"%s\">%s</option>", $servicetype_id, $servicetype);                  printf("<option value = \"%s\">%s</option>\n", $servicetype_id, $servicetype);
525          }          }
526                    
527          // Close things          // Close things
528          printf("</select><br><br>");          printf("</select><br><br>\n");
529          printf("<center>");              printf("<center>\n");  
530          printf("<input type = \"Submit\" value =\" << \">");          printf("<input type = \"Submit\" value =\" << \">\n");
531          printf("</center>");          printf("</center>\n");
532          printf("</form>");          printf("</form>\n");
533          printf("</td></tr>");          printf("</td></tr>\n");
534    
535          // Close off the table          // Close off the table
536          printf("</td></tr></table>");          printf("</td></tr></table>\n");
537    }
538    
539    
540    /**********************************************************
541    Function: formAssignStaffLibunit
542    Author: Paul Bramscher
543    Last Modified: 03.10.2004
544    ***********************************************************
545    Purpose:
546    Assigns library units (possibly multiple) to a given
547    staffperson.
548    **********************************************************/
549    function formAssignStaffLibunit($staff_id){
550                            
551            // Table definition
552            printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >\n");
553            
554            // Form
555            printf("<form method = \"POST\" action = \"assign.phtml\" >\n");
556            printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >\n", $staff_id);
557            printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignStaffLibunit\" >\n");
558            
559            // Available libunits
560            // Omit the '(N/A)' libunit
561            $omit_string = "WHERE libunit_id > 1";
562                            
563            // Omit any pre-selected libunits in libunit_staff
564            $in_string = getNotIn("libunit_id", "staff_id", $staff_id, "libunit_staff");
565            if (strlen($in_string) > 0) $omit_string .= " AND libunit_id NOT IN " . $in_string;
566                    
567            // Draw the box
568            printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
569            printf("Assign Library Unit to Staff");
570            printf("</td></tr>\n");
571            printf("<tr><td valign = \"top\" >\n");
572            printf("<br><b>Available Library Unit(s):<br></b>\n");
573            printf("<select name = \"libunit_id_array[]\" multiple size = \"5\" >\n");
574            dropDownFieldOmit("libunit", "libunit", "libunit_id", $omit_string);
575            printf("</select><br><br>\n");  
576            
577            // Close off form
578            printf("<center>\n");
579            printf("<input type = \"Submit\" value = \" >> \" >\n");
580            printf("</form>\n");
581            printf("</center>\n");
582            printf("</td>\n");
583            
584            // Current libunits
585            printf("<td valign = \"top\" >\n");
586            printf("<form method = \"POST\" action = \"delete.phtml\" >\n");
587            printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >\n", $staff_id);
588            printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteStaffLibunit\" >\n");
589            printf("<br><b>Selected Library Unit(s):</b><br>\n");
590            printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n");
591            
592            $sql = "SELECT l.libunit, l.libunit_id FROM
593                    staff s,
594                    libunit_staff ls,
595                    libunit l
596                    WHERE
597                    s.staff_id = " . $staff_id . " AND
598                    ls.staff_id = s.staff_id AND
599                    ls.libunit_id = l.libunit_id
600                    ORDER BY l.libunit";
601            $rs = xx_tryquery($sql);
602            
603            while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
604                    $libunit = $row["libunit"];
605                    $libunit_id = $row["libunit_id"];
606                    printf("<option value = \"%s\">%s</option>\n", $libunit_id, $libunit);
607            }
608            
609            printf("</select><br><br>\n");
610            printf("<center>\n");  
611            printf("<input type = \"Submit\" value =\" << \">\n");
612            printf("</center>\n");
613            printf("</form>\n");
614            printf("</td></tr>\n");
615            
616            // Close off table
617            printf("</td></tr></table>\n");
618    
619    }
620    
621    
622    /**********************************************************
623    Function: formAssignStaffSub
624    Author: Paul Bramscher
625    Last Modified: 03.10.2004
626    ***********************************************************
627    Purpose:
628    Assigns subjects (possibly multiple) to a given
629    staffperson.
630    **********************************************************/
631    function formAssignStaffSub($staff_id){
632    
633            // Table definition
634            printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >\n");
635            
636            // Form
637            printf("<form method = \"POST\" action = \"assign.phtml\" >\n");
638            printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >\n", $staff_id);
639            printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignStaffSub\" >\n");
640            
641            // Available subjects
642            // Omit the '(N/A)' subject
643            $omit_string = "WHERE subject_id > 1";
644                            
645            // Omit any pre-selected subjects in sub_staff
646            $in_string = getNotIn("subject_id", "staff_id", $staff_id, "sub_staff");
647            if (strlen($in_string) > 0) $omit_string .= " AND subject_id NOT IN " . $in_string;
648                    
649            // Draw the box
650            printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
651            printf("Assign Subjects");
652            printf("</td></tr>\n");
653            printf("<tr><td valign = \"top\" >\n");
654            printf("<br><b>Available Subject(s):<br></b>\n");
655            printf("<select name = \"subject_id_array[]\" multiple size = \"5\" >\n");
656            dropDownFieldOmit("subject", "subject", "subject_id", $omit_string);
657            printf("</select><br><br>\n");  
658            
659            // Close off form
660            printf("<center>\n");
661            printf("<input type = \"Submit\" value = \" >> \" >\n");
662            printf("</form>\n");
663            printf("</center>\n");
664            printf("</td>\n");
665            
666            // Current subjects
667            printf("<td valign = \"top\" >\n");
668            printf("<form method = \"POST\" action = \"delete.phtml\" >\n");
669            printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >", $staff_id);
670            printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteStaffSub\" >\n");
671            printf("<br><b>Selected Subject(s):</b><br>\n");
672            printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n");
673            
674            $sql = "SELECT s.subject, s.subject_id FROM
675                    staff t,
676                    sub_staff st,
677                    subject s
678                    WHERE
679                    t.staff_id = " . $staff_id . " AND
680                    st.staff_id = t.staff_id AND
681                    st.subject_id = s.subject_id
682                    ORDER BY s.subject";
683            $rs = xx_tryquery($sql);
684    
685            while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
686                    $subject = $row["subject"];
687                    $subject_id = $row["subject_id"];
688                    printf("<option value = \"%s\">%s</option>\n", $subject_id, $subject);
689            }
690            
691            printf("</select><br><br>\n");
692            printf("<center>\n");  
693            printf("<input type = \"Submit\" value =\" << \">\n");
694            printf("</center>\n");
695            printf("</form>\n");
696            printf("</td></tr>\n");
697            
698            // Close off table
699            printf("</td></tr></table>\n");
700    
701  }  }
702    
703    
704  /**********************************************************  /**********************************************************
705  Function: formAssignSubCoursesub  Function: formAssignSubCoursesub
706  Author: Paul Bramscher  Author: Paul Bramscher
707  Last Modified: 06.26.2003  Last Modified: 03.10.2004
708  ***********************************************************  ***********************************************************
709  Purpose:  Purpose:
710  Draws an HTML combo box with multiple selection capability  Draws an HTML combo box with multiple selection capability
711  to assign course subjects (with cip codes) to the supplied  to assign course subjects (with cip codes) to the supplied
712  subject id.    subject id.  
713  **********************************************************/  **********************************************************/
714  function formAssignSubCoursesub($con, $subject_id){  function formAssignSubCoursesub($subject_id){
715    
716          // Table definition          // Table definition
717          printf("<br><br>\n");          printf("<br><br>\n");
718          printf("<table width=\"90%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\" >");          printf("<table width=\"90%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\" >\n");
719    
720          // Form of available course subjects to select          // Form of available course subjects to select
721          printf("<form method = \"POST\" action = \"assign.phtml\" >");          printf("<form method = \"POST\" action = \"assign.phtml\" >\n");
722          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
723          printf("Map to Course Subjects / CIP Codes");          printf("Map to Course Subjects / CIP Codes");
724          printf("</td></tr>\n");          printf("</td></tr>\n");
725                    
726          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id);          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id);
727          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubCoursesub\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubCoursesub\" >\n");
728    
729          // Omit the '(N/A)' course subject          // Omit the '(N/A)' course subject
730          $omit_string = "WHERE coursesub_id > 1";          $omit_string = "WHERE coursesub_id > 1";
731                                                    
732          // Omit any pre-selected locations in sub_coursesub          // Omit any pre-selected locations in sub_coursesub
733          $in_string = getNotIn($con, "coursesub_id", "subject_id", $subject_id, "sub_coursesub");          $in_string = getNotIn("coursesub_id", "subject_id", $subject_id, "sub_coursesub");
734          if (strlen($in_string) > 0) $omit_string .= " AND coursesub_id NOT IN " . $in_string;          if (strlen($in_string) > 0) $omit_string .= " AND coursesub_id NOT IN " . $in_string;
735                                    
736          // Draw the combo box          // Draw the combo box
737          printf("<tr><td valign = \"top\" >\n");          printf("<tr><td valign = \"top\" >\n");
738          printf("<br><b>Available Course Subjects(s):<br></b>\n");          printf("<br><b>Available Course Subjects(s):<br></b>\n");
739          printf("<select name = \"coursesub_id_array[]\" multiple size = \"20\" >");          printf("<select name = \"coursesub_id_array[]\" multiple size = \"20\" >\n");
740          dropDownCoursesubOmit($con, $omit_string);          dropDownCoursesubOmit($omit_string);
741          printf("</select><br><br>");              printf("</select><br><br>\n");  
742                    
743          // Close things          // Close things
744          printf("<center>");          printf("<center>\n");
745          printf("<input type = \"Submit\" value = \" >> \" >");          printf("<input type = \"Submit\" value = \" >> \" >\n");
746          printf("</form>");          printf("</form>\n");
747          printf("</center>");          printf("</center>\n");
748          printf("</td>");          printf("</td>\n");
749                    
750          // Current coursesubs to deselect          // Current coursesubs to deselect
751          printf("<td valign = \"top\" >\n");          printf("<td valign = \"top\" >\n");
752          printf("<form method = \"POST\" action = \"delete.phtml\" >");          printf("<form method = \"POST\" action = \"delete.phtml\" >\n");
753          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id);          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id);
754          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubCoursesub\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubCoursesub\" >\n");
755          printf("<br><b>Selected Course Subject(s):</b><br>\n");          printf("<br><b>Selected Course Subject(s):</b><br>\n");
756          printf("<select name =\"key_list_array[]\" multiple size = \"20\">");          printf("<select name =\"key_list_array[]\" multiple size = \"20\">\n");
757                    
758          $sql = "SELECT c.coursesub, c.coursesub_descr, c.coursesub_id, c.cip_code FROM          $sql = "SELECT c.coursesub, c.coursesub_descr, c.coursesub_id, c.cip_code FROM
759                  coursesub c,                  coursesub c,
# Line 523  function formAssignSubCoursesub($con, $s Line 763  function formAssignSubCoursesub($con, $s
763                  s.subject_id = " . $subject_id . " AND                  s.subject_id = " . $subject_id . " AND
764                  sc.subject_id = s.subject_id AND                  sc.subject_id = s.subject_id AND
765                  sc.coursesub_id = c.coursesub_id ORDER BY coursesub_descr";                  sc.coursesub_id = c.coursesub_id ORDER BY coursesub_descr";
766                    $rs = xx_tryquery($sql);
767          // Fetch the values  
768          $rs = xx_query($sql, $con);          while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
         while ($row = xx_fetch_array ($rs)) {  
769                  $coursesub = $row["coursesub"];                  $coursesub = $row["coursesub"];
770                  $coursesub_id = $row["coursesub_id"];                  $coursesub_id = $row["coursesub_id"];
771                  $coursesub_descr = $row["coursesub_descr"];                  $coursesub_descr = $row["coursesub_descr"];
# Line 535  function formAssignSubCoursesub($con, $s Line 774  function formAssignSubCoursesub($con, $s
774                  // Limit length                  // Limit length
775                  if (strlen($coursesub_descr) > 30) $coursesub_descr = substr($coursesub_descr, 0, 30) . "...";                  if (strlen($coursesub_descr) > 30) $coursesub_descr = substr($coursesub_descr, 0, 30) . "...";
776                                    
777                  printf("<option value = \"%s\">%s | %s [%s]</option>", $coursesub_id, $coursesub, $coursesub_descr, $cip_code);                  printf("<option value = \"%s\">%s | %s [%s]</option>\n", $coursesub_id, $coursesub, $coursesub_descr, $cip_code);
778          }          }
779                    
780          // Close things          // Close things
781          printf("</select><br><br>");          printf("</select><br><br>\n");
782          printf("<center>");              printf("<center>\n");  
783          printf("<input type = \"Submit\" value =\" << \">");          printf("<input type = \"Submit\" value =\" << \">\n");
784          printf("</center>");          printf("</center>\n");
785          printf("</form>");          printf("</form>\n");
786          printf("</td></tr>");          printf("</td></tr>\n");
787    
788          // Close off the table          // Close off the table
789          printf("</td></tr></table>");          printf("</td></tr></table>\n");
790  }  }
791    
792    
793  /**********************************************************  /**********************************************************
794  Function: formAssignSubLoc  Function: formAssignSubLoc
795  Author: Paul Bramscher  Author: Paul Bramscher
796  Last Modified: 06.26.2003  Last Modified: 03.10.2004
797  ***********************************************************  ***********************************************************
798  Purpose:  Purpose:
799  Draws an HTML combo box with multiple selection capability  Draws an HTML combo box with multiple selection capability
800  to assign locations to the supplied subject id.    to assign locations to the supplied subject id.  
801  **********************************************************/  **********************************************************/
802  function formAssignSubLoc($con, $subject_id){  function formAssignSubLoc($subject_id){
803    
804          // Table definition          // Table definition
805          printf("<br><br>\n");          printf("<br><br>\n");
806          printf("<table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">");          printf("<table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n");
807    
808          // Form of available locations to select          // Form of available locations to select
809          printf("<form method = \"POST\" action = \"assign.phtml\" >");          printf("<form method = \"POST\" action = \"assign.phtml\" >\n");
810          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
811          printf("Assign Secondary Locations");          printf("Assign Secondary Locations");
812          printf("</td></tr>\n");          printf("</td></tr>\n");
813                    
814          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id);          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id);
815          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubLoc\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubLoc\" >\n");
816    
817          // Omit the '(N/A)' location          // Omit the '(N/A)' location
818          $omit_string = "WHERE location_id > 1";          $omit_string = "WHERE location_id > 1";
819                                                    
820          // Omit any pre-selected locations in sub_loc          // Omit any pre-selected locations in sub_loc
821          $in_string = getNotIn($con, "location_id", "subject_id", $subject_id, "sub_loc");          $in_string = getNotIn("location_id", "subject_id", $subject_id, "sub_loc");
822          if (strlen($in_string) > 0) $omit_string .= " AND location_id NOT IN " . $in_string;          if (strlen($in_string) > 0) $omit_string .= " AND location_id NOT IN " . $in_string;
823                                    
824          // Draw the combo box          // Draw the combo box
825          printf("<tr><td valign = \"top\" >\n");          printf("<tr><td valign = \"top\" >\n");
826          printf("<br><b>Available Location(s):<br></b>\n");          printf("<br><b>Available Location(s):<br></b>\n");
827          printf("<select name = \"location_id_array[]\" multiple size = \"5\" >");          printf("<select name = \"location_id_array[]\" multiple size = \"5\" >");
828          dropDownFieldOmit($con, "location", "location", "location_id", $omit_string);          dropDownFieldOmit("location", "location", "location_id", $omit_string);
829          printf("</select><br><br>");              printf("</select><br><br>\n");  
830                    
831          // Close things          // Close things
832          printf("<center>");          printf("<center>\n");
833          printf("<input type = \"Submit\" value = \" >> \" >");          printf("<input type = \"Submit\" value = \" >> \" >\n");
834          printf("</form>");          printf("</form>\n");
835          printf("</center>");          printf("</center>\n");
836          printf("</td>");          printf("</td>\n");
837                    
838          // Current locations to deselect          // Current locations to deselect
839          printf("<td valign = \"top\" >\n");          printf("<td valign = \"top\" >\n");
840          printf("<form method = \"POST\" action = \"delete.phtml\" >");          printf("<form method = \"POST\" action = \"delete.phtml\" >\n");
841          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id);          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id);
842          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubLoc\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubLoc\" >\n");
843          printf("<br><b>Selected Location(s):</b><br>\n");          printf("<br><b>Selected Location(s):</b><br>\n");
844          printf("<select name =\"key_list_array[]\" multiple size = 5>");          printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n");
845                    
846          $sql = "SELECT l.location, l.location_id FROM          $sql = "SELECT l.location, l.location_id FROM
847                  location l,                  location l,
# Line 612  function formAssignSubLoc($con, $subject Line 851  function formAssignSubLoc($con, $subject
851                  s.subject_id = " . $subject_id . " AND                  s.subject_id = " . $subject_id . " AND
852                  sl.subject_id = s.subject_id AND                  sl.subject_id = s.subject_id AND
853                  sl.location_id = l.location_id ORDER BY location";                  sl.location_id = l.location_id ORDER BY location";
854                    $rs = xx_tryquery($sql);
855          // Fetch the values  
856          $rs = xx_query($sql, $con);          while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
         while ($row = xx_fetch_array ($rs)) {  
857                  $location = $row["location"];                  $location = $row["location"];
858                  $location_id = $row["location_id"];                  $location_id = $row["location_id"];
859                  printf("<option value = \"%s\">%s</option>", $location_id, $location);                  printf("<option value = \"%s\">%s</option>\n", $location_id, $location);
860          }          }
861                    
862          // Close things          // Close things
863          printf("</select><br><br>");          printf("</select><br><br>\n");
864          printf("<center>");              printf("<center>\n");
865          printf("<input type = \"Submit\" value =\" << \">");          printf("<input type = \"Submit\" value =\" << \">\n");
866          printf("</center>");          printf("</center>\n");
867          printf("</form>");          printf("</form>\n");
868          printf("</td></tr>");          printf("</td></tr>\n");
869    
870          // Close off the table          // Close off the table
871          printf("</td></tr></table>");          printf("</td></tr></table>\n");
872  }  }
873    
874    
875  /**********************************************************  /**********************************************************
876  Function: formAssignSubMaster  Function: formAssignSubMaster
877  Author: Paul Bramscher  Author: Paul Bramscher
878  Last Modified: 06.26.2003  Last Modified: 03.10.2004
879  ***********************************************************  ***********************************************************
880  Purpose:  Purpose:
881  Draws an HTML combo box with multiple selection capability  Draws an HTML combo box with multiple selection capability
882  to assign master subjects to the supplied subject id.    to assign master subjects to the supplied subject id.  
883  **********************************************************/  **********************************************************/
884  function formAssignSubMaster($con, $subject_id){  function formAssignSubMaster($subject_id){
885    
886          // Table definition          // Table definition
887          printf("<br><br>\n");          printf("<br><br>\n");
888          printf("<table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >");          printf("<table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >\n");
889    
890          // Form of available master subjects to select          // Form of available master subjects to select
891          printf("<form method = \"POST\" action = \"assign.phtml\" >");          printf("<form method = \"POST\" action = \"assign.phtml\" >\n");
892    
893          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
894          printf("Assign Master Subjects");          printf("Assign Master Subjects");
895          printf("</td></tr>\n");          printf("</td></tr>\n");
896          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id);          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id);
897          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubMaster\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubMaster\" >\n");
898    
899          // Omit the '(N/A)' location          // Omit the '(N/A)' location
900          $omit_string = "WHERE mastersubject_id > 1";          $omit_string = "WHERE mastersubject_id > 1";
901                                                    
902          // Omit any pre-selected locations in sub_mastersubject          // Omit any pre-selected locations in sub_mastersubject
903          $in_string = getNotIn($con, "mastersubject_id", "subject_id", $subject_id, "sub_mastersubject");          $in_string = getNotIn("mastersubject_id", "subject_id", $subject_id, "sub_mastersubject");
904          if (strlen($in_string) > 0) $omit_string .= " AND mastersubject_id NOT IN " . $in_string;          if (strlen($in_string) > 0) $omit_string .= " AND mastersubject_id NOT IN " . $in_string;
905                                    
906          // Draw the combo box          // Draw the combo box
907          printf("<tr><td valign = \"top\" >\n");          printf("<tr><td valign = \"top\" >\n");
908          printf("<br><b>Available Master Subjects(s):<br></b>\n");          printf("<br><b>Available Master Subjects(s):<br></b>\n");
909          printf("<select name = \"mastersubject_id_array[]\" multiple size = \"5\" >");          printf("<select name = \"mastersubject_id_array[]\" multiple size = \"5\" >\n");
910          dropDownFieldOmit($con, "mastersubject", "mastersubject", "mastersubject_id", $omit_string);          dropDownFieldOmit("mastersubject", "mastersubject", "mastersubject_id", $omit_string);
911          printf("</select><br><br>");              printf("</select><br><br>\n");
912                    
913          // Close things          // Close things
914          printf("<center>");          printf("<center>\n");
915          printf("<input type = \"Submit\" value = \" >> \" >");          printf("<input type = \"Submit\" value = \" >> \" >\n");
916          printf("</form>");          printf("</form>\n");
917          printf("</center>");          printf("</center>\n");
918          printf("</td>");          printf("</td>\n");
919                    
920          // Current mastersubjects to deselect          // Current mastersubjects to deselect
921          printf("<td valign = \"top\" >\n");          printf("<td valign = \"top\" >\n");
922          printf("<form method = \"POST\" action = \"delete.phtml\" >");          printf("<form method = \"POST\" action = \"delete.phtml\" >\n");
923          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id);          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id);
924          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubMaster\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubMaster\" >\n");
925          printf("<br><b>Selected Master Subject(s):</b><br>\n");          printf("<br><b>Selected Master Subject(s):</b><br>\n");
926          printf("<select name =\"key_list_array[]\" multiple size = 5>");          printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n");
927                    
928          $sql = "SELECT m.mastersubject, m.mastersubject_id FROM          $sql = "SELECT m.mastersubject, m.mastersubject_id FROM
929                  mastersubject m,                  mastersubject m,
# Line 695  function formAssignSubMaster($con, $subj Line 933  function formAssignSubMaster($con, $subj
933                  s.subject_id = " . $subject_id . " AND                  s.subject_id = " . $subject_id . " AND
934                  sm.subject_id = s.subject_id AND                  sm.subject_id = s.subject_id AND
935                  sm.mastersubject_id = m.mastersubject_id ORDER BY mastersubject";                  sm.mastersubject_id = m.mastersubject_id ORDER BY mastersubject";
936                    $rs = xx_tryquery($sql);
937          // Fetch the values  
938          $rs = xx_query($sql, $con);          while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
         while ($row = xx_fetch_array ($rs)) {  
939                  $mastersubject = $row["mastersubject"];                  $mastersubject = $row["mastersubject"];
940                  $mastersubject_id = $row["mastersubject_id"];                  $mastersubject_id = $row["mastersubject_id"];
941                  printf("<option value = \"%s\">%s</option>", $mastersubject_id, $mastersubject);                  printf("<option value = \"%s\">%s</option>\n", $mastersubject_id, $mastersubject);
942          }          }
943                    
944          // Close things          // Close things
945          printf("</select><br><br>");          printf("</select><br><br>\n");
946          printf("<center>");              printf("<center>\n");  
947          printf("<input type = \"Submit\" value =\" << \">");          printf("<input type = \"Submit\" value =\" << \">\n");
948          printf("</center>");          printf("</center>\n");
949          printf("</form>");          printf("</form>\n");
950          printf("</td></tr>");          printf("</td></tr>\n");
951    
952          // Close off the table          // Close off the table
953          printf("</td></tr></table>");          printf("</td></tr></table>\n");
954  }  }
955    
956    
957  /**********************************************************  /**********************************************************
958  Function: formAssignSubOtherSub  Function: formAssignSubOtherSub
959  Author: Paul Bramscher  Author: Paul Bramscher
960  Last Modified: 11.06.2003  Last Modified: 03.10.2004
961  ***********************************************************  ***********************************************************
962  Purpose:  Purpose:
963  Draws an HTML combo box with multiple selection capability  Draws an HTML combo box with multiple selection capability
964  to assign other subject pages to the supplied subject id.    to assign other subject pages to the supplied subject id.  
965  **********************************************************/  **********************************************************/
966  function formAssignSubOtherSub($con, $subject_id){  function formAssignSubOtherSub($subject_id){
967    
968          // Table definition          // Table definition
969          printf("<table width=\"75%%\" border=\"2\" class=\"backLight\" cellpadding=\"4\" >");          printf("<table width=\"75%%\" border=\"2\" class=\"backLight\" cellpadding=\"4\" >\n");
970    
971          // Form of available master subjects to select          // Form of available master subjects to select
972          printf("<form method = \"POST\" action = \"subject_transaction.phtml\" >");          printf("<form method = \"POST\" action = \"subject_transaction.phtml\" >\n");
973          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id);          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id);
974          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubOtherSub\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubOtherSub\" >\n");
975    
976          // Free-form pages only          // Free-form pages only
977          $omit_string = "WHERE subject_id > 1 AND subject_id <> " . $subject_id;          $omit_string = "WHERE subject_id > 1 AND subject_id <> " . $subject_id;
978                                                    
979          // Omit any pre-selected other subjects in sub_othersub          // Omit any pre-selected other subjects in sub_othersub
980          $in_string = getNotIn($con, "othersub_id", "subject_id", $subject_id, "sub_othersub");          $in_string = getNotIn("othersub_id", "subject_id", $subject_id, "sub_othersub");
981          if (strlen($in_string) > 0) $omit_string .= " AND subject_id NOT IN " . $in_string;          if (strlen($in_string) > 0) $omit_string .= " AND subject_id NOT IN " . $in_string;
982                                    
983          // Draw the combo box          // Draw the combo box
# Line 749  function formAssignSubOtherSub($con, $su Line 986  function formAssignSubOtherSub($con, $su
986                    
987                    
988          printf("<tr><td valign = \"top\" >\n");          printf("<tr><td valign = \"top\" >\n");
989          printf("<br><strong>Available Subject(s):<br></strong>\n");          printf("<br><b>Available Subject(s):<br></b>\n");
990          printf("<select name = \"subject_id_array[]\" multiple size = \"5\" >");          printf("<select name = \"subject_id_array[]\" multiple size = \"5\" >\n");
991          dropDownFieldOmit($con, "subject", "subject", "subject_id", $omit_string);          dropDownFieldOmit("subject", "subject", "subject_id", $omit_string);
992          printf("</select><br><br>");          printf("</select><br><br>\n");
993                    
994          // Close things          // Close things
995          printf("<center>");          printf("<center>\n");
996          printf("<input type = \"Submit\" value = \" Add \" >");          printf("<input type = \"Submit\" value = \" Add \" >\n");
997          printf("</form>");          printf("</form>\n");
998          printf("</center>");          printf("</center>\n");
999          printf("</td></tr>");          printf("</td></tr>\n");
1000                    
1001          // Current rqs subjects to deselect          // Current rqs subjects to deselect
1002          printf("<tr><td valign = \"top\" >\n");          printf("<tr><td valign = \"top\" >\n");
1003          printf("<form method = \"POST\" action = \"subject_transaction.phtml\" >");          printf("<form method = \"POST\" action = \"subject_transaction.phtml\" >\n");
1004          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id);          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id);
1005          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubOtherSub\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubOtherSub\" >\n");
1006          printf("<br><strong>Selected Subject(s):</strong><br>\n");          printf("<br><b>Selected Subject(s):</b><br>\n");
1007          printf("<select name =\"key_list_array[]\" multiple size = \"3\">");          printf("<select name =\"key_list_array[]\" multiple size = \"3\">\n");
1008                    
1009          $sql = "SELECT so.othersub_id, s.subject FROM          $sql = "SELECT so.othersub_id, s.subject FROM
1010                  subject s,                  subject s,
# Line 776  function formAssignSubOtherSub($con, $su Line 1013  function formAssignSubOtherSub($con, $su
1013                  so.subject_id = " . $subject_id . " AND                  so.subject_id = " . $subject_id . " AND
1014                  so.othersub_id = s.subject_id                  so.othersub_id = s.subject_id
1015                  ORDER BY s.subject";                  ORDER BY s.subject";
1016                    $rs = xx_tryquery($sql);
1017          // Fetch the values  
1018          $rs = xx_query($sql, $con);          while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
         while ($row = xx_fetch_array ($rs)) {  
1019                  $othersub = $row["subject"];                  $othersub = $row["subject"];
1020                  $othersub_id = $row["othersub_id"];                  $othersub_id = $row["othersub_id"];
1021                                    
1022                  printf("<option value = \"%s\">%s</option>", $othersub_id, $othersub);                  printf("<option value = \"%s\">%s</option>\n", $othersub_id, $othersub);
1023          }          }
1024                    
1025          // Close things          // Close things
1026          printf("</select><br><br>");          printf("</select><br><br>\n");
1027          printf("<center>");              printf("<center>\n");
1028          printf("<input type = \"Submit\" value =\" Remove \">");          printf("<input type = \"Submit\" value =\" Remove \">\n");
1029          printf("</center>");          printf("</center>\n");
1030          printf("</form>");          printf("</form>\n");
1031          printf("</td></tr>");          printf("</td></tr>\n");
1032    
1033          // Close off the table          // Close off the table
1034          printf("</td></tr></table>");          printf("</td></tr></table>\n");
1035  }  }
1036    
1037    
1038  /**********************************************************  /**********************************************************
1039  Function: formAssignSubPage  Function: formAssignSubPage
1040  Author: Paul Bramscher  Author: Paul Bramscher
1041  Last Modified: 11.06.2003  Last Modified: 03.10.2004
1042  ***********************************************************  ***********************************************************
1043  Purpose:  Purpose:
1044  Draws an HTML combo box with multiple selection capability  Draws an HTML combo box with multiple selection capability
1045  to assign PageScribe Pages to the supplied subject id.    to assign PageScribe Pages to the supplied subject id.  
1046  **********************************************************/  **********************************************************/
1047  function formAssignSubPage($con, $subject_id){  function formAssignSubPage($subject_id){
1048    
1049          // Table definition          // Table definition
1050          printf("<table width=\"75%%\" border=\"2\" class=\"backLight\" cellpadding=\"4\" >");          printf("<table width=\"75%%\" border=\"2\" class=\"backLight\" cellpadding=\"4\" >\n");
1051    
1052          // Form of available master subjects to select          // Form of available master subjects to select
1053          printf("<form method = \"POST\" action = \"subject_transaction.phtml\" >");          printf("<form method = \"POST\" action = \"subject_transaction.phtml\" >\n");
1054          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id);          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id);
1055          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubPage\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubPage\" >\n");
1056    
1057          // Free-form pages only          // Free-form pages only
1058          $omit_string = "WHERE pagetype_id = 2";          $omit_string = "WHERE pagetype_id = 2";
1059                                                    
1060          // Omit any pre-selected pages in sub_page          // Omit any pre-selected pages in sub_page
1061          $in_string = getNotIn($con, "page_id", "subject_id", $subject_id, "sub_page");          $in_string = getNotIn("page_id", "subject_id", $subject_id, "sub_page");
1062          if (strlen($in_string) > 0) $omit_string .= " AND page_id NOT IN " . $in_string;          if (strlen($in_string) > 0) $omit_string .= " AND page_id NOT IN " . $in_string;
1063                                    
1064          // Draw the combo box          // Draw the combo box
# Line 831  function formAssignSubPage($con, $subjec Line 1067  function formAssignSubPage($con, $subjec
1067                    
1068                    
1069          printf("<tr><td valign = \"top\" >\n");          printf("<tr><td valign = \"top\" >\n");
1070          printf("<br><strong>Available Page(s):<br></strong>\n");          printf("<br><b>Available Page(s):<br></b>\n");
1071          printf("<select name = \"page_id_array[]\" multiple size = \"5\" >");          printf("<select name = \"page_id_array[]\" multiple size = \"5\" >\n");
1072          dropDownFieldOmit($con, "page", "page_title", "page_id", $omit_string);          dropDownFieldOmit("page", "page_title", "page_id", $omit_string);
1073          printf("</select><br><br>");              printf("</select><br><br>\n");  
1074                    
1075          // Close things          // Close things
1076          printf("<center>");          printf("<center>\n");
1077          printf("<input type = \"Submit\" value = \" Add \" >");          printf("<input type = \"Submit\" value = \" Add \" >\n");
1078          printf("</form>");          printf("</form>\n");
1079          printf("</center>");          printf("</center>\n");
1080          printf("</td></tr>");          printf("</td></tr>\n");
1081                    
1082          // Current mastersubjects to deselect          // Current mastersubjects to deselect
1083          printf("<tr><td valign = \"top\" >\n");          printf("<tr><td valign = \"top\" >\n");
1084          printf("<form method = \"POST\" action = \"subject_transaction.phtml\" >");          printf("<form method = \"POST\" action = \"subject_transaction.phtml\" >\n");
1085          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id);          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id);
1086          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubPage\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubPage\" >\n");
1087          printf("<br><strong>Selected Page(s):</strong><br>\n");          printf("<br><b>Selected Page(s):</b><br>\n");
1088          printf("<select name =\"key_list_array[]\" multiple size = \"3\">");          printf("<select name =\"key_list_array[]\" multiple size = \"3\">\n");
1089                    
1090          $sql = "SELECT p.page_title, p.page_id FROM          $sql = "SELECT p.page_title, p.page_id FROM
1091                  page p,                  page p,
# Line 858  function formAssignSubPage($con, $subjec Line 1094  function formAssignSubPage($con, $subjec
1094                  sp.subject_id = " . $subject_id . " AND                  sp.subject_id = " . $subject_id . " AND
1095                  sp.page_id = p.page_id                  sp.page_id = p.page_id
1096                  ORDER BY p.page_title";                  ORDER BY p.page_title";
1097                    $rs = xx_tryquery($sql);
1098          // Fetch the values  
1099          $rs = xx_query($sql, $con);          while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
         while ($row = xx_fetch_array ($rs)) {  
1100                  $page_title = $row["page_title"];                  $page_title = $row["page_title"];
1101                  $page_id = $row["page_id"];                  $page_id = $row["page_id"];
1102                                    
1103                  // Pull out any HTML                  // Pull out any HTML
1104                  $page_title = strip_tags($page_title);                  $page_title = strip_tags($page_title);
1105                                    
1106                  printf("<option value = \"%s\">%s</option>", $page_id, $page_title);                  printf("<option value = \"%s\">%s</option>\n", $page_id, $page_title);
1107          }          }
1108                    
1109          // Close things          // Close things
1110          printf("</select><br><br>");          printf("</select><br><br>\n");
1111          printf("<center>");              printf("<center>\n");  
1112          printf("<input type = \"Submit\" value =\" Remove \">");          printf("<input type = \"Submit\" value =\" Remove \">\n");
1113          printf("</center>");          printf("</center>\n");
1114          printf("</form>");          printf("</form>\n");
1115          printf("</td></tr>");          printf("</td></tr>\n");
1116    
1117          // Close off the table          // Close off the table
1118          printf("</td></tr></table>");          printf("</td></tr></table>\n");
1119  }  }
1120    
1121    
1122  /**********************************************************  /**********************************************************
1123  Function: formAssignSubStaff  Function: formAssignSubStaff
1124  Author: Paul Bramscher  Author: Paul Bramscher
1125  Last Modified: 06.26.2003  Last Modified: 03.10.2004
1126  ***********************************************************  ***********************************************************
1127  Purpose:  Purpose:
1128  Draws an HTML combo box with multiple selection capability  Draws an HTML combo box with multiple selection capability
1129  to assign staffpersons to the supplied subject id.    to assign staffpersons to the supplied subject id.  
1130  **********************************************************/  **********************************************************/
1131  function formAssignSubStaff($con, $subject_id){  function formAssignSubStaff($subject_id){
1132    
1133          // Table definition          // Table definition
1134          printf("<br><br>\n");          printf("<br><br>\n");
1135          printf("<table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n");          printf("<table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n");
1136                    
1137          // Form of available staff to select          // Form of available staff to select
1138          printf("<form method = \"POST\" action = \"assign.phtml\" >");          printf("<form method = \"POST\" action = \"assign.phtml\" >\n");
1139          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1140          printf("Assign Staff");          printf("Assign Staff");
1141          printf("</td></tr>\n");          printf("</td></tr>\n");
1142                    
1143          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id);          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id);
1144          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubStaff\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubStaff\" >\n");
1145    
1146          // Omit the '(N/A)' staff          // Omit the '(N/A)' staff
1147          $omit_string = "WHERE staff_id > 1";          $omit_string = "WHERE staff_id > 1";
1148                                                    
1149          // Omit any pre-selected staff in sub_staff          // Omit any pre-selected staff in sub_staff
1150          $in_string = getNotIn($con, "staff_id", "subject_id", $subject_id, "sub_staff");          $in_string = getNotIn("staff_id", "subject_id", $subject_id, "sub_staff");
1151          if (strlen($in_string) > 0) $omit_string .= " AND staff_id NOT IN " . $in_string;          if (strlen($in_string) > 0) $omit_string .= " AND staff_id NOT IN " . $in_string;
1152    
1153          // Draw the combo box          // Draw the combo box
1154          printf("<tr><td valign = \"top\" >\n");          printf("<tr><td valign = \"top\" >\n");
1155          printf("<br><b>Available Staff:<br></b>\n");          printf("<br><b>Available Staff:<br></b>\n");
1156          printf("<select name = \"staff_id_array[]\" multiple size = \"5\" >");          printf("<select name = \"staff_id_array[]\" multiple size = \"5\" >\n");
1157          dropDownStaffOmit($con, $omit_string);          dropDownStaffOmit($omit_string);
1158          printf("</select><br><br>");          printf("</select><br><br>\n");
1159                    
1160          // Close things          // Close things
1161          printf("<center>");          printf("<center>\n");
1162          printf("<input type = \"Submit\" value = \" >> \" >");          printf("<input type = \"Submit\" value = \" >> \" >\n");
1163          printf("</form>");          printf("</form>\n");
1164          printf("</center>");          printf("</center>\n");
1165          printf("</td>");          printf("</td>\n");
1166                    
1167          // Current staff to deselect          // Current staff to deselect
1168          printf("<td valign = \"top\" >\n");          printf("<td valign = \"top\" >\n");
1169          printf("<form method = \"POST\" action = \"delete.phtml\" >");          printf("<form method = \"POST\" action = \"delete.phtml\" >\n");
1170          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id);          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id);
1171          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubStaff\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubStaff\" >\n");
1172          printf("<br><b>Selected Staff:</b><br>\n");          printf("<br><b>Selected Staff:</b><br>\n");
1173          printf("<select name =\"key_list_array[]\" multiple size = 5>");          printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n");
1174                    
1175          $sql = "SELECT t.staff_id, t.last_name, t.first_name FROM          $sql = "SELECT t.staff_id, t.last_name, t.first_name FROM
1176                  staff t,                  staff t,
# Line 945  function formAssignSubStaff($con, $subje Line 1180  function formAssignSubStaff($con, $subje
1180                  s.subject_id = " . $subject_id . " AND                  s.subject_id = " . $subject_id . " AND
1181                  st.subject_id = s.subject_id AND                  st.subject_id = s.subject_id AND
1182                  st.staff_id = t.staff_id ORDER BY last_name, first_name";                  st.staff_id = t.staff_id ORDER BY last_name, first_name";
1183            $rs = xx_tryquery($sql);
1184          // Fetch the values  
1185          $rs = xx_query($sql, $con);          while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
         while ($row = xx_fetch_array ($rs)) {  
1186                  $first_name = $row["first_name"];                  $first_name = $row["first_name"];
1187                  $last_name = $row["last_name"];                  $last_name = $row["last_name"];
1188                  $staff_id = $row["staff_id"];                  $staff_id = $row["staff_id"];
1189                  printf("<option value = \"%d\">%s, %s</option>", $staff_id, $last_name, $first_name);                  printf("<option value = \"%d\">%s, %s</option>\n", $staff_id, $last_name, $first_name);
1190          }          }
1191                    
1192          // Close things          // Close things
1193          printf("</select><br><br>");          printf("</select><br><br>\n");
1194          printf("<center>");              printf("<center>\n");  
1195          printf("<input type = \"Submit\" value =\" << \">");          printf("<input type = \"Submit\" value =\" << \">\n");
1196          printf("</center>");          printf("</center>\n");
1197          printf("</form>");          printf("</form>\n");
1198          printf("</td></tr>");          printf("</td></tr>\n");
1199    
1200          // Close off table          // Close off table
1201          printf("</td></tr></table>");          printf("</td></tr></table>\n");
1202  }  }
1203    
1204    
1205  /**********************************************************  /**********************************************************
1206  Function: formCoursesub  Function: formCoursesub
1207  Author: Paul Bramscher  Author: Paul Bramscher
1208  Last Modified: 07.02.2003  Last Modified: 03.16.2004
1209  ***********************************************************  ***********************************************************
1210  Purpose:  Purpose:
1211  Draws an HTML form to edit the supplied feature id, or to  Draws an HTML form to edit the supplied course subject id,
1212  create a new feature if the incoming id is less than 1.  or to create a new course subject if the incoming id is
1213    less than 1.
1214  **********************************************************/    **********************************************************/  
1215  function formCoursesub($con, $coursesub_id) {  function formCoursesub($coursesub_id) {
1216    
1217          // Cast as integer to be sure          // Cast as integer to be sure
1218          $coursesub_id = (int) $coursesub_id;          $coursesub_id = (int) $coursesub_id;
1219                    
1220          // Get descriptive title          // Get descriptive title
1221          $coursesub = lookupField($con, "coursesub", "coursesub_id", $coursesub_id, "coursesub");          $coursesub = lookupField("coursesub", "coursesub_id", $coursesub_id, "coursesub");
1222    
1223          // Check to see if coursesub actually exists          // Check to see if coursesub actually exists
1224          $exists = existsRow($con, "coursesub", "coursesub_id", $coursesub_id);          $exists = existsRow("coursesub", "coursesub_id", $coursesub_id);
1225    
1226          // Houston, we have a problem          // Houston, we have a problem
1227          if ($key_id > 0 && $exists == 0) {          if ($key_id > 0 && $exists == 0) {
1228                  $problem = 1;                  $problem = 1;
1229                  printf("<h3>Course Subject #%d Not Found</h3>", $coursesub_id);                  printf("<h3>Course Subject (ID# %d) Not Found</h3>\n", $coursesub_id);
1230          }          }
1231    
1232          // Check to see if there are affected courselib pages          // Check to see if there are affected courselib pages
1233          $exists_courselib = existsRow($con, "course", "coursesub_id", $coursesub_id);          $exists_courselib = existsRow("course", "coursesub_id", $coursesub_id);
1234          if ($exists_courselib > 0) {          if ($exists_courselib > 0) {
1235                    
1236                  $problem = 1;                  $problem = 1;
1237                    
1238                  // Table definition                    // Table definition  
1239                  printf("<center><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\">\n");                  msgTableOpen(1, "Edit Course Subject (ID# " . $coursesub_id . ")");
1240                  printf("<tr><td><br>\n");                  printf("<b>Messages:</b><br>\n");
                 printf("<b>Messages:</b><br>");  
1241                  printf("This course subject is currently used on one or more course pages.  ");                  printf("This course subject is currently used on one or more course pages.  ");
1242                  printf("It may not be edited or deleted until all affected courses are moved to ");                  printf("It may not be edited or deleted until all affected courses are moved to ");
1243                  printf("an alternate course subject. Follow the link below for a list of ");                  printf("an alternate course subject. Follow the link below for a list of ");
1244                  printf("affected pages.  Course titles are composed, in part, based on this ");                  printf("affected pages.  Course titles are composed, in part, based on this ");
1245                  printf("value.<br><br>");                  printf("value.<br><br>\n");
1246                  printf("<a href=\"page_results_brief.phtml?coursesub_id=%s\">", $coursesub_id);                  printf("<a href=\"page_results_brief.phtml?coursesub_id=%s\">", $coursesub_id);
1247                  printf("page_results_brief.phtml?coursesub_id=%s", $coursesub_id);                  printf("page_results_brief.phtml?coursesub_id=%s</a>", $coursesub_id);
1248                  printf("</a><br><br>");                  printf("<br><br>\n");
1249                  printf("</td></tr></table></center>\n");                  msgTableClose();
1250            
1251          }          }
1252    
   
   
   
1253          // If no problems, then go for landing          // If no problems, then go for landing
1254          if ($problem != 1) {          if ($problem != 1) {
1255                    
# Line 1030  function formCoursesub($con, $coursesub_ Line 1262  function formCoursesub($con, $coursesub_
1262                  // If the user is editing an existing record, fetch previous values                  // If the user is editing an existing record, fetch previous values
1263                  if ($coursesub_id > 0 && $exists == 1) {                  if ($coursesub_id > 0 && $exists == 1) {
1264                          $sql = "SELECT * FROM coursesub WHERE coursesub_id = " . $coursesub_id;                          $sql = "SELECT * FROM coursesub WHERE coursesub_id = " . $coursesub_id;
1265                          $rs = xx_query($sql, $con);                          $rs = xx_tryquery($sql);
1266                          $row = xx_fetch_array ($rs);                          $row = xx_fetch_array ($rs, xx_ASSOC);
1267    
1268                          // Fetch existing values                          // Fetch existing values
1269                          $coursesub_id = $row["coursesub_id"];                          $coursesub_id = $row["coursesub_id"];
# Line 1052  function formCoursesub($con, $coursesub_ Line 1284  function formCoursesub($con, $coursesub_
1284    
1285                  // If new insert                  // If new insert
1286                  if ($coursesub_id <1) {                  if ($coursesub_id <1) {
1287                          printf("<form method = \"POST\" action = \"insert.phtml\" >");                          printf("<form method = \"POST\" action = \"insert.phtml\" >\n");
1288                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1289                          printf("Enter New Course Subject");                          printf("Enter New Course Subject");
1290                          printf("</td></tr>\n");                          printf("</td></tr>\n");
# Line 1060  function formCoursesub($con, $coursesub_ Line 1292  function formCoursesub($con, $coursesub_
1292    
1293                  // Else update                  // Else update
1294                  else {                  else {
1295                          printf("<form method = \"POST\" action = \"update.phtml\" >");                          printf("<form method = \"POST\" action = \"update.phtml\" >\n");
1296                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1297                          printf("Edit Course Subject: %s (#%d)", $coursesub, $coursesub_id);                          printf("Edit Course Subject: %s (ID# %d)", $coursesub, $coursesub_id);
1298                          printf("</td></tr>\n");                          printf("</td></tr>\n");
1299                  }                  }
1300    
   
1301                  // Coursesub abbrev.                  // Coursesub abbrev.
1302                  printf("<tr>\n");                  printf("<tr>\n");
1303                  printf("<td><b>Course Subject Abbrev:</b></td>\n");                  printf("<td><b>Course Subject Abbrev:</b></td>\n");
# Line 1083  function formCoursesub($con, $coursesub_ Line 1314  function formCoursesub($con, $coursesub_
1314                  printf("<tr>\n");                  printf("<tr>\n");
1315                  printf("<td><b>Campus:</b></td>\n");                  printf("<td><b>Campus:</b></td>\n");
1316                  printf("<td><select name =\"campus_id\">");                  printf("<td><select name =\"campus_id\">");
1317                  dropDownFieldSelected($con, "campus", "campus", "campus_id", "WHERE campus_id >= 0", $campus_id);                  dropDownFieldSelected("campus", "campus", "campus_id", "WHERE campus_id >= 0", $campus_id);
1318                  printf("</select></td>\n");                  printf("</select></td>\n");
1319                  printf("</tr>\n");                                printf("</tr>\n");              
1320                                    
# Line 1098  function formCoursesub($con, $coursesub_ Line 1329  function formCoursesub($con, $coursesub_
1329                                    
1330                  // If this is an existing course subject                  // If this is an existing course subject
1331                  if ($coursesub_id > 0) {                  if ($coursesub_id > 0) {
1332                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateCoursesub\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateCoursesub\" >\n");
1333                          printf("<input type = \"Submit\" value = \"Update Course Subject\" > ");                          printf("<input type = \"Submit\" value = \"Update Course Subject\" >\n");
1334                          printf("<input type = \"Hidden\" name = \"coursesub_id\" value = \"%d\" > ", $coursesub_id);                          printf("<input type = \"Hidden\" name = \"coursesub_id\" value = \"%d\" >\n", $coursesub_id);
1335                  }                  }
1336                  // Editing a new course subject                  // Editing a new course subject
1337                  else {                  else {
1338                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertCoursesub\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertCoursesub\" >\n");
1339                          printf("<input type = \"Submit\" value = \"Save New Course Subject\"> ");                          printf("<input type = \"Submit\" value = \"Save New Course Subject\">\n");
1340                  }                  }
1341    
1342                  // Common button                  // Common button
# Line 1120  function formCoursesub($con, $coursesub_ Line 1351  function formCoursesub($con, $coursesub_
1351    
1352    
1353  /**********************************************************  /**********************************************************
1354  Function: formEditSingleField($con, $display, $display_field,  Function: formEditSingleField($display, $display_field,
1355          $key_field, $key_id, $table);          $key_field, $key_id, $table);
1356  Author: Paul Bramscher  Author: Paul Bramscher
1357  Last Modified: 07.03.2003  Last Modified: 03.15.2004
1358  ***********************************************************  ***********************************************************
1359  Incoming:  Incoming:
 $con                    Database connection string  
 $table                  Table name to operate against  
1360  $display                A display to the user, typically  $display                A display to the user, typically
1361                          similar to $display_field                          similar to $display_field
1362  $display_field          Field name within $table to generate  $display_field          Field name within $table to generate
1363                          displayed values from                            displayed values from  
1364  $key_field              Name of primary key field in $table  $key_field              Name of primary key field in $table
1365  $key_id                 Value of $key_field  $key_id                 Value of $key_field
1366    $table                  Table name to operate against
1367  ***********************************************************  ***********************************************************
1368  Outgoing:  Outgoing:
1369  None  None
# Line 1143  This is a generic form function to creat Line 1373  This is a generic form function to creat
1373  table.  The table's primary key must not involve a  table.  The table's primary key must not involve a
1374  composite key -- since this form won't handle that.  composite key -- since this form won't handle that.
1375  **********************************************************/  **********************************************************/
1376  function formEditSingleField($con, $display, $display_field, $key_field, $key_id,  function formEditSingleField($display, $display_field, $key_field, $key_id,
1377                  $size, $table) {                  $size, $table) {
1378    
1379          // Make sure we have a positive integer to work with          // Make sure we have a positive integer to work with
# Line 1159  function formEditSingleField($con, $disp Line 1389  function formEditSingleField($con, $disp
1389                          . " = "                          . " = "
1390                          . $key_id;                          . $key_id;
1391                    
1392                  $rs = xx_query($sql, $con);                  $rs = xx_tryquery($sql);
1393                  $row = xx_fetch_array($rs);                  $row = xx_fetch_array($rs, xx_ASSOC);
1394                  $oldValue = Trim($row[$display_field]);                  $oldValue = Trim($row[$display_field]);
1395    
1396                  // Table definition                  // Table definition
1397                  printf("<center>\n");                  printf("<center>\n");
1398                  printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\"");                  printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\">\n");
1399                  printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                  printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1400                  printf("Edit %s: %s (#%d)", $display, $oldValue, $key_id);                  printf("Edit %s: %s (ID# %d)", $display, $oldValue, $key_id);
1401                  printf("</td></tr>\n");                  printf("</td></tr>\n");
1402                                    
1403                  // Form to handle any single field                  // Form to handle any single field
1404                  printf("<form method = \"POST\" action = \"update.phtml\" >");                  printf("<form method = \"POST\" action = \"update.phtml\" >\n");
1405                  printf("<tr><td>");                  printf("<tr><td>\n");
1406                  printf("<b>%s:</b> ", $display);                  printf("<b>%s:</b>\n", $display);
1407                  printf("</td>\n");                  printf("</td>\n");
1408                  printf("<td>\n");                  printf("<td>\n");
1409                  printf("<input type = \"text\" name = \"newValue\" size=\"%d\" value =\"%s\" >", $size, $oldValue);                  printf("<input type = \"text\" name = \"newValue\" size=\"%d\" value =\"%s\" >\n", $size, $oldValue);
1410                  printf("<input type = \"Hidden\" name = \"display\" value = \"%s\" >", $display);                  printf("<input type = \"Hidden\" name = \"display\" value = \"%s\" >\n", $display);
1411                  printf("<input type = \"Hidden\" name = \"display_field\" value = \"%s\" >", $display_field);                  printf("<input type = \"Hidden\" name = \"display_field\" value = \"%s\" >\n", $display_field);
1412                  printf("<input type = \"Hidden\" name = \"key_field\" value = \"%s\" >", $key_field);                  printf("<input type = \"Hidden\" name = \"key_field\" value = \"%s\" >\n", $key_field);
1413                  printf("<input type = \"Hidden\" name = \"key_id\" value = \"%s\" >", $key_id);                  printf("<input type = \"Hidden\" name = \"key_id\" value = \"%s\" >\n", $key_id);
1414                  printf("<input type = \"Hidden\" name = \"table\" value = \"%s\" >", $table);                  printf("<input type = \"Hidden\" name = \"table\" value = \"%s\" >\n", $table);
1415                  printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateSingleField\" >");                  printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateSingleField\" >\n");
1416                  printf("</td></tr>\n");                  printf("</td></tr>\n");
1417                  printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");                  printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");
1418                  printf("<input type = \"Submit\" value = \"Save Changes To %s\" > ", $display);                  printf("<input type = \"Submit\" value = \"Save Changes To %s\" >\n", $display);
1419                  printf("<input type = \"Reset\" value = \"Reset\" >");                  printf("<input type = \"Reset\" value = \"Reset\" >\n");
1420                                    
1421                  // Close things                  // Close things
1422                  printf("</form><BR>");                  printf("</form><br>\n");
1423                  printf("</td></tr>");                  printf("</td></tr>\n");
1424                  printf("</table></center>");                  printf("</table></center>\n");
1425    
1426          }          }
1427    
# Line 1202  function formEditSingleField($con, $disp Line 1432  function formEditSingleField($con, $disp
1432  /**********************************************************  /**********************************************************
1433  Function: formFaculty  Function: formFaculty
1434  Author: Paul Bramscher  Author: Paul Bramscher
1435  Last Modified: 07.03.2003  Last Modified: 03.16.2004
1436  ***********************************************************  ***********************************************************
1437  Purpose:  Purpose:
1438  Draws an HTML form to edit the supplied faculty id, or to  Draws an HTML form to edit the supplied faculty id, or to
1439  create a new faculty person if the incoming id is less than  create a new faculty person if the incoming id is less than
1440  1.  1.
1441  **********************************************************/  **********************************************************/
1442  function formFaculty($con, $faculty_id){  function formFaculty($faculty_id){
1443    
1444          // Initialize variables          // Initialize variables
1445          $faculty_id = (int) $faculty_id;          $faculty_id = (int) $faculty_id;
# Line 1228  function formFaculty($con, $faculty_id){ Line 1458  function formFaculty($con, $faculty_id){
1458                          FROM faculty f                          FROM faculty f
1459                          WHERE                          WHERE
1460                          faculty_id = " . $faculty_id;                          faculty_id = " . $faculty_id;
1461                    $rs = xx_tryquery($sql);
1462                  $rs = xx_query($sql, $con);                  $row = xx_fetch_array($rs, xx_ASSOC);
                 $row = xx_fetch_array($rs);  
1463                                    
1464                  // Fetch results                  // Fetch results
1465                  $faculty_firstname = Trim($row["faculty_firstname"]);                  $faculty_firstname = Trim($row["faculty_firstname"]);
# Line 1248  function formFaculty($con, $faculty_id){ Line 1477  function formFaculty($con, $faculty_id){
1477    
1478          // If new faculty          // If new faculty
1479          if ($faculty_id < 1) {          if ($faculty_id < 1) {
1480                  printf("<form method = \"POST\" action = \"insert.phtml\" >");                  printf("<form method = \"POST\" action = \"insert.phtml\" >\n");
1481                  printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                  printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1482                  printf("Enter New Faculty");                  printf("Enter New Faculty");
1483                  printf("</td></tr>\n");                  printf("</td></tr>\n");
# Line 1256  function formFaculty($con, $faculty_id){ Line 1485  function formFaculty($con, $faculty_id){
1485    
1486          // Else update          // Else update
1487          else {          else {
1488                  printf("<form method = \"POST\" action = \"update.phtml\" >");                  printf("<form method = \"POST\" action = \"update.phtml\" >\n");
1489                  printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                  printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1490                  printf("Edit Faculty: %s %s (#%d)", $faculty_firstname, $faculty_lastname, $faculty_id);                  printf("Edit Faculty: %s %s (ID# %d)", $faculty_firstname, $faculty_lastname, $faculty_id);
1491                  printf("</td></tr>\n");                  printf("</td></tr>\n");
1492          }          }
1493                    
# Line 1290  function formFaculty($con, $faculty_id){ Line 1519  function formFaculty($con, $faculty_id){
1519          printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");          printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");
1520          // If new faculty          // If new faculty
1521          if ($faculty_id < 1) {          if ($faculty_id < 1) {
1522                  printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertFaculty\" >");                  printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertFaculty\" >\n");
1523                  printf("<input type = \"Submit\" value = \"Save New Faculty\" > ");                  printf("<input type = \"Submit\" value = \"Save New Faculty\" >\n");
1524          }          }
1525          // Editing an existing faculty person          // Editing an existing faculty person
1526          else {          else {
1527                  printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateFaculty\" >");                  printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateFaculty\" >\n");
1528                  printf("<input type = \"Hidden\" name = \"faculty_id\" value = \"%d\" >", $faculty_id);                  printf("<input type = \"Hidden\" name = \"faculty_id\" value = \"%d\" >\n", $faculty_id);
1529                  printf("<input type = \"Submit\" value = \"Save Faculty Changes\" > ");                  printf("<input type = \"Submit\" value = \"Save Faculty Changes\" >\n");
1530          }          }
1531          printf("<input type = \"Reset\" value = \"Reset\" >");          printf("<input type = \"Reset\" value = \"Reset\" >\n");
1532    
1533          // Close things          // Close things
1534          printf("</form>");          printf("</form>\n");
1535          printf("</td></tr></table>");          printf("</td></tr></table>\n");
1536          printf("</center><br>");          printf("</center><br>\n");
1537  }  }
1538    
1539    
1540  /**********************************************************  /**********************************************************
1541  Function: formFeature  Function: formFeature
1542  Author: Paul Bramscher  Author: Paul Bramscher
1543  Last Modified: 07.01.2003  Last Modified: 03.15.2004
1544  ***********************************************************  ***********************************************************
1545  Purpose:  Purpose:
1546  Draws an HTML form to edit the supplied feature id, or to  Draws an HTML form to edit the supplied feature id, or to
1547  create a new feature if the incoming id is less than 1.  create a new feature if the incoming id is less than 1.
1548  **********************************************************/    **********************************************************/  
1549  function formFeature($con, $key_id) {  function formFeature($key_id) {
1550    
1551          // Cast as integer to be sure          // Cast as integer to be sure
1552          $key_id = (int) $key_id;          $key_id = (int) $key_id;
1553    
1554          // Check to see if feature actually exists          // Check to see if feature actually exists
1555          $exists = existsRow($con, "feature", "feature_id", $key_id);          $exists = existsRow("feature", "feature_id", $key_id);
1556    
1557          // Header          // Header
1558          printf("<center>");          printf("<center>");
# Line 1335  function formFeature($con, $key_id) { Line 1564  function formFeature($con, $key_id) {
1564                    
1565                  // Fetch existing values                          // Fetch existing values        
1566                  $sql = "SELECT * FROM feature WHERE feature_id = " . $key_id;                  $sql = "SELECT * FROM feature WHERE feature_id = " . $key_id;
1567                  $rs = xx_query($sql, $con);                  $rs = xx_tryquery($sql);
1568                  $row = xx_fetch_array ($rs);                  $row = xx_fetch_array ($rs, xx_ASSOC);
1569                  $feature_id = $row["feature_id"];                  $feature_id = $row["feature_id"];
1570                  $feature = $row["feature"];                  $feature = $row["feature"];
1571                  $image_path = $row["image_path"];                  $image_path = $row["image_path"];
# Line 1351  function formFeature($con, $key_id) { Line 1580  function formFeature($con, $key_id) {
1580          // Houston, we have a problem          // Houston, we have a problem
1581          if ($key_id > 0 && $exists == 0) {          if ($key_id > 0 && $exists == 0) {
1582                  $problem = 1;                  $problem = 1;
1583                  printf("<h3>Feature #%d Not Found</h3>", $key_id);                  printf("<h3>Feature (ID# %d) Not Found</h3>\n", $key_id);
1584          }          }
1585    
1586          // If no problems, then go for landing          // If no problems, then go for landing
# Line 1363  function formFeature($con, $key_id) { Line 1592  function formFeature($con, $key_id) {
1592                  // Form to handle feature                  // Form to handle feature
1593                  // If new insert                  // If new insert
1594                  if ($key_id <1) {                  if ($key_id <1) {
1595                          printf("<form method = \"POST\" action = \"insert.phtml\" >");                          printf("<form method = \"POST\" action = \"insert.phtml\" >\n");
1596                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1597                          printf("Enter New Feature");                          printf("Enter New Feature");
1598                          printf("</td></tr>\n");                          printf("</td></tr>\n");
# Line 1371  function formFeature($con, $key_id) { Line 1600  function formFeature($con, $key_id) {
1600    
1601                  // Else update                  // Else update
1602                  else {                  else {
1603                          printf("<form method = \"POST\" action = \"update.phtml\" >");                          printf("<form method = \"POST\" action = \"update.phtml\" >\n");
1604                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1605                          printf("Edit Feature: %s (#%d)", $feature, $feature_id);                          printf("Edit Feature: %s (ID# %d)", $feature, $feature_id);
1606                          printf("</td></tr>\n");                          printf("</td></tr>\n");
1607                  }                  }
1608    
1609                  // Feature name                  // Feature name
1610                  printf("<tr>\n");                  printf("<tr>\n");
1611                  printf("<td><b>Feature:</b></td>");                  printf("<td><b>Feature:</b></td>\n");
1612                  printf("<td><input type = \"text\" name = \"feature\" size = \"40\" value = \"%s\" ></td>\n", $feature);                  printf("<td><input type = \"text\" name = \"feature\" size = \"40\" value = \"%s\" ></td>\n", $feature);
1613                  printf("</tr>\n");                  printf("</tr>\n");
1614    
# Line 1398  function formFeature($con, $key_id) { Line 1627  function formFeature($con, $key_id) {
1627                  printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");                  printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");
1628                  // If this is an existing feature                  // If this is an existing feature
1629                  if ($key_id > 0) {                  if ($key_id > 0) {
1630                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateFeature\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateFeature\" >\n");
1631                          printf("<input type = \"Submit\" value = \"Update Feature\" > ");                          printf("<input type = \"Submit\" value = \"Update Feature\" >\n");
1632                          printf("<input type = \"Hidden\" name = \"feature_id\" value = \"%d\" > ", $feature_id);                          printf("<input type = \"Hidden\" name = \"feature_id\" value = \"%d\" >\n", $feature_id);
1633                  }                  }
1634                  // Editing a new feature                  // Editing a new feature
1635                  else {                  else {
1636                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertFeature\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertFeature\" >\n");
1637                          printf("<input type = \"Submit\" value = \"Save New Feature\"> ");                          printf("<input type = \"Submit\" value = \"Save New Feature\">\n");
1638                  }                  }
1639    
1640                  // Common button                  // Common button
# Line 1422  function formFeature($con, $key_id) { Line 1651  function formFeature($con, $key_id) {
1651  /**********************************************************  /**********************************************************
1652  Function: formInfotype  Function: formInfotype
1653  Author: Paul Bramscher  Author: Paul Bramscher
1654  Last Modified: 06.26.2003  Last Modified: 03.15.2004
1655  ***********************************************************  ***********************************************************
1656  Purpose:  Purpose:
1657  Draws an HTML form to edit the supplied information type id,  Draws an HTML form to edit the supplied information type id,
1658  or to create a new information type if the incoming id is  or to create a new information type if the incoming id is
1659  less than 1.  less than 1.
1660  **********************************************************/    **********************************************************/  
1661  function formInfotype($con, $key_id) {  function formInfotype($key_id) {
1662    
1663          // Cast as integer to be sure          // Cast as integer to be sure
1664          $key_id = (int) $key_id;          $key_id = (int) $key_id;
1665    
1666          // Check to see if infotype actually exists          // Check to see if infotype actually exists
1667          $exists = existsRow($con, "infotype", "infotype_id", $key_id);          $exists = existsRow("infotype", "infotype_id", $key_id);
1668    
1669          // Header          // Header
1670          printf("<center>");          printf("<center>\n");
1671          if ($key_id > 0 && $exists == 1) {          if ($key_id > 0 && $exists == 1) {
1672                    
1673                  // Initialization                  // Initialization
# Line 1449  function formInfotype($con, $key_id) { Line 1678  function formInfotype($con, $key_id) {
1678    
1679                  // Fetch existing values                          // Fetch existing values        
1680                  $sql = "SELECT * from infotype where infotype_id = " . $key_id;                  $sql = "SELECT * from infotype where infotype_id = " . $key_id;
1681                  $rs = xx_query($sql, $con);                  $rs = xx_tryquery($sql);
1682                  $row = xx_fetch_array ($rs);                  $row = xx_fetch_array ($rs, xx_ASSOC);
1683                  $infotype_id = $row["infotype_id"];                  $infotype_id = $row["infotype_id"];
1684                  $infotype = $row["infotype"];                  $infotype = $row["infotype"];
1685                  $masterinfotype_id = $row["masterinfotype_id"];                  $masterinfotype_id = $row["masterinfotype_id"];
# Line 1464  function formInfotype($con, $key_id) { Line 1693  function formInfotype($con, $key_id) {
1693          // Houston, we have a problem          // Houston, we have a problem
1694          if ($key_id > 0 && $exists == 0) {          if ($key_id > 0 && $exists == 0) {
1695                  $problem = 1;                  $problem = 1;
1696                  printf("<h3>Information Type #%d Not Found</h3>", $key_id);                  printf("<h3>Information Type (ID# %d) Not Found</h3>\n", $key_id);
1697          }          }
1698    
1699          // If no problems, then go for landing          // If no problems, then go for landing
# Line 1475  function formInfotype($con, $key_id) { Line 1704  function formInfotype($con, $key_id) {
1704    
1705                  // If new insert                  // If new insert
1706                  if ($key_id < 1) {                  if ($key_id < 1) {
1707                          printf("<form method = \"POST\" action = \"insert.phtml\" >");                          printf("<form method = \"POST\" action = \"insert.phtml\" >\n");
1708                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1709                          printf("Enter New Information Type");                          printf("Enter New Information Type");
1710                          printf("</td></tr>\n");                                          printf("</td></tr>\n");                
# Line 1484  function formInfotype($con, $key_id) { Line 1713  function formInfotype($con, $key_id) {
1713    
1714                  // Else update                  // Else update
1715                  else {                  else {
1716                          printf("<form method = \"POST\" action = \"update.phtml\" >");                          printf("<form method = \"POST\" action = \"update.phtml\" >\n");
1717                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1718                          printf("Edit Information Type: %s (#%d)", $infotype, $infotype_id);                          printf("Edit Information Type: %s (ID# %d)", $infotype, $infotype_id);
1719                          printf("</td></tr>\n");                          printf("</td></tr>\n");
1720                  }                  }
1721    
# Line 1500  function formInfotype($con, $key_id) { Line 1729  function formInfotype($con, $key_id) {
1729                  printf("<tr>\n");                  printf("<tr>\n");
1730                  printf("<td><b>Master Information Type:</b></td>\n");                  printf("<td><b>Master Information Type:</b></td>\n");
1731                  printf("<td>\n");                  printf("<td>\n");
1732                  printf("<select name =\"masterinfotype_id\">");                  printf("<select name =\"masterinfotype_id\">\n");
1733                  dropDownFieldSelected($con, "masterinfotype", "masterinfotype", "masterinfotype_id", "WHERE masterinfotype_id >= 0", $masterinfotype_id);                  dropDownFieldSelected("masterinfotype", "masterinfotype", "masterinfotype_id", "WHERE masterinfotype_id >= 0", $masterinfotype_id);
1734                  printf("</select>\n");                  printf("</select>\n");
1735                  printf("</td></tr>\n");                  printf("</td></tr>\n");
1736    
1737                  // Mastersubject                  // Mastersubject
1738                  printf("<tr>\n");                  printf("<tr>\n");
1739                  printf("<td><b>Master Subject:</b></td>");                  printf("<td><b>Master Subject:</b></td>\n");
1740                  printf("<td>\n");                  printf("<td>\n");
1741                  printf("<select name =\"mastersubject_id\">");                  printf("<select name =\"mastersubject_id\">\n");
1742                  dropDownFieldSelected($con, "mastersubject", "mastersubject", "mastersubject_id", "WHERE mastersubject_id >= 0", $mastersubject_id);                  dropDownFieldSelected("mastersubject", "mastersubject", "mastersubject_id", "WHERE mastersubject_id >= 0", $mastersubject_id);
1743                  printf("</select>\n");                  printf("</select>\n");
1744                  printf("</td></tr>\n");                  printf("</td></tr>\n");
1745                                    
# Line 1519  function formInfotype($con, $key_id) { Line 1748  function formInfotype($con, $key_id) {
1748                                    
1749                  // If this is an existing infotype                  // If this is an existing infotype
1750                  if ($key_id > 0) {                  if ($key_id > 0) {
1751                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateInfotype\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateInfotype\" >\n");
1752                          printf("<input type = \"Submit\" value = \"Update Info Type\" > ");                          printf("<input type = \"Submit\" value = \"Update Info Type\" >\n");
1753                          printf("<input type = \"Hidden\" name = \"infotype_id\" value = \"%d\" > ", $infotype_id);                          printf("<input type = \"Hidden\" name = \"infotype_id\" value = \"%d\" >\n", $infotype_id);
1754                  }                  }
1755                  // Editing a new infotype                  // Editing a new infotype
1756                  else {                  else {
1757                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertInfotype\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertInfotype\" >\n");
1758                          printf("<input type = \"Submit\" value = \"Save New Info Type\"> ");                          printf("<input type = \"Submit\" value = \"Save New Info Type\">\n");
1759                  }                  }
1760    
1761                  // Common button                  // Common button
# Line 1542  function formInfotype($con, $key_id) { Line 1771  function formInfotype($con, $key_id) {
1771    
1772    
1773  /**********************************************************  /**********************************************************
1774    Function: formLibunit
1775    Author: Paul Bramscher
1776    Last Modified: 03.16.2004
1777    ***********************************************************
1778    Purpose:
1779    Handles the creation of new (or editing of existing)
1780    library units.
1781    **********************************************************/
1782    function formLibunit($key_id){
1783    
1784            // Initialize variables
1785            $libunit_id = (int) $key_id;
1786            $libunit ="";
1787            $libunit_abbrev = "";
1788    
1789            // If editing an existing library unit load previous values
1790            if ($libunit_id > 1){
1791                    $sql = "SELECT
1792                            l.libunit,
1793                            l.libunit_abbrev,
1794                            l.head_staff_id
1795                            FROM libunit l
1796                            WHERE
1797                            libunit_id = " . $libunit_id;
1798                    $rs = xx_tryquery($sql);
1799                    $row = xx_fetch_array($rs, xx_ASSOC);
1800                    
1801                    // Fetch values
1802                    $libunit = Trim($row["libunit"]);
1803                    $libunit_abbrev = Trim($row["libunit_abbrev"]);
1804                    $head_staff_id = $row["head_staff_id"];
1805                    
1806                    // Run strings through the HTML cleaner for output
1807                    $libunit = textOutHTML($libunit);
1808                    $libunit_abbrev = textOutHTML($libunit_abbrev);
1809    
1810            }
1811    
1812            // Table definition  
1813            printf("<center><table width=\"75%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\">\n");
1814    
1815            // If new insert
1816            if ($key_id <1) {
1817                    printf("<form method = \"POST\" action = \"insert.phtml\" >\n");
1818                    printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1819                    printf("Enter New Library Unit");
1820                    printf("</td></tr>\n");
1821            }
1822    
1823            // Else update
1824            else {
1825                    printf("<form method = \"POST\" action = \"update.phtml\" >\n");
1826                    printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1827                    printf("Edit Library Unit: %s (ID# %d)", $libunit, $libunit_id);
1828                    printf("</td></tr>\n");
1829            }
1830    
1831            // Libunit
1832            printf("<td><b>Library Unit:</b></td>\n");  
1833            printf("<td><input type = \"text\" name = \"libunit\" size = \"60\" value = \"%s\" ></td>\n", $libunit);
1834            printf("</td></tr>\n");
1835    
1836            // Libunit abbrev.
1837            printf("<tr>\n");
1838            printf("<td><b>Abbreviation:</b></td>\n");
1839            printf("<td><input type = \"text\" name = \"libunit_abbrev\" size = \"20\" value = \"%s\"></td>\n", $libunit_abbrev);
1840            printf("</tr>\n");
1841    
1842            // Libunit lead
1843            printf("<tr>\n");      
1844            printf("<td><b>Unit Lead:</b></td>\n");  
1845            printf("<td><select name = \"head_staff_id\" >\n");
1846            dropDownStaffSelected($head_staff_id);
1847            printf("</select></td>\n");
1848            printf("</tr>\n");
1849    
1850            // Buttons
1851            printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");
1852            
1853            // If new libunit
1854            if ($libunit_id < 2) {
1855                    printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertLibunit\" >\n");
1856                    printf("<input type = \"Submit\" value = \"Save New Library Unit\" >\n");
1857            }
1858            // Editing an existing libunit
1859            else {
1860                    printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateLibunit\" >\n");
1861                    printf("<input type = \"Hidden\" name = \"libunit_id\" value = \"%d\" >\n", $libunit_id);
1862                    printf("<input type = \"Submit\" value = \"Save Library Unit Changes\" >\n");
1863            }
1864            printf("<input type = \"Reset\" value = \"Reset\" >\n");
1865    
1866            // Close the form and table
1867            printf("</form>\n");
1868            printf("</td></tr></table>\n");
1869    
1870            // Other forms - only if editing an existing libunit
1871    
1872            if ($libunit_id > 0) {
1873                    formAssignLibunitStaff($libunit_id);
1874            }
1875    
1876            printf("</center><br>\n");
1877    }
1878    
1879    
1880    /**********************************************************
1881  Function: formLocation  Function: formLocation
1882  Author: Paul Bramscher  Author: Paul Bramscher
1883  Last Modified: 06.26.2003  Last Modified: 03.15.2004
1884  ***********************************************************  ***********************************************************
1885  Draws an HTML form to edit the supplied location id, or to  Draws an HTML form to edit the supplied location id, or to
1886  create a new location if the incoming id is less than 1.  create a new location if the incoming id is less than 1.
1887  **********************************************************/    **********************************************************/  
1888  function formLocation($con, $key_id) {  function formLocation($key_id) {
1889    
1890          // Cast as integer to be sure          // Cast as integer to be sure
1891          $key_id = (int) $key_id;          $key_id = (int) $key_id;
1892    
1893          // Check to see if location actually exists          // Check to see if location actually exists
1894          $exists = existsRow($con, "location", "location_id", $key_id);          $exists = existsRow("location", "location_id", $key_id);
1895    
1896          // Header          // Header
1897          printf("<center>");          printf("<center>");
# Line 1577  function formLocation($con, $key_id) { Line 1913  function formLocation($con, $key_id) {
1913    
1914                  // Fetch existing values                  // Fetch existing values
1915                  $sql = "SELECT * from location where location_id = " . $key_id;                  $sql = "SELECT * from location where location_id = " . $key_id;
1916                  $rs = xx_query($sql, $con);                  $rs = xx_tryquery($sql);
1917                  $row = xx_fetch_array ($rs);                  $row = xx_fetch_array ($rs, xx_ASSOC);
1918                  $location_id = $row["location_id"];                  $location_id = $row["location_id"];
1919                  $location = $row["location"];                  $location = $row["location"];
1920                  $location_descr = $row["location_descr"];                  $location_descr = $row["location_descr"];
# Line 1607  function formLocation($con, $key_id) { Line 1943  function formLocation($con, $key_id) {
1943          // Houston, we have a problem          // Houston, we have a problem
1944          if ($key_id > 0 && $exists == 0) {          if ($key_id > 0 && $exists == 0) {
1945                  $problem = 1;                  $problem = 1;
1946                  printf("<h3>Location #%d Not Found</h3>", $key_id);                  printf("<h3>Location (ID# %d) Not Found</h3>\n", $key_id);
1947          }          }
1948    
1949          // If no problems, then go for landing          // If no problems, then go for landing
# Line 1618  function formLocation($con, $key_id) { Line 1954  function formLocation($con, $key_id) {
1954    
1955                  // If new insert                  // If new insert
1956                  if ($key_id <1) {                  if ($key_id <1) {
1957                          printf("<form method = \"POST\" action = \"insert.phtml\" >");                          printf("<form method = \"POST\" action = \"insert.phtml\" >\n");
1958                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1959                          printf("Enter New Location");                          printf("Enter New Location");
1960                          printf("</td></tr>\n");                          printf("</td></tr>\n");
# Line 1626  function formLocation($con, $key_id) { Line 1962  function formLocation($con, $key_id) {
1962    
1963                  // Else update                  // Else update
1964                  else {                  else {
1965                          printf("<form method = \"POST\" action = \"update.phtml\" >");                          printf("<form method = \"POST\" action = \"update.phtml\" >\n");
1966                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
1967                          printf("Edit Location: %s (#%d)", $location, $location_id);                          printf("Edit Location: %s (ID# %d)", $location, $location_id);
1968                          printf("</td></tr>\n");                          printf("</td></tr>\n");
1969                  }                  }
1970    
1971                  // Location/Library                  // Location/Library
1972                  printf("<tr>\n");                  printf("<tr>\n");
1973                  printf("<td><b>Location/Library:</b></td>");                  printf("<td><b>Location/Library:</b></td>\n");
1974                  printf("<td>\n");                  printf("<td>\n");
1975                  printf("<input type = \"text\" name = \"location\" size = \"60\" value = \"%s\" >", $location);                  printf("<input type = \"text\" name = \"location\" size = \"60\" value = \"%s\" >\n", $location);
1976                  printf("</td></tr>\n");                  printf("</td></tr>\n");
1977    
1978                  // Description                  // Description
# Line 1651  function formLocation($con, $key_id) { Line 1987  function formLocation($con, $key_id) {
1987                  printf("<tr>\n");                  printf("<tr>\n");
1988                  printf("<td><b>Campus:</b></td>\n");                  printf("<td><b>Campus:</b></td>\n");
1989                  printf("<td>\n");                  printf("<td>\n");
1990                  printf("<input type = \"text\" name = \"campus\" size = \"50\" value = \"%s\" >", $campus);                  printf("<input type = \"text\" name = \"campus\" size = \"50\" value = \"%s\" >\n", $campus);
1991                  printf("</td></tr>\n");                  printf("</td></tr>\n");
1992    
1993                  // Address1                  // Address1
1994                  printf("<tr>\n");                  printf("<tr>\n");
1995                  printf("<td><b>Address Line 1:</b></td>\n");                  printf("<td><b>Address Line 1:</b></td>\n");
1996                  printf("<td>\n");                  printf("<td>\n");
1997                  printf("<input type = \"text\" name = \"address1\" size = \"50\" value = \"%s\" >", $address1);                  printf("<input type = \"text\" name = \"address1\" size = \"50\" value = \"%s\" >\n", $address1);
1998                  printf("</td></tr>\n");                  printf("</td></tr>\n");
1999    
2000                  // Address2                  // Address2
2001                  printf("<tr>\n");                  printf("<tr>\n");
2002                  printf("<td><b>Address Line 2:</b></td>\n");                  printf("<td><b>Address Line 2:</b></td>\n");
2003                  printf("<td>\n");                  printf("<td>\n");
2004                  printf("<input type = \"text\" name = \"address2\" size = \"50\" value = \"%s\" >", $address2);                  printf("<input type = \"text\" name = \"address2\" size = \"50\" value = \"%s\" >\n", $address2);
2005                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2006    
2007                  // Address3                  // Address3
2008                  printf("<tr>\n");                  printf("<tr>\n");
2009                  printf("<td><b>Address Line 3:</b></td>\n");                  printf("<td><b>Address Line 3:</b></td>\n");
2010                  printf("<td>\n");                  printf("<td>\n");
2011                  printf("<input type = \"text\" name = \"address3\" size = \"50\" value = \"%s\" >", $address3);                  printf("<input type = \"text\" name = \"address3\" size = \"50\" value = \"%s\" >\n", $address3);
2012                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2013    
2014                  // Address4                  // Address4
2015                  printf("<tr>\n");                  printf("<tr>\n");
2016                  printf("<td><b>Address Line 4:</b></td>\n");                  printf("<td><b>Address Line 4:</b></td>\n");
2017                  printf("<td>\n");                  printf("<td>\n");
2018                  printf("<input type = \"text\" name = \"address4\" size = \"50\" value = \"%s\" >", $address4);                  printf("<input type = \"text\" name = \"address4\" size = \"50\" value = \"%s\" >\n", $address4);
2019                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2020    
2021                  // Telephone                  // Telephone
2022                  printf("<tr>\n");                  printf("<tr>\n");
2023                  printf("<td><b>Telephone:</b></td>\n");                  printf("<td><b>Telephone:</b></td>\n");
2024                  printf("<td>\n");                  printf("<td>\n");
2025                  printf("<input type = \"text\" name = \"telephone\" size = \"25\" value = \"%s\" >", $telephone);                  printf("<input type = \"text\" name = \"telephone\" size = \"25\" value = \"%s\" >\n", $telephone);
2026                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2027    
2028                  // mainURL                  // mainURL
2029                  printf("<tr>\n");                  printf("<tr>\n");
2030                  printf("<td><b>Main URL:</b></td>\n");                  printf("<td><b>Main URL:</b></td>\n");
2031                  printf("<td>\n");                  printf("<td>\n");
2032                  printf("<input type = \"text\" name = \"mainURL\" size = \"70\" value = \"%s\" >", $mainURL);                  printf("<input type = \"text\" name = \"mainURL\" size = \"70\" value = \"%s\" >\n", $mainURL);
2033                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2034    
2035                  // referenceURL                  // referenceURL
2036                  printf("<tr>\n");                  printf("<tr>\n");
2037                  printf("<td><b>Reference URL:</b></td>\n");                  printf("<td><b>Reference URL:</b></td>\n");
2038                  printf("<td>\n");                  printf("<td>\n");
2039                  printf("<input type = \"text\" name = \"referenceURL\" size = \"70\" value = \"%s\" >",                  printf("<input type = \"text\" name = \"referenceURL\" size = \"70\" value = \"%s\" >\n",
2040                          $referenceURL);                          $referenceURL);
2041                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2042    
# Line 1708  function formLocation($con, $key_id) { Line 2044  function formLocation($con, $key_id) {
2044                  printf("<tr>\n");                  printf("<tr>\n");
2045                  printf("<td><b>Hours URL:</b></td>\n");                  printf("<td><b>Hours URL:</b></td>\n");
2046                  printf("<td>\n");                  printf("<td>\n");
2047                  printf("<input type = \"text\" name = \"hoursURL\" size = \"70\" value = \"%s\" >",                  printf("<input type = \"text\" name = \"hoursURL\" size = \"70\" value = \"%s\" >\n",
2048                          $hoursURL);                          $hoursURL);
2049                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2050    
# Line 1716  function formLocation($con, $key_id) { Line 2052  function formLocation($con, $key_id) {
2052                  printf("<tr>\n");                  printf("<tr>\n");
2053                  printf("<td><b>Map URL:</b></td>\n");                  printf("<td><b>Map URL:</b></td>\n");
2054                  printf("<td>\n");                  printf("<td>\n");
2055                  printf("<input type = \"text\" name = \"mapURL\" size = \"70\" value = \"%s\" >", $mapURL);                  printf("<input type = \"text\" name = \"mapURL\" size = \"70\" value = \"%s\" >\n", $mapURL);
2056                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2057    
2058                  // Buttons                  // Buttons
# Line 1724  function formLocation($con, $key_id) { Line 2060  function formLocation($con, $key_id) {
2060                                    
2061                  // If this is an existing location                  // If this is an existing location
2062                  if ($key_id > 0) {                  if ($key_id > 0) {
2063                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateLocation\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateLocation\" >\n");
2064                          printf("<input type = \"Submit\" value = \"Update Location\" > ");                          printf("<input type = \"Submit\" value = \"Update Location\" >\n");
2065                          printf("<input type = \"Hidden\" name = \"location_id\" value = \"%d\" > ", $location_id);                          printf("<input type = \"Hidden\" name = \"location_id\" value = \"%d\" >\n", $location_id);
2066                  }                  }
2067                  // Editing a new location                  // Editing a new location
2068                  else {                  else {
2069                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertLocation\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertLocation\" >\n");
2070                          printf("<input type = \"Submit\" value = \"Save New Location\" > ");                          printf("<input type = \"Submit\" value = \"Save New Location\" >\n");
2071                  }                  }
2072    
2073                  // Common button                  // Common button
# Line 1746  function formLocation($con, $key_id) { Line 2082  function formLocation($con, $key_id) {
2082    
2083    
2084  /**********************************************************  /**********************************************************
2085  Function: formNewSingleField($con, $display, $field,  Function: formNewSingleField($display, $field,
2086          $size, $table);          $size, $table);
2087  Author: Paul Bramscher  Author: Paul Bramscher
2088  Last Modified: 07.03.2003  Last Modified: 03.11.2004
2089  ***********************************************************  ***********************************************************
2090  Incoming:  Incoming:
 $con                    Database connection string  
 $table                  Table name to operate against  
2091  $field                  Field name within $table  $field                  Field name within $table
2092  $display                A display to the user, typically  $display                A display to the user, typically
2093                          identical to $field                          identical to $field
2094  $size                   The size of the HTML input box  $size                   The size of the HTML input box
2095    $table                  Table name to operate against
2096  ***********************************************************  ***********************************************************
2097  Outgoing:  Outgoing:
2098  None  None
# Line 1767  This is a generic form function to creat Line 2102  This is a generic form function to creat
2102  table.  The table's primary key must not involve a  table.  The table's primary key must not involve a
2103  composite key since this form won't handle that.  composite key since this form won't handle that.
2104  **********************************************************/  **********************************************************/
2105  function formNewSingleField($con, $display, $field, $size, $table) {  function formNewSingleField($display, $field, $size, $table) {
2106    
2107          // Draw Box          // Draw Box
2108          printf("<center>\n");          printf("<center>\n");
2109          printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\">");          printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\">\n");
2110          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
2111          printf("Enter New %s", $display);          printf("Enter New %s", $display);
2112          printf("</td></tr>\n");          printf("</td></tr>\n");
2113                    
2114          // Form for the new field value          // Form for the new field value
2115          printf("<form method = \"POST\" action = \"insert.phtml\" >");            printf("<form method = \"POST\" action = \"insert.phtml\" >\n");
2116          printf("<tr>\n");          printf("<tr>\n");
2117          printf("<td><b>%s:</b></td>\n", $display);          printf("<td><b>%s:</b></td>\n", $display);
2118          printf("<td>");          printf("<td>\n");
2119          printf("<input type = \"text\" name = \"newValue\" size = \"%d\" >", $size);          printf("<input type = \"text\" name = \"newValue\" size = \"%d\" >\n", $size);
2120          printf("<input type = \"Hidden\" name = \"table\" value = \"%s\" >", $table);          printf("<input type = \"Hidden\" name = \"table\" value = \"%s\" >\n", $table);
2121          printf("<input type = \"Hidden\" name = \"field\" value = \"%s\" >", $field);          printf("<input type = \"Hidden\" name = \"field\" value = \"%s\" >\n", $field);
2122          printf("<input type = \"Hidden\" name = \"display\" value = \"%s\" >", $display);          printf("<input type = \"Hidden\" name = \"display\" value = \"%s\" >\n", $display);
2123          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertSingleField\" >");          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertSingleField\" >\n");
2124          printf("</td></tr>\n");          printf("</td></tr>\n");
2125          printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");          printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");
2126          printf("<input type = \"Submit\" value = \"Save New %s\" > ", $display);          printf("<input type = \"Submit\" value = \"Save New %s\" >\n", $display);
2127          printf("<input type = \"Reset\" value = \"Reset\" >");          printf("<input type = \"Reset\" value = \"Reset\" >\n");
2128    
2129          // Close things          // Close things
2130          printf("</form><br>");          printf("</form><br>\n");
2131          printf("</td></tr>");          printf("</td></tr>\n");
2132          printf("</table><br></center>");            printf("</table><br></center>\n");
2133  }  }
2134    
2135    
2136  /**********************************************************  /**********************************************************
2137    Function: formPassword
2138    Author: Paul Bramscher
2139    Last Modified: 03.11.2004
2140    ***********************************************************
2141    Purpose:
2142    Creates a new password for the supplied staff id.  Note
2143    that this is a locally stored (in mySQL) and encrypted
2144    password.  It is never visible in plaintext, nor is it
2145    ever brought to an HTML form, neither in plaintext nor
2146    in a "password" type HTML form field.
2147    **********************************************************/
2148    function formPassword($staff_id){
2149    
2150            /*****************************************
2151            ** If using native mySQL authentication **
2152            *****************************************/
2153    
2154            // Table definition
2155            printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\">\n");
2156    
2157            // Form
2158            printf("<form method = \"POST\" action = \"update.phtml\" >\n");
2159            printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
2160            printf("Local Authentication Password - See Note Below");
2161            printf("</td></tr>\n");
2162    
2163            // Staff password - for mySQL authentication only.  Ignored if x500 account is present.
2164            printf("<tr><td colspan=\"2\">\n");
2165            printf("<b>Note:</b> Supply if utilizing mySQL authentication, otherwise leave blank. ");
2166            printf("This will replace the password (if any) currently assigned to this account.");
2167            printf("</td></tr>\n");
2168    
2169            // First type
2170            printf("<tr>\n");
2171            printf("<td><b>New Password (6 char. minimum):</b></td>\n");    
2172            printf("<td><input type = \"password\" name = \"password\" size = \"25\"></td>\n");
2173            printf("</tr>\n");
2174    
2175            // Confirm type
2176            printf("<tr>\n");
2177            printf("<td><b>Confirm password (type again):</b></td>\n");
2178            printf("<td><input type = \"password\" name = \"password_confirm\" size = \"25\"></td>\n");
2179            printf("</tr>\n");
2180    
2181            // Buttons
2182            printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");
2183            printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >\n", $staff_id);
2184            printf("<input type = \"Hidden\" name = \"transaction\" value = \"updatePassword\" >\n");
2185            printf("<input type = \"Submit\" value = \"Save Local Password\" >\n");
2186    
2187            // Close the form and table
2188            printf("</form>\n");
2189            printf("</td></tr></table>\n");
2190    
2191    
2192            /*******************************************
2193            ** Determine if a password already exists **
2194            *******************************************/
2195    
2196    
2197            // Initialize variables
2198            $pass_set = 0;
2199    
2200            // Determine whether a password exists
2201            $sql = "SELECT COUNT(*) as pass_set
2202                    FROM staff s
2203                    WHERE (s.password <> NULL OR s.password <> '') and s.staff_id = " . $staff_id;
2204    
2205            $rs = xx_tryquery($sql);
2206            $row = xx_fetch_array($rs, xx_ASSOC);
2207    
2208            // Fetch values
2209            $pass_set = $row["pass_set"];
2210    
2211            // If some password already exists, offer this form
2212            if ($pass_set > 0) {
2213    
2214                    // Table definition
2215                    printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\">\n");
2216    
2217                    // Form
2218                    printf("<tr><td class=\"cellPlain\">\n");
2219                    printf("Local Password Found");
2220                    printf("</td></tr>\n");
2221                    printf("<form method = \"POST\" action = \"update.phtml\" >\n");
2222    
2223                    // Purge existing password
2224                    printf("<tr><td>\n");  
2225                    printf("<br><b>Purge password to null?</b><br><br>\n");  
2226                    printf("<b>Note:</b> It appears that this account currently has a password assigned to it.");
2227                    printf("This option will clear out any existing password, and leave the value NULL.");
2228                    printf("The staffperson may not login until a new password is supplied.<br><br>\n");
2229    
2230                    // Buttons
2231                    printf("<center>\n");
2232                    printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >\n", $staff_id);
2233                    printf("<input type = \"Hidden\" name = \"transaction\" value = \"purgePassword\" >\n");
2234                    printf("<input type = \"Submit\" value = \"Purge Password!\" >\n");
2235    
2236                    // Close the form and table
2237                    printf("</form>\n");
2238                    printf("</center></td></tr></table><br>\n");
2239    
2240            } // end password purge form
2241    
2242    } // end function
2243    
2244    
2245    /**********************************************************
2246  Function: formResource  Function: formResource
2247  Author: Paul Bramscher  Author: Paul Bramscher
2248  Last Modified: 06.19.2003 by Paul Bramscher  Last Modified: 03.16.2004 by Paul Bramscher
2249  ***********************************************************  ***********************************************************
2250  Draws an HTML form to edit the supplied resource id, or to  Draws an HTML form to edit the supplied resource id, or to
2251  create a new resource if the incoming id is less than 1.  create a new resource if the incoming id is less than 1.
2252  Note also that there are incoming masterinfotype id,  Note also that there are incoming masterinfotype id,
2253  mastersubject id, an title parameters.  mastersubject id, an title parameters.
2254  **********************************************************/    **********************************************************/  
2255  function formResource($con, $key_id, $masterinfotype_id, $mastersubject_id, $title) {  function formResource($key_id, $masterinfotype_id, $mastersubject_id, $title) {
2256    
2257          // Cast as integer to be sure          // Cast as integer to be sure
2258          $key_id = (int) $key_id;          $key_id = (int) $key_id;
2259    
2260          // Check to see if record actually exists          // Check to see if record actually exists
2261          $exists = existsRow($con, "resource", "resource_id", $key_id);          $exists = existsRow("resource", "resource_id", $key_id);
2262    
2263          // Houston, we have a problem          // Houston, we have a problem
2264          if ($key_id > 0 && $exists == 0) {          if ($key_id > 0 && $exists == 0) {
2265                  $problem = 1;                  $problem = 1;
2266                  printf("<h3>Resource #%d Not Found</h3>", $key_id);                  msgTableOpen(1, "Edit Resource (ID# " . $key_id . ")");
2267                    printf("<b>Messages:</b><br>\n");
2268                    printf("Resource not found. Operation cancelled.");
2269                    printf("<br><br>\n");
2270                    msgTableClose();
2271          }          }
2272    
2273    
# Line 1848  function formResource($con, $key_id, $ma Line 2296  function formResource($con, $key_id, $ma
2296                  $url = "";                  $url = "";
2297                  $visited = "";                  $visited = "";
2298                  $annotation ="";                  $annotation ="";
2299                    $vendor_id = 0;
2300    
2301                  // If the user is editing an existing record, fetch previous values                  // If the user is editing an existing record, fetch previous values
2302                  if ($key_id > 0 && $exists == 1) {                  if ($key_id > 0 && $exists == 1) {
2303                                    
2304                          $sql = "SELECT * from resource where resource_id = " . $key_id;                          $sql = "SELECT * from resource where resource_id = " . $key_id;
2305                          $rs = xx_query($sql, $con);                          $rs = xx_tryquery($sql);
2306                          $row = xx_fetch_array ($rs);                          $row = xx_fetch_array ($rs, xx_ASSOC);
2307    
2308                          // Fetch existing values                          // Fetch existing values
2309                          $resource_id = $row["resource_id"];                          $resource_id = $row["resource_id"];
# Line 1873  function formResource($con, $key_id, $ma Line 2322  function formResource($con, $key_id, $ma
2322                          $cat_num = $row["cat_num"];                          $cat_num = $row["cat_num"];
2323                          $site_title = $row["site_title"];                          $site_title = $row["site_title"];
2324                          $url = $row["url"];                          $url = $row["url"];
2325                            $guide_url = $row["guide_url"];                
2326                          $visited = $row["visited"];                          $visited = $row["visited"];
2327                          $annotation = $row["annotation"];                          $annotation = $row["annotation"];
2328                          $infotype_id = $row["infotype_id"];                          $infotype_id = $row["infotype_id"];
# Line 1880  function formResource($con, $key_id, $ma Line 2330  function formResource($con, $key_id, $ma
2330                          $coverage_detail = $row["coverage_detail"];                          $coverage_detail = $row["coverage_detail"];
2331                          $sources_indexed = $row["sources_indexed"];                          $sources_indexed = $row["sources_indexed"];
2332                          $location_id = $row["location_id"];                          $location_id = $row["location_id"];
2333                            $vendor_id = $row["vendor_id"];
2334                            $resource_status = $row["resource_status"];
2335                            $resource_message = $row["resource_message"];
2336    
2337                          // Run strings through the HTML cleaner for output                          // Run strings through the HTML cleaner for output
2338                          $title = textOutHTML($title);                          $title = textOutHTML($title);
# Line 1925  function formResource($con, $key_id, $ma Line 2378  function formResource($con, $key_id, $ma
2378                  printf("<table width=\"100%%\" border=\"0\" cellspacing =\"2\" cellpadding=\"2\">\n");                  printf("<table width=\"100%%\" border=\"0\" cellspacing =\"2\" cellpadding=\"2\">\n");
2379    
2380                  // Form header                  // Form header
2381                  printf("<tr><td colspan=\"4\" class=\"cellPlain\" >");                  printf("<tr><td colspan=\"4\" class=\"cellPlain\" >\n");
2382                  if ($key_id > 0 && $exists == 1) printf("Edit Resource #%d", $key_id);                  if ($key_id > 0 && $exists == 1) printf("Edit Resource (ID# %d)", $key_id);
2383                  if ($key_id <= 0) printf("Enter New Resource\n");                  if ($key_id <= 0) printf("Enter New Resource\n");
2384                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2385    
2386                  // If new insert                  // If new insert
2387                  if ($key_id <1) printf("<form method = \"POST\" action = \"insert.phtml\" >");                  if ($key_id <1) printf("<form method = \"POST\" action = \"insert.phtml\" >\n");
2388    
2389                  // Else update                  // Else update
2390                  else printf("<form method = \"POST\" action = \"update.phtml\" >");                  else printf("<form method = \"POST\" action = \"update.phtml\" >\n");
2391    
2392                  // Account & Time/date information if this is not a new resource                  // Account & Time/date information if this is not a new resource
2393                  if ($key_id > 0) {                  if ($key_id > 0) {
2394                          printf("<tr>\n<td colspan = \"1\">\n");                          printf("<tr>\n<td colspan = \"1\">\n");
2395                          printf("<br><B>Date Created:</b>");                          printf("<br><B>Date Created:</b>\n");
2396                          printf("</td><td colspan =\"3\">\n");                          printf("</td><td colspan =\"3\">\n");
2397                          printf("<BR>%s</td></tr>", $date_created);                          printf("<BR>%s</td></tr>", $date_created);
2398                          printf("<tr>\n<td colspan = \"1\">\n");                          printf("<tr>\n<td colspan = \"1\">\n");
2399                          printf("<B>Date Modified:</b>");                          printf("<B>Date Modified:</b>\n");
2400                          printf("</td><td colspan =\"3\">\n");                          printf("</td><td colspan =\"3\">\n");
2401                          printf("%s</td></tr>", $date_modified);                          printf("%s</td></tr>\n", $date_modified);
2402                                                    
2403                          printf("<tr>\n<td colspan = \"1\">\n");                          printf("<tr>\n<td colspan = \"1\">\n");
2404                          printf("<br><B>Creator:</b>");                          printf("<br><B>Creator:</b>\n");
2405                          printf("</td><td colspan =\"3\">\n");                          printf("</td><td colspan =\"3\">\n");
2406                          printf("<BR>%s</td></tr>", $account_created);                          printf("<BR>%s</td></tr>\n", $account_created);
2407                          printf("<tr>\n<td colspan = \"1\">\n");                          printf("<tr>\n<td colspan = \"1\">\n");
2408                          printf("<B>Last Modified by:</b>");                          printf("<B>Last Modified by:</b>\n");
2409                          printf("</td><td colspan =\"3\">\n");                          printf("</td><td colspan =\"3\">\n");
2410                          printf("%s</td></tr>", $account_modified);                          printf("%s</td></tr>\n", $account_modified);
2411                  }                  }
2412    
2413                  // Title                  // Title
2414                  printf("<tr><td colspan =\"1\" >\n");                  printf("<tr><td colspan =\"1\" >\n");
2415                  printf("<br><strong>Title:</strong> ");                  printf("<br><b>Title:</b>\n");
2416                  printf("</td><td colspan =\"3\">\n");                  printf("</td><td colspan =\"3\">\n");
2417                  printf("<br><input type = \"text\" name = \"title\" size = \"60\" value =\"%s\" >", $title);                  printf("<br><input type = \"text\" name = \"title\" size = \"60\" value =\"%s\" >\n", $title);
2418                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2419                                    
2420                  // Other Title                  // Other Title
2421                  printf("<tr><td colspan =\"1\" >\n");                  printf("<tr><td colspan =\"1\" >\n");
2422                  printf("<strong>Other Title:</strong> ");                  printf("<b>Other Title:</b>\n");
2423                  printf("</td><td colspan =\"3\">\n");                  printf("</td><td colspan =\"3\">\n");
2424                  printf("<input type = \"text\" name = \"other_title\" size = \"60\" value =\"%s\" >", $other_title);                  printf("<input type = \"text\" name = \"other_title\" size = \"60\" value =\"%s\" >\n", $other_title);
2425                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2426    
2427                  // Author(s)                  // Author(s)
2428                  printf("<tr><td colspan =\"1\" >\n");                  printf("<tr><td colspan =\"1\" >\n");
2429                  printf("<br><strong>Author(s):</strong> ");                  printf("<br><b>Author(s):</b>\n");
2430                  printf("</td><td colspan =\"3\">\n");                  printf("</td><td colspan =\"3\">\n");
2431                  printf("<br><input type = \"text\" name = \"author\" size = \"60\" value =\"%s\" >", $author);                  printf("<br><input type = \"text\" name = \"author\" size = \"60\" value =\"%s\" >\n", $author);
2432                  printf("<br><i>(if applicable)</i></td></tr>\n");                  printf("<br><i>(if applicable)</i></td></tr>\n");
2433    
2434                  // Coverage detail                  // Coverage detail
2435                  printf("<tr><td colspan = \"1\" valign=\"top\">\n");                  printf("<tr><td colspan = \"1\" valign=\"top\">\n");
2436                  printf("<strong>Coverage Detail:</strong>");                  printf("<b>Coverage Detail:</b>\n");
2437                  printf("</td><td colspan =\"3\">\n");                            printf("</td><td colspan =\"3\">\n");          
2438                  printf("<textarea name = \"coverage_detail\" cols = \"40\" rows = \"2\">");                  printf("<textarea name = \"coverage_detail\" cols = \"40\" rows = \"2\">\n");
2439                  printf("%s", $coverage_detail);                  printf("%s", $coverage_detail);
2440                  printf("</textarea>");                  printf("</textarea>\n");
2441                  printf("<br><i>(enter year, i.e. 1966 - 1985, or 1984 - present)</i>");                  printf("<br><i>(enter year, i.e. 1966 - 1985, or 1984 - present)</i>\n");
2442                  printf("<br><br></td></tr>\n");                  printf("<br><br></td></tr>\n");
2443                                    
2444                  // Sources Indexed                  // Sources Indexed
2445                  printf("<tr><td colspan =\"1\" valign=\"top\">\n");                  printf("<tr><td colspan =\"1\" valign=\"top\">\n");
2446                  printf("<strong>Sources Indexed:</strong> ");                  printf("<b>Sources Indexed:</b>\n");
2447                  printf("</td><td colspan =\"3\">\n");                            printf("</td><td colspan =\"3\">\n");          
2448                  printf("<input type = \"text\" name = \"sources_indexed\" size = \"60\" value =\"%s\" >", $sources_indexed);                  printf("<input type = \"text\" name = \"sources_indexed\" size = \"60\" value =\"%s\" >\n", $sources_indexed);
2449                  printf("<br><i>(enter link to vendor page)</i>");                  printf("<br><i>(enter link to vendor page)</i>\n");
2450                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2451    
2452                  // URL                  // URL
2453                  printf("<tr><td colspan = \"1\" valign=\"top\">\n");                  printf("<tr><td colspan = \"1\" valign=\"top\">\n");
2454                  printf("<strong>URL</a>:</strong>");                  printf("<b>URL</a>:</b>\n");
2455                  printf("</td><td colspan =\"3\">\n");                  printf("</td><td colspan =\"3\">\n");
2456                  printf("<textarea name = \"url\" rows = \"4\" cols = \"51\" >");                  printf("<textarea name = \"url\" rows = \"4\" cols = \"51\" >\n");
2457                  printf("%s", $url);                  printf("%s", $url);
2458                  printf("</textarea><br><br><br>\n");                  printf("</textarea><br>\n");
2459                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2460                                    
2461                    // Guide/Help URL
2462                    printf("<tr><td colspan = \"1\" valign=\"top\">\n");
2463                    printf("<b>Guide/Help URL</a>:</b>\n");
2464                    printf("</td><td colspan =\"3\">\n");
2465                    printf("<textarea name = \"guide_url\" rows = \"4\" cols = \"51\" >\n");
2466                    printf("%s", $guide_url);
2467                    printf("</textarea><br>\n");
2468                    printf("</td></tr>\n");        
2469                    
2470                  // Publisher                  // Publisher
2471                  printf("<tr><td colspan = \"1\" >\n");                  printf("<tr><td colspan = \"1\" >\n");
2472                  printf("<strong>Publisher:</strong> ");                  printf("<b>Publisher:</b>\n");
2473                  printf("</td><td colspan =\"3\">\n");                            printf("</td><td colspan =\"3\">\n");          
2474                  printf("<input type = \"text\" name = \"publisher\" size = \"50\" value =\"%s\" >", $publisher);                  printf("<input type = \"text\" name = \"publisher\" size = \"50\" value =\"%s\" >\n", $publisher);
2475                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2476    
2477                  // Publish date                  // Publish date
2478                  printf("<td colspan = \"1\" >\n");                  printf("<td colspan = \"1\" >\n");
2479                  printf("<strong>Publish Date:</strong> ");                  printf("<b>Publish Date:</b>\n");
2480                  printf("</td><td colspan =\"3\">\n");                            printf("</td><td colspan =\"3\">\n");          
2481                  printf("<input type = \"text\" name = \"pub_date\" size = \"50\" value = \"%s\" >", $pub_date);                  printf("<input type = \"text\" name = \"pub_date\" size = \"50\" value = \"%s\" >\n", $pub_date);
2482                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2483    
2484                  // Edition                  // Edition
2485                  printf("<tr><td colspan = \"1\" >\n");                  printf("<tr><td colspan = \"1\" >\n");
2486                  printf("<strong>Edition:</strong> ");                  printf("<b>Edition:</b>\n");
2487                  printf("</td><td colspan =\"3\">\n");                            printf("</td><td colspan =\"3\">\n");          
2488                  printf("<input type = \"text\" name = \"edition\" size = \"20\" value = \"%s\" >", $edition);                  printf("<input type = \"text\" name = \"edition\" size = \"20\" value = \"%s\" >\n", $edition);
2489                  printf("</td></tr>\n");                          printf("</td></tr>\n");
2490                                    
2491                  // Library Location / Call number                  // Library Location / Call number
2492                  printf("<td colspan = \"1\" valign=\"top\">\n");                  printf("<td colspan = \"1\" valign=\"top\">\n");
2493                  printf("<strong>Library Location and Call No.:</strong> ");                  printf("<b>Library Location and Call No.:</b>\n");
2494                  printf("</td><td colspan =\"3\">\n");                            printf("</td><td colspan =\"3\">\n");          
2495                  printf("<textarea rows=\"4\" cols = \"50\" name = \"call_no\">\n");                  printf("<textarea rows=\"4\" cols = \"50\" name = \"call_no\">\n");
2496                  printf($call_no);                  printf($call_no);
2497                  printf("</textarea></td></tr>\n");                        printf("</textarea></td></tr>\n");
2498    
2499                  // Catalog Number                  // Catalog Number
2500                  printf("<tr><td colspan = \"1\" >\n");                  printf("<tr><td colspan = \"1\" >\n");
2501                  printf("<strong>Aleph No.:</strong> ");                  printf("<b>Catalog No.:</b>\n");
2502                  printf("</td><td colspan =\"3\">\n");                            printf("</td><td colspan =\"3\">\n");          
2503                  printf("<input type = \"text\" name = \"cat_num\" size = \"25\" value = \"%s\" >", $cat_num);                  printf("<input type = \"text\" name = \"cat_num\" size = \"25\" value = \"%s\" >\n", $cat_num);
2504                  printf("</td></tr>\n");                          printf("</td></tr>\n");
2505                                    
2506                  // Master subject                  // Master subject
2507                  if ($mastersubject_id > 1 && $mastersubject_id != 2) {                  if ($mastersubject_id > 1 && $mastersubject_id != 2) {
2508                          $mastersubject = lookupField($con, "mastersubject", "mastersubject_id", $mastersubject_id, "mastersubject");                          $mastersubject = lookupField("mastersubject", "mastersubject_id", $mastersubject_id, "mastersubject");
2509                          printf("<tr><td colspan =\"1\" >\n");                          printf("<tr><td colspan =\"1\" >\n");
2510                          printf("<strong>Master subject:</strong> ");                          printf("<b>Master subject:</b>\n");
2511                          printf("</td><td colspan =\"3\">\n");                                            printf("</td><td colspan =\"3\">\n");                  
2512                          printf("%s", $mastersubject);                          printf("%s", $mastersubject);
2513                          printf("</td></tr>\n");                          printf("</td></tr>\n");
# Line 2054  function formResource($con, $key_id, $ma Line 2516  function formResource($con, $key_id, $ma
2516                  // Masterinfotype                  // Masterinfotype
2517                  if ($masterinfotype_id > 1) {                  if ($masterinfotype_id > 1) {
2518                          printf("<tr><td colspan = \"1\" >\n");                          printf("<tr><td colspan = \"1\" >\n");
2519                          printf("<strong>Master Information Type:</strong> ");                          printf("<b>Master Information Type:</b>\n");
2520                          printf("</td><td colspan =\"3\">\n");                                    printf("</td><td colspan =\"3\">\n");          
2521                          $masterinfotype = lookupField($con, "masterinfotype", "masterinfotype_id", $masterinfotype_id, "masterinfotype");                          $masterinfotype = lookupField("masterinfotype", "masterinfotype_id", $masterinfotype_id, "masterinfotype");
2522                          printf("%s", $masterinfotype);                          printf("%s", $masterinfotype);
2523                          printf("</td></tr>\n");                                          printf("</td></tr>\n");                
2524                  }                                        }                      
2525                                    
2526                  // Drop down box for default information type                  // Drop down box for default information type
2527                  printf("<td colspan = \"1\" >\n");                                        printf("<td colspan = \"1\" >\n");      
2528                  printf("<strong>Base Information Type:</strong>");                  printf("<b>Base Information Type:</b>\n");
2529                  printf("</td><td colspan =\"3\">\n");                  printf("</td><td colspan =\"3\">\n");
2530                  printf("<select name = \"infotype_id\" >");                  printf("<select name = \"infotype_id\" >\n");
2531                    
2532                  $limit = " WHERE infotype_id >= 0 ";                  $limit = " WHERE infotype_id >= 0 ";
2533                                    
# Line 2079  function formResource($con, $key_id, $ma Line 2541  function formResource($con, $key_id, $ma
2541                      $limit .= " AND (masterinfotype_id < 2 OR masterinfotype_id = " . $masterinfotype_id . ")";                      $limit .= " AND (masterinfotype_id < 2 OR masterinfotype_id = " . $masterinfotype_id . ")";
2542                  }                  }
2543                                                                    
2544                  dropDownFieldSelected($con, "infotype", "infotype", "infotype_id", $limit, $infotype_id);                  dropDownFieldSelected("infotype", "infotype", "infotype_id", $limit, $infotype_id);
2545                  printf("</select>");                  printf("</select>");
2546                  printf("</td></tr>\n");                  printf("</td></tr>\n");
2547    
2548                    // Vendor
2549                    printf("<tr><td colspan=\"1\">\n");
2550                    printf("<b>Vendor:</b>\n");
2551                    printf("</td>\n");
2552                    printf("<td colspan=\"2\">\n");
2553                    printf("<select name = \"vendor_id\" >\n");
2554                    dropDownFieldSelected("vendor", "vendor", "vendor_id", " WHERE vendor_id > 0", $vendor_id);
2555                    printf("</select>\n");
2556                    printf("</td></tr>\n");
2557    
2558                    // Status toggle
2559                    $up_toggle = "";                
2560                    $down_toggle = "";
2561                    $alert_toggle = "";
2562                    if ($resource_status < 1) $up_toggle = " CHECKED ";
2563                    else if ($resource_status == 1) $down_toggle = " CHECKED ";
2564                    else if ($resource_status == 2) $alert_toggle = " CHECKED ";
2565                    printf("<tr><td colspan=\"1\">\n");
2566                    printf("<b>Resource Status:</b>\n");
2567                    printf("</td>\n");
2568                    printf("<td colspan=\"3\">\n");
2569                    printf("<b>Up</b> <input type=\"radio\" name =\"resource_status\" value=\"0\" %s>\n", $up_toggle);
2570                    printf("<b>Down</b> <input type=\"radio\" name =\"resource_status\" value=\"1\" %s>\n", $down_toggle);
2571                    printf("<b>Alert</b> <input type=\"radio\" name =\"resource_status\" value=\"2\" %s>\n", $alert_toggle);
2572                    printf("</td></tr>\n");
2573    
2574                    // Down/alert message
2575                    printf("<tr><td colspan=\"1\">\n");
2576                    printf("<b>Down/Alert Message:</b>\n");
2577                    printf("</td>\n");
2578                    printf("<td colspan=\"3\">\n");
2579                    printf("<input type =\"text\" size=\"60\" name =\"resource_message\" value=\"%s\">\n", $resource_message);
2580                    printf("</td></tr>\n");
2581    
2582                  // Annotation                  // Annotation
2583                  printf("<tr><td colspan = \"4\">\n");                  printf("<tr><td colspan = \"4\">\n");
2584                  printf("<br><strong><a name=\"additional\">Annotation</a>:</strong><br>");                  printf("<br><b><a name=\"additional\">Annotation</a>:</b><br>\n");
2585                  printf("<textarea name = \"annotation\" rows = \"5\" cols = \"51\" >");                  printf("<textarea name = \"annotation\" rows = \"6\" cols = \"70\" >\n");
2586                  printf("%s", $annotation);                  printf("%s", $annotation);
2587                  printf("</textarea><br><br><br>\n");                  printf("</textarea><br><br><br>\n");
2588    
# Line 2095  function formResource($con, $key_id, $ma Line 2590  function formResource($con, $key_id, $ma
2590    
2591                  // If this is an existing resource                  // If this is an existing resource
2592                  if ($key_id > 0) {                  if ($key_id > 0) {
2593                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateResource\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateResource\" >\n");
2594                          printf("<input type = \"Submit\" value = \"Update Resource\" > ");                          printf("<input type = \"Submit\" value = \"Update Resource\" >\n");
2595                          printf("<input type = \"Hidden\" name = \"key_id\" value = \"%d\" > ", $key_id);                          printf("<input type = \"Hidden\" name = \"key_id\" value = \"%d\" >\n", $key_id);
2596                  }                  }
2597                  // A new resource                  // A new resource
2598                  else {                  else {
2599                          printf("<input type = \"Hidden\" name = \"mastersubject_id\" value = \"%d\" > ", $mastersubject_id);                          printf("<input type = \"Hidden\" name = \"mastersubject_id\" value = \"%d\" >\n", $mastersubject_id);
2600                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertResource\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertResource\" >\n");
2601                          printf("<input type = \"Submit\" value = \"Save New Resource\" > ");                          printf("<input type = \"Submit\" value = \"Save New Resource\" >\n");
2602                  }                  }
2603    
2604                  // Common button                  // Common button
# Line 2119  function formResource($con, $key_id, $ma Line 2614  function formResource($con, $key_id, $ma
2614                  // Other forms - only if editing an existing resource                  // Other forms - only if editing an existing resource
2615                  if ($key_id > 0) {                  if ($key_id > 0) {
2616                                    
2617                          formAssignResLoc($con, $key_id);                          formAssignResLoc($key_id);
2618                          formAssignResFeature($con, $key_id);                          formAssignResFeature($key_id);
2619                          formAssignResMastersubject($con, $key_id);                          formAssignResMastersubject($key_id);
2620    
2621                          // Offer a delete resource button                          // Offer a delete resource button
2622                          printf("<BR>");                          printf("<BR>\n");      
2623                          printf("<form method=\"POST\" action=\"delete.phtml\">\n");                          printf("<form method=\"POST\" action=\"delete.phtml\">\n");
2624                          printf("<input type=\"Hidden\" name=\"transaction\" value=\"deleteResourceConfirm\">\n");                          printf("<input type=\"Hidden\" name=\"transaction\" value=\"deleteResourceConfirm\">\n");
2625                          printf("<input type=\"Hidden\" name=\"resource_id\" value=\"%d\">\n", $key_id);                          printf("<input type=\"Hidden\" name=\"resource_id\" value=\"%d\">\n", $key_id);
# Line 2139  function formResource($con, $key_id, $ma Line 2634  function formResource($con, $key_id, $ma
2634  /**********************************************************  /**********************************************************
2635  Function: formService  Function: formService
2636  Author: Paul Bramscher  Author: Paul Bramscher
2637  Last Modified: 07.02.2003  Last Modified: 03.16.2004
2638  ***********************************************************  ***********************************************************
2639  Draws an HTML form to edit the supplied service id, or to  Draws an HTML form to edit the supplied service id, or to
2640  create a new service if the incoming id is less than 1.  create a new service if the incoming id is less than 1.
2641  **********************************************************/    **********************************************************/  
2642  function formService($con, $key_id) {  function formService($key_id) {
2643    
2644          // Cast as integer to be sure          // Cast as integer to be sure
2645          $key_id = (int) $key_id;          $key_id = (int) $key_id;
2646    
2647          // Check to see if service actually exists          // Check to see if service actually exists
2648          $exists = existsRow($con, "service", "service_id", $key_id);          $exists = existsRow("service", "service_id", $key_id);
2649    
2650          // Header          // Header
2651          printf("<center>");          printf("<center>");
# Line 2171  function formService($con, $key_id) { Line 2666  function formService($con, $key_id) {
2666    
2667                  // Fetch existing values                  // Fetch existing values
2668                  $sql = "SELECT * from service where service_id = " . $key_id;                  $sql = "SELECT * from service where service_id = " . $key_id;
2669                  $rs = xx_query($sql, $con);                  $rs = xx_tryquery($sql);
2670                  $row = xx_fetch_array ($rs);                  $row = xx_fetch_array ($rs, xx_ASSOC);
2671                  $service_id = $row["service_id"];                  $service_id = $row["service_id"];
2672                  $service = $row["service"];                  $service = $row["service"];
2673                  $serviceURL = $row["serviceURL"];                  $serviceURL = $row["serviceURL"];
# Line 2199  function formService($con, $key_id) { Line 2694  function formService($con, $key_id) {
2694          // Houston, we have a problem          // Houston, we have a problem
2695          if ($key_id > 0 && $exists == 0) {          if ($key_id > 0 && $exists == 0) {
2696                  $problem = 1;                  $problem = 1;
2697                  printf("<h3>Service #%d Not Found</h3>", $key_id);                  printf("<h3>Service (ID# %d) Not Found</h3>\n", $key_id);
2698          }          }
2699    
2700          // If no problems, then go for landing          // If no problems, then go for landing
# Line 2210  function formService($con, $key_id) { Line 2705  function formService($con, $key_id) {
2705    
2706                  // If new insert                  // If new insert
2707                  if ($key_id <1) {                  if ($key_id <1) {
2708                          printf("<form method = \"POST\" action = \"insert.phtml\" >");                          printf("<form method = \"POST\" action = \"insert.phtml\" >\n");
2709                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
2710                          printf("Enter New Service");                          printf("Enter New Service");
2711                          printf("</td></tr>\n");                          printf("</td></tr>\n");
# Line 2218  function formService($con, $key_id) { Line 2713  function formService($con, $key_id) {
2713    
2714                  // Else update                  // Else update
2715                  else {                  else {
2716                          printf("<form method = \"POST\" action = \"update.phtml\" >");                          printf("<form method = \"POST\" action = \"update.phtml\" >\n");
2717                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
2718                          printf("Edit Service: %s (#%d)", $service, $service_id);                          printf("Edit Service: %s (ID# %d)", $service, $service_id);
2719                          printf("</td></tr>\n");                          printf("</td></tr>\n");
2720                  }                  }
2721    
# Line 2234  function formService($con, $key_id) { Line 2729  function formService($con, $key_id) {
2729                  // Description                  // Description
2730                  printf("<tr>\n");                  printf("<tr>\n");
2731                  printf("<td colspan=\"2\"><b>Description:</b><br>\n");                  printf("<td colspan=\"2\"><b>Description:</b><br>\n");
2732                  printf("<textarea name = \"serviceDescr\" rows = \"5\" cols = \"70\" >");                  printf("<textarea name = \"serviceDescr\" rows = \"5\" cols = \"70\" >\n");
2733                  printf("%s", $serviceDescr);                  printf("%s", $serviceDescr);
2734                  printf("</textarea><br>\n");                  printf("</textarea><br>\n");
2735                  printf("</td></tr>\n");                  printf("</td></tr>\n");
# Line 2242  function formService($con, $key_id) { Line 2737  function formService($con, $key_id) {
2737                  // URL                  // URL
2738                  printf("<tr>\n");                  printf("<tr>\n");
2739                  printf("<td><b>Service URL:</b></td>\n");                  printf("<td><b>Service URL:</b></td>\n");
2740                  printf("<td><input type = \"text\" name = \"serviceURL\" size = \"50\" value = \"%s\" ></td>",                  printf("<td><input type = \"text\" name = \"serviceURL\" size = \"50\" value = \"%s\" ></td>\n",
2741                          $serviceURL);                          $serviceURL);
2742                  printf("</tr>\n");                  printf("</tr>\n");
2743    
# Line 2297  function formService($con, $key_id) { Line 2792  function formService($con, $key_id) {
2792                                    
2793                  printf("<tr>\n");                  printf("<tr>\n");
2794                  printf("<td><b>Open to Nonaffiliated Users?</b></td>\n");                  printf("<td><b>Open to Nonaffiliated Users?</b></td>\n");
2795                  printf("<td>Yes <input type = \"radio\" name = \"nonaff\" value = \"1\" %s> ", $nonaff_yes);                  printf("<td>Yes <input type = \"radio\" name = \"nonaff\" value = \"1\" %s>\n", $nonaff_yes);
2796                  printf("No <input type = \"radio\" name = \"nonaff\" value = \"0\" %s></td>\n", $nonaff_no);                  printf("No <input type = \"radio\" name = \"nonaff\" value = \"0\" %s></td>\n", $nonaff_no);
2797                  printf("</tr>\n");                  printf("</tr>\n");
2798    
# Line 2305  function formService($con, $key_id) { Line 2800  function formService($con, $key_id) {
2800                  printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");                  printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");
2801                  // If this is an existing service                  // If this is an existing service
2802                  if ($key_id > 0) {                  if ($key_id > 0) {
2803                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateService\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateService\" >\n");
2804                          printf("<input type = \"Submit\" value = \"Update Service\" > ");                          printf("<input type = \"Submit\" value = \"Update Service\" >\n");
2805                          printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" > ", $service_id);                          printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >\n", $service_id);
2806                  }                  }
2807                  // Editing a new service                  // Editing a new service
2808                  else {                  else {
2809                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertService\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertService\" >\n");
2810                          printf("<input type = \"Submit\" value = \"Save New Service\" > ");                          printf("<input type = \"Submit\" value = \"Save New Service\" >\n");
2811                  }                  }
2812    
2813                  // Common button                  // Common button
# Line 2325  function formService($con, $key_id) { Line 2820  function formService($con, $key_id) {
2820                  // Change service-location assignments                  // Change service-location assignments
2821    
2822                  if ($service_id > 0) {                  if ($service_id > 0) {
2823                          formAssignServServtype($con, $service_id);                          formAssignServServtype($service_id);
2824                          formAssignServLoc($con, $service_id);                          formAssignServLoc($service_id);
2825                  }                  }
2826    
2827                  printf("<BR>\n");                  printf("<BR>\n");
# Line 2338  function formService($con, $key_id) { Line 2833  function formService($con, $key_id) {
2833  /**********************************************************  /**********************************************************
2834  Function: formStyle  Function: formStyle
2835  Author: Paul Bramscher  Author: Paul Bramscher
2836  Last Modified: 07.03.2003  Last Modified: 03.16.2004
2837  ***********************************************************  ***********************************************************
2838  Draws an HTML form to edit the supplied style id, or to  Draws an HTML form to edit the supplied style id, or to
2839  create a new style if the incoming id is less than 1.  create a new style if the incoming id is less than 1.
# Line 2349  whether the supplied values for filename Line 2844  whether the supplied values for filename
2844  proper permissions.  This must be done separately by  proper permissions.  This must be done separately by
2845  someone with OS access.  someone with OS access.
2846  **********************************************************/    **********************************************************/  
2847  function formStyle($con, $key_id) {  function formStyle($key_id) {
2848    
2849          // Cast as integer to be sure          // Cast as integer to be sure
2850          $key_id = (int) $key_id;          $key_id = (int) $key_id;
2851    
2852          // Check to see if feature actually exists          // Check to see if feature actually exists
2853          $exists = existsRow($con, "style", "style_id", $key_id);          $exists = existsRow("style", "style_id", $key_id);
2854    
2855          // Header          // Header
2856          printf("<center>");          printf("<center>");
# Line 2367  function formStyle($con, $key_id) { Line 2862  function formStyle($con, $key_id) {
2862                    
2863                  // Fetch existing values                          // Fetch existing values        
2864                  $sql = "SELECT * from style where style_id = " . $key_id;                  $sql = "SELECT * from style where style_id = " . $key_id;
2865                  $rs = xx_query($sql, $con);                  $rs = xx_tryquery($sql);
2866                  $row = xx_fetch_array ($rs);                  $row = xx_fetch_array ($rs, xx_ASSOC);
2867                  $style_id = $row["style_id"];                  $style_id = $row["style_id"];
2868                  $style_title = $row["style_title"];                  $style_title = $row["style_title"];
2869                  $header_file = $row["header_file"];                  $header_file = $row["header_file"];
# Line 2385  function formStyle($con, $key_id) { Line 2880  function formStyle($con, $key_id) {
2880          // Houston, we have a problem          // Houston, we have a problem
2881          if ($key_id > 0 && $exists == 0) {          if ($key_id > 0 && $exists == 0) {
2882                  $problem = 1;                  $problem = 1;
2883                  printf("<h3>Style #%d Not Found</h3>", $key_id);                  printf("<h3>Style (ID# %d) Not Found</h3>\n", $key_id);
2884          }          }
2885    
2886          // If no problems, then go for landing          // If no problems, then go for landing
# Line 2396  function formStyle($con, $key_id) { Line 2891  function formStyle($con, $key_id) {
2891    
2892                  // If new insert                  // If new insert
2893                  if ($key_id <1) {                  if ($key_id <1) {
2894                          printf("<form method = \"POST\" action = \"insert.phtml\" >");                          printf("<form method = \"POST\" action = \"insert.phtml\" >\n");
2895                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
2896                          printf("Enter New Style");                          printf("Enter New Style");
2897                          printf("</td></tr>\n");                          printf("</td></tr>\n");
# Line 2404  function formStyle($con, $key_id) { Line 2899  function formStyle($con, $key_id) {
2899    
2900                  // Else update                  // Else update
2901                  else {                  else {
2902                          printf("<form method = \"POST\" action = \"update.phtml\" >");                          printf("<form method = \"POST\" action = \"update.phtml\" >\n");
2903                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
2904                          printf("Edit Style: %s (#%d)", $style, $style_id);                          printf("Edit Style: %s (ID# %d)", $style_title, $style_id);
2905                          printf("</td></tr>\n");                          printf("</td></tr>\n");
2906                  }                  }
2907    
# Line 2438  function formStyle($con, $key_id) { Line 2933  function formStyle($con, $key_id) {
2933                  printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");                  printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");
2934                  // If this is an existing style                  // If this is an existing style
2935                  if ($key_id > 0) {                  if ($key_id > 0) {
2936                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateStyle\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateStyle\" >\n");
2937                          printf("<input type = \"Submit\" value = \"Update Style\" > ");                          printf("<input type = \"Submit\" value = \"Update Style\" >\n");
2938                          printf("<input type = \"Hidden\" name = \"style_id\" value = \"%d\" > ", $style_id);                          printf("<input type = \"Hidden\" name = \"style_id\" value = \"%d\" >\n", $style_id);
2939                  }                  }
2940                  // Editing a new style                  // Editing a new style
2941                  else {                  else {
2942                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertStyle\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertStyle\" >\n");
2943                          printf("<input type = \"Submit\" value = \"Save New Style\"> ");                          printf("<input type = \"Submit\" value = \"Save New Style\">\n");
2944                  }                  }
2945    
2946                  // Common button                  // Common button
# Line 2460  function formStyle($con, $key_id) { Line 2955  function formStyle($con, $key_id) {
2955    
2956    
2957  /**********************************************************  /**********************************************************
2958    Function: formStaff
2959    Author: Paul Bramscher
2960    Last Modified: 03.16.2004
2961    ***********************************************************
2962    Purpose:
2963    Form to create a new staff person, or update the existing
2964    staff id.
2965    **********************************************************/
2966    function formStaff($staff_id){
2967    
2968            // Initialize variables
2969            $staff_id = (int) $staff_id;
2970            $last_name ="";
2971            $first_name = "";
2972            $staff_account = "";
2973            $staff_email = "";
2974            $password = "";
2975            $access = "";
2976            $access_id = 1;
2977    
2978            // If editing an existing staff member load previous values
2979            if ($staff_id > 1){
2980                    $sql = "SELECT
2981                            s.first_name,
2982                            s.last_name,
2983                            s.staff_account,
2984                            s.staff_email,
2985                            s.access_id,
2986                            t.stafftitle,
2987                            t.stafftitle_id,
2988                            a.access_id,
2989                            a.access_level,
2990                            a.access
2991                            FROM staff s, access a, stafftitle t
2992                            WHERE
2993                            s.access_id = a.access_id AND
2994                            s.stafftitle_id = t.stafftitle_id AND
2995                            staff_id=" . $staff_id;
2996    
2997                    $rs = xx_tryquery($sql);
2998                    $row = xx_fetch_array($rs, xx_ASSOC);
2999                    
3000                    // Fetch results
3001                    $first_name = Trim($row["first_name"]);
3002                    $last_name = Trim($row["last_name"]);
3003                    $staff_account = Trim($row["staff_account"]);
3004                    $staff_email = Trim($row["staff_email"]);              
3005                    $access = Trim($row["access"]);
3006                    $access_id = Trim($row["access_id"]);
3007                    $stafftitle = Trim($row["stafftitle"]);
3008                    $stafftitle_id = Trim($row["stafftitle_id"]);
3009    
3010                    // Run strings through the HTML cleaner for output
3011                    $first_name = textOutHTML($first_name);
3012                    $last_name = textOutHTML($last_name);
3013                    $staff_account = textOutHTML($staff_account);
3014    
3015            }
3016    
3017    
3018            // Table definition
3019            printf("<center><table width=\"75%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\">\n");
3020    
3021            // If new insert
3022            if ($staff_id <1) {
3023                    printf("<form method = \"POST\" action = \"insert.phtml\" >\n");
3024                    printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
3025                    printf("Enter New Staff Person");
3026                    printf("</td></tr>\n");
3027            }
3028    
3029            // Else update
3030            else {
3031                    printf("<form method = \"POST\" action = \"update.phtml\" >\n");
3032                    printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
3033                    printf("Edit Staff Person: %s %s (ID# %d)", $first_name, $last_name, $staff_id);
3034                    printf("</td></tr>\n");
3035            }
3036    
3037            // Last name
3038            printf("<tr>\n");      
3039            printf("<td><b>Last Name:</b></td>\n");  
3040            printf("<td><input type = \"text\" name = \"last_name\" size = \"40\" value = \"%s\" ></td>\n", $last_name);
3041            printf("</tr>\n");
3042    
3043            // First name
3044            printf("<tr>\n");
3045            printf("<td><b>First Name:</b></td>\n");      
3046            printf("<td><input type = \"text\" name = \"first_name\" size = \"30\" value = \"%s\"></td>\n", $first_name);
3047            printf("</tr>\n");
3048    
3049            // staff account - must be unique, may match against staff_account
3050            printf("<tr>\n");
3051            printf("<td><b>Staff Account (x500 if applicable, 20 char max.):</b></td>\n");
3052            printf("<td><input type = \"text\" name = \"staff_account\" size = \"20\" value =\"%s\"></td>\n", $staff_account);
3053            printf("</tr>\n");
3054            
3055            // Staff email - whether or not x500 authentication is used
3056            printf("<tr>\n");
3057            printf("<td><b>Staff E-Mail:</b></td>\n");
3058            printf("<td><input type = \"text\" name = \"staff_email\" size = \"50\" value =\"%s\"></td>\n", $staff_email);
3059            printf("</tr>\n");
3060    
3061            // Title
3062            printf("<tr>\n");
3063            printf("<td><b>Job Title:</b></td>\n");
3064            printf("<td><select name = \"stafftitle_id\">\n");
3065            dropDownFieldSelected("stafftitle", "stafftitle", "stafftitle_id", "WHERE stafftitle_id > 0", $stafftitle_id);
3066            printf("</select></td>\n");
3067            printf("</tr>\n");
3068    
3069            // Access
3070            printf("<tr>\n");
3071            printf("<td><b>Access Level:</b></td>\n");
3072            printf("<td><select name = \"access_id\">\n");
3073            dropDownFieldSelected("access", "access", "access_id", "WHERE access_id > 0", $access_id);
3074            printf("</select></td>\n");
3075            printf("</tr>\n");
3076    
3077            // Buttons
3078            printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");
3079            
3080            // If new staff
3081            if ($staff_id < 2) {
3082                    printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertStaff\" >\n");
3083                    printf("<input type = \"Submit\" value = \"Save New Staff\" >\n");
3084            }
3085            // Editing an existing staffperson
3086            else {
3087                    printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateStaff\" >\n");
3088                    printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >\n", $staff_id);
3089                    printf("<input type = \"Submit\" value = \"Save Staff Changes\" >\n");
3090            }
3091            printf("<input type = \"Reset\" value = \"Reset\" >\n");
3092    
3093            // Close the form and table
3094            printf("</form>\n");
3095    
3096            printf("</td></tr></table>\n");
3097    
3098            // If editing existing staff, draw other forms
3099            if ($staff_id > 0) {
3100                    formPassword($staff_id);
3101                    formAssignStaffLibunit($staff_id);
3102                    formAssignStaffSub($staff_id);
3103            }
3104    
3105            printf("</center><br>\n");
3106    }
3107    
3108    
3109    /**********************************************************
3110  Function: formSubject  Function: formSubject
3111  Author: Paul Bramscher  Author: Paul Bramscher
3112  Last Modified: 06.25.2003  Last Modified: 03.15.2004
3113  ***********************************************************  ***********************************************************
3114  Draws an HTML form to edit the supplied subject id, or to  Draws an HTML form to edit the supplied subject id, or to
3115  create a new subject if the incoming id is less than 1.  create a new subject if the incoming id is less than 1.
3116  **********************************************************/    **********************************************************/  
3117  function formSubject($con, $key_id) {  function formSubject($key_id) {
3118    
3119          // Cast as integer to be sure          // Cast as integer to be sure
3120          $key_id = (int) $key_id;          $key_id = (int) $key_id;
3121    
3122          // Check to see if location actually exists          // Check to see if location actually exists
3123          $exists = existsRow($con, "subject", "subject_id", $key_id);          $exists = existsRow("subject", "subject_id", $key_id);
3124    
3125          // Header          // Header
3126          printf("<center>");          printf("<center>");
# Line 2486  function formSubject($con, $key_id) { Line 3133  function formSubject($con, $key_id) {
3133                    
3134                  // If the user is editing an existing record, fetch previous values                  // If the user is editing an existing record, fetch previous values
3135                  $sql = "SELECT * from subject where subject_id = " . $key_id;                  $sql = "SELECT * from subject where subject_id = " . $key_id;
3136                  $rs = xx_query($sql, $con);                  $rs = xx_tryquery($sql);
3137                  $row = xx_fetch_array ($rs);                  $row = xx_fetch_array ($rs, xx_ASSOC);
3138    
3139                  // Fetch existing values                  // Fetch existing values
3140                  $subject_id = $row["subject_id"];                  $subject_id = $row["subject_id"];
# Line 2502  function formSubject($con, $key_id) { Line 3149  function formSubject($con, $key_id) {
3149          // Houston, we have a problem          // Houston, we have a problem
3150          if ($key_id > 0 && $exists == 0) {          if ($key_id > 0 && $exists == 0) {
3151                  $problem = 1;                  $problem = 1;
3152                  printf("<h3>Subject #%d Not Found</h3>", $key_id);                  printf("<h3>Subject (ID# %d) Not Found</h3>\n", $key_id);
3153          }          }
3154    
3155          // If no problems, then go for landing          // If no problems, then go for landing
# Line 2513  function formSubject($con, $key_id) { Line 3160  function formSubject($con, $key_id) {
3160    
3161                  // If new insert                  // If new insert
3162                  if ($key_id <1) {                  if ($key_id <1) {
3163                          printf("<form method = \"POST\" action = \"insert.phtml\" >");                          printf("<form method = \"POST\" action = \"insert.phtml\" >\n");
3164                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
3165                          printf("Enter New Subject");                          printf("Enter New Subject");
3166                          printf("</td></tr>\n");                          printf("</td></tr>\n");
# Line 2521  function formSubject($con, $key_id) { Line 3168  function formSubject($con, $key_id) {
3168    
3169                  // Else update                  // Else update
3170                  else {                  else {
3171                          printf("<form method = \"POST\" action = \"update.phtml\" >");                          printf("<form method = \"POST\" action = \"update.phtml\" >\n");
3172                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
3173                          printf("Update Subject: %s (#%d)", $subject, $subject_id);                          printf("Edit Subject: %s (ID# %d)", $subject, $subject_id);
3174                          printf("</td></tr>\n");                          printf("</td></tr>\n");
3175                  }                  }
3176    
3177                  // Subject                  // Subject
3178                  printf("<tr><td>\n");                  printf("<tr><td>\n");
3179                  printf("<b>Subject:</b>");                  printf("<b>Subject:</b>\n");
3180                  printf("</td>\n");                  printf("</td>\n");
3181                  printf("<td>\n");                  printf("<td>\n");
3182                  printf("<input type = \"text\" name = \"subject\" size = \"65\" value = \"%s\" >", $subject);                  printf("<input type = \"text\" name = \"subject\" size = \"65\" value = \"%s\" >\n", $subject);
3183                  printf("</td></tr>\n");                  printf("</td></tr>\n");
3184    
3185                  // Primary location                  // Primary location
3186                  printf("<tr>\n");                  printf("<tr>\n");
3187                  printf("<td><b>Primary Location:</b></td>\n");                  printf("<td><b>Primary Location:</b></td>\n");
3188                  printf("<td>\n");                  printf("<td>\n");
3189                  printf("<select name = \"sublocation_id\">");                  printf("<select name = \"sublocation_id\">\n");
3190                  dropDownFieldSelected($con, "location", "location", "location_id", "WHERE location_id > 0", $sublocation_id);                  dropDownFieldSelected("location", "location", "location_id", "WHERE location_id > 0", $sublocation_id);
3191                  printf("</select>\n");                  printf("</select>\n");
3192                  printf("</td></tr>\n");                  printf("</td></tr>\n");
3193    
# Line 2548  function formSubject($con, $key_id) { Line 3195  function formSubject($con, $key_id) {
3195                  printf("<tr>\n");                  printf("<tr>\n");
3196                  printf("<td colspan=\"2\">\n");                  printf("<td colspan=\"2\">\n");
3197                  printf("<b>Description:</b><br>");                  printf("<b>Description:</b><br>");
3198                  printf("<textarea name = \"subject_descr\" rows = \"5\" cols = \"65\" >");                  printf("<textarea name = \"subject_descr\" rows = \"5\" cols = \"65\" >\n");
3199                  printf("%s", $subject_descr);                  printf("%s", $subject_descr);
3200                  printf("</textarea></td></tr>\n");                  printf("</textarea></td></tr>\n");
3201    
# Line 2557  function formSubject($con, $key_id) { Line 3204  function formSubject($con, $key_id) {
3204                                    
3205                  // If this is an existing subject                  // If this is an existing subject
3206                  if ($key_id > 0) {                  if ($key_id > 0) {
3207                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateSubject\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateSubject\" >\n");
3208                          printf("<input type = \"Submit\" value = \"Update Subject\" > ");                          printf("<input type = \"Submit\" value = \"Update Subject\" >\n");
3209                          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" > ", $subject_id);                          printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id);
3210                  }                  }
3211                  // Editing a new subject                  // Editing a new subject
3212                  else {                  else {
3213                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertSubject\" > ");                          printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertSubject\" >\n");
3214                          printf("<input type = \"Submit\" value = \"Save New Subject\" > ");                          printf("<input type = \"Submit\" value = \"Save New Subject\" >\n");
3215                  }                  }
3216    
3217                  // Common button                  // Common button
# Line 2577  function formSubject($con, $key_id) { Line 3224  function formSubject($con, $key_id) {
3224                  // Change subject-location assignments                  // Change subject-location assignments
3225    
3226                  if ($subject_id > 0) {                  if ($subject_id > 0) {
3227                          formAssignSubMaster($con, $subject_id);                          formAssignSubMaster($subject_id);
3228                          formAssignSubLoc($con, $subject_id);                          formAssignSubLoc($subject_id);
3229                          formAssignSubStaff($con, $subject_id);                          formAssignSubStaff($subject_id);
3230                          formAssignSubCoursesub($con, $subject_id);                          formAssignSubCoursesub($subject_id);
3231                  }                  }
3232    
3233          } // No problems          } // No problems
# Line 2589  function formSubject($con, $key_id) { Line 3236  function formSubject($con, $key_id) {
3236  }  }
3237    
3238    
   
3239  /**********************************************************  /**********************************************************
3240  Function: formAssignLibunitStaff  Function: formVendor
3241  Author: Paul Bramscher  Author: Paul Bramscher
3242  Last Modified: 07.03.2003  Last Modified: 03.16.2004
3243  ***********************************************************  ***********************************************************
3244  Purpose:  Purpose:
3245  Assigns staff (possibly multiple) to a given library unit.  Draws an HTML form to edit the supplied vendor id, or to
3246  **********************************************************/  create a new vendor if the incoming id is less than 1.
3247  function formAssignLibunitStaff($con, $libunit_id){  **********************************************************/  
3248                    function formVendor($key_id) {
         // Table definition  
         printf("<br><table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\" bgcolor =\"#ffffff\" >");  
   
         // Form  
         printf("<form method = \"POST\" action = \"assign.phtml\" >");  
         printf("<input type = \"Hidden\" name = \"libunit_id\" value = \"%d\" >", $libunit_id);  
         printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignLibunitStaff\" >");  
           
         // Available staff  
         // Omit the '(N/A)' staff  
         $omit_string = "WHERE staff_id > 1";  
                   
         // Omit any pre-selected staff in libunit_staff  
         $in_string = getNotIn($con, "staff_id", "libunit_id", $libunit_id, "libunit_staff");  
         if (strlen($in_string) > 0) $omit_string .= " AND staff_id NOT IN " . $in_string;  
           
         // Draw the box  
         printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");  
         printf("Assign Staff to Library Unit");  
         printf("</td></tr>\n");  
         printf("<tr><td valign = \"top\" >\n");  
         printf("<br><strong>Available Staff:<br></strong>\n");  
         printf("<select name = \"staff_id_array[]\" multiple size = \"5\" >");  
         dropDownStaffOmit($con, $omit_string);  
         printf("</select><br><br>");      
   
         // Close off form  
         printf("<center>");  
         printf("<input type = \"Submit\" value = \" >> \" >");  
         printf("</form>");  
         printf("</center>");  
         printf("</td>");  
   
         // Current staff  
         printf("<td valign = \"top\" >\n");  
         printf("<form method = \"POST\" action = \"delete.phtml\" >");  
         printf("<input type = \"Hidden\" name = \"libunit_id\" value = \"%d\" >", $libunit_id);  
         printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteLibunitStaff\" >");  
         printf("<br><strong>Selected Staff:</strong><br>\n");  
         printf("<select name =\"key_list_array[]\" multiple size = 5>");  
   
         $sql = "SELECT s.staff_id, s.last_name, s.first_name FROM  
                 staff s,  
                 libunit_staff ls  
                 WHERE  
                 ls.libunit_id = " . $libunit_id . " AND  
                 s.staff_id = ls.staff_id  
                 ORDER BY last_name, first_name";  
   
         // Fetch the values  
         $rs = xx_query($sql, $con);  
         while ($row = xx_fetch_array ($rs)) {  
                 $first_name = $row["first_name"];  
                 $last_name = $row["last_name"];  
                 $staff_id = $row["staff_id"];  
                 printf("<option value = \"%d\">%s, %s</option>", $staff_id, $last_name, $first_name);  
         }  
   
         printf("</select><br><br>");  
         printf("<center>");      
         printf("<input type = \"Submit\" value =\" << \">");  
         printf("</center>");  
         printf("</form>");  
         printf("</td></tr>");  
   
         // Close off table  
         printf("</td></tr></table>");  
3249    
3250  }          // Cast as integer to be sure
3251            $key_id = (int) $key_id;
3252    
3253            // Check to see if vendor actually exists
3254            $exists = existsRow("vendor", "vendor_id", $key_id);
3255    
3256  /**********************************************************          // Header
 Function: formAssignStaffLibunit  
 Author: Paul Bramscher  
 Last Modified: 07.03.2003  
 ***********************************************************  
 Purpose:  
 Assigns library units (possibly multiple) to a given  
 staffperson.  
 **********************************************************/  
 function formAssignStaffLibunit($con, $staff_id){  
                           
         // Table definition  
         printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >");  
           
         // Form  
         printf("<form method = \"POST\" action = \"assign.phtml\" >");  
         printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >", $staff_id);  
         printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignStaffLibunit\" >");  
           
         // Available libunits  
         // Omit the '(N/A)' libunit  
         $omit_string = "WHERE libunit_id > 1";  
                           
         // Omit any pre-selected libunits in libunit_staff  
         $in_string = getNotIn($con, "libunit_id", "staff_id", $staff_id, "libunit_staff");  
         if (strlen($in_string) > 0) $omit_string .= " AND libunit_id NOT IN " . $in_string;  
                   
         // Draw the box  
         printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");  
         printf("Assign Library Unit to Staff");  
         printf("</td></tr>\n");  
         printf("<tr><td valign = \"top\" >\n");  
         printf("<br><strong>Available Library Unit(s):<br></strong>\n");  
         printf("<select name = \"libunit_id_array[]\" multiple size = \"5\" >");  
         dropDownFieldOmit($con, "libunit", "libunit", "libunit_id", $omit_string);  
         printf("</select><br><br>");      
           
         // Close off form  
3257          printf("<center>");          printf("<center>");
3258          printf("<input type = \"Submit\" value = \" >> \" >");          if ($key_id > 0 && $exists == 1) {
         printf("</form>");  
         printf("</center>");  
         printf("</td>");  
           
         // Current libunits  
         printf("<td valign = \"top\" >\n");  
         printf("<form method = \"POST\" action = \"delete.phtml\" >");  
         printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >", $staff_id);  
         printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteStaffLibunit\" >");  
         printf("<br><strong>Selected Library Unit(s):</strong><br>\n");  
         printf("<select name =\"key_list_array[]\" multiple size = 5>");  
           
         $sql = "SELECT l.libunit, l.libunit_id FROM  
                 staff s,  
                 libunit_staff ls,  
                 libunit l  
                 WHERE  
                 s.staff_id = " . $staff_id . " AND  
                 ls.staff_id = s.staff_id AND  
                 ls.libunit_id = l.libunit_id  
                 ORDER BY l.libunit";  
           
         // Fetch the values  
         $rs = xx_query($sql, $con);  
         while ($row = xx_fetch_array ($rs)) {  
                 $libunit = $row["libunit"];  
                 $libunit_id = $row["libunit_id"];  
                 printf("<option value = \"%s\">%s</option>", $libunit_id, $libunit);  
         }  
           
         printf("</select><br><br>");  
         printf("<center>");      
         printf("<input type = \"Submit\" value =\" << \">");  
         printf("</center>");  
         printf("</form>");  
         printf("</td></tr>");  
           
         // Close off table  
         printf("</td></tr></table>");  
   
 }  
   
   
 /**********************************************************  
 Function: formAssignStaffSub  
 Author: Paul Bramscher  
 Last Modified: 08.26.2003  
 ***********************************************************  
 Purpose:  
 Assigns subjects (possibly multiple) to a given  
 staffperson.  
 **********************************************************/  
 function formAssignStaffSub($con, $staff_id){  
   
         // Table definition  
         printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >\n");  
           
         // Form  
         printf("<form method = \"POST\" action = \"assign.phtml\" >\n");  
         printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >\n", $staff_id);  
         printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignStaffSub\" >\n");  
           
         // Available subjects  
         // Omit the '(N/A)' subject  
         $omit_string = "WHERE subject_id > 1";  
                           
         // Omit any pre-selected subjects in sub_staff  
         $in_string = getNotIn($con, "subject_id", "staff_id", $staff_id, "sub_staff");  
         if (strlen($in_string) > 0) $omit_string .= " AND subject_id NOT IN " . $in_string;  
                   
         // Draw the box  
         printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");  
         printf("Assign Subjects");  
         printf("</td></tr>\n");  
         printf("<tr><td valign = \"top\" >\n");  
         printf("<br><strong>Available Subject(s):<br></strong>\n");  
         printf("<select name = \"subject_id_array[]\" multiple size = \"5\" >\n");  
         dropDownFieldOmit($con, "subject", "subject", "subject_id", $omit_string);  
         printf("</select><br><br>\n");    
           
         // Close off form  
         printf("<center>\n");  
         printf("<input type = \"Submit\" value = \" >> \" >\n");  
         printf("</form>\n");  
         printf("</center>\n");  
         printf("</td>\n");  
           
         // Current subjects  
         printf("<td valign = \"top\" >\n");  
         printf("<form method = \"POST\" action = \"delete.phtml\" >\n");  
         printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >", $staff_id);  
         printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteStaffSub\" >\n");  
         printf("<br><strong>Selected Subject(s):</strong><br>\n");  
         printf("<select name =\"key_list_array[]\" multiple size = 5>\n");  
           
         $sql = "SELECT s.subject, s.subject_id FROM  
                 staff t,  
                 sub_staff st,  
                 subject s  
                 WHERE  
                 t.staff_id = " . $staff_id . " AND  
                 st.staff_id = t.staff_id AND  
                 st.subject_id = s.subject_id  
                 ORDER BY s.subject";  
           
         // Fetch the values  
         $rs = xx_query($sql, $con);  
         while ($row = xx_fetch_array ($rs)) {  
                 $subject = $row["subject"];  
                 $subject_id = $row["subject_id"];  
                 printf("<option value = \"%s\">%s</option>\n", $subject_id, $subject);  
         }  
           
         printf("</select><br><br>\n");  
         printf("<center>\n");    
         printf("<input type = \"Submit\" value =\" << \">\n");  
         printf("</center>\n");  
         printf("</form>\n");  
         printf("</td></tr>\n");  
           
         // Close off table  
         printf("</td></tr></table>\n");  
   
 }  
   
   
 /**********************************************************  
 Function: formLibunit  
 Author: Paul Bramscher  
 Last Modified: 07.03.2003  
 ***********************************************************  
 Purpose:  
 Handles the creation of new (or editing of existing)  
 library units.  
 **********************************************************/  
 function formLibunit($con, $key_id){  
   
         // Initialize variables  
         $libunit_id = (int) $key_id;  
         $libunit ="";  
         $libunit_abbrev = "";  
   
         // If editing an existing library unit load previous values  
         if ($libunit_id > 1){  
                 $sql = "SELECT  
                         l.libunit,  
                         l.libunit_abbrev,  
                         l.head_staff_id  
                         FROM libunit l  
                         WHERE  
                         libunit_id = " . $libunit_id;  
   
                 $rs = xx_query($sql, $con);  
                 $row = xx_fetch_array($rs);  
3259                                    
3260                  // Fetch values                  // Initialization
3261                  $libunit = Trim($row["libunit"]);                  $vendor_id = "";
3262                  $libunit_abbrev = Trim($row["libunit_abbrev"]);                  $vendor = "";
3263                  $head_staff_id = $row["head_staff_id"];                  $vendor_descr = "";
3264                    $vendor_status = "";
3265                    $vendor_message = "";
3266                                    
                 // Run strings through the HTML cleaner for output  
                 $libunit = textOutHTML($libunit);  
                 $libunit_abbrev = textOutHTML($libunit_abbrev);  
   
         }  
   
         // Table definition    
         printf("<center><table width=\"75%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\">\n");  
   
         // If new insert  
         if ($key_id <1) {  
                 printf("<form method = \"POST\" action = \"insert.phtml\" >");  
                 printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");  
                 printf("Enter New Library Unit");  
                 printf("</td></tr>\n");  
         }  
   
         // Else update  
         else {  
                 printf("<form method = \"POST\" action = \"update.phtml\" >");  
                 printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");  
                 printf("Edit Library Unit: %s (#%d)", $libunit, $libunit_id);  
                 printf("</td></tr>\n");  
         }  
   
         // Libunit  
         printf("<td><b>Library Unit:</b></td>\n");    
         printf("<td><input type = \"text\" name = \"libunit\" size = \"60\" value = \"%s\" ></td>\n", $libunit);  
         printf("</td></tr>");  
   
         // Libunit abbrev.  
         printf("<tr>\n");  
         printf("<td><b>Abbreviation:</b></td>\n");  
         printf("<td><input type = \"text\" name = \"libunit_abbrev\" size = \"20\" value = \"%s\"></td>\n", $libunit_abbrev);  
         printf("</tr>\n");  
   
         // Libunit lead  
         printf("<tr>\n");        
         printf("<td><b>Unit Lead:</b></td>\n");    
         printf("<td><select name = \"head_staff_id\" >");  
         dropDownStaffSelected($con, $head_staff_id);  
         printf("</select></td>\n");  
         printf("</tr>\n");  
   
         // Buttons  
         printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");  
3267                    
3268          // If new libunit                  // Fetch existing values        
3269          if ($libunit_id < 2) {                  $sql = "SELECT * FROM vendor WHERE vendor_id = " . $key_id;
3270                  printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertLibunit\" >");                  $rs = xx_tryquery($sql);
3271                  printf("<input type = \"Submit\" value = \"Save New Library Unit\" > ");                  $row = xx_fetch_array ($rs, xx_ASSOC);
3272          }                  $vendor_id = $row["vendor_id"];
3273          // Editing an existing libunit                  $vendor = $row["vendor"];
3274          else {                  $vendor_descr = $row["vendor_descr"];
3275                  printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateLibunit\" >");                  $vendor_status = $row["vendor_status"];
3276                  printf("<input type = \"Hidden\" name = \"libunit_id\" value = \"%d\" >", $libunit_id);                  $vendor_message = $row["vendor_message"];
                 printf("<input type = \"Submit\" value = \"Save Library Unit Changes\" > ");  
         }  
         printf("<input type = \"Reset\" value = \"Reset\" >");  
   
         // Close the form and table  
         printf("</form>");  
         printf("</td></tr></table>");  
   
         // Other forms - only if editing an existing libunit  
   
         if ($libunit_id > 0) {  
                 formAssignLibunitStaff($con, $libunit_id);  
         }  
   
         printf("</center><br>");  
 }  
   
   
 /**********************************************************  
 Function: formPassword  
 Author: Paul Bramscher  
 Last Modified: 07.03.2003  
 ***********************************************************  
 Purpose:  
 Creates a new password for the supplied staff id.  Note  
 that this is a locally stored (in mySQL) and encrypted  
 password.  It is never visible in plaintext, nor is it  
 ever brought to an HTML form, neither in plaintext nor  
 in a "password" type HTML form field.  
 **********************************************************/  
 function formPassword($con, $staff_id){  
   
         /*****************************************  
         ** If using native mySQL authentication **  
         *****************************************/  
   
         // Table definition  
         printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\">");  
   
         // Form  
         printf("<form method = \"POST\" action = \"update.phtml\" >");  
         printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");  
         printf("Local Authentication Password - See Note Below");  
         printf("</td></tr>\n");  
   
         // Staff password - for mySQL authentication only.  Ignored if x500 account is present.  
         printf("<tr><td colspan=\"2\">\n");  
         printf("<b>Note:</b> Supply if utilizing mySQL authentication, otherwise leave blank. ");  
         printf("This will replace the password (if any) currently assigned to this account.");  
         printf("</td></tr>\n");  
   
         // First type  
         printf("<tr>\n");  
         printf("<td><b>New Password (6 char. minimum):</b></td>\n");      
         printf("<td><input type = \"password\" name = \"password\" size = \"25\"></td>\n");  
         printf("</tr>\n");  
   
         // Confirm type  
         printf("<tr>\n");  
         printf("<td><b>Confirm password (type again):</b></td>\n");  
         printf("<td><input type = \"password\" name = \"password_confirm\" size = \"25\"></td>\n");  
         printf("</tr>\n");  
   
         // Buttons  
         printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");  
         printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >\n", $staff_id);  
         printf("<input type = \"Hidden\" name = \"transaction\" value = \"updatePassword\" >\n");  
         printf("<input type = \"Submit\" value = \"Save Local Password\" > ");  
   
         // Close the form and table  
         printf("</form>\n");  
         printf("</td></tr></table>\n");  
   
   
         /*******************************************  
         ** Determine if a password already exists **  
         *******************************************/  
   
   
         // Initialize variables  
         $pass_set = 0;  
   
         // Determine whether a password exists  
         $sql = "SELECT COUNT(*) as pass_set  
                 FROM staff s  
                 WHERE s.password IS NOT NULL and staff_id = " . $staff_id;  
   
         $rs = xx_query($sql, $con);  
         $row = xx_fetch_array($rs);  
   
         // Fetch values  
         $pass_set = Trim($row["pass_set"]);  
   
   
         // If some password already exists, offer this form  
         if ($pass_set > 0) {  
   
                 // Table definition  
                 printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\">");  
   
                 // Form  
                 printf("<tr><td class=\"cellPlain\">");  
                 printf("Local Password Found");  
                 printf("</td></tr>\n");  
                 printf("<form method = \"POST\" action = \"update.phtml\" >");  
   
                 // Purge existing password  
                 printf("<tr><td>\n");    
                 printf("<br><b>Purge password to null?</b><br><br>\n");    
                 printf("<b>Note:</b> It appears that this account currently has a password assigned to it.");  
                 printf("This option will clear out any existing password, and leave the value NULL.");  
                 printf("The staffperson may not login until a new password is supplied.<br><br>\n");  
   
                 // Buttons  
                 printf("<center>\n");  
                 printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >", $staff_id);              
                 printf("<input type = \"Hidden\" name = \"transaction\" value = \"purgePassword\" >");            
                 printf("<input type = \"Submit\" value = \"Purge Password!\" > ");  
   
                 // Close the form and table  
                 printf("</form>");  
                 printf("</center></td></tr></table><br>\n");  
   
         } // end password purge form  
   
 } // end function  
   
   
 /**********************************************************  
 Function: formStaff  
 Author: Paul Bramscher  
 Last Modified: 07.03.2003  
 ***********************************************************  
 Purpose:  
 Form to create a new staff person, or update the existing  
 staff id.  
 **********************************************************/  
 function formStaff($con, $staff_id){  
   
         // Initialize variables  
         $staff_id = (int) $staff_id;  
         $last_name ="";  
         $first_name = "";  
         $staff_account = "";  
         $staff_email = "";  
         $password = "";  
         $access = "";  
         $access_id = 1;  
   
         // If editing an existing staff member load previous values  
         if ($staff_id > 1){  
                 $sql = "SELECT  
                         s.first_name,  
                         s.last_name,  
                         s.staff_account,  
                         s.staff_email,  
                         s.access_id,  
                         t.stafftitle,  
                         t.stafftitle_id,  
                         a.access_id,  
                         a.access_level,  
                         a.access  
                         FROM staff s, access a, stafftitle t  
                         WHERE  
                         s.access_id = a.access_id AND  
                         s.stafftitle_id = t.stafftitle_id AND  
                         staff_id=" . $staff_id;  
   
                 $rs = xx_query($sql, $con);  
                 $row = xx_fetch_array($rs);  
                   
                 // Fetch results  
                 $first_name = Trim($row["first_name"]);  
                 $last_name = Trim($row["last_name"]);  
                 $staff_account = Trim($row["staff_account"]);  
                 $staff_email = Trim($row["staff_email"]);                
                 $access = Trim($row["access"]);  
                 $access_id = Trim($row["access_id"]);  
                 $stafftitle = Trim($row["stafftitle"]);  
                 $stafftitle_id = Trim($row["stafftitle_id"]);  
   
                 // Run strings through the HTML cleaner for output  
                 $first_name = textOutHTML($first_name);  
                 $last_name = textOutHTML($last_name);  
                 $staff_account = textOutHTML($staff_account);  
   
         }  
   
   
         // Table definition  
         printf("<center><table width=\"75%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\">\n");  
   
         // If new insert  
         if ($staff_id <1) {  
                 printf("<form method = \"POST\" action = \"insert.phtml\" >");  
                 printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");  
                 printf("Enter New Staff Person");  
                 printf("</td></tr>\n");  
3277          }          }
3278    
3279          // Else update          // Houston, we have a problem
3280          else {          if ($key_id > 0 && $exists == 0) {
3281                  printf("<form method = \"POST\" action = \"update.phtml\" >");                  $problem = 1;
3282                  printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");                  printf("<h3>Vendor (ID# %d) Not Found</h3>\n", $key_id);
                 printf("Edit Staff Person: %s %s (#%d)", $first_name, $last_name, $staff_id);  
                 printf("</td></tr>\n");  
3283          }          }
3284    
3285          // Last name          // If no problems, then go for landing
3286          printf("<tr>\n");                if ($problem != 1) {
         printf("<td><b>Last Name:</b></td>\n");    
         printf("<td><input type = \"text\" name = \"last_name\" size = \"40\" value = \"%s\" ></td>\n", $last_name);  
         printf("</tr>\n");  
3287    
3288          // First name                  // Table definition  
3289          printf("<tr>\n");                  printf("<center><table width=\"75%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\">\n");
         printf("<td><b>First Name:</b></td>\n");        
         printf("<td><input type = \"text\" name = \"first_name\" size = \"30\" value = \"%s\"></td>\n", $first_name);  
         printf("</tr>\n");  
3290    
3291          // staff account - must be unique, may match against staff_account                  // Form to handle vendor
3292          printf("<tr>\n");                  // If new insert
3293          printf("<td><b>Staff Account (x500 if applicable, 20 char max.):</b></td>");                  if ($key_id <1) {
3294          printf("<td><input type = \"text\" name = \"staff_account\" size = \"20\" value =\"%s\"></td>\n", $staff_account);                          printf("<form method = \"POST\" action = \"insert.phtml\" >\n");
3295          printf("</tr>\n");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
3296                                    printf("Enter New Vendor");
3297          // Staff email - whether or not x500 authentication is used                          printf("</td></tr>\n");
3298          printf("<tr>\n");                  }
         printf("<td><b>Staff E-Mail:</b></td>\n");  
         printf("<td><input type = \"text\" name = \"staff_email\" size = \"50\" value =\"%s\"></td>\n", $staff_email);  
         printf("</tr>\n");  
3299    
3300          // Title                  // Else update
3301          printf("<tr>\n");                  else {
3302          printf("<td><b>Job Title:</b></td>\n");                          printf("<form method = \"POST\" action = \"update.phtml\" >\n");
3303          printf("<td><select name = \"stafftitle_id\">");                          printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n");
3304          dropDownFieldSelected($con, "stafftitle", "stafftitle", "stafftitle_id", "WHERE stafftitle_id > 0", $stafftitle_id);                          printf("Edit Vendor: %s (ID# %d)", $vendor, $vendor_id);
3305          printf("</select></td>\n");                          printf("</td></tr>\n");
3306          printf("</tr>\n");                  }
3307    
3308          // Access                  // Vendor name
3309          printf("<tr>\n");                  printf("<tr>\n");
3310          printf("<td><b>Access Level:</b></td>\n");                  printf("<td><b>Vendor:</b></td>\n");
3311          printf("<td><select name = \"access_id\">\n");                  printf("<td><input type = \"text\" name = \"vendor\" size = \"40\" value = \"%s\" ></td>\n", $vendor);
3312          dropDownFieldSelected($con, "access", "access", "access_id", "WHERE access_id > 0", $access_id);                  printf("</tr>\n");
         printf("</select></td>\n");  
         printf("</tr>\n");  
3313    
3314          // Buttons                  // Vendor description
3315          printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");                  printf("<tr>\n");
3316                    printf("<td colspan=\"2\"><b>Description:</b><br>\n");
3317                    printf("<textarea name =\"vendor_descr\" rows =\"5\" cols=\"60\">\n");
3318                    printf("%s", $vendor_descr);
3319                    printf("</textarea>\n");
3320                    printf("</td></tr>\n");
3321                    
3322                    // Down toggle
3323                    $up_toggle = "";
3324                    $down_toggle = "";
3325                    $alert_toggle = "";
3326                    if ($vendor_status < 1) $up_toggle = " CHECKED ";
3327                    else if ($vendor_status == 1) $down_toggle = " CHECKED ";
3328                    else if ($vendor_status == 2) $alert_toggle = " CHECKED ";
3329                    printf("<tr><td>\n");
3330                    printf("<b>Vendor Status:</b>\n");
3331                    printf("</td>\n");
3332                    printf("<td>\n");
3333                    printf("<b>Up</b> <input type=\"radio\" name =\"vendor_status\" value=\"0\" %s>\n", $up_toggle);
3334                    printf("<b>Down</b> <input type=\"radio\" name =\"vendor_status\" value=\"1\" %s>\n", $down_toggle);
3335                    printf("<b>Alert</b> <input type=\"radio\" name =\"vendor_status\" value=\"2\" %s>\n", $alert_toggle);  
3336                    
3337          // If new staff                  printf("</td></tr>\n");
3338          if ($staff_id < 2) {                  
3339                  printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertStaff\" >");                      // Message
3340                  printf("<input type = \"Submit\" value = \"Save New Staff\" > ");                  printf("<tr><td>\n");
3341          }                  printf("<b>Down/Alert Message:</b>\n");
3342          // Editing an existing staffperson                  printf("</td>\n");
3343          else {                  printf("<td>\n");
3344                  printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateStaff\" >");                  printf("<input type =\"text\" size=\"60\" name =\"vendor_message\" value=\"%s\">\n", $vendor_message);
3345                  printf("<input type = \"Hidden\" name = \"staff_id\" value = \"%d\" >", $staff_id);                  printf("</td></tr>\n");        
                 printf("<input type = \"Submit\" value = \"Save Staff Changes\" > ");  
         }  
         printf("<input type = \"Reset\" value = \"Reset\" >\n");  
3346    
3347          // Close the form and table                  // Buttons
3348          printf("</form>\n");                  printf("<tr><td colspan=\"2\" align=\"center\"><br>\n");
3349                    // If this is an existing vendor
3350                    if ($key_id > 0) {
3351                            printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateVendor\" >\n");
3352                            printf("<input type = \"Submit\" value = \"Update Vendor\" >\n");
3353                            printf("<input type = \"Hidden\" name = \"vendor_id\" value = \"%d\" >\n", $vendor_id);
3354                    }
3355                    // Editing a new vendor
3356                    else {
3357                            printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertVendor\" >\n");
3358                            printf("<input type = \"Submit\" value = \"Save New Vendor\">\n");
3359                    }
3360    
3361          printf("</td></tr></table>\n");                  // Common button
3362                    printf("<input type = \"Reset\" value = \"Reset\" >\n");
3363    
3364          // If editing existing staff, draw other forms                  // Close things
3365          if ($staff_id > 0) {                  printf("</form>\n");
3366                  formPassword($con, $staff_id);                  printf("</td></tr></table></center>\n");
                 formAssignStaffLibunit($con, $staff_id);  
                 formAssignStaffSub($con, $staff_id);  
         }  
3367    
3368          printf("</center><br>\n");          } // No problems
3369  }  }
3370  ?>  ?>

Legend:
Removed from v.71  
changed lines
  Added in v.72

  ViewVC Help
Powered by ViewVC 1.1.26