From: piers Date: Tue, 11 Nov 2008 04:45:39 +0000 (+0000) Subject: MDL-16810 - Allow site configuration of scorm settings. Fixing grammar of texts,... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1adc77e6d281803aab0e3cff5c731b717e525bca;p=moodle.git MDL-16810 - Allow site configuration of scorm settings. Fixing grammar of texts, and default options values. Clean up $CFG values nolonger required. --- diff --git a/lang/en_utf8/scorm.php b/lang/en_utf8/scorm.php index f6ec138c68..748b88aa11 100644 --- a/lang/en_utf8/scorm.php +++ b/lang/en_utf8/scorm.php @@ -20,7 +20,7 @@ $string['attempts'] = 'Attempts'; $string['attemptsx'] = '$a attempts'; $string['attr_error'] = 'Bad value for attribute ($a->attr) in tag $a->tag.'; $string['autocontinue'] = 'Auto-Continue'; -$string['autocontinuedesc'] = 'This preferences sets the default auto continue for the activity'; +$string['autocontinuedesc'] = 'This preference sets the default auto continue for the activity'; $string['averageattempt'] = 'Average attempts'; $string['badmanifest'] = 'Some manifest errors: see errors log'; $string['badpackage'] = 'The specified package/manifest is not valid. Check it and try again.'; @@ -71,19 +71,19 @@ $string['forcecompleteddesc'] = 'This preference sets the default value for the $string['gradeaverage'] = 'Average grade'; $string['gradehighest'] = 'Highest grade'; $string['grademethod'] = 'Grading method'; -$string['grademethoddesc'] = 'This preferences sets the default grade method for an activity'; +$string['grademethoddesc'] = 'This preference sets the default grade method for an activity'; $string['gradescoes'] = 'Learning Objects'; $string['gradesum'] = 'Sum grade'; $string['height'] = 'Height'; $string['hidden'] = 'Hidden'; $string['hidebrowse'] = 'Disable preview mode'; -$string['hidebrowsedesc'] = 'This preferences sets the default or whether to disable or enable the preview mode'; +$string['hidebrowsedesc'] = 'This preference sets the default for whether to disable or enable the preview mode'; $string['hideexit'] = 'Hide exit link'; $string['hidenav'] = 'Hide navigation buttons'; -$string['hidenavdesc'] = 'This preferences sets the default or whether to show or hide the navigation buttons'; +$string['hidenavdesc'] = 'This preference sets the default for whether to show or hide the navigation buttons'; $string['hidereview'] = 'Hide review button'; $string['hidetoc'] = 'Course structure display (TOC)'; -$string['hidetocdesc'] = 'This preferences sets the default for whether to show or hide the course structure display (TOC)'; +$string['hidetocdesc'] = 'This preference sets the default for whether to show or hide the course structure display (TOC)'; $string['highestattempt'] = 'Highest attempt'; $string['identifier'] = 'Question Identifier'; $string['iframe'] = 'Current window'; @@ -99,8 +99,8 @@ $string['lastattemptlockdesc'] = 'This preference sets the default value for the $string['location'] = 'Show the location bar'; $string['max'] = 'Max score'; $string['maximumattempts'] = 'Number of attempts'; -$string['maximumattemptsdesc'] = 'This preferences sets the default number of maximum attempts for an activity'; -$string['maximumgradedesc'] = 'This preferences sets the default maximum grade for an activity'; +$string['maximumattemptsdesc'] = 'This preference sets the default maximum attempts for an activity'; +$string['maximumgradedesc'] = 'This preference sets the default maximum grade for an activity'; $string['menubar'] = 'Show the menu bar'; $string['min'] = 'Min score'; $string['missing_attribute'] = 'Missing attribute $a->attr in tag $a->tag'; @@ -157,7 +157,7 @@ $string['scormtype'] = 'Type'; $string['scrollbars'] = 'Allow the window to be scrolled'; $string['sided'] = 'On the left side'; $string['skipview'] = 'Student skip content structure page'; -$string['skipviewdesc'] = 'This preferences sets the default of when to skip content structure for a page'; +$string['skipviewdesc'] = 'This preference sets the default for when to skip content structure for a page'; $string['slashargs'] = 'WARNING: slash arguments is disabled on this site and objects may not function as expected!'; $string['stagesize'] = 'Stage size'; $string['started'] = 'Started on'; @@ -189,12 +189,12 @@ $string['versionwarning'] = 'The manifest version is older than 1.3, warning at $string['viewallreports'] = 'View reports for $a attempts'; $string['viewalluserreports'] = 'View reports for $a users'; $string['whatgrade'] = 'Attempts grading'; -$string['whatgradedesc'] = 'This preferences sets the default attempts grading'; +$string['whatgradedesc'] = 'This preference sets the default attempts grading'; $string['width'] = 'Width'; $string['window'] = 'Window'; $string['unziperror'] = 'An error occurs during package unzip'; $string['othersettings'] = 'Additional settings'; -$string['updatefreqdesc'] = 'This preferences sets the default auto-update frequency of an activity'; +$string['updatefreqdesc'] = 'This preference sets the default auto-update frequency of an activity'; $string['updatefreq'] = 'Auto-update frequency'; $string['options'] = 'Options'; $string['activityloading'] = "You will be automatically redirected to the activity in"; // used in conjunction with numseconds diff --git a/mod/scorm/db/upgrade.php b/mod/scorm/db/upgrade.php index 85161c9f50..57a6a55777 100644 --- a/mod/scorm/db/upgrade.php +++ b/mod/scorm/db/upgrade.php @@ -282,22 +282,50 @@ function xmldb_scorm_upgrade($oldversion) { unset_config($rcfg); } } - - $cfg_scorm = get_config('scorm'); - $new_config = array('resizable', - 'scrollbars', - 'directories', - 'location', - 'menubar', - 'toolbar', - 'status'); - foreach ($new_config as $ncfg) { - if (!isset($cfg_scorm->$ncfg)) { - set_config($ncfg, 1, 'scorm'); + /// scorm savepoint reached + upgrade_mod_savepoint($result, 2008090306, 'scorm'); + } + + + + // remove redundant config values + if ($result && $oldversion < 2008090307) { + $redundant_config = array( + 'scorm_allowapidebug', + 'scorm_allowtypeexternal', + 'scorm_allowtypeimsrepository', + 'scorm_allowtypelocalsync', + 'scorm_apidebugmask', + 'scorm_frameheight', + 'scorm_framewidth', + 'scorm_maxattempts', + 'scorm_updatetime', + 'scorm_resizable', + 'scorm_scrollbars', + 'scorm_directories', + 'scorm_location', + 'scorm_menubar', + 'scorm_toolbar', + 'scorm_status', + 'scorm_grademethod', + 'scorm_maxgrade', + 'scorm_whatgrade', + 'scorm_popup', + 'scorm_skipview', + 'scorm_hidebrowse', + 'scorm_hidetoc', + 'scorm_hidenav', + 'scorm_auto', + 'scorm_updatefreq' + ); + foreach ($redundant_config as $rcfg) { + if (isset($CFG->$rcfg)) { + unset_config($rcfg); } } + /// scorm savepoint reached - upgrade_mod_savepoint($result, 2008090306, 'scorm'); + upgrade_mod_savepoint($result, 2008090307, 'scorm'); } diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index 2ca0b9855d..00a7dbbc5f 100755 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -579,18 +579,12 @@ function scorm_get_post_actions() { } function scorm_option2text($scorm) { - $SCORM_POPUP_OPTIONS = array('resizable'=>1, - 'scrollbars'=>1, - 'directories'=>0, - 'location'=>0, - 'menubar'=>0, - 'toolbar'=>0, - 'status'=>0); - + $scorm_popoup_options = scorm_get_popup_options_array(); + if (isset($scorm->popup)) { if ($scorm->popup == 1) { $optionlist = array(); - foreach ($SCORM_POPUP_OPTIONS as $name => $option) { + foreach ($scorm_popoup_options as $name => $option) { if (isset($scorm->$name)) { $optionlist[] = $name.'='.$scorm->$name; } else { diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 1aec6c99a3..56e3ff9fdd 100755 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -33,13 +33,13 @@ function scorm_get_popup_options_array(){ global $CFG; $cfg_scorm = get_config('scorm'); - return array('resizable'=> $cfg_scorm->resizable, - 'scrollbars'=> $cfg_scorm->scrollbars, - 'directories'=> $cfg_scorm->directories, - 'location'=> $cfg_scorm->location, - 'menubar'=> $cfg_scorm->menubar, - 'toolbar'=> $cfg_scorm->toolbar, - 'status'=> $cfg_scorm->status); + return array('resizable'=> isset($cfg_scorm->resizable) ? $cfg_scorm->resizable : 0, + 'scrollbars'=> isset($cfg_scorm->scrollbars) ? $cfg_scorm->scrollbars : 0, + 'directories'=> isset($cfg_scorm->directories) ? $cfg_scorm->directories : 0, + 'location'=> isset($cfg_scorm->location) ? $cfg_scorm->location : 0, + 'menubar'=> isset($cfg_scorm->menubar) ? $cfg_scorm->menubar : 0, + 'toolbar'=> isset($cfg_scorm->toolbar) ? $cfg_scorm->toolbar : 0, + 'status'=> isset($cfg_scorm->status) ? $cfg_scorm->status : 0); } /** diff --git a/mod/scorm/mod_form.php b/mod/scorm/mod_form.php index 695b793baa..f68e2590a1 100644 --- a/mod/scorm/mod_form.php +++ b/mod/scorm/mod_form.php @@ -233,11 +233,13 @@ class mod_scorm_mod_form extends moodleform_mod { global $COURSE; if (isset($default_values['popup']) && ($default_values['popup'] == 1) && isset($default_values['options'])) { - $options = explode(',',$default_values['options']); - foreach ($options as $option) { - list($element,$value) = explode('=',$option); - $element = trim($element); - $default_values[$element] = trim($value); + if (!empty($default_values['options'])) { + $options = explode(',',$default_values['options']); + foreach ($options as $option) { + list($element,$value) = explode('=',$option); + $element = trim($element); + $default_values[$element] = trim($value); + } } } if (isset($default_values['grademethod'])) { diff --git a/mod/scorm/version.php b/mod/scorm/version.php index a48211c766..8ac61d8a4c 100755 --- a/mod/scorm/version.php +++ b/mod/scorm/version.php @@ -10,7 +10,7 @@ // catch up now, so until 27th October please only increment in very tiny steps // in HEAD, until we get past that date.. -$module->version = 2008090306; // The (date) version of this module +$module->version = 2008090307; // The (date) version of this module $module->requires = 2008090108; // The version of Moodle that is required $module->cron = 300; // How often should cron check this module (seconds)?