From f6855492dc9200a0b3995f63597f8e1f7a1ab6d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christophe=20No=C3=ABl?= Date: Mon, 21 Mar 2016 14:21:21 +0100 Subject: [PATCH] compile js --- views/js/controllers.min.js | 301 ++++++++++-------- views/js/controllers.min.js.map | 2 +- views/js/runtime/qtiBootstrap.min.js | 389 ++++++++++++----------- views/js/runtime/qtiBootstrap.min.js.map | 2 +- 4 files changed, 368 insertions(+), 326 deletions(-) diff --git a/views/js/controllers.min.js b/views/js/controllers.min.js index d2cade5626..8e1cc70796 100644 --- a/views/js/controllers.min.js +++ b/views/js/controllers.min.js @@ -732,29 +732,30 @@ fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stac "use strict";return{qtiClass:"simpleChoice.choiceInteraction",getContainer:containerHelper.get,getData:function(choice,data){return data.unique=1===parseInt(data.interaction.attributes.maxChoices),data},template:tpl}}),define("taoQtiItem/qtiCreator/widgets/choices/simpleChoice/states/states",["taoQtiItem/qtiCreator/widgets/states/factory","taoQtiItem/qtiCreator/widgets/choices/states/states","taoQtiItem/qtiCreator/widgets/choices/simpleChoice/states/Choice"],function(factory,states){return factory.createBundle(states,arguments)}),define("taoQtiItem/qtiCreator/widgets/choices/simpleChoice/Widget",["taoQtiItem/qtiCreator/widgets/choices/Widget","taoQtiItem/qtiCreator/widgets/choices/simpleChoice/states/states"],function(Widget,states){ var SimpleChoiceWidget=Widget.clone();return SimpleChoiceWidget.initCreator=function(){Widget.initCreator.call(this),this.registerStates(states);var $realLabel=this.$container.find(".real-label");$realLabel.children("input").attr("disabled","disabled")},SimpleChoiceWidget}),define("taoQtiItem/qtiCreator/renderers/choices/SimpleChoice.ChoiceInteraction",["lodash","taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleChoice.ChoiceInteraction","taoQtiItem/qtiCreator/widgets/choices/simpleChoice/Widget"],function(_,SimpleChoice,SimpleChoiceWidget){"use strict";var CreatorSimpleChoice=_.clone(SimpleChoice);return CreatorSimpleChoice.render=function(choice,options){ SimpleChoiceWidget.build(choice,SimpleChoice.getContainer(choice),this.getOption("choiceOptionForm"),options)},CreatorSimpleChoice}),define("taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleChoice.OrderInteraction",["tpl!taoQtiItem/qtiCommonRenderer/tpl/choices/choice","taoQtiItem/qtiCommonRenderer/helpers/container"],function(tpl,containerHelper){"use strict";return{qtiClass:"simpleChoice.orderInteraction",getContainer:containerHelper.get,template:tpl}}),define("taoQtiItem/qtiCreator/renderers/choices/SimpleChoice.OrderInteraction",["lodash","taoQtiItem/qtiCommonRenderer/renderers/choices/SimpleChoice.OrderInteraction","taoQtiItem/qtiCreator/widgets/choices/simpleChoice/Widget"],function(_,SimpleChoice,SimpleChoiceWidget){ -"use strict";var CreatorSimpleChoice=_.clone(SimpleChoice);return CreatorSimpleChoice.render=function(choice,options){SimpleChoiceWidget.build(choice,SimpleChoice.getContainer(choice),this.getOption("choiceOptionForm"),options)},CreatorSimpleChoice}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/associateInteraction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper), -stack1||0===stack1?stack1:""}function program3(depth0,data){var stack1;return stack1=typeof depth0===functionType?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing;return buffer+='
\n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
\n \n \n
\n
'})}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/associateInteraction.pair",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){return"incomplete-pair"}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,buffer="",self=this; -return buffer+='
  • \n
    \n
    \n
  • \n'})}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/instruction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression;return buffer+='
    \n ',(helper=helpers.message)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.message,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\n
    "})}),define("taoQtiItem/qtiCommonRenderer/helpers/instructions/Instruction",["lodash","taoQtiItem/qtiItem/helper/util","tpl!taoQtiItem/qtiCommonRenderer/tpl/instruction"],function(_,util,instructionTpl){ -var _notificationLevels=["info","warning","error","success"],Instruction=function(interaction,message,callback){this.interaction=interaction,this.defaultMessage=message||"",this.currentMessage="",this.level="info",this.serial=util.buildSerial("instruction_"),this.callback=callback,this.$dom=null,this.state=!1};return Instruction.isValidLevel=function(level){return _.indexOf(_notificationLevels,level)>=0},Instruction.prototype.setState=function(state){this.state=state},Instruction.prototype.checkState=function(state){return this.state===state},Instruction.prototype.getId=function(){return this.serial},Instruction.prototype.create=function($container){$container.append(instructionTpl({ -message:this.defaultMessage,serial:this.serial})),this.$dom=$container.find("#"+this.serial)},Instruction.prototype.update=function(options){var level=options&&options.level?options.level:"",message=options&&options.message?options.message:"",timeout=options&&options.timeout?options.timeout:0,start=options&&"function"==typeof options.start?options.start:null,stop=options&&"function"==typeof options.stop?options.stop:null;if(level&&Instruction.isValidLevel(level)&&(this.$dom.removeClass("feedback-"+this.level).addClass("feedback-"+level),this.$dom.find(".icon").removeClass("icon-"+this.level).addClass("icon-"+level),this.level=level),message&&(this.$dom.find(".instruction-message").html(message), -this.currentMessage=message),timeout){var _this=this;start&&start.call(_this),_this.timer=setTimeout(function(){stop&&stop.call(_this),_this.timer=null},timeout)}},Instruction.prototype.setLevel=function(level,timeout){var options={level:level};timeout&&(options.timeout=parseInt(timeout),options.stop=function(){this.setLevel("info")}),this.update(options)},Instruction.prototype.getLevel=function(){return this.level},Instruction.prototype.setMessage=function(message,timeout){this.update({message:message,timeout:timeout})},Instruction.prototype.reset=function(){this.update({level:"info",message:this.defaultMessage}),this.state=!1},Instruction.prototype.validate=function(data){ -"function"==typeof this.callback&&this.callback.call(this,data)},Instruction}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/notification",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",functionType="function",escapeExpression=this.escapeExpression,helperMissing=helpers.helperMissing;return buffer+='
    \n \n \n
    \n'})}),define("taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager",["lodash","jquery","i18n","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/Instruction","tpl!taoQtiItem/qtiCommonRenderer/tpl/notification"],function(_,$,__,containerHelper,Instruction,notifTpl){"use strict";var _instructions={},instructionManager={validateInstructions:function(element,data){var serial=element.getSerial();_instructions[serial]&&_.each(_instructions[serial],function(instruction){ -instruction.validate(data||{})})},appendInstruction:function(element,message,validateCallback){var serial=element.getSerial(),instruction=new Instruction(element,message,validateCallback);return _instructions[serial]||(_instructions[serial]={}),_instructions[serial][instruction.getId()]=instruction,instruction.create($(".instruction-container",containerHelper.get(element))),instruction},removeInstructions:function(element){_instructions[element.getSerial()]={},containerHelper.get(element).find(".instruction-container").empty()},resetInstructions:function(element){var serial=element.getSerial();_instructions[serial]&&_.each(_instructions[serial],function(instruction){ -instruction.reset()})},minMaxChoiceInstructions:function(interaction,options){var msg,self=this,min=options.min||0,max=options.max||0,getResponse=options.getResponse,onError=options.onError||_.noop(),choiceCount=options.choiceCount===!1?!1:_.size(interaction.getChoices()),minInstructionSet=!1;if(!_.isFunction(getResponse))throw"invalid parameter getResponse";max>0&&(choiceCount===!1||choiceCount>max)&&(max===min?(minInstructionSet=!0,msg=1>=max?__("You must select exactly %d choice",max):__("You must select exactly %d choices",max),self.appendInstruction(interaction,msg,function(data){getResponse(interaction).length>=max?(this.setLevel("success"),this.checkState("fulfilled")&&this.update({ -level:"warning",message:__("Maximum choices reached"),timeout:2e3,start:function(){onError(data)},stop:function(){this.update({level:"success",message:msg})}}),this.setState("fulfilled")):this.reset()})):max>min&&(msg=1>=max?__("You can select maximum %d choice",max):__("You can select maximum %d choices",max),self.appendInstruction(interaction,msg,function(data){getResponse(interaction).length>=max?(this.setLevel("success"),this.setMessage(__("Maximum choices reached")),this.checkState("fulfilled")&&this.update({level:"warning",timeout:2e3,start:function(){onError(data)},stop:function(){this.setLevel("info")}}),this.setState("fulfilled")):this.reset()}))),!minInstructionSet&&min>0&&(choiceCount===!1||choiceCount>min)&&(msg=1>=min?__("You must at least %d choice",min):__("You must select at least %d choices",max), -self.appendInstruction(interaction,msg,function(){getResponse(interaction).length>=min?this.setLevel("success"):this.reset()}))},appendNotification:function(element,message,level){if(level=level||"info",Instruction.isValidLevel(level)){var $container=containerHelper.get(element);$container.find(".notification-container").prepend(notifTpl({level:level,message:message}));var $notif=$container.find(".item-notification:first"),_remove=function(){$notif.fadeOut()};return $notif.find(".close-trigger").on("click",_remove),setTimeout(_remove,2e3),$notif}},removeNotifications:function(element){containerHelper.get(element).find(".item-notification").remove()}};return instructionManager; -}),define("taoQtiItem/qtiCommonRenderer/helpers/PciPrettyPrint",["lodash"],function(_){"use strict";function printBase(value,withType){var print="",base=value.base;return withType="undefined"!=typeof withType?withType:!0,base?(_.forIn(_formatters,function(formatter,baseType){return void 0!==base[baseType]?(print+=withType?"("+baseType+") ":"",print+=formatter(base[baseType]),!1):void 0}),print):void 0}function printList(value,withType){var print="",list=value.list;return withType="undefined"!=typeof withType?withType:!0,list?(_.forIn(_formatters,function(formatter,baseType){return void 0!==list[baseType]?(print+=withType?"("+baseType+") ":"",print+="[",_.each(list[baseType],function(value){ -print+=formatter(value)+", "}),_.size(list[baseType])&&(print=print.substring(0,print.length-2)),print+="]",!1):void 0}),print):void 0}function printRecord(value){return value&&value.record?"(record) "+JSON.stringify(value.record):""}var _formatters={"boolean":function(value){return value?"true":"false"},integer:function(value){return value},"float":function(value){return value},string:function(value){return""===value?"NULL":'"'+value+'"'},point:function(value){return"["+value[0]+", "+value[1]+"]"},pair:function(value){return"["+value[0]+", "+value[1]+"]"},directedPair:function(value){return"["+value[0]+", "+value[1]+"]"},duration:function(value){return value; -},file:function(value){return"binary data"},uri:function(value){return value},intOrIdentifier:function(value){return value},identifier:function(value){return value}};return{printBase:printBase,printList:printList,printRecord:printRecord}}),define("taoQtiItem/qtiCommonRenderer/helpers/PciResponse",["lodash","taoQtiItem/qtiCommonRenderer/helpers/PciPrettyPrint"],function(_,pciPrettyPrint){"use strict";var _qtiModelPciResponseCardinalities={single:"base",multiple:"list",ordered:"list",record:"record"};return{unserialize:function(response,interaction){var mappedCardinality,ret=[],responseDeclaration=interaction.getResponseDeclaration(),baseType=responseDeclaration.attr("baseType"),cardinality=responseDeclaration.attr("cardinality"); -if(!_qtiModelPciResponseCardinalities[cardinality])throw"unknown cardinality in the responseDeclaration of the interaction";mappedCardinality=_qtiModelPciResponseCardinalities[cardinality];var responseValues=response[mappedCardinality];if(null===responseValues)ret=[];else{if(!_.isObject(responseValues))throw"invalid response cardinality, expected "+cardinality+" ("+mappedCardinality+")";if(void 0===responseValues[baseType])throw"invalid response baseType";ret=responseValues[baseType],ret=_.isArray(ret)?ret:[ret]}return ret},serialize:function(responseValues,interaction){if(!_.isArray(responseValues))throw"invalid argument : responseValues must be an Array";var mappedCardinality,response={},responseDeclaration=interaction.getResponseDeclaration(),baseType=responseDeclaration.attr("baseType"),cardinality=responseDeclaration.attr("cardinality"); -if(!_qtiModelPciResponseCardinalities[cardinality])throw"unknown cardinality in the responseDeclaration of the interaction";return mappedCardinality=_qtiModelPciResponseCardinalities[cardinality],"base"===mappedCardinality?0===responseValues.length?response.base=null:(response.base={},response.base[baseType]=responseValues[0]):(response[mappedCardinality]={},response[mappedCardinality][baseType]=responseValues),response},isEmpty:function(response){return null===response||_.isEmpty(response)||null===response.base||_.isArray(response.list)&&_.isEmpty(response.list)||_.isArray(response.record)&&_.isEmpty(response.record)},prettyPrint:function(response){var print=""; -if("undefined"!=typeof response.base)print+=pciPrettyPrint.printBase(response,!0);else if("undefined"!=typeof response.list)print+=pciPrettyPrint.printList(response,!0);else{if("undefined"==typeof response.record)throw"Not a valid PCI JSON Response";print+=pciPrettyPrint.printRecord(response,!0)}return print}}}),define("taoQtiItem/qtiCommonRenderer/helpers/sizeAdapter",["jquery","lodash","util/adaptSize","ui/waitForMedia"],function($,_,adaptSize,waitForMedia){"use strict";return{adaptSize:function(target){var $elements,$container;switch(!0){case"undefined"!=typeof target.$container:$elements=target.$container.find(".add-option, .result-area .target, .choice-area .qti-choice"), -$container=target.$container;break;default:$elements=target,$container=$($elements).first().parent()}$container.waitForMedia(function(){adaptSize.height($elements)})}}}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/AssociateInteraction",["jquery","lodash","i18n","core/promise","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/associateInteraction","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/associateInteraction.pair","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/sizeAdapter"],function($,_,__,Promise,tpl,pairTpl,containerHelper,instructionMgr,pciResponse,sizeAdapter){ +"use strict";var CreatorSimpleChoice=_.clone(SimpleChoice);return CreatorSimpleChoice.render=function(choice,options){SimpleChoiceWidget.build(choice,SimpleChoice.getContainer(choice),this.getOption("choiceOptionForm"),options)},CreatorSimpleChoice}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/associateInteraction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,buffer="";return buffer+='id="'+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1.id,typeof stack1===functionType?stack1.apply(depth0):stack1))+'"'}function program3(depth0,data){ +var stack1,buffer="";return buffer+=" "+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1["class"],typeof stack1===functionType?stack1.apply(depth0):stack1))}function program5(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program7(depth0,data){var stack1;return stack1=typeof depth0===functionType?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers), +data=data||{};var stack1,helper,options,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing;return buffer+="
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
    \n \n \n
    \n
    \n'})}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/associateInteraction.pair",["handlebars"],function(hb){ +return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){return"incomplete-pair"}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,buffer="",self=this;return buffer+='
  • \n
    \n
    \n
  • \n'})}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/instruction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){ +this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression;return buffer+='
    \n ',(helper=helpers.message)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.message,stack1=typeof helper===functionType?helper.call(depth0,{ +hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+"\n
    "})}),define("taoQtiItem/qtiCommonRenderer/helpers/instructions/Instruction",["lodash","taoQtiItem/qtiItem/helper/util","tpl!taoQtiItem/qtiCommonRenderer/tpl/instruction"],function(_,util,instructionTpl){var _notificationLevels=["info","warning","error","success"],Instruction=function(interaction,message,callback){this.interaction=interaction,this.defaultMessage=message||"",this.currentMessage="",this.level="info",this.serial=util.buildSerial("instruction_"),this.callback=callback,this.$dom=null,this.state=!1};return Instruction.isValidLevel=function(level){return _.indexOf(_notificationLevels,level)>=0; +},Instruction.prototype.setState=function(state){this.state=state},Instruction.prototype.checkState=function(state){return this.state===state},Instruction.prototype.getId=function(){return this.serial},Instruction.prototype.create=function($container){$container.append(instructionTpl({message:this.defaultMessage,serial:this.serial})),this.$dom=$container.find("#"+this.serial)},Instruction.prototype.update=function(options){var level=options&&options.level?options.level:"",message=options&&options.message?options.message:"",timeout=options&&options.timeout?options.timeout:0,start=options&&"function"==typeof options.start?options.start:null,stop=options&&"function"==typeof options.stop?options.stop:null; +if(level&&Instruction.isValidLevel(level)&&(this.$dom.removeClass("feedback-"+this.level).addClass("feedback-"+level),this.$dom.find(".icon").removeClass("icon-"+this.level).addClass("icon-"+level),this.level=level),message&&(this.$dom.find(".instruction-message").html(message),this.currentMessage=message),timeout){var _this=this;start&&start.call(_this),_this.timer=setTimeout(function(){stop&&stop.call(_this),_this.timer=null},timeout)}},Instruction.prototype.setLevel=function(level,timeout){var options={level:level};timeout&&(options.timeout=parseInt(timeout),options.stop=function(){this.setLevel("info")}),this.update(options)},Instruction.prototype.getLevel=function(){ +return this.level},Instruction.prototype.setMessage=function(message,timeout){this.update({message:message,timeout:timeout})},Instruction.prototype.reset=function(){this.update({level:"info",message:this.defaultMessage}),this.state=!1},Instruction.prototype.validate=function(data){"function"==typeof this.callback&&this.callback.call(this,data)},Instruction}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/notification",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",functionType="function",escapeExpression=this.escapeExpression,helperMissing=helpers.helperMissing; +return buffer+='
    \n \n \n
    \n'})}),define("taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager",["lodash","jquery","i18n","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/Instruction","tpl!taoQtiItem/qtiCommonRenderer/tpl/notification"],function(_,$,__,containerHelper,Instruction,notifTpl){ +"use strict";var _instructions={},instructionManager={validateInstructions:function(element,data){var serial=element.getSerial();_instructions[serial]&&_.each(_instructions[serial],function(instruction){instruction.validate(data||{})})},appendInstruction:function(element,message,validateCallback){var serial=element.getSerial(),instruction=new Instruction(element,message,validateCallback);return _instructions[serial]||(_instructions[serial]={}),_instructions[serial][instruction.getId()]=instruction,instruction.create($(".instruction-container",containerHelper.get(element))),instruction},removeInstructions:function(element){_instructions[element.getSerial()]={}, +containerHelper.get(element).find(".instruction-container").empty()},resetInstructions:function(element){var serial=element.getSerial();_instructions[serial]&&_.each(_instructions[serial],function(instruction){instruction.reset()})},minMaxChoiceInstructions:function(interaction,options){var msg,self=this,min=options.min||0,max=options.max||0,getResponse=options.getResponse,onError=options.onError||_.noop(),choiceCount=options.choiceCount===!1?!1:_.size(interaction.getChoices()),minInstructionSet=!1;if(!_.isFunction(getResponse))throw"invalid parameter getResponse";max>0&&(choiceCount===!1||choiceCount>max)&&(max===min?(minInstructionSet=!0,msg=1>=max?__("You must select exactly %d choice",max):__("You must select exactly %d choices",max), +self.appendInstruction(interaction,msg,function(data){getResponse(interaction).length>=max?(this.setLevel("success"),this.checkState("fulfilled")&&this.update({level:"warning",message:__("Maximum choices reached"),timeout:2e3,start:function(){onError(data)},stop:function(){this.update({level:"success",message:msg})}}),this.setState("fulfilled")):this.reset()})):max>min&&(msg=1>=max?__("You can select maximum %d choice",max):__("You can select maximum %d choices",max),self.appendInstruction(interaction,msg,function(data){getResponse(interaction).length>=max?(this.setLevel("success"),this.setMessage(__("Maximum choices reached")),this.checkState("fulfilled")&&this.update({ +level:"warning",timeout:2e3,start:function(){onError(data)},stop:function(){this.setLevel("info")}}),this.setState("fulfilled")):this.reset()}))),!minInstructionSet&&min>0&&(choiceCount===!1||choiceCount>min)&&(msg=1>=min?__("You must at least %d choice",min):__("You must select at least %d choices",max),self.appendInstruction(interaction,msg,function(){getResponse(interaction).length>=min?this.setLevel("success"):this.reset()}))},appendNotification:function(element,message,level){if(level=level||"info",Instruction.isValidLevel(level)){var $container=containerHelper.get(element);$container.find(".notification-container").prepend(notifTpl({level:level,message:message +}));var $notif=$container.find(".item-notification:first"),_remove=function(){$notif.fadeOut()};return $notif.find(".close-trigger").on("click",_remove),setTimeout(_remove,2e3),$notif}},removeNotifications:function(element){containerHelper.get(element).find(".item-notification").remove()}};return instructionManager}),define("taoQtiItem/qtiCommonRenderer/helpers/PciPrettyPrint",["lodash"],function(_){"use strict";function printBase(value,withType){var print="",base=value.base;return withType="undefined"!=typeof withType?withType:!0,base?(_.forIn(_formatters,function(formatter,baseType){return void 0!==base[baseType]?(print+=withType?"("+baseType+") ":"",print+=formatter(base[baseType]), +!1):void 0}),print):void 0}function printList(value,withType){var print="",list=value.list;return withType="undefined"!=typeof withType?withType:!0,list?(_.forIn(_formatters,function(formatter,baseType){return void 0!==list[baseType]?(print+=withType?"("+baseType+") ":"",print+="[",_.each(list[baseType],function(value){print+=formatter(value)+", "}),_.size(list[baseType])&&(print=print.substring(0,print.length-2)),print+="]",!1):void 0}),print):void 0}function printRecord(value){return value&&value.record?"(record) "+JSON.stringify(value.record):""}var _formatters={"boolean":function(value){return value?"true":"false"},integer:function(value){return value},"float":function(value){ +return value},string:function(value){return""===value?"NULL":'"'+value+'"'},point:function(value){return"["+value[0]+", "+value[1]+"]"},pair:function(value){return"["+value[0]+", "+value[1]+"]"},directedPair:function(value){return"["+value[0]+", "+value[1]+"]"},duration:function(value){return value},file:function(value){return"binary data"},uri:function(value){return value},intOrIdentifier:function(value){return value},identifier:function(value){return value}};return{printBase:printBase,printList:printList,printRecord:printRecord}}),define("taoQtiItem/qtiCommonRenderer/helpers/PciResponse",["lodash","taoQtiItem/qtiCommonRenderer/helpers/PciPrettyPrint"],function(_,pciPrettyPrint){ +"use strict";var _qtiModelPciResponseCardinalities={single:"base",multiple:"list",ordered:"list",record:"record"};return{unserialize:function(response,interaction){var mappedCardinality,ret=[],responseDeclaration=interaction.getResponseDeclaration(),baseType=responseDeclaration.attr("baseType"),cardinality=responseDeclaration.attr("cardinality");if(!_qtiModelPciResponseCardinalities[cardinality])throw"unknown cardinality in the responseDeclaration of the interaction";mappedCardinality=_qtiModelPciResponseCardinalities[cardinality];var responseValues=response[mappedCardinality];if(null===responseValues)ret=[];else{if(!_.isObject(responseValues))throw"invalid response cardinality, expected "+cardinality+" ("+mappedCardinality+")"; +if(void 0===responseValues[baseType])throw"invalid response baseType";ret=responseValues[baseType],ret=_.isArray(ret)?ret:[ret]}return ret},serialize:function(responseValues,interaction){if(!_.isArray(responseValues))throw"invalid argument : responseValues must be an Array";var mappedCardinality,response={},responseDeclaration=interaction.getResponseDeclaration(),baseType=responseDeclaration.attr("baseType"),cardinality=responseDeclaration.attr("cardinality");if(!_qtiModelPciResponseCardinalities[cardinality])throw"unknown cardinality in the responseDeclaration of the interaction";return mappedCardinality=_qtiModelPciResponseCardinalities[cardinality],"base"===mappedCardinality?0===responseValues.length?response.base=null:(response.base={}, +response.base[baseType]=responseValues[0]):(response[mappedCardinality]={},response[mappedCardinality][baseType]=responseValues),response},isEmpty:function(response){return null===response||_.isEmpty(response)||null===response.base||_.isArray(response.list)&&_.isEmpty(response.list)||_.isArray(response.record)&&_.isEmpty(response.record)},prettyPrint:function(response){var print="";if("undefined"!=typeof response.base)print+=pciPrettyPrint.printBase(response,!0);else if("undefined"!=typeof response.list)print+=pciPrettyPrint.printList(response,!0);else{if("undefined"==typeof response.record)throw"Not a valid PCI JSON Response";print+=pciPrettyPrint.printRecord(response,!0); +}return print}}}),define("taoQtiItem/qtiCommonRenderer/helpers/sizeAdapter",["jquery","lodash","util/adaptSize","ui/waitForMedia"],function($,_,adaptSize,waitForMedia){"use strict";return{adaptSize:function(target){var $elements,$container;switch(!0){case"undefined"!=typeof target.$container:$elements=target.$container.find(".add-option, .result-area .target, .choice-area .qti-choice"),$container=target.$container;break;default:$elements=target,$container=$($elements).first().parent()}$container.waitForMedia(function(){adaptSize.height($elements)})}}}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/AssociateInteraction",["jquery","lodash","i18n","core/promise","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/associateInteraction","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/associateInteraction.pair","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/sizeAdapter"],function($,_,__,Promise,tpl,pairTpl,containerHelper,instructionMgr,pciResponse,sizeAdapter){ "use strict";var setChoice=function(interaction,$choice,$target){var $container=containerHelper.get(interaction),choiceSerial=$choice.data("serial"),usage=$choice.data("usage")||0,choice=interaction.getChoice(choiceSerial);if(!choiceSerial)throw"empty choice serial";usage++,$choice.data("usage",usage);var _setChoice=function(){$target.data("serial",choiceSerial).html($choice.html()).addClass("filled"),!interaction.responseMappingMode&&choice.attr("matchMax")&&usage>=choice.attr("matchMax")&&$choice.addClass("deactivated")};if($target.siblings("div").hasClass("filled")){var $resultArea=$(".result-area",$container),$pair=$target.parent(),thisPairSerial=[$target.siblings("div").data("serial"),choiceSerial],$otherRepeatedPair=$(); $resultArea.children().not($pair).each(function(){var $otherPair=$(this).children(".filled");if(2===$otherPair.length){var otherPairSerial=[$($otherPair[0]).data("serial"),$($otherPair[1]).data("serial")];if(2===_.intersection(thisPairSerial,otherPairSerial).length)return $otherRepeatedPair=$otherPair,!1}}),0===$otherRepeatedPair.length?(_setChoice(),containerHelper.triggerResponseChangeEvent(interaction,{type:"added",$pair:$pair,choices:thisPairSerial}),instructionMgr.validateInstructions(interaction,{choice:$choice,target:$target}),(interaction.responseMappingMode||0===parseInt(interaction.attr("maxAssociations")))&&($pair.removeClass("incomplete-pair"),$resultArea.children(".incomplete-pair").length||($resultArea.append(pairTpl({ empty:!0})),$resultArea.children(".incomplete-pair").fadeIn(600,function(){$(this).show()})))):($otherRepeatedPair.css("border","1px solid orange"),$target.html(__("identical pair already exists")).css({color:"orange",border:"1px solid orange"}),setTimeout(function(){$otherRepeatedPair.removeAttr("style"),$target.empty().css({color:"",border:""})},2e3))}else _setChoice()},unsetChoice=function(interaction,$filledChoice,animate,triggerChange){var $container=containerHelper.get(interaction),choiceSerial=$filledChoice.data("serial"),$choice=$container.find(".choice-area [data-serial="+choiceSerial+"]"),usage=$choice.data("usage")||0,$parent=$filledChoice.parent(); @@ -849,11 +850,12 @@ var correct=[];$('input[name="correct_'+_widget.serial+'[]"]:checked').each(func interactionSerial:interaction.getSerial(),choiceSerial:"n/a",choiceIdentifier:"n/a"})),$miniToolbar=extraData.$pair.children(".mini-tlb")),$miniToolbar.show(),$miniToolbar.data("pairIdentifier",pairIdentifier);var $correct=$miniToolbar.find("[data-role=correct]").data("pairIdentifier",pairIdentifier);pairs[pairIdentifier]&&pairs[pairIdentifier].correct?$correct.prop("checked",!0):$correct.prop("checked",!1);var $score=$miniToolbar.find("[data-role=score]").data("pairIdentifier",pairIdentifier);pairs[pairIdentifier]&&pairs[pairIdentifier].score?$score.val(pairs[pairIdentifier].score):$score.val(_defaultMappingValue)}}else $miniToolbar=extraData.$pair.children(".mini-tlb"), $miniToolbar.hide(),response.removeMapEntry($miniToolbar.data("pairIdentifier")),$miniToolbar.removeData("pairIdentifier"),$miniToolbar.find("[data-role=correct]").prop("checked",!1).removeData("pairIdentifier"),$miniToolbar.find("[data-role=score]").val(_defaultMappingValue).removeData("pairIdentifier"),_saveCorrect()}),_widget.$container.find(".result-area").on("change","[data-role=correct]",_saveCorrect).on("keyup","[data-role=score]",function(){var $score=$(this);response.setMapEntry($score.data("pairIdentifier"),$score.val())})},AssociateInteractionStateCorrect}),define("taoQtiItem/qtiCreator/widgets/interactions/associateInteraction/states/states",["taoQtiItem/qtiCreator/widgets/states/factory","taoQtiItem/qtiCreator/widgets/interactions/blockInteraction/states/states","taoQtiItem/qtiCreator/widgets/interactions/associateInteraction/states/Question","taoQtiItem/qtiCreator/widgets/interactions/associateInteraction/states/Choice","taoQtiItem/qtiCreator/widgets/interactions/associateInteraction/states/Answer","taoQtiItem/qtiCreator/widgets/interactions/associateInteraction/states/Correct","taoQtiItem/qtiCreator/widgets/interactions/associateInteraction/states/Map"],function(factory,states){ "use strict";return factory.createBundle(states,arguments)}),define("taoQtiItem/qtiCreator/widgets/interactions/associateInteraction/Widget",["taoQtiItem/qtiCreator/widgets/interactions/Widget","taoQtiItem/qtiCreator/widgets/interactions/associateInteraction/states/states","taoQtiItem/qtiCommonRenderer/helpers/sizeAdapter"],function(Widget,states,sizeAdapter){"use strict";var AssociateInteractionWidget=Widget.clone();return AssociateInteractionWidget.initCreator=function(){this.registerStates(states),Widget.initCreator.call(this),sizeAdapter.adaptSize(this)},AssociateInteractionWidget}),define("taoQtiItem/qtiCreator/renderers/interactions/AssociateInteraction",["lodash","taoQtiItem/qtiCommonRenderer/renderers/interactions/AssociateInteraction","taoQtiItem/qtiCreator/widgets/interactions/associateInteraction/Widget"],function(_,AssociateInteraction,AssociateInteractionWidget){ -"use strict";var CreatorAssociateInteraction=_.clone(AssociateInteraction);return CreatorAssociateInteraction.render=function(interaction,options){AssociateInteraction.renderEmptyPairs(interaction),AssociateInteractionWidget.build(interaction,AssociateInteraction.getContainer(interaction),this.getOption("interactionOptionForm"),this.getOption("responseOptionForm"),options)},CreatorAssociateInteraction}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/choiceInteraction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{ -hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program3(depth0,data){return" horizontal"}function program5(depth0,data){var stack1,helper;return(helper=helpers.listStyle)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.listStyle,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program7(depth0,data){var stack1;return stack1=typeof depth0===functionType?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers), -data=data||{};var stack1,helper,options,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing;return buffer+='
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1), -buffer+='\n
    \n
      \n ',options={hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data},(helper=helpers.choices)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.choices,stack1=typeof helper===functionType?helper.call(depth0,options):helper), -helpers.choices||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
    \n
    \n
    '})}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/ChoiceInteraction",["lodash","jquery","i18n","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/choiceInteraction","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/sizeAdapter"],function(_,$,__,tpl,containerHelper,instructionMgr,pciResponse,sizeAdapter){ +"use strict";var CreatorAssociateInteraction=_.clone(AssociateInteraction);return CreatorAssociateInteraction.render=function(interaction,options){AssociateInteraction.renderEmptyPairs(interaction),AssociateInteractionWidget.build(interaction,AssociateInteraction.getContainer(interaction),this.getOption("interactionOptionForm"),this.getOption("responseOptionForm"),options)},CreatorAssociateInteraction}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/choiceInteraction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,buffer="";return buffer+='id="'+escapeExpression((stack1=depth0&&depth0.attributes, +stack1=null==stack1||stack1===!1?stack1:stack1.id,typeof stack1===functionType?stack1.apply(depth0):stack1))+'"'}function program3(depth0,data){var stack1,buffer="";return buffer+=" "+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1["class"],typeof stack1===functionType?stack1.apply(depth0):stack1))}function program5(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program7(depth0,data){return" horizontal"; +}function program9(depth0,data){var stack1,helper;return(helper=helpers.listStyle)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.listStyle,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program11(depth0,data){var stack1;return stack1=typeof depth0===functionType?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing; +return buffer+="
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
    \n
      \n ',options={hash:{},inverse:self.noop,fn:self.program(11,program11,data),data:data},(helper=helpers.choices)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.choices,stack1=typeof helper===functionType?helper.call(depth0,options):helper),helpers.choices||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.program(11,program11,data),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
    \n
    \n
    \n'})}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/ChoiceInteraction",["lodash","jquery","i18n","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/choiceInteraction","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/sizeAdapter"],function(_,$,__,tpl,containerHelper,instructionMgr,pciResponse,sizeAdapter){ "use strict";var KEY_CODE_SPACE=32,KEY_CODE_ENTER=13,KEY_CODE_UP=38,KEY_CODE_DOWN=40,KEY_CODE_TAB=9,_pseudoLabel=function(interaction,$container){$container.off(".commonRenderer");var $choiceInputs=$container.find(".qti-choice").find("input:radio,input:checkbox").not("[disabled]").not(".disabled");$choiceInputs.on("keydown.commonRenderer",function(e){var keyCode=e.keyCode?e.keyCode:e.charCode;keyCode!==KEY_CODE_TAB&&e.preventDefault(),(keyCode===KEY_CODE_SPACE||keyCode===KEY_CODE_ENTER)&&_triggerInput($(this).closest(".qti-choice"));var $nextInput=$(this).closest(".qti-choice").next(".qti-choice").find("input:radio,input:checkbox").not("[disabled]").not(".disabled"),$prevInput=$(this).closest(".qti-choice").prev(".qti-choice").find("input:radio,input:checkbox").not("[disabled]").not(".disabled"); keyCode===KEY_CODE_UP?$prevInput.focus():keyCode===KEY_CODE_DOWN&&$nextInput.focus()}),$container.on("click.commonRenderer",".qti-choice",function(e){var $choiceBox=$(this);e.preventDefault(),e.stopPropagation(),_triggerInput($choiceBox),instructionMgr.validateInstructions(interaction,{choice:$choiceBox}),containerHelper.triggerResponseChangeEvent(interaction)})},_triggerInput=function($choiceBox){var $input=$choiceBox.find("input:radio,input:checkbox").not("[disabled]").not(".disabled");$input.length&&($input.prop("checked",!$input.prop("checked")),$input.trigger("change"))},render=function(interaction){var $container=containerHelper.get(interaction);_pseudoLabel(interaction,$container), _setInstructions(interaction),"horizontal"===interaction.attr("orientation")&&sizeAdapter.adaptSize($(".add-option, .result-area .target, .choice-area .qti-choice",$container))},_setInstructions=function(interaction){var msg,min=interaction.attr("minChoices"),max=interaction.attr("maxChoices"),choiceCount=_.size(interaction.getChoices()),minInstructionSet=!1;if(max>1&&choiceCount>max){var highlightInvalidInput=function($choice){var $input=$choice.find(".real-label > input"),$li=$choice.css("color","#BA122B"),$icon=$choice.find(".real-label > span").css("color","#BA122B").addClass("cross error"),timeout=interaction.data("__instructionTimeout");timeout&&clearTimeout(timeout), @@ -915,24 +917,25 @@ var interaction=this.element,tplData={tag:interaction.qtiClass,serial:interactio },EndAttemptInteractionWidget}),define("tpl!taoQtiItem/qtiCreator/tpl/inlineInteraction/endAttemptInteraction.placeholder",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression;return buffer+='\n '+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1.title,typeof stack1===functionType?stack1.apply(depth0):stack1))+"\n"})}),define("taoQtiItem/qtiCreator/renderers/interactions/EndAttemptInteraction",["jquery","lodash","taoQtiItem/qtiCommonRenderer/renderers/interactions/EndAttemptInteraction","taoQtiItem/qtiCreator/widgets/interactions/endAttemptInteraction/Widget","tpl!taoQtiItem/qtiCreator/tpl/inlineInteraction/endAttemptInteraction.placeholder"],function($,_,EndAttemptInteraction,EndAttemptInteractionWidget,tpl){ "use strict";var CreatorEndAttemptInteraction=_.clone(EndAttemptInteraction);return CreatorEndAttemptInteraction.template=tpl,CreatorEndAttemptInteraction.render=function(interaction,options){options=options||{};var interactionsConfig=this.getOption("interactions");interactionsConfig.endAttempt&&(options.config=interactionsConfig.endAttempt),EndAttemptInteractionWidget.build(interaction,$('.endAttemptInteraction-placeholder[data-serial="'+interaction.serial+'"]'),this.getOption("interactionOptionForm"),this.getOption("responseOptionForm"),options)},CreatorEndAttemptInteraction}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/extendedTextInteraction",["handlebars"],function(hb){ -return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program3(depth0,data){var stack1,helper,options,buffer="";return buffer+="\n ",helper=helpers.equal||depth0&&depth0.equal,options={hash:{},inverse:self.program(8,program8,data),fn:self.program(4,program4,data),data:data},stack1=helper?helper.call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||stack1===!1?stack1:stack1.format),"xhtml",options):helperMissing.call(depth0,"equal",(stack1=depth0&&depth0.attributes, -null==stack1||stack1===!1?stack1:stack1.format),"xhtml",options),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n {!-- If there's an expected length or a max length --}}\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||stack1===!1?stack1:stack1.expectedLength),{hash:{},inverse:self.noop,fn:self.program(12,program12,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.maxLength,{hash:{},inverse:self.noop,fn:self.program(14,program14,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n \n ",stack1=helpers["if"].call(depth0,depth0&&depth0.maxWords,{ -hash:{},inverse:self.noop,fn:self.program(16,program16,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n "}function program4(depth0,data){var stack1,buffer="";return buffer+="\n ",stack1=helpers.each.call(depth0,depth0&&depth0.maxStringLoop,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n "}function program5(depth0,data){var stack1,buffer="";return buffer+='\n
    \n '}function program6(depth0,data){return" attributes.class"}function program8(depth0,data){var stack1,buffer="";return buffer+="\n ", -stack1=helpers.each.call(depth0,depth0&&depth0.maxStringLoop,{hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n "}function program9(depth0,data){var stack1,buffer="";return buffer+='\n \n "}function program10(depth0,data){var stack1,buffer="";return buffer+='pattern="'+escapeExpression((stack1=depth0&&depth0.attributes, -stack1=null==stack1||stack1===!1?stack1:stack1.patternMask,typeof stack1===functionType?stack1.apply(depth0):stack1))+'"'}function program12(depth0,data){var stack1,helper,options,buffer="";return buffer+='\n
    \n 0 '+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" "+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1.expectedLength,typeof stack1===functionType?stack1.apply(depth0):stack1))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__, -options={hash:{},data:data},helper?helper.call(depth0,"chars",options):helperMissing.call(depth0,"__","chars",options)))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"recommanded",options):helperMissing.call(depth0,"__","recommanded",options)))+".\n
    \n "}function program14(depth0,data){var stack1,helper,options,buffer="";return buffer+='\n
    \n 0 '+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" ", -(helper=helpers.maxLength)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.maxLength,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"chars",options):helperMissing.call(depth0,"__","chars",options)))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"maximum",options):helperMissing.call(depth0,"__","maximum",options)))+".\n
    \n "}function program16(depth0,data){var stack1,helper,options,buffer=""; -return buffer+='\n
    \n 0 '+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" ",(helper=helpers.maxWords)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.maxWords,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"words",options):helperMissing.call(depth0,"__","words",options)))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__, -options={hash:{},data:data},helper?helper.call(depth0,"maximum",options):helperMissing.call(depth0,"__","maximum",options)))+".\n
    \n "}function program18(depth0,data){var stack1,helper,options,buffer="";return buffer+="\n ",helper=helpers.equal||depth0&&depth0.equal,options={hash:{},inverse:self.program(21,program21,data),fn:self.program(19,program19,data),data:data},stack1=helper?helper.call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||stack1===!1?stack1:stack1.format),depth0&&depth0.xhtml,options):helperMissing.call(depth0,"equal",(stack1=depth0&&depth0.attributes,null==stack1||stack1===!1?stack1:stack1.format),depth0&&depth0.xhtml,options), -(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n \n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||stack1===!1?stack1:stack1.expectedLength),{hash:{},inverse:self.noop,fn:self.program(23,program23,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.maxLength,{hash:{},inverse:self.noop,fn:self.program(14,program14,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n \n ",stack1=helpers["if"].call(depth0,depth0&&depth0.maxWords,{hash:{},inverse:self.noop,fn:self.program(16,program16,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1), -buffer+="\n "}function program19(depth0,data){var stack1,buffer="";return buffer+='\n
    \n '}function program21(depth0,data){var stack1,buffer="";return buffer+='\n \n "}function program23(depth0,data){var stack1,helper,options,buffer=""; -return buffer+='\n
    \n 0 '+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" "+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1.expectedLength,typeof stack1===functionType?stack1.apply(depth0):stack1))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"chars",options):helperMissing.call(depth0,"__","chars",options)))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__, -options={hash:{},data:data},helper?helper.call(depth0,"recommended",options):helperMissing.call(depth0,"__","recommended",options)))+".\n
    \n "}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this,helperMissing=helpers.helperMissing;return buffer+='
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.multiple,{hash:{},inverse:self.program(18,program18,data),fn:self.program(3,program3,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n
    \n"})}),define("taoQtiItem/qtiCommonRenderer/helpers/ckConfigurator",["ui/ckeditor/ckConfigurator"],function(ckConfigurator){ -"use strict";var getConfig=function(editor,toolbarType,options){return options=options||{},options.underline=!0,ckConfigurator.getConfig(editor,toolbarType,options)};return{getConfig:getConfig}}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/ExtendedTextInteraction",["jquery","lodash","i18n","core/promise","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/extendedTextInteraction","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","ckeditor","taoQtiItem/qtiCommonRenderer/helpers/ckConfigurator","polyfill/placeholders"],function($,_,__,Promise,tpl,containerHelper,instructionMgr,ckEditor,ckConfigurator){ +return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,buffer="";return buffer+='id="'+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1.id,typeof stack1===functionType?stack1.apply(depth0):stack1))+'"'}function program3(depth0,data){var stack1,buffer="";return buffer+=" "+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1["class"],typeof stack1===functionType?stack1.apply(depth0):stack1))}function program5(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data +}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program7(depth0,data){var stack1,helper,options,buffer="";return buffer+="\n ",helper=helpers.equal||depth0&&depth0.equal,options={hash:{},inverse:self.program(12,program12,data),fn:self.program(8,program8,data),data:data},stack1=helper?helper.call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||stack1===!1?stack1:stack1.format),"xhtml",options):helperMissing.call(depth0,"equal",(stack1=depth0&&depth0.attributes,null==stack1||stack1===!1?stack1:stack1.format),"xhtml",options),(stack1||0===stack1)&&(buffer+=stack1), +buffer+="\n {!-- If there's an expected length or a max length --}}\n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||stack1===!1?stack1:stack1.expectedLength),{hash:{},inverse:self.noop,fn:self.program(16,program16,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.maxLength,{hash:{},inverse:self.noop,fn:self.program(18,program18,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n \n ",stack1=helpers["if"].call(depth0,depth0&&depth0.maxWords,{hash:{},inverse:self.noop,fn:self.program(20,program20,data),data:data +}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n "}function program8(depth0,data){var stack1,buffer="";return buffer+="\n ",stack1=helpers.each.call(depth0,depth0&&depth0.maxStringLoop,{hash:{},inverse:self.noop,fn:self.program(9,program9,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n "}function program9(depth0,data){var stack1,buffer="";return buffer+='\n
    \n '}function program10(depth0,data){return" attributes.class"}function program12(depth0,data){var stack1,buffer="";return buffer+="\n ",stack1=helpers.each.call(depth0,depth0&&depth0.maxStringLoop,{ +hash:{},inverse:self.noop,fn:self.program(13,program13,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n "}function program13(depth0,data){var stack1,buffer="";return buffer+='\n \n "}function program14(depth0,data){var stack1,buffer="";return buffer+='pattern="'+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1.patternMask,typeof stack1===functionType?stack1.apply(depth0):stack1))+'"'; +}function program16(depth0,data){var stack1,helper,options,buffer="";return buffer+='\n
    \n 0 '+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" "+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1.expectedLength,typeof stack1===functionType?stack1.apply(depth0):stack1))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"chars",options):helperMissing.call(depth0,"__","chars",options)))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__, +options={hash:{},data:data},helper?helper.call(depth0,"recommanded",options):helperMissing.call(depth0,"__","recommanded",options)))+".\n
    \n "}function program18(depth0,data){var stack1,helper,options,buffer="";return buffer+='\n
    \n 0 '+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" ",(helper=helpers.maxLength)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.maxLength,stack1=typeof helper===functionType?helper.call(depth0,{ +hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"chars",options):helperMissing.call(depth0,"__","chars",options)))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"maximum",options):helperMissing.call(depth0,"__","maximum",options)))+".\n
    \n "}function program20(depth0,data){var stack1,helper,options,buffer="";return buffer+='\n
    \n 0 '+escapeExpression((helper=helpers.__||depth0&&depth0.__, +options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" ",(helper=helpers.maxWords)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.maxWords,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),buffer+=escapeExpression(stack1)+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"words",options):helperMissing.call(depth0,"__","words",options)))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"maximum",options):helperMissing.call(depth0,"__","maximum",options)))+".\n
    \n "; +}function program22(depth0,data){var stack1,helper,options,buffer="";return buffer+="\n ",helper=helpers.equal||depth0&&depth0.equal,options={hash:{},inverse:self.program(25,program25,data),fn:self.program(23,program23,data),data:data},stack1=helper?helper.call(depth0,(stack1=depth0&&depth0.attributes,null==stack1||stack1===!1?stack1:stack1.format),depth0&&depth0.xhtml,options):helperMissing.call(depth0,"equal",(stack1=depth0&&depth0.attributes,null==stack1||stack1===!1?stack1:stack1.format),depth0&&depth0.xhtml,options),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n \n ",stack1=helpers["if"].call(depth0,(stack1=depth0&&depth0.attributes, +null==stack1||stack1===!1?stack1:stack1.expectedLength),{hash:{},inverse:self.noop,fn:self.program(27,program27,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n ",stack1=helpers["if"].call(depth0,depth0&&depth0.maxLength,{hash:{},inverse:self.noop,fn:self.program(18,program18,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n \n ",stack1=helpers["if"].call(depth0,depth0&&depth0.maxWords,{hash:{},inverse:self.noop,fn:self.program(20,program20,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n "}function program23(depth0,data){var stack1,buffer="";return buffer+='\n
    \n '}function program25(depth0,data){var stack1,buffer="";return buffer+='\n \n "}function program27(depth0,data){var stack1,helper,options,buffer="";return buffer+='\n
    \n 0 '+escapeExpression((helper=helpers.__||depth0&&depth0.__, +options={hash:{},data:data},helper?helper.call(depth0,"of",options):helperMissing.call(depth0,"__","of",options)))+" "+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1.expectedLength,typeof stack1===functionType?stack1.apply(depth0):stack1))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"chars",options):helperMissing.call(depth0,"__","chars",options)))+" "+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"recommended",options):helperMissing.call(depth0,"__","recommended",options)))+".\n
    \n "; +}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this,helperMissing=helpers.helperMissing;return buffer+="
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.multiple,{ +hash:{},inverse:self.program(22,program22,data),fn:self.program(7,program7,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n
    \n"})}),define("taoQtiItem/qtiCommonRenderer/helpers/ckConfigurator",["ui/ckeditor/ckConfigurator"],function(ckConfigurator){"use strict";var getConfig=function(editor,toolbarType,options){return options=options||{},options.underline=!0,ckConfigurator.getConfig(editor,toolbarType,options)};return{getConfig:getConfig}}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/ExtendedTextInteraction",["jquery","lodash","i18n","core/promise","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/extendedTextInteraction","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","ckeditor","taoQtiItem/qtiCommonRenderer/helpers/ckConfigurator","polyfill/placeholders"],function($,_,__,Promise,tpl,containerHelper,instructionMgr,ckEditor,ckConfigurator){ "use strict";var render=function(interaction){return new Promise(function(resolve,reject){var $el,expectedLength,minStrings,patternMask,placeholderType,editor,$container=containerHelper.get(interaction),multiple=(interaction.getResponseDeclaration(),_isMultiple(interaction)),limiter=inputLimiter(interaction),placeholderText=interaction.attr("placeholderText"),toolbarType="extendedText",ckOptions={extraPlugins:"onchange",language:"en",defaultLanguage:"en",resize_enabled:!0,secure:"https:"==location.protocol,forceCustomDomain:!0};if(multiple){if($el=$container.find("input"),minStrings=interaction.attr("minStrings"),expectedLength=interaction.attr("expectedLength"), patternMask=interaction.attr("patternMask"),minStrings){var _getNumStrings=function($element){var num=0;return $element.each(function(){""!==$(this).val()&&num++}),num};minStrings=parseInt(minStrings,10),minStrings>0&&$el.on("blur.commonRenderer",function(){setTimeout(function(){!$el.is(":focus")&&_getNumStrings($el)0&&$el.each(function(){$(this).css("width",expectedLength+"em")})),patternMask&&$el.each(function(){_setPattern($(this),patternMask)}),placeholderText&&(placeholderType="first", "multiple"===placeholderType?$el.each(function(){$(this).attr("placeholder",placeholderText)}):"first"===placeholderType&&$el.first().attr("placeholder",placeholderText)),resolve()}else $el=$container.find("textarea"),placeholderText&&$el.attr("placeholder",placeholderText),"xhtml"===_getFormat(interaction)?(editor=_setUpCKEditor(interaction,ckOptions),editor||reject("Unable to instantiate ckEditor"),editor.on("loaded",function(){_.delay(resolve,300)}),("ready"===editor.status||"loaded"===editor.status)&&_.defer(resolve),editor.on("configLoaded",function(e){editor.config=ckConfigurator.getConfig(editor,toolbarType,ckOptions),limiter.enabled&&limiter.listenKeyPress(); @@ -974,16 +977,18 @@ $('[name="maxWords"]').val(""),$('[name="maxLength"]').val("")},callbacks.expect _createResponseWidget(this.widget)},function(){_destroyResponseWidget(this.widget)}),_createResponseWidget=function(widget){var interaction=widget.element,response=interaction.getResponseDeclaration(),correctResponse=_.values(response.getCorrect());renderer.enable(interaction),renderer.setText(interaction,correctResponse[0]),instructionMgr.appendInstruction(interaction,__("Please type the correct response below.")),widget.$container.on("responseChange.qti-widget",function(e,data){response.setCorrect([renderer.getResponse(interaction).base.string])})},_destroyResponseWidget=function(widget){var interaction=widget.element;renderer.clearText(interaction),instructionMgr.removeInstructions(widget.element), widget.$container.off("responseChange.qti-widget")};return ExtendedTextInteractionStateCorrect}),define("taoQtiItem/qtiCreator/widgets/interactions/extendedTextInteraction/states/Sleep",["taoQtiItem/qtiCreator/widgets/states/factory","taoQtiItem/qtiCreator/widgets/interactions/states/Sleep","taoQtiItem/qtiCommonRenderer/renderers/interactions/ExtendedTextInteraction"],function(stateFactory,Sleep,renderer){"use strict";var ExtendedTextInteractionStateSleep=stateFactory.extend(Sleep,function(){renderer.disable(this.widget.element)},function(){});return ExtendedTextInteractionStateSleep}),define("taoQtiItem/qtiCreator/widgets/interactions/extendedTextInteraction/states/states",["taoQtiItem/qtiCreator/widgets/states/factory","taoQtiItem/qtiCreator/widgets/interactions/blockInteraction/states/states","taoQtiItem/qtiCreator/widgets/interactions/extendedTextInteraction/states/Question","taoQtiItem/qtiCreator/widgets/interactions/extendedTextInteraction/states/Answer","taoQtiItem/qtiCreator/widgets/interactions/extendedTextInteraction/states/Correct","taoQtiItem/qtiCreator/widgets/interactions/extendedTextInteraction/states/Sleep"],function(factory,states){ "use strict";return factory.createBundle(states,arguments)}),define("taoQtiItem/qtiCreator/widgets/interactions/extendedTextInteraction/Widget",["taoQtiItem/qtiCreator/widgets/interactions/Widget","taoQtiItem/qtiCreator/widgets/interactions/extendedTextInteraction/states/states"],function(Widget,states){"use strict";var ExtendedTextInteractionWidget=Widget.clone();return ExtendedTextInteractionWidget.initCreator=function(){this.registerStates(states),Widget.initCreator.call(this)},ExtendedTextInteractionWidget}),define("taoQtiItem/qtiCreator/renderers/interactions/ExtendedTextInteraction",["lodash","taoQtiItem/qtiCommonRenderer/renderers/interactions/ExtendedTextInteraction","taoQtiItem/qtiCreator/widgets/interactions/extendedTextInteraction/Widget"],function(_,ExtendedTextInteraction,ExtendedTextInteractionWidget){ -"use strict";var CreatorExtendedTextInteraction=_.clone(ExtendedTextInteraction);return CreatorExtendedTextInteraction.render=function(interaction,options){ExtendedTextInteraction.render(interaction),ExtendedTextInteractionWidget.build(interaction,ExtendedTextInteraction.getContainer(interaction),this.getOption("interactionOptionForm"),this.getOption("responseOptionForm"),options)},CreatorExtendedTextInteraction}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/gapMatchInteraction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{ -hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program3(depth0,data){var stack1;return stack1=typeof depth0===functionType?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing;return buffer+='
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
      \n ',options={hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data},(helper=helpers.choices)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.choices, -stack1=typeof helper===functionType?helper.call(depth0,options):helper),helpers.choices||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
    \n
    \n
    ',(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="
    \n
    "})}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/GapMatchInteraction",["lodash","i18n","jquery","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/gapMatchInteraction","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse"],function(_,__,$,tpl,containerHelper,instructionMgr,pciResponse){ -"use strict";var _choiceUsages={},setChoice=function(interaction,$choice,$target){var choiceSerial=$choice.data("serial"),choice=interaction.getChoice(choiceSerial);_choiceUsages[choiceSerial]||(_choiceUsages[choiceSerial]=0),_choiceUsages[choiceSerial]++,$target.data("serial",choiceSerial).html($choice.html()).addClass("filled"),!interaction.responseMappingMode&&choice.attr("matchMax")&&_choiceUsages[choiceSerial]>=choice.attr("matchMax")&&$choice.attr("class","deactivated"),containerHelper.triggerResponseChangeEvent(interaction)},unsetChoice=function(interaction,$choice,animate){var serial=$choice.data("serial"),$container=containerHelper.get(interaction);$container.find(".choice-area [data-serial="+serial+"]").removeClass().addClass("qti-choice"), -_choiceUsages[serial]--,$choice.removeClass("filled").removeData("serial").empty(),interaction.swapping||containerHelper.triggerResponseChangeEvent(interaction)},getChoice=function(interaction,identifier){var $container=containerHelper.get(interaction);return $(".choice-area [data-identifier="+identifier+"]",$container)},getGap=function(interaction,identifier){var $container=containerHelper.get(interaction);return $(".qti-flow-container [data-identifier="+identifier+"]",$container)},render=function(interaction){var $container=containerHelper.get(interaction),$choiceArea=$container.find(".choice-area"),$flowContainer=$container.find(".qti-flow-container"),$activeChoice=null,_getChoice=function(serial){ -return $choiceArea.find("[data-serial="+serial+"]")},_setChoice=function($choice,$target){return setChoice(interaction,$choice,$target)},_resetSelection=function(){$activeChoice&&($flowContainer.find(".remove-choice").remove(),$activeChoice.removeClass("deactivated active"),$container.find(".empty").removeClass("empty"),$activeChoice=null)},_unsetChoice=function($choice){return unsetChoice(interaction,$choice)},_isInsertionMode=function(){return $activeChoice&&!$activeChoice.hasClass("filled")},_isModeEditing=function(){return $activeChoice&&$activeChoice.hasClass("filled")};$container.on("mousedown.commonRenderer",function(e){_resetSelection()}),$choiceArea.on("mousedown.commonRenderer",">li",function(e){ -return e.stopPropagation(),$activeChoice&&$(this).hasClass("active")||$(this).hasClass("deactivated")?void e.preventDefault():(_resetSelection(),$activeChoice=$(this).addClass("active"),void $flowContainer.find(".gapmatch-content").addClass("empty"))}),$flowContainer.on("mousedown.commonRenderer",".gapmatch-content",function(e){if(e.stopPropagation(),_isInsertionMode()){var $target=$(this),choiceSerial=$activeChoice.data("serial"),targetSerial=$target.data("serial");targetSerial!==choiceSerial&&(targetSerial&&_unsetChoice($target),_setChoice($activeChoice,$target)),$activeChoice.removeClass("active"),$container.find(".empty").removeClass("empty"),$activeChoice=null; -}else if(_isModeEditing()){var $target=$(this),targetSerial=$target.data("serial"),choiceSerial=$activeChoice.data("serial");targetSerial!==choiceSerial&&(_unsetChoice($activeChoice),targetSerial&&(_unsetChoice($target),_setChoice(_getChoice(targetSerial),$activeChoice)),_setChoice(_getChoice(choiceSerial),$target)),_resetSelection()}else if($(this).data("serial")&&$(this).hasClass("filled")){var serial=$(this).data("serial");$activeChoice=$(this),$activeChoice.addClass("active"),$flowContainer.find(">li>div").filter(function(){return $(this).data("serial")!==serial}).addClass("empty"),$choiceArea.find(">li:not(.deactivated)").filter(function(){return $(this).data("serial")!==serial; -}).addClass("empty");var $bin=$("",{"class":"icon-undo remove-choice",title:__("remove")});$bin.on("mousedown",function(e){e.stopPropagation(),_unsetChoice($activeChoice),_resetSelection()}),$(this).append($bin)}})},resetResponse=function(interaction){var $container=containerHelper.get(interaction);$(".gapmatch-content .active",$container).trigger("mousedown.commonRenderer"),$(".gapmatch-content",$container).each(function(){unsetChoice(interaction,$(this))})},_setPairs=function(interaction,pairs){_.each(pairs,function(pair){pair&&setChoice(interaction,getChoice(interaction,pair[0]),getGap(interaction,pair[1]).find(".gapmatch-content"))})},setResponse=function(interaction,response){ +"use strict";var CreatorExtendedTextInteraction=_.clone(ExtendedTextInteraction);return CreatorExtendedTextInteraction.render=function(interaction,options){ExtendedTextInteraction.render(interaction),ExtendedTextInteractionWidget.build(interaction,ExtendedTextInteraction.getContainer(interaction),this.getOption("interactionOptionForm"),this.getOption("responseOptionForm"),options)},CreatorExtendedTextInteraction}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/gapMatchInteraction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,buffer="";return buffer+='id="'+escapeExpression((stack1=depth0&&depth0.attributes, +stack1=null==stack1||stack1===!1?stack1:stack1.id,typeof stack1===functionType?stack1.apply(depth0):stack1))+'"'}function program3(depth0,data){var stack1,buffer="";return buffer+=" "+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1["class"],typeof stack1===functionType?stack1.apply(depth0):stack1))}function program5(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program7(depth0,data){var stack1;return stack1=typeof depth0===functionType?depth0.apply(depth0):depth0, +stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing;return buffer+="
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
      \n ', +options={hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data},(helper=helpers.choices)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.choices,stack1=typeof helper===functionType?helper.call(depth0,options):helper),helpers.choices||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
    \n
    \n
    ',(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1=typeof helper===functionType?helper.call(depth0,{ +hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="
    \n
    \n"})}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/GapMatchInteraction",["lodash","i18n","jquery","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/gapMatchInteraction","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse"],function(_,__,$,tpl,containerHelper,instructionMgr,pciResponse){"use strict";var _choiceUsages={},setChoice=function(interaction,$choice,$target){var choiceSerial=$choice.data("serial"),choice=interaction.getChoice(choiceSerial); +_choiceUsages[choiceSerial]||(_choiceUsages[choiceSerial]=0),_choiceUsages[choiceSerial]++,$target.data("serial",choiceSerial).html($choice.html()).addClass("filled"),!interaction.responseMappingMode&&choice.attr("matchMax")&&_choiceUsages[choiceSerial]>=choice.attr("matchMax")&&$choice.attr("class","deactivated"),containerHelper.triggerResponseChangeEvent(interaction)},unsetChoice=function(interaction,$choice,animate){var serial=$choice.data("serial"),$container=containerHelper.get(interaction);$container.find(".choice-area [data-serial="+serial+"]").removeClass().addClass("qti-choice"),_choiceUsages[serial]--,$choice.removeClass("filled").removeData("serial").empty(), +interaction.swapping||containerHelper.triggerResponseChangeEvent(interaction)},getChoice=function(interaction,identifier){var $container=containerHelper.get(interaction);return $(".choice-area [data-identifier="+identifier+"]",$container)},getGap=function(interaction,identifier){var $container=containerHelper.get(interaction);return $(".qti-flow-container [data-identifier="+identifier+"]",$container)},render=function(interaction){var $container=containerHelper.get(interaction),$choiceArea=$container.find(".choice-area"),$flowContainer=$container.find(".qti-flow-container"),$activeChoice=null,_getChoice=function(serial){return $choiceArea.find("[data-serial="+serial+"]"); +},_setChoice=function($choice,$target){return setChoice(interaction,$choice,$target)},_resetSelection=function(){$activeChoice&&($flowContainer.find(".remove-choice").remove(),$activeChoice.removeClass("deactivated active"),$container.find(".empty").removeClass("empty"),$activeChoice=null)},_unsetChoice=function($choice){return unsetChoice(interaction,$choice)},_isInsertionMode=function(){return $activeChoice&&!$activeChoice.hasClass("filled")},_isModeEditing=function(){return $activeChoice&&$activeChoice.hasClass("filled")};$container.on("mousedown.commonRenderer",function(e){_resetSelection()}),$choiceArea.on("mousedown.commonRenderer",">li",function(e){return e.stopPropagation(), +$activeChoice&&$(this).hasClass("active")||$(this).hasClass("deactivated")?void e.preventDefault():(_resetSelection(),$activeChoice=$(this).addClass("active"),void $flowContainer.find(".gapmatch-content").addClass("empty"))}),$flowContainer.on("mousedown.commonRenderer",".gapmatch-content",function(e){if(e.stopPropagation(),_isInsertionMode()){var $target=$(this),choiceSerial=$activeChoice.data("serial"),targetSerial=$target.data("serial");targetSerial!==choiceSerial&&(targetSerial&&_unsetChoice($target),_setChoice($activeChoice,$target)),$activeChoice.removeClass("active"),$container.find(".empty").removeClass("empty"),$activeChoice=null}else if(_isModeEditing()){ +var $target=$(this),targetSerial=$target.data("serial"),choiceSerial=$activeChoice.data("serial");targetSerial!==choiceSerial&&(_unsetChoice($activeChoice),targetSerial&&(_unsetChoice($target),_setChoice(_getChoice(targetSerial),$activeChoice)),_setChoice(_getChoice(choiceSerial),$target)),_resetSelection()}else if($(this).data("serial")&&$(this).hasClass("filled")){var serial=$(this).data("serial");$activeChoice=$(this),$activeChoice.addClass("active"),$flowContainer.find(">li>div").filter(function(){return $(this).data("serial")!==serial}).addClass("empty"),$choiceArea.find(">li:not(.deactivated)").filter(function(){return $(this).data("serial")!==serial}).addClass("empty"); +var $bin=$("",{"class":"icon-undo remove-choice",title:__("remove")});$bin.on("mousedown",function(e){e.stopPropagation(),_unsetChoice($activeChoice),_resetSelection()}),$(this).append($bin)}})},resetResponse=function(interaction){var $container=containerHelper.get(interaction);$(".gapmatch-content .active",$container).trigger("mousedown.commonRenderer"),$(".gapmatch-content",$container).each(function(){unsetChoice(interaction,$(this))})},_setPairs=function(interaction,pairs){_.each(pairs,function(pair){pair&&setChoice(interaction,getChoice(interaction,pair[0]),getGap(interaction,pair[1]).find(".gapmatch-content"))})},setResponse=function(interaction,response){ resetResponse(interaction),_setPairs(interaction,pciResponse.unserialize(response,interaction))},_getRawResponse=function(interaction){var response=[],$container=containerHelper.get(interaction);return $(".gapmatch-content",$container).each(function(){var choiceSerial=$(this).data("serial"),pair=[];choiceSerial&&pair.push(interaction.getChoice(choiceSerial).attr("identifier")),pair.push($(this).data("identifier")),2===pair.length&&response.push(pair)}),response},getResponse=function(interaction){return pciResponse.serialize(_getRawResponse(interaction),interaction)},destroy=function(interaction){var $container=containerHelper.get(interaction);$(document).off(".commonRenderer"), $container.off(".commonRenderer"),$container.find(".choice-area").off(".commonRenderer"),$container.find(".qti-flow-container").off(".commonRenderer"),$container.find(".gapmatch-content").empty(),$container.find(".active").removeClass("active"),$container.find(".remove-choice").remove(),$container.find(".empty").removeClass("empty"),containerHelper.reset(interaction)},setState=function(interaction,state){var $container;_.isObject(state)&&(state.response&&(interaction.resetResponse(),interaction.setResponse(state.response)),_.isArray(state.order)&&state.order.length===_.size(interaction.getChoices())&&($container=containerHelper.get(interaction),$(".choice-area .qti-choice",$container).sort(function(a,b){ var aIndex=_.indexOf(state.order,$(a).data("identifier")),bIndex=_.indexOf(state.order,$(b).data("identifier"));return aIndex>bIndex?1:bIndex>aIndex?-1:0}).detach().appendTo($(".choice-area",$container))))},getState=function(interaction){var $container,state={},response=interaction.getResponse();return response&&(state.response=response),interaction.attr("shuffle")===!0&&($container=containerHelper.get(interaction),state.order=[],$(".choice-area .qti-choice",$container).each(function(){state.order.push($(this).data("identifier"))})),state};return{qtiClass:"gapMatchInteraction",template:tpl,render:render,getContainer:containerHelper.get,setResponse:setResponse, @@ -1032,9 +1037,10 @@ entries=_.keys(response.getMapEntries()),_(pairs).difference(entries).forEach(in })}function updateForm(widget,entries){var interaction=widget.element,response=interaction.getResponseDeclaration(),mapEntries=response.getMapEntries(),formatedChoices=_.transform(interaction.getChoices(),function(acc,choice){acc[choice.id()]=choice.val()},{}),options={leftTitle:__("Choice"),rightTitle:__("Gap"),type:"directedPair",pairLeft:function(){return _.map(interaction.getChoices(),function(choice){return{id:choice.id(),value:choice.val()}})},pairRight:function(){return _.map(interaction.getGaps(),function(gap){return{id:gap.id(),value:gap.id()}})},formatLeft:function(value){return formatedChoices[value]||value}};entries&&(options.entries=_.transform(entries,function(result,value){ result[value]=void 0!==mapEntries[value]?mapEntries[value]:response.mappingAttributes.defaultValue},{})),interaction.pairScoringForm=scoringFormFactory(widget,options)}return stateFactory.create(Map,initMapState,exitMapState)}),define("taoQtiItem/qtiCreator/widgets/interactions/gapMatchInteraction/states/states",["taoQtiItem/qtiCreator/widgets/states/factory","taoQtiItem/qtiCreator/widgets/interactions/containerInteraction/states/states","taoQtiItem/qtiCreator/widgets/interactions/gapMatchInteraction/states/Question","taoQtiItem/qtiCreator/widgets/interactions/gapMatchInteraction/states/Answer","taoQtiItem/qtiCreator/widgets/interactions/gapMatchInteraction/states/Correct","taoQtiItem/qtiCreator/widgets/interactions/gapMatchInteraction/states/Map"],function(factory,states){ return factory.createBundle(states,arguments)}),define("taoQtiItem/qtiCreator/widgets/interactions/gapMatchInteraction/Widget",["taoQtiItem/qtiCreator/widgets/interactions/Widget","taoQtiItem/qtiCreator/widgets/interactions/gapMatchInteraction/states/states"],function(Widget,states){var GapMatchInteractionWidget=Widget.clone();return GapMatchInteractionWidget.initCreator=function(){this.registerStates(states),Widget.initCreator.call(this)},GapMatchInteractionWidget}),define("taoQtiItem/qtiCreator/renderers/interactions/GapMatchInteraction",["lodash","taoQtiItem/qtiCommonRenderer/renderers/interactions/GapMatchInteraction","taoQtiItem/qtiCreator/widgets/interactions/gapMatchInteraction/Widget"],function(_,GapMatchInteraction,GapMatchInteractionWidget){ -"use strict";var CreatorGapMatchInteraction=_.clone(GapMatchInteraction);return CreatorGapMatchInteraction.render=function(interaction,options){GapMatchInteractionWidget.build(interaction,GapMatchInteraction.getContainer(interaction),this.getOption("interactionOptionForm"),this.getOption("responseOptionForm"),options)},CreatorGapMatchInteraction}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/graphicAssociateInteraction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt, -stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this;return buffer+='
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
    \n
    \n
    \n
    \n
    \n'; +"use strict";var CreatorGapMatchInteraction=_.clone(GapMatchInteraction);return CreatorGapMatchInteraction.render=function(interaction,options){GapMatchInteractionWidget.build(interaction,GapMatchInteraction.getContainer(interaction),this.getOption("interactionOptionForm"),this.getOption("responseOptionForm"),options)},CreatorGapMatchInteraction}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/graphicAssociateInteraction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,buffer="";return buffer+='id="'+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1.id, +typeof stack1===functionType?stack1.apply(depth0):stack1))+'"'}function program3(depth0,data){var stack1,buffer="";return buffer+=" "+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1["class"],typeof stack1===functionType?stack1.apply(depth0):stack1))}function program5(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this; +return buffer+="
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
    \n
    \n
    \n
    \n
    \n'; })}),define("json!taoQtiItem/qtiCommonRenderer/renderers/graphic-style.json",function(){return{basic:{stroke:"#8D949E","stroke-width":2,"stroke-dasharray":"","stroke-linejoin":"round",fill:"#cccccc","fill-opacity":.5,cursor:"pointer"},hover:{stroke:"#3E7DA7",fill:"#0E5D91","fill-opacity":.3},selectable:{"stroke-dasharray":"-",stroke:"#3E7DA7",fill:"#cccccc","fill-opacity":.5},active:{stroke:"#3E7DA7","stroke-dasharray":"",fill:"#0E5D91","fill-opacity":.5},error:{stroke:"#C74155","stroke-dasharray":"","fill-opacity":.5,fill:"#661728"},success:{stroke:"#C74155","stroke-dasharray":"",fill:"#0E914B","fill-opacity":.5},layer:{fill:"#ffffff",opacity:0,cursor:"pointer" },creator:{"fill-opacity":.5,stroke:"#3E7DA7","stroke-dasharray":"",fill:"#0E5D91",cursor:"pointer"},"imageset-rect-stroke":{fill:"#ffffff",stroke:"#666666","stroke-width":1,"stroke-linejoin":"round",cursor:"pointer"},"imageset-rect-no-stroke":{fill:"#ffffff",stroke:"#ffffff","stroke-width":2,"stroke-linejoin":"round",cursor:"pointer"},"imageset-img":{cursor:"pointer"},"order-text":{fill:"#ffffff",stroke:"#000000","stroke-width":.7,"font-family":"sans-serif","font-weight":"bold","font-size":22,cursor:"pointer"},"score-text-default":{stroke:"#444444","stroke-width":.5,"font-family":"sans-serif","font-weight":"normal","font-size":20,cursor:"pointer"},"score-text":{ stroke:"#000000","stroke-width":.5,"font-family":"sans-serif","font-weight":"normal","font-size":20,cursor:"pointer"},"small-text":{stroke:"#000000","stroke-width":.5,"font-family":"sans-serif","font-weight":"normal","font-size":16,cursor:"pointer"},"layer-pos-text":{stroke:"#333","stroke-width":.5,"font-family":"sans-serif","font-weight":"normal","font-size":14},target:{path:"m 18,8.4143672 -1.882582,0 C 15.801891,4.9747852 13.071059,2.2344961 9.63508,1.9026738 L 9.63508,0 8.2305176,0 l 0,1.9026387 C 4.7947148,2.2343027 2.0637246,4.9746621 1.7481973,8.4143672 l -1.7481973,0 0,1.4045625 1.754877,0 c 0.3460429,3.4066753 3.0632871,6.1119843 6.4756406,6.4413813 l 0,1.739689 1.4045624,0 0,-1.739725 c 3.412547,-0.329537 6.129633,-3.034793 6.475641,-6.4413453 l 1.889279,0 z m -8.36492,6.5188648 0,-4.064673 -1.4045624,0 0,4.063882 C 5.5511016,14.612555 3.4232695,12.494619 3.0864551,9.8189297 l 4.0449512,0 0,-1.4045625 -4.0546368,0 C 3.3788672,5.6984941 5.5228887,3.5393379 8.2305176,3.2161113 l 0,3.9153125 1.4045624,0 0,-3.9160859 c 2.711162,0.3203965 4.858576,2.4808887 5.160955,5.1990293 l -3.927441,0 0,1.4045625 3.917773,0 C 14.449289,12.496957 12.318363,14.616158 9.63508,14.933232 z", @@ -1144,10 +1150,11 @@ return _.map(interaction.getChoices(),function(choice){return{id:choice.id(),val "use strict";return factory.createBundle(states,arguments)}),define("taoQtiItem/qtiCreator/widgets/interactions/graphicAssociateInteraction/Widget",["jquery","lodash","i18n","taoQtiItem/qtiCreator/widgets/interactions/Widget","taoQtiItem/qtiCreator/widgets/interactions/graphicInteraction/Widget","taoQtiItem/qtiCreator/widgets/interactions/graphicAssociateInteraction/states/states"],function($,_,__,Widget,GraphicWidget,states){"use strict";var GraphicAssociateInteractionWidget=_.extend(Widget.clone(),GraphicWidget,{initCreator:function(options){var paper;this.baseUrl=options.baseUrl,this.choiceForm=options.choiceForm,this.registerStates(states),Widget.initCreator.call(this), paper=this.createPaper(),paper&&(this.element.paper=paper,this.createChoices())},destroy:function(){var $container=this.$original,$item=$container.parents(".qti-item");$item.off("resize.gridEdit."+this.element.serial),$(window).off("resize.qti-widget."+this.element.serial),$container.off("resize.qti-widget."+this.element.serial),Widget.destroy.call(this)}});return GraphicAssociateInteractionWidget}),define("taoQtiItem/qtiCreator/renderers/interactions/GraphicAssociateInteraction",["lodash","taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicAssociateInteraction","taoQtiItem/qtiCreator/widgets/interactions/graphicAssociateInteraction/Widget"],function(_,GraphicAssociateInteraction,GraphicAssociateInteractionWidget){ "use strict";var CreatorGraphicAssociateInteraction=_.clone(GraphicAssociateInteraction);return CreatorGraphicAssociateInteraction.render=function(interaction,options){options=options||{},options.baseUrl=this.getOption("baseUrl"),options.choiceForm=this.getOption("choiceOptionForm"),options.uri=this.getOption("uri"),options.lang=this.getOption("lang"),options.mediaManager=this.getOption("mediaManager"),options.assetManager=this.getAssetManager(),GraphicAssociateInteractionWidget.build(interaction,GraphicAssociateInteraction.getContainer(interaction),this.getOption("interactionOptionForm"),this.getOption("responseOptionForm"),options)},CreatorGraphicAssociateInteraction; -}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/graphicGapMatchInteraction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program3(depth0,data){var stack1;return stack1=typeof depth0===functionType?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers), -data=data||{};var stack1,helper,options,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing;return buffer+='
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
    \n
    \n
    \n
    \n
      \n ', -options={hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data},(helper=helpers.gapImgs)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.gapImgs,stack1=typeof helper===functionType?helper.call(depth0,options):helper),helpers.gapImgs||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.program(3,program3,data),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n
    \n
    \n
    \n"})}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicGapMatchInteraction",["jquery","lodash","i18n","core/promise","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/graphicGapMatchInteraction","taoQtiItem/qtiCommonRenderer/helpers/Graphic","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager"],function($,_,__,Promise,tpl,graphic,pciResponse,containerHelper,instructionMgr){ +}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/graphicGapMatchInteraction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,buffer="";return buffer+='id="'+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1.id,typeof stack1===functionType?stack1.apply(depth0):stack1))+'"'}function program3(depth0,data){var stack1,buffer="";return buffer+=" "+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1["class"],typeof stack1===functionType?stack1.apply(depth0):stack1))}function program5(depth0,data){ +var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}function program7(depth0,data){var stack1;return stack1=typeof depth0===functionType?depth0.apply(depth0):depth0,stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this,blockHelperMissing=helpers.blockHelperMissing;return buffer+="
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
    \n
    \n
    \n
    \n
      \n ', +options={hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data},(helper=helpers.gapImgs)?stack1=helper.call(depth0,options):(helper=depth0&&depth0.gapImgs,stack1=typeof helper===functionType?helper.call(depth0,options):helper),helpers.gapImgs||(stack1=blockHelperMissing.call(depth0,stack1,{hash:{},inverse:self.noop,fn:self.program(7,program7,data),data:data})),(stack1||0===stack1)&&(buffer+=stack1),buffer+="\n
    \n
    \n
    \n"})}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicGapMatchInteraction",["jquery","lodash","i18n","core/promise","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/graphicGapMatchInteraction","taoQtiItem/qtiCommonRenderer/helpers/Graphic","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager"],function($,_,__,Promise,tpl,graphic,pciResponse,containerHelper,instructionMgr){ "use strict";var render=function(interaction){var self=this;return new Promise(function(resolve,reject){var $container=containerHelper.get(interaction),$gapList=$("ul.source",$container),background=($(".main-image-box",$container),interaction.object.attributes);interaction.gapFillers=[],$container.off("resized.qti-widget.resolve").one("resized.qti-widget.resolve",resolve),interaction.paper=graphic.responsivePaper("graphic-paper-"+interaction.serial,interaction.serial,{width:background.width,height:background.height,img:self.resolveUrl(background.data),imgId:"bg-image-"+interaction.serial,container:$container,resize:function(newSize,factor){$gapList.css("max-width",newSize+"px"), 1!==factor&&$gapList.find("img").each(function(){var $img=$(this);$img.width($img.attr("width")*factor),$img.height($img.attr("height")*factor)})}}),_.forEach(interaction.getChoices(),_.partial(_renderChoice,interaction)),_renderGapList(interaction,$gapList),_paperUnSelect(interaction)})},_renderChoice=function(interaction,choice){graphic.createElement(interaction.paper,choice.attr("shape"),choice.attr("coords"),{id:choice.serial,title:__("Select an image first"),hover:!1}).data("max",choice.attr("matchMax")).data("matching",[]).click(function(){_isMatchable(this)&&this.selectable===!0&&_selectShape(interaction,this)})},_renderGapList=function(interaction,$gapList){ $gapList.children("li").click(function(e){e.preventDefault();var $elt=$(this);$elt.hasClass("disabled")||($elt.hasClass("active")?($elt.removeClass("active"),_shapesUnSelectable(interaction)):($gapList.children("li").removeClass("active"),$elt.addClass("active"),_shapesSelectable(interaction)))})},_paperUnSelect=function(interaction){var $container=containerHelper.get(interaction),$gapImages=$("ul > li",$container),image=interaction.paper.getById("bg-image-"+interaction.serial);image&&image.click(function(){_shapesUnSelectable(interaction),$gapImages.removeClass("active")})},_selectShape=function(interaction,element,trackResponse){var $img,$clone,gapFiller,id,bbox,shapeOffset,activeOffset,matching,currentCount; @@ -1197,9 +1204,10 @@ stack1=null==stack1||stack1===!1?stack1:stack1.width,typeof stack1===functionTyp "use strict";var GraphicGapMatchInteractionWidget=_.extend(Widget.clone(),GraphicWidget,{initCreator:function(options){var paper;this.baseUrl=options.baseUrl,this.choiceForm=options.choiceForm,this.registerStates(states),Widget.initCreator.call(this),paper=this.createPaper(_.bind(this.scaleGapList,this)),paper&&(this.element.paper=paper,this.createChoices(),this.createGapImgs())},destroy:function(){var $container=this.$original,$item=$container.parents(".qti-item");$item.off("resize.gridEdit."+this.element.serial),$(window).off("resize.qti-widget."+this.element.serial),$container.off("resize.qti-widget."+this.element.serial),Widget.destroy.call(this)},scaleGapList:function(newSize,factor){ var $container=this.$original,$gapList=$("ul.source",$container);$gapList.css("max-width",newSize+"px"),factor&&1!==factor&&($gapList.find("img").each(function(){var $img=$(this);$img.width($img.attr("width")*factor),$img.height($img.attr("height")*factor)}),$container.data("factor",factor))},createGapImgs:function(){var interaction=this.element,$container=this.$original,$gapList=$("ul.source",$container);$gapList.empty(),_.forEach(interaction.gapImgs,function(gapImg){$gapList.append(gapImg.render())})}});return GraphicGapMatchInteractionWidget}),define("taoQtiItem/qtiCreator/renderers/interactions/GraphicGapMatchInteraction",["lodash","taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicGapMatchInteraction","taoQtiItem/qtiCreator/widgets/interactions/graphicGapMatchInteraction/Widget"],function(_,GraphicGapMatchInteraction,GraphicGapMatchInteractionWidget){ "use strict";var CreatorGraphicGapMatchInteraction=_.clone(GraphicGapMatchInteraction);return CreatorGraphicGapMatchInteraction.render=function(interaction,options){options=options||{},options.baseUrl=this.getOption("baseUrl"),options.choiceForm=this.getOption("choiceOptionForm"),options.uri=this.getOption("uri"),options.lang=this.getOption("lang"),options.mediaManager=this.getOption("mediaManager"),options.assetManager=this.getAssetManager(),GraphicGapMatchInteractionWidget.build(interaction,GraphicGapMatchInteraction.getContainer(interaction),this.getOption("interactionOptionForm"),this.getOption("responseOptionForm"),options)},CreatorGraphicGapMatchInteraction; -}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/graphicOrderInteraction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this;return buffer+='
    \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
    \n
    \n
    \n
    \n
      \n
      \n
      \n'})}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicOrderInteraction",["jquery","lodash","i18n","core/promise","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/graphicOrderInteraction","taoQtiItem/qtiCommonRenderer/helpers/Graphic","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager"],function($,_,__,Promise,tpl,graphic,pciResponse,containerHelper,instructionMgr){ +}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/graphicOrderInteraction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,buffer="";return buffer+='id="'+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1.id,typeof stack1===functionType?stack1.apply(depth0):stack1))+'"'}function program3(depth0,data){var stack1,buffer="";return buffer+=" "+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1["class"],typeof stack1===functionType?stack1.apply(depth0):stack1))}function program5(depth0,data){ +var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this;return buffer+="
      \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop, +fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
      \n
      \n
      \n
      \n
        \n
        \n
        \n'})}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicOrderInteraction",["jquery","lodash","i18n","core/promise","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/graphicOrderInteraction","taoQtiItem/qtiCommonRenderer/helpers/Graphic","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager"],function($,_,__,Promise,tpl,graphic,pciResponse,containerHelper,instructionMgr){ "use strict";var render=function(interaction){var self=this;return new Promise(function(resolve,reject){var $container=containerHelper.get(interaction),$orderList=$("ul",$container),background=interaction.object.attributes;$container.off("resized.qti-widget.resolve").one("resized.qti-widget.resolve",resolve),interaction.paper=graphic.responsivePaper("graphic-paper-"+interaction.serial,interaction.serial,{width:background.width,height:background.height,img:self.resolveUrl(background.data),imgId:"bg-image-"+interaction.serial,container:$container}),_renderOrderList(interaction,$orderList),_.forEach(interaction.getChoices(),_.partial(_renderChoice,interaction,$orderList)), instructionMgr.minMaxChoiceInstructions(interaction,{min:interaction.attr("minChoices"),max:interaction.attr("maxChoices"),getResponse:_getRawResponse,onError:function(data){graphic.highlightError(data.target)}})})},_renderChoice=function(interaction,$orderList,choice){graphic.createElement(interaction.paper,choice.attr("shape"),choice.attr("coords"),{id:choice.serial,title:__("Select this area")}).click(function(){this.active?_unselectShape(interaction.paper,this,$orderList):_selectShape(interaction.paper,this,$orderList),containerHelper.triggerResponseChangeEvent(interaction),instructionMgr.validateInstructions(interaction,{choice:choice})})},_renderOrderList=function(interaction,$orderList){ var $orderers,size=_.size(interaction.getChoices()),min=interaction.attr("minChoices"),max=interaction.attr("maxChoices");max>0&&size>max?size=max:min>0&&size>min&&(size=min),_.times(size,function(index){var position=index+1,$orderer=$('
      • '+position+"
      • ");0===index&&$orderer.addClass("active"),$orderList.append($orderer)}),_createTexts(interaction.paper,size,$orderList),$orderers=$orderList.children("li"),$orderers.click(function(e){e.preventDefault();var $orderer=$(this);$orderer.hasClass("active")||$orderer.hasClass("disabled")||($orderers.removeClass("active"),$orderer.addClass("active"))})},_selectShape=function(paper,element,$orderList){ @@ -1238,9 +1246,10 @@ var widget=this.widget,interaction=widget.element;interaction.paper&&(widget.$co paper&&(this.element.paper=paper,this.createChoices(),this.renderOrderList())},destroy:function(){var $container=this.$original,$item=$container.parents(".qti-item");$item.off("resize.gridEdit."+this.element.serial),$(window).off("resize.qti-widget."+this.element.serial),$container.off("resize.qti-widget."+this.element.serial),Widget.destroy.call(this)},scaleOrderList:function(newSize){$("ul.block-listing",this.$original).css("max-width",newSize+"px")},renderOrderList:function(){var interaction=this.element,size=_.size(interaction.getChoices()),min=interaction.attr("minChoices"),max=interaction.attr("maxChoices"),$orderList=$("ul.block-listing",this.$original); max>0&&size>max?size=max:min>0&&size>min&&(size=min),$orderList.empty(),_.times(size,function(index){var position=index+1,$orderer=$('
      • '+position+"
      • ");0===index&&$orderer.addClass("active"),$orderList.append($orderer)})}});return GraphicOrderInteractionWidget}),define("taoQtiItem/qtiCreator/renderers/interactions/GraphicOrderInteraction",["lodash","taoQtiItem/qtiCommonRenderer/renderers/interactions/GraphicOrderInteraction","taoQtiItem/qtiCreator/widgets/interactions/graphicOrderInteraction/Widget"],function(_,GraphicOrderInteraction,GraphicOrderInteractionWidget){"use strict";var CreatorGraphicOrderInteraction=_.clone(GraphicOrderInteraction); return CreatorGraphicOrderInteraction.render=function(interaction,options){options=options||{},options.baseUrl=this.getOption("baseUrl"),options.choiceForm=this.getOption("choiceOptionForm"),options.uri=this.getOption("uri"),options.lang=this.getOption("lang"),options.mediaManager=this.getOption("mediaManager"),options.assetManager=this.getAssetManager(),GraphicOrderInteractionWidget.build(interaction,GraphicOrderInteraction.getContainer(interaction),this.getOption("interactionOptionForm"),this.getOption("responseOptionForm"),options)},CreatorGraphicOrderInteraction}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/hotspotInteraction",["handlebars"],function(hb){ -return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this;return buffer+='
        \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
        \n
        \n
        \n
        \n
        \n'})}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/HotspotInteraction",["jquery","lodash","i18n","core/promise","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/hotspotInteraction","taoQtiItem/qtiCommonRenderer/helpers/Graphic","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager"],function($,_,__,Promise,tpl,graphic,pciResponse,containerHelper,instructionMgr){ +return hb.template(function(Handlebars,depth0,helpers,partials,data){function program1(depth0,data){var stack1,buffer="";return buffer+='id="'+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1.id,typeof stack1===functionType?stack1.apply(depth0):stack1))+'"'}function program3(depth0,data){var stack1,buffer="";return buffer+=" "+escapeExpression((stack1=depth0&&depth0.attributes,stack1=null==stack1||stack1===!1?stack1:stack1["class"],typeof stack1===functionType?stack1.apply(depth0):stack1))}function program5(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data +}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this;return buffer+="
        \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(5,program5,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
        \n
        \n
        \n
        \n
        \n'})}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/HotspotInteraction",["jquery","lodash","i18n","core/promise","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/hotspotInteraction","taoQtiItem/qtiCommonRenderer/helpers/Graphic","taoQtiItem/qtiCommonRenderer/helpers/PciResponse","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager"],function($,_,__,Promise,tpl,graphic,pciResponse,containerHelper,instructionMgr){ "use strict";var render=function(interaction){var self=this;return new Promise(function(resolve,reject){var $container=containerHelper.get(interaction),background=interaction.object.attributes;$container.off("resized.qti-widget.resolve").one("resized.qti-widget.resolve",resolve),interaction.paper=graphic.responsivePaper("graphic-paper-"+interaction.serial,interaction.serial,{width:background.width,height:background.height,img:self.resolveUrl(background.data),container:$container}),_.forEach(interaction.getChoices(),_.partial(_renderChoice,interaction)),instructionMgr.minMaxChoiceInstructions(interaction,{min:interaction.attr("minChoices"),max:interaction.attr("maxChoices"), getResponse:_getRawResponse,onError:function(data){data.target.active&&(data.target.active=!1,graphic.updateElementState(this,"basic",__("Select this area")),graphic.highlightError(data.target),containerHelper.triggerResponseChangeEvent(interaction),$container.trigger("inactiveChoice.qti-widget",[data.choice,data.target]))}})})},_renderChoice=function(interaction,choice){var $container=containerHelper.get(interaction);graphic.createElement(interaction.paper,choice.attr("shape"),choice.attr("coords"),{id:choice.serial,title:__("Select this area")}).click(function(){this.active?(graphic.updateElementState(this,"basic",__("Select this area")),this.active=!1,$container.trigger("inactiveChoice.qti-widget",[choice,this])):(graphic.updateElementState(this,"active",__("Click again to remove")), this.active=!0,$container.trigger("activeChoice.qti-widget",[choice,this])),containerHelper.triggerResponseChangeEvent(interaction),instructionMgr.validateInstructions(interaction,{choice:choice,target:this})})},_getRawResponse=function(interaction){return _(interaction.getChoices()).map(function(choice){var rElement=interaction.paper.getById(choice.serial);return rElement&&rElement.active===!0?choice.id():!1}).filter(_.isString).value()},setResponse=function(interaction,response){var responseValues;if(response&&interaction.paper){try{responseValues=pciResponse.unserialize(response,interaction)}catch(e){}_.isArray(responseValues)&&_.forEach(interaction.getChoices(),function(choice){ @@ -1277,15 +1286,16 @@ commonRenderer.setResponse(interaction,PciResponse.serialize(_.values(response.g "use strict";return factory.createBundle(states,arguments)}),define("taoQtiItem/qtiCreator/widgets/interactions/hotspotInteraction/Widget",["jquery","lodash","i18n","taoQtiItem/qtiCreator/widgets/interactions/Widget","taoQtiItem/qtiCreator/widgets/interactions/graphicInteraction/Widget","taoQtiItem/qtiCreator/widgets/interactions/hotspotInteraction/states/states"],function($,_,__,Widget,GraphicWidget,states){"use strict";var HotspotInteractionWidget=_.extend(Widget.clone(),GraphicWidget,{initCreator:function(options){var paper;this.baseUrl=options.baseUrl,this.choiceForm=options.choiceForm,this.registerStates(states),Widget.initCreator.call(this),paper=this.createPaper(), paper&&(this.element.paper=paper,this.createChoices())},destroy:function(){var $container=this.$original,$item=$container.parents(".qti-item");$item.off("resize.gridEdit."+this.element.serial),$(window).off("resize.qti-widget."+this.element.serial),$container.off("resize.qti-widget."+this.element.serial),Widget.destroy.call(this)}});return HotspotInteractionWidget}),define("taoQtiItem/qtiCreator/renderers/interactions/HotspotInteraction",["lodash","taoQtiItem/qtiCommonRenderer/renderers/interactions/HotspotInteraction","taoQtiItem/qtiCreator/widgets/interactions/hotspotInteraction/Widget"],function(_,HotspotInteraction,HotspotInteractionWidget){"use strict";var CreatorHotspotInteraction=_.clone(HotspotInteraction); return CreatorHotspotInteraction.render=function(interaction,options){options=options||{},options.baseUrl=this.getOption("baseUrl"),options.choiceForm=this.getOption("choiceOptionForm"),options.uri=this.getOption("uri"),options.lang=this.getOption("lang"),options.mediaManager=this.getOption("mediaManager"),options.assetManager=this.getAssetManager(),HotspotInteractionWidget.build(interaction,HotspotInteraction.getContainer(interaction),this.getOption("interactionOptionForm"),this.getOption("responseOptionForm"),options)},CreatorHotspotInteraction}),define("tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/hottextInteraction",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){ -function program1(depth0,data){var stack1,helper;return(helper=helpers.prompt)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.prompt,stack1=typeof helper===functionType?helper.call(depth0,{hash:{},data:data}):helper),stack1||0===stack1?stack1:""}this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,buffer="",functionType="function",escapeExpression=this.escapeExpression,self=this;return buffer+='
        \n ',stack1=helpers["if"].call(depth0,depth0&&depth0.prompt,{hash:{},inverse:self.noop,fn:self.program(1,program1,data),data:data}),(stack1||0===stack1)&&(buffer+=stack1),buffer+='\n
        \n
        ',(helper=helpers.body)?stack1=helper.call(depth0,{hash:{},data:data}):(helper=depth0&&depth0.body,stack1=typeof helper===functionType?helper.call(depth0,{ -hash:{},data:data}):helper),(stack1||0===stack1)&&(buffer+=stack1),buffer+="
        \n
        "})}),define("taoQtiItem/qtiCommonRenderer/renderers/interactions/HottextInteraction",["jquery","lodash","i18n","tpl!taoQtiItem/qtiCommonRenderer/tpl/interactions/hottextInteraction","taoQtiItem/qtiCommonRenderer/helpers/container","taoQtiItem/qtiCommonRenderer/helpers/instructions/instructionManager","taoQtiItem/qtiCommonRenderer/helpers/PciResponse"],function($,_,__,tpl,containerHelper,instructionMgr,pciResponse){"use strict";var pseudoLabel=function(interaction){var $container=containerHelper.get(interaction),setChoice=function($choice,interaction){var $inupt=$choice.find("input"); -if($inupt.prop("checked")||$inupt.hasClass("disabled"))$inupt.prop("checked",!1);else{var maxChoices=parseInt(interaction.attr("maxChoices")),currentChoices=_.values(_getRawResponse(interaction)).length;(maxChoices>currentChoices||0===maxChoices)&&$inupt.prop("checked",!0)}containerHelper.triggerResponseChangeEvent(interaction),instructionMgr.validateInstructions(interaction,{choice:$choice})};$(".hottext",$container).on("click",function(e){e.preventDefault(),setChoice($(this),interaction)})},render=function(interaction){pseudoLabel(interaction),instructionMgr.minMaxChoiceInstructions(interaction,{min:interaction.attr("minChoices"),max:interaction.attr("maxChoices"), -getResponse:_getRawResponse,onError:function(data){var $input,$choice,$icon;data.choice&&data.choice.length&&($choice=data.choice.addClass("error"),$input=$choice.find("input"),$icon=$choice.find(" > label > span").addClass("error cross"),setTimeout(function(){$input.prop("checked",!1),$choice.removeClass("error"),$icon.removeClass("error cross")},350))}})},resetResponse=function(interaction){var $container=containerHelper.get(interaction);$("input",$container).prop("checked",!1)},setResponse=function(interaction,response){var $container=containerHelper.get(interaction);try{_.each(pciResponse.unserialize(response,interaction),function(identifier){$container.find("input[value="+identifier+"]").prop("checked",!0); -}),instructionMgr.validateInstructions(interaction)}catch(e){throw new Error("wrong response format in argument : "+e)}},_getRawResponse=function(interaction){var values=[],$container=containerHelper.get(interaction);return $("input:checked",$container).each(function(){values.push($(this).val())}),values},getResponse=function(interaction){return pciResponse.serialize(_getRawResponse(interaction),interaction)},destroy=function(interaction){var $container=containerHelper.get(interaction);$container.find(".hottext").off("click"),containerHelper.reset(interaction)},setState=function(interaction,state){_.isObject(state)&&state.response&&(interaction.resetResponse(), -interaction.setResponse(state.response))},getState=function(interaction){var state={},response=interaction.getResponse();return response&&(state.response=response),state};return{qtiClass:"hottextInteraction",template:tpl,render:render,getContainer:containerHelper.get,setResponse:setResponse,getResponse:getResponse,resetResponse:resetResponse,destroy:destroy,setState:setState,getState:getState}}),define("tpl!taoQtiItem/qtiCreator/tpl/forms/interactions/hottext",["handlebars"],function(hb){return hb.template(function(Handlebars,depth0,helpers,partials,data){this.compilerInfo=[4,">= 1.0.0"],helpers=this.merge(helpers,Handlebars.helpers),data=data||{};var stack1,helper,options,buffer="",helperMissing=helpers.helperMissing,escapeExpression=this.escapeExpression,functionType="function"; -return buffer+='
        \n

        '+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"Allowed choices",options):helperMissing.call(depth0,"__","Allowed choices",options)))+'

        \n\n
        \n \n \n\n \n \n '+escapeExpression((helper=helpers.__||depth0&&depth0.__,options={hash:{},data:data},helper?helper.call(depth0,"The minimum number of choices that the candidate is required to select to form a valid response.",options):helperMissing.call(depth0,"__","The minimum number of choices that the candidate is required to select to form a valid response.",options)))+'\n \n
        \n
        \n