From 93c984a8298b062e3410829b2003739aad3eb692 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Tue, 14 May 2013 10:37:18 +1200 Subject: [PATCH] MDL-39239 SCORM: drop old imsrepository code - it doesn't work anyway. --- mod/scorm/db/upgrade.php | 15 +++++++++++++++ mod/scorm/lang/en/scorm.php | 3 --- mod/scorm/lib.php | 10 ---------- mod/scorm/loadSCO.php | 3 --- mod/scorm/locallib.php | 9 --------- mod/scorm/mod_form.php | 11 ----------- mod/scorm/settings.php | 2 -- mod/scorm/version.php | 2 +- 8 files changed, 16 insertions(+), 39 deletions(-) diff --git a/mod/scorm/db/upgrade.php b/mod/scorm/db/upgrade.php index 3dee001f6fb..13646edb426 100644 --- a/mod/scorm/db/upgrade.php +++ b/mod/scorm/db/upgrade.php @@ -79,6 +79,21 @@ function xmldb_scorm_upgrade($oldversion) { // Moodle v2.4.0 release upgrade line // Put any upgrade step following this + // Remove old imsrepository type - convert any existing records to external type to help prevent major errors. + if ($oldversion < 2013050101) { + $scorms = $DB->get_recordset('scorm', array('scormtype' => 'imsrepository')); + foreach($scorms as $scorm) { + $scorm->scormtype = SCORM_TYPE_EXTERNAL; + if (!empty($CFG->repository)) { // Fix path to imsmanifest if $CFG->repository is set. + $scorm->reference = $CFG->repository.substr($scorm->reference, 1).'/imsmanifest.xml'; + $scorm->sha1hash = sha1($scorm->reference); + } + $scorm->revision++; + $DB->update_record('scorm', $scorm); + } + upgrade_mod_savepoint(true, 2013050101, 'scorm'); + } + // Moodle v2.5.0 release upgrade line. // Put any upgrade step following this. diff --git a/mod/scorm/lang/en/scorm.php b/mod/scorm/lang/en/scorm.php index 0511e5748a3..dafdd2649df 100644 --- a/mod/scorm/lang/en/scorm.php +++ b/mod/scorm/lang/en/scorm.php @@ -37,7 +37,6 @@ $string['allowapidebug'] = 'Activate API debug and tracing (set the capture mask $string['allowtypeexternal'] = 'Enable external package type'; $string['allowtypeexternalaicc'] = 'Enable direct AICC URL'; $string['allowtypeexternalaicc_desc'] = 'If enabled this allows a direct url to a simple AICC package'; -$string['allowtypeimsrepository'] = 'Enable IMS package type'; $string['allowtypelocalsync'] = 'Enable downloaded package type'; $string['allowtypeaicchacp'] = 'Enable external AICC HACP'; $string['allowtypeaicchacp_desc'] = 'If enabled this allows AICC HACP external communication without requiring user login for post requests from the external AICC package'; @@ -293,7 +292,6 @@ $string['scormtype_help'] = 'This setting determines how the package is included * Uploaded package - Enables a SCORM package to be chosen via the file picker * External SCORM manifest - Enables an imsmanifest.xml URL to be specified. Note: If the URL has a different domain name than your site, then "Downloaded package" is a better option, since otherwise grades are not saved. * Downloaded package - Enables a package URL to be specified. The package will be unzipped and saved locally, and updated when the external SCORM package is updated. -* Local IMS content repository - Enables a package to be selected from within an IMS repository * External AICC URL - this URL is the launch URL for a single AICC Activity. A psuedo package will be constructed around this.'; $string['scorm:viewreport'] = 'View reports'; $string['scorm:viewscores'] = 'View scores'; @@ -327,7 +325,6 @@ $string['trackingloose'] = 'WARNING: The tracking data of this package will be l $string['type'] = 'Type'; $string['typeaiccurl'] = 'External AICC URL'; $string['typeexternal'] = 'External SCORM manifest'; -$string['typeimsrepository'] = 'Local IMS content repository'; $string['typelocal'] = 'Uploaded package'; $string['typelocalsync'] = 'Downloaded package'; $string['unziperror'] = 'An error occurs during package unzip'; diff --git a/mod/scorm/lib.php b/mod/scorm/lib.php index 4449ec7958b..06ffdcac89c 100644 --- a/mod/scorm/lib.php +++ b/mod/scorm/lib.php @@ -26,8 +26,6 @@ define('SCORM_TYPE_LOCAL', 'local'); define('SCORM_TYPE_LOCALSYNC', 'localsync'); /** SCORM_TYPE_EXTERNAL = external */ define('SCORM_TYPE_EXTERNAL', 'external'); -/** SCORM_TYPE_IMSREPOSITORY = imsrepository */ -define('SCORM_TYPE_IMSREPOSITORY', 'imsrepository'); /** SCORM_TYPE_AICCURL = external AICC url */ define('SCORM_TYPE_AICCURL', 'aiccurl'); @@ -84,7 +82,6 @@ function scorm_status_options($with_strings = false) { * @uses SCORM_TYPE_LOCAL * @uses SCORM_TYPE_LOCALSYNC * @uses SCORM_TYPE_EXTERNAL - * @uses SCORM_TYPE_IMSREPOSITORY * @param object $scorm Form data * @param object $mform * @return int new instance id @@ -138,8 +135,6 @@ function scorm_add_instance($scorm, $mform=null) { $record->reference = $scorm->packageurl; } else if ($record->scormtype === SCORM_TYPE_EXTERNAL) { $record->reference = $scorm->packageurl; - } else if ($record->scormtype === SCORM_TYPE_IMSREPOSITORY) { - $record->reference = $scorm->packageurl; } else if ($record->scormtype === SCORM_TYPE_AICCURL) { $record->reference = $scorm->packageurl; } else { @@ -172,7 +167,6 @@ function scorm_add_instance($scorm, $mform=null) { * @uses SCORM_TYPE_LOCAL * @uses SCORM_TYPE_LOCALSYNC * @uses SCORM_TYPE_EXTERNAL - * @uses SCORM_TYPE_IMSREPOSITORY * @param object $scorm Form data * @param object $mform * @return bool @@ -210,12 +204,8 @@ function scorm_update_instance($scorm, $mform=null) { } else if ($scorm->scormtype === SCORM_TYPE_LOCALSYNC) { $scorm->reference = $scorm->packageurl; - } else if ($scorm->scormtype === SCORM_TYPE_EXTERNAL) { $scorm->reference = $scorm->packageurl; - - } else if ($scorm->scormtype === SCORM_TYPE_IMSREPOSITORY) { - $scorm->reference = $scorm->packageurl; } else if ($scorm->scormtype === SCORM_TYPE_AICCURL) { $scorm->reference = $scorm->packageurl; } else { diff --git a/mod/scorm/loadSCO.php b/mod/scorm/loadSCO.php index a1924b9698e..65611e6a12c 100644 --- a/mod/scorm/loadSCO.php +++ b/mod/scorm/loadSCO.php @@ -150,9 +150,6 @@ if (scorm_external_link($sco->launch)) { } else if ($scorm->scormtype === SCORM_TYPE_EXTERNAL) { // Remote learning activity $result = dirname($scorm->reference).'/'.$launcher; -} else if ($scorm->scormtype === SCORM_TYPE_IMSREPOSITORY) { - // Repository - $result = $CFG->repositorywebroot.substr($scorm->reference, 1).'/'.$sco->launch; } else if ($scorm->scormtype === SCORM_TYPE_LOCAL or $scorm->scormtype === SCORM_TYPE_LOCALSYNC) { //note: do not convert this to use get_file_url() or moodle_url() //SCORM does not work without slasharguments and moodle_url() encodes querystring vars diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 1e41d5db73f..7e6cea5a770 100644 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -270,15 +270,6 @@ function scorm_parse($scorm, $full) { } $newhash = sha1($scorm->reference); - } else if ($scorm->scormtype === SCORM_TYPE_IMSREPOSITORY and !empty($CFG->repositoryactivate) and $cfg_scorm->allowtypeimsrepository) { - if (!$full and $scorm->sha1hash === sha1($scorm->reference)) { - return; - } - require_once("$CFG->dirroot/mod/scorm/datamodels/scormlib.php"); - if (!scorm_parse_scorm($scorm, $CFG->repository.substr($scorm->reference, 1).'/imsmanifest.xml')) { - $scorm->version = 'ERROR'; - } - $newhash = sha1($scorm->reference); } else if ($scorm->scormtype === SCORM_TYPE_AICCURL and $cfg_scorm->allowtypeexternalaicc) { require_once("$CFG->dirroot/mod/scorm/datamodels/aicclib.php"); // AICC diff --git a/mod/scorm/mod_form.php b/mod/scorm/mod_form.php index 2dc435f7cdf..4460deb1261 100644 --- a/mod/scorm/mod_form.php +++ b/mod/scorm/mod_form.php @@ -63,10 +63,6 @@ class mod_scorm_mod_form extends moodleform_mod { $scormtypes[SCORM_TYPE_LOCALSYNC] = get_string('typelocalsync', 'scorm'); } - if (!empty($CFG->repositoryactivate) and $cfg_scorm->allowtypeimsrepository) { - $scormtypes[SCORM_TYPE_IMSREPOSITORY] = get_string('typeimsrepository', 'scorm'); - } - if ($cfg_scorm->allowtypeexternalaicc) { $scormtypes[SCORM_TYPE_AICCURL] = get_string('typeaiccurl', 'scorm'); } @@ -400,12 +396,6 @@ class mod_scorm_mod_form extends moodleform_mod { } } - } else if ($type === SCORM_TYPE_IMSREPOSITORY) { - $reference = $data['packageurl']; - if (stripos($reference, '#') !== 0) { - $errors['packageurl'] = get_string('invalidurl', 'scorm'); - } - } else if ($type === SCORM_TYPE_AICCURL) { $reference = $data['packageurl']; // Syntax check. @@ -432,7 +422,6 @@ class mod_scorm_mod_form extends moodleform_mod { switch ($default_values['scormtype']) { case SCORM_TYPE_LOCALSYNC : case SCORM_TYPE_EXTERNAL: - case SCORM_TYPE_IMSREPOSITORY: case SCORM_TYPE_AICCURL: $default_values['packageurl'] = $default_values['reference']; } diff --git a/mod/scorm/settings.php b/mod/scorm/settings.php index 0df818228d4..aacb8e213df 100644 --- a/mod/scorm/settings.php +++ b/mod/scorm/settings.php @@ -112,8 +112,6 @@ if ($ADMIN->fulltree) { $settings->add(new admin_setting_configcheckbox('scorm/allowtypelocalsync', get_string('allowtypelocalsync', 'scorm'), '', 0)); - $settings->add(new admin_setting_configcheckbox('scorm/allowtypeimsrepository', get_string('allowtypeimsrepository', 'scorm'), '', 0)); - $settings->add(new admin_setting_configcheckbox('scorm/allowtypeexternalaicc', get_string('allowtypeexternalaicc', 'scorm'), get_string('allowtypeexternalaicc_desc', 'scorm'), 0)); $settings->add(new admin_setting_configcheckbox('scorm/allowaicchacp', get_string('allowtypeaicchacp', 'scorm'), get_string('allowtypeaicchacp_desc', 'scorm'), 0)); diff --git a/mod/scorm/version.php b/mod/scorm/version.php index 48dd05ec6d2..ff309ccdeba 100644 --- a/mod/scorm/version.php +++ b/mod/scorm/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$module->version = 2013050100; // The current module version (Date: YYYYMMDDXX) +$module->version = 2013050101; // The current module version (Date: YYYYMMDDXX) $module->requires = 2013050100; // Requires this Moodle version $module->component = 'mod_scorm'; // Full name of the plugin (used for diagnostics) $module->cron = 300;