V22.0004 Computers in Principle and Practice II
New York University: Spring 2002

Nathan Hull

Assignment 6
Due: Thursday, May 2nd


Red, White and Blue

Perl/CGI, JavaScript and Director


Version 1.0 - Now includes a flowchart of the assignment

START of Assignment 6 that we did in class (matching movie.cgi script)


In this assignment, you are to create a web experience that integrates Perl/CGI, JavaScript and Director movies into a whole.

BEFORE YOU GO FURTHER, let me suggest to you STRONGLY that you put up an existing Perl/CGI script - any existing Perl/CGI script into your own I5 account so that you get over the mechanics of posting it, giving permissions to it and testing it. Use one of mine or one from the book. Do it NOW!!

That said,

The "Red, White and Blue" assignment will allow the user to choose one of three Director movies ("Red," "White" or "Blue") to be served to them. The movies should be short and built around a central theme. The three movies could be about 3 examples of patriotism, 3 emotions, the affect of 3 colors, 3 cartoon characters, the stories of 3 balloons, etc., etc. Anything you like as long it is around a central theme, and has at least some tangential link to the three colors. The movies don't have to be interactive, so they should be pretty simple to make. (This may all be inspired by Kieslowski's film trilogy, but, then again, it may not!). Your movies should be in 320 x 240 format to keep them small. Also, keep the running time down to something reasonable.

There should be a fourth movie which serves as an introduction to the site. The introductory movie should include the rotation of a 3D Text field. (See the "Help" menu from Director 8.5, or my "Space" Example.) You should go ahead and build these four movies INDEPENDENTLY of writing the Perl and JavaScript that will surround them. Make them look visually attractive.

As you read the following description, refer to the flowchart of the assignment.

I. The introductory web page should include three items:

This web page should include some JavaScript that makes certain that the person inputs only ONE name. (i.e., it pops up an alert box if there are any spaces in the name.) It sends both the name field and the movie_choice field to the CGI script.

(Note that this assignment does NOT use any Cookies!)

II. The CGI Script

First, it should be noted that this is the same Perl script that is run for every submission. There is NOT a special script for the first time, etc.

The Script should create a web page for the user based upon their movie choice, and update a data file that keeps track of the order of the choices (not unlike my Shaggy vs. Gates script).

A. The web page the script creates and returns should include:

B. The CGI script should read and update a data file (held within cgi-bin) that includes 9 counts:

Choice # 1:      num_red      num_white      num_blue
Choice # 2:      num_red      num_white      num_blue
Choice # 3:      num_red      num_white      num_blue

Note that the first time the script is run, there aren't any fields that hold previously chosen movies. You can use this fact to determine that you have to output a new list of previously chosen movies. (You can check if a key exists by asking something like if ($choice_1) If. you get a 'true' value, the field was submitted; otherwise, it wasn't.)

III. The Returned HTML/JavaScript (created by the CGI script)

As noted above, the web page includes the selected movie, radio buttons that allow the user to choose the next movie, and various hidden fields. Also as noted above, it tells the user how many other people picked the selected movie in the same order.

This HTML/JavaScript shares some characteristics with the introductory page in that it plays a director movie, and that it has a series of radio buttons for the user's choice. Note that it does NOT display the user's name that was recorded from the first script. This is being held in the hidden field.

One thing that IS new to this HTML/JavaScript is a check to make certain that a user does NOT submit a choice that they have previously made.

For the third user's choice, the CGI program does NOT send back the red/white/blue radio buttons at all! Instead, all that is visible is a "Submit" button that actually is linked to the final web page.

IV. The Final Web Page

This is generated by the last HTML/JavaScript page which was itself generated by the CGI script. It merely thanks (by name!) the user. Note that this is the first time you have echoed back the name to the user.

Version 1.0 - Now includes a flowchart of the assignment


Load your pages up to the I5 server using the FTP client of your choice (Fetch, etc.) So that you do not have to destroy the look of your I5 Home Page, this assignment will use the following naming scheme for the first page:

assign6.html

Thus, the URL for looking at your page (presuming that you have User ID "abc1234") would be:

http://i5.nyu.edu/~abc1234/assign6.html


And, as usual, when your Web Page(s) for your assignment have been posted, please notify us at:

pnp2@cs.nyu.edu

In the Subject field of your message, please put the assignment number you are turning in.