Made user results work in new embed.

d6
Frode Petterson 2015-02-20 11:41:09 +01:00
parent 971a55df58
commit f76290cdde
3 changed files with 6 additions and 7 deletions

View File

@ -79,7 +79,7 @@ H5P.XAPIEvent.prototype.getVerb = function(full) {
H5P.XAPIEvent.prototype.setObject = function(instance) { H5P.XAPIEvent.prototype.setObject = function(instance) {
if (instance.contentId) { if (instance.contentId) {
this.data.statement.object = { this.data.statement.object = {
'id': H5PIntegration.getContentUrl(instance.contentId), 'id': H5P.contentDatas['cid-' + instance.contentId].url,
'objectType': 'Activity', 'objectType': 'Activity',
'extensions': { 'extensions': {
'http://h5p.org/x-api/h5p-local-content-id': instance.contentId 'http://h5p.org/x-api/h5p-local-content-id': instance.contentId
@ -98,10 +98,9 @@ H5P.XAPIEvent.prototype.setObject = function(instance) {
* Helper function to set the actor, email and name will be added automatically * Helper function to set the actor, email and name will be added automatically
*/ */
H5P.XAPIEvent.prototype.setActor = function() { H5P.XAPIEvent.prototype.setActor = function() {
var user = H5PIntegration.getUser();
this.data.statement.actor = { this.data.statement.actor = {
'name': user.name, 'name': H5P.user.name,
'mbox': 'mailto:' + user.mail, 'mbox': 'mailto:' + H5P.user.mail,
'objectType': 'Agent' 'objectType': 'Agent'
}; };
}; };

View File

@ -3,7 +3,7 @@ var H5P = H5P || {};
// Create object where external code may register and listen for H5P Events // Create object where external code may register and listen for H5P Events
H5P.externalDispatcher = new H5P.EventDispatcher(); H5P.externalDispatcher = new H5P.EventDispatcher();
if (window.top !== window.self && window.top.H5P !== undefined && window.top.H5P.externalDispatcher !== undefined) { if (H5P.isFramed && H5P.externalEmbed === false) {
H5P.externalDispatcher.on('xAPI', window.top.H5P.externalDispatcher.trigger); H5P.externalDispatcher.on('xAPI', window.top.H5P.externalDispatcher.trigger);
} }