Merge branch 'master_MDL-39239' of git://github.com/danmarsden/moodle

This commit is contained in:
Dan Poltawski 2013-06-12 16:49:29 +08:00
commit 19c1e0b80a
8 changed files with 16 additions and 39 deletions

View File

@ -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.

View File

@ -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';

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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'];
}

View File

@ -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));

View File

@ -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;