Gitlab CSE Unil

Commit e000eadd authored by M. Chardon's avatar M. Chardon
Browse files

correction github, place dans feedback configuration

parent 1f059165
define(["jquery","jqueryui","core/notification","core/templates","core/fragment","core/ajax","core/str","core/modal_factory","core/modal_events","assignfeedback_editpdfplus/tool","assignfeedback_editpdfplus/tooltype","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,n,o,p,q){var r=null,s=null,t=null,u=null,v=null,w=function(a,b){r=a,this.initTypeTool(b),this.init()};w.messageDelOk="",w.messageDelKo="",w.messageko="",w.messageaddok="",w.messageaddlibelleko="",w.messageEditOk="",w.prototype.selectTool=null;var x=function(){g.get_string("admindeltool_messageok","assignfeedback_editpdfplus").done(function(a){w.messageDelOk=a}).fail(c.exception),g.get_string("admindeltool_messageko","assignfeedback_editpdfplus").done(function(a){w.messageDelKo=a}).fail(c.exception),g.get_string("adminaddtool_messageok","assignfeedback_editpdfplus").done(function(a){w.messageaddok=a}).fail(c.exception),g.get_string("admin_messageko","assignfeedback_editpdfplus").done(function(a){w.messageko=a}).fail(c.exception),g.get_string("adminedittool_messageok","assignfeedback_editpdfplus").done(function(a){w.messageEditOk=a}).fail(c.exception),g.get_string("adminaddtool_messagelibelleko","assignfeedback_editpdfplus").done(function(a){w.messageaddlibelleko=a}).fail(c.exception)};w.prototype.initTypeTool=function(a){var b=JSON.parse(a);u=[];for(var c=0;c<b.length;c++){var d=new k;d.initAdmin(b[c]),u[c]=d}},w.prototype.init=function(){a("#editpdlplus_axes").on("change",function(){a(".toolbar").hide();var b=a("#editpdlplus_axes").val();if(b&&""!==b){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").prop("disabled",!0):a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeAttr("disabled"):(a("#editpdlplus_axes option[value='"+b+"']").data("delete",0),a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeAttr("disabled"))}else a("#assignfeedback_editpdfplus_widget_admin_workspace").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide();a("#toolworkspace").html("")}),a("#editpdlplus_axes").change(),a(".editpdlplus_tool").on("click",D),this.selectTool=a(".editpdlplus_tool").first(),this.initToolUI(),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_exportaxis").on("click",this.openDivExportAxis),a("#assignfeedback_editpdfplus_widget_admin_button_addtool").on("click",this.openDivAddTool),a(".btn-primary").click(),a(".btnimport").on("click",this.importAxis),a(".btnimportdel").on("click",this.deleteModel),x()},w.prototype.initToolUI=function(){a(this.selectTool).addClass("btn-primary"),y()};var y=function(){a(".sortable").sortable({placeholder:"alert-warning",handle:"button",cancel:"",stop:function(b,d){var e=a(d.item).prev().find("button").val(),g=a(d.item).next().find("button").val(),h=a(d.item).find("button").val();a("input[name^='previoustoolid']").val(e),a("input[name^='toolid']").val(h),a("input[name^='nexttoolid']").val(g);var i=a("#assignfeedback_editpdfplus_order_tool"),j=i.serialize()+"&contextid="+r;f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_order_form",args:{jsonformdata:JSON.stringify(j)}}])[0].done(function(a){"ok"===a.message?w.prototype.displayMessageInformation("message_order_tool",w.messageEditOk,1,0,0):w.prototype.displayMessageInformation("message_order_tool",w.messageko,0,1,0)}).fail(c.exception)}}),a(".sortable").disableSelection()};w.prototype.refreshPrevisu=function(){s.axis=a("#toolaxis").val(),s.typetool=a("#typetool").val(),s.colors=a("#color").val(),s.cartridge=a("#libelle").val(),s.cartridgeColor=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)),s.texts=a("#texts").val(),s.label=a("#button").val(),s.enabled=a("#enabled").val(),s.reply=0,a("#reply").is(":checked")&&(s.reply=1),s.orderTool=a("#order").val(),B(),A()};var z=function(a){for(var b=0;b<u.length;b++)if(u[b].id==a)return u[b]},A=function(){var b=parseInt(a("#typetool").val()),c=z(b),d=!1,e=!1;c.configurableCartridge&&0===parseInt(c.configurableCartridge)?(a("#libelle").hide(),a("label[for='libelle']").hide(),d=!0):(a("#libelle").show(),a("label[for='libelle']").show()),c.configurableCartridgeColor&&0===parseInt(c.configurableCartridgeColor)?(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.configurableColor&&0===parseInt(c.configurableColor)?(a("#color").hide(),a("label[for='color']").hide(),f=!0):(a("#color").show(),a("label[for='color']").show()),c.configurableTexts&&0===parseInt(c.configurableTexts)?(a(".textform").hide(),a("label[for='texts']").hide(),g=!0):(a(".textform").show(),a("label[for='texts']").show()),c.configurableQuestion&&0===parseInt(c.configurableQuestion)?(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()},B=function(){a("#canevas").html(""),v=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)v=new l;else if(3===b)v=new m;else if(4===b){v=new n;var c=new n}else 5===b?v=new p:6===b?v=new q:7===b&&(v=new o);if(v){var d=z(b);s.type=d,s.reply=0,a("#reply").is(":checked")&&(s.reply=1),v.initAdminDemo(s),v.draw(a("#canevas")),c&&(c.initChildAdminDemo(v),c.draw(a("#canevas")))}};w.prototype.openDivAddAxis=function(){var b=a("#editpdlplus_axes").val();b&&""!==b?(a("#message_edit_tool").hide(),a("#axistool").hide()):(a("#assignfeedback_editpdfplus_widget_admin_workspace").show(),a("#editpdlplus_axes_worspace").hide()),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled",!0);var f={};e.loadFragment("assignfeedback_editpdfplus","axisadd",r,f).done(function(a,b){d.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_addaxis",a,b)}.bind(this)).fail(c.exception)},w.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").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled",!0);var b=a("#editpdlplus_axes option:selected").val(),f={axeid:b};e.loadFragment("assignfeedback_editpdfplus","axisedit",r,f).done(function(a,b){d.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_editaxis",a,b)}.bind(this)).fail(c.exception)},w.prototype.openDivExportAxis=function(){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_exportaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_exportaxis").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled",!0);var b=a("#editpdlplus_axes option:selected").val(),h={axeid:b};e.loadFragment("assignfeedback_editpdfplus","axisexport",r,h).done(function(b,e){d.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_exportaxis",b,e),a("#axisExportSubmit").on("click",function(){var b=a("#assignfeedback_editpdfplus_widget_admin_div_exportaxis form"),d=b.serialize();f.call([{methodname:"assignfeedback_editpdfplus_submit_axis_export_form",args:{jsonformdata:JSON.stringify(d)}}])[0].done(function(b){if(""===b[0].message){var c=a("<tr></tr>");c.append("<td>"+b[0].axelabel+"</td>");for(var d=b,e=a('<td><div class="btn-group"></div></td>'),f=0;f<d.length;f++)e.append('<button class="btn" style="'+d[f].style+'">'+d[f].button+"</button>");c.append(e),c.append("<td><button class='btn btn-primary btn-sm btnimport' data-axis='"+b[0].axeid+"'><i class='fa fa-download'></i></button></td>"),c.append("<td><button class='btn btn-danger btn-sm btnimportdel' data-model='"+b[0].modelid+"'><i class='fa fa-remove'></i></button></td>"),a("div#import tbody").append(c),a(".btnimport").on("click",w.prototype.importAxis),a(".btnimportdel").on("click",w.prototype.deleteModel),w.prototype.resetDivAction("assignfeedback_editpdfplus_widget_admin_div_exportaxis"),a("#axistool").show();var h=a("#editpdlplus_axes").val();h&&""!==h?w.prototype.showWorkspace():(a("#assignfeedback_editpdfplus_widget_admin_workspace").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide()),a("#editpdlplus_axes").removeAttr("disabled");var i=g.get_string("adminexport_messageok","assignfeedback_editpdfplus");w.prototype.displayMessageInformation("message_export_axis",i,1,0,0)}else a("#assignfeedback_editpdfplus_widget_admin_div_exportaxis").append("<div class='alert alert-danger' style='margin-top: 5px;'>"+b[0].message+"</div>")}).fail(c.exception)}),a("#axisExportCancel").on("click",function(){w.prototype.resetDivAction("assignfeedback_editpdfplus_widget_admin_div_exportaxis"),w.prototype.showWorkspace(),a("#editpdlplus_axes").removeAttr("disabled")})}.bind(this)).fail(c.exception)},w.prototype.openDivDelAxis=function(){var b=a("#editpdlplus_axes option:selected").data("delete");if(!(null===b||parseInt(b)>0)){var d=a("#editpdlplus_axes option:selected").val();a("#assignfeedback_editpdfplus_del_axis input[name='axeid']").val(d),h.create({type:h.types.SAVE_CANCEL,title:g.get_string("adminaxisimport_delete","assignfeedback_editpdfplus"),body:g.get_string("adminaxisdelete_question","assignfeedback_editpdfplus")}).then(function(b){b.setSaveButtonText(g.get_string("adminaxisimport_delete","assignfeedback_editpdfplus"));var d=b.getRoot();d.on(i.save,function(){var b=a("#assignfeedback_editpdfplus_del_axis"),d=b.serialize()+"&contextid="+r;f.call([{methodname:"assignfeedback_editpdfplus_submit_axis_del_form",args:{jsonformdata:JSON.stringify(d)}}])[0].done(function(b){"1"===b[0].message?(a("#editpdlplus_axes option:selected").remove(),a("#editpdlplus_axes").change()):a("#assignfeedback_editpdfplus_widget_admin_div_delaxis").append("<div class='alert alert-danger' style='margin-top: 5px;'>"+b[0].message+"</div>")}).fail(c.exception)}),b.show()})}};var C=function(b,c,e){var f=a.Deferred();return b.fadeOut("fast",function(){d.replaceNodeContents(b,c,e),b.fadeIn("fast",function(){f.resolve()})}),f.promise()};w.prototype.deleteModel=function(){var b=a(this).parents("tr"),d=a(this).data("model");!d||parseInt(d)<=0||(a("#assignfeedback_editpdfplus_del_model input[name='modelid']").val(d),h.create({type:h.types.SAVE_CANCEL,title:g.get_string("adminaxisimport_delete","assignfeedback_editpdfplus"),body:g.get_string("delete_model_question","assignfeedback_editpdfplus")}).then(function(d){d.setSaveButtonText(g.get_string("adminaxisimport_delete","assignfeedback_editpdfplus"));var e=d.getRoot();e.on(i.save,function(){var d=a("#assignfeedback_editpdfplus_del_model"),e=d.serialize()+"&contextid="+r;f.call([{methodname:"assignfeedback_editpdfplus_submit_model_del_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(a){"1"===a[0].message?b.remove():w.prototype.displayMessageInformation("message_del_modal",a[0].message,1,0,0)}).fail(c.exception)}),d.show()}))},w.prototype.importAxis=function(){var b=a(this).data("axis");if(b&&!(parseInt(b)<=0)){a("#assignfeedback_editpdfplus_import_axis > div > input[name^='axeid']").val(b);var d=a("#assignfeedback_editpdfplus_import_axis"),e=d.serialize()+"&contextid="+r;f.call([{methodname:"assignfeedback_editpdfplus_submit_axis_import_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(b){if(""===b[0].message){var c=g.get_string("adminimport_messageok","assignfeedback_editpdfplus");w.prototype.displayMessageInformation("message_import_axis",c,1,0,0);var d="<div id='editpdlplus_toolbar_"+b[0].axeid+"' class='btn-group toolbar' style='display: none;'><ul class='sortable' style='list-style-type: none;margin: 0;padding: 0;width: 100%;'></ul></div>";a("#editpdlplus_toolbars").append(d),y();var e=new Option(b[0].axelabel,b[0].axeid,(!0),(!0));a("#editpdlplus_axes").append(e);var f=a("#editpdlplus_axes option[value='"+b[0].axeid+"']");if(f.data("delete",0),a("#editpdlplus_tool_item").html(""),b[0].toolid&&b[0].toolid>0)for(var h=0;h<b.length;h++){var i=new j;i.initAdmin(b[h]);var k=i.getButtonSortable(b[h].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(k)}else{var l=b[0].axeid,f=a("#editpdlplus_axes option[value='"+l+"']");f.data("delete",0)}a(".editpdlplus_tool").on("click",D),a("#editpdlplus_axes").change(),a("a[href^='#currenttoolbar'").click(),a("#axistool").show(),a("#assignfeedback_editpdfplus_widget_admin_toolheader").show(),a("#assignfeedback_editpdfplus_widget_admin_workspace").show(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").show()}else w.prototype.displayMessageInformation("message_import_axis",b[0].message,0,1,0)}).fail(c.exception)}};var D=function(){var b=a(this).val();a(".editpdlplus_tool").each(function(){a(this).removeClass("btn-primary"),a(this).css("background-image",""),a(this).css("background-color","");var c=a(this).data("enable");1!==c&&a(this).val()!==b&&(a(this).css("background-image","none"),a(this).css("background-color","#CCCCCC"))}),a(this).addClass("btn-primary"),s&&s.id===b||a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html("");var d={toolid:b};e.loadFragment("assignfeedback_editpdfplus","tooledit",r,d).done(function(d,e){C(a("#editpdlplus_tool_item"),d,e).done(function(){s=new j,s.id=b,s.axis=a("#toolaxis").val(),s.typetool=a("#typetool").val();var d=z(s.typetool);s.type=d;var e=a("#realcolor").val();e.length>0?s.colors=a("#color").val():(a("#color").val(d.color),s.colors=null),s.cartridge=a("#libelle").val(),a("#realcartridgecolor").val()&&a("#realcartridgecolor").val().length>0?s.cartridgeColor=a("#cartridgecolor").val():(a("#cartridgecolor").val(d.get_color_cartridge()),s.cartridgeColor=null),s.texts=a("#texts").val(),s.label=a("#button").val(),s.enabled=a("#enabled").val(),s.reply=a("#reply").val(),s.orderTool=a("#order").val(),a("#typetool").on("change",function(){s.typetool=a("#typetool").val();var b=z(s.typetool);s.type=b,s.colors=b.get_color(),s.cartridgeColor=b.get_color_cartridge(),a("#color").val(s.colors),a("#cartridgecolor").val(s.cartridgeColor),A(),B()}),a("#toolFormSubmit").on("click",function(){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));var d=a("#assignfeedback_editpdfplus_edit_tool"),e=d.serialize();f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_edit_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").show(),a("#message_edit_tool").html(w.messageEditOk),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_tool_"+b[0].selecttool).remove(),a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").html("");for(var c=0;c<b.length;c++){var d=new j;d.initAdmin(b[c]);var e=d.getButtonSortable(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(e)}a(".editpdlplus_tool").on("click",D);var f=a("#axisid").val();f!==b[0].axeid&&(a("#editpdlplus_axes").val(b[0].axeid),a("#editpdlplus_axes").change()),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(c.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(){t="clone",a("#assignfeedback_editpdfplus_widget_admin_button_addtool").click()}),a("#toolRemove").on("click",function(){if(!a(this).prop("disabled")){var b=a("#assignfeedback_editpdfplus_edit_tool"),d=b.serialize();f.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(w.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+" > ul").html(""),parseInt(b[0].toolid)>0){for(var c=0;c<b.length;c++){var d=new j;d.initAdmin(b[c]);var e=d.getButtonSortable(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(e)}a(".editpdlplus_tool").on("click",D)}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(c.exception)}}),a("#toolRefesh").on("click",function(){w.prototype.refreshPrevisu()}),B(),A()}.bind(this)).fail(c.exception)}.bind(this)).fail(c.exception)};return w.prototype.openDivAddTool=function(){a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html(""),a(".editpdlplus_tool").removeClass("btn-primary");var b=a("#editpdlplus_axes option:selected").val(),d={axisid:b};e.loadFragment("assignfeedback_editpdfplus","tooladd",r,d).done(function(d,e){C(a("#editpdlplus_tool_item"),d,e).done(function(){a("#toolaxis").val(b),"clone"===t?(a("#toolaxis").val(s.axis),a("#typetool").val(s.typetool),a("#color").val(s.colors),a("#libelle").val(s.cartridge),a("#cartridgecolor").val(s.cartridgeColor),a("#texts").val(s.texts),a("#button").val(s.label),a("#enabled").val(s.enabled),a("#reply").val(s.reply),a("#order").val(s.orderTool),s=new j,t=null):(s=new j,a("#typetool").on("change",function(){s=new j,s.axis=a("#toolaxis").val(),s.typetool=a("#typetool").val();var b=z(s.typetool);s.type=b,s.colors=b.get_color(),s.cartridgeColor=b.get_color_cartridge(),a("#color").val(s.colors),a("#cartridgecolor").val(s.cartridgeColor),w.prototype.refreshPrevisu()}),a("#typetool").change()),a("#toolFormSubmit").on("click",function(){if(""===a("#button").val())a("#message_edit_tool").show(),a("#message_edit_tool").html(w.messageaddlibelleko),a("#message_edit_tool").addClass("alert-warning"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success");else{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));var d=a("#assignfeedback_editpdfplus_edit_tool"),e=d.serialize();f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_add_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").show(),a("#message_edit_tool").html(w.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+" > ul").html("");for(var c=0;c<b.length;c++){var d=new j;d.initAdmin(b[c]);var e=d.getButtonSortable(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(e)}a(".editpdlplus_tool").on("click",D),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(c.exception)}})}.bind(this)).fail(c.exception)}.bind(this)).fail(c.exception)},w.prototype.showWorkspace=function(){a("#axistool").show(),a("#assignfeedback_editpdfplus_widget_admin_toolheader").show(),a("#assignfeedback_editpdfplus_widget_admin_workspace").show(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").show()},w.prototype.resetDivAction=function(b){a("#"+b).html(),a("#"+b).hide()},w.prototype.displayMessageInformation=function(b,c,d,e,f){a("#"+b).show(),a("#"+b).html(c),d?a("#"+b).addClass("alert-success"):a("#"+b).removeClass("alert-success"),e?a("#"+b).addClass("alert-danger"):a("#"+b).removeClass("alert-danger"),f?a("#"+b).addClass("alert-warning"):a("#"+b).removeClass("alert-warning"),a("#"+b).fadeOut(5e3)},w});
\ No newline at end of file
define(["jquery","jqueryui","core/notification","core/templates","core/fragment","core/ajax","core/str","core/modal_factory","core/modal_events","assignfeedback_editpdfplus/tool","assignfeedback_editpdfplus/tooltype","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,n,o,p,q){var r=null,s=null,t=null,u=null,v=null,w=function(a,b){r=a,this.initTypeTool(b),this.init()};w.messageDelOk="",w.messageDelKo="",w.messageko="",w.messageaddok="",w.messageaddlibelleko="",w.messageEditOk="",w.prototype.selectTool=null;var x=function(){g.get_string("admindeltool_messageok","assignfeedback_editpdfplus").done(function(a){w.messageDelOk=a}).fail(c.exception),g.get_string("admindeltool_messageko","assignfeedback_editpdfplus").done(function(a){w.messageDelKo=a}).fail(c.exception),g.get_string("adminaddtool_messageok","assignfeedback_editpdfplus").done(function(a){w.messageaddok=a}).fail(c.exception),g.get_string("admin_messageko","assignfeedback_editpdfplus").done(function(a){w.messageko=a}).fail(c.exception),g.get_string("adminedittool_messageok","assignfeedback_editpdfplus").done(function(a){w.messageEditOk=a}).fail(c.exception),g.get_string("adminaddtool_messagelibelleko","assignfeedback_editpdfplus").done(function(a){w.messageaddlibelleko=a}).fail(c.exception)};w.prototype.initTypeTool=function(a){var b=JSON.parse(a);u=[];for(var c=0;c<b.length;c++){var d=new k;d.initAdmin(b[c]),u[c]=d}},w.prototype.init=function(){a("#editpdlplus_axes").on("change",function(){a(".toolbar").hide();var b=a("#editpdlplus_axes").val();if(b&&""!==b){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").prop("disabled",!0):a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeAttr("disabled"):(a("#editpdlplus_axes option[value='"+b+"']").data("delete",0),a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeAttr("disabled"))}else a("#assignfeedback_editpdfplus_widget_admin_workspace").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide();a("#toolworkspace").html("")}),a("#editpdlplus_axes").change(),a(".editpdlplus_tool").on("click",D),this.selectTool=a(".editpdlplus_tool").first(),this.initToolUI(),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_exportaxis").on("click",this.openDivExportAxis),a("#assignfeedback_editpdfplus_widget_admin_button_addtool").on("click",this.openDivAddTool),a(".btn-primary").click(),a(".btnimport").on("click",this.importAxis),a(".btnimportdel").on("click",this.deleteModel),x()},w.prototype.initToolUI=function(){a(this.selectTool).addClass("btn-primary"),y()};var y=function(){a(".sortable").sortable({placeholder:"alert-warning",handle:"button",cancel:"",stop:function(b,d){var e=a(d.item).prev().find("button").val(),g=a(d.item).next().find("button").val(),h=a(d.item).find("button").val();a("input[name^='previoustoolid']").val(e),a("input[name^='toolid']").val(h),a("input[name^='nexttoolid']").val(g);var i=a("#assignfeedback_editpdfplus_order_tool"),j=i.serialize()+"&contextid="+r;f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_order_form",args:{jsonformdata:JSON.stringify(j)}}])[0].done(function(a){"ok"===a.message?w.prototype.displayMessageInformation("message_order_tool",w.messageEditOk,1,0,0):w.prototype.displayMessageInformation("message_order_tool",w.messageko,0,1,0)}).fail(c.exception)}}),a(".sortable").disableSelection()};w.prototype.refreshPrevisu=function(){s.axis=a("#toolaxis").val(),s.typetool=a("#typetool").val(),s.colors=a("#color").val(),s.cartridge=a("#libelle").val(),s.cartridgeColor=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)),s.texts=a("#texts").val(),s.label=a("#button").val(),s.enabled=a("#enabled").val(),s.reply=0,a("#reply").is(":checked")&&(s.reply=1),s.orderTool=a("#order").val(),B(),A()};var z=function(a){for(var b=0;b<u.length;b++)if(u[b].id==a)return u[b]},A=function(){var b=parseInt(a("#typetool").val()),c=z(b),d=!1,e=!1;c.configurableCartridge&&0===parseInt(c.configurableCartridge)?(a("#libelle").hide(),a("label[for='libelle']").hide(),d=!0):(a("#libelle").show(),a("label[for='libelle']").show()),c.configurableCartridgeColor&&0===parseInt(c.configurableCartridgeColor)?(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.configurableColor&&0===parseInt(c.configurableColor)?(a("#color").hide(),a("label[for='color']").hide(),f=!0):(a("#color").show(),a("label[for='color']").show()),c.configurableTexts&&0===parseInt(c.configurableTexts)?(a(".textform").hide(),a("label[for='texts']").hide(),g=!0):(a(".textform").show(),a("label[for='texts']").show()),c.configurableQuestion&&0===parseInt(c.configurableQuestion)?(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()},B=function(){a("#canevas").html(""),v=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)v=new l;else if(3===b)v=new m;else if(4===b){v=new n;var c=new n}else 5===b?v=new p:6===b?v=new q:7===b&&(v=new o);if(v){var d=z(b);s.type=d,s.reply=0,a("#reply").is(":checked")&&(s.reply=1),v.initAdminDemo(s),v.draw(a("#canevas")),c&&(c.initChildAdminDemo(v),c.draw(a("#canevas")))}};w.prototype.openDivAddAxis=function(){var b=a("#editpdlplus_axes").val();b&&""!==b?(a("#message_edit_tool").hide(),a("#axistool").hide()):(a("#assignfeedback_editpdfplus_widget_admin_workspace").show(),a("#editpdlplus_axes_worspace").hide()),a("#assignfeedback_editpdfplus_widget_admin_div_axis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled",!0);var f={};e.loadFragment("assignfeedback_editpdfplus","axisadd",r,f).done(function(a,b){d.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_addaxis",a,b)}.bind(this)).fail(c.exception)},w.prototype.openDivEditAxis=function(){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_axis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_editaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_editaxis").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled",!0);var b=a("#editpdlplus_axes option:selected").val(),f={axeid:b};e.loadFragment("assignfeedback_editpdfplus","axisedit",r,f).done(function(a,b){d.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_editaxis",a,b)}.bind(this)).fail(c.exception)},w.prototype.openDivExportAxis=function(){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_axis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_exportaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_exportaxis").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled",!0);var b=a("#editpdlplus_axes option:selected").val(),h={axeid:b};e.loadFragment("assignfeedback_editpdfplus","axisexport",r,h).done(function(b,e){d.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_exportaxis",b,e),a("#axisExportSubmit").on("click",function(){var b=a("#assignfeedback_editpdfplus_widget_admin_div_exportaxis form"),d=b.serialize();f.call([{methodname:"assignfeedback_editpdfplus_submit_axis_export_form",args:{jsonformdata:JSON.stringify(d)}}])[0].done(function(b){if(""===b[0].message){var c=a("<tr></tr>");c.append("<td>"+b[0].axelabel+"</td>");for(var d=b,e=a('<td><div class="btn-group"></div></td>'),f=0;f<d.length;f++)e.append('<button class="btn" style="'+d[f].style+'">'+d[f].button+"</button>");c.append(e),c.append("<td><button class='btn btn-primary btn-sm btnimport' data-axis='"+b[0].axeid+"'><i class='fa fa-download'></i></button></td>"),c.append("<td><button class='btn btn-danger btn-sm btnimportdel' data-model='"+b[0].modelid+"'><i class='fa fa-remove'></i></button></td>"),a("div#import tbody").append(c),a(".btnimport").on("click",w.prototype.importAxis),a(".btnimportdel").on("click",w.prototype.deleteModel),w.prototype.resetDivAction("assignfeedback_editpdfplus_widget_admin_div_exportaxis"),a("#axistool").show();var h=a("#editpdlplus_axes").val();h&&""!==h?w.prototype.showWorkspace():(a("#assignfeedback_editpdfplus_widget_admin_workspace").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide()),a("#editpdlplus_axes").removeAttr("disabled");var i=g.get_string("adminexport_messageok","assignfeedback_editpdfplus");w.prototype.displayMessageInformation("message_export_axis",i,1,0,0)}else a("#assignfeedback_editpdfplus_widget_admin_div_exportaxis").append("<div class='alert alert-danger' style='margin-top: 5px;'>"+b[0].message+"</div>")}).fail(c.exception)}),a("#axisExportCancel").on("click",function(){w.prototype.resetDivAction("assignfeedback_editpdfplus_widget_admin_div_exportaxis"),w.prototype.showWorkspace(),a("#editpdlplus_axes").removeAttr("disabled")})}.bind(this)).fail(c.exception)},w.prototype.openDivDelAxis=function(){var b=a("#editpdlplus_axes option:selected").data("delete");if(!(null===b||parseInt(b)>0)){var d=a("#editpdlplus_axes option:selected").val();a("#assignfeedback_editpdfplus_del_axis input[name='axeid']").val(d),h.create({type:h.types.SAVE_CANCEL,title:g.get_string("adminaxisimport_delete","assignfeedback_editpdfplus"),body:g.get_string("adminaxisdelete_question","assignfeedback_editpdfplus")}).then(function(b){b.setSaveButtonText(g.get_string("adminaxisimport_delete","assignfeedback_editpdfplus"));var d=b.getRoot();d.on(i.save,function(){var b=a("#assignfeedback_editpdfplus_del_axis"),d=b.serialize()+"&contextid="+r;f.call([{methodname:"assignfeedback_editpdfplus_submit_axis_del_form",args:{jsonformdata:JSON.stringify(d)}}])[0].done(function(b){"1"===b[0].message?(a("#editpdlplus_axes option:selected").remove(),a("#editpdlplus_axes").change()):a("#assignfeedback_editpdfplus_widget_admin_div_delaxis").append("<div class='alert alert-danger' style='margin-top: 5px;'>"+b[0].message+"</div>")}).fail(c.exception)}),b.show()})}};var C=function(b,c,e){var f=a.Deferred();return b.fadeOut("fast",function(){d.replaceNodeContents(b,c,e),b.fadeIn("fast",function(){f.resolve()})}),f.promise()};w.prototype.deleteModel=function(){var b=a(this).parents("tr"),d=a(this).data("model");!d||parseInt(d)<=0||(a("#assignfeedback_editpdfplus_del_model input[name='modelid']").val(d),h.create({type:h.types.SAVE_CANCEL,title:g.get_string("adminaxisimport_delete","assignfeedback_editpdfplus"),body:g.get_string("delete_model_question","assignfeedback_editpdfplus")}).then(function(d){d.setSaveButtonText(g.get_string("adminaxisimport_delete","assignfeedback_editpdfplus"));var e=d.getRoot();e.on(i.save,function(){var d=a("#assignfeedback_editpdfplus_del_model"),e=d.serialize()+"&contextid="+r;f.call([{methodname:"assignfeedback_editpdfplus_submit_model_del_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(a){"1"===a[0].message?b.remove():w.prototype.displayMessageInformation("message_del_modal",a[0].message,1,0,0)}).fail(c.exception)}),d.show()}))},w.prototype.importAxis=function(){var b=a(this).data("axis");if(b&&!(parseInt(b)<=0)){a("#assignfeedback_editpdfplus_import_axis > div > input[name^='axeid']").val(b);var d=a("#assignfeedback_editpdfplus_import_axis"),e=d.serialize()+"&contextid="+r;f.call([{methodname:"assignfeedback_editpdfplus_submit_axis_import_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(b){if(""===b[0].message){var c=g.get_string("adminimport_messageok","assignfeedback_editpdfplus");w.prototype.displayMessageInformation("message_import_axis",c,1,0,0);var d="<div id='editpdlplus_toolbar_"+b[0].axeid+"' class='btn-group toolbar' style='display: none;'><ul class='sortable' style='list-style-type: none;margin: 0;padding: 0;width: 100%;'></ul></div>";a("#editpdlplus_toolbars").append(d),y();var e=new Option(b[0].axelabel,b[0].axeid,(!0),(!0));a("#editpdlplus_axes").append(e);var f=a("#editpdlplus_axes option[value='"+b[0].axeid+"']");if(f.data("delete",0),a("#editpdlplus_tool_item").html(""),b[0].toolid&&b[0].toolid>0)for(var h=0;h<b.length;h++){var i=new j;i.initAdmin(b[h]);var k=i.getButtonSortable(b[h].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(k)}else{var l=b[0].axeid,f=a("#editpdlplus_axes option[value='"+l+"']");f.data("delete",0)}a(".editpdlplus_tool").on("click",D),a("#editpdlplus_axes").change(),a("a[href^='#currenttoolbar'").click(),a("#axistool").show(),a("#assignfeedback_editpdfplus_widget_admin_toolheader").show(),a("#assignfeedback_editpdfplus_widget_admin_workspace").show(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").show()}else w.prototype.displayMessageInformation("message_import_axis",b[0].message,0,1,0)}).fail(c.exception)}};var D=function(){var b=a(this).val();a(".editpdlplus_tool").each(function(){a(this).removeClass("btn-primary"),a(this).css("background-image",""),a(this).css("background-color","");var c=a(this).data("enable");1!==c&&a(this).val()!==b&&(a(this).css("background-image","none"),a(this).css("background-color","#CCCCCC"))}),a(this).addClass("btn-primary"),s&&s.id===b||a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html("");var d={toolid:b};e.loadFragment("assignfeedback_editpdfplus","tooledit",r,d).done(function(d,e){C(a("#editpdlplus_tool_item"),d,e).done(function(){s=new j,s.id=b,s.axis=a("#toolaxis").val(),s.typetool=a("#typetool").val();var d=z(s.typetool);s.type=d;var e=a("#realcolor").val();e.length>0?s.colors=a("#color").val():(a("#color").val(d.color),s.colors=null),s.cartridge=a("#libelle").val(),a("#realcartridgecolor").val()&&a("#realcartridgecolor").val().length>0?s.cartridgeColor=a("#cartridgecolor").val():(a("#cartridgecolor").val(d.get_color_cartridge()),s.cartridgeColor=null),s.texts=a("#texts").val(),s.label=a("#button").val(),s.enabled=a("#enabled").val(),s.reply=a("#reply").val(),s.orderTool=a("#order").val(),a("#typetool").on("change",function(){s.typetool=a("#typetool").val();var b=z(s.typetool);s.type=b,s.colors=b.get_color(),s.cartridgeColor=b.get_color_cartridge(),a("#color").val(s.colors),a("#cartridgecolor").val(s.cartridgeColor),A(),B()}),a("#toolFormSubmit").on("click",function(){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));var d=a("#assignfeedback_editpdfplus_edit_tool"),e=d.serialize();f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_edit_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").show(),a("#message_edit_tool").html(w.messageEditOk),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_tool_"+b[0].selecttool).remove(),a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").html("");for(var c=0;c<b.length;c++){var d=new j;d.initAdmin(b[c]);var e=d.getButtonSortable(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(e)}a(".editpdlplus_tool").on("click",D);var f=a("#axisid").val();f!==b[0].axeid&&(a("#editpdlplus_axes").val(b[0].axeid),a("#editpdlplus_axes").change()),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(c.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(){t="clone",a("#assignfeedback_editpdfplus_widget_admin_button_addtool").click()}),a("#toolRemove").on("click",function(){if(!a(this).prop("disabled")){var b=a("#assignfeedback_editpdfplus_edit_tool"),d=b.serialize();f.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(w.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+" > ul").html(""),parseInt(b[0].toolid)>0){for(var c=0;c<b.length;c++){var d=new j;d.initAdmin(b[c]);var e=d.getButtonSortable(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(e)}a(".editpdlplus_tool").on("click",D)}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(c.exception)}}),a("#toolRefesh").on("click",function(){w.prototype.refreshPrevisu()}),B(),A()}.bind(this)).fail(c.exception)}.bind(this)).fail(c.exception)};return w.prototype.openDivAddTool=function(){a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html(""),a(".editpdlplus_tool").removeClass("btn-primary");var b=a("#editpdlplus_axes option:selected").val(),d={axisid:b};e.loadFragment("assignfeedback_editpdfplus","tooladd",r,d).done(function(d,e){C(a("#editpdlplus_tool_item"),d,e).done(function(){a("#toolaxis").val(b),"clone"===t?(a("#toolaxis").val(s.axis),a("#typetool").val(s.typetool),a("#color").val(s.colors),a("#libelle").val(s.cartridge),a("#cartridgecolor").val(s.cartridgeColor),a("#texts").val(s.texts),a("#button").val(s.label),a("#enabled").val(s.enabled),a("#reply").val(s.reply),a("#order").val(s.orderTool),s=new j,t=null):(s=new j,a("#typetool").on("change",function(){s=new j,s.axis=a("#toolaxis").val(),s.typetool=a("#typetool").val();var b=z(s.typetool);s.type=b,s.colors=b.get_color(),s.cartridgeColor=b.get_color_cartridge(),a("#color").val(s.colors),a("#cartridgecolor").val(s.cartridgeColor),w.prototype.refreshPrevisu()}),a("#typetool").change()),a("#toolFormSubmit").on("click",function(){if(""===a("#button").val())a("#message_edit_tool").show(),a("#message_edit_tool").html(w.messageaddlibelleko),a("#message_edit_tool").addClass("alert-warning"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success");else{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));var d=a("#assignfeedback_editpdfplus_edit_tool"),e=d.serialize();f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_add_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").show(),a("#message_edit_tool").html(w.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+" > ul").html("");for(var c=0;c<b.length;c++){var d=new j;d.initAdmin(b[c]);var e=d.getButtonSortable(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(e)}a(".editpdlplus_tool").on("click",D),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(c.exception)}})}.bind(this)).fail(c.exception)}.bind(this)).fail(c.exception)},w.prototype.showWorkspace=function(){a("#axistool").show(),a("#assignfeedback_editpdfplus_widget_admin_toolheader").show(),a("#assignfeedback_editpdfplus_widget_admin_workspace").show(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").show()},w.prototype.resetDivAction=function(b){a("#"+b).html(),a("#"+b).hide()},w.prototype.displayMessageInformation=function(b,c,d,e,f){a("#"+b).show(),a("#"+b).html(c),d?a("#"+b).addClass("alert-success"):a("#"+b).removeClass("alert-success"),e?a("#"+b).addClass("alert-danger"):a("#"+b).removeClass("alert-danger"),f?a("#"+b).addClass("alert-warning"):a("#"+b).removeClass("alert-warning"),a("#"+b).fadeOut(5e3)},w});
\ No newline at end of file
......@@ -426,6 +426,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
$("#assignfeedback_editpdfplus_widget_admin_workspace").show();
$("#editpdlplus_axes_worspace").hide();
}
$('#assignfeedback_editpdfplus_widget_admin_div_axis').show();
$('#assignfeedback_editpdfplus_widget_admin_div_addaxis').show();
$('#assignfeedback_editpdfplus_widget_admin_div_addaxis').html("");
$('#assignfeedback_editpdfplus_widget_admin_toolheader').hide();
......@@ -445,6 +446,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
AdminPanel.prototype.openDivEditAxis = function () {
$("#message_edit_tool").hide();
$("#axistool").hide();
$('#assignfeedback_editpdfplus_widget_admin_div_axis').show();
$('#assignfeedback_editpdfplus_widget_admin_div_editaxis').show();
$('#assignfeedback_editpdfplus_widget_admin_div_editaxis').html("");
$('#assignfeedback_editpdfplus_widget_admin_toolheader').hide();
......@@ -465,6 +467,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
AdminPanel.prototype.openDivExportAxis = function () {
$("#message_edit_tool").hide();
$("#axistool").hide();
$('#assignfeedback_editpdfplus_widget_admin_div_axis').show();
$('#assignfeedback_editpdfplus_widget_admin_div_exportaxis').show();
$('#assignfeedback_editpdfplus_widget_admin_div_exportaxis').html("");
$('#assignfeedback_editpdfplus_widget_admin_toolheader').hide();
......
......@@ -129,36 +129,40 @@
</div>
</div>
</td>
<td id='assignfeedback_editpdfplus_widget_admin_toolworkspace' class='assignfeedback_editpdfplus_widget_admin_col2'>
<div id='editpdlplus_toolbars'>
{{# toolbars }}
<div id="editpdlplus_toolbar_{{axis.id}}" class="btn-group toolbar sortable" style="display: none;width: 100%;">
<ul class="sortable" style="list-style-type: none;margin: 0;padding: 0;width: 100%;">
{{# tools }}
<li style="float: left;display: block;">
<button class="btn {{button}} editpdlplus_tool" id="editpdlplus_tool_{{id}}" value="{{id}}" style="{{style}}" data-enable="{{enabled}}">
{{label}}
</button>
</li>
{{/ tools }}
</ul>
</div>
{{/ toolbars }}
</div>
{{{ toolorderform.render }}}
<td>
<div class="d-flex">
<div id='assignfeedback_editpdfplus_widget_admin_toolworkspace' class='assignfeedback_editpdfplus_widget_admin_col2 w-100'>
<div id='editpdlplus_toolbars'>
{{# toolbars }}
<div id="editpdlplus_toolbar_{{axis.id}}" class="btn-group toolbar sortable" style="display: none;width: 100%;">
<ul class="sortable" style="list-style-type: none;margin: 0;padding: 0;width: 100%;">
{{# tools }}
<li style="float: left;display: block;">
<button class="btn {{button}} editpdlplus_tool" id="editpdlplus_tool_{{id}}" value="{{id}}" style="{{style}}" data-enable="{{enabled}}">
{{label}}
</button>
</li>
{{/ tools }}
</ul>
</div>
{{/ toolbars }}
</div>
{{{ toolorderform.render }}}
<div class="alert" id="message_edit_tool"></div>
<div class="alert" id="message_edit_tool"></div>
<div id="editpdlplus_tool_item"></div>
</td>
<td>
<div id="assignfeedback_editpdfplus_widget_admin_div_addaxis" style="display:none;" class="card w-50 ml-2 border-primary">
</div>
<div id="assignfeedback_editpdfplus_widget_admin_div_editaxis" style="display:none;" class="card w-50 ml-2 border-primary">
</div>
<div id="assignfeedback_editpdfplus_widget_admin_div_delaxis" style="display:none;" class="card w-50 ml-2 border-primary">
</div>
<div id="assignfeedback_editpdfplus_widget_admin_div_exportaxis" style="display:none;" class="card w-50 ml-2 border-primary">
<div id="editpdlplus_tool_item"></div>
</div>
<div id="assignfeedback_editpdfplus_widget_admin_div_axis" style="display:none;" class="w-100">
<div id="assignfeedback_editpdfplus_widget_admin_div_addaxis" style="display:none;" class="card w-50 ml-2 border-primary">
</div>
<div id="assignfeedback_editpdfplus_widget_admin_div_editaxis" style="display:none;" class="card w-50 ml-2 border-primary">
</div>
<div id="assignfeedback_editpdfplus_widget_admin_div_delaxis" style="display:none;" class="card w-50 ml-2 border-primary">
</div>
<div id="assignfeedback_editpdfplus_widget_admin_div_exportaxis" style="display:none;" class="card w-50 ml-2 border-primary">
</div>
</div>
</div>
</td>
</tr>
......
......@@ -49,6 +49,7 @@ require(['jquery','core/ajax','core/notification'], function($,ajax,notification
if ('{{action}}' === 'add'){
var divAxis = "<div id='editpdlplus_toolbar_"+axe[0].axeid+"' class='btn-group toolbar' style='display: none;'><ul></ul></div>";
$('#editpdlplus_toolbars').append(divAxis);
$('#assignfeedback_editpdfplus_widget_admin_div_axis').hide();
$('#assignfeedback_editpdfplus_widget_admin_div_addaxis').html("");
$('#assignfeedback_editpdfplus_widget_admin_div_addaxis').hide();
var option=new Option(axe[0].axelabel, axe[0].axeid, true, true);
......@@ -56,6 +57,7 @@ require(['jquery','core/ajax','core/notification'], function($,ajax,notification
$("#editpdlplus_axes").change();
$('#editpdlplus_tool_item').html("");
} else {
$('#assignfeedback_editpdfplus_widget_admin_div_axis').hide();
$('#assignfeedback_editpdfplus_widget_admin_div_editaxis').html("");
$('#assignfeedback_editpdfplus_widget_admin_div_editaxis').hide();
$("#editpdlplus_axes option:selected").html(axe[0].axelabel);
......@@ -69,9 +71,11 @@ require(['jquery','core/ajax','core/notification'], function($,ajax,notification
});
$("#axisFormCancel").on("click", function () {
if ('{{action}}' === 'add'){
$('#assignfeedback_editpdfplus_widget_admin_div_axis').hide();
$('#assignfeedback_editpdfplus_widget_admin_div_addaxis').html("");
$('#assignfeedback_editpdfplus_widget_admin_div_addaxis').hide();
} else {
$('#assignfeedback_editpdfplus_widget_admin_div_axis').hide();
$('#assignfeedback_editpdfplus_widget_admin_div_editaxis').html("");
$('#assignfeedback_editpdfplus_widget_admin_div_editaxis').hide();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment