From 98939a3c844ed127f8583688e291d6618e949cf3 Mon Sep 17 00:00:00 2001 From: Nobelium Date: Sat, 26 Jul 2014 14:46:25 +0000 Subject: [PATCH] MDL-46236 mod_scorm : Setting lauch options for scorm in popup --- mod/scorm/view.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mod/scorm/view.js b/mod/scorm/view.js index 51c19d17065..f716978bb75 100644 --- a/mod/scorm/view.js +++ b/mod/scorm/view.js @@ -65,6 +65,7 @@ M.mod_scormform.init = function(Y) { } if (launch == true) { + setlaunchoptions(); winobj = window.open(launch_url,'Popup', poptions); this.target='Popup'; scormredirect(winobj); @@ -72,10 +73,18 @@ M.mod_scormform.init = function(Y) { // Listen for view form submit and generate popup on user interaction. if (scormform) { Y.on('submit', function(e) { + setlaunchoptions(); winobj = window.open(launch_url, 'Popup', poptions); this.target='Popup'; scormredirect(winobj); e.preventDefault(); }, scormform); } + + var setlaunchoptions = function() { + var mode = Y.one('#scormviewform input[name=mode]:checked').get('value'); + launch_url += '&mode=' + (mode ? mode : 'normal'); + var newattempt = Y.one('#scormviewform #a'); + launch_url += (newattempt && newattempt.get('checked') ? '&newattempt=on' : ''); + } }