Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ information provided here is intended especially for developers.
=== 2.9 ===

* Most of the functions from $mmaModScormOnline, $mmaModScormOffline, $mmaModScorm, $mmaModScormSync and $mmaModScormHelper now have a new param siteId to determine the site to affect. If you use any of these services please make sure you still pass the right parameters.
* Now filepool tries to use the files names instead of just using a hash. If you used the functions "getFilePathByUrl" or "getDirectoryUrlByUrl" to store package files, you should now use "getPackageDirPathByUrl" and "getPackageDirUrlByUrl" instead.

=== 2.8 ===

Expand Down
6 changes: 3 additions & 3 deletions www/addons/mod_imscp/services/imscp.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ angular.module('mm.addons.mod_imscp')
revision = $mmFilepool.getRevisionFromFileList(module.contents),
timemod = $mmFilepool.getTimemodifiedFromFileList(module.contents);

return $mmFilepool.getFilePathByUrl($mmSite.getId(), module.url).then(function(dirPath) {
return $mmFilepool.getPackageDirPathByUrl($mmSite.getId(), module.url).then(function(dirPath) {
return $mmFilepool.downloadPackage($mmSite.getId(), files, mmaModImscpComponent, module.id, revision, timemod, dirPath);
});
};
Expand Down Expand Up @@ -267,7 +267,7 @@ angular.module('mm.addons.mod_imscp')
}
mainFilePath = toc[0].href;

return $mmFilepool.getDirectoryUrlByUrl($mmSite.getId(), module.url).then(function(dirPath) {
return $mmFilepool.getPackageDirUrlByUrl($mmSite.getId(), module.url).then(function(dirPath) {
currentDirPath = dirPath;
// This URL is going to be injected in an iframe, we need trustAsResourceUrl to make it work in a browser.
return $sce.trustAsResourceUrl($mmFS.concatenatePaths(dirPath, mainFilePath));
Expand Down Expand Up @@ -390,7 +390,7 @@ angular.module('mm.addons.mod_imscp')
revision = $mmFilepool.getRevisionFromFileList(module.contents),
timemod = $mmFilepool.getTimemodifiedFromFileList(module.contents);

return $mmFilepool.getFilePathByUrl($mmSite.getId(), module.url).then(function(dirPath) {
return $mmFilepool.getPackageDirPathByUrl($mmSite.getId(), module.url).then(function(dirPath) {
return $mmFilepool.prefetchPackage($mmSite.getId(), files, mmaModImscpComponent, module.id, revision, timemod, dirPath);
});
};
Expand Down
6 changes: 3 additions & 3 deletions www/addons/mod_resource/services/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ angular.module('mm.addons.mod_resource')

if (self.isDisplayedInIframe(module)) {
// Get path of the module folder in filepool.
promise = $mmFilepool.getFilePathByUrl(siteid, module.url);
promise = $mmFilepool.getPackageDirPathByUrl(siteid, module.url);
} else {
promise = $q.when();
}
Expand Down Expand Up @@ -153,7 +153,7 @@ angular.module('mm.addons.mod_resource')
mainFilePath = mainFile.filepath.substr(1) + mainFilePath;
}

return $mmFilepool.getDirectoryUrlByUrl($mmSite.getId(), module.url).then(function(dirPath) {
return $mmFilepool.getPackageDirUrlByUrl($mmSite.getId(), module.url).then(function(dirPath) {
// This URL is going to be injected in an iframe, we need trustAsResourceUrl to make it work in a browser.
return $sce.trustAsResourceUrl($mmFS.concatenatePaths(dirPath, mainFilePath));
}, function() {
Expand Down Expand Up @@ -396,7 +396,7 @@ angular.module('mm.addons.mod_resource')

if (self.isDisplayedInIframe(module)) {
// Get path of the module folder in filepool.
promise = $mmFilepool.getFilePathByUrl(siteid, module.url);
promise = $mmFilepool.getPackageDirPathByUrl(siteid, module.url);
} else {
promise = $q.when();
}
Expand Down
4 changes: 2 additions & 2 deletions www/addons/mod_scorm/services/scorm.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ angular.module('mm.addons.mod_scorm')

siteId = siteId || $mmSite.getId();

return $mmFilepool.getDirectoryUrlByUrl(siteId, scorm.moduleurl).then(function(dirPath) {
return $mmFilepool.getPackageDirUrlByUrl(siteId, scorm.moduleurl).then(function(dirPath) {
// This URL is going to be injected in an iframe, we need trustAsResourceUrl to make it work in a browser.
return $sce.trustAsResourceUrl($mmFS.concatenatePaths(dirPath, sco.launch));
});
Expand All @@ -854,7 +854,7 @@ angular.module('mm.addons.mod_scorm')
*/
self.getScormFolder = function(moduleUrl, siteId) {
siteId = siteId || $mmSite.getId();
return $mmFilepool.getFilePathByUrl(siteId, moduleUrl);
return $mmFilepool.getPackageDirPathByUrl(siteId, moduleUrl);
};

/**
Expand Down
3 changes: 3 additions & 0 deletions www/core/lib/emulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ angular.module('mm.core')
errorCallback();
} else {
filePath = filePath.replace(basePath, ''); // Remove basePath from the filePath.
filePath = filePath.replace(/%20/g, ' '); // Replace all %20 with spaces.
$mmFS.writeFile(filePath, data.data).then(function(e) {
successCallback(e);
}).catch(function(error) {
Expand All @@ -81,7 +82,9 @@ angular.module('mm.core')
unzip: function(source, destination, callback, progressCallback) {
// Remove basePath from the source and destination.
source = source.replace(basePath, '');
source = source.replace(/%20/g, ' '); // Replace all %20 with spaces.
destination = destination.replace(basePath, '');
destination = destination.replace(/%20/g, ' '); // Replace all %20 with spaces.

$mmFS.readFile(source, $mmFS.FORMATARRAYBUFFER).then(function(data) {
var zip = new JSZip(data),
Expand Down
Loading