diff -Nrup moodle_org/mod/scorm/datamodels/scorm_12.js.php moodle/mod/scorm/datamodels/scorm_12.js.php --- moodle_org/mod/scorm/datamodels/scorm_12.js.php 2012-12-29 18:06:09.000000000 -0600 +++ moodle/mod/scorm/datamodels/scorm_12.js.php 2013-01-07 11:34:21.000000000 -0600 @@ -373,6 +373,9 @@ function SCORMapi1_2() { } //Store data if (errorCode == "0") { + if ( ( == 1) && (typeof SCORMapi1_2.timeout == 'undefined') ) { + SCORMapi1_2.timeout = window.setTimeout(API.LMSCommit,60000, ""); + } if ((typeof eval('datamodel["'+elementmodel+'"].range')) != "undefined") { range = eval('datamodel["'+elementmodel+'"].range'); ranges = range.split('#'); @@ -428,6 +431,10 @@ function SCORMapi1_2() { } function LMSCommit (param) { + if (SCORMapi1_2.timeout) { + window.clearTimeout(SCORMapi1_2.timeout); + delete SCORMapi1_2.timeout; + } errorCode = "0"; if (param == "") { if (Initialized) { diff -Nrup moodle_org/mod/scorm/datamodels/scorm_13.js.php moodle/mod/scorm/datamodels/scorm_13.js.php --- moodle_org/mod/scorm/datamodels/scorm_13.js.php 2012-12-29 18:06:09.000000000 -0600 +++ moodle/mod/scorm/datamodels/scorm_13.js.php 2013-01-07 11:34:21.000000000 -0600 @@ -769,6 +769,9 @@ function SCORMapi1_3() { //Store data if (errorCode == "0") { + if ( ( == 1) && (typeof SCORMapi1_3.timeout == 'undefined') ) { + SCORMapi1_3.timeout = window.setTimeout(API_1484_11.Commit,60000, ""); + } if ((typeof eval('datamodel["'+elementmodel+'"].range')) != "undefined") { range = eval('datamodel["'+elementmodel+'"].range'); ranges = range.split('#'); @@ -943,6 +946,10 @@ function SCORMapi1_3() { function Commit (param) { errorCode = "0"; + if (SCORMapi1_3.timeout) { + window.clearTimeout(SCORMapi1_3.timeout); + delete SCORMapi1_3.timeout; + } if (param == "") { if ((Initialized) && (!Terminated)) { var AJAXResult = StoreData(cmi,false); diff -Nrup moodle_org/mod/scorm/lang/en/scorm.php moodle/mod/scorm/lang/en/scorm.php --- moodle_org/mod/scorm/lang/en/scorm.php 2012-12-29 18:06:09.000000000 -0600 +++ moodle/mod/scorm/lang/en/scorm.php 2013-01-07 11:34:21.000000000 -0600 @@ -53,6 +53,9 @@ $string['attemptstatusentry'] = 'Entry p $string['attemptsx'] = '{$a} attempts'; $string['attempt1'] = '1 attempt'; $string['attr_error'] = 'Bad value for attribute ({$a->attr}) in tag {$a->tag}.'; +$string['autocommit'] = 'Auto-commit'; +$string['autocommit_help'] = 'If enabled, SCORM data is automaticaly saved to the database. Useful for SCORM objects which do not Commit() their data regularly.'; +$string['autocommitdesc'] = 'Automatically commit SCORM data if SCO does not call Commit()'; $string['autocontinue'] = 'Auto-continue'; $string['autocontinue_help'] = 'If enabled, subsequent learning objects are launched automatically, otherwise the Continue button must be used.'; $string['autocontinuedesc'] = 'This preference sets the default auto continue for the activity'; diff -Nrup moodle_org/mod/scorm/mod_form.php moodle/mod/scorm/mod_form.php --- moodle_org/mod/scorm/mod_form.php 2012-12-29 18:06:09.000000000 -0600 +++ moodle/mod/scorm/mod_form.php 2013-01-07 11:34:21.000000000 -0600 @@ -244,6 +244,11 @@ class mod_scorm_mod_form extends moodlef $mform->setDefault('auto', $cfg_scorm->auto); $mform->setAdvanced('auto', $cfg_scorm->auto_adv); + $mform->addElement('selectyesno', 'autocommit', get_string('autocommit', 'scorm')); + $mform->addHelpButton('autocommit', 'autocommit', 'scorm'); + $mform->setDefault('autocommit', $cfg_scorm->autocommit); + $mform->setAdvanced('autocommit', $cfg_scorm->autocommit_adv); + if (count($scormtypes) > 1) { // Update packages timing $mform->addElement('select', 'updatefreq', get_string('updatefreq', 'scorm'), scorm_get_updatefreq_array()); diff -Nrup moodle_org/mod/scorm/settings.php moodle/mod/scorm/settings.php --- moodle_org/mod/scorm/settings.php 2012-12-29 18:06:09.000000000 -0600 +++ moodle/mod/scorm/settings.php 2013-01-07 11:34:21.000000000 -0600 @@ -114,6 +114,10 @@ if ($ADMIN->fulltree) { get_string('updatefreq', 'scorm'), get_string('updatefreqdesc', 'scorm'), array('value' => 0, 'adv' => true), scorm_get_updatefreq_array())); + $settings->add(new admin_setting_configselect_with_advanced('scorm/autocommit', + get_string('autocommit', 'scorm'), get_string('autocommitdesc', 'scorm'), + array('value' => 0, 'adv' => true), $yesno)); + //admin level settings. $settings->add(new admin_setting_heading('scorm/adminsettings', get_string('adminsettings', 'scorm'), ''));