/[libdata]/branches/paul/admin/scribe.phtml
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/admin/scribe.phtml

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

revision 66 by dpavlin, Tue Jan 27 20:49:26 2004 UTC revision 67 by dpavlin, Thu Mar 18 19:24:54 2004 UTC
# Line 15  require_once ($GLOBAL_ADMIN_INC."scribe_ Line 15  require_once ($GLOBAL_ADMIN_INC."scribe_
15  require_once ($GLOBAL_ADMIN_INC."scribe_header.phtml");  require_once ($GLOBAL_ADMIN_INC."scribe_header.phtml");
16    
17    
18    // Default access settings
19    $sess_time_human = "";
20    $sess_staff_account = "";
21    $sess_staff_id = 0;
22    $sess_access_level = 0;
23    $sess_access = "";
24    $sess_last_name = "";
25    $sess_first_name = "";
26    
27    
28  // Collect access information  // Collect access information
29  if (isset($libsession)) {  if (isset($libsession)) {
30    
# Line 43  if ($page_id < 1 && $sess_access_level > Line 53  if ($page_id < 1 && $sess_access_level >
53  // If editing an exiting page  // If editing an exiting page
54  else {  else {
55          // Flag to make sure that the current user has sufficient access for this page          // Flag to make sure that the current user has sufficient access for this page
56          $auth_page = authPage($con, $page_id, $sess_access_level, $sess_staff_id);          $auth_page = authPage($page_id, $sess_access_level, $sess_staff_id);
57  }  }
58    
59  // If the cookie is set and access level is appropriate  // If the cookie is set and access level is appropriate
# Line 67  if(isset($libsession) && $auth_page == 1 Line 77  if(isset($libsession) && $auth_page == 1
77                          . $page_title                          . $page_title
78                          . "', 1, 0)";                          . "', 1, 0)";
79    
80                  mysql_query ("LOCK TABLE page WRITE", $con);                  mysql_tryquery ($sql);
81                    $page_id = mysql_insert_id();
                 // Failed  
                 if (!mysql_query($sql, $con)){  
                         sql_err($con);  
                         mysql_query ("UNLOCK TABLES", $con);  
                         bailout();  
                 }  
   
                 // Succeeded  
                 else {  
                         $page_id = mysql_insert_id($con);  
                         mysql_query("UNLOCK TABLES", $con);  
                 }  
82                                    
83                  // If a coursescribe page -- write the row into the course table                  // If a coursescribe page -- write the row into the course table
84                  if ($pagetype_id == 3) {                  if ($pagetype_id == 3) {
# Line 91  if(isset($libsession) && $auth_page == 1 Line 89  if(isset($libsession) && $auth_page == 1
89                                  . "', 'Information Resources and Services for:')";                                  . "', 'Information Resources and Services for:')";
90                    
91                          // Failed                          // Failed
92                          if (!mysql_query($sql, $con)){                          mysql_tryquery($sql);                          
                                 sql_err($con);  
                                 mysql_query ("UNLOCK TABLES", $con);  
                                 bailout();  
                         }  
   
                         // Succeeded  
                         else {  
                                 mysql_query("UNLOCK TABLES", $con);  
                         }                                
93                  }                  }
94    
95          }          }
# Line 116  if(isset($libsession) && $auth_page == 1 Line 105  if(isset($libsession) && $auth_page == 1
105                          LEFT JOIN course c using (page_id)                          LEFT JOIN course c using (page_id)
106                          WHERE p.page_id = " . $page_id;                          WHERE p.page_id = " . $page_id;
107    
108                  $rs = mysql_query($sql, $con);                  $rs = mysql_tryquery($sql);
109                  $row = mysql_fetch_array ($rs);                  $row = mysql_fetch_array ($rs, MYSQL_ASSOC);
110                  $page_title = $row["page_title"];                  $page_title = $row["page_title"];
111                  $pagetitle_style = $row["pagetitle_style"];                  $pagetitle_style = $row["pagetitle_style"];
112                  $style_id = $row["style_id"];                  $style_id = $row["style_id"];
# Line 139  if(isset($libsession) && $auth_page == 1 Line 128  if(isset($libsession) && $auth_page == 1
128                  /*************************************************                  /*************************************************
129                  ** Determine if there's anything in copy buffer **                  ** Determine if there's anything in copy buffer **
130                  *************************************************/                  *************************************************/
131                  $paste_data = existsRow($con, "pastebuffer", "paste_staff_id", $sess_staff_id);                  $paste_data = existsRow("pastebuffer", "paste_staff_id", $sess_staff_id);
132    
133    
134                  /**********************************                  /**********************************
# Line 147  if(isset($libsession) && $auth_page == 1 Line 136  if(isset($libsession) && $auth_page == 1
136                  **********************************/                  **********************************/
137                                    
138                  $genArray = array();                  $genArray = array();
139                  populateGenArray($con, $genArray, $page_id);                  populateGenArray($genArray, $page_id);
140                                    
141    
142                  /******************                  /******************
# Line 157  if(isset($libsession) && $auth_page == 1 Line 146  if(isset($libsession) && $auth_page == 1
146                  // Page commands table                  // Page commands table
147                  $page_title_display = strip_tags($page_title);                  $page_title_display = strip_tags($page_title);
148                  printf("<table width=\"95%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\"><tr>\n");                  printf("<table width=\"95%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\"><tr>\n");
149                  printf("<td colspan =\"4\" class=\"cellPlain\">Page Commands: %s\n", $page_title_display);                  printf("<td colspan =\"4\" class=\"cellPlain\">Page Commands: %s (ID# %d)", $page_title_display, $page_id);
150                  printf("</td></tr>\n");                  printf("</td></tr>\n");
151    
152    
# Line 413  if(isset($libsession) && $auth_page == 1 Line 402  if(isset($libsession) && $auth_page == 1
402                  printf("<input type=\"hidden\" name= \"transaction\" value= \"updateScribeStyle\">\n");                  printf("<input type=\"hidden\" name= \"transaction\" value= \"updateScribeStyle\">\n");
403                  printf("<input type=\"hidden\" name=\"page_id\" value=\"%d\">", $page_id);                  printf("<input type=\"hidden\" name=\"page_id\" value=\"%d\">", $page_id);
404                  printf("<select name = \"style_id\">\n");                  printf("<select name = \"style_id\">\n");
405                  dropDownFieldSelected($con, "style", "style_title", "style_id", " WHERE style_id > 0", $style_id);                  dropDownFieldSelected("style", "style_title", "style_id", " WHERE style_id > 0", $style_id);
406                  printf("</select>\n");                  printf("</select>\n");
407                  printf("<input type = \"submit\" value = \"Apply Style\">\n");                  printf("<input type = \"submit\" value = \"Apply Style\">\n");
408                  printf("</td></form>\n");                  printf("</td></form>\n");
409    
410                  // Page font format tool                  // Page font format tool
411                  printf("<td colspan=\"3\" align=\"left\">\n");                  printf("<td colspan=\"3\" align=\"left\">\n");
412                  $max_indent = getMaxIndent($con, $page_id);                  $max_indent = getMaxIndent($page_id);
413                  printf("<table border=\"0\">\n");                  printf("<table border=\"0\">\n");
414                  printf("<tr>\n");                  printf("<tr>\n");
415                  printf("<form method=\"post\" action =\"scribe_transaction.phtml\">\n");                  printf("<form method=\"post\" action =\"scribe_transaction.phtml\">\n");
# Line 464  if(isset($libsession) && $auth_page == 1 Line 453  if(isset($libsession) && $auth_page == 1
453                  ****************************************/                  ****************************************/
454    
455                                    
456                  if ($cmd == "pagestaff") formAssignPageStaff($con, $page_id, $staff_coordinator);                  if ($cmd == "pagestaff") formAssignPageStaff($page_id, $staff_coordinator);
457    
458    
459                  // Anchor to top of page                  // Anchor to top of page
# Line 486  if(isset($libsession) && $auth_page == 1 Line 475  if(isset($libsession) && $auth_page == 1
475                          p.page_id = "                          p.page_id = "
476                          . $page_id                          . $page_id
477                          . " AND p.style_id = s.style_id";                          . " AND p.style_id = s.style_id";
478                  $rs = mysql_query($sql, $con);                  $rs = mysql_tryquery($sql);
479                  $row = mysql_fetch_array ($rs);                  $row = mysql_fetch_array ($rs, MYSQL_ASSOC);
480                  $css_file = $row["css_file"];                  $css_file = $row["css_file"];
481                                    
482                  if (strlen($css_file) > 0) {                  if (strlen($css_file) > 0) {
# Line 499  if(isset($libsession) && $auth_page == 1 Line 488  if(isset($libsession) && $auth_page == 1
488                  }                  }
489    
490    
491                    /***************************
492                    ** Display current Styles **
493                    ***************************/
494                    
495                    printf("<table border=\"1\" cellpadding=\"4\"><tr>\n");
496                    printf("<td class=\"cellPlain\"> Current Style Key </td>\n");
497                    printf("<td>\n");
498                    printf("No Style | ");
499                    for ($counter = 1; $counter < 6; $counter++) {
500                            printf("<span class=\"S%d\">Style %d</span> ", $counter, $counter);
501                            if ($counter < 5) printf("| ");                
502                    }
503                    printf("</td></tr></table><br>\n");
504    
505    
506                  /***************                  /***************
507                  ** Page Title **                  ** Page Title **
508                  ***************/                  ***************/
# Line 514  if(isset($libsession) && $auth_page == 1 Line 518  if(isset($libsession) && $auth_page == 1
518                  }                  }
519    
520                  if ($cmd == "editHeader") {                  if ($cmd == "editHeader") {
521                          editHeader($con, $course_id, $page_id, $page_title, $pagetype_id);                          editHeader($course_id, $page_id, $page_title, $pagetype_id);
522                  }                  }
523    
524                  else {                    else {  
525                          displayHeader($con, $page_id, $page_title, $pagetitle_style, $pagetype_id);                          displayHeader($page_id, $page_title, $pagetitle_style, $pagetype_id);
526                  }                  }
527    
528                  printf("</td></tr></table><br>");                  printf("</td></tr></table><br>");
529    
530    
531                  /****************************************                  /****************************************
532                  ** If CourseLib, load additional forms **                  ** If CourseLib, load additional forms **
533                  ****************************************/                  ****************************************/
# Line 531  if(isset($libsession) && $auth_page == 1 Line 536  if(isset($libsession) && $auth_page == 1
536                  // Load the course forms is this is a CourseLib+/CourseScribe page                  // Load the course forms is this is a CourseLib+/CourseScribe page
537                  if ($pagetype_id == 3) {                  if ($pagetype_id == 3) {
538                                    
539                          formCourse($con, $active, $page_id);                          formCourse($active, $page_id);
540                          formCoursePers($con, $active, $course_id, $page_id);                          formCoursePers($active, $course_id, $page_id);
541                                                    
542                          // HR                          // HR
543                          printf("<hr>\n");                                                printf("<hr>\n");                      
# Line 541  if(isset($libsession) && $auth_page == 1 Line 546  if(isset($libsession) && $auth_page == 1
546                  /*********************                  /*********************
547                  ** PageScribe forms **                  ** PageScribe forms **
548                  **********************/                  **********************/
549                  else formPageHeader($con, $active, $page_id);                  else formPageHeader($active, $page_id);
550    
551    
552                  /******************************                  /******************************
# Line 549  if(isset($libsession) && $auth_page == 1 Line 554  if(isset($libsession) && $auth_page == 1
554                  ******************************/                  ******************************/
555                                    
556                  if ($display_toc == 1) {                  if ($display_toc == 1) {
557                          displayTOC($con, $page_id, $wrap_toc);                          displayTOC($page_id, $wrap_toc);
558                  }                  }
559    
560    
# Line 568  if(isset($libsession) && $auth_page == 1 Line 573  if(isset($libsession) && $auth_page == 1
573    
574                  $sql = "SELECT * FROM element e                  $sql = "SELECT * FROM element e
575                          LEFT JOIN resource r using (resource_id)                          LEFT JOIN resource r using (resource_id)
576                            LEFT JOIN vendor d on r.vendor_id = d.vendor_id                
577                          LEFT JOIN service v on e.service_id = v.service_id                          LEFT JOIN service v on e.service_id = v.service_id
578                          LEFT JOIN location l on e.location_id = l.location_id                          LEFT JOIN location l on e.location_id = l.location_id
579                          LEFT JOIN staff s on e.staff_id = s.staff_id                          LEFT JOIN staff s on e.staff_id = s.staff_id
# Line 575  if(isset($libsession) && $auth_page == 1 Line 581  if(isset($libsession) && $auth_page == 1
581                          WHERE page_id = " . $page_id                          WHERE page_id = " . $page_id
582                          . " ORDER BY e.element_order";                          . " ORDER BY e.element_order";
583    
584                  $rs = mysql_query($sql, $con);                  $rs = mysql_tryquery($sql);
585                                    
586                  // Make a copy of the result set for cursor manipulation later                  // Make a copy of the result set for cursor manipulation later
587                  $rscopy = $rs;                  $rscopy = $rs;
588    
589                  // If the previous didn't work, do this explicitly                                // If the previous didn't work, do this explicitly              
590                  // $rscopy = mysql_query($sql, $con);                  // $rscopy = mysql_tryquery($sql);
591    
592                  // Create a positional variable, may contain an element or a row of add buttons                  // Create a positional variable, may contain an element or a row of add buttons
593                  $position = 1;                  $position = 1;
# Line 618  if(isset($libsession) && $auth_page == 1 Line 624  if(isset($libsession) && $auth_page == 1
624                          switch ($cmd) {                          switch ($cmd) {
625    
626                                  case "addRes":                                  case "addRes":
627                                          addRes($con, $feature_id, $letter, $limitstring, $masterinfotype_id, $place_array, $page_id);                                          addRes($feature_id, $letter, $limitstring, $masterinfotype_id, $place_array, $page_id);
628                                          break;                                          break;
629                                  case "addLoc":                                  case "addLoc":
630                                          addLoc($con, $place_array, $page_id);                                          addLoc($place_array, $page_id);
631                                          break;                                          break;
632                                  case "addService":                                  case "addService":
633                                          addService($con, $place_array, $servicetype_id, $page_id);                                          addService($place_array, $servicetype_id, $page_id);
634                                          break;                                          break;
635                                  case "addStaff":                                  case "addStaff":
636                                          addStaff($con, $place_array, $page_id);                                          addStaff($place_array, $page_id);
637                                          break;                                                                            break;                                  
638                                  case "addLabel":                                  case "addLabel":
639                                          addLabel($con, $place_array, $page_id);                                          addLabel($place_array, $page_id);
640                                          break;                                          break;
641                                  case "addRQS":                                  case "addRQS":
642                                          addRQS($con, $place_array, $page_id);                                          addRQS($place_array, $page_id);
643                                          break;                                          break;
644                                  case "addRQSLink":                                  case "addRQSLink":
645                                          addRQSLink($con, $place_array, $page_id);                                          addRQSLink($place_array, $page_id);
646                                          break;                                                                                    break;                                          
647                                  default:                                  default:
648                                          break;                                          break;
# Line 656  if(isset($libsession) && $auth_page == 1 Line 662  if(isset($libsession) && $auth_page == 1
662                          // Present an add icon or the add options                          // Present an add icon or the add options
663                          if ($opt == "add" && $this_pos == $position) {                          if ($opt == "add" && $this_pos == $position) {
664                                  // Display add selection                                  // Display add selection
665                                  addSelection($con, $place_array, $page_id);                                  addSelection($place_array, $page_id);
666                          }                          }
667    
668                          else {                          else {
# Line 682  if(isset($libsession) && $auth_page == 1 Line 688  if(isset($libsession) && $auth_page == 1
688    
689    
690                  // Cycle through each row of page elements                  // Cycle through each row of page elements
691                  while ($row = mysql_fetch_array ($rs)) {                  while ($row = mysql_fetch_array ($rs, MYSQL_ASSOC)) {
692    
693                          // General element information                          // General element information
694                          $element_id = $row["element_id"];                          $element_id = $row["element_id"];
# Line 702  if(isset($libsession) && $auth_page == 1 Line 708  if(isset($libsession) && $auth_page == 1
708                          $title = $row["title"];                          $title = $row["title"];
709                          $call_no = $row["call_no"];                          $call_no = $row["call_no"];
710    
711                            $guide_url = $row["guide_url"];
712                            $resource_message = $row["resource_message"];
713                            $resource_status = $row["resource_status"];
714                            $vendor_message = $row["vendor_message"];
715                            $vendor_status = $row["vendor_status"];
716    
717                          // If a location                          // If a location
718                          $location_id = $row["location_id"];                          $location_id = $row["location_id"];
719                          $location = $row["location"];                          $location = $row["location"];
# Line 755  if(isset($libsession) && $auth_page == 1 Line 767  if(isset($libsession) && $auth_page == 1
767    
768                                  switch ($cmd) {                                  switch ($cmd) {
769                                          case "copyElement":                                          case "copyElement":
770                                                  copyElement($con, $place_array, $page_id, $element_id, $sess_staff_id);                                                  copyElement($place_array, $page_id, $element_id, $sess_staff_id);
771                                                  break;                                                  break;
772                                          case "delElement":                                          case "delElement":
773                                                  delElement($con, $place_array, $page_id, $element_id);                                                  delElement($place_array, $page_id, $element_id);
774                                                  break;                                                  break;
775                                          case "editElement":                                          case "editElement":
776                                                  editElement($con, $place_array, $page_id, $element_id);                                                  editElement($place_array, $page_id, $element_id);
777                                                  break;                                                                                    break;                                  
778                                          default:                                          default:
779                                                  break;                                                  break;
# Line 896  if(isset($libsession) && $auth_page == 1 Line 908  if(isset($libsession) && $auth_page == 1
908                                  printf("&nbsp;&nbsp;");                                  printf("&nbsp;&nbsp;");
909    
910                                  // Display edit buttons                                          // Display edit buttons        
911                                  editButtons($con, $element_size, $label_text, $label_url, $place_array, $resource_id, $page_id, $element_id);                                  editButtons($element_size, $label_text, $label_url, $place_array, $resource_id, $page_id, $element_id);
   
                                 // Allow up button  
                                 //if (siblingElderProbe($con, $page_id, $place_array)) buttonUp($page_id, $place_array);  
   
                                 // Allow down button  
                                 //if (siblingYoungerProbe($con, $page_id, $place_array)) buttonDown($page_id, $place_array);  
912    
913                                  // Allow up button                                  // Allow up button
914                                  if (sibProbeElder($genArray, $page_id, $place_array)) buttonUp($page_id, $place_array);                                  if (sibProbeElder($genArray, $page_id, $place_array)) buttonUp($page_id, $place_array);
# Line 910  if(isset($libsession) && $auth_page == 1 Line 916  if(isset($libsession) && $auth_page == 1
916                                  // Allow down button                                  // Allow down button
917                                  if (sibProbeYounger($genArray, $page_id, $place_array)) buttonDown($page_id, $place_array);                                  if (sibProbeYounger($genArray, $page_id, $place_array)) buttonDown($page_id, $place_array);
918    
919                                    // Handle down/alert messages
920                                    if ($vendor_status > 0 || $resource_status > 0) {
921    
922                                            printf("<br><img src =\"images/chain.jpg\" alt=\"Resource Temporarily Unavailable\">\n");
923                                            printf("<span class=\"error\">\n");
924                                            if (strlen($vendor_message) > 1) printf("%s\n", $vendor_message);
925                                            else if (strlen($resource_message) > 1) printf("%s\n", $resource_message);
926                                            printf("</span>\n");
927                                    }
928    
929                                  // Initialize anew for each row                                  // Initialize anew for each row
930                                  $display_descr = "";                                  $display_descr = "";
# Line 1035  if(isset($libsession) && $auth_page == 1 Line 1050  if(isset($libsession) && $auth_page == 1
1050                                                  switch ($cmd) {                                                          switch ($cmd) {        
1051    
1052                                                          case "addRes":                                                          case "addRes":
1053                                                                  addRes($con, $feature_id, $letter, $limitstring, $masterinfotype_id, $place_array, $page_id);                                                                  addRes($feature_id, $letter, $limitstring, $masterinfotype_id, $place_array, $page_id);
1054                                                                  break;                                                                  break;
1055                                                          case "addLoc":                                                          case "addLoc":
1056                                                                  addLoc($con, $place_array, $page_id);                                                                  addLoc($place_array, $page_id);
1057                                                                  break;                                                                  break;
1058                                                          case "addService":                                                          case "addService":
1059                                                                  addService($con, $place_array, $servicetype_id, $page_id);                                                                  addService($place_array, $servicetype_id, $page_id);
1060                                                                  break;                                                                  break;
1061                                                          case "addStaff":                                                          case "addStaff":
1062                                                                  addStaff($con, $place_array, $page_id);                                                                  addStaff($place_array, $page_id);
1063                                                                  break;                                                                                                    break;                                  
1064                                                          case "addLabel":                                                          case "addLabel":
1065                                                                  addLabel($con, $place_array, $page_id);                                                                  addLabel($place_array, $page_id);
1066                                                                  break;                                                                  break;
1067                                                          case "addRQS":                                                          case "addRQS":
1068                                                                  addRQS($con, $place_array, $page_id);                                                                  addRQS($place_array, $page_id);
1069                                                                  break;                                                                  break;
1070                                                          case "addRQSLink":                                                          case "addRQSLink":
1071                                                                  addRQSLink($con, $place_array, $page_id);                                                                  addRQSLink($place_array, $page_id);
1072                                                                  break;                                                                                                                            break;                                                          
1073                                                          default:                                                          default:
1074                                                                  break;                                                                  break;
# Line 1071  if(isset($libsession) && $auth_page == 1 Line 1086  if(isset($libsession) && $auth_page == 1
1086                                                  // Present an add icon or the add options                                                  // Present an add icon or the add options
1087                                                  if ($opt == "add" && $this_pos == $position) {                                                  if ($opt == "add" && $this_pos == $position) {
1088                                                          // Display add selection                                                          // Display add selection
1089                                                          addSelection($con, $place_array, $page_id);                                                          addSelection($place_array, $page_id);
1090                                                  }                                                  }
1091    
1092                                                  else {                                                  else {
# Line 1134  if(isset($libsession) && $auth_page == 1 Line 1149  if(isset($libsession) && $auth_page == 1
1149    
1150    
1151          // Error trapping          // Error trapping
1152          if ($page_debug == 1) errorTrap($con, $page_id);          if ($page_debug == 1) errorTrap($page_id);
1153    
1154    
1155          } // valid page workspace          } // valid page workspace
# Line 1143  if(isset($libsession) && $auth_page == 1 Line 1158  if(isset($libsession) && $auth_page == 1
1158                    
1159          // Display page coordinator          // Display page coordinator
1160          if ($staff_coordinator > 0) {          if ($staff_coordinator > 0) {
1161                  $display_page_coord = lookupStaff($con, $staff_coordinator);                  $display_page_coord = lookupStaff($staff_coordinator);
1162                  $staff_email = lookupField($con, "staff", "staff_id", $staff_coordinator, "staff_email");                  $staff_email = lookupField("staff", "staff_id", $staff_coordinator, "staff_email");
1163                    
1164                  if (strlen($display_page_coord) > 0 && strlen($staff_email) > 0) {                  if (strlen($display_page_coord) > 0 && strlen($staff_email) > 0) {
1165                          printf("<span class=\"S5\">\n");                          printf("<span class=\"S5\">\n");

Legend:
Removed from v.66  
changed lines
  Added in v.67

  ViewVC Help
Powered by ViewVC 1.1.26