| |
Javascript and Linux: |
|
Session 4
Friday February 28 3:15 pm - 4:15 pm |
Since 1999, UM-St. Louis Librarians have been developing and using javascript based interactive tutorials which simulate the use of several commercial databases and the local OPAC. A newly developed facility entitled "Did they do it?" allows instructors to create and administer personal accounts which access data on their students' completion of each section of any tutorial. In effect, faculty can assign specific library tutorials to their students, and determine "Did they do it?". The "Did They Do It?" system was developed using four open source software products: Linux, Apache, MySQL, and PHP. |
The list of tutorials currently available which use DTDI is located here:
Most of the interactive tutorials have been created by Reference Librarian Chris Niemeyer (niemyer@umsl.edu). Tutorials are typically divided into modules. Existing tutorials can be retrofitted with special URL's used to log the completion of the module, then pass the student on to the next module. Any HTML link on any web page can easily be modified. Basically, all that is being tracked is that a user has clicked on a specific link.
A standard HTML link leading a user from one page to the next might look something like this:
<a href="http://www.umsl.edu/library/didtheydoit/test/page_1.htm">Go to page A</a>
The owner of the page with the above link enables DTDI tracking merely by changing the existing link (above) thus:
<a href = "http://www.umsl.edu/library/utilities/jslinkpage.htm?logmodabbrev=TESTING&logmodnum=1& nexturl=http://www.umsl.edu/library/didtheydoit/test/page_1.htm">Go to page A</a>
Since most of the change in the URL is boilerplate text prefixed to the existing URL, a future modification of DTDI would be to include a utility that only requires the pre-existing URL be entered into a form with a couple of other necessary values; the new version of the URL would be returned properly modified and could be pasted direclty into the HTML web page.
A central component of DTDI is the javascript page:
http://www.umsl.edu/library/utilities/jslinkpage.htm
jslinkpage.htm uses cookies to determine if a user has already logged in (users are only prompted once during a session for their name and class). If the user is just beginning a session, they are asked to either login or continue anonynmously. HTML cookies keep track of the user's response so that they need not be prompted to login for each module. If a user chooses not to log in for tracking purposes, that information is also kept track of by jslinkpage.htm generated cookies. An added feature is that for the anonymous user who does not log in for tracking, they are never passed by jslinkpage.htm to the main DTDI server which runs on a separate machine. The javascript code for jslinkpage.htm is included in the appendix below. jslinkpage.htm is unique in that it is an HTML web page that is never meant to be displayed!
Two variable values being passed in the modified URL:
logmodabbrev=TESTING
logmodnum=1
logmodabbrev is a value that uniquely identifies a given tutorial. In this example, it is assumed that a tutorial called TESTING has been set up to be logged by the DTDI administrator.
logmodnum=1 refers to the specific number of a module within a tutorial. The next module would like be logmodnum=2 followed by logmodnum=3 and so forth.
Students
Students, or other users, need to know very little. Hopefully, required responses are self-evident to the end user, but a brief web page has been designed to explain how to respond to the various prompts.
Typically, an instructor simply tells the students that they are required to complete a tutorial which can be found via the Library web pages. When the student attempts to complete the tutorial, they will be prompted with the following by jslinkpage.htm:
Subsequently, if they elect to continue to the next screen they will actually be prompted to enter their name and select the class for which they are completing the tutorial. They will ONLY be presented with the names of pre-registered instructors who have assigned the given tutorial.
Faculty
Faculty wishing to assign a tutorial, and thus track completion by students, must register with DTDI and set up an account. An instructor's web page has been created as a mini-manual for setting up and using a DTDI account:
Librarians
Behind the scenes, as usual, we find librarians making things work. As mentioned earlier, one of the "behind the scenes" tasks is to modify the links on existing tutorials to make them DTDI compliant. Additionally, when a tutorial is thus modified, the administrator of DTDI must make an entry in a MySQL database table (modules) using the unique identifier for logmodabbrev which is included in the modified URL. I.e., there is an entry must exist in the modules table that corresponds to the value of logmodabbrev as entered in the linking URLs.
jslinkpage.htm
<html>
<head>
<title>Javascript Link Page for Module Logging</title>
<script language="javascript">
<!-- Activate Cloaking
// First, parse out logmodabbrev, logmodnum, nexturl from the URL
var is_input = document.URL.indexOf('?');
if (is_input != -1)
{
// Extract out everything after the '?' in full URL
urlstuff = document.URL.substring(is_input+1, document.URL.length);
// Create a three element array (3 items passed)
// Remember, arrays are indexed starting with 0 (e.g., 0,1,2...)
urlarray=urlstuff.split("&");
// Get the values only and assign to logmodabbrev, logmodnum, nexturl, autolog
valuearray=urlarray[0].split("=");
logmodabbrev=valuearray[1];
valuearray=urlarray[1].split("=");
logmodnum=valuearray[1];
valuearray=urlarray[2].split("=");
nexturl=valuearray[1];
// valuearray=urlarray[3].split("=");
// autolog=valuearray[1];
}
else
{
alert("Uh, oh. You have a bad URL. Not passing values for logmodabbrev,
logmodnum, nexturl");
}
// Next, check if logyesno cookie exists
if (document.cookie.length>0)
{
// If logyesno cookie = no then no logging; pass user on to nexturl
if ("no"==document.cookie.substring(9))
{
window.location.href=nexturl;
}
else
{
// logyesno cookie = yes; send user to didtheydoit.php with info.
window.location.href="http://tjrhino1.umsl.edu/ididit/didtheydoit.php"
+"?logmodabbrev="
+logmodabbrev
+"&logmodnum="
+logmodnum
+"&nexturl="
+nexturl;
}
}
else
// logyesno cookie does not exist so we'll have to ask user, then set it
{
// Prompt user to log or not log
answer=confirm("At the next screen you will be prompted to:\n\n 1.
Enter Your Name\n 2. Select Your Class\n\nYour instructor will be shown
a record\nof each module you complete.\n\n OR\n\nClick on [ Cancel ] to
continue anonymously.");
if(answer==true)
{
// They want to log, write the logyesno cookie as YES and pass them
// on to mainlogin.php with logmodabbrev, logmodnum, nexturl
document.cookie="logyesno=yes";
window.location.href="http://tjrhino1.umsl.edu/ididit/mainlogin.php"
+"?logmodabbrev="
+logmodabbrev
+"&logmodnum="
+logmodnum
+"&nexturl="
+nexturl;
}
else
{
// No logging. Set cookie (don't see this again) and go to nexturl
document.cookie="logyesno=no";
window.location.href=nexturl;
}
}
// Deactivate Cloaking -->
</script>
</head>
<body>
<p><hr /></p>
</body>
</html>
MySQL database: ididit
The "ididit" database consists of the following four tables with field values indicated:
modules
registration
instructor
logfile
modules - table holding information about each tutorial
modrecnum - numeric unique record identifier
modabbrev - character unique tutorial identifier (e.g., EXPAC) used in linking URLs
modnumber - number of modules in a given tutorial
modstarturl - the beginning screen for a given tutorial
moddescribe - text description of a tutorial
registration - table holding name, password, contact information for registrants
regrecnum - numeric unique record identifier
reginstructorlastname - last name
reginstructorfirstname - first name
reginstructorphone - phone number
reginstructoremail - email account
reginstructorpword - password of instructor
instructor - table of classes and tutorials assigned by instructors
instructorrecnum - numeric unique record identifier
instructorregrecnum - the unique number extracted from table registration for a given instructor
instructorlastname - last name of instructor extracted from table registration for a given instructor
instructorfirstname - first name of instructor extracted from table registration for a given instructor
instructorcoursename - the name of the course as given by instructor
instructormodabbrev - tutorial assigned by instructor extracted from table modules
recordstatus - "0" if instructor has "deleted" or "1" if still active
logfile - table of logged completions of tutorial modules
logrecnum - numeric unique record identifier
loglastname - last name of student as entered BY student
logfirstname - first name of student as entered BY student
loginstructorrecnum - student selected and extracted from table instructor (unique instructorrecnum)
loginstructorcoursename - student selected and extracted from table instructor (unique instructorcoursename)
logmodabbrev - same as modabbrev from table modules uniquely identifying which tutorial is being done
logmodnum - same as modnum from table modules uniquely identifying which module of tutorial is being done
logipfrom - ip number of user
logdate - date link was clicked (module was completed)
logtime - time stamp when link was clicked (module was completed)