forked from sbromle/RefBase-Fork
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibrary_search.php
More file actions
254 lines (228 loc) · 17.2 KB
/
library_search.php
File metadata and controls
254 lines (228 loc) · 17.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<?php
// Project: Web Reference Database (refbase) <http://www.refbase.net>
// Copyright: Matthias Steffens <mailto:refbase@extracts.de> and the file's
// original author(s).
//
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY. Please see the GNU General Public
// License for more details.
//
// File: ./library_search.php
// Repository: $HeadURL$
// Author(s): Matthias Steffens <mailto:refbase@extracts.de>
//
// Created: 29-Jul-02, 16:39
// Modified: $Date$
// $Author$
// $Revision$
// Search form providing the main fields.
// Searches will be restricted to records belonging
// to the IPOE <http://www.uni-kiel.de/ipoe/> library.
// TODO: I18n
// Incorporate some include files:
include 'initialize/db.inc.php'; // 'db.inc.php' is included to hide username and password
include 'includes/header.inc.php'; // include header
include 'includes/footer.inc.php'; // include footer
include 'includes/include.inc.php'; // include common functions
include 'initialize/ini.inc.php'; // include common variables
// --------------------------------------------------------------------
// START A SESSION:
// call the 'start_session()' function (from 'include.inc.php') which will also read out available session variables:
start_session(true);
// --------------------------------------------------------------------
// Initialize preferred display language:
// (note that 'locales.inc.php' has to be included *after* the call to the 'start_session()' function)
include 'includes/locales.inc.php'; // include the locales
// --------------------------------------------------------------------
// (1) Open the database connection and use the literature database:
connectToMySQLDatabase(); // function 'connectToMySQLDatabase()' is defined in 'include.inc.php'
// If there's no stored message available:
if (!isset($_SESSION['HeaderString']))
$HeaderString = "Search the $hostInstitutionAbbrevName library:"; // Provide the default message
else
{
$HeaderString = $_SESSION['HeaderString']; // extract 'HeaderString' session variable (only necessary if register globals is OFF!)
// Note: though we clear the session variable, the current message is still available to this script via '$HeaderString':
deleteSessionVariable("HeaderString"); // function 'deleteSessionVariable()' is defined in 'include.inc.php'
}
// Extract the view type requested by the user (either 'Mobile', 'Print', 'Web' or ''):
// ('' will produce the default 'Web' output style)
if (isset($_REQUEST['viewType']))
$viewType = $_REQUEST['viewType'];
else
$viewType = "";
// Get the default number of records per page preferred by the current user:
$showRows = $_SESSION['userRecordsPerPage'];
// Get the user's preference for displaying auto-completions:
$showAutoCompletions = $_SESSION['userAutoCompletions'];
// Show the login status:
showLogin(); // (function 'showLogin()' is defined in 'include.inc.php')
// (2a) Display header:
// call the 'displayHTMLhead()' and 'showPageHeader()' functions (which are defined in 'header.inc.php'):
displayHTMLhead(encodeHTML($officialDatabaseName) . " -- Library Search", "index,follow", "Search the " . encodeHTML($officialDatabaseName), "", false, "", $viewType, array());
showPageHeader($HeaderString);
// (2b) Start <form> and <table> holding the form elements:
echo "\n<form action=\"search.php\" method=\"GET\">";
echo "\n<input type=\"hidden\" name=\"formType\" value=\"librarySearch\">"
. "\n<input type=\"hidden\" name=\"showQuery\" value=\"0\">";
echo "\n<table align=\"center\" border=\"0\" cellpadding=\"0\" cellspacing=\"10\" width=\"95%\" summary=\"This table holds the search form\">"
. "\n<tr>"
. "\n\t<th align=\"left\">Show</th>\n\t<th align=\"left\">Field</th>\n\t<th align=\"left\"> </th>\n\t<th align=\"left\">That...</th>\n\t<th align=\"left\">Search String</th>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td width=\"20\" valign=\"middle\"><input type=\"checkbox\" name=\"showAuthor\" value=\"1\" checked></td>"
. "\n\t<td width=\"40\"><b>Author:</b></td>\n\t<td width=\"10\"> </td>"
. "\n\t<td width=\"130\">\n\t\t<select name=\"authorSelector\">\n\t\t\t<option>contains</option>\n\t\t\t<option>does not contain</option>\n\t\t\t<option>is equal to</option>\n\t\t\t<option>is not equal to</option>\n\t\t\t<option>starts with</option>\n\t\t\t<option>ends with</option>\n\t\t</select>\n\t</td>"
. "\n\t<td><input type=\"text\" name=\"authorName\" size=\"42\"></td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td valign=\"middle\"><input type=\"checkbox\" name=\"showTitle\" value=\"1\" checked></td>"
. "\n\t<td><b>Title:</b></td>\n\t<td> </td>"
. "\n\t<td>\n\t\t<select name=\"titleSelector\">\n\t\t\t<option>contains</option>\n\t\t\t<option>does not contain</option>\n\t\t\t<option>is equal to</option>\n\t\t\t<option>is not equal to</option>\n\t\t\t<option>starts with</option>\n\t\t\t<option>ends with</option>\n\t\t</select>\n\t</td>"
. "\n\t<td><input type=\"text\" name=\"titleName\" size=\"42\"></td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td valign=\"middle\"><input type=\"checkbox\" name=\"showYear\" value=\"1\" checked></td>"
. "\n\t<td><b>Year:</b></td>\n\t<td> </td>"
. "\n\t<td>\n\t\t<select name=\"yearSelector\">\n\t\t\t<option>contains</option>\n\t\t\t<option>does not contain</option>\n\t\t\t<option>is equal to</option>\n\t\t\t<option>is not equal to</option>\n\t\t\t<option>starts with</option>\n\t\t\t<option>ends with</option>\n\t\t\t<option>is greater than</option>\n\t\t\t<option>is less than</option>\n\t\t\t<option>is within range</option>\n\t\t\t<option>is within list</option>\n\t\t</select>\n\t</td>"
. "\n\t<td><input type=\"text\" name=\"yearNo\" size=\"42\"></td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td width=\"20\" valign=\"middle\"><input type=\"checkbox\" name=\"showEditor\" value=\"1\"></td>"
. "\n\t<td width=\"40\"><b>Editor:</b></td>\n\t<td width=\"10\"> </td>"
. "\n\t<td width=\"130\">\n\t\t<select name=\"editorSelector\">\n\t\t\t<option>contains</option>\n\t\t\t<option>does not contain</option>\n\t\t\t<option>is equal to</option>\n\t\t\t<option>is not equal to</option>\n\t\t\t<option>starts with</option>\n\t\t\t<option>ends with</option>\n\t\t</select>\n\t</td>"
. "\n\t<td><input type=\"text\" name=\"editorName\" size=\"42\"></td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td valign=\"middle\"><input type=\"checkbox\" name=\"showSeriesTitle\" value=\"1\" checked></td>"
. "\n\t<td><b>Series:</b></td>\n\t<td align=\"center\"><input type=\"radio\" name=\"seriesTitleRadio\" value=\"1\" checked></td>"
. "\n\t<td>\n\t\t<select name=\"seriesTitleSelector\">\n\t\t\t<option>contains</option>\n\t\t\t<option>does not contain</option>\n\t\t\t<option>is equal to</option>\n\t\t\t<option>is not equal to</option>\n\t\t\t<option>starts with</option>\n\t\t\t<option>ends with</option>\n\t\t</select>\n\t</td>"
. "\n\t<td>";
// (3) Run the query on the literature database through the connection:
// (here by use of the 'selectDistinct' function)
// Produce the select list
// Parameters:
// 1: Database connection
// 2. Table that contains values
// 3. The field name of the table's primary key
// 4. Table name of the user data table
// 5. The field name within the user data table that corresponds to the field in 3.
// 6. The field name of the user ID field within the user data table
// 7. The user ID of the currently logged in user (which must be provided as a session variable)
// 8. Attribute that contains values
// 9. <SELECT> element name
// 10. An additional non-database value (display string)
// 11. String that gets submitted instead of the display string given in 10.
// 12. Optional <OPTION SELECTED>
// 13. Restrict query to field... (keep empty if no restriction wanted)
// 14. ...where field contents are...
// 15. Split field contents into substrings? (yes = true, no = false)
// 16. POSIX-PATTERN to split field contents into substrings (in order to obtain actual values)
echo selectDistinct($connection,
$tableRefs,
"serial",
$tableUserData,
"record_id",
"user_id",
$loginUserID,
"series_title",
"seriesTitleName",
$loc["All"],
"All",
$loc["All"],
"",
"",
false,
"");
echo "\n\t</td>"
. "\n</tr>";
echo "\n<tr>"
. "\n\t<td> </td>"
. "\n\t<td align=\"right\">or:</td>\n\t<td align=\"center\"><input type=\"radio\" name=\"seriesTitleRadio\" value=\"0\"></td>"
. "\n\t<td>\n\t\t<select name=\"seriesTitleSelector2\">\n\t\t\t<option>contains</option>\n\t\t\t<option>does not contain</option>\n\t\t\t<option>is equal to</option>\n\t\t\t<option>is not equal to</option>\n\t\t\t<option>starts with</option>\n\t\t\t<option>ends with</option>\n\t\t</select>\n\t</td>"
. "\n\t<td><input type=\"text\" name=\"seriesTitleName2\" size=\"42\"></td>"
. "\n</tr>";
// (4) Complete the form:
echo "\n<tr>"
. "\n\t<td valign=\"middle\"><input type=\"checkbox\" name=\"showVolume\" value=\"1\"></td>"
. "\n\t<td><b>Volume:</b></td>\n\t<td> </td>"
. "\n\t<td>\n\t\t<select name=\"volumeSelector\">\n\t\t\t<option>contains</option>\n\t\t\t<option>does not contain</option>\n\t\t\t<option>is equal to</option>\n\t\t\t<option>is not equal to</option>\n\t\t\t<option>starts with</option>\n\t\t\t<option>ends with</option>\n\t\t\t<option>is greater than</option>\n\t\t\t<option>is less than</option>\n\t\t\t<option>is within range</option>\n\t\t\t<option>is within list</option>\n\t\t</select>\n\t</td>"
. "\n\t<td><input type=\"text\" name=\"volumeNo\" size=\"42\"></td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td valign=\"middle\"><input type=\"checkbox\" name=\"showPages\" value=\"1\" checked></td>"
. "\n\t<td><b>Pages:</b></td>\n\t<td> </td>"
. "\n\t<td>\n\t\t<select name=\"pagesSelector\">\n\t\t\t<option>contains</option>\n\t\t\t<option>does not contain</option>\n\t\t\t<option>is equal to</option>\n\t\t\t<option>is not equal to</option>\n\t\t\t<option>starts with</option>\n\t\t\t<option>ends with</option>\n\t\t</select>\n\t</td>"
. "\n\t<td><input type=\"text\" name=\"pagesNo\" size=\"42\"></td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td width=\"20\" valign=\"middle\"><input type=\"checkbox\" name=\"showPublisher\" value=\"1\"></td>"
. "\n\t<td width=\"40\"><b>Publisher:</b></td>\n\t<td width=\"10\"> </td>"
. "\n\t<td width=\"130\">\n\t\t<select name=\"publisherSelector\">\n\t\t\t<option>contains</option>\n\t\t\t<option>does not contain</option>\n\t\t\t<option>is equal to</option>\n\t\t\t<option>is not equal to</option>\n\t\t\t<option>starts with</option>\n\t\t\t<option>ends with</option>\n\t\t</select>\n\t</td>"
. "\n\t<td><input type=\"text\" name=\"publisherName\" size=\"42\"></td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td width=\"20\" valign=\"middle\"><input type=\"checkbox\" name=\"showPlace\" value=\"1\"></td>"
. "\n\t<td width=\"40\"><b>Place:</b></td>\n\t<td width=\"10\"> </td>"
. "\n\t<td width=\"130\">\n\t\t<select name=\"placeSelector\">\n\t\t\t<option>contains</option>\n\t\t\t<option>does not contain</option>\n\t\t\t<option>is equal to</option>\n\t\t\t<option>is not equal to</option>\n\t\t\t<option>starts with</option>\n\t\t\t<option>ends with</option>\n\t\t</select>\n\t</td>"
. "\n\t<td><input type=\"text\" name=\"placeName\" size=\"42\"></td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td width=\"20\" valign=\"middle\"><input type=\"checkbox\" name=\"showCallNumber\" value=\"1\" checked></td>"
. "\n\t<td width=\"40\"><b>Signature:</b></td>\n\t<td width=\"10\"> </td>"
. "\n\t<td width=\"130\">\n\t\t<select name=\"callNumberSelector\">\n\t\t\t<option>contains</option>\n\t\t\t<option>does not contain</option>\n\t\t\t<option>is equal to</option>\n\t\t\t<option>is not equal to</option>\n\t\t\t<option>starts with</option>\n\t\t\t<option>ends with</option>\n\t\t</select>\n\t</td>"
. "\n\t<td><input type=\"text\" name=\"callNumberName\" size=\"42\"></td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td width=\"20\" valign=\"middle\"><input type=\"checkbox\" name=\"showKeywords\" value=\"1\"></td>"
. "\n\t<td width=\"40\"><b>Keywords:</b></td>\n\t<td width=\"10\"> </td>"
. "\n\t<td width=\"130\">\n\t\t<select name=\"keywordsSelector\">\n\t\t\t<option>contains</option>\n\t\t\t<option>does not contain</option>\n\t\t\t<option>is equal to</option>\n\t\t\t<option>is not equal to</option>\n\t\t\t<option>starts with</option>\n\t\t\t<option>ends with</option>\n\t\t</select>\n\t</td>"
. "\n\t<td><input type=\"text\" name=\"keywordsName\" size=\"42\"></td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td width=\"20\" valign=\"middle\"><input type=\"checkbox\" name=\"showNotes\" value=\"1\"></td>"
. "\n\t<td width=\"40\"><b>Notes:</b></td>\n\t<td width=\"10\"> </td>"
. "\n\t<td width=\"130\">\n\t\t<select name=\"notesSelector\">\n\t\t\t<option>contains</option>\n\t\t\t<option>does not contain</option>\n\t\t\t<option>is equal to</option>\n\t\t\t<option>is not equal to</option>\n\t\t\t<option>starts with</option>\n\t\t\t<option>ends with</option>\n\t\t</select>\n\t</td>"
. "\n\t<td><input type=\"text\" name=\"notesName\" size=\"42\"></td>"
. "\n</tr>"
. "\n<tr>\n\t<td> </td>\n\t<td> </td>\n\t<td> </td>\n\t<td> </td>\n\t<td> </td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td> </td>"
. "\n\t<td valign=\"top\"><b>Display Options:</b></td>\n\t<td> </td>"
. "\n\t<td valign=\"middle\"><input type=\"checkbox\" name=\"showLinks\" value=\"1\" checked> Display Links</td>"
. "\n\t<td valign=\"middle\">Show <input type=\"text\" name=\"showRows\" value=\"" . $showRows . "\" size=\"4\" title=\"" . $loc["DescriptionShowRecordsPerPage"] . "\"> records per page"
. " <input type=\"submit\" value=\"Search\"></td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td> </td>\n\t<td> </td>\n\t<td> </td>\n\t<td> </td>\n\t<td> </td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td> </td>\n\t<td>1st sort by:</td>\n\t<td> </td>"
. "\n\t<td>\n\t\t<select name=\"sortSelector1\">\n\t\t\t<option selected>author</option>\n\t\t\t<option>title</option>\n\t\t\t<option>year</option>\n\t\t\t<option>editor</option>\n\t\t\t<option>series_title</option>\n\t\t\t<option>series_volume</option>\n\t\t\t<option>pages</option>\n\t\t\t<option>publisher</option>\n\t\t\t<option>place</option>\n\t\t\t<option>call_number</option>\n\t\t\t<option>keywords</option>\n\t\t\t<option>notes</option>\n\t\t</select>\n\t</td>"
. "\n\t<td>\n\t\t<input type=\"radio\" name=\"sortRadio1\" value=\"0\" checked> ascending "
. "\n\t\t<input type=\"radio\" name=\"sortRadio1\" value=\"1\"> descending\n\t</td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td> </td>\n\t<td>2nd sort by:</td>\n\t<td> </td>"
. "\n\t<td>\n\t\t<select name=\"sortSelector2\">\n\t\t\t<option>author</option>\n\t\t\t<option>title</option>\n\t\t\t<option selected>year</option>\n\t\t\t<option>editor</option>\n\t\t\t<option>series_title</option>\n\t\t\t<option>series_volume</option>\n\t\t\t<option>pages</option>\n\t\t\t<option>publisher</option>\n\t\t\t<option>place</option>\n\t\t\t<option>call_number</option>\n\t\t\t<option>keywords</option>\n\t\t\t<option>notes</option>\n\t\t</select>\n\t</td>"
. "\n\t<td>\n\t\t<input type=\"radio\" name=\"sortRadio2\" value=\"0\"> ascending "
. "\n\t\t<input type=\"radio\" name=\"sortRadio2\" value=\"1\" checked> descending\n\t</td>"
. "\n</tr>"
. "\n<tr>"
. "\n\t<td> </td>\n\t<td>3rd sort by:</td>\n\t<td> </td>"
. "\n\t<td>\n\t\t<select name=\"sortSelector3\">\n\t\t\t<option>author</option>\n\t\t\t<option selected>title</option>\n\t\t\t<option>year</option>\n\t\t\t<option>editor</option>\n\t\t\t<option>series_title</option>\n\t\t\t<option>series_volume</option>\n\t\t\t<option>pages</option>\n\t\t\t<option>publisher</option>\n\t\t\t<option>place</option>\n\t\t\t<option>call_number</option>\n\t\t\t<option>keywords</option>\n\t\t\t<option>notes</option>\n\t\t</select>\n\t</td>"
. "\n\t<td>\n\t\t<input type=\"radio\" name=\"sortRadio3\" value=\"0\" checked> ascending "
. "\n\t\t<input type=\"radio\" name=\"sortRadio3\" value=\"1\"> descending\n\t</td>"
. "\n</tr>"
. "\n</table>"
. "\n</form>";
// (5) Close the database connection:
disconnectFromMySQLDatabase(); // function 'disconnectFromMySQLDatabase()' is defined in 'include.inc.php'
// --------------------------------------------------------------------
// DISPLAY THE HTML FOOTER:
// call the 'showPageFooter()' and 'displayHTMLfoot()' functions (which are defined in 'footer.inc.php')
showPageFooter($HeaderString);
displayHTMLfoot();
// --------------------------------------------------------------------
?>