Gitlab CSE Unil

Commit 71c2cc3b authored by M. Chardon's avatar M. Chardon
Browse files

import des axes

parent 0945bd1e
define(["jquery","core/notification","core/templates","core/fragment","core/ajax","core/str","assignfeedback_editpdfplus/annotation","assignfeedback_editpdfplus/annotationhighlightplus","assignfeedback_editpdfplus/annotationstampplus","assignfeedback_editpdfplus/annotationframe","assignfeedback_editpdfplus/annotationcommentplus","assignfeedback_editpdfplus/annotationverticalline","assignfeedback_editpdfplus/annotationstampcomment"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){var n=null,o=null,p=null,q=null,r=function(a,b){n=a,q=JSON.parse(b),this.init()},s=null;r.messageDelOk="",r.messageDelKo="",r.messageko="",r.messageaddok="",r.messageaddlibelleko="",r.messageEditOk="",r.prototype.selectTool=null,r.prototype.init=function(){a("#editpdlplus_axes").on("change",function(){a(".toolbar").hide();var b=a("#editpdlplus_axes").val();a("#editpdlplus_toolbar_"+b).show();var c=a("#editpdlplus_axes option:selected").data("delete");c?parseInt(c)>0?a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").addClass("disabled"):a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled"):(a("#editpdlplus_axes option[value='"+b+"']").data("delete",0),a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled")),a("#toolworkspace").html("")}),a("#editpdlplus_axes").change(),a(".editpdlplus_tool").on("click",y),this.selectTool=a(".editpdlplus_tool").first(),this.initTool(),a("#assignfeedback_editpdfplus_widget_admin_button_addaxis").on("click",this.openDivAddAxis),a("#assignfeedback_editpdfplus_widget_admin_button_editaxis").on("click",this.openDivEditAxis),a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").on("click",this.openDivDelAxis),a("#assignfeedback_editpdfplus_widget_admin_button_addtool").on("click",this.openDivAddTool),a(".btn-primary").click(),t()};var t=function(){f.get_string("admindeltool_messageok","assignfeedback_editpdfplus").done(function(a){r.messageDelOk=a}).fail(b.exception),f.get_string("admindeltool_messageko","assignfeedback_editpdfplus").done(function(a){r.messageDelKo=a}).fail(b.exception),f.get_string("adminaddtool_messageok","assignfeedback_editpdfplus").done(function(a){r.messageaddok=a}).fail(b.exception),f.get_string("admin_messageko","assignfeedback_editpdfplus").done(function(a){r.messageko=a}).fail(b.exception),f.get_string("adminedittool_messageok","assignfeedback_editpdfplus").done(function(a){r.messageEditOk=a}).fail(b.exception),f.get_string("adminaddtool_messagelibelleko","assignfeedback_editpdfplus").done(function(a){r.messageaddlibelleko=a}).fail(b.exception)};r.prototype.test=function(){alert("test"),y()},r.prototype.initTool=function(){a(this.selectTool).removeClass("btn-default"),a(this.selectTool).addClass("btn-primary")},r.prototype.refreshPrevisu=function(){o.typetool=a("#typetool").val(),o.color=a("#color").val(),o.libelle=a("#libelle").val(),o.catridgecolor=a("#cartridgecolor").val();var b="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(b+='"'+a(this).val().replace(/"/g,"")+'",')}),b.length>0&&a("#texts").val(b.substring(0,b.length-1)),o.texts=a("#texts").val(),o.button=a("#button").val(),o.enabled=a("#enabled").val(),o.reply=0,a("#reply").is(":checked")&&(o.reply=1),o.order=a("#order").val(),w(),v()};var u=function(a){for(var b=0;b<q.length;b++)if(q[b].id==a)return q[b]},v=function(){var b=parseInt(a("#typetool").val()),c=u(b),d=!1,e=!1;c.configurable_cartridge&&0===parseInt(c.configurable_cartridge)?(a("#libelle").hide(),a("label[for='libelle']").hide(),d=!0):(a("#libelle").show(),a("label[for='libelle']").show()),c.configurable_cartridge_color&&0===parseInt(c.configurable_cartridge_color)?(a("#cartridgecolor").hide(),a("label[for='cartridgecolor']").hide(),e=!0):(a("#cartridgecolor").show(),a("label[for='cartridgecolor']").show()),d&&e?a("#collapse3").parent().hide():a("#collapse3").parent().show();var f=!1,g=!1,h=!1;c.configurable_color&&0===parseInt(c.configurable_color)?(a("#color").hide(),a("label[for='color']").hide(),f=!0):(a("#color").show(),a("label[for='color']").show()),c.configurable_texts&&0===parseInt(c.configurable_texts)?(a(".textform").hide(),a("label[for='texts']").hide(),g=!0):(a(".textform").show(),a("label[for='texts']").show()),c.configurable_question&&0===parseInt(c.configurable_question)?(a("#reply").hide(),a("label[for='reply']").hide(),h=!0):(a("#reply").show(),a("label[for='reply']").show()),f&&h&&g?a("#collapse4").parent().hide():a("#collapse4").parent().show()},w=function(){a("#canevas").html(""),s=null;var b=parseInt(a("#typetool").val());if(3===b||4===b||7===b?a("#canevas").css("background-image","url("+a("#map01").val()+")"):1===b||6===b?a("#canevas").css("background-image","url("+a("#map02").val()+")"):5===b&&a("#canevas").css("background-image","url("+a("#map03").val()+")"),1===b)s=new h;else if(3===b)s=new i;else if(4===b){s=new j;var c=new j}else 5===b?s=new l:6===b?s=new m:7===b&&(s=new k);if(s){var d=u(b);o.reply=0,a("#reply").is(":checked")&&(o.reply=1),s.initAdminDemo(o,d),s.draw(a("#canevas")),c&&(c.initChildAdminDemo(s),c.draw(a("#canevas")))}};r.prototype.openDivAddAxis=function(){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled","disabled");var e={};d.loadFragment("assignfeedback_editpdfplus","axisadd",n,e).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},r.prototype.openDivEditAxis=function(){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_editaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled","disabled");var e=a("#editpdlplus_axes option:selected").val(),f={axeid:e};d.loadFragment("assignfeedback_editpdfplus","axisedit",n,f).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},r.prototype.openDivDelAxis=function(){var e=a("#editpdlplus_axes option:selected").data("delete");if(null!==e&&0===parseInt(e)){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_delaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled","disabled");var f=a("#editpdlplus_axes option:selected").val(),g={axeid:f};d.loadFragment("assignfeedback_editpdfplus","axisdel",n,g).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)}};var x=function(b,d,e){var f=a.Deferred();return b.fadeOut("fast",function(){c.replaceNodeContents(b,d,e),b.fadeIn("fast",function(){f.resolve()})}),f.promise()},y=function(){var c=a(this).val();a(".editpdlplus_tool").each(function(){a(this).removeClass("btn-primary"),a(this).removeClass("btn-default");var b=a(this).data("enable");1===b&&a(this).val()!==c&&a(this).addClass("btn-default")}),a(this).addClass("btn-primary"),o&&o.id===c||a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html("");var f={toolid:c};d.loadFragment("assignfeedback_editpdfplus","tooledit",n,f).done(function(d,f){x(a("#editpdlplus_tool_item"),d,f).done(function(){o=new Object,o.id=c,o.typetool=a("#typetool").val();var d=u(o.typetool),f=a("#realcolor").val();f.length>0?o.color=a("#color").val():(a("#color").val(d.color),o.color=null),o.libelle=a("#libelle").val(),a("#realcartridgecolor").val().length>0?o.catridgecolor=a("#cartridgecolor").val():(a("#cartridgecolor").val(d.cartridge_color),o.catridgecolor=null),o.texts=a("#texts").val(),o.button=a("#button").val(),o.enabled=a("#enabled").val(),o.reply=a("#reply").val(),o.order=a("#order").val(),a("#typetool").on("change",function(){o.typetool=a("#typetool").val();var b=u(o.typetool);o.color=b.color,o.catridgecolor=b.cartridge_color,a("#color").val(o.color),a("#cartridgecolor").val(o.catridgecolor),v(),w()}),a("#toolFormSubmit").on("click",function(){var c="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(c+='"'+a(this).val().replace(/"/g,"")+'",')}),c.length>0&&a("#texts").val(c.substring(0,c.length-1));var d=a("#assignfeedback_editpdfplus_edit_tool"),f=d.serialize();e.call([{methodname:"assignfeedback_editpdfplus_submit_tool_edit_form",args:{jsonformdata:JSON.stringify(f)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").show(),a("#message_edit_tool").html(r.messageEditOk),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_toolbar_"+b[0].axeid).html("");for(var c=0;c<b.length;c++){var d="btn-default";1!==b[c].enable&&(d=""),b[c].toolid===b[c].selecttool&&(d="btn-primary");var e="";4!==b[c].typetool&&1!==b[c].typetool||(e="text-decoration: underline;");var f=b[c].button;4!==b[c].typetool&&5!==b[c].typetool||(f="| "+f,4===b[c].typetool&&(f+=" |"));var g="<button class='btn "+d+" editpdlplus_tool' id='editpdlplus_tool_"+b[c].toolid+"' style='"+e+"' value='"+b[c].toolid+"' data-enable='"+b[c].enable+"'>"+f+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(g)}a(".editpdlplus_tool").on("click",y),a("#editpdlplus_tool_"+b[0].selecttool).click()}else a("#message_edit_tool").show(),a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(b.exception)}),a("#toolEnabled").on("click",function(){var b=a("#toolenabled").val();1==b?(a("#toolEnabled > i").addClass("fa-eye-slash"),a("#toolEnabled > i").removeClass("fa-eye"),a("#toolenabled").val(0)):(a("#toolEnabled > i").addClass("fa-eye"),a("#toolEnabled > i").removeClass("fa-eye-slash"),a("#toolenabled").val(1)),a("#toolFormSubmit").click()}),a("#toolClone").on("click",function(){p="clone",a("#assignfeedback_editpdfplus_widget_admin_button_addtool").click()}),a("#toolRemove").on("click",function(){if(!a(this).hasClass("disabled")){var c=a("#assignfeedback_editpdfplus_edit_tool"),d=c.serialize();e.call([{methodname:"assignfeedback_editpdfplus_submit_tool_del_form",args:{jsonformdata:JSON.stringify(d)}}])[0].done(function(b){if(""===b[0].message||"1"===b[0].message){if(a("#message_edit_tool").show(),a("#message_edit_tool").html(r.messageDelOk),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_toolbar_"+b[0].axeid).html(""),parseInt(b[0].toolid)>0){for(var c=0;c<b.length;c++){var d="btn-default";1!==b[c].enable&&(d=""),b[c].toolid===b[c].selecttool&&(d="btn-primary");var e="";4!==b[c].typetool&&1!==b[c].typetool||(e="text-decoration: underline;");var f=b[c].button;4!==b[c].typetool&&5!==b[c].typetool||(f="| "+f,4===b[c].typetool&&(f+=" |"));var g="<button class='btn "+d+" editpdlplus_tool' id='editpdlplus_tool_"+b[c].toolid+"' style='"+e+"' value='"+b[c].toolid+"' data-enable='"+b[c].enable+"'>"+f+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(g)}a(".editpdlplus_tool").on("click",y)}else{var h=b[0].axeid,i=a("#editpdlplus_axes option[value='"+h+"']");i.data("delete",0);var j=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");j.removeClass("disabled")}a("#toolworkspace").html("")}else a("#message_edit_tool").show(),a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(b.exception)}}),a("#toolRefesh").on("click",function(){r.prototype.refreshPrevisu()}),w(),v()}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)};return r.prototype.openDivAddTool=function(){a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html(""),a(".btn-primary").addClass("btn-default"),a(".editpdlplus_tool").removeClass("btn-primary");var c=a("#editpdlplus_axes option:selected").val(),f={axisid:c};d.loadFragment("assignfeedback_editpdfplus","tooladd",n,f).done(function(c,d){x(a("#editpdlplus_tool_item"),c,d).done(function(){a("#canevas").hide(),"clone"===p?(a("#typetool").val(o.typetool),a("#color").val(o.color),a("#libelle").val(o.libelle),a("#cartridgecolor").val(o.catridgecolor),a("#texts").val(o.texts),a("#button").val(o.button),a("#enabled").val(o.enabled),a("#reply").val(o.reply),a("#order").val(o.order),o=new Object,p=null):(o=new Object,a("#typetool").on("change",function(){o.typetool=a("#typetool").val();var b=u(o.typetool);o.color=b.color,o.catridgecolor=b.cartridge_color,a("#color").val(o.color),a("#cartridgecolor").val(o.catridgecolor),v()}),a("#typetool").change()),a("#toolFormSubmit").on("click",function(){if(""===a("#button").val())a("#message_edit_tool").show(),a("#message_edit_tool").html(r.messageaddlibelleko),a("#message_edit_tool").addClass("alert-warning"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success");else{var c="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(c+='"'+a(this).val().replace(/"/g,"")+'",')}),c.length>0&&a("#texts").val(c.substring(0,c.length-1));var d=a("#assignfeedback_editpdfplus_edit_tool"),f=d.serialize();e.call([{methodname:"assignfeedback_editpdfplus_submit_tool_add_form",args:{jsonformdata:JSON.stringify(f)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").show(),a("#message_edit_tool").html(r.messageaddok),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_toolbar_"+b[0].axeid).html("");for(var c=0;c<b.length;c++){var d="btn-default";1!==b[c].enable&&(d=""),b[c].toolid===b[c].selecttool&&(d="btn-primary");var e="";4!==b[c].typetool&&1!==b[c].typetool||(e="text-decoration: underline;");var f=b[c].button;4!==b[c].typetool&&5!==b[c].typetool||(f="| "+f,4===b[c].typetool&&(f+=" |"));var g="<button class='btn "+d+" editpdlplus_tool' id='editpdlplus_tool_"+b[c].toolid+"' style='"+e+"' value='"+b[c].toolid+"' data-enable='"+b[c].enable+"'>"+f+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(g)}a(".editpdlplus_tool").on("click",y),a("#toolworkspace").html("");var h=b[0].axeid,i=a("#editpdlplus_axes option[value='"+h+"']");i.data("delete",1);var j=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");j.addClass("disabled")}else a("#message_edit_tool").show(),a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(b.exception)}})}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)},r});
\ No newline at end of file
define(["jquery","core/notification","core/templates","core/fragment","core/ajax","core/str","assignfeedback_editpdfplus/annotation","assignfeedback_editpdfplus/annotationhighlightplus","assignfeedback_editpdfplus/annotationstampplus","assignfeedback_editpdfplus/annotationframe","assignfeedback_editpdfplus/annotationcommentplus","assignfeedback_editpdfplus/annotationverticalline","assignfeedback_editpdfplus/annotationstampcomment"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){var n=null,o=null,p=null,q=null,r=function(a,b){n=a,q=JSON.parse(b),this.init()},s=null;r.messageDelOk="",r.messageDelKo="",r.messageko="",r.messageaddok="",r.messageaddlibelleko="",r.messageEditOk="",r.prototype.selectTool=null,r.prototype.init=function(){a("#editpdlplus_axes").on("change",function(){a(".toolbar").hide();var b=a("#editpdlplus_axes").val();a("#editpdlplus_toolbar_"+b).show();var c=a("#editpdlplus_axes option:selected").data("delete");c?parseInt(c)>0?a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").addClass("disabled"):a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled"):(a("#editpdlplus_axes option[value='"+b+"']").data("delete",0),a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled")),a("#toolworkspace").html("")}),a("#editpdlplus_axes").change(),a(".editpdlplus_tool").on("click",y),this.selectTool=a(".editpdlplus_tool").first(),this.initTool(),a("#assignfeedback_editpdfplus_widget_admin_button_addaxis").on("click",this.openDivAddAxis),a("#assignfeedback_editpdfplus_widget_admin_button_editaxis").on("click",this.openDivEditAxis),a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").on("click",this.openDivDelAxis),a("#assignfeedback_editpdfplus_widget_admin_button_addtool").on("click",this.openDivAddTool),a(".btn-primary").click(),a(".btnimport").on("click",this.importAxis),t()};var t=function(){f.get_string("admindeltool_messageok","assignfeedback_editpdfplus").done(function(a){r.messageDelOk=a}).fail(b.exception),f.get_string("admindeltool_messageko","assignfeedback_editpdfplus").done(function(a){r.messageDelKo=a}).fail(b.exception),f.get_string("adminaddtool_messageok","assignfeedback_editpdfplus").done(function(a){r.messageaddok=a}).fail(b.exception),f.get_string("admin_messageko","assignfeedback_editpdfplus").done(function(a){r.messageko=a}).fail(b.exception),f.get_string("adminedittool_messageok","assignfeedback_editpdfplus").done(function(a){r.messageEditOk=a}).fail(b.exception),f.get_string("adminaddtool_messagelibelleko","assignfeedback_editpdfplus").done(function(a){r.messageaddlibelleko=a}).fail(b.exception)};r.prototype.test=function(){alert("test"),y()},r.prototype.initTool=function(){a(this.selectTool).removeClass("btn-default"),a(this.selectTool).addClass("btn-primary")},r.prototype.refreshPrevisu=function(){o.typetool=a("#typetool").val(),o.color=a("#color").val(),o.libelle=a("#libelle").val(),o.catridgecolor=a("#cartridgecolor").val();var b="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(b+='"'+a(this).val().replace(/"/g,"")+'",')}),b.length>0&&a("#texts").val(b.substring(0,b.length-1)),o.texts=a("#texts").val(),o.button=a("#button").val(),o.enabled=a("#enabled").val(),o.reply=0,a("#reply").is(":checked")&&(o.reply=1),o.order=a("#order").val(),w(),v()};var u=function(a){for(var b=0;b<q.length;b++)if(q[b].id==a)return q[b]},v=function(){var b=parseInt(a("#typetool").val()),c=u(b),d=!1,e=!1;c.configurable_cartridge&&0===parseInt(c.configurable_cartridge)?(a("#libelle").hide(),a("label[for='libelle']").hide(),d=!0):(a("#libelle").show(),a("label[for='libelle']").show()),c.configurable_cartridge_color&&0===parseInt(c.configurable_cartridge_color)?(a("#cartridgecolor").hide(),a("label[for='cartridgecolor']").hide(),e=!0):(a("#cartridgecolor").show(),a("label[for='cartridgecolor']").show()),d&&e?a("#collapse3").parent().hide():a("#collapse3").parent().show();var f=!1,g=!1,h=!1;c.configurable_color&&0===parseInt(c.configurable_color)?(a("#color").hide(),a("label[for='color']").hide(),f=!0):(a("#color").show(),a("label[for='color']").show()),c.configurable_texts&&0===parseInt(c.configurable_texts)?(a(".textform").hide(),a("label[for='texts']").hide(),g=!0):(a(".textform").show(),a("label[for='texts']").show()),c.configurable_question&&0===parseInt(c.configurable_question)?(a("#reply").hide(),a("label[for='reply']").hide(),h=!0):(a("#reply").show(),a("label[for='reply']").show()),f&&h&&g?a("#collapse4").parent().hide():a("#collapse4").parent().show()},w=function(){a("#canevas").html(""),s=null;var b=parseInt(a("#typetool").val());if(3===b||4===b||7===b?a("#canevas").css("background-image","url("+a("#map01").val()+")"):1===b||6===b?a("#canevas").css("background-image","url("+a("#map02").val()+")"):5===b&&a("#canevas").css("background-image","url("+a("#map03").val()+")"),1===b)s=new h;else if(3===b)s=new i;else if(4===b){s=new j;var c=new j}else 5===b?s=new l:6===b?s=new m:7===b&&(s=new k);if(s){var d=u(b);o.reply=0,a("#reply").is(":checked")&&(o.reply=1),s.initAdminDemo(o,d),s.draw(a("#canevas")),c&&(c.initChildAdminDemo(s),c.draw(a("#canevas")))}};r.prototype.openDivAddAxis=function(){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled","disabled");var e={};d.loadFragment("assignfeedback_editpdfplus","axisadd",n,e).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},r.prototype.openDivEditAxis=function(){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_editaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled","disabled");var e=a("#editpdlplus_axes option:selected").val(),f={axeid:e};d.loadFragment("assignfeedback_editpdfplus","axisedit",n,f).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},r.prototype.openDivDelAxis=function(){var e=a("#editpdlplus_axes option:selected").data("delete");if(null!==e&&0===parseInt(e)){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_delaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled","disabled");var f=a("#editpdlplus_axes option:selected").val(),g={axeid:f};d.loadFragment("assignfeedback_editpdfplus","axisdel",n,g).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)}};var x=function(b,d,e){var f=a.Deferred();return b.fadeOut("fast",function(){c.replaceNodeContents(b,d,e),b.fadeIn("fast",function(){f.resolve()})}),f.promise()};r.prototype.importAxis=function(){var c=a(this).data("axis");if(c&&parseInt(c)>0){a("#assignfeedback_editpdfplus_import_axis > div > input[name^='axeid']").val(c);var d=a("#assignfeedback_editpdfplus_import_axis"),f=d.serialize()+"&courseid="+a("#courseid").val();e.call([{methodname:"assignfeedback_editpdfplus_submit_axis_import_form",args:{jsonformdata:JSON.stringify(f)}}])[0].done(function(b){if(""===b[0].message){a("#message_import_axis").show(),a("#message_import_axis").html(r.messageaddok),a("#message_import_axis").addClass("alert-success"),a("#message_import_axis").removeClass("alert-danger"),a("#message_import_axis").removeClass("alert-warning");var c="<div id='editpdlplus_toolbar_"+b[0].axeid+"' class='btn-group toolbar' style='display: none;'></div>";a("#editpdlplus_toolbars").append(c);var d=new Option(b[0].axelabel,b[0].axeid,(!0),(!0));a("#editpdlplus_axes").append(d),a("#editpdlplus_tool_item").html("");for(var e=0;e<b.length;e++)if(b[e].toolid&&b[e].toolid>0){var f="btn-default";1!==b[e].enable&&(f="");var g="";4!==b[e].typetool&&1!==b[e].typetool||(g="text-decoration: underline;");var h=b[e].button;4!==b[e].typetool&&5!==b[e].typetool||(h="| "+h,4===b[e].typetool&&(h+=" |"));var i="<button class='btn "+f+" editpdlplus_tool' id='editpdlplus_tool_"+b[e].toolid+"' style='"+g+"' value='"+b[e].toolid+"' data-enable='"+b[e].enable+"'>"+h+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(i)}a(".editpdlplus_tool").on("click",y),a("#editpdlplus_axes").change(),a("a[href^='#collapseadmin2'").click()}else a("#message_import_axis").show(),a("#message_import_axis").html(b[0].message),a("#message_import_axis").addClass("alert-danger"),a("#message_import_axis").removeClass("alert-success")}).fail(b.exception)}};var y=function(){var c=a(this).val();a(".editpdlplus_tool").each(function(){a(this).removeClass("btn-primary"),a(this).removeClass("btn-default");var b=a(this).data("enable");1===b&&a(this).val()!==c&&a(this).addClass("btn-default")}),a(this).addClass("btn-primary"),o&&o.id===c||a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html("");var f={toolid:c};d.loadFragment("assignfeedback_editpdfplus","tooledit",n,f).done(function(d,f){x(a("#editpdlplus_tool_item"),d,f).done(function(){o=new Object,o.id=c,o.typetool=a("#typetool").val();var d=u(o.typetool),f=a("#realcolor").val();f.length>0?o.color=a("#color").val():(a("#color").val(d.color),o.color=null),o.libelle=a("#libelle").val(),a("#realcartridgecolor").val().length>0?o.catridgecolor=a("#cartridgecolor").val():(a("#cartridgecolor").val(d.cartridge_color),o.catridgecolor=null),o.texts=a("#texts").val(),o.button=a("#button").val(),o.enabled=a("#enabled").val(),o.reply=a("#reply").val(),o.order=a("#order").val(),a("#typetool").on("change",function(){o.typetool=a("#typetool").val();var b=u(o.typetool);o.color=b.color,o.catridgecolor=b.cartridge_color,a("#color").val(o.color),a("#cartridgecolor").val(o.catridgecolor),v(),w()}),a("#toolFormSubmit").on("click",function(){var c="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(c+='"'+a(this).val().replace(/"/g,"")+'",')}),c.length>0&&a("#texts").val(c.substring(0,c.length-1));var d=a("#assignfeedback_editpdfplus_edit_tool"),f=d.serialize();e.call([{methodname:"assignfeedback_editpdfplus_submit_tool_edit_form",args:{jsonformdata:JSON.stringify(f)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").show(),a("#message_edit_tool").html(r.messageEditOk),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_toolbar_"+b[0].axeid).html("");for(var c=0;c<b.length;c++){var d="btn-default";1!==b[c].enable&&(d=""),b[c].toolid===b[c].selecttool&&(d="btn-primary");var e="";4!==b[c].typetool&&1!==b[c].typetool||(e="text-decoration: underline;");var f=b[c].button;4!==b[c].typetool&&5!==b[c].typetool||(f="| "+f,4===b[c].typetool&&(f+=" |"));var g="<button class='btn "+d+" editpdlplus_tool' id='editpdlplus_tool_"+b[c].toolid+"' style='"+e+"' value='"+b[c].toolid+"' data-enable='"+b[c].enable+"'>"+f+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(g)}a(".editpdlplus_tool").on("click",y),a("#editpdlplus_tool_"+b[0].selecttool).click()}else a("#message_edit_tool").show(),a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(b.exception)}),a("#toolEnabled").on("click",function(){var b=a("#toolenabled").val();1==b?(a("#toolEnabled > i").addClass("fa-eye-slash"),a("#toolEnabled > i").removeClass("fa-eye"),a("#toolenabled").val(0)):(a("#toolEnabled > i").addClass("fa-eye"),a("#toolEnabled > i").removeClass("fa-eye-slash"),a("#toolenabled").val(1)),a("#toolFormSubmit").click()}),a("#toolClone").on("click",function(){p="clone",a("#assignfeedback_editpdfplus_widget_admin_button_addtool").click()}),a("#toolRemove").on("click",function(){if(!a(this).hasClass("disabled")){var c=a("#assignfeedback_editpdfplus_edit_tool"),d=c.serialize();e.call([{methodname:"assignfeedback_editpdfplus_submit_tool_del_form",args:{jsonformdata:JSON.stringify(d)}}])[0].done(function(b){if(""===b[0].message||"1"===b[0].message){if(a("#message_edit_tool").show(),a("#message_edit_tool").html(r.messageDelOk),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_toolbar_"+b[0].axeid).html(""),parseInt(b[0].toolid)>0){for(var c=0;c<b.length;c++){var d="btn-default";1!==b[c].enable&&(d=""),b[c].toolid===b[c].selecttool&&(d="btn-primary");var e="";4!==b[c].typetool&&1!==b[c].typetool||(e="text-decoration: underline;");var f=b[c].button;4!==b[c].typetool&&5!==b[c].typetool||(f="| "+f,4===b[c].typetool&&(f+=" |"));var g="<button class='btn "+d+" editpdlplus_tool' id='editpdlplus_tool_"+b[c].toolid+"' style='"+e+"' value='"+b[c].toolid+"' data-enable='"+b[c].enable+"'>"+f+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(g)}a(".editpdlplus_tool").on("click",y)}else{var h=b[0].axeid,i=a("#editpdlplus_axes option[value='"+h+"']");i.data("delete",0);var j=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");j.removeClass("disabled")}a("#toolworkspace").html("")}else a("#message_edit_tool").show(),a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(b.exception)}}),a("#toolRefesh").on("click",function(){r.prototype.refreshPrevisu()}),w(),v()}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)};return r.prototype.openDivAddTool=function(){a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html(""),a(".btn-primary").addClass("btn-default"),a(".editpdlplus_tool").removeClass("btn-primary");var c=a("#editpdlplus_axes option:selected").val(),f={axisid:c};d.loadFragment("assignfeedback_editpdfplus","tooladd",n,f).done(function(c,d){x(a("#editpdlplus_tool_item"),c,d).done(function(){a("#canevas").hide(),"clone"===p?(a("#typetool").val(o.typetool),a("#color").val(o.color),a("#libelle").val(o.libelle),a("#cartridgecolor").val(o.catridgecolor),a("#texts").val(o.texts),a("#button").val(o.button),a("#enabled").val(o.enabled),a("#reply").val(o.reply),a("#order").val(o.order),o=new Object,p=null):(o=new Object,a("#typetool").on("change",function(){o.typetool=a("#typetool").val();var b=u(o.typetool);o.color=b.color,o.catridgecolor=b.cartridge_color,a("#color").val(o.color),a("#cartridgecolor").val(o.catridgecolor),v()}),a("#typetool").change()),a("#toolFormSubmit").on("click",function(){if(""===a("#button").val())a("#message_edit_tool").show(),a("#message_edit_tool").html(r.messageaddlibelleko),a("#message_edit_tool").addClass("alert-warning"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success");else{var c="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(c+='"'+a(this).val().replace(/"/g,"")+'",')}),c.length>0&&a("#texts").val(c.substring(0,c.length-1));var d=a("#assignfeedback_editpdfplus_edit_tool"),f=d.serialize();e.call([{methodname:"assignfeedback_editpdfplus_submit_tool_add_form",args:{jsonformdata:JSON.stringify(f)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").show(),a("#message_edit_tool").html(r.messageaddok),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_toolbar_"+b[0].axeid).html("");for(var c=0;c<b.length;c++){var d="btn-default";1!==b[c].enable&&(d=""),b[c].toolid===b[c].selecttool&&(d="btn-primary");var e="";4!==b[c].typetool&&1!==b[c].typetool||(e="text-decoration: underline;");var f=b[c].button;4!==b[c].typetool&&5!==b[c].typetool||(f="| "+f,4===b[c].typetool&&(f+=" |"));var g="<button class='btn "+d+" editpdlplus_tool' id='editpdlplus_tool_"+b[c].toolid+"' style='"+e+"' value='"+b[c].toolid+"' data-enable='"+b[c].enable+"'>"+f+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(g)}a(".editpdlplus_tool").on("click",y),a("#toolworkspace").html("");var h=b[0].axeid,i=a("#editpdlplus_axes option[value='"+h+"']");i.data("delete",1);var j=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");j.addClass("disabled")}else a("#message_edit_tool").show(),a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(b.exception)}})}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)},r});
\ No newline at end of file
......@@ -88,6 +88,8 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
$(".btn-primary").click();
$(".btnimport").on('click', this.importAxis);
initMessages();
};
//init message
......@@ -340,6 +342,79 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
//return true;
};
//
AdminPanel.prototype.importAxis = function () {
var axisimportid = $(this).data('axis');
if (axisimportid && parseInt(axisimportid) > 0) {
$("#assignfeedback_editpdfplus_import_axis > div > input[name^='axeid']").val(axisimportid);
var form = $('#assignfeedback_editpdfplus_import_axis');
var data = form.serialize() + "&courseid=" + $("#courseid").val();
ajax.call([
{
methodname: 'assignfeedback_editpdfplus_submit_axis_import_form',
args: {jsonformdata: JSON.stringify(data)}
}
])[0].done(function (toolbar) {
if (toolbar[0].message === "") {
//mise à jour du message
$("#message_import_axis").show();
$("#message_import_axis").html(AdminPanel.messageaddok);
$("#message_import_axis").addClass("alert-success");
$("#message_import_axis").removeClass("alert-danger");
$("#message_import_axis").removeClass("alert-warning");
//maj axe
var divAxis = "<div id='editpdlplus_toolbar_"
+ toolbar[0].axeid
+ "' class='btn-group toolbar' style='display: none;'></div>";
$('#editpdlplus_toolbars').append(divAxis);
var option = new Option(toolbar[0].axelabel, toolbar[0].axeid, true, true);
$("#editpdlplus_axes").append(option);
$('#editpdlplus_tool_item').html("");
//maj toolbar
for (var i = 0; i < toolbar.length; i++) {
if (toolbar[i].toolid && toolbar[i].toolid > 0) {
var classButton = "btn-default";
if (toolbar[i].enable !== 1) {
classButton = "";
}
var style = "";
if (toolbar[i].typetool === 4 || toolbar[i].typetool === 1) {
style = "text-decoration: underline;";
}
var label = toolbar[i].button;
if (toolbar[i].typetool === 4 || toolbar[i].typetool === 5) {
label = "| " + label;
if (toolbar[i].typetool === 4) {
label += " |";
}
}
var buttonTmp = "<button class='btn "
+ classButton
+ " editpdlplus_tool' id='editpdlplus_tool_"
+ toolbar[i].toolid + "' style='"
+ style
+ "' value='"
+ toolbar[i].toolid
+ "' data-enable='"
+ toolbar[i].enable + "'>"
+ label
+ "</button>";
$("#editpdlplus_toolbar_" + toolbar[0].axeid).append(buttonTmp);
}
}
$(".editpdlplus_tool").on("click", refreshToolView);
//maj visu
$("#editpdlplus_axes").change();
$("a[href^='#collapseadmin2'").click();
} else {
$("#message_import_axis").show();
$("#message_import_axis").html(toolbar[0].message);
$("#message_import_axis").addClass("alert-danger");
$("#message_import_axis").removeClass("alert-success");
}
}).fail(notification.exception);
}
};
//
var refreshToolView = function () {
var selectid = $(this).val();
$(".editpdlplus_tool").each(function () {
......
......@@ -281,4 +281,49 @@ class admin_editor {
return $typetools;
}
public static function getAxisById($axeid) {
global $DB;
$axis = $DB->get_record('assignfeedback_editpp_axis', array('id' => $axeid), '*', MUST_EXIST);
return $axis;
}
public static function import_axis($axisOrigin, $context) {
global $DB;
$record = $DB->get_record_sql('SELECT max(order_axis) as order_max FROM {assignfeedback_editpp_axis} WHERE contextid = :contextid', array('contextid' => $context));
$axis = new axis();
$axis->contextid = $context;
$axis->label = $axisOrigin->label;
if ($record->order_max == null) {
$axis->order_axis = 1;
} else {
$axis->order_axis = $record->order_max + 1;
}
return $DB->insert_record('assignfeedback_editpp_axis', $axis);
}
public static function import_tool($toolToImport, $axeNew, $context) {
global $DB;
$record = $DB->get_record_sql('SELECT max(order_tool) as order_max FROM {assignfeedback_editpp_tool} WHERE contextid = :contextid', array('axis' => $axeNew->id, 'contextid' => $context));
$tool = new tool();
$tool->axis = $axeNew;
$tool->cartridge = $toolToImport->cartridge;
$tool->cartridge_color = $toolToImport->cartridge_color;
$tool->colors = $toolToImport->colors;
$tool->contextid = $context;
$tool->enabled = $toolToImport->enabled;
$tool->label = $toolToImport->label;
$tool->reply = $toolToImport->reply;
$tool->texts = $toolToImport->texts;
$tool->type = $toolToImport->type;
if ($record->order_max == null) {
$tool->order_tool = 1;
} else {
$tool->order_tool = $record->order_max + 1;
}
return $DB->insert_record('assignfeedback_editpp_tool', $tool);
}
}
<?php
/**
*
*
* @package assignfeedback_editpdfplus
* @copyright 2017 Université de Lausanne
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace assignfeedback_editpdfplus\form;
require_once("$CFG->libdir/formslib.php");
use moodleform;
/**
* Description of formslib
*
* @author kury
*/
class axis_import_form extends moodleform {
protected function definition() {
global $CFG;
$mform = $this->_form;
$mform->addElement('hidden', 'axeid', '');
$mform->setType('axeid', PARAM_INTEGER);
}
//Custom validation should be added here
function validation($data, $files) {
return array();
}
}
......@@ -89,4 +89,15 @@ $functions = array(
'enabled' => 1,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
),
'assignfeedback_editpdfplus_submit_axis_import_form' => array(
'classname' => 'assignfeedback_editpdfplus_external',
'methodname' => 'submit_axis_import_form',
'classpath' => 'mod/assign/feedback/editpdfplus/externallib.php',
'description' => 'Import an axis with its tools',
'type' => 'write',
'ajax' => true,
'requiredcapability' => 'assignfeedback/editpdfplus:managetools',
'enabled' => 1,
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
)
);
......@@ -32,6 +32,7 @@ require_once("locallib_admin.php");
use \assignfeedback_editpdfplus\form\axis_form;
use \assignfeedback_editpdfplus\form\axis_del_form;
use \assignfeedback_editpdfplus\form\axis_import_form;
use \assignfeedback_editpdfplus\admin_editor;
class assignfeedback_editpdfplus_external extends external_api {
......@@ -431,4 +432,95 @@ class assignfeedback_editpdfplus_external extends external_api {
);
}
/**
* Returns description of method parameters
* @return external_function_parameters
*/
public static function submit_axis_import_form_parameters() {
return new external_function_parameters(
array(
'jsonformdata' => new external_value(PARAM_RAW, 'The data from the grading form, encoded as a json array')
)
);
}
public static function submit_axis_import_form($jsonformdata) {
global $USER, $PAGE, $DB;
$params = self::validate_parameters(self::submit_axis_import_form_parameters(), array(
'jsonformdata' => $jsonformdata
));
$serialiseddata = json_decode($params['jsonformdata']);
$data = array();
parse_str($serialiseddata, $data);
$warnings = array();
if (WS_SERVER) {
// Assume form submission if coming from WS.
$USER->ignoresesskey = true;
//$data['_qf__mod_assign_grade_form_' . $params['userid']] = 1;
}
$course = $DB->get_record('course', array('id' => $data['courseid']), '*', MUST_EXIST);
$context = context_course::instance($course->id, MUST_EXIST);
$PAGE->set_context($context);
$customdata = (object) $data;
$formparams = array($customdata);
// Data is injected into the form by the last param for the constructor.
$mform = new axis_import_form(null, $formparams, 'post', '', null, true, $data);
$validateddata = $mform->get_data();
if ($validateddata && $validateddata->axeid) {
$axeToImport = admin_editor::getAxisById($validateddata->axeid);
$axeNew = admin_editor::import_axis($axeToImport, $context->id);
if ($axeNew) {
$tools = admin_editor::get_tools_by_axis($axeToImport->id);
//$toolsNew = array();
foreach ($tools as $toolToImport) {
admin_editor::import_tool($toolToImport, $axeNew, $context->id);
}
//$res = array('axeid' => $axeNew, 'axelabel' => $axeToImport->label);
$res = array();
$toolsNew = admin_editor::get_tools_by_axis($axeNew);
if (sizeof($toolsNew) > 0) {
foreach ($toolsNew as $tool) {
$res[] = array('axeid' => $axeNew, 'axelabel' => $axeToImport->label, 'message' => "", 'enable' => $tool->enabled, 'toolid' => $tool->id, 'typetool' => $tool->type, 'button' => $tool->label, 'message' => '');
}
} else {
$res = array(array('axeid' => $axeNew, 'axelabel' => $axeToImport->label, 'message' => ""));
}
return $res;
}
}
$warnings[] = array('message' => get_string('admin_messageko', 'assignfeedback_editpdfplus'));
return $warnings;
}
/* public static function submit_axis_form_returns() {
return new external_warnings();
} */
public static function submit_axis_import_form_returns() {
return new external_multiple_structure(
new external_single_structure(
array(
'axeid' => new external_value(PARAM_INT, 'axis id', VALUE_OPTIONAL),
'axelabel' => new external_value(PARAM_TEXT, 'axis label', VALUE_OPTIONAL),
'message' => new external_value(PARAM_TEXT, 'message'),
'enable' => new external_value(PARAM_INT, 'tool enable', VALUE_OPTIONAL),
'toolid' => new external_value(PARAM_INT, 'tool id', VALUE_OPTIONAL),
'typetool' => new external_value(PARAM_INT, 'tool type', VALUE_OPTIONAL),
'button' => new external_value(PARAM_TEXT, 'tool label', VALUE_OPTIONAL)
)
)
);
}
}
......@@ -27,6 +27,7 @@ defined('MOODLE_INTERNAL') || die();
use \assignfeedback_editpdfplus\page_editor;
use \assignfeedback_editpdfplus\widget_admin;
use \assignfeedback_editpdfplus\form\axis_form;
use \assignfeedback_editpdfplus\form\axis_import_form;
use \assignfeedback_editpdfplus\form\axis_del_form;
use \assignfeedback_editpdfplus\admin_editor;
......@@ -68,8 +69,14 @@ class assign_feedback_editpdfplus_admin {
//Set default data (if any)
$formAddAxis->set_data($toform);
} */
$axisimportform = new axis_import_form(null, array('id' => $this->course->id), null, null, array('id' => "assignfeedback_editpdfplus_import_axis"));
$axisimportform->id = "assignfeedback_editpdfplus_import_axis";
$axisimportform->title = "";
$axisimportform->action = "import";
$widget = $this->get_widget();
//$widget->axisaddform = $formAddAxis;
$widget->axisimportform = $axisimportform;
$widget->courseid = $this->course->id;
$html .= $renderer->render_assignfeedback_editpdfplus_widget_admin($widget);
return $html;
}
......
......@@ -5,109 +5,118 @@
<div class="assignfeedback_editpdfplus_widget_admin">
<h5>{{# str }} adminsubtitle, assignfeedback_editpdfplus {{/ str }}</h5>
<div class="panel panel-default">
<div class="panel-heading">
Importation axe
</div>
<div class="panel-body">
Axes disponibles à l'importation
<table class='table table-bordered table-striped'>
<thead>
<tr>
<!--th>Cours / activité</th-->
<th>Nom</th>
<th>Outils</th>
<th>Importer</th>
</tr>
</thead>
<tbody>
{{# toolbarsDispo }}
<tr>
<!--td></td-->
<td>{{axis.label}}</td>
<td>
{{# tools }}
<button class="btn btn-default" style="{{style}}">
{{label}}
</button>
{{/ tools }}
</td>
<td><button class='btn btn-primary btn-sm' class='btnimport' data-axis='{{axis.id}}'><i class='fa fa-download'></i></button></td>
</tr>
{{/ toolbarsDispo }}
</tbody>
</table>
<div class="panel-group" id="adminAccordion">
<div class="panel panel-default">
<div class="panel-heading">
<a data-toggle="collapse" href="#collapseadmin1" data-parent="#adminAccordion">Importation axe</a>
</div>
<div id="collapseadmin1" class="panel-collapse collapse">
<div class="panel-body">
Axes disponibles à l'importation
{{{ axisimportform.render }}}
<input type="hidden" id="courseid" value="{{courseid}}" />
<table class='table table-bordered table-striped'>
<thead>
<tr>
<!--th>Cours / activité</th-->
<th>Nom</th>
<th>Outils</th>
<th>Importer</th>
</tr>
</thead>
<tbody>
{{# toolbarsDispo }}
<tr>
<!--td></td-->
<td>{{axis.label}}</td>
<td>
{{# tools }}
<button class="btn btn-default" style="{{style}}">
{{label}}
</button>
{{/ tools }}
</td>
<td><button class='btn btn-primary btn-sm btnimport' data-axis='{{axis.id}}'><i class='fa fa-download'></i></button></td>
</tr>
{{/ toolbarsDispo }}
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
{{# str }} admincurrenttoolbar, assignfeedback_editpdfplus {{/ str }}
</div>
<div class="panel-body">
<div class='row'>
<div class='col-sm-2'>
<h6>
{{# str }} adminaxis, assignfeedback_editpdfplus {{/ str }}
<button type="button" class="btn btn-default" id="assignfeedback_editpdfplus_widget_admin_button_addaxis">
<i class="fa fa-plus" aria-hidden="true"></i>
</button>
</h6>
</div>
<div class='col-sm-10' id='assignfeedback_editpdfplus_widget_admin_toolheader'>
<h6>
{{# str }} admintools, assignfeedback_editpdfplus {{/ str }}
<button type="button" class="btn btn-default" id="assignfeedback_editpdfplus_widget_admin_button_addtool">
<i class="fa fa-plus" aria-hidden="true"></i>
</button>
</h6>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<a data-toggle="collapse" href="#collapseadmin2" data-parent="#adminAccordion">{{# str }} admincurrenttoolbar, assignfeedback_editpdfplus {{/ str }}</a>
</div>
<div class='row' id='assignfeedback_editpdfplus_widget_admin_workspace'>
<div class='col-sm-2'>
<select id='editpdlplus_axes' class='form-control'>
{{# axis }}
<option value="{{id}}" data-delete="{{children}}">{{label}}</option>
{{/ axis }}
</select>
<div class="panel panel-default" id="axistool">
<div class="panel-body" style="text-align: center;">
<button type="button" class="btn btn-default" id="assignfeedback_editpdfplus_widget_admin_button_editaxis">