# HG changeset patch # User Nicholas Jillings # Date 1509466918 0 # Node ID 6b95437ae6722b106700a3459bbabcaf4c273e37 # Parent e441e3d5c7e74a00c2ae4d9ed0578e5ed3525b6b Close #109 diff -r e441e3d5c7e7 -r 6b95437ae672 interfaces/ape.js --- a/interfaces/ape.js Tue Oct 31 15:55:07 2017 +0000 +++ b/interfaces/ape.js Tue Oct 31 16:21:58 2017 +0000 @@ -341,7 +341,7 @@ this.exportXMLDOM = function () { var node = storage.document.createElement('value'); node.setAttribute("interface-name", axisInterface.name) - node.textContent = this.value(); + node.textContent = this.value; return node; } this.error = function () { @@ -400,6 +400,9 @@ return label; }, "set": function () {} + }, + "metric": { + "value": metric } }); } @@ -558,6 +561,7 @@ UI.startTime = undefined; } this.handleEvent = function (event) { + var time = audioEngineContext.timer.getTestTime(); if (event.preventDefault) { event.preventDefault(); } @@ -570,12 +574,14 @@ move = Math.max(50, move); move = Math.min(w, move); UI.selected.value = (move / w); + UI.selected.metric.moved(time, UI.selected.value); } else if (event.type == "touchmove") { var move = event.originalEvent.targetTouches[0].clientX - 6; var w = $(event.currentTarget).width(); move = Math.max(50, move); move = Math.min(w, move); UI.selected.value = (move / w); + UI.selected.metric.moved(time, UI.selected.value); } } this.checkAllMoved = function () { diff -r e441e3d5c7e7 -r 6b95437ae672 js/core.js --- a/js/core.js Tue Oct 31 15:55:07 2017 +0000 +++ b/js/core.js Tue Oct 31 16:21:58 2017 +0000 @@ -2711,6 +2711,12 @@ this.textArea.style.width = boxwidth - 6 + "px"; }; this.resize(); + this.check = function () { + if (this.specification.mandatory && this.textArea.value.length == 0) { + return false; + } + return true; + } }; this.radioBox = function (commentQuestion) { @@ -2785,6 +2791,15 @@ } this.holder.style.width = boxwidth + "px"; }; + this.check = function () { + var anyChecked = this.options.some(function (a) { + return a.checked; + }); + if (this.specification.mandatory && anyChecked == false) { + return false; + } + return true; + } this.resize(); }; @@ -2851,6 +2866,15 @@ } this.holder.style.width = boxwidth + "px"; }; + this.check = function () { + var anyChecked = this.options.some(function (a) { + return a.checked; + }); + if (this.specification.mandatory && anyChecked == false) { + return false; + } + return true; + }; this.resize(); }; @@ -2908,6 +2932,9 @@ this.holder.style.width = boxwidth + "px"; this.slider.style.width = boxwidth - 24 + "px"; }; + this.check = function () { + return true; + } this.resize(); }; @@ -2930,6 +2957,19 @@ this.commentQuestions = []; }; + this.checkCommentQuestions = function () { + var errored = this.commentQuestions.reduce(function (a, cq) { + if (cq.check() == false) { + a.push(cq); + } + return a; + }, []); + if (errored.length == 0) { + return true; + } + interfaceContext.lightbox.post("Message", "Not all the mandatory comment boxes below have been filled."); + } + this.outsideReferenceDOM = function (audioObject, index, inject) { this.parent = audioObject; this.outsideReferenceHolder = document.createElement('button');