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

Contents of /branches/paul/admin/new_resource.phtml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 12 - (show annotations)
Thu Jan 15 14:22:44 2004 UTC (20 years, 3 months ago) by dpavlin
File size: 3948 byte(s)
initial import of libdata version 1.04

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 ($GLOBAL_ADMIN_INC."db_connect.php");
9 require_once ($GLOBAL_ADMIN_INC."app_controls.php");
10 require_once ($GLOBAL_ADMIN_INC."fuzzy.php");
11
12
13 // Collect access information
14 if (isset($libsession)) {
15
16 // Fetch session information
17 $sessionClass = new sessionClass("", $libsession, "", "");
18 $accessClass = new accessClass($sessionClass);
19
20 // Load user session variables
21 $sess_time_human = $sessionClass->time_human;
22 $sess_staff_account = $sessionClass->staff_account;
23 $sess_staff_id = $accessClass->staff_id;
24 $sess_access_level = $accessClass->access_level;
25 $sess_access = $accessClass->access;
26 $sess_last_name = $accessClass->last_name;
27 $sess_first_name = $accessClass->first_name;
28
29 }
30
31
32 // If the cookie is set and access level is appropriate
33 if(isset($libsession) && $sess_access_level >= 20) {
34
35 // If title is not present
36 if (strlen($title) < 2) {
37
38 newResPageHeader();
39
40 // Table
41 printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\">\n");
42 printf("<tr><td><br>\n");
43 printf("<strong>Messages:</strong><br>\n");
44 printf("Title was not supplied. This is a required field.");
45 printf("<br><br></td></tr></table>\n");
46 printf("</center>\n");
47
48 adminReturn($sess_access_level);
49 }
50
51 // Mastersubject or masterinfotype was not supplied
52 else if ($mastersubject_id < 2 && $masterinfotype_id < 2) {
53
54 newResPageHeader();
55
56 // Table
57 printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\">\n");
58 printf("<tr><td><br>\n");
59 printf("<strong>Messages:</strong><br>\n");
60 printf("Please supply a Master Subject or Master Information Type.");
61 printf("<br><br></td></tr></table>\n");
62 adminReturn($sess_access_level);
63 printf("<br><br>\n");
64
65 // Include descriptive text
66 require_once ($GLOBAL_ADMIN_INC."new_title_text.phtml");
67 adminReturn($sess_access_level);
68
69 printf("</center>\n");
70 }
71
72 // Run the pattern-matching subsystem
73 else {
74
75 // Try to find exact or fuzzy matches
76 $hits = 0;
77
78 // Look for exact matches
79 $hits = recordCount($con, "resource", "title", $title, "A");
80 if ($hits > 0) {
81
82 // Draw page header
83 newResPageHeader();
84
85 // Table
86 printf("<table width = \"60%%\" border = \"1\" cellpadding =\"4\" class=\"backLight\">\n");
87 printf("<tr><td><br>\n");
88 printf("<strong>Messages:</strong><br>\n");
89 printf("A resource entitled '%s' was already found. No duplicates are allowed on the system.", $title);
90 printf("<br><br></td></tr></table>\n");
91 printf("</center>\n");
92
93 adminReturn($sess_access_level);
94
95 }
96
97 // No exact match. Look for fuzzy match.
98 else {
99 $hits = resTitlePat($con, $title);
100 if ($hits > 0) {
101
102 printf("<br><br><center>\n");
103 printf("<form method =\"POST\" action=\"operation.phtml?masterinfotype_id=%d&mastersubject_id=%d\">\n", $masterinfotype_id, $mastersubject_id);
104 printf("<input type=\"Hidden\" name=\"table\" value=\"resource\">\n");
105 printf("<input type=\"Hidden\" name=\"operation\" value=\"New\">\n");
106 printf("<input type=\"Hidden\" name=\"title\" value=\"%s\">\n", $title);
107 printf("<input type=\"submit\" value=\"Continue Entering\">\n");
108 printf("</form>\n");
109 printf("</center>\n");
110
111 adminReturn($sess_access_level);
112
113 } // found fuzzy hits
114
115
116 // All systems go!
117 else {
118 $title = urlencode($title);
119 header("Location: operation.phtml?title=" . $title . "&mastersubject_id=" . $mastersubject_id . "&masterinfotype_id=" . $masterinfotype_id . "&table=resource&operation=New");
120 }
121
122 } // check for fuzzy matches
123
124 } // check for fuzzy or exact hits
125
126 } // end of access to this page
127
128 // No access page
129 else require_once ($GLOBAL_NO_ACCESS);
130
131
132 // Page footer
133 require_once ($GLOBAL_ADMIN_FOOTER);
134 ?>
135
136 </center>
137 </HTML>

  ViewVC Help
Powered by ViewVC 1.1.26