1 |
<?php |
2 |
/********************************************************** |
3 |
Function Library: scribeforms.php |
4 |
Original Author: Paul Bramscher <brams006@umn.edu> |
5 |
Last Modified: 03.11.2004 |
6 |
*********************************************************** |
7 |
Comments: |
8 |
This library brings together all of the edit forms on the |
9 |
PageScribe system. |
10 |
*********************************************************** |
11 |
Table of Contents: |
12 |
addLabel |
13 |
addLoc |
14 |
addRes |
15 |
addRQS |
16 |
addRQSLink |
17 |
addSelection |
18 |
addService |
19 |
addStaff |
20 |
buttonDown |
21 |
buttonUp |
22 |
copyElement |
23 |
delElement |
24 |
displayElement |
25 |
displayHeader |
26 |
editButtons |
27 |
editElement |
28 |
editHeader |
29 |
formAssignPageStaff |
30 |
formAssignPageSubject |
31 |
formCourse |
32 |
formCoursePers |
33 |
formPageHeader |
34 |
pageTitleStyle |
35 |
**********************************************************/ |
36 |
|
37 |
|
38 |
/********************************************************** |
39 |
Function: addLabel |
40 |
Author: Paul Bramscher |
41 |
Last Modified: 03.11.2004 |
42 |
*********************************************************** |
43 |
Purpose: |
44 |
Collect values for title, description, and URL to add a |
45 |
free-text or label type element on a PageScribe/CourseLib |
46 |
page. |
47 |
**********************************************************/ |
48 |
function addLabel($place_array, $page_id) { |
49 |
|
50 |
// Break apart place array |
51 |
// $element_id = $place_array[0]; |
52 |
// $element_order = $place_array[1]; |
53 |
// $indent_level = $place_array[2]; |
54 |
// $parent_id = $place_array[3]; |
55 |
$position = $place_array[4]; |
56 |
|
57 |
// Build an HTML passable place array |
58 |
$place_array_HTML = $place_array[0] . "," . $place_array[1] . "," . $place_array[2] . "," . $place_array[3] . "," . $place_array[4]; |
59 |
|
60 |
// Table |
61 |
printf("<table width=\"25%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
62 |
|
63 |
// Add label form |
64 |
printf("<BR><form method = \"POST\" action = \"scribe_transaction.phtml\">\n"); |
65 |
printf("<input type = \"hidden\" name=\"page_id\" value =\"%d\">\n", $page_id); |
66 |
printf("<input type = \"hidden\" name=\"place_array_HTML\" value =\"%s\">\n", $place_array_HTML); |
67 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertScribeLabel\" >\n"); |
68 |
|
69 |
// Row header |
70 |
printf("<tr><td class=\"cellPlain\">\n"); |
71 |
printf("Add Text"); |
72 |
printf("</td></tr>\n"); |
73 |
|
74 |
// Label |
75 |
printf("<tr><td>\n"); |
76 |
printf("<br><b>Label:</b><br>\n"); |
77 |
printf("<input type =\"text\" name =\"label\" size =\"40\">\n"); |
78 |
printf("<br>\n"); |
79 |
|
80 |
// Description |
81 |
printf("<BR><b>Description:</b><br>\n"); |
82 |
printf("<textarea rows=\"2\" cols=\"40\" name =\"element_descr\" >\n"); |
83 |
printf("</textarea><br>\n"); |
84 |
|
85 |
// URL |
86 |
printf("<b>Wrap with URL:</b><br>\n"); |
87 |
printf("<input type = \"text\" name =\"label_url\" value =\"http://\" size=\"50\"><br><br>\n"); |
88 |
|
89 |
// Interior table |
90 |
printf("<table border=\"0\" cellpadding=\"4\"><tr><td>\n"); |
91 |
printf("<input type= \"submit\" value=\"Add\">\n"); |
92 |
printf("</form>\n"); |
93 |
printf("</td><td>\n"); |
94 |
|
95 |
// Cancel button |
96 |
printf("<form method =\"POST\" action =\"scribe.phtml?page_id=%d&this_pos=%d#p%d\">\n", |
97 |
$page_id, $position, $position); |
98 |
printf("<input type=\"hidden\" name=\"cmd\" value=\"\">\n"); |
99 |
printf("<input type =\"submit\" value =\"Cancel\">\n"); |
100 |
printf("</form>\n"); |
101 |
|
102 |
// Close interior table |
103 |
printf("</td></tr></table>\n"); |
104 |
|
105 |
// Close exterior table |
106 |
printf("</td></tr></table>\n"); |
107 |
} |
108 |
|
109 |
|
110 |
/********************************************************** |
111 |
Function: addLoc |
112 |
Author: Paul Bramscher |
113 |
Last Modified: 03.11.2004 |
114 |
*********************************************************** |
115 |
Purpose: |
116 |
Select from the list of available location to add as an |
117 |
element to a PageScribe/CourseLib page. |
118 |
**********************************************************/ |
119 |
function addLoc($place_array, $page_id) { |
120 |
|
121 |
// Break apart place array |
122 |
// $element_id = $place_array[0]; |
123 |
// $element_order = $place_array[1]; |
124 |
// $indent_level = $place_array[2]; |
125 |
// $parent_id = $place_array[3]; |
126 |
$position = $place_array[4]; |
127 |
|
128 |
// Build an HTML passable place array |
129 |
$place_array_HTML = $place_array[0] . "," . $place_array[1] . "," . $place_array[2] . "," . $place_array[3] . "," . $place_array[4]; |
130 |
|
131 |
// Table |
132 |
printf("<table width=\"25%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
133 |
|
134 |
// Add location form |
135 |
printf("<form method = \"POST\" action = \"scribe_transaction.phtml\">\n"); |
136 |
printf("<input type = \"hidden\" name=\"page_id\" value =\"%d\">\n", $page_id); |
137 |
printf("<input type = \"hidden\" name=\"place_array_HTML\" value =\"%s\">\n", $place_array_HTML); |
138 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertScribeLocation\" >\n"); |
139 |
|
140 |
// Row header |
141 |
printf("<tr><td class=\"cellPlain\">\n"); |
142 |
printf("Add a Location"); |
143 |
printf("</td></tr>\n"); |
144 |
|
145 |
// Location drop-down |
146 |
printf("<tr><td>\n"); |
147 |
printf("<BR><b>Select Location:</b><br>\n"); |
148 |
printf("<select name =\"location_id\" size=\"5\" >\n"); |
149 |
dropDownFieldOmit("location", "location", "location_id", " WHERE location_id > 1"); |
150 |
printf("</select><br><br>\n"); |
151 |
|
152 |
|
153 |
// Interior table |
154 |
printf("<table border=\"0\" cellpadding=\"4\"><tr><td>\n"); |
155 |
printf("<input type= \"submit\" value=\"Add\">\n"); |
156 |
printf("</form>\n"); |
157 |
printf("</td><td>\n"); |
158 |
|
159 |
// Cancel button |
160 |
printf("<form method =\"POST\" action =\"scribe.phtml?page_id=%d&this_pos=%d#p%d\">\n", |
161 |
$page_id, $position, $position); |
162 |
printf("<input type=\"hidden\" name=\"cmd\" value=\"\">\n"); |
163 |
printf("<input type =\"submit\" value =\"Cancel\">\n"); |
164 |
printf("</form>\n"); |
165 |
|
166 |
// Close interior table |
167 |
printf("</td></tr></table>\n"); |
168 |
|
169 |
// Close exterior table |
170 |
printf("</td></tr></table>\n"); |
171 |
} |
172 |
|
173 |
|
174 |
/********************************************************** |
175 |
Function: addRes |
176 |
Author: Paul Bramscher |
177 |
Last Modified: 03.11.2004 |
178 |
*********************************************************** |
179 |
Purpose: |
180 |
Select from the list of available resources to add as |
181 |
an element to a PageScribe/CourseLib page. |
182 |
**********************************************************/ |
183 |
function addRes($feature_id, $letter, $limitstring, $masterinfotype_id, $place_array, $page_id) { |
184 |
|
185 |
// Default to letter A if nothing selected |
186 |
if ($letter == "" && $limitstring == "" && $masterinfotype_id < 1 && $feature_id < 1) $letter = "A"; |
187 |
|
188 |
// Break apart place array |
189 |
// $element_id = $place_array[0]; |
190 |
// $element_order = $place_array[1]; |
191 |
// $indent_level = $place_array[2]; |
192 |
// $parent_id = $place_array[3]; |
193 |
$position = $place_array[4]; |
194 |
|
195 |
// Build an HTML passable place array |
196 |
$place_array_HTML = $place_array[0] . "," . $place_array[1] . "," . $place_array[2] . "," . $place_array[3] . "," . $place_array[4]; |
197 |
|
198 |
|
199 |
// Table |
200 |
printf("<table width =\"40%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
201 |
|
202 |
// Row header |
203 |
printf("<tr><td class=\"cellPlain\" colspan=\"2\">\n"); |
204 |
printf("Add Resource"); |
205 |
printf("</td></tr>\n"); |
206 |
printf("<tr><td colspan=\"2\">\n"); |
207 |
|
208 |
// Limit to letter |
209 |
printf("Narrow Resource List To:<br>\n"); |
210 |
if ($letter != "" && $letter != "All") printf("Starting With <b>%s</b>\n", $letter); |
211 |
else if ($limitstring != "") printf ("Titles or Descriptions Containing <b>\"%s\"</b>\n", $limitstring); |
212 |
else printf ("All Resources\n"); |
213 |
|
214 |
// User limited by masterinfotype, display it |
215 |
if ($masterinfotype_id > 0) { |
216 |
$masterinfotype = lookupField("masterinfotype", "masterinfotype_id", $masterinfotype_id, "masterinfotype"); |
217 |
printf(" within <b>%s</b>\n", $masterinfotype); |
218 |
} |
219 |
|
220 |
// User limited by feature, display it |
221 |
if ($feature_id > 0) { |
222 |
$feature = lookupField("feature", "feature_id", $feature_id, "feature"); |
223 |
printf(" involving <b>%s</b>\n", $feature); |
224 |
} |
225 |
|
226 |
printf("<BR>\n"); |
227 |
|
228 |
// Allow A-Z |
229 |
printf("<tr><td align=\"center\" colspan=\"2\" class=\"backLight\">\n"); |
230 |
printf("<a href=\"scribe.phtml?page_id=" |
231 |
. $page_id |
232 |
. "&cmd=addRes&letter=All" |
233 |
. "&this_pos=" |
234 |
. $position |
235 |
. "#p" |
236 |
. $position |
237 |
. "\">A-Z</a>"); |
238 |
|
239 |
// Draw the alphabet |
240 |
for ($ascii_char = 65; $ascii_char <= 90; $ascii_char++) { |
241 |
if ($ascii_char == 77 || $asci_char == 90) printf("<BR><BR>\n"); |
242 |
else printf(" | "); |
243 |
printf("<a href=\"scribe.phtml?page_id=" |
244 |
. $page_id |
245 |
. "&cmd=addRes" |
246 |
. "&letter=" |
247 |
. chr($ascii_char) |
248 |
. "&this_pos=" |
249 |
. $position |
250 |
. "#p" |
251 |
. $position |
252 |
. "\">" |
253 |
. chr($ascii_char) |
254 |
. "</a>"); |
255 |
|
256 |
} |
257 |
printf("</td></tr>\n"); |
258 |
|
259 |
|
260 |
// Search |
261 |
printf("<tr><td class=\"cellPlain\">Title or Description:</td><td>\n"); |
262 |
printf("<form method=\"POST\" action=\"scribe.phtml#p%d\">\n", $position); |
263 |
printf("<input type = \"hidden\" name=\"cmd\" value=\"addRes\">\n"); |
264 |
printf("<input type = \"hidden\" name=\"page_id\" value =\"%d\">\n", $page_id); |
265 |
printf("<input type = \"hidden\" name=\"this_pos\" value =\"%s\">\n", $position); |
266 |
printf("<input type=\"text\" name=\"limitstring\" value =\"%s\" size =\"20\">\n", $limitstring); |
267 |
printf(" and/or "); |
268 |
printf("</td></tr>\n"); |
269 |
|
270 |
|
271 |
// Masterinfotype |
272 |
printf("<tr><td class = \"cellPlain\" >Master Info Type:</td><td>\n"); |
273 |
printf("<select name = \"masterinfotype_id\">\n"); |
274 |
printf("<option value=\"0\">All</option>\n"); |
275 |
dropDownFieldSelected("masterinfotype", "masterinfotype", "masterinfotype_id", " WHERE masterinfotype_id > 1 ", $masterinfotype_id); |
276 |
printf("</select>\n"); |
277 |
printf(" and/or</td></tr>\n"); |
278 |
|
279 |
|
280 |
// Feature |
281 |
printf("<tr><td class = \"cellPlain\" >Feature:</td><td>\n"); |
282 |
printf("<select name = \"feature_id\">\n"); |
283 |
printf("<option value=\"0\">All</option>\n"); |
284 |
dropDownFieldSelected("feature", "feature", "feature_id", " WHERE feature_id > 1 ", $feature_id); |
285 |
printf("</select>\n"); |
286 |
printf("<input type=\"submit\" value =\"Limit\"></form>\n"); |
287 |
printf("</td></tr>\n"); |
288 |
|
289 |
|
290 |
// The Add-Resource Box |
291 |
printf("<tr><td align=\"center\" colspan = \"2\" >\n"); |
292 |
printf("<form method =\"POST\" action=\"scribe_transaction.phtml\" >\n"); |
293 |
printf("<input type = \"hidden\" name=\"page_id\" value =\"%d\">\n", $page_id); |
294 |
printf("<input type = \"hidden\" name=\"place_array_HTML\" value =\"%s\">\n", $place_array_HTML); |
295 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertScribeResource\" >\n"); |
296 |
printf("<b>Add a Resource</b><br>\n"); |
297 |
printf("<select name = \"resource_id\" size = \"5\" >\n"); |
298 |
|
299 |
// Determine any limits and draw the box |
300 |
if (strlen($letter) > 0 && $letter != "All") $limit = $letter; |
301 |
if (strlen($limitstring) > 0) $limit = $limitstring; |
302 |
dropDownResource(0, $limit, $masterinfotype_id, $feature_id); |
303 |
printf("</select><br>\n"); |
304 |
|
305 |
// Interior table |
306 |
printf("<table border=\"0\" cellpadding=\"4\"><tr><td>\n"); |
307 |
printf("<input type=\"submit\" value =\"Add\">\n"); |
308 |
printf("</form>\n"); |
309 |
printf("</td><td>\n"); |
310 |
|
311 |
// Cancel button |
312 |
printf("<form method =\"POST\" action =\"scribe.phtml?page_id=%d&this_pos=%d#p%d\">\n", |
313 |
$page_id, $position, $position); |
314 |
printf("<input type=\"hidden\" name=\"cmd\" value=\"\">\n"); |
315 |
printf("<input type =\"submit\" value =\"Cancel\">\n"); |
316 |
printf("</form></td></tr>\n"); |
317 |
|
318 |
// Close interior table |
319 |
printf("</table>\n"); |
320 |
|
321 |
// Add a new base resource |
322 |
printf("<tr><td colspan=\"2\">\n"); |
323 |
printf("<b>Can't find the resource?</b> "); |
324 |
printf("<a href=\"console.phtml\">Add New Resource</a>\n"); |
325 |
|
326 |
// Close exterior table |
327 |
printf("</td></tr></table><br>\n"); |
328 |
} |
329 |
|
330 |
|
331 |
/********************************************************** |
332 |
Function: addRQS |
333 |
Author: Paul Bramscher |
334 |
Last Modified: 03.11.2004 |
335 |
*********************************************************** |
336 |
Purpose: |
337 |
Select an RQS subject page to harvest (all elements). This |
338 |
is contrasted with addRQSLink() which merely adds a link |
339 |
to it. |
340 |
**********************************************************/ |
341 |
function addRQS($place_array, $page_id) { |
342 |
|
343 |
// Break apart place array |
344 |
// $element_id = $place_array[0]; |
345 |
// $element_order = $place_array[1]; |
346 |
// $indent_level = $place_array[2]; |
347 |
// $parent_id = $place_array[3]; |
348 |
$position = $place_array[4]; |
349 |
|
350 |
// Build an HTML passable place array |
351 |
$place_array_HTML = $place_array[0] . "," . $place_array[1] . "," . $place_array[2] . "," . $place_array[3] . "," . $place_array[4]; |
352 |
|
353 |
// Table |
354 |
printf("<table width=\"25%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
355 |
|
356 |
// Add label form |
357 |
printf("<BR><form method = \"POST\" action = \"scribe_transaction.phtml\">\n"); |
358 |
printf("<input type = \"hidden\" name=\"page_id\" value =\"%d\">\n", $page_id); |
359 |
printf("<input type = \"hidden\" name=\"place_array_HTML\" value =\"%s\">\n", $place_array_HTML); |
360 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertScribeRQS\" >\n"); |
361 |
|
362 |
// Row header |
363 |
printf("<tr><td class=\"cellPlain\">\n"); |
364 |
printf("Harvest an RQS Page"); |
365 |
printf("</td></tr>\n"); |
366 |
|
367 |
// Select subject |
368 |
printf("<tr><td>\n"); |
369 |
printf("<br><b>RQS Subject:</b><br>\n"); |
370 |
printf("<select name = \"subject_id\" size=\"10\">\n"); |
371 |
dropDownFieldOmit("subject", "subject", "subject_id", "WHERE SUBJECT_ID > 1"); |
372 |
printf("</select>\n"); |
373 |
|
374 |
// Interior table |
375 |
printf("<table border=\"0\" cellpadding=\"4\"><tr><td>\n"); |
376 |
printf("<input type= \"submit\" value=\"Harvest Resources\">\n"); |
377 |
printf("</form>\n"); |
378 |
printf("</td><td>\n"); |
379 |
|
380 |
// Cancel button |
381 |
printf("<form method =\"POST\" action =\"scribe.phtml?page_id=%d&this_pos=%d#p%d\">\n", |
382 |
$page_id, $position, $position); |
383 |
printf("<input type=\"hidden\" name=\"cmd\" value=\"\">\n"); |
384 |
printf("<input type =\"submit\" value =\"Cancel\">\n"); |
385 |
printf("</form>\n"); |
386 |
|
387 |
// Close interior table |
388 |
printf("</td></tr></table>\n"); |
389 |
|
390 |
// Close exterior table |
391 |
printf("</td></tr></table>\n"); |
392 |
} |
393 |
|
394 |
|
395 |
/********************************************************** |
396 |
Function: addRQSLink |
397 |
Author: Paul Bramscher |
398 |
Last Modified: 03.11.2004 |
399 |
*********************************************************** |
400 |
Purpose: |
401 |
Select from a list of RQS pages to add as a link element |
402 |
on a PageScribe/CourseLib page. |
403 |
**********************************************************/ |
404 |
function addRQSLink($place_array, $page_id) { |
405 |
|
406 |
// Break apart place array |
407 |
// $element_id = $place_array[0]; |
408 |
// $element_order = $place_array[1]; |
409 |
// $indent_level = $place_array[2]; |
410 |
// $parent_id = $place_array[3]; |
411 |
$position = $place_array[4]; |
412 |
|
413 |
// Build an HTML passable place array |
414 |
$place_array_HTML = $place_array[0] . "," . $place_array[1] . "," . $place_array[2] . "," . $place_array[3] . "," . $place_array[4]; |
415 |
|
416 |
// Table |
417 |
printf("<table width=\"25%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
418 |
|
419 |
// Add label form |
420 |
printf("<BR><form method = \"POST\" action = \"scribe_transaction.phtml\">\n"); |
421 |
printf("<input type = \"hidden\" name=\"page_id\" value =\"%d\">\n", $page_id); |
422 |
printf("<input type = \"hidden\" name=\"place_array_HTML\" value =\"%s\">\n", $place_array_HTML); |
423 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertScribeRQSLink\" >\n"); |
424 |
|
425 |
// Row header |
426 |
printf("<tr><td class=\"cellPlain\">\n"); |
427 |
printf("Add RQS Page Link"); |
428 |
printf("</td></tr>\n"); |
429 |
|
430 |
// Select subject |
431 |
printf("<tr><td>\n"); |
432 |
printf("<br><b>RQS Subject:</b><br>\n"); |
433 |
printf("<select name = \"subject_id\" size=\"10\">\n"); |
434 |
dropDownFieldOmit("subject", "subject", "subject_id", "WHERE SUBJECT_ID > 1"); |
435 |
printf("</select>\n"); |
436 |
|
437 |
// Interior table |
438 |
printf("<table border=\"0\" cellpadding=\"4\"><tr><td>\n"); |
439 |
printf("<input type= \"submit\" value=\"Add Link\">\n"); |
440 |
printf("</form>\n"); |
441 |
printf("</td><td>\n"); |
442 |
|
443 |
// Cancel button |
444 |
printf("<form method =\"POST\" action =\"scribe.phtml?page_id=%d&this_pos=%d#p%d\">\n", |
445 |
$page_id, $position, $position); |
446 |
printf("<input type=\"hidden\" name=\"cmd\" value=\"\">\n"); |
447 |
printf("<input type =\"submit\" value =\"Cancel\">\n"); |
448 |
printf("</form>\n"); |
449 |
|
450 |
// Close interior table |
451 |
printf("</td></tr></table>\n"); |
452 |
|
453 |
// Close exterior table |
454 |
printf("</td></tr></table>\n"); |
455 |
} |
456 |
|
457 |
|
458 |
/********************************************************** |
459 |
Function: addSelection |
460 |
Author: Paul Bramscher |
461 |
Last Modified: 03.11.2004 |
462 |
*********************************************************** |
463 |
Purpose: |
464 |
Select from a list of element types to add to a |
465 |
PageScribe/CourseLib page. Note that these types |
466 |
correspond to columns available in the elements and |
467 |
pastebuffer tables -- adding a new type is not a trivial |
468 |
task. All SQL which render Pagescribe/Courselib pages |
469 |
would need to be changed to add the new join criteria. |
470 |
**********************************************************/ |
471 |
function addSelection($place_array, $page_id) { |
472 |
|
473 |
// Break apart place array |
474 |
// $element_id = $place_array[0]; |
475 |
// $element_order = $place_array[1]; |
476 |
// $indent_level = $place_array[2]; |
477 |
// $parent_id = $place_array[3]; |
478 |
$position = $place_array[4]; |
479 |
|
480 |
// Table |
481 |
printf("<table class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
482 |
|
483 |
// Row header |
484 |
printf("<tr><td class=\"cellPlain\">\n"); |
485 |
printf("Add An Element"); |
486 |
printf("</td></tr>\n"); |
487 |
|
488 |
// Element selection form |
489 |
printf("<form method =\"POST\" action =\"scribe.phtml?page_id=%d&this_pos=%d#p%d\">\n", |
490 |
$page_id, $position, $position); |
491 |
|
492 |
printf("<tr><td>\n"); |
493 |
printf("<BR><b>Select Type To Add:</b><br>\n"); |
494 |
printf("<select name =\"cmd\" size=\"7\">\n"); |
495 |
printf("<option value =\"addRes\">Resource</option>\n"); |
496 |
printf("<option value=\"addLoc\">Location</option>\n"); |
497 |
printf("<option value=\"addStaff\">Staff</option>\n"); |
498 |
printf("<option value=\"addService\">Service</option>\n"); |
499 |
printf("<option value=\"addLabel\">Text</option>\">\n"); |
500 |
printf("<option value=\"addRQSLink\">RQS Subject Link</option>\n"); |
501 |
printf("<option value=\"addRQS\">RQS Subject Harvest</option>\n"); |
502 |
printf("</select><BR><BR>\n"); |
503 |
|
504 |
// Interior table |
505 |
printf("<table border=\"0\" cellpadding=\"4\"><tr><td>\n"); |
506 |
printf("<input type =\"submit\" value =\"Select\">\n"); |
507 |
printf("</form>\n"); |
508 |
printf("</td><td>\n"); |
509 |
|
510 |
// Cancel button |
511 |
printf("<form method =\"POST\" action =\"scribe.phtml?page_id=%d&this_pos=%d#p%d\">\n", |
512 |
$page_id, $position, $position); |
513 |
printf("<input type=\"hidden\" name=\"cmd\" value=\"\">\n"); |
514 |
printf("<input type =\"submit\" value =\"Cancel\">\n"); |
515 |
printf("</form>\n"); |
516 |
|
517 |
// Close interior table |
518 |
printf("</td></tr></table>\n"); |
519 |
|
520 |
// Close exterior table |
521 |
printf("</td></tr></table>\n"); |
522 |
|
523 |
} |
524 |
|
525 |
|
526 |
/********************************************************** |
527 |
Function: addService |
528 |
Author: Paul Bramscher |
529 |
Last Modified: 03.11.2004 |
530 |
*********************************************************** |
531 |
Purpose: |
532 |
Select from a list of library services to add as an |
533 |
element to a PageScribe/CourseLib page. |
534 |
**********************************************************/ |
535 |
function addService($place_array, $servicetype_id, $page_id) { |
536 |
|
537 |
// Break apart place array |
538 |
// $element_id = $place_array[0]; |
539 |
// $element_order = $place_array[1]; |
540 |
// $indent_level = $place_array[2]; |
541 |
// $parent_id = $place_array[3]; |
542 |
$position = $place_array[4]; |
543 |
|
544 |
// Build an HTML passable place array |
545 |
$place_array_HTML = $place_array[0] . "," . $place_array[1] . "," . $place_array[2] . "," . $place_array[3] . "," . $place_array[4]; |
546 |
|
547 |
// Table |
548 |
printf("<table width=\"25%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
549 |
|
550 |
// Row header |
551 |
printf("<tr><td class=\"cellPlain\" colspan=\"2\">\n"); |
552 |
printf("Add a Service"); |
553 |
printf("</td></tr>\n"); |
554 |
|
555 |
// Limit by type |
556 |
printf("<tr><td class=\"cellPlain\">Service Type:</td>\n"); |
557 |
printf("<form method =\"POST\" action =\"scribe.phtml?page_id=%d&this_pos=%d#p%d\">\n", |
558 |
$page_id, $position, $position); |
559 |
printf("<input type=\"hidden\" name=\"cmd\" value=\"addService\">\n"); |
560 |
printf("<input type = \"hidden\" name=\"page_id\" value =\"%d\">\n", $page_id); |
561 |
printf("<input type = \"hidden\" name=\"place_array_HTML\" value =\"%s\">\n", $place_array_HTML); |
562 |
printf("<input type = \"hidden\" name=\"this_pos\" value =\"%s\">\n", $position); |
563 |
printf("<td>\n"); |
564 |
printf("<select name =\"servicetype_id\">\n"); |
565 |
printf("<option value=\"\">All</option>\n"); |
566 |
dropDownFieldSelected("servicetype", "servicetype", "servicetype_id", " WHERE servicetype_id > 1", $servicetype_id); |
567 |
printf("</select><br><br>\n"); |
568 |
printf("<input type =\"submit\" value =\"Limit by Service Type\">\n"); |
569 |
printf("</form></td></tr>\n"); |
570 |
|
571 |
// Add service form |
572 |
printf("<form method = \"POST\" action = \"scribe_transaction.phtml\">\n"); |
573 |
printf("<input type = \"hidden\" name=\"page_id\" value =\"%d\">\n", $page_id); |
574 |
printf("<input type = \"hidden\" name=\"place_array_HTML\" value =\"%s\">\n", $place_array_HTML); |
575 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertScribeService\" >\n"); |
576 |
|
577 |
// Service drop-down |
578 |
printf("<tr><td colspan=\"2\">Select a Service:<br>\n"); |
579 |
printf("<select name =\"service_id\" size=\"5\" >\n"); |
580 |
dropDownServiceLimit($servicetype_id); |
581 |
printf("</select><br><br>\n"); |
582 |
|
583 |
// Interior table |
584 |
printf("<table border=\"0\" cellpadding=\"4\"><tr><td>\n"); |
585 |
printf("<input type= \"submit\" value=\"Add\">\n"); |
586 |
printf("</form>\n"); |
587 |
printf("</td><td>\n"); |
588 |
|
589 |
// Cancel button |
590 |
printf("<form method =\"POST\" action =\"scribe.phtml?page_id=%d&this_pos=%d#p%d\">\n", |
591 |
$page_id, $position, $position); |
592 |
printf("<input type=\"hidden\" name=\"cmd\" value=\"\">\n"); |
593 |
printf("<input type =\"submit\" value =\"Cancel\">\n"); |
594 |
printf("</form>\n"); |
595 |
|
596 |
// Close interior table |
597 |
printf("</td></tr></table>\n"); |
598 |
|
599 |
// Close exterior table |
600 |
printf("</td></tr></table>\n"); |
601 |
} |
602 |
|
603 |
|
604 |
/********************************************************** |
605 |
Function: addStaff |
606 |
Author: Paul Bramscher |
607 |
Last Modified: 03.11.2004 |
608 |
*********************************************************** |
609 |
Purpose: |
610 |
Select from a list of library staff to add as an |
611 |
element to a PageScribe/CourseLib page. |
612 |
**********************************************************/ |
613 |
function addStaff($place_array, $page_id) { |
614 |
|
615 |
// Break apart place array |
616 |
// $element_id = $place_array[0]; |
617 |
// $element_order = $place_array[1]; |
618 |
// $indent_level = $place_array[2]; |
619 |
// $parent_id = $place_array[3]; |
620 |
$position = $place_array[4]; |
621 |
|
622 |
// Build an HTML passable place array |
623 |
$place_array_HTML = $place_array[0] . "," . $place_array[1] . "," . $place_array[2] . "," . $place_array[3] . "," . $place_array[4]; |
624 |
|
625 |
$position = $place_array[4]; |
626 |
|
627 |
// Table |
628 |
printf("<table width=\"25%%\" class=\"backLight\" border=\"1\" cellpadding=\"4\">\n"); |
629 |
|
630 |
// Add staff form |
631 |
printf("<form method = \"POST\" action = \"scribe_transaction.phtml\">\n"); |
632 |
printf("<input type = \"hidden\" name=\"page_id\" value =\"%d\">\n", $page_id); |
633 |
printf("<input type = \"hidden\" name=\"place_array_HTML\" value =\"%s\">\n", $place_array_HTML); |
634 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"insertScribeStaff\" >\n"); |
635 |
|
636 |
// Row header |
637 |
printf("<tr><td class=\"cellPlain\">\n"); |
638 |
printf("Add Staff"); |
639 |
printf("</td></tr>\n"); |
640 |
|
641 |
// Staff drop-down |
642 |
printf("<tr><td>\n"); |
643 |
printf("<BR><b>Select Staffperson:</b><br>\n"); |
644 |
printf("<select name =\"staff_id\" size=\"5\" >\n"); |
645 |
dropDownStaffOmit(" WHERE staff_id > 1"); |
646 |
printf("</select><br><br>\n"); |
647 |
|
648 |
// Interior table |
649 |
printf("<table border=\"0\" cellpadding=\"4\"><tr><td>\n"); |
650 |
printf("<input type= \"submit\" value=\"Add\">\n"); |
651 |
printf("</form>\n"); |
652 |
printf("</td><td>\n"); |
653 |
|
654 |
// Cancel button |
655 |
printf("<form method =\"POST\" action =\"scribe.phtml?page_id=%d&this_pos=%d#p%d\">\n", |
656 |
$page_id, $position, $position); |
657 |
printf("<input type=\"hidden\" name=\"cmd\" value=\"\">\n"); |
658 |
printf("<input type =\"submit\" value =\"Cancel\">\n"); |
659 |
printf("</form>\n"); |
660 |
|
661 |
// Close interior table |
662 |
printf("</td></tr></table>\n"); |
663 |
|
664 |
// Close exterior table |
665 |
printf("</td></tr></table>\n"); |
666 |
} |
667 |
|
668 |
|
669 |
/********************************************************** |
670 |
Function: buttonDown |
671 |
Author: Paul Bramscher |
672 |
Last Modified: 06.23.2003 |
673 |
*********************************************************** |
674 |
Purpose: |
675 |
Provide a down button for elements on a PageScribe/CourseLib |
676 |
page which may be moved down. |
677 |
**********************************************************/ |
678 |
function buttonDown($page_id, $place_array){ |
679 |
|
680 |
// Break apart place array |
681 |
$element_id = $place_array[0]; |
682 |
$element_order = $place_array[1]; |
683 |
$indent_level = $place_array[2]; |
684 |
$parent_id = $place_array[3]; |
685 |
$position = $place_array[4]; |
686 |
|
687 |
// Move down |
688 |
printf("<a href=\"scribe_transaction.phtml?transaction=elementDown&page_id=%d&element_id=%d&position=%d#p%d\"><img src=\"images/down.jpg\" border=\"0\" alt=\"move down\"></a>\n", $page_id, $element_id, $position, $position); |
689 |
} |
690 |
|
691 |
|
692 |
/********************************************************** |
693 |
Function: buttonUp |
694 |
Author: Paul Bramscher |
695 |
Last Modified: 06.23.2003 |
696 |
*********************************************************** |
697 |
Purpose: |
698 |
Provide a down button for elements on a PageScribe/CourseLib |
699 |
page which may be moved up. |
700 |
**********************************************************/ |
701 |
function buttonUp($page_id, $place_array){ |
702 |
|
703 |
// Break apart place array |
704 |
$element_id = $place_array[0]; |
705 |
$element_order = $place_array[1]; |
706 |
$indent_level = $place_array[2]; |
707 |
$parent_id = $place_array[3]; |
708 |
$position = $place_array[4]; |
709 |
|
710 |
// Move up |
711 |
printf("<a href=\"scribe_transaction.phtml?transaction=elementUp&page_id=%d&element_id=%d&position=%d#p%d\"><img src=\"images/up.jpg\" border=\"0\" alt=\"move up\"></a>\n", $page_id, $element_id, $position, $position); |
712 |
} |
713 |
|
714 |
|
715 |
/********************************************************** |
716 |
Function: copyElement |
717 |
Author: Paul Bramscher |
718 |
Last Modified: 03.11.2004 |
719 |
*********************************************************** |
720 |
Purpose: |
721 |
Query the user to copy either the selected element |
722 |
singly or (if present) all descendants. Note that we also |
723 |
pass the current staff id, since each staffperson has |
724 |
his/her unique copy-paste buffer. |
725 |
**********************************************************/ |
726 |
function copyElement($place_array, $page_id, $element_id, $sess_staff_id) { |
727 |
|
728 |
// Break apart place array |
729 |
// $element_id = $place_array[0]; |
730 |
$element_order = $place_array[1]; |
731 |
$indent_level = $place_array[2]; |
732 |
// $parent_id = $place_array[3]; |
733 |
$position = $place_array[4]; |
734 |
|
735 |
// Build an HTML passable place array |
736 |
$place_array_HTML = $place_array[0] . "," . $place_array[1] . "," . $place_array[2] . "," . $place_array[3] . "," . $place_array[4]; |
737 |
|
738 |
// Table |
739 |
printf("<BR><table width=\"25%%\" class=\"backLight\" border=\"1\">\n"); |
740 |
|
741 |
// Row header |
742 |
printf("<tr><td class=\"cellPlain\">\n"); |
743 |
printf("Copy Element"); |
744 |
printf("</td></tr>\n"); |
745 |
|
746 |
// Determine number of children |
747 |
$num_children = parentIs($element_id, $page_id); |
748 |
|
749 |
// Cut form |
750 |
printf("<form method =\"POST\" action =\"scribe_transaction.phtml\">\n"); |
751 |
printf("<input type =\"hidden\" name =\"transaction\" value =\"copyPasteElement\">\n"); |
752 |
printf("<input type = \"hidden\" name=\"place_array_HTML\" value =\"%s\">\n", $place_array_HTML); |
753 |
printf("<input type =\"hidden\" name =\"page_id\" value =\"%d\">\n", $page_id); |
754 |
printf("<input type =\"hidden\" name =\"sess_staff_id\" value =\"%d\">\n", $sess_staff_id); |
755 |
|
756 |
// Display the element |
757 |
printf("<tr><td>\n"); |
758 |
printf("<b>Item:</b><br>\n"); |
759 |
displayElement($element_id, $page_id); |
760 |
printf("<BR>\n"); |
761 |
|
762 |
if ($num_children > 0) { |
763 |
printf("Element is a parent. How do you wish to copy?<br><br>\n"); |
764 |
printf("<select name =\"copysingle\">\n"); |
765 |
printf("<option value =\"0\" selected>Copy element and all descendants</option>\n"); |
766 |
printf("<option value =\"1\">Copy this element only?</option>\n"); |
767 |
printf("</select><br><br>\n"); |
768 |
} |
769 |
else { |
770 |
printf("<input type =\"hidden\" name =\"copysingle\" value =\"0\">"); |
771 |
printf("Element has no children. Copy this one only.<br><br>"); |
772 |
} |
773 |
|
774 |
// Interior table |
775 |
printf("<table border=\"0\" cellpadding=\"4\"><tr><td>\n"); |
776 |
printf("<input type =\"submit\" value =\"Copy Element\">\n"); |
777 |
printf("</form>\n"); |
778 |
printf("</td><td>\n"); |
779 |
|
780 |
// Cancel button |
781 |
printf("<form method =\"POST\" action =\"scribe.phtml?page_id=%d&this_pos=%d#p%d\">\n", |
782 |
$page_id, $position, $position); |
783 |
printf("<input type=\"hidden\" name=\"cmd\" value=\"\">\n"); |
784 |
printf("<input type =\"submit\" value =\"Cancel\">\n"); |
785 |
printf("</form>\n"); |
786 |
|
787 |
// Close interior table |
788 |
printf("</td></tr></table>\n"); |
789 |
|
790 |
// Close exterior table |
791 |
printf("</td></tr></table>\n"); |
792 |
} |
793 |
|
794 |
|
795 |
/********************************************************** |
796 |
Function: delElement |
797 |
Author: Paul Bramscher |
798 |
Last Modified: 03.11.2004 |
799 |
*********************************************************** |
800 |
Purpose: |
801 |
Query the user to (1) delete the current element only, |
802 |
(2) also delete all children (if available), or (3) promote |
803 |
them to the parent level of the deleted element. |
804 |
**********************************************************/ |
805 |
function delElement($place_array, $page_id, $element_id) { |
806 |
|
807 |
// Break apart place array |
808 |
// $element_id = $place_array[0]; |
809 |
$element_order = $place_array[1]; |
810 |
$indent_level = $place_array[2]; |
811 |
// $parent_id = $place_array[3]; |
812 |
$position = $place_array[4]; |
813 |
|
814 |
// Build an HTML passable place array |
815 |
$place_array_HTML = $place_array[0] . "," . $place_array[1] . "," . $place_array[2] . "," . $place_array[3] . "," . $place_array[4]; |
816 |
|
817 |
// Table |
818 |
printf("<BR><table width=\"25%%\" class=\"backLight\" border=\"1\">\n"); |
819 |
|
820 |
// Row header |
821 |
printf("<tr><td class=\"cellPlain\">\n"); |
822 |
printf("Delete Element"); |
823 |
printf("</td></tr>\n"); |
824 |
|
825 |
// Determine number of children |
826 |
$num_children = parentIs($element_id, $page_id); |
827 |
|
828 |
// Delete form |
829 |
printf("<form method =\"POST\" action =\"scribe_transaction.phtml\">\n"); |
830 |
printf("<input type =\"hidden\" name =\"transaction\" value =\"deleteElement\">\n"); |
831 |
printf("<input type = \"hidden\" name=\"place_array_HTML\" value =\"%s\">\n", $place_array_HTML); |
832 |
printf("<input type =\"hidden\" name =\"page_id\" value =\"%d\">\n", $page_id); |
833 |
|
834 |
// Display the element |
835 |
printf("<tr><td>\n"); |
836 |
printf("<b>Item:</b><br>\n"); |
837 |
displayElement($element_id, $page_id); |
838 |
printf("<BR>\n"); |
839 |
|
840 |
if ($num_children > 0) { |
841 |
printf("Element is a parent. How do you wish to delete?<br><br>\n"); |
842 |
printf("<select name =\"promote\">\n"); |
843 |
printf("<option value =\"1\" selected>Delete element and promote children</option>\n"); |
844 |
printf("<option value =\"2\">Delete element and all descendants</option>\n"); |
845 |
printf("</select><br><br>\n"); |
846 |
} |
847 |
else { |
848 |
printf("<input type =\"hidden\" name =\"promote\" value =\"0\">\n"); |
849 |
printf("Element has no children. Delete this one only.<br><br>\n"); |
850 |
} |
851 |
|
852 |
// Interior table |
853 |
printf("<table border=\"0\" cellpadding=\"4\"><tr><td>\n"); |
854 |
printf("<input type =\"submit\" value =\"Delete!\">\n"); |
855 |
printf("</form>\n"); |
856 |
|
857 |
// Cancel button |
858 |
printf("</td><td>\n"); |
859 |
printf("<form method =\"POST\" action =\"scribe.phtml?page_id=%d&this_pos=%d#p%d\">\n", |
860 |
$page_id, $position, $position); |
861 |
printf("<input type=\"hidden\" name=\"cmd\" value=\"\">\n"); |
862 |
printf("<input type =\"submit\" value =\"Cancel\">\n"); |
863 |
printf("</form>\n"); |
864 |
|
865 |
// Close interior table |
866 |
printf("</td></tr></table>\n"); |
867 |
|
868 |
// Close exterior table |
869 |
printf("</td></tr></table>\n"); |
870 |
} |
871 |
|
872 |
|
873 |
/********************************************************** |
874 |
Function: displayElement |
875 |
Author: Paul Bramscher |
876 |
Last Modified: 03.11.2004 |
877 |
*********************************************************** |
878 |
Purpose: |
879 |
Output the "title" of any element type. Note that this |
880 |
also include free-text label type elements, as well as |
881 |
a concatenated first-name, last-name staff member type |
882 |
element. |
883 |
**********************************************************/ |
884 |
function displayElement ($element_id, $page_id) { |
885 |
|
886 |
// Build a join to cover the possible element types |
887 |
$sql = "SELECT |
888 |
l.location, |
889 |
s.last_name, |
890 |
s.first_name, |
891 |
r.title, |
892 |
e.label, |
893 |
v.service, |
894 |
b.subject |
895 |
FROM |
896 |
element e |
897 |
LEFT JOIN resource r using (resource_id) |
898 |
LEFT JOIN location l on e.location_id = l.location_id |
899 |
LEFT JOIN staff s on e.staff_id = s.staff_id |
900 |
LEFT JOIN service v on e.service_id = v.service_id |
901 |
LEFT JOIN subject b on e.subject_id = b.subject_id |
902 |
WHERE page_id = " |
903 |
. $page_id |
904 |
. " AND element_id = " |
905 |
. $element_id; |
906 |
|
907 |
$rs = xx_tryquery($sql); |
908 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
909 |
|
910 |
// Pull out the possible display values |
911 |
$location = $row["location"]; |
912 |
$last_name = $row["last_name"]; |
913 |
$first_name = $row["first_name"]; |
914 |
$title = $row["title"]; |
915 |
$label = $row["label"]; |
916 |
$service = $row["service"]; |
917 |
$subject = $row["subject"]; |
918 |
|
919 |
// Determine which one |
920 |
if (strlen($title) > 1) printf("%s<br>\n", $title); |
921 |
else if (strlen($label) > 1) printf("%s<br>\n", $label); |
922 |
else if (strlen($location) > 1) printf("%s<br>\n", $location); |
923 |
else if (strlen($service) > 1) printf("%s<br>\n", $service); |
924 |
else if (strlen($subject) > 1) printf("%s<br>\n", $subject); |
925 |
else if (strlen($last_name) > 1) { |
926 |
if (strlen($first_name) > 1) printf("%s", $first_name); |
927 |
printf(" %s<br>\n", $last_name); |
928 |
} |
929 |
|
930 |
} |
931 |
|
932 |
|
933 |
/********************************************************** |
934 |
Function: displayHeader |
935 |
Author: Paul Bramscher |
936 |
Last Modified: 03.11.2004 |
937 |
*********************************************************** |
938 |
Purpose: |
939 |
In edit mode, offer a form to the author of a PageScribe or |
940 |
CourseLib page the ability to edit the page/course title. |
941 |
Note that the actual data is prefixed with either "Page Title" |
942 |
or "Course Title" depending on the type of page it is. |
943 |
**********************************************************/ |
944 |
function displayHeader ($page_id, $page_title, |
945 |
$pagetitle_style, $pagetype_id) { |
946 |
|
947 |
// Determine label name |
948 |
if ($pagetype_id == 3) $label = "Course Title"; |
949 |
else $label = "Page Title"; |
950 |
|
951 |
// Table |
952 |
printf("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td align=\"left\">\n"); |
953 |
|
954 |
// Edit scribe header form |
955 |
printf("<form method=\"POST\" action = \"scribe.phtml?page_id=%d\" >\n", $page_id); |
956 |
printf("<input type = \"Hidden\" name = \"cmd\" value = \"editHeader\" >\n"); |
957 |
if ($pagetitle_style > 0) printf("<b>%s:</b> <span class=\"S%d\">%s</span>\n", $label, $pagetitle_style, $page_title); |
958 |
else printf("<b>%s:</b> %s\n", $label, $page_title); |
959 |
printf("<input type = \"image\" src=\"images/edit.gif\" name =\"edit\" alt=\"edit\">\n"); |
960 |
printf("</td>\n"); |
961 |
|
962 |
// Close form |
963 |
printf("</form>\n"); |
964 |
|
965 |
// Edit page title style |
966 |
printf("<td> "); |
967 |
pageTitleStyle($page_id, $pagetitle_style); |
968 |
|
969 |
// Close table |
970 |
printf("</td></tr></table>\n"); |
971 |
|
972 |
} |
973 |
|
974 |
|
975 |
/********************************************************** |
976 |
Function: editButtons |
977 |
Author: Paul Bramscher |
978 |
Last Modified: 03.11.2004 |
979 |
*********************************************************** |
980 |
Purpose: |
981 |
Display the style elements (1-5) that may be applied to |
982 |
the given element. The currently-enforced style |
983 |
(if non-NULL) is displayed in boldface. If no style |
984 |
is selected, the "X" is bolded. |
985 |
**********************************************************/ |
986 |
function editButtons($element_size, $label_text, $label_url, |
987 |
$place_array, $resource_id, $page_id, $element_id){ |
988 |
|
989 |
// Break apart place array |
990 |
// $element_id = $place_array[0]; |
991 |
// $element_order = $place_array[1]; |
992 |
// $indent_level = $place_array[2]; |
993 |
// $parent_id = $place_array[3]; |
994 |
$position = $place_array[4]; |
995 |
|
996 |
// Initial the bolding variables |
997 |
$bold0 = ""; |
998 |
$bold0_close = ""; |
999 |
$bold1 = ""; |
1000 |
$bold1_close = ""; |
1001 |
$bold2 = ""; |
1002 |
$bold2_close = ""; |
1003 |
$bold3 = ""; |
1004 |
$bold3_close = ""; |
1005 |
$bold4 = ""; |
1006 |
$bold4_close = ""; |
1007 |
$bold5 = ""; |
1008 |
$bold5_close = ""; |
1009 |
|
1010 |
// Display the selected size in bold type |
1011 |
switch ($element_size) { |
1012 |
|
1013 |
case 1: $bold1 = "<b>"; |
1014 |
$bold1_close = "</b>"; |
1015 |
break; |
1016 |
case 2: $bold2 = "<b>"; |
1017 |
$bold2_close = "</b>"; |
1018 |
break; |
1019 |
case 3: $bold3 = "<b>"; |
1020 |
$bold3_close = "</b>"; |
1021 |
break; |
1022 |
|
1023 |
case 4: $bold4 = "<b>"; |
1024 |
$bold4_close = "</b>"; |
1025 |
break; |
1026 |
case 5: $bold5 = "<b>"; |
1027 |
$bold5_close = "</b>"; |
1028 |
break; |
1029 |
default: $bold0 = "<b>"; |
1030 |
$bold0_close = "</b>"; |
1031 |
break; |
1032 |
} |
1033 |
|
1034 |
|
1035 |
// Edit |
1036 |
printf("<a href=\"scribe.phtml?page_id=%d&cmd=editElement&this_pos=%d#p%d\"><img src=\"images/edit.gif\" border=\"0\" alt=\"edit\"></a>\n", $page_id, $position, $position); |
1037 |
|
1038 |
// Delete |
1039 |
printf("<a href=\"scribe.phtml?page_id=%d&cmd=delElement&this_pos=%d#p%d\"><img src=\"images/delete.gif\" border=\"0\" alt=\"delete\"></a>\n", $page_id, $position, $position); |
1040 |
|
1041 |
// Copy |
1042 |
printf("<a href=\"scribe.phtml?page_id=%d&cmd=copyElement&this_pos=%d#p%d\"><img src=\"images/copy.gif\" border=\"0\" alt=\"copy\"></a>\n", $page_id, $position, $position); |
1043 |
|
1044 |
// Element size control |
1045 |
printf("Style: [ %s<a href=\"scribe_transaction.phtml?transaction=elementSize&page_id=%d&element_id=%d&size=0&position=%d#p%d\">X</a>%s | ", $bold0, $page_id, $element_id, $position, $position, $bold0_close); |
1046 |
printf("%s<a href=\"scribe_transaction.phtml?transaction=elementSize&page_id=%d&element_id=%d&size=1&position=%d#p%d\">1</a>%s | ", $bold1, $page_id, $element_id, $position, $position, $bold1_close); |
1047 |
printf("%s<a href=\"scribe_transaction.phtml?transaction=elementSize&page_id=%d&element_id=%d&size=2&position=%d#p%d\">2</a>%s | ", $bold2, $page_id, $element_id, $position, $position, $bold2_close); |
1048 |
printf("%s<a href=\"scribe_transaction.phtml?transaction=elementSize&page_id=%d&element_id=%d&size=3&position=%d#p%d\">3</a>%s | ", $bold3, $page_id, $element_id, $position, $position, $bold3_close); |
1049 |
printf("%s<a href=\"scribe_transaction.phtml?transaction=elementSize&page_id=%d&element_id=%d&size=4&position=%d#p%d\">4</a>%s | ", $bold4, $page_id, $element_id, $position, $position, $bold4_close); |
1050 |
printf("%s<a href=\"scribe_transaction.phtml?transaction=elementSize&page_id=%d&element_id=%d&size=5&position=%d#p%d\">5</a>%s ]\n", $bold5, $page_id, $element_id, $position, $position, $bold5_close); |
1051 |
|
1052 |
|
1053 |
} |
1054 |
|
1055 |
|
1056 |
/********************************************************** |
1057 |
Function: editElement |
1058 |
Author: Paul Bramscher |
1059 |
Last Modified: 03.11.2004 |
1060 |
*********************************************************** |
1061 |
Purpose: |
1062 |
Build a form to edit the incoming element. Depending on |
1063 |
the type of element, different sorts of functionality |
1064 |
occurs. |
1065 |
**********************************************************/ |
1066 |
function editElement($place_array, $page_id, $element_id) { |
1067 |
|
1068 |
// Break apart place array |
1069 |
// $element_id = $place_array[0]; |
1070 |
// $element_order = $place_array[1]; |
1071 |
// $indent_level = $place_array[2]; |
1072 |
// $parent_id = $place_array[3]; |
1073 |
$position = $place_array[4]; |
1074 |
|
1075 |
// Retrieve the element's information |
1076 |
$sql = "SELECT * FROM element e |
1077 |
LEFT JOIN resource r using (resource_id) |
1078 |
LEFT JOIN service v on e.service_id = v.service_id |
1079 |
LEFT JOIN location l on e.location_id = l.location_id |
1080 |
LEFT JOIN staff s on e.staff_id = s.staff_id |
1081 |
LEFT JOIN subject b on e.subject_id = b.subject_id |
1082 |
WHERE page_id = " . $page_id . " AND element_id = " . $element_id |
1083 |
. " ORDER BY e.element_order"; |
1084 |
|
1085 |
$rs = xx_tryquery($sql); |
1086 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
1087 |
|
1088 |
// General element fields |
1089 |
$element_descr = $row["element_descr"]; |
1090 |
|
1091 |
// If a text label |
1092 |
$label = $row["label"]; |
1093 |
$label = textOutHTML($label); |
1094 |
$label_url = $row["label_url"]; |
1095 |
|
1096 |
|
1097 |
// Flag if this is a text label element type, to ensure no blank entries |
1098 |
if (strlen($label) > 0) $label_flag = 1; |
1099 |
else $label_flag = 0; |
1100 |
|
1101 |
// If a resource |
1102 |
$resource_id = $row["resource_id"]; |
1103 |
$annotation = $row["annotation"]; |
1104 |
$url = $row["url"]; |
1105 |
$title = $row["title"]; |
1106 |
$title = textOutHTML($title); |
1107 |
|
1108 |
// If a location |
1109 |
$location_id = $row["location_id"]; |
1110 |
$location = $row["location"]; |
1111 |
$location = textOutHTML($location); |
1112 |
$location_descr = $row["location_descr"]; |
1113 |
$mainURL = $row["mainURL"]; |
1114 |
|
1115 |
// If a staffperson |
1116 |
$staff_id = $row["staff_id"]; |
1117 |
$last_name = $row["last_name"]; |
1118 |
$last_name = textOutHTML($last_name); |
1119 |
$first_name = $row["first_name"]; |
1120 |
$first_name = textOutHTML($first_name); |
1121 |
$staff_account = $row["staff_account"]; |
1122 |
|
1123 |
// If a service |
1124 |
$service = $row["service"]; |
1125 |
$service = textOutHTML($service); |
1126 |
$serviceDescr = $row["serviceDescr"]; |
1127 |
$service_id = $row["service_id"]; |
1128 |
$serviceURL = $row["serviceURL"]; |
1129 |
|
1130 |
// If an RQS subject |
1131 |
$subject = $row["subject"]; |
1132 |
$subject = textOutHTML($subject); |
1133 |
$subject_descr = $row["subject_descr"]; |
1134 |
$subject_id = $row["subject_id"]; |
1135 |
$subjectURL = $GLOBAL_RQS_URL."rqs.phtml?subject_id=".$subject_id; |
1136 |
|
1137 |
// Set flag whether a custom description exists |
1138 |
if (strlen($element_descr) < 1) $descr_status = "Dynamic"; |
1139 |
else $descr_status = "Custom"; |
1140 |
|
1141 |
// Determine the description and label |
1142 |
if ($resource_id > 0) { |
1143 |
$display_label = "<b>(Resource)</b> " . $title; |
1144 |
$display_descr = $annotation; |
1145 |
} |
1146 |
else if ($location_id > 0) { |
1147 |
$display_label = "<b>(Location)</b> " . $location; |
1148 |
$display_descr = $location_descr; |
1149 |
} |
1150 |
else if ($staff_id > 0) { |
1151 |
$display_label = "<b>(Staff)</b> " . $first_name . " " . $last_name; |
1152 |
} |
1153 |
else if ($subject_id > 0) { |
1154 |
$display_label = "<b>(RQS Subject)</b> " . $subject; |
1155 |
$display_descr = $subject_descr; |
1156 |
} |
1157 |
else if ($service_id > 0) { |
1158 |
$display_label = "<b>(Service)</b> " . $service; |
1159 |
$display_descr = $serviceDescr; |
1160 |
} |
1161 |
|
1162 |
// Table |
1163 |
printf("<br><table width =\"45%%\" border=\"1\" class=\"backLight\">\n"); |
1164 |
|
1165 |
// Row header |
1166 |
printf("<tr><td class=\"cellPlain\">\n"); |
1167 |
printf("Edit Element"); |
1168 |
printf("</td></tr>\n"); |
1169 |
|
1170 |
// Edit form |
1171 |
printf("<form method=\"POST\" action = \"scribe_transaction.phtml\" >\n"); |
1172 |
printf("<input type=\"hidden\" name=\"transaction\" value=\"updateScribeElement\">\n"); |
1173 |
printf("<input type=\"hidden\" name=\"element_id\" value=\"%d\">\n", $element_id); |
1174 |
printf("<input type=\"hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
1175 |
printf("<input type=\"hidden\" name=\"position\" value=\"%d\">\n", $position); |
1176 |
printf("<input type=\"hidden\" name=\"label_flag\" value=\"%d\">\n", $label_flag); |
1177 |
|
1178 |
// Item Display |
1179 |
printf("<tr><td>\n"); |
1180 |
printf("<b>Item:</b><br>\n"); |
1181 |
if ($label_flag == 0) printf("%s<br><br>\n", $display_label); |
1182 |
else { |
1183 |
printf("<input type=\"text\" name =\"label\" value=\"%s\" size=\"40\"><br><br>\n", $label); |
1184 |
} |
1185 |
|
1186 |
// If a text label |
1187 |
if ($label_flag == 1) { |
1188 |
printf("<b>Wrap with URL:</b><br>\n"); |
1189 |
|
1190 |
if (strlen($label_url) < 1) $label_url = "http://"; |
1191 |
printf("<input type=\"text\" name=\"label_url\" size = \"55\" value=\"%s\"><br><br>\n", $label_url); |
1192 |
} |
1193 |
|
1194 |
if ($label_flag == 0) { |
1195 |
|
1196 |
// Description status |
1197 |
printf("<b>Current description status:</b> %s<br><br>", $descr_status); |
1198 |
printf("Initially the dynamic description (if any) is supplied below. If you wish to customize, make changes "); |
1199 |
printf("and save. If you don't wish to customize, please cancel this operation. "); |
1200 |
printf("Clearing out all characters (including spaces, etc.) will revert back to the dynamic description. "); |
1201 |
printf("The advantage of dynamic is that changes made to the source record will be reflected here in real-time.<br><br>\n"); |
1202 |
|
1203 |
} |
1204 |
|
1205 |
// Description |
1206 |
printf("<b>Description:</b><br>\n"); |
1207 |
if (strlen($element_descr) < 1) $element_descr = $display_descr; |
1208 |
printf("<textarea name =\"element_descr\" rows=\"5\" cols=\"45\">\n"); |
1209 |
printf("%s", $element_descr); |
1210 |
printf("</textarea><br><br>\n"); |
1211 |
|
1212 |
// Interior table |
1213 |
printf("<table border=\"0\" cellpadding=\"4\"><tr><td>\n"); |
1214 |
if ($label_flag == 1) printf("<input type= \"submit\" value=\"Save Changes\">\n"); |
1215 |
else printf("<input type= \"submit\" value=\"Save Custom Description\">\n"); |
1216 |
printf("</form>\n"); |
1217 |
printf("</td><td>\n"); |
1218 |
|
1219 |
printf("<form method =\"POST\" action =\"scribe.phtml?page_id=%d&this_pos=%d#p%d\">\n", |
1220 |
$page_id, $position, $position); |
1221 |
printf("<input type=\"hidden\" name=\"cmd\" value=\"\">\n"); |
1222 |
printf("<input type =\"submit\" value =\"Cancel\">\n"); |
1223 |
printf("</form>\n"); |
1224 |
|
1225 |
// Close interior table |
1226 |
printf("</td></tr></table>\n"); |
1227 |
|
1228 |
// Close exterior table |
1229 |
printf("</td></tr></table>\n"); |
1230 |
|
1231 |
} |
1232 |
|
1233 |
|
1234 |
/********************************************************** |
1235 |
Function: editHeader |
1236 |
Author: Paul Bramscher |
1237 |
Last Modified: 03.11.2004 |
1238 |
*********************************************************** |
1239 |
Purpose: |
1240 |
Form to edit the supplied page_id title. |
1241 |
**********************************************************/ |
1242 |
function editHeader ($course_id, $page_id, $page_title, $pagetype_id) { |
1243 |
|
1244 |
// Determine label name |
1245 |
if ($pagetype_id == 3) $label = "Course Title"; |
1246 |
else $label = "Page Title"; |
1247 |
|
1248 |
// Edit scribe header form |
1249 |
printf("<form method=\"POST\" action = \"scribe_transaction.phtml\" >\n"); |
1250 |
printf("<b>%s:</b><br>\n", $label); |
1251 |
printf("<textarea name =\"page_title\" rows = \"3\" cols = \"50\">\n"); |
1252 |
printf("%s", $page_title); |
1253 |
printf("</textarea>\n "); |
1254 |
|
1255 |
// Save or cancel |
1256 |
printf("<input type=\"submit\" value =\"Save\">\n"); |
1257 |
printf("<a href=\"scribe.phtml?page_id=%d\">Cancel</a>\n", $page_id); |
1258 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"updateScribeHeader\" >\n"); |
1259 |
printf("<input type = \"hidden\" name=\"page_id\" value =\"%d\">\n", $page_id); |
1260 |
printf("<input type = \"hidden\" name=\"pagetype_id\" value=\"%d\">\n", $pagetype_id); |
1261 |
printf("<input type = \"hidden\" name=\"course_id\" value=\"%d\">\n", $course_id); |
1262 |
|
1263 |
// Close form |
1264 |
printf("</form>\n"); |
1265 |
} |
1266 |
|
1267 |
|
1268 |
/********************************************************** |
1269 |
Function: formAssignPageStaff |
1270 |
Author: Paul Bramscher |
1271 |
Last Modified: 03.11.2004 |
1272 |
*********************************************************** |
1273 |
Purpose: |
1274 |
Assign authoring staff to the supplied page id. This may |
1275 |
be as primary coordinator, or secondary maintainers with |
1276 |
access. By default, of course, the creator of the page is |
1277 |
coordinator. Assigning him/her as a secondary maintainer |
1278 |
(in addition to coordinator) offers no benefits. |
1279 |
**********************************************************/ |
1280 |
function formAssignPageStaff($page_id, $staff_coordinator){ |
1281 |
|
1282 |
// Table definition |
1283 |
printf("<center>\n"); |
1284 |
printf("<table width=\"\80%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\" >\n"); |
1285 |
printf("<tr><td colspan=\"2\" class=\"cellPlain\">\n"); |
1286 |
printf("Assign Page Staff"); |
1287 |
printf("</td></tr>\n"); |
1288 |
|
1289 |
// Primary coordinator |
1290 |
printf("<tr><td colspan=\"2\">\n"); |
1291 |
printf("<center>\n"); |
1292 |
printf("<form method = \"POST\" action = \"scribe_transaction.phtml\" >\n"); |
1293 |
printf("<input type = \"Hidden\" name = \"page_id\" value = \"%d\" >\n", $page_id); |
1294 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignStaffCoordinator\" >\n"); |
1295 |
printf("<b>Page Coordinator:</b> "); |
1296 |
printf("<select name =\"staff_coordinator\">\n"); |
1297 |
dropDownStaffSelected($staff_coordinator); |
1298 |
printf("</select>\n"); |
1299 |
printf("<input type=\"submit\" value=\"Reassign Coordinator!\"><br>\n"); |
1300 |
printf("</center>\n"); |
1301 |
printf("<B>Important Note:</b> You may accidentally remove your own access to this page if you remove "); |
1302 |
printf("yourself as coordinator, are not listed as a maintainer, and do not have cross-page editing access."); |
1303 |
printf("</form></td></tr>\n"); |
1304 |
|
1305 |
// Available staff |
1306 |
// Omit the '(N/A)' staff |
1307 |
$omit_string = "WHERE staff_id > 1"; |
1308 |
|
1309 |
// Omit any pre-selected staff in page_staff |
1310 |
$in_string = getNotIn("staff_id", "page_id", $page_id, "page_staff"); |
1311 |
if (strlen($in_string) > 0) $omit_string .= " AND staff_id NOT IN " . $in_string; |
1312 |
|
1313 |
// Form for maintainer assignments |
1314 |
printf("<form method = \"POST\" action = \"scribe_transaction.phtml\" >\n"); |
1315 |
printf("<input type = \"Hidden\" name = \"page_id\" value = \"%d\" >\n", $page_id); |
1316 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"assignPageStaff\" >\n"); |
1317 |
|
1318 |
// Available staff |
1319 |
printf("<tr><td valign = \"top\" >\n"); |
1320 |
printf("<br><b>Available Maintainers:<br></b>\n"); |
1321 |
printf("<select name = \"staff_id_array[]\" multiple size = \"5\" >\n"); |
1322 |
dropDownStaffOmit($omit_string); |
1323 |
printf("</select><br><br>\n"); |
1324 |
printf("<center>\n"); |
1325 |
printf("<input type = \"Submit\" value = \" >> \" >\n"); |
1326 |
printf("</center>\n"); |
1327 |
printf("</form>\n"); |
1328 |
printf("</td>\n"); |
1329 |
|
1330 |
// Current staff |
1331 |
printf("<td valign = \"top\" >\n"); |
1332 |
printf("<form method = \"POST\" action = \"scribe_transaction.phtml\" >\n"); |
1333 |
printf("<input type = \"Hidden\" name = \"page_id\" value = \"%d\" >\n", $page_id); |
1334 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deletePageStaff\" >\n"); |
1335 |
printf("<br><b>Selected Maintainers:</b><br>\n"); |
1336 |
printf("<select name =\"staff_list_array[]\" multiple size = 5>\n"); |
1337 |
dropDownPageStaff($page_id); |
1338 |
printf("</select><br><br>\n"); |
1339 |
printf("<center>\n"); |
1340 |
printf("<input type = \"Submit\" value =\" << \">\n"); |
1341 |
printf("</center>\n"); |
1342 |
printf("</form>\n"); |
1343 |
printf("</td></tr>\n"); |
1344 |
|
1345 |
// Close window |
1346 |
printf("<tr><td align=\"center\" colspan=\"2\">\n"); |
1347 |
printf("<form method =\"POST\" action=\"scribe.phtml?page_id=%d\">\n", $page_id); |
1348 |
printf("<input type=\"submit\" value=\"Close This Window\">\n"); |
1349 |
printf("</form>\n"); |
1350 |
printf("</td></tr>\n"); |
1351 |
|
1352 |
// Close table |
1353 |
printf("</table>\n"); |
1354 |
printf("</center><br>\n"); |
1355 |
} |
1356 |
|
1357 |
|
1358 |
/********************************************************** |
1359 |
Function: formCourse |
1360 |
Author: Paul Bramscher |
1361 |
Last Modified: 03.11.2004 |
1362 |
*********************************************************** |
1363 |
Purpose: |
1364 |
This function draws out CourseLib specific fields and |
1365 |
offers them as forms available for edit. Note that the |
1366 |
"active" variable, if set to a corresponding field name, |
1367 |
will turn one of the fields into an active edit-mode form. |
1368 |
While inactive, the form -- when clicked -- turns that field |
1369 |
active. |
1370 |
**********************************************************/ |
1371 |
function formCourse($active, $page_id) { |
1372 |
|
1373 |
// Retrieve current information |
1374 |
$sql = "SELECT |
1375 |
c.course_id, |
1376 |
c.coursesub_id, |
1377 |
c.course_num, |
1378 |
c.course_section, |
1379 |
c.term_id, |
1380 |
c.course_year, |
1381 |
c.campus_id, |
1382 |
c.courseheader, |
1383 |
c.introheader1, |
1384 |
c.intromessage1, |
1385 |
c.introheader2, |
1386 |
c.intromessage2, |
1387 |
s.coursesub, |
1388 |
t.term, |
1389 |
p.campus, |
1390 |
g.published |
1391 |
|
1392 |
FROM |
1393 |
course c |
1394 |
LEFT JOIN term t using (term_id) |
1395 |
LEFT JOIN campus p on c.campus_id = p.campus_id |
1396 |
LEFT JOIN coursesub s on c.coursesub_id = s.coursesub_id |
1397 |
LEFT JOIN page g on c.page_id = g.page_id |
1398 |
|
1399 |
WHERE |
1400 |
c.page_id = " . $page_id; |
1401 |
$rs = xx_tryquery($sql); |
1402 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
1403 |
|
1404 |
$course_id = $row["course_id"]; |
1405 |
$staff_id_created = $row["staff_id_created"]; |
1406 |
$staff_id_edited = $row["staff_id_edited"]; |
1407 |
$coursesub_id = $row["coursesub_id"]; |
1408 |
$coursesub = $row["coursesub"]; |
1409 |
$course_num = $row["course_num"]; |
1410 |
$course_section = $row["course_section"]; |
1411 |
$term_id = $row["term_id"]; |
1412 |
$term = $row["term"]; |
1413 |
$course_year = $row["course_year"]; |
1414 |
$campus_id = $row["campus_id"]; |
1415 |
$campus = $row["campus"]; |
1416 |
$courseheader = $row["courseheader"]; |
1417 |
$introheader1 = $row["introheader1"]; |
1418 |
$intromessage1 = $row["intromessage1"]; |
1419 |
$introheader2 = $row["introheader2"]; |
1420 |
$intromessage2 = $row["intromessage2"]; |
1421 |
$published = $row["published"]; |
1422 |
|
1423 |
// Run strings through the HTML cleaner for output |
1424 |
$course_title = textOutHTML($course_title); |
1425 |
$course_section = textOutHTML($course_section); |
1426 |
$introheader1 = textOutHTML($introheader1); |
1427 |
$introheader2 = textOutHTML($introheader2); |
1428 |
|
1429 |
// Table |
1430 |
printf("<table width=\"100%%\" border =\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"); |
1431 |
|
1432 |
|
1433 |
/*********************** |
1434 |
** Course Page Header ** |
1435 |
***********************/ |
1436 |
|
1437 |
printf("<tr><td width=\"25%%\"><b>Course Page Header:</b></td>\n"); |
1438 |
|
1439 |
|
1440 |
// Active |
1441 |
if ($active == "courseheader") { |
1442 |
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
1443 |
printf("<td colspan=\"3\">\n"); |
1444 |
printf("<input type=\"Hidden\" name=\"transaction\" value=\"updateScribeCourse\">\n"); |
1445 |
printf("<input type=\"Hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
1446 |
printf("<input type=\"Hidden\" name=\"course_id\" value=\"%d\">\n", $course_id); |
1447 |
printf("<input type=\"Hidden\" name=\"field_name\" value=\"courseheader\">\n"); |
1448 |
printf("<input type =\"text\" size=\"50\" name=\"field_value\" value = \"%s\" >\n", $courseheader); |
1449 |
|
1450 |
// Save or cancel |
1451 |
printf("<input type=\"submit\" value =\"Save\">\n"); |
1452 |
printf("<a href=\"scribe.phtml?page_id=%d\">Cancel</a>\n", $page_id); |
1453 |
printf("</td>\n"); |
1454 |
printf("</form>\n"); |
1455 |
|
1456 |
} |
1457 |
|
1458 |
// Inactive |
1459 |
else { |
1460 |
printf("<form method=\"POST\" action=\"scribe.phtml?page_id=%d\">\n", $page_id); |
1461 |
printf("<td colspan=\"3\">\n"); |
1462 |
printf("<input type=\"Hidden\" name=\"active\" value=\"courseheader\">\n"); |
1463 |
printf("%s ", $courseheader); |
1464 |
printf("<input type = \"image\" src=\"images/edit.gif\" name =\"edit\" alt=\"edit\">\n"); |
1465 |
printf("</td>\n"); |
1466 |
printf("</form>\n"); |
1467 |
} |
1468 |
printf("</tr>\n"); |
1469 |
|
1470 |
|
1471 |
/******************* |
1472 |
** Course Subject ** |
1473 |
*******************/ |
1474 |
|
1475 |
|
1476 |
printf("<tr><td><b>Course Designator (required):</b></td>\n"); |
1477 |
|
1478 |
// Active |
1479 |
if ($active == "coursesub") { |
1480 |
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
1481 |
printf("<td colspan=\"3\">\n"); |
1482 |
printf("<input type=\"Hidden\" name=\"transaction\" value=\"updateScribeCourse\">\n"); |
1483 |
printf("<input type=\"Hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
1484 |
printf("<input type=\"Hidden\" name=\"course_id\" value=\"%d\">\n", $course_id); |
1485 |
printf("<input type=\"Hidden\" name=\"field_name\" value=\"coursesub_id\">\n"); |
1486 |
printf("<select name =\"field_value\">\n"); |
1487 |
|
1488 |
// Published pages may not be set to N/A or null course designators |
1489 |
$limit = ""; |
1490 |
if ($published == 1) $limit = " WHERE coursesub_id > 1"; |
1491 |
dropDownCoursesubSelected($limit, $coursesub_id); |
1492 |
printf("</select> \n"); |
1493 |
|
1494 |
// Save or cancel |
1495 |
printf("<input type=\"submit\" value =\"Save\">\n"); |
1496 |
printf("<a href=\"scribe.phtml?page_id=%d\">Cancel</a>\n", $page_id); |
1497 |
printf("</td>\n"); |
1498 |
printf("</form>\n"); |
1499 |
} |
1500 |
|
1501 |
// Inactive |
1502 |
else { |
1503 |
printf("<form method=\"POST\" action=\"scribe.phtml?page_id=%d\">\n", $page_id); |
1504 |
printf("<td colspan=\"3\">\n"); |
1505 |
printf("<input type=\"Hidden\" name=\"active\" value=\"coursesub\">\n"); |
1506 |
printf("%s ", $coursesub); |
1507 |
printf("<input type = \"image\" src=\"images/edit.gif\" name =\"edit\" alt=\"edit\">\n"); |
1508 |
printf("</td>\n"); |
1509 |
printf("</form>\n"); |
1510 |
} |
1511 |
|
1512 |
printf("</tr>\n"); |
1513 |
|
1514 |
/****************** |
1515 |
** Course Number ** |
1516 |
******************/ |
1517 |
|
1518 |
printf("<tr><td align=\"left\"><b>Course Number</b>: </td>\n"); |
1519 |
|
1520 |
|
1521 |
// Active |
1522 |
if ($active == "course_num") { |
1523 |
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
1524 |
printf("<td width=\"25%%\">\n"); |
1525 |
printf("<input type=\"Hidden\" name=\"transaction\" value=\"updateScribeCourse\">\n"); |
1526 |
printf("<input type=\"Hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
1527 |
printf("<input type=\"Hidden\" name=\"course_id\" value=\"%d\">\n", $course_id); |
1528 |
printf("<input type=\"Hidden\" name=\"field_name\" value=\"course_num\">\n"); |
1529 |
printf("<input type =\"text\" size=\"10\" name=\"field_value\" value = \"%s\" >\n", $course_num); |
1530 |
|
1531 |
// Save or cancel |
1532 |
printf("<input type=\"submit\" value =\"Save\">\n"); |
1533 |
printf("<a href=\"scribe.phtml?page_id=%d\">Cancel</a>\n", $page_id); |
1534 |
printf("</td>\n"); |
1535 |
printf("</form>\n"); |
1536 |
} |
1537 |
|
1538 |
// Inactive |
1539 |
else { |
1540 |
printf("<form method=\"POST\" action=\"scribe.phtml?page_id=%d\">\n", $page_id); |
1541 |
printf("<td width=\"25%%\">\n"); |
1542 |
printf("<input type=\"Hidden\" name=\"active\" value=\"course_num\">\n"); |
1543 |
printf("%s ", $course_num); |
1544 |
printf("<input type = \"image\" src=\"images/edit.gif\" name =\"edit\" alt=\"edit\">\n"); |
1545 |
printf("</td>\n"); |
1546 |
printf("</form>\n"); |
1547 |
} |
1548 |
|
1549 |
|
1550 |
/******************* |
1551 |
** Course Section ** |
1552 |
*******************/ |
1553 |
|
1554 |
|
1555 |
printf("<td align=\"right\" width=\"25%%\"><b>Section:</b> </td>\n"); |
1556 |
|
1557 |
// Active |
1558 |
if ($active == "course_section") { |
1559 |
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
1560 |
printf("<td width=\"25%%\">\n"); |
1561 |
printf("<input type=\"Hidden\" name=\"transaction\" value=\"updateScribeCourse\">\n"); |
1562 |
printf("<input type=\"Hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
1563 |
printf("<input type=\"Hidden\" name=\"course_id\" value=\"%d\">\n", $course_id); |
1564 |
printf("<input type=\"Hidden\" name=\"field_name\" value=\"course_section\">\n"); |
1565 |
printf("<input type =\"text\" size=\"10\" name=\"field_value\" value = \"%s\" >\n", $course_section); |
1566 |
|
1567 |
// Save or cancel |
1568 |
printf("<input type=\"submit\" value =\"Save\">\n"); |
1569 |
printf("<a href=\"scribe.phtml?page_id=%d\">Cancel</a>\n", $page_id); |
1570 |
printf("</td>\n"); |
1571 |
printf("</form>\n"); |
1572 |
} |
1573 |
|
1574 |
// Inactive |
1575 |
else { |
1576 |
printf("<form method=\"POST\" action=\"scribe.phtml?page_id=%d\">\n", $page_id); |
1577 |
printf("<td width=\"25%%\">\n"); |
1578 |
printf("<input type=\"Hidden\" name=\"active\" value=\"course_section\">\n"); |
1579 |
printf("%s ", $course_section); |
1580 |
printf("<input type = \"image\" src=\"images/edit.gif\" name =\"edit\" alt=\"edit\">\n"); |
1581 |
printf("</td>\n"); |
1582 |
printf("</form>\n"); |
1583 |
} |
1584 |
printf("</tr>\n"); |
1585 |
|
1586 |
|
1587 |
/*********** |
1588 |
** Campus ** |
1589 |
***********/ |
1590 |
|
1591 |
printf("<tr><td><b>Campus:</b></td>\n"); |
1592 |
|
1593 |
// Active |
1594 |
if ($active == "campus") { |
1595 |
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
1596 |
printf("<td colspan=\"3\">\n"); |
1597 |
printf("<input type=\"Hidden\" name=\"transaction\" value=\"updateScribeCourse\">\n"); |
1598 |
printf("<input type=\"Hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
1599 |
printf("<input type=\"Hidden\" name=\"course_id\" value=\"%d\">\n", $course_id); |
1600 |
printf("<input type=\"Hidden\" name=\"field_name\" value=\"campus_id\">\n"); |
1601 |
printf("<select name =\"field_value\">\n"); |
1602 |
dropDownFieldSelected("campus", "campus", "campus_id", " WHERE campus_id > 0", $campus_id); |
1603 |
printf("</select> \n"); |
1604 |
|
1605 |
// Save or cancel |
1606 |
printf("<input type=\"submit\" value =\"Save\">\n"); |
1607 |
printf("<a href=\"scribe.phtml?page_id=%d\">Cancel</a>\n", $page_id); |
1608 |
printf("</td>\n"); |
1609 |
printf("</form>\n"); |
1610 |
} |
1611 |
|
1612 |
// Inactive |
1613 |
else { |
1614 |
printf("<form method=\"POST\" action=\"scribe.phtml?page_id=%d\">\n", $page_id); |
1615 |
printf("<td colspan=\"3\">\n"); |
1616 |
printf("<input type=\"Hidden\" name=\"active\" value=\"campus\">\n"); |
1617 |
printf("%s ", $campus); |
1618 |
printf("<input type = \"image\" src=\"images/edit.gif\" name =\"edit\" alt=\"edit\">\n"); |
1619 |
printf("</td>\n"); |
1620 |
printf("</form>\n"); |
1621 |
} |
1622 |
printf("</tr>\n");; |
1623 |
|
1624 |
|
1625 |
/********* |
1626 |
** Term ** |
1627 |
*********/ |
1628 |
|
1629 |
printf("<tr><td><b>Term:</b></td>\n"); |
1630 |
|
1631 |
// Active |
1632 |
if ($active == "term") { |
1633 |
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
1634 |
printf("<td>\n"); |
1635 |
printf("<input type=\"Hidden\" name=\"transaction\" value=\"updateScribeCourse\">\n"); |
1636 |
printf("<input type=\"Hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
1637 |
printf("<input type=\"Hidden\" name=\"course_id\" value=\"%d\">\n", $course_id); |
1638 |
printf("<input type=\"Hidden\" name=\"field_name\" value=\"term_id\">\n"); |
1639 |
printf("<select name =\"field_value\">\n"); |
1640 |
dropDownFieldSelected("term", "term", "term_id", " WHERE term_id > 0", $term_id); |
1641 |
printf("</select> \n"); |
1642 |
|
1643 |
// Save or cancel |
1644 |
printf("<input type=\"submit\" value =\"Save\">\n"); |
1645 |
printf("<a href=\"scribe.phtml?page_id=%d\">Cancel</a>\n", $page_id); |
1646 |
printf("</td>\n"); |
1647 |
printf("</form>\n"); |
1648 |
} |
1649 |
|
1650 |
// Inactive |
1651 |
else { |
1652 |
printf("<form method=\"POST\" action=\"scribe.phtml?page_id=%d\">\n", $page_id); |
1653 |
printf("<td>\n"); |
1654 |
printf("<input type=\"Hidden\" name=\"active\" value=\"term\">\n"); |
1655 |
printf("%s ", $term); |
1656 |
printf("<input type = \"image\" src=\"images/edit.gif\" name =\"edit\" alt=\"edit\">\n"); |
1657 |
printf("</td>\n"); |
1658 |
printf("</form>\n"); |
1659 |
} |
1660 |
|
1661 |
/********* |
1662 |
** Year ** |
1663 |
*********/ |
1664 |
|
1665 |
printf("<td align =\"right\" ><b>Year:</b> </td>\n"); |
1666 |
|
1667 |
// Active |
1668 |
if ($active == "course_year") { |
1669 |
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
1670 |
printf("<td>\n"); |
1671 |
printf("<input type=\"Hidden\" name=\"transaction\" value=\"updateScribeCourse\">\n"); |
1672 |
printf("<input type=\"Hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
1673 |
printf("<input type=\"Hidden\" name=\"course_id\" value=\"%d\">\n", $course_id); |
1674 |
printf("<input type=\"Hidden\" name=\"field_name\" value=\"course_year\">\n"); |
1675 |
printf("<input type =\"text\" size=\"6\" name=\"field_value\" value = \"%s\" >\n", $course_year); |
1676 |
|
1677 |
// Save or cancel |
1678 |
printf("<input type=\"submit\" value =\"Save\">\n"); |
1679 |
printf("<a href=\"scribe.phtml?page_id=%d\">Cancel</a>\n", $page_id); |
1680 |
printf("</td>\n"); |
1681 |
printf("</form>\n"); |
1682 |
} |
1683 |
|
1684 |
// Inactive |
1685 |
else { |
1686 |
printf("<form method=\"POST\" action=\"scribe.phtml?page_id=%d\">", $page_id); |
1687 |
printf("<td>\n"); |
1688 |
printf("<input type=\"Hidden\" name=\"active\" value=\"course_year\">"); |
1689 |
printf("%s ", $course_year); |
1690 |
printf("<input type = \"image\" src=\"images/edit.gif\" name =\"edit\" alt=\"edit\">\n"); |
1691 |
printf("</td>\n"); |
1692 |
printf("</form>\n"); |
1693 |
} |
1694 |
printf("</tr>\n"); |
1695 |
|
1696 |
|
1697 |
/******************* |
1698 |
** Intro Header 1 ** |
1699 |
*******************/ |
1700 |
|
1701 |
printf("<tr><td align=\"center\" colspan=\"4\"><br><b>Introductory Header 1:</b></td></tr>\n"); |
1702 |
printf("<tr><td align=\"center\" valign=\"middle\" colspan=\"6\">\n"); |
1703 |
|
1704 |
// Active |
1705 |
if ($active == "introheader1") { |
1706 |
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
1707 |
printf("<input type=\"Hidden\" name=\"transaction\" value=\"updateScribeCourse\">\n"); |
1708 |
printf("<input type=\"Hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
1709 |
printf("<input type=\"Hidden\" name=\"course_id\" value=\"%d\">\n", $course_id); |
1710 |
printf("<input type=\"Hidden\" name=\"field_name\" value=\"introheader1\">\n"); |
1711 |
printf("<input type =\"text\" size=\"30\" name=\"field_value\" value = \"%s\" >\n", $introheader1); |
1712 |
|
1713 |
// Save or cancel |
1714 |
printf("<input type=\"submit\" value =\"Save\">\n"); |
1715 |
printf("<a href=\"scribe.phtml?page_id=%d\">Cancel</a>\n", $page_id); |
1716 |
printf("</form>\n"); |
1717 |
} |
1718 |
|
1719 |
// Inactive |
1720 |
else { |
1721 |
printf("<form method=\"POST\" action=\"scribe.phtml?page_id=%d\">\n", $page_id); |
1722 |
printf("<input type=\"Hidden\" name=\"active\" value=\"introheader1\">\n"); |
1723 |
printf("%s ", $introheader1); |
1724 |
printf("<input type = \"image\" src=\"images/edit.gif\" name =\"edit\" alt=\"edit\">\n"); |
1725 |
printf("</form>\n"); |
1726 |
} |
1727 |
printf("</td></tr>\n"); |
1728 |
|
1729 |
|
1730 |
/******************** |
1731 |
** Intro Message 1 ** |
1732 |
********************/ |
1733 |
|
1734 |
printf("<tr><td colspan=\"4\"><b>Introductory Message 1:</b></td></tr>\n"); |
1735 |
printf("<tr><td align=\"left\" valign=\"middle\" colspan=\"6\">\n"); |
1736 |
|
1737 |
// Active |
1738 |
if ($active == "intromessage1") { |
1739 |
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
1740 |
printf("<input type=\"Hidden\" name=\"transaction\" value=\"updateScribeCourse\">\n"); |
1741 |
printf("<input type=\"Hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
1742 |
printf("<input type=\"Hidden\" name=\"course_id\" value=\"%d\">\n", $course_id); |
1743 |
printf("<input type=\"Hidden\" name=\"field_name\" value=\"intromessage1\">\n"); |
1744 |
printf("<textarea rows=\"5\" cols=\"65\" name =\"field_value\" >\n"); |
1745 |
printf("%s", $intromessage1); |
1746 |
printf("</textarea>\n"); |
1747 |
|
1748 |
// Save or cancel |
1749 |
printf("<input type=\"submit\" value =\"Save\">\n"); |
1750 |
printf("<a href=\"scribe.phtml?page_id=%d\">Cancel</a>\n", $page_id); |
1751 |
printf("</form>\n"); |
1752 |
} |
1753 |
|
1754 |
// Inactive |
1755 |
else { |
1756 |
printf("<form method=\"POST\" action=\"scribe.phtml?page_id=%d\">", $page_id); |
1757 |
printf("<input type=\"Hidden\" name=\"active\" value=\"intromessage1\">"); |
1758 |
printf("%s ", $intromessage1); |
1759 |
printf("<input type = \"image\" src=\"images/edit.gif\" name =\"edit\" alt=\"edit\">\n"); |
1760 |
printf("</form>\n"); |
1761 |
} |
1762 |
printf("<br></td></tr>\n"); |
1763 |
|
1764 |
|
1765 |
/******************* |
1766 |
** Intro Header 2 ** |
1767 |
*******************/ |
1768 |
|
1769 |
printf("<tr><td align=\"center\" colspan=\"4\"><b>Introductory Header 2:</b></td></tr>\n"); |
1770 |
printf("<tr><td align=\"center\" valign=\"middle\" colspan=\"4\">\n"); |
1771 |
|
1772 |
// Active |
1773 |
if ($active == "introheader2") { |
1774 |
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
1775 |
printf("<input type=\"Hidden\" name=\"transaction\" value=\"updateScribeCourse\">\n"); |
1776 |
printf("<input type=\"Hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
1777 |
printf("<input type=\"Hidden\" name=\"course_id\" value=\"%d\">\n", $course_id); |
1778 |
printf("<input type=\"Hidden\" name=\"field_name\" value=\"introheader2\">\n"); |
1779 |
printf("<input type =\"text\" size=\"30\" name=\"field_value\" value = \"%s\" >\n", $introheader2); |
1780 |
|
1781 |
// Save or cancel |
1782 |
printf("<input type=\"submit\" value =\"Save\">\n"); |
1783 |
printf("<a href=\"scribe.phtml?page_id=%d\">Cancel</a>\n", $page_id); |
1784 |
printf("</form>\n"); |
1785 |
} |
1786 |
|
1787 |
// Inactive |
1788 |
else { |
1789 |
printf("<form method=\"POST\" action=\"scribe.phtml?page_id=%d\">\n", $page_id); |
1790 |
printf("<input type=\"Hidden\" name=\"active\" value=\"introheader2\">\n"); |
1791 |
printf("%s ", $introheader2); |
1792 |
printf("<input type = \"image\" src=\"images/edit.gif\" name =\"edit\" alt=\"edit\">\n"); |
1793 |
printf("</form>\n"); |
1794 |
} |
1795 |
printf("</td></tr>\n"); |
1796 |
|
1797 |
/******************** |
1798 |
** Intro Message 2 ** |
1799 |
********************/ |
1800 |
|
1801 |
printf("<tr><td colspan=\"4\"><b>Introductory Message 2:</b></td></tr>\n"); |
1802 |
printf("<tr><td align=\"left\" valign=\"middle\" colspan=\"4\">\n"); |
1803 |
|
1804 |
// Active |
1805 |
if ($active == "intromessage2") { |
1806 |
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
1807 |
printf("<input type=\"Hidden\" name=\"transaction\" value=\"updateScribeCourse\">\n"); |
1808 |
printf("<input type=\"Hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
1809 |
printf("<input type=\"Hidden\" name=\"course_id\" value=\"%d\">\n", $course_id); |
1810 |
printf("<input type=\"Hidden\" name=\"field_name\" value=\"intromessage2\">\n"); |
1811 |
printf("<textarea rows=\"5\" cols=\"65\" name =\"field_value\" >\n"); |
1812 |
printf("%s", $intromessage2); |
1813 |
printf("</textarea>\n"); |
1814 |
|
1815 |
// Save or cancel |
1816 |
printf("<input type=\"submit\" value =\"Save\">\n"); |
1817 |
printf("<a href=\"scribe.phtml?page_id=%d\">Cancel</a>\n", $page_id); |
1818 |
printf("</form>\n"); |
1819 |
} |
1820 |
|
1821 |
// Inactive |
1822 |
else { |
1823 |
printf("<form method=\"POST\" action=\"scribe.phtml?page_id=%d\">\n", $page_id); |
1824 |
printf("<input type=\"Hidden\" name=\"active\" value=\"intromessage2\">\n"); |
1825 |
printf("%s ", $intromessage2); |
1826 |
printf("<input type = \"image\" src=\"images/edit.gif\" name =\"edit\" alt=\"edit\">\n"); |
1827 |
printf("</form>\n"); |
1828 |
} |
1829 |
printf("<br></td></tr>\n"); |
1830 |
|
1831 |
// Close table |
1832 |
printf("</table>\n"); |
1833 |
|
1834 |
} |
1835 |
|
1836 |
|
1837 |
/********************************************************** |
1838 |
Function: formCoursePers |
1839 |
Author: Paul Bramscher |
1840 |
Last Modified: 03.11.2004 |
1841 |
*********************************************************** |
1842 |
Purpose: |
1843 |
Allows the selection of existing LibData library staff, |
1844 |
faculty (drawn from the faculty table), or creation of |
1845 |
on-the-fly and non-indexed TA/other staff. Also, it is |
1846 |
possible here to create faculty on the fly. |
1847 |
**********************************************************/ |
1848 |
function formCoursePers($active, $course_id, $page_id) { |
1849 |
|
1850 |
// Retrieve current information |
1851 |
$sql = "SELECT * |
1852 |
FROM |
1853 |
course_personnel cp |
1854 |
LEFT JOIN staff s using (staff_id) |
1855 |
LEFT JOIN stafftitle st on cp.stafftitle_id = st.stafftitle_id |
1856 |
LEFT JOIN faculty f on cp.faculty_id = f.faculty_id |
1857 |
|
1858 |
WHERE |
1859 |
course_id = " . $course_id . " ORDER BY personnel_id"; |
1860 |
|
1861 |
$rs = xx_tryquery($sql); |
1862 |
|
1863 |
// Table |
1864 |
printf("<table cellpadding = \"0\" cellspacing = \"4\" >\n"); |
1865 |
|
1866 |
// Display course personnel |
1867 |
printf("<tr><td colspan=\"2\">\n"); |
1868 |
|
1869 |
// Add course personnel anchor |
1870 |
printf("<a name=\"coursePers\"></a>\n"); |
1871 |
|
1872 |
printf("<b>Personnel:</b><br>\n"); |
1873 |
printf("</td></tr>\n"); |
1874 |
|
1875 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
1876 |
|
1877 |
// Initialize |
1878 |
$last_name = ""; |
1879 |
$first_name = ""; |
1880 |
$staff_account = ""; |
1881 |
$email = ""; |
1882 |
$stafftitle = ""; |
1883 |
$staff_email = ""; |
1884 |
$faculty_email = ""; |
1885 |
$pers_email = ""; |
1886 |
|
1887 |
// Fetch the general stuff |
1888 |
$personnel_id = $row["personnel_id"]; |
1889 |
$staff_id = $row["staff_id"]; |
1890 |
$faculty_id = $row["faculty_id"]; |
1891 |
$stafftitle = $row["stafftitle"]; |
1892 |
$stafftitle_id = $row["stafftitle_id"]; |
1893 |
|
1894 |
// Row is staff. (Not 0, NULL, 1=N/A). |
1895 |
if ($staff_id > 1) { |
1896 |
|
1897 |
// Gather the staff table fields |
1898 |
$last_name = $row["last_name"]; |
1899 |
$first_name = $row["first_name"]; |
1900 |
$staff_account = $row["staff_account"]; |
1901 |
$email = $row["staff_email"]; |
1902 |
|
1903 |
} |
1904 |
|
1905 |
// Row is faculty (Not 0, NULL, 1=N/A). |
1906 |
else if ($faculty_id > 1) { |
1907 |
|
1908 |
// Gather the faculty table fields |
1909 |
$last_name = $row["faculty_lastname"]; |
1910 |
$first_name = $row["faculty_firstname"]; |
1911 |
$faculty_account = $row["faculty_account"]; |
1912 |
$email = $row["faculty_email"]; |
1913 |
|
1914 |
} |
1915 |
|
1916 |
// Row is "other", use the freetext fields |
1917 |
else { |
1918 |
|
1919 |
// Gather the catch-all fields |
1920 |
$last_name = $row["pers_lastname"]; |
1921 |
$first_name = $row["pers_firstname"]; |
1922 |
$pers_account = $row["pers_account"]; |
1923 |
$email = $row["pers_email"]; |
1924 |
} |
1925 |
|
1926 |
|
1927 |
// Display the row, offer delete option |
1928 |
printf("<tr><td>\n"); |
1929 |
if ($stafftitle_id > 1) printf("%s: ", $stafftitle); |
1930 |
printf("%s %s <a href=\"mailto:%s\">%s</a><br>\n", |
1931 |
$first_name, $last_name, $email, $email); |
1932 |
printf("</td>\n"); |
1933 |
|
1934 |
// Offer delete button |
1935 |
printf("<td>\n"); |
1936 |
printf("<form method=\"post\" action=\"scribe_transaction.phtml\">\n"); |
1937 |
printf("<input type=\"hidden\" name=\"transaction\" value=\"deleteCoursePers\">\n"); |
1938 |
printf("<input type=\"hidden\" name=\"personnel_id\" value = \"%d\" >\n", $personnel_id); |
1939 |
printf("<input type=\"hidden\" name=\"course_id\" value = \"%d\" >\n", $course_id); |
1940 |
printf("<input type=\"hidden\" name=\"page_id\" value = \"%d\">\n", $page_id); |
1941 |
printf("<input type=\"submit\" value=\"Remove\">\n"); |
1942 |
printf("</td>\n"); |
1943 |
printf("</form>\n"); |
1944 |
|
1945 |
// Close row |
1946 |
printf("</tr>\n"); |
1947 |
|
1948 |
} // end course_personnel rows |
1949 |
|
1950 |
// Close personnel display table |
1951 |
printf("</table>\n"); |
1952 |
|
1953 |
// Offer an add course personnel button |
1954 |
if ($active != "addCoursePers" ){ |
1955 |
|
1956 |
// Offer add option |
1957 |
printf("<table><tr><td colspan=\"2\">\n"); |
1958 |
printf("<form method=\"post\" action=\"scribe.phtml?page_id=%d#coursePers\">\n", $page_id); |
1959 |
printf("<input type=\"hidden\" name=\"active\" value=\"addCoursePers\">\n"); |
1960 |
printf("<input type=\"submit\" value=\"Add Personnel\">\n"); |
1961 |
printf("</td></tr></table>\n"); |
1962 |
printf("</form>\n"); |
1963 |
|
1964 |
} |
1965 |
|
1966 |
// Add course personnel is active, display the selection form |
1967 |
else { |
1968 |
|
1969 |
// Outer box table |
1970 |
printf("<table width = \"40%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\" >\n"); |
1971 |
printf("<tr><td class=\"cellPlain\">\n"); |
1972 |
printf("Add Course Personnel"); |
1973 |
printf("</td></tr>\n"); |
1974 |
printf("<td>\n"); |
1975 |
|
1976 |
// Add form table |
1977 |
printf("<table width = \"100%%\" class=\"backLight\" cellpadding = \"0\" cellspacing = \"4\" >\n"); |
1978 |
|
1979 |
// "add" is active, offer the add form |
1980 |
printf("<form method=\"post\" action=\"scribe_transaction.phtml\">\n"); |
1981 |
printf("<input type=\"hidden\" name=\"transaction\" value=\"insertCoursePers\">\n"); |
1982 |
printf("<input type=\"hidden\" name=\"course_id\" value=\"%d\">\n", $course_id); |
1983 |
printf("<input type=\"hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
1984 |
|
1985 |
// Staff title |
1986 |
printf("<tr><td valign=\"top\" >\n"); |
1987 |
printf("<b>Personnel Title:</b>\n"); |
1988 |
printf("</td><td colspan = \"2\" valign=\"top\" >\n"); |
1989 |
printf("<select name=\"stafftitle_id\">\n"); |
1990 |
dropDownField("stafftitle", "stafftitle", "stafftitle_id"); |
1991 |
printf("</select><br><br>"); |
1992 |
printf("</td></tr>\n"); |
1993 |
|
1994 |
// Select one of the following... |
1995 |
printf("<tr><td colspan=\"3\" valign=\"top\" >\n"); |
1996 |
printf("Select <b>one</b> of the following:\n"); |
1997 |
printf("</td></tr>\n"); |
1998 |
|
1999 |
// HR for readability |
2000 |
printf("<tr><td colspan=\"3\">\n"); |
2001 |
printf("<hr>\n"); |
2002 |
printf("</td></tr>\n"); |
2003 |
|
2004 |
// Staff |
2005 |
printf("<tr><td valign=\"top\">\n"); |
2006 |
printf("<b>Library Staff:</b>\n"); |
2007 |
printf("</td><td colspan = \"2\" valign=\"top\" >\n"); |
2008 |
printf("<select name=\"staff_id\">\n"); |
2009 |
dropDownStaff(); |
2010 |
printf("</select>"); |
2011 |
printf("</td></tr>\n"); |
2012 |
|
2013 |
// HR for readability |
2014 |
printf("<tr><td colspan=\"3\">\n"); |
2015 |
printf("<hr>\n"); |
2016 |
printf("<b>OR</b><br><br>\n"); |
2017 |
printf("</td></tr>\n"); |
2018 |
|
2019 |
// Faculty |
2020 |
printf("<tr><td valign=\"top\">\n"); |
2021 |
printf("<b>U Faculty:</b>\n"); |
2022 |
printf("</td><td colspan = \"2\" valign=\"top\" >\n"); |
2023 |
printf("<select name=\"faculty_id\">\n"); |
2024 |
dropDownFaculty(); |
2025 |
printf("</select>"); |
2026 |
printf("</td></tr>\n"); |
2027 |
|
2028 |
// HR for readability |
2029 |
printf("<tr><td colspan=\"3\">\n"); |
2030 |
printf("<hr>\n"); |
2031 |
printf("<b>OR Fill out the following:</b><br><br>\n"); |
2032 |
printf("<b>Important Note:</b> You may enter faculty on-the-fly here if they |
2033 |
are not present in the drop-down list above. TA's and non-affiliated |
2034 |
instructors may be also entered. Be sure to click the 'faculty' |
2035 |
radio button below if you wish to index your entry as a faculty person. |
2036 |
Do not enter library staff here.<br><br>"); |
2037 |
printf("</td></tr>\n"); |
2038 |
|
2039 |
// Or freetext |
2040 |
printf("<tr><td>\n"); |
2041 |
printf("<b>Last name:</b> "); |
2042 |
printf("</td><td colspan = \"2\" >\n"); |
2043 |
printf("<input type =\"text\" name =\"pers_lastname\" size=\"30\">\n"); |
2044 |
printf("</td></tr>\n"); |
2045 |
printf("<tr><td>\n"); |
2046 |
printf("<b>First name:</b> "); |
2047 |
printf("</td><td colspan = \"2\" >\n"); |
2048 |
printf("<input type =\"text\" name =\"pers_firstname\" size=\"20\">\n"); |
2049 |
printf("</td></tr>\n"); |
2050 |
printf("<tr><td>\n"); |
2051 |
printf("<b>x500 (if applicable):</b> "); |
2052 |
printf("</td><td colspan = \"2\" >\n"); |
2053 |
printf("<input type =\"text\" name =\"pers_account\" size=\"15\">\n"); |
2054 |
printf("</td></tr>\n"); |
2055 |
printf("<tr><td>\n"); |
2056 |
printf("<b>E-mail:</b> "); |
2057 |
printf("</td><td colspan = \"2\" >\n"); |
2058 |
printf("<input type =\"text\" name =\"pers_email\" size=\"30\">\n"); |
2059 |
printf("</td></tr>\n"); |
2060 |
|
2061 |
// Entry type |
2062 |
printf("<tr><td colspan=\"3\"><br>\n"); |
2063 |
printf("<b>Faculty</b> <input type =\"radio\" name =\"pers_type\" value=\"faculty\" checked>\n"); |
2064 |
printf("<b>TA/Other</b> <input type =\"radio\" name =\"pers_type\" value=\"other\">\n"); |
2065 |
printf("</td></tr>\n"); |
2066 |
|
2067 |
// HR for readability |
2068 |
printf("<tr><td colspan=\"3\">\n"); |
2069 |
printf("<hr>\n"); |
2070 |
printf("</td></tr>\n"); |
2071 |
|
2072 |
// Submit or reset form |
2073 |
printf("<tr><td align=\"right\">\n"); |
2074 |
printf("<input type=\"submit\" value=\"Submit\">\n"); |
2075 |
printf("</td><td align=\"center\">\n"); |
2076 |
printf("<input type=\"reset\" value=\"Reset\">\n"); |
2077 |
printf("</td>\n"); |
2078 |
printf("</form>\n"); |
2079 |
|
2080 |
// Cancel form |
2081 |
printf("<td align=\"left\">\n"); |
2082 |
printf("<form method=\"post\" action=\"scribe.phtml?page_id=%d\">\n", $page_id); |
2083 |
printf("<input type=\"submit\" value=\"Cancel\">\n"); |
2084 |
printf("</td></tr>\n"); |
2085 |
printf("</form>\n"); |
2086 |
|
2087 |
} |
2088 |
|
2089 |
// Close add form table |
2090 |
printf("</table>\n"); |
2091 |
|
2092 |
// Close outer table |
2093 |
printf("</td></tr></table>\n"); |
2094 |
|
2095 |
} |
2096 |
|
2097 |
|
2098 |
/********************************************************** |
2099 |
Function: formPageHeader |
2100 |
Author: Paul Bramscher |
2101 |
Last Modified: 03.11.2004 |
2102 |
*********************************************************** |
2103 |
Purpose: |
2104 |
This function allows the editing of the supplied page id |
2105 |
pageheader field. |
2106 |
**********************************************************/ |
2107 |
function formPageHeader($active, $page_id) { |
2108 |
|
2109 |
// Retrieve current information |
2110 |
$sql = "SELECT |
2111 |
pageheader |
2112 |
FROM |
2113 |
page |
2114 |
WHERE |
2115 |
page_id = " . $page_id; |
2116 |
|
2117 |
|
2118 |
$rs = xx_tryquery($sql); |
2119 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
2120 |
|
2121 |
$pageheader = $row["pageheader"]; |
2122 |
|
2123 |
// Run strings through the HTML cleaner for output |
2124 |
// $pageheader = textOutHTML($pageheader); |
2125 |
|
2126 |
|
2127 |
/**************** |
2128 |
** Page Header ** |
2129 |
****************/ |
2130 |
|
2131 |
printf("<b>Page Header:</b><br>\n"); |
2132 |
|
2133 |
|
2134 |
// Table |
2135 |
printf("<table border =\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"); |
2136 |
printf("<tr>\n"); |
2137 |
|
2138 |
|
2139 |
// Active |
2140 |
if ($active == "pageheader") { |
2141 |
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
2142 |
printf("<td>\n"); |
2143 |
printf("<input type=\"Hidden\" name=\"transaction\" value=\"updatePageHeader\">\n"); |
2144 |
printf("<input type=\"Hidden\" name=\"page_id\" value=\"%d\">\n", $page_id); |
2145 |
printf("<textarea name =\"pageheader\" rows=\"5\" cols=\"80\">\n"); |
2146 |
printf($pageheader); |
2147 |
printf("</textarea>\n"); |
2148 |
|
2149 |
// Save or cancel |
2150 |
printf("<input type=\"submit\" value =\"Save\">\n"); |
2151 |
printf("<a href=\"scribe.phtml?page_id=%d\">Cancel</a>\n", $page_id); |
2152 |
printf("</td>\n"); |
2153 |
printf("</form>\n"); |
2154 |
|
2155 |
} |
2156 |
|
2157 |
// Inactive |
2158 |
else { |
2159 |
printf("<form method=\"POST\" action=\"scribe.phtml?page_id=%d\">\n", $page_id); |
2160 |
printf("<td align=\"left\">\n"); |
2161 |
printf("<input type=\"Hidden\" name=\"active\" value=\"pageheader\">\n"); |
2162 |
printf("%s ", $pageheader); |
2163 |
printf("<input type = \"image\" src=\"images/edit.gif\" name =\"edit\" alt=\"edit\">\n"); |
2164 |
printf("</td>\n"); |
2165 |
printf("</form>\n"); |
2166 |
} |
2167 |
printf("</tr>\n"); |
2168 |
|
2169 |
// Close table |
2170 |
printf("</table><br>\n"); |
2171 |
} |
2172 |
|
2173 |
|
2174 |
/********************************************************** |
2175 |
Function:pageTitleStyle |
2176 |
Author: Paul Bramscher |
2177 |
Last Modified: 03.11.2004 |
2178 |
*********************************************************** |
2179 |
Purpose: |
2180 |
Display the style elements (1-5) that may be applied to |
2181 |
the CLPS page title. The currently-enforced style |
2182 |
(if non-NULL) is displayed in boldface. If no style |
2183 |
is selected, the "X" is bolded. |
2184 |
**********************************************************/ |
2185 |
function pageTitleStyle($page_id, $pagetitle_style){ |
2186 |
|
2187 |
// Initial the bolding variables |
2188 |
$bold0 = ""; |
2189 |
$bold0_close = ""; |
2190 |
$bold1 = ""; |
2191 |
$bold1_close = ""; |
2192 |
$bold2 = ""; |
2193 |
$bold2_close = ""; |
2194 |
$bold3 = ""; |
2195 |
$bold3_close = ""; |
2196 |
$bold4 = ""; |
2197 |
$bold4_close = ""; |
2198 |
$bold5 = ""; |
2199 |
$bold5_close = ""; |
2200 |
|
2201 |
// Display the selected size in bold type |
2202 |
switch ($pagetitle_style) { |
2203 |
|
2204 |
case 1: $bold1 = "<b>"; |
2205 |
$bold1_close = "</b>"; |
2206 |
break; |
2207 |
case 2: $bold2 = "<b>"; |
2208 |
$bold2_close = "</b>"; |
2209 |
break; |
2210 |
case 3: $bold3 = "<b>"; |
2211 |
$bold3_close = "</b>"; |
2212 |
break; |
2213 |
|
2214 |
case 4: $bold4 = "<b>"; |
2215 |
$bold4_close = "</b>"; |
2216 |
break; |
2217 |
case 5: $bold5 = "<b>"; |
2218 |
$bold5_close = "</b>"; |
2219 |
break; |
2220 |
default: $bold0 = "<b>"; |
2221 |
$bold0_close = "</b>"; |
2222 |
break; |
2223 |
} |
2224 |
|
2225 |
// Style control |
2226 |
printf("Style: [ %s<a href=\"scribe_transaction.phtml?transaction=updatePageTitleStyle&page_id=%d&pagetitle_style=0\">X</a>%s | ", $bold0, $page_id, $bold0_close); |
2227 |
printf("%s<a href=\"scribe_transaction.phtml?transaction=updatePageTitleStyle&page_id=%d&pagetitle_style=1\">1</a>%s | ", $bold1, $page_id, $bold1_close); |
2228 |
printf("%s<a href=\"scribe_transaction.phtml?transaction=updatePageTitleStyle&page_id=%d&pagetitle_style=2\">2</a>%s | ", $bold2, $page_id, $bold2_close); |
2229 |
printf("%s<a href=\"scribe_transaction.phtml?transaction=updatePageTitleStyle&page_id=%d&pagetitle_style=3\">3</a>%s | ", $bold3, $page_id, $bold3_close); |
2230 |
printf("%s<a href=\"scribe_transaction.phtml?transaction=updatePageTitleStyle&page_id=%d&pagetitle_style=4\">4</a>%s | ", $bold4, $page_id, $bold4_close); |
2231 |
printf("%s<a href=\"scribe_transaction.phtml?transaction=updatePageTitleStyle&page_id=%d&pagetitle_style=5\">5</a>%s ]\n", $bold5, $page_id, $bold5_close); |
2232 |
|
2233 |
} |
2234 |
?> |