diff --git a/bower.json b/bower.json index c06cc94..3707237 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "tincan", - "version": "0.22.1", + "version": "0.22.2", "homepage": "http://rusticisoftware.github.com/TinCanJS/", "authors": [ "Brian J. Miller " diff --git a/build/tincan-min.js b/build/tincan-min.js index 601de3b..954fc3d 100644 --- a/build/tincan-min.js +++ b/build/tincan-min.js @@ -14,4 +14,4 @@ See the License for the specific language governing permissions and limitations under the License. */ -;var TinCan;(function(){"use strict";var a={statementId:!0,voidedStatementId:!0,verb:!0,object:!0,registration:!0,context:!0,actor:!0,since:!0,until:!0,limit:!0,authoritative:!0,sparse:!0,instructor:!0,ascending:!0,continueToken:!0,agent:!0,activityId:!0,stateId:!0,profileId:!0,activity_platform:!0,grouping:!0,"Accept-Language":!0};TinCan=function(a){this.log("constructor"),this.recordStores=[],this.actor=null,this.activity=null,this.registration=null,this.context=null,this.init(a)},TinCan.prototype={LOG_SRC:"TinCan",log:function(a,b){TinCan.DEBUG&&typeof console!="undefined"&&console.log&&(b=b||this.LOG_SRC||"TinCan",console.log("TinCan."+b+": "+a))},init:function(a){this.log("init");var b;a=a||{},a.hasOwnProperty("url")&&a.url!==""&&this._initFromQueryString(a.url);if(a.hasOwnProperty("recordStores")&&a.recordStores!==undefined)for(b=0;b0){typeof b=="function"&&(i=function(a,d){var g;c.log("sendStatement - callbackWrapper: "+f),f>1?(f-=1,j.push({err:a,xhr:d})):f===1?(j.push({err:a,xhr:d}),g=[j,e],b.apply(this,g)):c.log("sendStatement - unexpected record store count: "+f)});for(g=0;g0)return c=this.recordStores[0],c.retrieveStatement(a,{callback:b});this.log("[warning] getStatement: No LRSs added yet (statement not retrieved)")},voidStatement:function(a,b,c){this.log("voidStatement");var d=this,e,f,g,h=this.recordStores.length,i,j=[],k,l=[];a instanceof TinCan.Statement&&(a=a.id),typeof c.actor!="undefined"?f=c.actor:this.actor!==null&&(f=this.actor),g=new TinCan.Statement({actor:f,verb:{id:"http://adlnet.gov/expapi/verbs/voided"},target:{objectType:"StatementRef",id:a}});if(h>0){typeof b=="function"&&(k=function(a,c){var e;d.log("voidStatement - callbackWrapper: "+h),h>1?(h-=1,l.push({err:a,xhr:c})):h===1?(l.push({err:a,xhr:c}),e=[l,g],b.apply(this,e)):d.log("voidStatement - unexpected record store count: "+h)});for(i=0;i0)return c=this.recordStores[0],c.retrieveVoidedStatement(a,{callback:b});this.log("[warning] getVoidedStatement: No LRSs added yet (statement not retrieved)")},sendStatements:function(a,b){this.log("sendStatements");var c=this,d,e=[],f=this.recordStores.length,g,h=[],i,j=[];if(a.length===0)typeof b=="function"&&b.apply(this,[null,e]);else{for(g=0;g0){typeof b=="function"&&(i=function(a,d){var g;c.log("sendStatements - callbackWrapper: "+f),f>1?(f-=1,j.push({err:a,xhr:d})):f===1?(j.push({err:a,xhr:d}),g=[j,e],b.apply(this,g)):c.log("sendStatements - unexpected record store count: "+f)});for(g=0;g0)return c=this.recordStores[0],a=a||{},d=a.params||{},a.sendActor&&this.actor!==null&&(c.version==="0.9"||c.version==="0.95"?d.actor=this.actor:d.agent=this.actor),a.sendActivity&&this.activity!==null&&(c.version==="0.9"||c.version==="0.95"?d.target=this.activity:d.activity=this.activity),typeof d.registration=="undefined"&&this.registration!==null&&(d.registration=this.registration),b={params:d},typeof a.callback!="undefined"&&(b.callback=a.callback),c.queryStatements(b);this.log("[warning] getStatements: No LRSs added yet (statements not read)")},getState:function(a,b){this.log("getState");var c,d;if(this.recordStores.length>0)return d=this.recordStores[0],b=b||{},c={agent:typeof b.agent!="undefined"?b.agent:this.actor,activity:typeof b.activity!="undefined"?b.activity:this.activity},typeof b.registration!="undefined"?c.registration=b.registration:this.registration!==null&&(c.registration=this.registration),typeof b.callback!="undefined"&&(c.callback=b.callback),d.retrieveState(a,c);this.log("[warning] getState: No LRSs added yet (state not retrieved)")},setState:function(a,b,c){this.log("setState");var d,e;if(this.recordStores.length>0)return e=this.recordStores[0],c=c||{},d={agent:typeof c.agent!="undefined"?c.agent:this.actor,activity:typeof c.activity!="undefined"?c.activity:this.activity},typeof c.registration!="undefined"?d.registration=c.registration:this.registration!==null&&(d.registration=this.registration),typeof c.lastSHA1!="undefined"&&(d.lastSHA1=c.lastSHA1),typeof c.contentType!="undefined"&&(d.contentType=c.contentType),typeof c.callback!="undefined"&&(d.callback=c.callback),e.saveState(a,b,d);this.log("[warning] setState: No LRSs added yet (state not saved)")},deleteState:function(a,b){this.log("deleteState");var c,d;if(this.recordStores.length>0)return d=this.recordStores[0],b=b||{},c={agent:typeof b.agent!="undefined"?b.agent:this.actor,activity:typeof b.activity!="undefined"?b.activity:this.activity},typeof b.registration!="undefined"?c.registration=b.registration:this.registration!==null&&(c.registration=this.registration),typeof b.callback!="undefined"&&(c.callback=b.callback),d.dropState(a,c);this.log("[warning] deleteState: No LRSs added yet (state not deleted)")},getActivityProfile:function(a,b){this.log("getActivityProfile");var c,d;if(this.recordStores.length>0)return d=this.recordStores[0],b=b||{},c={activity:typeof b.activity!="undefined"?b.activity:this.activity},typeof b.callback!="undefined"&&(c.callback=b.callback),d.retrieveActivityProfile(a,c);this.log("[warning] getActivityProfile: No LRSs added yet (activity profile not retrieved)")},setActivityProfile:function(a,b,c){this.log("setActivityProfile");var d,e;if(this.recordStores.length>0)return e=this.recordStores[0],c=c||{},d={activity:typeof c.activity!="undefined"?c.activity:this.activity},typeof c.callback!="undefined"&&(d.callback=c.callback),typeof c.lastSHA1!="undefined"&&(d.lastSHA1=c.lastSHA1),typeof c.contentType!="undefined"&&(d.contentType=c.contentType),e.saveActivityProfile(a,b,d);this.log("[warning] setActivityProfile: No LRSs added yet (activity profile not saved)")},deleteActivityProfile:function(a,b){this.log("deleteActivityProfile");var c,d;if(this.recordStores.length>0)return d=this.recordStores[0],b=b||{},c={activity:typeof b.activity!="undefined"?b.activity:this.activity},typeof b.callback!="undefined"&&(c.callback=b.callback),d.dropActivityProfile(a,c);this.log("[warning] deleteActivityProfile: No LRSs added yet (activity profile not deleted)")},getAgentProfile:function(a,b){this.log("getAgentProfile");var c,d;if(this.recordStores.length>0)return d=this.recordStores[0],b=b||{},c={agent:typeof b.agent!="undefined"?b.agent:this.actor},typeof b.callback!="undefined"&&(c.callback=b.callback),d.retrieveAgentProfile(a,c);this.log("[warning] getAgentProfile: No LRSs added yet (agent profile not retrieved)")},setAgentProfile:function(a,b,c){this.log("setAgentProfile");var d,e;if(this.recordStores.length>0)return e=this.recordStores[0],c=c||{},d={agent:typeof c.agent!="undefined"?c.agent:this.actor},typeof c.callback!="undefined"&&(d.callback=c.callback),typeof c.lastSHA1!="undefined"&&(d.lastSHA1=c.lastSHA1),typeof c.contentType!="undefined"&&(d.contentType=c.contentType),e.saveAgentProfile(a,b,d);this.log("[warning] setAgentProfile: No LRSs added yet (agent profile not saved)")},deleteAgentProfile:function(a,b){this.log("deleteAgentProfile");var c,d;if(this.recordStores.length>0)return d=this.recordStores[0],b=b||{},c={agent:typeof b.agent!="undefined"?b.agent:this.actor},typeof b.callback!="undefined"&&(c.callback=b.callback),d.dropAgentProfile(a,c);this.log("[warning] deleteAgentProfile: No LRSs added yet (agent profile not deleted)")}},TinCan.DEBUG=!1,TinCan.enableDebug=function(){TinCan.DEBUG=!0},TinCan.disableDebug=function(){TinCan.DEBUG=!1},TinCan.versions=function(){return["1.0.1","1.0.0","0.95","0.9"]},typeof module=="object"&&(module.exports=TinCan)})(),function(){"use strict",TinCan.Utils={getUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=Math.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)})},getISODateString:function(a){function b(a,b){var c,d;if(typeof a=="undefined"||a===null)a=0;if(typeof b=="undefined"||b===null)b=2;c=Math.pow(10,b-1),d=a.toString();while(a1)d="0"+d,c/=10;return d}return a.getUTCFullYear()+"-"+b(a.getUTCMonth()+1)+"-"+b(a.getUTCDate())+"T"+b(a.getUTCHours())+":"+b(a.getUTCMinutes())+":"+b(a.getUTCSeconds())+"."+b(a.getUTCMilliseconds(),3)+"Z"},getSHA1String:function(a){return CryptoJS.SHA1(a).toString(CryptoJS.enc.Hex)},getBase64String:function(a){return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Latin1.parse(a))},getLangDictionaryValue:function(a,b){var c=this[a],d;if(typeof b!="undefined"&&typeof c[b]!="undefined")return c[b];if(typeof c.und!="undefined")return c.und;if(typeof c["en-US"]!="undefined")return c["en-US"];for(d in c)if(c.hasOwnProperty(d))return c[d];return""},parseURL:function(a){var b=String(a).split("?"),c,d,e,f={};if(b.length===2){c=b[1].split("&");for(e=0;e0&&(a.name=a.firstName[0],a.firstName.length>1&&(this.degraded=!0)),a.name!==""&&(a.name+=" "),typeof a.lastName!="undefined"&&a.lastName.length>0&&(a.name+=a.lastName[0],a.lastName.length>1&&(this.degraded=!0));else if(typeof a.familyName!="undefined"||typeof a.givenName!="undefined")a.name="",typeof a.givenName!="undefined"&&a.givenName.length>0&&(a.name=a.givenName[0],a.givenName.length>1&&(this.degraded=!0)),a.name!==""&&(a.name+=" "),typeof a.familyName!="undefined"&&a.familyName.length>0&&(a.name+=a.familyName[0],a.familyName.length>1&&(this.degraded=!0));typeof a.name=="object"&&a.name!==null&&(a.name.length>1&&(this.degraded=!0),a.name=a.name[0]),typeof a.mbox=="object"&&a.mbox!==null&&(a.mbox.length>1&&(this.degraded=!0),a.mbox=a.mbox[0]),typeof a.mbox_sha1sum=="object"&&a.mbox_sha1sum!==null&&(a.mbox_sha1sum.length>1&&(this.degraded=!0),a.mbox_sha1sum=a.mbox_sha1sum[0]),typeof a.openid=="object"&&a.openid!==null&&(a.openid.length>1&&(this.degraded=!0),a.openid=a.openid[0]),typeof a.account=="object"&&a.account!==null&&typeof a.account.homePage=="undefined"&&typeof a.account.name=="undefined"&&(a.account.length===0?delete a.account:(a.account.length>1&&(this.degraded=!0),a.account=a.account[0])),a.hasOwnProperty("account")&&(a.account instanceof TinCan.AgentAccount?this.account=a.account:this.account=new TinCan.AgentAccount(a.account));for(b=0;b0){b.member=[];for(c=0;c0)for(c=0;c0)if(a==="0.9"||a==="0.95")this[c[d]].length>1&&this.log("[warning] version does not support multiple values in: "+c[d]),b[c[d]]=this[c[d]][0].asVersion(a);else{b[c[d]]=[];for(e=0;e0){if(a==="0.9"||a==="0.95")throw this.log("[error] version does not support the 'category' property: "+a),new Error(a+" does not support the 'category' property");b.category=[];for(d=0;d=200&&f<400||e))return d={err:f,xhr:a},f===0?log("[warning] There was a problem communicating with the Learning Record Store. Aborted, offline, or invalid CORS endpoint ("+f+")",LOG_SRC):log("[warning] There was a problem communicating with the Learning Record Store. ("+f+" | "+a.responseText+")",LOG_SRC),b.callback&&b.callback(f,a),d;if(!b.callback)return d={err:null,xhr:a},d;b.callback(null,a)},nativeRequest=function(a,b,c){log("sendRequest using XMLHttpRequest",LOG_SRC);var d=this,e,f,g=[],h,i={finished:!1,fakeStatus:null},j=typeof c.callback!="undefined";log("sendRequest using XMLHttpRequest - async: "+j,LOG_SRC);for(f in c.params)c.params.hasOwnProperty(f)&&g.push(f+"="+encodeURIComponent(c.params[f]));g.length>0&&(a+="?"+g.join("&")),typeof XMLHttpRequest!="undefined"?e=new XMLHttpRequest:e=new ActiveXObject("Microsoft.XMLHTTP"),e.open(c.method,a,j);for(f in b)b.hasOwnProperty(f)&&e.setRequestHeader(f,b[f]);typeof c.data!="undefined"&&(c.data+=""),h=c.data,j&&(e.onreadystatechange=function(){log("xhr.onreadystatechange - xhr.readyState: "+e.readyState,LOG_SRC),e.readyState===4&&requestComplete.call(d,e,c,i)});try{e.send(h)}catch(k){log("sendRequest caught send exception: "+k,LOG_SRC)}return j?e:requestComplete.call(this,e,c,i)},xdrRequest=function(a,b,c){log("sendRequest using XDomainRequest",LOG_SRC);var d=this,e,f=[],g,h,i,j={finished:!1,fakeStatus:null};a+="?method="+c.method;for(h in c.params)c.params.hasOwnProperty(h)&&f.push(h+"="+encodeURIComponent(c.params[h]));for(h in b)b.hasOwnProperty(h)&&f.push(h+"="+encodeURIComponent(b[h]));c.data!==null&&f.push("content="+encodeURIComponent(c.data)),g=f.join("&"),e=new XDomainRequest,e.open("POST",a),c.callback?(e.onload=function(){j.fakeStatus=200,requestComplete.call(d,e,c,j)},e.onerror=function(){j.fakeStatus=400,requestComplete.call(d,e,c,j)},e.ontimeout=function(){j.fakeStatus=0,requestComplete.call(d,e,c,j)}):(e.onload=function(){j.fakeStatus=200},e.onerror=function(){j.fakeStatus=400},e.ontimeout=function(){j.fakeStatus=0}),e.onprogress=function(){},e.timeout=0;try{e.send(g)}catch(k){log("sendRequest caught send exception: "+k,LOG_SRC)}if(!c.callback){i=1e4+Date.now(),log("sendRequest - until: "+i+", finished: "+j.finished,LOG_SRC);while(Date.now()>>2]|=(c[e>>>2]>>>24-8*(e%4)&255)<<24-8*((d+e)%4);else if(65535>>2]=c[e>>>2];else b.push.apply(b,c);return this.sigBytes+=a,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-8*(c%4),b.length=a.ceil(c/4)},clone:function(){var a=e.clone.call(this);return a.words=this.words.slice(0),a},random:function(b){for(var c=[],d=0;d>>2]>>>24-8*(d%4)&255;c.push((e>>>4).toString(16)),c.push((e&15).toString(16))}return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d>>3]|=parseInt(a.substr(d,2),16)<<24-4*(d%8);return f.create(c,b/2)}},i=g.Latin1={stringify:function(a){for(var b=a.words,a=a.sigBytes,c=[],d=0;d>>2]>>>24-8*(d%4)&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d>>2]|=(a.charCodeAt(d)&255)<<24-8*(d%4);return f.create(c,b)}},j=g.Utf8={stringify:function(a){try{return decodeURIComponent(escape(i.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data")}},parse:function(a){return i.parse(unescape(encodeURIComponent(a)))}},k=d.BufferedBlockAlgorithm=e.extend({reset:function(){this._data=f.create(),this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=j.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,d=c.words,e=c.sigBytes,g=this.blockSize,h=e/(4*g),h=b?a.ceil(h):a.max((h|0)-this._minBufferSize,0),b=h*g,e=a.min(4*b,e);if(b){for(var i=0;ik;k++){if(16>k)d[k]=a[b+k]|0;else{var l=d[k-3]^d[k-8]^d[k-14]^d[k-16];d[k]=l<<1|l>>>31}l=(e<<5|e>>>27)+j+d[k],l=20>k?l+((f&g|~f&i)+1518500249):40>k?l+((f^g^i)+1859775393):60>k?l+((f&g|f&i|g&i)-1894007588):l+((f^g^i)-899497514),j=i,i=g,g=f<<30|f>>>2,f=e,e=l}c[0]=c[0]+e|0,c[1]=c[1]+f|0,c[2]=c[2]+g|0,c[3]=c[3]+i|0,c[4]=c[4]+j|0},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;b[d>>>5]|=128<<24-d%32,b[(d+64>>>9<<4)+15]=c,a.sigBytes=4*b.length,this._process()}});a.SHA1=b._createHelper(e),a.HmacSHA1=b._createHmacHelper(e)})(),function(){var a=CryptoJS,b=a.lib,c=b.WordArray,d=a.enc,e=d.Base64={stringify:function(a){var b=a.words,c=a.sigBytes,d=this._map;a.clamp();var e=[];for(var f=0;f>>2]>>>24-f%4*8&255,h=b[f+1>>>2]>>>24-(f+1)%4*8&255,i=b[f+2>>>2]>>>24-(f+2)%4*8&255,j=g<<16|h<<8|i;for(var k=0;k<4&&f+k*.75>>6*(3-k)&63))}var l=d.charAt(64);if(l)while(e.length%4)e.push(l);return e.join("")},parse:function(a){a=a.replace(/\s/g,"");var b=a.length,d=this._map,e=d.charAt(64);if(e){var f=a.indexOf(e);f!=-1&&(b=f)}var g=[],h=0;for(var i=0;i>>6-i%4*2;g[h>>>2]|=(j|k)<<24-h%4*8,h++}return c.create(g,h)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(); +;var TinCan;(function(){"use strict";var a={statementId:!0,voidedStatementId:!0,verb:!0,object:!0,registration:!0,context:!0,actor:!0,since:!0,until:!0,limit:!0,authoritative:!0,sparse:!0,instructor:!0,ascending:!0,continueToken:!0,agent:!0,activityId:!0,stateId:!0,profileId:!0,activity_platform:!0,grouping:!0,"Accept-Language":!0};TinCan=function(a){this.log("constructor"),this.recordStores=[],this.actor=null,this.activity=null,this.registration=null,this.context=null,this.init(a)},TinCan.prototype={LOG_SRC:"TinCan",log:function(a,b){TinCan.DEBUG&&typeof console!="undefined"&&console.log&&(b=b||this.LOG_SRC||"TinCan",console.log("TinCan."+b+": "+a))},init:function(a){this.log("init");var b;a=a||{},a.hasOwnProperty("url")&&a.url!==""&&this._initFromQueryString(a.url);if(a.hasOwnProperty("recordStores")&&a.recordStores!==undefined)for(b=0;b0){typeof b=="function"&&(i=function(a,d){var g;c.log("sendStatement - callbackWrapper: "+f),f>1?(f-=1,j.push({err:a,xhr:d})):f===1?(j.push({err:a,xhr:d}),g=[j,e],b.apply(this,g)):c.log("sendStatement - unexpected record store count: "+f)});for(g=0;g0)return c=this.recordStores[0],c.retrieveStatement(a,{callback:b});this.log("[warning] getStatement: No LRSs added yet (statement not retrieved)")},voidStatement:function(a,b,c){this.log("voidStatement");var d=this,e,f,g,h=this.recordStores.length,i,j=[],k,l=[];a instanceof TinCan.Statement&&(a=a.id),typeof c.actor!="undefined"?f=c.actor:this.actor!==null&&(f=this.actor),g=new TinCan.Statement({actor:f,verb:{id:"http://adlnet.gov/expapi/verbs/voided"},target:{objectType:"StatementRef",id:a}});if(h>0){typeof b=="function"&&(k=function(a,c){var e;d.log("voidStatement - callbackWrapper: "+h),h>1?(h-=1,l.push({err:a,xhr:c})):h===1?(l.push({err:a,xhr:c}),e=[l,g],b.apply(this,e)):d.log("voidStatement - unexpected record store count: "+h)});for(i=0;i0)return c=this.recordStores[0],c.retrieveVoidedStatement(a,{callback:b});this.log("[warning] getVoidedStatement: No LRSs added yet (statement not retrieved)")},sendStatements:function(a,b){this.log("sendStatements");var c=this,d,e=[],f=this.recordStores.length,g,h=[],i,j=[];if(a.length===0)typeof b=="function"&&b.apply(this,[null,e]);else{for(g=0;g0){typeof b=="function"&&(i=function(a,d){var g;c.log("sendStatements - callbackWrapper: "+f),f>1?(f-=1,j.push({err:a,xhr:d})):f===1?(j.push({err:a,xhr:d}),g=[j,e],b.apply(this,g)):c.log("sendStatements - unexpected record store count: "+f)});for(g=0;g0)return c=this.recordStores[0],a=a||{},d=a.params||{},a.sendActor&&this.actor!==null&&(c.version==="0.9"||c.version==="0.95"?d.actor=this.actor:d.agent=this.actor),a.sendActivity&&this.activity!==null&&(c.version==="0.9"||c.version==="0.95"?d.target=this.activity:d.activity=this.activity),typeof d.registration=="undefined"&&this.registration!==null&&(d.registration=this.registration),b={params:d},typeof a.callback!="undefined"&&(b.callback=a.callback),c.queryStatements(b);this.log("[warning] getStatements: No LRSs added yet (statements not read)")},getState:function(a,b){this.log("getState");var c,d;if(this.recordStores.length>0)return d=this.recordStores[0],b=b||{},c={agent:typeof b.agent!="undefined"?b.agent:this.actor,activity:typeof b.activity!="undefined"?b.activity:this.activity},typeof b.registration!="undefined"?c.registration=b.registration:this.registration!==null&&(c.registration=this.registration),typeof b.callback!="undefined"&&(c.callback=b.callback),d.retrieveState(a,c);this.log("[warning] getState: No LRSs added yet (state not retrieved)")},setState:function(a,b,c){this.log("setState");var d,e;if(this.recordStores.length>0)return e=this.recordStores[0],c=c||{},d={agent:typeof c.agent!="undefined"?c.agent:this.actor,activity:typeof c.activity!="undefined"?c.activity:this.activity},typeof c.registration!="undefined"?d.registration=c.registration:this.registration!==null&&(d.registration=this.registration),typeof c.lastSHA1!="undefined"&&(d.lastSHA1=c.lastSHA1),typeof c.contentType!="undefined"&&(d.contentType=c.contentType),typeof c.callback!="undefined"&&(d.callback=c.callback),e.saveState(a,b,d);this.log("[warning] setState: No LRSs added yet (state not saved)")},deleteState:function(a,b){this.log("deleteState");var c,d;if(this.recordStores.length>0)return d=this.recordStores[0],b=b||{},c={agent:typeof b.agent!="undefined"?b.agent:this.actor,activity:typeof b.activity!="undefined"?b.activity:this.activity},typeof b.registration!="undefined"?c.registration=b.registration:this.registration!==null&&(c.registration=this.registration),typeof b.callback!="undefined"&&(c.callback=b.callback),d.dropState(a,c);this.log("[warning] deleteState: No LRSs added yet (state not deleted)")},getActivityProfile:function(a,b){this.log("getActivityProfile");var c,d;if(this.recordStores.length>0)return d=this.recordStores[0],b=b||{},c={activity:typeof b.activity!="undefined"?b.activity:this.activity},typeof b.callback!="undefined"&&(c.callback=b.callback),d.retrieveActivityProfile(a,c);this.log("[warning] getActivityProfile: No LRSs added yet (activity profile not retrieved)")},setActivityProfile:function(a,b,c){this.log("setActivityProfile");var d,e;if(this.recordStores.length>0)return e=this.recordStores[0],c=c||{},d={activity:typeof c.activity!="undefined"?c.activity:this.activity},typeof c.callback!="undefined"&&(d.callback=c.callback),typeof c.lastSHA1!="undefined"&&(d.lastSHA1=c.lastSHA1),typeof c.contentType!="undefined"&&(d.contentType=c.contentType),e.saveActivityProfile(a,b,d);this.log("[warning] setActivityProfile: No LRSs added yet (activity profile not saved)")},deleteActivityProfile:function(a,b){this.log("deleteActivityProfile");var c,d;if(this.recordStores.length>0)return d=this.recordStores[0],b=b||{},c={activity:typeof b.activity!="undefined"?b.activity:this.activity},typeof b.callback!="undefined"&&(c.callback=b.callback),d.dropActivityProfile(a,c);this.log("[warning] deleteActivityProfile: No LRSs added yet (activity profile not deleted)")},getAgentProfile:function(a,b){this.log("getAgentProfile");var c,d;if(this.recordStores.length>0)return d=this.recordStores[0],b=b||{},c={agent:typeof b.agent!="undefined"?b.agent:this.actor},typeof b.callback!="undefined"&&(c.callback=b.callback),d.retrieveAgentProfile(a,c);this.log("[warning] getAgentProfile: No LRSs added yet (agent profile not retrieved)")},setAgentProfile:function(a,b,c){this.log("setAgentProfile");var d,e;if(this.recordStores.length>0)return e=this.recordStores[0],c=c||{},d={agent:typeof c.agent!="undefined"?c.agent:this.actor},typeof c.callback!="undefined"&&(d.callback=c.callback),typeof c.lastSHA1!="undefined"&&(d.lastSHA1=c.lastSHA1),typeof c.contentType!="undefined"&&(d.contentType=c.contentType),e.saveAgentProfile(a,b,d);this.log("[warning] setAgentProfile: No LRSs added yet (agent profile not saved)")},deleteAgentProfile:function(a,b){this.log("deleteAgentProfile");var c,d;if(this.recordStores.length>0)return d=this.recordStores[0],b=b||{},c={agent:typeof b.agent!="undefined"?b.agent:this.actor},typeof b.callback!="undefined"&&(c.callback=b.callback),d.dropAgentProfile(a,c);this.log("[warning] deleteAgentProfile: No LRSs added yet (agent profile not deleted)")}},TinCan.DEBUG=!1,TinCan.enableDebug=function(){TinCan.DEBUG=!0},TinCan.disableDebug=function(){TinCan.DEBUG=!1},TinCan.versions=function(){return["1.0.1","1.0.0","0.95","0.9"]},typeof module=="object"&&(module.exports=TinCan)})(),function(){"use strict",TinCan.Utils={getUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=Math.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)})},getISODateString:function(a){function b(a,b){var c,d;if(typeof a=="undefined"||a===null)a=0;if(typeof b=="undefined"||b===null)b=2;c=Math.pow(10,b-1),d=a.toString();while(a1)d="0"+d,c/=10;return d}return a.getUTCFullYear()+"-"+b(a.getUTCMonth()+1)+"-"+b(a.getUTCDate())+"T"+b(a.getUTCHours())+":"+b(a.getUTCMinutes())+":"+b(a.getUTCSeconds())+"."+b(a.getUTCMilliseconds(),3)+"Z"},getSHA1String:function(a){return CryptoJS.SHA1(a).toString(CryptoJS.enc.Hex)},getBase64String:function(a){return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Latin1.parse(a))},getLangDictionaryValue:function(a,b){var c=this[a],d;if(typeof b!="undefined"&&typeof c[b]!="undefined")return c[b];if(typeof c.und!="undefined")return c.und;if(typeof c["en-US"]!="undefined")return c["en-US"];for(d in c)if(c.hasOwnProperty(d))return c[d];return""},parseURL:function(a){var b=String(a).split("?"),c,d,e,f={};if(b.length===2){c=b[1].split("&");for(e=0;e0&&(a.name=a.firstName[0],a.firstName.length>1&&(this.degraded=!0)),a.name!==""&&(a.name+=" "),typeof a.lastName!="undefined"&&a.lastName.length>0&&(a.name+=a.lastName[0],a.lastName.length>1&&(this.degraded=!0));else if(typeof a.familyName!="undefined"||typeof a.givenName!="undefined")a.name="",typeof a.givenName!="undefined"&&a.givenName.length>0&&(a.name=a.givenName[0],a.givenName.length>1&&(this.degraded=!0)),a.name!==""&&(a.name+=" "),typeof a.familyName!="undefined"&&a.familyName.length>0&&(a.name+=a.familyName[0],a.familyName.length>1&&(this.degraded=!0));typeof a.name=="object"&&a.name!==null&&(a.name.length>1&&(this.degraded=!0),a.name=a.name[0]),typeof a.mbox=="object"&&a.mbox!==null&&(a.mbox.length>1&&(this.degraded=!0),a.mbox=a.mbox[0]),typeof a.mbox_sha1sum=="object"&&a.mbox_sha1sum!==null&&(a.mbox_sha1sum.length>1&&(this.degraded=!0),a.mbox_sha1sum=a.mbox_sha1sum[0]),typeof a.openid=="object"&&a.openid!==null&&(a.openid.length>1&&(this.degraded=!0),a.openid=a.openid[0]),typeof a.account=="object"&&a.account!==null&&typeof a.account.homePage=="undefined"&&typeof a.account.name=="undefined"&&(a.account.length===0?delete a.account:(a.account.length>1&&(this.degraded=!0),a.account=a.account[0])),a.hasOwnProperty("account")&&(a.account instanceof TinCan.AgentAccount?this.account=a.account:this.account=new TinCan.AgentAccount(a.account));for(b=0;b0){b.member=[];for(c=0;c0)for(c=0;c0)if(a==="0.9"||a==="0.95")this[c[d]].length>1&&this.log("[warning] version does not support multiple values in: "+c[d]),b[c[d]]=this[c[d]][0].asVersion(a);else{b[c[d]]=[];for(e=0;e0){if(a==="0.9"||a==="0.95")throw this.log("[error] version does not support the 'category' property: "+a),new Error(a+" does not support the 'category' property");b.category=[];for(d=0;d=200&&f<400||e))return d={err:f,xhr:a},f===0?log("[warning] There was a problem communicating with the Learning Record Store. Aborted, offline, or invalid CORS endpoint ("+f+")",LOG_SRC):log("[warning] There was a problem communicating with the Learning Record Store. ("+f+" | "+a.responseText+")",LOG_SRC),b.callback&&b.callback(f,a),d;if(!b.callback)return d={err:null,xhr:a},d;b.callback(null,a)},nativeRequest=function(a,b,c){log("sendRequest using XMLHttpRequest",LOG_SRC);var d=this,e,f,g=[],h,i={finished:!1,fakeStatus:null},j=typeof c.callback!="undefined";log("sendRequest using XMLHttpRequest - async: "+j,LOG_SRC);for(f in c.params)c.params.hasOwnProperty(f)&&g.push(f+"="+encodeURIComponent(c.params[f]));g.length>0&&(a+="?"+g.join("&")),typeof XMLHttpRequest!="undefined"?e=new XMLHttpRequest:e=new ActiveXObject("Microsoft.XMLHTTP"),e.open(c.method,a,j);for(f in b)b.hasOwnProperty(f)&&e.setRequestHeader(f,b[f]);typeof c.data!="undefined"&&(c.data+=""),h=c.data,j&&(e.onreadystatechange=function(){log("xhr.onreadystatechange - xhr.readyState: "+e.readyState,LOG_SRC),e.readyState===4&&requestComplete.call(d,e,c,i)});try{e.send(h)}catch(k){log("sendRequest caught send exception: "+k,LOG_SRC)}return j?e:requestComplete.call(this,e,c,i)},xdrRequest=function(a,b,c){log("sendRequest using XDomainRequest",LOG_SRC);var d=this,e,f=[],g,h,i,j={finished:!1,fakeStatus:null};a+="?method="+c.method;for(h in c.params)c.params.hasOwnProperty(h)&&f.push(h+"="+encodeURIComponent(c.params[h]));for(h in b)b.hasOwnProperty(h)&&f.push(h+"="+encodeURIComponent(b[h]));c.data!==null&&f.push("content="+encodeURIComponent(c.data)),g=f.join("&"),e=new XDomainRequest,e.open("POST",a),c.callback?(e.onload=function(){j.fakeStatus=200,requestComplete.call(d,e,c,j)},e.onerror=function(){j.fakeStatus=400,requestComplete.call(d,e,c,j)},e.ontimeout=function(){j.fakeStatus=0,requestComplete.call(d,e,c,j)}):(e.onload=function(){j.fakeStatus=200},e.onerror=function(){j.fakeStatus=400},e.ontimeout=function(){j.fakeStatus=0}),e.onprogress=function(){},e.timeout=0;try{e.send(g)}catch(k){log("sendRequest caught send exception: "+k,LOG_SRC)}if(!c.callback){i=1e4+Date.now(),log("sendRequest - until: "+i+", finished: "+j.finished,LOG_SRC);while(Date.now()>>2]|=(c[e>>>2]>>>24-8*(e%4)&255)<<24-8*((d+e)%4);else if(65535>>2]=c[e>>>2];else b.push.apply(b,c);return this.sigBytes+=a,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-8*(c%4),b.length=a.ceil(c/4)},clone:function(){var a=e.clone.call(this);return a.words=this.words.slice(0),a},random:function(b){for(var c=[],d=0;d>>2]>>>24-8*(d%4)&255;c.push((e>>>4).toString(16)),c.push((e&15).toString(16))}return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d>>3]|=parseInt(a.substr(d,2),16)<<24-4*(d%8);return f.create(c,b/2)}},i=g.Latin1={stringify:function(a){for(var b=a.words,a=a.sigBytes,c=[],d=0;d>>2]>>>24-8*(d%4)&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],d=0;d>>2]|=(a.charCodeAt(d)&255)<<24-8*(d%4);return f.create(c,b)}},j=g.Utf8={stringify:function(a){try{return decodeURIComponent(escape(i.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data")}},parse:function(a){return i.parse(unescape(encodeURIComponent(a)))}},k=d.BufferedBlockAlgorithm=e.extend({reset:function(){this._data=f.create(),this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=j.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,d=c.words,e=c.sigBytes,g=this.blockSize,h=e/(4*g),h=b?a.ceil(h):a.max((h|0)-this._minBufferSize,0),b=h*g,e=a.min(4*b,e);if(b){for(var i=0;ik;k++){if(16>k)d[k]=a[b+k]|0;else{var l=d[k-3]^d[k-8]^d[k-14]^d[k-16];d[k]=l<<1|l>>>31}l=(e<<5|e>>>27)+j+d[k],l=20>k?l+((f&g|~f&i)+1518500249):40>k?l+((f^g^i)+1859775393):60>k?l+((f&g|f&i|g&i)-1894007588):l+((f^g^i)-899497514),j=i,i=g,g=f<<30|f>>>2,f=e,e=l}c[0]=c[0]+e|0,c[1]=c[1]+f|0,c[2]=c[2]+g|0,c[3]=c[3]+i|0,c[4]=c[4]+j|0},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;b[d>>>5]|=128<<24-d%32,b[(d+64>>>9<<4)+15]=c,a.sigBytes=4*b.length,this._process()}});a.SHA1=b._createHelper(e),a.HmacSHA1=b._createHmacHelper(e)})(),function(){var a=CryptoJS,b=a.lib,c=b.WordArray,d=a.enc,e=d.Base64={stringify:function(a){var b=a.words,c=a.sigBytes,d=this._map;a.clamp();var e=[];for(var f=0;f>>2]>>>24-f%4*8&255,h=b[f+1>>>2]>>>24-(f+1)%4*8&255,i=b[f+2>>>2]>>>24-(f+2)%4*8&255,j=g<<16|h<<8|i;for(var k=0;k<4&&f+k*.75>>6*(3-k)&63))}var l=d.charAt(64);if(l)while(e.length%4)e.push(l);return e.join("")},parse:function(a){a=a.replace(/\s/g,"");var b=a.length,d=this._map,e=d.charAt(64);if(e){var f=a.indexOf(e);f!=-1&&(b=f)}var g=[],h=0;for(var i=0;i>>6-i%4*2;g[h>>>2]|=(j|k)<<24-h%4*8,h++}return c.create(g,h)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(); diff --git a/build/tincan-node.js b/build/tincan-node.js index cda6767..4035cd4 100644 --- a/build/tincan-node.js +++ b/build/tincan-node.js @@ -2119,6 +2119,7 @@ TinCan client library }; compatibility["0.95"] = compatibility["0.9"]; + compatibility["1.0.1"] = compatibility["1.0.0"]; if (cfg.params.hasOwnProperty("target")) { cfg.params.object = cfg.params.target; diff --git a/build/tincan.js b/build/tincan.js index b92fd77..81efacf 100644 --- a/build/tincan.js +++ b/build/tincan.js @@ -2119,6 +2119,7 @@ TinCan client library }; compatibility["0.95"] = compatibility["0.9"]; + compatibility["1.0.1"] = compatibility["1.0.0"]; if (cfg.params.hasOwnProperty("target")) { cfg.params.object = cfg.params.target; diff --git a/package.json b/package.json index 7cf43e7..65cd8b2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "tincanjs", "description": "Tin Can API Library", - "version": "0.22.1", + "version": "0.22.2", "private": false, "main": "build/tincan-node.js", "directories": { diff --git a/src/LRS.js b/src/LRS.js index 0bb2a77..48f54ec 100644 --- a/src/LRS.js +++ b/src/LRS.js @@ -655,6 +655,7 @@ TinCan client library }; compatibility["0.95"] = compatibility["0.9"]; + compatibility["1.0.1"] = compatibility["1.0.0"]; if (cfg.params.hasOwnProperty("target")) { cfg.params.object = cfg.params.target; diff --git a/yuidoc.json b/yuidoc.json index 2427f4a..b234485 100644 --- a/yuidoc.json +++ b/yuidoc.json @@ -1,5 +1,5 @@ { - "version": "0.22.1", + "version": "0.22.2", "name": "TinCanJS", "description": "Library for working with Tin Can API in JavaScript", "url": "http://rusticisoftware.github.com/TinCanJS/",