/[libdata]/trunk/admin/subject_builder.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 /trunk/admin/subject_builder.phtml

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

revision 71 by dpavlin, Thu Mar 4 22:43:50 2004 UTC revision 72 by dpavlin, Thu Mar 18 20:33:37 2004 UTC
# Line 17  printf("<link rel=\"stylesheet\" href=\" Line 17  printf("<link rel=\"stylesheet\" href=\"
17  printf("</HEAD>\n");  printf("</HEAD>\n");
18    
19    
20    // Default access settings
21    $sess_time_human = "";
22    $sess_staff_account = "";
23    $sess_staff_id = 0;
24    $sess_access_level = 0;
25    $sess_access = "";
26    $sess_last_name = "";
27    $sess_first_name = "";
28    
29    
30  // Page header  // Page header
31  require_once ($GLOBAL_ADMIN_HEADER);  require_once ($GLOBAL_ADMIN_HEADER);
32    
# Line 45  $auth_subject = 0; Line 55  $auth_subject = 0;
55    
56    
57  // Flag to make sure that the current user has sufficient access for this subject  // Flag to make sure that the current user has sufficient access for this subject
58  $auth_subject = authSubject($con, $sess_access_level, $sess_staff_id, $subject_id);  $auth_subject = authSubject($sess_access_level, $sess_staff_id, $subject_id);
59    
60    
61  // If the cookie is set and access level is appropriate  // If the cookie is set and access level is appropriate
# Line 61  if(isset($libsession) && $sess_access_le Line 71  if(isset($libsession) && $sess_access_le
71          ** Display user's subject choice **          ** Display user's subject choice **
72          **********************************/          **********************************/
73    
74          $subject = lookupField($con, "subject", "subject_id", $subject_id, "subject");          $subject = lookupField("subject", "subject_id", $subject_id, "subject");
75          printf("<h2>Research QuickStart: %s</h2>", $subject);          printf("<h2>Research QuickStart: %s</h2>", $subject);
76          printf("</td></tr>\n");          printf("</td></tr>\n");
77    
# Line 101  if(isset($libsession) && $sess_access_le Line 111  if(isset($libsession) && $sess_access_le
111                  subject_id = "                  subject_id = "
112                  . $subject_id;                  . $subject_id;
113                                    
114          $rs = xx_query($sql, $con);          $rs = xx_tryquery($sql);
115          $row = xx_fetch_array ($rs);              $row = xx_fetch_array ($rs, xx_ASSOC);  
116          $rqs_date_modified = $row["rqs_date_modified"];          $rqs_date_modified = $row["rqs_date_modified"];
117          $rqs_date_created = $row["rqs_date_created"];          $rqs_date_created = $row["rqs_date_created"];
118          $rqs_account_created = $row["rqs_account_created"];          $rqs_account_created = $row["rqs_account_created"];
# Line 169  if(isset($libsession) && $sess_access_le Line 179  if(isset($libsession) && $sess_access_le
179    
180          // User limited by masterinfotype, display it          // User limited by masterinfotype, display it
181          if ($masterinfotype_id > 0) {          if ($masterinfotype_id > 0) {
182                  $masterinfotype = lookupField($con, "masterinfotype", "masterinfotype_id", $masterinfotype_id, "masterinfotype");                  $masterinfotype = lookupField("masterinfotype", "masterinfotype_id", $masterinfotype_id, "masterinfotype");
183                  printf(" within <b>%s</b>\n", $masterinfotype);                  printf(" within <b>%s</b>\n", $masterinfotype);
184          }          }
185    
186          // User limited by feature, display it          // User limited by feature, display it
187          if ($feature_id > 0) {          if ($feature_id > 0) {
188                  $feature = lookupField($con, "feature", "feature_id", $feature_id, "feature");                  $feature = lookupField("feature", "feature_id", $feature_id, "feature");
189                  printf(" involving <b>%s</b>\n", $feature);                  printf(" involving <b>%s</b>\n", $feature);
190          }          }
191    
# Line 215  if(isset($libsession) && $sess_access_le Line 225  if(isset($libsession) && $sess_access_le
225          printf("<tr><td class = \"cellPlain\">Master Info Type:</td><td>\n");          printf("<tr><td class = \"cellPlain\">Master Info Type:</td><td>\n");
226          printf("<select name = \"masterinfotype_id\">\n");          printf("<select name = \"masterinfotype_id\">\n");
227          printf("<option value=\"0\">All</option>\n");          printf("<option value=\"0\">All</option>\n");
228          dropDownFieldSelected($con, "masterinfotype", "masterinfotype", "masterinfotype_id", " WHERE masterinfotype_id > 1 ", $masterinfotype_id);          dropDownFieldSelected("masterinfotype", "masterinfotype", "masterinfotype_id", " WHERE masterinfotype_id > 1 ", $masterinfotype_id);
229          printf("</select>\n");          printf("</select>\n");
230          printf(" and/or</td></tr>\n");          printf(" and/or</td></tr>\n");
231    
# Line 226  if(isset($libsession) && $sess_access_le Line 236  if(isset($libsession) && $sess_access_le
236          printf("<tr><td class = \"cellPlain\" >Feature:</td><td>\n");          printf("<tr><td class = \"cellPlain\" >Feature:</td><td>\n");
237          printf("<select name = \"feature_id\">\n");          printf("<select name = \"feature_id\">\n");
238          printf("<option value=\"0\">All</option>\n");          printf("<option value=\"0\">All</option>\n");
239          dropDownFieldSelected($con, "feature", "feature", "feature_id", " WHERE feature_id > 1 ", $feature_id);          dropDownFieldSelected("feature", "feature", "feature_id", " WHERE feature_id > 1 ", $feature_id);
240          printf("</select>\n");          printf("</select>\n");
241    
242          printf("<input type=\"submit\" value =\"Limit\"></form>\n");          printf("<input type=\"submit\" value =\"Limit\"></form>\n");
# Line 245  if(isset($libsession) && $sess_access_le Line 255  if(isset($libsession) && $sess_access_le
255          // Determine any limits and draw the box          // Determine any limits and draw the box
256          if (strlen($letter) > 0 && $letter != "All") $limit = $letter;          if (strlen($letter) > 0 && $letter != "All") $limit = $letter;
257          if (strlen($limitstring) > 0) $limit = $limitstring;          if (strlen($limitstring) > 0) $limit = $limitstring;
258          dropDownResource($con, 0, $limit, $masterinfotype_id, $feature_id);          dropDownResource(0, $limit, $masterinfotype_id, $feature_id);
259          printf("</select><br>\n");          printf("</select><br>\n");
260    
261          printf("<input type =\"hidden\" name=\"subject_id\" value =\"%d\">\n", $subject_id);          printf("<input type =\"hidden\" name=\"subject_id\" value =\"%d\">\n", $subject_id);
# Line 266  if(isset($libsession) && $sess_access_le Line 276  if(isset($libsession) && $sess_access_le
276          *************************/          *************************/
277                    
278          printf("<td width=\"50%%\" valign=\"top\" align=\"right\">\n");          printf("<td width=\"50%%\" valign=\"top\" align=\"right\">\n");
279          formAssignSubOtherSub($con, $subject_id);          formAssignSubOtherSub($subject_id);
280                    
281          printf("<br>\n");          printf("<br>\n");
282          formAssignSubPage($con, $subject_id);          formAssignSubPage($subject_id);
283                    
284          // Close outer cell, row, and table          // Close outer cell, row, and table
285          printf("</td></tr></table>\n");          printf("</td></tr></table>\n");
# Line 301  if(isset($libsession) && $sess_access_le Line 311  if(isset($libsession) && $sess_access_le
311                          rsi.infotype_id = i.infotype_id                          rsi.infotype_id = i.infotype_id
312                          ORDER BY mi.masterinfotype, i.infotype";                          ORDER BY mi.masterinfotype, i.infotype";
313    
314          $rs = xx_query($sql, $con);          $rs = xx_tryquery($sql);
315    
316          $rows = xx_num_rows($rs);          $rows = xx_num_rows($rs);
317    
# Line 309  if(isset($libsession) && $sess_access_le Line 319  if(isset($libsession) && $sess_access_le
319          $last_masterinfotype_id = 0;          $last_masterinfotype_id = 0;
320    
321          $rowcount = 0;          $rowcount = 0;
322          while ($row = xx_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
323    
324                  // Fetch information types for this subject                  // Fetch information types for this subject
325                  $infotype_id = $row["infotype_id"];                  $infotype_id = $row["infotype_id"];
# Line 369  if(isset($libsession) && $sess_access_le Line 379  if(isset($libsession) && $sess_access_le
379                  rsi.resource_id = r.resource_id                  rsi.resource_id = r.resource_id
380                  ORDER BY m.masterinfotype, i.infotype, r.title";                  ORDER BY m.masterinfotype, i.infotype, r.title";
381    
382          $rs = xx_query($sql, $con);          $rs = xx_tryquery($sql);
383    
384          // printf("sql was: %s<BR><BR>", $sql);          // printf("sql was: %s<BR><BR>", $sql);
385    
386          while ($row = xx_fetch_array ($rs)) {          while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
387    
388                  // Fetch information types for this subject                  // Fetch information types for this subject
389                  $description = $row["description"];                  $description = $row["description"];
# Line 396  if(isset($libsession) && $sess_access_le Line 406  if(isset($libsession) && $sess_access_le
406    
407    
408                  // Edit mode                  // Edit mode
409                  if ($selected_resource_id == $resource_id && $selected_infotype_id == $infotype_id) {                  if ($selected_resource_id == $resource_id && $selected_infotype_id == $infotype_id && $operation == "editSubjectBuilder") {
410    
411                          // Build an anchor                          // Build an anchor
412                          printf("<a name = \"%d\" > </a>\n", $resource_id);                          printf("<a name = \"%d\" > </a>\n", $resource_id);
# Line 413  if(isset($libsession) && $sess_access_le Line 423  if(isset($libsession) && $sess_access_le
423                          // Change information type                          // Change information type
424                          printf("<br><b>Information Type:</b><br>\n");                          printf("<br><b>Information Type:</b><br>\n");
425                          printf("<select name =\"infotype_id\">\n");                          printf("<select name =\"infotype_id\">\n");
426                          dropDownInfotype($con, $infotype_id, $subject_id);                          dropDownInfotype($infotype_id, $subject_id);
427                          printf("</select><BR><BR>\n");                          printf("</select><BR><BR>\n");
428    
429                          // Set to highlighted status                          // Set to highlighted status
# Line 474  if(isset($libsession) && $sess_access_le Line 484  if(isset($libsession) && $sess_access_le
484    
485                  }                  }
486    
487                    // Prompt for removal
488                    else if ($selected_resource_id == $resource_id && $selected_infotype_id == $infotype_id && $operation == "deleteSubjectBuilder") {
489    
490                            printf("<table border =\"1\" class=\"backLight\">\n");
491                            printf("<tr><td class=\"cellPlain\"><a name=\"r%d\">Remove This Resource?</a></td></tr>\n", $resource_id);
492                            printf("<td class=\"backLight\">\n");
493    
494                            printf("<b>Title:</b> %s<br>\n", $title);
495                            if (strlen($url) > 0 ) printf ("<b>URL:</b> <a href=\"%s\">%s</a><BR>\n", $url, $url);
496                            printf("<b>Description:</b> ");
497                            if (strlen($description) > 0) printf("<i>%s</i> ", $description);
498                            else printf("<i>%s</i> ", $annotation);
499                            printf("<br><br>\n");
500                            
501                            // Remove
502                            printf("<table><tr>\n");
503                            printf("<form method =\"POST\" action=\"subject_transaction.phtml\" >\n");
504                            printf("<td>\n");
505                            printf("<input type=\"hidden\" name=\"transaction\" value=\"deleteSubjectBuilder\">\n");
506                            printf("<input type=\"hidden\" name =\"resource_id\" value =\"%d\">\n", $selected_resource_id);
507                            printf("<input type=\"hidden\" name =\"subject_id\" value =\"%d\">\n", $subject_id);
508                            printf("<input type=\"hidden\" name =\"infotype_id\" value =\"%d\">\n", $selected_infotype_id);                
509                            printf("<input type = \"submit\" value =\"Remove\">\n");
510                            printf("</td></form>\n");
511                            
512                            // Cancel
513                            printf("<form method=\"POST\" action=\"subject_builder.phtml?subject_id=%d#r%d\">", $subject_id, $resource_id);
514                            printf("<td>\n");
515                            printf("<input type =\"submit\" value =\"Cancel\">\n");
516                            printf("</td></form></tr>\n");
517                            
518                            // Close things
519                            printf("</table></table><br>\n");
520    
521                    }
522    
523                  // Display mode                  // Display mode
524                  else {                    else {  
525    
526                            if ($masterinfotype_id == 1 && $infotype_id == 1) {
527    
528                                    printf("<b>System Message: ");
529                                    if (existsResSubNOTNA($resource_id, $subject_id)) printf("The following resource appears elsewhere on this page.  Multiple instances must belong to unique information types.  Please assign to a new information type or remove it.");
530                                    else printf("The following resource lacked a default information type when it was added to this page.  Please assign this instance to an information type.  Also consider assigning a default information type to the base resource if it is still blank.");
531                                    printf("</b><br><br>\n");
532                            }
533    
534                          printf("<a name=\"r%d\">Title:</a> %s<br>\n", $resource_id, $title);                          printf("<a name=\"r%d\">Title:</a> %s<br>\n", $resource_id, $title);
535                          if (strlen($url) > 0 ) printf ("URL: <a href=\"%s\">%s</a><BR>\n", $url, $url);                          if (strlen($url) > 0 ) printf ("URL: <a href=\"%s\">%s</a><BR>\n", $url, $url);
536                          printf("Description: ");                          printf("Description: ");
# Line 506  if(isset($libsession) && $sess_access_le Line 559  if(isset($libsession) && $sess_access_le
559                          printf("</td></form>\n");                          printf("</td></form>\n");
560                                                    
561                          // Remove this entry                          // Remove this entry
562                          printf("<form method =\"POST\" action=\"subject_transaction.phtml\" >\n");                          printf("<form method=\"POST\" action=\"subject_builder.phtml?subject_id=%d#r%d\">", $subject_id, $resource_id);                
563                          printf("<td>\n");                          printf("<td>\n");
564                          printf("<input type=\"hidden\" name=\"transaction\" value=\"deleteSubjectBuilder\">\n");                          printf("<input type=\"hidden\" name=\"operation\" value=\"deleteSubjectBuilder\">\n");
565                          printf("<input type=\"hidden\" name =\"resource_id\" value =\"%d\">\n", $resource_id);                          printf("<input type=\"hidden\" name =\"selected_resource_id\" value =\"%d\">\n", $resource_id);
566                          printf("<input type=\"hidden\" name =\"subject_id\" value =\"%d\">\n", $subject_id);                          printf("<input type=\"hidden\" name =\"subject_id\" value =\"%d\">\n", $subject_id);
567                          printf("<input type=\"hidden\" name =\"infotype_id\" value =\"%d\">\n", $infotype_id);                                            printf("<input type=\"hidden\" name =\"selected_infotype_id\" value =\"%d\">\n", $infotype_id);                
568                          printf("<input type = \"submit\" value =\"Remove\">\n");                          printf("<input type = \"submit\" value =\"Remove\">\n");
569                          printf("</td></form></tr></table><br><br>\n");                          printf("</td></form></tr></table><br><br>\n");
570    

Legend:
Removed from v.71  
changed lines
  Added in v.72

  ViewVC Help
Powered by ViewVC 1.1.26