From 17ccf590265d9545f5fefc63997b8fcd02425eab Mon Sep 17 00:00:00 2001 From: Andrew Downes Date: Fri, 28 Apr 2017 13:38:13 +0100 Subject: [PATCH] Add actor account support for 1.0.0 --- index.html | 3 ++- scripts/TinCanViewer.js | 37 +++++++++++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index c94bee5..cfe28ac 100644 --- a/index.html +++ b/index.html @@ -58,9 +58,10 @@

Tin Can Statement Viewer

- + diff --git a/scripts/TinCanViewer.js b/scripts/TinCanViewer.js index 6c57de2..ebaf267 100644 --- a/scripts/TinCanViewer.js +++ b/scripts/TinCanViewer.js @@ -115,12 +115,21 @@ TINCAN.Viewer.prototype.TinCanSearchHelper = function () { var agent = null, agentCfg = {}, agentProperty = this.getSearchVar("agentProperty"), - agentValue = this.getSearchVar("agentValue"); - - if (agentProperty !== null && agentValue !== null) { - agentCfg[agentProperty] = agentValue; - - agent = new TinCan.Agent(agentCfg); + agentValue = this.getSearchVar("agentValue"), + agentAccountName = this.getSearchVar("agentAccountName"), + agentAccountHomePage = this.getSearchVar("agentAccountHomePage"); + + if (agentProperty !== null) { + if (agentProperty == 'account' && agentAccountHomePage !== null && agentAccountName !== null){ + agentCfg.account = { + name: agentAccountName, + homePage: agentAccountHomePage + }; + agent = new TinCan.Agent(agentCfg); + } else if (agentValue !== null) { + agentCfg[agentProperty] = agentValue; + agent = new TinCan.Agent(agentCfg); + } } return agent; @@ -776,6 +785,22 @@ TINCAN.Viewer.prototype.pageInitialize = function () { } ); + $("#agentAccountName").hide(); + $("#agentAccountHomePage").hide(); + $("#agentProperty").change( + function (e) { + if ($("#agentProperty").val() == 'mbox') { + $("#agentValue").show(); + $("#agentAccountName").hide(); + $("#agentAccountHomePage").hide(); + } else if ($("#agentProperty").val() == 'account') { + $("#agentValue").hide(); + $("#agentAccountName").show(); + $("#agentAccountHomePage").show(); + } + } + ); + $("#showAdvancedOptions").click( function () { var version = $("#version").val(),