/[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 67 - (show annotations)
Thu Mar 18 19:24:54 2004 UTC (20 years, 1 month ago) by dpavlin
File size: 4080 byte(s)
updated to libdata 2.00

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

  ViewVC Help
Powered by ViewVC 1.1.26