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.
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
(via Josep M. Fontana, Universitat Pompeu Fabra)
- Rikkyo Univeristy, Japan (via Paul Allum)
@ -33,9 +33,9 @@ IMPORTANT NOTICE
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.
@ -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 .
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"
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 **
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 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 do not work for a public sector educational establishment.
* 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 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:

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'));
}
@ -467,7 +467,7 @@ function hotpot_set_attempt_details(&$attempt) {
}
// 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
);

View file

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

View file

@ -2,7 +2,7 @@
// 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.
function hotpot_upgrade($oldversion) {

View file

@ -2,7 +2,7 @@
// 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.
function hotpot_upgrade($oldversion) {

View file

@ -17,7 +17,7 @@ function hotpot_update_to_v2_2() {
$index = "{$table}_{$field}_idx";
}
hotpot_db_delete_index("{$CFG->prefix}$table", $index);
// add new hotpot_questions.md5key field (and index)
$table = 'hotpot_questions';
$field = 'md5key';
@ -31,7 +31,7 @@ function hotpot_update_to_v2_2() {
$ok = $ok && set_field($table, 'md5key', md5($record->name), 'id', $record->id);
}
}
// remove the index on hotpot_strings.string
$table = 'hotpot_strings';
$field = 'string';
@ -55,7 +55,7 @@ function hotpot_update_to_v2_2() {
$ok = $ok && set_field($table, 'md5key', md5($record->string), 'id', $record->id);
}
}
return $ok;
}
function hotpot_update_to_v2_1_21() {
@ -124,12 +124,12 @@ function hotpot_remove_orphans($secondarytable, $secondarykeyfield, $primarytabl
$db->debug = false;
$records = get_records_sql("
SELECT
SELECT
t2.$secondarykeyfield, t2.$secondarykeyfield
FROM
{$CFG->prefix}$secondarytable t2 LEFT JOIN {$CFG->prefix}$primarytable t1
FROM
{$CFG->prefix}$secondarytable t2 LEFT JOIN {$CFG->prefix}$primarytable t1
ON (t2.$secondarykeyfield = t1.id)
WHERE
WHERE
t1.$primarykeyfield IS NULL
");
@ -270,7 +270,7 @@ function hotpot_update_to_v2_1_2() {
$debug = $db->debug;
$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)
$rs = $db->Execute("
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
$attempts = get_records_sql("
SELECT id, userid, hotpot, score, timestart, timefinish, status
FROM {$CFG->prefix}hotpot_attempts
SELECT id, userid, hotpot, score, timestart, timefinish, status
FROM {$CFG->prefix}hotpot_attempts
WHERE userid = ".$record['userid']." AND hotpot=".$record['hotpot']."
ORDER BY timestart DESC, id DESC
");
@ -298,7 +298,7 @@ function hotpot_update_to_v2_1_2() {
unset($previous_timestart);
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"
if ($attempt->status==1 && isset($previous_timestart)) {
$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', '');
// hotpot_questions: nullify empty and non-numeric (shouldn't be any) values in "text" field
switch (strtolower($CFG->dbfamily)) {
case 'mysql' :
case 'mysql' :
$NOT_REGEXP = 'NOT REGEXP';
break;
case 'postgres' :
@ -358,13 +358,13 @@ function hotpot_update_to_v2_1() {
} else {
$ok = $ok && hotpot_create_table($table);
switch (strtolower($CFG->dbfamily)) {
case 'mysql' :
case 'mysql' :
case 'postgres' :
$sql = "
INSERT INTO {$CFG->prefix}$table (attempt, details)
INSERT INTO {$CFG->prefix}$table (attempt, details)
SELECT a.id AS attempt, a.details AS details
FROM {$CFG->prefix}hotpot_attempts a
WHERE
WHERE
a.details IS NOT NULL AND a.details <> ''
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');
// hotpot_string: correct double-encoded HTML entities
$ok = $ok && execute_sql("
UPDATE {$CFG->prefix}hotpot_strings
SET string = REPLACE(string, '&amp;','&')
WHERE string LIKE '%&amp;#%'
UPDATE {$CFG->prefix}hotpot_strings
SET string = REPLACE(string, '&amp;','&')
WHERE string LIKE '%&amp;#%'
AND (string LIKE '<' OR string LIKE '>')
");
// hotpot_question: remove questions which refer to deleted hotpots
@ -468,7 +468,7 @@ function hotpot_update_to_v2_from_hotpotatoes() {
global $CFG;
$ok = true; // hope for the best!
// check we have the minimum required hotpot module
$minimum = 2005031400;
$minimum = 2005031400;
$module = get_record("modules", "name", "hotpot");
if (empty($module) || $module->version<$minimum) {
if ($module) {
@ -558,7 +558,7 @@ function hotpot_create_table($table) {
}
}
return $ok;
}
}
// Moodle 1.7 (and earlier)
@ -731,9 +731,9 @@ function hotpot_update_logs($oldmodulename, $modulename, $moduleid, &$new) {
break;
case "attempt":
case "submit":
case "review":
case "review":
$id = substr(strrchr($record->url,"="),1);
if (isset($new->attempt[$id])) {
if (isset($new->attempt[$id])) {
$id = $new->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;
$db->debug = $feedback;
switch (strtolower($CFG->dbfamily)) {
case 'mysql' :
case 'mysql' :
$rs = $db->Execute("SHOW INDEX FROM `$table`");
if ($rs && $rs->RecordCount()>0) {
$records = $rs->GetArray();
@ -990,7 +990,7 @@ function hotpot_db_delete_index($table, $index, $feedback=false) {
// check index exists
if (hotpot_db_index_exists($table, $index)) {
switch (strtolower($CFG->dbfamily)) {
case 'mysql' :
case 'mysql' :
$sql = "ALTER TABLE `$table` DROP INDEX `$index`";
break;
case 'postgres' :
@ -1044,7 +1044,7 @@ function hotpot_db_table_exists($table, $feedback=false) {
return hotpot_db_object_exists($table, '', $feedback);
}
function hotpot_db_field_exists($table, $field, $feedback=false) {
return
return
hotpot_db_object_exists($table, '', $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";
// set $sql
switch (strtolower($CFG->dbfamily)) {
case 'mysql' :
case 'mysql' :
if (empty($field)) {
$sql = "SHOW TABLES LIKE '$table'";
} 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'";
} else {
$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')
";
}
@ -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)) {
$oldfield = $field;
}
}
if (is_string($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");
break;
case 'postgres':
// get db version
// N.B. $db->ServerInfo() usually returns blank
// get db version
// N.B. $db->ServerInfo() usually returns blank
// (except lib/adodb/drivers/adodb-postgre64-inc.php)
$dbversion = '';
$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);
} else {
execute_sql("
UPDATE pg_attribute SET attnotnull=".($notnull ? 'TRUE' : 'FALSE')."
UPDATE pg_attribute SET attnotnull=".($notnull ? 'TRUE' : 'FALSE')."
WHERE attname = '$tmpfield'
AND attrelid = (SELECT oid FROM pg_class WHERE relname = '$table')
");

View file

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

View file

@ -1,27 +1,27 @@
<!--
// PLEASE NOTE that this version is more recent than the incorrectly
// numbered v6.1, dated 2003.11.17. From now on, version numbers will
// PLEASE NOTE that this version is more recent than the incorrectly
// numbered v6.1, dated 2003.11.17. From now on, version numbers will
// follow those of Hot Potatoes.
/* hot-potatoes.js (v6.0.4.0 - 2005.02.18)
* =======================================
* by Gordon Bateson, February 2003
* Copyright (c) 2003 Gordon Bateson. All Rights Reserved.
*
* You are hereby granted a royalty free license to use or modify this
* software provided that this copyright notice appears on all copies.
* You are hereby granted a royalty free license to use or modify this
* software provided that this copyright notice appears on all copies.
*
* 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/
*/
// 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
// 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
// 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
// use the defaults below. This is useful if you want to use different
// 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
// use the defaults below. This is useful if you want to use different
// settings for different quizzes.
// ************
// Login Screen
@ -29,7 +29,7 @@
if (window.Login==null) {
Login = new Array();
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";
// 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");
@ -42,21 +42,21 @@ if (window.Login==null) {
// new Array("Webmaster")
// );
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]
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]
// This can also be a string required to start the quiz ...
// Login[3] = "password";
Login[4] = true; // Show prompt for the cookie expiry date
// If false, cookies expire at the end of the current session
Login[5] = "guest,webmaster"
// guest user names (case insensitive) ...
// Login[5] = "guest,webmaster";
// guest user names (case insensitive) ...
// Login[5] = "guest,webmaster";
// These users do NOT need to fill in other login fields
// 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)
}
// *********
@ -65,25 +65,25 @@ if (window.Login==null) {
if (window.DB==null) {
DB = new Array();
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]
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)
// 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"
DB[2] = "hot-potatoes";
DB[2] = "hot-potatoes";
// append_db file name (no extension)
// 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.
// 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").
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[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)
// 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
// 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
@ -94,7 +94,7 @@ if (window.DB==null) {
DB[8] = ''; // email address to which results should be sent
// 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:
// ********
// JBC
@ -162,16 +162,16 @@ if (window.JCloze==null) {
// [0] : (unused)
// [1] : array of JCLOZE_ANSWER_TEXTs
// [2] : clue for this answer
// JCLOZE_ANSWER_TEXT :
// JCLOZE_ANSWER_TEXT :
// [0] : array (seems unnecessary, just the text would be enough?)
// [0] : text of possible answer
// State : array of JCLOZE_ANSWER_STATEs
// JCLOZE_ANSWER_STATE (v5) :
// JCLOZE_ANSWER_STATE (v5) :
// [0] : clue asked for or not
// [1] : number of hints (show next letter) and penalties ('check' an incorrect answer)
// [2] : length of answer matched
// [3] : score for this item
// [4] : already answered correctly
// [4] : already answered correctly
// [5] : answer entered in text box (right or not)
// JCLOZE_ANSWER_STATE (v6)
// this.ClueGiven = false;
@ -196,16 +196,16 @@ if (window.JCross==null) {
JCross[8] = true; // show number of checks
// 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)
// C : clue numbers (CL in v6)
// G : guesses
// 'L', 'C' ('CL') and 'G' are all 2-dimensional arrays (rows x cols)
//
// v5 quizzes additionally use the following single-dimension arrays
// A : clues for across (horizontal) words
// D : clues for down (vertical) words
// N.B. form is only sent when all answers are correct so
// A : clues for across (horizontal) words
// D : clues for down (vertical) words
// N.B. form is only sent when all answers are correct so
// you can't find out what 'wrong' answers were entered
// ********
// JMatch
@ -251,7 +251,7 @@ if (window.JMatch==null) {
// [0] : text
// [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)
// 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
// ********
// JMix
@ -266,8 +266,8 @@ if (window.JMix==null) {
JMix[5] = true; // show number of checks
JMix[6] = true; // show number of hints (=show next word)
}
// JMix quizzes use the global variables
// 'Segments', 'GuessSequence' and 'Penalties'
// JMix quizzes use the global variables
// 'Segments', 'GuessSequence' and 'Penalties'
// Segments : array of JMix_QUESTIONs
// JMix_QUESTION:
// [0] : text
@ -305,7 +305,7 @@ if (window.JQuiz==null) {
// [0] : array (seems unnecessary, just the text would be enough?)
// [0] : text of possible answer
// Status : array of JQUIZ_ANSWER_STATEs
// JQUIZ_ANSWER_STATE :
// JQUIZ_ANSWER_STATE :
// [0] : question done or not
// [1] : number of wrong checks
// [2] : number of hints asked for
@ -324,23 +324,23 @@ if (window.JQuiz==null) {
// [1] : feedback text
// [2] : correct answer flag (1=a correct answer, 0=a wrong answer)
// [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)
// State : array of JQUIZ_QUESTION_STATEs
// JQUIZ_QUESTION_STATE :
// JQUIZ_QUESTION_STATE :
// [0] : score (-1 shows not done yet)
// [1] : array showing on which number try each JQUIZ_ANSWER was selected
// [2] : number of attempts at this question
// [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
// 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)
// [5] : - for multiple choice, short-answer and hybrid questions, this is a
// comma-delimited list showing order in which answers were chosen
// - for multi-select fields, this is bar-delimted ('|') list of settings
// 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
// - for multi-select fields, this is bar-delimted ('|') list of settings
// 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
// settings for the correct answer.
// N.B. JBC, JMatch(v5) and JQuiz(v5) all use global variables 'I' and 'Status'
// JBC : I[0].length==3 && !window.RItems
@ -624,7 +624,7 @@ function checkOK(w, n){
function getValue(w, n, flag) {
var obj = w.document.forms[0].elements[n];
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;
} else {
var v = obj.value;
@ -634,7 +634,7 @@ function getValue(w, n, flag) {
if (n=='Password' || (n=='UserID' && !Login[3])) {
var pwd = getPassword(w);
if (pwd && v!=pwd) msg = MSG[n=='Password' ? 13 : 14];
}
}
if (n=='UserEmail' && window.RegExp) {
var r = '(\\w|-)+';
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 (navigator.appName=='Netscape' && (location.protocol=='file:' || navigator.userAgent.indexOf('Netscape6')>=0)) {
// 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
// to reject the form, so encode the form data as a URL
var url = form.action;
@ -931,11 +931,11 @@ function GetQuestionDetails() {
var hp = hpVersion();
var t = hpQuizType();
var v = hpQuizVersion();
return (t==1) ? GetJbcQuestionDetails(hp, v) :
(t==2) ? GetJClozeQuestionDetails(hp, v) :
(t==3) ? GetJCrossQuestionDetails(hp, v) :
(t==4) ? GetJMatchQuestionDetails(hp, v) :
(t==5) ? GetJMixQuestionDetails(hp, v) :
return (t==1) ? GetJbcQuestionDetails(hp, v) :
(t==2) ? GetJClozeQuestionDetails(hp, v) :
(t==3) ? GetJCrossQuestionDetails(hp, v) :
(t==4) ? GetJMatchQuestionDetails(hp, v) :
(t==5) ? GetJMixQuestionDetails(hp, v) :
(t==6) ? GetJQuizQuestionDetails(hp, v) :
(t==7) ? GetRhubarbDetails(hp, v) :
(t==8) ? GetSequiturDetails(hp, v) : '';
@ -944,7 +944,7 @@ function GetJbcQuestionDetails(hp, v) {
qDetails = '';
// check the quiz version
if (hp==5 || hp==6) {
// get question details
// get question details
for(var q=0; q<I.length; q++) {
// initialize strings to hold answer details
var aDetails = new Array();
@ -953,7 +953,7 @@ function GetJbcQuestionDetails(hp, v) {
aDetails[2] = new Array(); // ignored
// get answer details
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]);
}
// 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 col=0; col<L[row].length; col++) {
// increment letter count, if required
if (L[row][col]) letters++;
if (L[row][col]) letters++;
// show answers and clues, if required
var q = (hp==5) ? C[row][col] : CL[row][col];
if (q) {
for (var i=0; i<2; i++) { // 0==across, 1==down
var AD = (i==0) ? 'A' : 'D';
var acrossdown = (i==0) ? 'across' : 'down';
var clue = (hp==5) ? eval(AD+'['+q+']') : GetJCrossClue('Clue_'+AD+'_'+q);
if (clue) {
// format 'Q' (a padded, two-digit version of 'q')
var Q = getQ('JCross', q) + acrossdown + '_'; // e.g. JCross_01_across_
if (JCross[0]) {
qDetails += makeSeparator(Q);
}
@ -1384,7 +1384,7 @@ function GetJQuizAnswerDetails(q, flag) {
}
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)==',') {
// HP 6.0 and 6.1 (always has trailing comma)
x = x.substring(0, x.length-1).split(',');
@ -1577,7 +1577,7 @@ function hpClickCheck(hp, t, v, args) {
if (window.MakeIndividualDropdowns) {
var is_wrong = (ii!=0);
g = I[i][1][ii][0];
} else {
} else {
var is_wrong = (ii!=i);
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();
var ii = HP[_guesses][i].length;
// 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;
if (r==1) {
// Rottmeier DropDown 2.4
// do nothing
// do nothing
} else {
var G = g.toUpperCase();
var G = g.toUpperCase();
var ii_max = I[i][1].length;
for (var ii=0; ii<ii_max; ii++) {
if (window.CaseSensitive) {
@ -1826,7 +1826,7 @@ function hpClickCheck(hp, t, v, args) {
} else {
if (!HP[_wrong][q]) HP[_wrong][q] = 0;
HP[_wrong][q]++;
}
}
}
}
//return true;
@ -1944,7 +1944,7 @@ function hpHiddenField(name, value, comma, forceHTML) {
var values = value;
var i_max = values.length;
value = '';
if (comma==null) comma = ',';
if (comma==null) comma = ',';
for (var i=0; i<i_max; i++) {
values[i] = trim(values[i]);
if (values[i]!=null && values[i]!='') {
@ -1999,8 +1999,8 @@ function getTime(obj) {
// get year, month and day
// for an LMS : yyyy-mm-dd
// for email : DayName MonthName dd yyyy
var s = is_LMS() ?
obj.getFullYear() + '-' + pad(obj.getMonth()+1, 2) + '-' + pad(obj.getDate(), 2) :
var s = is_LMS() ?
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()
;
// 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
var s = getFuncCode(fn);
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) : '';
// make sure browser has decoded the unicode prompt properly
// this check is mainly for ns4, but there may be others
@ -2109,13 +2109,13 @@ function getPrompt(fn) {
}
function getStartUpCode(fn) {
// 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 '}'
// v6 : the code before and after 'GetUserName();'
// v6 : the code before and after 'GetUserName();'
// i.e. all the code except the call to 'GetUserName();'
var s = getFuncCode(fn);
var i1 = s.indexOf('GetUserName();');
if (i1>=0) { // v6
if (i1>=0) { // v6
var i2 = i1 + 14;
} else { // v5
var i1 = s.indexOf('UserName');
@ -2310,14 +2310,14 @@ function hpInterceptHints() {
var f = 'Hint';
var a = getFuncArgs(f, true);
x = 'hpClick(1,0);'; // question number is always zero
} else if (window.CheckAnswer) {
var f = 'CheckAnswer';
var a = getFuncArgs(f, true);
if (a[0]=='ShowHint') {
if (a[1]=='QNum') {
// JQuiz v3, v5-v6[HP5]
x = 'if(ShowHint)hpClick(1,QNum);';
x = 'if(ShowHint)hpClick(1,QNum);';
} else {
// JQuiz v4
x = 'if(ShowHint)hpClick(1,QNum-1);'; // QNum is a global variable
@ -2397,7 +2397,7 @@ function hpInterceptChecks() {
// JCross none
// JMatch HP5 v3, v5, v6: CheckAnswer(), HP5 v4: CheckResults(), HP6: CheckAnswers()
// JMix CheckAnswer(CheckType)
// JQuiz
// JQuiz
// HP5: CheckAnswer(ShowHint, QNum)
// HP6: CheckMCAnswer, CheckMultiSelAnswer, CheckShortAnswer
// Rhubarb CheckWord(InputWord)
@ -2440,7 +2440,7 @@ function hpInterceptChecks() {
if (a[0]=='ShowHint') {
if (a[1]=='QNum') {
// 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 {
// JQuiz v4
x = 'if(!ShowHint&&State[QNum-1][0]<1)hpClick(3,QNum-1);'; // QNum is a global variable
@ -2452,7 +2452,7 @@ function hpInterceptChecks() {
// Sequitur
x = 'if (!(CurrentNumber==TotalSegments||AllDone||Btn.innerHTML==IncorrectIndicator))hpClick(3,Chosen);';
}
} else if (window.CheckWord) {
} else if (window.CheckWord) {
f = 'CheckWord';
var a = getFuncArgs(f, true);
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");
}
// 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
if (window.attachEvent==null) {
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)
// JCloze uses "Cloze" form
// 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
// JMatch uses "QForm" form, which contains elements called "sel*" (which disappear by the time the quiz is finished)
// JMix uses "ButtonForm"
@ -2542,14 +2542,14 @@ if (navigator.userAgent.indexOf("Netscape6")>=0 && window.ShowMessage) {
// === v6 ===
// JBC uses "QForm" 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"
// HP6: has "Clues" table in "MainDiv"
// JMatch has "MatchDiv" in "MainDiv"
// HP5: uses "QForm" form, which contains elements called "sel*"
// HP6: uses "QForm" form, which contains elements called "s*_**"
// JMix does not use any forms, but has "SegmentDiv" in "MainDiv"
// JQuiz
// JQuiz
// HP5: uses "QForm" form, which contains an element called "Guess"
// HP6: has "Questions" ordered list in "MainDiv"
// === v6+ ===
@ -2833,7 +2833,7 @@ function hpTimedOut() {
}
function hpFinished() {
// assume false result
var x = false;
var x = false;
var hp = hpVersion();
var t = hpQuizType();
var v = hpQuizVersion();
@ -2962,7 +2962,7 @@ function Finish(quizstatus) {
}
}
// create form to send results
if (DB[7] && DB[8] && !is_LMS()) {
if (DB[7] && DB[8] && !is_LMS()) {
ResultForm = ''
+ '<html><body>'
+ '<form name="Results" action="" method="post" enctype="x-www-form-encoded">'

View file

@ -6,7 +6,7 @@
require_once("../../course/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)) {
error("Course ID is incorrect");
}
@ -68,7 +68,7 @@
// do nothing (user is not diplaying this section)
} else {
$hotpots[$hotpot_instance->id] = $hotpot_instance;
}
}
}
}
if (empty($hotpots)) {
@ -197,9 +197,9 @@
if ($concat_field) {
$records = get_records_sql("
SELECT $concat_field, COUNT(*), hotpot, name
FROM {$CFG->prefix}hotpot_questions
FROM {$CFG->prefix}hotpot_questions
WHERE hotpot IN ($hotpotids)
GROUP BY hotpot, name
GROUP BY hotpot, name
HAVING COUNT(*) >1
");
if ($records) {
@ -268,31 +268,31 @@
}
switch ($course->format) {
case 'weeks' :
case 'weeks' :
$title = get_string("week");
break;
case 'topics' :
case 'topics' :
$title = get_string("topic");
break;
default :
default :
$title = '';
break;
}
if ($title) {
array_push($table->head, $title);
array_push($table->head, $title);
array_push($table->align, "center");
}
if (has_capability('moodle/course:manageactivities', $coursecontext)) {
array_push($table->head, $strupdate);
array_push($table->align, "center");
}
array_push($table->head,
get_string("name"),
get_string("quizcloses", "quiz"),
get_string("bestgrade", "quiz"),
array_push($table->head,
get_string("name"),
get_string("quizcloses", "quiz"),
get_string("bestgrade", "quiz"),
get_string("attempts", "quiz")
);
array_push($table->align,
array_push($table->align,
"left", "left", "center", "left"
);
if (has_capability('mod/hotpot:grade', $coursecontext)) {
@ -334,7 +334,7 @@
$bestscore = "&nbsp;";
} else {
$cm = get_coursemodule_from_instance('hotpot', $hotpot->id);
// report number of attempts and users
$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);
if ($event->timeduration > HOTPOT_MAX_EVENT_LENGTH) { /// Long durations create two events
$event->name = addslashes($hotpot->name).' ('.get_string('hotpotopens', 'hotpot').')';
$event->timeduration = 0;
add_event($event);
$event->timestart = $hotpot->timeclose;
$event->eventtype = 'close';
$event->name = addslashes($hotpot->name).' ('.get_string('hotpotcloses', 'hotpot').')';
@ -451,7 +451,7 @@ function hotpot_is_visible(&$cm) {
}
$cm->sectionvisible = $section->visible;
}
if (empty($cm->sectionvisible)) {
$visible = HOTPOT_NO;
} else {
@ -783,7 +783,7 @@ function hotpot_get_all_instances_in_course($modulename, $course) {
if ($rawmods = get_records_sql($query)) {
// cache $isteacher setting
$isteacher = has_capability('mod/hotpot:viewreport', get_context_instance(CONTEXT_COURSE, $course->id));
$explodesection = array();
@ -990,7 +990,7 @@ function hotpot_print_recent_activity($course, $isteacher, $timestart) {
foreach ($records as $id => $record){
if ($cm = get_coursemodule_from_instance('hotpot', $record->id, $course->id)) {
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (has_capability('mod/hotpot:viewreport', $context)) {
$href = "$CFG->wwwroot/mod/hotpot/view.php?hp=$id";
$name = '&nbsp;<a href="'.$href.'">'.$record->name.'</a>';
@ -1274,7 +1274,7 @@ function hotpot_add_attempt($hotpotid) {
$attempt->status = HOTPOT_STATUS_ABANDONED;
update_record('hotpot_attempts', $attempt);
}
}
}
// create and add new attempt record
$attempt = new stdClass();
@ -1778,7 +1778,7 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
$i_max = count($objects[0]);
for ($i=0; $i<$i_max; $i++) {
// extract URL from <PARAM> or <A>
// extract URL from <PARAM> or <A>
$url = '';
if (preg_match($param_url, $objects[3][$i], $matches) || preg_match($link_url, $objects[3][$i], $matches)) {
$url = $matches[3];
@ -2318,13 +2318,13 @@ if (!function_exists('get_coursemodule_from_id')) {
function get_coursemodule_from_id($modulename, $cmid, $courseid=0) {
global $CFG;
return get_record_sql("
SELECT
SELECT
cm.*, m.name, md.name as modname
FROM
FROM
{$CFG->prefix}course_modules cm,
{$CFG->prefix}modules md,
{$CFG->prefix}$modulename m
WHERE
WHERE
".($courseid ? "cm.course = '$courseid' AND " : '')."
cm.id = '$cmid' 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) {
global $CFG;
return get_record_sql("
SELECT
SELECT
cm.*, m.name, md.name as modname
FROM
FROM
{$CFG->prefix}course_modules cm,
{$CFG->prefix}modules md,
{$CFG->prefix}$modulename m
WHERE
WHERE
".($courseid ? "cm.course = '$courseid' AND" : '')."
cm.instance = m.id AND
md.name = '$modulename' AND

View file

@ -1,13 +1,13 @@
<?php // $id$
//////////////////////////////////////////////////////////////
// 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
//
//////////////////////////////////////////////////////////////
/// 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).
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 .= '</embed>';
$replace .= '</object>&nbsp;';
$text = preg_replace($search, $replace, $text);
}
@ -86,7 +86,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
if ($CFG->filter_mediaplugin_enable_flv) {
$search = '/<a(.*?)href=\"([^<]+)\.flv\"([^>]*)>(.*?)<\/a>/is';
$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 .= ' 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 .= '</embed>';
$replace .= '</object>&nbsp;';
$text = preg_replace($search, $replace, $text);
}
@ -161,7 +161,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
$replace .= '<param name="autoplay" value="false" />';
$replace .= '<embed src="\\2.\\3" width="240" height="180" controller="true" autoplay="false"> </embed>';
$replace .= '</object></p>';
$text = preg_replace($search, $replace, $text);
}
@ -174,10 +174,10 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
$replace .= '<param name="autoplay" value="false" />';
$replace .= '<embed src="\\2.avi" width="240" height="180" controller="true" autoplay="false"> </embed>';
$replace .= '</object></p>';
$text = preg_replace($search, $replace, $text);
}
if ($CFG->filter_mediaplugin_enable_ram) {
$search = '/<a(.*?)href=\"([^<]+)\.ram\"([^>]*)>(.*?)<\/a>/is';
@ -202,7 +202,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
$text = preg_replace($search, $replace, $text);
}
if ($CFG->filter_mediaplugin_enable_rpm) {
$search = '/<a(.*?)href=\"([^<]+)\.rpm\"([^>]*)>(.*?)<\/a>/is';
@ -227,7 +227,7 @@ function hotpot_mediaplayer_moodle(&$hotpot, $text) {
$text = preg_replace($search, $replace, $text);
}
if ($CFG->filter_mediaplugin_enable_rm) {
$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 -->
<!-- It is used from /course/mod.php.The whole instance is available as $form. -->
<?php
<?php
require_once("$CFG->dirroot/mod/hotpot/lib.php");
@ -10,11 +10,11 @@ set_form_fields($form);
// commonly used array of <select> options
$yes_no_options = array(
HOTPOT_NO => get_string("no"),
HOTPOT_NO => get_string("no"),
HOTPOT_YES => get_string("yes")
);
$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_FILEPATH => get_string("textsourcefilepath", "hotpot"),
HOTPOT_TEXTSOURCE_SPECIFIC => get_string("textsourcespecific", "hotpot")
@ -71,7 +71,7 @@ $text_source_options = array(
<td align="left"><?php
if ($form->mode=='add') {
choose_from_menu(
$text_source_options, "namesource", "$form->namesource", "",
$text_source_options, "namesource", "$form->namesource", "",
"return hotpot_lockoptions('form', 'namesource', namelockitems, nameoffvalues)"
);
} else {
@ -82,8 +82,8 @@ $text_source_options = array(
</tr>
<tr valign="top">
<td align="right">
<b><?php
print_string("summary")
<b><?php
print_string("summary")
?>:</b><br />
<font size="1"><?php
helpbutton("summary", get_string("summary"), "resource", true, true);
@ -94,13 +94,13 @@ $text_source_options = array(
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
print '<br />';
} else {
helpbutton("text", get_string("helptext"), "moodle", true, true);
helpbutton("text", get_string("helptext"), "moodle", true, true);
print '<br />';
emoticonhelpbutton("form", "description");
}
?></font>
</td>
<td align="left"><?php
<td align="left"><?php
if ($form->mode=='add') {
choose_from_menu($text_source_options, "summarysource", "$form->summarysource", "");
print '<br />';
@ -217,9 +217,9 @@ $text_source_options = array(
?></td>
</tr>
<tr valign="top">
<td align="right"><b><?php
<td align="right"><b><?php
$quizchain = "{$form->mode}quizchain";
print_string($quizchain, "hotpot");
print_string($quizchain, "hotpot");
?>:</b></td>
<td align="left"><?php
choose_from_menu($yes_no_options, "quizchain", $form->quizchain, "");
@ -329,8 +329,8 @@ $text_source_options = array(
helpbutton("clickreporting", get_string("clickreporting","hotpot"), "hotpot");
?></td>
</tr>
<?php
print_standard_coursemodule_settings($form);
<?php
print_standard_coursemodule_settings($form);
?>
<tr valign="top">
<td align="right">&nbsp;</td>
@ -375,7 +375,7 @@ $text_source_options = array(
hotpot_lockoptions('form', 'enabletimeclose', timecloselockitems, timeoffvalues);
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
function setfocus() {
var Frm = document.getElementById('form');

View file

@ -14,7 +14,7 @@
}
if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured");
}
}
if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
error("Course module is incorrect");
}
@ -220,8 +220,8 @@
$fields = 'a.*, u.firstname, u.lastname, u.picture';
if ($mode=='click') {
$fields .= ', u.idnumber';
} else {
// overview, simple and detailed reports
} else {
// overview, simple and detailed reports
// get last attempt record in clickreport series
$ids = array();
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
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
$users = get_records_sql("
SELECT
SELECT
u.id, u.firstname, u.lastname
FROM
FROM
{$CFG->prefix}user u,
{$CFG->prefix}hotpot_attempts ha
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)
$reportpercentscore = str_replace('%', '%%', $reportpercentscore);
}
array_push($table->head,
array_push($table->head,
get_string('reportthisclick', 'hotpot', get_string('reportquestionstried', 'hotpot')),
get_string('reportsofar', 'hotpot', get_string('reportquestionstried', '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("
SELECT userid, MIN(time) AS logouttime
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
");
if (empty($records)) {

View file

@ -1,15 +1,15 @@
<?PHP // $Id$
<?PHP // $Id$
////////////////////////////////////////////////////////////////////
/// Default class for report plugins
///
/// Doesn't do anything on it's own -- it needs to be extended.
/// This class displays quiz reports. Because it is called from
///
/// Doesn't do anything on it's own -- it needs to be extended.
/// This class displays quiz reports. Because it is called from
/// within /mod/quiz/report.php you can assume that the page header
/// and footer are taken care of.
///
/// This file can refer to itself as report.php to pass variables
/// to itself - all these will also be globally available. You must
///
/// This file can refer to itself as report.php to pass variables
/// to itself - all these will also be globally available. You must
/// pass "id=$cm->id" or q=$quiz->id", and "mode=reportname".
////////////////////////////////////////////////////////////////////
@ -17,7 +17,7 @@
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
// it is replaced by the "display" functions in the scripts in the "report" folder
return true;
@ -68,7 +68,7 @@ class hotpot_default_report {
// add $value to answers array, if it was not there
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 ...)
@ -98,12 +98,12 @@ class hotpot_default_report {
foreach($table->legend as $q=>$question) {
$legend->stat[] = array(
get_string('questionshort', 'hotpot', $q+1),
get_string('questionshort', 'hotpot', $q+1),
$question['name']
);
foreach($question['answers'] as $a=>$answer) {
$legend->stat[] = array(
$this->dec_to_ALPHA($a),
$this->dec_to_ALPHA($a),
$answer
);
}
@ -324,7 +324,7 @@ class hotpot_default_report {
function print_report_finish(&$course, &$hotpot, &$options) {
switch ($options['reportformat']) {
case 'txt' :
case 'txt' :
// do nothing
break;
case 'xls':
@ -450,7 +450,7 @@ class hotpot_default_report {
$col = 0; // column index
while ($col<$table->colspan && isset($cells[$i])) {
if (empty($skipcol[$col])) {
$cell = &$cells[$i++];
$cell = &$cells[$i++];
$td = $table->td[$col];
if (is_object($cell)) {
$text = $cell->text;
@ -546,7 +546,7 @@ class hotpot_default_report {
}
function print_text_start(&$course, &$hotpot, &$options) {
$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("Expires: 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_foot($wb, $ws, $table, $row, $options);
}
// close the workbook (and send it to the browser)
$wb->close();
}
@ -679,8 +679,8 @@ class hotpot_default_report {
function print_excel_head(&$wb, &$ws, &$table, &$row, &$options) {
// define format properties
$properties = array(
'bold'=>1,
'align'=>'center',
'bold'=>1,
'align'=>'center',
'v_align'=>'bottom',
'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
$table->head = array(
get_string("name"),
get_string("name"),
hotpot_grade_heading($hotpot, $options),
get_string('attempt', 'quiz'),
get_string('attempt', 'quiz'),
);
$table->align = array('left', 'center', 'center');
$table->size = array(150, 80, 10);
@ -50,8 +50,8 @@ class hotpot_report extends hotpot_default_report {
// question headings
$this->add_question_headings($questions, $table, 'left', 0, false, 2);
// penalties (not always needed) and raw score
array_push($table->head,
get_string('penalties', 'hotpot'),
array_push($table->head,
get_string('penalties', 'hotpot'),
get_string('score', 'quiz')
);
array_push($table->align, 'center', 'center');
@ -82,7 +82,7 @@ class hotpot_report extends hotpot_default_report {
}
$cells = array ($name, $grade, $attemptnumber);
// $name and $grade are only printed on first line per user
$name = $blank;
$name = $blank;
$grade = $blank;
$start_col = count($cells);
foreach ($questionids as $col => $id) {

View file

@ -29,13 +29,13 @@ class hotpot_report extends hotpot_default_report {
$table->size[] = 10;
$table->wrap[] = "nowrap";
}
array_push($table->head,
get_string("name"),
array_push($table->head,
get_string("name"),
hotpot_grade_heading($hotpot, $options),
get_string("attempt", "quiz"),
get_string("time", "quiz"),
get_string("reportstatus", "hotpot"),
get_string("timetaken", "quiz"),
get_string("attempt", "quiz"),
get_string("time", "quiz"),
get_string("reportstatus", "hotpot"),
get_string("timetaken", "quiz"),
get_string("score", "quiz")
);
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
$score = '<span class="highlight">'.$score.'</span>';
}
array_push($data,
array_push($data,
$attemptnumber,
$checkbox.$starttime,
hotpot_format_status($attempt),

View file

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

View file

@ -5,13 +5,13 @@
//-----------------------------------------------------------
//
// hotpot
// (CL, pk->id,
// (CL, pk->id,
// fk->course, files)
// |
// +--------------+---------------+
// | |
// hotpot_attempts hotpot_questions
// (UL, pk->id, (UL, pk->id,
// (UL, pk->id, (UL, pk->id,
// fk->hotpot) fk->hotpot, text)
// | | |
// +-------------------+----------+ |
@ -40,7 +40,7 @@ require_once ("$CFG->dirroot/mod/hotpot/lib.php");
function hotpot_restore_mods($mod, $restore) {
//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")
// $mod is an object
// 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
// $record is the newly added hotpot record
$foreignkeys = array(
'hotpot'=>$record->id,
'hotpot'=>$record->id,
'text'=>'hotpot_strings'
);
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
// 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
$i = 0; // index for $records_TAG
do {
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
// $key : the name of a field in the current $record
// $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
// $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.
// If this field is specified, then the current record will only be added
// 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
static $table_columns = array();
if (empty($table_columns[$table])) {
global $CFG, $db;
global $CFG, $db;
$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>";
}
$ok = false;
$ok = false;
}
}
}
@ -403,7 +403,7 @@ function hotpot_restore_record(&$restore, $status, &$xml, $table, $foreign_keys,
if (isset($record->old_id)) {
backup_putid($restore->backup_unique_code, $table, $record->old_id, $record->id);
}
} else {
} else {
// failed to add (or find) $record
if (!defined('RESTORE_SILENTLY')) {
print "<ul><li>Record could not be added: table=$table</li></ul>";
@ -453,7 +453,7 @@ function hotpot_restore_logs($restore, $log) {
break;
case "attempt":
case "submit":
case "review":
case "review":
if ($log->cmid) {
//Get the new_id of the module (to recode the info field)
$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);
//Get the new_id of the attempt (to recode the url field)
$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->info = $mod->new_id;
$status = true;

View file

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

View file

@ -1,4 +1,4 @@
<?PHP
<?PHP
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) {
$this->parent = &$parent;
$get_js = optional_param('js', false);
$get_css = optional_param('css', false);
if (!empty($get_css)) {
// set $this->css
$this->v6_expand_StyleSheet();
$this->v6_expand_StyleSheet();
} else if (!empty($get_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>');
}
// timer
// timer
function v6_expand_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');
}
// send results
// send results
function v6_expand_SendResults() {
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() {
$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() {
$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);
if (preg_match_all($pattern, $value, $matches)) {
$chars = array_merge($chars, $matches[0]);
}
}
$i++;
}
@ -1260,7 +1260,7 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
$str .= '<p class="QuestionText">'.$question_text.'</p>';
if (
$question_type==HOTPOT_JQUIZ_SHORTANSWER ||
$question_type==HOTPOT_JQUIZ_SHORTANSWER ||
$question_type==HOTPOT_JQUIZ_HYBRID
) {
$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 (
$question_type==HOTPOT_JQUIZ_MULTICHOICE ||
$question_type==HOTPOT_JQUIZ_MULTICHOICE ||
$question_type==HOTPOT_JQUIZ_HYBRID ||
$question_type==HOTPOT_JQUIZ_MULTISELECT
) {
switch ($question_type) {
case HOTPOT_JQUIZ_MULTICHOICE:
case HOTPOT_JQUIZ_MULTICHOICE:
$str .= '<ol class="MCAnswers">'."\n";
break;
case HOTPOT_JQUIZ_HYBRID:
@ -1456,6 +1456,6 @@ function hotpot_keypad_sort_value($char) {
}
return $sort_value;
}
}
?>

View file

@ -5,7 +5,7 @@
[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>
[strPlainTitle]
@ -61,9 +61,9 @@
</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 -->
[inclNavButtons]

View file

@ -6,20 +6,20 @@ function SetScormScore(){
//Reports the current score and any other information back to the LMS
if (API != null){
API.LMSSetValue('cmi.core.score.raw', Score);
//Now send a detailed reports on the item
var ItemLabel = 'Matching';
API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel);
API.LMSSetValue('cmi.interactions.0.id', 'int'+ItemLabel);
API.LMSSetValue('cmi.objectives.0.status', API.LMSGetValue('cmi.core.lesson_status'));
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.score.min', '0');
API.LMSSetValue('cmi.objectives.0.score.max', '100');
API.LMSSetValue('cmi.objectives.0.score.raw', Score);
//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.student_response', AnswersTried);
API.LMSCommit('');
}
}
@ -54,7 +54,7 @@ var AnswersTried = '';
FC = new Array();
DC = new Array();
function onEndDrag(){
function onEndDrag(){
//Is it dropped on any of the fixed cards?
var Docked = false;
var DropTarget = DroppedOnFixed(CurrDrag);
@ -79,7 +79,7 @@ function onEndDrag(){
DC[CurrDrag].tag = 0;
D[CurrDrag][2] = 0;
}
}
}
function DroppedOnFixed(DNum){
var Result = -1;
@ -121,12 +121,12 @@ function StartUp(){
if (C.ie){
DragTop += 15;
}
//Reduce array if required
if (QsToShow < F.length){
ReduceItems2();
}
//Shuffle the left items if required
if (ShuffleQs == true){
F = Shuffle(F);
@ -143,7 +143,7 @@ function StartUp(){
for (var i=0; i<F.length; i++){
CardContent = F[i][0];
FC[i] = new Card('F' + i, 10);
FC[i].elm.innerHTML = CardContent;
FC[i].elm.innerHTML = CardContent;
if (FC[i].GetW() > Widest){
Widest = FC[i].GetW();
}
@ -162,7 +162,7 @@ function StartUp(){
DC[i] = new Card('D' + i, 10);
CardContent = D[i][0];
// 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);}
DC[i].css.cursor = 'move';
DC[i].css.backgroundColor = '[strExBGColor]';
@ -276,7 +276,7 @@ function ReduceItems2(){
}
for (j=ItemToDump; j<(D.length-1); j++){
D[j] = D[j+1];
}
}
F.length = F.length-1;
D.length = D.length-1;
}
@ -303,7 +303,7 @@ function CheckAnswers(){
TotalCorrect++;
}
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.
// DC[i].GoHome();
DC[i].SetL(DC[i].GetL() + 10);

View file

@ -5,7 +5,7 @@
[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>
[strPlainTitle]
@ -61,9 +61,9 @@
</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 -->
[inclNavButtons]

View file

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

View file

@ -5,7 +5,7 @@
[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>
[strPlainTitle]

View file

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

View file

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

View file

@ -5,7 +5,7 @@ function Client(){
this.ua = navigator.userAgent;
this.name = navigator.appName;
this.ver = navigator.appVersion;
this.ver = navigator.appVersion;
//Get data about the browser
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));
if (this.geckoVer < 20020000){this.min = false;}
}
//Look for Firebird
this.firebird = (this.ua.indexOf('Firebird') > 1);
//Look for Safari
this.safari = (this.ua.indexOf('Safari') > 1);
if (this.safari){
this.gecko = false;
}
//Look for IE
this.ie = (this.ua.indexOf('MSIE') > 0);
if (this.ie){
this.ieVer = parseFloat(this.ua.substring(this.ua.indexOf('MSIE')+5, this.ua.length));
if (this.ieVer < 5.5){this.min = false;}
}
//Look for Opera
this.opera = (this.ua.indexOf('Opera') > 0);
if (this.opera){
@ -43,7 +43,7 @@ function Client(){
if (this.min == false){
alert('Your browser may not be able to handle this page.');
}
//Special case for the horrible ie5mac
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 VDim=smB-lgT;
if (VDim<1){return 0;}
return (HDim*VDim);
return (HDim*VDim);
}
Card.prototype.Overlap=CardOverlap;
@ -105,18 +105,18 @@ Card.prototype.GoHome=CardGoHome;
function doDrag(e) {
if (CurrDrag == -1) {return};
if (C.ie){var Ev = window.event}else{var Ev = e}
var difX = Ev.clientX-window.lastX;
var difY = Ev.clientY-window.lastY;
var newX = DC[CurrDrag].GetL()+difX;
var newY = DC[CurrDrag].GetT()+difY;
DC[CurrDrag].SetL(newX);
var difX = Ev.clientX-window.lastX;
var difY = Ev.clientY-window.lastY;
var newX = DC[CurrDrag].GetL()+difX;
var newY = DC[CurrDrag].GetT()+difY;
DC[CurrDrag].SetL(newX);
DC[CurrDrag].SetT(newY);
window.lastX = Ev.clientX;
window.lastY = Ev.clientY;
window.lastX = Ev.clientX;
window.lastY = Ev.clientY;
return false;
}
}
function beginDrag(e, DragNum) {
function beginDrag(e, DragNum) {
CurrDrag = DragNum;
if (C.ie){
var Ev = window.event;
@ -125,27 +125,27 @@ function beginDrag(e, DragNum) {
}
else{
var Ev = e;
window.onmousemove=doDrag;
window.onmousemove=doDrag;
window.onmouseup=endDrag;
}
}
DC[CurrDrag].Highlight();
topZ++;
DC[CurrDrag].css.zIndex = topZ;
window.lastX=Ev.clientX;
window.lastX=Ev.clientX;
window.lastY=Ev.clientY;
return false;
}
return false;
}
function endDrag(e) {
function endDrag(e) {
if (CurrDrag == -1) {return};
DC[CurrDrag].Unhighlight();
if (C.ie){document.onmousemove=null}else{window.onmousemove=null;}
onEndDrag();
onEndDrag();
CurrDrag = -1;
//Need a bugfix for Opera focus problem here
if (C.opera){FocusAButton();}
return true;
}
}
var CurrDrag = -1;
var topZ = 100;

View file

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

View file

@ -12,7 +12,7 @@
<param name="type" value="audio/x-pn-realaudio-plugin" />
<param name="src" value="[strFilePath]" />
<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]
[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"
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>
Page Title
@ -31,7 +31,7 @@ Page Title
</div>
<div id="MainDiv" class="StdDiv">
<p>Page content...</p>
</div>

View file

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

View file

@ -57,13 +57,13 @@ function GetViewportHeight(){
function TopSettingWithScrollOffset(TopPercent){
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()
var InTextBox = false;
function SuppressBackspace(e){
function SuppressBackspace(e){
if (InTextBox == true){return;}
if (C.ie) {
thisKey = window.event.keyCode;
@ -80,7 +80,7 @@ function SuppressBackspace(e){
if (Suppress == true){
if (C.ie){
window.event.returnValue = false;
window.event.returnValue = false;
window.event.cancelBubble = true;
}
else{

View file

@ -5,7 +5,7 @@
[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>
[strPlainTitle]
@ -120,7 +120,7 @@
[/inclHint]
-->
<div id="ClozeDiv">
<form id="Cloze" method="post" action="" onsubmit="return false;">
<div class="ClozeBody">

View file

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

View file

@ -5,7 +5,7 @@
[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>
[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>
-->
<table class="CrosswordGrid">
<tbody>

View file

@ -5,7 +5,7 @@ function SetScormScore(){
//Reports the current score and any other information back to the LMS
if (API != null){
API.LMSSetValue('cmi.core.score.raw', Score);
//Now send a detailed reports on the item
var ItemLabel = 'Crossword';
API.LMSSetValue('cmi.objectives.0.id', 'obj'+ItemLabel);
@ -15,13 +15,13 @@ function SetScormScore(){
}
else{
API.LMSSetValue('cmi.objectives.0.status', 'incomplete');
}
}
API.LMSSetValue('cmi.objectives.0.score.min', '0');
API.LMSSetValue('cmi.objectives.0.score.max', '100');
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
API.LMSSetValue('cmi.interactions.0.type', 'crossword');
API.LMSCommit('');
}
}
@ -35,7 +35,7 @@ var Feedback = '';
var AcrossCaption = '';
var DownCaption = '';
var Correct = '[strCorrect]';
var Incorrect = '[strIncorrect]';
var Incorrect = '[strIncorrect]';
var GiveHint = '[strGiveHint]';
var YourScoreIs = '[strYourScoreIs]';
var BuiltGrid = '';
@ -45,7 +45,7 @@ var Score = 0;
var InTextBox = false;
var Locked = false;
var TimeOver = false;
var CaseSensitive = [boolCaseSensitive];
var CaseSensitive = [boolCaseSensitive];
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>';
@ -65,7 +65,7 @@ function StartUp(){
[inclScorm1.2]
ScormStartUp();
[/inclScorm1.2]
AcrossCaption = document.getElementById('CluesAcrossLabel').innerHTML;
DownCaption = document.getElementById('CluesDownLabel').innerHTML;
[inclSendResults]
@ -88,14 +88,14 @@ function GetAnswerLength(Across,x,y){
while ((x<L.length)&&(L[x][y].length > 0)){
Result += L[x][y].length;
x++;
}
}
return Result;
}
else{
while ((y<L[x].length)&&(L[x][y].length > 0)){
Result += L[x][y].length;
y++;
}
}
return Result;
}
}
@ -165,7 +165,7 @@ function SplitStringToPerceivedChars(InString, PC){
function EnterAnswer(Guess,Across,AnsLength,x,y){
var PC = new Array();
SplitStringToPerceivedChars(Guess, PC);
var i=x;
var j=y;
var Letter = 0;
@ -269,9 +269,9 @@ function CheckAnswers(){
var AllCorrect = true;
var TotLetters = 0;
var CorrectLetters = 0;
var LetterFromKey = '';
var LetterFromKey = '';
var LetterFromGuess = '';
//Check each letter
for (var i=0; i<L.length; i++){
for (var j=0; j<L[i].length; j++){
@ -285,7 +285,7 @@ function CheckAnswers(){
LetterFromKey = L[i][j].toUpperCase();
LetterFromGuess = G[i][j].toUpperCase();
}
if (LetterFromGuess != LetterFromKey){
if (LetterFromGuess != LetterFromKey){
G[i][j] = '';
//Blank that square in the grid
SetGridSquareValue(i,j,'');
@ -316,7 +316,7 @@ function CheckAnswers(){
ShowMessage(Output);
WriteToInstructions(Output);
if ((AllCorrect == true)||(TimeOver == true)){
[inclSendResults]
setTimeout('SendResults(' + Score + ')', 50);

View file

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

View file

@ -5,7 +5,7 @@
[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>
[strPlainTitle]

View file

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

View file

@ -5,7 +5,7 @@
[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>
[strPlainTitle]

View file

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

View file

@ -5,7 +5,7 @@
[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>
[strPlainTitle]
@ -109,7 +109,7 @@
<div id="MainDiv" class="StdDiv">
<div id="QNav" class="QuestionNavigation">
<p style="text-align: right;">
@ -126,7 +126,7 @@
</div>
</div>
[strQuestionOutput]
[inclKeypad]

View file

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

View file

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml"
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>
[strPlainIndexTitle]
@ -21,7 +21,7 @@ body{
font-family: [strFontFace];
[inclPageBGColor] background-color: [strPageBGColor];[/inclPageBGColor]
color: [strTextColor];
[inclGraphicURL] background-image: url([strGraphicURL]);[/inclGraphicURL]
[inclGraphicURL] background-image: url([strGraphicURL]);[/inclGraphicURL]
padding-left: 5%;
padding-right: 5%;
font-size: [strFontSize];

View file

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