Documentation:
Paper Management Script - la bibliothèque
Contents
I. Overview II. Other Notes
Last documentation revision: 24 July 2003, Thursday
Last script revision: 24 July 2003, Thursday
©S. Shyu 2003, all rights reserved.

 - - - - - -
I. Overview
This script is written for the purpose of managing papers using a MySQL database (version 4 or higher as of this revision) and displaying them by an assigned category. One is also able to manage categories within the script, adding and deleting them as desired. A simple user authentication and management system is also in place - however, any user may delete any other users - there is no advanced system of setting permissions between users as of yet. Note that this is not designed to be an index of papers that may be searched by detailed fields beyond the paper's category or arbitrarily assigned ID number (that is, bibliographical information, such as publication, publication date, authors, etc. are stored together in a single field and thus it is not possible to perform searches with the script as-is using any of those fields as a criterion; although it would be possible to write a function to search the citation fields for such datat, doing so would be decidedly less efficient and ideal.)

General note regarding authentication: you must have cookies enabled to use this script's authentication feature. If you are concerned about privacy, then you should download a browser with built-in cookie management functions, such as Mozilla (whose cookie management features will enable selective acceptance of cookies).
I.1 Data Structure
The data structure as defined for the script is fairly rigid. The script has been designed around the data structure strictly and it does not allow for changes to the pre-defined table structure without modifications of the script. While changes to the modification of the data structure are possible even when data already exists, making such modifications would require careful rewriting of the script, and client-side testing would be ideal to ensure that the data is not damaged when the revised script is applied to the existing data.
I.1.i Papers Table
The Papers table has this structure:
+--------------+----------+------+-----+---------+----------------+
| Field        | Type     | Null | Key | Default | Extra          |
+--------------+----------+------+-----+---------+----------------+
| ID           | int(11)  |      | PRI | NULL    | auto_increment |
| PaperTitle   | text     | YES  |     | NULL    |                |
| Abstract     | text     | YES  |     | NULL    |                |
| Citation     | text     | YES  |     | NULL    |                |
| LinkNo       | tinytext | YES  |     | NULL    |                |
| PaperNo      | int(6)   |      | UNI | 0       |                |
| ImgURL       | tinytext | YES  |     | NULL    |                |
| SubmittedBy  | tinytext | YES  |     | NULL    |                |
| UpdatedBy    | tinytext | YES  |     | NULL    |                |
| CategoryID   | tinytext | YES  |     | NULL    |                |
| DateCreated  | datetime | YES  |     | NULL    |                |
| DateModified | datetime | YES  |     | NULL    |                |
+--------------+----------+------+-----+---------+----------------+
Explanation of Fields:
ID [integer, display size 11]:
The integer by which the papers are sorted within the table. This is a required field and automatically added and incremented by the database.
PaperTitle [text, maximum 65535 characters]:
The paper's title.
Abstract [text, maximum 65535 characters]:
The paper's abstract.
Citation [text, maximum 65535 characters]:
The paper's full citation. The format may be arbitrarily chosen by the user inputting the data; the script does not require adherence to any particular stylesheet.
LinkNo [text, maximum 255 characters]:
The paper's link number. As of this script's writing, the server on which the papers are stored uses a download script to count downloads of particular papers. When the script displays paper data for the user that requests so, it will output an appropriate link based upon this number. It will be used as such:
http://[base URL]/download.cgi?[LinkNo]
For example:
http://biocomplexity.indiana.edu/cgi-bin/download.cgi?01a
PaperNo [integer, maximum length 6, required]:
The paper's number, as arbitrarily assigned. This is a required field and must be specified; the database will assign the default value of 0 otherwise. Note that this value must also be unique and attempting to add additional papers without specifying a number will yield errors as the default of 0 will have already been assigned to a paper.
ImgURL [text, maximum 255 characters]:
The URL to an image to displayed with the paper data, if there exists one. Like with the LinkNo field, a base URL will be used and this field will only contain the data to be appended.
http://[base URL]/[image]
For example:
http://biocomplexity.indiana.edu/images/paper01.gif
SubmittedBy [text, maximum 255 characters]:
The user name of the person who submitted the data to the database. The user name will be determined via the script's authentication system.
UpdatedBy [text, maximum 255 characters]:
The user name of the person last modified a particular record. The user name will be determined via the script's authentication system.
CategoryID [text, maximum 255 characters]:
The category ID of a paper. The category ID will correspond with a category in the Categories table.
DateCreated [datetime]:
The date and time when the record was submitted.
DateModified [datetime]:
The date and time when the record was last modified.
In spite of the limits described above, the script imposes arbitrary limits that are lower than those described above upon the lengths of the fields into which the user will enter data. The lengths are decidedly generous and exist only to prevent accidental data duplication [this feature is not fully implemented as of revision 0.5β] (i.e., as much of the data will be entered via the copy and paste functions, the data limits imposed should prevent problems in the event a user accidentally 'pastes' the text twice into a field). These limits are as follows:

Field (character limit)
PaperTitle (1024)
Abstract (16384)
Citation (8192)
LinkNo (5)
ImgURL (128)
CategoryID (128)
I.1.ii Categories Table
The Categories table has this structure:
+------------+--------------+------+-----+---------+----------------+
| Field      | Type         | Null | Key | Default | Extra          |
+------------+--------------+------+-----+---------+----------------+
| ID         | int(11)      |      | PRI | NULL    | auto_increment |
| Category   | tinytext     |      |     |         |                |
| CategoryID | varchar(255) |      | UNI |         |                |
+------------+--------------+------+-----+---------+----------------+
Explanation of Fields:
ID [integer, display size 11]:
An integer by which the papers are sorted within the table. This is a required field and is automatically added and incremented by the database.
Category [text, maximum 255 characters]:
The name of the category into which papers may be classified.
CategoryID [text, maximum 255 characters]:
A (shorter) ID, usually a combination of numbers and only a few letters by which the category will be identified. The category ID specified by the user must be unique (relative to other category IDs stored within this table) or the database will refuse the input.
I.1.iii Users Table
The Users table has this structure:
+---------------+--------------+------+-----+---------------------+----------------+
| Field         | Type         | Null | Key | Default             | Extra          |
+---------------+--------------+------+-----+---------------------+----------------+
| user_id       | int(8)       |      | PRI | NULL                | auto_increment |
| username      | varchar(30)  |      | UNI |                     |                |
| password      | varchar(32)  |      |     |                     |                |
| fullname      | varchar(80)  |      |     |                     |                |
| email         | varchar(128) |      | UNI |                     |                |
| create_date   | datetime     |      |     | 0000-00-00 00:00:00 |                |
| last_visited  | datetime     | YES  |     | NULL                |                |
+---------------+--------------+------+-----+---------------------+----------------+
Explanation of Fields:
user_id [integer, display size 8]:
An integer by which the papers are sorted within the table. This is a required field and is automatically added and incremented by the database.
username [text, maximum 30 characters, required]:
The username of a user. This is a required field and must be unique (relative to other usernames stored within this table or the database will not accept the input.
password [text, maximum 32 characters, required]:
The password of a user. The script will store first encode paasswords via the PHP md5() function, which produces a 32-character encoded string of the function's input. This is a one-way 'encryption' process and it is not easily decrypted afterwards; this is done for security reasons. The script imposes a 32-character limit on passwords, but regardless of what the input for this field, it will eventually be stored as a 32-character string.
fullname [text, maximum 80 characters, required]:
The actual, given name of a user (or any form thereof).
email [text, maximum 128 characters, required]:
The e-mail address of a user. This must be unique as well, to prevent the same user from re-registering (with the same e-mail address).
create_date [datetime, required]:
The date the user's account was created.
last_visited [datetime]:
The date and time when the user last visited the site. Null if the user has not visited the site before. Recorded upon the user's logging in.
I.2 Instructions
Usage of this script is fairly self-explanatory. This section will contain specific notes regarding each section's usage, if any. If you encounter errors when submitting data, you might also look here to see the specific notes regarding data input. Please see I.1 Data Structure for detailed information regarding data structure if you continue to encounter errors upon inputting data.

General Notes:
  1. Each section that allows for data manipulation has a separate function for viewing and editing data. Although both will display the data, the function for editing data will allow you to select a record for editing and will not display all of the data associated with each record, whereas the function for viewing will enable the user to view the full record.
  2. JavaScript may be utilized to validate data input, ensuring it does not violate any imposed restrictions; however, this feature has not been implemented as of yet, but will in the near future.
  3. When editing a record, there will be a checkbox present that will allow you to delete the data. If the user checks this box and the clicks the Edit [paper, category, user] button, then the record will be irrevocably deleted.


I.2.i Managing Categories
The category ID you assign to a category must be unique. If it is not, then you will receive an error upon attempting to add a record.
I.2.ii Managing Users
All fields are required when adding a user. You will receive errors if you do not complete all fields.

When editing users, if you do not desire to change their password, then leave the password fields blank. If you wish to change the user's password, then fill in new passwords into the appropriate fields.

As passwords cannot be retrieved and decrypted from the format in which they are encoded in the database, you may only change an existing user's password. (Viewing it is presently impossible with this script.) Thus, if a user has forgotten their password, the password's retrieval is impossible - it may only be resetted instead.

The user name and e-mail address you specify upon adding a user must be unique. If either user name or e-mail exists within the database, you will receive an error.
I.2.iii Adding Data
There are currently no notes for this section.
I.2.iv Editing Data
There are currently no notes for this section.
I.2.v Viewing Data
There are currently no notes for this section.

 - - - - - -

II. Other Notes
These are included for reference and are not of significant importance to the script or its operation.
II.1 Styles
The site uses one master stylesheet to define the styles used within it - named style.css as of this writing. The styles have no particular organization within them, but the ones used primarily on the site (of those defined) are these:

.header3 [for page headers]
{ font-size: 16pt;
font-variant: small-caps;
font-weight: bold;
margin-bottom: 20px }
.subheader2 [for smaller headers, usually in-text]
{ font-size: 10pt;
font-weight: bold;
margin-top: 5px;
margin-bottom: 2px;
color: #767878; }
.subtext1 [for text within the page (for data, the font defined in the BODY section of the stylesheet is used).]
{ font-family: Trebuchet MS, Trebuchet;
font-size: 10pt;
margin-left: 13px;
margin-bottom: 25px; }
II.2 HTML

This script management interface is written in XHTML 1.0 as defined by the World Wide Web Consortium (w3.org). The syntax has not been validated as of yet, but the majority of it should be compliant. Additionally, the site uses cascading style sheets (CSS) to define the styles used within the site.
II.3 Version History [Revisions]

paper management / version 0.6β / 24 july 2003 [thu]
Code has not been tidied up very much, but a few new features have been added. The code, actually, has probably become a bit messier, especially on the newer pages. There's not an easy to handle variables when they can sometimes be posted and other times passed through the query string. As of now, the 'solution' implemented works - it is just a bit inefficient. However, as site usage should be relatively light, this should not pose much problem for now.
  • Ability to sort records in view data page
  • Basic search function, for papers table only
  • Pagination of results when viewing papers
  • Pagination of results when browsing papers for editing
  • Ability to edit from search results
  • Basic view data page for use outside of the script administration area


  • paper management / version 0.5β / 23 july 2003 [wed]
    Still un-named, but the basic script complete with simple authentication (with PHP sessions) is complete. Authentication could be more secure, as PHP sesssions are not totally secure; additionally, there may be some bugs present, but basic use at this time does not reveal any significant ones. Data is manipulated via a MySQL server. The script is still not very dynamic with regard to data handling, but this intentional as broader functions (mass-moves, mass-deletes, etc.) were beyond the function of this script. However, mass-changing of certain fields - such as the category field - is planned for the future. This script is also custom-designed, so configuration/naming of tables and databases still requires much manual modification.

    Basic Feature List:
  • Adding, editing and deletion of categories
  • Adding, editing and deletion of users
  • Adding, editing and deletion of papers
  • Mostly documented (the script itself excepted)
  • Ability to sort by various fields
  • Ability to display papers outside of script by various fields (in particular by category)