CGI scripts

This section treats the scripts residing at the server side of the system, it also treats the communication between the client and the server.

Below is a general description of the communication followed by a short description of each script. To ease the overview of the scripts they are divided into three categories (retrieval, storage and command).

General description

All computer-computer communication within the package is done using cgi scripts. All but one of the script used handles applet-server communication, the odd one out is the script used to save a students answers on the server (web page-server communication). To tell a cgi script what to do a number of variables are sent with the call, in most calls the information sent to the server are just some variable strings so the GET method is sufficient. However for some of the calls, when a lot of information has to be transferred to the script, the POST method is used. From the script perspective it does not matter if POST or GET is used as all the scripts can handle them both in a similar manner. The same applies for the encoding of the variables done by the calling side. The only difference lies in that while the variables are put in the URL for GET, they have to be transferred through a URL connection stream when using POST. (for a discussion on GET vs. POST see the document Problems).

The response data from a script is sent to an applet as an (HTML) page. This page is then parsed by the applet. With pages in this discussion are meant text documents starting with "Content-type: text/html\n\n". There are however no HTML code in the pages.

The general coding for the responses from the scripts are: If the response starts with a zero ("0"), the script failed to perform ( this could for example be due to that a file failed to open a file), if the response starts with a one ("1"), the script call was successful.


Data retrieval scripts

The retrieving scripts are used to get data from the server. These kind of scripts do not change the state on the server (i.e. nothing is changed on the server).

The scripts that falls into the retrieval category are:

getAllDataFiles.perl getAllAnswers.perl  getStudents.perl doCourseInfo.perl checkPassword.perl  
Event: Response from script:
user name/password not correct 0Invalid user name/password
password file couldn't be opened 2Couldn't open the password file ... etc.
subject given, subject didn't exist in acc file 10Password correct but user do not ...etc.
subject given, subject did exist in acc file 11subject
subject given/not given, failed to open acc file 12Password correct but failed to open access file.
subject not given  11"all the subjects for teacher"
 


Data storage scripts

The data storage scripts are called by applets and QuestionPages when they need to store information on the server e.g. the MakePageApplet storing a new QuestionPage or the CreateCourseApplet registering students.

The scripts that falls into the data storage category are:

makeDataFile.perl distans.perl registerStudents.perl deleteStudents.perl

Command scripts

The command scripts are used by an applet to perform a specific action on the server e.g. delete a QuestionPage, add a new teacher access, etc.
 
The scripts that falls into the retrieval category are:

makeCross.perl makeAlt.perl makeWritten.perl rmPage.perl mkCourse.perl rmCourse.perl addCourseAccess.perl removeCourseAccess.perl The variable courses should look like this: The variable users should look like this: