1 |
<?php |
2 |
// Load globals |
3 |
require_once ("global_vars.php"); |
4 |
|
5 |
// Includes |
6 |
require_once ($GLOBAL_ADMIN_INC."sessionClass.php"); |
7 |
require_once ($GLOBAL_ADMIN_INC."accessClass.php"); |
8 |
require_once ("db_connect.php"); |
9 |
require_once ($GLOBAL_ADMIN_INC."app_controls.php"); |
10 |
require_once ($GLOBAL_ADMIN_INC."forms.php"); |
11 |
|
12 |
// HTML header |
13 |
printf("<HTML>\n"); |
14 |
printf("<HEAD>\n"); |
15 |
printf("<title>RQS Subject Builder</title>\n"); |
16 |
printf("<link rel=\"stylesheet\" href=\"%s\" type=\"text/css\">\n", $GLOBAL_ADMIN_CSS); |
17 |
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 |
31 |
require_once ($GLOBAL_ADMIN_HEADER); |
32 |
|
33 |
|
34 |
// Collect access information |
35 |
if (isset($libsession)) { |
36 |
|
37 |
// Fetch session information |
38 |
$sessionClass = new sessionClass("", $libsession, "", ""); |
39 |
$accessClass = new accessClass($sessionClass); |
40 |
|
41 |
// Load user session variables |
42 |
$sess_time_human = $sessionClass->time_human; |
43 |
$sess_staff_account = $sessionClass->staff_account; |
44 |
$sess_staff_id = $accessClass->staff_id; |
45 |
$sess_access_level = $accessClass->access_level; |
46 |
$sess_access = $accessClass->access; |
47 |
$sess_last_name = $accessClass->last_name; |
48 |
$sess_first_name = $accessClass->first_name; |
49 |
|
50 |
} |
51 |
|
52 |
|
53 |
// Default authorization |
54 |
$auth_subject = 0; |
55 |
|
56 |
|
57 |
// Flag to make sure that the current user has sufficient access for this subject |
58 |
$auth_subject = authSubject($sess_access_level, $sess_staff_id, $subject_id); |
59 |
|
60 |
|
61 |
// If the cookie is set and access level is appropriate |
62 |
if(isset($libsession) && $sess_access_level >= 20 && $auth_subject == 1) { |
63 |
|
64 |
// Default to incoming letter A if nothing selected |
65 |
if ($letter == "" && $limitstring == "" && $masterinfotype_id < 1 && $feature_id < 1) $letter = "A"; |
66 |
|
67 |
printf("<table border =\"0\">\n"); |
68 |
printf("<tr><td colspan=\"2\">"); |
69 |
|
70 |
/********************************** |
71 |
** Display user's subject choice ** |
72 |
**********************************/ |
73 |
|
74 |
$subject = lookupField("subject", "subject_id", $subject_id, "subject"); |
75 |
printf("<h2>Research QuickStart: %s</h2>", $subject); |
76 |
printf("</td></tr>\n"); |
77 |
|
78 |
|
79 |
/******************* |
80 |
** Preview option ** |
81 |
*******************/ |
82 |
|
83 |
printf("<tr><td>\n"); |
84 |
printf("<form method =\"POST\" action=\"%srqs.phtml?subject_id=%s\" >\n", $GLOBAL_RQS_URL, $subject_id); |
85 |
printf("<br><input type=\"submit\" value =\"Preview This Page\">\n"); |
86 |
printf("</form>\n"); |
87 |
printf("</td>\n"); |
88 |
|
89 |
printf("<td>\n"); |
90 |
printf("<form method =\"POST\" action=\"%srqs.phtml?core=1&subject_id=%s\" >\n", $GLOBAL_RQS_URL, $subject_id); |
91 |
printf("<br><input type=\"submit\" value =\"Preview Core Only\">\n"); |
92 |
printf("</form>\n"); |
93 |
|
94 |
printf("</td></tr></table><br>\n"); |
95 |
|
96 |
|
97 |
/******************************* |
98 |
** Publish toggle & page info ** |
99 |
*******************************/ |
100 |
|
101 |
// Collect the data |
102 |
$sql = "SELECT |
103 |
rqs_date_created, |
104 |
rqs_date_modified, |
105 |
rqs_account_created, |
106 |
rqs_account_modified, |
107 |
rqs_published |
108 |
FROM |
109 |
subject |
110 |
WHERE |
111 |
subject_id = " |
112 |
. $subject_id; |
113 |
|
114 |
$rs = xx_tryquery($sql); |
115 |
$row = xx_fetch_array ($rs, xx_ASSOC); |
116 |
$rqs_date_modified = $row["rqs_date_modified"]; |
117 |
$rqs_date_created = $row["rqs_date_created"]; |
118 |
$rqs_account_created = $row["rqs_account_created"]; |
119 |
$rqs_account_modified = $row["rqs_account_modified"]; |
120 |
$rqs_published = $row["rqs_published"]; |
121 |
|
122 |
printf("<table width=\"95%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\"><tr>\n"); |
123 |
printf("<td colspan =\"4\" class=\"cellPlain\">RQS Page Status</td></tr>\n"); |
124 |
|
125 |
// Date created |
126 |
printf("<td>\n"); |
127 |
printf("<b>Created:</b> %s (%s)\n", $rqs_date_created, $rqs_account_created); |
128 |
printf("</td>\n"); |
129 |
|
130 |
// Date modified |
131 |
printf("<td>\n"); |
132 |
printf("<b>Modified:</b> %s (%s)\n", $rqs_date_modified, $rqs_account_modified); |
133 |
printf("</td>\n"); |
134 |
|
135 |
// Publish status |
136 |
if ($rqs_published > 0) { |
137 |
printf("<form method=\"POST\" action=\"subject_transaction.phtml\">\n"); |
138 |
printf("<input type =\"hidden\" name=\"transaction\" value =\"rqsUnpublish\">\n"); |
139 |
printf("<input type=\"hidden\" name=\"subject_id\" value=\"%d\">\n", $subject_id); |
140 |
printf("<td><b>Pub Status:</b> Published</td>\n"); |
141 |
printf("<td><input type=\"submit\" value=\"Unpublish\">\n"); |
142 |
printf("</form>\n"); |
143 |
printf("</td>\n"); |
144 |
} |
145 |
else { |
146 |
printf("<form method=\"POST\" action=\"subject_transaction.phtml\">\n"); |
147 |
printf("<input type =\"hidden\" name=\"transaction\" value =\"rqsPublish\">\n"); |
148 |
printf("<input type=\"hidden\" name=\"subject_id\" value=\"%d\">\n", $subject_id); |
149 |
printf("<td><b>Pub Status:</b> Not published</td>\n"); |
150 |
printf("<td><input type=\"submit\" value=\"Publish\">\n"); |
151 |
printf("</form>\n"); |
152 |
printf("</td>\n"); |
153 |
} |
154 |
printf("</tr>\n"); |
155 |
printf("</table><br>\n"); |
156 |
|
157 |
|
158 |
// Outer table for main page body |
159 |
printf("<table width=\"100%%\" border=\"0\">\n"); |
160 |
printf("<tr><td width=\"50%%\" valign=\"top\">\n"); |
161 |
|
162 |
|
163 |
/********************************* |
164 |
** Add Resource - Select Limits ** |
165 |
*********************************/ |
166 |
|
167 |
printf("<table width = \"75%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\">\n"); |
168 |
printf("<tr><td colspan=\"2\" align=\"left\" class=\"cellPlain\">\n"); |
169 |
printf("<a name=\"select\">Select Resource</a>"); |
170 |
printf("</td></tr>\n"); |
171 |
|
172 |
printf("<tr><td colspan=\"2\">\n"); |
173 |
|
174 |
// Limit to letter |
175 |
printf("Narrow Resource List To:<br>\n"); |
176 |
if ($letter != "") printf("Starting With <b>%s</b>\n", $letter); |
177 |
else if ($limitstring != "") printf ("Titles or Descriptions Containing <b>\"%s\"</b>\n", $limitstring); |
178 |
else printf ("All Resources\n"); |
179 |
|
180 |
// User limited by masterinfotype, display it |
181 |
if ($masterinfotype_id > 0) { |
182 |
$masterinfotype = lookupField("masterinfotype", "masterinfotype_id", $masterinfotype_id, "masterinfotype"); |
183 |
printf(" within <b>%s</b>\n", $masterinfotype); |
184 |
} |
185 |
|
186 |
// User limited by feature, display it |
187 |
if ($feature_id > 0) { |
188 |
$feature = lookupField("feature", "feature_id", $feature_id, "feature"); |
189 |
printf(" involving <b>%s</b>\n", $feature); |
190 |
} |
191 |
|
192 |
printf("</td></tr>\n"); |
193 |
|
194 |
/******************** |
195 |
** Limit by Letter ** |
196 |
********************/ |
197 |
|
198 |
printf("<tr><td colspan=\"2\" bgcolor = \"#ffffff\" align=\"center\" >\n"); |
199 |
printf("<a href=\"subject_builder.phtml?subject_id=%d&letter=All#select\">A-Z</a> | ", $subject_id); |
200 |
|
201 |
// Draw the alphabet |
202 |
for ($ascii_char = 65; $ascii_char <= 90; $ascii_char++) { |
203 |
if ($ascii_char == 77 || $asci_char == 90) printf("<BR><BR>\n"); |
204 |
else printf(" | "); |
205 |
printf("<a href=\"subject_builder.phtml?subject_id=%d&letter=%s#select\">%s</a>", $subject_id, chr($ascii_char), chr($ascii_char)); |
206 |
|
207 |
} |
208 |
printf("</td></tr>\n"); |
209 |
|
210 |
/*********** |
211 |
** Search ** |
212 |
***********/ |
213 |
|
214 |
printf("<tr><td class = \"cellPlain\">Title or Description:</td><td>\n"); |
215 |
printf("<form method=\"POST\" action=\"subject_builder.phtml#select\">\n"); |
216 |
printf("<input type=\"hidden\" name=\"subject_id\" value=\"%d\">\n", $subject_id); |
217 |
printf("<input type=\"text\" name=\"limitstring\" value =\"%s\" size =\"20\">\n", $limitstring); |
218 |
printf(" and/or</td></tr>\n"); |
219 |
|
220 |
|
221 |
/******************* |
222 |
** Masterinfotype ** |
223 |
*******************/ |
224 |
|
225 |
printf("<tr><td class = \"cellPlain\">Master Info Type:</td><td>\n"); |
226 |
printf("<select name = \"masterinfotype_id\">\n"); |
227 |
printf("<option value=\"0\">All</option>\n"); |
228 |
dropDownFieldSelected("masterinfotype", "masterinfotype", "masterinfotype_id", " WHERE masterinfotype_id > 1 ", $masterinfotype_id); |
229 |
printf("</select>\n"); |
230 |
printf(" and/or</td></tr>\n"); |
231 |
|
232 |
/************ |
233 |
** Feature ** |
234 |
************/ |
235 |
|
236 |
printf("<tr><td class = \"cellPlain\" >Feature:</td><td>\n"); |
237 |
printf("<select name = \"feature_id\">\n"); |
238 |
printf("<option value=\"0\">All</option>\n"); |
239 |
dropDownFieldSelected("feature", "feature", "feature_id", " WHERE feature_id > 1 ", $feature_id); |
240 |
printf("</select>\n"); |
241 |
|
242 |
printf("<input type=\"submit\" value =\"Limit\"></form>\n"); |
243 |
|
244 |
printf("</td></tr>\n"); |
245 |
|
246 |
/************************* |
247 |
** The Add-Resource Box ** |
248 |
*************************/ |
249 |
|
250 |
printf("<tr><td colspan = \"2\" align = \"center\" >\n"); |
251 |
printf("<form method =\"POST\" action=\"subject_transaction.phtml\" >\n"); |
252 |
printf("<b>Add a Resource to this RQS page</b><BR>\n"); |
253 |
printf("<select name = \"resource_id\" size = \"5\" >\n"); |
254 |
|
255 |
// Determine any limits and draw the box |
256 |
if (strlen($letter) > 0 && $letter != "All") $limit = $letter; |
257 |
if (strlen($limitstring) > 0) $limit = $limitstring; |
258 |
dropDownResource(0, $limit, $masterinfotype_id, $feature_id); |
259 |
printf("</select><br>\n"); |
260 |
|
261 |
printf("<input type =\"hidden\" name=\"subject_id\" value =\"%d\">\n", $subject_id); |
262 |
printf("<input type =\"hidden\" name=\"transaction\" value =\"insertSubjectBuilder\">\n"); |
263 |
printf("<br><input type=\"submit\" name =\"highlighted\" value =\"Add\">\n"); |
264 |
printf(" <input type=\"submit\" name =\"highlighted\" value =\"Add Core\">\n"); |
265 |
printf("</form>"); |
266 |
if ($recent > 0) printf("<a href=\"#r%d\">Jump to Most Recently Added</a>\n", $recent); |
267 |
print "Can't find the resource you need to add? <a href=\"console.phtml\">Add a New Resource</a><br />\n"; |
268 |
printf("</td></tr></table><BR>\n"); |
269 |
|
270 |
|
271 |
// Close outer cell |
272 |
printf("</td>\n"); |
273 |
|
274 |
/************************* |
275 |
** Select Related Pages ** |
276 |
*************************/ |
277 |
|
278 |
printf("<td width=\"50%%\" valign=\"top\" align=\"right\">\n"); |
279 |
formAssignSubOtherSub($subject_id); |
280 |
|
281 |
printf("<br>\n"); |
282 |
formAssignSubPage($subject_id); |
283 |
|
284 |
// Close outer cell, row, and table |
285 |
printf("</td></tr></table>\n"); |
286 |
|
287 |
|
288 |
/************************************************************************* |
289 |
** Main body table. Table of contents in left cell, resources in right ** |
290 |
*************************************************************************/ |
291 |
|
292 |
printf("<table width=\"100%%\" border=\"0\" cellpadding=\"4\">\n"); |
293 |
printf("<tr><td width=\"20%%\" valign=\"top\" class=\"backLight\">\n"); |
294 |
|
295 |
|
296 |
/*********************************** |
297 |
** Generate the table of contents ** |
298 |
***********************************/ |
299 |
|
300 |
printf("<b>Contents of this page:</b><br><br>\n"); |
301 |
// Generate the list |
302 |
$sql = "SELECT DISTINCT mi.masterinfotype_id, mi.masterinfotype, i.infotype_id, i.infotype FROM |
303 |
res_sub_infotype rsi, |
304 |
infotype i, |
305 |
masterinfotype mi |
306 |
|
307 |
WHERE |
308 |
rsi.subject_id = " |
309 |
. $subject_id |
310 |
. " AND mi.masterinfotype_id = i.masterinfotype_id AND |
311 |
rsi.infotype_id = i.infotype_id |
312 |
ORDER BY mi.masterinfotype, i.infotype"; |
313 |
|
314 |
$rs = xx_tryquery($sql); |
315 |
|
316 |
$rows = xx_num_rows($rs); |
317 |
|
318 |
// initialize |
319 |
$last_masterinfotype_id = 0; |
320 |
|
321 |
$rowcount = 0; |
322 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
323 |
|
324 |
// Fetch information types for this subject |
325 |
$infotype_id = $row["infotype_id"]; |
326 |
$infotype = $row["infotype"]; |
327 |
$masterinfotype_id = $row["masterinfotype_id"]; |
328 |
$masterinfotype = $row["masterinfotype"]; |
329 |
|
330 |
if ($last_masterinfotype_id != $masterinfotype_id) { |
331 |
if ($rowcount > 0) printf("</ul>\n"); |
332 |
printf("<b><a href=\"subject_builder.phtml?subject_id=%d#m%d\">%s</a></b>\n", $subject_id, $masterinfotype_id, $masterinfotype); |
333 |
printf("<ul>\n"); |
334 |
} |
335 |
|
336 |
printf("<li><a href=\"subject_builder.phtml?subject_id=%d#i%d\">%s</a></li>\n", $subject_id, $infotype_id, $infotype); |
337 |
|
338 |
|
339 |
$last_masterinfotype_id = $masterinfotype_id; |
340 |
$rowcount++; |
341 |
|
342 |
}; |
343 |
|
344 |
// Close remaining ul tag |
345 |
if ($rowcount > 0) printf("</ul>\n"); |
346 |
|
347 |
// Close table of contents cell |
348 |
printf("</td>\n"); |
349 |
|
350 |
// Resources, main body cell |
351 |
printf("<td width=\"80%%\" valign=\"top\">"); |
352 |
|
353 |
|
354 |
/*************************** |
355 |
** Generate the resources ** |
356 |
***************************/ |
357 |
|
358 |
$sql = "SELECT |
359 |
rsi.description, |
360 |
rsi.highlighted, |
361 |
m.masterinfotype_id, |
362 |
m.masterinfotype, |
363 |
i.infotype_id, |
364 |
i.infotype, |
365 |
r.resource_id, |
366 |
r.title, |
367 |
r.author, |
368 |
r.annotation, |
369 |
r.url, |
370 |
r.cat_num |
371 |
FROM res_sub_infotype rsi, |
372 |
infotype i, masterinfotype m, resource r |
373 |
WHERE |
374 |
rsi.subject_id = " |
375 |
. $subject_id |
376 |
. " AND rsi.masterinfotype_id = m.masterinfotype_id AND |
377 |
rsi.infotype_id = i.infotype_id AND |
378 |
rsi.masterinfotype_id = m.masterinfotype_id AND |
379 |
rsi.resource_id = r.resource_id |
380 |
ORDER BY m.masterinfotype, i.infotype, r.title"; |
381 |
|
382 |
$rs = xx_tryquery($sql); |
383 |
|
384 |
// printf("sql was: %s<BR><BR>", $sql); |
385 |
|
386 |
while ($row = xx_fetch_array ($rs, xx_ASSOC)) { |
387 |
|
388 |
// Fetch information types for this subject |
389 |
$description = $row["description"]; |
390 |
$masterinfotype = $row["masterinfotype"]; |
391 |
$masterinfotype_id = $row["masterinfotype_id"]; |
392 |
$infotype = $row["infotype"]; |
393 |
$infotype_id = $row["infotype_id"]; |
394 |
$title = $row["title"]; |
395 |
$author = $row["author"]; |
396 |
$annotation = $row["annotation"]; |
397 |
$resource_id = $row["resource_id"]; |
398 |
$url = $row["url"]; |
399 |
$cat_num = $row["cat_num"]; |
400 |
$highlighted = $row["highlighted"]; |
401 |
|
402 |
|
403 |
// Header info |
404 |
if ($last_m != $masterinfotype) printf("<h3><a name=\"m%d\">%s</a></h3>", $masterinfotype_id, $masterinfotype); |
405 |
if ($last_i != $infotype) printf("<b><a name=\"i%d\">%s</a></b><br><br>", $infotype_id, $infotype); |
406 |
|
407 |
|
408 |
// Edit mode |
409 |
if ($selected_resource_id == $resource_id && $selected_infotype_id == $infotype_id && $operation == "editSubjectBuilder") { |
410 |
|
411 |
// Build an anchor |
412 |
printf("<a name = \"%d\" > </a>\n", $resource_id); |
413 |
|
414 |
printf("<table border=\"1\" class=\"backLight\">\n"); |
415 |
printf("<tr><td class=\"cellPlain\">\n"); |
416 |
printf("Edit This Instance"); |
417 |
printf("</td></tr>\n"); |
418 |
printf("<form method=\"POST\" action =\"subject_transaction.phtml\">\n"); |
419 |
printf("<tr><td>\n"); |
420 |
printf("<b>Title:</b> %s<br>\n", $title); |
421 |
if (strlen($url) > 0 ) printf ("<b>URL:</b> <a href=\"%s\">%s</a><BR>\n", $url, $url); |
422 |
|
423 |
// Change information type |
424 |
printf("<br><b>Information Type:</b><br>\n"); |
425 |
printf("<select name =\"infotype_id\">\n"); |
426 |
dropDownInfotype($infotype_id, $subject_id); |
427 |
printf("</select><BR><BR>\n"); |
428 |
|
429 |
// Set to highlighted status |
430 |
printf("<b>Highlighted/core resource?"); |
431 |
printf(" "); |
432 |
// Default radio button to appropriate value |
433 |
if ($highlighted != 1) $no_check = " CHECKED "; |
434 |
else $yes_check = " CHECKED "; |
435 |
// Radio buttons |
436 |
printf("Yes <input type = \"radio\" name =\"highlighted\" value = \"1\" %s> ", $yes_check); |
437 |
printf(" "); |
438 |
printf("No <input type = \"radio\" name =\"highlighted\" value = \"0\" %s></b><br><br>", $no_check); |
439 |
|
440 |
// Reset the checked status |
441 |
$yes_check = ""; |
442 |
$no_check = ""; |
443 |
|
444 |
// Use default description if none specified |
445 |
printf("<b>Use resource default description?"); |
446 |
printf(" "); |
447 |
|
448 |
// Default radio button to appropriate value |
449 |
if (strlen($description) > 0) $no_check = " CHECKED "; |
450 |
else $yes_check = " CHECKED "; |
451 |
|
452 |
// Radio buttons |
453 |
printf("Yes <input type = \"radio\" name =\"descr_default\" value = \"1\" %s> ", $yes_check); |
454 |
printf(" "); |
455 |
printf("No <input type = \"radio\" name =\"descr_default\" value = \"0\" %s></b>", $no_check); |
456 |
|
457 |
// Change description here |
458 |
printf("<br><br>If not, click \"no\" and make changes below:<br>\n"); |
459 |
printf("<b>This description:</b><BR>\n"); |
460 |
printf("<textarea cols=\"60\" rows=\"4\" name =\"description\">\n"); |
461 |
if (strlen($description) > 0) printf("%s", $description); |
462 |
else printf("%s", $annotation); |
463 |
printf("</textarea>\n"); |
464 |
|
465 |
// Form variables and submit |
466 |
printf("<input type=\"hidden\" name=\"transaction\" value=\"updateSubjectBuilder\">\n"); |
467 |
printf("<input type =\"hidden\" name =\"resource_id\" value =\"%d\">\n", $resource_id); |
468 |
printf("<input type=\"hidden\" name =\"subject_id\" value =\"%s\">\n", $subject_id); |
469 |
printf("<input type=\"hidden\" name =\"old_infotype_id\" value =\"%s\">\n", $infotype_id); |
470 |
|
471 |
// Hand-hold HTML to make the buttons appear together |
472 |
printf("<table><tr><td>\n"); |
473 |
printf("<input type = \"submit\" value =\"Save Changes\">\n"); |
474 |
printf("</td>\n"); |
475 |
printf("</form>\n"); |
476 |
printf("<form method=\"POST\" action=\"subject_builder.phtml?subject_id=%d#r%d\">", $subject_id, $resource_id); |
477 |
printf("<td>\n"); |
478 |
printf("<input type=\"submit\" value=\"Cancel\">\n"); |
479 |
printf("</td>\n"); |
480 |
printf("</form>\n"); |
481 |
printf("</tr></table>\n"); |
482 |
|
483 |
printf("</td></tr></table><BR><BR>\n"); |
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 |
524 |
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); |
535 |
if (strlen($url) > 0 ) printf ("URL: <a href=\"%s\">%s</a><BR>\n", $url, $url); |
536 |
printf("Description: "); |
537 |
if (strlen($description) > 0) printf("<i>%s</i> ", $description); |
538 |
else printf("<i>%s</i> ", $annotation); |
539 |
|
540 |
// Edit options |
541 |
printf("<table border =\"1\" cellpadding = \"0\" cellspacing = \"3\" class=\"backLight\"><tr>\n"); |
542 |
|
543 |
// Edit base resource entry |
544 |
printf("<form method =\"POST\" action=\"operation.phtml?operation=Edit&table=resource&key_id=%d\" >\n", $resource_id); |
545 |
printf("<td>\n"); |
546 |
printf("<input type=\"hidden\" name=\"operation\" value=\"Edit\">\n"); |
547 |
printf("<input type =\"hidden\" name =\"table\" value =\"resource\">\n"); |
548 |
printf("<input type = \"submit\" name = \"edit\" value =\"Edit Base Resource\">\n"); |
549 |
printf("</td></form>\n"); |
550 |
|
551 |
// Edit this entry |
552 |
printf("<form method =\"POST\" action=\"subject_builder.phtml#%d\" >\n", $resource_id); |
553 |
printf("<td>\n"); |
554 |
printf("<input type=\"hidden\" name=\"operation\" value=\"editSubjectBuilder\">\n"); |
555 |
printf("<input type =\"hidden\" name =\"selected_resource_id\" value =\"%d\">\n", $resource_id); |
556 |
printf("<input type=\"hidden\" name =\"subject_id\" value =\"%s\">\n", $subject_id); |
557 |
printf("<input type=\"hidden\" name =\"selected_infotype_id\" value =\"%d\">\n", $infotype_id); |
558 |
printf("<input type = \"submit\" name = \"edit\" value =\"Edit This Instance\">\n"); |
559 |
printf("</td></form>\n"); |
560 |
|
561 |
// Remove this entry |
562 |
printf("<form method=\"POST\" action=\"subject_builder.phtml?subject_id=%d#r%d\">", $subject_id, $resource_id); |
563 |
printf("<td>\n"); |
564 |
printf("<input type=\"hidden\" name=\"operation\" value=\"deleteSubjectBuilder\">\n"); |
565 |
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); |
567 |
printf("<input type=\"hidden\" name =\"selected_infotype_id\" value =\"%d\">\n", $infotype_id); |
568 |
printf("<input type = \"submit\" value =\"Remove\">\n"); |
569 |
printf("</td></form></tr></table><br><br>\n"); |
570 |
|
571 |
} // end display mode |
572 |
|
573 |
$last_m = $masterinfotype; |
574 |
$last_i = $infotype; |
575 |
|
576 |
} // end all rows |
577 |
|
578 |
|
579 |
// Close main body table |
580 |
printf("</td></tr></table>\n"); |
581 |
|
582 |
|
583 |
} // logged in user |
584 |
|
585 |
// No access page |
586 |
else require_once ($GLOBAL_NO_ACCESS); |
587 |
|
588 |
// Page footer |
589 |
require_once ($GLOBAL_ADMIN_FOOTER); |
590 |
?> |
591 |
|
592 |
</center> |
593 |
</body> |
594 |
</html> |