MDL-70361 mod_lti: deeplinking multiple preserve resourceid and tag

This commit is contained in:
Claude Vervoort 2020-11-30 14:41:13 -05:00
parent c8d33eb9ce
commit 3071777ddb
4 changed files with 4 additions and 5 deletions

View File

@ -1,2 +1,2 @@
function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var h=a.apply(b,c);function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}f(void 0)})}}define ("mod_lti/contentitem",["jquery","core/notification","core/str","core/templates","mod_lti/form-field","core/modal_factory","core/modal_events"],function(a,b,c,d,e,f,g){var h,i,j=[new e("name",e.TYPES.TEXT,!1,""),new e("introeditor",e.TYPES.EDITOR,!1,""),new e("toolurl",e.TYPES.TEXT,!0,""),new e("securetoolurl",e.TYPES.TEXT,!0,""),new e("instructorchoiceacceptgrades",e.TYPES.CHECKBOX,!0,!0),new e("instructorchoicesendname",e.TYPES.CHECKBOX,!0,!0),new e("instructorchoicesendemailaddr",e.TYPES.CHECKBOX,!0,!0),new e("instructorcustomparameters",e.TYPES.TEXT,!0,""),new e("icon",e.TYPES.TEXT,!0,""),new e("secureicon",e.TYPES.TEXT,!0,""),new e("launchcontainer",e.TYPES.SELECT,!0,0),new e("grade_modgrade_point",e.TYPES.TEXT,!1,""),new e("lineitemresourceid",e.TYPES.TEXT,!0,""),new e("lineitemtag",e.TYPES.TEXT,!0,"")],k=function(a){a.setAttribute("hidden","true");a.setAttribute("aria-hidden","true");a.setAttribute("tab-index","-1")},l=function(a){a.removeAttribute("hidden");a.setAttribute("aria-hidden","false");a.setAttribute("tab-index","1")},m=function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(b){var c,e,f,g,h,i,j;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:c=document.querySelector("#region-main-box form");e=c.querySelector("[data-attribute=\"dynamic-import\"]");f=c.querySelector("#fgroup_id_buttonar");g=c.querySelector("#id_submitbutton");Array.from(c.children).forEach(k);k(g);a.next=8;return d.renderForPromise("mod_lti/tool_deeplinking_results",{items:b});case 8:h=a.sent;i=h.html;j=h.js;a.next=13;return d.replaceNodeContents(e,i,j);case 13:l(e);l(f);case 15:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}(),n=function(a){var b={};["name","toolurl","securetoolurl","instructorcustomparameters","icon","secureicon","launchcontainer"].forEach(function(c){b[c]=a[c]||""});b["introeditor[text]"]=a.introeditor?a.introeditor.text:"";b["introeditor[format]"]=a.introeditor?a.introeditor.format:"";if(1===a.instructorchoiceacceptgrades){b.instructorchoiceacceptgrades="1";b["grade[modgrade_point]"]=a.grade_modgrade_point||"100"}else{b.instructorchoiceacceptgrades="0"}return b};window.processContentItemReturnData=function(a){if(h){h.hide()}if(a.multiple){for(var b in j){j[b].setFieldValue("name"===j[b].name?"item":null)}var c=[];a.multiple.forEach(function(a){c.push(n(a))});m(a.multiple);var f=document.querySelector("#id_submitbutton2");f.onclick=function(a){a.preventDefault();f.disabled=!0;var b=new FormData(document.querySelector("form.mform")),d=function(){document.querySelector("#id_cancel").click()};c.reduce(function postVariant(a,c){Object.entries(c).forEach(function(a){return b.set(a[0],a[1])});var d=new URLSearchParams(b),e=function(){return fetch(document.location.pathname,{method:"post",body:d})};return a.then(e).catch(e)},Promise.resolve()).then(d).catch(d)}}else{for(b in j){var d=j[b],e=null;if("undefined"!=typeof a[d.name]){e=a[d.name]}d.setFieldValue(e)}d.setFieldValue(e)}if(i){i(a)}};return{init:function init(a,e,j){i=j;var k=d.render("mod_lti/contentitem",{url:a,postData:e});if(h){h.setBody(k);h.show();return}c.get_string("selectcontent","lti").then(function(a){return f.create({title:a,body:k,large:!0})}).then(function(a){h=a;a.getRoot().on(g.hidden,function(){a.setBody("");b.fetchNotifications()});a.show()}).catch(b.exception)}}});
function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){c(a);return}if(h.done){b(i)}else{Promise.resolve(i).then(d,e)}}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){var h=a.apply(b,c);function f(a){asyncGeneratorStep(h,d,e,f,g,"next",a)}function g(a){asyncGeneratorStep(h,d,e,f,g,"throw",a)}f(void 0)})}}define ("mod_lti/contentitem",["jquery","core/notification","core/str","core/templates","mod_lti/form-field","core/modal_factory","core/modal_events"],function(a,b,c,d,e,f,g){var h,i,j=[new e("name",e.TYPES.TEXT,!1,""),new e("introeditor",e.TYPES.EDITOR,!1,""),new e("toolurl",e.TYPES.TEXT,!0,""),new e("securetoolurl",e.TYPES.TEXT,!0,""),new e("instructorchoiceacceptgrades",e.TYPES.CHECKBOX,!0,!0),new e("instructorchoicesendname",e.TYPES.CHECKBOX,!0,!0),new e("instructorchoicesendemailaddr",e.TYPES.CHECKBOX,!0,!0),new e("instructorcustomparameters",e.TYPES.TEXT,!0,""),new e("icon",e.TYPES.TEXT,!0,""),new e("secureicon",e.TYPES.TEXT,!0,""),new e("launchcontainer",e.TYPES.SELECT,!0,0),new e("grade_modgrade_point",e.TYPES.TEXT,!1,""),new e("lineitemresourceid",e.TYPES.TEXT,!0,""),new e("lineitemtag",e.TYPES.TEXT,!0,"")],k=function(a){a.setAttribute("hidden","true");a.setAttribute("aria-hidden","true");a.setAttribute("tab-index","-1")},l=function(a){a.removeAttribute("hidden");a.setAttribute("aria-hidden","false");a.setAttribute("tab-index","1")},m=function(){var a=_asyncToGenerator(regeneratorRuntime.mark(function a(b){var c,e,f,g,h,i,j;return regeneratorRuntime.wrap(function(a){while(1){switch(a.prev=a.next){case 0:c=document.querySelector("#region-main-box form");e=c.querySelector("[data-attribute=\"dynamic-import\"]");f=c.querySelector("#fgroup_id_buttonar");g=c.querySelector("#id_submitbutton");Array.from(c.children).forEach(k);k(g);a.next=8;return d.renderForPromise("mod_lti/tool_deeplinking_results",{items:b});case 8:h=a.sent;i=h.html;j=h.js;a.next=13;return d.replaceNodeContents(e,i,j);case 13:l(e);l(f);case 15:case"end":return a.stop();}}},a)}));return function(){return a.apply(this,arguments)}}(),n=function(a){var b={};["name","toolurl","securetoolurl","instructorcustomparameters","icon","secureicon","launchcontainer","lineitemresourceid","lineitemtag"].forEach(function(c){b[c]=a[c]||""});b["introeditor[text]"]=a.introeditor?a.introeditor.text:"";b["introeditor[format]"]=a.introeditor?a.introeditor.format:"";if(1===a.instructorchoiceacceptgrades){b.instructorchoiceacceptgrades="1";b["grade[modgrade_point]"]=a.grade_modgrade_point||"100"}else{b.instructorchoiceacceptgrades="0"}return b};window.processContentItemReturnData=function(a){if(h){h.hide()}if(a.multiple){for(var b in j){j[b].setFieldValue("name"===j[b].name?"item":null)}var c=[];a.multiple.forEach(function(a){c.push(n(a))});m(a.multiple);var f=document.querySelector("#id_submitbutton2");f.onclick=function(a){a.preventDefault();f.disabled=!0;var b=new FormData(document.querySelector("form.mform")),d=function(){document.querySelector("#id_cancel").click()};c.reduce(function postVariant(a,c){Object.entries(c).forEach(function(a){return b.set(a[0],a[1])});var d=new URLSearchParams(b),e=function(){return fetch(document.location.pathname,{method:"post",body:d})};return a.then(e).catch(e)},Promise.resolve()).then(d).catch(d)}}else{for(b in j){var d=j[b],e=null;if("undefined"!=typeof a[d.name]){e=a[d.name]}d.setFieldValue(e)}d.setFieldValue(e)}if(i){i(a)}};return{init:function init(a,e,j){i=j;var k=d.render("mod_lti/contentitem",{url:a,postData:e});if(h){h.setBody(k);h.show();return}c.get_string("selectcontent","lti").then(function(a){return f.create({title:a,body:k,large:!0})}).then(function(a){h=a;a.getRoot().on(g.hidden,function(){a.setBody("");b.fetchNotifications()});a.show()}).catch(b.exception)}}});
//# sourceMappingURL=contentitem.min.js.map

File diff suppressed because one or more lines are too long

View File

@ -163,7 +163,8 @@ define(
*/
var configToVariant = (config) => {
const variant = {};
['name', 'toolurl', 'securetoolurl', 'instructorcustomparameters', 'icon', 'secureicon', 'launchcontainer'].forEach(
['name', 'toolurl', 'securetoolurl', 'instructorcustomparameters', 'icon', 'secureicon',
'launchcontainer', 'lineitemresourceid', 'lineitemtag'].forEach(
function(name) {
variant[name] = config[name] || '';
}

View File

@ -1525,8 +1525,6 @@ function content_item_to_form(object $tool, object $typeconfig, object $item) :
}
$config->instructorcustomparameters = implode("\n", $customparameters);
}
// Including a JSON version of the form data to support adding many items in one submit.
$config->contentitemjson = json_encode($item);
return $config;
}