Gitlab CSE Unil

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

bouton de prévisu instantanée

parent a5364bd7
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.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",w),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()},r.prototype.test=function(){alert("test"),w()},r.prototype.initTool=function(){a(this.selectTool).removeClass("btn-default"),a(this.selectTool).addClass("btn-primary")};var t=function(a){for(var b=0;b<q.length;b++)if(q[b].id==a)return q[b]},u=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=t(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("#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("#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("#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 v=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()},w=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"),a("#editpdlplus_tool_item").html("");var f={toolid:c};d.loadFragment("assignfeedback_editpdfplus","tooledit",n,f).done(function(c,d){v(a("#editpdlplus_tool_item"),c,d).done(function(){o=new Object,o.typetool=a("#typetool").val(),o.color=a("#color").val(),o.libelle=a("#libelle").val(),o.catridgecolor=a("#cartridgecolor").val(),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("#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").html("Modifications enregistrées"),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),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",w),w()}else 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").html(b[0].messageok),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),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",w)}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").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(b.exception)}}),u()}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)};return r.prototype.openDivAddTool=function(){var c=f.get_string("adminaddtool_messageok","assignfeedback_editpdfplus");a("#editpdlplus_tool_item").html(""),a(".btn-primary").addClass("btn-default"),a(".editpdlplus_tool").removeClass("btn-primary");var g=a("#editpdlplus_axes option:selected").val(),h={axisid:g};d.loadFragment("assignfeedback_editpdfplus","tooladd",n,h).done(function(d,f){v(a("#editpdlplus_tool_item"),d,f).done(function(){"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=null,p=null),a("#toolFormSubmit").on("click",function(){if(""===a("#button").val()){var d="<strong>Attention!</strong>Le libellé du bouton n'est pas renseigné";a("#message_edit_tool").html(d),a("#message_edit_tool").addClass("alert-warning"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}else{var f="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(f+='"'+a(this).val().replace(/"/g,"")+'",')}),f.length>0&&a("#texts").val(f.substring(0,f.length-1));var g=a("#assignfeedback_editpdfplus_edit_tool"),h=g.serialize();e.call([{methodname:"assignfeedback_editpdfplus_submit_tool_add_form",args:{jsonformdata:JSON.stringify(h)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").html(c),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 d=0;d<b.length;d++){var e="btn-default";1!==b[d].enable&&(e=""),b[d].toolid===b[d].selecttool&&(e="btn-primary");var f="";4!==b[d].typetool&&1!==b[d].typetool||(f="text-decoration: underline;");var g=b[d].button;4!==b[d].typetool&&5!==b[d].typetool||(g="| "+g,4===b[d].typetool&&(g+=" |"));var h="<button class='btn "+e+" editpdlplus_tool' id='editpdlplus_tool_"+b[d].toolid+"' style='"+f+"' value='"+b[d].toolid+"' data-enable='"+b[d].enable+"'>"+g+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(h)}a(".editpdlplus_tool").on("click",w),a("#toolworkspace").html("");var i=b[0].axeid,j=a("#editpdlplus_axes option[value='"+i+"']");j.data("delete",1);var k=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");k.addClass("disabled")}else 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.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",w),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()},r.prototype.test=function(){alert("test"),w()},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(),u()};var t=function(a){for(var b=0;b<q.length;b++)if(q[b].id==a)return q[b]},u=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=t(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("#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("#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("#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 v=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()},w=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"),a("#editpdlplus_tool_item").html("");var f={toolid:c};d.loadFragment("assignfeedback_editpdfplus","tooledit",n,f).done(function(c,d){v(a("#editpdlplus_tool_item"),c,d).done(function(){o=new Object,o.typetool=a("#typetool").val(),o.color=a("#color").val(),o.libelle=a("#libelle").val(),o.catridgecolor=a("#cartridgecolor").val(),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("#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").html("Modifications enregistrées"),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),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",w),w()}else 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").html(b[0].messageok),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),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",w)}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").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()}),u()}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)};return r.prototype.openDivAddTool=function(){var c=f.get_string("adminaddtool_messageok","assignfeedback_editpdfplus");a("#editpdlplus_tool_item").html(""),a(".btn-primary").addClass("btn-default"),a(".editpdlplus_tool").removeClass("btn-primary");var g=a("#editpdlplus_axes option:selected").val(),h={axisid:g};d.loadFragment("assignfeedback_editpdfplus","tooladd",n,h).done(function(d,f){v(a("#editpdlplus_tool_item"),d,f).done(function(){"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=null,p=null),a("#toolFormSubmit").on("click",function(){if(""===a("#button").val()){var d="<strong>Attention!</strong>Le libellé du bouton n'est pas renseigné";a("#message_edit_tool").html(d),a("#message_edit_tool").addClass("alert-warning"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}else{var f="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(f+='"'+a(this).val().replace(/"/g,"")+'",')}),f.length>0&&a("#texts").val(f.substring(0,f.length-1));var g=a("#assignfeedback_editpdfplus_edit_tool"),h=g.serialize();e.call([{methodname:"assignfeedback_editpdfplus_submit_tool_add_form",args:{jsonformdata:JSON.stringify(h)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").html(c),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 d=0;d<b.length;d++){var e="btn-default";1!==b[d].enable&&(e=""),b[d].toolid===b[d].selecttool&&(e="btn-primary");var f="";4!==b[d].typetool&&1!==b[d].typetool||(f="text-decoration: underline;");var g=b[d].button;4!==b[d].typetool&&5!==b[d].typetool||(g="| "+g,4===b[d].typetool&&(g+=" |"));var h="<button class='btn "+e+" editpdlplus_tool' id='editpdlplus_tool_"+b[d].toolid+"' style='"+f+"' value='"+b[d].toolid+"' data-enable='"+b[d].enable+"'>"+g+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(h)}a(".editpdlplus_tool").on("click",w),a("#toolworkspace").html("");var i=b[0].axeid,j=a("#editpdlplus_axes option[value='"+i+"']");j.data("delete",1);var k=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");k.addClass("disabled")}else 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
......@@ -92,21 +92,30 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
$(this.selectTool).addClass("btn-primary");
};
//
/*AdminPanel.prototype.refreshPrevisu = function () {
currentTool.typetool = $("#typetool").val();
currentTool.color = $("#color").val();
currentTool.libelle = $("#libelle").val();
currentTool.catridgecolor = $("#cartridgecolor").val();
currentTool.texts = $("#texts").val();
currentTool.button = $("#button").val();
currentTool.enabled = $("#enabled").val();
currentTool.reply = 0;
if ($("#reply").is(':checked')) {
currentTool.reply = 1;
}
currentTool.order = $("#order").val();
initCanevas();
};*/
AdminPanel.prototype.refreshPrevisu = function () {
currentTool.typetool = $("#typetool").val();
currentTool.color = $("#color").val();
currentTool.libelle = $("#libelle").val();
currentTool.catridgecolor = $("#cartridgecolor").val();
var res = "";
$("input[name^='text[']").each(function () {
if ($(this).val() && ($(this).val()).length > 0) {
res += '"' + $(this).val().replace(/"/g, "") + '",';
}
});
if (res.length > 0) {
$("#texts").val(res.substring(0, res.length - 1));
}
currentTool.texts = $("#texts").val();
currentTool.button = $("#button").val();
currentTool.enabled = $("#enabled").val();
currentTool.reply = 0;
if ($("#reply").is(':checked')) {
currentTool.reply = 1;
}
currentTool.order = $("#order").val();
initCanevas();
};
//
var getTypeTool = function (toolid) {
for (var i = 0; i < typetools.length; i++) {
......@@ -421,6 +430,9 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
}).fail(notification.exception);
}
});
$("#toolRefesh").on("click", function () {
AdminPanel.prototype.refreshPrevisu();
});
//maj affichage previsu
initCanevas();
}.bind(this)).fail(notification.exception);
......
......@@ -12,7 +12,7 @@
<div class='col-sm-3'>
{{#tool.id}}<div id="editpdlplus_tool_label" class="btn alert-info" style="cursor: default;">{{tool.label}}</div>{{/tool.id}}
</div>
<div class='col-sm-offset-1 col-sm-5'>
<div class='col-sm-offset-1 col-sm-3'>
{{# str }} admintoolboxaction, assignfeedback_editpdfplus {{/ str }}{{#tool.id}}s{{/tool.id}} :
<button type="button" class="btn btn-default" id="toolFormSubmit"><i class="fa fa-{{#tool.id}}save{{/tool.id}}{{^tool.id}}save{{/tool.id}}" aria-hidden="true"></i></button>
{{#tool.id}}
......@@ -21,6 +21,11 @@
<button type="button" class="btn btn-default {{^tool.removable}}disabled{{/tool.removable}}" id="toolRemove"><i class="fa fa-remove" aria-hidden="true"></i></button>
{{/tool.id}}
</div>
<div class='col-sm-2'>
{{#tool.id}}
<button type="button" class="btn btn-default" id="toolRefesh"><i class="fa fa-refresh" aria-hidden="true"></i></button>
{{/tool.id}}
</div>
</div>
<div class='row'>
......
Supports Markdown
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