diff --git a/views/js/pciCreator/ims/geogebrapci/interaction/creator/widget/states/Question.js b/views/js/pciCreator/ims/geogebrapci/interaction/creator/widget/states/Question.js index 4c0b057..ff86b4a 100644 --- a/views/js/pciCreator/ims/geogebrapci/interaction/creator/widget/states/Question.js +++ b/views/js/pciCreator/ims/geogebrapci/interaction/creator/widget/states/Question.js @@ -21,12 +21,13 @@ define([ var GGBPCIStateQuestion = stateFactory.extend(Question, function () { - + console.log("STATEFACTORY 2 : First code to be read") }, function () { - + console.log("STATEFACTORY 1 : it is coming at the end of the loading") + }); @@ -34,13 +35,12 @@ define([ //Rappel : interaction.prop() is a setter for config in renderer // interaction.properties = config in render - - var _widget = this.widget, Sform = _widget.$form, interaction = _widget.element, - response = interaction.getResponseDeclaration(), + response = interaction.getResponseDeclaration(), + //GGB - APP Parameters get from pciCreator param_appName = interaction.prop('param').appName, param_width = interaction.prop('param').width, param_height = interaction.prop('param').height, @@ -48,6 +48,7 @@ define([ param_showZoomButtons = interaction.prop('param').showZoomButtons, param_showFullscreenButton = interaction.prop('param').showFullscreenButton, param_language = interaction.prop('param').language, + // param_country = interaction.prop('param').country, param_showMenuBar = interaction.prop('param').showMenuBar, param_showToolBar = interaction.prop('param').showToolBar, param_allowStyleBar = interaction.prop('param').allowStyleBar, @@ -56,7 +57,11 @@ define([ param_saveB64 = interaction.prop('resp').data, param_AnswerSet = interaction.prop('resp').answerSet; + + + //response.correctResponse = 1 + var correct = _.values(interaction.getResponseDeclaration().getCorrect()); //This is the responseDeclaration in XML @@ -79,10 +84,13 @@ define([ //init form javascript formElement.initWidget(Sform); + + $(".saveAppData").on("click", function() { interaction.properties.state = "modified"; - interaction.properties.param.filename="saved"; + interaction.properties.param.filename="saved"; + interaction.triggerPci('dataChange', [interaction.properties]); // Send it to AMD for action }) @@ -134,7 +142,6 @@ define([ Sform.find("#RightClick").on("click", function() { let toggle = $(this).prop("checked"); - console.log(toggle); interaction.triggerPci('RightClickChange', [toggle]); // Send it to AMD for action interaction.properties.param.enableRightClick = toggle; @@ -168,7 +175,6 @@ define([ interaction.properties.param.showZoomButtons = GGBConfig.appShowZoomBT; interaction.properties.param.showFullscreenButton = GGBConfig.appShowFScreenBT; interaction.properties.param.language = GGBConfig.language; - //interaction.properties.param.country = GGBConfig.country; interaction.properties.param.showMenuBar = GGBConfig.MenuBar; interaction.properties.param.showToolBar = GGBConfig.ToolBar; interaction.properties.param.algebraInputPosition = true; @@ -176,15 +182,6 @@ define([ interaction.properties.param.enableRightClick = GGBConfig.RightClick; interaction.properties.param.enableUndoRedo = GGBConfig.UndoRedo; - /* try { - console.log("NO DATA"); - //ggbApplet.getBase64(function(b) { GGBConfig.file = b }); - } catch (error) { - //console.error(error); - GGBConfig.file = ""; - console.log(error); - } */ - interaction.triggerPci('appChange', [GGBConfig]); // Send it to AMD for action }); diff --git a/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/GGBInteraction.js b/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/GGBInteraction.js index 066f10e..85f7304 100644 --- a/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/GGBInteraction.js +++ b/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/GGBInteraction.js @@ -40,8 +40,8 @@ define(['qtiCustomInteractionContext', * @param {Object} [state] - the json serialized state object, returned by previous call to getStatus(), use to initialize an */ getInstance: function getInstance(dom, config, state) { - var response = config.boundTo; + config.properties.param = JSON.parse(config.properties.param) config.properties.resp = JSON.parse(config.properties.resp) @@ -159,9 +159,11 @@ define(['qtiCustomInteractionContext', * @param {Object} interaction */ destroy: function () { - if (typeof this.api !== "undefined") { - this.api.remove(); + if (typeof this.previewApplet !== "undefined") { + this.previewApplet.remove(); } + + //window.ggbApplet.remove() var $container = $(this.dom); $container.off().empty(); @@ -202,6 +204,7 @@ define(['qtiCustomInteractionContext', //renderer.render(_this, _this.dom, _this.config, assetManager); renderer.render(_this, _this.dom, config, assetManager); + //Listening to Change Data called from Question after changing values for config this.on('dataChange', function (conf) { @@ -265,7 +268,8 @@ define(['qtiCustomInteractionContext', } else { // Fail code - + console.log(data.thumbUrl); + console.log('No valid Thumbnail found ! Sorry') $('#miniat').html(""); } }); @@ -326,9 +330,13 @@ define(['qtiCustomInteractionContext', setTimeout(() => { $(_this.dom).find(".groupPanel").removeAttr("style"); + + // $(_this.dom).find(".groupPanel").css("backgroundColor", "red"); $(_this.dom).find(".groupPanel").css("width", ""); + $(_this.dom).find(".mowColorPlusButton").css("width", ""); $(_this.dom).find(".mowColorPlusButton").css("top", ""); + //$(_this.dom).find(".groupPanel").css("width", "360px!important"); }, 500); }); diff --git a/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/instancer.js b/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/instancer.js index a70b30b..fc0b817 100644 --- a/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/instancer.js +++ b/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/instancer.js @@ -13,13 +13,15 @@ define(['GGBPCI/interaction/runtime/js/lib/deployggb'], function(GGBApplet) { 'use strict'; function instancer(pciObj, $container, config) { + var ggbdom = "ggb_" + Date.now(); $container.find(".GGBPCI").append('
'); if ($container.parent().hasClass('widget-box')) { - + initGGB(config); } else { + previeGGBPCI(config) } @@ -51,6 +53,7 @@ define(['GGBPCI/interaction/runtime/js/lib/deployggb'], function(GGBApplet) { function initGGB(config) { if (config.param.filename.length > 0) { var ggbApp = new GGBApplet({ + id: "ggbAssess", filename: config.param.filename, detachKeyboard: false, appName: config.param.appName, @@ -87,10 +90,9 @@ define(['GGBPCI/interaction/runtime/js/lib/deployggb'], function(GGBApplet) { ggbApp.inject(ggbdom); cssCorrecter(); - - } else { var ggbApp = new GGBApplet({ + id: "ggbAssess", detachKeyboard : false, appName : config.param.appName, showToolBar : config.param.showToolBar, @@ -129,8 +131,9 @@ define(['GGBPCI/interaction/runtime/js/lib/deployggb'], function(GGBApplet) { } function previeGGBPCI(config) { - + var ggbApp = new GGBApplet({ + id: "ggbAssess", detachKeyboard: false, appName: config.param.appName, showToolBar: config.param.showToolBar, @@ -161,12 +164,11 @@ define(['GGBPCI/interaction/runtime/js/lib/deployggb'], function(GGBApplet) { pciObj.previewApplet = api; } else { pciObj.previewApplet = api; - } + } } }, true); ggbApp.inject(ggbdom); - cssCorrecter() } diff --git a/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/lib/deployggb.js b/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/lib/deployggb.js index 164861b..de207ac 100644 --- a/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/lib/deployggb.js +++ b/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/lib/deployggb.js @@ -383,9 +383,11 @@ web3d.succeeded = web3d.succeeded || web3d() //JANFIX : Here is the launcher } scriptLoaded() - console.log("JPTRACKER1") + console.log("JPTRACKER100") - } else if (html5Codebase.requirejs) { require(["geogebra/runtime/js/web3d/web3d.nocache"], scriptLoaded); } else { // original + } else if (html5Codebase.requirejs) { + //require(["geogebra/runtime/js/web3d/web3d.nocache"], scriptLoaded); + } else { // original script.onload = scriptLoaded; appletElem.appendChild(script) console.log("JPTRACKER2") diff --git a/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/renderer.js b/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/renderer.js index 72d0041..7eaa2f6 100644 --- a/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/renderer.js +++ b/views/js/pciCreator/ims/geogebrapci/interaction/runtime/js/renderer.js @@ -15,7 +15,7 @@ define(['taoQtiItem/portableLib/jquery_2_1_1', 'use strict'; function renderChoices(pciObj, $container, config) { - + instancer.ggb(pciObj, $container, config); }