This example shows how to create a simple file library. It demonstrates batching and sorting. You can click on the column names to sort the files. If you click twice on a column then the files are sorted in reverse order. If you upload more than eight files, then the results will be split up over more than one page. This is called batching.
The files are located in the Files folder. The getFiles script returns a sorted list of files. The getLink and getSize scripts do small formatting tasks to build hyperlinks and format file sizes. The batching is done in the index_html template. The template also makes use of the test function to assign different CSS classes to elements depending on conditions. This is how the sorted column name is bolded and alternate table rows are made gray.
|example.html||text/html||206 bytes||May 7, 2002 11:08 am|
|example.txt||text/plain||29 bytes||May 7, 2002 11:08 am|
You can add a file to the library by uploading it from your local computer. The addFile script accepts the file upload and creates a new file object in the Files folder. It then returns this page with a confirmation message. The addFile script has the "manager" proxy role, which allows it to add a file regardless of the user's permissions.