remove trailing whitespace on every line and standardize line endings

This commit is contained in:
gbateson 2008-03-06 07:39:21 +00:00
parent efcbd12a39
commit 87042d5731
49 changed files with 501 additions and 501 deletions

View file

@ -16,7 +16,7 @@ This is v2.3.2 of the HotPot module for Moodle 1.8
This software is provided "AS IS" without a warranty of any kind. This software is provided "AS IS" without a warranty of any kind.
Sponsors who have generously contributed to the development of this software: Sponsors who have generously contributed to the development of this software:
- Agencia de Gestio d'Ajuts Universitaris i de Recerca (AGAUR), - Agencia de Gestio d'Ajuts Universitaris i de Recerca (AGAUR),
Autonomous Government of Catalonia, Spain Autonomous Government of Catalonia, Spain
(via Josep M. Fontana, Universitat Pompeu Fabra) (via Josep M. Fontana, Universitat Pompeu Fabra)
- Rikkyo Univeristy, Japan (via Paul Allum) - Rikkyo Univeristy, Japan (via Paul Allum)
@ -33,9 +33,9 @@ IMPORTANT NOTICE
TO INSTALL OR UPDATE THE HOTPOT MODULE TO INSTALL OR UPDATE THE HOTPOT MODULE
====================================== ======================================
You should install only this module by installing a complete Moodle 1.8 package. You should install only this module by installing a complete Moodle 1.8 package.
Similarly, the recommended way to upgrade this module is to upgrade to a complete Moodle 1.8 package. Similarly, the recommended way to upgrade this module is to upgrade to a complete Moodle 1.8 package.
However, it is possible to download and unzip a complete Moodle 1.8 package and extract the "mod/hotpot" folder for use on your live Moodle 1.8 site. However, it is possible to download and unzip a complete Moodle 1.8 package and extract the "mod/hotpot" folder for use on your live Moodle 1.8 site.
@ -53,7 +53,7 @@ TO USE THE HOTPOT MODULE
5. On the main page for the Moodle course, confirm editing is turned on (click the "Turn editing on" button), then, in the section where you want to add the HotPot activity, select "Hot Potatoes Quiz" on the "Add an activity" drop-down menu . 5. On the main page for the Moodle course, confirm editing is turned on (click the "Turn editing on" button), then, in the section where you want to add the HotPot activity, select "Hot Potatoes Quiz" on the "Add an activity" drop-down menu .
If "Hot Potatoes Quiz" does not appear on the "Add an activity" menu, you may need to enable the HotPot module as follows: If "Hot Potatoes Quiz" does not appear on the "Add an activity" menu, you may need to enable the HotPot module as follows:
a) from the site's front page select "Admin" then "Modules" a) from the site's front page select "Admin" then "Modules"
b) click the "closed eye" icon for the "Hot Potatoes Quiz" module b) click the "closed eye" icon for the "Hot Potatoes Quiz" module
@ -75,9 +75,9 @@ HOT POTATOES CONDITIONS OF USE
** Reproduced from the Hot Potatoes site ** ** Reproduced from the Hot Potatoes site **
Hot Potatoes is offered free to the educational community by the University of Victoria Humanities Computing and Media Centre (formerly the Language Centre), under certain conditions. Hot Potatoes is free for use by state educational institutions which are non-profit making, on the condition that the material produced using the program is freely available to anyone via the WWW. However, you need to purchase a licence under any of the following conditions: Hot Potatoes is offered free to the educational community by the University of Victoria Humanities Computing and Media Centre (formerly the Language Centre), under certain conditions. Hot Potatoes is free for use by state educational institutions which are non-profit making, on the condition that the material produced using the program is freely available to anyone via the WWW. However, you need to purchase a licence under any of the following conditions:
* You do not work for a public sector educational establishment. * You do not work for a public sector educational establishment.
* You charge money for access to the material you make with Hot Potatoes. * You charge money for access to the material you make with Hot Potatoes.
* You restrict access to the material in some way. (The only exception here is if you have an account on www.hotpot.net, where you ARE allowed to use password restrictions.) * You restrict access to the material in some way. (The only exception here is if you have an account on www.hotpot.net, where you ARE allowed to use password restrictions.)
* You want to use the Masher program included with the Hot Potatoes suite. * You want to use the Masher program included with the Hot Potatoes suite.
For more information on licences, and details on how to purchase one, check out our Website at: For more information on licences, and details on how to purchase one, check out our Website at:

View file

@ -162,7 +162,7 @@
} }
} }
// redirect to the next quiz or the course page // redirect to the next quiz or the course page
redirect($next_url, get_string('resultssaved', 'hotpot')); redirect($next_url, get_string('resultssaved', 'hotpot'));
} }
@ -467,7 +467,7 @@ function hotpot_set_attempt_details(&$attempt) {
} }
// remove "correct" and "wrong" values from "ignored" values // remove "correct" and "wrong" values from "ignored" values
$response->ignored = array_diff($response->ignored, $response->ignored = array_diff($response->ignored,
$response->correct, $response->wrong, $oldresponse->correct, $oldresponse->wrong $response->correct, $response->wrong, $oldresponse->correct, $oldresponse->wrong
); );

View file

@ -4,7 +4,7 @@
<table cellpadding="9" cellspacing="0"> <table cellpadding="9" cellspacing="0">
<tr valign="top"> <tr valign="top">
<td align="right">hotpot_showtimes:</td> <td align="right">hotpot_showtimes:</td>
<td><?PHP <td><?PHP
unset($choices); unset($choices);
$choices["0"] = get_string("no"); $choices["0"] = get_string("no");
$choices["1"] = get_string("yes"); $choices["1"] = get_string("yes");

View file

@ -2,7 +2,7 @@
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT! // THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
// //
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL // IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY. // LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
function hotpot_upgrade($oldversion) { function hotpot_upgrade($oldversion) {

View file

@ -2,7 +2,7 @@
// THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT! // THIS FILE IS DEPRECATED! PLEASE DO NOT MAKE CHANGES TO IT!
// //
// IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL // IT IS USED ONLY FOR UPGRADES FROM BEFORE MOODLE 1.7, ALL
// LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY. // LATER CHANGES SHOULD USE upgrade.php IN THIS DIRECTORY.
function hotpot_upgrade($oldversion) { function hotpot_upgrade($oldversion) {

View file

@ -17,7 +17,7 @@ function hotpot_update_to_v2_2() {
$index = "{$table}_{$field}_idx"; $index = "{$table}_{$field}_idx";
} }
hotpot_db_delete_index("{$CFG->prefix}$table", $index); hotpot_db_delete_index("{$CFG->prefix}$table", $index);
// add new hotpot_questions.md5key field (and index) // add new hotpot_questions.md5key field (and index)
$table = 'hotpot_questions'; $table = 'hotpot_questions';
$field = 'md5key'; $field = 'md5key';
@ -31,7 +31,7 @@ function hotpot_update_to_v2_2() {
$ok = $ok && set_field($table, 'md5key', md5($record->name), 'id', $record->id); $ok = $ok && set_field($table, 'md5key', md5($record->name), 'id', $record->id);
} }
} }
// remove the index on hotpot_strings.string // remove the index on hotpot_strings.string
$table = 'hotpot_strings'; $table = 'hotpot_strings';
$field = 'string'; $field = 'string';
@ -55,7 +55,7 @@ function hotpot_update_to_v2_2() {
$ok = $ok && set_field($table, 'md5key', md5($record->string), 'id', $record->id); $ok = $ok && set_field($table, 'md5key', md5($record->string), 'id', $record->id);
} }
} }
return $ok; return $ok;
} }
function hotpot_update_to_v2_1_21() { function hotpot_update_to_v2_1_21() {
@ -124,12 +124,12 @@ function hotpot_remove_orphans($secondarytable, $secondarykeyfield, $primarytabl
$db->debug = false; $db->debug = false;
$records = get_records_sql(" $records = get_records_sql("
SELECT SELECT
t2.$secondarykeyfield, t2.$secondarykeyfield t2.$secondarykeyfield, t2.$secondarykeyfield
FROM FROM
{$CFG->prefix}$secondarytable t2 LEFT JOIN {$CFG->prefix}$primarytable t1 {$CFG->prefix}$secondarytable t2 LEFT JOIN {$CFG->prefix}$primarytable t1
ON (t2.$secondarykeyfield = t1.id) ON (t2.$secondarykeyfield = t1.id)
WHERE WHERE
t1.$primarykeyfield IS NULL t1.$primarykeyfield IS NULL
"); ");
@ -270,7 +270,7 @@ function hotpot_update_to_v2_1_2() {
$debug = $db->debug; $debug = $db->debug;
$db->debug = false; $db->debug = false;
// extract info about attempts by each user on each hotpot (cases where // extract info about attempts by each user on each hotpot (cases where
// the user has only one attempt, or no "in progess" attempt are ignored) // the user has only one attempt, or no "in progess" attempt are ignored)
$rs = $db->Execute(" $rs = $db->Execute("
SELECT userid, hotpot, COUNT(*), MIN(status) SELECT userid, hotpot, COUNT(*), MIN(status)
@ -289,8 +289,8 @@ function hotpot_update_to_v2_1_2() {
// get all attempts by this user at this hotpot // get all attempts by this user at this hotpot
$attempts = get_records_sql(" $attempts = get_records_sql("
SELECT id, userid, hotpot, score, timestart, timefinish, status SELECT id, userid, hotpot, score, timestart, timefinish, status
FROM {$CFG->prefix}hotpot_attempts FROM {$CFG->prefix}hotpot_attempts
WHERE userid = ".$record['userid']." AND hotpot=".$record['hotpot']." WHERE userid = ".$record['userid']." AND hotpot=".$record['hotpot']."
ORDER BY timestart DESC, id DESC ORDER BY timestart DESC, id DESC
"); ");
@ -298,7 +298,7 @@ function hotpot_update_to_v2_1_2() {
unset($previous_timestart); unset($previous_timestart);
foreach ($attempts as $attempt) { foreach ($attempts as $attempt) {
// if this attempt has a status of "in progress" and is not // if this attempt has a status of "in progress" and is not
// the most recent one in the group, set the status to "abandoned" // the most recent one in the group, set the status to "abandoned"
if ($attempt->status==1 && isset($previous_timestart)) { if ($attempt->status==1 && isset($previous_timestart)) {
$values = 'status=3'; $values = 'status=3';
@ -335,7 +335,7 @@ function hotpot_update_to_v2_1() {
$ok = $ok && hotpot_db_update_field_type('hotpot_questions', 'name', 'name', 'TEXT', '', '', 'NOT NULL', ''); $ok = $ok && hotpot_db_update_field_type('hotpot_questions', 'name', 'name', 'TEXT', '', '', 'NOT NULL', '');
// hotpot_questions: nullify empty and non-numeric (shouldn't be any) values in "text" field // hotpot_questions: nullify empty and non-numeric (shouldn't be any) values in "text" field
switch (strtolower($CFG->dbfamily)) { switch (strtolower($CFG->dbfamily)) {
case 'mysql' : case 'mysql' :
$NOT_REGEXP = 'NOT REGEXP'; $NOT_REGEXP = 'NOT REGEXP';
break; break;
case 'postgres' : case 'postgres' :
@ -358,13 +358,13 @@ function hotpot_update_to_v2_1() {
} else { } else {
$ok = $ok && hotpot_create_table($table); $ok = $ok && hotpot_create_table($table);
switch (strtolower($CFG->dbfamily)) { switch (strtolower($CFG->dbfamily)) {
case 'mysql' : case 'mysql' :
case 'postgres' : case 'postgres' :
$sql = " $sql = "
INSERT INTO {$CFG->prefix}$table (attempt, details) INSERT INTO {$CFG->prefix}$table (attempt, details)
SELECT a.id AS attempt, a.details AS details SELECT a.id AS attempt, a.details AS details
FROM {$CFG->prefix}hotpot_attempts a FROM {$CFG->prefix}hotpot_attempts a
WHERE WHERE
a.details IS NOT NULL AND a.details <> '' a.details IS NOT NULL AND a.details <> ''
AND a.details LIKE '<?xml%' AND a.details LIKE '%</hpjsresult>' AND a.details LIKE '<?xml%' AND a.details LIKE '%</hpjsresult>'
"; ";
@ -400,9 +400,9 @@ function hotpot_update_to_v2_1() {
$ok = $ok && hotpot_db_add_index('hotpot_responses', 'question'); $ok = $ok && hotpot_db_add_index('hotpot_responses', 'question');
// hotpot_string: correct double-encoded HTML entities // hotpot_string: correct double-encoded HTML entities
$ok = $ok && execute_sql(" $ok = $ok && execute_sql("
UPDATE {$CFG->prefix}hotpot_strings UPDATE {$CFG->prefix}hotpot_strings
SET string = REPLACE(string, '&amp;','&') SET string = REPLACE(string, '&amp;','&')
WHERE string LIKE '%&amp;#%' WHERE string LIKE '%&amp;#%'
AND (string LIKE '<' OR string LIKE '>') AND (string LIKE '<' OR string LIKE '>')
"); ");
// hotpot_question: remove questions which refer to deleted hotpots // hotpot_question: remove questions which refer to deleted hotpots
@ -468,7 +468,7 @@ function hotpot_update_to_v2_from_hotpotatoes() {
global $CFG; global $CFG;
$ok = true; // hope for the best! $ok = true; // hope for the best!
// check we have the minimum required hotpot module // check we have the minimum required hotpot module
$minimum = 2005031400; $minimum = 2005031400;
$module = get_record("modules", "name", "hotpot"); $module = get_record("modules", "name", "hotpot");
if (empty($module) || $module->version<$minimum) { if (empty($module) || $module->version<$minimum) {
if ($module) { if ($module) {
@ -558,7 +558,7 @@ function hotpot_create_table($table) {
} }
} }
return $ok; return $ok;
} }
// Moodle 1.7 (and earlier) // Moodle 1.7 (and earlier)
@ -731,9 +731,9 @@ function hotpot_update_logs($oldmodulename, $modulename, $moduleid, &$new) {
break; break;
case "attempt": case "attempt":
case "submit": case "submit":
case "review": case "review":
$id = substr(strrchr($record->url,"="),1); $id = substr(strrchr($record->url,"="),1);
if (isset($new->attempt[$id])) { if (isset($new->attempt[$id])) {
$id = $new->attempt[$id]; $id = $new->attempt[$id];
} }
$record->url = "review.php?id=".$record->cmid."&attempt=$id"; $record->url = "review.php?id=".$record->cmid."&attempt=$id";
@ -961,7 +961,7 @@ function hotpot_db_index_exists($table, $index, $feedback=false) {
$debug = $db->debug; $debug = $db->debug;
$db->debug = $feedback; $db->debug = $feedback;
switch (strtolower($CFG->dbfamily)) { switch (strtolower($CFG->dbfamily)) {
case 'mysql' : case 'mysql' :
$rs = $db->Execute("SHOW INDEX FROM `$table`"); $rs = $db->Execute("SHOW INDEX FROM `$table`");
if ($rs && $rs->RecordCount()>0) { if ($rs && $rs->RecordCount()>0) {
$records = $rs->GetArray(); $records = $rs->GetArray();
@ -990,7 +990,7 @@ function hotpot_db_delete_index($table, $index, $feedback=false) {
// check index exists // check index exists
if (hotpot_db_index_exists($table, $index)) { if (hotpot_db_index_exists($table, $index)) {
switch (strtolower($CFG->dbfamily)) { switch (strtolower($CFG->dbfamily)) {
case 'mysql' : case 'mysql' :
$sql = "ALTER TABLE `$table` DROP INDEX `$index`"; $sql = "ALTER TABLE `$table` DROP INDEX `$index`";
break; break;
case 'postgres' : case 'postgres' :
@ -1044,7 +1044,7 @@ function hotpot_db_table_exists($table, $feedback=false) {
return hotpot_db_object_exists($table, '', $feedback); return hotpot_db_object_exists($table, '', $feedback);
} }
function hotpot_db_field_exists($table, $field, $feedback=false) { function hotpot_db_field_exists($table, $field, $feedback=false) {
return return
hotpot_db_object_exists($table, '', $feedback) && hotpot_db_object_exists($table, '', $feedback) &&
hotpot_db_object_exists($table, $field, $feedback) hotpot_db_object_exists($table, $field, $feedback)
; ;
@ -1055,7 +1055,7 @@ function hotpot_db_object_exists($table, $field='', $feedback=false) {
$table = "{$CFG->prefix}$table"; $table = "{$CFG->prefix}$table";
// set $sql // set $sql
switch (strtolower($CFG->dbfamily)) { switch (strtolower($CFG->dbfamily)) {
case 'mysql' : case 'mysql' :
if (empty($field)) { if (empty($field)) {
$sql = "SHOW TABLES LIKE '$table'"; $sql = "SHOW TABLES LIKE '$table'";
} else { } else {
@ -1067,7 +1067,7 @@ function hotpot_db_object_exists($table, $field='', $feedback=false) {
$sql = "SELECT relname FROM pg_class WHERE relname = '$table' AND relkind='r'"; $sql = "SELECT relname FROM pg_class WHERE relname = '$table' AND relkind='r'";
} else { } else {
$sql = " $sql = "
SELECT attname FROM pg_attribute WHERE attname = '$field' SELECT attname FROM pg_attribute WHERE attname = '$field'
AND attrelid = (SELECT oid FROM pg_class WHERE relname = '$table') AND attrelid = (SELECT oid FROM pg_class WHERE relname = '$table')
"; ";
} }
@ -1177,7 +1177,7 @@ function hotpot_db_update_field_type($table, $oldfield, $field, $type, $size, $u
} }
if (empty($oldfield) && hotpot_db_field_exists($table, $field)) { if (empty($oldfield) && hotpot_db_field_exists($table, $field)) {
$oldfield = $field; $oldfield = $field;
} }
if (is_string($unsigned)) { if (is_string($unsigned)) {
$unsigned = (strtoupper($unsigned)=='UNSIGNED'); $unsigned = (strtoupper($unsigned)=='UNSIGNED');
} }
@ -1245,8 +1245,8 @@ function hotpot_db_update_field_type($table, $oldfield, $field, $type, $size, $u
$ok = $ok && execute_sql("ALTER TABLE `$table` $action `$field` $fieldtype"); $ok = $ok && execute_sql("ALTER TABLE `$table` $action `$field` $fieldtype");
break; break;
case 'postgres': case 'postgres':
// get db version // get db version
// N.B. $db->ServerInfo() usually returns blank // N.B. $db->ServerInfo() usually returns blank
// (except lib/adodb/drivers/adodb-postgre64-inc.php) // (except lib/adodb/drivers/adodb-postgre64-inc.php)
$dbversion = ''; $dbversion = '';
$rs = $db->Execute("SELECT version()"); $rs = $db->Execute("SELECT version()");
@ -1292,7 +1292,7 @@ function hotpot_db_update_field_type($table, $oldfield, $field, $type, $size, $u
execute_sql('ALTER TABLE '.$table.' ALTER COLUMN "'.$tmpfield.'" '.$notnull); execute_sql('ALTER TABLE '.$table.' ALTER COLUMN "'.$tmpfield.'" '.$notnull);
} else { } else {
execute_sql(" execute_sql("
UPDATE pg_attribute SET attnotnull=".($notnull ? 'TRUE' : 'FALSE')." UPDATE pg_attribute SET attnotnull=".($notnull ? 'TRUE' : 'FALSE')."
WHERE attname = '$tmpfield' WHERE attname = '$tmpfield'
AND attrelid = (SELECT oid FROM pg_class WHERE relname = '$table') AND attrelid = (SELECT oid FROM pg_class WHERE relname = '$table')
"); ");

View file

@ -1,6 +1,6 @@
<?php //$Id$ <?php //$Id$
// This file keeps track of upgrades to // This file keeps track of upgrades to
// the hotpot module // the hotpot module
// //
// Sometimes, changes between versions involve // Sometimes, changes between versions involve
@ -23,8 +23,8 @@ function xmldb_hotpot_upgrade($oldversion=0) {
$result = true; $result = true;
/// And upgrade begins here. For each one, you'll need one /// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete /// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper /// this comment lines once this file start handling proper
/// upgrade code. /// upgrade code.

View file

@ -1,27 +1,27 @@
<!-- <!--
// PLEASE NOTE that this version is more recent than the incorrectly // PLEASE NOTE that this version is more recent than the incorrectly
// numbered v6.1, dated 2003.11.17. From now on, version numbers will // numbered v6.1, dated 2003.11.17. From now on, version numbers will
// follow those of Hot Potatoes. // follow those of Hot Potatoes.
/* hot-potatoes.js (v6.0.4.0 - 2005.02.18) /* hot-potatoes.js (v6.0.4.0 - 2005.02.18)
* ======================================= * =======================================
* by Gordon Bateson, February 2003 * by Gordon Bateson, February 2003
* Copyright (c) 2003 Gordon Bateson. All Rights Reserved. * Copyright (c) 2003 Gordon Bateson. All Rights Reserved.
* *
* You are hereby granted a royalty free license to use or modify this * You are hereby granted a royalty free license to use or modify this
* software provided that this copyright notice appears on all copies. * software provided that this copyright notice appears on all copies.
* *
* This software is provided "AS IS" without a warranty of any kind. * This software is provided "AS IS" without a warranty of any kind.
* *
* Documentation and downloads may be available from: * Documentation and downloads may be available from:
* http://www.kanazawa-gu.ac.jp/~gordon/research/hot-potatoes/ * http://www.kanazawa-gu.ac.jp/~gordon/research/hot-potatoes/
*/ */
// This JavaScript library modifies the SendResults and StartUp functions // This JavaScript library modifies the SendResults and StartUp functions
// used by hotpot v5 and v6, so that more (or less!) details about the // used by hotpot v5 and v6, so that more (or less!) details about the
// student can be input, and more details of a quiz's questions and answers // student can be input, and more details of a quiz's questions and answers
// can be submitted to the server when the quiz is finished // can be submitted to the server when the quiz is finished
// If the arrays below (Login, DB, JBC, ...) are set BEFORE calling this // If the arrays below (Login, DB, JBC, ...) are set BEFORE calling this
// script, they will NOT be overwritten. Any array that is not set, will // script, they will NOT be overwritten. Any array that is not set, will
// use the defaults below. This is useful if you want to use different // use the defaults below. This is useful if you want to use different
// settings for different quizzes. // settings for different quizzes.
// ************ // ************
// Login Screen // Login Screen
@ -29,7 +29,7 @@
if (window.Login==null) { if (window.Login==null) {
Login = new Array(); Login = new Array();
Login[0] = true; // Show prompt for user name Login[0] = true; // Show prompt for user name
// This can also be a string of user names ... // This can also be a string of user names ...
// Login[0] = "Guest,Peter,Paul,Mary,Webmaster"; // Login[0] = "Guest,Peter,Paul,Mary,Webmaster";
// or an array of user names (and on-screen texts) (and passwords) ... // or an array of user names (and on-screen texts) (and passwords) ...
// Login[0] = new Array("Guest", "001,Peter,xxxx", "002,Paul,yyyy", "003,Mary,zzzz", "Webmaster"); // Login[0] = new Array("Guest", "001,Peter,xxxx", "002,Paul,yyyy", "003,Mary,zzzz", "Webmaster");
@ -42,21 +42,21 @@ if (window.Login==null) {
// new Array("Webmaster") // new Array("Webmaster")
// ); // );
Login[1] = true; // Show prompt for student's UserID Login[1] = true; // Show prompt for student's UserID
// If there is no password prompt (i.e. Logon[3] is false), this value // If there is no password prompt (i.e. Logon[3] is false), this value
// will be checked against the password information, if any, in Login[0] // will be checked against the password information, if any, in Login[0]
Login[2] = false; // Show prompt for student's email Login[2] = false; // Show prompt for student's email
Login[3] = false; // Show prompt for quiz password, and check this value against Login[3] = false; // Show prompt for quiz password, and check this value against
// the password information, if any, in Login[0] // the password information, if any, in Login[0]
// This can also be a string required to start the quiz ... // This can also be a string required to start the quiz ...
// Login[3] = "password"; // Login[3] = "password";
Login[4] = true; // Show prompt for the cookie expiry date Login[4] = true; // Show prompt for the cookie expiry date
// If false, cookies expire at the end of the current session // If false, cookies expire at the end of the current session
Login[5] = "guest,webmaster" Login[5] = "guest,webmaster"
// guest user names (case insensitive) ... // guest user names (case insensitive) ...
// Login[5] = "guest,webmaster"; // Login[5] = "guest,webmaster";
// These users do NOT need to fill in other login fields // These users do NOT need to fill in other login fields
// and their quiz results are NOT added to the database // and their quiz results are NOT added to the database
// the Login prompts and error messages // the Login prompts and error messages
// are defined in the MSG array (see below) // are defined in the MSG array (see below)
} }
// ********* // *********
@ -65,25 +65,25 @@ if (window.Login==null) {
if (window.DB==null) { if (window.DB==null) {
DB = new Array(); DB = new Array();
DB[0] = true; // append form fields to database on server DB[0] = true; // append form fields to database on server
// If you are NOT using BFormMail's database feature, // If you are NOT using BFormMail's database feature,
// set DB[0]=false, and you can then safely ignore DB[1 to 5] // set DB[0]=false, and you can then safely ignore DB[1 to 5]
DB[1] = "/home/gordon/public_html/cgi/hot-potatoes-data"; DB[1] = "/home/gordon/public_html/cgi/hot-potatoes-data";
// append_db folder path (no trailing slash) // append_db folder path (no trailing slash)
// Can be either an absolute path e.g. "/home/gordon/public_html/cgi/hot-potatoes-data" // Can be either an absolute path e.g. "/home/gordon/public_html/cgi/hot-potatoes-data"
// or a relative (to CGI bin) path e.g. "hot-potatoes-data" // or a relative (to CGI bin) path e.g. "hot-potatoes-data"
DB[2] = "hot-potatoes"; DB[2] = "hot-potatoes";
// append_db file name (no extension) // append_db file name (no extension)
// If left blank, the quiz file name, without extension, will be used // If left blank, the quiz file name, without extension, will be used
// i.e. each quiz will have its results stored in a different file. // i.e. each quiz will have its results stored in a different file.
// If filled in, this file will store the results for ALL quizzes. // If filled in, this file will store the results for ALL quizzes.
// Database files and folders must be set up BEFORE running the quiz // Database files and folders must be set up BEFORE running the quiz
// must have appropriate access privileges (on Unix, use "chmod 666"). // must have appropriate access privileges (on Unix, use "chmod 666").
DB[3] = ""; // append_db extension (if left blank, ".txt" will be used) DB[3] = ""; // append_db extension (if left blank, ".txt" will be used)
DB[4] = ""; // db_fields (if left blank, ALL quiz fields will be sent) DB[4] = ""; // db_fields (if left blank, ALL quiz fields will be sent)
DB[5] = ""; // db_delimiter (if left blank, tab will be used) DB[5] = ""; // db_delimiter (if left blank, tab will be used)
DB[6] = "REMOTE_ADDR,HTTP_USER_AGENT"; DB[6] = "REMOTE_ADDR,HTTP_USER_AGENT";
// env_report ('REMOTE_ADDR','HTTP_USER_AGENT' and a few others) // env_report ('REMOTE_ADDR','HTTP_USER_AGENT' and a few others)
// for a complete description of these fields are, see ... // for a complete description of these fields are, see ...
// http://www.infosheet.com/stuff/BFormMail.readme // http://www.infosheet.com/stuff/BFormMail.readme
// Switches DB[7] and DB[8] force the settings in the ResultForm // Switches DB[7] and DB[8] force the settings in the ResultForm
// In v5 and v6 quizzes, these settings wil be override those in the original quiz // In v5 and v6 quizzes, these settings wil be override those in the original quiz
@ -94,7 +94,7 @@ if (window.DB==null) {
DB[8] = ''; // email address to which results should be sent DB[8] = ''; // email address to which results should be sent
// e.g. gordon@kanazawa-gu.ac.jp // e.g. gordon@kanazawa-gu.ac.jp
} }
// By default the quiz's question's scores will be returned. // By default the quiz's question's scores will be returned.
// If you want more detailed information, set the flags below: // If you want more detailed information, set the flags below:
// ******** // ********
// JBC // JBC
@ -162,16 +162,16 @@ if (window.JCloze==null) {
// [0] : (unused) // [0] : (unused)
// [1] : array of JCLOZE_ANSWER_TEXTs // [1] : array of JCLOZE_ANSWER_TEXTs
// [2] : clue for this answer // [2] : clue for this answer
// JCLOZE_ANSWER_TEXT : // JCLOZE_ANSWER_TEXT :
// [0] : array (seems unnecessary, just the text would be enough?) // [0] : array (seems unnecessary, just the text would be enough?)
// [0] : text of possible answer // [0] : text of possible answer
// State : array of JCLOZE_ANSWER_STATEs // State : array of JCLOZE_ANSWER_STATEs
// JCLOZE_ANSWER_STATE (v5) : // JCLOZE_ANSWER_STATE (v5) :
// [0] : clue asked for or not // [0] : clue asked for or not
// [1] : number of hints (show next letter) and penalties ('check' an incorrect answer) // [1] : number of hints (show next letter) and penalties ('check' an incorrect answer)
// [2] : length of answer matched // [2] : length of answer matched
// [3] : score for this item // [3] : score for this item
// [4] : already answered correctly // [4] : already answered correctly
// [5] : answer entered in text box (right or not) // [5] : answer entered in text box (right or not)
// JCLOZE_ANSWER_STATE (v6) // JCLOZE_ANSWER_STATE (v6)
// this.ClueGiven = false; // this.ClueGiven = false;
@ -196,16 +196,16 @@ if (window.JCross==null) {
JCross[8] = true; // show number of checks JCross[8] = true; // show number of checks
// there are no "ignored" answers for JCross quizzes // there are no "ignored" answers for JCross quizzes
} }
// JCross quizzes use the following global variables: // JCross quizzes use the following global variables:
// L : letters (of correct answers) // L : letters (of correct answers)
// C : clue numbers (CL in v6) // C : clue numbers (CL in v6)
// G : guesses // G : guesses
// 'L', 'C' ('CL') and 'G' are all 2-dimensional arrays (rows x cols) // 'L', 'C' ('CL') and 'G' are all 2-dimensional arrays (rows x cols)
// //
// v5 quizzes additionally use the following single-dimension arrays // v5 quizzes additionally use the following single-dimension arrays
// A : clues for across (horizontal) words // A : clues for across (horizontal) words
// D : clues for down (vertical) words // D : clues for down (vertical) words
// N.B. form is only sent when all answers are correct so // N.B. form is only sent when all answers are correct so
// you can't find out what 'wrong' answers were entered // you can't find out what 'wrong' answers were entered
// ******** // ********
// JMatch // JMatch
@ -251,7 +251,7 @@ if (window.JMatch==null) {
// [0] : text // [0] : text
// [1] : tag of the F item to which it SHOULD be dragged // [1] : tag of the F item to which it SHOULD be dragged
// [2] : tag of the F item to which it was dragged (initally 0) // [2] : tag of the F item to which it was dragged (initally 0)
// N.B. form is only sent when all answers are correct so // N.B. form is only sent when all answers are correct so
// you can't find out what 'wrong' answers were entered // you can't find out what 'wrong' answers were entered
// ******** // ********
// JMix // JMix
@ -266,8 +266,8 @@ if (window.JMix==null) {
JMix[5] = true; // show number of checks JMix[5] = true; // show number of checks
JMix[6] = true; // show number of hints (=show next word) JMix[6] = true; // show number of hints (=show next word)
} }
// JMix quizzes use the global variables // JMix quizzes use the global variables
// 'Segments', 'GuessSequence' and 'Penalties' // 'Segments', 'GuessSequence' and 'Penalties'
// Segments : array of JMix_QUESTIONs // Segments : array of JMix_QUESTIONs
// JMix_QUESTION: // JMix_QUESTION:
// [0] : text // [0] : text
@ -305,7 +305,7 @@ if (window.JQuiz==null) {
// [0] : array (seems unnecessary, just the text would be enough?) // [0] : array (seems unnecessary, just the text would be enough?)
// [0] : text of possible answer // [0] : text of possible answer
// Status : array of JQUIZ_ANSWER_STATEs // Status : array of JQUIZ_ANSWER_STATEs
// JQUIZ_ANSWER_STATE : // JQUIZ_ANSWER_STATE :
// [0] : question done or not // [0] : question done or not
// [1] : number of wrong checks // [1] : number of wrong checks
// [2] : number of hints asked for // [2] : number of hints asked for
@ -324,23 +324,23 @@ if (window.JQuiz==null) {
// [1] : feedback text // [1] : feedback text
// [2] : correct answer flag (1=a correct answer, 0=a wrong answer) // [2] : correct answer flag (1=a correct answer, 0=a wrong answer)
// [3] : weighted score (as percentage) if correct // [3] : weighted score (as percentage) if correct
// [4] : flag (usually set to 1, but for hybrid answers that are not // [4] : flag (usually set to 1, but for hybrid answers that are not
// to be included in multiple choice options, it is set to 0) // to be included in multiple choice options, it is set to 0)
// State : array of JQUIZ_QUESTION_STATEs // State : array of JQUIZ_QUESTION_STATEs
// JQUIZ_QUESTION_STATE : // JQUIZ_QUESTION_STATE :
// [0] : score (-1 shows not done yet) // [0] : score (-1 shows not done yet)
// [1] : array showing on which number try each JQUIZ_ANSWER was selected // [1] : array showing on which number try each JQUIZ_ANSWER was selected
// [2] : number of attempts at this question // [2] : number of attempts at this question
// [3] : total of weighted scores of correct answers that were selected // [3] : total of weighted scores of correct answers that were selected
// i.e. each time a correct answer is selected, // i.e. each time a correct answer is selected,
// its JQUIZ_ANSWER[3] weighting is added to this total // its JQUIZ_ANSWER[3] weighting is added to this total
// so when all the correct answers have been selected, this will be 100 // so when all the correct answers have been selected, this will be 100
// [4] : penalties incurred for hints (score is set to zero if >= 1) // [4] : penalties incurred for hints (score is set to zero if >= 1)
// [5] : - for multiple choice, short-answer and hybrid questions, this is a // [5] : - for multiple choice, short-answer and hybrid questions, this is a
// comma-delimited list showing order in which answers were chosen // comma-delimited list showing order in which answers were chosen
// - for multi-select fields, this is bar-delimted ('|') list of settings // - for multi-select fields, this is bar-delimted ('|') list of settings
// showing whether each checkbox was selected ('Y') on not ('N') when the // showing whether each checkbox was selected ('Y') on not ('N') when the
// 'Check' button was clicked. The final item in the list will be the // 'Check' button was clicked. The final item in the list will be the
// settings for the correct answer. // settings for the correct answer.
// N.B. JBC, JMatch(v5) and JQuiz(v5) all use global variables 'I' and 'Status' // N.B. JBC, JMatch(v5) and JQuiz(v5) all use global variables 'I' and 'Status'
// JBC : I[0].length==3 && !window.RItems // JBC : I[0].length==3 && !window.RItems
@ -624,7 +624,7 @@ function checkOK(w, n){
function getValue(w, n, flag) { function getValue(w, n, flag) {
var obj = w.document.forms[0].elements[n]; var obj = w.document.forms[0].elements[n];
var TYPE = obj.type.toUpperCase(); // required for ns4 (win) var TYPE = obj.type.toUpperCase(); // required for ns4 (win)
if (obj.options && TYPE.indexOf('SELECT')>=0){ if (obj.options && TYPE.indexOf('SELECT')>=0){
var v = obj.options[obj.selectedIndex].value; var v = obj.options[obj.selectedIndex].value;
} else { } else {
var v = obj.value; var v = obj.value;
@ -634,7 +634,7 @@ function getValue(w, n, flag) {
if (n=='Password' || (n=='UserID' && !Login[3])) { if (n=='Password' || (n=='UserID' && !Login[3])) {
var pwd = getPassword(w); var pwd = getPassword(w);
if (pwd && v!=pwd) msg = MSG[n=='Password' ? 13 : 14]; if (pwd && v!=pwd) msg = MSG[n=='Password' ? 13 : 14];
} }
if (n=='UserEmail' && window.RegExp) { if (n=='UserEmail' && window.RegExp) {
var r = '(\\w|-)+'; var r = '(\\w|-)+';
r = r + '(\\.' + r + ')'; r = r + '(\\.' + r + ')';
@ -784,7 +784,7 @@ function SendAllResults(Score) {
// if this is a Netscape browser, check if the referer will be set OK // if this is a Netscape browser, check if the referer will be set OK
if (navigator.appName=='Netscape' && (location.protocol=='file:' || navigator.userAgent.indexOf('Netscape6')>=0)) { if (navigator.appName=='Netscape' && (location.protocol=='file:' || navigator.userAgent.indexOf('Netscape6')>=0)) {
// ns4 and ns7 set referer to 'file:// ...' when running a quiz offline // ns4 and ns7 set referer to 'file:// ...' when running a quiz offline
// ns6.2 (at least) always sets referer to 'about:blank' // ns6.2 (at least) always sets referer to 'about:blank'
// Netscape's setting of referer can cause BFormMail // Netscape's setting of referer can cause BFormMail
// to reject the form, so encode the form data as a URL // to reject the form, so encode the form data as a URL
var url = form.action; var url = form.action;
@ -931,11 +931,11 @@ function GetQuestionDetails() {
var hp = hpVersion(); var hp = hpVersion();
var t = hpQuizType(); var t = hpQuizType();
var v = hpQuizVersion(); var v = hpQuizVersion();
return (t==1) ? GetJbcQuestionDetails(hp, v) : return (t==1) ? GetJbcQuestionDetails(hp, v) :
(t==2) ? GetJClozeQuestionDetails(hp, v) : (t==2) ? GetJClozeQuestionDetails(hp, v) :
(t==3) ? GetJCrossQuestionDetails(hp, v) : (t==3) ? GetJCrossQuestionDetails(hp, v) :
(t==4) ? GetJMatchQuestionDetails(hp, v) : (t==4) ? GetJMatchQuestionDetails(hp, v) :
(t==5) ? GetJMixQuestionDetails(hp, v) : (t==5) ? GetJMixQuestionDetails(hp, v) :
(t==6) ? GetJQuizQuestionDetails(hp, v) : (t==6) ? GetJQuizQuestionDetails(hp, v) :
(t==7) ? GetRhubarbDetails(hp, v) : (t==7) ? GetRhubarbDetails(hp, v) :
(t==8) ? GetSequiturDetails(hp, v) : ''; (t==8) ? GetSequiturDetails(hp, v) : '';
@ -944,7 +944,7 @@ function GetJbcQuestionDetails(hp, v) {
qDetails = ''; qDetails = '';
// check the quiz version // check the quiz version
if (hp==5 || hp==6) { if (hp==5 || hp==6) {
// get question details // get question details
for(var q=0; q<I.length; q++) { for(var q=0; q<I.length; q++) {
// initialize strings to hold answer details // initialize strings to hold answer details
var aDetails = new Array(); var aDetails = new Array();
@ -953,7 +953,7 @@ function GetJbcQuestionDetails(hp, v) {
aDetails[2] = new Array(); // ignored aDetails[2] = new Array(); // ignored
// get answer details // get answer details
for(var a=0; a<I[q][1].length; a++) { for(var a=0; a<I[q][1].length; a++) {
var i = (Status[q][1][a]=='R') ? 0 : (Status[q][1][a]=='0') ? 2 : 1; var i = (Status[q][1][a]=='R') ? 0 : (Status[q][1][a]=='0') ? 2 : 1;
aDetails[i][aDetails[i].length] = (JBC[6] ? a : I[q][1][a][0]); aDetails[i][aDetails[i].length] = (JBC[6] ? a : I[q][1][a][0]);
} }
// format 'Q' (a padded, two-digit version of 'q') // format 'Q' (a padded, two-digit version of 'q')
@ -1076,19 +1076,19 @@ function GetJCrossQuestionDetails(hp, v) {
for (var row=0; row<L.length; row++) { for (var row=0; row<L.length; row++) {
for (var col=0; col<L[row].length; col++) { for (var col=0; col<L[row].length; col++) {
// increment letter count, if required // increment letter count, if required
if (L[row][col]) letters++; if (L[row][col]) letters++;
// show answers and clues, if required // show answers and clues, if required
var q = (hp==5) ? C[row][col] : CL[row][col]; var q = (hp==5) ? C[row][col] : CL[row][col];
if (q) { if (q) {
for (var i=0; i<2; i++) { // 0==across, 1==down for (var i=0; i<2; i++) { // 0==across, 1==down
var AD = (i==0) ? 'A' : 'D'; var AD = (i==0) ? 'A' : 'D';
var acrossdown = (i==0) ? 'across' : 'down'; var acrossdown = (i==0) ? 'across' : 'down';
var clue = (hp==5) ? eval(AD+'['+q+']') : GetJCrossClue('Clue_'+AD+'_'+q); var clue = (hp==5) ? eval(AD+'['+q+']') : GetJCrossClue('Clue_'+AD+'_'+q);
if (clue) { if (clue) {
// format 'Q' (a padded, two-digit version of 'q') // format 'Q' (a padded, two-digit version of 'q')
var Q = getQ('JCross', q) + acrossdown + '_'; // e.g. JCross_01_across_ var Q = getQ('JCross', q) + acrossdown + '_'; // e.g. JCross_01_across_
if (JCross[0]) { if (JCross[0]) {
qDetails += makeSeparator(Q); qDetails += makeSeparator(Q);
} }
@ -1384,7 +1384,7 @@ function GetJQuizAnswerDetails(q, flag) {
} }
x[i] = a.join('+'); x[i] = a.join('+');
} }
} else if (x) { // multiple-choice, short-answer and hybrid } else if (x) { // multiple-choice, short-answer and hybrid
if (x.charAt(x.length-1)==',') { if (x.charAt(x.length-1)==',') {
// HP 6.0 and 6.1 (always has trailing comma) // HP 6.0 and 6.1 (always has trailing comma)
x = x.substring(0, x.length-1).split(','); x = x.substring(0, x.length-1).split(',');
@ -1577,7 +1577,7 @@ function hpClickCheck(hp, t, v, args) {
if (window.MakeIndividualDropdowns) { if (window.MakeIndividualDropdowns) {
var is_wrong = (ii!=0); var is_wrong = (ii!=0);
g = I[i][1][ii][0]; g = I[i][1][ii][0];
} else { } else {
var is_wrong = (ii!=i); var is_wrong = (ii!=i);
g = I[ii][1][0][0]; g = I[ii][1][0][0];
} }
@ -1592,13 +1592,13 @@ function hpClickCheck(hp, t, v, args) {
if (!HP[_guesses][i]) HP[_guesses][i] = new Array(); if (!HP[_guesses][i]) HP[_guesses][i] = new Array();
var ii = HP[_guesses][i].length; var ii = HP[_guesses][i].length;
// is this a new guess at this gap? // is this a new guess at this gap?
if (ii==0 || g!=HP[_guesses][i][ii-1]) { if (ii==0 || g!=HP[_guesses][i][ii-1]) {
HP[_guesses][i][ii] = g; HP[_guesses][i][ii] = g;
if (r==1) { if (r==1) {
// Rottmeier DropDown 2.4 // Rottmeier DropDown 2.4
// do nothing // do nothing
} else { } else {
var G = g.toUpperCase(); var G = g.toUpperCase();
var ii_max = I[i][1].length; var ii_max = I[i][1].length;
for (var ii=0; ii<ii_max; ii++) { for (var ii=0; ii<ii_max; ii++) {
if (window.CaseSensitive) { if (window.CaseSensitive) {
@ -1826,7 +1826,7 @@ function hpClickCheck(hp, t, v, args) {
} else { } else {
if (!HP[_wrong][q]) HP[_wrong][q] = 0; if (!HP[_wrong][q]) HP[_wrong][q] = 0;
HP[_wrong][q]++; HP[_wrong][q]++;
} }
} }
} }
//return true; //return true;
@ -1944,7 +1944,7 @@ function hpHiddenField(name, value, comma, forceHTML) {
var values = value; var values = value;
var i_max = values.length; var i_max = values.length;
value = ''; value = '';
if (comma==null) comma = ','; if (comma==null) comma = ',';
for (var i=0; i<i_max; i++) { for (var i=0; i<i_max; i++) {
values[i] = trim(values[i]); values[i] = trim(values[i]);
if (values[i]!=null && values[i]!='') { if (values[i]!=null && values[i]!='') {
@ -1999,8 +1999,8 @@ function getTime(obj) {
// get year, month and day // get year, month and day
// for an LMS : yyyy-mm-dd // for an LMS : yyyy-mm-dd
// for email : DayName MonthName dd yyyy // for email : DayName MonthName dd yyyy
var s = is_LMS() ? var s = is_LMS() ?
obj.getFullYear() + '-' + pad(obj.getMonth()+1, 2) + '-' + pad(obj.getDate(), 2) : obj.getFullYear() + '-' + pad(obj.getMonth()+1, 2) + '-' + pad(obj.getDate(), 2) :
MSG[16][obj.getDay()] + ' ' + MSG[17][obj.getMonth()] + ' ' + pad(obj.getDate(), 2) + ' ' + obj.getFullYear() MSG[16][obj.getDay()] + ' ' + MSG[17][obj.getMonth()] + ' ' + pad(obj.getDate(), 2) + ' ' + obj.getFullYear()
; ;
// get hours, minutes and seconds (hh:mm:ss) // get hours, minutes and seconds (hh:mm:ss)
@ -2093,7 +2093,7 @@ function getPrompt(fn) {
// Note: netscape uses double-quote as delimiter, others use single quote // Note: netscape uses double-quote as delimiter, others use single quote
var s = getFuncCode(fn); var s = getFuncCode(fn);
var i1 = s.indexOf('prompt') + 8; var i1 = s.indexOf('prompt') + 8;
var i2 = s.indexOf(s.charAt(i1-1), i1); var i2 = s.indexOf(s.charAt(i1-1), i1);
var p = (i1>=8 && i2>i1) ? s.substring(i1, i2) : ''; var p = (i1>=8 && i2>i1) ? s.substring(i1, i2) : '';
// make sure browser has decoded the unicode prompt properly // make sure browser has decoded the unicode prompt properly
// this check is mainly for ns4, but there may be others // this check is mainly for ns4, but there may be others
@ -2109,13 +2109,13 @@ function getPrompt(fn) {
} }
function getStartUpCode(fn) { function getStartUpCode(fn) {
// the main initialization code comes from the StartUp function // the main initialization code comes from the StartUp function
// v5 : the code before "UserName", if any, // v5 : the code before "UserName", if any,
// and the code after the 2nd subsequent '}' // and the code after the 2nd subsequent '}'
// v6 : the code before and after 'GetUserName();' // v6 : the code before and after 'GetUserName();'
// i.e. all the code except the call to 'GetUserName();' // i.e. all the code except the call to 'GetUserName();'
var s = getFuncCode(fn); var s = getFuncCode(fn);
var i1 = s.indexOf('GetUserName();'); var i1 = s.indexOf('GetUserName();');
if (i1>=0) { // v6 if (i1>=0) { // v6
var i2 = i1 + 14; var i2 = i1 + 14;
} else { // v5 } else { // v5
var i1 = s.indexOf('UserName'); var i1 = s.indexOf('UserName');
@ -2310,14 +2310,14 @@ function hpInterceptHints() {
var f = 'Hint'; var f = 'Hint';
var a = getFuncArgs(f, true); var a = getFuncArgs(f, true);
x = 'hpClick(1,0);'; // question number is always zero x = 'hpClick(1,0);'; // question number is always zero
} else if (window.CheckAnswer) { } else if (window.CheckAnswer) {
var f = 'CheckAnswer'; var f = 'CheckAnswer';
var a = getFuncArgs(f, true); var a = getFuncArgs(f, true);
if (a[0]=='ShowHint') { if (a[0]=='ShowHint') {
if (a[1]=='QNum') { if (a[1]=='QNum') {
// JQuiz v3, v5-v6[HP5] // JQuiz v3, v5-v6[HP5]
x = 'if(ShowHint)hpClick(1,QNum);'; x = 'if(ShowHint)hpClick(1,QNum);';
} else { } else {
// JQuiz v4 // JQuiz v4
x = 'if(ShowHint)hpClick(1,QNum-1);'; // QNum is a global variable x = 'if(ShowHint)hpClick(1,QNum-1);'; // QNum is a global variable
@ -2397,7 +2397,7 @@ function hpInterceptChecks() {
// JCross none // JCross none
// JMatch HP5 v3, v5, v6: CheckAnswer(), HP5 v4: CheckResults(), HP6: CheckAnswers() // JMatch HP5 v3, v5, v6: CheckAnswer(), HP5 v4: CheckResults(), HP6: CheckAnswers()
// JMix CheckAnswer(CheckType) // JMix CheckAnswer(CheckType)
// JQuiz // JQuiz
// HP5: CheckAnswer(ShowHint, QNum) // HP5: CheckAnswer(ShowHint, QNum)
// HP6: CheckMCAnswer, CheckMultiSelAnswer, CheckShortAnswer // HP6: CheckMCAnswer, CheckMultiSelAnswer, CheckShortAnswer
// Rhubarb CheckWord(InputWord) // Rhubarb CheckWord(InputWord)
@ -2440,7 +2440,7 @@ function hpInterceptChecks() {
if (a[0]=='ShowHint') { if (a[0]=='ShowHint') {
if (a[1]=='QNum') { if (a[1]=='QNum') {
// JQuiz v3, v5-v6[HP5] // JQuiz v3, v5-v6[HP5]
x = 'if(!ShowHint&&Status[QNum][0]<1)hpClick(3,QNum);'; x = 'if(!ShowHint&&Status[QNum][0]<1)hpClick(3,QNum);';
} else { } else {
// JQuiz v4 // JQuiz v4
x = 'if(!ShowHint&&State[QNum-1][0]<1)hpClick(3,QNum-1);'; // QNum is a global variable x = 'if(!ShowHint&&State[QNum-1][0]<1)hpClick(3,QNum-1);'; // QNum is a global variable
@ -2452,7 +2452,7 @@ function hpInterceptChecks() {
// Sequitur // Sequitur
x = 'if (!(CurrentNumber==TotalSegments||AllDone||Btn.innerHTML==IncorrectIndicator))hpClick(3,Chosen);'; x = 'if (!(CurrentNumber==TotalSegments||AllDone||Btn.innerHTML==IncorrectIndicator))hpClick(3,Chosen);';
} }
} else if (window.CheckWord) { } else if (window.CheckWord) {
f = 'CheckWord'; f = 'CheckWord';
var a = getFuncArgs(f, true); var a = getFuncArgs(f, true);
if (a[0]=='InputWord') { if (a[0]=='InputWord') {
@ -2492,7 +2492,7 @@ if (Array.prototype && Array.prototype.push==null) {
Array.prototype.push = new Function("x", "this[this.length]=x"); Array.prototype.push = new Function("x", "this[this.length]=x");
} }
// add attachEvent function, if required (allows HP5 v6 quizzes to run on ie5mac) // add attachEvent function, if required (allows HP5 v6 quizzes to run on ie5mac)
// NOTE: to allow v6 quizzes on ie5mac, the following code // NOTE: to allow v6 quizzes on ie5mac, the following code
// needs to be inserted BEFORE the Hot Potatoes javascript // needs to be inserted BEFORE the Hot Potatoes javascript
if (window.attachEvent==null) { if (window.attachEvent==null) {
window.attachEvent = new Function('evt', 'fn', 'eval("window."+evt+"="+fn)'); window.attachEvent = new Function('evt', 'fn', 'eval("window."+evt+"="+fn)');
@ -2534,7 +2534,7 @@ if (navigator.userAgent.indexOf("Netscape6")>=0 && window.ShowMessage) {
// JBC uses "QForm" form, which contains elements called "FB_*_**" (* and ** start at 0) // JBC uses "QForm" form, which contains elements called "FB_*_**" (* and ** start at 0)
// JCloze uses "Cloze" form // JCloze uses "Cloze" form
// JCross writes out "AnswerForm" from a variable called "GetAnswerOpener" // JCross writes out "AnswerForm" from a variable called "GetAnswerOpener"
// HP5.3: uses "AnswerForm" in "BottomFrame" // HP5.3: uses "AnswerForm" in "BottomFrame"
// HP5.5: uses "AnswerForm" in "TopFrame", but it is only there when an answer is being input // HP5.5: uses "AnswerForm" in "TopFrame", but it is only there when an answer is being input
// JMatch uses "QForm" form, which contains elements called "sel*" (which disappear by the time the quiz is finished) // JMatch uses "QForm" form, which contains elements called "sel*" (which disappear by the time the quiz is finished)
// JMix uses "ButtonForm" // JMix uses "ButtonForm"
@ -2542,14 +2542,14 @@ if (navigator.userAgent.indexOf("Netscape6")>=0 && window.ShowMessage) {
// === v6 === // === v6 ===
// JBC uses "QForm" form (elements have no name or id) // JBC uses "QForm" form (elements have no name or id)
// JCloze uses "Cloze" form (elements have no name or id) // JCloze uses "Cloze" form (elements have no name or id)
// JCross does not use any forms, // JCross does not use any forms,
// HP5: has "GridDiv" in "MainDiv" // HP5: has "GridDiv" in "MainDiv"
// HP6: has "Clues" table in "MainDiv" // HP6: has "Clues" table in "MainDiv"
// JMatch has "MatchDiv" in "MainDiv" // JMatch has "MatchDiv" in "MainDiv"
// HP5: uses "QForm" form, which contains elements called "sel*" // HP5: uses "QForm" form, which contains elements called "sel*"
// HP6: uses "QForm" form, which contains elements called "s*_**" // HP6: uses "QForm" form, which contains elements called "s*_**"
// JMix does not use any forms, but has "SegmentDiv" in "MainDiv" // JMix does not use any forms, but has "SegmentDiv" in "MainDiv"
// JQuiz // JQuiz
// HP5: uses "QForm" form, which contains an element called "Guess" // HP5: uses "QForm" form, which contains an element called "Guess"
// HP6: has "Questions" ordered list in "MainDiv" // HP6: has "Questions" ordered list in "MainDiv"
// === v6+ === // === v6+ ===
@ -2833,7 +2833,7 @@ function hpTimedOut() {
} }
function hpFinished() { function hpFinished() {
// assume false result // assume false result
var x = false; var x = false;
var hp = hpVersion(); var hp = hpVersion();
var t = hpQuizType(); var t = hpQuizType();
var v = hpQuizVersion(); var v = hpQuizVersion();
@ -2962,7 +2962,7 @@ function Finish(quizstatus) {
} }
} }
// create form to send results // create form to send results
if (DB[7] && DB[8] && !is_LMS()) { if (DB[7] && DB[8] && !is_LMS()) {
ResultForm = '' ResultForm = ''
+ '<html><body>' + '<html><body>'
+ '<form name="Results" action="" method="post" enctype="x-www-form-encoded">' + '<form name="Results" action="" method="post" enctype="x-www-form-encoded">'

View file

@ -6,7 +6,7 @@
require_once("../../course/lib.php"); require_once("../../course/lib.php");
require_once("lib.php"); require_once("lib.php");
$id = required_param('id', PARAM_INT); // course $id = required_param('id', PARAM_INT); // course
if (! $course = get_record("course", "id", $id)) { if (! $course = get_record("course", "id", $id)) {
error("Course ID is incorrect"); error("Course ID is incorrect");
} }
@ -68,7 +68,7 @@
// do nothing (user is not diplaying this section) // do nothing (user is not diplaying this section)
} else { } else {
$hotpots[$hotpot_instance->id] = $hotpot_instance; $hotpots[$hotpot_instance->id] = $hotpot_instance;
} }
} }
} }
if (empty($hotpots)) { if (empty($hotpots)) {
@ -197,9 +197,9 @@
if ($concat_field) { if ($concat_field) {
$records = get_records_sql(" $records = get_records_sql("
SELECT $concat_field, COUNT(*), hotpot, name SELECT $concat_field, COUNT(*), hotpot, name
FROM {$CFG->prefix}hotpot_questions FROM {$CFG->prefix}hotpot_questions
WHERE hotpot IN ($hotpotids) WHERE hotpot IN ($hotpotids)
GROUP BY hotpot, name GROUP BY hotpot, name
HAVING COUNT(*) >1 HAVING COUNT(*) >1
"); ");
if ($records) { if ($records) {
@ -268,31 +268,31 @@
} }
switch ($course->format) { switch ($course->format) {
case 'weeks' : case 'weeks' :
$title = get_string("week"); $title = get_string("week");
break; break;
case 'topics' : case 'topics' :
$title = get_string("topic"); $title = get_string("topic");
break; break;
default : default :
$title = ''; $title = '';
break; break;
} }
if ($title) { if ($title) {
array_push($table->head, $title); array_push($table->head, $title);
array_push($table->align, "center"); array_push($table->align, "center");
} }
if (has_capability('moodle/course:manageactivities', $coursecontext)) { if (has_capability('moodle/course:manageactivities', $coursecontext)) {
array_push($table->head, $strupdate); array_push($table->head, $strupdate);
array_push($table->align, "center"); array_push($table->align, "center");
} }
array_push($table->head, array_push($table->head,
get_string("name"), get_string("name"),
get_string("quizcloses", "quiz"), get_string("quizcloses", "quiz"),
get_string("bestgrade", "quiz"), get_string("bestgrade", "quiz"),
get_string("attempts", "quiz") get_string("attempts", "quiz")
); );
array_push($table->align, array_push($table->align,
"left", "left", "center", "left" "left", "left", "center", "left"
); );
if (has_capability('mod/hotpot:grade', $coursecontext)) { if (has_capability('mod/hotpot:grade', $coursecontext)) {
@ -334,7 +334,7 @@
$bestscore = "&nbsp;"; $bestscore = "&nbsp;";
} else { } else {
$cm = get_coursemodule_from_instance('hotpot', $hotpot->id); $cm = get_coursemodule_from_instance('hotpot', $hotpot->id);
// report number of attempts and users // report number of attempts and users
$report = get_string("viewallreports","quiz", $totals[$hotpot->id]->attemptcount); $report = get_string("viewallreports","quiz", $totals[$hotpot->id]->attemptcount);

View file

@ -242,11 +242,11 @@ function hotpot_update_events($hotpot) {
$event->timeduration = ($hotpot->timeclose - $hotpot->timeopen); $event->timeduration = ($hotpot->timeclose - $hotpot->timeopen);
if ($event->timeduration > HOTPOT_MAX_EVENT_LENGTH) { /// Long durations create two events if ($event->timeduration > HOTPOT_MAX_EVENT_LENGTH) { /// Long durations create two events
$event->name = addslashes($hotpot->name).' ('.get_string('hotpotopens', 'hotpot').')'; $event->name = addslashes($hotpot->name).' ('.get_string('hotpotopens', 'hotpot').')';
$event->timeduration = 0; $event->timeduration = 0;
add_event($event); add_event($event);
$event->timestart = $hotpot->timeclose; $event->timestart = $hotpot->timeclose;
$event->eventtype = 'close'; $event->eventtype = 'close';
$event->name = addslashes($hotpot->name).' ('.get_string('hotpotcloses', 'hotpot').')'; $event->name = addslashes($hotpot->name).' ('.get_string('hotpotcloses', 'hotpot').')';
@ -451,7 +451,7 @@ function hotpot_is_visible(&$cm) {
} }
$cm->sectionvisible = $section->visible; $cm->sectionvisible = $section->visible;
} }
if (empty($cm->sectionvisible)) { if (empty($cm->sectionvisible)) {
$visible = HOTPOT_NO; $visible = HOTPOT_NO;
} else { } else {
@ -783,7 +783,7 @@ function hotpot_get_all_instances_in_course($modulename, $course) {
if ($rawmods = get_records_sql($query)) { if ($rawmods = get_records_sql($query)) {
// cache $isteacher setting // cache $isteacher setting
$isteacher = has_capability('mod/hotpot:viewreport', get_context_instance(CONTEXT_COURSE, $course->id)); $isteacher = has_capability('mod/hotpot:viewreport', get_context_instance(CONTEXT_COURSE, $course->id));
$explodesection = array(); $explodesection = array();
@ -990,7 +990,7 @@ function hotpot_print_recent_activity($course, $isteacher, $timestart) {
foreach ($records as $id => $record){ foreach ($records as $id => $record){
if ($cm = get_coursemodule_from_instance('hotpot', $record->id, $course->id)) { if ($cm = get_coursemodule_from_instance('hotpot', $record->id, $course->id)) {
$context = get_context_instance(CONTEXT_MODULE, $cm->id); $context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (has_capability('mod/hotpot:viewreport', $context)) { if (has_capability('mod/hotpot:viewreport', $context)) {
$href = "$CFG->wwwroot/mod/hotpot/view.php?hp=$id"; $href = "$CFG->wwwroot/mod/hotpot/view.php?hp=$id";
$name = '&nbsp;<a href="'.$href.'">'.$record->name.'</a>'; $name = '&nbsp;<a href="'.$href.'">'.$record->name.'</a>';
@ -1274,7 +1274,7 @@ function hotpot_add_attempt($hotpotid) {
$attempt->status = HOTPOT_STATUS_ABANDONED; $attempt->status = HOTPOT_STATUS_ABANDONED;
update_record('hotpot_attempts', $attempt); update_record('hotpot_attempts', $attempt);
} }
} }
// create and add new attempt record // create and add new attempt record
$attempt = new stdClass(); $attempt = new stdClass();
@ -1778,7 +1778,7 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
$i_max = count($objects[0]); $i_max = count($objects[0]);
for ($i=0; $i<$i_max; $i++) { for ($i=0; $i<$i_max; $i++) {
// extract URL from <PARAM> or <A> // extract URL from <PARAM> or <A>
$url = ''; $url = '';
if (preg_match($param_url, $objects[3][$i], $matches) || preg_match($link_url, $objects[3][$i], $matches)) { if (preg_match($param_url, $objects[3][$i], $matches) || preg_match($link_url, $objects[3][$i], $matches)) {
$url = $matches[3]; $url = $matches[3];
@ -2318,13 +2318,13 @@ if (!function_exists('get_coursemodule_from_id')) {
function get_coursemodule_from_id($modulename, $cmid, $courseid=0) { function get_coursemodule_from_id($modulename, $cmid, $courseid=0) {
global $CFG; global $CFG;
return get_record_sql(" return get_record_sql("
SELECT SELECT
cm.*, m.name, md.name as modname cm.*, m.name, md.name as modname
FROM FROM
{$CFG->prefix}course_modules cm, {$CFG->prefix}course_modules cm,
{$CFG->prefix}modules md, {$CFG->prefix}modules md,
{$CFG->prefix}$modulename m {$CFG->prefix}$modulename m
WHERE WHERE
".($courseid ? "cm.course = '$courseid' AND " : '')." ".($courseid ? "cm.course = '$courseid' AND " : '')."
cm.id = '$cmid' AND cm.id = '$cmid' AND
cm.instance = m.id AND cm.instance = m.id AND
@ -2338,13 +2338,13 @@ if (!function_exists('get_coursemodule_from_instance')) {
function get_coursemodule_from_instance($modulename, $instance, $courseid=0) { function get_coursemodule_from_instance($modulename, $instance, $courseid=0) {
global $CFG; global $CFG;
return get_record_sql(" return get_record_sql("
SELECT SELECT
cm.*, m.name, md.name as modname cm.*, m.name, md.name as modname
FROM FROM
{$CFG->prefix}course_modules cm, {$CFG->prefix}course_modules cm,
{$CFG->prefix}modules md, {$CFG->prefix}modules md,
{$CFG->prefix}$modulename m {$CFG->prefix}$modulename m
WHERE WHERE
".($courseid ? "cm.course = '$courseid' AND" : '')." ".($courseid ? "cm.course = '$courseid' AND" : '')."
cm.instance = m.id AND cm.instance = m.id AND
md.name = '$modulename' AND md.name = '$modulename' AND

View file

@ -1,13 +1,13 @@
<?php // $id$ <?php // $id$
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
// Media plugin filtering // Media plugin filtering
// //
// This filter will replace any links to a media file with // This filter will replace any links to a media file with
// a media plugin that plays that media inline // a media plugin that plays that media inline
// //
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
/// This is the filtering function itself. It accepts the /// This is the filtering function itself. It accepts the
/// courseid and the text to be filtered (in HTML form). /// courseid and the text to be filtered (in HTML form).
function hotpot_mediaplayer_moodle(&$hotpot, $text) { function hotpot_mediaplayer_moodle(&$hotpot, $text) {
@ -42,7 +42,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
$replace .= ' pluginspage="http://www.macromedia.com/go/getflashplayer">'; $replace .= ' pluginspage="http://www.macromedia.com/go/getflashplayer">';
$replace .= '</embed>'; $replace .= '</embed>';
$replace .= '</object>&nbsp;'; $replace .= '</object>&nbsp;';
$text = preg_replace($search, $replace, $text); $text = preg_replace($search, $replace, $text);
} }
@ -86,7 +86,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
if ($CFG->filter_mediaplugin_enable_flv) { if ($CFG->filter_mediaplugin_enable_flv) {
$search = '/<a(.*?)href=\"([^<]+)\.flv\"([^>]*)>(.*?)<\/a>/is'; $search = '/<a(.*?)href=\"([^<]+)\.flv\"([^>]*)>(.*?)<\/a>/is';
$replace = '\\0&nbsp;<object class="mediaplugin flv" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'; $replace = '\\0&nbsp;<object class="mediaplugin flv" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
$replace .= ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" '; $replace .= ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
$replace .= ' width="480" height="360" id="flvplayer">'; $replace .= ' width="480" height="360" id="flvplayer">';
@ -99,7 +99,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
$replace .= ' pluginspage="http://www.macromedia.com/go/getflashplayer">'; $replace .= ' pluginspage="http://www.macromedia.com/go/getflashplayer">';
$replace .= '</embed>'; $replace .= '</embed>';
$replace .= '</object>&nbsp;'; $replace .= '</object>&nbsp;';
$text = preg_replace($search, $replace, $text); $text = preg_replace($search, $replace, $text);
} }
@ -161,7 +161,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
$replace .= '<param name="autoplay" value="false" />'; $replace .= '<param name="autoplay" value="false" />';
$replace .= '<embed src="\\2.\\3" width="240" height="180" controller="true" autoplay="false"> </embed>'; $replace .= '<embed src="\\2.\\3" width="240" height="180" controller="true" autoplay="false"> </embed>';
$replace .= '</object></p>'; $replace .= '</object></p>';
$text = preg_replace($search, $replace, $text); $text = preg_replace($search, $replace, $text);
} }
@ -174,10 +174,10 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
$replace .= '<param name="autoplay" value="false" />'; $replace .= '<param name="autoplay" value="false" />';
$replace .= '<embed src="\\2.avi" width="240" height="180" controller="true" autoplay="false"> </embed>'; $replace .= '<embed src="\\2.avi" width="240" height="180" controller="true" autoplay="false"> </embed>';
$replace .= '</object></p>'; $replace .= '</object></p>';
$text = preg_replace($search, $replace, $text); $text = preg_replace($search, $replace, $text);
} }
if ($CFG->filter_mediaplugin_enable_ram) { if ($CFG->filter_mediaplugin_enable_ram) {
$search = '/<a(.*?)href=\"([^<]+)\.ram\"([^>]*)>(.*?)<\/a>/is'; $search = '/<a(.*?)href=\"([^<]+)\.ram\"([^>]*)>(.*?)<\/a>/is';
@ -202,7 +202,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
$text = preg_replace($search, $replace, $text); $text = preg_replace($search, $replace, $text);
} }
if ($CFG->filter_mediaplugin_enable_rpm) { if ($CFG->filter_mediaplugin_enable_rpm) {
$search = '/<a(.*?)href=\"([^<]+)\.rpm\"([^>]*)>(.*?)<\/a>/is'; $search = '/<a(.*?)href=\"([^<]+)\.rpm\"([^>]*)>(.*?)<\/a>/is';
@ -227,7 +227,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
$text = preg_replace($search, $replace, $text); $text = preg_replace($search, $replace, $text);
} }
if ($CFG->filter_mediaplugin_enable_rm) { if ($CFG->filter_mediaplugin_enable_rm) {
$search = '/<a(.*?)href=\"([^<]+)\.rm\"([^>]*)>(.*?)<\/a>/is'; $search = '/<a(.*?)href=\"([^<]+)\.rm\"([^>]*)>(.*?)<\/a>/is';

View file

@ -1,7 +1,7 @@
<!-- This page defines the form to create or edit an instance of this module --> <!-- This page defines the form to create or edit an instance of this module -->
<!-- It is used from /course/mod.php.The whole instance is available as $form. --> <!-- It is used from /course/mod.php.The whole instance is available as $form. -->
<?php <?php
require_once("$CFG->dirroot/mod/hotpot/lib.php"); require_once("$CFG->dirroot/mod/hotpot/lib.php");
@ -10,11 +10,11 @@ set_form_fields($form);
// commonly used array of <select> options // commonly used array of <select> options
$yes_no_options = array( $yes_no_options = array(
HOTPOT_NO => get_string("no"), HOTPOT_NO => get_string("no"),
HOTPOT_YES => get_string("yes") HOTPOT_YES => get_string("yes")
); );
$text_source_options = array( $text_source_options = array(
HOTPOT_TEXTSOURCE_QUIZ => get_string("textsourcequiz", "hotpot"), HOTPOT_TEXTSOURCE_QUIZ => get_string("textsourcequiz", "hotpot"),
HOTPOT_TEXTSOURCE_FILENAME => get_string("textsourcefilename", "hotpot"), HOTPOT_TEXTSOURCE_FILENAME => get_string("textsourcefilename", "hotpot"),
HOTPOT_TEXTSOURCE_FILEPATH => get_string("textsourcefilepath", "hotpot"), HOTPOT_TEXTSOURCE_FILEPATH => get_string("textsourcefilepath", "hotpot"),
HOTPOT_TEXTSOURCE_SPECIFIC => get_string("textsourcespecific", "hotpot") HOTPOT_TEXTSOURCE_SPECIFIC => get_string("textsourcespecific", "hotpot")
@ -71,7 +71,7 @@ $text_source_options = array(
<td align="left"><?php <td align="left"><?php
if ($form->mode=='add') { if ($form->mode=='add') {
choose_from_menu( choose_from_menu(
$text_source_options, "namesource", "$form->namesource", "", $text_source_options, "namesource", "$form->namesource", "",
"return hotpot_lockoptions('form', 'namesource', namelockitems, nameoffvalues)" "return hotpot_lockoptions('form', 'namesource', namelockitems, nameoffvalues)"
); );
} else { } else {
@ -82,8 +82,8 @@ $text_source_options = array(
</tr> </tr>
<tr valign="top"> <tr valign="top">
<td align="right"> <td align="right">
<b><?php <b><?php
print_string("summary") print_string("summary")
?>:</b><br /> ?>:</b><br />
<font size="1"><?php <font size="1"><?php
helpbutton("summary", get_string("summary"), "resource", true, true); helpbutton("summary", get_string("summary"), "resource", true, true);
@ -94,13 +94,13 @@ $text_source_options = array(
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true); helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
print '<br />'; print '<br />';
} else { } else {
helpbutton("text", get_string("helptext"), "moodle", true, true); helpbutton("text", get_string("helptext"), "moodle", true, true);
print '<br />'; print '<br />';
emoticonhelpbutton("form", "description"); emoticonhelpbutton("form", "description");
} }
?></font> ?></font>
</td> </td>
<td align="left"><?php <td align="left"><?php
if ($form->mode=='add') { if ($form->mode=='add') {
choose_from_menu($text_source_options, "summarysource", "$form->summarysource", ""); choose_from_menu($text_source_options, "summarysource", "$form->summarysource", "");
print '<br />'; print '<br />';
@ -217,9 +217,9 @@ $text_source_options = array(
?></td> ?></td>
</tr> </tr>
<tr valign="top"> <tr valign="top">
<td align="right"><b><?php <td align="right"><b><?php
$quizchain = "{$form->mode}quizchain"; $quizchain = "{$form->mode}quizchain";
print_string($quizchain, "hotpot"); print_string($quizchain, "hotpot");
?>:</b></td> ?>:</b></td>
<td align="left"><?php <td align="left"><?php
choose_from_menu($yes_no_options, "quizchain", $form->quizchain, ""); choose_from_menu($yes_no_options, "quizchain", $form->quizchain, "");
@ -329,8 +329,8 @@ $text_source_options = array(
helpbutton("clickreporting", get_string("clickreporting","hotpot"), "hotpot"); helpbutton("clickreporting", get_string("clickreporting","hotpot"), "hotpot");
?></td> ?></td>
</tr> </tr>
<?php <?php
print_standard_coursemodule_settings($form); print_standard_coursemodule_settings($form);
?> ?>
<tr valign="top"> <tr valign="top">
<td align="right">&nbsp;</td> <td align="right">&nbsp;</td>
@ -375,7 +375,7 @@ $text_source_options = array(
hotpot_lockoptions('form', 'enabletimeclose', timecloselockitems, timeoffvalues); hotpot_lockoptions('form', 'enabletimeclose', timecloselockitems, timeoffvalues);
hotpot_lockoptions('form', 'studentfeedback', feedbacklockitems, feedbackoffvalues); hotpot_lockoptions('form', 'studentfeedback', feedbacklockitems, feedbackoffvalues);
// override the standard Moodle "setfocus" function, // override the standard Moodle "setfocus" function,
// which gives a js error if the "name" field is hidden // which gives a js error if the "name" field is hidden
function setfocus() { function setfocus() {
var Frm = document.getElementById('form'); var Frm = document.getElementById('form');

View file

@ -14,7 +14,7 @@
} }
if (! $course = get_record("course", "id", $cm->course)) { if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured"); error("Course is misconfigured");
} }
if (! $hotpot = get_record("hotpot", "id", $cm->instance)) { if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
error("Course module is incorrect"); error("Course module is incorrect");
} }
@ -220,8 +220,8 @@
$fields = 'a.*, u.firstname, u.lastname, u.picture'; $fields = 'a.*, u.firstname, u.lastname, u.picture';
if ($mode=='click') { if ($mode=='click') {
$fields .= ', u.idnumber'; $fields .= ', u.idnumber';
} else { } else {
// overview, simple and detailed reports // overview, simple and detailed reports
// get last attempt record in clickreport series // get last attempt record in clickreport series
$ids = array(); $ids = array();
foreach ($cr_attempts as $cr_attempt) { foreach ($cr_attempts as $cr_attempt) {
@ -406,7 +406,7 @@ function hotpot_delete_selected_attempts(&$hotpot, $del) {
} }
////////////////////////////////////////////// //////////////////////////////////////////////
/// functions to print the report headings and /// functions to print the report headings and
/// report selector menus /// report selector menus
function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) { function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) {
@ -479,9 +479,9 @@ function hotpot_print_report_selector(&$course, &$hotpot, &$formdata) {
// get users who have ever atetmpted this HotPot // get users who have ever atetmpted this HotPot
$users = get_records_sql(" $users = get_records_sql("
SELECT SELECT
u.id, u.firstname, u.lastname u.id, u.firstname, u.lastname
FROM FROM
{$CFG->prefix}user u, {$CFG->prefix}user u,
{$CFG->prefix}hotpot_attempts ha {$CFG->prefix}hotpot_attempts ha
WHERE WHERE

View file

@ -338,7 +338,7 @@ class hotpot_report extends hotpot_default_report {
if (!function_exists('clean_getstring_data')) { // Moodle 1.4 (and less) if (!function_exists('clean_getstring_data')) { // Moodle 1.4 (and less)
$reportpercentscore = str_replace('%', '%%', $reportpercentscore); $reportpercentscore = str_replace('%', '%%', $reportpercentscore);
} }
array_push($table->head, array_push($table->head,
get_string('reportthisclick', 'hotpot', get_string('reportquestionstried', 'hotpot')), get_string('reportthisclick', 'hotpot', get_string('reportquestionstried', 'hotpot')),
get_string('reportsofar', 'hotpot', get_string('reportquestionstried', 'hotpot')), get_string('reportsofar', 'hotpot', get_string('reportquestionstried', 'hotpot')),
get_string('reportthisclick', 'hotpot', get_string('reportright', 'hotpot')), get_string('reportthisclick', 'hotpot', get_string('reportright', 'hotpot')),
@ -424,7 +424,7 @@ class hotpot_report extends hotpot_default_report {
$records = get_records_sql_menu(" $records = get_records_sql_menu("
SELECT userid, MIN(time) AS logouttime SELECT userid, MIN(time) AS logouttime
FROM {$CFG->prefix}log FROM {$CFG->prefix}log
WHERE userid=$attempt->userid AND action='logout' AND time>$attempt->cr_timefinish WHERE userid=$attempt->userid AND action='logout' AND time>$attempt->cr_timefinish
GROUP BY userid GROUP BY userid
"); ");
if (empty($records)) { if (empty($records)) {

View file

@ -1,15 +1,15 @@
<?PHP // $Id$ <?PHP // $Id$
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
/// Default class for report plugins /// Default class for report plugins
/// ///
/// Doesn't do anything on it's own -- it needs to be extended. /// Doesn't do anything on it's own -- it needs to be extended.
/// This class displays quiz reports. Because it is called from /// This class displays quiz reports. Because it is called from
/// within /mod/quiz/report.php you can assume that the page header /// within /mod/quiz/report.php you can assume that the page header
/// and footer are taken care of. /// and footer are taken care of.
/// ///
/// This file can refer to itself as report.php to pass variables /// This file can refer to itself as report.php to pass variables
/// to itself - all these will also be globally available. You must /// to itself - all these will also be globally available. You must
/// pass "id=$cm->id" or q=$quiz->id", and "mode=reportname". /// pass "id=$cm->id" or q=$quiz->id", and "mode=reportname".
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -17,7 +17,7 @@
class hotpot_default_report { class hotpot_default_report {
function display($hotpot, $cm, $course, $users, $attempts, $questions, $options) { function display($hotpot, $cm, $course, $users, $attempts, $questions, $options) {
/// This function just displays the report /// This function just displays the report
// it is replaced by the "display" functions in the scripts in the "report" folder // it is replaced by the "display" functions in the scripts in the "report" folder
return true; return true;
@ -68,7 +68,7 @@ class hotpot_default_report {
// add $value to answers array, if it was not there // add $value to answers array, if it was not there
if ($i==$i_max) { if ($i==$i_max) {
$table->legend[$q]['answers'][$i] = $value; $table->legend[$q]['answers'][$i] = $value;
} }
// convert $value to alphabetic index (A, B ... AA, AB ...) // convert $value to alphabetic index (A, B ... AA, AB ...)
@ -98,12 +98,12 @@ class hotpot_default_report {
foreach($table->legend as $q=>$question) { foreach($table->legend as $q=>$question) {
$legend->stat[] = array( $legend->stat[] = array(
get_string('questionshort', 'hotpot', $q+1), get_string('questionshort', 'hotpot', $q+1),
$question['name'] $question['name']
); );
foreach($question['answers'] as $a=>$answer) { foreach($question['answers'] as $a=>$answer) {
$legend->stat[] = array( $legend->stat[] = array(
$this->dec_to_ALPHA($a), $this->dec_to_ALPHA($a),
$answer $answer
); );
} }
@ -324,7 +324,7 @@ class hotpot_default_report {
function print_report_finish(&$course, &$hotpot, &$options) { function print_report_finish(&$course, &$hotpot, &$options) {
switch ($options['reportformat']) { switch ($options['reportformat']) {
case 'txt' : case 'txt' :
// do nothing // do nothing
break; break;
case 'xls': case 'xls':
@ -450,7 +450,7 @@ class hotpot_default_report {
$col = 0; // column index $col = 0; // column index
while ($col<$table->colspan && isset($cells[$i])) { while ($col<$table->colspan && isset($cells[$i])) {
if (empty($skipcol[$col])) { if (empty($skipcol[$col])) {
$cell = &$cells[$i++]; $cell = &$cells[$i++];
$td = $table->td[$col]; $td = $table->td[$col];
if (is_object($cell)) { if (is_object($cell)) {
$text = $cell->text; $text = $cell->text;
@ -546,7 +546,7 @@ class hotpot_default_report {
} }
function print_text_start(&$course, &$hotpot, &$options) { function print_text_start(&$course, &$hotpot, &$options) {
$downloadfilename = clean_filename("$course->shortname $hotpot->name.txt"); $downloadfilename = clean_filename("$course->shortname $hotpot->name.txt");
header("Content-Type: application/download\n"); header("Content-Type: application/download\n");
header("Content-Disposition: attachment; filename=$downloadfilename"); header("Content-Disposition: attachment; filename=$downloadfilename");
header("Expires: 0"); header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0,pre-check=0"); header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
@ -658,7 +658,7 @@ class hotpot_default_report {
$this->print_excel_stat($wb, $ws, $table, $row, $options); $this->print_excel_stat($wb, $ws, $table, $row, $options);
$this->print_excel_foot($wb, $ws, $table, $row, $options); $this->print_excel_foot($wb, $ws, $table, $row, $options);
} }
// close the workbook (and send it to the browser) // close the workbook (and send it to the browser)
$wb->close(); $wb->close();
} }
@ -679,8 +679,8 @@ class hotpot_default_report {
function print_excel_head(&$wb, &$ws, &$table, &$row, &$options) { function print_excel_head(&$wb, &$ws, &$table, &$row, &$options) {
// define format properties // define format properties
$properties = array( $properties = array(
'bold'=>1, 'bold'=>1,
'align'=>'center', 'align'=>'center',
'v_align'=>'bottom', 'v_align'=>'bottom',
'text_wrap'=>1 'text_wrap'=>1
); );

View file

@ -39,9 +39,9 @@ class hotpot_report extends hotpot_default_report {
} }
// headings for name, attempt number, score/grade and penalties // headings for name, attempt number, score/grade and penalties
$table->head = array( $table->head = array(
get_string("name"), get_string("name"),
hotpot_grade_heading($hotpot, $options), hotpot_grade_heading($hotpot, $options),
get_string('attempt', 'quiz'), get_string('attempt', 'quiz'),
); );
$table->align = array('left', 'center', 'center'); $table->align = array('left', 'center', 'center');
$table->size = array(150, 80, 10); $table->size = array(150, 80, 10);
@ -50,8 +50,8 @@ class hotpot_report extends hotpot_default_report {
// question headings // question headings
$this->add_question_headings($questions, $table, 'left', 0, false, 2); $this->add_question_headings($questions, $table, 'left', 0, false, 2);
// penalties (not always needed) and raw score // penalties (not always needed) and raw score
array_push($table->head, array_push($table->head,
get_string('penalties', 'hotpot'), get_string('penalties', 'hotpot'),
get_string('score', 'quiz') get_string('score', 'quiz')
); );
array_push($table->align, 'center', 'center'); array_push($table->align, 'center', 'center');
@ -82,7 +82,7 @@ class hotpot_report extends hotpot_default_report {
} }
$cells = array ($name, $grade, $attemptnumber); $cells = array ($name, $grade, $attemptnumber);
// $name and $grade are only printed on first line per user // $name and $grade are only printed on first line per user
$name = $blank; $name = $blank;
$grade = $blank; $grade = $blank;
$start_col = count($cells); $start_col = count($cells);
foreach ($questionids as $col => $id) { foreach ($questionids as $col => $id) {

View file

@ -29,13 +29,13 @@ class hotpot_report extends hotpot_default_report {
$table->size[] = 10; $table->size[] = 10;
$table->wrap[] = "nowrap"; $table->wrap[] = "nowrap";
} }
array_push($table->head, array_push($table->head,
get_string("name"), get_string("name"),
hotpot_grade_heading($hotpot, $options), hotpot_grade_heading($hotpot, $options),
get_string("attempt", "quiz"), get_string("attempt", "quiz"),
get_string("time", "quiz"), get_string("time", "quiz"),
get_string("reportstatus", "hotpot"), get_string("reportstatus", "hotpot"),
get_string("timetaken", "quiz"), get_string("timetaken", "quiz"),
get_string("score", "quiz") get_string("score", "quiz")
); );
array_push($table->align, "left", "center", "center", "left", "center", "center", "center"); array_push($table->align, "left", "center", "center", "left", "center", "center", "center");
@ -96,7 +96,7 @@ class hotpot_report extends hotpot_default_report {
if ($is_html && is_numeric($score) && $score==$user->grade) { // best grade if ($is_html && is_numeric($score) && $score==$user->grade) { // best grade
$score = '<span class="highlight">'.$score.'</span>'; $score = '<span class="highlight">'.$score.'</span>';
} }
array_push($data, array_push($data,
$attemptnumber, $attemptnumber,
$checkbox.$starttime, $checkbox.$starttime,
hotpot_format_status($attempt), hotpot_format_status($attempt),

View file

@ -29,9 +29,9 @@ class hotpot_report extends hotpot_default_report {
$table->size[] = 10; $table->size[] = 10;
} }
// name, grade and attempt number // name, grade and attempt number
array_push($table->head, array_push($table->head,
get_string("name"), get_string("name"),
hotpot_grade_heading($hotpot, $options), hotpot_grade_heading($hotpot, $options),
get_string("attempt", "quiz") get_string("attempt", "quiz")
); );
array_push($table->align, "left", "center", "center"); array_push($table->align, "left", "center", "center");
@ -39,8 +39,8 @@ class hotpot_report extends hotpot_default_report {
// question headings // question headings
$this->add_question_headings($questions, $table); $this->add_question_headings($questions, $table);
// penalties and raw score // penalties and raw score
array_push($table->head, array_push($table->head,
get_string('penalties', 'hotpot'), get_string('penalties', 'hotpot'),
get_string('score', 'quiz') get_string('score', 'quiz')
); );
array_push($table->align, "center", "center"); array_push($table->align, "center", "center");

View file

@ -5,13 +5,13 @@
//----------------------------------------------------------- //-----------------------------------------------------------
// //
// hotpot // hotpot
// (CL, pk->id, // (CL, pk->id,
// fk->course, files) // fk->course, files)
// | // |
// +--------------+---------------+ // +--------------+---------------+
// | | // | |
// hotpot_attempts hotpot_questions // hotpot_attempts hotpot_questions
// (UL, pk->id, (UL, pk->id, // (UL, pk->id, (UL, pk->id,
// fk->hotpot) fk->hotpot, text) // fk->hotpot) fk->hotpot, text)
// | | | // | | |
// +-------------------+----------+ | // +-------------------+----------+ |
@ -40,7 +40,7 @@ require_once ("$CFG->dirroot/mod/hotpot/lib.php");
function hotpot_restore_mods($mod, $restore) { function hotpot_restore_mods($mod, $restore) {
//This function restores a single hotpot activity //This function restores a single hotpot activity
// This function is called by "restore_create_modules" (in "backup/restorelib.php") // This function is called by "restore_create_modules" (in "backup/restorelib.php")
// which is called by "backup/restore_execute.html" (included by "backup/restore.php") // which is called by "backup/restore_execute.html" (included by "backup/restore.php")
// $mod is an object // $mod is an object
// id : id field in 'modtype' table // id : id field in 'modtype' table
@ -129,7 +129,7 @@ function hotpot_restore_questions(&$restore, $status, &$xml, &$record) {
// $xml is an XML tree for a hotpot record // $xml is an XML tree for a hotpot record
// $record is the newly added hotpot record // $record is the newly added hotpot record
$foreignkeys = array( $foreignkeys = array(
'hotpot'=>$record->id, 'hotpot'=>$record->id,
'text'=>'hotpot_strings' 'text'=>'hotpot_strings'
); );
return hotpot_restore_records( return hotpot_restore_records(
@ -240,7 +240,7 @@ function hotpot_restore_records(&$restore, $status, &$xml, $table, $foreign_keys
// $record_TAG : (optional) the name of an XML tag which starts a single record // $record_TAG : (optional) the name of an XML tag which starts a single record
// If no $record_TAG is specified, the block of records is assumed to be a single record // If no $record_TAG is specified, the block of records is assumed to be a single record
// other parameters are explained in "hotpot_restore_record" below // other parameters are explained in "hotpot_restore_record" below
$i = 0; // index for $records_TAG $i = 0; // index for $records_TAG
do { do {
unset($xml_records); unset($xml_records);
@ -287,10 +287,10 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
// $foreign_keys : array of foreign keys, if any, specifed as $key=>$value // $foreign_keys : array of foreign keys, if any, specifed as $key=>$value
// $key : the name of a field in the current $record // $key : the name of a field in the current $record
// $value : if $value is numeric, then $record->$key is set to $value. // $value : if $value is numeric, then $record->$key is set to $value.
// Otherwise $value is assumed to be a table name and $record->$key // Otherwise $value is assumed to be a table name and $record->$key
// is treated as a comma separated list of ids in that table // is treated as a comma separated list of ids in that table
// $more_restore : optional PHP code to be eval(uated) for each record // $more_restore : optional PHP code to be eval(uated) for each record
// $secondary_key : // $secondary_key :
// the name of the secondary key field, if any, in the current $record. // the name of the secondary key field, if any, in the current $record.
// If this field is specified, then the current record will only be added // If this field is specified, then the current record will only be added
// if the $record->$secondarykey value does not already exist in $table // if the $record->$secondarykey value does not already exist in $table
@ -298,7 +298,7 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
// maintain a cache of info on table columns // maintain a cache of info on table columns
static $table_columns = array(); static $table_columns = array();
if (empty($table_columns[$table])) { if (empty($table_columns[$table])) {
global $CFG, $db; global $CFG, $db;
$table_columns[$table] = $db->MetaColumns("$CFG->prefix$table"); $table_columns[$table] = $db->MetaColumns("$CFG->prefix$table");
} }
@ -341,7 +341,7 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
} }
print "was not restored</li></ul>"; print "was not restored</li></ul>";
} }
$ok = false; $ok = false;
} }
} }
} }
@ -403,7 +403,7 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
if (isset($record->old_id)) { if (isset($record->old_id)) {
backup_putid($restore->backup_unique_code, $table, $record->old_id, $record->id); backup_putid($restore->backup_unique_code, $table, $record->old_id, $record->id);
} }
} else { } else {
// failed to add (or find) $record // failed to add (or find) $record
if (!defined('RESTORE_SILENTLY')) { if (!defined('RESTORE_SILENTLY')) {
print "<ul><li>Record could not be added: table=$table</li></ul>"; print "<ul><li>Record could not be added: table=$table</li></ul>";
@ -453,7 +453,7 @@ function hotpot_restore_logs($restore, $log) {
break; break;
case "attempt": case "attempt":
case "submit": case "submit":
case "review": case "review":
if ($log->cmid) { if ($log->cmid) {
//Get the new_id of the module (to recode the info field) //Get the new_id of the module (to recode the info field)
$mod = backup_getid($restore->backup_unique_code,$log->module,$log->info); $mod = backup_getid($restore->backup_unique_code,$log->module,$log->info);
@ -462,7 +462,7 @@ function hotpot_restore_logs($restore, $log) {
$attemptid = substr(strrchr($log->url,"="),1); $attemptid = substr(strrchr($log->url,"="),1);
//Get the new_id of the attempt (to recode the url field) //Get the new_id of the attempt (to recode the url field)
$attempt = backup_getid($restore->backup_unique_code,"hotpot_attempts",$attemptid); $attempt = backup_getid($restore->backup_unique_code,"hotpot_attempts",$attemptid);
if ($attempt) { if ($attempt) {
$log->url = "review.php?id=".$log->cmid."&attempt=".$attempt->new_id; $log->url = "review.php?id=".$log->cmid."&attempt=".$attempt->new_id;
$log->info = $mod->new_id; $log->info = $mod->new_id;
$status = true; $status = true;

View file

@ -31,7 +31,7 @@
if (! $attempt = get_record("hotpot_attempts", "id", $attempt)) { if (! $attempt = get_record("hotpot_attempts", "id", $attempt)) {
error("Attempt ID was incorrect"); error("Attempt ID was incorrect");
} }
$context = get_context_instance(CONTEXT_MODULE, $cm->id); $context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_login($course->id); require_login($course->id);
@ -109,10 +109,10 @@ function hotpot_print_attempt_summary(&$hotpot, &$attempt) {
$value = hotpot_format_status($attempt); $value = hotpot_format_status($attempt);
break; break;
case 'timerecorded': case 'timerecorded':
$value = empty($attempt->timefinish) ? '-' : userdate($attempt->timefinish); $value = empty($attempt->timefinish) ? '-' : userdate($attempt->timefinish);
break; break;
case 'timetaken': case 'timetaken':
$value = empty($attempt->timefinish) ? '-' : format_time($attempt->timefinish - $attempt->timestart); $value = empty($attempt->timefinish) ? '-' : format_time($attempt->timefinish - $attempt->timestart);
break; break;
default: default:
$value = isset($attempt->$field) ? $attempt->$field : NULL; $value = isset($attempt->$field) ? $attempt->$field : NULL;

View file

@ -92,7 +92,7 @@ class hotpot_xml_template_default {
$rrggbb = '/^\#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i'; $rrggbb = '/^\#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i';
if (( if ((
preg_match($rgb, $x, $x_matches) || preg_match($rgb, $x, $x_matches) ||
preg_match($rrggbb, $x, $x_matches) preg_match($rrggbb, $x, $x_matches)
) && ( ) && (
preg_match($rgb, $y, $y_matches) || preg_match($rgb, $y, $y_matches) ||
preg_match($rrggbb, $y, $y_matches) preg_match($rrggbb, $y, $y_matches)

View file

@ -1,4 +1,4 @@
<?PHP <?PHP
class hotpot_xml_quiz_template extends hotpot_xml_template_default { class hotpot_xml_quiz_template extends hotpot_xml_template_default {
@ -6,13 +6,13 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
function hotpot_xml_quiz_template(&$parent) { function hotpot_xml_quiz_template(&$parent) {
$this->parent = &$parent; $this->parent = &$parent;
$get_js = optional_param('js', false); $get_js = optional_param('js', false);
$get_css = optional_param('css', false); $get_css = optional_param('css', false);
if (!empty($get_css)) { if (!empty($get_css)) {
// set $this->css // set $this->css
$this->v6_expand_StyleSheet(); $this->v6_expand_StyleSheet();
} else if (!empty($get_js)) { } else if (!empty($get_js)) {
// set $this->js // set $this->js
@ -165,7 +165,7 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
return empty($value) ? '' : ('<h3 class="ExerciseSubtitle">'.$value.'</h3>'); return empty($value) ? '' : ('<h3 class="ExerciseSubtitle">'.$value.'</h3>');
} }
// timer // timer
function v6_expand_Timer() { function v6_expand_Timer() {
return $this->int_value('data,timer,include-timer'); return $this->int_value('data,timer,include-timer');
@ -177,7 +177,7 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
return $this->parent->xml_value('data,timer,seconds'); return $this->parent->xml_value('data,timer,seconds');
} }
// send results // send results
function v6_expand_SendResults() { function v6_expand_SendResults() {
return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',send-email'); return $this->parent->xml_value('hotpot-config-file,'.$this->parent->quiztype.',send-email');
@ -299,7 +299,7 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
} }
function v6_expand_NavLightColor() { function v6_expand_NavLightColor() {
$color = $this->parent->xml_value('hotpot-config-file,global,nav-bar-color'); $color = $this->parent->xml_value('hotpot-config-file,global,nav-bar-color');
return $this->get_halfway_color($color, '#ffffff'); return $this->get_halfway_color($color, '#ffffff');
} }
function v6_expand_NavShadeColor() { function v6_expand_NavShadeColor() {
$color = $this->parent->xml_value('hotpot-config-file,global,nav-bar-color'); $color = $this->parent->xml_value('hotpot-config-file,global,nav-bar-color');
@ -534,7 +534,7 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
$value = strtr($value, $ENTITIES); $value = strtr($value, $ENTITIES);
if (preg_match_all($pattern, $value, $matches)) { if (preg_match_all($pattern, $value, $matches)) {
$chars = array_merge($chars, $matches[0]); $chars = array_merge($chars, $matches[0]);
} }
$i++; $i++;
} }
@ -1260,7 +1260,7 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
$str .= '<p class="QuestionText">'.$question_text.'</p>'; $str .= '<p class="QuestionText">'.$question_text.'</p>';
if ( if (
$question_type==HOTPOT_JQUIZ_SHORTANSWER || $question_type==HOTPOT_JQUIZ_SHORTANSWER ||
$question_type==HOTPOT_JQUIZ_HYBRID $question_type==HOTPOT_JQUIZ_HYBRID
) { ) {
$str .= '<div class="ShortAnswer" id="Q_'.$q.'_SA"><form method="post" action="" onsubmit="return false;"><div>'; $str .= '<div class="ShortAnswer" id="Q_'.$q.'_SA"><form method="post" action="" onsubmit="return false;"><div>';
@ -1283,13 +1283,13 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
} }
if ( if (
$question_type==HOTPOT_JQUIZ_MULTICHOICE || $question_type==HOTPOT_JQUIZ_MULTICHOICE ||
$question_type==HOTPOT_JQUIZ_HYBRID || $question_type==HOTPOT_JQUIZ_HYBRID ||
$question_type==HOTPOT_JQUIZ_MULTISELECT $question_type==HOTPOT_JQUIZ_MULTISELECT
) { ) {
switch ($question_type) { switch ($question_type) {
case HOTPOT_JQUIZ_MULTICHOICE: case HOTPOT_JQUIZ_MULTICHOICE:
$str .= '<ol class="MCAnswers">'."\n"; $str .= '<ol class="MCAnswers">'."\n";
break; break;
case HOTPOT_JQUIZ_HYBRID: case HOTPOT_JQUIZ_HYBRID:
@ -1456,6 +1456,6 @@ function hotpot_keypad_sort_value($char) {
} }
return $sort_value; return $sort_value;
} }
?> ?>

View file

@ -5,7 +5,7 @@
[strDublinCoreMetadata] [strDublinCoreMetadata]
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> <title>
[strPlainTitle] [strPlainTitle]
@ -61,9 +61,9 @@
</script> </script>
</head> </head>
<body onload="TimerStartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]> <body onload="TimerStartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
<!-- BeginTopNavButtons --> <!-- BeginTopNavButtons -->
[inclNavButtons] [inclNavButtons]

View file

@ -6,20 +6,20 @@ function SetScormScore(){
//Reports the current score and any other information back to the LMS //Reports the current score and any other information back to the LMS
if (API != null){ if (API != null){
API.LMSSetValue('cmi.core.score.raw', Score); API.LMSSetValue('cmi.core.score.raw', Score);
//Now send a detailed reports on the item //Now send a detailed reports on the item
var ItemLabel = 'Matching'; var ItemLabel = 'Matching';
API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel); API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel);
API.LMSSetValue('cmi.interactions.0.id', 'int'+ItemLabel); API.LMSSetValue('cmi.interactions.0.id', 'int'+ItemLabel);
API.LMSSetValue('cmi.objectives.0.status', API.LMSGetValue('cmi.core.lesson_status')); API.LMSSetValue('cmi.objectives.0.status', API.LMSGetValue('cmi.core.lesson_status'));
API.LMSSetValue('cmi.objectives.0.score.min', '0'); API.LMSSetValue('cmi.objectives.0.score.min', '0');
API.LMSSetValue('cmi.objectives.0.score.max', '100'); API.LMSSetValue('cmi.objectives.0.score.max', '100');
API.LMSSetValue('cmi.objectives.0.score.raw', Score); API.LMSSetValue('cmi.objectives.0.score.raw', Score);
//We can only use the performance type, because we're storing multiple responses of various types. //We can only use the performance type, because we're storing multiple responses of various types.
API.LMSSetValue('cmi.interactions.0.type', 'performance'); API.LMSSetValue('cmi.interactions.0.type', 'performance');
API.LMSSetValue('cmi.interactions.0.student_response', AnswersTried); API.LMSSetValue('cmi.interactions.0.student_response', AnswersTried);
API.LMSCommit(''); API.LMSCommit('');
} }
} }
@ -54,7 +54,7 @@ var AnswersTried = '';
FC = new Array(); FC = new Array();
DC = new Array(); DC = new Array();
function onEndDrag(){ function onEndDrag(){
//Is it dropped on any of the fixed cards? //Is it dropped on any of the fixed cards?
var Docked = false; var Docked = false;
var DropTarget = DroppedOnFixed(CurrDrag); var DropTarget = DroppedOnFixed(CurrDrag);
@ -79,7 +79,7 @@ function onEndDrag(){
DC[CurrDrag].tag = 0; DC[CurrDrag].tag = 0;
D[CurrDrag][2] = 0; D[CurrDrag][2] = 0;
} }
} }
function DroppedOnFixed(DNum){ function DroppedOnFixed(DNum){
var Result = -1; var Result = -1;
@ -121,12 +121,12 @@ function StartUp(){
if (C.ie){ if (C.ie){
DragTop += 15; DragTop += 15;
} }
//Reduce array if required //Reduce array if required
if (QsToShow < F.length){ if (QsToShow < F.length){
ReduceItems2(); ReduceItems2();
} }
//Shuffle the left items if required //Shuffle the left items if required
if (ShuffleQs == true){ if (ShuffleQs == true){
F = Shuffle(F); F = Shuffle(F);
@ -143,7 +143,7 @@ function StartUp(){
for (var i=0; i<F.length; i++){ for (var i=0; i<F.length; i++){
CardContent = F[i][0]; CardContent = F[i][0];
FC[i] = new Card('F' + i, 10); FC[i] = new Card('F' + i, 10);
FC[i].elm.innerHTML = CardContent; FC[i].elm.innerHTML = CardContent;
if (FC[i].GetW() > Widest){ if (FC[i].GetW() > Widest){
Widest = FC[i].GetW(); Widest = FC[i].GetW();
} }
@ -162,7 +162,7 @@ function StartUp(){
DC[i] = new Card('D' + i, 10); DC[i] = new Card('D' + i, 10);
CardContent = D[i][0]; CardContent = D[i][0];
// if (CardContent.indexOf('<img ') > -1){CardContent += '<br clear="all" />';} //used to be required for Navigator rendering bug with images // if (CardContent.indexOf('<img ') > -1){CardContent += '<br clear="all" />';} //used to be required for Navigator rendering bug with images
DC[i].elm.innerHTML = CardContent; DC[i].elm.innerHTML = CardContent;
if (DC[i].GetW() > DragWidth){DC[i].SetW(DragWidth);} if (DC[i].GetW() > DragWidth){DC[i].SetW(DragWidth);}
DC[i].css.cursor = 'move'; DC[i].css.cursor = 'move';
DC[i].css.backgroundColor = '[strExBGColor]'; DC[i].css.backgroundColor = '[strExBGColor]';
@ -276,7 +276,7 @@ function ReduceItems2(){
} }
for (j=ItemToDump; j<(D.length-1); j++){ for (j=ItemToDump; j<(D.length-1); j++){
D[j] = D[j+1]; D[j] = D[j+1];
} }
F.length = F.length-1; F.length = F.length-1;
D.length = D.length-1; D.length = D.length-1;
} }
@ -303,7 +303,7 @@ function CheckAnswers(){
TotalCorrect++; TotalCorrect++;
} }
else{ else{
//Change made for version 6.0.3.41: don't send wrong items home, //Change made for version 6.0.3.41: don't send wrong items home,
//show them in a more conspicuous way. //show them in a more conspicuous way.
// DC[i].GoHome(); // DC[i].GoHome();
DC[i].SetL(DC[i].GetL() + 10); DC[i].SetL(DC[i].GetL() + 10);

View file

@ -5,7 +5,7 @@
[strDublinCoreMetadata] [strDublinCoreMetadata]
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> <title>
[strPlainTitle] [strPlainTitle]
@ -61,9 +61,9 @@
</script> </script>
</head> </head>
<body onload="TimerStartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]> <body onload="TimerStartUp()" id="TheBody" [inclScorm1.2]onunload="CheckLMSFinish()"[/inclScorm1.2]>
<!-- BeginTopNavButtons --> <!-- BeginTopNavButtons -->
[inclNavButtons] [inclNavButtons]

View file

@ -5,7 +5,7 @@ function SetScormScore(){
//Reports the current score and any other information back to the LMS //Reports the current score and any other information back to the LMS
if (API != null){ if (API != null){
API.LMSSetValue('cmi.core.score.raw', Score); API.LMSSetValue('cmi.core.score.raw', Score);
//Now send a detailed reports on the item //Now send a detailed reports on the item
var ItemLabel = 'Item_1'; var ItemLabel = 'Item_1';
API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel); API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel);
@ -16,15 +16,15 @@ function SetScormScore(){
else{ else{
API.LMSSetValue('cmi.objectives.0.status', 'incomplete'); API.LMSSetValue('cmi.objectives.0.status', 'incomplete');
} }
API.LMSSetValue('cmi.objectives.0.score.min', '0'); API.LMSSetValue('cmi.objectives.0.score.min', '0');
API.LMSSetValue('cmi.objectives.0.score.max', '100'); API.LMSSetValue('cmi.objectives.0.score.max', '100');
API.LMSSetValue('cmi.objectives.0.score.raw', Score); API.LMSSetValue('cmi.objectives.0.score.raw', Score);
//We can only use the performance type, because we're storing multiple responses of various types. //We can only use the performance type, because we're storing multiple responses of various types.
API.LMSSetValue('cmi.interactions.0.type', 'performance'); API.LMSSetValue('cmi.interactions.0.type', 'performance');
API.LMSSetValue('cmi.interactions.0.student_response', AnswersTried); API.LMSSetValue('cmi.interactions.0.student_response', AnswersTried);
API.LMSCommit(''); API.LMSCommit('');
} }
} }
@ -106,7 +106,7 @@ function GetGuessSequence(){
} }
var CardPos = 0; var CardPos = 0;
for (i=0; i<Cds.length; i++){ for (i=0; i<Cds.length; i++){
for (var j=0; j<L.length; j++){ for (var j=0; j<L.length; j++){
//Slight modification for 6.0.4: allow some leeway for 1px inaccuracy in card placing by browser. //Slight modification for 6.0.4: allow some leeway for 1px inaccuracy in card placing by browser.
@ -142,7 +142,7 @@ function GetGuessSequence(){
} }
function CompDrags(a,b){ function CompDrags(a,b){
return a.GetL() - b.GetL(); return a.GetL() - b.GetL();
} }
function FindSegment(SegID){ function FindSegment(SegID){
@ -178,7 +178,7 @@ function CompileString(InArray){
if ((Openers.indexOf(OutString.charAt(OutString.length-1)) > -1)||(Punctuation.indexOf(OutArray[i].charAt(0)) > -1)){ if ((Openers.indexOf(OutString.charAt(OutString.length-1)) > -1)||(Punctuation.indexOf(OutArray[i].charAt(0)) > -1)){
Spacer = ''; Spacer = '';
} }
OutString = OutString + Spacer + OutArray[i]; OutString = OutString + Spacer + OutArray[i];
} }
//Capitalize the first letter if necessary //Capitalize the first letter if necessary
@ -233,8 +233,8 @@ function CheckAnswer(CheckType){
LongestCorrect[k] = TempCorrect[k]; LongestCorrect[k] = TempCorrect[k];
} }
HintToReturn = TempHint; HintToReturn = TempHint;
} }
} }
} }
if (WhichCorrect > -1){ if (WhichCorrect > -1){
AllDone = true; AllDone = true;
@ -244,7 +244,7 @@ function CheckAnswer(CheckType){
} }
} }
WellDone = '<span class="CorrectAnswer">' + CompiledOutput + '</span><br /><br />' + CorrectResponse + '<br />'; WellDone = '<span class="CorrectAnswer">' + CompiledOutput + '</span><br /><br />' + CorrectResponse + '<br />';
if (AnswersTried.length > 0){AnswersTried += ' | ';} if (AnswersTried.length > 0){AnswersTried += ' | ';}
AnswersTried += CompiledOutput; AnswersTried += CompiledOutput;
@ -280,7 +280,7 @@ function CheckAnswer(CheckType){
if (CheckType == 1){ if (CheckType == 1){
TryAgain += '<br />' + NextCorrect + '<br />' + FindSegment(HintToReturn); TryAgain += '<br />' + NextCorrect + '<br />' + FindSegment(HintToReturn);
} }
[inclTimer] [inclTimer]
if (TimeOver == true){ if (TimeOver == true){
Score = Math.floor(((LongestCorrect.length-Penalties) * 100)/Segments.length); Score = Math.floor(((LongestCorrect.length-Penalties) * 100)/Segments.length);
@ -291,7 +291,7 @@ function CheckAnswer(CheckType){
Penalties++; //Penalty for inaccurate check Penalties++; //Penalty for inaccurate check
ShowMessage(TryAgain); ShowMessage(TryAgain);
} }
//If the exercise is over, deal with that //If the exercise is over, deal with that
if ((AllDone == true)||(TimeOver == true)){ if ((AllDone == true)||(TimeOver == true)){
[inclSendResults] [inclSendResults]
@ -304,9 +304,9 @@ function CheckAnswer(CheckType){
Locked = true; Locked = true;
Finished = true; Finished = true;
setTimeout('Finish()', SubmissionTimeout); setTimeout('Finish()', SubmissionTimeout);
WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); WriteToInstructions(YourScoreIs + ' ' + Score + '%.');
} }
[inclScorm1.2] [inclScorm1.2]
if (AllDone == true){ if (AllDone == true){
SetScormComplete(); SetScormComplete();
@ -329,18 +329,18 @@ var Answers = new Array();
function doDrag(e) { function doDrag(e) {
if (CurrDrag == -1) {return}; if (CurrDrag == -1) {return};
if (C.ie){var Ev = window.event}else{var Ev = e} if (C.ie){var Ev = window.event}else{var Ev = e}
var difX = Ev.clientX-window.lastX; var difX = Ev.clientX-window.lastX;
var difY = Ev.clientY-window.lastY; var difY = Ev.clientY-window.lastY;
var newX = Cds[CurrDrag].GetL()+difX; var newX = Cds[CurrDrag].GetL()+difX;
var newY = Cds[CurrDrag].GetT()+difY; var newY = Cds[CurrDrag].GetT()+difY;
Cds[CurrDrag].SetL(newX); Cds[CurrDrag].SetL(newX);
Cds[CurrDrag].SetT(newY); Cds[CurrDrag].SetT(newY);
window.lastX = Ev.clientX; window.lastX = Ev.clientX;
window.lastY = Ev.clientY; window.lastY = Ev.clientY;
return false; return false;
} }
function beginDrag(e, DragNum) { function beginDrag(e, DragNum) {
CurrDrag = DragNum; CurrDrag = DragNum;
if (C.ie){ if (C.ie){
var Ev = window.event; var Ev = window.event;
@ -349,25 +349,25 @@ function beginDrag(e, DragNum) {
} }
else{ else{
var Ev = e; var Ev = e;
window.onmousemove=doDrag; window.onmousemove=doDrag;
window.onmouseup=endDrag; window.onmouseup=endDrag;
} }
Cds[CurrDrag].SwapColours(); Cds[CurrDrag].SwapColours();
topZ++; topZ++;
Cds[CurrDrag].css.zIndex = topZ; Cds[CurrDrag].css.zIndex = topZ;
window.lastX=Ev.clientX; window.lastX=Ev.clientX;
window.lastY=Ev.clientY; window.lastY=Ev.clientY;
return true; return true;
} }
function endDrag(e) { function endDrag(e) {
if (CurrDrag == -1) {return}; if (CurrDrag == -1) {return};
Cds[CurrDrag].SwapColours(); Cds[CurrDrag].SwapColours();
if (C.ie){document.onmousemove=null}else{window.onmousemove=null;} if (C.ie){document.onmousemove=null}else{window.onmousemove=null;}
onEndDrag(); onEndDrag();
CurrDrag = -1; CurrDrag = -1;
return true; return true;
} }
function onEndDrag(){ function onEndDrag(){
//Snap to lines //Snap to lines
@ -430,10 +430,10 @@ function CheckOver(NoMove){
Cds[i].SetL(LeftColPos); Cds[i].SetL(LeftColPos);
Cds[i].SetT(Cds[i].GetT() + DropHeight); Cds[i].SetT(Cds[i].GetT() + DropHeight);
} }
CheckOver(i); CheckOver(i);
} }
} }
} }
} }
} }
} }

View file

@ -5,7 +5,7 @@
[strDublinCoreMetadata] [strDublinCoreMetadata]
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> <title>
[strPlainTitle] [strPlainTitle]

View file

@ -16,7 +16,7 @@ var CurrItem = null;
var Stage = 2; var Stage = 2;
var QList = new Array(); var QList = new Array();
var ShuffleQs = [boolShuffleQs]; var ShuffleQs = [boolShuffleQs];
function SetUpItems(){ function SetUpItems(){
var i; var i;
@ -32,7 +32,7 @@ function SetUpItems(){
Row.getElementsByTagName('td')[1].className = 'Hidden'; Row.getElementsByTagName('td')[1].className = 'Hidden';
QList.push(Qs.removeChild(Row)); QList.push(Qs.removeChild(Row));
} }
//Shuffle the rows //Shuffle the rows
if (ShuffleQs == true){ if (ShuffleQs == true){
QList = Shuffle(QList); QList = Shuffle(QList);
@ -47,11 +47,11 @@ function SetUpItems(){
function StartUp(){ function StartUp(){
SetUpItems(); SetUpItems();
[inclScorm1.2] [inclScorm1.2]
initAPI(window); initAPI(window);
if (API != null){ if (API != null){
API.LMSInitialize(''); API.LMSInitialize('');
API.LMSSetValue('cmi.core.lesson_status', 'browsed'); API.LMSSetValue('cmi.core.lesson_status', 'browsed');
API.LMSSetValue('cmi.comments', 'This exercise has no checking or scoring features.'); API.LMSSetValue('cmi.comments', 'This exercise has no checking or scoring features.');
API.LMSCommit(''); API.LMSCommit('');
@ -72,7 +72,7 @@ var Started = false;
function DeleteItem(){ function DeleteItem(){
if ((CurrItem == null)||(document.getElementById('Questions').getElementsByTagName('tr').length < 1)){return;} if ((CurrItem == null)||(document.getElementById('Questions').getElementsByTagName('tr').length < 1)){return;}
//Delete the current item //Delete the current item
var DelItem = CurrItem; var DelItem = CurrItem;
Stage = 2; Stage = 2;
@ -89,7 +89,7 @@ function ShowItem(){
if (Len < 1){ if (Len < 1){
return; return;
} }
//if no current item, get the last item so we roll forward //if no current item, get the last item so we roll forward
if (CurrItem == null){ if (CurrItem == null){
CurrItem = Qs.getElementsByTagName('tr')[Len-1]; CurrItem = Qs.getElementsByTagName('tr')[Len-1];
@ -97,7 +97,7 @@ function ShowItem(){
return; return;
} }
} }
//if CurrItem has been fully shown, move to the next one //if CurrItem has been fully shown, move to the next one
if (Stage == 2){ if (Stage == 2){
CurrItem.getElementsByTagName('td')[0].className = 'Hidden'; CurrItem.getElementsByTagName('td')[0].className = 'Hidden';
@ -109,7 +109,7 @@ function ShowItem(){
CurrItem = Qs.getElementsByTagName('tr')[0]; CurrItem = Qs.getElementsByTagName('tr')[0];
} }
} }
//Show the appropriate bits //Show the appropriate bits
if (Stage == 2){ if (Stage == 2){
//Show the first item and hide the second //Show the first item and hide the second
@ -121,9 +121,9 @@ function ShowItem(){
//Show both items //Show both items
CurrItem.getElementsByTagName('td')[0].className = 'Showing'; CurrItem.getElementsByTagName('td')[0].className = 'Showing';
CurrItem.getElementsByTagName('td')[1].className = 'Showing'; CurrItem.getElementsByTagName('td')[1].className = 'Showing';
Stage = 2; Stage = 2;
} }
[inclPreloadImages] [inclPreloadImages]
RefreshImages(); RefreshImages();
[/inclPreloadImages] [/inclPreloadImages]

View file

@ -16,7 +16,7 @@ body{
font-family: [strFontFace]; font-family: [strFontFace];
[inclPageBGColor] background-color: [strPageBGColor];[/inclPageBGColor] [inclPageBGColor] background-color: [strPageBGColor];[/inclPageBGColor]
color: [strTextColor]; color: [strTextColor];
[inclGraphicURL] background-image: url([strGraphicURL]);[/inclGraphicURL] [inclGraphicURL] background-image: url([strGraphicURL]);[/inclGraphicURL]
margin-right: 5%; margin-right: 5%;
margin-left: 5%; margin-left: 5%;
font-size: [strFontSize]; font-size: [strFontSize];
@ -73,14 +73,14 @@ div.StdDiv{
text-align: right; text-align: right;
font-size: 150%; font-size: 150%;
direction: rtl; direction: rtl;
font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", [strFontFace]; font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", [strFontFace];
} }
.CentredRTLText{ .CentredRTLText{
text-align: center; text-align: center;
font-size: 150%; font-size: 150%;
direction: rtl; direction: rtl;
font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", [strFontFace]; font-family: "Simplified Arabic", "Traditional Arabic", "Times New Roman", [strFontFace];
} }
button p.RTLText{ button p.RTLText{
@ -531,7 +531,7 @@ div.NavButtonBar{
.NavButton { .NavButton {
border-style: solid; border-style: solid;
[inclNavBarColor] [inclNavBarColor]
border-left-color: [strNavLightColor]; border-left-color: [strNavLightColor];
border-top-color: [strNavLightColor]; border-top-color: [strNavLightColor];
border-right-color: [strNavShadeColor]; border-right-color: [strNavShadeColor];
@ -540,7 +540,7 @@ div.NavButtonBar{
color: [strNavTextColor]; color: [strNavTextColor];
[/inclNavBarColor] [/inclNavBarColor]
border-width: 2px; border-width: 2px;
cursor: pointer; cursor: pointer;
} }
.NavButtonUp { .NavButtonUp {
@ -554,7 +554,7 @@ div.NavButtonBar{
background-color: [strNavTextColor]; background-color: [strNavTextColor];
[/inclNavBarColor] [/inclNavBarColor]
border-width: 2px; border-width: 2px;
cursor: pointer; cursor: pointer;
} }
.NavButtonDown { .NavButtonDown {
@ -568,7 +568,7 @@ div.NavButtonBar{
background-color: [strNavTextColor]; background-color: [strNavTextColor];
[/inclNavBarColor] [/inclNavBarColor]
border-width: 2px; border-width: 2px;
cursor: pointer; cursor: pointer;
} }
/*EndNavBarStyle*/ /*EndNavBarStyle*/

View file

@ -5,7 +5,7 @@ function Client(){
this.ua = navigator.userAgent; this.ua = navigator.userAgent;
this.name = navigator.appName; this.name = navigator.appName;
this.ver = navigator.appVersion; this.ver = navigator.appVersion;
//Get data about the browser //Get data about the browser
this.mac = (this.ver.indexOf('Mac') != -1); this.mac = (this.ver.indexOf('Mac') != -1);
@ -17,23 +17,23 @@ function Client(){
this.geckoVer = parseInt(this.ua.substring(this.ua.indexOf('Gecko')+6, this.ua.length)); this.geckoVer = parseInt(this.ua.substring(this.ua.indexOf('Gecko')+6, this.ua.length));
if (this.geckoVer < 20020000){this.min = false;} if (this.geckoVer < 20020000){this.min = false;}
} }
//Look for Firebird //Look for Firebird
this.firebird = (this.ua.indexOf('Firebird') > 1); this.firebird = (this.ua.indexOf('Firebird') > 1);
//Look for Safari //Look for Safari
this.safari = (this.ua.indexOf('Safari') > 1); this.safari = (this.ua.indexOf('Safari') > 1);
if (this.safari){ if (this.safari){
this.gecko = false; this.gecko = false;
} }
//Look for IE //Look for IE
this.ie = (this.ua.indexOf('MSIE') > 0); this.ie = (this.ua.indexOf('MSIE') > 0);
if (this.ie){ if (this.ie){
this.ieVer = parseFloat(this.ua.substring(this.ua.indexOf('MSIE')+5, this.ua.length)); this.ieVer = parseFloat(this.ua.substring(this.ua.indexOf('MSIE')+5, this.ua.length));
if (this.ieVer < 5.5){this.min = false;} if (this.ieVer < 5.5){this.min = false;}
} }
//Look for Opera //Look for Opera
this.opera = (this.ua.indexOf('Opera') > 0); this.opera = (this.ua.indexOf('Opera') > 0);
if (this.opera){ if (this.opera){
@ -43,7 +43,7 @@ function Client(){
if (this.min == false){ if (this.min == false){
alert('Your browser may not be able to handle this page.'); alert('Your browser may not be able to handle this page.');
} }
//Special case for the horrible ie5mac //Special case for the horrible ie5mac
this.ie5mac = (this.ie&&this.mac&&(this.ieVer<6)); this.ie5mac = (this.ie&&this.mac&&(this.ieVer<6));
} }

View file

@ -77,7 +77,7 @@ function CardOverlap(OtherCard){
var lgT=(this.GetT()>OtherCard.GetT())? this.GetT(): OtherCard.GetT(); var lgT=(this.GetT()>OtherCard.GetT())? this.GetT(): OtherCard.GetT();
var VDim=smB-lgT; var VDim=smB-lgT;
if (VDim<1){return 0;} if (VDim<1){return 0;}
return (HDim*VDim); return (HDim*VDim);
} }
Card.prototype.Overlap=CardOverlap; Card.prototype.Overlap=CardOverlap;
@ -105,18 +105,18 @@ Card.prototype.GoHome=CardGoHome;
function doDrag(e) { function doDrag(e) {
if (CurrDrag == -1) {return}; if (CurrDrag == -1) {return};
if (C.ie){var Ev = window.event}else{var Ev = e} if (C.ie){var Ev = window.event}else{var Ev = e}
var difX = Ev.clientX-window.lastX; var difX = Ev.clientX-window.lastX;
var difY = Ev.clientY-window.lastY; var difY = Ev.clientY-window.lastY;
var newX = DC[CurrDrag].GetL()+difX; var newX = DC[CurrDrag].GetL()+difX;
var newY = DC[CurrDrag].GetT()+difY; var newY = DC[CurrDrag].GetT()+difY;
DC[CurrDrag].SetL(newX); DC[CurrDrag].SetL(newX);
DC[CurrDrag].SetT(newY); DC[CurrDrag].SetT(newY);
window.lastX = Ev.clientX; window.lastX = Ev.clientX;
window.lastY = Ev.clientY; window.lastY = Ev.clientY;
return false; return false;
} }
function beginDrag(e, DragNum) { function beginDrag(e, DragNum) {
CurrDrag = DragNum; CurrDrag = DragNum;
if (C.ie){ if (C.ie){
var Ev = window.event; var Ev = window.event;
@ -125,27 +125,27 @@ function beginDrag(e, DragNum) {
} }
else{ else{
var Ev = e; var Ev = e;
window.onmousemove=doDrag; window.onmousemove=doDrag;
window.onmouseup=endDrag; window.onmouseup=endDrag;
} }
DC[CurrDrag].Highlight(); DC[CurrDrag].Highlight();
topZ++; topZ++;
DC[CurrDrag].css.zIndex = topZ; DC[CurrDrag].css.zIndex = topZ;
window.lastX=Ev.clientX; window.lastX=Ev.clientX;
window.lastY=Ev.clientY; window.lastY=Ev.clientY;
return false; return false;
} }
function endDrag(e) { function endDrag(e) {
if (CurrDrag == -1) {return}; if (CurrDrag == -1) {return};
DC[CurrDrag].Unhighlight(); DC[CurrDrag].Unhighlight();
if (C.ie){document.onmousemove=null}else{window.onmousemove=null;} if (C.ie){document.onmousemove=null}else{window.onmousemove=null;}
onEndDrag(); onEndDrag();
CurrDrag = -1; CurrDrag = -1;
//Need a bugfix for Opera focus problem here //Need a bugfix for Opera focus problem here
if (C.opera){FocusAButton();} if (C.opera){FocusAButton();}
return true; return true;
} }
var CurrDrag = -1; var CurrDrag = -1;
var topZ = 100; var topZ = 100;

View file

@ -39,7 +39,7 @@ function CheckGuess(Guess, Answer, CaseSensitive, PercentCorrect, Feedback){
} }
else{ else{
this.WorkingGuess = Guess; this.WorkingGuess = Guess;
this.WorkingAnswer = Answer; this.WorkingAnswer = Answer;
} }
this.Hint = ''; this.Hint = '';
this.HintPenalty = 1/Answer.length; this.HintPenalty = 1/Answer.length;
@ -66,12 +66,12 @@ function CheckGuess_DoCheck(){
} }
//Stash the hint //Stash the hint
this.Hint = this.Answer.charAt(i); this.Hint = this.Answer.charAt(i);
this.CorrectStart = this.Guess.substring(0, i); this.CorrectStart = this.Guess.substring(0, i);
//If there's more to the answer, look at the rest of it //If there's more to the answer, look at the rest of it
if (i<this.Guess.length){ if (i<this.Guess.length){
//Figure out how much of the end is correct //Figure out how much of the end is correct
var j = this.WorkingGuess.length-1; var j = this.WorkingGuess.length-1;
var k = this.WorkingAnswer.length-1; var k = this.WorkingAnswer.length-1;
@ -90,7 +90,7 @@ function CheckGuess_DoCheck(){
} }
else{ else{
this.PercentMatch = Math.floor((100 * CorrectChars)/this.Guess.length); this.PercentMatch = Math.floor((100 * CorrectChars)/this.Guess.length);
} }
} }
CheckGuess.prototype.DoCheck = CheckGuess_DoCheck; CheckGuess.prototype.DoCheck = CheckGuess_DoCheck;
@ -160,13 +160,13 @@ CheckAnswerArray.prototype.GetBestMatch = CheckAnswerArray_GetBestMatch;
function CheckShortAnswer(QNum){ function CheckShortAnswer(QNum){
//bail if question doesn't exist or exercise finished //bail if question doesn't exist or exercise finished
if ((State[QNum].length < 1)||(Finished == true)){return;} if ((State[QNum].length < 1)||(Finished == true)){return;}
//bail if question already complete //bail if question already complete
if (State[QNum][0] > -1){return;} if (State[QNum][0] > -1){return;}
//Get the guess (TrimString added to fix bug for 6.0.4.3) //Get the guess (TrimString added to fix bug for 6.0.4.3)
var G = TrimString(document.getElementById('Q_' + QNum + '_Guess').value); var G = TrimString(document.getElementById('Q_' + QNum + '_Guess').value);
//If no guess, bail with message; no penalty //If no guess, bail with message; no penalty
if (G.length < 1){ if (G.length < 1){
ShowMessage(PleaseEnter); ShowMessage(PleaseEnter);
@ -175,7 +175,7 @@ function CheckShortAnswer(QNum){
//Increment tries //Increment tries
State[QNum][2]++; State[QNum][2]++;
//Create a check object //Create a check object
var CA = new CheckAnswerArray(CaseSensitive); var CA = new CheckAnswerArray(CaseSensitive);
@ -184,7 +184,7 @@ function CheckShortAnswer(QNum){
CA.AddAnswer(G, I[QNum][3][ANum][0], I[QNum][3][ANum][3], I[QNum][3][ANum][1]); CA.AddAnswer(G, I[QNum][3][ANum][0], I[QNum][3][ANum][3], I[QNum][3][ANum][1]);
} }
CA.GetBestMatch(); CA.GetBestMatch();
//Store any match in the state tracking field //Store any match in the state tracking field
if (State[QNum][5].length > 0){State[QNum][5] += ' | ';} if (State[QNum][5].length > 0){State[QNum][5] += ' | ';}
if (CA.MatchNum > -1){ if (CA.MatchNum > -1){
@ -198,11 +198,11 @@ function CheckShortAnswer(QNum){
//Add the percent correct value for this answer to the Q State (works for all //Add the percent correct value for this answer to the Q State (works for all
//situations, wrong or right) //situations, wrong or right)
State[QNum][3] += CA.Score; State[QNum][3] += CA.Score;
//Now branch, based on the nature of the match //Now branch, based on the nature of the match
//Is it a complete match? //Is it a complete match?
if (CA.CompleteMatch == true){ if (CA.CompleteMatch == true){
//Is it with a wrong answer, or a right answer? //Is it with a wrong answer, or a right answer?
if (CA.Score == 100){ if (CA.Score == 100){
//It's right //It's right
@ -213,8 +213,8 @@ function CheckShortAnswer(QNum){
if (AlsoCorrectList.length > 0){ if (AlsoCorrectList.length > 0){
CA.Feedback += '<br />' + CorrectList + '<br />' + AlsoCorrectList; CA.Feedback += '<br />' + CorrectList + '<br />' + AlsoCorrectList;
} }
} }
//Get the overall score and add it to the feedback //Get the overall score and add it to the feedback
if (ContinuousScoring == true){ if (ContinuousScoring == true){
CalculateOverallScore(); CalculateOverallScore();
@ -228,14 +228,14 @@ function CheckShortAnswer(QNum){
return; return;
} }
} }
//Otherwise, it's a match to a predicted wrong/partially correct, or a partial //Otherwise, it's a match to a predicted wrong/partially correct, or a partial
//match to a right answer //match to a right answer
if (CA.Feedback.length < 1){CA.Feedback = DefaultWrong;} if (CA.Feedback.length < 1){CA.Feedback = DefaultWrong;}
//Remove any previous score unless exercise is finished (6.0.3.8+) //Remove any previous score unless exercise is finished (6.0.3.8+)
if (Finished == false){ if (Finished == false){
WriteToInstructions(strInstructions); WriteToInstructions(strInstructions);
} }
ShowMessage(CA.Feedback); ShowMessage(CA.Feedback);
//If necessary, switch a hybrid question to m/c //If necessary, switch a hybrid question to m/c
@ -278,7 +278,7 @@ function GetCorrectArray(QNum){
if (I[QNum][3][ANum][2] == 1){ //This is an acceptable correct answer if (I[QNum][3][ANum][2] == 1){ //This is an acceptable correct answer
Result.push(I[QNum][3][ANum][0]); Result.push(I[QNum][3][ANum][0]);
} }
} }
return Result; return Result;
} }
@ -322,28 +322,28 @@ function ReplaceGuessBox(QNum, Ans){
function ShowAnswers(QNum){ function ShowAnswers(QNum){
//bail if question doesn't exist or exercise finished //bail if question doesn't exist or exercise finished
if ((State[QNum].length < 1)||(Finished == true)){return;} if ((State[QNum].length < 1)||(Finished == true)){return;}
//Get the answer list to display //Get the answer list to display
var Ans = GetCorrectList(QNum, '', false); var Ans = GetCorrectList(QNum, '', false);
Ans = CorrectList + '<br />' + Ans; Ans = CorrectList + '<br />' + Ans;
//Display feedback //Display feedback
ShowMessage(Ans); ShowMessage(Ans);
//Set the score for this question to 0 if no //Set the score for this question to 0 if no
if (State[QNum][0] < 1){ if (State[QNum][0] < 1){
State[QNum][0] = 0; State[QNum][0] = 0;
} }
//Get the first correct answer //Get the first correct answer
var FirstAns = GetFirstCorrectAnswer(QNum); var FirstAns = GetFirstCorrectAnswer(QNum);
//Replace the textbox //Replace the textbox
ReplaceGuessBox(QNum, FirstAns); ReplaceGuessBox(QNum, FirstAns);
//Remove any current score //Remove any current score
WriteToInstructions(strInstructions); WriteToInstructions(strInstructions);
//This may be the last, so check finished status //This may be the last, so check finished status
CheckFinished(); CheckFinished();
} }
@ -355,13 +355,13 @@ function ShowAnswers(QNum){
function ShowHint(QNum){ function ShowHint(QNum){
//bail if question doesn't exist or exercise finished //bail if question doesn't exist or exercise finished
if ((State[QNum].length < 1)||(Finished == true)){return;} if ((State[QNum].length < 1)||(Finished == true)){return;}
//bail if question already complete //bail if question already complete
if (State[QNum][0] > -1){return;} if (State[QNum][0] > -1){return;}
//Get the guess //Get the guess
var G = document.getElementById('Q_' + QNum + '_Guess').value; var G = document.getElementById('Q_' + QNum + '_Guess').value;
//If no guess, give the first correct bit //If no guess, give the first correct bit
if (G.length < 1){ if (G.length < 1){
var Ans = GetFirstCorrectAnswer(QNum); var Ans = GetFirstCorrectAnswer(QNum);
@ -374,7 +374,7 @@ function ShowHint(QNum){
//Increment tries //Increment tries
State[QNum][2]++; State[QNum][2]++;
//Create a check object //Create a check object
var CA = new CheckAnswerArray(CaseSensitive); var CA = new CheckAnswerArray(CaseSensitive);

View file

@ -12,7 +12,7 @@
<param name="type" value="audio/x-pn-realaudio-plugin" /> <param name="type" value="audio/x-pn-realaudio-plugin" />
<param name="src" value="[strFilePath]" /> <param name="src" value="[strFilePath]" />
<param name="autostart" value="false" /> <param name="autostart" value="false" />
<param name="controls" value="[inclVideo]ImageWindow,[/inclVideo]ControlPanel" /> <param name="controls" value="[inclVideo]ImageWindow,[/inclVideo]ControlPanel" />
[strContent]</object>[/Real Player] [strContent]</object>[/Real Player]
[Flash Player]<object codebase="[strFilePath]" type="application/x-shockwave-flash" width="[strWidth]" height="[strHeight]" data="[strFilePath]"> <param name="movie" value="[strFilePath]" />[strContent]</object>[/Flash Player] [Flash Player]<object codebase="[strFilePath]" type="application/x-shockwave-flash" width="[strWidth]" height="[strHeight]" data="[strFilePath]"> <param name="movie" value="[strFilePath]" />[strContent]</object>[/Flash Player]

View file

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" <html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en"><head> xml:lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> <title>
Page Title Page Title
@ -31,7 +31,7 @@ Page Title
</div> </div>
<div id="MainDiv" class="StdDiv"> <div id="MainDiv" class="StdDiv">
<p>Page content...</p> <p>Page content...</p>
</div> </div>

View file

@ -21,7 +21,7 @@ function ShowMessage(Feedback){
//Focus the OK button //Focus the OK button
setTimeout("document.getElementById('FeedbackOKButton').focus()", 50); setTimeout("document.getElementById('FeedbackOKButton').focus()", 50);
//[inclPreloadImages] //[inclPreloadImages]
// RefreshImages(); // RefreshImages();
//[/inclPreloadImages] //[/inclPreloadImages]
@ -54,7 +54,7 @@ function ShowElements(Show, TagName, ContainerToReverse){
Els[i].style.visibility = 'hidden'; Els[i].style.visibility = 'hidden';
if (C.mac && C.gecko) {Els[i].style.display = 'none';} if (C.mac && C.gecko) {Els[i].style.display = 'none';}
} }
} }
else { else {
// tagName is either input or select (that is, Form Elements) // tagName is either input or select (that is, Form Elements)
// ie6 has a problem with Form elements, so manipulate those // ie6 has a problem with Form elements, so manipulate those

View file

@ -57,13 +57,13 @@ function GetViewportHeight(){
function TopSettingWithScrollOffset(TopPercent){ function TopSettingWithScrollOffset(TopPercent){
var T = Math.floor(GetViewportHeight() * (TopPercent/100)); var T = Math.floor(GetViewportHeight() * (TopPercent/100));
return GetScrollTop() + T; return GetScrollTop() + T;
} }
//CODE FOR AVOIDING LOSS OF DATA WHEN BACKSPACE KEY INVOKES history.back() //CODE FOR AVOIDING LOSS OF DATA WHEN BACKSPACE KEY INVOKES history.back()
var InTextBox = false; var InTextBox = false;
function SuppressBackspace(e){ function SuppressBackspace(e){
if (InTextBox == true){return;} if (InTextBox == true){return;}
if (C.ie) { if (C.ie) {
thisKey = window.event.keyCode; thisKey = window.event.keyCode;
@ -80,7 +80,7 @@ function SuppressBackspace(e){
if (Suppress == true){ if (Suppress == true){
if (C.ie){ if (C.ie){
window.event.returnValue = false; window.event.returnValue = false;
window.event.cancelBubble = true; window.event.cancelBubble = true;
} }
else{ else{

View file

@ -5,7 +5,7 @@
[strDublinCoreMetadata] [strDublinCoreMetadata]
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> <title>
[strPlainTitle] [strPlainTitle]
@ -120,7 +120,7 @@
[/inclHint] [/inclHint]
--> -->
<div id="ClozeDiv"> <div id="ClozeDiv">
<form id="Cloze" method="post" action="" onsubmit="return false;"> <form id="Cloze" method="post" action="" onsubmit="return false;">
<div class="ClozeBody"> <div class="ClozeBody">

View file

@ -9,7 +9,7 @@ function SetScormScore(){
//Now send detailed reports about each item //Now send detailed reports about each item
for (var i=0; i<State.length; i++){ for (var i=0; i<State.length; i++){
var ThisItemGuesses = ''; var ThisItemGuesses = '';
var GapLabel = 'Gap_' + (i+1).toString(); var GapLabel = 'Gap_' + (i+1).toString();
var ThisItemScore = Math.floor(State[i].ItemScore * 100) + ''; var ThisItemScore = Math.floor(State[i].ItemScore * 100) + '';
API.LMSSetValue('cmi.objectives.' + i + '.id', 'obj'+GapLabel); API.LMSSetValue('cmi.objectives.' + i + '.id', 'obj'+GapLabel);
API.LMSSetValue('cmi.interactions.' + i + '.id', 'int'+GapLabel); API.LMSSetValue('cmi.interactions.' + i + '.id', 'int'+GapLabel);
@ -24,11 +24,11 @@ function SetScormScore(){
} }
for (var j=0; j<State[i].Guesses.length; j++){ for (var j=0; j<State[i].Guesses.length; j++){
if (j>0){ThisItemGuesses += ' | ';} if (j>0){ThisItemGuesses += ' | ';}
ThisItemGuesses += State[i].Guesses[j]; ThisItemGuesses += State[i].Guesses[j];
} }
API.LMSSetValue('cmi.interactions.' + i + '.type', 'fill-in'); API.LMSSetValue('cmi.interactions.' + i + '.type', 'fill-in');
API.LMSSetValue('cmi.interactions.' + i + '.student_response', ThisItemGuesses); API.LMSSetValue('cmi.interactions.' + i + '.student_response', ThisItemGuesses);
} }
API.LMSCommit(''); API.LMSCommit('');
} }
} }
@ -48,7 +48,7 @@ function ItemState(){
var Feedback = ''; var Feedback = '';
var Correct = '[strCorrect]'; var Correct = '[strCorrect]';
var Incorrect = '[strIncorrect]'; var Incorrect = '[strIncorrect]';
var GiveHint = '[strGiveHint]'; var GiveHint = '[strGiveHint]';
var CaseSensitive = [boolCaseSensitive]; var CaseSensitive = [boolCaseSensitive];
var YourScoreIs = '[strYourScoreIs]'; var YourScoreIs = '[strYourScoreIs]';
@ -70,7 +70,7 @@ function StartUp(){
if (document.getElementById('CharacterKeypad') != null){ if (document.getElementById('CharacterKeypad') != null){
document.getElementById('CharacterKeypad').style.display = 'block'; document.getElementById('CharacterKeypad').style.display = 'block';
} }
[inclScorm1.2] [inclScorm1.2]
ScormStartUp(); ScormStartUp();
[/inclScorm1.2] [/inclScorm1.2]
@ -89,9 +89,9 @@ function StartUp(){
for (i=0; i<I.length; i++){ for (i=0; i<I.length; i++){
State[i] = new ItemState(); State[i] = new ItemState();
} }
ClearTextBoxes(); ClearTextBoxes();
[inclTimer] [inclTimer]
StartTimer(); StartTimer();
[/inclTimer] [/inclTimer]
@ -126,8 +126,8 @@ function CompileGuesses(){
Temp += '<fieldlabelid>JClozeStudentResponses</fieldlabelid><fielddata>'; Temp += '<fieldlabelid>JClozeStudentResponses</fieldlabelid><fielddata>';
for (var j=0; j<State[i].Guesses.length; j++){ for (var j=0; j<State[i].Guesses.length; j++){
if (j>0){Temp += '| ';} if (j>0){Temp += '| ';}
Temp += State[i].Guesses[j] + ' '; Temp += State[i].Guesses[j] + ' ';
} }
Temp += '</fielddata></field>'; Temp += '</fielddata></field>';
} }
Temp += '</fields></hpnetresult>'; Temp += '</fields></hpnetresult>';
@ -184,12 +184,12 @@ function CheckAnswers(){
} }
ShowMessage(Output); ShowMessage(Output);
setTimeout('WriteToInstructions(Output)', 50); setTimeout('WriteToInstructions(Output)', 50);
Score = TotalScore; Score = TotalScore;
CompileGuesses(); CompileGuesses();
if ((AllCorrect == true)||(Finished == true)){ if ((AllCorrect == true)||(Finished == true)){
[inclSendResults] [inclSendResults]
setTimeout('SendResults(' + TotalScore + ')', 50); setTimeout('SendResults(' + TotalScore + ')', 50);
[/inclSendResults] [/inclSendResults]
@ -282,7 +282,7 @@ function FindCurrent() {
return CurrentWord; return CurrentWord;
} }
} }
x=CurrentWord + 1; x=CurrentWord + 1;
while (x<I.length){ while (x<I.length){
if (State[x].AnsweredCorrectly == false){ if (State[x].AnsweredCorrectly == false){
@ -290,7 +290,7 @@ function FindCurrent() {
return x; return x;
} }
} }
x++; x++;
} }
x = 0; x = 0;
@ -300,7 +300,7 @@ function FindCurrent() {
return x; return x;
} }
} }
x++; x++;
} }
return FoundCurrent; return FoundCurrent;
} }

View file

@ -5,7 +5,7 @@
[strDublinCoreMetadata] [strDublinCoreMetadata]
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> <title>
[strPlainTitle] [strPlainTitle]
@ -120,7 +120,7 @@
<button id="CheckButton1" class="FuncButton" onmouseover="FuncBtnOver(this)" onfocus="FuncBtnOver(this)" onmouseout="FuncBtnOut(this)" onblur="FuncBtnOut(this)" onmousedown="FuncBtnDown(this)" onmouseup="FuncBtnOut(this)" onclick="CheckAnswers()">&nbsp;[strCheckCaption]&nbsp;</button> <button id="CheckButton1" class="FuncButton" onmouseover="FuncBtnOver(this)" onfocus="FuncBtnOver(this)" onmouseout="FuncBtnOut(this)" onblur="FuncBtnOut(this)" onmousedown="FuncBtnDown(this)" onmouseup="FuncBtnOut(this)" onclick="CheckAnswers()">&nbsp;[strCheckCaption]&nbsp;</button>
--> -->
<table class="CrosswordGrid"> <table class="CrosswordGrid">
<tbody> <tbody>

View file

@ -5,7 +5,7 @@ function SetScormScore(){
//Reports the current score and any other information back to the LMS //Reports the current score and any other information back to the LMS
if (API != null){ if (API != null){
API.LMSSetValue('cmi.core.score.raw', Score); API.LMSSetValue('cmi.core.score.raw', Score);
//Now send a detailed reports on the item //Now send a detailed reports on the item
var ItemLabel = 'Crossword'; var ItemLabel = 'Crossword';
API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel); API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel);
@ -15,13 +15,13 @@ function SetScormScore(){
} }
else{ else{
API.LMSSetValue('cmi.objectives.0.status', 'incomplete'); API.LMSSetValue('cmi.objectives.0.status', 'incomplete');
} }
API.LMSSetValue('cmi.objectives.0.score.min', '0'); API.LMSSetValue('cmi.objectives.0.score.min', '0');
API.LMSSetValue('cmi.objectives.0.score.max', '100'); API.LMSSetValue('cmi.objectives.0.score.max', '100');
API.LMSSetValue('cmi.objectives.0.score.raw', Score); API.LMSSetValue('cmi.objectives.0.score.raw', Score);
//We're not sending any student response data, so we can set this to a non-standard value //We're not sending any student response data, so we can set this to a non-standard value
API.LMSSetValue('cmi.interactions.0.type', 'crossword'); API.LMSSetValue('cmi.interactions.0.type', 'crossword');
API.LMSCommit(''); API.LMSCommit('');
} }
} }
@ -35,7 +35,7 @@ var Feedback = '';
var AcrossCaption = ''; var AcrossCaption = '';
var DownCaption = ''; var DownCaption = '';
var Correct = '[strCorrect]'; var Correct = '[strCorrect]';
var Incorrect = '[strIncorrect]'; var Incorrect = '[strIncorrect]';
var GiveHint = '[strGiveHint]'; var GiveHint = '[strGiveHint]';
var YourScoreIs = '[strYourScoreIs]'; var YourScoreIs = '[strYourScoreIs]';
var BuiltGrid = ''; var BuiltGrid = '';
@ -45,7 +45,7 @@ var Score = 0;
var InTextBox = false; var InTextBox = false;
var Locked = false; var Locked = false;
var TimeOver = false; var TimeOver = false;
var CaseSensitive = [boolCaseSensitive]; var CaseSensitive = [boolCaseSensitive];
var InputStuff = '<form method="post" action="" onsubmit="return false;"><span class="ClueNum">[strClueNum]: </span>'; var InputStuff = '<form method="post" action="" onsubmit="return false;"><span class="ClueNum">[strClueNum]: </span>';
InputStuff += '[strClue] <input onfocus="CurrentBox=this;InTextBox=true;" onblur="InTextBox=false;" id="[strBoxId]" type="edit" size="[strEditSize]" maxlength="[strMaxLength]"></input>'; InputStuff += '[strClue] <input onfocus="CurrentBox=this;InTextBox=true;" onblur="InTextBox=false;" id="[strBoxId]" type="edit" size="[strEditSize]" maxlength="[strMaxLength]"></input>';
@ -65,7 +65,7 @@ function StartUp(){
[inclScorm1.2] [inclScorm1.2]
ScormStartUp(); ScormStartUp();
[/inclScorm1.2] [/inclScorm1.2]
AcrossCaption = document.getElementById('CluesAcrossLabel').innerHTML; AcrossCaption = document.getElementById('CluesAcrossLabel').innerHTML;
DownCaption = document.getElementById('CluesDownLabel').innerHTML; DownCaption = document.getElementById('CluesDownLabel').innerHTML;
[inclSendResults] [inclSendResults]
@ -88,14 +88,14 @@ function GetAnswerLength(Across,x,y){
while ((x<L.length)&&(L[x][y].length > 0)){ while ((x<L.length)&&(L[x][y].length > 0)){
Result += L[x][y].length; Result += L[x][y].length;
x++; x++;
} }
return Result; return Result;
} }
else{ else{
while ((y<L[x].length)&&(L[x][y].length > 0)){ while ((y<L[x].length)&&(L[x][y].length > 0)){
Result += L[x][y].length; Result += L[x][y].length;
y++; y++;
} }
return Result; return Result;
} }
} }
@ -165,7 +165,7 @@ function SplitStringToPerceivedChars(InString, PC){
function EnterAnswer(Guess,Across,AnsLength,x,y){ function EnterAnswer(Guess,Across,AnsLength,x,y){
var PC = new Array(); var PC = new Array();
SplitStringToPerceivedChars(Guess, PC); SplitStringToPerceivedChars(Guess, PC);
var i=x; var i=x;
var j=y; var j=y;
var Letter = 0; var Letter = 0;
@ -269,9 +269,9 @@ function CheckAnswers(){
var AllCorrect = true; var AllCorrect = true;
var TotLetters = 0; var TotLetters = 0;
var CorrectLetters = 0; var CorrectLetters = 0;
var LetterFromKey = ''; var LetterFromKey = '';
var LetterFromGuess = ''; var LetterFromGuess = '';
//Check each letter //Check each letter
for (var i=0; i<L.length; i++){ for (var i=0; i<L.length; i++){
for (var j=0; j<L[i].length; j++){ for (var j=0; j<L[i].length; j++){
@ -285,7 +285,7 @@ function CheckAnswers(){
LetterFromKey = L[i][j].toUpperCase(); LetterFromKey = L[i][j].toUpperCase();
LetterFromGuess = G[i][j].toUpperCase(); LetterFromGuess = G[i][j].toUpperCase();
} }
if (LetterFromGuess != LetterFromKey){ if (LetterFromGuess != LetterFromKey){
G[i][j] = ''; G[i][j] = '';
//Blank that square in the grid //Blank that square in the grid
SetGridSquareValue(i,j,''); SetGridSquareValue(i,j,'');
@ -316,7 +316,7 @@ function CheckAnswers(){
ShowMessage(Output); ShowMessage(Output);
WriteToInstructions(Output); WriteToInstructions(Output);
if ((AllCorrect == true)||(TimeOver == true)){ if ((AllCorrect == true)||(TimeOver == true)){
[inclSendResults] [inclSendResults]
setTimeout('SendResults(' + Score + ')', 50); setTimeout('SendResults(' + Score + ')', 50);

View file

@ -3,7 +3,7 @@
xml:lang="en"> xml:lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title> <title></title>
<script type="text/javascript"> <script type="text/javascript">

View file

@ -5,7 +5,7 @@
[strDublinCoreMetadata] [strDublinCoreMetadata]
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> <title>
[strPlainTitle] [strPlainTitle]

View file

@ -6,18 +6,18 @@ function SetScormScore(){
//Reports the current score and any other information back to the LMS //Reports the current score and any other information back to the LMS
if (API != null){ if (API != null){
API.LMSSetValue('cmi.core.score.raw', Score); API.LMSSetValue('cmi.core.score.raw', Score);
//Now send a detailed reports on the item //Now send a detailed reports on the item
var ItemLabel = 'Matching'; var ItemLabel = 'Matching';
API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel); API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel);
API.LMSSetValue('cmi.interactions.0.id', 'int'+ItemLabel); API.LMSSetValue('cmi.interactions.0.id', 'int'+ItemLabel);
API.LMSSetValue('cmi.objectives.0.status', API.LMSGetValue('cmi.core.lesson_status')); API.LMSSetValue('cmi.objectives.0.status', API.LMSGetValue('cmi.core.lesson_status'));
API.LMSSetValue('cmi.objectives.0.score.min', '0'); API.LMSSetValue('cmi.objectives.0.score.min', '0');
API.LMSSetValue('cmi.objectives.0.score.max', '100'); API.LMSSetValue('cmi.objectives.0.score.max', '100');
API.LMSSetValue('cmi.objectives.0.score.raw', Score); API.LMSSetValue('cmi.objectives.0.score.raw', Score);
//We can only use the performance type, because we're storing multiple responses of various types. //We can only use the performance type, because we're storing multiple responses of various types.
API.LMSSetValue('cmi.interactions.0.type', 'performance'); API.LMSSetValue('cmi.interactions.0.type', 'performance');
var AnswersTried = ''; var AnswersTried = '';
for (var i=0; i<Status[0][3].length; i++){ for (var i=0; i<Status[0][3].length; i++){
if (i>0){AnswersTried += ' | ';} if (i>0){AnswersTried += ' | ';}
@ -57,7 +57,7 @@ function StartUp(){
[inclScorm1.2] [inclScorm1.2]
ScormStartUp(); ScormStartUp();
[/inclScorm1.2] [/inclScorm1.2]
[inclSendResults] [inclSendResults]
GetUserName(); GetUserName();
[/inclSendResults] [/inclSendResults]
@ -134,7 +134,7 @@ function SetUpItems(ShuffleQs, ReduceTo){
//Remove all the table rows and put them in an array for processing //Remove all the table rows and put them in an array for processing
var Qs = document.getElementById('Questions'); var Qs = document.getElementById('Questions');
//First, get a list of keys //First, get a list of keys
GetUniqueKeys(Qs, OriginalKeys); GetUniqueKeys(Qs, OriginalKeys);
@ -144,12 +144,12 @@ function SetUpItems(ShuffleQs, ReduceTo){
} }
var Reducing = (QList.length > ReduceTo); var Reducing = (QList.length > ReduceTo);
//If required, select random rows to delete //If required, select random rows to delete
if (Reducing == true){ if (Reducing == true){
var DumpItem = 0; var DumpItem = 0;
while (ReduceTo < QList.length){ while (ReduceTo < QList.length){
//Get a number to delete from the array //Get a number to delete from the array
DumpItem = Math.floor(QList.length*Math.random()); DumpItem = Math.floor(QList.length*Math.random());
for (i=DumpItem; i<(QList.length-1); i++){ for (i=DumpItem; i<(QList.length-1); i++){
@ -164,16 +164,16 @@ function SetUpItems(ShuffleQs, ReduceTo){
} }
TotalUnfixedLeftItems = QList.length; TotalUnfixedLeftItems = QList.length;
//Write the rows back to the table body //Write the rows back to the table body
for (i=0; i<QList.length; i++){ for (i=0; i<QList.length; i++){
Qs.appendChild(QList[i]); Qs.appendChild(QList[i]);
} }
//Now we need to remove any drop-down options that no longer have associated select items //Now we need to remove any drop-down options that no longer have associated select items
if (Reducing == true){ if (Reducing == true){
GetUniqueKeys(Qs, ReducedKeys); GetUniqueKeys(Qs, ReducedKeys);
Selects = Qs.getElementsByTagName('select'); Selects = Qs.getElementsByTagName('select');
for (i=0; i<Selects.length; i++){ for (i=0; i<Selects.length; i++){
Options = Selects[i].getElementsByTagName('option'); Options = Selects[i].getElementsByTagName('option');
@ -209,22 +209,22 @@ function CheckAnswers(){
var AnsText = ''; var AnsText = '';
var AllDone = true; var AllDone = true;
TotCorrectChoices = 0; TotCorrectChoices = 0;
//for each item not fixed or a distractor //for each item not fixed or a distractor
for (var i=0; i<Status.length; i++){ for (var i=0; i<Status.length; i++){
//if it hasn't been answered correctly yet //if it hasn't been answered correctly yet
if (Status[i][0] < 1){ if (Status[i][0] < 1){
//Add one to the number of tries for this item //Add one to the number of tries for this item
Status[i][1]++; Status[i][1]++;
//Get a pointer to the drop-down //Get a pointer to the drop-down
Select = document.getElementById(Status[i][2]); Select = document.getElementById(Status[i][2]);
Key = GetKeyFromSelect(Select); Key = GetKeyFromSelect(Select);
//Save the answer given //Save the answer given
Status[i][3].push(Select.options[Select.selectedIndex].value); Status[i][3].push(Select.options[Select.selectedIndex].value);
//Check the answer //Check the answer
if (Select.options[Select.selectedIndex].value == Key){ if (Select.options[Select.selectedIndex].value == Key){
Status[i][0] = 1; Status[i][0] = 1;
@ -233,7 +233,7 @@ function CheckAnswers(){
Parent.removeChild(Select); Parent.removeChild(Select);
Parent.innerHTML = AnsText; Parent.innerHTML = AnsText;
Parent.nextSibling.innerHTML = CorrectIndicator; Parent.nextSibling.innerHTML = CorrectIndicator;
} }
else{ else{
AllDone = false; AllDone = false;
Parent = Select.parentNode; Parent = Select.parentNode;
@ -281,7 +281,7 @@ function CheckAnswers(){
//Show the feedback //Show the feedback
ShowMessage(Feedback); ShowMessage(Feedback);
[inclScorm1.2] [inclScorm1.2]
if (AllDone == true){ if (AllDone == true){
SetScormComplete(); SetScormComplete();

View file

@ -5,7 +5,7 @@
[strDublinCoreMetadata] [strDublinCoreMetadata]
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> <title>
[strPlainTitle] [strPlainTitle]

View file

@ -5,7 +5,7 @@ function SetScormScore(){
//Reports the current score and any other information back to the LMS //Reports the current score and any other information back to the LMS
if (API != null){ if (API != null){
API.LMSSetValue('cmi.core.score.raw', Score); API.LMSSetValue('cmi.core.score.raw', Score);
//Now send a detailed reports on the item //Now send a detailed reports on the item
var ItemLabel = 'Item_1'; var ItemLabel = 'Item_1';
API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel); API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel);
@ -16,14 +16,14 @@ function SetScormScore(){
else{ else{
API.LMSSetValue('cmi.objectives.0.status', 'incomplete'); API.LMSSetValue('cmi.objectives.0.status', 'incomplete');
} }
API.LMSSetValue('cmi.objectives.0.score.min', '0'); API.LMSSetValue('cmi.objectives.0.score.min', '0');
API.LMSSetValue('cmi.objectives.0.score.max', '100'); API.LMSSetValue('cmi.objectives.0.score.max', '100');
API.LMSSetValue('cmi.objectives.0.score.raw', Score); API.LMSSetValue('cmi.objectives.0.score.raw', Score);
//We can only use the performance type, because we're storing multiple responses of various types. //We can only use the performance type, because we're storing multiple responses of various types.
API.LMSSetValue('cmi.interactions.0.type', 'performance'); API.LMSSetValue('cmi.interactions.0.type', 'performance');
API.LMSSetValue('cmi.interactions.0.student_response', AnswersTried); API.LMSSetValue('cmi.interactions.0.student_response', AnswersTried);
API.LMSCommit(''); API.LMSCommit('');
} }
} }
@ -135,7 +135,7 @@ function BuildCurrGuess(){
RemainingList += Segments[i][0] + '&nbsp; &nbsp;&nbsp;'; RemainingList += Segments[i][0] + '&nbsp; &nbsp;&nbsp;';
} }
} }
//now concatenate the segments, adding spaces where appropriate; //now concatenate the segments, adding spaces where appropriate;
Output = CompileString(GuessSequence); Output = CompileString(GuessSequence);
} }
@ -162,7 +162,7 @@ function CompileString(InArray){
if ((Openers.indexOf(OutString.charAt(OutString.length-1)) > -1)||(Punctuation.indexOf(OutArray[i].charAt(0)) > -1)){ if ((Openers.indexOf(OutString.charAt(OutString.length-1)) > -1)||(Punctuation.indexOf(OutArray[i].charAt(0)) > -1)){
Spacer = ''; Spacer = '';
} }
OutString = OutString + Spacer + OutArray[i]; OutString = OutString + Spacer + OutArray[i];
} }
//Capitalize the first letter if necessary //Capitalize the first letter if necessary
@ -227,8 +227,8 @@ function CheckAnswer(CheckType){
LongestCorrect[k] = TempCorrect[k]; LongestCorrect[k] = TempCorrect[k];
} }
HintToReturn = TempHint; HintToReturn = TempHint;
} }
} }
} }
if (WhichCorrect > -1){ if (WhichCorrect > -1){
AllDone = true; AllDone = true;
@ -242,7 +242,7 @@ function CheckAnswer(CheckType){
if (AnswersTried.length > 0){AnswersTried += ' | ';} if (AnswersTried.length > 0){AnswersTried += ' | ';}
AnswersTried += Output; AnswersTried += Output;
//Do score calculation here //Do score calculation here
Score = Math.floor(((Segments.length-Penalties) * 100)/Segments.length); Score = Math.floor(((Segments.length-Penalties) * 100)/Segments.length);
WellDone += YourScoreIs + ' ' + Score + '%.<br />'; WellDone += YourScoreIs + ' ' + Score + '%.<br />';
@ -289,7 +289,7 @@ function CheckAnswer(CheckType){
DisplayExercise(Exercise); DisplayExercise(Exercise);
ShowMessage(TryAgain); ShowMessage(TryAgain);
Penalties++; //Penalty for inaccurate check Penalties++; //Penalty for inaccurate check
[inclTimer] [inclTimer]
if (TimeOver == true){ if (TimeOver == true){
Score = Math.floor(((LongestCorrect.length-Penalties) * 100)/Segments.length); Score = Math.floor(((LongestCorrect.length-Penalties) * 100)/Segments.length);
@ -311,7 +311,7 @@ function CheckAnswer(CheckType){
Locked = true; Locked = true;
Finished = true; Finished = true;
setTimeout('Finish()', SubmissionTimeout); setTimeout('Finish()', SubmissionTimeout);
WriteToInstructions(YourScoreIs + ' ' + Score + '%.'); WriteToInstructions(YourScoreIs + ' ' + Score + '%.');
} }
[inclScorm1.2] [inclScorm1.2]
if (AllDone == true){ if (AllDone == true){
@ -339,7 +339,7 @@ function StartUp(){
//Stash the instructions so they can be redisplayed //Stash the instructions so they can be redisplayed
strInstructions = document.getElementById('InstructionsDiv').innerHTML; strInstructions = document.getElementById('InstructionsDiv').innerHTML;
[inclSendResults] [inclSendResults]
GetUserName(); GetUserName();
[/inclSendResults] [/inclSendResults]
@ -356,8 +356,8 @@ function StartUp(){
//Build and show the exercise //Build and show the exercise
BuildExercise(); BuildExercise();
DisplayExercise(Exercise); DisplayExercise(Exercise);
[inclTimer] [inclTimer]
StartTimer(); StartTimer();
[/inclTimer] [/inclTimer]

View file

@ -5,7 +5,7 @@
[strDublinCoreMetadata] [strDublinCoreMetadata]
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> <title>
[strPlainTitle] [strPlainTitle]
@ -109,7 +109,7 @@
<div id="MainDiv" class="StdDiv"> <div id="MainDiv" class="StdDiv">
<div id="QNav" class="QuestionNavigation"> <div id="QNav" class="QuestionNavigation">
<p style="text-align: right;"> <p style="text-align: right;">
@ -126,7 +126,7 @@
</div> </div>
</div> </div>
[strQuestionOutput] [strQuestionOutput]
[inclKeypad] [inclKeypad]

View file

@ -32,7 +32,7 @@ function SetScormScore(){
API.LMSSetValue('cmi.interactions.' + i + '.student_response', State[i][5]); API.LMSSetValue('cmi.interactions.' + i + '.student_response', State[i][5]);
} }
} }
API.LMSCommit(''); API.LMSCommit('');
} }
} }
@ -89,7 +89,7 @@ function CompleteEmptyFeedback(){
} }
function SetUpQuestions(){ function SetUpQuestions(){
var AList = new Array(); var AList = new Array();
var QList = new Array(); var QList = new Array();
var i, j; var i, j;
Qs = document.getElementById('Questions'); Qs = document.getElementById('Questions');
@ -126,7 +126,7 @@ function SetUpQuestions(){
} }
} }
} }
for (i=0; i<QList.length; i++){ for (i=0; i<QList.length; i++){
Qs.appendChild(QList[i]); Qs.appendChild(QList[i]);
QArray[QArray.length] = QList[i]; QArray[QArray.length] = QList[i];
@ -134,13 +134,13 @@ function SetUpQuestions(){
//Show the first item //Show the first item
QArray[0].style.display = ''; QArray[0].style.display = '';
//Now hide all except the first item //Now hide all except the first item
for (i=1; i<QArray.length; i++){ for (i=1; i<QArray.length; i++){
QArray[i].style.display = 'none'; QArray[i].style.display = 'none';
} }
SetQNumReadout(); SetQNumReadout();
SetFocusToTextbox(); SetFocusToTextbox();
} }
@ -155,7 +155,7 @@ function SetFocusToTextbox(){
} }
else{ else{
if (QArray[CurrQNum].getElementsByTagName('textarea')[0] != null){ if (QArray[CurrQNum].getElementsByTagName('textarea')[0] != null){
QArray[CurrQNum].getElementsByTagName('textarea')[0].focus(); QArray[CurrQNum].getElementsByTagName('textarea')[0].focus();
//and show a keypad if there is one //and show a keypad if there is one
if (document.getElementById('CharacterKeypad') != null){ if (document.getElementById('CharacterKeypad') != null){
document.getElementById('CharacterKeypad').style.display = 'block'; document.getElementById('CharacterKeypad').style.display = 'block';
@ -172,7 +172,7 @@ function SetFocusToTextbox(){
function ChangeQ(ChangeBy){ function ChangeQ(ChangeBy){
//The following line prevents moving to another question until the current //The following line prevents moving to another question until the current
//question is answered correctly. Uncomment it to enable this behaviour. //question is answered correctly. Uncomment it to enable this behaviour.
// if (State[CurrQNum][0] == -1){return;} // if (State[CurrQNum][0] == -1){return;}
if (((CurrQNum + ChangeBy) < 0)||((CurrQNum + ChangeBy) >= QArray.length)){return;} if (((CurrQNum + ChangeBy) < 0)||((CurrQNum + ChangeBy) >= QArray.length)){return;}
QArray[CurrQNum].style.display = 'none'; QArray[CurrQNum].style.display = 'none';
@ -204,7 +204,7 @@ function ShowSpecialReadingForQuestion(){
document.getElementById('ShowMethodButton').style.display = 'none'; document.getElementById('ShowMethodButton').style.display = 'none';
} }
} }
} }
} }
} }
} }
@ -242,32 +242,32 @@ function StartUp(){
if (QsToShow < 2){ if (QsToShow < 2){
document.getElementById('QNav').style.display = 'none'; document.getElementById('QNav').style.display = 'none';
} }
//Stash the instructions so they can be redisplayed //Stash the instructions so they can be redisplayed
strInstructions = document.getElementById('InstructionsDiv').innerHTML; strInstructions = document.getElementById('InstructionsDiv').innerHTML;
[inclScorm1.2] [inclScorm1.2]
ScormStartUp(); ScormStartUp();
[/inclScorm1.2] [/inclScorm1.2]
[inclSendResults] [inclSendResults]
GetUserName(); GetUserName();
[/inclSendResults] [/inclSendResults]
[inclPreloadImages] [inclPreloadImages]
PreloadImages([PreloadImageList]); PreloadImages([PreloadImageList]);
[/inclPreloadImages] [/inclPreloadImages]
CompleteEmptyFeedback(); CompleteEmptyFeedback();
SetUpQuestions(); SetUpQuestions();
ClearTextBoxes(); ClearTextBoxes();
CreateStatusArray(); CreateStatusArray();
[inclTimer] [inclTimer]
setTimeout('StartTimer()', 50); setTimeout('StartTimer()', 50);
[/inclTimer] [/inclTimer]
//Check search string for q parameter //Check search string for q parameter
if (document.location.search.length > 0){ if (document.location.search.length > 0){
if (ShuffleQs == false){ if (ShuffleQs == false){
@ -302,7 +302,7 @@ function ShowHideQuestions(){
document.getElementById('Questions').style.listStyleType = 'none'; document.getElementById('Questions').style.listStyleType = 'none';
document.getElementById('OneByOneReadout').style.display = ''; document.getElementById('OneByOneReadout').style.display = '';
document.getElementById('ShowMethodButton').innerHTML = ShowAllQuestionsCaption; document.getElementById('ShowMethodButton').innerHTML = ShowAllQuestionsCaption;
ShowingAllQuestions = false; ShowingAllQuestions = false;
} }
document.getElementById('ShowMethodButton').style.display = 'inline'; document.getElementById('ShowMethodButton').style.display = 'inline';
} }
@ -335,10 +335,10 @@ function CreateStatusArray(){
function CheckMCAnswer(QNum, ANum, Btn){ function CheckMCAnswer(QNum, ANum, Btn){
//if question doesn't exist, bail //if question doesn't exist, bail
if (State[QNum].length < 1){return;} if (State[QNum].length < 1){return;}
//Get the feedback //Get the feedback
Feedback = I[QNum][3][ANum][1]; Feedback = I[QNum][3][ANum][1];
//Now show feedback and bail if question already complete //Now show feedback and bail if question already complete
if (State[QNum][0] > -1){ if (State[QNum][0] > -1){
//Add an extra message explaining that the question //Add an extra message explaining that the question
@ -348,40 +348,40 @@ function CheckMCAnswer(QNum, ANum, Btn){
ShowMessage(Feedback); ShowMessage(Feedback);
return; return;
} }
//Hide the button while processing //Hide the button while processing
Btn.style.display = 'none'; Btn.style.display = 'none';
//Increment the number of tries //Increment the number of tries
State[QNum][2]++; State[QNum][2]++;
//Add the percent-correct value of this answer //Add the percent-correct value of this answer
State[QNum][3] += I[QNum][3][ANum][3]; State[QNum][3] += I[QNum][3][ANum][3];
//Store the try number in the answer part of the State array, for tracking purposes //Store the try number in the answer part of the State array, for tracking purposes
State[QNum][1][ANum] = State[QNum][2]; State[QNum][1][ANum] = State[QNum][2];
if (State[QNum][5].length > 0){State[QNum][5] += ' | ';} if (State[QNum][5].length > 0){State[QNum][5] += ' | ';}
State[QNum][5] += String.fromCharCode(65+ANum); State[QNum][5] += String.fromCharCode(65+ANum);
//Should this answer be accepted as correct? //Should this answer be accepted as correct?
if (I[QNum][3][ANum][2] < 1){ if (I[QNum][3][ANum][2] < 1){
//It's wrong //It's wrong
//Mark the answer //Mark the answer
Btn.innerHTML = IncorrectIndicator; Btn.innerHTML = IncorrectIndicator;
//Remove any previous score unless exercise is finished (6.0.3.8+) //Remove any previous score unless exercise is finished (6.0.3.8+)
if (Finished == false){ if (Finished == false){
WriteToInstructions(strInstructions); WriteToInstructions(strInstructions);
} }
//Check whether this leaves just one MC answer unselected, in which case the Q is terminated //Check whether this leaves just one MC answer unselected, in which case the Q is terminated
var RemainingAnswer = FinalAnswer(QNum); var RemainingAnswer = FinalAnswer(QNum);
if (RemainingAnswer > -1){ if (RemainingAnswer > -1){
//Behave as if the last answer had been selected, but give no credit for it //Behave as if the last answer had been selected, but give no credit for it
//Increment the number of tries //Increment the number of tries
State[QNum][2]++; State[QNum][2]++;
//Calculate the score for this question //Calculate the score for this question
CalculateMCQuestionScore(QNum); CalculateMCQuestionScore(QNum);
@ -397,7 +397,7 @@ function CheckMCAnswer(QNum, ANum, Btn){
//It's right //It's right
//Mark the answer //Mark the answer
Btn.innerHTML = CorrectIndicator; Btn.innerHTML = CorrectIndicator;
//Calculate the score for this question //Calculate the score for this question
CalculateMCQuestionScore(QNum); CalculateMCQuestionScore(QNum);
@ -410,13 +410,13 @@ function CheckMCAnswer(QNum, ANum, Btn){
} }
} }
} }
//Show the button again //Show the button again
Btn.style.display = 'inline'; Btn.style.display = 'inline';
//Finally, show the feedback //Finally, show the feedback
ShowMessage(Feedback); ShowMessage(Feedback);
//Check whether all questions are now done //Check whether all questions are now done
CheckFinished(); CheckFinished();
} }
@ -426,7 +426,7 @@ function CalculateMCQuestionScore(QNum){
var PercentCorrect = State[QNum][3]; var PercentCorrect = State[QNum][3];
var TotAns = GetTotalMCAnswers(QNum); var TotAns = GetTotalMCAnswers(QNum);
var HintPenalties = State[QNum][4]; var HintPenalties = State[QNum][4];
//Make sure it's not already complete //Make sure it's not already complete
if (State[QNum][0] < 0){ if (State[QNum][0] < 0){
@ -489,11 +489,11 @@ function CheckMultiSelAnswer(QNum){
//Increment the tries for this question //Increment the tries for this question
State[QNum][2]++; State[QNum][2]++;
var ShouldBeChecked; var ShouldBeChecked;
var Matches = 0; var Matches = 0;
if (State[QNum][5].length > 0){State[QNum][5] += ' | ';} if (State[QNum][5].length > 0){State[QNum][5] += ' | ';}
//Check if there are any mismatches //Check if there are any mismatches
Feedback = ''; Feedback = '';
var CheckBox = null; var CheckBox = null;
@ -530,12 +530,12 @@ function CheckMultiSelAnswer(QNum){
//It's wrong -- Remove any previous score unless exercise is finished (6.0.3.8+) //It's wrong -- Remove any previous score unless exercise is finished (6.0.3.8+)
if (Finished == false){ if (Finished == false){
WriteToInstructions(strInstructions); WriteToInstructions(strInstructions);
} }
} }
//Show the feedback //Show the feedback
ShowMessage(Feedback); ShowMessage(Feedback);
//Check whether all questions are now done //Check whether all questions are now done
CheckFinished(); CheckFinished();
} }
@ -543,7 +543,7 @@ function CheckMultiSelAnswer(QNum){
function CalculateMultiSelQuestionScore(QNum){ function CalculateMultiSelQuestionScore(QNum){
var Tries = State[QNum][2]; var Tries = State[QNum][2];
var TotAns = State[QNum][1].length; var TotAns = State[QNum][1].length;
//Make sure it's not already complete //Make sure it's not already complete
if (State[QNum][0] < 0){ if (State[QNum][0] < 0){
State[QNum][0] = (TotAns - (Tries-1)) / TotAns; State[QNum][0] = (TotAns - (Tries-1)) / TotAns;
@ -558,7 +558,7 @@ function CalculateMultiSelQuestionScore(QNum){
function CalculateOverallScore(){ function CalculateOverallScore(){
var TotalWeighting = 0; var TotalWeighting = 0;
var TotalScore = 0; var TotalScore = 0;
for (var QNum=0; QNum<State.length; QNum++){ for (var QNum=0; QNum<State.length; QNum++){
if (State[QNum] != null){ if (State[QNum] != null){
if (State[QNum][0] > -1){ if (State[QNum][0] > -1){
@ -571,9 +571,9 @@ function CalculateOverallScore(){
Score = Math.floor((TotalScore/TotalWeighting)*100); Score = Math.floor((TotalScore/TotalWeighting)*100);
} }
else{ else{
//if TotalWeighting is 0, no questions so far have any value, so //if TotalWeighting is 0, no questions so far have any value, so
//no penalty should be shown. //no penalty should be shown.
Score = 100; Score = 100;
} }
} }
@ -588,7 +588,7 @@ function CheckFinished(){
} }
} }
if (AllDone == true){ if (AllDone == true){
//Report final score and submit if necessary //Report final score and submit if necessary
CalculateOverallScore(); CalculateOverallScore();
FB = YourScoreIs + ' ' + Score + '%.'; FB = YourScoreIs + ' ' + Score + '%.';
@ -604,7 +604,7 @@ function CheckFinished(){
FB += '<br />' + CorrectFirstTime + ' ' + CFT + '/' + QsToShow; FB += '<br />' + CorrectFirstTime + ' ' + CFT + '/' + QsToShow;
} }
WriteToInstructions(FB); WriteToInstructions(FB);
Finished == true; Finished == true;
[inclTimer] [inclTimer]
window.clearInterval(Interval); window.clearInterval(Interval);
@ -621,7 +621,7 @@ function CheckFinished(){
TimeOver = true; TimeOver = true;
Locked = true; Locked = true;
[inclSendResults] [inclSendResults]
setTimeout('SendResults(' + Score + ')', 50); setTimeout('SendResults(' + Score + ')', 50);
[/inclSendResults] [/inclSendResults]
@ -654,7 +654,7 @@ function TimesUp(){
TimeOver = true; TimeOver = true;
Finished = true; Finished = true;
ShowMessage('[strTimesUp]'); ShowMessage('[strTimesUp]');
//Set all remaining scores to 0 //Set all remaining scores to 0
for (var QNum=0; QNum<State.length; QNum++){ for (var QNum=0; QNum<State.length; QNum++){
if (State[QNum] != null){ if (State[QNum] != null){

View file

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" <html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en"><head> xml:lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> <title>
[strPlainIndexTitle] [strPlainIndexTitle]
@ -21,7 +21,7 @@ body{
font-family: [strFontFace]; font-family: [strFontFace];
[inclPageBGColor] background-color: [strPageBGColor];[/inclPageBGColor] [inclPageBGColor] background-color: [strPageBGColor];[/inclPageBGColor]
color: [strTextColor]; color: [strTextColor];
[inclGraphicURL] background-image: url([strGraphicURL]);[/inclGraphicURL] [inclGraphicURL] background-image: url([strGraphicURL]);[/inclGraphicURL]
padding-left: 5%; padding-left: 5%;
padding-right: 5%; padding-right: 5%;
font-size: [strFontSize]; font-size: [strFontSize];

View file

@ -32,7 +32,7 @@
if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) { if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
error("Course Module ID was incorrect"); error("Course Module ID was incorrect");
} }
} }
require_login($course->id); require_login($course->id);
$context = get_context_instance(CONTEXT_MODULE, $cm->id); $context = get_context_instance(CONTEXT_MODULE, $cm->id);
@ -62,7 +62,7 @@
} else if ($hotpot->subnet && !address_in_subnet($_SERVER['REMOTE_ADDR'], $hotpot->subnet)) { } else if ($hotpot->subnet && !address_in_subnet($_SERVER['REMOTE_ADDR'], $hotpot->subnet)) {
$error = get_string("subneterror", "quiz"); $error = get_string("subneterror", "quiz");
// check number of attempts // check number of attempts
} else if ($hotpot->attempts && $hotpot->attempts <= count_records_select('hotpot_attempts', 'hotpot='.$hotpot->id.' AND userid='.$USER->id, 'COUNT(DISTINCT clickreportid)')) { } else if ($hotpot->attempts && $hotpot->attempts <= count_records_select('hotpot_attempts', 'hotpot='.$hotpot->id.' AND userid='.$USER->id, 'COUNT(DISTINCT clickreportid)')) {
$error = get_string("nomoreattempts", "quiz"); $error = get_string("nomoreattempts", "quiz");
// get password // get password
} else if ($hotpot->password && empty($hppassword)) { } else if ($hotpot->password && empty($hppassword)) {
@ -129,19 +129,19 @@
} }
// if HTML is being requested ... // if HTML is being requested ...
if (empty($get_js) && empty($get_css)) { if (empty($get_js) && empty($get_css)) {
if (empty($frameset)) { if (empty($frameset)) {
// HP v6 // HP v6
if ($hotpot->navigation==HOTPOT_NAVIGATION_FRAME || $hotpot->navigation==HOTPOT_NAVIGATION_IFRAME) { if ($hotpot->navigation==HOTPOT_NAVIGATION_FRAME || $hotpot->navigation==HOTPOT_NAVIGATION_IFRAME) {
$get_html = ($framename=='main') ? true : false; $get_html = ($framename=='main') ? true : false;
} else { } else {
$get_html = true; $get_html = true;
} }
} else { } else {
// HP5 v5 // HP5 v5
$get_html = empty($framename) ? true : false; $get_html = empty($framename) ? true : false;
} }
if ($get_html) { if ($get_html) {
if (HOTPOT_FIRST_ATTEMPT) { if (HOTPOT_FIRST_ATTEMPT) {
add_to_log($course->id, "hotpot", "view", "view.php?id=$cm->id", "$hotpot->id", "$cm->id"); add_to_log($course->id, "hotpot", "view", "view.php?id=$cm->id", "$hotpot->id", "$cm->id");
@ -306,7 +306,7 @@
$body = ''; $body = '';
$body_tags = ''; $body_tags = '';
$footer = '</html>'; $footer = '</html>';
// HP6 and some HP5 (v6 and v4) // HP6 and some HP5 (v6 and v4)
if (preg_match('|<body'.'([^>]*'.'onLoad=(["\'])(.*?)(\\2)'.'[^>]*)'.'>(.*)</body>|is', $hp->html, $matches)) { if (preg_match('|<body'.'([^>]*'.'onLoad=(["\'])(.*?)(\\2)'.'[^>]*)'.'>(.*)</body>|is', $hp->html, $matches)) {
$body = $matches[5]; // contents of first <body onload="StartUp()">...</body> block $body = $matches[5]; // contents of first <body onload="StartUp()">...</body> block
if ($pageid) { if ($pageid) {
@ -376,7 +376,7 @@
//update_module_button($cm->id, $course->id, $strmodulename.'" style="font-size:0.8em') //update_module_button($cm->id, $course->id, $strmodulename.'" style="font-size:0.8em')
print_header( print_header(
$title, $heading, $navigation, $title, $heading, $navigation,
"", $head.$styles.$scripts, true, $button, "", $head.$styles.$scripts, true, $button,
$loggedinas, false, $body_tags $loggedinas, false, $body_tags
); );
if (!empty($available_msg)) { if (!empty($available_msg)) {
@ -431,8 +431,8 @@
$body_tags = " onload=\"set_iframe_height('$iframe_id')\""; $body_tags = " onload=\"set_iframe_height('$iframe_id')\"";
$iframe_js = '<script src="iframe.js" type="text/javascript"></script>'."\n"; $iframe_js = '<script src="iframe.js" type="text/javascript"></script>'."\n";
print_header( print_header(
$title, $heading, $navigation, $title, $heading, $navigation,
"", $head.$styles.$scripts.$iframe_js, true, $button, "", $head.$styles.$scripts.$iframe_js, true, $button,
$loggedinas, false, $body_tags $loggedinas, false, $body_tags
); );
if (!empty($available_msg)) { if (!empty($available_msg)) {
@ -454,8 +454,8 @@
// do nothing // do nothing
} else { } else {
$hp->html = preg_replace( $hp->html = preg_replace(
'|<meta[^>]*charset=iso-8859-1[^>]*>|is', '|<meta[^>]*charset=iso-8859-1[^>]*>|is',
'<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'" />', '<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'" />',
$hp->html $hp->html
); );
} }