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

Diff of /branches/paul_xx/admin/include/delete.php

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

branches/paul/admin/include/delete.php revision 68 by dpavlin, Thu Mar 18 19:24:54 2004 UTC branches/paul_xx/admin/include/delete.php revision 69 by dpavlin, Thu Mar 18 20:01:09 2004 UTC
# Line 82  function deleteCampus($campus_id){ Line 82  function deleteCampus($campus_id){
82                    
83                  // First clear out any coursescribe pages                  // First clear out any coursescribe pages
84                  $sql = "UPDATE course SET campus_id = NULL WHERE campus_id = " . $campus_id;                  $sql = "UPDATE course SET campus_id = NULL WHERE campus_id = " . $campus_id;
85                  if (mysql_tryquery($sql)) printf("Campus purged from assignments to course pages.<br>\n");                  if (xx_tryquery($sql)) printf("Campus purged from assignments to course pages.<br>\n");
86    
87                  // Delete from the coursesub table                  // Delete from the coursesub table
88                  $sql = "UPDATE coursesub SET campus_id = 1 WHERE campus_id =" . $campus_id;                              $sql = "UPDATE coursesub SET campus_id = 1 WHERE campus_id =" . $campus_id;            
89                  if (mysql_tryquery ($sql)) printf("Removed from affected Course Subjects.<br>\n");                  if (xx_tryquery ($sql)) printf("Removed from affected Course Subjects.<br>\n");
90    
91                  // Delete from the campus table                  // Delete from the campus table
92                  $sql = "DELETE FROM campus WHERE campus_id =" . $campus_id;                  $sql = "DELETE FROM campus WHERE campus_id =" . $campus_id;
93                  if (mysql_tryquery ($sql)) printf("Removed this campus successfully.");                  if (xx_tryquery ($sql)) printf("Removed this campus successfully.");
94    
95          }          }
96          else printf("Cannot delete Campus ID# 1, it acts as a system placeholder.");          else printf("Cannot delete Campus ID# 1, it acts as a system placeholder.");
# Line 166  function deleteCoursesub($coursesub_id){ Line 166  function deleteCoursesub($coursesub_id){
166                  else {                  else {
167                          // Delete from the sub_coursesub table                          // Delete from the sub_coursesub table
168                          $sql = "DELETE FROM sub_coursesub WHERE coursesub_id = " . $coursesub_id;                          $sql = "DELETE FROM sub_coursesub WHERE coursesub_id = " . $coursesub_id;
169                          if (mysql_tryquery ($sql)) printf("Subject-Course Subject assignments removed.<BR>\n");                          if (xx_tryquery ($sql)) printf("Subject-Course Subject assignments removed.<BR>\n");
170    
171                          // Delete from the coursesub table                          // Delete from the coursesub table
172                          $sql = "DELETE FROM coursesub WHERE coursesub_id =" . $coursesub_id;                          $sql = "DELETE FROM coursesub WHERE coursesub_id =" . $coursesub_id;
173                          if (mysql_tryquery ($sql)) printf("Removed this Course Subject successfully.");                          if (xx_tryquery ($sql)) printf("Removed this Course Subject successfully.");
174                  }                  }
175    
176          }          }
# Line 259  function deleteFaculty($faculty_id){ Line 259  function deleteFaculty($faculty_id){
259                    
260                  // First clear out the course_personnel assignments                      // First clear out the course_personnel assignments    
261                  $sql = "DELETE FROM course_personnel WHERE faculty_id = " . $faculty_id;                  $sql = "DELETE FROM course_personnel WHERE faculty_id = " . $faculty_id;
262                  if (mysql_tryquery ($sql)) printf("Faculty person purged from assignments to course pages.<BR>\n");                  if (xx_tryquery ($sql)) printf("Faculty person purged from assignments to course pages.<BR>\n");
263    
264                  // Delete from the faculty table                  // Delete from the faculty table
265                  $sql = "DELETE FROM faculty WHERE faculty_id =" . $faculty_id;                  $sql = "DELETE FROM faculty WHERE faculty_id =" . $faculty_id;
266                  if (mysql_tryquery ($sql)) printf("Removed this faculty person successfully.");                  if (xx_tryquery ($sql)) printf("Removed this faculty person successfully.");
267    
268          }          }
269          else printf ("Cannot delete Faculty ID# 1, it acts as a system placeholder.");          else printf ("Cannot delete Faculty ID# 1, it acts as a system placeholder.");
# Line 329  function deleteFeature($feature_id){ Line 329  function deleteFeature($feature_id){
329    
330                  // Delete all resource_feature assignments                  // Delete all resource_feature assignments
331                  $sql = "DELETE from res_feature WHERE feature_id =" . $feature_id;                  $sql = "DELETE from res_feature WHERE feature_id =" . $feature_id;
332                  if (mysql_tryquery ($sql)) printf("Removed resource-feature associations.<BR>\n");                  if (xx_tryquery ($sql)) printf("Removed resource-feature associations.<BR>\n");
333    
334                  // Delete from feature table                  // Delete from feature table
335                  $sql = "DELETE FROM feature WHERE feature_id =" . $feature_id;                  $sql = "DELETE FROM feature WHERE feature_id =" . $feature_id;
336                  if (mysql_tryquery ($sql)) printf("Removed feature successfully.");                  if (xx_tryquery ($sql)) printf("Removed feature successfully.");
337    
338          }          }
339          else printf ("Cannot delete Feature ID# 1, it acts as a system placeholder.");          else printf ("Cannot delete Feature ID# 1, it acts as a system placeholder.");
# Line 400  function deleteInfotype($infotype_id){ Line 400  function deleteInfotype($infotype_id){
400    
401                  // Delete all res_sub_infotype assignments                  // Delete all res_sub_infotype assignments
402                  $sql = "DELETE from res_sub_infotype WHERE infotype_id =" . $infotype_id;                  $sql = "DELETE from res_sub_infotype WHERE infotype_id =" . $infotype_id;
403                  if (mysql_tryquery ($sql)) printf("Removed resource-subject-infotype associations.<BR>\n");                  if (xx_tryquery ($sql)) printf("Removed resource-subject-infotype associations.<BR>\n");
404    
405                  // Set (N/A) type in resource table                  // Set (N/A) type in resource table
406                  $sql = "UPDATE resource SET infotype_id = 1 WHERE infotype_id =" . $infotype_id;                  $sql = "UPDATE resource SET infotype_id = 1 WHERE infotype_id =" . $infotype_id;
407                  if (mysql_tryquery ($sql)) printf("Set default information types for affects resources to (N/A).<BR>\n");                  if (xx_tryquery ($sql)) printf("Set default information types for affects resources to (N/A).<BR>\n");
408    
409                  // Delete from infotype table                  // Delete from infotype table
410                  $sql = "DELETE FROM infotype WHERE infotype_id =" . $infotype_id;                  $sql = "DELETE FROM infotype WHERE infotype_id =" . $infotype_id;
411                  if (mysql_tryquery ($sql)) printf("Removed this information type successfully.");                  if (xx_tryquery ($sql)) printf("Removed this information type successfully.");
412          }          }
413          else printf ("Cannot delete Information Type ID# 1, it acts as a system placeholder.");          else printf ("Cannot delete Information Type ID# 1, it acts as a system placeholder.");
414                    
# Line 473  function deleteLibunit($libunit_id){ Line 473  function deleteLibunit($libunit_id){
473          // First delete from libunit_staff          // First delete from libunit_staff
474          if ($libunit_id > 1) {          if ($libunit_id > 1) {
475                  $sql = "DELETE FROM libunit_staff WHERE libunit_id = " . $libunit_id;                  $sql = "DELETE FROM libunit_staff WHERE libunit_id = " . $libunit_id;
476                  if (mysql_tryquery ($sql)) printf("Deleted affected Library Unit staff assignments.<BR>\n");                  if (xx_tryquery ($sql)) printf("Deleted affected Library Unit staff assignments.<BR>\n");
477    
478                  // Delete from the libunit table                  // Delete from the libunit table
479                  $sql = "DELETE FROM libunit WHERE libunit_id =" . $libunit_id;                  $sql = "DELETE FROM libunit WHERE libunit_id =" . $libunit_id;
480                  if (mysql_tryquery ($sql)) printf("Removed this Library Unit successfully.");                  if (xx_tryquery ($sql)) printf("Removed this Library Unit successfully.");
481    
482          }          }
483          else printf ("Cannot delete Library Unit ID# 1, it acts as a system placeholder.");          else printf ("Cannot delete Library Unit ID# 1, it acts as a system placeholder.");
# Line 540  function deleteLibunitStaff($key_list_ar Line 540  function deleteLibunitStaff($key_list_ar
540                          . $libunit_id                          . $libunit_id
541                          . " AND staff_id = "                          . " AND staff_id = "
542                          . $key_list_array[$element];                          . $key_list_array[$element];
543                  mysql_tryquery($sql);                  xx_tryquery($sql);
544          }          }
545          // Call the libunit form back          // Call the libunit form back
546          formLibunit($libunit_id);          formLibunit($libunit_id);
# Line 570  function deleteLocation($delMessage, $lo Line 570  function deleteLocation($delMessage, $lo
570                    
571                  // First delete from res_loc                      // First delete from res_loc    
572                  $sql = "DELETE FROM res_loc WHERE location_id = " . $location_id;                  $sql = "DELETE FROM res_loc WHERE location_id = " . $location_id;
573                  if (mysql_tryquery ($sql)) printf("Affected resource-location assignments removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("Affected resource-location assignments removed.<BR>\n");
574    
575                  // Delete from sub_loc                  // Delete from sub_loc
576                  $sql = "DELETE FROM sub_loc WHERE location_id =" . $location_id;                  $sql = "DELETE FROM sub_loc WHERE location_id =" . $location_id;
577                  if (mysql_tryquery ($sql)) printf("Affected subject-location assignments removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("Affected subject-location assignments removed.<BR>\n");
578    
579                  // Delete primary subject locations                  // Delete primary subject locations
580                  $sql = "UPDATE subject SET sublocation_id = NULL WHERE sublocation_id =" . $location_id;                  $sql = "UPDATE subject SET sublocation_id = NULL WHERE sublocation_id =" . $location_id;
581                  if (mysql_tryquery ($sql)) printf("Affected primary subject locations set to NULL.<BR>\n");                  if (xx_tryquery ($sql)) printf("Affected primary subject locations set to NULL.<BR>\n");
582    
583                  // Delete from serv_loc                  // Delete from serv_loc
584                  $sql = "DELETE FROM serv_loc WHERE location_id =" . $location_id;                  $sql = "DELETE FROM serv_loc WHERE location_id =" . $location_id;
585                  if (mysql_tryquery ($sql)) printf("Affected service-location assignments removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("Affected service-location assignments removed.<BR>\n");
586    
587                  /********************************                  /********************************
588                  ** Update affected CL/PS pages **                  ** Update affected CL/PS pages **
# Line 591  function deleteLocation($delMessage, $lo Line 591  function deleteLocation($delMessage, $lo
591                  // First, get the default location description and title                  // First, get the default location description and title
592                  $sql = "SELECT location, location_descr FROM location WHERE location_id = "                  $sql = "SELECT location, location_descr FROM location WHERE location_id = "
593                          . $location_id;                          . $location_id;
594                  $rs = mysql_tryquery($sql);                  $rs = xx_tryquery($sql);
595                  $row = mysql_fetch_array ($rs, MYSQL_ASSOC);                  $row = xx_fetch_array ($rs, xx_ASSOC);
596                  $location = $row["location"];                  $location = $row["location"];
597                  $location_descr = $row["location_descr"];                  $location_descr = $row["location_descr"];
598    
# Line 612  function deleteLocation($delMessage, $lo Line 612  function deleteLocation($delMessage, $lo
612                          . $delMessage                          . $delMessage
613                          . "'), location_id = NULL WHERE location_id =" . $location_id                          . "'), location_id = NULL WHERE location_id =" . $location_id
614                          . " AND (element_descr IS NOT NULL OR element_descr != '')";                          . " AND (element_descr IS NOT NULL OR element_descr != '')";
615                  if (mysql_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n");                  if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n");
616    
617                  // Next, update all of the elements using this resource without a custom description.                  // Next, update all of the elements using this resource without a custom description.
618                  $sql = "UPDATE element SET label = '"                  $sql = "UPDATE element SET label = '"
# Line 621  function deleteLocation($delMessage, $lo Line 621  function deleteLocation($delMessage, $lo
621                          . $location_descr                          . $location_descr
622                          . "', location_id = NULL WHERE location_id =" . $location_id                          . "', location_id = NULL WHERE location_id =" . $location_id
623                          . " AND (element_descr IS NULL OR element_descr = '')";                          . " AND (element_descr IS NULL OR element_descr = '')";
624                  if (mysql_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions.<BR>\n");                  if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions.<BR>\n");
625    
626                  /**********************************                  /**********************************
627                  ** Update affected CL/PS buffers **                  ** Update affected CL/PS buffers **
# Line 634  function deleteLocation($delMessage, $lo Line 634  function deleteLocation($delMessage, $lo
634                          . $delMessage                          . $delMessage
635                          . "'), location_id = NULL WHERE location_id =" . $location_id                          . "'), location_id = NULL WHERE location_id =" . $location_id
636                          . " AND (element_descr IS NOT NULL OR element_descr != '')";                          . " AND (element_descr IS NOT NULL OR element_descr != '')";
637                  if (mysql_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n");                  if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n");
638    
639                  // Next, update all of the elements using this location without a custom description.                  // Next, update all of the elements using this location without a custom description.
640                  $sql = "UPDATE pastebuffer SET label = '"                  $sql = "UPDATE pastebuffer SET label = '"
# Line 643  function deleteLocation($delMessage, $lo Line 643  function deleteLocation($delMessage, $lo
643                          . $location_descr                          . $location_descr
644                          . "', location_id = NULL WHERE location_id =" . $location_id                          . "', location_id = NULL WHERE location_id =" . $location_id
645                          . " AND (element_descr IS NULL OR element_descr = '')";                          . " AND (element_descr IS NULL OR element_descr = '')";
646                  if (mysql_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n");                  if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n");
647    
648                  // Delete from location                  // Delete from location
649                  $sql = "DELETE FROM location WHERE location_id =" . $location_id;                  $sql = "DELETE FROM location WHERE location_id =" . $location_id;
650                  if (mysql_tryquery ($sql)) printf("Location successfully removed.");                  if (xx_tryquery ($sql)) printf("Location successfully removed.");
651    
652          }          }
653          else printf ("Cannot delete Location ID# 1, it acts as a system placeholder.");          else printf ("Cannot delete Location ID# 1, it acts as a system placeholder.");
# Line 728  function deleteMasterinfotype($masterinf Line 728  function deleteMasterinfotype($masterinf
728                          . $masterinfotype_id;                          . $masterinfotype_id;
729                                                    
730                  // Fetch the values                  // Fetch the values
731                  $rs = mysql_tryquery($sql);                  $rs = xx_tryquery($sql);
732                  while ($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) {                  while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
733                          $infotype_id = $row["infotype_id"];                          $infotype_id = $row["infotype_id"];
734                          $infotype = $row["infotype"];                          $infotype = $row["infotype"];
735                                                    
# Line 738  function deleteMasterinfotype($masterinf Line 738  function deleteMasterinfotype($masterinf
738    
739                          // Delete all res_sub_infotype assignments                          // Delete all res_sub_infotype assignments
740                          $sql = "DELETE from res_sub_infotype WHERE infotype_id =" . $infotype_id;                          $sql = "DELETE from res_sub_infotype WHERE infotype_id =" . $infotype_id;
741                          if (mysql_tryquery ($sql)) printf("Removed resource-subject-infotype associations.<BR>\n");                          if (xx_tryquery ($sql)) printf("Removed resource-subject-infotype associations.<BR>\n");
742    
743                          // Set (N/A) type in resource table                          // Set (N/A) type in resource table
744                          $sql = "UPDATE resource SET infotype_id = 1 WHERE infotype_id =" . $infotype_id;                          $sql = "UPDATE resource SET infotype_id = 1 WHERE infotype_id =" . $infotype_id;
745                          if (mysql_tryquery ($sql)) printf("Set default information types for affects resources to (N/A).<BR>\n");                          if (xx_tryquery ($sql)) printf("Set default information types for affects resources to (N/A).<BR>\n");
746    
747                          // Delete from infotype table                          // Delete from infotype table
748                          $sql = "DELETE FROM infotype WHERE infotype_id =" . $infotype_id;                          $sql = "DELETE FROM infotype WHERE infotype_id =" . $infotype_id;
749                          if (mysql_tryquery ($sql)) printf("Removed affected specific information types.<BR>\n");                          if (xx_tryquery ($sql)) printf("Removed affected specific information types.<BR>\n");
750                  }                  }
751                                    
752                  // Delete from masterinfotype table                  // Delete from masterinfotype table
753                  $sql = "DELETE FROM masterinfotype WHERE masterinfotype_id =" . $masterinfotype_id;                  $sql = "DELETE FROM masterinfotype WHERE masterinfotype_id =" . $masterinfotype_id;
754                  if (mysql_tryquery ($sql)) printf("Removed Master Information Type successfully.");                  if (xx_tryquery ($sql)) printf("Removed Master Information Type successfully.");
755    
756          }          }
757          else printf ("Cannot delete Master Information Type ID# 1, it acts as a system placeholder.");          else printf ("Cannot delete Master Information Type ID# 1, it acts as a system placeholder.");
# Line 829  function deleteMastersubject($mastersubj Line 829  function deleteMastersubject($mastersubj
829    
830                  // Delete from sub_mastersubject                  // Delete from sub_mastersubject
831                  $sql = "DELETE FROM sub_mastersubject WHERE mastersubject_id =" . $mastersubject_id;                  $sql = "DELETE FROM sub_mastersubject WHERE mastersubject_id =" . $mastersubject_id;
832                  if (mysql_tryquery ($sql)) printf("Affected subject-mastersubject assignments removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("Affected subject-mastersubject assignments removed.<BR>\n");
833    
834                  // Delete from res_mastersubject                  // Delete from res_mastersubject
835                  $sql = "DELETE FROM res_mastersubject WHERE mastersubject_id =" . $mastersubject_id;                  $sql = "DELETE FROM res_mastersubject WHERE mastersubject_id =" . $mastersubject_id;
836                  if (mysql_tryquery ($sql)) printf("Affected resource-mastersubject assignments removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("Affected resource-mastersubject assignments removed.<BR>\n");
837    
838                  // Delete from mastersubject table                  // Delete from mastersubject table
839                  $sql = "DELETE FROM mastersubject WHERE mastersubject_id =" . $mastersubject_id;                  $sql = "DELETE FROM mastersubject WHERE mastersubject_id =" . $mastersubject_id;
840                  if (mysql_tryquery ($sql)) printf("Removed Master Subject successfully.");                  if (xx_tryquery ($sql)) printf("Removed Master Subject successfully.");
841    
842          }          }
843          else printf ("Cannot delete Master Subject ID# 1, it acts as a system placeholder.");          else printf ("Cannot delete Master Subject ID# 1, it acts as a system placeholder.");
# Line 879  function deleteMastersubjectConfirm($key Line 879  function deleteMastersubjectConfirm($key
879                  // Check subjects                  // Check subjects
880                  $sql = "SELECT COUNT(sm.subject_id) as num_subjects FROM sub_mastersubject sm WHERE sm.mastersubject_id ="                  $sql = "SELECT COUNT(sm.subject_id) as num_subjects FROM sub_mastersubject sm WHERE sm.mastersubject_id ="
881                          . $mastersubject_id;                          . $mastersubject_id;
882                  $rs = mysql_tryquery($sql);                  $rs = xx_tryquery($sql);
883                  $row = mysql_fetch_array ($rs, MYSQL_ASSOC);                  $row = xx_fetch_array ($rs, xx_ASSOC);
884                  $num_subjects = $row["num_subjects"];                  $num_subjects = $row["num_subjects"];
885                  if ($num_subjects > 0) $problem = 1;                  if ($num_subjects > 0) $problem = 1;
886                                    
887                  // Check resources                  // Check resources
888                  $sql = "SELECT COUNT(rm.resource_id) as num_resources FROM res_mastersubject rm WHERE rm.mastersubject_id = "                  $sql = "SELECT COUNT(rm.resource_id) as num_resources FROM res_mastersubject rm WHERE rm.mastersubject_id = "
889                          . $mastersubject_id;                          . $mastersubject_id;
890                  $rs = mysql_tryquery($sql);                  $rs = xx_tryquery($sql);
891                  $row = mysql_fetch_array ($rs, MYSQL_ASSOC);                  $row = xx_fetch_array ($rs, xx_ASSOC);
892                  $num_resources = $row["num_resources"];                  $num_resources = $row["num_resources"];
893                  if ($num_resources > 0) $problem = 1;                  if ($num_resources > 0) $problem = 1;
894                                    
# Line 940  function deleteResFeature($key_list_arra Line 940  function deleteResFeature($key_list_arra
940                          . $resource_id                          . $resource_id
941                          . " AND feature_id = "                          . " AND feature_id = "
942                          . $key_list_array[$element];                          . $key_list_array[$element];
943                  mysql_tryquery ($sql);                  xx_tryquery ($sql);
944          }          }
945          // Call the resource form back          // Call the resource form back
946          formResource($resource_id, 0, 0, '');          formResource($resource_id, 0, 0, '');
# Line 964  function deleteResLoc($key_list_array, $ Line 964  function deleteResLoc($key_list_array, $
964                          . $resource_id                          . $resource_id
965                          . " AND location_id = "                          . " AND location_id = "
966                          . $key_list_array[$element];                                                      . $key_list_array[$element];                            
967                  mysql_tryquery ($sql);                  xx_tryquery ($sql);
968          }          }
969          // Call the resource form back          // Call the resource form back
970          formResource($resource_id, 0, 0, '');          formResource($resource_id, 0, 0, '');
# Line 989  function deleteResMastersubject($key_lis Line 989  function deleteResMastersubject($key_lis
989                          . $resource_id                          . $resource_id
990                          . " AND mastersubject_id = "                          . " AND mastersubject_id = "
991                          . $key_list_array[$element];                                                      . $key_list_array[$element];                            
992                  mysql_tryquery ($sql);                  xx_tryquery ($sql);
993          }          }
994          // Call the resource form back          // Call the resource form back
995          formResource($resource_id, 0, 0, '');          formResource($resource_id, 0, 0, '');
# Line 1016  function deleteResource($delMessage, $re Line 1016  function deleteResource($delMessage, $re
1016    
1017          // First delete all related rows in res_sub_infotype          // First delete all related rows in res_sub_infotype
1018          $sql = "DELETE FROM res_sub_infotype WHERE resource_id = " . $resource_id;          $sql = "DELETE FROM res_sub_infotype WHERE resource_id = " . $resource_id;
1019          if (mysql_tryquery ($sql)) printf("Resource removed from all resource-subject-infotype assignments.<BR>\n");          if (xx_tryquery ($sql)) printf("Resource removed from all resource-subject-infotype assignments.<BR>\n");
1020    
1021          // Delete from the res_loc table          // Delete from the res_loc table
1022          $sql = "DELETE FROM res_loc WHERE resource_id =" . $resource_id;          $sql = "DELETE FROM res_loc WHERE resource_id =" . $resource_id;
1023          if (mysql_tryquery ($sql)) printf("Removed from resource-location table.<BR>\n");          if (xx_tryquery ($sql)) printf("Removed from resource-location table.<BR>\n");
1024                    
1025          // Delete from the res_mastersubject table                // Delete from the res_mastersubject table      
1026          $sql = "DELETE FROM res_mastersubject WHERE resource_id =" . $resource_id;          $sql = "DELETE FROM res_mastersubject WHERE resource_id =" . $resource_id;
1027          if (mysql_tryquery ($sql)) printf("Removed from resource-mastersubject table.<BR>\n");          if (xx_tryquery ($sql)) printf("Removed from resource-mastersubject table.<BR>\n");
1028    
1029          // Delete from the res_feature table          // Delete from the res_feature table
1030          $sql = "DELETE FROM res_feature WHERE resource_id =" . $resource_id;          $sql = "DELETE FROM res_feature WHERE resource_id =" . $resource_id;
1031          if (mysql_tryquery ($sql)) printf("Removed from resource-feature table.<BR>\n");          if (xx_tryquery ($sql)) printf("Removed from resource-feature table.<BR>\n");
1032                    
1033          /********************************          /********************************
1034          ** Update affected CL/PS pages **          ** Update affected CL/PS pages **
# Line 1037  function deleteResource($delMessage, $re Line 1037  function deleteResource($delMessage, $re
1037          // First, get the default resource description and title          // First, get the default resource description and title
1038          $sql = "SELECT annotation, title FROM resource WHERE resource_id = "          $sql = "SELECT annotation, title FROM resource WHERE resource_id = "
1039                  . $resource_id;                  . $resource_id;
1040          $rs = mysql_tryquery($sql);          $rs = xx_tryquery($sql);
1041          $row = mysql_fetch_array ($rs, MYSQL_ASSOC);          $row = xx_fetch_array ($rs, xx_ASSOC);
1042          $annotation = $row["annotation"];          $annotation = $row["annotation"];
1043          $title = $row["title"];          $title = $row["title"];
1044    
# Line 1058  function deleteResource($delMessage, $re Line 1058  function deleteResource($delMessage, $re
1058                  . $delMessage                  . $delMessage
1059                  . "'), resource_id = NULL WHERE resource_id =" . $resource_id                  . "'), resource_id = NULL WHERE resource_id =" . $resource_id
1060                  . " AND (element_descr IS NOT NULL OR element_descr != '')";                  . " AND (element_descr IS NOT NULL OR element_descr != '')";
1061          if (mysql_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n");          if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n");
1062    
1063          // Next, update all of the elements using this resource without a custom description.          // Next, update all of the elements using this resource without a custom description.
1064          $sql = "UPDATE element SET label = '"          $sql = "UPDATE element SET label = '"
# Line 1067  function deleteResource($delMessage, $re Line 1067  function deleteResource($delMessage, $re
1067                  . $annotation                  . $annotation
1068                  . "', resource_id = NULL WHERE resource_id =" . $resource_id                  . "', resource_id = NULL WHERE resource_id =" . $resource_id
1069                  . " AND (element_descr IS NULL OR element_descr = '')";                  . " AND (element_descr IS NULL OR element_descr = '')";
1070          if (mysql_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions.<BR>\n");          if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions.<BR>\n");
1071    
1072          /***************************************          /***************************************
1073          ** Update affected CL/PS copy buffers **          ** Update affected CL/PS copy buffers **
# Line 1080  function deleteResource($delMessage, $re Line 1080  function deleteResource($delMessage, $re
1080                  . $delMessage                  . $delMessage
1081                  . "'), resource_id = NULL WHERE resource_id =" . $resource_id                  . "'), resource_id = NULL WHERE resource_id =" . $resource_id
1082                  . " AND (element_descr IS NOT NULL OR element_descr != '')";                  . " AND (element_descr IS NOT NULL OR element_descr != '')";
1083          if (mysql_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n");          if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n");
1084    
1085          // Next, update all of the elements using this resource without a custom description.          // Next, update all of the elements using this resource without a custom description.
1086          $sql = "UPDATE pastebuffer SET label = '"          $sql = "UPDATE pastebuffer SET label = '"
# Line 1089  function deleteResource($delMessage, $re Line 1089  function deleteResource($delMessage, $re
1089                  . $annotation                  . $annotation
1090                  . "', resource_id = NULL WHERE resource_id =" . $resource_id                  . "', resource_id = NULL WHERE resource_id =" . $resource_id
1091                  . " AND (element_descr IS NULL OR element_descr = '')";                          . " AND (element_descr IS NULL OR element_descr = '')";        
1092          if (mysql_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n");          if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n");
1093                                    
1094          // Delete from the resource table          // Delete from the resource table
1095          $sql = "DELETE FROM resource WHERE resource_id =" . $resource_id;          $sql = "DELETE FROM resource WHERE resource_id =" . $resource_id;
1096          if (mysql_tryquery ($sql)) printf("Successfully removed from all tables.");          if (xx_tryquery ($sql)) printf("Successfully removed from all tables.");
1097                    
1098          printf("<br><br>\n");          printf("<br><br>\n");
1099          msgTableClose();          msgTableClose();
# Line 1169  function deleteService($delMessage, $ser Line 1169  function deleteService($delMessage, $ser
1169    
1170          // First delete all related rows in serv_servtype          // First delete all related rows in serv_servtype
1171          $sql = "DELETE FROM serv_servtype WHERE service_id = " . $service_id;          $sql = "DELETE FROM serv_servtype WHERE service_id = " . $service_id;
1172          if (mysql_tryquery ($sql)) printf("Service removed from all service-servicetype assignments.<BR>\n");          if (xx_tryquery ($sql)) printf("Service removed from all service-servicetype assignments.<BR>\n");
1173    
1174          // Delete from the serv_loc table          // Delete from the serv_loc table
1175          $sql = "DELETE FROM serv_loc WHERE service_id =" . $service_id;          $sql = "DELETE FROM serv_loc WHERE service_id =" . $service_id;
1176          if (mysql_tryquery ($sql)) printf("Removed from service-location table.<BR>\n");          if (xx_tryquery ($sql)) printf("Removed from service-location table.<BR>\n");
1177    
1178          /********************************          /********************************
1179          ** Update affected CL/PS pages **          ** Update affected CL/PS pages **
# Line 1182  function deleteService($delMessage, $ser Line 1182  function deleteService($delMessage, $ser
1182          // First, get the default service description and title          // First, get the default service description and title
1183          $sql = "SELECT service, serviceDescr FROM service WHERE service_id = "          $sql = "SELECT service, serviceDescr FROM service WHERE service_id = "
1184                  . $service_id;                    . $service_id;  
1185          $rs = mysql_tryquery($sql);          $rs = xx_tryquery($sql);
1186          $row = mysql_fetch_array ($rs, MYSQL_ASSOC);          $row = xx_fetch_array ($rs, xx_ASSOC);
1187          $service = $row["service"];          $service = $row["service"];
1188          $serviceDescr = $row["serviceDescr"];          $serviceDescr = $row["serviceDescr"];
1189    
# Line 1203  function deleteService($delMessage, $ser Line 1203  function deleteService($delMessage, $ser
1203                  . $delMessage                  . $delMessage
1204                  . "'), service_id = NULL WHERE service_id =" . $service_id                  . "'), service_id = NULL WHERE service_id =" . $service_id
1205                  . " AND (element_descr IS NOT NULL OR element_descr != '')";                  . " AND (element_descr IS NOT NULL OR element_descr != '')";
1206          if (mysql_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n");          if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n");
1207    
1208          // Next, update all of the elements using this service without a custom description.          // Next, update all of the elements using this service without a custom description.
1209          $sql = "UPDATE element SET label = '"          $sql = "UPDATE element SET label = '"
# Line 1213  function deleteService($delMessage, $ser Line 1213  function deleteService($delMessage, $ser
1213                  . "', service_id = NULL WHERE service_id =" . $service_id                  . "', service_id = NULL WHERE service_id =" . $service_id
1214                  . " AND (element_descr IS NULL OR element_descr = '')";                          . " AND (element_descr IS NULL OR element_descr = '')";        
1215    
1216          if (mysql_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions.<BR>\n");          if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions.<BR>\n");
1217    
1218          /***************************************          /***************************************
1219          ** Update affected CP/PS copy buffers **          ** Update affected CP/PS copy buffers **
# Line 1226  function deleteService($delMessage, $ser Line 1226  function deleteService($delMessage, $ser
1226                  . $delMessage                  . $delMessage
1227                  . "'), service_id = NULL WHERE service_id =" . $service_id                  . "'), service_id = NULL WHERE service_id =" . $service_id
1228                  . " AND (element_descr IS NOT NULL OR element_descr != '')";                  . " AND (element_descr IS NOT NULL OR element_descr != '')";
1229          if (mysql_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n");          if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n");
1230    
1231          // Next, update all of the elements using this service without a custom description.          // Next, update all of the elements using this service without a custom description.
1232          $sql = "UPDATE pastebuffer SET label = '"          $sql = "UPDATE pastebuffer SET label = '"
# Line 1235  function deleteService($delMessage, $ser Line 1235  function deleteService($delMessage, $ser
1235                  . $serviceDescr                  . $serviceDescr
1236                  . "', service_id = NULL WHERE service_id =" . $service_id                  . "', service_id = NULL WHERE service_id =" . $service_id
1237                  . " AND (element_descr IS NULL OR element_descr = '')";                          . " AND (element_descr IS NULL OR element_descr = '')";        
1238          if (mysql_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n");          if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n");
1239    
1240          // Delete from the service table          // Delete from the service table
1241          $sql = "DELETE FROM service WHERE service_id =" . $service_id;          $sql = "DELETE FROM service WHERE service_id =" . $service_id;
1242          if (mysql_tryquery ($sql)) printf("Successfully removed from all tables.");          if (xx_tryquery ($sql)) printf("Successfully removed from all tables.");
1243    
1244          printf("<br><br>\n");          printf("<br><br>\n");
1245          msgTableClose();          msgTableClose();
# Line 1311  function deleteServicetype($servicetype_ Line 1311  function deleteServicetype($servicetype_
1311    
1312                  // Delete from serv_servtype table                  // Delete from serv_servtype table
1313                  $sql = "DELETE FROM serv_servtype WHERE servicetype_id =" . $servicetype_id;                  $sql = "DELETE FROM serv_servtype WHERE servicetype_id =" . $servicetype_id;
1314                  if (mysql_tryquery ($sql)) printf("Removed Service-Service Type associations.<BR>\n");                  if (xx_tryquery ($sql)) printf("Removed Service-Service Type associations.<BR>\n");
1315                    
1316                  // Delete from servicetype table                  // Delete from servicetype table
1317                  $sql = "DELETE FROM servicetype WHERE servicetype_id =" . $servicetype_id;                  $sql = "DELETE FROM servicetype WHERE servicetype_id =" . $servicetype_id;
1318                  if (mysql_tryquery ($sql)) printf("Removed Service Type successfully.");                  if (xx_tryquery ($sql)) printf("Removed Service Type successfully.");
1319    
1320          }          }
1321          else printf ("Cannot delete Service Type ID# 1, it acts as a system placeholder.");          else printf ("Cannot delete Service Type ID# 1, it acts as a system placeholder.");
# Line 1382  function deleteServLoc($key_list_array, Line 1382  function deleteServLoc($key_list_array,
1382                          . $service_id                          . $service_id
1383                          . " AND location_id = "                          . " AND location_id = "
1384                          . $key_list_array[$element];                          . $key_list_array[$element];
1385                  mysql_tryquery ($sql);                  xx_tryquery ($sql);
1386          }          }
1387          // Call the service form back          // Call the service form back
1388          formService($service_id, 0, 0);          formService($service_id, 0, 0);
# Line 1407  function deleteServServtype($key_list_ar Line 1407  function deleteServServtype($key_list_ar
1407                          . $service_id                          . $service_id
1408                          . " AND servicetype_id = "                          . " AND servicetype_id = "
1409                          . $key_list_array[$element];                          . $key_list_array[$element];
1410                  mysql_tryquery ($sql);                  xx_tryquery ($sql);
1411          }          }
1412          // Call the service form back          // Call the service form back
1413          formService($service_id, 0, 0);          formService($service_id, 0, 0);
# Line 1436  function deleteStaff($delMessage, $staff Line 1436  function deleteStaff($delMessage, $staff
1436    
1437                  // First delete all related rows in sub_staff                  // First delete all related rows in sub_staff
1438                  $sql = "DELETE FROM sub_staff WHERE staff_id = " . $staff_id;                  $sql = "DELETE FROM sub_staff WHERE staff_id = " . $staff_id;
1439                  if (mysql_tryquery ($sql)) printf("All subject-staff assignments for this staff person removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("All subject-staff assignments for this staff person removed.<BR>\n");
1440    
1441                  // Delete from the course_personnel table                  // Delete from the course_personnel table
1442                  $sql = "DELETE FROM course_personnel WHERE staff_id =" . $staff_id;                  $sql = "DELETE FROM course_personnel WHERE staff_id =" . $staff_id;
1443                  if (mysql_tryquery ($sql)) printf("Removed this staff person from course personnel tables.<BR>\n");                  if (xx_tryquery ($sql)) printf("Removed this staff person from course personnel tables.<BR>\n");
1444    
1445                  // Delete all related rows in page_staff                          // Delete all related rows in page_staff        
1446                  $sql = "DELETE FROM page_staff WHERE staff_id = " . $staff_id;                  $sql = "DELETE FROM page_staff WHERE staff_id = " . $staff_id;
1447                  if (mysql_tryquery ($sql)) printf("All page-staff assignments for this staff person removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("All page-staff assignments for this staff person removed.<BR>\n");
1448    
1449                  /********************************                  /********************************
1450                  ** Update affected CL/PS pages **                  ** Update affected CL/PS pages **
# Line 1453  function deleteStaff($delMessage, $staff Line 1453  function deleteStaff($delMessage, $staff
1453                  // First, get the staff fields                  // First, get the staff fields
1454                  $sql = "SELECT first_name, last_name FROM staff WHERE staff_id = "                  $sql = "SELECT first_name, last_name FROM staff WHERE staff_id = "
1455                          . $staff_id;                              . $staff_id;    
1456                  $rs = mysql_tryquery($sql);                  $rs = xx_tryquery($sql);
1457                  $row = mysql_fetch_array ($rs, MYSQL_ASSOC);                  $row = xx_fetch_array ($rs, xx_ASSOC);
1458                  $first_name = $row["first_name"];                  $first_name = $row["first_name"];
1459                  $last_name = $row["last_name"];                  $last_name = $row["last_name"];
1460    
# Line 1474  function deleteStaff($delMessage, $staff Line 1474  function deleteStaff($delMessage, $staff
1474                          . $delMessage                          . $delMessage
1475                          . "'), staff_id = NULL WHERE staff_id =" . $staff_id                          . "'), staff_id = NULL WHERE staff_id =" . $staff_id
1476                          . " AND element_descr IS NOT NULL AND element_descr <> ''";                          . " AND element_descr IS NOT NULL AND element_descr <> ''";
1477                  if (mysql_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n");                  if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n");
1478    
1479                  // Handle blank staff description elements                  // Handle blank staff description elements
1480                  $sql = "UPDATE element SET label = '"                  $sql = "UPDATE element SET label = '"
# Line 1483  function deleteStaff($delMessage, $staff Line 1483  function deleteStaff($delMessage, $staff
1483                          . $delMessage                          . $delMessage
1484                          . "', staff_id = NULL WHERE staff_id =" . $staff_id                          . "', staff_id = NULL WHERE staff_id =" . $staff_id
1485                          . " AND (element_descr IS NULL OR element_descr = '')";                          . " AND (element_descr IS NULL OR element_descr = '')";
1486                  if (mysql_tryquery ($sql)) printf("Added delete message to blank PageScribe descriptions.<BR>\n");                  if (xx_tryquery ($sql)) printf("Added delete message to blank PageScribe descriptions.<BR>\n");
1487    
1488                  /**********************************                  /**********************************
1489                  ** Update affected CL/PS buffers **                  ** Update affected CL/PS buffers **
# Line 1496  function deleteStaff($delMessage, $staff Line 1496  function deleteStaff($delMessage, $staff
1496                          . $delMessage                          . $delMessage
1497                          . "'), staff_id = NULL WHERE staff_id =" . $staff_id                          . "'), staff_id = NULL WHERE staff_id =" . $staff_id
1498                          . " AND element_descr IS NOT NULL AND element_descr <> ''";                          . " AND element_descr IS NOT NULL AND element_descr <> ''";
1499                  if (mysql_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n");                  if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n");
1500                                    
1501                  // Handle blank staff description pastebuffer elements                  // Handle blank staff description pastebuffer elements
1502                  $sql = "UPDATE pastebuffer SET label = '"                  $sql = "UPDATE pastebuffer SET label = '"
# Line 1505  function deleteStaff($delMessage, $staff Line 1505  function deleteStaff($delMessage, $staff
1505                          . $delMessage                          . $delMessage
1506                          . "', staff_id = NULL WHERE staff_id =" . $staff_id                          . "', staff_id = NULL WHERE staff_id =" . $staff_id
1507                          . " AND (element_descr IS NULL OR element_descr = '')";                          . " AND (element_descr IS NULL OR element_descr = '')";
1508                  if (mysql_tryquery ($sql)) printf("Added delete message to blank PageScribe descriptions.<BR>\n");                  if (xx_tryquery ($sql)) printf("Added delete message to blank PageScribe descriptions.<BR>\n");
1509    
1510                  // Delete from the staff table                  // Delete from the staff table
1511                  $sql = "DELETE FROM staff WHERE staff_id =" . $staff_id;                  $sql = "DELETE FROM staff WHERE staff_id =" . $staff_id;
1512                  if (mysql_tryquery ($sql)) printf("Removed this staff person successfully.");                  if (xx_tryquery ($sql)) printf("Removed this staff person successfully.");
1513          }          }
1514          else printf ("Cannot delete Staff ID's #1-2. Operation cancelled.");          else printf ("Cannot delete Staff ID's #1-2. Operation cancelled.");
1515                    
# Line 1589  function deleteStaffLibunit($key_list_ar Line 1589  function deleteStaffLibunit($key_list_ar
1589                          . $staff_id                          . $staff_id
1590                          . " AND libunit_id = "                          . " AND libunit_id = "
1591                          . $key_list_array[$element];                          . $key_list_array[$element];
1592                  mysql_tryquery($sql);                  xx_tryquery($sql);
1593          }          }
1594          // Call the staff form back          // Call the staff form back
1595          formStaff($staff_id);          formStaff($staff_id);
# Line 1617  function deleteStaffSub($key_list_array, Line 1617  function deleteStaffSub($key_list_array,
1617                          . $staff_id                          . $staff_id
1618                          . " AND subject_id = "                          . " AND subject_id = "
1619                          . $key_list_array[$element];                          . $key_list_array[$element];
1620                  mysql_tryquery($sql);                  xx_tryquery($sql);
1621          }          }
1622          // Call the staff form back          // Call the staff form back
1623          formStaff($staff_id);          formStaff($staff_id);
# Line 1641  function deleteStafftitle($stafftitle_id Line 1641  function deleteStafftitle($stafftitle_id
1641          if ($stafftitle_id > 1) {          if ($stafftitle_id > 1) {
1642                  // First update all rows in staff to (N/A)                  // First update all rows in staff to (N/A)
1643                  $sql = "UPDATE staff SET stafftitle_id = 1 WHERE stafftitle_id = " . $stafftitle_id;                  $sql = "UPDATE staff SET stafftitle_id = 1 WHERE stafftitle_id = " . $stafftitle_id;
1644                  if (mysql_tryquery ($sql)) printf("Successfully set affected staff titles to (N/A).<BR>\n");                  if (xx_tryquery ($sql)) printf("Successfully set affected staff titles to (N/A).<BR>\n");
1645    
1646                  // Delete from the title table                  // Delete from the title table
1647                  $sql = "DELETE FROM stafftitle WHERE stafftitle_id =" . $stafftitle_id;                  $sql = "DELETE FROM stafftitle WHERE stafftitle_id =" . $stafftitle_id;
1648                  if (mysql_tryquery ($sql)) printf("Removed this staff title successfully.");                  if (xx_tryquery ($sql)) printf("Removed this staff title successfully.");
1649    
1650          }          }
1651          else printf ("Cannot delete Staff Title ID# 1, it acts as a system placeholder.");          else printf ("Cannot delete Staff Title ID# 1, it acts as a system placeholder.");
# Line 1711  function deleteStyle($style_id){ Line 1711  function deleteStyle($style_id){
1711          if ($style_id > 2) {          if ($style_id > 2) {
1712                  // First update all affected rows in page to (N/A)                  // First update all affected rows in page to (N/A)
1713                  $sql = "UPDATE page SET style_id = 1 WHERE style_id = " . $style_id;                  $sql = "UPDATE page SET style_id = 1 WHERE style_id = " . $style_id;
1714                  if (mysql_tryquery ($sql)) printf("Successfully set affected page styles to (N/A).<BR>\n");                  if (xx_tryquery ($sql)) printf("Successfully set affected page styles to (N/A).<BR>\n");
1715    
1716                  // Delete from the style table                  // Delete from the style table
1717                  $sql = "DELETE FROM style WHERE style_id =" . $style_id;                  $sql = "DELETE FROM style WHERE style_id =" . $style_id;
1718                  if (mysql_tryquery ($sql)) printf("Removed this style successfully.");                  if (xx_tryquery ($sql)) printf("Removed this style successfully.");
1719    
1720          }          }
1721          else {          else {
# Line 1789  function deleteSubCoursesub($key_list_ar Line 1789  function deleteSubCoursesub($key_list_ar
1789                          . $subject_id                          . $subject_id
1790                          . " AND coursesub_id = "                          . " AND coursesub_id = "
1791                          . $key_list_array[$element];                          . $key_list_array[$element];
1792                  mysql_tryquery ($sql);                  xx_tryquery ($sql);
1793          }          }
1794          // Call the subject form back          // Call the subject form back
1795          formSubject($subject_id);          formSubject($subject_id);
# Line 1817  function deleteSubject($delMessage, $sub Line 1817  function deleteSubject($delMessage, $sub
1817                    
1818                  // First delete all related rows in res_sub_infotype                  // First delete all related rows in res_sub_infotype
1819                  $sql = "DELETE FROM res_sub_infotype WHERE subject_id = " . $subject_id;                  $sql = "DELETE FROM res_sub_infotype WHERE subject_id = " . $subject_id;
1820                  if (mysql_tryquery ($sql)) printf("Resource-subject-information type associations removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("Resource-subject-information type associations removed.<BR>\n");
1821    
1822                  // Delete from the sub_loc table                  // Delete from the sub_loc table
1823                  $sql = "DELETE FROM sub_loc WHERE subject_id =" . $subject_id;                  $sql = "DELETE FROM sub_loc WHERE subject_id =" . $subject_id;
1824                  if (mysql_tryquery ($sql)) printf("Subject-location associations removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("Subject-location associations removed.<BR>\n");
1825    
1826                  // Delete from the sub_mastersubject table                  // Delete from the sub_mastersubject table
1827                  $sql = "DELETE FROM sub_mastersubject WHERE subject_id =" . $subject_id;                  $sql = "DELETE FROM sub_mastersubject WHERE subject_id =" . $subject_id;
1828                  if (mysql_tryquery ($sql)) printf("Subject-mastersubject associations removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("Subject-mastersubject associations removed.<BR>\n");
1829    
1830                  // Delete from the sub_staff table                  // Delete from the sub_staff table
1831                  $sql = "DELETE FROM sub_staff WHERE subject_id =" . $subject_id;                  $sql = "DELETE FROM sub_staff WHERE subject_id =" . $subject_id;
1832                  if (mysql_tryquery ($sql)) printf("Subject-staff assignments removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("Subject-staff assignments removed.<BR>\n");
1833    
1834                  // Delete from the sub_coursesub table                  // Delete from the sub_coursesub table
1835                  $sql = "DELETE FROM sub_coursesub WHERE subject_id =" . $subject_id;                  $sql = "DELETE FROM sub_coursesub WHERE subject_id =" . $subject_id;
1836                  if (mysql_tryquery ($sql)) printf("Subject-Course Subject assignments removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("Subject-Course Subject assignments removed.<BR>\n");
1837    
1838                  // Delete from the sub_page table                  // Delete from the sub_page table
1839                  $sql = "DELETE FROM sub_page WHERE subject_id =" . $subject_id;                  $sql = "DELETE FROM sub_page WHERE subject_id =" . $subject_id;
1840                  if (mysql_tryquery ($sql)) printf("Subject-Page assignments removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("Subject-Page assignments removed.<BR>\n");
1841    
1842                  // Delete from the sub_othersub table                  // Delete from the sub_othersub table
1843                  $sql = "DELETE FROM sub_othersub WHERE othersub_id ="                  $sql = "DELETE FROM sub_othersub WHERE othersub_id ="
1844                          . $subject_id                          . $subject_id
1845                          . " OR subject_id = "                          . " OR subject_id = "
1846                          . $subject_id;                          . $subject_id;
1847                  if (mysql_tryquery ($sql)) printf("Subject-Other Subject assignments removed.<BR>\n");                  if (xx_tryquery ($sql)) printf("Subject-Other Subject assignments removed.<BR>\n");
1848    
1849                  /********************************                  /********************************
1850                  ** Update affected CL/PS pages **                  ** Update affected CL/PS pages **
# Line 1853  function deleteSubject($delMessage, $sub Line 1853  function deleteSubject($delMessage, $sub
1853                  // First, get the default subject description and title                  // First, get the default subject description and title
1854                  $sql = "SELECT subject, subject_descr FROM subject WHERE subject_id = "                  $sql = "SELECT subject, subject_descr FROM subject WHERE subject_id = "
1855                          . $subject_id;                            . $subject_id;  
1856                  $rs = mysql_tryquery($sql);                  $rs = xx_tryquery($sql);
1857                  $row = mysql_fetch_array ($rs, MYSQL_ASSOC);                  $row = xx_fetch_array ($rs, xx_ASSOC);
1858                  $subject = $row["subject"];                  $subject = $row["subject"];
1859                  $subject_descr = $row["subject_descr"];                  $subject_descr = $row["subject_descr"];
1860    
# Line 1874  function deleteSubject($delMessage, $sub Line 1874  function deleteSubject($delMessage, $sub
1874                          . $delMessage                          . $delMessage
1875                          . "'), subject_id = NULL WHERE subject_id =" . $subject_id                          . "'), subject_id = NULL WHERE subject_id =" . $subject_id
1876                          . " AND (element_descr IS NOT NULL OR element_descr != '')";                          . " AND (element_descr IS NOT NULL OR element_descr != '')";
1877                  if (mysql_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n");                  if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions.<BR>\n");
1878    
1879                  // Next, update all of the elements using this resource without a custom description.                  // Next, update all of the elements using this resource without a custom description.
1880                  $sql = "UPDATE element SET label = '"                  $sql = "UPDATE element SET label = '"
# Line 1883  function deleteSubject($delMessage, $sub Line 1883  function deleteSubject($delMessage, $sub
1883                          . $subject_descr                          . $subject_descr
1884                          . "', subject_id = NULL WHERE subject_id =" . $subject_id                          . "', subject_id = NULL WHERE subject_id =" . $subject_id
1885                          . " AND (element_descr IS NULL OR element_descr = '')";                          . " AND (element_descr IS NULL OR element_descr = '')";
1886                  if (mysql_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions.<BR>\n");                  if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions.<BR>\n");
1887    
1888                  /***************************************                  /***************************************
1889                  ** Update affected CL/PS copy buffers **                  ** Update affected CL/PS copy buffers **
# Line 1896  function deleteSubject($delMessage, $sub Line 1896  function deleteSubject($delMessage, $sub
1896                          . $delMessage                          . $delMessage
1897                          . "'), subject_id = NULL WHERE subject_id =" . $subject_id                          . "'), subject_id = NULL WHERE subject_id =" . $subject_id
1898                          . " AND (element_descr IS NOT NULL OR element_descr != '')";                          . " AND (element_descr IS NOT NULL OR element_descr != '')";
1899                  if (mysql_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n");                  if (xx_tryquery ($sql)) printf("Added delete message to custom PageScribe descriptions (buffers).<BR>\n");
1900    
1901                  // Next, update all of the elements using this location without a custom description.                  // Next, update all of the elements using this location without a custom description.
1902                  $sql = "UPDATE pastebuffer SET label = '"                  $sql = "UPDATE pastebuffer SET label = '"
# Line 1905  function deleteSubject($delMessage, $sub Line 1905  function deleteSubject($delMessage, $sub
1905                          . $subject_descr                          . $subject_descr
1906                          . "', subject_id = NULL WHERE subject_id =" . $subject_id                          . "', subject_id = NULL WHERE subject_id =" . $subject_id
1907                          . " AND (element_descr IS NULL OR element_descr = '')";                                  . " AND (element_descr IS NULL OR element_descr = '')";        
1908                  if (mysql_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n");                  if (xx_tryquery ($sql)) printf("Added delete message to default PageScribe descriptions (buffers).<BR>\n");
1909    
1910                  // Finally delete from the subject table                  // Finally delete from the subject table
1911                  $sql = "DELETE FROM subject WHERE subject_id =" . $subject_id;                  $sql = "DELETE FROM subject WHERE subject_id =" . $subject_id;
1912                  if (mysql_tryquery ($sql)) printf("Successfully removed this subject from the system.");                  if (xx_tryquery ($sql)) printf("Successfully removed this subject from the system.");
1913          }          }
1914          else printf ("Cannot delete Subject ID# 1, it acts as a system placeholder.");          else printf ("Cannot delete Subject ID# 1, it acts as a system placeholder.");
1915                    
# Line 1980  function deleteSubLoc($key_list_array, $ Line 1980  function deleteSubLoc($key_list_array, $
1980                          . $subject_id                          . $subject_id
1981                          . " AND location_id = "                          . " AND location_id = "
1982                          . $key_list_array[$element];                          . $key_list_array[$element];
1983                  mysql_tryquery($sql);                  xx_tryquery($sql);
1984          }          }
1985          // Call the subject form back          // Call the subject form back
1986          formSubject($subject_id);          formSubject($subject_id);
# Line 2006  function deleteSubMaster($key_list_array Line 2006  function deleteSubMaster($key_list_array
2006                          . $subject_id                          . $subject_id
2007                          . " AND mastersubject_id = "                          . " AND mastersubject_id = "
2008                          . $key_list_array[$element];                          . $key_list_array[$element];
2009                  mysql_tryquery($sql);                  xx_tryquery($sql);
2010          }          }
2011          // Call the subject form back          // Call the subject form back
2012          formSubject($subject_id);          formSubject($subject_id);
# Line 2031  function deleteSubStaff($key_list_array, Line 2031  function deleteSubStaff($key_list_array,
2031                          . $subject_id                          . $subject_id
2032                          . " AND staff_id = "                          . " AND staff_id = "
2033                          . $key_list_array[$element];                          . $key_list_array[$element];
2034                  mysql_tryquery($sql);                  xx_tryquery($sql);
2035          }          }
2036          // Call the subject form back          // Call the subject form back
2037          formSubject($subject_id);          formSubject($subject_id);
# Line 2057  function deleteTerm($term_id){ Line 2057  function deleteTerm($term_id){
2057    
2058                  // Delete all course term assignments                  // Delete all course term assignments
2059                  $sql = "UPDATE course SET term_id = NULL WHERE term_id =" . $term_id;                  $sql = "UPDATE course SET term_id = NULL WHERE term_id =" . $term_id;
2060                  if (mysql_tryquery ($sql)) printf("Removed this term from affected course pages.<BR>\n");                  if (xx_tryquery ($sql)) printf("Removed this term from affected course pages.<BR>\n");
2061    
2062                  // Delete from term table                  // Delete from term table
2063                  $sql = "DELETE FROM term WHERE term_id =" . $term_id;                  $sql = "DELETE FROM term WHERE term_id =" . $term_id;
2064                  if (mysql_tryquery ($sql)) printf("Removed term successfully.");                  if (xx_tryquery ($sql)) printf("Removed term successfully.");
2065          }          }
2066          else printf ("Cannot delete Term ID# 1, it acts as a system placeholder.");          else printf ("Cannot delete Term ID# 1, it acts as a system placeholder.");
2067                    
# Line 2127  function deleteVendor($vendor_id){ Line 2127  function deleteVendor($vendor_id){
2127                  // First update affected resources                  // First update affected resources
2128                  $sql = "UPDATE resource SET vendor_id = NULL WHERE vendor_id = "                  $sql = "UPDATE resource SET vendor_id = NULL WHERE vendor_id = "
2129                          . $vendor_id;                          . $vendor_id;
2130                  if (mysql_tryquery ($sql)) printf("Vendor purged from assignments to resources.<BR>\n");                  if (xx_tryquery ($sql)) printf("Vendor purged from assignments to resources.<BR>\n");
2131    
2132                  // Delete from the vendor table                  // Delete from the vendor table
2133                  $sql = "DELETE FROM vendor WHERE vendor_id =" . $vendor_id;                  $sql = "DELETE FROM vendor WHERE vendor_id =" . $vendor_id;
2134                  if (mysql_tryquery ($sql)) printf("Removed this vendor successfully.");                  if (xx_tryquery ($sql)) printf("Removed this vendor successfully.");
2135    
2136          }          }
2137          else printf ("Cannot delete Vendor ID# 1, it acts as a system placeholder.");          else printf ("Cannot delete Vendor ID# 1, it acts as a system placeholder.");

Legend:
Removed from v.68  
changed lines
  Added in v.69

  ViewVC Help
Powered by ViewVC 1.1.26