Skip to content

Commit

Permalink
Merge pull request #1311 from torinfo/troy-features
Browse files Browse the repository at this point in the history
Troy features
  • Loading branch information
torinfo authored Aug 21, 2024
2 parents 02ce480 + 1276621 commit 4bb53d6
Show file tree
Hide file tree
Showing 36 changed files with 581 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ optional: feedback page synch play enable
}

// feedback if question has true/false answers
if (true) {
if (judge) {
var fb;
finishTracking(options);
if (options.answerType == "multiple" && options.type == "radio") {
Expand Down Expand Up @@ -165,6 +165,8 @@ optional: feedback page synch play enable


feedbackTxt += options[fb] != "" ? '<div class="feedback"><p>' + options[fb] + '</p></div>' : "";
}else {
finishTracking(options);
}

if (options.childNodes[index].getAttribute("enable") == "true" || (enable == true && ((options.childNodes[index].getAttribute("page") == undefined || options.childNodes[index].getAttribute("page") == "") && (options.childNodes[index].getAttribute("synch") == undefined || options.childNodes[index].getAttribute("synch") == "")))) {
Expand Down Expand Up @@ -233,6 +235,7 @@ optional: feedback page synch play enable

return {
_setup: function(options) {
console.log(options);
media = this;
let judgeOverride = options.judge?? "true";
judge = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3159,7 +3159,7 @@ function x_passwordPage(pswds) {
}else if(type == "vaultnumeric") {
$pswdBlock.find('.x_pswdInput').html('<div class="vault numeric"><div class="vault-door-frame"><div class="vault-door"></div></div></div>');
$pswdBlock.find('.vault-door')
.append('<input readonly type="text" id="x_pagePswd" name="x_pagePswd" style="grid-area: input;" aria-label="' + x_getLangInfo(x_languageData.find("password")[0], "label", "Password") + '">')
.append('<input type="text" id="x_pagePswd" name="x_pagePswd" style="grid-area: input;" aria-label="' + x_getLangInfo(x_languageData.find("password")[0], "label", "Password") + '">')
.append('<button class="numberbtn" style="grid-area: one;">1</button><button class="numberbtn" style="grid-area: two;">2</button><button class="numberbtn" style="grid-area: three;">3</button><button class="numberbtn" style="grid-area: four;">4</button><button class="numberbtn" style="grid-area: five;">5</button><button class="numberbtn" style="grid-area: six;">6</button><button class="numberbtn" style="grid-area: seven;">7</button><button class="numberbtn" style="grid-area: eight;">8</button><button class="numberbtn" style="grid-area: nine;">9</button><button class="numberbtn" style="grid-area: zero;">0</button><button id="resetbtn" style="grid-area: reset;">AC</button><button style="grid-area: unused;"> </button>')
.append('<button id="x_pagePswdBtn" style="grid-area: button;">' + (x_currentPageXML.getAttribute('passwordSubmit') != undefined && x_currentPageXML.getAttribute('passwordSubmit') != '' ? x_currentPageXML.getAttribute('passwordSubmit') : 'Submit') + '</button>');

Expand Down Expand Up @@ -4425,7 +4425,7 @@ function x_scaleImg(img, maxW, maxH, scale, firstScale, setH, enlarge) {
imgH = $img.data("origSize")[1];
}

if (enlarge != true) {
if (enlarge == false) {
maxW = Math.min(maxW, imgW);
maxH = Math.min(maxH, imgH);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,7 @@ function XTResults(fullcompletion) {
matchSub.correct = (learnerAnswer === correctAnswer);
matchSub.learnerAnswer = learnerAnswer;
matchSub.correctAnswer = correctAnswer;
matchSub.judge = (state.interactions[i].result != null && state.interactions[i].result != null.judge != null ? state.interactions[i].result != null.judge : true);
matchSub.judge = (state.interactions[i].result != null && state.interactions[i].result.judge != null ? state.interactions[i].result.judge : true);
judge &= matchSub.judge;
results.interactions[nrofquestions - 1].subinteractions.push(matchSub);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@

l_total++;
if ($this.data("category").is($this.parent()) || !l_judge) {
$this.html($this.html() + '<span class="tick"><span class="ui-helper-hidden-accessible">' + x_getLangInfo(x_languageData.find("tick")[0], "label", "Correct") + '</span><span class="fa fa-fw fa-x-tick"></span></span>');
if(l_judge) {
$this.html($this.html() + '<span class="tick"><span class="ui-helper-hidden-accessible">' + x_getLangInfo(x_languageData.find("tick")[0], "label", "Correct") + '</span><span class="fa fa-fw fa-x-tick"></span></span>');
}
l_feedback.push("correct");
l_option.result = true;
l_correct++;
Expand All @@ -99,9 +101,10 @@
}
l_options.push(l_option);
});

$("#scoreTxt").html(l_correct);
$("#totalTxt").html(this.totaloptions);
if(l_judge) {
$("#scoreTxt").html(l_correct);
$("#totalTxt").html(this.totaloptions);
}
$("#feedback").show();

var result = {
Expand All @@ -120,6 +123,11 @@
var correctOptions = [],
correctAnswer = [],
correctFeedback = [];
let judge = true;

if(x_currentPageXML.getAttribute("judge") != undefined && x_currentPageXML.getAttribute("judge") == 'false'){
judge = false;
}

this.checked = false;
// Track the quiz page
Expand All @@ -128,6 +136,9 @@
{
this.weighting = x_currentPageXML.getAttribute("trackingWeight");
}
if(x_currentPageXML.getAttribute("judge") != undefined && x_currentPageXML.getAttribute("judge") == 'false'){
this.weighting= 0.0;
}
XTSetPageType(x_currentPage, 'numeric', 1, this.weighting);


Expand All @@ -143,12 +154,14 @@
.html(x_addLineBreaks(x_currentPageXML.getAttribute("text")))
.addClass("transparent"); /* without the text having a bg the labels strangely aren't selectable in IE */

var $feedback = $("#feedback");
var $feedback= $("#feedback");
if (x_currentPageXML.getAttribute("feedback") != undefined && x_currentPageXML.getAttribute("feedback") != "") {
$feedback.html(x_addLineBreaks(x_currentPageXML.getAttribute("feedback")));
}
if (x_currentPageXML.getAttribute("feedbackScore") != undefined && x_currentPageXML.getAttribute("feedbackScore") != "") {
$feedback.append('<p>' + x_addLineBreaks(x_currentPageXML.getAttribute("feedbackScore").replace("{i}", '<span id="scoreTxt"></span>').replace("{n}", '<span id="totalTxt"></span>')) + '</p>');
if(judge) {
$feedback.append('<p>' + x_addLineBreaks(x_currentPageXML.getAttribute("feedbackScore").replace("{i}", '<span id="scoreTxt"></span>').replace("{n}", '<span id="totalTxt"></span>')) + '</p>');
}
} else if ($feedback.html().length == 0) {
$feedback.remove();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
{
this.weighting = x_currentPageXML.getAttribute("trackingWeight");
}
if(x_currentPageXML.getAttribute("judge") != undefined && x_currentPageXML.getAttribute("judge") == 'false'){
this.weighting= 0.0;
}

XTSetPageType(x_currentPage, 'numeric', $(x_currentPageXML).children().length, this.weighting);
var panelWidth = x_currentPageXML.getAttribute("panelWidth");
Expand Down Expand Up @@ -207,10 +210,11 @@
$thisInput
.val($.trim($thisInput.val()))
.prop("readonly", true);

$thisInput.parent().find(".result")
.removeClass("hidden")
.parent().find(".tickTxt").html(tick);
if(judge) {
$thisInput.parent().find(".result")
.removeClass("hidden")
.parent().find(".tickTxt").html(tick);
}

$feedback.html("");
$this.focus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

var pageIndex = 0;

this.weighting = 1.0;
this.weighting = 0.0;
if (x_currentPageXML.getAttribute("trackingWeight") != undefined)
{
this.weighting = x_currentPageXML.getAttribute("trackingWeight");
Expand Down Expand Up @@ -262,9 +262,15 @@
}

// Add download button
var $finishBtn = $('<button id="downloadBtn">');
var $downloadBtn = $('<button id="downloadBtn">');
var $submitBtn = $('<button id="submitBtn">');
var $finishSection = $('<div class="item"/>');
$finishBtn.appendTo($finishSection);
if(x_currentPageXML.getAttribute("showDownload") != "false"){
$downloadBtn.appendTo($finishSection);
}
if(x_currentPageXML.getAttribute("track") == "true"){
$submitBtn.appendTo($finishSection);
}
if (x_currentPageXML.getAttribute('download') && x_currentPageXML.getAttribute('download') == 'extra') {
$page = $('<div>')
.attr('id', 'page' + pageIndex)
Expand All @@ -278,20 +284,21 @@
}

if (x_currentPageXML.getAttribute('instructions') && x_currentPageXML.getAttribute('instructions') != "") {
$('<p>'+ x_currentPageXML.getAttribute('instructions') + '</p>').insertBefore($finishBtn);
$('<p>'+ x_currentPageXML.getAttribute('instructions') + '</p>').insertBefore($downloadBtn);
}

$("#pageContents").data("numPages", $("#pages").children(".page").length);


if(x_currentPageXML.getAttribute("track") == "true"){
$finishBtn.button({
label: x_currentPageXML.getAttribute('downloadTxt') != undefined ? x_currentPageXML.getAttribute('downloadTxt') : "Submit"
$submitBtn.button({
label: x_currentPageXML.getAttribute('submitTxt') != undefined ? x_currentPageXML.getAttribute('submitTxt') : "Submit"
}).click(function () {
documentation.track();
});
} else {
$finishBtn.button({
}
if(x_currentPageXML.getAttribute("showDownload") != "false"){
$downloadBtn.button({
icons: {
primary: "fa fa-x-download"
},
Expand Down Expand Up @@ -811,7 +818,7 @@
if (documentation.checkRequired(currentPage)) {
documentation.sendToXAPI($("#pageContents").data("docData"));
}
$("#downloadBtn").hide().prev().hide();
$("#submitBtn").hide();
}

this.showPage = function (page) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@
}

/* add ticks to correct answers */
#targetHolder input[readonly].correct+span:before, #targetHolder input[correct]+span:before, #targetHolder .target.correct+span:before, #targetHolder select[disabled].correct+span:before {
#targetHolder input[readonly].judged.correct+span:before, #targetHolder input[correct].judged+span:before, #targetHolder .target.correct+span:before, #targetHolder select[disabled].correct+span:before {
font-family: FontAwesome;
content: "\f00c";
color: green;
margin-left:1px;
}

/*gap fill: show red crosses when incorrect and in tracking mode*/
#targetHolder select[disabled]+span:before, #targetHolder .target.incorrect+span:before, #pageContents input[readonly]+span:before{
#targetHolder select[disabled]+span:before, #targetHolder .target.incorrect+span:before, #pageContents input[readonly].judeged+span:before{
font-family: FontAwesome;
content: "\f00d";
color: red;
Expand Down Expand Up @@ -206,4 +206,4 @@
#x_mainHolder.x_responsive #labelHolder .label {
font-size: 2vmin;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,11 @@

if ((x_currentPageXML.getAttribute("markEnd") == undefined || x_currentPageXML.getAttribute("markEnd") == "false") && !this.isTracked) {
$("#submitBtn, #showBtn").remove();

let judge = true;
if(x_currentPageXML.getAttribute("judge") != undefined && x_currentPageXML.getAttribute("judge") == 'false'){
judge = false;
}

$targetHolder.find("input")
.addClass("incorrect")
.on("keypress", function() {
Expand All @@ -477,11 +481,13 @@

setTimeout(function() {
var currvalue = !casesensitive ? $this.val().trim().toLowerCase() : $this.val().trim();
if (answerData[$this.data("index")].indexOf(currvalue) != -1) { // correct
if (answerData[$this.data("index")].indexOf(currvalue) != -1 || !judge) { // correct
$this
.attr("readonly", "readonly")
.addClass("correct")
.removeClass("incorrect");
if(judge){
$this.attr("readonly", "readonly");
}

$pageContents.find("#hint").remove();

Expand Down Expand Up @@ -1220,10 +1226,15 @@
var correct = false;
var answer = currvalue;

if(judge){
$this.addClass("judged");
}
if ((answerData.length > 0 && answerData[$this.data("index")].indexOf(currvalue) != -1) || !judge) { // correct
$this.attr("readonly", "readonly");
$this.attr("correct", "correct");
$this.addClass("correct");
if(judge) {
$this.addClass("correct");
}
feedback = "Correct";
correct = true;
correct_answers++;
Expand Down Expand Up @@ -1357,7 +1368,6 @@
$(this).width($(this).data("width"));
}
});

$incorrectTargets
.html("")
.focusin(targetFocusIn)
Expand All @@ -1379,6 +1389,8 @@
.focusout(labelFocusOut)
.keypress(labelKeyPress)
.click(labelClick)
.data("prevHolder", null)
.data("dragged", false)
.css({
"opacity": 1,
"left": "auto",
Expand Down Expand Up @@ -1439,6 +1451,9 @@
{
this.weighting = x_currentPageXML.getAttribute("trackingWeight");
}
if(x_currentPageXML.getAttribute("judge") != undefined && x_currentPageXML.getAttribute("judge") == 'false'){
this.weighting= 0.0;
}
if (x_currentPageXML.getAttribute("interactivity") !== "Drag Drop") // text fill in blank or drop down
{
XTSetPageType(x_currentPage, 'numeric', answerData.length, this.weighting);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@
l_option = {source: $this.text().trim(),target: "[" + xPos + "," + yPos + "]"};

if ($this.data("correct") == $this.index() || labelData[$("#grid .listHolder").index($this.parents(".listHolder"))][$this.index()] == $this.html() || !judge) {
$this.append('<span class="tick"><span class="ui-helper-hidden-accessible">' + x_getLangInfo(x_languageData.find("tick")[0], "label", "Correct") + '</span><span class="result fa fa-fw fa-x-tick"></span></span>');
if(judge) {
$this.append('<span class="tick"><span class="ui-helper-hidden-accessible">' + x_getLangInfo(x_languageData.find("tick")[0], "label", "Correct") + '</span><span class="result fa fa-fw fa-x-tick"></span></span>');
}
numOfQuestions++;
correct++;
l_option.result = true;
Expand Down Expand Up @@ -1174,6 +1176,9 @@
{
this.weighting = x_currentPageXML.getAttribute("trackingWeight");
}
if(x_currentPageXML.getAttribute("judge") != undefined && x_currentPageXML.getAttribute("judge") == 'false'){
this.weighting= 0.0;
}

correctOptions = [];
correctAnswer = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
transform: translate(-50%,-50%);
}

.holder{
position: absolute;
/*height: calc(100% - 20px);*/
/*width: calc(100% - 20px);*/
top: 10px;
right: 10px;
}

#slider_handle{
background: grey;
position: relative;
}

.image{
position: absolute;
}
Expand All @@ -24,6 +37,20 @@
height: 100%;
}

#slider_handle.horizontal{
width: 20px;
height: 10%;
top: 45%;
right: 5px;
}

#slider_handle.vertical{
width: 10%;
height: 20px;
left: 45%;
bottom: 5px;
}

#slider.vertical{
width: 100%;
height: 10px;
Expand Down
Loading

0 comments on commit 4bb53d6

Please sign in to comment.