Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add actor account support for 1.0.0 #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ <h1>Tin Can Statement Viewer</h1>
<label>Agent Property</label>
<select id="agentProperty">
<option value="mbox">mbox</option>
<option value="account">account</option>
</select>
</td>
<td><label>Agent Value</label><input id="agentValue" type="text" placeholder="Email Address"></td>
<td><label>Agent Value</label><input id="agentValue" type="text" placeholder="Email Address"><input id="agentAccountName" type="text" placeholder="Account Name"><input id="agentAccountHomePage" type="text" placeholder="Account HomePage"></td>
<td><label>Verb ID</label><input id="verb1" type="text" placeholder="Verb"></td>
<td><label>Activity ID</label><input id="activityId1" type="text" placeholder="Activity ID"></td>
</tr>
Expand Down
37 changes: 31 additions & 6 deletions scripts/TinCanViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line ends up being duplicated to avoid overly complex if conditions.

}
}

return agent;
Expand Down Expand Up @@ -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(),
Expand Down