]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16810 - Allow site configuration of scorm settings. Fixing grammar of texts,...
authorpiers <piers>
Tue, 11 Nov 2008 04:45:39 +0000 (04:45 +0000)
committerpiers <piers>
Tue, 11 Nov 2008 04:45:39 +0000 (04:45 +0000)
lang/en_utf8/scorm.php
mod/scorm/db/upgrade.php
mod/scorm/lib.php
mod/scorm/locallib.php
mod/scorm/mod_form.php
mod/scorm/version.php

index f6ec138c6887600fcda64fd85d79967ed45c3ea7..748b88aa11add980062ab67e2023a0bc6e097a6a 100644 (file)
@@ -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
index 85161c9f50a19a08240ae960ade76e458e307ad2..57a6a55777f100cb2bed35f02bf342dbf3049638 100644 (file)
@@ -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');
     }
     
     
index 2ca0b9855d86589110a8f648fec6bac5c1731995..00a7dbbc5f93ad42fd1ff6dd1ac962e27a3cc904 100755 (executable)
@@ -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 {
index 1aec6c99a3152c01973d5031994c57a2ccaec88d..56e3ff9fdd5321266c849fbcd753c15ca36e45b9 100755 (executable)
@@ -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); 
 }
 
 /**
index 695b793baa101b4945c87fca2784181352bf5394..f68e2590a17b4caa16a78a8e5d203de7f8dd16d0 100644 (file)
@@ -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'])) {
index a48211c7667ea55d6949dfa96af06b94e68781d6..8ac61d8a4c042e2fb462dec4964c92395d7646ce 100755 (executable)
@@ -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)?