1 |
<?php |
<?php |
2 |
/********************************************************** |
/********************************************************** |
3 |
Function Library: scribe_application.php |
Function Library: scribe_application.php |
4 |
Original Author: Paul Bramscher <brams006@tc.umn.edu> |
Original Author: Paul Bramscher <brams006@umn.edu> |
5 |
Last Modified: 01.27.2004 |
Last Modified: 03.16.2004 |
6 |
*********************************************************** |
*********************************************************** |
7 |
Comments: |
Comments: |
8 |
This library brings together all of the SQL actions in |
This library brings together all of the SQL actions in |
10 |
on app_controls.php and other libraries as well, but these |
on app_controls.php and other libraries as well, but these |
11 |
are specific to CLPS. |
are specific to CLPS. |
12 |
*********************************************************** |
*********************************************************** |
13 |
|
Table of Contents: |
14 |
assignPageStaff |
assignPageStaff |
15 |
assignStaffCoordinator |
assignStaffCoordinator |
16 |
copyPasteElement |
copyPasteElement |
20 |
deletePage |
deletePage |
21 |
deletePageConfirm |
deletePageConfirm |
22 |
deletePageStaff |
deletePageStaff |
|
displayCourseHeader |
|
|
displayCoursePers |
|
23 |
displayTOC |
displayTOC |
|
elementDecrease |
|
24 |
elementDown |
elementDown |
|
elementIncrease |
|
25 |
elementMultiFormat |
elementMultiFormat |
26 |
elementSize |
elementSize |
27 |
elementUp |
elementUp |
43 |
populateGenArray |
populateGenArray |
44 |
scribePublish |
scribePublish |
45 |
scribeUnpublish |
scribeUnpublish |
|
|
|
|
--- |
|
|
Deprecated: |
|
|
siblingElderProbe |
|
|
siblingYoungerProbe |
|
|
--- |
|
|
|
|
|
|
|
46 |
sibProbeElder |
sibProbeElder |
47 |
sibProbeYounger |
sibProbeYounger |
48 |
toggleTOCDisplay |
toggleTOCDisplay |
67 |
/********************************************************** |
/********************************************************** |
68 |
Function: assignPageStaff |
Function: assignPageStaff |
69 |
Author: Paul Bramscher |
Author: Paul Bramscher |
70 |
Last Modified: 04.23.2003 |
Last Modified: 03.03.2004 |
71 |
*********************************************************** |
*********************************************************** |
72 |
Purpose: |
Purpose: |
73 |
Assigns staffpersons (possibly multiple) to a given page |
Assigns staffpersons (possibly multiple) to a given page |
74 |
and calls the page edit mode back again. |
and calls the page edit mode back again. |
75 |
**********************************************************/ |
**********************************************************/ |
76 |
function assignPageStaff($con, $page_id, $staff_id_array) { |
function assignPageStaff($page_id, $staff_id_array) { |
77 |
|
|
78 |
// For all staff in the array |
// For all staff in the array |
79 |
for ($subscript = 0; $subscript < sizeof($staff_id_array); $subscript++ ) { |
for ($subscript = 0; $subscript < sizeof($staff_id_array); $subscript++ ) { |
81 |
// Check to make sure that the staff isn't already assigned |
// Check to make sure that the staff isn't already assigned |
82 |
$sql = "SELECT * FROM page_staff where page_id = " . $page_id . |
$sql = "SELECT * FROM page_staff where page_id = " . $page_id . |
83 |
" AND staff_id = " . $staff_id_array[$subscript]; |
" AND staff_id = " . $staff_id_array[$subscript]; |
84 |
$rs = mysql_query($sql); |
$rs = mysql_tryquery($sql); |
85 |
if (mysql_num_rows($rs) == 0) { |
if (mysql_num_rows($rs) == 0) { |
86 |
|
|
87 |
$sql = "INSERT INTO page_staff (page_id, staff_id) VALUES (" |
$sql = "INSERT INTO page_staff (page_id, staff_id) VALUES (" |
88 |
. $page_id |
. $page_id |
89 |
. ", " |
. ", " |
90 |
. $staff_id_array[$subscript] |
. $staff_id_array[$subscript] |
91 |
. ")"; |
. ")"; |
92 |
|
mysql_tryquery($sql); |
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} // bad write |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
} // good write of staff |
|
93 |
|
|
94 |
} // staff not already assigned |
} // staff not already assigned |
95 |
|
|
104 |
/********************************************************** |
/********************************************************** |
105 |
Function: assignStaffCoordinator |
Function: assignStaffCoordinator |
106 |
Author: Paul Bramscher |
Author: Paul Bramscher |
107 |
Last Modified: 04.22.2003 |
Last Modified: 03.03.2004 |
108 |
*********************************************************** |
*********************************************************** |
109 |
Purpose: |
Purpose: |
110 |
Assigns a single staff coordinator to a given page and |
Assigns a single staff coordinator to a given page and |
111 |
calls the page edit mode back again. |
calls the page edit mode back again. |
112 |
**********************************************************/ |
**********************************************************/ |
113 |
function assignStaffCoordinator($con, $page_id, $staff_coordinator) { |
function assignStaffCoordinator($page_id, $staff_coordinator) { |
114 |
|
|
115 |
$sql = "UPDATE page SET staff_coordinator = " |
$sql = "UPDATE page SET staff_coordinator = " |
116 |
. $staff_coordinator |
. $staff_coordinator |
117 |
. " WHERE page_id = " |
. " WHERE page_id = " |
118 |
. $page_id; |
. $page_id; |
119 |
|
|
120 |
if (!mysql_query ($sql, $con)){ |
mysql_tryquery ($sql); |
121 |
sql_err($sql); |
header("Location: scribe.phtml?page_id=" . $page_id); |
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { // Success call the page back |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
header("Location: scribe.phtml?page_id=" . $page_id); |
|
|
} |
|
122 |
} |
} |
123 |
|
|
124 |
|
|
125 |
/********************************************************** |
/********************************************************** |
126 |
Function: copyPasteElement |
Function: copyPasteElement |
127 |
Author: Paul Bramscher |
Author: Paul Bramscher |
128 |
Last Modified: 06.11.2003 |
Last Modified: 03.03.2004 |
129 |
*********************************************************** |
*********************************************************** |
130 |
Purpose: |
Purpose: |
131 |
Copies the supplied element id and descendants (if picked) |
Copies the supplied element id and descendants (if picked) |
132 |
and inserts them into the user's copy/paste buffer. Any |
and inserts them into the user's copy/paste buffer. Any |
133 |
previously copied data is replaced. |
previously copied data is replaced. |
134 |
**********************************************************/ |
**********************************************************/ |
135 |
function copyPasteElement($con, $page_id, $place_array_HTML, $copysingle, $sess_staff_id){ |
function copyPasteElement($page_id, $place_array_HTML, $copysingle, $sess_staff_id){ |
136 |
|
|
137 |
// Split by comma separated values |
// Split by comma separated values |
138 |
$place_array = split(",", $place_array_HTML); |
$place_array = split(",", $place_array_HTML); |
147 |
// First, we delete any previously cut elements from the pastebuffer table |
// First, we delete any previously cut elements from the pastebuffer table |
148 |
$sql = "DELETE FROM pastebuffer WHERE paste_staff_id = " |
$sql = "DELETE FROM pastebuffer WHERE paste_staff_id = " |
149 |
. $sess_staff_id; |
. $sess_staff_id; |
150 |
|
mysql_tryquery($sql); |
|
//printf("sql was: %s<BR>\n", $sql); |
|
|
|
|
|
|
|
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
$success = 0; |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
} |
|
151 |
|
|
152 |
// Element is a parent, and user is copying that element only. |
// Element is a parent, and user is copying that element only. |
153 |
if ($copysingle == 1) { |
if ($copysingle == 1) { |
168 |
. " AND element_order > " |
. " AND element_order > " |
169 |
. $element_order |
. $element_order |
170 |
. " ORDER BY element_order"; |
. " ORDER BY element_order"; |
171 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
172 |
|
|
173 |
// Check for indent level |
// Check for indent level |
174 |
while (($row = mysql_fetch_array ($rs)) && ($end_found == 0)) { |
while (($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) && ($end_found == 0)) { |
175 |
|
|
176 |
$probe_element_id = $row["element_id"]; |
$probe_element_id = $row["element_id"]; |
177 |
$probe_indent_level = $row["indent_level"]; |
$probe_indent_level = $row["indent_level"]; |
232 |
. $end_element_order |
. $end_element_order |
233 |
. " ORDER BY element_order"; |
. " ORDER BY element_order"; |
234 |
|
|
235 |
if (!mysql_query($sql, $con)){ |
mysql_tryquery($sql); |
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
$success = 0; |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
} |
|
|
|
|
236 |
header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position); |
header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position); |
237 |
|
|
238 |
} // end function |
} // end function |
241 |
/********************************************************** |
/********************************************************** |
242 |
Function: deleteCopyBuffer |
Function: deleteCopyBuffer |
243 |
Author: Paul Bramscher |
Author: Paul Bramscher |
244 |
Last Modified: 04.22.2003 |
Last Modified: 03.03.2004 |
245 |
*********************************************************** |
*********************************************************** |
246 |
Purpose: |
Purpose: |
247 |
Clears the user's copy/paste buffer. |
Clears the user's copy/paste buffer. |
248 |
**********************************************************/ |
**********************************************************/ |
249 |
function deleteCopyBuffer($con, $page_id, $paste_staff_id){ |
function deleteCopyBuffer($page_id, $paste_staff_id){ |
250 |
|
|
251 |
$sql = "DELETE from pastebuffer WHERE paste_staff_id = " |
$sql = "DELETE from pastebuffer WHERE paste_staff_id = " |
252 |
. $paste_staff_id; |
. $paste_staff_id; |
253 |
|
mysql_tryquery($sql); |
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
|
|
|
254 |
header("Location: scribe.phtml?page_id=". $page_id); |
header("Location: scribe.phtml?page_id=". $page_id); |
255 |
} |
} |
256 |
|
|
258 |
/********************************************************** |
/********************************************************** |
259 |
Function: deleteCoursePers |
Function: deleteCoursePers |
260 |
Author: Paul Bramscher |
Author: Paul Bramscher |
261 |
Last Modified: 12.02.2002 |
Last Modified: 03.03.2004 |
262 |
*********************************************************** |
*********************************************************** |
263 |
Purpose: |
Purpose: |
264 |
Deletes the supplied personnel id from the course. |
Deletes the supplied personnel id from the course. |
265 |
**********************************************************/ |
**********************************************************/ |
266 |
function deleteCoursePers($con, $course_id, $page_id, $personnel_id){ |
function deleteCoursePers($course_id, $page_id, $personnel_id){ |
267 |
|
|
268 |
// Build the sql. |
// Build the sql. |
269 |
$sql = "DELETE from course_personnel WHERE personnel_id = " |
$sql = "DELETE from course_personnel WHERE personnel_id = " |
270 |
. $personnel_id |
. $personnel_id |
271 |
. " AND course_id = " |
. " AND course_id = " |
272 |
. $course_id; |
. $course_id; |
273 |
|
mysql_tryquery($sql); |
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
|
|
|
274 |
header("Location: scribe.phtml?page_id=". $page_id); |
header("Location: scribe.phtml?page_id=". $page_id); |
275 |
} |
} |
276 |
|
|
277 |
|
|
|
|
|
278 |
/********************************************************** |
/********************************************************** |
279 |
Function: deleteElement |
Function: deleteElement |
280 |
Author: Paul Bramscher |
Author: Paul Bramscher |
281 |
Last Modified: 04.24.2003 |
Last Modified: 03.03.2004 |
282 |
*********************************************************** |
*********************************************************** |
283 |
Purpose: |
Purpose: |
284 |
Deletes the supplied element id. Depending on user selection, |
Deletes the supplied element id. Depending on user selection, |
289 |
and any removed descendants, from the libstats statistics |
and any removed descendants, from the libstats statistics |
290 |
table. |
table. |
291 |
**********************************************************/ |
**********************************************************/ |
292 |
function deleteElement($con, $page_id, $place_array_HTML, $promote){ |
function deleteElement($page_id, $place_array_HTML, $promote){ |
293 |
|
|
294 |
// Split by comma separated values |
// Split by comma separated values |
295 |
$place_array = split(",", $place_array_HTML); |
$place_array = split(",", $place_array_HTML); |
315 |
|
|
316 |
if ($promote == 0) { |
if ($promote == 0) { |
317 |
|
|
|
// Success flag |
|
|
$success = 1; |
|
|
|
|
318 |
// First delete the element |
// First delete the element |
319 |
$sql = "DELETE from element WHERE page_id = " |
$sql = "DELETE from element WHERE page_id = " |
320 |
. $page_id |
. $page_id |
321 |
. " AND element_id = " |
. " AND element_id = " |
322 |
. $element_id; |
. $element_id; |
323 |
if (!mysql_query($sql, $con)){ |
mysql_tryquery($sql); |
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
$success = 0; |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
} |
|
324 |
|
|
325 |
// Next, update the order of the remainders |
// Next, update the order of the remainders |
326 |
if ($success == 1) { |
$sql = "UPDATE element SET element_order = element_order - 1 WHERE page_id = " |
327 |
|
. $page_id |
328 |
$sql = "UPDATE element SET element_order = element_order - 1 WHERE page_id = " |
. " AND element_order > " |
329 |
. $page_id |
. $element_order; |
330 |
. " AND element_order > " |
mysql_tryquery($sql); |
|
. $element_order; |
|
|
|
|
|
// Make the change |
|
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
} // end reordering |
|
|
|
|
|
} // end safety check for reordering |
|
331 |
|
|
332 |
// Last, delete the element reference from the stats database |
// Last, delete the element reference from the stats database |
333 |
if ($success == 1) { |
$sql = "DELETE from libstats.elementstats WHERE page_id = " |
334 |
$sql = "DELETE from libstats.elementstats WHERE page_id = " |
. $page_id |
335 |
. $page_id |
. " AND element_id = " |
336 |
. " AND element_id = " |
. $element_id; |
337 |
. $element_id; |
mysql_tryquery($sql); |
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
$success = 0; |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
// Done, return to page |
|
|
if ($position > 2) $new_pos = $position - 1; |
|
|
else $new_pos = 1; |
|
|
header("Location: scribe.phtml?page_id=". $page_id . "#p" . $new_pos); |
|
338 |
|
|
339 |
} |
// Done, return to page |
340 |
} // end removal from stats database |
if ($position > 2) $new_pos = $position - 1; |
341 |
|
else $new_pos = 1; |
342 |
|
header("Location: scribe.phtml?page_id=". $page_id . "#p" . $new_pos); |
343 |
|
|
344 |
} // end simple delete |
} // end simple delete |
345 |
|
|
368 |
. " AND element_order > " |
. " AND element_order > " |
369 |
. $element_order |
. $element_order |
370 |
. " ORDER BY element_order"; |
. " ORDER BY element_order"; |
371 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
372 |
|
|
373 |
// Check for and promote all descendants |
// Check for and promote all descendants |
374 |
while (($row = mysql_fetch_array ($rs)) && ($desc_indent_level > $indent_level)) { |
while (($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) && ($desc_indent_level > $indent_level)) { |
375 |
$desc_element_id = $row["element_id"]; |
$desc_element_id = $row["element_id"]; |
376 |
$desc_parent_id = $row["parent_id"]; |
$desc_parent_id = $row["parent_id"]; |
377 |
$desc_indent_level = $row["indent_level"]; |
$desc_indent_level = $row["indent_level"]; |
382 |
. $page_id |
. $page_id |
383 |
. " AND element_id = " |
. " AND element_id = " |
384 |
. $desc_element_id; |
. $desc_element_id; |
385 |
|
mysql_tryquery($promote_sql); |
|
if (!mysql_query($promote_sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
$success = 0; |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
} // end of a descendant promote |
|
386 |
|
|
387 |
} // end of check for one descendant |
} // end of check for one descendant |
388 |
|
|
401 |
. $page_id |
. $page_id |
402 |
. " AND element_id = " |
. " AND element_id = " |
403 |
. $desc_element_id; |
. $desc_element_id; |
404 |
if (!mysql_query($newparent_sql, $con)){ |
mysql_tryquery($newparent_sql); |
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
$success = 0; |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
} // end of a first-generation parent reassignment |
|
405 |
|
|
406 |
} // end check for first generation children |
} // end check for first generation children |
407 |
|
|
408 |
} // end check for all descendants |
} // end check for all descendants |
409 |
|
|
410 |
// Next, delete the parent |
// Next, delete the parent |
411 |
if ($success == 1) { |
$parent_sql = "DELETE FROM element WHERE element_id = " |
412 |
$parent_sql = "DELETE FROM element WHERE element_id = " |
. $element_id; |
413 |
. $element_id; |
mysql_tryquery($parent_sql); |
414 |
if (!mysql_query($parent_sql, $con)){ |
|
415 |
sql_err($con); |
// Increment the deleted counter to include the parent |
416 |
mysql_query ("UNLOCK TABLES", $con); |
$num_desc++; |
|
bailout(); |
|
|
$success = 0; |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
// Increment the deleted counter to include the parent |
|
|
$num_desc++; |
|
|
|
|
|
} // end of parent delete |
|
|
|
|
|
} // end of safety check for parent delete |
|
417 |
|
|
418 |
// Next, update the order of the remainders |
// Next, update the order of the remainders |
419 |
if ($success == 1) { |
$order_sql = "UPDATE element SET element_order = element_order - 1 WHERE page_id = " |
420 |
$order_sql = "UPDATE element SET element_order = element_order - 1 WHERE page_id = " |
. $page_id |
421 |
. $page_id |
. " AND element_order > " |
422 |
. " AND element_order > " |
. $element_order; |
423 |
. $element_order; |
mysql_tryquery($order_sql); |
|
if (!mysql_query($order_sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
$success = 0; |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
} // end reordering |
|
|
|
|
|
} // end of safety check for reordering |
|
|
|
|
424 |
|
|
425 |
// Last, delete the (parent) element reference from the stats database |
// Last, delete the (parent) element reference from the stats database |
426 |
if ($success == 1) { |
$sql = "DELETE from libstats.elementstats WHERE page_id = " |
427 |
$sql = "DELETE from libstats.elementstats WHERE page_id = " |
. $page_id |
428 |
. $page_id |
. " AND element_id = " |
429 |
. " AND element_id = " |
. $element_id; |
430 |
. $element_id; |
mysql_tryquery($sql); |
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
$success = 0; |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
// Done, return to page |
|
|
if ($position > 2) $new_pos = $position - 1; |
|
|
else $new_pos = 1; |
|
|
header("Location: scribe.phtml?page_id=". $page_id . "#p" . $new_pos); |
|
|
|
|
|
} |
|
|
|
|
|
} // end removal from stats database |
|
431 |
|
|
432 |
|
// Done, return to page |
433 |
|
if ($position > 2) $new_pos = $position - 1; |
434 |
|
else $new_pos = 1; |
435 |
|
header("Location: scribe.phtml?page_id=". $page_id . "#p" . $new_pos); |
436 |
|
|
437 |
} // end delete and promote |
} // end delete and promote |
438 |
|
|
443 |
|
|
444 |
|
|
445 |
else if ($promote == 2) { |
else if ($promote == 2) { |
|
|
|
|
// Success flag |
|
|
$success = 1; |
|
446 |
|
|
447 |
// Intialize first descendant indent level to proper value |
// Intialize first descendant indent level to proper value |
448 |
$desc_indent_level = $indent_level + 1; |
$desc_indent_level = $indent_level + 1; |
462 |
. " AND element_order > " |
. " AND element_order > " |
463 |
. $element_order |
. $element_order |
464 |
. " ORDER BY element_order"; |
. " ORDER BY element_order"; |
465 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
466 |
|
|
467 |
// Check for and delete all descendants |
// Check for and delete all descendants |
468 |
while (($row = mysql_fetch_array ($rs)) && ($desc_indent_level > $indent_level)) { |
while (($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) && ($desc_indent_level > $indent_level)) { |
469 |
$desc_element_id = $row["element_id"]; |
$desc_element_id = $row["element_id"]; |
470 |
$desc_parent_id = $row["parent_id"]; |
$desc_parent_id = $row["parent_id"]; |
471 |
$desc_indent_level = $row["indent_level"]; |
$desc_indent_level = $row["indent_level"]; |
473 |
// We've found a descendant, delete it |
// We've found a descendant, delete it |
474 |
if ($desc_indent_level > $indent_level) { |
if ($desc_indent_level > $indent_level) { |
475 |
$delete_sql = "DELETE FROM element WHERE element_id = " |
$delete_sql = "DELETE FROM element WHERE element_id = " |
476 |
. $desc_element_id; |
. $desc_element_id; |
477 |
if (!mysql_query($delete_sql, $con)){ |
mysql_tryquery($delete_sql); |
478 |
sql_err($con); |
|
479 |
mysql_query ("UNLOCK TABLES", $con); |
// Increment the deleted descendant counter |
480 |
bailout(); |
$num_desc++; |
|
$success = 0; |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
// Increment the deleted descendant counter |
|
|
$num_desc++; |
|
|
} // end of a descendant delete |
|
481 |
|
|
482 |
} // end of check for one descendant |
} // end of check for one descendant |
483 |
|
|
|
|
|
484 |
// Delete this (descendant) element reference from the stats database |
// Delete this (descendant) element reference from the stats database |
485 |
if ($success == 1) { |
$sql = "DELETE from libstats.elementstats WHERE page_id = " |
486 |
$sql = "DELETE from libstats.elementstats WHERE page_id = " |
. $page_id |
487 |
. $page_id |
. " AND element_id = " |
488 |
. " AND element_id = " |
. $desc_element_id; |
489 |
. $desc_element_id; |
mysql_tryquery($sql); |
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
$success = 0; |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
} |
|
|
} // end removal from stats database |
|
490 |
|
|
491 |
} // end check for all descendants |
} // end check for all descendants |
492 |
|
|
493 |
// Delete the parent itself |
// Delete the parent itself |
494 |
if ($success == 1) { |
$parent_sql = "DELETE FROM element WHERE element_id = " |
495 |
$parent_sql = "DELETE FROM element WHERE element_id = " |
. $element_id; |
496 |
. $element_id; |
mysql_tryquery($parent_sql); |
|
if (!mysql_query($parent_sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
$success = 0; |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
497 |
|
|
498 |
// Increment the deleted counter to include the parent |
// Increment the deleted counter to include the parent |
499 |
$num_desc++; |
$num_desc++; |
|
|
|
|
} // end of parent delete |
|
|
|
|
|
} // end of safety check for parent delete |
|
500 |
|
|
501 |
// Next, update the order of the remainders |
// Next, update the order of the remainders |
502 |
if ($success == 1) { |
$order_sql = "UPDATE element SET element_order = element_order - " |
503 |
$order_sql = "UPDATE element SET element_order = element_order - " |
. $num_desc |
504 |
. $num_desc |
. " WHERE page_id = " |
505 |
. " WHERE page_id = " |
. $page_id |
506 |
. $page_id |
. " AND element_order > " |
507 |
. " AND element_order > " |
. $element_order; |
508 |
. $element_order; |
mysql_tryquery($order_sql); |
|
if (!mysql_query($order_sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
$success = 0; |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
} // end reordering |
|
|
|
|
|
} // end of safety check for reordering |
|
|
|
|
509 |
|
|
510 |
// Last, delete the (parent) element reference from the stats database |
// Last, delete the (parent) element reference from the stats database |
511 |
if ($success == 1) { |
$sql = "DELETE from libstats.elementstats WHERE page_id = " |
512 |
$sql = "DELETE from libstats.elementstats WHERE page_id = " |
. $page_id |
513 |
. $page_id |
. " AND element_id = " |
514 |
. " AND element_id = " |
. $element_id; |
515 |
. $element_id; |
mysql_tryquery($sql); |
|
|
|
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
$success = 0; |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
// Done, return to page |
|
|
if ($position > 2) $new_pos = $position - 1; |
|
|
else $new_pos = 1; |
|
|
header("Location: scribe.phtml?page_id=". $page_id . "#p" . $new_pos); |
|
516 |
|
|
517 |
} |
// Done, return to page |
518 |
|
if ($position > 2) $new_pos = $position - 1; |
519 |
} // end removal from stats database |
else $new_pos = 1; |
520 |
|
header("Location: scribe.phtml?page_id=". $page_id . "#p" . $new_pos); |
521 |
|
|
522 |
} // end delete parent and children |
} // end delete parent and children |
523 |
|
|
527 |
/********************************************************** |
/********************************************************** |
528 |
Function: deletePage |
Function: deletePage |
529 |
Author: Paul Bramscher |
Author: Paul Bramscher |
530 |
Last Modified: 06.17.2003 |
Last Modified: 03.16.2004 |
531 |
*********************************************************** |
*********************************************************** |
532 |
Purpose: |
Purpose: |
533 |
Deletes the supplied page id. In doing so, elements, |
Deletes the supplied page id. In doing so, elements, |
538 |
page id in the libstats database, including element-level |
page id in the libstats database, including element-level |
539 |
and overall page statistics. |
and overall page statistics. |
540 |
**********************************************************/ |
**********************************************************/ |
541 |
function deletePage($con, $page_id){ |
function deletePage($page_id){ |
542 |
|
|
543 |
// Load globals |
// Load globals |
544 |
include("global_vars.php"); |
include("global_vars.php"); |
546 |
// Include the page header |
// Include the page header |
547 |
include ($GLOBAL_ADMIN_INC."scribe_header.phtml"); |
include ($GLOBAL_ADMIN_INC."scribe_header.phtml"); |
548 |
|
|
549 |
// HTML headers |
// HTML header |
550 |
printf("<html>\n"); |
printf("<html>\n"); |
551 |
printf("<head>\n"); |
printf("<head>\n"); |
552 |
printf("<title>PageScribe: Deleting page...</title>\n"); |
printf("<title>PageScribe: Deleting page...</title>\n"); |
553 |
printf("<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n", $GLOBAL_ADMIN_CSS); |
printf("<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n", $GLOBAL_ADMIN_CSS); |
554 |
printf("</head>"); |
printf("</head>\n"); |
|
|
|
|
|
|
|
// Draw form heading |
|
|
printf("<center><h3>Deleting Page...</h3>\n"); |
|
|
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\">\n"); |
|
|
printf("<tr><td><br>\n"); |
|
|
printf("<strong>Messages:</strong><br>\n"); |
|
555 |
|
|
556 |
|
msgTableOpen(1, "Deleting Page (ID# " . $page_id . ")"); |
557 |
|
printf("<b>Messages:</b><br>\n"); |
558 |
|
|
559 |
// Purge all |
// Purge all |
560 |
if ($page_id > 0) { |
if ($page_id > 0) { |
561 |
|
|
|
// Error flag |
|
|
$success = 1; |
|
|
|
|
562 |
// Initialize |
// Initialize |
563 |
$course_id = 0; |
$course_id = 0; |
564 |
|
|
566 |
$sql = "SELECT course_id FROM course WHERE page_id = " |
$sql = "SELECT course_id FROM course WHERE page_id = " |
567 |
. $page_id; |
. $page_id; |
568 |
|
|
569 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
570 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
571 |
|
|
572 |
// Collect the access information |
// Collect the access information |
573 |
$course_id = $row["course_id"]; |
$course_id = $row["course_id"]; |
574 |
|
|
575 |
// Delete all elements first |
// Delete all elements first |
576 |
$sql = "DELETE from element WHERE page_id =" . $page_id; |
$sql = "DELETE from element WHERE page_id =" . $page_id; |
577 |
|
if (mysql_tryquery ($sql)) printf("Removed this page's elements.<BR>\n"); |
|
if (!mysql_query ($sql, $con)){ |
|
|
$success = 0; |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed this page's elements.<BR>\n"); |
|
|
} |
|
578 |
|
|
579 |
// Delete course information, if any |
// Delete course information, if any |
580 |
if ($success == 1) { |
$sql = "DELETE from course WHERE page_id =" . $page_id; |
581 |
|
if (mysql_tryquery ($sql)) printf("Removed course information (if any).<BR>\n"); |
|
$sql = "DELETE from course WHERE page_id =" . $page_id; |
|
|
|
|
|
if (!mysql_query ($sql, $con)){ |
|
|
$success = 0; |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed course information (if any).<BR>\n"); |
|
|
} |
|
|
} |
|
582 |
|
|
583 |
// Delete assigned course personnel, if any |
// Delete assigned course personnel, if any |
584 |
if ($success == 1 && $course_id > 0) { |
if ($course_id > 0) { |
585 |
|
|
586 |
$sql = "DELETE from course_personnel WHERE course_id =" . $course_id; |
$sql = "DELETE from course_personnel WHERE course_id =" . $course_id; |
587 |
|
if (mysql_tryquery ($sql)) printf("Removed assigned course personnel (if any).<BR>\n"); |
|
if (!mysql_query ($sql, $con)){ |
|
|
$success = 0; |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed assigned course personnel (if any).<BR>\n"); |
|
|
} |
|
588 |
} |
} |
589 |
|
|
590 |
// Delete assigned staff, if any |
// Delete assigned staff, if any |
591 |
if ($success == 1) { |
$sql = "DELETE from page_staff WHERE page_id =" . $page_id; |
592 |
|
if (mysql_tryquery ($sql)) printf("Removed assigned staff (if any).<BR>\n"); |
|
$sql = "DELETE from page_staff WHERE page_id =" . $page_id; |
|
|
|
|
|
if (!mysql_query ($sql, $con)){ |
|
|
$success = 0; |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed assigned staff (if any).<BR>\n"); |
|
|
} |
|
|
} |
|
593 |
|
|
594 |
// Delete assigned subjects, if any |
// Delete assigned subjects, if any |
595 |
if ($success == 1) { |
$sql = "DELETE from sub_page WHERE page_id =" . $page_id; |
596 |
|
if (mysql_tryquery ($sql)) printf("Removed assigned subjects (if any).<BR>\n"); |
|
$sql = "DELETE from sub_page WHERE page_id =" . $page_id; |
|
|
|
|
|
if (!mysql_query ($sql, $con)){ |
|
|
$success = 0; |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed assigned subjects (if any).<BR>\n"); |
|
|
} |
|
|
} |
|
597 |
|
|
598 |
// Delete element statistics, if any |
// Delete element statistics, if any |
599 |
if ($success == 1) { |
$sql = "DELETE from libstats.elementstats WHERE page_id =" . $page_id; |
600 |
|
if (mysql_tryquery ($sql)) printf("Removed page's element statistics (if any).<BR>\n"); |
|
$sql = "DELETE from libstats.elementstats WHERE page_id =" . $page_id; |
|
|
|
|
|
if (!mysql_query ($sql, $con)){ |
|
|
$success = 0; |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed page's element statistics (if any).<BR>\n"); |
|
|
} |
|
|
} |
|
601 |
|
|
602 |
// Delete page overall statistics, if any |
// Delete page overall statistics, if any |
603 |
if ($success == 1) { |
$sql = "DELETE from libstats.pagestats WHERE page_id =" . $page_id; |
604 |
|
if (mysql_tryquery ($sql)) printf("Removed page's overall statistics (if any).<BR>\n"); |
|
$sql = "DELETE from libstats.pagestats WHERE page_id =" . $page_id; |
|
|
|
|
|
if (!mysql_query ($sql, $con)){ |
|
|
$success = 0; |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed page's overall statistics (if any).<BR>\n"); |
|
|
} |
|
|
} |
|
605 |
|
|
606 |
// Delete the page information |
// Delete the page information |
607 |
if ($success == 1) { |
$sql = "DELETE from page WHERE page_id =" . $page_id; |
608 |
|
if (mysql_tryquery ($sql)) printf("Removed page successfully."); |
|
$sql = "DELETE from page WHERE page_id =" . $page_id; |
|
|
|
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
printf("Removed page successfully.<BR><BR>\n"); |
|
|
} |
|
|
} |
|
609 |
|
|
610 |
} |
} |
611 |
else printf("Scribe page not found.<br><br>\n"); |
else printf("Scribe page not found."); |
|
|
|
|
printf("</td></tr></table>\n"); |
|
612 |
|
|
613 |
|
printf("<br><br>\n"); |
614 |
|
msgTableClose(); |
615 |
|
|
616 |
// Link to return to admin console |
// Link to return to admin console |
617 |
adminReturn(""); |
adminReturn(""); |
|
|
|
|
printf("</center>\n"); |
|
618 |
|
|
619 |
// Include the footer |
// Include the footer |
620 |
include ($GLOBAL_ADMIN_INC."scribe_footer.phtml"); |
include ($GLOBAL_ADMIN_INC."scribe_footer.phtml"); |
624 |
/********************************************************** |
/********************************************************** |
625 |
Function: deletePageConfirm |
Function: deletePageConfirm |
626 |
Author: Paul Bramscher |
Author: Paul Bramscher |
627 |
Last Modified: 05.01.2003 |
Last Modified: 03.16.2004 |
628 |
*********************************************************** |
*********************************************************** |
629 |
Purpose: |
Purpose: |
630 |
Confirm prompt to delete the supplied page id. |
Confirm prompt to delete the supplied page id. |
631 |
**********************************************************/ |
**********************************************************/ |
632 |
function deletePageConfirm($con, $page_id){ |
function deletePageConfirm($page_id){ |
633 |
|
|
634 |
// Load globals |
// Load globals |
635 |
include ("global_vars.php"); |
include ("global_vars.php"); |
640 |
// Include the page header |
// Include the page header |
641 |
include ($GLOBAL_ADMIN_INC."scribe_header.phtml"); |
include ($GLOBAL_ADMIN_INC."scribe_header.phtml"); |
642 |
|
|
643 |
// HTML junk |
// HTML header |
644 |
printf("<html>\n"); |
printf("<html>\n"); |
645 |
printf("<head>\n"); |
printf("<head>\n"); |
646 |
printf("<title>PageScribe: Delete Page?</title>\n"); |
printf("<title>PageScribe: Delete Page?</title>\n"); |
647 |
printf("<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n", $GLOBAL_ADMIN_CSS); |
printf("<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n", $GLOBAL_ADMIN_CSS); |
648 |
printf("</head>"); |
printf("</head>\n"); |
649 |
|
|
650 |
// Draw page heading |
msgTableOpen(1, "Delete Page (ID# " . $page_id . ")?"); |
|
printf("<center><h3>Delete Page?</h3>"); |
|
651 |
|
|
652 |
// Check to see if its possible |
// Check to see if its possible |
653 |
$exists = existsRow($con, "page", "page_id", $page_id); |
$exists = existsRow("page", "page_id", $page_id); |
654 |
if ($exists > 0){ |
if ($exists > 0){ |
655 |
|
|
|
// Table |
|
|
printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\">"); |
|
|
printf("<tr><td>"); |
|
|
|
|
656 |
// Lookup the title & author |
// Lookup the title & author |
657 |
$page_title = lookupField($con, "page", "page_id", $page_id, "page_title"); |
$page_title = lookupField("page", "page_id", $page_id, "page_title"); |
658 |
printf("<BR><strong>Page Title:</strong> %s<br>\n ", $page_title); |
printf("<b>Page Title:</b> %s<br><br>\n ", $page_title); |
659 |
|
printf("This will permanently remove the page and its various assignments from the system.<br><br>\n"); |
660 |
|
|
661 |
// Form to draw the delete button |
// Form to draw the delete button |
662 |
printf("<form method = \"POST\" action = \"scribe_transaction.phtml\" >\n"); |
printf("<form method = \"POST\" action = \"scribe_transaction.phtml\" >\n"); |
663 |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deletePage\" >\n"); |
printf("<input type = \"Hidden\" name = \"transaction\" value = \"deletePage\" >\n"); |
664 |
printf("<input type = \"Hidden\" name = \"page_id\" value = \"%d\" >\n", $page_id); |
printf("<input type = \"Hidden\" name = \"page_id\" value = \"%d\" >\n", $page_id); |
|
printf("This will <b>permanently</b> remove the page and its various assignments from the system<BR><BR>\n"); |
|
665 |
printf("<center>\n"); |
printf("<center>\n"); |
666 |
|
|
667 |
// Interior table |
// Interior table |
683 |
|
|
684 |
// Close interior table |
// Close interior table |
685 |
printf("</table>\n"); |
printf("</table>\n"); |
|
|
|
|
// Close table |
|
|
printf("</td></tr></table>\n"); |
|
686 |
} |
} |
687 |
|
|
688 |
// Failed for whatever reason |
// Failed |
689 |
else if ($exists < 1) printf ("Page not found. Operation cancelled.<br>\n"); |
else if ($exists < 1) printf ("Page not found. Operation cancelled.<br><br>\n"); |
690 |
|
|
691 |
|
msgTableClose(); |
692 |
|
|
693 |
// Link to return to admin console |
// Link to return to admin console |
694 |
adminReturn(""); |
adminReturn(""); |
695 |
|
|
|
|
|
|
printf("</center>"); |
|
|
|
|
696 |
// Include the footer |
// Include the footer |
697 |
include ($GLOBAL_ADMIN_INC."scribe_footer.phtml"); |
include ($GLOBAL_ADMIN_INC."scribe_footer.phtml"); |
698 |
} |
} |
701 |
/********************************************************** |
/********************************************************** |
702 |
Function: deletePageStaff |
Function: deletePageStaff |
703 |
Author: Paul Bramscher |
Author: Paul Bramscher |
704 |
Last Modified: 04.22.2003 |
Last Modified: 03.03.2004 |
705 |
*********************************************************** |
*********************************************************** |
706 |
Purpose: |
Purpose: |
707 |
Delete a staffperson (possibly multiple) associated with |
Delete a staffperson (possibly multiple) associated with |
708 |
the supplied page id. |
the supplied page id. |
709 |
**********************************************************/ |
**********************************************************/ |
710 |
function deletePageStaff($con, $page_id, $staff_list_array){ |
function deletePageStaff($page_id, $staff_list_array){ |
711 |
|
|
712 |
for ($element = 0; $element < sizeof($staff_list_array); $element++) { |
for ($element = 0; $element < sizeof($staff_list_array); $element++) { |
713 |
$sql = "DELETE FROM page_staff where page_id = " . $page_id . |
$sql = "DELETE FROM page_staff where page_id = " . $page_id . |
714 |
" AND staff_id = " . $staff_list_array[$element]; |
" AND staff_id = " . $staff_list_array[$element]; |
715 |
|
|
716 |
// Failed |
mysql_tryquery($sql); |
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
717 |
} |
} |
718 |
|
|
719 |
// Call the PageScribe page back |
// Call the PageScribe page back |
722 |
|
|
723 |
|
|
724 |
/********************************************************** |
/********************************************************** |
|
Function: displayCourseHeader |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 04.24.2003 |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Output the course related information for a course page. |
|
|
**********************************************************/ |
|
|
function displayCourseHeader($con, $page_id, $page_title) { |
|
|
|
|
|
// Retrieve current information |
|
|
$sql = "SELECT * |
|
|
FROM |
|
|
course c |
|
|
LEFT JOIN term t using (term_id) |
|
|
LEFT JOIN campus p on c.campus_id = p.campus_id |
|
|
LEFT JOIN coursesub s on c.coursesub_id = s.coursesub_id |
|
|
|
|
|
WHERE |
|
|
page_id = " . $page_id; |
|
|
|
|
|
$rs = mysql_query($sql, $con); |
|
|
$row = mysql_fetch_array ($rs); |
|
|
|
|
|
$course_id = $row["course_id"]; |
|
|
$staff_id_created = $row["staff_id_created"]; |
|
|
$staff_id_edited = $row["staff_id_edited"]; |
|
|
$coursesub_id = $row["coursesub_id"]; |
|
|
$coursesub = $row["coursesub"]; |
|
|
$course_num = $row["course_num"]; |
|
|
$course_section = $row["course_section"]; |
|
|
$course_concat = $row["course_concat"]; |
|
|
$term_id = $row["term_id"]; |
|
|
$term = $row["term"]; |
|
|
$course_year = $row["course_year"]; |
|
|
$campus_id = $row["campus_id"]; |
|
|
$campus = $row["campus"]; |
|
|
$courseheader = $row["courseheader"]; |
|
|
$introheader1 = $row["introheader1"]; |
|
|
$intromessage1 = $row["intromessage1"]; |
|
|
$introheader2 = $row["introheader2"]; |
|
|
$intromessage2 = $row["intromessage2"]; |
|
|
|
|
|
// Course Header |
|
|
if (strlen($courseheader) > 1) printf("%s<BR>\n", $courseheader); |
|
|
|
|
|
// Start the span class |
|
|
printf("<span class=\"S2\">"); |
|
|
|
|
|
// Display concatenated course title |
|
|
printf("%s", $course_concat); |
|
|
|
|
|
// Close the span |
|
|
printf("</span><BR><BR>\n"); |
|
|
|
|
|
// Display course term |
|
|
if (strlen($term) > 1 && $term_id > 1) printf("%s", $term); |
|
|
|
|
|
// Display Comma |
|
|
if (strlen($term) > 1 && strlen($course_year) > 1) printf(", "); |
|
|
|
|
|
// Display course year |
|
|
if (strlen($course_year) > 1) printf("%s", $course_year); |
|
|
|
|
|
printf("<BR>"); |
|
|
|
|
|
// Campus |
|
|
if (strlen($campus) > 0 && $campus_id > 1) printf("%s<BR>\n", $campus); |
|
|
|
|
|
// Intro header1 |
|
|
if (strlen($introheader1) > 0) { |
|
|
printf("<center><b>\n"); |
|
|
printf("%s", $introheader1); |
|
|
printf("</b></center><br>\n"); |
|
|
|
|
|
} |
|
|
|
|
|
// Intro Message1 |
|
|
if (strlen($intromessage1) > 0) { |
|
|
printf("%s", $intromessage1); |
|
|
printf("<br>\n"); |
|
|
} |
|
|
|
|
|
// Intro header2 |
|
|
if (strlen($introheader2) > 0) { |
|
|
printf("<center><b>\n"); |
|
|
printf("%s", $introheader2); |
|
|
printf("</b></center><br>\n"); |
|
|
|
|
|
} |
|
|
|
|
|
// Intro Message2 |
|
|
if (strlen($intromessage2) > 0) { |
|
|
printf("%s", $intromessage2); |
|
|
printf("<br>\n"); |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/********************************************************** |
|
|
Function: displayCoursePers |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 04.22.2003 |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Displays the personnel associated with the course, by |
|
|
looking up the course id based on the page id. |
|
|
**********************************************************/ |
|
|
function displayCoursePers($con, $page_id) { |
|
|
|
|
|
// Determine the course id |
|
|
$course_id = lookupfield($con, "course", "page_id", $page_id, "course_id"); |
|
|
|
|
|
// Retrieve current information |
|
|
$sql = "SELECT * |
|
|
FROM |
|
|
course_personnel cp |
|
|
LEFT JOIN staff s using (staff_id) |
|
|
LEFT JOIN stafftitle st on cp.stafftitle_id = st.stafftitle_id |
|
|
LEFT JOIN faculty f on cp.faculty_id = f.faculty_id |
|
|
|
|
|
WHERE |
|
|
course_id = " . $course_id . " ORDER BY personnel_id"; |
|
|
|
|
|
$rs = mysql_query($sql, $con); |
|
|
|
|
|
// See how many in this record set |
|
|
$num_personnel = mysql_num_rows($rs); |
|
|
|
|
|
if ($num_personnel > 0) { |
|
|
|
|
|
// Display course personnel |
|
|
printf("<BR>\n"); |
|
|
printf("<b>Personnel:</b><br>\n"); |
|
|
|
|
|
|
|
|
while ($row = mysql_fetch_array ($rs)) { |
|
|
|
|
|
// Initialize |
|
|
$last_name = ""; |
|
|
$first_name = ""; |
|
|
$x500 = ""; |
|
|
$email = ""; |
|
|
$stafftitle = ""; |
|
|
|
|
|
// Fetch the general stuff |
|
|
$personnel_id = $row["personnel_id"]; |
|
|
$staff_id = $row["staff_id"]; |
|
|
$faculty_id = $row["faculty_id"]; |
|
|
$stafftitle = $row["stafftitle"]; |
|
|
$stafftitle_id = $row["stafftitle_id"]; |
|
|
|
|
|
// Row is staff. (Not 0, NULL, 1=N/A). |
|
|
if ($staff_id > 1) { |
|
|
|
|
|
// Gather the staff table fields |
|
|
$last_name = $row["last_name"]; |
|
|
$first_name = $row["first_name"]; |
|
|
$x500 = $row["staff_account"]; |
|
|
$email = $x500 . "@umn.edu"; |
|
|
|
|
|
} |
|
|
|
|
|
// Row is faculty (Not 0, NULL, 1=N/A). |
|
|
else if ($faculty_id > 1) { |
|
|
|
|
|
// Gather the faculty table fields |
|
|
$last_name = $row["faculty_lastname"]; |
|
|
$first_name = $row["faculty_firstname"]; |
|
|
$x500 = $row["faculty_account"]; |
|
|
$email = $row["faculty_email"]; |
|
|
|
|
|
} |
|
|
|
|
|
// Row is "other", use the freetext fields |
|
|
else { |
|
|
|
|
|
// Gather the catch-all fields |
|
|
$last_name = $row["pers_lastname"]; |
|
|
$first_name = $row["pers_firstname"]; |
|
|
$x500 = $row["pers_account"]; |
|
|
$email = $row["pers_email"]; |
|
|
} |
|
|
|
|
|
|
|
|
// Display the data |
|
|
if ($stafftitle_id > 1) printf("%s: ", $stafftitle); |
|
|
printf("%s %s <a href=\"mailto:%s\">%s</a><br>\n", |
|
|
$first_name, $last_name, $email, $email); |
|
|
|
|
|
} // all course_personnel rows |
|
|
|
|
|
} // if there were any persons attached to this course |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/********************************************************** |
|
725 |
Function: displayTOC |
Function: displayTOC |
726 |
Author: Paul Bramscher |
Author: Paul Bramscher |
727 |
Last Modified: 12.15.2003 |
Last Modified: 03.03.2004 |
728 |
*********************************************************** |
*********************************************************** |
729 |
Purpose: |
Purpose: |
730 |
Generates and displays a table of contents (TOC) for the |
Generates and displays a table of contents (TOC) for the |
735 |
two-column table of contents, split at the midpoint |
two-column table of contents, split at the midpoint |
736 |
(rounded up for odd numbers of root elements). |
(rounded up for odd numbers of root elements). |
737 |
**********************************************************/ |
**********************************************************/ |
738 |
function displayTOC($con, $page_id, $wrap_toc) { |
function displayTOC($page_id, $wrap_toc) { |
739 |
|
|
740 |
// Calculate number of elements |
// Calculate number of elements |
741 |
$sql = "SELECT COUNT(*) as num_elements FROM element WHERE indent_level < 1 AND page_id = " |
$sql = "SELECT COUNT(*) as num_elements FROM element WHERE indent_level < 1 AND page_id = " |
742 |
. $page_id; |
. $page_id; |
743 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
744 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
745 |
$num_elements = $row["num_elements"]; |
$num_elements = $row["num_elements"]; |
746 |
|
|
747 |
// Calculate midpoint element |
// Calculate midpoint element |
780 |
. $page_id |
. $page_id |
781 |
. " AND e.indent_level < 1 ORDER BY e.element_order"; |
. " AND e.indent_level < 1 ORDER BY e.element_order"; |
782 |
|
|
783 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
784 |
|
|
785 |
// Build a general ToC anchor |
// Build a general ToC anchor |
786 |
printf("<a name=\"toc\"></a>\n"); |
printf("<a name=\"toc\"></a>\n"); |
795 |
|
|
796 |
$row_num = 0; |
$row_num = 0; |
797 |
|
|
798 |
while ($row = mysql_fetch_array ($rs)) { |
while ($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) { |
799 |
|
|
800 |
// Check for the midpoint |
// Check for the midpoint |
801 |
if ($wrap_toc == 1) |
if ($wrap_toc == 1) |
863 |
} |
} |
864 |
|
|
865 |
|
|
|
/********************************************************** |
|
|
Function: elementDecrease |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 10.29.2002 |
|
|
*********************************************************** |
|
|
Incoming: |
|
|
$con Database connection string |
|
|
$element_id Element to perform decrease on |
|
|
$page_id Page the element is location on |
|
|
$position Position on the page |
|
|
*********************************************************** |
|
|
Outgoing: |
|
|
None |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Decreases the output size of the element. Note that the |
|
|
HTML <H> tag operates in reverse, with H1 typically being |
|
|
larger than H5. So this increase effectively increases the |
|
|
numerical value of the tag. |
|
|
|
|
|
If the user shrinks below 5, set it equal to zero, which |
|
|
means that the <H> tag will be unused by the system. |
|
|
|
|
|
NOTE: This has been deprecated with the elementSize() |
|
|
function. It is not currently being used. |
|
|
**********************************************************/ |
|
|
function elementDecrease($con, $element_id, $page_id, $position){ |
|
|
|
|
|
// Get current element size |
|
|
$sql = "SELECT element_size FROM element WHERE element_id = " |
|
|
. $element_id |
|
|
. " AND page_id = " |
|
|
. $page_id; |
|
|
$rs = mysql_query($sql, $con); |
|
|
$row = mysql_fetch_array ($rs); |
|
|
$element_size = $row["element_size"]; |
|
|
|
|
|
// Default to <H5> if nothing specified |
|
|
if ($element_size < 1) $element_size = 5; |
|
|
|
|
|
// Original was less than 5. Note that we don't shrink smaller than 5. |
|
|
else if ($element_size < 5) $element_size++; |
|
|
|
|
|
// Else get rid of the size value altogether |
|
|
else if ($element_size == 5) $element_size = 0; |
|
|
|
|
|
$sql = "UPDATE element SET element_size = " |
|
|
. $element_size |
|
|
. " WHERE page_id = " |
|
|
. $page_id |
|
|
. " AND element_id = " |
|
|
. $element_id; |
|
|
|
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { // Success call the page back |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
|
|
|
header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position); |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
866 |
/********************************************************** |
/********************************************************** |
867 |
Function: elementDown |
Function: elementDown |
868 |
Author: Paul Bramscher |
Author: Paul Bramscher |
869 |
Last Modified: 09.24.2002 |
Last Modified: 03.04.2004 |
870 |
*********************************************************** |
*********************************************************** |
871 |
Incoming: |
Incoming: |
|
$con Database connection string |
|
872 |
$element_id Element to move down |
$element_id Element to move down |
873 |
$page_id Page the element is location on |
$page_id Page the element is location on |
874 |
$position Position on the page |
$position Position on the page |
891 |
to its position. With the next iteration, perhaps... |
to its position. With the next iteration, perhaps... |
892 |
**********************************************************/ |
**********************************************************/ |
893 |
|
|
894 |
function elementDown($con, $element_id, $page_id, $position) { |
function elementDown($element_id, $page_id, $position) { |
895 |
|
|
896 |
// Get information about the element to move down |
// Get information about the element to move down |
897 |
$sql = "SELECT indent_level, parent_id, element_order FROM element WHERE page_id = " |
$sql = "SELECT indent_level, parent_id, element_order FROM element WHERE page_id = " |
898 |
. $page_id |
. $page_id |
899 |
. " AND element_id = " |
. " AND element_id = " |
900 |
. $element_id; |
. $element_id; |
901 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
902 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
903 |
$down_indent_level = $row["indent_level"]; |
$down_indent_level = $row["indent_level"]; |
904 |
$down_element_order = $row["element_order"]; |
$down_element_order = $row["element_order"]; |
905 |
|
|
912 |
. $down_element_order |
. $down_element_order |
913 |
. " ORDER BY element_order"; |
. " ORDER BY element_order"; |
914 |
|
|
915 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
916 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
917 |
$up_element_id = $row["element_id"]; |
$up_element_id = $row["element_id"]; |
918 |
$up_element_order = $row["element_order"]; |
$up_element_order = $row["element_order"]; |
919 |
|
|
933 |
. " AND element_order < " |
. " AND element_order < " |
934 |
. $up_element_order; |
. $up_element_order; |
935 |
|
|
936 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
937 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
938 |
$down_num = $row["down_num"]; |
$down_num = $row["down_num"]; |
939 |
|
|
940 |
// Add the element itself |
// Add the element itself |
951 |
. $up_element_order |
. $up_element_order |
952 |
. " ORDER BY element_order"; |
. " ORDER BY element_order"; |
953 |
|
|
954 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
955 |
|
|
956 |
// Flag to determine the end of this element's lineage |
// Flag to determine the end of this element's lineage |
957 |
$lineage = 1; |
$lineage = 1; |
972 |
descendant affected by a move. |
descendant affected by a move. |
973 |
*/ |
*/ |
974 |
|
|
975 |
while (($row = mysql_fetch_array ($rs)) && $lineage == 1) { |
while (($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) && $lineage == 1) { |
976 |
$desc_element_id = $row["element_id"]; |
$desc_element_id = $row["element_id"]; |
977 |
$desc_indent_level = $row["indent_level"]; |
$desc_indent_level = $row["indent_level"]; |
978 |
$desc_element_order = $row["element_order"]; |
$desc_element_order = $row["element_order"]; |
1001 |
. " AND element_order <= " |
. " AND element_order <= " |
1002 |
. $stop_element_order |
. $stop_element_order |
1003 |
. " ORDER BY element_order"; |
. " ORDER BY element_order"; |
1004 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
1005 |
|
|
1006 |
while ($row = mysql_fetch_array ($rs)) { |
while ($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) { |
1007 |
$mod_element_id = $row["element_id"]; |
$mod_element_id = $row["element_id"]; |
1008 |
$mod_indent_level = $row["indent_level"]; |
$mod_indent_level = $row["indent_level"]; |
1009 |
$mod_element_order = $row["element_order"]; |
$mod_element_order = $row["element_order"]; |
1030 |
. $page_id |
. $page_id |
1031 |
. " AND element_id = " |
. " AND element_id = " |
1032 |
. $mod_element_id; |
. $mod_element_id; |
1033 |
if (!mysql_query ($mod_sql, $con)){ |
mysql_tryquery($mod_sql); |
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { // Success |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} // moved an element up or down |
|
1034 |
|
|
1035 |
} // all affected elements |
} // all affected elements |
1036 |
|
|
1052 |
|
|
1053 |
} |
} |
1054 |
|
|
1055 |
|
|
|
/********************************************************** |
|
|
Function: elementIncrease |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 09.12.2002 |
|
|
*********************************************************** |
|
|
Incoming: |
|
|
$con Database connection string |
|
|
$element_id Element to perform decrease on |
|
|
$page_id Page the element is location on |
|
|
$position Position on the page |
|
|
*********************************************************** |
|
|
Outgoing: |
|
|
None |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Increases the output size of the element. Note that the |
|
|
HTML <H> tag operates in reverse, with H1 typically being |
|
|
larger than H5. So this increase effectively decreases the |
|
|
numerical value of the tag. |
|
|
|
|
|
NOTE: This has been deprecated with the elementSize() |
|
|
function. It is not currently being used. |
|
|
**********************************************************/ |
|
|
function elementIncrease($con, $element_id, $page_id, $position){ |
|
|
|
|
|
// Get current element size |
|
|
$sql = "SELECT element_size FROM element WHERE element_id = " |
|
|
. $element_id |
|
|
. " AND page_id = " |
|
|
. $page_id; |
|
|
$rs = mysql_query($sql, $con); |
|
|
$row = mysql_fetch_array ($rs); |
|
|
$element_size = $row["element_size"]; |
|
|
|
|
|
// Default to <H5> if nothing specified |
|
|
if ($element_size < 1) $element_size = 5; |
|
|
|
|
|
// Original was larger than 1. Note that we don't shrink smaller than 1. |
|
|
else if ($element_size > 1) $element_size--; |
|
|
|
|
|
$sql = "UPDATE element SET element_size = " |
|
|
. $element_size |
|
|
. " WHERE page_id = " |
|
|
. $page_id |
|
|
. " AND element_id = " |
|
|
. $element_id; |
|
|
|
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { // Success call the page back |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position); |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
1056 |
/********************************************************** |
/********************************************************** |
1057 |
Function: elementMultiFormat |
Function: elementMultiFormat |
1058 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1059 |
Last Modified: 06.25.2003 |
Last Modified: 03.03.2004 |
1060 |
*********************************************************** |
*********************************************************** |
1061 |
Incoming: |
Incoming: |
|
$con Database connection string |
|
1062 |
$auto_font_style Corresponds to 0-5 CSS style styles |
$auto_font_style Corresponds to 0-5 CSS style styles |
1063 |
$auto_indent_level Indent level upon which to apply |
$auto_indent_level Indent level upon which to apply |
1064 |
the changes. |
the changes. |
1072 |
particular indent level to the selected size on the |
particular indent level to the selected size on the |
1073 |
supplied page id. |
supplied page id. |
1074 |
**********************************************************/ |
**********************************************************/ |
1075 |
function elementMultiFormat($con, $auto_element_size, $auto_indent_level, $page_id){ |
function elementMultiFormat($auto_element_size, $auto_indent_level, $page_id){ |
1076 |
|
|
1077 |
// Build the SQL |
// Build the SQL |
1078 |
$sql = "UPDATE element SET element_size = " |
$sql = "UPDATE element SET element_size = " |
1081 |
. $page_id |
. $page_id |
1082 |
. " AND indent_level = " |
. " AND indent_level = " |
1083 |
. $auto_indent_level; |
. $auto_indent_level; |
1084 |
|
mysql_tryquery($sql); |
1085 |
if (!mysql_query ($sql, $con)){ |
header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position); |
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { // Success call the page back |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
|
|
|
header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position); |
|
|
} |
|
1086 |
|
|
1087 |
} |
} |
1088 |
|
|
1090 |
/********************************************************** |
/********************************************************** |
1091 |
Function: elementSize |
Function: elementSize |
1092 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1093 |
Last Modified: 02.18.2003 |
Last Modified: 03.03.2004 |
1094 |
*********************************************************** |
*********************************************************** |
1095 |
Incoming: |
Incoming: |
|
$con Database connection string |
|
1096 |
$element_id Element to perform decrease on |
$element_id Element to perform decrease on |
1097 |
$page_id Page the element is location on |
$page_id Page the element is location on |
1098 |
$position Position on the page |
$position Position on the page |
1108 |
5. This function is meant to deprecate the elementIncrease() |
5. This function is meant to deprecate the elementIncrease() |
1109 |
and elementDecrease() pair of functions. |
and elementDecrease() pair of functions. |
1110 |
**********************************************************/ |
**********************************************************/ |
1111 |
function elementSize($con, $element_id, $page_id, $position, $size){ |
function elementSize($element_id, $page_id, $position, $size){ |
1112 |
|
|
1113 |
// Error trap |
// Error trap |
1114 |
if ($size < 1) $size = 0; |
if ($size < 1) $size = 0; |
1120 |
. $page_id |
. $page_id |
1121 |
. " AND element_id = " |
. " AND element_id = " |
1122 |
. $element_id; |
. $element_id; |
1123 |
|
mysql_tryquery($sql); |
1124 |
if (!mysql_query ($sql, $con)){ |
header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position); |
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { // Success call the page back |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position); |
|
|
} |
|
|
|
|
1125 |
} |
} |
1126 |
|
|
1127 |
|
|
1128 |
/********************************************************** |
/********************************************************** |
1129 |
Function: elementUp |
Function: elementUp |
1130 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1131 |
Last Modified: 09.24.2002 |
Last Modified: 03.03.2004 |
1132 |
*********************************************************** |
*********************************************************** |
1133 |
Incoming: |
Incoming: |
|
$con Database connection string |
|
1134 |
$element_id Element to move up |
$element_id Element to move up |
1135 |
$page_id Page the element is location on |
$page_id Page the element is location on |
1136 |
$position Position on the page |
$position Position on the page |
1143 |
element is the "up set" rather than the "down set". See |
element is the "up set" rather than the "down set". See |
1144 |
comments under elementDown for further information. |
comments under elementDown for further information. |
1145 |
**********************************************************/ |
**********************************************************/ |
1146 |
function elementUp($con, $element_id, $page_id, $position) { |
function elementUp($element_id, $page_id, $position) { |
1147 |
|
|
1148 |
// Get information about the element to move up |
// Get information about the element to move up |
1149 |
$sql = "SELECT indent_level, parent_id, element_order FROM element WHERE page_id = " |
$sql = "SELECT indent_level, parent_id, element_order FROM element WHERE page_id = " |
1150 |
. $page_id |
. $page_id |
1151 |
. " AND element_id = " |
. " AND element_id = " |
1152 |
. $element_id; |
. $element_id; |
1153 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
1154 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
1155 |
$up_indent_level = $row["indent_level"]; |
$up_indent_level = $row["indent_level"]; |
1156 |
$up_element_order = $row["element_order"]; |
$up_element_order = $row["element_order"]; |
1157 |
|
|
1164 |
. $up_element_order |
. $up_element_order |
1165 |
. " ORDER BY element_order DESC"; |
. " ORDER BY element_order DESC"; |
1166 |
|
|
1167 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
1168 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
1169 |
$down_element_id = $row["element_id"]; |
$down_element_id = $row["element_id"]; |
1170 |
$down_element_order = $row["element_order"]; |
$down_element_order = $row["element_order"]; |
1171 |
|
|
1185 |
. " AND element_order < " |
. " AND element_order < " |
1186 |
. $up_element_order; |
. $up_element_order; |
1187 |
|
|
1188 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
1189 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
1190 |
$down_num = $row["down_num"]; |
$down_num = $row["down_num"]; |
1191 |
|
|
1192 |
// Add the element itself |
// Add the element itself |
1202 |
. " AND element_order > " |
. " AND element_order > " |
1203 |
. $up_element_order |
. $up_element_order |
1204 |
. " ORDER BY element_order"; |
. " ORDER BY element_order"; |
1205 |
|
$rs = mysql_tryquery($sql); |
|
$rs = mysql_query($sql, $con); |
|
1206 |
|
|
1207 |
// Flag to determine the end of this element's lineage |
// Flag to determine the end of this element's lineage |
1208 |
$lineage = 1; |
$lineage = 1; |
1223 |
descendant affected by a move. |
descendant affected by a move. |
1224 |
*/ |
*/ |
1225 |
|
|
1226 |
while (($row = mysql_fetch_array ($rs)) && $lineage == 1) { |
while (($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) && $lineage == 1) { |
1227 |
$desc_element_id = $row["element_id"]; |
$desc_element_id = $row["element_id"]; |
1228 |
$desc_indent_level = $row["indent_level"]; |
$desc_indent_level = $row["indent_level"]; |
1229 |
$desc_element_order = $row["element_order"]; |
$desc_element_order = $row["element_order"]; |
1252 |
. " AND element_order <= " |
. " AND element_order <= " |
1253 |
. $stop_element_order |
. $stop_element_order |
1254 |
. " ORDER BY element_order"; |
. " ORDER BY element_order"; |
1255 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
1256 |
|
|
1257 |
while ($row = mysql_fetch_array ($rs)) { |
while ($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) { |
1258 |
$mod_element_id = $row["element_id"]; |
$mod_element_id = $row["element_id"]; |
1259 |
$mod_indent_level = $row["indent_level"]; |
$mod_indent_level = $row["indent_level"]; |
1260 |
$mod_element_order = $row["element_order"]; |
$mod_element_order = $row["element_order"]; |
1281 |
. $page_id |
. $page_id |
1282 |
. " AND element_id = " |
. " AND element_id = " |
1283 |
. $mod_element_id; |
. $mod_element_id; |
1284 |
|
mysql_tryquery($mod_sql); |
|
if (!mysql_query ($mod_sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { // Success |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} // moved an element up or down |
|
|
|
|
1285 |
|
|
1286 |
} // all affected elements |
} // all affected elements |
1287 |
|
|
1296 |
/********************************************************** |
/********************************************************** |
1297 |
Function: getMaxIndent |
Function: getMaxIndent |
1298 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1299 |
Last Modified: 06.25.2003 |
Last Modified: 03.03.2004 |
1300 |
*********************************************************** |
*********************************************************** |
1301 |
Purpose: |
Purpose: |
1302 |
Return the maximum indent level for the supplied page id. |
Return the maximum indent level for the supplied page id. |
1303 |
**********************************************************/ |
**********************************************************/ |
1304 |
function getMaxIndent($con, $page_id){ |
function getMaxIndent($page_id){ |
1305 |
|
|
1306 |
// Initialize |
// Initialize |
1307 |
$max_indent = 0; |
$max_indent = 0; |
1310 |
$sql = "SELECT MAX(indent_level) AS max_indent FROM element WHERE page_id = " |
$sql = "SELECT MAX(indent_level) AS max_indent FROM element WHERE page_id = " |
1311 |
. $page_id; |
. $page_id; |
1312 |
|
|
1313 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
1314 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
1315 |
$max_indent = $row["max_indent"]; |
$max_indent = $row["max_indent"]; |
1316 |
|
|
1317 |
return $max_indent; |
return $max_indent; |
1321 |
/********************************************************** |
/********************************************************** |
1322 |
Function: insertCoursePers |
Function: insertCoursePers |
1323 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1324 |
Last Modified: 06.24.2003 |
Last Modified: 03.03.2004 |
1325 |
*********************************************************** |
*********************************************************** |
1326 |
Purpose: |
Purpose: |
1327 |
Associates the incoming personnel information with the |
Associates the incoming personnel information with the |
1330 |
member (existing or newly created on the fly), or a |
member (existing or newly created on the fly), or a |
1331 |
non-indexed TA. |
non-indexed TA. |
1332 |
**********************************************************/ |
**********************************************************/ |
1333 |
function insertCoursePers($con, $course_id, $faculty_id, |
function insertCoursePers($course_id, $faculty_id, |
1334 |
$page_id, $pers_email, $pers_firstname, $pers_lastname, |
$page_id, $pers_email, $pers_firstname, $pers_lastname, |
1335 |
$pers_type, $pers_account, $staff_id, $stafftitle_id){ |
$pers_type, $pers_account, $staff_id, $stafftitle_id){ |
1336 |
|
|
1366 |
|
|
1367 |
// Check for uniqueness |
// Check for uniqueness |
1368 |
$faculty_name_display = $pers_firstname . " " . $pers_lastname; |
$faculty_name_display = $pers_firstname . " " . $pers_lastname; |
1369 |
$exists_id = existsFaculty($con, $pers_firstname, $pers_lastname); |
$exists_id = existsFaculty($pers_firstname, $pers_lastname); |
1370 |
|
|
1371 |
if ($exists_id > 0) { |
if ($exists_id > 0) { |
1372 |
$err_code = 1; |
$err_code = 1; |
1392 |
. "', '" |
. "', '" |
1393 |
. $pers_email |
. $pers_email |
1394 |
. "')"; |
. "')"; |
1395 |
|
mysql_tryquery($sql); |
1396 |
mysql_query ("LOCK TABLE faculty WRITE", $con); |
$new_faculty_id = mysql_insert_id(); |
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
$new_faculty_id = mysql_insert_id($con); |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
1397 |
|
|
1398 |
// Now, build the SQL for the insert into course_personnel |
// Now, build the SQL for the insert into course_personnel |
1399 |
$sql = "INSERT INTO course_personnel (course_id, stafftitle_id, faculty_id) VALUES (" |
$sql = "INSERT INTO course_personnel (course_id, stafftitle_id, faculty_id) VALUES (" |
1437 |
|
|
1438 |
// Proceed if there are no error messages |
// Proceed if there are no error messages |
1439 |
if ($err_code == 0) { |
if ($err_code == 0) { |
1440 |
|
mysql_tryquery($sql); |
|
// Failed |
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
1441 |
|
|
1442 |
// Done. Call the PageScribe page back |
// Done. Call the PageScribe page back |
1443 |
header("Location: scribe.phtml?page_id=" . $page_id . "#coursePers"); |
header("Location: scribe.phtml?page_id=" . $page_id . "#coursePers"); |
1449 |
// Page header |
// Page header |
1450 |
require_once ($GLOBAL_ADMIN_INC."scribe_header.phtml"); |
require_once ($GLOBAL_ADMIN_INC."scribe_header.phtml"); |
1451 |
|
|
1452 |
printf("<center><h3>Adding Course Personnel...</h3>"); |
printf("<center><h3>Adding Course Personnel...</h3>\n"); |
1453 |
|
|
1454 |
// Table |
// Table |
1455 |
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">\n"); |
printf("<table width = \"60%%\" border = \"3\" cellpadding =\"4\" class=\"backLight\">\n"); |
1456 |
printf("<tr><td><br>\n"); |
printf("<tr><td>\n"); |
1457 |
printf("<strong>Messages:</strong><br>\n"); |
printf("<b>Messages:</b><br>\n"); |
1458 |
printf("%s", $err_msg); |
printf("%s", $err_msg); |
1459 |
printf("<BR><BR>\n"); |
printf("<br><br></td></tr></table>\n"); |
|
printf("</td></tr></table>\n"); |
|
1460 |
printf("</center>\n"); |
printf("</center>\n"); |
1461 |
|
|
1462 |
// Page footer |
// Page footer |
1470 |
/********************************************************** |
/********************************************************** |
1471 |
Function: insertScribeLabel |
Function: insertScribeLabel |
1472 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1473 |
Last Modified: 07.03.2003 |
Last Modified: 03.03.2004 |
1474 |
*********************************************************** |
*********************************************************** |
1475 |
Purpose: |
Purpose: |
1476 |
Inserts a "label" or free-text type PageScribe element onto |
Inserts a "label" or free-text type PageScribe element onto |
1477 |
a PageScribe page. |
a PageScribe page. |
1478 |
**********************************************************/ |
**********************************************************/ |
1479 |
function insertScribeLabel($con, $element_descr, $label, $label_url, $place_array_HTML, $page_id){ |
function insertScribeLabel($element_descr, $label, $label_url, $place_array_HTML, $page_id){ |
1480 |
|
|
1481 |
// Clean up strings |
// Clean up strings |
1482 |
$element_descr = textInmySQL($element_descr); |
$element_descr = textInmySQL($element_descr); |
1507 |
$position = $place_array[4]; |
$position = $place_array[4]; |
1508 |
|
|
1509 |
// First probe for the new parent_id |
// First probe for the new parent_id |
1510 |
$parent_id = parentProbe($con, $page_id, $prev_element_order, $prev_indent_level); |
$parent_id = parentProbe($page_id, $prev_element_order, $prev_indent_level); |
1511 |
|
|
1512 |
// Next, bump all of the following items down by one |
// Next, bump all of the following items down by one |
1513 |
$sql = "UPDATE element SET element_order = element_order + 1 WHERE page_id = " |
$sql = "UPDATE element SET element_order = element_order + 1 WHERE page_id = " |
1514 |
. $page_id . " AND element_order >= " . $prev_element_order; |
. $page_id . " AND element_order >= " . $prev_element_order; |
1515 |
|
mysql_tryquery($sql); |
|
// Make the change |
|
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
|
|
|
1516 |
|
|
1517 |
// Next insert the new label |
// Next insert the new label |
1518 |
$sql = "INSERT INTO element (page_id, label, label_url, element_descr, element_order, indent_level,parent_id) VALUES (" |
$sql = "INSERT INTO element (page_id, label, label_url, element_descr, element_order, indent_level,parent_id) VALUES (" |
1522 |
. $element_descr . "', " |
. $element_descr . "', " |
1523 |
. $prev_element_order . ", " |
. $prev_element_order . ", " |
1524 |
. $prev_indent_level . ", " |
. $prev_indent_level . ", " |
1525 |
. $parent_id . ")"; |
. $parent_id . ")"; |
1526 |
|
mysql_tryquery($sql); |
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
// Success |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
1527 |
} |
} |
1528 |
|
|
1529 |
header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position); |
header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position); |
1533 |
/********************************************************** |
/********************************************************** |
1534 |
Function: insertScribeLocation |
Function: insertScribeLocation |
1535 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1536 |
Last Modified: 07.03.2003 |
Last Modified: 03.03.2004 |
1537 |
*********************************************************** |
*********************************************************** |
1538 |
Purpose: |
Purpose: |
1539 |
Inserts location type element onto a PageScribe page. |
Inserts location type element onto a PageScribe page. |
1540 |
**********************************************************/ |
**********************************************************/ |
1541 |
function insertScribeLocation($con, $location_id, $place_array_HTML, $page_id){ |
function insertScribeLocation($location_id, $place_array_HTML, $page_id){ |
1542 |
|
|
1543 |
// Error checking |
// Error checking |
1544 |
if ($location_id > 0) { |
if ($location_id > 0) { |
1554 |
$position = $place_array[4]; |
$position = $place_array[4]; |
1555 |
|
|
1556 |
// First probe for the new parent_id |
// First probe for the new parent_id |
1557 |
$parent_id = parentProbe($con, $page_id, $prev_element_order, $prev_indent_level); |
$parent_id = parentProbe($page_id, $prev_element_order, $prev_indent_level); |
1558 |
|
|
1559 |
// Next, bump all of the following items down by one |
// Next, bump all of the following items down by one |
1560 |
$sql = "UPDATE element SET element_order = element_order + 1 WHERE page_id = " |
$sql = "UPDATE element SET element_order = element_order + 1 WHERE page_id = " |
1561 |
. $page_id . " AND element_order >= " . $prev_element_order; |
. $page_id . " AND element_order >= " . $prev_element_order; |
1562 |
|
mysql_tryquery($sql); |
|
// Make the change |
|
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
1563 |
|
|
1564 |
// Next insert the new location |
// Next insert the new location |
1565 |
$sql = "INSERT INTO element (page_id, location_id, element_order, indent_level,parent_id) VALUES (" |
$sql = "INSERT INTO element (page_id, location_id, element_order, indent_level,parent_id) VALUES (" |
1568 |
. $prev_element_order . ", " |
. $prev_element_order . ", " |
1569 |
. $prev_indent_level . ", " |
. $prev_indent_level . ", " |
1570 |
. $parent_id . ")"; |
. $parent_id . ")"; |
1571 |
if (!mysql_query ($sql, $con)){ |
mysql_tryquery($sql); |
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
// Success |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
1572 |
|
|
1573 |
} |
} |
1574 |
|
|
1579 |
/********************************************************** |
/********************************************************** |
1580 |
Function: insertScribeResource |
Function: insertScribeResource |
1581 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1582 |
Last Modified: 07.03.2003 |
Last Modified: 03.03.2004 |
1583 |
*********************************************************** |
*********************************************************** |
1584 |
Purpose: |
Purpose: |
1585 |
Inserts a resource type element onto a PageScribe page. |
Inserts a resource type element onto a PageScribe page. |
1586 |
**********************************************************/ |
**********************************************************/ |
1587 |
function insertScribeResource($con, $place_array_HTML, $resource_id, $page_id){ |
function insertScribeResource($place_array_HTML, $resource_id, $page_id){ |
1588 |
|
|
1589 |
// Error checking |
// Error checking |
1590 |
if ($resource_id > 0) { |
if ($resource_id > 0) { |
1600 |
$position = $place_array[4]; |
$position = $place_array[4]; |
1601 |
|
|
1602 |
// First probe for the new parent_id |
// First probe for the new parent_id |
1603 |
$parent_id = parentProbe($con, $page_id, $prev_element_order, $prev_indent_level); |
$parent_id = parentProbe($page_id, $prev_element_order, $prev_indent_level); |
1604 |
|
|
1605 |
// Next, bump all of the following items down by one |
// Next, bump all of the following items down by one |
1606 |
$sql = "UPDATE element SET element_order = element_order + 1 WHERE page_id = " |
$sql = "UPDATE element SET element_order = element_order + 1 WHERE page_id = " |
1607 |
. $page_id . " AND element_order >= " . $prev_element_order; |
. $page_id . " AND element_order >= " . $prev_element_order; |
1608 |
|
mysql_tryquery($sql); |
|
// Make the change |
|
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
1609 |
|
|
1610 |
// Next insert the new resource |
// Next insert the new resource |
1611 |
$sql = "INSERT INTO element (page_id, resource_id, element_order, indent_level,parent_id) VALUES (" |
$sql = "INSERT INTO element (page_id, resource_id, element_order, indent_level,parent_id) VALUES (" |
1614 |
. $prev_element_order . ", " |
. $prev_element_order . ", " |
1615 |
. $prev_indent_level . ", " |
. $prev_indent_level . ", " |
1616 |
. $parent_id . ")"; |
. $parent_id . ")"; |
1617 |
if (!mysql_query ($sql, $con)){ |
mysql_tryquery($sql); |
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
// Success |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
1618 |
|
|
1619 |
} |
} |
1620 |
|
|
1625 |
/********************************************************** |
/********************************************************** |
1626 |
Function: insertScribeRQS |
Function: insertScribeRQS |
1627 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1628 |
Last Modified: 07.03.2003 |
Last Modified: 03.03.2004 |
1629 |
*********************************************************** |
*********************************************************** |
1630 |
Purpose: |
Purpose: |
1631 |
This function performs the "RQS harvest". For the supplied |
This function performs the "RQS harvest". For the supplied |
1632 |
subject id, collect all of the resources and insert them |
subject id, collect all of the resources and insert them |
1633 |
as elements onto a PageScribe page. |
as elements onto a PageScribe page. |
1634 |
**********************************************************/ |
**********************************************************/ |
1635 |
function insertScribeRQS($con, $place_array_HTML, $subject_id, $page_id){ |
function insertScribeRQS($place_array_HTML, $subject_id, $page_id){ |
1636 |
|
|
1637 |
// Error checking |
// Error checking |
1638 |
if ($subject_id > 0) { |
if ($subject_id > 0) { |
1648 |
$position = $place_array[4]; |
$position = $place_array[4]; |
1649 |
|
|
1650 |
// First probe for the new parent_id |
// First probe for the new parent_id |
1651 |
$parent_id = parentProbe($con, $page_id, $prev_element_order, $prev_indent_level); |
$parent_id = parentProbe($page_id, $prev_element_order, $prev_indent_level); |
1652 |
|
|
1653 |
// Identify the number of new elements to add |
// Identify the number of new elements to add |
1654 |
$sql = "SELECT COUNT(*) as num_rqs from res_sub_infotype WHERE subject_id = " . $subject_id; |
$sql = "SELECT COUNT(*) as num_rqs from res_sub_infotype WHERE subject_id = " . $subject_id; |
1655 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
1656 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
1657 |
|
|
1658 |
// Pull out the possible display values |
// Pull out the possible display values |
1659 |
$num_rqs = $row["num_rqs"]; |
$num_rqs = $row["num_rqs"]; |
1666 |
. $num_rqs |
. $num_rqs |
1667 |
. " WHERE page_id = " |
. " WHERE page_id = " |
1668 |
. $page_id . " AND element_order >= " . $prev_element_order; |
. $page_id . " AND element_order >= " . $prev_element_order; |
1669 |
|
mysql_tryquery($sql); |
|
// Make the change |
|
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
1670 |
|
|
1671 |
// Cycle through the resources |
// Cycle through the resources |
1672 |
$sql = "SELECT rsi.resource_id, r.title |
$sql = "SELECT rsi.resource_id, r.title |
1675 |
WHERE subject_id = " . $subject_id . |
WHERE subject_id = " . $subject_id . |
1676 |
" ORDER BY r.title"; |
" ORDER BY r.title"; |
1677 |
|
|
1678 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
1679 |
while ($row = mysql_fetch_array ($rs)) { |
while ($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) { |
1680 |
|
|
1681 |
// Fetch resource |
// Fetch resource |
1682 |
$resource_id = $row["resource_id"]; |
$resource_id = $row["resource_id"]; |
1688 |
. $prev_element_order . ", " |
. $prev_element_order . ", " |
1689 |
. $prev_indent_level . ", " |
. $prev_indent_level . ", " |
1690 |
. $parent_id . ")"; |
. $parent_id . ")"; |
1691 |
if (!mysql_query ($i_sql, $con)){ |
mysql_tryquery($i_sql); |
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
// Success |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} // successful import |
|
1692 |
|
|
1693 |
// Increment element order |
// Increment element order |
1694 |
$prev_element_order++; |
$prev_element_order++; |
1707 |
/********************************************************** |
/********************************************************** |
1708 |
Function: insertScribeRQSLink |
Function: insertScribeRQSLink |
1709 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1710 |
Last Modified: 07.03.2003 |
Last Modified: 03.03.2004 |
1711 |
*********************************************************** |
*********************************************************** |
1712 |
Purpose: |
Purpose: |
1713 |
Inserts an RQS subject page element onto a PageScribe page. |
Inserts an RQS subject page element onto a PageScribe page. |
1714 |
**********************************************************/ |
**********************************************************/ |
1715 |
function insertScribeRQSLink($con, $place_array_HTML, $subject_id, $page_id){ |
function insertScribeRQSLink($place_array_HTML, $subject_id, $page_id){ |
1716 |
|
|
1717 |
// Error checking |
// Error checking |
1718 |
if ($subject_id > 0) { |
if ($subject_id > 0) { |
1728 |
$position = $place_array[4]; |
$position = $place_array[4]; |
1729 |
|
|
1730 |
// First probe for the new parent_id |
// First probe for the new parent_id |
1731 |
$parent_id = parentProbe($con, $page_id, $prev_element_order, $prev_indent_level); |
$parent_id = parentProbe($page_id, $prev_element_order, $prev_indent_level); |
1732 |
|
|
1733 |
// Next, bump all of the following items down by one |
// Next, bump all of the following items down by one |
1734 |
$sql = "UPDATE element SET element_order = element_order + 1 WHERE page_id = " |
$sql = "UPDATE element SET element_order = element_order + 1 WHERE page_id = " |
1735 |
. $page_id . " AND element_order >= " . $prev_element_order; |
. $page_id . " AND element_order >= " . $prev_element_order; |
1736 |
|
mysql_tryquery($sql); |
|
// Make the change |
|
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
1737 |
|
|
1738 |
// Next insert the new resource |
// Next insert the new resource |
1739 |
$sql = "INSERT INTO element (page_id, subject_id, element_order, indent_level,parent_id) VALUES (" |
$sql = "INSERT INTO element (page_id, subject_id, element_order, indent_level,parent_id) VALUES (" |
1742 |
. $prev_element_order . ", " |
. $prev_element_order . ", " |
1743 |
. $prev_indent_level . ", " |
. $prev_indent_level . ", " |
1744 |
. $parent_id . ")"; |
. $parent_id . ")"; |
1745 |
if (!mysql_query ($sql, $con)){ |
mysql_tryquery($sql); |
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
// Success |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
1746 |
|
|
1747 |
} |
} |
1748 |
|
|
1753 |
/********************************************************** |
/********************************************************** |
1754 |
Function: insertScribeService |
Function: insertScribeService |
1755 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1756 |
Last Modified: 07.03.2003 |
Last Modified: 03.03.2004 |
1757 |
*********************************************************** |
*********************************************************** |
1758 |
Purpose: |
Purpose: |
1759 |
Inserts a service type element onto a PageScribe page. |
Inserts a service type element onto a PageScribe page. |
1760 |
**********************************************************/ |
**********************************************************/ |
1761 |
function insertScribeService($con, $place_array_HTML, $page_id, $service_id){ |
function insertScribeService($place_array_HTML, $page_id, $service_id){ |
1762 |
|
|
1763 |
// Error checking |
// Error checking |
1764 |
if ($service_id > 0) { |
if ($service_id > 0) { |
1774 |
$position = $place_array[4]; |
$position = $place_array[4]; |
1775 |
|
|
1776 |
// First probe for the new parent_id |
// First probe for the new parent_id |
1777 |
$parent_id = parentProbe($con, $page_id, $prev_element_order, $prev_indent_level); |
$parent_id = parentProbe($page_id, $prev_element_order, $prev_indent_level); |
1778 |
|
|
1779 |
// Next, bump all of the following items down by one |
// Next, bump all of the following items down by one |
1780 |
$sql = "UPDATE element SET element_order = element_order + 1 WHERE page_id = " |
$sql = "UPDATE element SET element_order = element_order + 1 WHERE page_id = " |
1781 |
. $page_id . " AND element_order >= " . $prev_element_order; |
. $page_id . " AND element_order >= " . $prev_element_order; |
1782 |
|
mysql_tryquery($sql); |
|
// Make the change |
|
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
1783 |
|
|
1784 |
// Next insert the new service |
// Next insert the new service |
1785 |
$sql = "INSERT INTO element (page_id, service_id, element_order, indent_level,parent_id) VALUES (" |
$sql = "INSERT INTO element (page_id, service_id, element_order, indent_level,parent_id) VALUES (" |
1788 |
. $prev_element_order . ", " |
. $prev_element_order . ", " |
1789 |
. $prev_indent_level . ", " |
. $prev_indent_level . ", " |
1790 |
. $parent_id . ")"; |
. $parent_id . ")"; |
1791 |
if (!mysql_query ($sql, $con)){ |
mysql_tryquery($sql); |
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
// Success |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
1792 |
|
|
1793 |
} |
} |
1794 |
|
|
1799 |
/********************************************************** |
/********************************************************** |
1800 |
Function: insertScribeStaff |
Function: insertScribeStaff |
1801 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1802 |
Last Modified: 04.22.2003 |
Last Modified: 03.03.2004 |
1803 |
*********************************************************** |
*********************************************************** |
1804 |
Purpose: |
Purpose: |
1805 |
Inserts a staffperson as an element on a PageScribe page. |
Inserts a staffperson as an element on a PageScribe page. |
1806 |
**********************************************************/ |
**********************************************************/ |
1807 |
function insertScribeStaff($con, $place_array_HTML, $staff_id, $page_id){ |
function insertScribeStaff($place_array_HTML, $staff_id, $page_id){ |
1808 |
|
|
1809 |
// Split by comma separated values |
// Split by comma separated values |
1810 |
$place_array = split(",", $place_array_HTML); |
$place_array = split(",", $place_array_HTML); |
1817 |
$position = $place_array[4]; |
$position = $place_array[4]; |
1818 |
|
|
1819 |
// First probe for the new parent_id |
// First probe for the new parent_id |
1820 |
$parent_id = parentProbe($con, $page_id, $prev_element_order, $prev_indent_level); |
$parent_id = parentProbe($page_id, $prev_element_order, $prev_indent_level); |
1821 |
|
|
1822 |
// Next, bump all of the following items down by one |
// Next, bump all of the following items down by one |
1823 |
$sql = "UPDATE element SET element_order = element_order + 1 WHERE page_id = " |
$sql = "UPDATE element SET element_order = element_order + 1 WHERE page_id = " |
1824 |
. $page_id . " AND element_order >= " . $prev_element_order; |
. $page_id . " AND element_order >= " . $prev_element_order; |
1825 |
|
mysql_tryquery($sql); |
|
// Make the change |
|
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
1826 |
|
|
1827 |
// Next insert the new staff |
// Next insert the new staff |
1828 |
$sql = "INSERT INTO element (page_id, staff_id, element_order, indent_level,parent_id) VALUES (" |
$sql = "INSERT INTO element (page_id, staff_id, element_order, indent_level,parent_id) VALUES (" |
1831 |
. $prev_element_order . ", " |
. $prev_element_order . ", " |
1832 |
. $prev_indent_level . ", " |
. $prev_indent_level . ", " |
1833 |
. $parent_id . ")"; |
. $parent_id . ")"; |
1834 |
if (!mysql_query ($sql, $con)){ |
mysql_tryquery($sql); |
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
// Success |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
1835 |
|
|
1836 |
header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position); |
header("Location: scribe.phtml?page_id=" . $page_id . "#p" . $position); |
1837 |
} |
} |
1840 |
/********************************************************** |
/********************************************************** |
1841 |
Function: pageLoadStats |
Function: pageLoadStats |
1842 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1843 |
Last Modified: 04.23.2003 |
Last Modified: 03.03.2004 |
1844 |
*********************************************************** |
*********************************************************** |
1845 |
Purpose: |
Purpose: |
1846 |
Logs a statistical entry for a PageScribe/CourseLib page |
Logs a statistical entry for a PageScribe/CourseLib page |
1851 |
that the database doesn't grow too large. Currently there |
that the database doesn't grow too large. Currently there |
1852 |
exists no automatic mechanism to purge or archive stats. |
exists no automatic mechanism to purge or archive stats. |
1853 |
**********************************************************/ |
**********************************************************/ |
1854 |
function pageLoadStats($con, $page_id){ |
function pageLoadStats($page_id){ |
1855 |
|
|
1856 |
// Add a row for page usage |
// Add a row for page usage |
1857 |
|
|
1867 |
. ", now(), '" |
. ", now(), '" |
1868 |
. $user_ip |
. $user_ip |
1869 |
. "')"; |
. "')"; |
1870 |
|
mysql_tryquery($sql); |
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} // bad write |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
} // good write to the pagestats table |
|
1871 |
|
|
1872 |
} |
} |
1873 |
|
|
1875 |
/********************************************************** |
/********************************************************** |
1876 |
Function: pageTemplate |
Function: pageTemplate |
1877 |
Author: Paul Bramscher |
Author: Paul Bramscher |
1878 |
Last Modified: 12.15.2003 |
Last Modified: 03.03.2004 |
1879 |
*********************************************************** |
*********************************************************** |
1880 |
Purpose: |
Purpose: |
1881 |
Performs the clone or copy page functionality. Note that |
Performs the clone or copy page functionality. Note that |
1890 |
on the new page are all new and must be calculated on the |
on the new page are all new and must be calculated on the |
1891 |
fly. |
fly. |
1892 |
**********************************************************/ |
**********************************************************/ |
1893 |
function pageTemplate($con, $page_id, $sess_staff_id, $sess_staff_account){ |
function pageTemplate($page_id, $sess_staff_id, $sess_staff_account){ |
1894 |
|
|
1895 |
// First copy the page elements |
// First copy the page elements |
1896 |
$sql = "SELECT * FROM page WHERE page_id = " |
$sql = "SELECT * FROM page WHERE page_id = " |
1897 |
. $page_id; |
. $page_id; |
1898 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
1899 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
1900 |
|
|
1901 |
// Fetch results |
// Fetch results |
1902 |
$style_id = $row["style_id"]; |
$style_id = $row["style_id"]; |
1956 |
. $up_text |
. $up_text |
1957 |
. "')"; |
. "')"; |
1958 |
|
|
1959 |
//printf("sql was: %s", $sql); |
mysql_tryquery($sql); |
1960 |
|
$new_page_id = mysql_insert_id(); |
|
mysql_query ("LOCK TABLE page WRITE", $con); |
|
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
$new_page_id = mysql_insert_id($con); |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
|
|
|
1961 |
|
|
1962 |
// If a new stub was created, and this happens to be a course page, get the course id. |
// If a new stub was created, and this happens to be a course page, get the course id. |
1963 |
if ($new_page_id > 0 && $pagetype_id == 3) { |
if ($new_page_id > 0 && $pagetype_id == 3) { |
1964 |
$course_id = lookupfield($con, "course", "page_id", $page_id, "course_id"); |
$course_id = lookupfield("course", "page_id", $page_id, "course_id"); |
1965 |
} |
} |
1966 |
|
|
1967 |
|
|
1968 |
if ($course_id > 0 && $new_page_id > 0) { |
if ($course_id > 0 && $new_page_id > 0) { |
1969 |
|
|
|
|
|
1970 |
// Copy the course elements |
// Copy the course elements |
1971 |
$sql = "SELECT * FROM course WHERE page_id = " |
$sql = "SELECT * FROM course WHERE page_id = " |
1972 |
. $page_id; |
. $page_id; |
1973 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
1974 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
1975 |
|
|
1976 |
// Fetch results |
// Fetch results |
1977 |
$coursesub_id = $row["coursesub_id"]; |
$coursesub_id = $row["coursesub_id"]; |
2036 |
$introheader2 . "', '" . |
$introheader2 . "', '" . |
2037 |
$intromessage2 . "')"; |
$intromessage2 . "')"; |
2038 |
|
|
2039 |
if (!mysql_query($sql, $con)){ |
mysql_tryquery($sql); |
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
|
} // was a CourseScribe type page |
|
2040 |
|
|
2041 |
|
} // was a CourseScribe type page |
2042 |
|
|
2043 |
// Next, copy all elements |
// Next, copy all elements |
|
|
|
|
|
|
2044 |
// This is not the most efficient method, but it works for now. |
// This is not the most efficient method, but it works for now. |
2045 |
|
|
2046 |
|
|
2048 |
. $page_id |
. $page_id |
2049 |
. " ORDER BY element_id"; |
. " ORDER BY element_id"; |
2050 |
|
|
2051 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
2052 |
while ($row = mysql_fetch_array ($rs)) { |
while ($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) { |
2053 |
|
|
2054 |
// Fetch previous values |
// Fetch previous values |
2055 |
$element_id = $row["element_id"]; |
$element_id = $row["element_id"]; |
2082 |
if (strlen($element_descr) > 0) $element_descr = textInmySQL($element_descr); |
if (strlen($element_descr) > 0) $element_descr = textInmySQL($element_descr); |
2083 |
|
|
2084 |
// Calculate the new parent if needed |
// Calculate the new parent if needed |
2085 |
if ($parent_id > 0) $parent_id = parentProbe($con, $new_page_id, $element_order, $indent_level); |
if ($parent_id > 0) $parent_id = parentProbe($new_page_id, $element_order, $indent_level); |
2086 |
|
|
2087 |
// Insert the element onto the new page |
// Insert the element onto the new page |
2088 |
$clone_sql = "INSERT INTO element ( |
$clone_sql = "INSERT INTO element ( |
2115 |
$indent_level . ")"; |
$indent_level . ")"; |
2116 |
|
|
2117 |
// Execute the query |
// Execute the query |
2118 |
if (!mysql_query($clone_sql, $con)){ |
mysql_tryquery($clone_sql); |
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
2119 |
|
|
2120 |
} |
} |
2121 |
|
|
2127 |
/********************************************************** |
/********************************************************** |
2128 |
Function: pageTemplateConfirm |
Function: pageTemplateConfirm |
2129 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2130 |
Last Modified: 11.07.2003 |
Last Modified: 03.03.2004 |
2131 |
*********************************************************** |
*********************************************************** |
2132 |
Purpose: |
Purpose: |
2133 |
Prompts the author that he/she is about to template a |
Prompts the author that he/she is about to template a |
2134 |
page. |
page. |
2135 |
**********************************************************/ |
**********************************************************/ |
2136 |
function pageTemplateConfirm($con, $page_id, $sess_staff_id, $sess_staff_account){ |
function pageTemplateConfirm($page_id, $sess_staff_id, $sess_staff_account){ |
2137 |
|
|
2138 |
// Load globals |
// Load globals |
2139 |
include("global_vars.php"); |
include("global_vars.php"); |
2146 |
printf("<head>\n"); |
printf("<head>\n"); |
2147 |
printf("<title>%s: Confirm Clone & Load</title>\n", $GLOBAL_SYS_NAME); |
printf("<title>%s: Confirm Clone & Load</title>\n", $GLOBAL_SYS_NAME); |
2148 |
printf("<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n", $GLOBAL_ADMIN_CSS); |
printf("<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n", $GLOBAL_ADMIN_CSS); |
2149 |
printf("</head>"); |
printf("</head>\n"); |
2150 |
|
|
2151 |
// Table |
// Table |
2152 |
printf("<center>\n"); |
printf("<center>\n"); |
2154 |
printf("<tr><td class=\"cellPlain\">\n"); |
printf("<tr><td class=\"cellPlain\">\n"); |
2155 |
printf("Confirm Clone & Load"); |
printf("Confirm Clone & Load"); |
2156 |
printf("</td></tr>\n"); |
printf("</td></tr>\n"); |
2157 |
printf("<tr><td><br>\n"); |
printf("<tr><td>\n"); |
2158 |
|
|
2159 |
// Collect information |
// Collect information |
2160 |
$sql = "SELECT |
$sql = "SELECT |
2170 |
. $page_id |
. $page_id |
2171 |
. " AND p.staff_coordinator = s.staff_id"; |
. " AND p.staff_coordinator = s.staff_id"; |
2172 |
|
|
2173 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
2174 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
2175 |
|
|
2176 |
$page_title = strip_tags($row["page_title"]); |
$page_title = strip_tags($row["page_title"]); |
2177 |
$first_name = $row["first_name"]; |
$first_name = $row["first_name"]; |
2179 |
$staff_email = $row["staff_email"]; |
$staff_email = $row["staff_email"]; |
2180 |
$staff_name = $first_name . " " . $last_name; |
$staff_name = $first_name . " " . $last_name; |
2181 |
|
|
2182 |
printf("<b>Page Title: </b>%s<br>", $page_title); |
printf("<b>Page Title: </b>%s<br>\n", $page_title); |
2183 |
printf("<b>Coordinator: </b>%s <a href=\"mailto:%s\">%s</a><br><br>", $staff_name, $staff_email, $staff_email); |
printf("<b>Coordinator: </b>%s <a href=\"mailto:%s\">%s</a><br><br>\n", $staff_name, $staff_email, $staff_email); |
|
|
|
2184 |
printf("Before cloning this page, please consider seeking permission from and/or giving "); |
printf("Before cloning this page, please consider seeking permission from and/or giving "); |
2185 |
printf("attribution to the page author(s) of the original work.<br><br>\n"); |
printf("attribution to the page author(s) of the original work.<br><br>\n"); |
2186 |
|
|
2191 |
printf("<input type=\"hidden\" name =\"sess_staff_account\" value = \"%d\">\n", $sess_staff_account); |
printf("<input type=\"hidden\" name =\"sess_staff_account\" value = \"%d\">\n", $sess_staff_account); |
2192 |
printf("<input type=\"hidden\" name =\"sess_staff_id\" value = \"%d\">\n", $sess_staff_id); |
printf("<input type=\"hidden\" name =\"sess_staff_id\" value = \"%d\">\n", $sess_staff_id); |
2193 |
printf("<center><input type=\"submit\" value=\"Continue\"></center>\n"); |
printf("<center><input type=\"submit\" value=\"Continue\"></center>\n"); |
2194 |
printf("</td></tr></table>\n"); |
printf("<br><br></td></tr></table>\n"); |
2195 |
|
|
2196 |
// Link to return to admin console |
// Link to return to admin console |
2197 |
adminReturn(""); |
adminReturn(""); |
2206 |
/********************************************************** |
/********************************************************** |
2207 |
Function: parentIs |
Function: parentIs |
2208 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2209 |
Last Modified: 04.23.2003 |
Last Modified: 03.03.2004 |
2210 |
*********************************************************** |
*********************************************************** |
2211 |
Purpose: |
Purpose: |
2212 |
Tests the supplied element to determine whether it has any |
Tests the supplied element to determine whether it has any |
2213 |
children. |
children. |
2214 |
**********************************************************/ |
**********************************************************/ |
2215 |
function parentIs($con, $element_id, $page_id){ |
function parentIs($element_id, $page_id){ |
2216 |
|
|
2217 |
// First initialize the number of children |
// First initialize the number of children |
2218 |
$num_children = 0; |
$num_children = 0; |
2221 |
. $page_id |
. $page_id |
2222 |
. " AND parent_id = " |
. " AND parent_id = " |
2223 |
. $element_id; |
. $element_id; |
2224 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
2225 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
2226 |
$num_children = $row["num_children"]; |
$num_children = $row["num_children"]; |
2227 |
|
|
2228 |
return $num_children; |
return $num_children; |
2232 |
/********************************************************** |
/********************************************************** |
2233 |
Function: parentProbe |
Function: parentProbe |
2234 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2235 |
Last Modified: 11.20.2003 |
Last Modified: 03.03.2004 |
2236 |
*********************************************************** |
*********************************************************** |
2237 |
Purpose: |
Purpose: |
2238 |
Probes for a parent (if not a root-level element) of the |
Probes for a parent (if not a root-level element) of the |
2241 |
looking for the first previous element with an indent |
looking for the first previous element with an indent |
2242 |
(generation) level of precisely one less. |
(generation) level of precisely one less. |
2243 |
**********************************************************/ |
**********************************************************/ |
2244 |
function parentProbe($con, $page_id, $prev_element_order, $prev_indent_level){ |
function parentProbe($page_id, $prev_element_order, $prev_indent_level){ |
2245 |
|
|
2246 |
// If the item's indent level is 0, it is its own parent. Return 0. |
// If the item's indent level is 0, it is its own parent. Return 0. |
2247 |
if ($prev_indent_level < 1) $parent_id = 0; |
if ($prev_indent_level < 1) $parent_id = 0; |
2261 |
// Found parent tag |
// Found parent tag |
2262 |
$found = 0; |
$found = 0; |
2263 |
|
|
2264 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
2265 |
while (($row = mysql_fetch_array ($rs)) && $found == 0) { |
while (($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) && $found == 0) { |
2266 |
|
|
2267 |
/* Cycle through the list, looking for the first item with an indent |
/* Cycle through the list, looking for the first item with an indent |
2268 |
of less. */ |
of less. */ |
2288 |
/********************************************************** |
/********************************************************** |
2289 |
Function: pasteElement |
Function: pasteElement |
2290 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2291 |
Last Modified: 04.23.2003 |
Last Modified: 03.11.2004 |
2292 |
*********************************************************** |
*********************************************************** |
2293 |
Purpose: |
Purpose: |
2294 |
Copies the user's copy/paste buffer onto the supplied |
Copies the user's copy/paste buffer onto the supplied |
2296 |
This sort of logic required a fair amount of coffee to |
This sort of logic required a fair amount of coffee to |
2297 |
work out. |
work out. |
2298 |
**********************************************************/ |
**********************************************************/ |
2299 |
function pasteElement($con, $element_order, $indent_level, $page_id, $position, $sess_staff_id) { |
function pasteElement($element_order, $indent_level, $page_id, $position, $sess_staff_id) { |
2300 |
|
|
2301 |
// Debug mode: 0=off, 1=on. |
// Debug mode: 0=off, 1=on. |
2302 |
$debug = 0; |
$debug = 0; |
2303 |
|
|
2304 |
if ($debug == 1) { |
if ($debug == 1) { |
2305 |
printf("<BR><BR><h3>This will eventually paste your elements... Close, but not quite bug-free.</h3><BR>\n"); |
printf("<h3>Element Paste - Debug Mode</h3><br>\n"); |
2306 |
printf("On page id: %d<BR>\n", $page_id); |
printf("On page id: %d<br>\n", $page_id); |
2307 |
printf("It will go in order #%d<BR>\n", $element_order); |
printf("It will go in order #%d<br>\n", $element_order); |
2308 |
printf("Afterwards you'll return to pos: %d<BR>\n", $position); |
printf("Afterwards you'll return to pos: %d<br>\n", $position); |
2309 |
} |
} |
2310 |
|
|
2311 |
|
|
2313 |
$sql = "SELECT COUNT(*) as buffer_size FROM pastebuffer WHERE paste_staff_id = " |
$sql = "SELECT COUNT(*) as buffer_size FROM pastebuffer WHERE paste_staff_id = " |
2314 |
. $sess_staff_id |
. $sess_staff_id |
2315 |
. " ORDER BY element_order"; |
. " ORDER BY element_order"; |
2316 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
2317 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
2318 |
$buffer_size = $row["buffer_size"]; |
$buffer_size = $row["buffer_size"]; |
2319 |
|
|
2320 |
if ($debug == 1) printf("Number of elements in buffer: %s<BR>\n", $buffer_size); |
if ($debug == 1) printf("Number of elements in buffer: %s<br>\n", $buffer_size); |
2321 |
|
|
2322 |
|
|
2323 |
// Determine parent ID of first pasted element |
// Determine parent ID of first pasted element |
2325 |
. $page_id |
. $page_id |
2326 |
. " AND element_order = " |
. " AND element_order = " |
2327 |
. $element_order; |
. $element_order; |
2328 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
2329 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
2330 |
$adjust_parent_id = $row["element_id"]; |
$adjust_parent_id = $row["element_id"]; |
2331 |
|
|
2332 |
if ($debug == 1) printf("Parent of first element will be: %d<BR>", $adjust_parent_id); |
if ($debug == 1) printf("Parent of first element will be: %d<BR>", $adjust_parent_id); |
2340 |
. " AND element_order >= " |
. " AND element_order >= " |
2341 |
. $element_order; |
. $element_order; |
2342 |
|
|
2343 |
if ($debug == 1) printf("bump down sql was: %s<BR>", $sql); |
if ($debug == 1) printf("bump down sql was: %s<br>\n", $sql); |
|
|
|
2344 |
|
|
2345 |
if (!mysql_query($sql, $con)){ |
mysql_tryquery($sql); |
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
2346 |
|
|
2347 |
// Select from the paste buffer |
// Select from the paste buffer |
2348 |
$sql = "SELECT * FROM pastebuffer WHERE paste_staff_id = " |
$sql = "SELECT * FROM pastebuffer WHERE paste_staff_id = " |
2349 |
. $sess_staff_id |
. $sess_staff_id |
2350 |
. " ORDER BY element_order"; |
. " ORDER BY element_order"; |
2351 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
2352 |
|
|
2353 |
// row count |
// row count |
2354 |
$row_num = 0; |
$row_num = 0; |
2355 |
|
|
2356 |
while ($row = mysql_fetch_array ($rs)) { |
while ($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) { |
2357 |
|
|
2358 |
// Load copy-paste buffer elements |
// Load copy-paste buffer elements |
2359 |
$copy_indent_level = $row["indent_level"]; |
$copy_indent_level = $row["indent_level"]; |
2408 |
else $adjust_indent_level = $last_adjust_indent_level; |
else $adjust_indent_level = $last_adjust_indent_level; |
2409 |
|
|
2410 |
// Determine parent for all but the first item |
// Determine parent for all but the first item |
2411 |
$adjust_parent_id = parentProbe($con, $page_id, $adjust_element_order, $adjust_indent_level); |
$adjust_parent_id = parentProbe($page_id, $adjust_element_order, $adjust_indent_level); |
2412 |
|
|
2413 |
// Debugging |
// Debugging |
2414 |
if ($debug == 1) { |
if ($debug == 1) { |
2415 |
printf("new position start indent:<BR>"); |
printf("new position start indent:<br>\n"); |
2416 |
printf("last copy indent: %d, ", $last_copy_indent_level); |
printf("last copy indent: %d, ", $last_copy_indent_level); |
2417 |
printf("this copy indent: %d<BR>", $copy_indent_level); |
printf("this copy indent: %d<br>\n", $copy_indent_level); |
2418 |
printf("last adjust indent: %d, ", $last_adjust_indent_level); |
printf("last adjust indent: %d, ", $last_adjust_indent_level); |
2419 |
printf("this adjust indent: %d<br>", $adjust_indent_level); |
printf("this adjust indent: %d<br>\n", $adjust_indent_level); |
2420 |
|
|
2421 |
} |
} |
2422 |
|
|
2463 |
. ")"; |
. ")"; |
2464 |
|
|
2465 |
// Debugging |
// Debugging |
2466 |
if ($debug == 1) printf("insert sql was: %s<BR>\n", $p_sql); |
if ($debug == 1) printf("insert sql was: %s<br>\n", $p_sql); |
2467 |
|
|
2468 |
// Perform the write |
// Perform the write |
2469 |
mysql_query ("LOCK TABLE element WRITE", $con); |
mysql_tryquery($p_sql); |
2470 |
if (!mysql_query($p_sql, $con)){ |
$paste_element_id = mysql_insert_id(); |
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
$paste_element_id = mysql_insert_id($con); |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
2471 |
|
|
2472 |
// Debugging |
// Debugging |
2473 |
if ($debug == 1) { |
if ($debug == 1) { |
2474 |
printf("insert sql was: %s<BR>\n", $p_sql); |
printf("insert sql was: %s<br>\n", $p_sql); |
2475 |
printf("<b>inserted id was: %d</b><Br>\n", $paste_element_id); |
printf("<b>inserted id was: %d</b><br>\n", $paste_element_id); |
2476 |
printf("<b>adjust parent was: %d</b><Br>\n", $adjust_parent_id); |
printf("<b>adjust parent was: %d</b><br>\n", $adjust_parent_id); |
2477 |
printf("<b>adjust order was: %d</b><Br><BR>\n", $adjust_element_order); |
printf("<b>adjust order was: %d</b><br><br>\n", $adjust_element_order); |
2478 |
} |
} |
2479 |
|
|
2480 |
// Track some variables |
// Track some variables |
2491 |
/********************************************************** |
/********************************************************** |
2492 |
Function: populateGenArray |
Function: populateGenArray |
2493 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2494 |
Last Modified: 06.30.2003 |
Last Modified: 03.03.2004 |
2495 |
*********************************************************** |
*********************************************************** |
2496 |
Purpose: |
Purpose: |
2497 |
Builds an array from 0 (unused empty placeholder) to N, |
Builds an array from 0 (unused empty placeholder) to N, |
2501 |
is created outside the function. This function modifies |
is created outside the function. This function modifies |
2502 |
and returns it. |
and returns it. |
2503 |
**********************************************************/ |
**********************************************************/ |
2504 |
function populateGenArray($con, &$genArray, $page_id) { |
function populateGenArray(&$genArray, $page_id) { |
2505 |
|
|
2506 |
// Initialize the 0th (unused) array element |
// Initialize the 0th (unused) array element |
2507 |
$genArray[0] = 0; |
$genArray[0] = 0; |
2512 |
WHERE page_id = " |
WHERE page_id = " |
2513 |
. $page_id |
. $page_id |
2514 |
. " ORDER BY element_order"; |
. " ORDER BY element_order"; |
2515 |
|
$rs = mysql_tryquery($sql); |
|
$rs = mysql_query($sql, $con); |
|
2516 |
|
|
2517 |
// Start populating generation array subscript [1] |
// Start populating generation array subscript [1] |
2518 |
$rowcount = 1; |
$rowcount = 1; |
2519 |
|
|
2520 |
while ($row = mysql_fetch_array ($rs)) { |
while ($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) { |
2521 |
|
|
2522 |
// Fetch values |
// Fetch values |
2523 |
$element_order = $row["element_order"]; |
$element_order = $row["element_order"]; |
2539 |
/********************************************************** |
/********************************************************** |
2540 |
Function: scribePublish |
Function: scribePublish |
2541 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2542 |
Last Modified: 04.23.2003 |
Last Modified: 03.11.2004 |
2543 |
*********************************************************** |
*********************************************************** |
2544 |
Purpose: |
Purpose: |
2545 |
Performs the PageScribe/CourseLib page publish functionality. |
Performs the PageScribe/CourseLib page publish functionality. |
2553 |
page for published pages) if there are concerns about page load |
page for published pages) if there are concerns about page load |
2554 |
performance issues with the fully dynamic version. |
performance issues with the fully dynamic version. |
2555 |
**********************************************************/ |
**********************************************************/ |
2556 |
function scribePublish($con, $page_id) { |
function scribePublish($page_id) { |
2557 |
|
|
2558 |
|
|
2559 |
/* |
/* |
2577 |
|
|
2578 |
// printf("sql was: %s", $sql); |
// printf("sql was: %s", $sql); |
2579 |
|
|
2580 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
2581 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
2582 |
$coursesub_id = $row["coursesub_id"]; |
$coursesub_id = $row["coursesub_id"]; |
2583 |
$pagetype_id = $row["pagetype_id"]; |
$pagetype_id = $row["pagetype_id"]; |
2584 |
|
|
2597 |
printf("<head>\n"); |
printf("<head>\n"); |
2598 |
printf("<title>%s: Missing Information</title>\n", $GLOBAL_SYS_NAME); |
printf("<title>%s: Missing Information</title>\n", $GLOBAL_SYS_NAME); |
2599 |
printf("<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n", $GLOBAL_ADMIN_CSS); |
printf("<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n", $GLOBAL_ADMIN_CSS); |
2600 |
printf("</head>"); |
printf("</head>\n"); |
2601 |
|
|
2602 |
// Draw form heading |
// Draw form heading |
2603 |
printf("<center><h3>%s: Missing Information</h3>\n", $GLOBAL_SYS_NAME); |
printf("<center><h3>%s: Missing Information</h3>\n", $GLOBAL_SYS_NAME); |
2604 |
|
|
2605 |
// Table |
// Table |
2606 |
printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\">\n"); |
printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\">\n"); |
2607 |
printf("<tr><td><br>\n"); |
printf("<tr><td>\n"); |
2608 |
printf("<strong>Messages:</strong><br>\n"); |
printf("<b>Messages:</b><br>\n"); |
2609 |
printf("CourseLib pages may not be published without a course designator. "); |
printf("CourseLib pages may not be published without a course designator. "); |
2610 |
printf("This is a required field -- please go back and select a course designator. "); |
printf("This is a required field -- please go back and select a course designator. "); |
2611 |
printf("If one does not apply, this should probably be a PageScribe page instead.<BR><BR>\n"); |
printf("If one does not apply, this should probably be a PageScribe page instead.<br><br>\n"); |
2612 |
|
|
2613 |
printf("</td></tr></table>\n"); |
printf("</td></tr></table>\n"); |
2614 |
|
|
2638 |
// Clear out existing published information |
// Clear out existing published information |
2639 |
// This is important, also, to get rid of a NULL value before performing a CONCAT below. |
// This is important, also, to get rid of a NULL value before performing a CONCAT below. |
2640 |
$sql = "UPDATE page set pageHTML = '' WHERE page_id = " . $page_id; |
$sql = "UPDATE page set pageHTML = '' WHERE page_id = " . $page_id; |
2641 |
|
mysql_tryquery($sql); |
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} // bad write |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
2642 |
|
|
2643 |
// Open the filepointer for a screen dump |
// Open the filepointer for a screen dump |
2644 |
$fp = fopen ($page_loc, "r"); |
$fp = fopen ($page_loc, "r"); |
2660 |
|
|
2661 |
// Concatenate the stream into the pageHTML field |
// Concatenate the stream into the pageHTML field |
2662 |
$sql = "UPDATE page set pageHTML = CONCAT(pageHTML,'" . $iostream_fix . "') WHERE page_id = " . $page_id; |
$sql = "UPDATE page set pageHTML = CONCAT(pageHTML,'" . $iostream_fix . "') WHERE page_id = " . $page_id; |
2663 |
|
mysql_tryquery($sql); |
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
printf("sql was: %s<BR>", $sql); |
|
|
bailout(); |
|
|
} // bad write |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} // good write |
|
2664 |
} |
} |
2665 |
|
|
2666 |
// Close up the open file pointer |
// Close up the open file pointer |
2668 |
|
|
2669 |
// Set published flag to 1 |
// Set published flag to 1 |
2670 |
$sql = "UPDATE page set published = '1' WHERE page_id = " . $page_id; |
$sql = "UPDATE page set published = '1' WHERE page_id = " . $page_id; |
2671 |
|
mysql_tryquery($sql); |
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} // bad write |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
} // good write |
|
2672 |
|
|
2673 |
} // end open file pointer |
} // end open file pointer |
2674 |
|
|
2675 |
end of comment-out */ |
end of comment-out */ |
2676 |
|
|
2677 |
/********************************************************************* |
/********************************************************************* |
2678 |
** Comment out this portion if static page functionality is desired ** |
** Comment out this portion if static page functionality is desired ** |
2680 |
|
|
2681 |
// Set published flag to 1 |
// Set published flag to 1 |
2682 |
$sql = "UPDATE page set published = '1' WHERE page_id = " . $page_id; |
$sql = "UPDATE page set published = '1' WHERE page_id = " . $page_id; |
2683 |
|
mysql_tryquery($sql); |
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} // bad write |
|
|
else { |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
|
|
|
} // good write |
|
2684 |
|
|
2685 |
/*********************** |
/*********************** |
2686 |
** End of comment-out ** |
** End of comment-out ** |
2696 |
/********************************************************** |
/********************************************************** |
2697 |
Function: scribeUnpublish |
Function: scribeUnpublish |
2698 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2699 |
Last Modified: 04.23.2003 |
Last Modified: 03.03.2004 |
2700 |
*********************************************************** |
*********************************************************** |
2701 |
Purpose: |
Purpose: |
2702 |
Unpublishes the supplied page id. Note that we set both |
Unpublishes the supplied page id. Note that we set both |
2703 |
the pageHTML to NULL and flip the published flag back to |
the pageHTML to NULL and flip the published flag back to |
2704 |
0 (FALSE). |
0 (FALSE). |
2705 |
**********************************************************/ |
**********************************************************/ |
2706 |
function scribeUnpublish($con, $page_id) { |
function scribeUnpublish($page_id) { |
2707 |
|
|
2708 |
// Build the SQL |
// Build the SQL |
2709 |
$sql = "UPDATE page SET pageHTML = NULL, published = '0' WHERE page_id =" . $page_id; |
$sql = "UPDATE page SET pageHTML = NULL, published = '0' WHERE page_id =" . $page_id; |
2710 |
|
mysql_tryquery($sql); |
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
2711 |
|
|
2712 |
header("Location: scribe.phtml?page_id=" . $page_id); |
header("Location: scribe.phtml?page_id=" . $page_id); |
2713 |
} |
} |
2714 |
|
|
2715 |
|
|
2716 |
/********************************************************** |
/********************************************************** |
|
Function: siblingElderProbe |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 04.23.2003 |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Tests the supplied element to see whether it has an elder |
|
|
sibling. If so, then this element (and descendants) may |
|
|
be moved up a position and the up arrow becomes available |
|
|
on the PageScribe/CourseLib authoring page. |
|
|
**********************************************************/ |
|
|
function siblingElderProbe($con, $page_id, $place_array){ |
|
|
|
|
|
// Break apart place array |
|
|
$prev_element_id = $place_array[0]; |
|
|
$prev_element_order = $place_array[1]; |
|
|
$prev_indent_level = $place_array[2]; |
|
|
$prev_parent_id = $place_array[3]; |
|
|
$prev_position = $place_array[4]; |
|
|
|
|
|
// Error checking |
|
|
if ($prev_indent_level < 1) $prev_indent_level = 0; |
|
|
if ($prev_parent_id < 1) $prev_parent_id = 0; |
|
|
if ($prev_element_order < 1) $prev_element_order = 0; |
|
|
|
|
|
// ID of elder sibling |
|
|
$element_id = 0; |
|
|
|
|
|
$sql = "SELECT element_id, element_order FROM element WHERE page_id = " |
|
|
. $page_id |
|
|
. " AND indent_level = " |
|
|
. $prev_indent_level |
|
|
. " AND parent_id = " |
|
|
. $prev_parent_id |
|
|
. " AND element_order < " |
|
|
. $prev_element_order |
|
|
. " ORDER BY element_order DESC LIMIT 1"; |
|
|
|
|
|
$rs = mysql_query($sql, $con); |
|
|
$row = mysql_fetch_array ($rs); |
|
|
$element_id = $row["element_id"]; |
|
|
|
|
|
return $element_id; |
|
|
} |
|
|
|
|
|
|
|
|
/********************************************************** |
|
|
Function: siblingYoungerProbe |
|
|
Author: Paul Bramscher |
|
|
Last Modified: 04.23.2003 |
|
|
*********************************************************** |
|
|
Purpose: |
|
|
Tests the supplied element to see whether it has a younger |
|
|
sibling. If so, then this element (and descendants) may |
|
|
be moved down a position and the down arrow becomes available |
|
|
on the PageScribe/CourseLib authoring page. |
|
|
**********************************************************/ |
|
|
function siblingYoungerProbe($con, $page_id, $place_array){ |
|
|
|
|
|
// Break apart place array |
|
|
$prev_element_id = $place_array[0]; |
|
|
$prev_element_order = $place_array[1]; |
|
|
$prev_indent_level = $place_array[2]; |
|
|
$prev_parent_id = $place_array[3]; |
|
|
$prev_position = $place_array[4]; |
|
|
|
|
|
// Error checking |
|
|
if ($prev_indent_level < 1) $prev_indent_level = 0; |
|
|
if ($prev_parent_id < 1) $prev_parent_id = 0; |
|
|
if ($prev_element_order < 1) $prev_element_order = 0; |
|
|
|
|
|
// Younger sibling ID |
|
|
$element_id = 0; |
|
|
|
|
|
$sql = "SELECT element_id, element_order FROM element WHERE page_id = " |
|
|
. $page_id |
|
|
. " AND indent_level = " |
|
|
. $prev_indent_level |
|
|
. " AND parent_id = " |
|
|
. $prev_parent_id |
|
|
. " AND element_order > " |
|
|
. $prev_element_order |
|
|
. " ORDER BY element_order LIMIT 1"; |
|
|
|
|
|
$rs = mysql_query($sql, $con); |
|
|
$row = mysql_fetch_array ($rs); |
|
|
$element_id = $row["element_id"]; |
|
|
|
|
|
return $element_id; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/********************************************************** |
|
2717 |
Function: sibProbeElder |
Function: sibProbeElder |
2718 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2719 |
Last Modified: 06.30.2003 |
Last Modified: 06.30.2003 |
2804 |
/********************************************************** |
/********************************************************** |
2805 |
Function: toggleTOCDisplay |
Function: toggleTOCDisplay |
2806 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2807 |
Last Modified: 04.24.2003 |
Last Modified: 03.03.2004 |
2808 |
*********************************************************** |
*********************************************************** |
2809 |
Purpose: |
Purpose: |
2810 |
Flips the flag to 1 (TRUE) or 0 (FALSE) for the display |
Flips the flag to 1 (TRUE) or 0 (FALSE) for the display |
2812 |
ToC is autogenerated and includes the root elements on the |
ToC is autogenerated and includes the root elements on the |
2813 |
page. |
page. |
2814 |
**********************************************************/ |
**********************************************************/ |
2815 |
function toggleTOCDisplay($con, $display_toc, $page_id) { |
function toggleTOCDisplay($display_toc, $page_id) { |
2816 |
|
|
2817 |
$sql = "UPDATE page SET display_toc = " |
$sql = "UPDATE page SET display_toc = " |
2818 |
. $display_toc |
. $display_toc |
2819 |
. " WHERE page_id = " |
. " WHERE page_id = " |
2820 |
. $page_id; |
. $page_id; |
2821 |
|
mysql_tryquery($sql); |
|
// Failed |
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
2822 |
|
|
2823 |
// Call the PageScribe page back |
// Call the PageScribe page back |
2824 |
header("Location: scribe.phtml?page_id=" . $page_id); |
header("Location: scribe.phtml?page_id=" . $page_id); |
2828 |
/********************************************************** |
/********************************************************** |
2829 |
Function: toggleTOCWrap |
Function: toggleTOCWrap |
2830 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2831 |
Last Modified: 12.15.2003 |
Last Modified: 03.03.2004 |
2832 |
*********************************************************** |
*********************************************************** |
2833 |
Purpose: |
Purpose: |
2834 |
Flips the flag to 1 (TRUE) or 0 (FALSE) for the wrapping |
Flips the flag to 1 (TRUE) or 0 (FALSE) for the wrapping |
2836 |
ToC is autogenerated and includes the root elements on the |
ToC is autogenerated and includes the root elements on the |
2837 |
page. The wrap results in a two-column view of the ToC. |
page. The wrap results in a two-column view of the ToC. |
2838 |
**********************************************************/ |
**********************************************************/ |
2839 |
function toggleTOCWrap($con, $page_id, $wrap_toc) { |
function toggleTOCWrap($page_id, $wrap_toc) { |
2840 |
|
|
2841 |
$sql = "UPDATE page SET wrap_toc = " |
$sql = "UPDATE page SET wrap_toc = " |
2842 |
. $wrap_toc |
. $wrap_toc |
2843 |
. " WHERE page_id = " |
. " WHERE page_id = " |
2844 |
. $page_id; |
. $page_id; |
2845 |
|
mysql_tryquery($sql); |
|
// Failed |
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
2846 |
|
|
2847 |
// Call the PageScribe page back |
// Call the PageScribe page back |
2848 |
header("Location: scribe.phtml?page_id=" . $page_id); |
header("Location: scribe.phtml?page_id=" . $page_id); |
2852 |
/********************************************************** |
/********************************************************** |
2853 |
Function: toggleUpDisplay |
Function: toggleUpDisplay |
2854 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2855 |
Last Modified: 04.24.2003 |
Last Modified: 03.03.2004 |
2856 |
*********************************************************** |
*********************************************************** |
2857 |
Purpose: |
Purpose: |
2858 |
Toggles the display of the [return to top] text on the |
Toggles the display of the [return to top] text on the |
2862 |
will also insert a preliminary value as passed from the |
will also insert a preliminary value as passed from the |
2863 |
default string setting on the scribe authoring page. |
default string setting on the scribe authoring page. |
2864 |
**********************************************************/ |
**********************************************************/ |
2865 |
function toggleUpDisplay($con, $display_up, $page_id, $up_text) { |
function toggleUpDisplay($display_up, $page_id, $up_text) { |
2866 |
|
|
2867 |
// Collect some data on the current up text |
// Collect some data on the current up text |
2868 |
$current_up_text = lookupField($con, "page", "page_id", $page_id, "up_text"); |
$current_up_text = lookupField("page", "page_id", $page_id, "up_text"); |
2869 |
|
|
2870 |
// Toggle the flag to TRUE or FALSE |
// Toggle the flag to TRUE or FALSE |
2871 |
$sql = "UPDATE page SET display_up = " |
$sql = "UPDATE page SET display_up = " |
2872 |
. $display_up |
. $display_up |
2873 |
. " WHERE page_id = " |
. " WHERE page_id = " |
2874 |
. $page_id; |
. $page_id; |
2875 |
|
mysql_tryquery($sql); |
|
// Failed |
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
2876 |
|
|
2877 |
/* If the current up_text is blank, and the user has |
/* If the current up_text is blank, and the user has |
2878 |
toggled ON, then insert the default wording. */ |
toggled ON, then insert the default wording. */ |
2881 |
. $up_text |
. $up_text |
2882 |
. "' WHERE page_id = " |
. "' WHERE page_id = " |
2883 |
. $page_id; |
. $page_id; |
2884 |
|
mysql_tryquery($sql); |
|
// Failed |
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
2885 |
} |
} |
2886 |
|
|
2887 |
// Call the PageScribe page back |
// Call the PageScribe page back |
2892 |
/********************************************************** |
/********************************************************** |
2893 |
Function: toggleUpText |
Function: toggleUpText |
2894 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2895 |
Last Modified: 04.24.2003 |
Last Modified: 03.03.2004 |
2896 |
*********************************************************** |
*********************************************************** |
2897 |
Purpose: |
Purpose: |
2898 |
Changes the [return to top] text for the supplied page id, |
Changes the [return to top] text for the supplied page id, |
2899 |
on a given page id before each new root element. |
on a given page id before each new root element. |
2900 |
**********************************************************/ |
**********************************************************/ |
2901 |
function toggleUpText($con, $page_id, $up_text) { |
function toggleUpText($page_id, $up_text) { |
2902 |
|
|
2903 |
// Clean the string |
// Clean the string |
2904 |
$up_text = textInmySQL($up_text); |
$up_text = textInmySQL($up_text); |
2908 |
. $up_text |
. $up_text |
2909 |
. "' WHERE page_id = " |
. "' WHERE page_id = " |
2910 |
. $page_id; |
. $page_id; |
2911 |
|
mysql_tryquery($sql); |
|
// Failed |
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
2912 |
|
|
2913 |
// Call the PageScribe page back |
// Call the PageScribe page back |
2914 |
header("Location: scribe.phtml?page_id=" . $page_id); |
header("Location: scribe.phtml?page_id=" . $page_id); |
2918 |
/********************************************************** |
/********************************************************** |
2919 |
Function: toggleURLDisplay |
Function: toggleURLDisplay |
2920 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2921 |
Last Modified: 04.24.2003 |
Last Modified: 03.03.2004 |
2922 |
*********************************************************** |
*********************************************************** |
2923 |
Purpose: |
Purpose: |
2924 |
This function updates the display_urls field in the |
This function updates the display_urls field in the |
2934 |
URL's in edit mode for a quick visual inspection without |
URL's in edit mode for a quick visual inspection without |
2935 |
having to resort to the user interface. |
having to resort to the user interface. |
2936 |
**********************************************************/ |
**********************************************************/ |
2937 |
function toggleURLDisplay($con, $display_urls, $page_id) { |
function toggleURLDisplay($display_urls, $page_id) { |
2938 |
|
|
2939 |
// Build the SQL |
// Build the SQL |
2940 |
$sql = "UPDATE page SET display_urls = " |
$sql = "UPDATE page SET display_urls = " |
2941 |
. $display_urls |
. $display_urls |
2942 |
. " WHERE page_id = " |
. " WHERE page_id = " |
2943 |
. $page_id; |
. $page_id; |
2944 |
|
mysql_tryquery($sql); |
|
// Failed |
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
2945 |
|
|
2946 |
// Call the PageScribe page back |
// Call the PageScribe page back |
2947 |
header("Location: scribe.phtml?page_id=" . $page_id); |
header("Location: scribe.phtml?page_id=" . $page_id); |
2950 |
/********************************************************** |
/********************************************************** |
2951 |
Function: updatePageDebug |
Function: updatePageDebug |
2952 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2953 |
Last Modified: 04.24.2003 |
Last Modified: 03.03.2004 |
2954 |
*********************************************************** |
*********************************************************** |
2955 |
Purpose: |
Purpose: |
2956 |
Updates the flag for page debug to 1 (TRUE) or 0 (FALSE). |
Updates the flag for page debug to 1 (TRUE) or 0 (FALSE). |
2957 |
|
|
2958 |
|
Notes: This is not currently used. Potentially we could |
2959 |
|
utilize this flag when TRUE, to run the debugger every |
2960 |
|
time a page is loaded. |
2961 |
**********************************************************/ |
**********************************************************/ |
2962 |
function updatePageDebug($con, $page_debug, $page_id) { |
function updatePageDebug($page_debug, $page_id) { |
2963 |
|
|
2964 |
$sql = "UPDATE page SET page_debug = " |
$sql = "UPDATE page SET page_debug = " |
2965 |
. $page_debug |
. $page_debug |
2966 |
. " WHERE page_id = " |
. " WHERE page_id = " |
2967 |
. $page_id; |
. $page_id; |
2968 |
|
mysql_tryquery($sql); |
|
// Failed |
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
2969 |
|
|
2970 |
// Call the PageScribe page back |
// Call the PageScribe page back |
2971 |
header("Location: scribe.phtml?page_id=" . $page_id); |
header("Location: scribe.phtml?page_id=" . $page_id); |
2975 |
/********************************************************** |
/********************************************************** |
2976 |
Function: updatePageHeader |
Function: updatePageHeader |
2977 |
Author: Paul Bramscher |
Author: Paul Bramscher |
2978 |
Last Modified: 01.27.2004 |
Last Modified: 03.03.2004 |
2979 |
*********************************************************** |
*********************************************************** |
2980 |
Purpose: |
Purpose: |
2981 |
Updates the supplie page id's pageheader |
Updates the supplied page id's pageheader |
2982 |
**********************************************************/ |
**********************************************************/ |
2983 |
function updatePageHeader($con, $page_id, $pageheader) { |
function updatePageHeader($page_id, $pageheader) { |
2984 |
|
|
2985 |
// Clean up |
// Clean up |
2986 |
if (strlen($pageheader) > 0) $pageheader = textInmySQL($pageheader); |
if (strlen($pageheader) > 0) $pageheader = textInmySQL($pageheader); |
2989 |
. $pageheader |
. $pageheader |
2990 |
. "' WHERE page_id = " |
. "' WHERE page_id = " |
2991 |
. $page_id; |
. $page_id; |
2992 |
|
mysql_tryquery($sql); |
|
// Failed |
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
2993 |
|
|
2994 |
// Call the PageScribe page back |
// Call the PageScribe page back |
2995 |
header("Location: scribe.phtml?page_id=" . $page_id); |
header("Location: scribe.phtml?page_id=" . $page_id); |
2999 |
/********************************************************** |
/********************************************************** |
3000 |
Function: updatePageTitleStyle |
Function: updatePageTitleStyle |
3001 |
Author: Paul Bramscher |
Author: Paul Bramscher |
3002 |
Last Modified: 11.21.2003 |
Last Modified: 03.03.2004 |
3003 |
*********************************************************** |
*********************************************************** |
3004 |
Purpose: |
Purpose: |
3005 |
Updates the style class for the supplied page_id |
Updates the style class for the supplied page_id |
3006 |
**********************************************************/ |
**********************************************************/ |
3007 |
function updatePageTitleStyle($con, $page_id, $pagetitle_style) { |
function updatePageTitleStyle($page_id, $pagetitle_style) { |
3008 |
|
|
3009 |
$sql = "UPDATE page SET pagetitle_style = " |
$sql = "UPDATE page SET pagetitle_style = " |
3010 |
. $pagetitle_style |
. $pagetitle_style |
3011 |
. " WHERE page_id = " |
. " WHERE page_id = " |
3012 |
. $page_id; |
. $page_id; |
3013 |
|
mysql_tryquery($sql); |
|
// Failed |
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
3014 |
|
|
3015 |
// Call the PageScribe page back |
// Call the PageScribe page back |
3016 |
header("Location: scribe.phtml?page_id=" . $page_id); |
header("Location: scribe.phtml?page_id=" . $page_id); |
3020 |
/********************************************************** |
/********************************************************** |
3021 |
Function: updateScribeCourse |
Function: updateScribeCourse |
3022 |
Author: Paul Bramscher |
Author: Paul Bramscher |
3023 |
Last Modified: 06.25.2003 |
Last Modified: 03.03.2004 |
3024 |
*********************************************************** |
*********************************************************** |
3025 |
Purpose: |
Purpose: |
3026 |
Updates the supplied field and value for the course id. |
Updates the supplied field and value for the course id. |
3028 |
there were modifications which affect the title |
there were modifications which affect the title |
3029 |
(subject, designator, or section). |
(subject, designator, or section). |
3030 |
**********************************************************/ |
**********************************************************/ |
3031 |
function updateScribeCourse($con, $course_id, $field_name, $field_value, $page_id) { |
function updateScribeCourse($course_id, $field_name, $field_value, $page_id) { |
3032 |
|
|
3033 |
// Clean up for entry |
// Clean up for entry |
3034 |
if (strlen($field_value) > 0) $field_value = textInmySQL($field_value); |
if (strlen($field_value) > 0) $field_value = textInmySQL($field_value); |
3045 |
. $course_id |
. $course_id |
3046 |
. " AND page_id = " |
. " AND page_id = " |
3047 |
. $page_id; |
. $page_id; |
3048 |
|
mysql_tryquery($sql); |
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
3049 |
|
|
3050 |
|
|
3051 |
} |
} |
3060 |
. $page_id |
. $page_id |
3061 |
. ")"; |
. ")"; |
3062 |
|
|
3063 |
// Write the new row to the database |
mysql_tryquery($sql); |
3064 |
mysql_query ("LOCK TABLE course WRITE", $con); |
$course_id = mysql_insert_id(); |
|
if (!mysql_query($sql, $con)){ |
|
|
sql_err($con); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
$course_id = mysql_insert_id($con); |
|
|
mysql_query("UNLOCK TABLES", $con); |
|
|
} |
|
3065 |
|
|
3066 |
} |
} |
3067 |
updateScribeCourseConcat($con, $course_id, $page_id); |
updateScribeCourseConcat($course_id, $page_id); |
3068 |
} |
} |
3069 |
|
|
3070 |
/********************************************************** |
/********************************************************** |
3071 |
Function: updateScribeCourseConcat |
Function: updateScribeCourseConcat |
3072 |
Author: Paul Bramscher |
Author: Paul Bramscher |
3073 |
Last Modified: 04.24.2003 |
Last Modified: 03.03.2004 |
3074 |
*********************************************************** |
*********************************************************** |
3075 |
Purpose: |
Purpose: |
3076 |
This function updates a CourseLib course title of the |
This function updates a CourseLib course title of the |
3081 |
mySQL. We needed to present a completely ordered list of |
mySQL. We needed to present a completely ordered list of |
3082 |
courses -- not merely by course subject. |
courses -- not merely by course subject. |
3083 |
**********************************************************/ |
**********************************************************/ |
3084 |
function updateScribeCourseConcat($con, $course_id, $page_id) { |
function updateScribeCourseConcat($course_id, $page_id) { |
3085 |
|
|
3086 |
// Fetch course related information |
// Fetch course related information |
3087 |
$sql = "SELECT |
$sql = "SELECT |
3098 |
WHERE |
WHERE |
3099 |
course_id = " . $course_id; |
course_id = " . $course_id; |
3100 |
|
|
3101 |
$rs = mysql_query($sql, $con); |
$rs = mysql_tryquery($sql); |
3102 |
$row = mysql_fetch_array ($rs); |
$row = mysql_fetch_array ($rs, MYSQL_ASSOC); |
3103 |
|
|
3104 |
$page_title = $row["page_title"]; |
$page_title = $row["page_title"]; |
3105 |
$coursesub_id = $row["coursesub_id"]; |
$coursesub_id = $row["coursesub_id"]; |
3131 |
. $course_concat |
. $course_concat |
3132 |
. "' WHERE course_id = " |
. "' WHERE course_id = " |
3133 |
. $course_id; |
. $course_id; |
3134 |
|
mysql_tryquery($sql); |
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
3135 |
|
|
3136 |
header("Location: scribe.phtml?page_id=" . $page_id); |
header("Location: scribe.phtml?page_id=" . $page_id); |
3137 |
|
|
3140 |
/********************************************************** |
/********************************************************** |
3141 |
Function: updateScribeElement |
Function: updateScribeElement |
3142 |
Author: Paul Bramscher |
Author: Paul Bramscher |
3143 |
Last Modified: 07.01.2003 |
Last Modified: 03.03.2004 |
3144 |
*********************************************************** |
*********************************************************** |
3145 |
Purpose: |
Purpose: |
3146 |
Updates a PageScribe element. This function handles the |
Updates a PageScribe element. This function handles the |
3148 |
descriptions -- as well as customized descriptions for |
descriptions -- as well as customized descriptions for |
3149 |
any other element type. |
any other element type. |
3150 |
**********************************************************/ |
**********************************************************/ |
3151 |
function updateScribeElement($con, $element_descr, |
function updateScribeElement($element_descr, |
3152 |
$element_id, $label, $label_flag, $label_url, $page_id, $position) { |
$element_id, $label, $label_flag, $label_url, $page_id, $position) { |
3153 |
|
|
3154 |
// Problem flagging |
// Problem flagging |
3193 |
. $page_id |
. $page_id |
3194 |
. " AND element_id = " |
. " AND element_id = " |
3195 |
. $element_id; |
. $element_id; |
3196 |
|
mysql_tryquery($sql); |
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
3197 |
|
|
3198 |
|
|
3199 |
} |
} |
3211 |
. $page_id |
. $page_id |
3212 |
. " AND element_id = " |
. " AND element_id = " |
3213 |
. $element_id; |
. $element_id; |
3214 |
|
mysql_tryquery($sql); |
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
3215 |
|
|
3216 |
} |
} |
3217 |
|
|
3228 |
. $page_id |
. $page_id |
3229 |
. " AND element_id = " |
. " AND element_id = " |
3230 |
. $element_id; |
. $element_id; |
3231 |
|
mysql_tryquery($sql); |
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
3232 |
|
|
3233 |
} |
} |
3234 |
|
|
3242 |
/********************************************************** |
/********************************************************** |
3243 |
Function: updateScribeHeader |
Function: updateScribeHeader |
3244 |
Author: Paul Bramscher |
Author: Paul Bramscher |
3245 |
Last Modified: 04.24.2003 |
Last Modified: 03.03.2004 |
3246 |
*********************************************************** |
*********************************************************** |
3247 |
Purpose: |
Purpose: |
3248 |
Updates the page title for the supplied page id. |
Updates the page title for the supplied page id. |
3249 |
**********************************************************/ |
**********************************************************/ |
3250 |
function updateScribeHeader($con, $course_id, $page_id, $page_title, $pagetype_id) { |
function updateScribeHeader($course_id, $page_id, $page_title, $pagetype_id) { |
3251 |
|
|
3252 |
// Clean up strings |
// Clean up strings |
3253 |
$page_title = textInmySQL($page_title); |
$page_title = textInmySQL($page_title); |
3257 |
. $page_title |
. $page_title |
3258 |
. "' WHERE page_id =" |
. "' WHERE page_id =" |
3259 |
. $page_id; |
. $page_id; |
3260 |
|
mysql_tryquery($sql); |
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
3261 |
|
|
3262 |
// Update the concatenated course title if this is a course page |
// Update the concatenated course title if this is a course page |
3263 |
if ($pagetype_id == 3) updateScribeCourseConcat($con, $course_id, $page_id); |
if ($pagetype_id == 3) updateScribeCourseConcat($course_id, $page_id); |
3264 |
|
|
3265 |
header("Location: scribe.phtml?page_id=" . $page_id); |
header("Location: scribe.phtml?page_id=" . $page_id); |
3266 |
|
|
3270 |
/********************************************************** |
/********************************************************** |
3271 |
Function: updateScribeStyle |
Function: updateScribeStyle |
3272 |
Author: Paul Bramscher |
Author: Paul Bramscher |
3273 |
Last Modified: 04.24.2003 |
Last Modified: 03.03.2004 |
3274 |
*********************************************************** |
*********************************************************** |
3275 |
Purpose: |
Purpose: |
3276 |
Changes the style definition for the supplied page id. |
Changes the style definition for the supplied page id. |
3277 |
**********************************************************/ |
**********************************************************/ |
3278 |
function updateScribeStyle($con, $page_id, $style_id) { |
function updateScribeStyle($page_id, $style_id) { |
3279 |
|
|
3280 |
// Build the SQL |
// Build the SQL |
3281 |
$sql = "UPDATE page SET style_id = " |
$sql = "UPDATE page SET style_id = " |
3282 |
. $style_id |
. $style_id |
3283 |
. " WHERE page_id =" |
. " WHERE page_id =" |
3284 |
. $page_id; |
. $page_id; |
3285 |
|
mysql_tryquery($sql); |
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
3286 |
|
|
3287 |
header("Location: scribe.phtml?page_id=" . $page_id); |
header("Location: scribe.phtml?page_id=" . $page_id); |
3288 |
} |
} |
3291 |
/********************************************************** |
/********************************************************** |
3292 |
Function: updateScribeUpdate |
Function: updateScribeUpdate |
3293 |
Author: Paul Bramscher |
Author: Paul Bramscher |
3294 |
Last Modified: 04.24.2003 |
Last Modified: 03.03.2004 |
3295 |
*********************************************************** |
*********************************************************** |
3296 |
Purpose: |
Purpose: |
3297 |
Modifies the PageScribe/CourseLib page "last updated" |
Modifies the PageScribe/CourseLib page "last updated" |
3298 |
field. |
field. |
3299 |
**********************************************************/ |
**********************************************************/ |
3300 |
function updateScribeUpdate($con, $page_id, $sess_staff_account) { |
function updateScribeUpdate($page_id, $sess_staff_account) { |
3301 |
|
|
3302 |
$sql = "UPDATE page SET date_modified = now(), account_modified ='" |
$sql = "UPDATE page SET date_modified = now(), account_modified ='" |
3303 |
. $sess_staff_account |
. $sess_staff_account |
3304 |
. "' WHERE page_id = " |
. "' WHERE page_id = " |
3305 |
. $page_id; |
. $page_id; |
3306 |
|
mysql_tryquery($sql); |
|
// Failed |
|
|
if (!mysql_query ($sql, $con)){ |
|
|
sql_err($sql); |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
bailout(); |
|
|
} |
|
|
|
|
|
// Succeeded |
|
|
else { |
|
|
mysql_query ("UNLOCK TABLES", $con); |
|
|
} |
|
3307 |
} |
} |
3308 |
|
|
3309 |
|
|
3369 |
return $younger; |
return $younger; |
3370 |
|
|
3371 |
} |
} |
3372 |
?> |
?> |