Skip to content

Commit

Permalink
Merge pull request #361 from dpalou/MOBILE-1389-new
Browse files Browse the repository at this point in the history
MOBILE-1389 scorm: Fix size in % and logout bug
  • Loading branch information
jleyva committed Jan 22, 2016
2 parents 7b63927 + e641cf7 commit 10fd2f5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions www/addons/mod_scorm/controllers/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ angular.module('mm.addons.mod_scorm')
$scope.scorm = scorm;
$scope.loadingToc = true;

if (scorm.popup) {
// Fix for bug in WS not returning %. If we receive a value <= 100 we'll assume it's a percentage.
if (scorm.width <= 100) {
scorm.width = scorm.width + '%';
}
if (scorm.height <= 100) {
scorm.height = scorm.height + '%';
}
}

// Fetch data needed to play the SCORM.
function fetchData() {
// Wait for any ongoing sync to finish. We won't sync a SCORM while it's being played.
Expand Down
8 changes: 8 additions & 0 deletions www/addons/mod_scorm/services/scorm.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,10 @@ angular.module('mm.addons.mod_scorm')
self.getScos = function(scormid, organization, ignoreCache) {
organization = organization || '';

if (!$mmSite.isLoggedIn()) {
return $q.reject();
}

// Don't send the organization to the WS, we'll filter them locally.
var params = {
scormid: scormid
Expand Down Expand Up @@ -945,6 +949,10 @@ angular.module('mm.addons.mod_scorm')
cacheKey: getScormDataCacheKey(courseid)
};

if (!$mmSite.isLoggedIn()) {
return $q.reject();
}

return $mmSite.read('mod_scorm_get_scorms_by_courses', params, preSets).then(function(response) {
if (response && response.scorms) {
var currentScorm;
Expand Down
12 changes: 12 additions & 0 deletions www/addons/mod_scorm/services/scorm_online.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ angular.module('mm.addons.mod_scorm')
self.getAttemptCount = function(scormId, userId, ignoreMissing, ignoreCache) {
userId = userId || $mmSite.getUserId();

if (!$mmSite.isLoggedIn()) {
return $q.reject();
}

var params = {
scormid: scormId,
userid: userId,
Expand Down Expand Up @@ -135,6 +139,10 @@ angular.module('mm.addons.mod_scorm')
preSets.emergencyCache = 0;
}

if (!$mmSite.isLoggedIn()) {
return $q.reject();
}

return $mmSite.read('mod_scorm_get_scorm_user_data', params, preSets).then(function(response) {
if (response && response.data) {
// Format the response.
Expand Down Expand Up @@ -224,6 +232,10 @@ angular.module('mm.addons.mod_scorm')
return $q.when(); // Nothing to save.
}

if (!$mmSite.isLoggedIn()) {
return $q.reject();
}

blockedScorms[scormId] = true;

return $mmSite.write('mod_scorm_insert_scorm_tracks', params).then(function(response) {
Expand Down

0 comments on commit 10fd2f5

Please sign in to comment.