Homework 5
CS320, Fall 2006


Due: Tuesday, November 28

Please upload your files to CSNS. The files should include all the source code, documentation, and an HTML file hw5.html, which contains a link to your JSP page on the CS3 server. Note that file uploading will be disabled automatically after 11:59PM of the due date, so please turn in your work on time.

[Reading]

[Problem Description]

For this assignment, add a registration page to the online album application you developed in Homework 4 so a user can create an new account. Also implement a custom tag <ownerOnly> which can be used to display content that should only be shown to the owner of an album. Again, all features described in previous assignments must work; otherwise there will be a credit penalty of up to 40pt.

[Registration Page] (50pt)

In the registration page, ask the user to fill out a form as shown in the following example:

Username:

Password:

Retype password:

Name for your album:
First Name (optional):

Last Name (optional):

Email (optional):

Your application should properly handle the following errors:

For each type of errors, output an error message and ask the user to re-enter the data. Note that validation of the input data should be implemented on the server side, i.e. not in JavaScript. Optional fields can be empty, which should not be treated as an error. However, if a user do provide the optional information, you must store it in the database.

Once a user is registered, they may start using their album as described in previous assignments.

[OwnerOnly Tag] (30pt)

Create a custom tag called <ownerOnly> which has one attributes albumId. The tag only displays its body content if the user who's currently logged in is the owner of the album. For example, the following code only shows the Create New Folder option to the owner of the album:

<ownerOnly albumId="${param.albumId}"><a href="NewFolder.jsp">Create New Folder</a></ownerOnly>

Please make sure you use the tag at least once in your code to show that it works correctly.

Note that depending on your implementation, you may use attribute(s) other than albumId, or no attribute at all, for the <ownerOnly> tag. 

[Extra Credit Work]

For extra credit, implement some of the features listed below:

1. Modify your application so that it supports two types of users: regular and admin. Once an admin user is logged in, he or she can perform several operations that are not available to regular users:

2. (10pt) Allow users to edit folder information including folder name and description.

3. (15pt) Allow users to delete a folder, which will delete all the pictures in the folder as well.

4. (30pt) Automatically create a thumbnail of a picture when the picture is uploaded. In the Album/Folder view, display only the thumbnails of the pictures, and when a user clicks on thumbnail, displays the full-sized picture as well as other information about the picture, which may include name, owner, date uploaded etc. For how to create thumbnails, please check out the article at http://java.sun.com/developer/TechTips/1999/tt1021.html.

5. (30pt) Allow users to rate pictures in public folders with a rating from 1 to 5. The average of rating of a picture must be displayed, but you can decide where and how to display it.

6. (50pt)  Allow folders to contain not only pictures, but also other folders. Moving pictures between folders should still work as described in previous assignments, and furthermore, we should be able to move folders as well.

The due date for the extra credit work is Sunday, December 3Saturday, December 2, and you may turn it in as Homework 6. A hw6.html must be included, which should provide the following: