1 |
dpavlin |
17 |
<?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 ($GLOBAL_ADMIN_INC."db_connect.php"); |
9 |
|
|
require_once ($GLOBAL_ADMIN_INC."app_controls.php"); |
10 |
|
|
require_once ($GLOBAL_ADMIN_INC."scribe_forms.php"); |
11 |
|
|
require_once ($GLOBAL_ADMIN_INC."scribe_application.php"); |
12 |
|
|
|
13 |
|
|
|
14 |
|
|
// Page header |
15 |
|
|
require_once ($GLOBAL_ADMIN_INC."scribe_header.phtml"); |
16 |
|
|
|
17 |
|
|
|
18 |
|
|
// Collect access information |
19 |
|
|
if (isset($libsession)) { |
20 |
|
|
|
21 |
|
|
// Fetch session information |
22 |
|
|
$sessionClass = new sessionClass("", $libsession, "", ""); |
23 |
|
|
$accessClass = new accessClass($sessionClass); |
24 |
|
|
|
25 |
|
|
// Load user session variables |
26 |
|
|
$sess_time_human = $sessionClass->time_human; |
27 |
|
|
$sess_staff_account = $sessionClass->staff_account; |
28 |
|
|
$sess_staff_id = $accessClass->staff_id; |
29 |
|
|
$sess_access_level = $accessClass->access_level; |
30 |
|
|
$sess_access = $accessClass->access; |
31 |
|
|
$sess_last_name = $accessClass->last_name; |
32 |
|
|
$sess_first_name = $accessClass->first_name; |
33 |
|
|
|
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
|
37 |
|
|
// Default authorization |
38 |
|
|
$auth_page = 0; |
39 |
|
|
|
40 |
|
|
// Create a new page: available to valid user sessions with access level >= 20 (author) |
41 |
|
|
if ($page_id < 1 && $sess_access_level >= 20) $auth_page = 1; |
42 |
|
|
|
43 |
|
|
// If editing an exiting page |
44 |
|
|
else { |
45 |
|
|
// Flag to make sure that the current user has sufficient access for this page |
46 |
|
|
$auth_page = authPage($con, $page_id, $sess_access_level, $sess_staff_id); |
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
// If the cookie is set and access level is appropriate |
50 |
|
|
if(isset($libsession) && $auth_page == 1) { |
51 |
|
|
|
52 |
|
|
// If creating a new page |
53 |
|
|
if ($page_id < 1 && $style_id > 0 && strlen($page_title) > 0) { |
54 |
|
|
|
55 |
|
|
// Cleaner |
56 |
|
|
$page_title = textInmySQL($page_title); |
57 |
|
|
|
58 |
|
|
$sql = "INSERT INTO page (date_created, account_created, staff_coordinator, style_id, pagetype_id, page_title, display_toc, wrap_toc) VALUES ( now(), '" |
59 |
|
|
. $sess_staff_account |
60 |
|
|
. "'," |
61 |
|
|
. $sess_staff_id |
62 |
|
|
. "," |
63 |
|
|
. $style_id |
64 |
|
|
. ", " |
65 |
|
|
. $pagetype_id |
66 |
|
|
. ", '" |
67 |
|
|
. $page_title |
68 |
|
|
. "', 1, 0)"; |
69 |
|
|
|
70 |
|
|
mysql_query ("LOCK TABLE page WRITE", $con); |
71 |
|
|
|
72 |
|
|
// Failed |
73 |
|
|
if (!mysql_query($sql, $con)){ |
74 |
|
|
sql_err($con); |
75 |
|
|
mysql_query ("UNLOCK TABLES", $con); |
76 |
|
|
bailout(); |
77 |
|
|
} |
78 |
|
|
|
79 |
|
|
// Succeeded |
80 |
|
|
else { |
81 |
|
|
$page_id = mysql_insert_id($con); |
82 |
|
|
mysql_query("UNLOCK TABLES", $con); |
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
// If a coursescribe page -- write the row into the course table |
86 |
|
|
if ($pagetype_id == 3) { |
87 |
|
|
$sql = "INSERT INTO course (page_id, course_concat, courseheader) VALUES(" |
88 |
|
|
. $page_id |
89 |
|
|
. ", '" |
90 |
|
|
. $page_title |
91 |
|
|
. "', 'Information Resources and Services for:')"; |
92 |
|
|
|
93 |
|
|
// Failed |
94 |
|
|
if (!mysql_query($sql, $con)){ |
95 |
|
|
sql_err($con); |
96 |
|
|
mysql_query ("UNLOCK TABLES", $con); |
97 |
|
|
bailout(); |
98 |
|
|
} |
99 |
|
|
|
100 |
|
|
// Succeeded |
101 |
|
|
else { |
102 |
|
|
mysql_query("UNLOCK TABLES", $con); |
103 |
|
|
} |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
} |
107 |
|
|
|
108 |
|
|
// Continue only if we now have a valid page workspace |
109 |
|
|
if ($page_id > 0 ) { |
110 |
|
|
|
111 |
|
|
/*************************** |
112 |
|
|
** Fetch Page Information ** |
113 |
|
|
***************************/ |
114 |
|
|
|
115 |
|
|
$sql = "SELECT * FROM page p |
116 |
|
|
LEFT JOIN course c using (page_id) |
117 |
|
|
WHERE p.page_id = " . $page_id; |
118 |
|
|
|
119 |
|
|
$rs = mysql_query($sql, $con); |
120 |
|
|
$row = mysql_fetch_array ($rs); |
121 |
|
|
$page_title = $row["page_title"]; |
122 |
|
|
$pagetitle_style = $row["pagetitle_style"]; |
123 |
|
|
$style_id = $row["style_id"]; |
124 |
|
|
$pagetype_id = $row["pagetype_id"]; |
125 |
|
|
$published = $row["published"]; |
126 |
|
|
$display_urls = $row["display_urls"]; |
127 |
|
|
$display_toc = $row["display_toc"]; |
128 |
|
|
$wrap_toc = $row["wrap_toc"]; |
129 |
|
|
$display_up = $row["display_up"]; |
130 |
|
|
$up_text = $row["up_text"]; |
131 |
|
|
$date_created = $row["date_created"]; |
132 |
|
|
$date_modified = $row["date_modified"]; |
133 |
|
|
$account_created = $row["account_created"]; |
134 |
|
|
$account_modified = $row["account_modified"]; |
135 |
|
|
$staff_coordinator = $row["staff_coordinator"]; |
136 |
|
|
$page_debug = $row["page_debug"]; |
137 |
|
|
$course_id = $row["course_id"]; |
138 |
|
|
|
139 |
|
|
/************************************************* |
140 |
|
|
** Determine if there's anything in copy buffer ** |
141 |
|
|
*************************************************/ |
142 |
|
|
$paste_data = existsRow($con, "pastebuffer", "paste_staff_id", $sess_staff_id); |
143 |
|
|
|
144 |
|
|
|
145 |
|
|
/********************************** |
146 |
|
|
** Populate the generation array ** |
147 |
|
|
**********************************/ |
148 |
|
|
|
149 |
|
|
$genArray = array(); |
150 |
|
|
populateGenArray($con, $genArray, $page_id); |
151 |
|
|
|
152 |
|
|
|
153 |
|
|
/****************** |
154 |
|
|
** Page Commands ** |
155 |
|
|
******************/ |
156 |
|
|
|
157 |
|
|
// Page commands table |
158 |
|
|
$page_title_display = strip_tags($page_title); |
159 |
|
|
printf("<table width=\"95%%\" border=\"1\" cellpadding=\"4\" class=\"backLight\"><tr>\n"); |
160 |
|
|
printf("<td colspan =\"4\" class=\"cellPlain\">Page Commands: %s\n", $page_title_display); |
161 |
|
|
printf("</td></tr>\n"); |
162 |
|
|
|
163 |
|
|
|
164 |
|
|
/************************************* |
165 |
|
|
** Row for general page information ** |
166 |
|
|
*************************************/ |
167 |
|
|
printf("<tr>\n"); |
168 |
|
|
|
169 |
|
|
// Date created |
170 |
|
|
printf("<td>\n"); |
171 |
|
|
printf("<b>Created:</b><br> %s (%s)\n", $date_created, $account_created); |
172 |
|
|
printf("</td>\n"); |
173 |
|
|
|
174 |
|
|
// Date modified |
175 |
|
|
printf("<td>\n"); |
176 |
|
|
printf("<b>Modified:</b><br> %s (%s)\n", $date_modified, $account_modified); |
177 |
|
|
printf("</td>\n"); |
178 |
|
|
|
179 |
|
|
// Publish status |
180 |
|
|
printf("<td colspan=\"2\">\n"); |
181 |
|
|
printf("<b>Pub Status:</b> "); |
182 |
|
|
if ($published >0) { |
183 |
|
|
$static_url = $GLOBAL_SCRIBE_URL. "publish.phtml?page_id=" . $page_id; |
184 |
|
|
|
185 |
|
|
printf("Published.<br>\n"); |
186 |
|
|
// Uncomment this out to provide a link to the static page |
187 |
|
|
// printf("<b>Static URL:</b> <a href=\"%s\">%s</a><br>\n", $static_url, $static_url); |
188 |
|
|
|
189 |
|
|
} |
190 |
|
|
else printf("(Not published)<br>\n"); |
191 |
|
|
$dyna_url = $GLOBAL_SCRIBE_URL. "page.phtml?page_id=" . $page_id; |
192 |
|
|
printf("<b>URL:</b> <a href=\"%s\">%s</a>\n", $dyna_url, $dyna_url); |
193 |
|
|
printf("</td></tr>\n"); |
194 |
|
|
|
195 |
|
|
/************************************************ |
196 |
|
|
** Row for Copy/delete/publish/preview buttons ** |
197 |
|
|
************************************************/ |
198 |
|
|
printf("<tr>\n"); |
199 |
|
|
|
200 |
|
|
// Create clone |
201 |
|
|
printf("<td colspan=\"1\">\n"); |
202 |
|
|
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
203 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"pageTemplate\">\n"); |
204 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
205 |
|
|
printf("<input type=\"hidden\" name =\"sess_staff_account\" value = \"%d\">\n", $sess_staff_account); |
206 |
|
|
printf("<input type=\"hidden\" name =\"sess_staff_id\" value = \"%d\">\n", $sess_staff_id); |
207 |
|
|
printf("<input type=\"submit\" value = \"Create Clone\"></td>\n"); |
208 |
|
|
printf("</form>\n"); |
209 |
|
|
|
210 |
|
|
// Delete page |
211 |
|
|
printf("<td colspan=\"1\">\n"); |
212 |
|
|
printf("<form method=\"POST\" action=\"scribe_transaction.phtml\" >\n"); |
213 |
|
|
printf("<input type=\"hidden\" name= \"transaction\" value= \"deletePageConfirm\">\n"); |
214 |
|
|
printf("<input type=\"hidden\" name=\"page_id\" value=\"%d\">", $page_id); |
215 |
|
|
printf("<input type=\"submit\" value = \"Delete Page!\"></td>\n"); |
216 |
|
|
printf("</form>\n"); |
217 |
|
|
|
218 |
|
|
// Published, draw the republish button |
219 |
|
|
if ($published > 0 ){ |
220 |
|
|
|
221 |
|
|
// Uncomment this to allow a republish option, if using static pages |
222 |
|
|
// Republish button |
223 |
|
|
/* |
224 |
|
|
printf("<td><table border=\"0\"><tr><td>"); |
225 |
|
|
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
226 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"scribePublish\">\n"); |
227 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
228 |
|
|
printf("<input type=\"submit\" value = \"Republish\">\n"); |
229 |
|
|
printf("</td></form>\n"); |
230 |
|
|
|
231 |
|
|
printf("<td><form method=\"POST\" action =\"scribe_transaction.phtml\">"); |
232 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"scribeUnpublish\">\n"); |
233 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
234 |
|
|
printf("<input type=\"submit\" value = \"Unpublish\">\n"); |
235 |
|
|
printf("</td></form></tr></table>\n"); |
236 |
|
|
*/ |
237 |
|
|
|
238 |
|
|
// Comment out this, if using static pages |
239 |
|
|
printf("<td colspan=\"1\"><form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
240 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"scribeUnpublish\">\n"); |
241 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
242 |
|
|
printf("<input type=\"submit\" value = \"Unpublish\">\n"); |
243 |
|
|
|
244 |
|
|
|
245 |
|
|
printf("</td>\n"); |
246 |
|
|
|
247 |
|
|
// Uncomment out this, if using static pages |
248 |
|
|
printf("</form>\n"); |
249 |
|
|
|
250 |
|
|
} |
251 |
|
|
|
252 |
|
|
// Not published, offer publish page form |
253 |
|
|
else { |
254 |
|
|
|
255 |
|
|
printf("<td colspan=\"1\">\n"); |
256 |
|
|
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
257 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"scribePublish\">\n"); |
258 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
259 |
|
|
printf("<input type=\"submit\" value = \"Publish\">\n"); |
260 |
|
|
printf("</td></form>\n"); |
261 |
|
|
|
262 |
|
|
} |
263 |
|
|
|
264 |
|
|
// Offer preview link |
265 |
|
|
printf("<td colspan=\"1\">\n"); |
266 |
|
|
printf("<a href=\"%spage.phtml?page_id=%d\">Preview</a><br>\n", $GLOBAL_SCRIBE_URL, $page_id); |
267 |
|
|
printf("</td></tr>\n"); |
268 |
|
|
|
269 |
|
|
|
270 |
|
|
/************************* |
271 |
|
|
** Row for URLs, ToC, etc. |
272 |
|
|
*************************/ |
273 |
|
|
printf("<tr>\n"); |
274 |
|
|
|
275 |
|
|
// Display urls |
276 |
|
|
if ($display_urls < 1) { |
277 |
|
|
printf("<td colspan =\"1\" align=\"left\">\n"); |
278 |
|
|
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
279 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"toggleURLDisplay\">\n"); |
280 |
|
|
printf("<input type=\"hidden\" name =\"display_urls\" value = \"1\">\n"); |
281 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
282 |
|
|
printf("<input type=\"submit\" value = \"Show URL's in Author Mode\">\n"); |
283 |
|
|
printf("</td></form>\n"); |
284 |
|
|
} |
285 |
|
|
|
286 |
|
|
//Turn off urls |
287 |
|
|
else { |
288 |
|
|
printf("<td colspan =\"1\" align=\"left\">\n"); |
289 |
|
|
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
290 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"toggleURLDisplay\">\n"); |
291 |
|
|
printf("<input type=\"hidden\" name =\"display_urls\" value = \"0\">\n"); |
292 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
293 |
|
|
printf("<input type=\"submit\" value = \"Suppress URL Display\">\n"); |
294 |
|
|
printf("</td></form>\n"); |
295 |
|
|
} |
296 |
|
|
|
297 |
|
|
// Display table of contents |
298 |
|
|
if ($display_toc < 1) { |
299 |
|
|
printf("<td colspan =\"1\" align=\"left\">\n"); |
300 |
|
|
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
301 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"toggleTOCDisplay\">\n"); |
302 |
|
|
printf("<input type=\"hidden\" name =\"display_toc\" value = \"1\">\n"); |
303 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
304 |
|
|
printf("<input type=\"submit\" value = \"Activate ToC\">\n"); |
305 |
|
|
printf("</td></form>\n"); |
306 |
|
|
} |
307 |
|
|
|
308 |
|
|
//Turn off table of contents |
309 |
|
|
else { |
310 |
|
|
printf("<td colspan =\"1\" align=\"left\">\n"); |
311 |
|
|
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
312 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"toggleTOCDisplay\">\n"); |
313 |
|
|
printf("<input type=\"hidden\" name =\"display_toc\" value = \"0\">\n"); |
314 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
315 |
|
|
printf("<input type=\"submit\" value = \"Suppress ToC\">\n"); |
316 |
|
|
printf("</td></form>\n"); |
317 |
|
|
} |
318 |
|
|
|
319 |
|
|
|
320 |
|
|
// Wrap the table of contents |
321 |
|
|
// Don't display the ToC, so don't offer the option |
322 |
|
|
if ($display_toc < 1) { |
323 |
|
|
printf("<td colspan=\"1\" align=\"left\"> </td>\n"); |
324 |
|
|
} |
325 |
|
|
|
326 |
|
|
// ToC is displayed and wrap is off, offer toggle ON |
327 |
|
|
else if ($wrap_toc < 1) { |
328 |
|
|
printf("<td colspan =\"1\" align=\"left\">\n"); |
329 |
|
|
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
330 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"toggleTOCWrap\">\n"); |
331 |
|
|
printf("<input type=\"hidden\" name =\"wrap_toc\" value = \"1\">\n"); |
332 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
333 |
|
|
printf("<input type=\"submit\" value = \"Wrap ToC\">\n"); |
334 |
|
|
printf("</td></form>\n"); |
335 |
|
|
|
336 |
|
|
} |
337 |
|
|
|
338 |
|
|
// ToC is displayed and wrap is on, offer toggle OFF |
339 |
|
|
else if ($wrap_toc >= 1) { |
340 |
|
|
printf("<td colspan =\"1\" align=\"left\">\n"); |
341 |
|
|
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
342 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"toggleTOCWrap\">\n"); |
343 |
|
|
printf("<input type=\"hidden\" name =\"wrap_toc\" value = \"0\">\n"); |
344 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
345 |
|
|
printf("<input type=\"submit\" value = \"Unwrap ToC\">\n"); |
346 |
|
|
printf("</td></form>\n"); |
347 |
|
|
} |
348 |
|
|
|
349 |
|
|
// Dump copy buffer |
350 |
|
|
if ($paste_data) { |
351 |
|
|
printf("<td colspan =\"1\" align=\"left\">\n"); |
352 |
|
|
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">\n"); |
353 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"deleteCopyBuffer\">\n"); |
354 |
|
|
printf("<input type=\"hidden\" name =\"paste_staff_id\" value = \"%d\">\n", $sess_staff_id); |
355 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
356 |
|
|
printf("<input type=\"submit\" value = \"Clear Copy Buffer\">\n"); |
357 |
|
|
printf("</td></form>\n"); |
358 |
|
|
} |
359 |
|
|
|
360 |
|
|
// No copy buffer present, draw a blank cell |
361 |
|
|
else printf("<td colspan=\"1\"> </td>\n"); |
362 |
|
|
|
363 |
|
|
printf("</tr>\n"); |
364 |
|
|
|
365 |
|
|
// Display [Return to Top] anchor |
366 |
|
|
printf("<tr>\n"); |
367 |
|
|
|
368 |
|
|
// Set default if no previous value for [up] text |
369 |
|
|
if (strlen($up_text) < 1) $up_text = "[Return to Top]"; |
370 |
|
|
|
371 |
|
|
// [Up] anchor display is on, offer to turn them off or edit language |
372 |
|
|
if ($display_up == 1) { |
373 |
|
|
|
374 |
|
|
// Turn off [up] anchors |
375 |
|
|
printf("<td colspan=\"1\">\n"); |
376 |
|
|
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">"); |
377 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"toggleUpDisplay\">\n"); |
378 |
|
|
printf("<input type=\"hidden\" name =\"display_up\" value = \"0\">\n"); |
379 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
380 |
|
|
printf("<input type=\"submit\" value = \"Deactivate [Up] Anchors\">\n"); |
381 |
|
|
printf("</td></form>\n"); |
382 |
|
|
|
383 |
|
|
// Change text of [up] anchors |
384 |
|
|
printf("<td colspan=\"3\">\n"); |
385 |
|
|
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">"); |
386 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"toggleUpText\">\n"); |
387 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
388 |
|
|
printF("<b>[Up] Anchor Text:</b> "); |
389 |
|
|
printf("<input type=\"text\" name =\"up_text\" value = \"%s\" size = \"30\" >\n", $up_text); |
390 |
|
|
printf("<input type=\"submit\" value = \"Save [Up] Text\">\n"); |
391 |
|
|
printf("</td></form>\n"); |
392 |
|
|
} |
393 |
|
|
|
394 |
|
|
|
395 |
|
|
// [Up] anchor display is off, offer to activate them |
396 |
|
|
else { |
397 |
|
|
|
398 |
|
|
printf("<td colspan=\"4\">\n"); |
399 |
|
|
printf("<form method=\"POST\" action =\"scribe_transaction.phtml\">"); |
400 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"toggleUpDisplay\">\n"); |
401 |
|
|
printf("<input type=\"hidden\" name =\"display_up\" value = \"1\">\n"); |
402 |
|
|
printf("<input type=\"hidden\" name =\"up_text\" value = \"%s\">\n", $up_text); |
403 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
404 |
|
|
printf("<input type=\"submit\" value = \"Activate [Up] Anchors\">\n"); |
405 |
|
|
printf("</td></form>\n"); |
406 |
|
|
} |
407 |
|
|
|
408 |
|
|
printf("</tr>\n"); |
409 |
|
|
|
410 |
|
|
// Change the current style |
411 |
|
|
printf("<tr><td align=\"left\">\n"); |
412 |
|
|
printf("<form method = \"POST\" action = \"scribe_transaction.phtml\">\n"); |
413 |
|
|
printf("<input type=\"hidden\" name= \"transaction\" value= \"updateScribeStyle\">\n"); |
414 |
|
|
printf("<input type=\"hidden\" name=\"page_id\" value=\"%d\">", $page_id); |
415 |
|
|
printf("<select name = \"style_id\">\n"); |
416 |
|
|
dropDownFieldSelected($con, "style", "style_title", "style_id", " WHERE style_id > 0", $style_id); |
417 |
|
|
printf("</select>\n"); |
418 |
|
|
printf("<input type = \"submit\" value = \"Apply Style\">\n"); |
419 |
|
|
printf("</td></form>\n"); |
420 |
|
|
|
421 |
|
|
// Page font format tool |
422 |
|
|
printf("<td colspan=\"3\" align=\"left\">\n"); |
423 |
|
|
$max_indent = getMaxIndent($con, $page_id); |
424 |
|
|
printf("<table border=\"0\">\n"); |
425 |
|
|
printf("<tr>\n"); |
426 |
|
|
printf("<form method=\"post\" action =\"scribe_transaction.phtml\">\n"); |
427 |
|
|
printf("<input type=\"hidden\" name =\"transaction\" value = \"elementMultiFormat\">\n"); |
428 |
|
|
printf("<input type=\"hidden\" name =\"page_id\" value = \"%d\">\n", $page_id); |
429 |
|
|
printf("<td><b>Page Font Format:</b> Indent: "); |
430 |
|
|
printf("<select name=\"auto_indent_level\">\n"); |
431 |
|
|
for ($indent_select = 0; $indent_select <= $max_indent; $indent_select++) { |
432 |
|
|
printf("<option value=\"%d\">Level: %d</option>\n", $indent_select, $indent_select); |
433 |
|
|
} |
434 |
|
|
printf("</select></td>\n"); |
435 |
|
|
printf("<td>Font: "); |
436 |
|
|
printf("<select name=\"auto_element_size\">\n"); |
437 |
|
|
for ($element_size_select = 0; $element_size_select <= 5; $element_size_select++) { |
438 |
|
|
printf("<option value=\"%d\">Style: %d</option>\n", $element_size_select, $element_size_select); |
439 |
|
|
} |
440 |
|
|
printf("</select>\n"); |
441 |
|
|
printf("<input type=\"submit\" value=\"Apply Format\">\n"); |
442 |
|
|
printf("</td></form>\n"); |
443 |
|
|
printf("</tr></table>\n"); |
444 |
|
|
|
445 |
|
|
// End of outer cell/row |
446 |
|
|
printf("</td></tr>\n"); |
447 |
|
|
|
448 |
|
|
// Assign page staff |
449 |
|
|
if ($cmd != "pagestaff") { |
450 |
|
|
printf("<tr>\n"); |
451 |
|
|
printf("<td colspan=\"4\">\n"); |
452 |
|
|
printf("<form method=\"POST\" action=\"scribe.phtml?page_id=%d&cmd=pagestaff\">", $page_id); |
453 |
|
|
printf("<input type=\"submit\" value=\"Assign Page Staff\">\n"); |
454 |
|
|
printf("</td></form>\n"); |
455 |
|
|
printf("</tr>\n"); |
456 |
|
|
} |
457 |
|
|
|
458 |
|
|
// Close page commands table |
459 |
|
|
printf("</table><br>\n"); |
460 |
|
|
|
461 |
|
|
|
462 |
|
|
/**************************************** |
463 |
|
|
** Staff and Subject Assignments Menus ** |
464 |
|
|
****************************************/ |
465 |
|
|
|
466 |
|
|
|
467 |
|
|
if ($cmd == "pagestaff") formAssignPageStaff($con, $page_id, $staff_coordinator); |
468 |
|
|
|
469 |
|
|
|
470 |
|
|
// Anchor to top of page |
471 |
|
|
printf("<a name=\"top\"></a>\n"); |
472 |
|
|
|
473 |
|
|
|
474 |
|
|
/******************************************************* |
475 |
|
|
** Load the page's css definitions (if exists) inline ** |
476 |
|
|
*******************************************************/ |
477 |
|
|
|
478 |
|
|
|
479 |
|
|
$css_file = ""; |
480 |
|
|
$sql = "SELECT |
481 |
|
|
s.css_file |
482 |
|
|
FROM |
483 |
|
|
style s, |
484 |
|
|
page p |
485 |
|
|
WHERE |
486 |
|
|
p.page_id = " |
487 |
|
|
. $page_id |
488 |
|
|
. " AND p.style_id = s.style_id"; |
489 |
|
|
$rs = mysql_query($sql, $con); |
490 |
|
|
$row = mysql_fetch_array ($rs); |
491 |
|
|
$css_file = $row["css_file"]; |
492 |
|
|
|
493 |
|
|
if (strlen($css_file) > 0) { |
494 |
|
|
printf("<style type=\"text/css\">\n"); |
495 |
|
|
//include($GLOBAL_PUBLIC_URL.$css_file); pfb -- don't assume locations |
496 |
|
|
include($css_file); |
497 |
|
|
printf("TD {font-size: 90%%}\n"); |
498 |
|
|
printf("</style>\n"); |
499 |
|
|
} |
500 |
|
|
|
501 |
|
|
|
502 |
|
|
/*************** |
503 |
|
|
** Page Title ** |
504 |
|
|
***************/ |
505 |
|
|
|
506 |
|
|
|
507 |
|
|
printf("<table width = \"90%%\" border =\"0\"><tr><td>"); |
508 |
|
|
|
509 |
|
|
// Special note to CourseLib authors |
510 |
|
|
if ($pagetype_id == 3) { |
511 |
|
|
printf("<span class=\"bigDark\">"); |
512 |
|
|
printf("Note: Course Designator (Subject) is required to publish a page. Don't include it in the course title, select it from the pick-list below. "); |
513 |
|
|
printf("</span><br><br>\n"); |
514 |
|
|
} |
515 |
|
|
|
516 |
|
|
if ($cmd == "editHeader") { |
517 |
|
|
editHeader($con, $course_id, $page_id, $page_title, $pagetype_id); |
518 |
|
|
} |
519 |
|
|
|
520 |
|
|
else { |
521 |
|
|
displayHeader($con, $page_id, $page_title, $pagetitle_style, $pagetype_id); |
522 |
|
|
} |
523 |
|
|
|
524 |
|
|
printf("</td></tr></table><br>"); |
525 |
|
|
|
526 |
|
|
/**************************************** |
527 |
|
|
** If CourseLib, load additional forms ** |
528 |
|
|
****************************************/ |
529 |
|
|
|
530 |
|
|
|
531 |
|
|
// Load the course forms is this is a CourseLib+/CourseScribe page |
532 |
|
|
if ($pagetype_id == 3) { |
533 |
|
|
|
534 |
|
|
formCourse($con, $active, $page_id); |
535 |
|
|
formCoursePers($con, $active, $course_id, $page_id); |
536 |
|
|
|
537 |
|
|
// HR |
538 |
|
|
printf("<hr>\n"); |
539 |
|
|
} |
540 |
|
|
|
541 |
|
|
/********************* |
542 |
|
|
** PageScribe forms ** |
543 |
|
|
**********************/ |
544 |
|
|
else formPageHeader($con, $active, $page_id); |
545 |
|
|
|
546 |
|
|
|
547 |
|
|
/****************************** |
548 |
|
|
** Display Table of Contents ** |
549 |
|
|
******************************/ |
550 |
|
|
|
551 |
|
|
if ($display_toc == 1) { |
552 |
|
|
displayTOC($con, $page_id, $wrap_toc); |
553 |
|
|
} |
554 |
|
|
|
555 |
|
|
|
556 |
|
|
/************************************** |
557 |
|
|
** Place everything in a large table ** |
558 |
|
|
**************************************/ |
559 |
|
|
|
560 |
|
|
|
561 |
|
|
printf("<center><table width= \"100%%\" border=\"0\" cellpadding=\"0\" cellspacing =\"0\"><tr><td align=\"left\">\n"); |
562 |
|
|
|
563 |
|
|
|
564 |
|
|
/*********************** |
565 |
|
|
** Fetch All Elements ** |
566 |
|
|
***********************/ |
567 |
|
|
|
568 |
|
|
|
569 |
|
|
$sql = "SELECT * FROM element e |
570 |
|
|
LEFT JOIN resource r using (resource_id) |
571 |
|
|
LEFT JOIN service v on e.service_id = v.service_id |
572 |
|
|
LEFT JOIN location l on e.location_id = l.location_id |
573 |
|
|
LEFT JOIN staff s on e.staff_id = s.staff_id |
574 |
|
|
LEFT JOIN subject b on e.subject_id = b.subject_id |
575 |
|
|
WHERE page_id = " . $page_id |
576 |
|
|
. " ORDER BY e.element_order"; |
577 |
|
|
|
578 |
|
|
$rs = mysql_query($sql, $con); |
579 |
|
|
|
580 |
|
|
// Make a copy of the result set for cursor manipulation later |
581 |
|
|
$rscopy = $rs; |
582 |
|
|
|
583 |
|
|
// If the previous didn't work, do this explicitly |
584 |
|
|
// $rscopy = mysql_query($sql, $con); |
585 |
|
|
|
586 |
|
|
// Create a positional variable, may contain an element or a row of add buttons |
587 |
|
|
$position = 1; |
588 |
|
|
|
589 |
|
|
// Initialize the element order |
590 |
|
|
$element_order = 1; |
591 |
|
|
|
592 |
|
|
// Track indent levels |
593 |
|
|
$last_indent_level = 0; |
594 |
|
|
$indent_level = 0; |
595 |
|
|
|
596 |
|
|
// Initialize row number |
597 |
|
|
$row_number = 0; |
598 |
|
|
|
599 |
|
|
|
600 |
|
|
/**************** |
601 |
|
|
** INITIAL ADD ** |
602 |
|
|
****************/ |
603 |
|
|
|
604 |
|
|
// Define array to hold information about each element location |
605 |
|
|
$place_array = array(0, $element_order, $indent_level, 0, $position); |
606 |
|
|
|
607 |
|
|
// Name every position with an anchor |
608 |
|
|
printf("\n\n\n<a name = \"p%d\"></a>\n", $position); |
609 |
|
|
|
610 |
|
|
|
611 |
|
|
/********************* |
612 |
|
|
** INITIAL ADD MODE ** |
613 |
|
|
*********************/ |
614 |
|
|
|
615 |
|
|
|
616 |
|
|
if ($position == $this_pos && strlen($cmd) > 0) { |
617 |
|
|
|
618 |
|
|
switch ($cmd) { |
619 |
|
|
|
620 |
|
|
case "addRes": |
621 |
|
|
addRes($con, $feature_id, $letter, $limitstring, $masterinfotype_id, $place_array, $page_id); |
622 |
|
|
break; |
623 |
|
|
case "addLoc": |
624 |
|
|
addLoc($con, $place_array, $page_id); |
625 |
|
|
break; |
626 |
|
|
case "addService": |
627 |
|
|
addService($con, $place_array, $servicetype_id, $page_id); |
628 |
|
|
break; |
629 |
|
|
case "addStaff": |
630 |
|
|
addStaff($con, $place_array, $page_id); |
631 |
|
|
break; |
632 |
|
|
case "addLabel": |
633 |
|
|
addLabel($con, $place_array, $page_id); |
634 |
|
|
break; |
635 |
|
|
case "addRQS": |
636 |
|
|
addRQS($con, $place_array, $page_id); |
637 |
|
|
break; |
638 |
|
|
case "addRQSLink": |
639 |
|
|
addRQSLink($con, $place_array, $page_id); |
640 |
|
|
break; |
641 |
|
|
default: |
642 |
|
|
break; |
643 |
|
|
|
644 |
|
|
} // End cmd switch |
645 |
|
|
|
646 |
|
|
} |
647 |
|
|
|
648 |
|
|
else { |
649 |
|
|
|
650 |
|
|
|
651 |
|
|
/************************** |
652 |
|
|
** ELSE INITIAL ADD ICON ** |
653 |
|
|
**************************/ |
654 |
|
|
|
655 |
|
|
|
656 |
|
|
// Present an add icon or the add options |
657 |
|
|
if ($opt == "add" && $this_pos == $position) { |
658 |
|
|
// Display add selection |
659 |
|
|
addSelection($con, $place_array, $page_id); |
660 |
|
|
} |
661 |
|
|
|
662 |
|
|
else { |
663 |
|
|
printf("<a href=\"scribe.phtml?page_id=" |
664 |
|
|
. $page_id |
665 |
|
|
. "&opt=add" |
666 |
|
|
. "&this_pos=" |
667 |
|
|
. $position |
668 |
|
|
. "#p" |
669 |
|
|
. $position |
670 |
|
|
. "\"><img src =\"images/add.gif\" border=\"0\" alt=\"add\"></a>\n"); |
671 |
|
|
|
672 |
|
|
// Paste |
673 |
|
|
if ($paste_data > 0) |
674 |
|
|
printf("<a href=\"scribe_transaction.phtml?transaction=pasteElement&page_id=%d&element_order=%d&indent_level=%d&position=%d\"><img src=\"images/paste.gif\" border=\"0\" alt=\"paste\"></a>\n", $page_id, $element_order, $indent_level, $position); |
675 |
|
|
|
676 |
|
|
|
677 |
|
|
} |
678 |
|
|
} |
679 |
|
|
printf("<BR>\n"); |
680 |
|
|
$position++; |
681 |
|
|
|
682 |
|
|
|
683 |
|
|
|
684 |
|
|
// Cycle through each row of page elements |
685 |
|
|
while ($row = mysql_fetch_array ($rs)) { |
686 |
|
|
|
687 |
|
|
// General element information |
688 |
|
|
$element_id = $row["element_id"]; |
689 |
|
|
$page_id = $row["page_id"]; |
690 |
|
|
$element_size = $row["element_size"]; |
691 |
|
|
$label = $row["label"]; |
692 |
|
|
$label_url = $row["label_url"]; |
693 |
|
|
$element_order = $row["element_order"]; |
694 |
|
|
$element_descr = $row["element_descr"]; |
695 |
|
|
$indent_level = $row["indent_level"]; |
696 |
|
|
$parent_id = $row["parent_id"]; |
697 |
|
|
|
698 |
|
|
// If a resource |
699 |
|
|
$resource_id = $row["resource_id"]; |
700 |
|
|
$annotation = $row["annotation"]; |
701 |
|
|
$url = $row["url"]; |
702 |
|
|
$title = $row["title"]; |
703 |
|
|
$call_no = $row["call_no"]; |
704 |
|
|
|
705 |
|
|
// If a location |
706 |
|
|
$location_id = $row["location_id"]; |
707 |
|
|
$location = $row["location"]; |
708 |
|
|
$location_descr = $row["location_descr"]; |
709 |
|
|
$mainURL = $row["mainURL"]; |
710 |
|
|
$mapURL = $row["mapURL"]; |
711 |
|
|
$hoursURL = $row["hoursURL"]; |
712 |
|
|
|
713 |
|
|
// If a staffperson |
714 |
|
|
$staff_id = $row["staff_id"]; |
715 |
|
|
$last_name = $row["last_name"]; |
716 |
|
|
$first_name = $row["first_name"]; |
717 |
|
|
$staff_account = $row["staff_account"]; |
718 |
|
|
$staff_email = $row["staff_email"]; |
719 |
|
|
|
720 |
|
|
// If a service |
721 |
|
|
$service = $row["service"]; |
722 |
|
|
$serviceDescr = $row["serviceDescr"]; |
723 |
|
|
$service_id = $row["service_id"]; |
724 |
|
|
$serviceURL = $row["serviceURL"]; |
725 |
|
|
|
726 |
|
|
// If a subject |
727 |
|
|
$subject = $row["subject"]; |
728 |
|
|
$subject_id = $row["subject_id"]; |
729 |
|
|
$subject_descr = $row["subject_descr"]; |
730 |
|
|
|
731 |
|
|
// Define array to hold information about each element location |
732 |
|
|
$place_array = array($element_id, $element_order, $indent_level, $parent_id, $position); |
733 |
|
|
|
734 |
|
|
// Start the indention |
735 |
|
|
if ($indent_level > 0) { |
736 |
|
|
for ($spaces = 0; $spaces < $indent_level; $spaces++) { |
737 |
|
|
printf("<ul>"); |
738 |
|
|
} |
739 |
|
|
printf("<li>"); |
740 |
|
|
} |
741 |
|
|
|
742 |
|
|
// Name every position with an anchor |
743 |
|
|
printf("\n\n\n<a name = \"p%d\"></a>\n", $position); |
744 |
|
|
|
745 |
|
|
// Build an additional TOC anchor for root-level elements |
746 |
|
|
if ($indent_level == 0 && $display_toc == 1) printf("<a name =\"toc%d\"></a>\n", $element_id); |
747 |
|
|
|
748 |
|
|
|
749 |
|
|
/*************** |
750 |
|
|
** EDIT MODE? ** |
751 |
|
|
***************/ |
752 |
|
|
|
753 |
|
|
|
754 |
|
|
if ($position == $this_pos && strlen($cmd) > 0) { |
755 |
|
|
|
756 |
|
|
switch ($cmd) { |
757 |
|
|
case "copyElement": |
758 |
|
|
copyElement($con, $place_array, $page_id, $element_id, $sess_staff_id); |
759 |
|
|
break; |
760 |
|
|
case "delElement": |
761 |
|
|
delElement($con, $place_array, $page_id, $element_id); |
762 |
|
|
break; |
763 |
|
|
case "editElement": |
764 |
|
|
editElement($con, $place_array, $page_id, $element_id); |
765 |
|
|
break; |
766 |
|
|
default: |
767 |
|
|
break; |
768 |
|
|
|
769 |
|
|
} // End cmd switch |
770 |
|
|
|
771 |
|
|
|
772 |
|
|
} // END EDIT MODE |
773 |
|
|
|
774 |
|
|
|
775 |
|
|
/********************** |
776 |
|
|
** ELSE DISPLAY MODE ** |
777 |
|
|
**********************/ |
778 |
|
|
|
779 |
|
|
else { |
780 |
|
|
|
781 |
|
|
// Display [Return to Top] link if this item represents a new root level, |
782 |
|
|
// the user has toggled the displaying of up anchors, and there is something to display. |
783 |
|
|
if ($row_number > 0 && $indent_level < 1 && $display_up > 0 && strlen($up_text) > 0) { |
784 |
|
|
printf("<span class=\"S5\">\n"); |
785 |
|
|
printf("<a href=\"scribe.phtml?page_id=%d#top\">%s</a><br><br>\n", $page_id, $up_text); |
786 |
|
|
printf("</span>\n"); |
787 |
|
|
} |
788 |
|
|
|
789 |
|
|
// This element is a resource, display it. |
790 |
|
|
if ($resource_id > 0) { |
791 |
|
|
|
792 |
|
|
// Set the span S class if specified |
793 |
|
|
if ($element_size > 0) printf ("<span class=\"S%d\">", $element_size); |
794 |
|
|
|
795 |
|
|
// If an URL was specified for the resource, make it linkable. |
796 |
|
|
if (strlen($url) > 0) $title = "<a href =\"" . $url . "\">" . $title . "</a>"; |
797 |
|
|
|
798 |
|
|
// Display Resource |
799 |
|
|
printf ("%s", $title); |
800 |
|
|
|
801 |
|
|
// If a span class is being used, close it now |
802 |
|
|
if ($element_size > 0) printf ("</span>\n"); |
803 |
|
|
|
804 |
|
|
} |
805 |
|
|
|
806 |
|
|
// Or this element is a label, display it. |
807 |
|
|
else if (strlen($label) > 0) { |
808 |
|
|
|
809 |
|
|
// Set the span S class if specified |
810 |
|
|
if ($element_size > 0) printf ("<span class=\"S%d\">", $element_size); |
811 |
|
|
|
812 |
|
|
// If an URL was specified, add it. |
813 |
|
|
if (strlen($label_url) > 0) $label = "<a href =\"" . $label_url . "\">" . $label . "</a>"; |
814 |
|
|
|
815 |
|
|
// Label |
816 |
|
|
printf("%s", $label); |
817 |
|
|
|
818 |
|
|
// If a span class is being used, close it now |
819 |
|
|
if ($element_size > 0) printf ("</span>\n"); |
820 |
|
|
|
821 |
|
|
} |
822 |
|
|
|
823 |
|
|
// Or this element is a location/library, display it. |
824 |
|
|
else if ($location_id > 0) { |
825 |
|
|
|
826 |
|
|
// Set the span S class if specified |
827 |
|
|
if ($element_size > 0) printf ("<span class=\"S%d\">", $element_size); |
828 |
|
|
|
829 |
|
|
// If an URL was available, make it linkable |
830 |
|
|
if (strlen($mainURL) > 0) printf("<a href=\"%s\">%s</a>", $mainURL, $location); |
831 |
|
|
|
832 |
|
|
// Display location |
833 |
|
|
else printf("%s\n", $location); |
834 |
|
|
|
835 |
|
|
// If a span class is being used, close it now |
836 |
|
|
if ($element_size > 0) printf ("</span>\n"); |
837 |
|
|
|
838 |
|
|
} |
839 |
|
|
|
840 |
|
|
// Or this element is a service, display it. |
841 |
|
|
else if ($service_id > 0 ) { |
842 |
|
|
// Set the span S class if specified |
843 |
|
|
if ($element_size > 0) printf ("<span class=\"S%d\">", $element_size); |
844 |
|
|
|
845 |
|
|
// If an URL was specified for the service, make it linkable. |
846 |
|
|
if (strlen($serviceURL) > 0) $service = "<a href =\"" . $serviceURL . "\">" . $service . "</a>"; |
847 |
|
|
|
848 |
|
|
// Service |
849 |
|
|
printf("%s", $service); |
850 |
|
|
|
851 |
|
|
// If a span class is being used, close it now |
852 |
|
|
if ($element_size > 0) printf ("</span>\n"); |
853 |
|
|
} |
854 |
|
|
|
855 |
|
|
// Or this element is a subject, display it. |
856 |
|
|
else if ($subject_id > 0 ) { |
857 |
|
|
// Set the span S class if specified |
858 |
|
|
if ($element_size > 0) printf ("<span class=\"S%d\">", $element_size); |
859 |
|
|
|
860 |
|
|
// If an URL was specified for the service, make it linkable. |
861 |
|
|
$subject = "<a href=\"" |
862 |
|
|
. $GLOBAL_RQS_URL |
863 |
|
|
."rqs.phtml?subject_id=" |
864 |
|
|
.$subject_id |
865 |
|
|
."\">" |
866 |
|
|
. $subject |
867 |
|
|
."</a>"; |
868 |
|
|
|
869 |
|
|
// Subject |
870 |
|
|
printf("%s", $subject); |
871 |
|
|
|
872 |
|
|
// If a span class is being used, close it now |
873 |
|
|
if ($element_size > 0) printf ("</span>\n"); |
874 |
|
|
} |
875 |
|
|
|
876 |
|
|
// Or this element is a staff person, display it. |
877 |
|
|
else if ($staff_id > 0 ) { |
878 |
|
|
|
879 |
|
|
// Set the span S class if specified |
880 |
|
|
if ($element_size > 0) printf ("<span class=\"S%d\">", $element_size); |
881 |
|
|
|
882 |
|
|
$staff_name = $first_name . " " . $last_name; |
883 |
|
|
|
884 |
|
|
// If an e-mail is available, link with mailto: |
885 |
|
|
if (strlen($staff_email) > 0) printf("<a href=\"mailto:%s\">%s</a>", $staff_email, $staff_name); |
886 |
|
|
|
887 |
|
|
// Display staff |
888 |
|
|
else printf("%s", $staff_name); |
889 |
|
|
|
890 |
|
|
// If a span class is being used, close it now |
891 |
|
|
if ($element_size > 0) printf ("</span>\n"); |
892 |
|
|
|
893 |
|
|
} |
894 |
|
|
|
895 |
|
|
// Space |
896 |
|
|
printf(" "); |
897 |
|
|
|
898 |
|
|
// Display edit buttons |
899 |
|
|
editButtons($con, $element_size, $label_text, $label_url, $place_array, $resource_id, $page_id, $element_id); |
900 |
|
|
|
901 |
|
|
// Allow up button |
902 |
|
|
//if (siblingElderProbe($con, $page_id, $place_array)) buttonUp($page_id, $place_array); |
903 |
|
|
|
904 |
|
|
// Allow down button |
905 |
|
|
//if (siblingYoungerProbe($con, $page_id, $place_array)) buttonDown($page_id, $place_array); |
906 |
|
|
|
907 |
|
|
// Allow up button |
908 |
|
|
if (sibProbeElder($genArray, $page_id, $place_array)) buttonUp($page_id, $place_array); |
909 |
|
|
|
910 |
|
|
// Allow down button |
911 |
|
|
if (sibProbeYounger($genArray, $page_id, $place_array)) buttonDown($page_id, $place_array); |
912 |
|
|
|
913 |
|
|
|
914 |
|
|
// Initialize anew for each row |
915 |
|
|
$display_descr = ""; |
916 |
|
|
$viewable_url = ""; |
917 |
|
|
|
918 |
|
|
// Determine the display description and viewable url |
919 |
|
|
if (strlen($element_descr) > 0) { |
920 |
|
|
$display_descr = $element_descr; |
921 |
|
|
if (strlen($label_url) > 0 ) $viewable_url = "URL:" . $label_url; |
922 |
|
|
} |
923 |
|
|
else if ($resource_id > 0) { |
924 |
|
|
$display_descr = $annotation; |
925 |
|
|
$viewable_url = $url; |
926 |
|
|
} |
927 |
|
|
else if ($location_id > 0) { |
928 |
|
|
$display_descr = $location_descr; |
929 |
|
|
$viewable_url = $mainURL; |
930 |
|
|
} |
931 |
|
|
else if ($service_id > 0) { |
932 |
|
|
$display_descr = $serviceDescr; |
933 |
|
|
$viewable_url = $serviceURL; |
934 |
|
|
} |
935 |
|
|
else if ($subject_id > 0) { |
936 |
|
|
$display_descr = $subject_descr; |
937 |
|
|
$viewable_url = $GLOBAL_RQS_URL."rqs.phtml?subject_id=".$subject_id; |
938 |
|
|
} |
939 |
|
|
|
940 |
|
|
if ($staff_id > 0) $viewable_url = $staff_email; |
941 |
|
|
|
942 |
|
|
// Display URL if toggled and available |
943 |
|
|
if (strlen($viewable_url) > 0 && $display_urls == 1) printf("<BR>%s<BR>\n", $viewable_url); |
944 |
|
|
|
945 |
|
|
// Concatenate the hoursURL and mapURL if available and this is a location |
946 |
|
|
if ($location_id > 0) { |
947 |
|
|
|
948 |
|
|
// Flag to add a <BR> before additional location information |
949 |
|
|
$br_flag = 0; |
950 |
|
|
|
951 |
|
|
if (strlen($hoursURL) > 0) { |
952 |
|
|
|
953 |
|
|
if (strlen($display_descr) > 0) { |
954 |
|
|
$display_descr .= "<BR>\n"; |
955 |
|
|
$br_flag = 1; |
956 |
|
|
} |
957 |
|
|
|
958 |
|
|
$display_descr .= " • <a href=\"" |
959 |
|
|
. $hoursURL |
960 |
|
|
. "\">Hours</a>"; |
961 |
|
|
} |
962 |
|
|
if (strlen($mapURL) > 0) { |
963 |
|
|
|
964 |
|
|
if (strlen($display_descr) > 0 && $br_flag == 0) { |
965 |
|
|
$display_descr .= "<BR>\n"; |
966 |
|
|
$br_flag = 1; |
967 |
|
|
} |
968 |
|
|
|
969 |
|
|
$display_descr .= " • <a href=\"" |
970 |
|
|
. $mapURL |
971 |
|
|
. "\">Map</a>"; |
972 |
|
|
} |
973 |
|
|
|
974 |
|
|
} |
975 |
|
|
|
976 |
|
|
// Concatenate callno/location information for resources |
977 |
|
|
if ($resource_id > 0 && strlen($call_no) > 0) { |
978 |
|
|
|
979 |
|
|
if (strlen($display_descr) > 0) $display_descr .= "<BR>"; |
980 |
|
|
$display_descr .= "• Location(s): " . $call_no; |
981 |
|
|
} |
982 |
|
|
|
983 |
|
|
// Display description if available |
984 |
|
|
if (strlen($display_descr) > 0) printf("<BR>%s\n", $display_descr); |
985 |
|
|
|
986 |
|
|
} |
987 |
|
|
|
988 |
|
|
|
989 |
|
|
// Close the indention |
990 |
|
|
if ($indent_level > 0) { |
991 |
|
|
printf("</li>"); |
992 |
|
|
for ($spaces = 0; $spaces < $indent_level; $spaces++) { |
993 |
|
|
printf("</ul>"); |
994 |
|
|
} |
995 |
|
|
} |
996 |
|
|
else printf("<BR>\n"); |
997 |
|
|
|
998 |
|
|
|
999 |
|
|
// Increment order |
1000 |
|
|
$element_order++; |
1001 |
|
|
|
1002 |
|
|
// Cycle back to zero indent level, allow an insert if there are no younger relatives in this branch |
1003 |
|
|
for ($reverse_indent = $indent_level + 1; $reverse_indent >= 0; $reverse_indent--) { |
1004 |
|
|
|
1005 |
|
|
// Redefine array to hold information about each element location |
1006 |
|
|
$place_array = array($element_id, $element_order, $reverse_indent, $parent_id, $position); |
1007 |
|
|
|
1008 |
|
|
// Allow indent mode only if there are no children |
1009 |
|
|
if (!youngerProbe($page_id, $place_array, $rs)) { |
1010 |
|
|
|
1011 |
|
|
// Increment position |
1012 |
|
|
$position++; |
1013 |
|
|
|
1014 |
|
|
// Redefine array to hold information about each element location |
1015 |
|
|
$place_array = array($element_id, $element_order, $reverse_indent, $parent_id, $position); |
1016 |
|
|
|
1017 |
|
|
|
1018 |
|
|
// Start the indention |
1019 |
|
|
if ($reverse_indent > 0) { |
1020 |
|
|
for ($spaces = 0; $spaces < $reverse_indent; $spaces++) { |
1021 |
|
|
printf("<ul>"); |
1022 |
|
|
} |
1023 |
|
|
printf("<li>"); |
1024 |
|
|
} |
1025 |
|
|
|
1026 |
|
|
// Name every position with an anchor |
1027 |
|
|
printf("\n\n<a name = \"p%d\"></a>\n", $position); |
1028 |
|
|
|
1029 |
|
|
/********************** |
1030 |
|
|
** ADD INDENTED MODE ** |
1031 |
|
|
**********************/ |
1032 |
|
|
|
1033 |
|
|
if ($position == $this_pos && strlen($cmd) > 0) { |
1034 |
|
|
|
1035 |
|
|
switch ($cmd) { |
1036 |
|
|
|
1037 |
|
|
case "addRes": |
1038 |
|
|
addRes($con, $feature_id, $letter, $limitstring, $masterinfotype_id, $place_array, $page_id); |
1039 |
|
|
break; |
1040 |
|
|
case "addLoc": |
1041 |
|
|
addLoc($con, $place_array, $page_id); |
1042 |
|
|
break; |
1043 |
|
|
case "addService": |
1044 |
|
|
addService($con, $place_array, $servicetype_id, $page_id); |
1045 |
|
|
break; |
1046 |
|
|
case "addStaff": |
1047 |
|
|
addStaff($con, $place_array, $page_id); |
1048 |
|
|
break; |
1049 |
|
|
case "addLabel": |
1050 |
|
|
addLabel($con, $place_array, $page_id); |
1051 |
|
|
break; |
1052 |
|
|
case "addRQS": |
1053 |
|
|
addRQS($con, $place_array, $page_id); |
1054 |
|
|
break; |
1055 |
|
|
case "addRQSLink": |
1056 |
|
|
addRQSLink($con, $place_array, $page_id); |
1057 |
|
|
break; |
1058 |
|
|
default: |
1059 |
|
|
break; |
1060 |
|
|
|
1061 |
|
|
} // End cmd switch |
1062 |
|
|
|
1063 |
|
|
} |
1064 |
|
|
else { |
1065 |
|
|
|
1066 |
|
|
/*************************** |
1067 |
|
|
** ELSE INDENTED ADD ICON ** |
1068 |
|
|
***************************/ |
1069 |
|
|
|
1070 |
|
|
|
1071 |
|
|
// Present an add icon or the add options |
1072 |
|
|
if ($opt == "add" && $this_pos == $position) { |
1073 |
|
|
// Display add selection |
1074 |
|
|
addSelection($con, $place_array, $page_id); |
1075 |
|
|
} |
1076 |
|
|
|
1077 |
|
|
else { |
1078 |
|
|
printf("<a href=\"scribe.phtml?page_id=" |
1079 |
|
|
. $page_id |
1080 |
|
|
. "&opt=add" |
1081 |
|
|
. "&this_pos=" |
1082 |
|
|
. $position |
1083 |
|
|
. "#p" |
1084 |
|
|
. $position |
1085 |
|
|
. "\"><img src =\"images/add.gif\" border=\"0\" alt=\"add\"></a>\n"); |
1086 |
|
|
|
1087 |
|
|
// Paste |
1088 |
|
|
if ($paste_data > 0) |
1089 |
|
|
printf("<a href=\"scribe_transaction.phtml?transaction=pasteElement&page_id=%d&element_order=%d&indent_level=%d&position=%d\"><img src=\"images/paste.gif\" border=\"0\" alt=\"paste\"></a>\n", $page_id, $element_order, $reverse_indent, $position); |
1090 |
|
|
|
1091 |
|
|
} |
1092 |
|
|
|
1093 |
|
|
} |
1094 |
|
|
|
1095 |
|
|
|
1096 |
|
|
// Close the indention |
1097 |
|
|
if ($reverse_indent > 0) { |
1098 |
|
|
printf("</li>"); |
1099 |
|
|
for ($spaces = 0; $spaces < $reverse_indent; $spaces++) { |
1100 |
|
|
printf("</ul>"); |
1101 |
|
|
} |
1102 |
|
|
} |
1103 |
|
|
else printf("<BR>\n"); |
1104 |
|
|
|
1105 |
|
|
} // no children, allow an indent add |
1106 |
|
|
} // as many times as possible |
1107 |
|
|
|
1108 |
|
|
// Increment position |
1109 |
|
|
$position++; |
1110 |
|
|
|
1111 |
|
|
// Swap indent levels |
1112 |
|
|
$last_indent_level = $indent_level; |
1113 |
|
|
|
1114 |
|
|
// Increment row number |
1115 |
|
|
$row_number++; |
1116 |
|
|
|
1117 |
|
|
} // all table rows |
1118 |
|
|
|
1119 |
|
|
|
1120 |
|
|
|
1121 |
|
|
// Display final [Return to Top] link, regardless of current indent level, if |
1122 |
|
|
// the user has toggled the displaying of up anchors, and there is something to display. |
1123 |
|
|
if ($row_number > 0 && $display_up > 0 && strlen($up_text) > 0) { |
1124 |
|
|
printf("<span class=\"S5\">\n"); |
1125 |
|
|
printf("<a href=\"scribe.phtml?page_id=%d#top\">%s</a><br><br>\n", $page_id, $up_text); |
1126 |
|
|
printf("</span>\n"); |
1127 |
|
|
} |
1128 |
|
|
|
1129 |
|
|
|
1130 |
|
|
/********************** |
1131 |
|
|
** close large table ** |
1132 |
|
|
**********************/ |
1133 |
|
|
printf("</td></tr></table></center><br><br>\n"); |
1134 |
|
|
|
1135 |
|
|
|
1136 |
|
|
// Error trapping |
1137 |
|
|
if ($page_debug == 1) errorTrap($con, $page_id); |
1138 |
|
|
|
1139 |
|
|
|
1140 |
|
|
} // valid page workspace |
1141 |
|
|
|
1142 |
|
|
printf("<br><br>\n"); |
1143 |
|
|
|
1144 |
|
|
// Display page coordinator |
1145 |
|
|
if ($staff_coordinator > 0) { |
1146 |
|
|
$display_page_coord = lookupStaff($con, $staff_coordinator); |
1147 |
|
|
$staff_email = lookupField($con, "staff", "staff_id", $staff_coordinator, "staff_email"); |
1148 |
|
|
|
1149 |
|
|
if (strlen($display_page_coord) > 0 && strlen($staff_email) > 0) { |
1150 |
|
|
printf("<span class=\"S5\">\n"); |
1151 |
|
|
printf("Page Coordinator: %s <a href=\"mailto:%s\">%s</a>\n", $display_page_coord, $staff_email, $staff_email); |
1152 |
|
|
printf("</span><br>\n"); |
1153 |
|
|
} |
1154 |
|
|
} |
1155 |
|
|
|
1156 |
|
|
|
1157 |
|
|
// Display page URL |
1158 |
|
|
printf("<span class=\"S5\">\n"); |
1159 |
|
|
printf("This URL: <a href=\"%sscribe.phtml?page_id=%d\">%sscribe.phtml?page_id=%d</a>\n", $GLOBAL_ADMIN_URL, $page_id, $GLOBAL_ADMIN_URL, $page_id); |
1160 |
|
|
printf("</span>\n"); |
1161 |
|
|
|
1162 |
|
|
// If no page title supplied |
1163 |
|
|
if (strlen($page_title) < 1) { |
1164 |
|
|
printf("<center><br>\n"); |
1165 |
|
|
printf("No course/page title supplied. Operation cancelled."); |
1166 |
|
|
printf("<br></center>\n"); |
1167 |
|
|
|
1168 |
|
|
adminReturn($sess_access_level); |
1169 |
|
|
} |
1170 |
|
|
|
1171 |
|
|
} // logged in |
1172 |
|
|
|
1173 |
|
|
// No access |
1174 |
|
|
else require_once ($GLOBAL_NO_ACCESS); |
1175 |
|
|
|
1176 |
|
|
|
1177 |
|
|
// Page footer |
1178 |
|
|
require_once ($GLOBAL_ADMIN_INC."scribe_footer.phtml"); |
1179 |
|
|
?> |
1180 |
|
|
</body> |
1181 |
|
|
</html> |