HW#4 --- last modified March 02 2019 13:33:24..

Solution set.

Due date: Nov 13

Files to be submitted:
  linkollector.zip

Purpose: To gain practice programming in Perl. To write a server side program to make use of data posted from a client.

Related Course Outcomes:

This howework is directly geared toward course outcomes (2) [Write server-side scripts in Java, PHP, and Perl], (4) [Write server-side scripts that process HTML forms], and (5) [Write client-side scripts which validate forms]. Your server-side program will also have to produce validating XHTML 1.1, so outcome (1) [Write validating HTML documents employing CSS and containing standard HTML elements including forms, tables, and client-side scripts] will also be addressed

Specification:

Each semester, faculty in the Computer Science Department are required to give a hardcopy of their green sheets to the department staff for record keeping purposes. For this homework, you will develop the super-duper Link-ollector (Link Collector) program. When a faculty member initially goes to the Link-ollector page, a form is presented requesting the Professor's name, the course, the section number, a URL, and a submit button. When the submit button is clicked, you should have a Javascript program validate that all the fields are filled out. Since we have not used POST before, make sure your form uses the POST method.

On the server side, I want you to store the information you get in a file called links.txt . Each line in links.txt should have the format:

name$#$course$#$section$#$URL

For example,

Pollett$#$174$#$2#$#http://www.cs.sjsu.edu/faculty/pollett/174.23.06f/

The Link-ollector should then return a message to the client saying the data was collected. It should also give a summary of what was collected, and allow the user to edit or deletion the information and resubmit. It should set a cookie on the client with a key Professor which has value the name of the professor and expiry date in four months. Finally, it should ask if the user would like to add another link. If the user clicks yes, then the start page is redisplayed.

Your program should detect if a given client ever comes back to the start page after the initial time using the cookie. If so, in addition to the form to collect a link, the page should display a list of links that have already been provided by that professor, and allow that person the opportunity to edit/delete them and update the links.txt file.

This completes the description of the homework, for two additional bonus points (bonus points are added after curving) you can write a small script which reads the links.txt file and for each line downloads the web-page given by the link, and prints this page (not as raw HTML source but as it would be formatted in a browser) to a printer. We will not cover all that is needed to get these bonus points in class, so you will have to do some reading on your own, if you like to get these points.

Point Breakdown

Your web application sends validating XHTML 1.1 code to client 1pt
Web form is as described 1pt
Javascript used to validate form 1pt
Server side program stores data correctly in links.txt 2pt
Server side program responds as described and allows user opportunity to edit/delete data 2pt
Server side program sets and uses cookie as described 1pt
Server side program acts as described if user comes back to the site after submitting a link 2pt
Total10pts