Merge branch 'no-url-fopen' into aggregated-xapi

semantics-font
Svein-Tore Griff With 2015-03-24 18:27:23 +01:00
commit 58d0d3e32c
2 changed files with 16 additions and 13 deletions

View File

@ -150,7 +150,7 @@ H5P.XAPIEvent.prototype.setActor = function() {
this.data.statement.actor = { this.data.statement.actor = {
'account': { 'account': {
'name': uuid, 'name': uuid,
'homePage': window.location.origin + H5PIntegration.basePath 'homePage': H5PIntegration.siteUrl
}, },
'objectType': 'Agent' 'objectType': 'Agent'
}; };

View File

@ -234,20 +234,10 @@ H5P.init = function (target) {
* @returns {string} HTML * @returns {string} HTML
*/ */
H5P.getHeadTags = function (contentId) { H5P.getHeadTags = function (contentId) {
var basePath = window.location.protocol + '//' + window.location.host + H5PIntegration.basePath;
var createUrl = function (path) {
if (path.substring(0,7) !== 'http://' && path.substring(0,8) !== 'https://') {
// Not external, add base path.
path = basePath + path;
}
return path;
};
var createStyleTags = function (styles) { var createStyleTags = function (styles) {
var tags = ''; var tags = '';
for (var i = 0; i < styles.length; i++) { for (var i = 0; i < styles.length; i++) {
tags += '<link rel="stylesheet" href="' + createUrl(styles[i]) + '">'; tags += '<link rel="stylesheet" href="' + styles[i] + '">';
} }
return tags; return tags;
}; };
@ -255,7 +245,7 @@ H5P.getHeadTags = function (contentId) {
var createScriptTags = function (scripts) { var createScriptTags = function (scripts) {
var tags = ''; var tags = '';
for (var i = 0; i < scripts.length; i++) { for (var i = 0; i < scripts.length; i++) {
tags += '<script src="' + createUrl(scripts[i]) + '"></script>'; tags += '<script src="' + scripts[i] + '"></script>';
} }
return tags; return tags;
}; };
@ -516,6 +506,19 @@ H5P.getPath = function (path, contentId) {
return prefix + '/' + path; return prefix + '/' + path;
}; };
/**
* THIS FUNCTION IS DEPRECATED, USE getPath INSTEAD
* Will be remove march 2016.
*
* Find the path to the content files folder based on the id of the content
*
* @param contentId
* Id of the content requesting a path
*/
H5P.getContentPath = function (contentId) {
return H5PIntegration.url + '/content/' + contentId;
};
/** /**
* Get library class constructor from H5P by classname. * Get library class constructor from H5P by classname.
* Note that this class will only work for resolve "H5P.NameWithoutDot". * Note that this class will only work for resolve "H5P.NameWithoutDot".