You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1701 lines
84 KiB

  1. <?php
  2. // turn on warnings and notice during developement
  3. include('initialize/PhpErrorSettings.inc.php');
  4. // Project: Web Reference Database (refbase) <http://www.refbase.net>
  5. // Copyright: Matthias Steffens <mailto:refbase@extracts.de> and the file's
  6. // original author(s).
  7. //
  8. // This code is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY. Please see the GNU General Public
  10. // License for more details.
  11. //
  12. // File: ./record.php
  13. // Repository: $HeadURL: file:///svn/p/refbase/code/branches/bleeding-edge/record.php $
  14. // Author(s): Matthias Steffens <mailto:refbase@extracts.de>
  15. //
  16. // Created: 29-Jul-02, 16:39
  17. // Modified: $Date: 2017-04-13 02:00:18 +0000 (Thu, 13 Apr 2017) $
  18. // $Author: karnesky $
  19. // $Revision: 1416 $
  20. // Form that offers to add
  21. // records or edit/delete
  22. // existing ones.
  23. // Incorporate some include files:
  24. include 'initialize/db.inc.php'; // 'db.inc.php' is included to hide username and password
  25. include 'includes/header.inc.php'; // include header
  26. include 'includes/footer.inc.php'; // include footer
  27. include 'includes/include.inc.php'; // include common functions
  28. include 'initialize/ini.inc.php'; // include common variables
  29. // --------------------------------------------------------------------
  30. // START A SESSION:
  31. // call the 'start_session()' function (from 'include.inc.php') which will also read out available session variables:
  32. start_session(true);
  33. // --------------------------------------------------------------------
  34. // Initialize preferred display language:
  35. // (note that 'locales.inc.php' has to be included *after* the call to the 'start_session()' function)
  36. include 'includes/locales.inc.php'; // include the locales
  37. // --------------------------------------------------------------------
  38. // Extract session variables:
  39. if (isset($_SESSION['errors']))
  40. {
  41. $errors = $_SESSION['errors']; // read session variable (only necessary if register globals is OFF!)
  42. // Note: though we clear the session variable, the current error message is still available to this script via '$errors':
  43. deleteSessionVariable("errors"); // function 'deleteSessionVariable()' is defined in 'include.inc.php'
  44. }
  45. else
  46. $errors = array(); // initialize the '$errors' variable in order to prevent 'Undefined variable...' messages
  47. if (isset($_SESSION['formVars']))
  48. {
  49. $formVars = $_SESSION['formVars']; // read session variable (only necessary if register globals is OFF!)
  50. // Note: though we clear the session variable, the current form variables are still available to this script via '$formVars':
  51. deleteSessionVariable("formVars"); // function 'deleteSessionVariable()' is defined in 'include.inc.php'
  52. }
  53. else
  54. $formVars = array();
  55. // Read out import data that were saved as a session variable:
  56. // NOTE: This is done by 'import_modify.php' (if a single record was imported via the web interface) in order to retain
  57. // large param/value strings (that would exceed the maximum string limit for GET requests). This works around a limitation
  58. // in Internet Explorer which has a maximum URL length of 2,083 characters & a maximum path length of 2,048 characters.
  59. // More info: <http://support.microsoft.com/kb/208427/EN-US/>
  60. if (isset($_SESSION['importData']))
  61. {
  62. foreach ($_SESSION['importData'] as $varname => $value)
  63. {
  64. $_POST[$varname] = $value;
  65. $_REQUEST[$varname] = $value;
  66. }
  67. deleteSessionVariable("importData"); // function 'deleteSessionVariable()' is defined in 'include.inc.php'
  68. }
  69. // --------------------------------------------------------------------
  70. if (isset($_REQUEST['recordAction']))
  71. $recordAction = $_REQUEST['recordAction']; // check whether the user wants to *add* a record or *edit* an existing one
  72. else
  73. $recordAction = ""; // if the 'recordAction' parameter wasn't set we set the '$recordAction' variable to the empty string ("") to prevent 'Undefined index: recordAction...' notification messages
  74. if (isset($_REQUEST['mode']))
  75. $mode = $_REQUEST['mode']; // check whether the user wants to add a record by use of an *import* form (e.g., the parameter "mode=import" will be set by 'import_modify.php' and 'import_csa_modify.php')
  76. else
  77. $mode = ""; // if the 'mode' parameter wasn't set we set the '$mode' variable to the empty string ("") to prevent 'Undefined index: mode...' notification messages
  78. if (isset($_REQUEST['importSource']))
  79. $importSource = $_REQUEST['importSource']; // get the source from which the imported data originate (e.g., if data have been imported via 'import_csa.php', the 'importSource' value will be 'csa')
  80. else
  81. $importSource = ""; // if the 'importSource' parameter wasn't set we set the '$importSource' variable to the empty string ("") to prevent 'Undefined index: importSource...' notification messages
  82. if (isset($_REQUEST['serialNo']))
  83. $serialNo = $_REQUEST['serialNo']; // fetch the serial number of the record to edit
  84. else
  85. $serialNo = ""; // this is actually unneccessary, but we do it for clarity reasons here
  86. // Setup some required variables:
  87. // If there's no stored message available:
  88. if (!isset($_SESSION['HeaderString'])) // if there's no stored message available
  89. {
  90. if (empty($errors)) // provide one of the default messages:
  91. {
  92. $errors = array(); // re-assign an empty array (in order to prevent 'Undefined variable "errors"...' messages when calling the 'fieldError' function later on)
  93. if ($recordAction == "edit") // *edit* record
  94. $HeaderString = $loc["EditRecordHeaderText"] . ":";
  95. else // *add* record will be the default action if no parameter is given
  96. {
  97. $HeaderString = $loc["AddRecordHeaderText"];
  98. if (isset($_REQUEST['source'])) // when importing data, we display the original source data if the 'source' parameter is present:
  99. $HeaderString .= ". Original source data:\n" . encodeHTML($_REQUEST['source']); // the 'source' parameter gets passed by 'import.php' or 'import_csa.php'
  100. else
  101. $HeaderString .= ":";
  102. }
  103. }
  104. else // -> there were errors validating the data entered by the user
  105. $HeaderString = $loc["Warning_InputDataError"];
  106. }
  107. else // there is already a stored message available
  108. {
  109. $HeaderString = $_SESSION['HeaderString']; // extract 'HeaderString' session variable (only necessary if register globals is OFF!)
  110. // Note: though we clear the session variable, the current message is still available to this script via '$HeaderString':
  111. deleteSessionVariable("HeaderString"); // function 'deleteSessionVariable()' is defined in 'include.inc.php'
  112. }
  113. // Extract the view type requested by the user (either 'Mobile', 'Print', 'Web' or ''):
  114. // ('' will produce the default 'Web' output style)
  115. if (isset($_REQUEST['viewType']))
  116. $viewType = $_REQUEST['viewType'];
  117. else
  118. $viewType = "";
  119. // if the user isn't logged in -OR- any normal user is logged in (not the admin)...
  120. if ((!isset($loginEmail)) OR ((isset($loginEmail)) AND ($loginEmail != $adminLoginEmail)))
  121. {
  122. $fieldLock = " readonly"; // ... lock the 'location' & 'file' fields
  123. $fieldLockLabel = " (" . $loc["readonly"] . ")"; // ... append a " (readonly)" indicator to the field description of the 'location' & 'file' fields
  124. }
  125. else // if the admin is logged in...
  126. {
  127. $fieldLock = ""; // ...the 'location' & 'file' fields won't be locked (since the admin should be able to freely add or edit any records)
  128. $fieldLockLabel = "";
  129. }
  130. if ($recordAction == "edit") // *edit* record
  131. {
  132. $pageTitle = $loc["EditRecord"]; // set the correct page title
  133. $addEditButtonTitle = $loc["ButtonTitle_EditRecord"]; // set the button name of the (default) submit button ('Edit Record')
  134. }
  135. else
  136. {
  137. $recordAction = "add"; // *add* record will be the default action if no parameter is given
  138. $pageTitle = $loc["AddRecord"]; // set the correct page title
  139. $addEditButtonTitle = $loc["ButtonTitle_AddRecord"]; // set the button name of the (default) submit button ('Add Record')
  140. $serialNo = $loc["not assigned yet"];
  141. // if the user isn't logged in -OR- any normal user is logged in (not the admin)...
  142. if ((!isset($loginEmail)) OR ((isset($loginEmail)) AND ($loginEmail != $adminLoginEmail)))
  143. // ...provide a generic info string within the (locked) 'location' field that informs the user about the automatic fill in of his user name & email address
  144. // (IMPORTANT: if you change this information string you must also edit the corresponding 'preg_match(...)' pattern in 'modify.php'!)
  145. $locationName = $loc["your name & email address will be filled in automatically"];
  146. else // if the admin is logged in...
  147. $locationName = ""; // ...keep the 'location' field empty
  148. }
  149. if (isset($loginEmail)) // if a user is logged in
  150. {
  151. // build a correct call number prefix for the currently logged-in user (e.g. 'IP� @ msteffens'):
  152. $callNumberPrefix = getCallNumberPrefix(); // function 'getCallNumberPrefix()' is defined in 'include.inc.php'
  153. }
  154. // Build HTML elements that allow for auto-completions of text entered by the user:
  155. if (isset($_SESSION['userAutoCompletions']) AND ($_SESSION['userAutoCompletions'] == "yes"))
  156. {
  157. $authorSuggestElements = buildSuggestElements("authorName", "authorSuggestions", "authorSuggestProgress", "col-author-", "\t\t", "';'"); // function 'buildSuggestElements()' is defined in 'include.inc.php'
  158. $titleSuggestElements = buildSuggestElements("titleName", "titleSuggestions", "titleSuggestProgress", "col-title-");
  159. $yearSuggestElements = buildSuggestElements("yearNo", "yearSuggestions", "yearSuggestProgress", "col-year-");
  160. $publicationSuggestElements = buildSuggestElements("publicationName", "publicationSuggestions", "publicationSuggestProgress", "col-publication-");
  161. $abbrevJournalSuggestElements = buildSuggestElements("abbrevJournalName", "abbrevJournalSuggestions", "abbrevJournalSuggestProgress", "col-abbrev_journal-");
  162. $volumeSuggestElements = buildSuggestElements("volumeNo", "volumeSuggestions", "volumeSuggestProgress", "col-volume-");
  163. $issueSuggestElements = buildSuggestElements("issueNo", "issueSuggestions", "issueSuggestProgress", "col-issue-");
  164. $pagesSuggestElements = buildSuggestElements("pagesNo", "pagesSuggestions", "pagesSuggestProgress", "col-pages-");
  165. $keywordsSuggestElements = buildSuggestElements("keywordsName", "keywordsSuggestions", "keywordsSuggestProgress", "col-keywords-", "\t\t", "';'");
  166. $addressSuggestElements = buildSuggestElements("addressName", "addressSuggestions", "addressSuggestProgress", "col-address-", "\t\t", "';'");
  167. $corporateAuthorSuggestElements = buildSuggestElements("corporateAuthorName", "corporateAuthorSuggestions", "corporateAuthorSuggestProgress", "col-corporate_author-", "\t\t", "';'");
  168. $publisherSuggestElements = buildSuggestElements("publisherName", "publisherSuggestions", "publisherSuggestProgress", "col-publisher-");
  169. $placeSuggestElements = buildSuggestElements("placeName", "placeSuggestions", "placeSuggestProgress", "col-place-", "\t\t", "[';',',']");
  170. $editorSuggestElements = buildSuggestElements("editorName", "editorSuggestions", "editorSuggestProgress", "col-editor-", "\t\t", "';'");
  171. $languageSuggestElements = buildSuggestElements("languageName", "languageSuggestions", "languageSuggestProgress", "col-language-", "\t\t", "';'");
  172. $summaryLanguageSuggestElements = buildSuggestElements("summaryLanguageName", "summaryLanguageSuggestions", "summaryLanguageSuggestProgress", "col-summary_language-", "\t\t", "';'");
  173. $origTitleSuggestElements = buildSuggestElements("origTitleName", "origTitleSuggestions", "origTitleSuggestProgress", "col-orig_title-");
  174. $seriesEditorSuggestElements = buildSuggestElements("seriesEditorName", "seriesEditorSuggestions", "seriesEditorSuggestProgress", "col-series_editor-", "\t\t", "';'");
  175. $seriesTitleSuggestElements = buildSuggestElements("seriesTitleName", "seriesTitleSuggestions", "seriesTitleSuggestProgress", "col-series_title-");
  176. $abbrevSeriesTitleSuggestElements = buildSuggestElements("abbrevSeriesTitleName", "abbrevSeriesTitleSuggestions", "abbrevSeriesTitleSuggestProgress", "col-abbrev_series_title-");
  177. $seriesVolumeSuggestElements = buildSuggestElements("seriesVolumeNo", "seriesVolumeSuggestions", "seriesVolumeSuggestProgress", "col-series_volume-");
  178. $seriesIssueSuggestElements = buildSuggestElements("seriesIssueNo", "seriesIssueSuggestions", "seriesIssueSuggestProgress", "col-series_issue-");
  179. $editionSuggestElements = buildSuggestElements("editionNo", "editionSuggestions", "editionSuggestProgress", "col-edition-");
  180. $issnSuggestElements = buildSuggestElements("issnName", "issnSuggestions", "issnSuggestProgress", "col-issn-");
  181. $isbnSuggestElements = buildSuggestElements("isbnName", "isbnSuggestions", "isbnSuggestProgress", "col-isbn-");
  182. $mediumSuggestElements = buildSuggestElements("mediumName", "mediumSuggestions", "mediumSuggestProgress", "col-medium-");
  183. $areaSuggestElements = buildSuggestElements("areaName", "areaSuggestions", "areaSuggestProgress", "col-area-", "\t\t", "';'");
  184. $expeditionSuggestElements = buildSuggestElements("expeditionName", "expeditionSuggestions", "expeditionSuggestProgress", "col-expedition-", "\t\t", "';'");
  185. $conferenceSuggestElements = buildSuggestElements("conferenceName", "conferenceSuggestions", "conferenceSuggestProgress", "col-conference-");
  186. $notesSuggestElements = buildSuggestElements("notesName", "notesSuggestions", "notesSuggestProgress", "col-notes-", "\t\t", "';'");
  187. if ((isset($loginEmail)) AND ($loginEmail == $adminLoginEmail)) // admin logged in
  188. {
  189. $locationSuggestElements = buildSuggestElements("locationName", "locationSuggestions", "locationSuggestProgress", "col-location-", "\t\t", "';'");
  190. $callNumberSuggestElements = buildSuggestElements("callNumberName", "callNumberSuggestions", "callNumberSuggestProgress", "col-call_number-", "\t\t", "[';','@']");
  191. }
  192. else // user isn't logged in -OR- any normal user is logged in
  193. {
  194. $locationSuggestElements = "";
  195. $callNumberSuggestElements = buildSuggestElements("callNumberNameUserOnly", "callNumberSuggestions", "callNumberSuggestProgress", "col-call_number-", "\t\t", "[';','@']");
  196. }
  197. $userKeysSuggestElements = buildSuggestElements("userKeysName", "userKeysSuggestions", "userKeysSuggestProgress", "col-user_keys-", "\t\t", "';'");
  198. $userNotesSuggestElements = buildSuggestElements("userNotesName", "userNotesSuggestions", "userNotesSuggestProgress", "col-user_notes-", "\t\t", "';'");
  199. $userFileSuggestElements = buildSuggestElements("userFileName", "userFileSuggestions", "userFileSuggestProgress", "col-user_file-");
  200. $userGroupsSuggestElements = buildSuggestElements("userGroupsName", "userGroupsSuggestions", "userGroupsSuggestProgress", "col-user_groups-", "\t\t", "';'");
  201. $citeKeySuggestElements = buildSuggestElements("citeKeyName", "citeKeySuggestions", "citeKeySuggestProgress", "col-cite_key-");
  202. $relatedSuggestElements = buildSuggestElements("relatedName", "relatedSuggestions", "relatedSuggestProgress", "col-related-", "\t\t", "';'");
  203. $urlSuggestElements = buildSuggestElements("urlName", "urlSuggestions", "urlSuggestProgress", "col-url-");
  204. $doiSuggestElements = buildSuggestElements("doiName", "doiSuggestions", "doiSuggestProgress", "col-doi-");
  205. $onlineCitationSuggestElements = buildSuggestElements("onlineCitationName", "onlineCitationSuggestions", "onlineCitationSuggestProgress", "col-online_citation-");
  206. }
  207. else
  208. {
  209. $authorSuggestElements = "";
  210. $titleSuggestElements = "";
  211. $yearSuggestElements = "";
  212. $publicationSuggestElements = "";
  213. $abbrevJournalSuggestElements = "";
  214. $volumeSuggestElements = "";
  215. $issueSuggestElements = "";
  216. $pagesSuggestElements = "";
  217. $keywordsSuggestElements = "";
  218. $addressSuggestElements = "";
  219. $corporateAuthorSuggestElements = "";
  220. $publisherSuggestElements = "";
  221. $placeSuggestElements = "";
  222. $editorSuggestElements = "";
  223. $languageSuggestElements = "";
  224. $summaryLanguageSuggestElements = "";
  225. $origTitleSuggestElements = "";
  226. $seriesEditorSuggestElements = "";
  227. $seriesTitleSuggestElements = "";
  228. $abbrevSeriesTitleSuggestElements = "";
  229. $seriesVolumeSuggestElements = "";
  230. $seriesIssueSuggestElements = "";
  231. $editionSuggestElements = "";
  232. $issnSuggestElements = "";
  233. $isbnSuggestElements = "";
  234. $mediumSuggestElements = "";
  235. $areaSuggestElements = "";
  236. $expeditionSuggestElements = "";
  237. $conferenceSuggestElements = "";
  238. $notesSuggestElements = "";
  239. $locationSuggestElements = "";
  240. $callNumberSuggestElements = "";
  241. $userKeysSuggestElements = "";
  242. $userNotesSuggestElements = "";
  243. $userFileSuggestElements = "";
  244. $userGroupsSuggestElements = "";
  245. $citeKeySuggestElements = "";
  246. $relatedSuggestElements = "";
  247. $urlSuggestElements = "";
  248. $doiSuggestElements = "";
  249. $onlineCitationSuggestElements = "";
  250. }
  251. // --------------------------------------------------------------------
  252. // CONSTRUCT SQL QUERY:
  253. // if the script was called with parameters (like: 'record.php?recordAction=edit&serialNo=...')
  254. if ($recordAction == "edit")
  255. {
  256. // for the selected record, select *all* available fields:
  257. $query = buildSELECTclause("Edit", "1"); // function 'buildSELECTclause()' is defined in 'include.inc.php'
  258. if (isset($_SESSION['loginEmail'])) // if a user is logged in, show user specific fields:
  259. $query .= " FROM $tableRefs LEFT JOIN $tableUserData ON serial = record_id AND user_id =" . quote_smart($loginUserID) . " WHERE serial RLIKE " . quote_smart("^(" . $serialNo . ")$"); // since we'll only fetch one record, the ORDER BY clause is obsolete here
  260. else // if NO user logged in, don't display any user specific fields:
  261. $query .= " FROM $tableRefs WHERE serial RLIKE " . quote_smart("^(" . $serialNo . ")$"); // since we'll only fetch one record, the ORDER BY clause is obsolete here
  262. }
  263. // --------------------------------------------------------------------
  264. // (1) OPEN CONNECTION, (2) SELECT DATABASE
  265. connectToMySQLDatabase(); // function 'connectToMySQLDatabase()' is defined in 'include.inc.php'
  266. // Initialize some variables (to prevent "Undefined variable..." messages):
  267. $isEditorCheckBox = "";
  268. $contributionIDCheckBox = "";
  269. $locationSelectorName = "";
  270. if ($recordAction == "edit" AND empty($errors))
  271. {
  272. // (3a) RUN the query on the database through the connection:
  273. $result = queryMySQLDatabase($query); // function 'queryMySQLDatabase()' is defined in 'include.inc.php'
  274. if (@ mysqli_num_rows($result) == 1) // this condition is added here to avoid the case that clicking on a search result item which got deleted in the meantime invokes a seemingly correct but empty 'edit record' search form
  275. {
  276. // (3b) EXTRACT results:
  277. $row = mysqli_fetch_array($result); //fetch the current row into the array $row (it'll be always *one* row, but anyhow)
  278. // fetch attributes of the current record into variables:
  279. $authorName = encodeHTML($row['author']);
  280. $titleName = encodeHTML($row['title']);
  281. $yearNo = encodeHTML($row['year']);
  282. $publicationName = encodeHTML($row['publication']);
  283. $abbrevJournalName = encodeHTML($row['abbrev_journal']);
  284. $volumeNo = encodeHTML($row['volume']);
  285. $issueNo = encodeHTML($row['issue']);
  286. $pagesNo = encodeHTML($row['pages']);
  287. $addressName = encodeHTML($row['address']);
  288. $corporateAuthorName = encodeHTML($row['corporate_author']);
  289. $keywordsName = encodeHTML($row['keywords']);
  290. $abstractName = encodeHTML($row['abstract']);
  291. $publisherName = encodeHTML($row['publisher']);
  292. $placeName = encodeHTML($row['place']);
  293. $editorName = encodeHTML($row['editor']);
  294. $languageName = encodeHTML($row['language']);
  295. $summaryLanguageName = encodeHTML($row['summary_language']);
  296. $origTitleName = encodeHTML($row['orig_title']);
  297. $seriesEditorName = encodeHTML($row['series_editor']);
  298. $seriesTitleName = encodeHTML($row['series_title']);
  299. $abbrevSeriesTitleName = encodeHTML($row['abbrev_series_title']);
  300. $seriesVolumeNo = encodeHTML($row['series_volume']);
  301. $seriesIssueNo = encodeHTML($row['series_issue']);
  302. $editionNo = encodeHTML($row['edition']);
  303. $issnName = encodeHTML($row['issn']);
  304. $isbnName = encodeHTML($row['isbn']);
  305. $mediumName = encodeHTML($row['medium']);
  306. $areaName = encodeHTML($row['area']);
  307. $expeditionName = encodeHTML($row['expedition']);
  308. $conferenceName = encodeHTML($row['conference']);
  309. $notesName = encodeHTML($row['notes']);
  310. $approvedRadio = encodeHTML($row['approved']);
  311. // we only show the contents of the 'location' field if the user is logged in:
  312. // (this is mostly done to shield user email addresses from exposure to search engines and/or email harvesting robots)
  313. if (isset($loginEmail))
  314. {
  315. $locationName = encodeHTML($row['location']);
  316. $rawLocationName = $row['location']; // we'll save the unencoded location string to a separate variable since it will be needed when generating the delete button
  317. }
  318. else
  319. {
  320. $locationName = "";
  321. $rawLocationName = "";
  322. }
  323. $callNumberName = $row['call_number']; // contents of the 'call_number' field will get encoded depending on who's logged in (normal user vs. admin)
  324. // (for normal users being logged in, the field's contents won't get HTML encoded at all, since the data will
  325. // get *rawurlencoded* when including them within a hidden form tag; for the admin being logged in, the data
  326. // will get HTML encoded below)
  327. // if a normal user is logged in, we'll only display the user's *own* call number within the 'call_number' field:
  328. if ((isset($loginEmail)) AND ($loginEmail != $adminLoginEmail))
  329. {
  330. if (preg_match("/(^|.*;) *$callNumberPrefix *@ +([^@;]+)/", $callNumberName)) // if the user's call number prefix occurs within the contents of the 'call_number' field
  331. {
  332. $callNumberNameUserOnly = preg_replace("/(^|.*;) *$callNumberPrefix *@ +([^@;]+).*/i", "\\2", $callNumberName); // extract the user's *own* call number from the full contents of the 'call_number' field
  333. $callNumberNameUserOnly = encodeHTML($callNumberNameUserOnly);
  334. }
  335. else
  336. $callNumberNameUserOnly = "";
  337. }
  338. elseif ((isset($loginEmail)) AND ($loginEmail == $adminLoginEmail)) // admin logged in
  339. {
  340. $callNumberNameUserOnly = ""; // the 'call_number' field will be empty if no user is logged in (note that '$callNumberNameUserOnly' won't be used at all, if the admin is logged in)
  341. $callNumberName = encodeHTML($callNumberName); // if the admin is logged in we display the full contents of the 'call_number' field, so we'll need to HTML encode the data
  342. }
  343. else // nobody logged in
  344. {
  345. $callNumberNameUserOnly = ""; // the 'call_number' field will be empty if no user is logged in (note that '$callNumberNameUserOnly' won't be used at all, if the admin is logged in)
  346. // note that, as for normal users being logged in, the call number field contents won't get HTML encoded here, since the data will get *rawurlencoded* when including them within a hidden form tag
  347. }
  348. $serialNo = encodeHTML($row['serial']);
  349. $typeName = encodeHTML($row['type']);
  350. $thesisName = encodeHTML($row['thesis']);
  351. if (isset($row['marked'])) // 'marked' field is only provided if a user is logged in
  352. $markedRadio = encodeHTML($row['marked']);
  353. else
  354. $markedRadio = "";
  355. if (isset($row['copy'])) // 'copy' field is only provided if a user is logged in
  356. $copyName = encodeHTML($row['copy']);
  357. else
  358. $copyName = "";
  359. if (isset($row['selected'])) // 'selected' field is only provided if a user is logged in
  360. $selectedRadio = encodeHTML($row['selected']);
  361. else
  362. $selectedRadio = "";
  363. if (isset($row['user_keys'])) // 'user_keys' field is only provided if a user is logged in
  364. $userKeysName = encodeHTML($row['user_keys']);
  365. else
  366. $userKeysName = "";
  367. if (isset($row['user_notes'])) // 'user_notes' field is only provided if a user is logged in
  368. $userNotesName = encodeHTML($row['user_notes']);
  369. else
  370. $userNotesName = "";
  371. if (isset($row['user_file'])) // 'user_file' field is only provided if a user is logged in
  372. $userFileName = encodeHTML($row['user_file']);
  373. else
  374. $userFileName = "";
  375. if (isset($row['user_groups'])) // 'user_groups' field is only provided if a user is logged in
  376. $userGroupsName = encodeHTML($row['user_groups']);
  377. else
  378. $userGroupsName = "";
  379. if (isset($row['cite_key'])) // 'cite_key' field is only provided if a user is logged in
  380. $citeKeyName = encodeHTML($row['cite_key']);
  381. else
  382. $citeKeyName = "";
  383. if (isset($row['related'])) // 'related' field is only provided if a user is logged in
  384. $relatedName = encodeHTML($row['related']);
  385. else
  386. $relatedName = "";
  387. // show the contents of the 'file' field if one of the following conditions is met:
  388. // - the variable '$fileVisibility' (defined in 'ini.inc.php') is set to 'everyone'
  389. // - the variable '$fileVisibility' is set to 'login' AND the user is logged in
  390. // - the variable '$fileVisibility' is set to 'user-specific' AND the 'user_permissions' session variable contains 'allow_download'
  391. if ($fileVisibility == "everyone" OR ($fileVisibility == "login" AND isset($_SESSION['loginEmail'])) OR ($fileVisibility == "user-specific" AND (isset($_SESSION['user_permissions']) AND preg_match("/allow_download/", $_SESSION['user_permissions']))))
  392. $fileName = encodeHTML($row['file']);
  393. else // if the user has no permission to download (and hence view) any files, 'modify.php' will take care that the empty form value won't overwrite any existing contents of the 'file' field
  394. $fileName = "";
  395. $urlName = encodeHTML($row['url']);
  396. $doiName = encodeHTML($row['doi']);
  397. $contributionID = $row['contribution_id'];
  398. $onlinePublication = $row['online_publication'];
  399. $onlineCitationName = $row['online_citation'];
  400. $createdDate = $row['created_date'];
  401. $createdTime = $row['created_time'];
  402. $createdBy = encodeHTML($row['created_by']);
  403. $modifiedDate = $row['modified_date'];
  404. $modifiedTime = $row['modified_time'];
  405. $modifiedBy = encodeHTML($row['modified_by']);
  406. $origRecord = $row['orig_record'];
  407. }
  408. else
  409. showErrorMsg($loc["The Query"].":\n<br>\n<br>\n<code>" . encodeHTML($query) . "</code>\n<br>\n<br>\n ". $loc["caused an error"].":", "");
  410. }
  411. else // if ($recordAction == "add") -OR- ($recordAction == "edit" but there were some errors on submit)
  412. {
  413. if ($recordAction == "add" AND $mode == "import" AND empty($errors)) // if the user wants to import record data by use of an import form (like 'import.php' or 'import_csa.php')
  414. {
  415. foreach($_REQUEST as $varname => $value)
  416. // remove slashes from parameter values if 'magic_quotes_gpc = On':
  417. $_REQUEST[$varname] = stripSlashesIfMagicQuotes($value); // function 'stripSlashesIfMagicQuotes()' is defined in 'include.inc.php'
  418. // read field data from a GET/POST request:
  419. if (isset($_REQUEST['author']))
  420. $authorName = encodeHTML($_REQUEST['author']);
  421. else
  422. $authorName = "";
  423. if (isset($_REQUEST['title']))
  424. $titleName = encodeHTML($_REQUEST['title']);
  425. else
  426. $titleName = "";
  427. if (isset($_REQUEST['year']))
  428. $yearNo = encodeHTML($_REQUEST['year']);
  429. else
  430. $yearNo = "";
  431. if (isset($_REQUEST['publication']))
  432. $publicationName = encodeHTML($_REQUEST['publication']);
  433. else
  434. $publicationName = "";
  435. if (isset($_REQUEST['abbrev_journal']))
  436. $abbrevJournalName = encodeHTML($_REQUEST['abbrev_journal']);
  437. else
  438. $abbrevJournalName = "";
  439. if (isset($_REQUEST['volume']))
  440. $volumeNo = encodeHTML($_REQUEST['volume']);
  441. else
  442. $volumeNo = "";
  443. if (isset($_REQUEST['issue']))
  444. $issueNo = encodeHTML($_REQUEST['issue']);
  445. else
  446. $issueNo = "";
  447. if (isset($_REQUEST['pages']))
  448. $pagesNo = encodeHTML($_REQUEST['pages']);
  449. else
  450. $pagesNo = "";
  451. if (isset($_REQUEST['address']))
  452. $addressName = encodeHTML($_REQUEST['address']);
  453. else
  454. $addressName = "";
  455. if (isset($_REQUEST['corporate_author']))
  456. $corporateAuthorName = encodeHTML($_REQUEST['corporate_author']);
  457. else
  458. $corporateAuthorName = "";
  459. if (isset($_REQUEST['keywords']))
  460. $keywordsName = encodeHTML($_REQUEST['keywords']);
  461. else
  462. $keywordsName = "";
  463. if (isset($_REQUEST['abstract']))
  464. $abstractName = encodeHTML($_REQUEST['abstract']);
  465. else
  466. $abstractName = "";
  467. if (isset($_REQUEST['publisher']))
  468. $publisherName = encodeHTML($_REQUEST['publisher']);
  469. else
  470. $publisherName = "";
  471. if (isset($_REQUEST['place']))
  472. $placeName = encodeHTML($_REQUEST['place']);
  473. else
  474. $placeName = "";
  475. if (isset($_REQUEST['editor']))
  476. $editorName = encodeHTML($_REQUEST['editor']);
  477. else
  478. $editorName = "";
  479. if (isset($_REQUEST['language']))
  480. $languageName = encodeHTML($_REQUEST['language']);
  481. else
  482. $languageName = "";
  483. if (isset($_REQUEST['summary_language']))
  484. $summaryLanguageName = encodeHTML($_REQUEST['summary_language']);
  485. else
  486. $summaryLanguageName = "";
  487. if (isset($_REQUEST['orig_title']))
  488. $origTitleName = encodeHTML($_REQUEST['orig_title']);
  489. else
  490. $origTitleName = "";
  491. if (isset($_REQUEST['series_editor']))
  492. $seriesEditorName = encodeHTML($_REQUEST['series_editor']);
  493. else
  494. $seriesEditorName = "";
  495. if (isset($_REQUEST['series_title']))
  496. $seriesTitleName = encodeHTML($_REQUEST['series_title']);
  497. else
  498. $seriesTitleName = "";
  499. if (isset($_REQUEST['abbrev_series_title']))
  500. $abbrevSeriesTitleName = encodeHTML($_REQUEST['abbrev_series_title']);
  501. else
  502. $abbrevSeriesTitleName = "";
  503. if (isset($_REQUEST['series_volume']))
  504. $seriesVolumeNo = encodeHTML($_REQUEST['series_volume']);
  505. else
  506. $seriesVolumeNo = "";
  507. if (isset($_REQUEST['series_issue']))
  508. $seriesIssueNo = encodeHTML($_REQUEST['series_issue']);
  509. else
  510. $seriesIssueNo = "";
  511. if (isset($_REQUEST['edition']))
  512. $editionNo = encodeHTML($_REQUEST['edition']);
  513. else
  514. $editionNo = "";
  515. if (isset($_REQUEST['issn']))
  516. $issnName = encodeHTML($_REQUEST['issn']);
  517. else
  518. $issnName = "";
  519. if (isset($_REQUEST['isbn']))
  520. $isbnName = encodeHTML($_REQUEST['isbn']);
  521. else
  522. $isbnName = "";
  523. $mediumName = "";
  524. if (isset($_REQUEST['area']))
  525. $areaName = encodeHTML($_REQUEST['area']);
  526. else
  527. $areaName = "";
  528. $expeditionName = "";
  529. if (isset($_REQUEST['conference']))
  530. $conferenceName = encodeHTML($_REQUEST['conference']);
  531. else
  532. $conferenceName = "";
  533. if (isset($_REQUEST['notes']))
  534. $notesName = encodeHTML($_REQUEST['notes']);
  535. else
  536. $notesName = "";
  537. $approvedRadio = "";
  538. $locationName = $locationName; // supply some generic info: "(...will be filled in automatically)" [as defined at the top of this script]
  539. $rawLocationName = "";
  540. if (isset($_REQUEST['call_number']))
  541. {
  542. // if the data did originate from an import form -AND- (if the user isn't logged in -OR- any normal user is logged in (not the admin))...
  543. if ($recordAction == "add" AND $mode == "import" AND ((!isset($loginEmail)) OR ((isset($loginEmail)) AND ($loginEmail != $adminLoginEmail))))
  544. {
  545. $callNumberName = "";
  546. $callNumberNameUserOnly = encodeHTML($_REQUEST['call_number']); // for import, we assume that the contents of the call number field fully belong to the current user
  547. }
  548. else // if the data didn't originate from an import form or if the admin is logged in...
  549. {
  550. $callNumberName = encodeHTML($_REQUEST['call_number']);
  551. $callNumberNameUserOnly = "";
  552. }
  553. }
  554. else
  555. {
  556. $callNumberName = "";
  557. $callNumberNameUserOnly = "";
  558. }
  559. $serialNo = $serialNo; // supply some generic info: "(not assigned yet)" [as defined at the top of this script]
  560. if (isset($_REQUEST['type']))
  561. $typeName = encodeHTML($_REQUEST['type']);
  562. else
  563. $typeName = "";
  564. if (isset($_REQUEST['thesis']))
  565. $thesisName = encodeHTML($_REQUEST['thesis']);
  566. else
  567. $thesisName = "";
  568. if (isset($_REQUEST['marked']))
  569. $markedRadio = encodeHTML($_REQUEST['marked']);
  570. else
  571. $markedRadio = "";
  572. if (isset($_REQUEST['copy']))
  573. $copyName = encodeHTML($_REQUEST['copy']);
  574. else
  575. $copyName = "";
  576. if (isset($_REQUEST['selected']))
  577. $selectedRadio = encodeHTML($_REQUEST['selected']);
  578. else
  579. $selectedRadio = "";
  580. if (isset($_REQUEST['user_keys']))
  581. $userKeysName = encodeHTML($_REQUEST['user_keys']);
  582. else
  583. $userKeysName = "";
  584. if (isset($_REQUEST['user_notes']))
  585. $userNotesName = encodeHTML($_REQUEST['user_notes']);
  586. else
  587. $userNotesName = "";
  588. if (isset($_REQUEST['user_file']))
  589. $userFileName = encodeHTML($_REQUEST['user_file']);
  590. else
  591. $userFileName = "";
  592. if (isset($_REQUEST['user_groups']))
  593. $userGroupsName = encodeHTML($_REQUEST['user_groups']);
  594. else
  595. $userGroupsName = "";
  596. if (isset($_REQUEST['cite_key']))
  597. $citeKeyName = encodeHTML($_REQUEST['cite_key']);
  598. else
  599. $citeKeyName = "";
  600. if (isset($_REQUEST['related']))
  601. $relatedName = encodeHTML($_REQUEST['related']);
  602. else
  603. $relatedName = "";
  604. // NOTE: currently, we only allow for file URLs with full URL paths
  605. //
  606. // TODO: - ensure that there aren't any security issues
  607. // - should we accept local file paths/names from the import data? if so, how should we handle them?
  608. // - make sure that any recognized PDF files get renamed & filed according to the settings in 'initialize/ini.inc.php';
  609. // in case of remote file URLs, this may mean downloading the remote PDF, and filing/renaming it according to preference
  610. if (isset($_REQUEST['file']) AND preg_match("#^(https?|ftp|file)://#i", $_REQUEST['file'])) // if the 'file' field contains a full URL (starting with "http://", "https://", "ftp://" or "file://")
  611. $fileName = encodeHTML($_REQUEST['file']);
  612. else
  613. $fileName = "";
  614. if (isset($_REQUEST['url']))
  615. $urlName = encodeHTML($_REQUEST['url']);
  616. else
  617. $urlName = "";
  618. if (isset($_REQUEST['doi']))
  619. $doiName = encodeHTML($_REQUEST['doi']);
  620. else
  621. $doiName = "";
  622. $contributionID = "";
  623. $onlinePublication = "";
  624. $onlineCitationName = "";
  625. $createdDate = ""; // for INSERTs, 'created_...' and 'modified_...' variables will get fresh values in 'modify.php' anyhow
  626. $createdTime = "";
  627. $createdBy = "";
  628. $modifiedDate = "";
  629. $modifiedTime = "";
  630. $modifiedBy = "";
  631. $origRecord = "";
  632. }
  633. else // the user tried to add or edit a record but...
  634. {
  635. if (!empty($errors)) // ...there were some errors on submit. -> Re-load the data that were submitted by the user:
  636. {
  637. foreach($formVars as $varname => $value)
  638. // remove slashes from parameter values if 'magic_quotes_gpc = On':
  639. $formVars[$varname] = stripSlashesIfMagicQuotes($value); // function 'stripSlashesIfMagicQuotes()' is defined in 'include.inc.php'
  640. if (isset($formVars['authorName']))
  641. $authorName = $formVars['authorName'];
  642. else
  643. $authorName = "";
  644. if (isset($formVars['isEditorCheckBox'])) // the user did mark the "is Editor" checkbox
  645. $isEditorCheckBox = $formVars['isEditorCheckBox'];
  646. if (isset($formVars['titleName']))
  647. $titleName = $formVars['titleName'];
  648. else
  649. $titleName = "";
  650. if (isset($formVars['yearNo']))
  651. $yearNo = $formVars['yearNo'];
  652. else
  653. $yearNo = "";
  654. if (isset($formVars['publicationName']))
  655. $publicationName = $formVars['publicationName'];
  656. else
  657. $publicationName = "";
  658. if (isset($formVars['abbrevJournalName']))
  659. $abbrevJournalName = $formVars['abbrevJournalName'];
  660. else
  661. $abbrevJournalName = "";
  662. if (isset($formVars['volumeNo']))
  663. $volumeNo = $formVars['volumeNo'];
  664. else
  665. $volumeNo = "";
  666. if (isset($formVars['issueNo']))
  667. $issueNo = $formVars['issueNo'];
  668. else
  669. $issueNo = "";
  670. if (isset($formVars['pagesNo']))
  671. $pagesNo = $formVars['pagesNo'];
  672. else
  673. $pagesNo = "";
  674. if (isset($formVars['addressName']))
  675. $addressName = $formVars['addressName'];
  676. else
  677. $addressName = "";
  678. if (isset($formVars['corporateAuthorName']))
  679. $corporateAuthorName = $formVars['corporateAuthorName'];
  680. else
  681. $corporateAuthorName = "";
  682. if (isset($formVars['keywordsName']))
  683. $keywordsName = $formVars['keywordsName'];
  684. else
  685. $keywordsName = "";
  686. if (isset($formVars['abstractName']))
  687. $abstractName = $formVars['abstractName'];
  688. else
  689. $abstractName = "";
  690. if (isset($formVars['publisherName']))
  691. $publisherName = $formVars['publisherName'];
  692. else
  693. $publisherName = "";
  694. if (isset($formVars['placeName']))
  695. $placeName = $formVars['placeName'];
  696. else
  697. $placeName = "";
  698. if (isset($formVars['editorName']))
  699. $editorName = $formVars['editorName'];
  700. else
  701. $editorName = "";
  702. if (isset($formVars['languageName']))
  703. $languageName = $formVars['languageName'];
  704. else
  705. $languageName = "";
  706. if (isset($formVars['summaryLanguageName']))
  707. $summaryLanguageName = $formVars['summaryLanguageName'];
  708. else
  709. $summaryLanguageName = "";
  710. if (isset($formVars['origTitleName']))
  711. $origTitleName = $formVars['origTitleName'];
  712. else
  713. $origTitleName = "";
  714. if (isset($formVars['seriesEditorName']))
  715. $seriesEditorName = $formVars['seriesEditorName'];
  716. else
  717. $seriesEditorName = "";
  718. if (isset($formVars['seriesTitleName']))
  719. $seriesTitleName = $formVars['seriesTitleName'];
  720. else
  721. $seriesTitleName = "";
  722. if (isset($formVars['abbrevSeriesTitleName']))
  723. $abbrevSeriesTitleName = $formVars['abbrevSeriesTitleName'];
  724. else
  725. $abbrevSeriesTitleName = "";
  726. if (isset($formVars['seriesVolumeNo']))
  727. $seriesVolumeNo = $formVars['seriesVolumeNo'];
  728. else
  729. $seriesVolumeNo = "";
  730. if (isset($formVars['seriesIssueNo']))
  731. $seriesIssueNo = $formVars['seriesIssueNo'];
  732. else
  733. $seriesIssueNo = "";
  734. if (isset($formVars['editionNo']))
  735. $editionNo = $formVars['editionNo'];
  736. else
  737. $editionNo = "";
  738. if (isset($formVars['issnName']))
  739. $issnName = $formVars['issnName'];
  740. else
  741. $issnName = "";
  742. if (isset($formVars['isbnName']))
  743. $isbnName = $formVars['isbnName'];
  744. else
  745. $isbnName = "";
  746. if (isset($formVars['mediumName']))
  747. $mediumName = $formVars['mediumName'];
  748. else
  749. $mediumName = "";
  750. if (isset($formVars['areaName']))
  751. $areaName = $formVars['areaName'];
  752. else
  753. $areaName = "";
  754. if (isset($formVars['expeditionName']))
  755. $expeditionName = $formVars['expeditionName'];
  756. else
  757. $expeditionName = "";
  758. if (isset($formVars['conferenceName']))
  759. $conferenceName = $formVars['conferenceName'];
  760. else
  761. $conferenceName = "";
  762. if (isset($formVars['notesName']))
  763. $notesName = $formVars['notesName'];
  764. else
  765. $notesName = "";
  766. if (isset($formVars['approvedRadio']))
  767. $approvedRadio = $formVars['approvedRadio'];
  768. else
  769. $approvedRadio = "";
  770. if ($recordAction == "edit")
  771. {
  772. if (isset($formVars['locationName']))
  773. {
  774. $locationName = $formVars['locationName'];
  775. $rawLocationName = $formVars['locationName'];
  776. }
  777. else
  778. {
  779. $locationName = "";
  780. $rawLocationName = "";
  781. }
  782. }
  783. else
  784. {
  785. $locationName = $locationName; // supply some generic info: "(...will be filled in automatically)" [as defined at the top of this script]
  786. $rawLocationName = "";
  787. }
  788. if (isset($formVars['callNumberName']))
  789. $callNumberName = $formVars['callNumberName'];
  790. else
  791. $callNumberName = "";
  792. if (preg_match("/%40/", $callNumberName)) // if '$callNumberName' still contains URL encoded data... ('%40' is the URL encoded form of the character '@', see note below!)
  793. $callNumberName = rawurldecode($callNumberName); // ...URL decode 'callNumberName' variable contents (it was URL encoded before incorporation into a hidden tag of the 'record' form to avoid any HTML syntax errors)
  794. // NOTE: URL encoded data that are included within a *link* will get URL decoded automatically *before* extraction via '$_POST'!
  795. // But, opposed to that, URL encoded data that are included within a form by means of a *hidden form tag* will NOT get URL decoded automatically! Then, URL decoding has to be done manually (as is done here)!
  796. if (isset($formVars['callNumberNameUserOnly']))
  797. $callNumberNameUserOnly = $formVars['callNumberNameUserOnly'];
  798. else
  799. $callNumberNameUserOnly = "";
  800. if ($recordAction == "edit")
  801. $serialNo = $formVars['serialNo'];
  802. else
  803. $serialNo = $serialNo; // supply some generic info: "(not assigned yet)" [as defined at the top of this script]
  804. if (isset($formVars['typeName']))
  805. $typeName = $formVars['typeName'];
  806. else
  807. $typeName = "";
  808. if (isset($formVars['thesisName']))
  809. $thesisName = $formVars['thesisName'];
  810. else
  811. $thesisName = "";
  812. if (isset($formVars['markedRadio']))
  813. $markedRadio = $formVars['markedRadio'];
  814. else
  815. $markedRadio = "";
  816. if (isset($formVars['copyName']))
  817. $copyName = $formVars['copyName'];
  818. else
  819. $copyName = "";
  820. if (isset($formVars['selectedRadio']))
  821. $selectedRadio = $formVars['selectedRadio'];
  822. else
  823. $selectedRadio = "";
  824. if (isset($formVars['userKeysName']))
  825. $userKeysName = $formVars['userKeysName'];
  826. else
  827. $userKeysName = "";
  828. if (isset($formVars['userNotesName']))
  829. $userNotesName = $formVars['userNotesName'];
  830. else
  831. $userNotesName = "";
  832. if (isset($formVars['userFileName']))
  833. $userFileName = $formVars['userFileName'];
  834. else
  835. $userFileName = "";
  836. if (isset($formVars['userGroupsName']))
  837. $userGroupsName = $formVars['userGroupsName'];
  838. else
  839. $userGroupsName = "";
  840. if (isset($formVars['citeKeyName']))
  841. $citeKeyName = $formVars['citeKeyName'];
  842. else
  843. $citeKeyName = "";
  844. if (isset($formVars['relatedName']))
  845. $relatedName = $formVars['relatedName'];
  846. else
  847. $relatedName = "";
  848. if (isset($formVars['fileName']))
  849. $fileName = $formVars['fileName'];
  850. else
  851. $fileName = "";
  852. if (isset($formVars['urlName']))
  853. $urlName = $formVars['urlName'];
  854. else
  855. $urlName = "";
  856. if (isset($formVars['doiName']))
  857. $doiName = $formVars['doiName'];
  858. else
  859. $doiName = "";
  860. if (isset($formVars['contributionIDName']))
  861. $contributionID = $formVars['contributionIDName'];
  862. else
  863. $contributionID = "";
  864. $contributionID = rawurldecode($contributionID); // URL decode 'contributionID' variable contents (it was URL encoded before incorporation into a hidden tag of the 'record' form to avoid any HTML syntax errors) [see above!]
  865. // check if we need to set the checkbox in front of "This is a ... publication.":
  866. if (isset($formVars['contributionIDCheckBox'])) // the user did mark the contribution ID checkbox
  867. $contributionIDCheckBox = $formVars['contributionIDCheckBox'];
  868. if (isset($formVars['locationSelectorName']))
  869. $locationSelectorName = $formVars['locationSelectorName'];
  870. else
  871. $locationSelectorName = "";
  872. // check if we need to set the "Online publication" checkbox:
  873. if (isset($formVars['onlinePublicationCheckBox'])) // the user did mark the "Online publication" checkbox
  874. $onlinePublication = "yes";
  875. else
  876. $onlinePublication = "no";
  877. if (isset($formVars['onlineCitationName']))
  878. $onlineCitationName = $formVars['onlineCitationName'];
  879. else
  880. $onlineCitationName = "";
  881. $createdDate = ""; // for INSERTs, 'created_...' and 'modified_...' variables will get fresh values in 'modify.php' anyhow
  882. $createdTime = "";
  883. $createdBy = "";
  884. $modifiedDate = "";
  885. $modifiedTime = "";
  886. $modifiedBy = "";
  887. if (isset($formVars['origRecord']))
  888. $origRecord = $formVars['origRecord'];
  889. else
  890. $origRecord = "";
  891. }
  892. else // add a new record -> display an empty form (i.e., set all variables to an empty string [""] or their default values, respectively):
  893. {
  894. $authorName = "";
  895. $titleName = "";
  896. $yearNo = "";
  897. $publicationName = "";
  898. $abbrevJournalName = "";
  899. $volumeNo = "";
  900. $issueNo = "";
  901. $pagesNo = "";
  902. $addressName = "";
  903. $corporateAuthorName = "";
  904. $keywordsName = "";
  905. $abstractName = "";
  906. $publisherName = "";
  907. $placeName = "";
  908. $editorName = "";
  909. $languageName = "";
  910. $summaryLanguageName = "";
  911. $origTitleName = "";
  912. $seriesEditorName = "";
  913. $seriesTitleName = "";
  914. $abbrevSeriesTitleName = "";
  915. $seriesVolumeNo = "";
  916. $seriesIssueNo = "";
  917. $editionNo = "";
  918. $issnName = "";
  919. $isbnName = "";
  920. $mediumName = "";
  921. $areaName = "";
  922. $expeditionName = "";
  923. $conferenceName = "";
  924. $notesName = "";
  925. $approvedRadio = "";
  926. $locationName = $locationName; // supply some generic info: "(...will be filled in automatically)" [as defined at the top of this script]
  927. $rawLocationName = "";
  928. $callNumberName = "";
  929. $callNumberNameUserOnly = "";
  930. $serialNo = $serialNo; // supply some generic info: "(not assigned yet)" [as defined at the top of this script]
  931. $typeName = "Journal Article";
  932. $thesisName = "";
  933. $markedRadio = "";
  934. $copyName = "true";
  935. $selectedRadio = "";
  936. $userKeysName = "";
  937. $userNotesName = "";
  938. $userFileName = "";
  939. $userGroupsName = "";
  940. $citeKeyName = "";
  941. $relatedName = "";
  942. $fileName = "";
  943. $urlName = "";
  944. $doiName = "";
  945. $contributionID = "";
  946. $onlinePublication = "";
  947. $onlineCitationName = "";
  948. $createdDate = ""; // for INSERTs, 'created_...' and 'modified_...' variables will get fresh values in 'modify.php' anyhow
  949. $createdTime = "";
  950. $createdBy = "";
  951. $modifiedDate = "";
  952. $modifiedTime = "";
  953. $modifiedBy = "";
  954. $origRecord = "";
  955. }
  956. }
  957. }
  958. // Show the login status:
  959. showLogin(); // (function 'showLogin()' is defined in 'include.inc.php')
  960. // (4a) DISPLAY header:
  961. // call the 'displayHTMLhead()' and 'showPageHeader()' functions (which are defined in 'header.inc.php'):
  962. displayHTMLhead(encodeHTML($officialDatabaseName) . " -- " . $pageTitle, "index,follow", "Add, edit or delete a record in the " . encodeHTML($officialDatabaseName), "", false, "", $viewType, array());
  963. showPageHeader($HeaderString);
  964. // (4b) DISPLAY results:
  965. // Start <form> and <table> holding the form elements:
  966. echo "\n<form enctype=\"multipart/form-data\" action=\"modify.php?proc=1\" method=\"POST\" accept-charset=\"" . $contentTypeCharset . "\" name=\"record\">"; // '$contentTypeCharset' is defined in 'ini.inc.php'
  967. echo "\n<input type=\"hidden\" name=\"formType\" value=\"record\">";
  968. echo "\n<input type=\"hidden\" name=\"submit\" value=\"" . $addEditButtonTitle . "\">"; // provide a default value for the 'submit' form tag (then, hitting <enter> within a text entry field will act as if the user clicked the 'Add/Edit Record' button)
  969. echo "\n<input type=\"hidden\" name=\"recordAction\" value=\"" . $recordAction . "\">";
  970. echo "\n<input type=\"hidden\" name=\"contributionIDName\" value=\"" . rawurlencode($contributionID) . "\">";
  971. echo "\n<input type=\"hidden\" name=\"origRecord\" value=\"" . $origRecord . "\">";
  972. if ($recordAction == "edit")
  973. {
  974. // the following hidden form tags are included in order to have their values available when a record is moved to the 'deleted' table:
  975. echo "\n<input type=\"hidden\" name=\"createdDate\" value=\"" . $createdDate . "\">";
  976. echo "\n<input type=\"hidden\" name=\"createdTime\" value=\"" . $createdTime . "\">";
  977. echo "\n<input type=\"hidden\" name=\"createdBy\" value=\"" . $createdBy . "\">";
  978. echo "\n<input type=\"hidden\" name=\"modifiedDate\" value=\"" . $modifiedDate . "\">";
  979. echo "\n<input type=\"hidden\" name=\"modifiedTime\" value=\"" . $modifiedTime . "\">";
  980. echo "\n<input type=\"hidden\" name=\"modifiedBy\" value=\"" . $modifiedBy . "\">";
  981. }
  982. // include a hidden tag that indicates the login status *at the time this page was loaded*:
  983. // Background: We use the session variable "$loginEmail" to control whether a user is logged in or not. However, if a user is working in different browser windows/tabs
  984. // the state/contents of a particular window might have changed due to any login/logout actions performed by the user. As an example, a user (who's currently NOT logged in!)
  985. // could open several records in edit view to *different* browser windows. Then he realizes that he forgot to login and logs in on the last browser window. He submits that
  986. // window and displays the next of his windows (where he still appears to be logged out). He doesn't notice the obsolete login status and goes on editing/submitting this window.
  987. // Since the session variable is global, it WILL be possible to submit the form in that window! This proceedure will cause the following problems:
  988. // Problems: 1. For normal users, the user's *own* call number will get removed from the 'call_number' field contents! The user's call number prefix will remain, though.
  989. // (the user's call number gets deleted, since the call number form field is left blank if a user isn't logged in)
  990. // 2. For normal users as well as for admins, any contribution ID that exists within the "contribution_id" field will be removed
  991. // (this is, since the contribution ID checkbox isn't shown when the user isn't logged in)
  992. // Solution: Since the above problems can't be circumvented easily with the current design, we simply include a hidden form tag, that indicates the user's login status on a
  993. // *per page* basis. Then, 'modify.php' will only allow submitting of forms where "pageLoginStatus=logged in". If a user is already logged in, but the "pageLoginStatus" of the currently
  994. // displayed page still states "logged out", he'll need to reload the page or click on the login link to update the "pageLoginStatus" first. This will avoid the problems outlined above.
  995. if (isset($loginEmail)) // if a user is logged in...
  996. echo "\n<input type=\"hidden\" name=\"pageLoginStatus\" value=\"logged in\">"; // ...the user was logged IN when loading this page
  997. else // if no user is logged in...
  998. echo "\n<input type=\"hidden\" name=\"pageLoginStatus\" value=\"logged out\">"; // ...the user was logged OUT when loading this page
  999. // if the user isn't logged in -OR- any normal user is logged in (not the admin)...
  1000. if ((!isset($loginEmail)) OR ((isset($loginEmail)) AND ($loginEmail != $adminLoginEmail)))
  1001. // except the admin, no user will be presented with the complete contents of the 'call_number' field! This is to prevent normal users
  1002. // to mess with other user's personal call numbers. Instead, normal users will always only see their own id number within the 'call_number' field.
  1003. // This should also avoid confusion how this field should/must be edited properly. Of course, the full contents of the 'call_number' field must be
  1004. // preserved, therefore we include them within a hidden form tag:
  1005. echo "\n<input type=\"hidden\" name=\"callNumberName\" value=\"" . rawurlencode($callNumberName) . "\">"; // ...include the *full* contents of the 'call_number' field
  1006. echo "\n<table align=\"center\" border=\"0\" cellpadding=\"5\" cellspacing=\"0\" width=\"600\" summary=\"This table holds a form that offers to add records or edit existing ones\">"
  1007. . "\n<tr>"
  1008. . "\n\t<td width=\"74\" class=\"mainfieldsbg\"><b>". $loc["Author"]."</b></td>"
  1009. . "\n\t<td colspan=\"4\" class=\"mainfieldsbg\">"
  1010. . "\n\t\t" . fieldError("authorName", $errors) . "<input type=\"text\" id=\"authorName\" name=\"authorName\" value=\"$authorName\" size=\"60\" title=\"". $loc["DescriptionAuthor"]."\">" . $authorSuggestElements
  1011. . "\n\t</td>";
  1012. if ($isEditorCheckBox == "1" OR preg_match("/ *\(eds?\)$/", $authorName)) // if the '$isEditorCheckBox' variable is set to 1 -OR- if 'author' field ends with either " (ed)" or " (eds)"
  1013. $isEditorCheckBoxIsChecked = " checked"; // mark the 'is Editor' checkbox
  1014. else
  1015. $isEditorCheckBoxIsChecked = ""; // don't mark the 'is Editor' checkbox
  1016. echo "\n\t<td align=\"right\" class=\"mainfieldsbg\"><input type=\"checkbox\" id=\"isEditorCheckBox\" name=\"isEditorCheckBox\" value=\"1\"$isEditorCheckBoxIsChecked title=\"". $loc["DescriptionEditorCheckBox"]."\">&nbsp;&nbsp;<b>". $loc["isEditor"]."</b></td>"
  1017. . "\n</tr>"
  1018. . "\n<tr>"
  1019. . "\n\t<td width=\"74\" class=\"mainfieldsbg\"><b>". $loc["Title"]."</b></td>"
  1020. . "\n\t<td colspan=\"3\" class=\"mainfieldsbg\">"
  1021. . "\n\t\t" . fieldError("titleName", $errors) . "<input type=\"text\" id=\"titleName\" name=\"titleName\" value=\"$titleName\" size=\"47\" title=\"". $loc["DescriptionTitle"]."\">" . $titleSuggestElements
  1022. . "\n\t</td>"
  1023. . "\n\t<td width=\"74\" class=\"mainfieldsbg\"><b>". $loc["Type"]."</b></td>";
  1024. if (!isset($_SESSION['user_types']))
  1025. $documentTypeDisabled = " disabled"; // disable the type popup if the session variable holding the user's types isn't available
  1026. else
  1027. $documentTypeDisabled = "";
  1028. $recordType = "\n\t<td align=\"right\" class=\"mainfieldsbg\">"
  1029. . "\n\t\t<select id=\"typeName\" name=\"typeName\" title=\"". $loc["DescriptionType"]."\" $documentTypeDisabled>";
  1030. if (isset($_SESSION['user_types']))
  1031. {
  1032. $userTypesAvail = explode("; ", $_SESSION['user_types']);
  1033. $userTypesAvailInv = array_flip($userTypesAvail);
  1034. $localizedTypeName = array(
  1035. 'Journal Article' => $loc['typeJournal Article'],
  1036. 'Abstract' => $loc['typeAbstract'],
  1037. 'Book Chapter' => $loc['typeBook Chapter'],
  1038. 'Book Whole' => $loc['typeBook Whole'],
  1039. 'Conference Article' => $loc['typeConference Article'],
  1040. 'Conference Volume' => $loc['typeConference Volume'],
  1041. 'Journal' => $loc['typeJournal'],
  1042. 'Magazine Article' => $loc['typeMagazine Article'],
  1043. 'Manual' => $loc['typeManual'],
  1044. 'Manuscript' => $loc['typeManuscript'],
  1045. 'Map' => $loc['typeMap'],
  1046. 'Miscellaneous' => $loc['typeMiscellaneous'],
  1047. 'Newspaper Article' => $loc['typeNewspaper Article'],
  1048. 'Patent' => $loc['typePatent'],
  1049. 'Report' => $loc['typeReport'],
  1050. 'Software' => $loc['typeSoftware'],
  1051. );
  1052. $userTypesArray = array_intersect_key($localizedTypeName, $userTypesAvailInv);
  1053. $optionTags = buildSelectMenuOptions($userTypesArray, "//", "\t\t\t", true); // build properly formatted <option value=""> tag elements from the items listed in the 'user_types' session variable
  1054. $recordType .= $optionTags;
  1055. if ($recordAction == "edit" || $mode == "import") // for the edit (or import) record form, the current type is added to the drop down if it isn't one of the user's types
  1056. {
  1057. $userTypes = preg_split("/ *; */", $_SESSION['user_types']);
  1058. $optionPresent = false;
  1059. foreach ($userTypes as $userType)
  1060. {
  1061. if ($userType == $typeName)
  1062. {
  1063. $optionPresent = true;
  1064. }
  1065. }
  1066. if ($optionPresent != true)
  1067. {
  1068. $recordType .= "\n\t\t\t<option value=\"$typeName\" selected>$localizedTypeName[$typeName]</option>";
  1069. }
  1070. }
  1071. }
  1072. else
  1073. $recordType .= "<option>(no types available)</option>";
  1074. $recordType .= "\n\t\t</select>"
  1075. . "\n\t</td>";
  1076. if (!empty($typeName))
  1077. $recordType = preg_replace("/(value=\"$typeName\")/i", "\\1 selected", $recordType);
  1078. echo "$recordType"
  1079. . "\n</tr>"
  1080. . "\n<tr>"
  1081. . "\n\t<td width=\"74\" class=\"mainfieldsbg\"><b>". $loc["Year"]."</b></td>"
  1082. . "\n\t<td class=\"mainfieldsbg\">"
  1083. . "\n\t\t" . fieldError("yearNo", $errors) . "<input type=\"text\" id=\"yearNo\" name=\"yearNo\" value=\"$yearNo\" size=\"14\" title=\"". $loc["DescriptionYear"]."\">" . $yearSuggestElements
  1084. . "\n\t</td>"
  1085. . "\n\t<td width=\"74\" class=\"mainfieldsbg\"><b>". $loc["Publication"]."</b></td>"
  1086. . "\n\t<td class=\"mainfieldsbg\">"
  1087. . "\n\t\t" . fieldError("publicationName", $errors) . "<input type=\"text\" id=\"publicationName\" name=\"publicationName\" value=\"$publicationName\" size=\"14\" title=\"". $loc["DescriptionPublicationName"]."\">" . $publicationSuggestElements
  1088. . "\n\t</td>"
  1089. . "\n\t<td width=\"74\" class=\"mainfieldsbg\"><b>". $loc["JournalAbbr"]."</b></td>"
  1090. . "\n\t<td align=\"right\" class=\"mainfieldsbg\">"
  1091. . "\n\t\t" . fieldError("abbrevJournalName", $errors) . "<input type=\"text\" id=\"abbrevJournalName\" name=\"abbrevJournalName\" value=\"$abbrevJournalName\" size=\"14\" title=\"". $loc["DescriptionJournalAbbr"]."\">" . $abbrevJournalSuggestElements
  1092. . "\n\t</td>"
  1093. . "\n</tr>"
  1094. . "\n<tr>"
  1095. . "\n\t<td width=\"74\" class=\"mainfieldsbg\"><b>". $loc["Volume"]."</b></td>"
  1096. . "\n\t<td class=\"mainfieldsbg\">"
  1097. . "\n\t\t" . fieldError("volumeNo", $errors) . "<input type=\"text\" id=\"volumeNo\" name=\"volumeNo\" value=\"$volumeNo\" size=\"14\" title=\"". $loc["DescriptionVolume"]."\">" . $volumeSuggestElements
  1098. . "\n\t</td>"
  1099. . "\n\t<td width=\"74\" class=\"mainfieldsbg\"><b>". $loc["Issue"]."</b></td>"
  1100. . "\n\t<td class=\"mainfieldsbg\">"
  1101. . "\n\t\t<input type=\"text\" id=\"issueNo\" name=\"issueNo\" value=\"$issueNo\" size=\"14\" title=\"". $loc["DescriptionIssue"]."\">" . $issueSuggestElements
  1102. . "\n\t</td>"
  1103. . "\n\t<td width=\"74\" class=\"mainfieldsbg\"><b>". $loc["Pages"]."</b></td>"
  1104. . "\n\t<td align=\"right\" class=\"mainfieldsbg\">"
  1105. . "\n\t\t" . fieldError("pagesNo", $errors) . "<input type=\"text\" id=\"pagesNo\" name=\"pagesNo\" value=\"$pagesNo\" size=\"14\" title=\"". $loc["DescriptionPages"]."\">" . $pagesSuggestElements
  1106. . "\n\t</td>"
  1107. . "\n</tr>"
  1108. . "\n<tr>"
  1109. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Keywords"]."</b></td>"
  1110. . "\n\t<td colspan=\"5\" class=\"otherfieldsbg\">"
  1111. . "\n\t\t<input type=\"text\" id=\"keywordsName\" name=\"keywordsName\" value=\"$keywordsName\" size=\"84\" title=\"". $loc["DescriptionKeywords"]."\">" . $keywordsSuggestElements
  1112. . "\n\t</td>"
  1113. . "\n</tr>"
  1114. . "\n<tr>"
  1115. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Abstract"]."</b></td>"
  1116. . "\n\t<td colspan=\"5\" class=\"otherfieldsbg\"><textarea id=\"abstractName\" name=\"abstractName\" rows=\"6\" cols=\"83\" title=\"". $loc["DescriptionAbstract"]."\">$abstractName</textarea></td>"
  1117. . "\n</tr>"
  1118. . "\n<tr>"
  1119. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Address"]."</b></td>"
  1120. . "\n\t<td colspan=\"5\" class=\"otherfieldsbg\">"
  1121. . "\n\t\t<input type=\"text\" id=\"addressName\" name=\"addressName\" value=\"$addressName\" size=\"84\" title=\"". $loc["DescriptionAdress"]."\">" . $addressSuggestElements
  1122. . "\n\t</td>"
  1123. . "\n</tr>"
  1124. . "\n<tr>"
  1125. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["CorporateAuthor"]."</b></td>"
  1126. . "\n\t<td colspan=\"3\" class=\"otherfieldsbg\">"
  1127. . "\n\t\t<input type=\"text\" id=\"corporateAuthorName\" name=\"corporateAuthorName\" value=\"$corporateAuthorName\" size=\"47\" title=\"". $loc["DescriptionCorporate"]."\">" . $corporateAuthorSuggestElements
  1128. . "\n\t</td>"
  1129. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Thesis"]."</b></td>";
  1130. $thesisType = "\n\t<td align=\"right\" class=\"otherfieldsbg\">\n\t\t<select id=\"thesisName\" name=\"thesisName\" title=\"". $loc["DescriptionThesis"]."\">\n\t\t\t<option></option>\n\t\t\t<option value=\"Bachelor's thesis\">" . $loc["Bachelor's thesis"] . "</option>\n\t\t\t<option value=\"Master's thesis\">" . $loc["Master's thesis"] . "</option>\n\t\t\t<option value=\"Ph.D. thesis\">" . $loc["Ph.D. thesis"] . "</option>\n\t\t\t<option value=\"Diploma thesis\">" . $loc["Diploma thesis"] . "</option>\n\t\t\t<option value=\"Doctoral thesis\">" . $loc["Doctoral thesis"] . "</option>\n\t\t\t<option value=\"Habilitation thesis\">" . $loc["Habilitation thesis"] . "</option>\n\t\t</select>\n\t</td>";
  1131. if (!empty($thesisName))
  1132. $thesisType = preg_replace("/<option (value=\"" . $thesisName . "\")>/", "<option \\1 selected>", $thesisType);
  1133. echo "$thesisType"
  1134. . "\n</tr>"
  1135. . "\n<tr>"
  1136. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Publisher"]."</b></td>"
  1137. . "\n\t<td class=\"otherfieldsbg\">"
  1138. . "\n\t\t<input type=\"text\" id=\"publisherName\" name=\"publisherName\" value=\"$publisherName\" size=\"14\" title=\"". $loc["DescriptionPublisher"]."\">" . $publisherSuggestElements
  1139. . "\n\t</td>"
  1140. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["PublisherPlace"]."</b></td>"
  1141. . "\n\t<td class=\"otherfieldsbg\">"
  1142. . "\n\t\t<input type=\"text\" id=\"placeName\" name=\"placeName\" value=\"$placeName\" size=\"14\" title=\"". $loc["DescriptionPublisherPlace"]."\">" . $placeSuggestElements
  1143. . "\n\t</td>"
  1144. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Editor"]."</b></td>"
  1145. . "\n\t<td align=\"right\" class=\"otherfieldsbg\">"
  1146. . "\n\t\t<input type=\"text\" id=\"editorName\" name=\"editorName\" value=\"$editorName\" size=\"14\" title=\"". $loc["DescriptionEditor"]."\">" . $editorSuggestElements
  1147. . "\n\t</td>"
  1148. . "\n</tr>"
  1149. . "\n<tr>"
  1150. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Language"]."</b></td>"
  1151. . "\n\t<td class=\"otherfieldsbg\">"
  1152. . "\n\t\t" . fieldError("languageName", $errors) . "<input type=\"text\" id=\"languageName\" name=\"languageName\" value=\"$languageName\" size=\"14\" title=\"". $loc["DescriptionLanguage"]."\">" . $languageSuggestElements
  1153. . "\n\t</td>"
  1154. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["LanguageSummary"]."</b></td>"
  1155. . "\n\t<td class=\"otherfieldsbg\">"
  1156. . "\n\t\t<input type=\"text\" id=\"summaryLanguageName\" name=\"summaryLanguageName\" value=\"$summaryLanguageName\" size=\"14\" title=\"". $loc["DescriptionLanguageSummary"]."\">" . $summaryLanguageSuggestElements
  1157. . "\n\t</td>"
  1158. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["TitleOriginal"]."</b></td>"
  1159. . "\n\t<td align=\"right\" class=\"otherfieldsbg\">"
  1160. . "\n\t\t<input type=\"text\" id=\"origTitleName\" name=\"origTitleName\" value=\"$origTitleName\" size=\"14\" title=\"". $loc["DescriptionTitleOriginal"]."\">" . $origTitleSuggestElements
  1161. . "\n\t</td>"
  1162. . "\n</tr>"
  1163. . "\n<tr>"
  1164. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["SeriesEditor"]."</b></td>"
  1165. . "\n\t<td class=\"otherfieldsbg\">"
  1166. . "\n\t\t<input type=\"text\" id=\"seriesEditorName\" name=\"seriesEditorName\" value=\"$seriesEditorName\" size=\"14\" title=\"". $loc["DescriptionSeriesEditor"]."\">" . $seriesEditorSuggestElements
  1167. . "\n\t</td>"
  1168. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["TitleSeries"]."</b></td>"
  1169. . "\n\t<td class=\"otherfieldsbg\">"
  1170. . "\n\t\t<input type=\"text\" id=\"seriesTitleName\" name=\"seriesTitleName\" value=\"$seriesTitleName\" size=\"14\" title=\"". $loc["DescriptionTitleSeries"]."\">" . $seriesTitleSuggestElements
  1171. . "\n\t</td>"
  1172. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["TitleSeriesAbbr"]."</b></td>"
  1173. . "\n\t<td align=\"right\" class=\"otherfieldsbg\">"
  1174. . "\n\t\t<input type=\"text\" id=\"abbrevSeriesTitleName\" name=\"abbrevSeriesTitleName\" value=\"$abbrevSeriesTitleName\" size=\"14\" title=\"". $loc["DescriptionTitleSeriesAbbr"]."\">" . $abbrevSeriesTitleSuggestElements
  1175. . "\n\t</td>"
  1176. . "\n</tr>"
  1177. . "\n<tr>"
  1178. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["SeriesVolume"]."</b></td>"
  1179. . "\n\t<td class=\"otherfieldsbg\">"
  1180. . "\n\t\t<input type=\"text\" id=\"seriesVolumeNo\" name=\"seriesVolumeNo\" value=\"$seriesVolumeNo\" size=\"14\" title=\"". $loc["DescriptionSeriesVolume"]."\">" . $seriesVolumeSuggestElements
  1181. . "\n\t</td>"
  1182. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["SeriesIssue"]."</b></td>"
  1183. . "\n\t<td class=\"otherfieldsbg\">"
  1184. . "\n\t\t<input type=\"text\" id=\"seriesIssueNo\" name=\"seriesIssueNo\" value=\"$seriesIssueNo\" size=\"14\" title=\"". $loc["DescriptionSeriesIssue"]."\">" . $seriesIssueSuggestElements
  1185. . "\n\t</td>"
  1186. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Edition"]."</b></td>"
  1187. . "\n\t<td align=\"right\" class=\"otherfieldsbg\">"
  1188. . "\n\t\t<input type=\"text\" id=\"editionNo\" name=\"editionNo\" value=\"$editionNo\" size=\"14\" title=\"". $loc["DescriptionEdition"]."\">" . $editionSuggestElements
  1189. . "\n\t</td>"
  1190. . "\n</tr>"
  1191. . "\n<tr>"
  1192. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["ISSN"]."</b></td>"
  1193. . "\n\t<td class=\"otherfieldsbg\">"
  1194. . "\n\t\t<input type=\"text\" id=\"issnName\" name=\"issnName\" value=\"$issnName\" size=\"14\" title=\"". $loc["DescriptionISSN"]."\">" . $issnSuggestElements
  1195. . "\n\t</td>"
  1196. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["ISBN"]."</b></td>"
  1197. . "\n\t<td class=\"otherfieldsbg\">"
  1198. . "\n\t\t<input type=\"text\" id=\"isbnName\" name=\"isbnName\" value=\"$isbnName\" size=\"14\" title=\"". $loc["DescriptionISBN"]."\">" . $isbnSuggestElements
  1199. . "\n\t</td>"
  1200. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Medium"]."</b></td>"
  1201. . "\n\t<td align=\"right\" class=\"otherfieldsbg\">"
  1202. . "\n\t\t<input type=\"text\" id=\"mediumName\" name=\"mediumName\" value=\"$mediumName\" size=\"14\" title=\"". $loc["DescriptionMedium"]."\">" . $mediumSuggestElements
  1203. . "\n\t</td>"
  1204. . "\n</tr>"
  1205. . "\n<tr>"
  1206. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Area"]."</b></td>"
  1207. . "\n\t<td class=\"otherfieldsbg\">"
  1208. . "\n\t\t<input type=\"text\" id=\"areaName\" name=\"areaName\" value=\"$areaName\" size=\"14\" title=\"". $loc["DescriptionArea"]."\">" . $areaSuggestElements
  1209. . "\n\t</td>"
  1210. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Expedition"]."</b></td>"
  1211. . "\n\t<td class=\"otherfieldsbg\">"
  1212. . "\n\t\t<input type=\"text\" id=\"expeditionName\" name=\"expeditionName\" value=\"$expeditionName\" size=\"14\" title=\"". $loc["DescriptionExpedition"]."\">" . $expeditionSuggestElements
  1213. . "\n\t</td>"
  1214. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Conference"]."</b></td>"
  1215. . "\n\t<td align=\"right\" class=\"otherfieldsbg\">"
  1216. . "\n\t\t<input type=\"text\" id=\"conferenceName\" name=\"conferenceName\" value=\"$conferenceName\" size=\"14\" title=\"". $loc["DescriptionConference"]."\">" . $conferenceSuggestElements
  1217. . "\n\t</td>"
  1218. . "\n</tr>"
  1219. . "\n<tr>"
  1220. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Notes"]."</b></td>"
  1221. . "\n\t<td colspan=\"3\" class=\"otherfieldsbg\">"
  1222. . "\n\t\t<input type=\"text\" id=\"notesName\" name=\"notesName\" value=\"$notesName\" size=\"47\" title=\"". $loc["DescriptionNotes"]."\">" . $notesSuggestElements
  1223. . "\n\t</td>"
  1224. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Approved"]."</b></td>";
  1225. $approved = "\n\t<td align=\"right\" class=\"otherfieldsbg\"><input type=\"radio\" id=\"approvedRadioA\" name=\"approvedRadio\" value=\"yes\" title=\"". $loc["DescriptionApproved"]."\">&nbsp;&nbsp;". $loc["yes"]."&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"radio\" id=\"approvedRadioB\" name=\"approvedRadio\" value=\"no\" title=\"". $loc["DescriptionApproved"]."\">&nbsp;&nbsp;". $loc["no"]."</td>";
  1226. if ($approvedRadio == "yes")
  1227. $approved = preg_replace("/name=\"approvedRadio\" value=\"yes\"/", "name=\"approvedRadio\" value=\"yes\" checked", $approved);
  1228. else // ($approvedRadio == "no")
  1229. $approved = preg_replace("/name=\"approvedRadio\" value=\"no\"/", "name=\"approvedRadio\" value=\"no\" checked", $approved);
  1230. echo "$approved"
  1231. . "\n</tr>"
  1232. . "\n<tr>"
  1233. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["Location"]."</b></td>"
  1234. . "\n\t<td colspan=\"5\" class=\"otherfieldsbg\">"
  1235. . "\n\t\t<input type=\"text\" id=\"locationName\" name=\"locationName\" value=\"$locationName\" size=\"84\" title=\"". $loc["DescriptionLocation"]."$fieldLockLabel\"$fieldLock>" . $locationSuggestElements
  1236. . "\n\t</td>"
  1237. . "\n</tr>"
  1238. . "\n<tr>"
  1239. . "\n\t<td width=\"74\" class=\"mainfieldsbg\"><b>". $loc["CallNumber"]."</b></td>";
  1240. // if the user isn't logged in -OR- any normal user is logged in (not the admin)...
  1241. if ((!isset($loginEmail)) OR ((isset($loginEmail)) AND ($loginEmail != $adminLoginEmail)))
  1242. {
  1243. // ...we just show the user's own call number (if any):
  1244. echo "\n\t<td colspan=\"3\" class=\"mainfieldsbg\">"
  1245. . "\n\t\t" . fieldError("callNumberNameUserOnly", $errors) . "<input type=\"text\" id=\"callNumberNameUserOnly\" name=\"callNumberNameUserOnly\" value=\"$callNumberNameUserOnly\" size=\"47\" title=\"". $loc["DescriptionCallNumber"]."\">" . $callNumberSuggestElements
  1246. . "\n\t</td>";
  1247. }
  1248. else // if the admin is logged in...
  1249. {
  1250. // ...we display the full contents of the 'call_number' field:
  1251. echo "\n\t<td colspan=\"3\" class=\"mainfieldsbg\">"
  1252. . "\n\t\t<input type=\"text\" id=\"callNumberName\" name=\"callNumberName\" value=\"$callNumberName\" size=\"47\" title=\"". $loc["DescriptionCallNumberFull"]."\">" . $callNumberSuggestElements
  1253. . "\n\t</td>";
  1254. }
  1255. echo "\n\t<td width=\"74\" class=\"mainfieldsbg\"><b>". $loc["Serial"]."</b></td>"
  1256. . "\n\t<td align=\"right\" class=\"mainfieldsbg\"><input type=\"text\" id=\"serialNo\" name=\"serialNo\" value=\"$serialNo\" size=\"14\" title=\"". $loc["DescriptionSerial"]."\" readonly></td>"
  1257. . "\n</tr>"
  1258. . "\n<tr>"
  1259. . "\n\t<td width=\"74\" class=\"userfieldsbg\"><b>". $loc["Marked"]."</b></td>";
  1260. $marked = "\n\t<td class=\"userfieldsbg\"><input type=\"radio\" id=\"markedRadioA\" name=\"markedRadio\" value=\"yes\" title=\"". $loc["DescriptionMarked"]."\">&nbsp;&nbsp;". $loc["yes"]."&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"radio\" id=\"markedRadioB\" name=\"markedRadio\" value=\"no\" title=\"". $loc["DescriptionMarked"]."\">&nbsp;&nbsp;". $loc["no"]."</td>";
  1261. if ($markedRadio == "yes")
  1262. $marked = preg_replace("/name=\"markedRadio\" value=\"yes\"/", "name=\"markedRadio\" value=\"yes\" checked", $marked);
  1263. else // ($markedRadio == "no")
  1264. $marked = preg_replace("/name=\"markedRadio\" value=\"no\"/", "name=\"markedRadio\" value=\"no\" checked", $marked);
  1265. echo "$marked"
  1266. . "\n\t<td width=\"74\" class=\"userfieldsbg\"><b>". $loc["Copy"]."</b></td>";
  1267. $copy = "\n\t<td class=\"userfieldsbg\">\n\t\t<select id=\"copyName\" name=\"copyName\" title=\"". $loc["DescriptionCopy"]."\">\n\t\t\t<option value=\"true\">". $loc["true"]."</option>\n\t\t\t<option value=\"fetch\">". $loc["fetch"]."</option>\n\t\t\t<option value=\"ordered\">". $loc["ordered"]."</option>\n\t\t\t<option value=\"false\">". $loc["false"]."</option>\n\t\t</select>\n\t</td>";
  1268. if (!empty($copyName))
  1269. $copy = preg_replace("/<option(.*?)>" . $loc[$copyName] . "/", "<option\\1 selected>" . $loc[$copyName], $copy);
  1270. echo "$copy"
  1271. . "\n\t<td width=\"74\" class=\"userfieldsbg\"><b>". $loc["Selected"]."</b></td>";
  1272. $selected = "\n\t<td align=\"right\" class=\"userfieldsbg\"><input type=\"radio\" id=\"selectedRadioA\" name=\"selectedRadio\" value=\"yes\" title=\"". $loc["DescriptionSelected"]."\">&nbsp;&nbsp;". $loc["yes"]."&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"radio\" id=\"selectedRadioB\" name=\"selectedRadio\" value=\"no\" title=\"". $loc["DescriptionSelected"]."\">&nbsp;&nbsp;". $loc["no"]."</td>";
  1273. if ($selectedRadio == "yes")
  1274. $selected = preg_replace("/name=\"selectedRadio\" value=\"yes\"/", "name=\"selectedRadio\" value=\"yes\" checked", $selected);
  1275. else // ($selectedRadio == "no")
  1276. $selected = preg_replace("/name=\"selectedRadio\" value=\"no\"/", "name=\"selectedRadio\" value=\"no\" checked", $selected);
  1277. echo "$selected"
  1278. . "\n</tr>"
  1279. . "\n<tr>"
  1280. . "\n\t<td width=\"74\" class=\"userfieldsbg\"><b>". $loc["UserKeys"]."</b></td>"
  1281. . "\n\t<td colspan=\"5\" class=\"userfieldsbg\">"
  1282. . "\n\t\t<input type=\"text\" id=\"userKeysName\" name=\"userKeysName\" value=\"$userKeysName\" size=\"84\" title=\"". $loc["DescriptionUserKeys"]."\">" . $userKeysSuggestElements
  1283. . "\n\t</td>"
  1284. . "\n</tr>"
  1285. . "\n<tr>"
  1286. . "\n\t<td width=\"74\" class=\"userfieldsbg\"><b>". $loc["UserNotes"]."</b></td>"
  1287. . "\n\t<td colspan=\"3\" class=\"userfieldsbg\">"
  1288. . "\n\t\t<input type=\"text\" id=\"userNotesName\" name=\"userNotesName\" value=\"$userNotesName\" size=\"47\" title=\"". $loc["DescriptionUserNotes"]."\">" . $userNotesSuggestElements
  1289. . "\n\t</td>"
  1290. . "\n\t<td width=\"74\" class=\"userfieldsbg\"><b>". $loc["UserFile"]."</b></td>"
  1291. . "\n\t<td align=\"right\" class=\"userfieldsbg\">"
  1292. . "\n\t\t<input type=\"text\" id=\"userFileName\" name=\"userFileName\" value=\"$userFileName\" size=\"14\" title=\"". $loc["DescriptionUserFile"]."\">" . $userFileSuggestElements
  1293. . "\n\t</td>"
  1294. . "\n</tr>"
  1295. . "\n<tr>"
  1296. . "\n\t<td width=\"74\" class=\"userfieldsbg\"><b>". $loc["UserGroups"]."</b></td>";
  1297. if (isset($_SESSION['user_permissions']) AND preg_match("/allow_user_groups/", $_SESSION['user_permissions'])) // if the 'user_permissions' session variable contains 'allow_user_groups'...
  1298. // adjust the title string for the user groups text entry field:
  1299. {
  1300. $userGroupsFieldLock = "";
  1301. $userGroupsTitle = $loc["DescriptionUserGroups"];
  1302. }
  1303. else
  1304. {
  1305. $userGroupsFieldLock = " disabled"; // it would be more consistent to remove the user groups field completely from the form if the user has no permission to use the user groups feature; but since this would complicate the processing quite a bit, we just disable the field (for now)
  1306. $userGroupsTitle = $loc["NoPermission"] . $loc["NoPermission_ForUserGroups"];
  1307. }
  1308. echo "\n\t<td colspan=\"3\" class=\"userfieldsbg\">"
  1309. . "\n\t\t<input type=\"text\" id=\"userGroupsName\" name=\"userGroupsName\" value=\"$userGroupsName\" size=\"47\"$userGroupsFieldLock title=\"$userGroupsTitle\">" . $userGroupsSuggestElements
  1310. . "\n\t</td>"
  1311. . "\n\t<td width=\"74\" class=\"userfieldsbg\"><b>". $loc["CiteKey"]."</b></td>"
  1312. . "\n\t<td align=\"right\" class=\"userfieldsbg\">"
  1313. . "\n\t\t<input type=\"text\" id=\"citeKeyName\" name=\"citeKeyName\" value=\"$citeKeyName\" size=\"14\" title=\"". $loc["DescriptionCiteKey"]."\">" . $citeKeySuggestElements
  1314. . "\n\t</td>"
  1315. . "\n</tr>"
  1316. . "\n<tr>"
  1317. . "\n\t<td width=\"74\" class=\"userfieldsbg\"><b>". $loc["Related"]."</b></td>"
  1318. . "\n\t<td colspan=\"5\" class=\"userfieldsbg\">"
  1319. . "\n\t\t<input type=\"text\" id=\"relatedName\" name=\"relatedName\" value=\"$relatedName\" size=\"84\" title=\"". $loc["DescriptionRelated"]."\">" . $relatedSuggestElements
  1320. . "\n\t</td>"
  1321. . "\n</tr>"
  1322. . "\n<tr>"
  1323. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["File"]."</b></td>"
  1324. . "\n\t<td colspan=\"3\" class=\"otherfieldsbg\"><input type=\"text\" id=\"fileName\" name=\"fileName\" value=\"$fileName\" size=\"47\" title=\"". $loc["DescriptionFile"]."\"$fieldLock></td>";
  1325. if (isset($_SESSION['user_permissions']) AND preg_match("/allow_upload/", $_SESSION['user_permissions'])) // if the 'user_permissions' session variable contains 'allow_upload'...
  1326. // adjust the title string for the upload button:
  1327. {
  1328. $uploadButtonLock = "";
  1329. $uploadTitle = $loc["DescriptionFileUpload"];
  1330. }
  1331. else
  1332. {
  1333. $uploadButtonLock = " disabled"; // disabling of the upload button doesn't seem to work in all browsers (e.g., it doesn't work in Safari on MacOSX Panther, but does work with Mozilla & Camino) ?:-/
  1334. $uploadTitle = $loc["NoPermission"] . $loc["NoPermission_ForFileUpload"]; // similarily, not all browsers will show title strings for disabled buttons (Safari does, Mozilla & Camino do not)
  1335. }
  1336. echo "\n\t<td valign=\"bottom\" colspan=\"2\" class=\"otherfieldsbg\">" . fieldError("uploadFile", $errors) . "<input type=\"file\" id=\"uploadFile\" name=\"uploadFile\" size=\"17\"$uploadButtonLock title=\"$uploadTitle\"></td>"
  1337. . "\n</tr>"
  1338. . "\n<tr>"
  1339. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["URL"]."</b></td>"
  1340. . "\n\t<td colspan=\"3\" class=\"otherfieldsbg\">"
  1341. . "\n\t\t<input type=\"text\" id=\"urlName\" name=\"urlName\" value=\"$urlName\" size=\"47\" title=\"". $loc["DescriptionURL"]."\">" . $urlSuggestElements
  1342. . "\n\t</td>"
  1343. . "\n\t<td width=\"74\" class=\"otherfieldsbg\"><b>". $loc["DOI"]."</b></td>"
  1344. . "\n\t<td align=\"right\" class=\"otherfieldsbg\">"
  1345. . "\n\t\t<input type=\"text\" id=\"doiName\" name=\"doiName\" value=\"$doiName\" size=\"14\" title=\"". $loc["DescriptionDOI"]."\">" . $doiSuggestElements
  1346. . "\n\t</td>"
  1347. . "\n</tr>";
  1348. if ($onlinePublication == "yes") // if the 'online_publication' field value is "yes"
  1349. $onlinePublicationCheckBoxIsChecked = " checked"; // mark the 'Online publication' checkbox
  1350. else
  1351. $onlinePublicationCheckBoxIsChecked = ""; // don't mark the 'Online publication' checkbox
  1352. echo "\n<tr>"
  1353. . "\n\t<td width=\"74\" class=\"otherfieldsbg\">&nbsp;</td>"
  1354. . "\n\t<td colspan=\"3\" class=\"otherfieldsbg\">\n\t\t<input type=\"checkbox\" id=\"onlinePublicationCheckBox\" name=\"onlinePublicationCheckBox\" value=\"1\"$onlinePublicationCheckBoxIsChecked title=\"". $loc["DescriptionOnlinePublicationCheckbox"]."\">&nbsp;"
  1355. . "\n\t\t". $loc["Online publication. Cite with this text:"]."&nbsp;"
  1356. . "\n\t\t<input type=\"text\" id=\"onlineCitationName\" name=\"onlineCitationName\" value=\"$onlineCitationName\" size=\"7\" title=\"". $loc["DescriptionOnlinePublicationCitation"]."\">" . $onlineCitationSuggestElements
  1357. . "\n\t</td>";
  1358. if (isset($loginEmail)) // if a user is logged in...
  1359. {
  1360. // ...we'll show a checkbox where the user can state that the current publication stems form his own institution
  1361. if ($contributionIDCheckBox == "1" OR preg_match("/$abbrevInstitution/", $contributionID)) // if the '$contributionIDCheckBox' variable is set to 1 -OR- if the currrent user's abbreviated institution name is listed within the 'contribution_id' field
  1362. $contributionIDCheckBoxIsChecked = " checked";
  1363. else
  1364. $contributionIDCheckBoxIsChecked = "";
  1365. if ($origRecord > 0) // if the current record has been identified as duplicate entry...
  1366. $contributionIDCheckBoxLock = " disabled"; // ...we lock the check box (since the original entry, and not the dup entry, should be marked instead)
  1367. else
  1368. $contributionIDCheckBoxLock = "";
  1369. echo "\n\t<td colspan=\"2\" class=\"otherfieldsbg\">\n\t\t<input type=\"checkbox\" id=\"contributionIDCheckBox\" name=\"contributionIDCheckBox\" value=\"1\"$contributionIDCheckBoxIsChecked title=\"". $loc["DescriptionOwnPublication"]."\"$contributionIDCheckBoxLock>&nbsp;"
  1370. . "\n\t\t". encodeHTML($abbrevInstitution) . " " . $loc["publication"] . "\n\t</td>"; // we make use of the session variable '$abbrevInstitution' here
  1371. }
  1372. else
  1373. {
  1374. echo "\n\t<td colspan=\"2\" class=\"otherfieldsbg\">&nbsp;</td>";
  1375. }
  1376. echo "\n</tr>"
  1377. . "\n<tr>"
  1378. . "\n\t<td width=\"74\">&nbsp;</td>"
  1379. . "\n\t<td colspan=\"5\">&nbsp;</td>"
  1380. . "\n</tr>";
  1381. echo "\n<tr>"
  1382. . "\n\t<td width=\"74\">". $loc["Location Field"].":</td>";
  1383. $locationSelector = "\n\t<td colspan=\"3\">\n\t\t<select id=\"locationSelectorName\" name=\"locationSelectorName\" title=\"". $loc["DescriptionLocationSelector"]."\">\n\t\t\t<option value=\"don't touch\">". $loc["don't touch"]."</option>\n\t\t\t<option value=\"add\">". $loc["add"]."</option>\n\t\t\t<option value=\"remove\">". $loc["remove"]."</option>\n\t\t</select>&nbsp;&nbsp;\n\t\t". $loc["my name & email address"]."\n\t</td>";
  1384. if ($recordAction == "edit" AND !empty($locationSelectorName))
  1385. $locationSelector = preg_replace("/<option(.*?)>" . $loc[$locationSelectorName] . "/", "<option\\1 selected>" . $loc[$locationSelectorName], $locationSelector);
  1386. elseif ($recordAction == "add")
  1387. {
  1388. $locationSelector = preg_replace("/<option(.*?)>" . $loc["add"] . "/", "<option\\1 selected>" . $loc["add"], $locationSelector); // select the appropriate menu entry ...
  1389. if ((!isset($loginEmail)) OR ((isset($loginEmail)) AND ($loginEmail != $adminLoginEmail))) // ... and if the user isn't logged in -OR- any normal user is logged in (not the admin) ...
  1390. $locationSelector = preg_replace("/<select/i", "<select disabled", $locationSelector); // ... disable the popup menu. This is, since the current user & email address will be always written to the location field when adding new records. An orphaned record would be produced if the user could chose anything other than 'add'! (Note that the admin is permitted to override this behaviour)
  1391. }
  1392. echo "$locationSelector"
  1393. . "\n\t<td align=\"right\" colspan=\"2\">";
  1394. // Note that, normally, we don't show interface items which the user isn't allowed to use (see the delete button). But, in the case of the add/edit button we make an exception here and just grey the button out.
  1395. // This is, since otherwise the form would have no submit button at all, which would be pretty odd. The title string of the button explains why it is disabled.
  1396. if ($recordAction == "edit") // adjust the title string for the edit button
  1397. {
  1398. if (isset($_SESSION['user_permissions']) AND preg_match("/allow_edit/", $_SESSION['user_permissions'])) // if the 'user_permissions' session variable contains 'allow_edit'...
  1399. {
  1400. $addEditButtonLock = "";
  1401. $addEditTitle = $loc["DescriptionEditButton"];
  1402. }
  1403. else
  1404. {
  1405. $addEditButtonLock = " disabled";
  1406. $addEditTitle = $loc["NoPermission"] . $loc["NoPermission_ForEditRecords"];
  1407. }
  1408. }
  1409. else // if ($recordAction == "add") // adjust the title string for the add button
  1410. {
  1411. if (isset($_SESSION['user_permissions']) AND preg_match("/allow_add/", $_SESSION['user_permissions'])) // if the 'user_permissions' session variable contains 'allow_add'...
  1412. {
  1413. $addEditButtonLock = "";
  1414. $addEditTitle = $loc["DescriptionAddButton"];
  1415. }
  1416. else
  1417. {
  1418. $addEditButtonLock = " disabled";
  1419. $addEditTitle = $loc["NoPermission"] . $loc["NoPermission_ForAddRecords"];
  1420. }
  1421. }
  1422. // display an ADD/EDIT button:
  1423. echo "<input type=\"submit\" name=\"submit\" value=\"$addEditButtonTitle\"$addEditButtonLock title=\"$addEditTitle\">";
  1424. if (isset($_SESSION['user_permissions']) AND preg_match("/allow_delete/", $_SESSION['user_permissions'])) // if the 'user_permissions' session variable contains 'allow_delete'...
  1425. // ... display a delete button:
  1426. {
  1427. if ($recordAction == "edit") // add a DELETE button (CAUTION: the delete button must be displayed *AFTER* the edit button, otherwise DELETE will be the default action if the user hits return!!)
  1428. // (this is since the first displayed submit button represents the default submit action in several browsers!! [like OmniWeb or Mozilla])
  1429. {
  1430. if (!isset($loginEmail) OR ((!preg_match("/" . $loginEmail . "/", $locationName) OR preg_match("/;/", $rawLocationName)) AND ($loginEmail != $adminLoginEmail))) // if the user isn't logged in -OR- any normal user is logged in & the 'location' field doesn't list her email address -OR- if the 'location' field contains more than one user (which is indicated by a semicolon character)...
  1431. // Note that we use '$rawLocationName' instead of the '$locationName' variable for those tests that check for the existence of a semicolon since for '$locationName' high ASCII characters were converted into HTML entities.
  1432. // E.g., the german umlaut '�' would be presented as '&uuml;', thus containing a semicolon character *within* the user's name!
  1433. {
  1434. // build an informative title string:
  1435. if (!isset($loginEmail)) // if the user isn't logged in
  1436. $deleteTitle = $loc["DescriptionDeleteButtonDisabled"] . $loc["DescriptionDeleteButtonDisabledNotLoggedIn"];
  1437. elseif (!preg_match("/" . $loginEmail . "/", $locationName)) // if any normal user is logged in & the 'location' field doesn't list her email address
  1438. $deleteTitle = $loc["DescriptionDeleteButtonDisabled"] . $loc["DescriptionDeleteButtonDisabledNotYours"];
  1439. elseif (preg_match("/;/", $rawLocationName)) // if the 'location' field contains more than one user (which is indicated by a semicolon character)
  1440. {
  1441. // if we made it here, the current user is listed within the 'location' field of this record
  1442. if (preg_match("/^[^;]+;[^;]+$/", $rawLocationName)) // the 'location' field does contain exactly one ';' => two authors, i.e., there's only one "other user" listed within the 'location' field
  1443. $deleteTitle = $loc["DescriptionDeleteButtonDisabled"] . $loc["DescriptionDeleteButtonDisabledOtherUser"];
  1444. elseif (preg_match("/^[^;]+;[^;]+;[^;]+/", $rawLocationName)) // the 'location' field does contain at least two ';' => more than two authors, i.e., there are two or more "other users" listed within the 'location' field
  1445. $deleteTitle = $loc["DescriptionDeleteButtonDisabled"] . $loc["DescriptionDeleteButtonDisabledOtherUsers"];
  1446. }
  1447. $deleteButtonLock = " disabled"; // ...we lock the delete button (since a normal user shouldn't be allowed to delete records that belong to other users)
  1448. }
  1449. else
  1450. {
  1451. $deleteTitle = $loc["DescriptionDeleteButton"];
  1452. $deleteButtonLock = "";
  1453. }
  1454. echo "&nbsp;&nbsp;&nbsp;<input type=\"submit\" name=\"submit\" value=\"" . $loc["ButtonTitle_DeleteRecord"] . "\"$deleteButtonLock title=\"$deleteTitle\">";
  1455. }
  1456. }
  1457. echo "</td>"
  1458. . "\n</tr>"
  1459. . "\n</table>"
  1460. . "\n</form>";
  1461. // (5) CLOSE the database connection:
  1462. disconnectFromMySQLDatabase(); // function 'disconnectFromMySQLDatabase()' is defined in 'include.inc.php'
  1463. // --------------------------------------------------------------------
  1464. // SHOW ERROR IN RED:
  1465. function fieldError($fieldName, $errors)
  1466. {
  1467. if (isset($errors[$fieldName]))
  1468. return "<b><span class=\"warning2\">" . $errors[$fieldName] . "</span></b><br>";
  1469. }
  1470. // --------------------------------------------------------------------
  1471. // DISPLAY THE HTML FOOTER:
  1472. // call the 'showPageFooter()' and 'displayHTMLfoot()' functions (which are defined in 'footer.inc.php')
  1473. showPageFooter($HeaderString);
  1474. displayHTMLfoot();
  1475. // --------------------------------------------------------------------
  1476. ?>