1 |
<?php |
2 |
/********************************************************** |
3 |
Function Library: forms.php |
4 |
Original Author: Paul Bramscher <brams006@umn.edu> |
5 |
Last Modified: 03.16.2004 by Paul Bramscher |
6 |
*********************************************************** |
7 |
Comments: |
8 |
Functions here include most data-entry forms. Note that |
9 |
the same form controls both "new" and "edit" functionality. |
10 |
The standard convention used is to call a form with a |
11 |
zero "0" if it is a new record, or a positive integer |
12 |
corresponding to the primary key of the row to edit an |
13 |
existing record. |
14 |
|
15 |
Assignment-type forms are those which build a composite |
16 |
primary key to a bridging table. These allow for both the |
17 |
creation of new associations and the deletion of existing |
18 |
associations, depending on which transaction the user |
19 |
selects. Boxes are mutually exclusive, with available |
20 |
options in one box, selected options in another. These |
21 |
combo boxes allow multiple selections (or deselections). |
22 |
*********************************************************** |
23 |
Table of Contents: |
24 |
formAssignLibunitStaff |
25 |
formAssignResFeature |
26 |
formAssignResLoc |
27 |
formAssignResMastersubject |
28 |
formAssignServLoc |
29 |
formAssignServServtype |
30 |
formAssignStaffLibunit |
31 |
formAssignStaffSub |
32 |
formAssignSubCoursesub |
33 |
formAssignSubLoc |
34 |
formAssignSubMaster |
35 |
formAssignSubOtherSub |
36 |
formAssignSubPage |
37 |
formAssignSubStaff |
38 |
formCoursesub |
39 |
formEditSingleField |
40 |
formFaculty |
41 |
formFeature |
42 |
formInfotype |
43 |
formLibunit |
44 |
formLocation |
45 |
formNewSingleField |
46 |
formPassword |
47 |
formResource |
48 |
formService |
49 |
formStaff |
50 |
formStyle |
51 |
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 |
138 |
Author: Paul Bramscher |
139 |
Last Modified: 03.10.2004 |
140 |
*********************************************************** |
141 |
Purpose: |
142 |
Draws an HTML combo box with multiple selection capability |
143 |
to assign features to the supplied resource id. |
144 |
**********************************************************/ |
145 |
function formAssignResFeature($resource_id){ |
146 |
|
147 |
// Table definition |
148 |
printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >\n"); |
149 |
|
150 |
// Form of available features to select |
151 |
printf("<form method = \"POST\" action = \"assign.phtml#ResFea\" >\n"); |
152 |
printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >\n", $resource_id); |
153 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignResFeature\" >\n"); |
154 |
|
155 |
// Omit the '(N/A)' feature |
156 |
$omit_string = "WHERE feature_id > 1"; |
157 |
|
158 |
// Omit any pre-selected features in res_feature |
159 |
$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; |
161 |
|
162 |
// Draw the combo box |
163 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
164 |
printf("Assign Features"); |
165 |
printf("</td></tr>\n"); |
166 |
printf("<tr><td valign = \"top\" >\n"); |
167 |
printf("<br><b>Available Features(s):<br></b>\n"); |
168 |
printf("<select name = \"feature_id_array[]\" multiple size = \"5\" >\n"); |
169 |
dropDownFieldOmit("feature", "feature", "feature_id", $omit_string); |
170 |
printf("</select><br><br>\n"); |
171 |
|
172 |
// Close things |
173 |
printf("<center>\n"); |
174 |
printf("<input type = \"Submit\" value = \" >> \" >\n"); |
175 |
printf("</form>\n"); |
176 |
printf("</center>\n"); |
177 |
printf("</td>\n"); |
178 |
|
179 |
// Form of current features to deselect |
180 |
printf("<td valign = \"top\" >\n"); |
181 |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
182 |
printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >\n", $resource_id); |
183 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteResFeature\" >\n"); |
184 |
printf("<br><b>Selected feature(s):</b><br>\n"); |
185 |
printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n"); |
186 |
|
187 |
$sql = "SELECT f.feature, f.feature_id FROM |
188 |
feature f, |
189 |
res_feature rf, |
190 |
resource r |
191 |
WHERE |
192 |
r.resource_id = " . $resource_id . " AND |
193 |
rf.resource_id = r.resource_id AND |
194 |
rf.feature_id = f.feature_id ORDER BY feature"; |
195 |
$rs = xx_tryquery($sql); |
196 |
|
197 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
198 |
$feature = $row["feature"]; |
199 |
$feature_id = $row["feature_id"]; |
200 |
printf("<option value = \"%s\">%s</option>\n", $feature_id, $feature); |
201 |
} |
202 |
|
203 |
// Close things |
204 |
printf("</select><br><br>\n"); |
205 |
printf("<center>\n"); |
206 |
printf("<input type = \"Submit\" value =\" << \">\n"); |
207 |
printf("</center>\n"); |
208 |
printf("</form>\n"); |
209 |
printf("</td></tr>\n"); |
210 |
|
211 |
// Close off table |
212 |
printf("</td></tr></table>\n"); |
213 |
} |
214 |
|
215 |
|
216 |
/********************************************************** |
217 |
Function: formAssignResLoc |
218 |
Author: Paul Bramscher |
219 |
Last Modified: 03.10.2004 |
220 |
*********************************************************** |
221 |
Purpose: |
222 |
Draws an HTML combo box with multiple selection capability |
223 |
to assign locations to the supplied resource id. |
224 |
**********************************************************/ |
225 |
function formAssignResLoc($resource_id){ |
226 |
|
227 |
// Table definition |
228 |
printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >\n"); |
229 |
|
230 |
// Form of available locations to select |
231 |
printf("<form method = \"POST\" action = \"assign.phtml#ResLoc\" >\n"); |
232 |
printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >\n", $resource_id); |
233 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignResLoc\" >\n"); |
234 |
|
235 |
// Omit the '(N/A)' location |
236 |
$omit_string = "WHERE location_id > 1"; |
237 |
|
238 |
// Omit any pre-selected locations in res_loc |
239 |
$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; |
241 |
|
242 |
// Draw the combo box |
243 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
244 |
printf("Assign Locations"); |
245 |
printf("</td></tr>\n"); |
246 |
printf("<tr><td valign = \"top\" >\n"); |
247 |
printf("<br><b>Available Location(s):<br></b>\n"); |
248 |
printf("<select name = \"location_id_array[]\" multiple size = \"5\" >\n"); |
249 |
dropDownFieldOmit("location", "location", "location_id", $omit_string); |
250 |
printf("</select><br><br>\n"); |
251 |
|
252 |
// Close things |
253 |
printf("<center>\n"); |
254 |
printf("<input type = \"Submit\" value = \" >> \" >\n"); |
255 |
printf("</center>\n"); |
256 |
printf("</form>\n"); |
257 |
printf("</td>\n"); |
258 |
|
259 |
// Current locations to deselect |
260 |
printf("<td valign = \"top\" >\n"); |
261 |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
262 |
printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >\n", $resource_id); |
263 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteResLoc\" >\n"); |
264 |
printf("<br><b>Selected Location(s):</b><br>\n"); |
265 |
printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n"); |
266 |
|
267 |
$sql = "SELECT l.location, l.location_id FROM |
268 |
location l, |
269 |
res_loc rl, |
270 |
resource r |
271 |
WHERE |
272 |
r.resource_id = " . $resource_id . " AND |
273 |
rl.resource_id = r.resource_id AND |
274 |
rl.location_id = l.location_id ORDER BY location"; |
275 |
$rs = xx_tryquery($sql); |
276 |
|
277 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
278 |
$location = $row["location"]; |
279 |
$location_id = $row["location_id"]; |
280 |
printf("<option value = \"%s\">%s</option>\n", $location_id, $location); |
281 |
} |
282 |
|
283 |
// Close things |
284 |
printf("</select><br><br>\n"); |
285 |
printf("<center>\n"); |
286 |
printf("<input type = \"Submit\" value =\" << \">\n"); |
287 |
printf("</center>\n"); |
288 |
printf("</form>\n"); |
289 |
printf("</td></tr>\n"); |
290 |
|
291 |
// Close off table |
292 |
printf("</td></tr></table>\n"); |
293 |
} |
294 |
|
295 |
|
296 |
/********************************************************** |
297 |
Function: formAssignResMastersubject |
298 |
Author: Paul Bramscher |
299 |
Last Modified: 03.10.2004 |
300 |
*********************************************************** |
301 |
Purpose: |
302 |
Draws an HTML combo box with multiple selection capability |
303 |
to assign master subjects to the supplied resource id. |
304 |
**********************************************************/ |
305 |
function formAssignResMastersubject($resource_id){ |
306 |
|
307 |
// Table definition |
308 |
printf("<br><table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >\n"); |
309 |
|
310 |
// Form of available master subjects to select |
311 |
printf("<form method = \"POST\" action = \"assign.phtml#ResMaster\" >\n"); |
312 |
printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >\n", $resource_id); |
313 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignResMastersubject\" >\n"); |
314 |
|
315 |
// Omit the '(N/A)' mastersubjects |
316 |
$omit_string = "WHERE mastersubject_id > 2"; |
317 |
|
318 |
// Omit any pre-selected locations in res_mastersubject |
319 |
$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; |
321 |
|
322 |
// Draw the combo box |
323 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
324 |
printf("Assign Master Subjects"); |
325 |
printf("</td></tr>\n"); |
326 |
printf("<tr><td valign = \"top\" >\n"); |
327 |
printf("<br><b>Available Mastersubjects(s):<br></b>\n"); |
328 |
printf("<select name = \"mastersubject_id_array[]\" multiple size = \"5\" >\n"); |
329 |
dropDownFieldOmit("mastersubject", "mastersubject", "mastersubject_id", $omit_string); |
330 |
printf("</select><br><br>\n"); |
331 |
|
332 |
// Close things |
333 |
printf("<center>\n"); |
334 |
printf("<input type = \"Submit\" value = \" >> \" >"); |
335 |
printf("</center>"); |
336 |
printf("</form>"); |
337 |
printf("</td>"); |
338 |
|
339 |
// Current master subjects to deselect |
340 |
printf("<td valign = \"top\" >\n"); |
341 |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
342 |
printf("<input type = \"Hidden\" name = \"resource_id\" value = \"%d\" >\n", $resource_id); |
343 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteResMastersubject\" >\n"); |
344 |
printf("<br><b>Selected Mastersubjects(s):</b><br>\n"); |
345 |
printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n"); |
346 |
|
347 |
$sql = "SELECT m.mastersubject, m.mastersubject_id FROM |
348 |
mastersubject m, |
349 |
res_mastersubject rm, |
350 |
resource r |
351 |
WHERE |
352 |
r.resource_id = " . $resource_id . " AND |
353 |
rm.resource_id = r.resource_id AND |
354 |
rm.mastersubject_id = m.mastersubject_id ORDER BY mastersubject"; |
355 |
$rs = xx_tryquery($sql); |
356 |
|
357 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
358 |
$mastersubject = $row["mastersubject"]; |
359 |
$mastersubject_id = $row["mastersubject_id"]; |
360 |
printf("<option value = \"%s\">%s</option>\n", $mastersubject_id, $mastersubject); |
361 |
} |
362 |
|
363 |
// Close things |
364 |
printf("</select><br><br>\n"); |
365 |
printf("<center>\n"); |
366 |
printf("<input type = \"Submit\" value =\" << \">\n"); |
367 |
printf("</center>\n"); |
368 |
printf("</form>\n"); |
369 |
printf("</td></tr>\n"); |
370 |
|
371 |
// Close off table |
372 |
printf("</td></tr></table>\n"); |
373 |
} |
374 |
|
375 |
|
376 |
/********************************************************** |
377 |
Function: formAssignServLoc |
378 |
Author: Paul Bramscher |
379 |
Last Modified: 03.10.2004 |
380 |
*********************************************************** |
381 |
Purpose: |
382 |
Draws an HTML combo box with multiple selection capability |
383 |
to assign locations to the supplied service id. |
384 |
**********************************************************/ |
385 |
function formAssignServLoc($service_id){ |
386 |
|
387 |
// Table definition |
388 |
printf("<br><br><table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n"); |
389 |
|
390 |
// Form of available locations to select |
391 |
printf("<form method = \"POST\" action = \"assign.phtml\" >\n"); |
392 |
printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >\n", $service_id); |
393 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignServLoc\" >\n"); |
394 |
|
395 |
// Box header |
396 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
397 |
printf("Assign Service Locations"); |
398 |
printf("</td></tr>\n"); |
399 |
|
400 |
// Omit the '(N/A)' location |
401 |
$omit_string = "WHERE location_id > 1"; |
402 |
|
403 |
// Omit any pre-selected locations in service_location |
404 |
$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; |
406 |
|
407 |
// Draw the combo box |
408 |
printf("<tr><td valign = \"top\" >\n"); |
409 |
printf("<br><b>Available Location(s):<br></b>\n"); |
410 |
printf("<select name = \"location_id_array[]\" multiple size = \"5\" >\n"); |
411 |
dropDownFieldOmit("location", "location", "location_id", $omit_string); |
412 |
printf("</select><br><br>\n"); |
413 |
|
414 |
// Close things |
415 |
printf("<center>\n"); |
416 |
printf("<input type = \"Submit\" value = \" >> \" >\n"); |
417 |
printf("</form>\n"); |
418 |
printf("</center>\n"); |
419 |
printf("</td>\n"); |
420 |
|
421 |
// Current locations to deselect |
422 |
printf("<td valign = \"top\" >\n"); |
423 |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
424 |
printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >\n", $service_id); |
425 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteServLoc\" >\n"); |
426 |
printf("<br><b>Selected Location(s):</b><br>\n"); |
427 |
printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n"); |
428 |
|
429 |
$sql = "SELECT l.location, l.location_id FROM |
430 |
location l, |
431 |
serv_loc sl, |
432 |
service s |
433 |
WHERE |
434 |
s.service_id = " . $service_id . " AND |
435 |
sl.service_id = s.service_id AND |
436 |
sl.location_id = l.location_id ORDER BY location"; |
437 |
$rs = xx_tryquery($sql); |
438 |
|
439 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
440 |
$location = $row["location"]; |
441 |
$location_id = $row["location_id"]; |
442 |
printf("<option value = \"%s\">%s</option>\n", $location_id, $location); |
443 |
} |
444 |
|
445 |
// Close things |
446 |
printf("</select><br><br>\n"); |
447 |
printf("<center>\n"); |
448 |
printf("<input type = \"Submit\" value =\" << \">\n"); |
449 |
printf("</center>\n"); |
450 |
printf("</form>\n"); |
451 |
printf("</td></tr>\n"); |
452 |
|
453 |
// Close off the table |
454 |
printf("</td></tr></table>\n"); |
455 |
} |
456 |
|
457 |
|
458 |
/********************************************************** |
459 |
Function: formAssignServServtype |
460 |
Author: Paul Bramscher |
461 |
Last Modified: 03.10.2004 |
462 |
*********************************************************** |
463 |
Purpose: |
464 |
Draws an HTML combo box with multiple selection capability |
465 |
to assign service types to the supplied service id. |
466 |
**********************************************************/ |
467 |
function formAssignServServtype($service_id){ |
468 |
|
469 |
// Table definition |
470 |
printf("<br><br><table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n"); |
471 |
|
472 |
// Form of available service types to select |
473 |
printf("<form method = \"POST\" action = \"assign.phtml\" >\n"); |
474 |
printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >\n", $service_id); |
475 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignServServtype\" >\n"); |
476 |
|
477 |
// Box header |
478 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
479 |
printf("Assign Service Types"); |
480 |
printf("</td></tr>\n"); |
481 |
|
482 |
// Omit the '(N/A)' type |
483 |
$omit_string = "WHERE servicetype_id > 1"; |
484 |
|
485 |
// Omit any pre-selected servive types in serv_servtype |
486 |
$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; |
488 |
|
489 |
// Draw the combo box |
490 |
printf("<tr><td valign = \"top\" >\n"); |
491 |
printf("<br><b>Available Service Types(s):<br></b>\n"); |
492 |
printf("<select name = \"servicetype_id_array[]\" multiple size = \"5\" >\n"); |
493 |
dropDownFieldOmit("servicetype", "servicetype", "servicetype_id", $omit_string); |
494 |
printf("</select><br><br>\n"); |
495 |
|
496 |
// Close things |
497 |
printf("<center>\n"); |
498 |
printf("<input type = \"Submit\" value = \" >> \" >\n"); |
499 |
printf("</form>\n"); |
500 |
printf("</center>\n"); |
501 |
printf("</td>\n"); |
502 |
|
503 |
// Current servicetypes to deselect |
504 |
printf("<td valign = \"top\" >\n"); |
505 |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
506 |
printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >\n", $service_id); |
507 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteServServtype\" >\n"); |
508 |
printf("<br><b>Selected Service Types(s):</b><br>\n"); |
509 |
printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n"); |
510 |
|
511 |
$sql = "SELECT t.servicetype, t.servicetype_id FROM |
512 |
servicetype t, |
513 |
serv_servtype st, |
514 |
service s |
515 |
WHERE |
516 |
s.service_id = " . $service_id . " AND |
517 |
st.service_id = s.service_id AND |
518 |
st.servicetype_id = t.servicetype_id ORDER BY servicetype"; |
519 |
$rs = xx_tryquery($sql); |
520 |
|
521 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
522 |
$servicetype = $row["servicetype"]; |
523 |
$servicetype_id = $row["servicetype_id"]; |
524 |
printf("<option value = \"%s\">%s</option>\n", $servicetype_id, $servicetype); |
525 |
} |
526 |
|
527 |
// Close things |
528 |
printf("</select><br><br>\n"); |
529 |
printf("<center>\n"); |
530 |
printf("<input type = \"Submit\" value =\" << \">\n"); |
531 |
printf("</center>\n"); |
532 |
printf("</form>\n"); |
533 |
printf("</td></tr>\n"); |
534 |
|
535 |
// Close off the table |
536 |
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 |
706 |
Author: Paul Bramscher |
707 |
Last Modified: 03.10.2004 |
708 |
*********************************************************** |
709 |
Purpose: |
710 |
Draws an HTML combo box with multiple selection capability |
711 |
to assign course subjects (with cip codes) to the supplied |
712 |
subject id. |
713 |
**********************************************************/ |
714 |
function formAssignSubCoursesub($subject_id){ |
715 |
|
716 |
// Table definition |
717 |
printf("<br><br>\n"); |
718 |
printf("<table width=\"90%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\" >\n"); |
719 |
|
720 |
// Form of available course subjects to select |
721 |
printf("<form method = \"POST\" action = \"assign.phtml\" >\n"); |
722 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
723 |
printf("Map to Course Subjects / CIP Codes"); |
724 |
printf("</td></tr>\n"); |
725 |
|
726 |
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id); |
727 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubCoursesub\" >\n"); |
728 |
|
729 |
// Omit the '(N/A)' course subject |
730 |
$omit_string = "WHERE coursesub_id > 1"; |
731 |
|
732 |
// Omit any pre-selected locations in sub_coursesub |
733 |
$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; |
735 |
|
736 |
// Draw the combo box |
737 |
printf("<tr><td valign = \"top\" >\n"); |
738 |
printf("<br><b>Available Course Subjects(s):<br></b>\n"); |
739 |
printf("<select name = \"coursesub_id_array[]\" multiple size = \"20\" >\n"); |
740 |
dropDownCoursesubOmit($omit_string); |
741 |
printf("</select><br><br>\n"); |
742 |
|
743 |
// Close things |
744 |
printf("<center>\n"); |
745 |
printf("<input type = \"Submit\" value = \" >> \" >\n"); |
746 |
printf("</form>\n"); |
747 |
printf("</center>\n"); |
748 |
printf("</td>\n"); |
749 |
|
750 |
// Current coursesubs to deselect |
751 |
printf("<td valign = \"top\" >\n"); |
752 |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
753 |
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id); |
754 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubCoursesub\" >\n"); |
755 |
printf("<br><b>Selected Course Subject(s):</b><br>\n"); |
756 |
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 |
759 |
coursesub c, |
760 |
sub_coursesub sc, |
761 |
subject s |
762 |
WHERE |
763 |
s.subject_id = " . $subject_id . " AND |
764 |
sc.subject_id = s.subject_id AND |
765 |
sc.coursesub_id = c.coursesub_id ORDER BY coursesub_descr"; |
766 |
$rs = xx_tryquery($sql); |
767 |
|
768 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
769 |
$coursesub = $row["coursesub"]; |
770 |
$coursesub_id = $row["coursesub_id"]; |
771 |
$coursesub_descr = $row["coursesub_descr"]; |
772 |
$cip_code = $row["cip_code"]; |
773 |
|
774 |
// Limit length |
775 |
if (strlen($coursesub_descr) > 30) $coursesub_descr = substr($coursesub_descr, 0, 30) . "..."; |
776 |
|
777 |
printf("<option value = \"%s\">%s | %s [%s]</option>\n", $coursesub_id, $coursesub, $coursesub_descr, $cip_code); |
778 |
} |
779 |
|
780 |
// Close things |
781 |
printf("</select><br><br>\n"); |
782 |
printf("<center>\n"); |
783 |
printf("<input type = \"Submit\" value =\" << \">\n"); |
784 |
printf("</center>\n"); |
785 |
printf("</form>\n"); |
786 |
printf("</td></tr>\n"); |
787 |
|
788 |
// Close off the table |
789 |
printf("</td></tr></table>\n"); |
790 |
} |
791 |
|
792 |
|
793 |
/********************************************************** |
794 |
Function: formAssignSubLoc |
795 |
Author: Paul Bramscher |
796 |
Last Modified: 03.10.2004 |
797 |
*********************************************************** |
798 |
Purpose: |
799 |
Draws an HTML combo box with multiple selection capability |
800 |
to assign locations to the supplied subject id. |
801 |
**********************************************************/ |
802 |
function formAssignSubLoc($subject_id){ |
803 |
|
804 |
// Table definition |
805 |
printf("<br><br>\n"); |
806 |
printf("<table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n"); |
807 |
|
808 |
// Form of available locations to select |
809 |
printf("<form method = \"POST\" action = \"assign.phtml\" >\n"); |
810 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
811 |
printf("Assign Secondary Locations"); |
812 |
printf("</td></tr>\n"); |
813 |
|
814 |
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id); |
815 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubLoc\" >\n"); |
816 |
|
817 |
// Omit the '(N/A)' location |
818 |
$omit_string = "WHERE location_id > 1"; |
819 |
|
820 |
// Omit any pre-selected locations in sub_loc |
821 |
$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; |
823 |
|
824 |
// Draw the combo box |
825 |
printf("<tr><td valign = \"top\" >\n"); |
826 |
printf("<br><b>Available Location(s):<br></b>\n"); |
827 |
printf("<select name = \"location_id_array[]\" multiple size = \"5\" >"); |
828 |
dropDownFieldOmit("location", "location", "location_id", $omit_string); |
829 |
printf("</select><br><br>\n"); |
830 |
|
831 |
// Close things |
832 |
printf("<center>\n"); |
833 |
printf("<input type = \"Submit\" value = \" >> \" >\n"); |
834 |
printf("</form>\n"); |
835 |
printf("</center>\n"); |
836 |
printf("</td>\n"); |
837 |
|
838 |
// Current locations to deselect |
839 |
printf("<td valign = \"top\" >\n"); |
840 |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
841 |
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id); |
842 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubLoc\" >\n"); |
843 |
printf("<br><b>Selected Location(s):</b><br>\n"); |
844 |
printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n"); |
845 |
|
846 |
$sql = "SELECT l.location, l.location_id FROM |
847 |
location l, |
848 |
sub_loc sl, |
849 |
subject s |
850 |
WHERE |
851 |
s.subject_id = " . $subject_id . " AND |
852 |
sl.subject_id = s.subject_id AND |
853 |
sl.location_id = l.location_id ORDER BY location"; |
854 |
$rs = xx_tryquery($sql); |
855 |
|
856 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
857 |
$location = $row["location"]; |
858 |
$location_id = $row["location_id"]; |
859 |
printf("<option value = \"%s\">%s</option>\n", $location_id, $location); |
860 |
} |
861 |
|
862 |
// Close things |
863 |
printf("</select><br><br>\n"); |
864 |
printf("<center>\n"); |
865 |
printf("<input type = \"Submit\" value =\" << \">\n"); |
866 |
printf("</center>\n"); |
867 |
printf("</form>\n"); |
868 |
printf("</td></tr>\n"); |
869 |
|
870 |
// Close off the table |
871 |
printf("</td></tr></table>\n"); |
872 |
} |
873 |
|
874 |
|
875 |
/********************************************************** |
876 |
Function: formAssignSubMaster |
877 |
Author: Paul Bramscher |
878 |
Last Modified: 03.10.2004 |
879 |
*********************************************************** |
880 |
Purpose: |
881 |
Draws an HTML combo box with multiple selection capability |
882 |
to assign master subjects to the supplied subject id. |
883 |
**********************************************************/ |
884 |
function formAssignSubMaster($subject_id){ |
885 |
|
886 |
// Table definition |
887 |
printf("<br><br>\n"); |
888 |
printf("<table width=\"60%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\" >\n"); |
889 |
|
890 |
// Form of available master subjects to select |
891 |
printf("<form method = \"POST\" action = \"assign.phtml\" >\n"); |
892 |
|
893 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
894 |
printf("Assign Master Subjects"); |
895 |
printf("</td></tr>\n"); |
896 |
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id); |
897 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubMaster\" >\n"); |
898 |
|
899 |
// Omit the '(N/A)' location |
900 |
$omit_string = "WHERE mastersubject_id > 1"; |
901 |
|
902 |
// Omit any pre-selected locations in sub_mastersubject |
903 |
$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; |
905 |
|
906 |
// Draw the combo box |
907 |
printf("<tr><td valign = \"top\" >\n"); |
908 |
printf("<br><b>Available Master Subjects(s):<br></b>\n"); |
909 |
printf("<select name = \"mastersubject_id_array[]\" multiple size = \"5\" >\n"); |
910 |
dropDownFieldOmit("mastersubject", "mastersubject", "mastersubject_id", $omit_string); |
911 |
printf("</select><br><br>\n"); |
912 |
|
913 |
// Close things |
914 |
printf("<center>\n"); |
915 |
printf("<input type = \"Submit\" value = \" >> \" >\n"); |
916 |
printf("</form>\n"); |
917 |
printf("</center>\n"); |
918 |
printf("</td>\n"); |
919 |
|
920 |
// Current mastersubjects to deselect |
921 |
printf("<td valign = \"top\" >\n"); |
922 |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
923 |
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id); |
924 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubMaster\" >\n"); |
925 |
printf("<br><b>Selected Master Subject(s):</b><br>\n"); |
926 |
printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n"); |
927 |
|
928 |
$sql = "SELECT m.mastersubject, m.mastersubject_id FROM |
929 |
mastersubject m, |
930 |
sub_mastersubject sm, |
931 |
subject s |
932 |
WHERE |
933 |
s.subject_id = " . $subject_id . " AND |
934 |
sm.subject_id = s.subject_id AND |
935 |
sm.mastersubject_id = m.mastersubject_id ORDER BY mastersubject"; |
936 |
$rs = xx_tryquery($sql); |
937 |
|
938 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
939 |
$mastersubject = $row["mastersubject"]; |
940 |
$mastersubject_id = $row["mastersubject_id"]; |
941 |
printf("<option value = \"%s\">%s</option>\n", $mastersubject_id, $mastersubject); |
942 |
} |
943 |
|
944 |
// Close things |
945 |
printf("</select><br><br>\n"); |
946 |
printf("<center>\n"); |
947 |
printf("<input type = \"Submit\" value =\" << \">\n"); |
948 |
printf("</center>\n"); |
949 |
printf("</form>\n"); |
950 |
printf("</td></tr>\n"); |
951 |
|
952 |
// Close off the table |
953 |
printf("</td></tr></table>\n"); |
954 |
} |
955 |
|
956 |
|
957 |
/********************************************************** |
958 |
Function: formAssignSubOtherSub |
959 |
Author: Paul Bramscher |
960 |
Last Modified: 03.10.2004 |
961 |
*********************************************************** |
962 |
Purpose: |
963 |
Draws an HTML combo box with multiple selection capability |
964 |
to assign other subject pages to the supplied subject id. |
965 |
**********************************************************/ |
966 |
function formAssignSubOtherSub($subject_id){ |
967 |
|
968 |
// Table definition |
969 |
printf("<table width=\"75%%\" border=\"2\" class=\"backLight\" cellpadding=\"4\" >\n"); |
970 |
|
971 |
// Form of available master subjects to select |
972 |
printf("<form method = \"POST\" action = \"subject_transaction.phtml\" >\n"); |
973 |
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id); |
974 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubOtherSub\" >\n"); |
975 |
|
976 |
// Free-form pages only |
977 |
$omit_string = "WHERE subject_id > 1 AND subject_id <> " . $subject_id; |
978 |
|
979 |
// Omit any pre-selected other subjects in sub_othersub |
980 |
$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; |
982 |
|
983 |
// Draw the combo box |
984 |
// Header |
985 |
printf("<tr><td class=\"cellPlain\" colspan=\"2\">Related RQS Subjects</td></tr>\n"); |
986 |
|
987 |
|
988 |
printf("<tr><td valign = \"top\" >\n"); |
989 |
printf("<br><b>Available Subject(s):<br></b>\n"); |
990 |
printf("<select name = \"subject_id_array[]\" multiple size = \"5\" >\n"); |
991 |
dropDownFieldOmit("subject", "subject", "subject_id", $omit_string); |
992 |
printf("</select><br><br>\n"); |
993 |
|
994 |
// Close things |
995 |
printf("<center>\n"); |
996 |
printf("<input type = \"Submit\" value = \" Add \" >\n"); |
997 |
printf("</form>\n"); |
998 |
printf("</center>\n"); |
999 |
printf("</td></tr>\n"); |
1000 |
|
1001 |
// Current rqs subjects to deselect |
1002 |
printf("<tr><td valign = \"top\" >\n"); |
1003 |
printf("<form method = \"POST\" action = \"subject_transaction.phtml\" >\n"); |
1004 |
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >", $subject_id); |
1005 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubOtherSub\" >\n"); |
1006 |
printf("<br><b>Selected Subject(s):</b><br>\n"); |
1007 |
printf("<select name =\"key_list_array[]\" multiple size = \"3\">\n"); |
1008 |
|
1009 |
$sql = "SELECT so.othersub_id, s.subject FROM |
1010 |
subject s, |
1011 |
sub_othersub so |
1012 |
WHERE |
1013 |
so.subject_id = " . $subject_id . " AND |
1014 |
so.othersub_id = s.subject_id |
1015 |
ORDER BY s.subject"; |
1016 |
$rs = xx_tryquery($sql); |
1017 |
|
1018 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
1019 |
$othersub = $row["subject"]; |
1020 |
$othersub_id = $row["othersub_id"]; |
1021 |
|
1022 |
printf("<option value = \"%s\">%s</option>\n", $othersub_id, $othersub); |
1023 |
} |
1024 |
|
1025 |
// Close things |
1026 |
printf("</select><br><br>\n"); |
1027 |
printf("<center>\n"); |
1028 |
printf("<input type = \"Submit\" value =\" Remove \">\n"); |
1029 |
printf("</center>\n"); |
1030 |
printf("</form>\n"); |
1031 |
printf("</td></tr>\n"); |
1032 |
|
1033 |
// Close off the table |
1034 |
printf("</td></tr></table>\n"); |
1035 |
} |
1036 |
|
1037 |
|
1038 |
/********************************************************** |
1039 |
Function: formAssignSubPage |
1040 |
Author: Paul Bramscher |
1041 |
Last Modified: 03.10.2004 |
1042 |
*********************************************************** |
1043 |
Purpose: |
1044 |
Draws an HTML combo box with multiple selection capability |
1045 |
to assign PageScribe Pages to the supplied subject id. |
1046 |
**********************************************************/ |
1047 |
function formAssignSubPage($subject_id){ |
1048 |
|
1049 |
// Table definition |
1050 |
printf("<table width=\"75%%\" border=\"2\" class=\"backLight\" cellpadding=\"4\" >\n"); |
1051 |
|
1052 |
// Form of available master subjects to select |
1053 |
printf("<form method = \"POST\" action = \"subject_transaction.phtml\" >\n"); |
1054 |
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id); |
1055 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubPage\" >\n"); |
1056 |
|
1057 |
// Free-form pages only |
1058 |
$omit_string = "WHERE pagetype_id = 2"; |
1059 |
|
1060 |
// Omit any pre-selected pages in sub_page |
1061 |
$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; |
1063 |
|
1064 |
// Draw the combo box |
1065 |
// Header |
1066 |
printf("<tr><td class=\"cellPlain\" colspan=\"2\">Related PageScribe Pages</td></tr>\n"); |
1067 |
|
1068 |
|
1069 |
printf("<tr><td valign = \"top\" >\n"); |
1070 |
printf("<br><b>Available Page(s):<br></b>\n"); |
1071 |
printf("<select name = \"page_id_array[]\" multiple size = \"5\" >\n"); |
1072 |
dropDownFieldOmit("page", "page_title", "page_id", $omit_string); |
1073 |
printf("</select><br><br>\n"); |
1074 |
|
1075 |
// Close things |
1076 |
printf("<center>\n"); |
1077 |
printf("<input type = \"Submit\" value = \" Add \" >\n"); |
1078 |
printf("</form>\n"); |
1079 |
printf("</center>\n"); |
1080 |
printf("</td></tr>\n"); |
1081 |
|
1082 |
// Current mastersubjects to deselect |
1083 |
printf("<tr><td valign = \"top\" >\n"); |
1084 |
printf("<form method = \"POST\" action = \"subject_transaction.phtml\" >\n"); |
1085 |
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id); |
1086 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubPage\" >\n"); |
1087 |
printf("<br><b>Selected Page(s):</b><br>\n"); |
1088 |
printf("<select name =\"key_list_array[]\" multiple size = \"3\">\n"); |
1089 |
|
1090 |
$sql = "SELECT p.page_title, p.page_id FROM |
1091 |
page p, |
1092 |
sub_page sp |
1093 |
WHERE |
1094 |
sp.subject_id = " . $subject_id . " AND |
1095 |
sp.page_id = p.page_id |
1096 |
ORDER BY p.page_title"; |
1097 |
$rs = xx_tryquery($sql); |
1098 |
|
1099 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
1100 |
$page_title = $row["page_title"]; |
1101 |
$page_id = $row["page_id"]; |
1102 |
|
1103 |
// Pull out any HTML |
1104 |
$page_title = strip_tags($page_title); |
1105 |
|
1106 |
printf("<option value = \"%s\">%s</option>\n", $page_id, $page_title); |
1107 |
} |
1108 |
|
1109 |
// Close things |
1110 |
printf("</select><br><br>\n"); |
1111 |
printf("<center>\n"); |
1112 |
printf("<input type = \"Submit\" value =\" Remove \">\n"); |
1113 |
printf("</center>\n"); |
1114 |
printf("</form>\n"); |
1115 |
printf("</td></tr>\n"); |
1116 |
|
1117 |
// Close off the table |
1118 |
printf("</td></tr></table>\n"); |
1119 |
} |
1120 |
|
1121 |
|
1122 |
/********************************************************** |
1123 |
Function: formAssignSubStaff |
1124 |
Author: Paul Bramscher |
1125 |
Last Modified: 03.10.2004 |
1126 |
*********************************************************** |
1127 |
Purpose: |
1128 |
Draws an HTML combo box with multiple selection capability |
1129 |
to assign staffpersons to the supplied subject id. |
1130 |
**********************************************************/ |
1131 |
function formAssignSubStaff($subject_id){ |
1132 |
|
1133 |
// Table definition |
1134 |
printf("<br><br>\n"); |
1135 |
printf("<table width=\"60%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n"); |
1136 |
|
1137 |
// Form of available staff to select |
1138 |
printf("<form method = \"POST\" action = \"assign.phtml\" >\n"); |
1139 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
1140 |
printf("Assign Staff"); |
1141 |
printf("</td></tr>\n"); |
1142 |
|
1143 |
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id); |
1144 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignSubStaff\" >\n"); |
1145 |
|
1146 |
// Omit the '(N/A)' staff |
1147 |
$omit_string = "WHERE staff_id > 1"; |
1148 |
|
1149 |
// Omit any pre-selected staff in sub_staff |
1150 |
$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; |
1152 |
|
1153 |
// Draw the combo box |
1154 |
printf("<tr><td valign = \"top\" >\n"); |
1155 |
printf("<br><b>Available Staff:<br></b>\n"); |
1156 |
printf("<select name = \"staff_id_array[]\" multiple size = \"5\" >\n"); |
1157 |
dropDownStaffOmit($omit_string); |
1158 |
printf("</select><br><br>\n"); |
1159 |
|
1160 |
// Close things |
1161 |
printf("<center>\n"); |
1162 |
printf("<input type = \"Submit\" value = \" >> \" >\n"); |
1163 |
printf("</form>\n"); |
1164 |
printf("</center>\n"); |
1165 |
printf("</td>\n"); |
1166 |
|
1167 |
// Current staff to deselect |
1168 |
printf("<td valign = \"top\" >\n"); |
1169 |
printf("<form method = \"POST\" action = \"delete.phtml\" >\n"); |
1170 |
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id); |
1171 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deleteSubStaff\" >\n"); |
1172 |
printf("<br><b>Selected Staff:</b><br>\n"); |
1173 |
printf("<select name =\"key_list_array[]\" multiple size = \"5\">\n"); |
1174 |
|
1175 |
$sql = "SELECT t.staff_id, t.last_name, t.first_name FROM |
1176 |
staff t, |
1177 |
sub_staff st, |
1178 |
subject s |
1179 |
WHERE |
1180 |
s.subject_id = " . $subject_id . " AND |
1181 |
st.subject_id = s.subject_id AND |
1182 |
st.staff_id = t.staff_id ORDER BY last_name, first_name"; |
1183 |
$rs = xx_tryquery($sql); |
1184 |
|
1185 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
1186 |
$first_name = $row["first_name"]; |
1187 |
$last_name = $row["last_name"]; |
1188 |
$staff_id = $row["staff_id"]; |
1189 |
printf("<option value = \"%d\">%s, %s</option>\n", $staff_id, $last_name, $first_name); |
1190 |
} |
1191 |
|
1192 |
// Close things |
1193 |
printf("</select><br><br>\n"); |
1194 |
printf("<center>\n"); |
1195 |
printf("<input type = \"Submit\" value =\" << \">\n"); |
1196 |
printf("</center>\n"); |
1197 |
printf("</form>\n"); |
1198 |
printf("</td></tr>\n"); |
1199 |
|
1200 |
// Close off table |
1201 |
printf("</td></tr></table>\n"); |
1202 |
} |
1203 |
|
1204 |
|
1205 |
/********************************************************** |
1206 |
Function: formCoursesub |
1207 |
Author: Paul Bramscher |
1208 |
Last Modified: 03.16.2004 |
1209 |
*********************************************************** |
1210 |
Purpose: |
1211 |
Draws an HTML form to edit the supplied course subject id, |
1212 |
or to create a new course subject if the incoming id is |
1213 |
less than 1. |
1214 |
**********************************************************/ |
1215 |
function formCoursesub($coursesub_id) { |
1216 |
|
1217 |
// Cast as integer to be sure |
1218 |
$coursesub_id = (int) $coursesub_id; |
1219 |
|
1220 |
// Get descriptive title |
1221 |
$coursesub = lookupField("coursesub", "coursesub_id", $coursesub_id, "coursesub"); |
1222 |
|
1223 |
// Check to see if coursesub actually exists |
1224 |
$exists = existsRow("coursesub", "coursesub_id", $coursesub_id); |
1225 |
|
1226 |
// Houston, we have a problem |
1227 |
if ($key_id > 0 && $exists == 0) { |
1228 |
$problem = 1; |
1229 |
printf("<h3>Course Subject (ID# %d) Not Found</h3>\n", $coursesub_id); |
1230 |
} |
1231 |
|
1232 |
// Check to see if there are affected courselib pages |
1233 |
$exists_courselib = existsRow("course", "coursesub_id", $coursesub_id); |
1234 |
if ($exists_courselib > 0) { |
1235 |
|
1236 |
$problem = 1; |
1237 |
|
1238 |
// Table definition |
1239 |
msgTableOpen(1, "Edit Course Subject (ID# " . $coursesub_id . ")"); |
1240 |
printf("<b>Messages:</b><br>\n"); |
1241 |
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 "); |
1243 |
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 "); |
1245 |
printf("value.<br><br>\n"); |
1246 |
printf("<a href=\"page_results_brief.phtml?coursesub_id=%s\">", $coursesub_id); |
1247 |
printf("page_results_brief.phtml?coursesub_id=%s</a>", $coursesub_id); |
1248 |
printf("<br><br>\n"); |
1249 |
msgTableClose(); |
1250 |
|
1251 |
} |
1252 |
|
1253 |
// If no problems, then go for landing |
1254 |
if ($problem != 1) { |
1255 |
|
1256 |
// Initialization |
1257 |
$coursesub = ""; |
1258 |
$coursesub_descr = ""; |
1259 |
$campus_id = ""; |
1260 |
$cip_code = ""; |
1261 |
|
1262 |
// If the user is editing an existing record, fetch previous values |
1263 |
if ($coursesub_id > 0 && $exists == 1) { |
1264 |
$sql = "SELECT * FROM coursesub WHERE coursesub_id = " . $coursesub_id; |
1265 |
$rs = xx_tryquery($sql); |
1266 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
1267 |
|
1268 |
// Fetch existing values |
1269 |
$coursesub_id = $row["coursesub_id"]; |
1270 |
$coursesub = $row["coursesub"]; |
1271 |
$coursesub_descr = $row["coursesub_descr"]; |
1272 |
$cip_code = $row["cip_code"]; |
1273 |
$campus_id = $row["campus_id"]; |
1274 |
|
1275 |
// Run strings through the HTML cleaner for output |
1276 |
$coursesub = textOutHTML($coursesub); |
1277 |
$coursesub_descr = textOutHTML($coursesub_descr); |
1278 |
$cip_code = textOutHTML($cip_code); |
1279 |
|
1280 |
}; |
1281 |
|
1282 |
// Table definition |
1283 |
printf("<center><table width=\"75%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n"); |
1284 |
|
1285 |
// If new insert |
1286 |
if ($coursesub_id <1) { |
1287 |
printf("<form method = \"POST\" action = \"insert.phtml\" >\n"); |
1288 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
1289 |
printf("Enter New Course Subject"); |
1290 |
printf("</td></tr>\n"); |
1291 |
} |
1292 |
|
1293 |
// Else update |
1294 |
else { |
1295 |
printf("<form method = \"POST\" action = \"update.phtml\" >\n"); |
1296 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
1297 |
printf("Edit Course Subject: %s (ID# %d)", $coursesub, $coursesub_id); |
1298 |
printf("</td></tr>\n"); |
1299 |
} |
1300 |
|
1301 |
// Coursesub abbrev. |
1302 |
printf("<tr>\n"); |
1303 |
printf("<td><b>Course Subject Abbrev:</b></td>\n"); |
1304 |
printf("<td><input type = \"text\" name = \"coursesub\" size = \"10\" value = \"%s\" ></td>\n", $coursesub); |
1305 |
printf("</tr>\n"); |
1306 |
|
1307 |
// Coursesub descr |
1308 |
printf("<tr>\n"); |
1309 |
printf("<td><b>Course Subject Description:</b></td>\n"); |
1310 |
printf("<td><input type = \"text\" name = \"coursesub_descr\" size = \"60\" value = \"%s\" ></td>\n", $coursesub_descr); |
1311 |
printf("</tr>\n"); |
1312 |
|
1313 |
// Campus |
1314 |
printf("<tr>\n"); |
1315 |
printf("<td><b>Campus:</b></td>\n"); |
1316 |
printf("<td><select name =\"campus_id\">"); |
1317 |
dropDownFieldSelected("campus", "campus", "campus_id", "WHERE campus_id >= 0", $campus_id); |
1318 |
printf("</select></td>\n"); |
1319 |
printf("</tr>\n"); |
1320 |
|
1321 |
// CIP code |
1322 |
printf("<tr>\n"); |
1323 |
printf("<td><b>CIP Code:</b></td>\n"); |
1324 |
printf("<td><input type = \"text\" name = \"cip_code\" size = \"25\" value = \"%s\" ></td>\n", $cip_code); |
1325 |
printf("</tr>\n"); |
1326 |
|
1327 |
// Buttons |
1328 |
printf("<tr><td colspan=\"2\" align=\"center\"><br>\n"); |
1329 |
|
1330 |
// If this is an existing course subject |
1331 |
if ($coursesub_id > 0) { |
1332 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateCoursesub\" >\n"); |
1333 |
printf("<input type = \"Submit\" value = \"Update Course Subject\" >\n"); |
1334 |
printf("<input type = \"Hidden\" name = \"coursesub_id\" value = \"%d\" >\n", $coursesub_id); |
1335 |
} |
1336 |
// Editing a new course subject |
1337 |
else { |
1338 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertCoursesub\" >\n"); |
1339 |
printf("<input type = \"Submit\" value = \"Save New Course Subject\">\n"); |
1340 |
} |
1341 |
|
1342 |
// Common button |
1343 |
printf("<input type = \"Reset\" value = \"Reset\" >\n"); |
1344 |
|
1345 |
// Close things |
1346 |
printf("</form>\n"); |
1347 |
printf("</td></tr></table></center>\n"); |
1348 |
|
1349 |
} // No problems |
1350 |
} |
1351 |
|
1352 |
|
1353 |
/********************************************************** |
1354 |
Function: formEditSingleField($display, $display_field, |
1355 |
$key_field, $key_id, $table); |
1356 |
Author: Paul Bramscher |
1357 |
Last Modified: 03.15.2004 |
1358 |
*********************************************************** |
1359 |
Incoming: |
1360 |
$display A display to the user, typically |
1361 |
similar to $display_field |
1362 |
$display_field Field name within $table to generate |
1363 |
displayed values from |
1364 |
$key_field Name of primary key field in $table |
1365 |
$key_id Value of $key_field |
1366 |
$table Table name to operate against |
1367 |
*********************************************************** |
1368 |
Outgoing: |
1369 |
None |
1370 |
*********************************************************** |
1371 |
Purpose: |
1372 |
This is a generic form function to create a new entry in a |
1373 |
table. The table's primary key must not involve a |
1374 |
composite key -- since this form won't handle that. |
1375 |
**********************************************************/ |
1376 |
function formEditSingleField($display, $display_field, $key_field, $key_id, |
1377 |
$size, $table) { |
1378 |
|
1379 |
// Make sure we have a positive integer to work with |
1380 |
if ($key_id > 1){ |
1381 |
|
1382 |
// Fetch previous value |
1383 |
$sql = "SELECT " |
1384 |
. $display_field |
1385 |
. " FROM " |
1386 |
. $table |
1387 |
. " WHERE " |
1388 |
. $key_field |
1389 |
. " = " |
1390 |
. $key_id; |
1391 |
|
1392 |
$rs = xx_tryquery($sql); |
1393 |
$row = xx_fetch_array($rs, xx_ASSOC); |
1394 |
$oldValue = Trim($row[$display_field]); |
1395 |
|
1396 |
// Table definition |
1397 |
printf("<center>\n"); |
1398 |
printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\">\n"); |
1399 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
1400 |
printf("Edit %s: %s (ID# %d)", $display, $oldValue, $key_id); |
1401 |
printf("</td></tr>\n"); |
1402 |
|
1403 |
// Form to handle any single field |
1404 |
printf("<form method = \"POST\" action = \"update.phtml\" >\n"); |
1405 |
printf("<tr><td>\n"); |
1406 |
printf("<b>%s:</b>\n", $display); |
1407 |
printf("</td>\n"); |
1408 |
printf("<td>\n"); |
1409 |
printf("<input type = \"text\" name = \"newValue\" size=\"%d\" value =\"%s\" >\n", $size, $oldValue); |
1410 |
printf("<input type = \"Hidden\" name = \"display\" value = \"%s\" >\n", $display); |
1411 |
printf("<input type = \"Hidden\" name = \"display_field\" value = \"%s\" >\n", $display_field); |
1412 |
printf("<input type = \"Hidden\" name = \"key_field\" value = \"%s\" >\n", $key_field); |
1413 |
printf("<input type = \"Hidden\" name = \"key_id\" value = \"%s\" >\n", $key_id); |
1414 |
printf("<input type = \"Hidden\" name = \"table\" value = \"%s\" >\n", $table); |
1415 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateSingleField\" >\n"); |
1416 |
printf("</td></tr>\n"); |
1417 |
printf("<tr><td colspan=\"2\" align=\"center\"><br>\n"); |
1418 |
printf("<input type = \"Submit\" value = \"Save Changes To %s\" >\n", $display); |
1419 |
printf("<input type = \"Reset\" value = \"Reset\" >\n"); |
1420 |
|
1421 |
// Close things |
1422 |
printf("</form><br>\n"); |
1423 |
printf("</td></tr>\n"); |
1424 |
printf("</table></center>\n"); |
1425 |
|
1426 |
} |
1427 |
|
1428 |
else printf("Nothing selected. Operation cancelled."); |
1429 |
} |
1430 |
|
1431 |
|
1432 |
/********************************************************** |
1433 |
Function: formFaculty |
1434 |
Author: Paul Bramscher |
1435 |
Last Modified: 03.16.2004 |
1436 |
*********************************************************** |
1437 |
Purpose: |
1438 |
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 |
1440 |
1. |
1441 |
**********************************************************/ |
1442 |
function formFaculty($faculty_id){ |
1443 |
|
1444 |
// Initialize variables |
1445 |
$faculty_id = (int) $faculty_id; |
1446 |
$faculty_lastname =""; |
1447 |
$faculty_firstname = ""; |
1448 |
$faculty_account = ""; |
1449 |
$faculty_email = ""; |
1450 |
|
1451 |
// If editing an existing faculty member load previous values |
1452 |
if ($faculty_id > 1){ |
1453 |
$sql = "SELECT |
1454 |
f.faculty_firstname, |
1455 |
f.faculty_lastname, |
1456 |
f.faculty_account, |
1457 |
f.faculty_email |
1458 |
FROM faculty f |
1459 |
WHERE |
1460 |
faculty_id = " . $faculty_id; |
1461 |
$rs = xx_tryquery($sql); |
1462 |
$row = xx_fetch_array($rs, xx_ASSOC); |
1463 |
|
1464 |
// Fetch results |
1465 |
$faculty_firstname = Trim($row["faculty_firstname"]); |
1466 |
$faculty_lastname = Trim($row["faculty_lastname"]); |
1467 |
$faculty_account = Trim($row["faculty_account"]); |
1468 |
$faculty_email = Trim($row["faculty_email"]); |
1469 |
|
1470 |
// Run strings through the HTML cleaner for output |
1471 |
$faculty_lastname = textOutHTML($faculty_lastname); |
1472 |
$faculty_firstname = textOutHTML($faculty_firstname); |
1473 |
} |
1474 |
|
1475 |
// Table definition |
1476 |
printf("<center><table width=\"75%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\">\n"); |
1477 |
|
1478 |
// If new faculty |
1479 |
if ($faculty_id < 1) { |
1480 |
printf("<form method = \"POST\" action = \"insert.phtml\" >\n"); |
1481 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
1482 |
printf("Enter New Faculty"); |
1483 |
printf("</td></tr>\n"); |
1484 |
} |
1485 |
|
1486 |
// Else update |
1487 |
else { |
1488 |
printf("<form method = \"POST\" action = \"update.phtml\" >\n"); |
1489 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
1490 |
printf("Edit Faculty: %s %s (ID# %d)", $faculty_firstname, $faculty_lastname, $faculty_id); |
1491 |
printf("</td></tr>\n"); |
1492 |
} |
1493 |
|
1494 |
// Last name |
1495 |
printf("<tr>\n"); |
1496 |
printf("<td width=\"40%%\"><b>Last Name:</b></td>\n"); |
1497 |
printf("<td><input type = \"text\" name = \"faculty_lastname\" size = \"40\" value = \"%s\" ></td>\n", $faculty_lastname); |
1498 |
printf("</tr>\n"); |
1499 |
|
1500 |
// First name |
1501 |
printf("<tr>\n"); |
1502 |
printf("<td><b>First Name:</b></td>\n"); |
1503 |
printf("<td><input type = \"text\" name = \"faculty_firstname\" size = \"40\" value = \"%s\"></td>\n", $faculty_firstname); |
1504 |
printf("</tr>\n"); |
1505 |
|
1506 |
// Faculty account (x500 if applicable) |
1507 |
printf("<tr>\n"); |
1508 |
printf("<td><b>Faculty account (x500 if applicable):</b></td>\n"); |
1509 |
printf("<td><input type = \"text\" name = \"faculty_account\" size = \"15\" value =\"%s\"></td>\n", $faculty_account); |
1510 |
printf("</tr>\n"); |
1511 |
|
1512 |
// Email |
1513 |
printf("<tr>\n"); |
1514 |
printf("<td><b>Email:</b></td>\n"); |
1515 |
printf("<td><input type = \"text\" name = \"faculty_email\" size = \"40\" value =\"%s\"></td>\n", $faculty_email); |
1516 |
printf("</tr>\n"); |
1517 |
|
1518 |
// Buttons |
1519 |
printf("<tr><td colspan=\"2\" align=\"center\"><br>\n"); |
1520 |
// If new faculty |
1521 |
if ($faculty_id < 1) { |
1522 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertFaculty\" >\n"); |
1523 |
printf("<input type = \"Submit\" value = \"Save New Faculty\" >\n"); |
1524 |
} |
1525 |
// Editing an existing faculty person |
1526 |
else { |
1527 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateFaculty\" >\n"); |
1528 |
printf("<input type = \"Hidden\" name = \"faculty_id\" value = \"%d\" >\n", $faculty_id); |
1529 |
printf("<input type = \"Submit\" value = \"Save Faculty Changes\" >\n"); |
1530 |
} |
1531 |
printf("<input type = \"Reset\" value = \"Reset\" >\n"); |
1532 |
|
1533 |
// Close things |
1534 |
printf("</form>\n"); |
1535 |
printf("</td></tr></table>\n"); |
1536 |
printf("</center><br>\n"); |
1537 |
} |
1538 |
|
1539 |
|
1540 |
/********************************************************** |
1541 |
Function: formFeature |
1542 |
Author: Paul Bramscher |
1543 |
Last Modified: 03.15.2004 |
1544 |
*********************************************************** |
1545 |
Purpose: |
1546 |
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. |
1548 |
**********************************************************/ |
1549 |
function formFeature($key_id) { |
1550 |
|
1551 |
// Cast as integer to be sure |
1552 |
$key_id = (int) $key_id; |
1553 |
|
1554 |
// Check to see if feature actually exists |
1555 |
$exists = existsRow("feature", "feature_id", $key_id); |
1556 |
|
1557 |
// Header |
1558 |
printf("<center>"); |
1559 |
if ($key_id > 0 && $exists == 1) { |
1560 |
|
1561 |
// Initialization |
1562 |
$feature = ""; |
1563 |
$feature_id = ""; |
1564 |
|
1565 |
// Fetch existing values |
1566 |
$sql = "SELECT * FROM feature WHERE feature_id = " . $key_id; |
1567 |
$rs = xx_tryquery($sql); |
1568 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
1569 |
$feature_id = $row["feature_id"]; |
1570 |
$feature = $row["feature"]; |
1571 |
$image_path = $row["image_path"]; |
1572 |
$image_alt = $row["image_alt"]; |
1573 |
|
1574 |
// Run strings through the HTML cleaner for output |
1575 |
$feature = textOutHTML($feature); |
1576 |
$image_path = textOutHTML($image_path); |
1577 |
$image_alt = textOutHTML($image_alt); |
1578 |
} |
1579 |
|
1580 |
// Houston, we have a problem |
1581 |
if ($key_id > 0 && $exists == 0) { |
1582 |
$problem = 1; |
1583 |
printf("<h3>Feature (ID# %d) Not Found</h3>\n", $key_id); |
1584 |
} |
1585 |
|
1586 |
// If no problems, then go for landing |
1587 |
if ($problem != 1) { |
1588 |
|
1589 |
// Table definition |
1590 |
printf("<center><table width=\"75%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\">\n"); |
1591 |
|
1592 |
// Form to handle feature |
1593 |
// If new insert |
1594 |
if ($key_id <1) { |
1595 |
printf("<form method = \"POST\" action = \"insert.phtml\" >\n"); |
1596 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
1597 |
printf("Enter New Feature"); |
1598 |
printf("</td></tr>\n"); |
1599 |
} |
1600 |
|
1601 |
// Else update |
1602 |
else { |
1603 |
printf("<form method = \"POST\" action = \"update.phtml\" >\n"); |
1604 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
1605 |
printf("Edit Feature: %s (ID# %d)", $feature, $feature_id); |
1606 |
printf("</td></tr>\n"); |
1607 |
} |
1608 |
|
1609 |
// Feature name |
1610 |
printf("<tr>\n"); |
1611 |
printf("<td><b>Feature:</b></td>\n"); |
1612 |
printf("<td><input type = \"text\" name = \"feature\" size = \"40\" value = \"%s\" ></td>\n", $feature); |
1613 |
printf("</tr>\n"); |
1614 |
|
1615 |
// Image path |
1616 |
printf("<tr>\n"); |
1617 |
printf("<td><b>Image Path:</b></td>\n"); |
1618 |
printf("<td><input type = \"text\" name = \"image_path\" size = \"50\" value = \"%s\" ></td>\n", $image_path); |
1619 |
printf("</tr>\n"); |
1620 |
|
1621 |
// Image alt text |
1622 |
printf("<tr>\n"); |
1623 |
printf("<td><b>Image Alt Text:</b></td>\n"); |
1624 |
printf("<td><input type = \"text\" name = \"image_alt\" size = \"50\" value = \"%s\" ></td>\n", $image_alt); |
1625 |
|
1626 |
// Buttons |
1627 |
printf("<tr><td colspan=\"2\" align=\"center\"><br>\n"); |
1628 |
// If this is an existing feature |
1629 |
if ($key_id > 0) { |
1630 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateFeature\" >\n"); |
1631 |
printf("<input type = \"Submit\" value = \"Update Feature\" >\n"); |
1632 |
printf("<input type = \"Hidden\" name = \"feature_id\" value = \"%d\" >\n", $feature_id); |
1633 |
} |
1634 |
// Editing a new feature |
1635 |
else { |
1636 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertFeature\" >\n"); |
1637 |
printf("<input type = \"Submit\" value = \"Save New Feature\">\n"); |
1638 |
} |
1639 |
|
1640 |
// Common button |
1641 |
printf("<input type = \"Reset\" value = \"Reset\" >\n"); |
1642 |
|
1643 |
// Close things |
1644 |
printf("</form>\n"); |
1645 |
printf("</td></tr></table></center>\n"); |
1646 |
|
1647 |
} // No problems |
1648 |
} |
1649 |
|
1650 |
|
1651 |
/********************************************************** |
1652 |
Function: formInfotype |
1653 |
Author: Paul Bramscher |
1654 |
Last Modified: 03.15.2004 |
1655 |
*********************************************************** |
1656 |
Purpose: |
1657 |
Draws an HTML form to edit the supplied information type id, |
1658 |
or to create a new information type if the incoming id is |
1659 |
less than 1. |
1660 |
**********************************************************/ |
1661 |
function formInfotype($key_id) { |
1662 |
|
1663 |
// Cast as integer to be sure |
1664 |
$key_id = (int) $key_id; |
1665 |
|
1666 |
// Check to see if infotype actually exists |
1667 |
$exists = existsRow("infotype", "infotype_id", $key_id); |
1668 |
|
1669 |
// Header |
1670 |
printf("<center>\n"); |
1671 |
if ($key_id > 0 && $exists == 1) { |
1672 |
|
1673 |
// Initialization |
1674 |
$infotype = ""; |
1675 |
$infotype_id = ""; |
1676 |
$masterinfotype_id = ""; |
1677 |
$mastersubject_id = ""; |
1678 |
|
1679 |
// Fetch existing values |
1680 |
$sql = "SELECT * from infotype where infotype_id = " . $key_id; |
1681 |
$rs = xx_tryquery($sql); |
1682 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
1683 |
$infotype_id = $row["infotype_id"]; |
1684 |
$infotype = $row["infotype"]; |
1685 |
$masterinfotype_id = $row["masterinfotype_id"]; |
1686 |
$mastersubject_id = $row["mastersubject_id"]; |
1687 |
|
1688 |
// Run strings through the HTML cleaner for output |
1689 |
$infotype = textOutHTML($infotype); |
1690 |
|
1691 |
} |
1692 |
|
1693 |
// Houston, we have a problem |
1694 |
if ($key_id > 0 && $exists == 0) { |
1695 |
$problem = 1; |
1696 |
printf("<h3>Information Type (ID# %d) Not Found</h3>\n", $key_id); |
1697 |
} |
1698 |
|
1699 |
// If no problems, then go for landing |
1700 |
if ($problem != 1) { |
1701 |
|
1702 |
// Table |
1703 |
printf("<center><table width=\"75%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n"); |
1704 |
|
1705 |
// If new insert |
1706 |
if ($key_id < 1) { |
1707 |
printf("<form method = \"POST\" action = \"insert.phtml\" >\n"); |
1708 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
1709 |
printf("Enter New Information Type"); |
1710 |
printf("</td></tr>\n"); |
1711 |
|
1712 |
} |
1713 |
|
1714 |
// Else update |
1715 |
else { |
1716 |
printf("<form method = \"POST\" action = \"update.phtml\" >\n"); |
1717 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
1718 |
printf("Edit Information Type: %s (ID# %d)", $infotype, $infotype_id); |
1719 |
printf("</td></tr>\n"); |
1720 |
} |
1721 |
|
1722 |
// Infotype |
1723 |
printf("<tr>\n"); |
1724 |
printf("<td><b>Information Type:</b></td>\n"); |
1725 |
printf("<td><input type = \"text\" name = \"infotype\" size = \"60\" value = \"%s\" ></td>\n", $infotype); |
1726 |
printf("</tr>\n"); |
1727 |
|
1728 |
// Masterinfotype |
1729 |
printf("<tr>\n"); |
1730 |
printf("<td><b>Master Information Type:</b></td>\n"); |
1731 |
printf("<td>\n"); |
1732 |
printf("<select name =\"masterinfotype_id\">\n"); |
1733 |
dropDownFieldSelected("masterinfotype", "masterinfotype", "masterinfotype_id", "WHERE masterinfotype_id >= 0", $masterinfotype_id); |
1734 |
printf("</select>\n"); |
1735 |
printf("</td></tr>\n"); |
1736 |
|
1737 |
// Mastersubject |
1738 |
printf("<tr>\n"); |
1739 |
printf("<td><b>Master Subject:</b></td>\n"); |
1740 |
printf("<td>\n"); |
1741 |
printf("<select name =\"mastersubject_id\">\n"); |
1742 |
dropDownFieldSelected("mastersubject", "mastersubject", "mastersubject_id", "WHERE mastersubject_id >= 0", $mastersubject_id); |
1743 |
printf("</select>\n"); |
1744 |
printf("</td></tr>\n"); |
1745 |
|
1746 |
// Buttons |
1747 |
printf("<tr><td colspan=\"2\" align=\"center\"><br>\n"); |
1748 |
|
1749 |
// If this is an existing infotype |
1750 |
if ($key_id > 0) { |
1751 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateInfotype\" >\n"); |
1752 |
printf("<input type = \"Submit\" value = \"Update Info Type\" >\n"); |
1753 |
printf("<input type = \"Hidden\" name = \"infotype_id\" value = \"%d\" >\n", $infotype_id); |
1754 |
} |
1755 |
// Editing a new infotype |
1756 |
else { |
1757 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertInfotype\" >\n"); |
1758 |
printf("<input type = \"Submit\" value = \"Save New Info Type\">\n"); |
1759 |
} |
1760 |
|
1761 |
// Common button |
1762 |
printf("<input type = \"Reset\" value = \"Reset\" >\n"); |
1763 |
|
1764 |
// Close things |
1765 |
printf("</form>\n"); |
1766 |
printf("</td></tr></table></center>\n"); |
1767 |
|
1768 |
|
1769 |
} // No problems |
1770 |
} |
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 |
1882 |
Author: Paul Bramscher |
1883 |
Last Modified: 03.15.2004 |
1884 |
*********************************************************** |
1885 |
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. |
1887 |
**********************************************************/ |
1888 |
function formLocation($key_id) { |
1889 |
|
1890 |
// Cast as integer to be sure |
1891 |
$key_id = (int) $key_id; |
1892 |
|
1893 |
// Check to see if location actually exists |
1894 |
$exists = existsRow("location", "location_id", $key_id); |
1895 |
|
1896 |
// Header |
1897 |
printf("<center>"); |
1898 |
if ($key_id > 0 && $exists == 1) { |
1899 |
|
1900 |
// Initialization |
1901 |
$location = ""; |
1902 |
$location_descr = ""; |
1903 |
$campus = ""; |
1904 |
$address1 = ""; |
1905 |
$address2 = ""; |
1906 |
$address3 = ""; |
1907 |
$address4 = ""; |
1908 |
$mainURL = ""; |
1909 |
$referenceURL = ""; |
1910 |
$mapURL = ""; |
1911 |
$hoursURL = ""; |
1912 |
$telephone = ""; |
1913 |
|
1914 |
// Fetch existing values |
1915 |
$sql = "SELECT * from location where location_id = " . $key_id; |
1916 |
$rs = xx_tryquery($sql); |
1917 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
1918 |
$location_id = $row["location_id"]; |
1919 |
$location = $row["location"]; |
1920 |
$location_descr = $row["location_descr"]; |
1921 |
$campus = $row["campus"]; |
1922 |
$address1 = $row["address1"]; |
1923 |
$address2 = $row["address2"]; |
1924 |
$address3 = $row["address3"]; |
1925 |
$address4 = $row["address4"]; |
1926 |
$mainURL = $row["mainURL"]; |
1927 |
$referenceURL = $row["referenceURL"]; |
1928 |
$mapURL = $row["mapURL"]; |
1929 |
$hoursURL = $row["hoursURL"]; |
1930 |
$telephone = $row["telephone"]; |
1931 |
|
1932 |
// Run strings through the HTML cleaner for output |
1933 |
$location = textOutHTML($location); |
1934 |
$location_descr = textOutHTML($location_descr); |
1935 |
$campus = textOutHTML($campus); |
1936 |
$address1 = textOutHTML($address1); |
1937 |
$address2 = textOutHTML($address2); |
1938 |
$address3 = textOutHTML($address3); |
1939 |
$address4 = textOutHTML($address4); |
1940 |
|
1941 |
} |
1942 |
|
1943 |
// Houston, we have a problem |
1944 |
if ($key_id > 0 && $exists == 0) { |
1945 |
$problem = 1; |
1946 |
printf("<h3>Location (ID# %d) Not Found</h3>\n", $key_id); |
1947 |
} |
1948 |
|
1949 |
// If no problems, then go for landing |
1950 |
if ($problem != 1) { |
1951 |
|
1952 |
// Table definition |
1953 |
printf("<center><table width=\"75%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n"); |
1954 |
|
1955 |
// If new insert |
1956 |
if ($key_id <1) { |
1957 |
printf("<form method = \"POST\" action = \"insert.phtml\" >\n"); |
1958 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
1959 |
printf("Enter New Location"); |
1960 |
printf("</td></tr>\n"); |
1961 |
} |
1962 |
|
1963 |
// Else update |
1964 |
else { |
1965 |
printf("<form method = \"POST\" action = \"update.phtml\" >\n"); |
1966 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
1967 |
printf("Edit Location: %s (ID# %d)", $location, $location_id); |
1968 |
printf("</td></tr>\n"); |
1969 |
} |
1970 |
|
1971 |
// Location/Library |
1972 |
printf("<tr>\n"); |
1973 |
printf("<td><b>Location/Library:</b></td>\n"); |
1974 |
printf("<td>\n"); |
1975 |
printf("<input type = \"text\" name = \"location\" size = \"60\" value = \"%s\" >\n", $location); |
1976 |
printf("</td></tr>\n"); |
1977 |
|
1978 |
// Description |
1979 |
printf("<tr><td colspan=\"2\"><br>\n"); |
1980 |
printf("<b>Description:</b><br>\n"); |
1981 |
printf("<textarea name = \"location_descr\" rows = \"5\" cols = \"70\" >\n"); |
1982 |
printf("%s", $location_descr); |
1983 |
printf("</textarea><br><br><br>\n"); |
1984 |
printf("</td></tr>\n"); |
1985 |
|
1986 |
// Campus |
1987 |
printf("<tr>\n"); |
1988 |
printf("<td><b>Campus:</b></td>\n"); |
1989 |
printf("<td>\n"); |
1990 |
printf("<input type = \"text\" name = \"campus\" size = \"50\" value = \"%s\" >\n", $campus); |
1991 |
printf("</td></tr>\n"); |
1992 |
|
1993 |
// Address1 |
1994 |
printf("<tr>\n"); |
1995 |
printf("<td><b>Address Line 1:</b></td>\n"); |
1996 |
printf("<td>\n"); |
1997 |
printf("<input type = \"text\" name = \"address1\" size = \"50\" value = \"%s\" >\n", $address1); |
1998 |
printf("</td></tr>\n"); |
1999 |
|
2000 |
// Address2 |
2001 |
printf("<tr>\n"); |
2002 |
printf("<td><b>Address Line 2:</b></td>\n"); |
2003 |
printf("<td>\n"); |
2004 |
printf("<input type = \"text\" name = \"address2\" size = \"50\" value = \"%s\" >\n", $address2); |
2005 |
printf("</td></tr>\n"); |
2006 |
|
2007 |
// Address3 |
2008 |
printf("<tr>\n"); |
2009 |
printf("<td><b>Address Line 3:</b></td>\n"); |
2010 |
printf("<td>\n"); |
2011 |
printf("<input type = \"text\" name = \"address3\" size = \"50\" value = \"%s\" >\n", $address3); |
2012 |
printf("</td></tr>\n"); |
2013 |
|
2014 |
// Address4 |
2015 |
printf("<tr>\n"); |
2016 |
printf("<td><b>Address Line 4:</b></td>\n"); |
2017 |
printf("<td>\n"); |
2018 |
printf("<input type = \"text\" name = \"address4\" size = \"50\" value = \"%s\" >\n", $address4); |
2019 |
printf("</td></tr>\n"); |
2020 |
|
2021 |
// Telephone |
2022 |
printf("<tr>\n"); |
2023 |
printf("<td><b>Telephone:</b></td>\n"); |
2024 |
printf("<td>\n"); |
2025 |
printf("<input type = \"text\" name = \"telephone\" size = \"25\" value = \"%s\" >\n", $telephone); |
2026 |
printf("</td></tr>\n"); |
2027 |
|
2028 |
// mainURL |
2029 |
printf("<tr>\n"); |
2030 |
printf("<td><b>Main URL:</b></td>\n"); |
2031 |
printf("<td>\n"); |
2032 |
printf("<input type = \"text\" name = \"mainURL\" size = \"70\" value = \"%s\" >\n", $mainURL); |
2033 |
printf("</td></tr>\n"); |
2034 |
|
2035 |
// referenceURL |
2036 |
printf("<tr>\n"); |
2037 |
printf("<td><b>Reference URL:</b></td>\n"); |
2038 |
printf("<td>\n"); |
2039 |
printf("<input type = \"text\" name = \"referenceURL\" size = \"70\" value = \"%s\" >\n", |
2040 |
$referenceURL); |
2041 |
printf("</td></tr>\n"); |
2042 |
|
2043 |
// hoursURL |
2044 |
printf("<tr>\n"); |
2045 |
printf("<td><b>Hours URL:</b></td>\n"); |
2046 |
printf("<td>\n"); |
2047 |
printf("<input type = \"text\" name = \"hoursURL\" size = \"70\" value = \"%s\" >\n", |
2048 |
$hoursURL); |
2049 |
printf("</td></tr>\n"); |
2050 |
|
2051 |
// mapURL |
2052 |
printf("<tr>\n"); |
2053 |
printf("<td><b>Map URL:</b></td>\n"); |
2054 |
printf("<td>\n"); |
2055 |
printf("<input type = \"text\" name = \"mapURL\" size = \"70\" value = \"%s\" >\n", $mapURL); |
2056 |
printf("</td></tr>\n"); |
2057 |
|
2058 |
// Buttons |
2059 |
printf("<tr><td colspan=\"2\" align=\"center\"><br>\n"); |
2060 |
|
2061 |
// If this is an existing location |
2062 |
if ($key_id > 0) { |
2063 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateLocation\" >\n"); |
2064 |
printf("<input type = \"Submit\" value = \"Update Location\" >\n"); |
2065 |
printf("<input type = \"Hidden\" name = \"location_id\" value = \"%d\" >\n", $location_id); |
2066 |
} |
2067 |
// Editing a new location |
2068 |
else { |
2069 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertLocation\" >\n"); |
2070 |
printf("<input type = \"Submit\" value = \"Save New Location\" >\n"); |
2071 |
} |
2072 |
|
2073 |
// Common button |
2074 |
printf("<input type = \"Reset\" value = \"Reset\" >\n"); |
2075 |
|
2076 |
// Close things |
2077 |
printf("</form>\n"); |
2078 |
printf("</td></tr></table></center>\n"); |
2079 |
|
2080 |
} // No problems |
2081 |
} |
2082 |
|
2083 |
|
2084 |
/********************************************************** |
2085 |
Function: formNewSingleField($display, $field, |
2086 |
$size, $table); |
2087 |
Author: Paul Bramscher |
2088 |
Last Modified: 03.11.2004 |
2089 |
*********************************************************** |
2090 |
Incoming: |
2091 |
$field Field name within $table |
2092 |
$display A display to the user, typically |
2093 |
identical to $field |
2094 |
$size The size of the HTML input box |
2095 |
$table Table name to operate against |
2096 |
*********************************************************** |
2097 |
Outgoing: |
2098 |
None |
2099 |
*********************************************************** |
2100 |
Purpose: |
2101 |
This is a generic form function to create a new entry in a |
2102 |
table. The table's primary key must not involve a |
2103 |
composite key since this form won't handle that. |
2104 |
**********************************************************/ |
2105 |
function formNewSingleField($display, $field, $size, $table) { |
2106 |
|
2107 |
// Draw Box |
2108 |
printf("<center>\n"); |
2109 |
printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\">\n"); |
2110 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
2111 |
printf("Enter New %s", $display); |
2112 |
printf("</td></tr>\n"); |
2113 |
|
2114 |
// Form for the new field value |
2115 |
printf("<form method = \"POST\" action = \"insert.phtml\" >\n"); |
2116 |
printf("<tr>\n"); |
2117 |
printf("<td><b>%s:</b></td>\n", $display); |
2118 |
printf("<td>\n"); |
2119 |
printf("<input type = \"text\" name = \"newValue\" size = \"%d\" >\n", $size); |
2120 |
printf("<input type = \"Hidden\" name = \"table\" value = \"%s\" >\n", $table); |
2121 |
printf("<input type = \"Hidden\" name = \"field\" value = \"%s\" >\n", $field); |
2122 |
printf("<input type = \"Hidden\" name = \"display\" value = \"%s\" >\n", $display); |
2123 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertSingleField\" >\n"); |
2124 |
printf("</td></tr>\n"); |
2125 |
printf("<tr><td colspan=\"2\" align=\"center\"><br>\n"); |
2126 |
printf("<input type = \"Submit\" value = \"Save New %s\" >\n", $display); |
2127 |
printf("<input type = \"Reset\" value = \"Reset\" >\n"); |
2128 |
|
2129 |
// Close things |
2130 |
printf("</form><br>\n"); |
2131 |
printf("</td></tr>\n"); |
2132 |
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 |
2247 |
Author: Paul Bramscher |
2248 |
Last Modified: 03.16.2004 by Paul Bramscher |
2249 |
*********************************************************** |
2250 |
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. |
2252 |
Note also that there are incoming masterinfotype id, |
2253 |
mastersubject id, an title parameters. |
2254 |
**********************************************************/ |
2255 |
function formResource($key_id, $masterinfotype_id, $mastersubject_id, $title) { |
2256 |
|
2257 |
// Cast as integer to be sure |
2258 |
$key_id = (int) $key_id; |
2259 |
|
2260 |
// Check to see if record actually exists |
2261 |
$exists = existsRow("resource", "resource_id", $key_id); |
2262 |
|
2263 |
// Houston, we have a problem |
2264 |
if ($key_id > 0 && $exists == 0) { |
2265 |
$problem = 1; |
2266 |
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 |
|
2274 |
// If no problems, then go for landing |
2275 |
if ($problem != 1) { |
2276 |
// Initialization |
2277 |
if (strlen($title) > 0) { |
2278 |
// Decode the title and strip slashes -- twice to be sure |
2279 |
$title = urldecode($title); |
2280 |
$title = stripslashes($title); |
2281 |
$title = stripslashes($title); |
2282 |
} |
2283 |
$other_title = ""; |
2284 |
$coverage_detail = ""; |
2285 |
$sources_indexed = ""; |
2286 |
$location_id = ""; |
2287 |
$author = ""; |
2288 |
$format_id = 0; |
2289 |
$pub_loc = ""; |
2290 |
$publisher = ""; |
2291 |
$pub_date = ""; |
2292 |
$edition = ""; |
2293 |
$call_no = ""; |
2294 |
$cat_num = ""; |
2295 |
$site_title = ""; |
2296 |
$url = ""; |
2297 |
$visited = ""; |
2298 |
$annotation =""; |
2299 |
$vendor_id = 0; |
2300 |
|
2301 |
// If the user is editing an existing record, fetch previous values |
2302 |
if ($key_id > 0 && $exists == 1) { |
2303 |
|
2304 |
$sql = "SELECT * from resource where resource_id = " . $key_id; |
2305 |
$rs = xx_tryquery($sql); |
2306 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
2307 |
|
2308 |
// Fetch existing values |
2309 |
$resource_id = $row["resource_id"]; |
2310 |
$date_created = $row["date_created"]; |
2311 |
$date_modified = $row["date_modified"]; |
2312 |
$account_created = $row["account_created"]; |
2313 |
$account_modified = $row["account_modified"]; |
2314 |
$title = $row["title"]; |
2315 |
$author = $row["author"]; |
2316 |
$format_id = $row["format_id"]; |
2317 |
$pub_loc = $row["pub_loc"]; |
2318 |
$publisher = $row["publisher"]; |
2319 |
$pub_date = $row["pub_date"]; |
2320 |
$edition = $row["edition"]; |
2321 |
$call_no = $row["call_no"]; |
2322 |
$cat_num = $row["cat_num"]; |
2323 |
$site_title = $row["site_title"]; |
2324 |
$url = $row["url"]; |
2325 |
$guide_url = $row["guide_url"]; |
2326 |
$visited = $row["visited"]; |
2327 |
$annotation = $row["annotation"]; |
2328 |
$infotype_id = $row["infotype_id"]; |
2329 |
$other_title = $row["other_title"]; |
2330 |
$coverage_detail = $row["coverage_detail"]; |
2331 |
$sources_indexed = $row["sources_indexed"]; |
2332 |
$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 |
2338 |
$title = textOutHTML($title); |
2339 |
$author = textOutHTML($author); |
2340 |
$publisher = textOutHTML($publisher); |
2341 |
$pub_date = textOutHTML($pub_date); |
2342 |
$edition = textOutHTML($edition); |
2343 |
$call_no = textOutHTML($call_no); |
2344 |
$cat_num = textOutHTML($cat_num); |
2345 |
$site_title = textOutHTML($site_title); |
2346 |
$other_title = textOutHTML($other_title); |
2347 |
$coverage_detail = textOutHTML($coverage_detail); |
2348 |
$sources_indexed = textOutHTML($sources_indexed); |
2349 |
}; |
2350 |
|
2351 |
// Display feedback to the user if resource was entered today |
2352 |
|
2353 |
// Fetch today's date |
2354 |
$today = getdate(); |
2355 |
$mon = $today[mon]; |
2356 |
$mday = $today[mday]; |
2357 |
$year = $today[year]; |
2358 |
|
2359 |
// Back-fill in case we have single-digits. |
2360 |
if (strlen($mday) < 2) $mday = "0" . $mday; |
2361 |
if (strlen($mon) < 2) $mon = "0" . $mon; |
2362 |
|
2363 |
// Generate a mySQL-friendly datetime for today's stamp |
2364 |
$today_stamp = $year . "-" . $mon . "-" . $mday; |
2365 |
|
2366 |
if (substr($date_created, 0, 10) == $today_stamp) { |
2367 |
printf("<center>\n"); |
2368 |
printf("Resource <b>'%s'</b> successfully added today by <b>%s</b>.<br>\n", $title, $account_created); |
2369 |
printf("Scroll <a href=\"#additional\">down</a> to edit further attributes for this resource.<br><br>\n"); |
2370 |
printf("</center><br>\n"); |
2371 |
} |
2372 |
|
2373 |
|
2374 |
// Exterior table for border |
2375 |
printf("<center><table width=\"75%%\" border=\"1\" class=\"backLight\" cellspacing=\"2\" cellpadding=\"0\" ><tr><td>\n"); |
2376 |
|
2377 |
// Table definition |
2378 |
printf("<table width=\"100%%\" border=\"0\" cellspacing =\"2\" cellpadding=\"2\">\n"); |
2379 |
|
2380 |
// Form header |
2381 |
printf("<tr><td colspan=\"4\" class=\"cellPlain\" >\n"); |
2382 |
if ($key_id > 0 && $exists == 1) printf("Edit Resource (ID# %d)", $key_id); |
2383 |
if ($key_id <= 0) printf("Enter New Resource\n"); |
2384 |
printf("</td></tr>\n"); |
2385 |
|
2386 |
// If new insert |
2387 |
if ($key_id <1) printf("<form method = \"POST\" action = \"insert.phtml\" >\n"); |
2388 |
|
2389 |
// Else update |
2390 |
else printf("<form method = \"POST\" action = \"update.phtml\" >\n"); |
2391 |
|
2392 |
// Account & Time/date information if this is not a new resource |
2393 |
if ($key_id > 0) { |
2394 |
printf("<tr>\n<td colspan = \"1\">\n"); |
2395 |
printf("<br><B>Date Created:</b>\n"); |
2396 |
printf("</td><td colspan =\"3\">\n"); |
2397 |
printf("<BR>%s</td></tr>", $date_created); |
2398 |
printf("<tr>\n<td colspan = \"1\">\n"); |
2399 |
printf("<B>Date Modified:</b>\n"); |
2400 |
printf("</td><td colspan =\"3\">\n"); |
2401 |
printf("%s</td></tr>\n", $date_modified); |
2402 |
|
2403 |
printf("<tr>\n<td colspan = \"1\">\n"); |
2404 |
printf("<br><B>Creator:</b>\n"); |
2405 |
printf("</td><td colspan =\"3\">\n"); |
2406 |
printf("<BR>%s</td></tr>\n", $account_created); |
2407 |
printf("<tr>\n<td colspan = \"1\">\n"); |
2408 |
printf("<B>Last Modified by:</b>\n"); |
2409 |
printf("</td><td colspan =\"3\">\n"); |
2410 |
printf("%s</td></tr>\n", $account_modified); |
2411 |
} |
2412 |
|
2413 |
// Title |
2414 |
printf("<tr><td colspan =\"1\" >\n"); |
2415 |
printf("<br><b>Title:</b>\n"); |
2416 |
printf("</td><td colspan =\"3\">\n"); |
2417 |
printf("<br><input type = \"text\" name = \"title\" size = \"60\" value =\"%s\" >\n", $title); |
2418 |
printf("</td></tr>\n"); |
2419 |
|
2420 |
// Other Title |
2421 |
printf("<tr><td colspan =\"1\" >\n"); |
2422 |
printf("<b>Other Title:</b>\n"); |
2423 |
printf("</td><td colspan =\"3\">\n"); |
2424 |
printf("<input type = \"text\" name = \"other_title\" size = \"60\" value =\"%s\" >\n", $other_title); |
2425 |
printf("</td></tr>\n"); |
2426 |
|
2427 |
// Author(s) |
2428 |
printf("<tr><td colspan =\"1\" >\n"); |
2429 |
printf("<br><b>Author(s):</b>\n"); |
2430 |
printf("</td><td colspan =\"3\">\n"); |
2431 |
printf("<br><input type = \"text\" name = \"author\" size = \"60\" value =\"%s\" >\n", $author); |
2432 |
printf("<br><i>(if applicable)</i></td></tr>\n"); |
2433 |
|
2434 |
// Coverage detail |
2435 |
printf("<tr><td colspan = \"1\" valign=\"top\">\n"); |
2436 |
printf("<b>Coverage Detail:</b>\n"); |
2437 |
printf("</td><td colspan =\"3\">\n"); |
2438 |
printf("<textarea name = \"coverage_detail\" cols = \"40\" rows = \"2\">\n"); |
2439 |
printf("%s", $coverage_detail); |
2440 |
printf("</textarea>\n"); |
2441 |
printf("<br><i>(enter year, i.e. 1966 - 1985, or 1984 - present)</i>\n"); |
2442 |
printf("<br><br></td></tr>\n"); |
2443 |
|
2444 |
// Sources Indexed |
2445 |
printf("<tr><td colspan =\"1\" valign=\"top\">\n"); |
2446 |
printf("<b>Sources Indexed:</b>\n"); |
2447 |
printf("</td><td colspan =\"3\">\n"); |
2448 |
printf("<input type = \"text\" name = \"sources_indexed\" size = \"60\" value =\"%s\" >\n", $sources_indexed); |
2449 |
printf("<br><i>(enter link to vendor page)</i>\n"); |
2450 |
printf("</td></tr>\n"); |
2451 |
|
2452 |
// URL |
2453 |
printf("<tr><td colspan = \"1\" valign=\"top\">\n"); |
2454 |
printf("<b>URL</a>:</b>\n"); |
2455 |
printf("</td><td colspan =\"3\">\n"); |
2456 |
printf("<textarea name = \"url\" rows = \"4\" cols = \"51\" >\n"); |
2457 |
printf("%s", $url); |
2458 |
printf("</textarea><br>\n"); |
2459 |
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 |
2471 |
printf("<tr><td colspan = \"1\" >\n"); |
2472 |
printf("<b>Publisher:</b>\n"); |
2473 |
printf("</td><td colspan =\"3\">\n"); |
2474 |
printf("<input type = \"text\" name = \"publisher\" size = \"50\" value =\"%s\" >\n", $publisher); |
2475 |
printf("</td></tr>\n"); |
2476 |
|
2477 |
// Publish date |
2478 |
printf("<td colspan = \"1\" >\n"); |
2479 |
printf("<b>Publish Date:</b>\n"); |
2480 |
printf("</td><td colspan =\"3\">\n"); |
2481 |
printf("<input type = \"text\" name = \"pub_date\" size = \"50\" value = \"%s\" >\n", $pub_date); |
2482 |
printf("</td></tr>\n"); |
2483 |
|
2484 |
// Edition |
2485 |
printf("<tr><td colspan = \"1\" >\n"); |
2486 |
printf("<b>Edition:</b>\n"); |
2487 |
printf("</td><td colspan =\"3\">\n"); |
2488 |
printf("<input type = \"text\" name = \"edition\" size = \"20\" value = \"%s\" >\n", $edition); |
2489 |
printf("</td></tr>\n"); |
2490 |
|
2491 |
// Library Location / Call number |
2492 |
printf("<td colspan = \"1\" valign=\"top\">\n"); |
2493 |
printf("<b>Library Location and Call No.:</b>\n"); |
2494 |
printf("</td><td colspan =\"3\">\n"); |
2495 |
printf("<textarea rows=\"4\" cols = \"50\" name = \"call_no\">\n"); |
2496 |
printf($call_no); |
2497 |
printf("</textarea></td></tr>\n"); |
2498 |
|
2499 |
// Catalog Number |
2500 |
printf("<tr><td colspan = \"1\" >\n"); |
2501 |
printf("<b>Catalog No.:</b>\n"); |
2502 |
printf("</td><td colspan =\"3\">\n"); |
2503 |
printf("<input type = \"text\" name = \"cat_num\" size = \"25\" value = \"%s\" >\n", $cat_num); |
2504 |
printf("</td></tr>\n"); |
2505 |
|
2506 |
// Master subject |
2507 |
if ($mastersubject_id > 1 && $mastersubject_id != 2) { |
2508 |
$mastersubject = lookupField("mastersubject", "mastersubject_id", $mastersubject_id, "mastersubject"); |
2509 |
printf("<tr><td colspan =\"1\" >\n"); |
2510 |
printf("<b>Master subject:</b>\n"); |
2511 |
printf("</td><td colspan =\"3\">\n"); |
2512 |
printf("%s", $mastersubject); |
2513 |
printf("</td></tr>\n"); |
2514 |
} |
2515 |
|
2516 |
// Masterinfotype |
2517 |
if ($masterinfotype_id > 1) { |
2518 |
printf("<tr><td colspan = \"1\" >\n"); |
2519 |
printf("<b>Master Information Type:</b>\n"); |
2520 |
printf("</td><td colspan =\"3\">\n"); |
2521 |
$masterinfotype = lookupField("masterinfotype", "masterinfotype_id", $masterinfotype_id, "masterinfotype"); |
2522 |
printf("%s", $masterinfotype); |
2523 |
printf("</td></tr>\n"); |
2524 |
} |
2525 |
|
2526 |
// Drop down box for default information type |
2527 |
printf("<td colspan = \"1\" >\n"); |
2528 |
printf("<b>Base Information Type:</b>\n"); |
2529 |
printf("</td><td colspan =\"3\">\n"); |
2530 |
printf("<select name = \"infotype_id\" >\n"); |
2531 |
|
2532 |
$limit = " WHERE infotype_id >= 0 "; |
2533 |
|
2534 |
// Limit to a mastersubject's information types |
2535 |
if ($mastersubject_id > 0 && $mastersubject_id != 2) { |
2536 |
$limit .= " AND (mastersubject_id < 3 OR mastersubject_id = " . $mastersubject_id . ")"; |
2537 |
} |
2538 |
|
2539 |
// Limit to a master information type's information types |
2540 |
if ($masterinfotype_id > 1) { |
2541 |
$limit .= " AND (masterinfotype_id < 2 OR masterinfotype_id = " . $masterinfotype_id . ")"; |
2542 |
} |
2543 |
|
2544 |
dropDownFieldSelected("infotype", "infotype", "infotype_id", $limit, $infotype_id); |
2545 |
printf("</select>"); |
2546 |
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 |
2583 |
printf("<tr><td colspan = \"4\">\n"); |
2584 |
printf("<br><b><a name=\"additional\">Annotation</a>:</b><br>\n"); |
2585 |
printf("<textarea name = \"annotation\" rows = \"6\" cols = \"70\" >\n"); |
2586 |
printf("%s", $annotation); |
2587 |
printf("</textarea><br><br><br>\n"); |
2588 |
|
2589 |
// Buttons |
2590 |
|
2591 |
// If this is an existing resource |
2592 |
if ($key_id > 0) { |
2593 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateResource\" >\n"); |
2594 |
printf("<input type = \"Submit\" value = \"Update Resource\" >\n"); |
2595 |
printf("<input type = \"Hidden\" name = \"key_id\" value = \"%d\" >\n", $key_id); |
2596 |
} |
2597 |
// A new resource |
2598 |
else { |
2599 |
printf("<input type = \"Hidden\" name = \"mastersubject_id\" value = \"%d\" >\n", $mastersubject_id); |
2600 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertResource\" >\n"); |
2601 |
printf("<input type = \"Submit\" value = \"Save New Resource\" >\n"); |
2602 |
} |
2603 |
|
2604 |
// Common button |
2605 |
printf("<input type = \"Reset\" value = \"Reset\" >\n"); |
2606 |
|
2607 |
// Close things |
2608 |
printf("</form><br>\n"); |
2609 |
printf("</td></tr></table>\n"); |
2610 |
|
2611 |
// Exterior table |
2612 |
printf("</td></tr></table>\n"); |
2613 |
|
2614 |
// Other forms - only if editing an existing resource |
2615 |
if ($key_id > 0) { |
2616 |
|
2617 |
formAssignResLoc($key_id); |
2618 |
formAssignResFeature($key_id); |
2619 |
formAssignResMastersubject($key_id); |
2620 |
|
2621 |
// Offer a delete resource button |
2622 |
printf("<BR>\n"); |
2623 |
printf("<form method=\"POST\" action=\"delete.phtml\">\n"); |
2624 |
printf("<input type=\"Hidden\" name=\"transaction\" value=\"deleteResourceConfirm\">\n"); |
2625 |
printf("<input type=\"Hidden\" name=\"resource_id\" value=\"%d\">\n", $key_id); |
2626 |
printf("<input type=\"submit\" value=\"Delete Resource!\">\n"); |
2627 |
printf("</form>\n"); |
2628 |
} |
2629 |
|
2630 |
} // No problems |
2631 |
} |
2632 |
|
2633 |
|
2634 |
/********************************************************** |
2635 |
Function: formService |
2636 |
Author: Paul Bramscher |
2637 |
Last Modified: 03.16.2004 |
2638 |
*********************************************************** |
2639 |
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. |
2641 |
**********************************************************/ |
2642 |
function formService($key_id) { |
2643 |
|
2644 |
// Cast as integer to be sure |
2645 |
$key_id = (int) $key_id; |
2646 |
|
2647 |
// Check to see if service actually exists |
2648 |
$exists = existsRow("service", "service_id", $key_id); |
2649 |
|
2650 |
// Header |
2651 |
printf("<center>"); |
2652 |
if ($key_id > 0 && $exists == 1) { |
2653 |
|
2654 |
// Initialization |
2655 |
$service = ""; |
2656 |
$serviceURL = ""; |
2657 |
$serviceDescr = ""; |
2658 |
$address1 = ""; |
2659 |
$address2 = ""; |
2660 |
$address3 = ""; |
2661 |
$address4 = ""; |
2662 |
$telephone = ""; |
2663 |
$fax = ""; |
2664 |
$email = ""; |
2665 |
$nonaff = ""; |
2666 |
|
2667 |
// Fetch existing values |
2668 |
$sql = "SELECT * from service where service_id = " . $key_id; |
2669 |
$rs = xx_tryquery($sql); |
2670 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
2671 |
$service_id = $row["service_id"]; |
2672 |
$service = $row["service"]; |
2673 |
$serviceURL = $row["serviceURL"]; |
2674 |
$serviceDescr = $row["serviceDescr"]; |
2675 |
$address1 = $row["address1"]; |
2676 |
$address2 = $row["address2"]; |
2677 |
$address3 = $row["address3"]; |
2678 |
$address4 = $row["address4"]; |
2679 |
$telephone = $row["telephone"]; |
2680 |
$fax = $row["fax"]; |
2681 |
$email = $row["email"]; |
2682 |
$nonaff = $row["nonaff"]; |
2683 |
|
2684 |
// Run strings through the HTML cleaner for output |
2685 |
$service = textOutHTML($service); |
2686 |
$serviceDescr = textOutHTML($serviceDescr); |
2687 |
$address1 = textOutHTML($address1); |
2688 |
$address2 = textOutHTML($address2); |
2689 |
$address3 = textOutHTML($address3); |
2690 |
$address4 = textOutHTML($address4); |
2691 |
|
2692 |
} |
2693 |
|
2694 |
// Houston, we have a problem |
2695 |
if ($key_id > 0 && $exists == 0) { |
2696 |
$problem = 1; |
2697 |
printf("<h3>Service (ID# %d) Not Found</h3>\n", $key_id); |
2698 |
} |
2699 |
|
2700 |
// If no problems, then go for landing |
2701 |
if ($problem != 1) { |
2702 |
|
2703 |
// Table definition |
2704 |
printf("<center><table width=\"75%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n"); |
2705 |
|
2706 |
// If new insert |
2707 |
if ($key_id <1) { |
2708 |
printf("<form method = \"POST\" action = \"insert.phtml\" >\n"); |
2709 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
2710 |
printf("Enter New Service"); |
2711 |
printf("</td></tr>\n"); |
2712 |
} |
2713 |
|
2714 |
// Else update |
2715 |
else { |
2716 |
printf("<form method = \"POST\" action = \"update.phtml\" >\n"); |
2717 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
2718 |
printf("Edit Service: %s (ID# %d)", $service, $service_id); |
2719 |
printf("</td></tr>\n"); |
2720 |
} |
2721 |
|
2722 |
|
2723 |
// Service Name |
2724 |
printf("<tr>\n"); |
2725 |
printf("<td><b>Service Name:</b></td>\n"); |
2726 |
printf("<td><input type = \"text\" name = \"service\" size = \"40\" value = \"%s\" ></td>\n", $service); |
2727 |
printf("</tr>\n"); |
2728 |
|
2729 |
// Description |
2730 |
printf("<tr>\n"); |
2731 |
printf("<td colspan=\"2\"><b>Description:</b><br>\n"); |
2732 |
printf("<textarea name = \"serviceDescr\" rows = \"5\" cols = \"70\" >\n"); |
2733 |
printf("%s", $serviceDescr); |
2734 |
printf("</textarea><br>\n"); |
2735 |
printf("</td></tr>\n"); |
2736 |
|
2737 |
// URL |
2738 |
printf("<tr>\n"); |
2739 |
printf("<td><b>Service URL:</b></td>\n"); |
2740 |
printf("<td><input type = \"text\" name = \"serviceURL\" size = \"50\" value = \"%s\" ></td>\n", |
2741 |
$serviceURL); |
2742 |
printf("</tr>\n"); |
2743 |
|
2744 |
// Address1 |
2745 |
printf("<tr>\n"); |
2746 |
printf("<td><b>Address Line 1:</b></td>\n"); |
2747 |
printf("<td><input type = \"text\" name = \"address1\" size = \"35\" value = \"%s\" ></td>\n", $address1); |
2748 |
printf("</tr>\n"); |
2749 |
|
2750 |
// Address2 |
2751 |
printf("<tr>\n"); |
2752 |
printf("<td><b>Address Line 2:</b></td>\n"); |
2753 |
printf("<td><input type = \"text\" name = \"address2\" size = \"35\" value = \"%s\" ></td>\n", $address2); |
2754 |
printf("</tr>\n"); |
2755 |
|
2756 |
// Address3 |
2757 |
printf("<tr>\n"); |
2758 |
printf("<td><b>Address Line 3:</b></td>\n"); |
2759 |
printf("<td><input type = \"text\" name = \"address3\" size = \"35\" value = \"%s\" ></td>\n", $address3); |
2760 |
printf("</tr>\n"); |
2761 |
|
2762 |
// Address4 |
2763 |
printf("<tr>\n"); |
2764 |
printf("<td><b>Address Line 4:</b></td>\n"); |
2765 |
printf("<td><input type = \"text\" name = \"address4\" size = \"35\" value = \"%s\" ></td>\n", $address4); |
2766 |
printf("</tr>\n"); |
2767 |
|
2768 |
// Telephone |
2769 |
printf("<tr>\n"); |
2770 |
printf("<td><b>Telephone:</b></td>\n"); |
2771 |
printf("<td><input type = \"text\" name = \"telephone\" size = \"25\" value = \"%s\" ></td>\n", $telephone); |
2772 |
printf("</tr>\n"); |
2773 |
|
2774 |
// Fax |
2775 |
printf("<tr>\n"); |
2776 |
printf("<td><b>Fax:</b></td>\n"); |
2777 |
printf("<td><input type = \"text\" name = \"fax\" size = \"25\" value = \"%s\" ></td>\n", $fax); |
2778 |
printf("</tr>\n"); |
2779 |
|
2780 |
// Email |
2781 |
printf("<tr>\n"); |
2782 |
printf("<td><b>E-mail Address:</b></td>\n"); |
2783 |
printf("<td><input type = \"text\" name = \"email\" size = \"25\" value = \"%s\" ></td>\n", |
2784 |
$email); |
2785 |
printf("</tr>\n"); |
2786 |
|
2787 |
// Nonaffil |
2788 |
$nonaff_yes = ""; |
2789 |
$nonadd_no = ""; |
2790 |
if ($nonaff == 1) $nonaff_yes = " CHECKED "; |
2791 |
else $nonaff_no = " CHECKED "; |
2792 |
|
2793 |
printf("<tr>\n"); |
2794 |
printf("<td><b>Open to Nonaffiliated Users?</b></td>\n"); |
2795 |
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); |
2797 |
printf("</tr>\n"); |
2798 |
|
2799 |
// Buttons |
2800 |
printf("<tr><td colspan=\"2\" align=\"center\"><br>\n"); |
2801 |
// If this is an existing service |
2802 |
if ($key_id > 0) { |
2803 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateService\" >\n"); |
2804 |
printf("<input type = \"Submit\" value = \"Update Service\" >\n"); |
2805 |
printf("<input type = \"Hidden\" name = \"service_id\" value = \"%d\" >\n", $service_id); |
2806 |
} |
2807 |
// Editing a new service |
2808 |
else { |
2809 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertService\" >\n"); |
2810 |
printf("<input type = \"Submit\" value = \"Save New Service\" >\n"); |
2811 |
} |
2812 |
|
2813 |
// Common button |
2814 |
printf("<input type = \"Reset\" value = \"Reset\" >\n"); |
2815 |
|
2816 |
// Close things |
2817 |
printf("</form>\n"); |
2818 |
printf("</td></tr></table></center>\n"); |
2819 |
|
2820 |
// Change service-location assignments |
2821 |
|
2822 |
if ($service_id > 0) { |
2823 |
formAssignServServtype($service_id); |
2824 |
formAssignServLoc($service_id); |
2825 |
} |
2826 |
|
2827 |
printf("<BR>\n"); |
2828 |
|
2829 |
} // No problems |
2830 |
} |
2831 |
|
2832 |
|
2833 |
/********************************************************** |
2834 |
Function: formStyle |
2835 |
Author: Paul Bramscher |
2836 |
Last Modified: 03.16.2004 |
2837 |
*********************************************************** |
2838 |
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. |
2840 |
|
2841 |
Note that neither this form, nor the SQL insert/update |
2842 |
counterpart functions, do any error checking to see |
2843 |
whether the supplied values for filenames exist, or have |
2844 |
proper permissions. This must be done separately by |
2845 |
someone with OS access. |
2846 |
**********************************************************/ |
2847 |
function formStyle($key_id) { |
2848 |
|
2849 |
// Cast as integer to be sure |
2850 |
$key_id = (int) $key_id; |
2851 |
|
2852 |
// Check to see if feature actually exists |
2853 |
$exists = existsRow("style", "style_id", $key_id); |
2854 |
|
2855 |
// Header |
2856 |
printf("<center>"); |
2857 |
if ($key_id > 0 && $exists == 1) { |
2858 |
|
2859 |
// Initialization |
2860 |
$style_title = ""; |
2861 |
$style_id = ""; |
2862 |
|
2863 |
// Fetch existing values |
2864 |
$sql = "SELECT * from style where style_id = " . $key_id; |
2865 |
$rs = xx_tryquery($sql); |
2866 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
2867 |
$style_id = $row["style_id"]; |
2868 |
$style_title = $row["style_title"]; |
2869 |
$header_file = $row["header_file"]; |
2870 |
$footer_file = $row["footer_file"]; |
2871 |
$css_file = $row["css_file"]; |
2872 |
|
2873 |
// Run strings through the HTML cleaner for output |
2874 |
$style_title = textOutHTML($style_title); |
2875 |
$header_file = textOutHTML($header_file); |
2876 |
$footer_file = textOutHTML($footer_file); |
2877 |
$css_file = textOutHTML($css_file); |
2878 |
} |
2879 |
|
2880 |
// Houston, we have a problem |
2881 |
if ($key_id > 0 && $exists == 0) { |
2882 |
$problem = 1; |
2883 |
printf("<h3>Style (ID# %d) Not Found</h3>\n", $key_id); |
2884 |
} |
2885 |
|
2886 |
// If no problems, then go for landing |
2887 |
if ($problem != 1) { |
2888 |
|
2889 |
// Table definition |
2890 |
printf("<center><table width=\"75%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n"); |
2891 |
|
2892 |
// If new insert |
2893 |
if ($key_id <1) { |
2894 |
printf("<form method = \"POST\" action = \"insert.phtml\" >\n"); |
2895 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
2896 |
printf("Enter New Style"); |
2897 |
printf("</td></tr>\n"); |
2898 |
} |
2899 |
|
2900 |
// Else update |
2901 |
else { |
2902 |
printf("<form method = \"POST\" action = \"update.phtml\" >\n"); |
2903 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
2904 |
printf("Edit Style: %s (ID# %d)", $style_title, $style_id); |
2905 |
printf("</td></tr>\n"); |
2906 |
} |
2907 |
|
2908 |
// Style Title |
2909 |
printf("<tr>\n"); |
2910 |
printf("<td><b>Style Title:</b></td>\n"); |
2911 |
printf("<td><input type = \"text\" name = \"style_title\" size = \"40\" value = \"%s\" ></td>\n", $style_title); |
2912 |
printf("</tr>\n"); |
2913 |
|
2914 |
// Header File |
2915 |
printf("<tr>\n"); |
2916 |
printf("<td><b>Header File:</b></td>\n"); |
2917 |
printf("<td><input type = \"text\" name = \"header_file\" size = \"60\" value = \"%s\" ></td>\n", $header_file); |
2918 |
printf("</tr>\n"); |
2919 |
|
2920 |
// Footer File |
2921 |
printf("<tr>\n"); |
2922 |
printf("<td><b>Footer File:</td>\n"); |
2923 |
printf("<td><input type = \"text\" name = \"footer_file\" size = \"60\" value = \"%s\" ></td>\n", $footer_file); |
2924 |
printf("</tr>\n"); |
2925 |
|
2926 |
// CSS File |
2927 |
printf("<tr>\n"); |
2928 |
printf("<td><b>CSS File:</b></td>\n"); |
2929 |
printf("<td><input type = \"text\" name = \"css_file\" size = \"60\" value = \"%s\" ></td>\n", $css_file); |
2930 |
printf("</tr>\n"); |
2931 |
|
2932 |
// Buttons |
2933 |
printf("<tr><td colspan=\"2\" align=\"center\"><br>\n"); |
2934 |
// If this is an existing style |
2935 |
if ($key_id > 0) { |
2936 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateStyle\" >\n"); |
2937 |
printf("<input type = \"Submit\" value = \"Update Style\" >\n"); |
2938 |
printf("<input type = \"Hidden\" name = \"style_id\" value = \"%d\" >\n", $style_id); |
2939 |
} |
2940 |
// Editing a new style |
2941 |
else { |
2942 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertStyle\" >\n"); |
2943 |
printf("<input type = \"Submit\" value = \"Save New Style\">\n"); |
2944 |
} |
2945 |
|
2946 |
// Common button |
2947 |
printf("<input type = \"Reset\" value = \"Reset\" >\n"); |
2948 |
|
2949 |
// Close things |
2950 |
printf("</form>\n"); |
2951 |
printf("<br></td></tr></table></center>\n"); |
2952 |
|
2953 |
} // No problems |
2954 |
} |
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 |
3111 |
Author: Paul Bramscher |
3112 |
Last Modified: 03.15.2004 |
3113 |
*********************************************************** |
3114 |
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. |
3116 |
**********************************************************/ |
3117 |
function formSubject($key_id) { |
3118 |
|
3119 |
// Cast as integer to be sure |
3120 |
$key_id = (int) $key_id; |
3121 |
|
3122 |
// Check to see if location actually exists |
3123 |
$exists = existsRow("subject", "subject_id", $key_id); |
3124 |
|
3125 |
// Header |
3126 |
printf("<center>"); |
3127 |
if ($key_id > 0 && $exists == 1) { |
3128 |
|
3129 |
// Initialization |
3130 |
$subject = ""; |
3131 |
$subject_id = ""; |
3132 |
$sublocation_id = ""; |
3133 |
|
3134 |
// If the user is editing an existing record, fetch previous values |
3135 |
$sql = "SELECT * from subject where subject_id = " . $key_id; |
3136 |
$rs = xx_tryquery($sql); |
3137 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
3138 |
|
3139 |
// Fetch existing values |
3140 |
$subject_id = $row["subject_id"]; |
3141 |
$subject = $row["subject"]; |
3142 |
$sublocation_id = $row["sublocation_id"]; |
3143 |
$subject_descr = $row["subject_descr"]; |
3144 |
|
3145 |
// Run strings through the HTML cleaner for output |
3146 |
$subject = textOutHTML($subject); |
3147 |
} |
3148 |
|
3149 |
// Houston, we have a problem |
3150 |
if ($key_id > 0 && $exists == 0) { |
3151 |
$problem = 1; |
3152 |
printf("<h3>Subject (ID# %d) Not Found</h3>\n", $key_id); |
3153 |
} |
3154 |
|
3155 |
// If no problems, then go for landing |
3156 |
if ($problem != 1) { |
3157 |
|
3158 |
// Table definition |
3159 |
printf("<center><table width=\"75%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n"); |
3160 |
|
3161 |
// If new insert |
3162 |
if ($key_id <1) { |
3163 |
printf("<form method = \"POST\" action = \"insert.phtml\" >\n"); |
3164 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
3165 |
printf("Enter New Subject"); |
3166 |
printf("</td></tr>\n"); |
3167 |
} |
3168 |
|
3169 |
// Else update |
3170 |
else { |
3171 |
printf("<form method = \"POST\" action = \"update.phtml\" >\n"); |
3172 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
3173 |
printf("Edit Subject: %s (ID# %d)", $subject, $subject_id); |
3174 |
printf("</td></tr>\n"); |
3175 |
} |
3176 |
|
3177 |
// Subject |
3178 |
printf("<tr><td>\n"); |
3179 |
printf("<b>Subject:</b>\n"); |
3180 |
printf("</td>\n"); |
3181 |
printf("<td>\n"); |
3182 |
printf("<input type = \"text\" name = \"subject\" size = \"65\" value = \"%s\" >\n", $subject); |
3183 |
printf("</td></tr>\n"); |
3184 |
|
3185 |
// Primary location |
3186 |
printf("<tr>\n"); |
3187 |
printf("<td><b>Primary Location:</b></td>\n"); |
3188 |
printf("<td>\n"); |
3189 |
printf("<select name = \"sublocation_id\">\n"); |
3190 |
dropDownFieldSelected("location", "location", "location_id", "WHERE location_id > 0", $sublocation_id); |
3191 |
printf("</select>\n"); |
3192 |
printf("</td></tr>\n"); |
3193 |
|
3194 |
// Description |
3195 |
printf("<tr>\n"); |
3196 |
printf("<td colspan=\"2\">\n"); |
3197 |
printf("<b>Description:</b><br>"); |
3198 |
printf("<textarea name = \"subject_descr\" rows = \"5\" cols = \"65\" >\n"); |
3199 |
printf("%s", $subject_descr); |
3200 |
printf("</textarea></td></tr>\n"); |
3201 |
|
3202 |
// Buttons |
3203 |
printf("<tr><td colspan=\"2\" align=\"center\"><br>\n"); |
3204 |
|
3205 |
// If this is an existing subject |
3206 |
if ($key_id > 0) { |
3207 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateSubject\" >\n"); |
3208 |
printf("<input type = \"Submit\" value = \"Update Subject\" >\n"); |
3209 |
printf("<input type = \"Hidden\" name = \"subject_id\" value = \"%d\" >\n", $subject_id); |
3210 |
} |
3211 |
// Editing a new subject |
3212 |
else { |
3213 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertSubject\" >\n"); |
3214 |
printf("<input type = \"Submit\" value = \"Save New Subject\" >\n"); |
3215 |
} |
3216 |
|
3217 |
// Common button |
3218 |
printf("<input type = \"Reset\" value = \"Reset\" >\n"); |
3219 |
|
3220 |
// Close things |
3221 |
printf("</form>\n"); |
3222 |
printf("</td></tr></table></center>\n"); |
3223 |
|
3224 |
// Change subject-location assignments |
3225 |
|
3226 |
if ($subject_id > 0) { |
3227 |
formAssignSubMaster($subject_id); |
3228 |
formAssignSubLoc($subject_id); |
3229 |
formAssignSubStaff($subject_id); |
3230 |
formAssignSubCoursesub($subject_id); |
3231 |
} |
3232 |
|
3233 |
} // No problems |
3234 |
|
3235 |
printf("<BR>\n"); |
3236 |
} |
3237 |
|
3238 |
|
3239 |
/********************************************************** |
3240 |
Function: formVendor |
3241 |
Author: Paul Bramscher |
3242 |
Last Modified: 03.16.2004 |
3243 |
*********************************************************** |
3244 |
Purpose: |
3245 |
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 |
**********************************************************/ |
3248 |
function formVendor($key_id) { |
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 |
3257 |
printf("<center>"); |
3258 |
if ($key_id > 0 && $exists == 1) { |
3259 |
|
3260 |
// Initialization |
3261 |
$vendor_id = ""; |
3262 |
$vendor = ""; |
3263 |
$vendor_descr = ""; |
3264 |
$vendor_status = ""; |
3265 |
$vendor_message = ""; |
3266 |
|
3267 |
|
3268 |
// Fetch existing values |
3269 |
$sql = "SELECT * FROM vendor WHERE vendor_id = " . $key_id; |
3270 |
$rs = xx_tryquery($sql); |
3271 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
3272 |
$vendor_id = $row["vendor_id"]; |
3273 |
$vendor = $row["vendor"]; |
3274 |
$vendor_descr = $row["vendor_descr"]; |
3275 |
$vendor_status = $row["vendor_status"]; |
3276 |
$vendor_message = $row["vendor_message"]; |
3277 |
} |
3278 |
|
3279 |
// Houston, we have a problem |
3280 |
if ($key_id > 0 && $exists == 0) { |
3281 |
$problem = 1; |
3282 |
printf("<h3>Vendor (ID# %d) Not Found</h3>\n", $key_id); |
3283 |
} |
3284 |
|
3285 |
// If no problems, then go for landing |
3286 |
if ($problem != 1) { |
3287 |
|
3288 |
// Table definition |
3289 |
printf("<center><table width=\"75%%\" border=\"1\" class=\"backLight\" cellpadding=\"4\">\n"); |
3290 |
|
3291 |
// Form to handle vendor |
3292 |
// If new insert |
3293 |
if ($key_id <1) { |
3294 |
printf("<form method = \"POST\" action = \"insert.phtml\" >\n"); |
3295 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
3296 |
printf("Enter New Vendor"); |
3297 |
printf("</td></tr>\n"); |
3298 |
} |
3299 |
|
3300 |
// Else update |
3301 |
else { |
3302 |
printf("<form method = \"POST\" action = \"update.phtml\" >\n"); |
3303 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
3304 |
printf("Edit Vendor: %s (ID# %d)", $vendor, $vendor_id); |
3305 |
printf("</td></tr>\n"); |
3306 |
} |
3307 |
|
3308 |
// Vendor name |
3309 |
printf("<tr>\n"); |
3310 |
printf("<td><b>Vendor:</b></td>\n"); |
3311 |
printf("<td><input type = \"text\" name = \"vendor\" size = \"40\" value = \"%s\" ></td>\n", $vendor); |
3312 |
printf("</tr>\n"); |
3313 |
|
3314 |
// Vendor description |
3315 |
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 |
printf("</td></tr>\n"); |
3338 |
|
3339 |
// Message |
3340 |
printf("<tr><td>\n"); |
3341 |
printf("<b>Down/Alert Message:</b>\n"); |
3342 |
printf("</td>\n"); |
3343 |
printf("<td>\n"); |
3344 |
printf("<input type =\"text\" size=\"60\" name =\"vendor_message\" value=\"%s\">\n", $vendor_message); |
3345 |
printf("</td></tr>\n"); |
3346 |
|
3347 |
// Buttons |
3348 |
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 |
// Common button |
3362 |
printf("<input type = \"Reset\" value = \"Reset\" >\n"); |
3363 |
|
3364 |
// Close things |
3365 |
printf("</form>\n"); |
3366 |
printf("</td></tr></table></center>\n"); |
3367 |
|
3368 |
} // No problems |
3369 |
} |
3370 |
?> |