--- trunk/admin/subject_builder.phtml 2004/03/18 20:21:08 71
+++ trunk/admin/subject_builder.phtml 2004/03/18 20:33:37 72
@@ -17,6 +17,16 @@
printf("\n");
+// Default access settings
+$sess_time_human = "";
+$sess_staff_account = "";
+$sess_staff_id = 0;
+$sess_access_level = 0;
+$sess_access = "";
+$sess_last_name = "";
+$sess_first_name = "";
+
+
// Page header
require_once ($GLOBAL_ADMIN_HEADER);
@@ -45,7 +55,7 @@
// Flag to make sure that the current user has sufficient access for this subject
-$auth_subject = authSubject($con, $sess_access_level, $sess_staff_id, $subject_id);
+$auth_subject = authSubject($sess_access_level, $sess_staff_id, $subject_id);
// If the cookie is set and access level is appropriate
@@ -61,7 +71,7 @@
** Display user's subject choice **
**********************************/
- $subject = lookupField($con, "subject", "subject_id", $subject_id, "subject");
+ $subject = lookupField("subject", "subject_id", $subject_id, "subject");
printf("
Research QuickStart: %s ", $subject);
printf("\n");
@@ -101,8 +111,8 @@
subject_id = "
. $subject_id;
- $rs = xx_query($sql, $con);
- $row = xx_fetch_array ($rs);
+ $rs = xx_tryquery($sql);
+ $row = xx_fetch_array ($rs, xx_ASSOC);
$rqs_date_modified = $row["rqs_date_modified"];
$rqs_date_created = $row["rqs_date_created"];
$rqs_account_created = $row["rqs_account_created"];
@@ -169,13 +179,13 @@
// User limited by masterinfotype, display it
if ($masterinfotype_id > 0) {
- $masterinfotype = lookupField($con, "masterinfotype", "masterinfotype_id", $masterinfotype_id, "masterinfotype");
+ $masterinfotype = lookupField("masterinfotype", "masterinfotype_id", $masterinfotype_id, "masterinfotype");
printf(" within %s \n", $masterinfotype);
}
// User limited by feature, display it
if ($feature_id > 0) {
- $feature = lookupField($con, "feature", "feature_id", $feature_id, "feature");
+ $feature = lookupField("feature", "feature_id", $feature_id, "feature");
printf(" involving %s \n", $feature);
}
@@ -215,7 +225,7 @@
printf("Master Info Type: \n");
printf("\n");
printf("All \n");
- dropDownFieldSelected($con, "masterinfotype", "masterinfotype", "masterinfotype_id", " WHERE masterinfotype_id > 1 ", $masterinfotype_id);
+ dropDownFieldSelected("masterinfotype", "masterinfotype", "masterinfotype_id", " WHERE masterinfotype_id > 1 ", $masterinfotype_id);
printf(" \n");
printf(" and/or \n");
@@ -226,7 +236,7 @@
printf("Feature: \n");
printf("\n");
printf("All \n");
- dropDownFieldSelected($con, "feature", "feature", "feature_id", " WHERE feature_id > 1 ", $feature_id);
+ dropDownFieldSelected("feature", "feature", "feature_id", " WHERE feature_id > 1 ", $feature_id);
printf(" \n");
printf(" \n");
@@ -245,7 +255,7 @@
// Determine any limits and draw the box
if (strlen($letter) > 0 && $letter != "All") $limit = $letter;
if (strlen($limitstring) > 0) $limit = $limitstring;
- dropDownResource($con, 0, $limit, $masterinfotype_id, $feature_id);
+ dropDownResource(0, $limit, $masterinfotype_id, $feature_id);
printf(" \n");
printf(" \n", $subject_id);
@@ -266,10 +276,10 @@
*************************/
printf(" \n");
- formAssignSubOtherSub($con, $subject_id);
+ formAssignSubOtherSub($subject_id);
printf(" \n");
- formAssignSubPage($con, $subject_id);
+ formAssignSubPage($subject_id);
// Close outer cell, row, and table
printf(" \n");
@@ -301,7 +311,7 @@
rsi.infotype_id = i.infotype_id
ORDER BY mi.masterinfotype, i.infotype";
- $rs = xx_query($sql, $con);
+ $rs = xx_tryquery($sql);
$rows = xx_num_rows($rs);
@@ -309,7 +319,7 @@
$last_masterinfotype_id = 0;
$rowcount = 0;
- while ($row = xx_fetch_array ($rs)) {
+ while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
// Fetch information types for this subject
$infotype_id = $row["infotype_id"];
@@ -369,11 +379,11 @@
rsi.resource_id = r.resource_id
ORDER BY m.masterinfotype, i.infotype, r.title";
- $rs = xx_query($sql, $con);
+ $rs = xx_tryquery($sql);
// printf("sql was: %s ", $sql);
- while ($row = xx_fetch_array ($rs)) {
+ while ($row = xx_fetch_array ($rs, xx_ASSOC)) {
// Fetch information types for this subject
$description = $row["description"];
@@ -396,7 +406,7 @@
// Edit mode
- if ($selected_resource_id == $resource_id && $selected_infotype_id == $infotype_id) {
+ if ($selected_resource_id == $resource_id && $selected_infotype_id == $infotype_id && $operation == "editSubjectBuilder") {
// Build an anchor
printf(" \n", $resource_id);
@@ -413,7 +423,7 @@
// Change information type
printf("Information Type: \n");
printf("\n");
- dropDownInfotype($con, $infotype_id, $subject_id);
+ dropDownInfotype($infotype_id, $subject_id);
printf(" \n");
// Set to highlighted status
@@ -474,10 +484,53 @@
}
+ // Prompt for removal
+ else if ($selected_resource_id == $resource_id && $selected_infotype_id == $infotype_id && $operation == "deleteSubjectBuilder") {
+
+ printf("\n");
+ printf("Remove This Resource? \n", $resource_id);
+ printf("\n");
+
+ printf("Title: %s \n", $title);
+ if (strlen($url) > 0 ) printf ("URL: %s \n", $url, $url);
+ printf("Description: ");
+ if (strlen($description) > 0) printf("%s ", $description);
+ else printf("%s ", $annotation);
+ printf(" \n");
+
+ // Remove
+ printf("\n");
+ printf("\n");
+
+ // Cancel
+ printf(" \n");
+
+ // Close things
+ printf("
\n");
+
+ }
// Display mode
else {
+ if ($masterinfotype_id == 1 && $infotype_id == 1) {
+
+ printf("System Message: ");
+ 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.");
+ 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.");
+ printf(" \n");
+ }
+
printf("Title: %s \n", $resource_id, $title);
if (strlen($url) > 0 ) printf ("URL: %s \n", $url, $url);
printf("Description: ");
@@ -506,12 +559,12 @@
printf("\n");
// Remove this entry
- printf(" \n");