Skip to content

Commit 10fd2f5

Browse files
committed
Merge pull request #361 from dpalou/MOBILE-1389-new
MOBILE-1389 scorm: Fix size in % and logout bug
2 parents 7b63927 + e641cf7 commit 10fd2f5

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

www/addons/mod_scorm/controllers/player.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ angular.module('mm.addons.mod_scorm')
3939
$scope.scorm = scorm;
4040
$scope.loadingToc = true;
4141

42+
if (scorm.popup) {
43+
// Fix for bug in WS not returning %. If we receive a value <= 100 we'll assume it's a percentage.
44+
if (scorm.width <= 100) {
45+
scorm.width = scorm.width + '%';
46+
}
47+
if (scorm.height <= 100) {
48+
scorm.height = scorm.height + '%';
49+
}
50+
}
51+
4252
// Fetch data needed to play the SCORM.
4353
function fetchData() {
4454
// Wait for any ongoing sync to finish. We won't sync a SCORM while it's being played.

www/addons/mod_scorm/services/scorm.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,10 @@ angular.module('mm.addons.mod_scorm')
728728
self.getScos = function(scormid, organization, ignoreCache) {
729729
organization = organization || '';
730730

731+
if (!$mmSite.isLoggedIn()) {
732+
return $q.reject();
733+
}
734+
731735
// Don't send the organization to the WS, we'll filter them locally.
732736
var params = {
733737
scormid: scormid
@@ -945,6 +949,10 @@ angular.module('mm.addons.mod_scorm')
945949
cacheKey: getScormDataCacheKey(courseid)
946950
};
947951

952+
if (!$mmSite.isLoggedIn()) {
953+
return $q.reject();
954+
}
955+
948956
return $mmSite.read('mod_scorm_get_scorms_by_courses', params, preSets).then(function(response) {
949957
if (response && response.scorms) {
950958
var currentScorm;

www/addons/mod_scorm/services/scorm_online.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ angular.module('mm.addons.mod_scorm')
6767
self.getAttemptCount = function(scormId, userId, ignoreMissing, ignoreCache) {
6868
userId = userId || $mmSite.getUserId();
6969

70+
if (!$mmSite.isLoggedIn()) {
71+
return $q.reject();
72+
}
73+
7074
var params = {
7175
scormid: scormId,
7276
userid: userId,
@@ -135,6 +139,10 @@ angular.module('mm.addons.mod_scorm')
135139
preSets.emergencyCache = 0;
136140
}
137141

142+
if (!$mmSite.isLoggedIn()) {
143+
return $q.reject();
144+
}
145+
138146
return $mmSite.read('mod_scorm_get_scorm_user_data', params, preSets).then(function(response) {
139147
if (response && response.data) {
140148
// Format the response.
@@ -224,6 +232,10 @@ angular.module('mm.addons.mod_scorm')
224232
return $q.when(); // Nothing to save.
225233
}
226234

235+
if (!$mmSite.isLoggedIn()) {
236+
return $q.reject();
237+
}
238+
227239
blockedScorms[scormId] = true;
228240

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

0 commit comments

Comments
 (0)