Gitlab CSE Unil

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

documentation php et javascript

parent 185d8614
define(["jquery","core/notification","core/templates","core/fragment","core/ajax","core/str","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){var o=null,p=null,q=null,r=null,s=function(a,b){o=a,this.initTypeTool(b),this.init()},t=null;s.messageDelOk="",s.messageDelKo="",s.messageko="",s.messageaddok="",s.messageaddlibelleko="",s.messageEditOk="",s.prototype.selectTool=null,s.prototype.initTypeTool=function(a){var b=JSON.parse(a);r=[];for(var c=0;c<b.length;c++){var d=new h;d.initAdmin(b[c]),r[c]=d}},s.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").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"))}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",z),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_addtool").on("click",this.openDivAddTool),a(".btn-primary").click(),a(".btnimport").on("click",this.importAxis),u()};var u=function(){f.get_string("admindeltool_messageok","assignfeedback_editpdfplus").done(function(a){s.messageDelOk=a}).fail(b.exception),f.get_string("admindeltool_messageko","assignfeedback_editpdfplus").done(function(a){s.messageDelKo=a}).fail(b.exception),f.get_string("adminaddtool_messageok","assignfeedback_editpdfplus").done(function(a){s.messageaddok=a}).fail(b.exception),f.get_string("admin_messageko","assignfeedback_editpdfplus").done(function(a){s.messageko=a}).fail(b.exception),f.get_string("adminedittool_messageok","assignfeedback_editpdfplus").done(function(a){s.messageEditOk=a}).fail(b.exception),f.get_string("adminaddtool_messagelibelleko","assignfeedback_editpdfplus").done(function(a){s.messageaddlibelleko=a}).fail(b.exception)};s.prototype.test=function(){alert("test"),z()},s.prototype.initToolUI=function(){a(this.selectTool).removeClass("btn-default"),a(this.selectTool).addClass("btn-primary")},s.prototype.refreshPrevisu=function(){p.typetool=a("#typetool").val(),p.colors=a("#color").val(),p.cartridge=a("#libelle").val(),p.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)),p.texts=a("#texts").val(),p.label=a("#button").val(),p.enabled=a("#enabled").val(),p.reply=0,a("#reply").is(":checked")&&(p.reply=1),p.orderTool=a("#order").val(),x(),w()};var v=function(a){for(var b=0;b<r.length;b++)if(r[b].id==a)return r[b]},w=function(){var b=parseInt(a("#typetool").val()),c=v(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()},x=function(){a("#canevas").html(""),t=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)t=new i;else if(3===b)t=new j;else if(4===b){t=new k;var c=new k}else 5===b?t=new m:6===b?t=new n:7===b&&(t=new l);if(t){var d=v(b);p.type=d,p.reply=0,a("#reply").is(":checked")&&(p.reply=1),t.initAdminDemo(p),t.draw(a("#canevas")),c&&(c.initChildAdminDemo(t),c.draw(a("#canevas")))}};s.prototype.openDivAddAxis=function(){var e=a("#editpdlplus_axes").val();e&&""!==e?(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 > .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={};d.loadFragment("assignfeedback_editpdfplus","axisadd",o,f).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},s.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",o,f).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},s.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",o,g).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)}};var y=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()};s.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(s.messageaddok),a("#message_import_axis").addClass("alert-success"),a("#message_import_axis").removeClass("alert-danger"),a("#message_import_axis").removeClass("alert-warning"),a("#message_import_axis").fadeOut(5e3);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);var e=a("#editpdlplus_axes option[value='"+b[0].axeid+"']");e.data("delete",1);var f=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");if(f.addClass("disabled"),a("#editpdlplus_tool_item").html(""),b[0].toolid&&b[0].toolid>0)for(var h=0;h<b.length;h++){var i=new g;i.initAdmin(b[h]);var j=i.getButton(b[h].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid).append(j)}else{var k=b[0].axeid,e=a("#editpdlplus_axes option[value='"+k+"']");e.data("delete",0);var f=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");f.removeClass("disabled")}a(".editpdlplus_tool").on("click",z),a("#editpdlplus_axes").change(),a("a[href^='#collapseadmin1'").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 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"),a("#message_import_axis").fadeOut(5e3)}).fail(b.exception)}};var z=function(){var c=a(this).val();a(".editpdlplus_tool").each(function(){a(this).removeClass("btn-primary"),a(this).removeClass("btn-default"),a(this).css("background-image",""),a(this).css("background-color","");var b=a(this).data("enable");1===b&&a(this).val()!==c?a(this).addClass("btn-default"):a(this).val()!==c&&(a(this).css("background-image","none"),a(this).css("background-color","#CCCCCC"))}),a(this).addClass("btn-primary"),p&&p.id===c||a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html("");var f={toolid:c};d.loadFragment("assignfeedback_editpdfplus","tooledit",o,f).done(function(d,f){y(a("#editpdlplus_tool_item"),d,f).done(function(){p=new g,p.id=c,p.typetool=a("#typetool").val();var d=v(p.typetool);p.type=d;var f=a("#realcolor").val();f.length>0?p.colors=a("#color").val():(a("#color").val(d.color),p.colors=null),p.cartridge=a("#libelle").val(),a("#realcartridgecolor").val().length>0?p.cartridgeColor=a("#cartridgecolor").val():(a("#cartridgecolor").val(d.cartridge_color),p.cartridgeColor=null),p.texts=a("#texts").val(),p.label=a("#button").val(),p.enabled=a("#enabled").val(),p.reply=a("#reply").val(),p.orderTool=a("#order").val(),a("#typetool").on("change",function(){p.typetool=a("#typetool").val();var b=v(p.typetool);p.type=b,p.colors=b.get_color(),p.cartridgeColor=b.get_color_cartridge(),a("#color").val(p.colors),a("#cartridgecolor").val(p.cartridgeColor),w(),x()}),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(s.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=new g;d.initAdmin(b[c]);var e=d.getButton(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid).append(e)}a(".editpdlplus_tool").on("click",z),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(){q="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(s.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=new g;d.initAdmin(b[c]);var e=d.getButton(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid).append(e)}a(".editpdlplus_tool").on("click",z)}else{var f=b[0].axeid,h=a("#editpdlplus_axes option[value='"+f+"']");h.data("delete",0);var i=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");i.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(){s.prototype.refreshPrevisu()}),x(),w()}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)};return s.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",o,f).done(function(c,d){y(a("#editpdlplus_tool_item"),c,d).done(function(){a("#canevas").hide(),"clone"===q?(a("#typetool").val(p.typetool),a("#color").val(p.colors),a("#libelle").val(p.cartridge),a("#cartridgecolor").val(p.cartridgeColor),a("#texts").val(p.texts),a("#button").val(p.label),a("#enabled").val(p.enabled),a("#reply").val(p.reply),a("#order").val(p.orderTool),p=new g,q=null):(p=new g,a("#typetool").on("change",function(){p=new g,p.typetool=a("#typetool").val();var b=v(p.typetool);p.type=b,p.colors=b.get_color(),p.cartridgeColor=b.get_color_cartridge(),a("#color").val(p.colors),a("#cartridgecolor").val(p.cartridgeColor),w()}),a("#typetool").change()),a("#toolFormSubmit").on("click",function(){if(""===a("#button").val())a("#message_edit_tool").show(),a("#message_edit_tool").html(s.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(s.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=new g;d.initAdmin(b[c]);var e=d.getButton(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid).append(e)}a(".editpdlplus_tool").on("click",z),a("#toolworkspace").html("");var f=b[0].axeid,h=a("#editpdlplus_axes option[value='"+f+"']");h.data("delete",1);var i=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");i.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)},s});
\ No newline at end of file
define(["jquery","core/notification","core/templates","core/fragment","core/ajax","core/str","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){var o=null,p=null,q=null,r=null,s=null,t=function(a,b){o=a,this.initTypeTool(b),this.init()};t.messageDelOk="",t.messageDelKo="",t.messageko="",t.messageaddok="",t.messageaddlibelleko="",t.messageEditOk="",t.prototype.selectTool=null;var u=function(){f.get_string("admindeltool_messageok","assignfeedback_editpdfplus").done(function(a){t.messageDelOk=a}).fail(b.exception),f.get_string("admindeltool_messageko","assignfeedback_editpdfplus").done(function(a){t.messageDelKo=a}).fail(b.exception),f.get_string("adminaddtool_messageok","assignfeedback_editpdfplus").done(function(a){t.messageaddok=a}).fail(b.exception),f.get_string("admin_messageko","assignfeedback_editpdfplus").done(function(a){t.messageko=a}).fail(b.exception),f.get_string("adminedittool_messageok","assignfeedback_editpdfplus").done(function(a){t.messageEditOk=a}).fail(b.exception),f.get_string("adminaddtool_messagelibelleko","assignfeedback_editpdfplus").done(function(a){t.messageaddlibelleko=a}).fail(b.exception)};t.prototype.initTypeTool=function(a){var b=JSON.parse(a);r=[];for(var c=0;c<b.length;c++){var d=new h;d.initAdmin(b[c]),r[c]=d}},t.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").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"))}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",z),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_addtool").on("click",this.openDivAddTool),a(".btn-primary").click(),a(".btnimport").on("click",this.importAxis),u()},t.prototype.initToolUI=function(){a(this.selectTool).removeClass("btn-default"),a(this.selectTool).addClass("btn-primary")},t.prototype.refreshPrevisu=function(){p.typetool=a("#typetool").val(),p.colors=a("#color").val(),p.cartridge=a("#libelle").val(),p.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)),p.texts=a("#texts").val(),p.label=a("#button").val(),p.enabled=a("#enabled").val(),p.reply=0,a("#reply").is(":checked")&&(p.reply=1),p.orderTool=a("#order").val(),x(),w()};var v=function(a){for(var b=0;b<r.length;b++)if(r[b].id==a)return r[b]},w=function(){var b=parseInt(a("#typetool").val()),c=v(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()},x=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 i;else if(3===b)s=new j;else if(4===b){s=new k;var c=new k}else 5===b?s=new m:6===b?s=new n:7===b&&(s=new l);if(s){var d=v(b);p.type=d,p.reply=0,a("#reply").is(":checked")&&(p.reply=1),s.initAdminDemo(p),s.draw(a("#canevas")),c&&(c.initChildAdminDemo(s),c.draw(a("#canevas")))}};t.prototype.openDivAddAxis=function(){var e=a("#editpdlplus_axes").val();e&&""!==e?(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 > .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={};d.loadFragment("assignfeedback_editpdfplus","axisadd",o,f).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},t.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",o,f).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},t.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",o,g).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)}};var y=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()};t.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(t.messageaddok),a("#message_import_axis").addClass("alert-success"),a("#message_import_axis").removeClass("alert-danger"),a("#message_import_axis").removeClass("alert-warning"),a("#message_import_axis").fadeOut(5e3);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);var e=a("#editpdlplus_axes option[value='"+b[0].axeid+"']");e.data("delete",1);var f=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");if(f.addClass("disabled"),a("#editpdlplus_tool_item").html(""),b[0].toolid&&b[0].toolid>0)for(var h=0;h<b.length;h++){var i=new g;i.initAdmin(b[h]);var j=i.getButton(b[h].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid).append(j)}else{var k=b[0].axeid,e=a("#editpdlplus_axes option[value='"+k+"']");e.data("delete",0);var f=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");f.removeClass("disabled")}a(".editpdlplus_tool").on("click",z),a("#editpdlplus_axes").change(),a("a[href^='#collapseadmin1'").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 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"),a("#message_import_axis").fadeOut(5e3)}).fail(b.exception)}};var z=function(){var c=a(this).val();a(".editpdlplus_tool").each(function(){a(this).removeClass("btn-primary"),a(this).removeClass("btn-default"),a(this).css("background-image",""),a(this).css("background-color","");var b=a(this).data("enable");1===b&&a(this).val()!==c?a(this).addClass("btn-default"):a(this).val()!==c&&(a(this).css("background-image","none"),a(this).css("background-color","#CCCCCC"))}),a(this).addClass("btn-primary"),p&&p.id===c||a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html("");var f={toolid:c};d.loadFragment("assignfeedback_editpdfplus","tooledit",o,f).done(function(d,f){y(a("#editpdlplus_tool_item"),d,f).done(function(){p=new g,p.id=c,p.typetool=a("#typetool").val();var d=v(p.typetool);p.type=d;var f=a("#realcolor").val();f.length>0?p.colors=a("#color").val():(a("#color").val(d.color),p.colors=null),p.cartridge=a("#libelle").val(),a("#realcartridgecolor").val().length>0?p.cartridgeColor=a("#cartridgecolor").val():(a("#cartridgecolor").val(d.cartridge_color),p.cartridgeColor=null),p.texts=a("#texts").val(),p.label=a("#button").val(),p.enabled=a("#enabled").val(),p.reply=a("#reply").val(),p.orderTool=a("#order").val(),a("#typetool").on("change",function(){p.typetool=a("#typetool").val();var b=v(p.typetool);p.type=b,p.colors=b.get_color(),p.cartridgeColor=b.get_color_cartridge(),a("#color").val(p.colors),a("#cartridgecolor").val(p.cartridgeColor),w(),x()}),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(t.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=new g;d.initAdmin(b[c]);var e=d.getButton(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid).append(e)}a(".editpdlplus_tool").on("click",z),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(){q="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(t.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=new g;d.initAdmin(b[c]);var e=d.getButton(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid).append(e)}a(".editpdlplus_tool").on("click",z)}else{var f=b[0].axeid,h=a("#editpdlplus_axes option[value='"+f+"']");h.data("delete",0);var i=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");i.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(){t.prototype.refreshPrevisu()}),x(),w()}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)};return t.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",o,f).done(function(c,d){y(a("#editpdlplus_tool_item"),c,d).done(function(){a("#canevas").hide(),"clone"===q?(a("#typetool").val(p.typetool),a("#color").val(p.colors),a("#libelle").val(p.cartridge),a("#cartridgecolor").val(p.cartridgeColor),a("#texts").val(p.texts),a("#button").val(p.label),a("#enabled").val(p.enabled),a("#reply").val(p.reply),a("#order").val(p.orderTool),p=new g,q=null):(p=new g,a("#typetool").on("change",function(){p=new g,p.typetool=a("#typetool").val();var b=v(p.typetool);p.type=b,p.colors=b.get_color(),p.cartridgeColor=b.get_color_cartridge(),a("#color").val(p.colors),a("#cartridgecolor").val(p.cartridgeColor),w()}),a("#typetool").change()),a("#toolFormSubmit").on("click",function(){if(""===a("#button").val())a("#message_edit_tool").show(),a("#message_edit_tool").html(t.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(t.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=new g;d.initAdmin(b[c]);var e=d.getButton(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid).append(e)}a(".editpdlplus_tool").on("click",z),a("#toolworkspace").html("");var f=b[0].axeid,h=a("#editpdlplus_axes option[value='"+f+"']");h.data("delete",1);var i=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");i.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)},t});
\ No newline at end of file
......@@ -19,6 +19,20 @@
*/
/**
* @module mod_assignfeedback_editpdfplus/admin_panel
* @param {Jquery} $
* @param {core/notification} notification
* @param {core/templates} templates
* @param {core/fragment} fragment
* @param {core/ajax} ajax
* @param {core/str} str
* @param {assignfeedback_editpdfplus/tool} Tool
* @param {assignfeedback_editpdfplus/tooltype} ToolType
* @param {assignfeedback_editpdfplus/annotationhighlightplus} AnnotationHighlightplus
* @param {assignfeedback_editpdfplus/annotationstampplus} AnnotationStampplus
* @param {assignfeedback_editpdfplus/annotationframe} AnnotationFrame
* @param {assignfeedback_editpdfplus/annotationcommentplus} AnnotationCommentplus
* @param {assignfeedback_editpdfplus/annotationverticalline} AnnotationVerticalline
* @param {assignfeedback_editpdfplus/annotationstampcomment} AnnotationStampcomment
*/
define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
'core/ajax', 'core/str', 'assignfeedback_editpdfplus/tool', 'assignfeedback_editpdfplus/tooltype',
......@@ -30,14 +44,46 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
AnnotationHighlightplus, AnnotationStampplus, AnnotationFrame,
AnnotationCommentplus, AnnotationVerticalline, AnnotationStampcomment) {
/********************
* GLOBAL VARIABLES *
********************/
/**
* Context id
* @type {Integer}
*/
var contextid = null;
/**
* Current tool in process
* @type {Tool}
*/
var currentTool = null;
/**
* Current action
* @type {String}
*/
var action = null;
/**
* All type tools
* @type {Array<assignfeedback_edipdfplus\typetool>}
*/
var typetools = null;
/**
* Current annotation in process
* @type {Annotation}
*/
var annotationcurrent = null;
/****************
* CONSTRUCTOR *
****************/
/**
* AdminPanel class.
*
* @class AdminPanel
* @param {Integer} contextidP
* @param {String} typetoolsP
*/
var AdminPanel = function (contextidP, typetoolsP) {
//this.registerEventListeners();
......@@ -45,18 +91,75 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
this.initTypeTool(typetoolsP);
this.init();
};
var annotationcurrent = null;
/**************
* Parameters *
**************/
//messages
/**
* Message ok in delete case
*/
AdminPanel.messageDelOk = "";
/**
* Message ko in delete case
*/
AdminPanel.messageDelKo = "";
/**
* Message ko in all case
*/
AdminPanel.messageko = "";
/**
* Message ok in add case
*/
AdminPanel.messageaddok = "";
/**
* Message ko in add case
*/
AdminPanel.messageaddlibelleko = "";
/**
* Message ok in edit case
*/
AdminPanel.messageEditOk = "";
//
//AdminPanel.prototype.contextid;
//
/**
* Current select button
* @type {Jquery node}
*/
AdminPanel.prototype.selectTool = null;
/*************
* FUNCTIONS *
*************/
/**
* Initalisation of all messages with ajax
*/
var initMessages = function () {
str.get_string('admindeltool_messageok', 'assignfeedback_editpdfplus').done(function (message) {
AdminPanel.messageDelOk = message;
}).fail(notification.exception);
str.get_string('admindeltool_messageko', 'assignfeedback_editpdfplus').done(function (message) {
AdminPanel.messageDelKo = message;
}).fail(notification.exception);
str.get_string('adminaddtool_messageok', 'assignfeedback_editpdfplus').done(function (message) {
AdminPanel.messageaddok = message;
}).fail(notification.exception);
str.get_string('admin_messageko', 'assignfeedback_editpdfplus').done(function (message) {
AdminPanel.messageko = message;
}).fail(notification.exception);
str.get_string('adminedittool_messageok', 'assignfeedback_editpdfplus').done(function (message) {
AdminPanel.messageEditOk = message;
}).fail(notification.exception);
str.get_string('adminaddtool_messagelibelleko', 'assignfeedback_editpdfplus').done(function (message) {
AdminPanel.messageaddlibelleko = message;
}).fail(notification.exception);
};
/**
* Set typetool list from json request
* @param {object} typeToolsP
*/
AdminPanel.prototype.initTypeTool = function (typeToolsP) {
var typetoolsTmp = JSON.parse(typeToolsP);
typetools = [];
......@@ -66,7 +169,10 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
typetools[i] = typeToolTmp;
}
};
//
/**
* Init IHM
*/
AdminPanel.prototype.init = function () {
$("#editpdlplus_axes").on("change", function () {
$(".toolbar").hide();
......@@ -91,7 +197,7 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
$('#toolworkspace').html("");
});
$("#editpdlplus_axes").change();
//
$(".editpdlplus_tool").on("click", refreshToolView);
this.selectTool = $(".editpdlplus_tool").first();
this.initToolUI();
......@@ -106,38 +212,18 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
initMessages();
};
//init message
var initMessages = function () {
str.get_string('admindeltool_messageok', 'assignfeedback_editpdfplus').done(function (message) {
AdminPanel.messageDelOk = message;
}).fail(notification.exception);
str.get_string('admindeltool_messageko', 'assignfeedback_editpdfplus').done(function (message) {
AdminPanel.messageDelKo = message;
}).fail(notification.exception);
str.get_string('adminaddtool_messageok', 'assignfeedback_editpdfplus').done(function (message) {
AdminPanel.messageaddok = message;
}).fail(notification.exception);
str.get_string('admin_messageko', 'assignfeedback_editpdfplus').done(function (message) {
AdminPanel.messageko = message;
}).fail(notification.exception);
str.get_string('adminedittool_messageok', 'assignfeedback_editpdfplus').done(function (message) {
AdminPanel.messageEditOk = message;
}).fail(notification.exception);
str.get_string('adminaddtool_messagelibelleko', 'assignfeedback_editpdfplus').done(function (message) {
AdminPanel.messageaddlibelleko = message;
}).fail(notification.exception);
};
//
AdminPanel.prototype.test = function () {
alert("test");
refreshToolView();
};
//
/**
* Init too UI for select element
*/
AdminPanel.prototype.initToolUI = function () {
$(this.selectTool).removeClass("btn-default");
$(this.selectTool).addClass("btn-primary");
};
//
/**
* Init tool form and preview
*/
AdminPanel.prototype.refreshPrevisu = function () {
currentTool.typetool = $("#typetool").val();
currentTool.colors = $("#color").val();
......@@ -163,7 +249,12 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
initCanevas();
initToolDisplay();
};
//
/**
* Get type tool object from an id
* @param {Integer} toolid
* @return {Typetool}
*/
var getTypeTool = function (toolid) {
for (var i = 0; i < typetools.length; i++) {
if (typetools[i].id == toolid) {
......@@ -171,6 +262,10 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
}
}
};
/**
* Init tool form display with custom configurable parameters
*/
var initToolDisplay = function () {
var typetool = parseInt($("#typetool").val());
var typetoolEntity = getTypeTool(typetool);
......@@ -230,7 +325,10 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
$("#collapse4").parent().show();
}
};
//
/**
* Init tool preview
*/
var initCanevas = function () {
$('#canevas').html("");
annotationcurrent = null;
......@@ -271,7 +369,10 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
}
}
};
//
/**
* Load content for adding an axis
*/
AdminPanel.prototype.openDivAddAxis = function () {
var selectAxis = $("#editpdlplus_axes").val();
if (selectAxis && selectAxis !== "") {
......@@ -293,7 +394,10 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
html, js);
}.bind(this)).fail(notification.exception);
};
//
/**
* Load content for editing an axis
*/
AdminPanel.prototype.openDivEditAxis = function () {
$("#message_edit_tool").hide();
$("#axistool").hide();
......@@ -302,15 +406,6 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
$('#assignfeedback_editpdfplus_widget_admin_toolheader').hide();
$('#assignfeedback_editpdfplus_widget_admin_toolworkspace').hide();
$("#editpdlplus_axes").prop('disabled', 'disabled');
/*var context = {name: 'Tweety bird', intelligence: 2};
templates.render('assignfeedback_editpdfplus/admin_axis_add', context)
// It returns a promise that needs to be resoved.
.then(function (html, js) {
// Here eventually I have my compiled template, and any javascript that it generated.
// The templates object has append, prepend and replace functions.
templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body',
html, js);
}).fail(notification.exception);*/
var axeid = $("#editpdlplus_axes option:selected").val();
var params = {axeid: axeid};
fragment.loadFragment('assignfeedback_editpdfplus', 'axisedit', contextid, params)
......@@ -319,7 +414,10 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
html, js);
}.bind(this)).fail(notification.exception);
};
//
/**
* Load content for deleting an axis
*/
AdminPanel.prototype.openDivDelAxis = function () {
var canBeDelete = $("#editpdlplus_axes option:selected").data('delete');
if (canBeDelete !== null && parseInt(canBeDelete) === 0) {
......@@ -339,11 +437,12 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
}.bind(this)).fail(notification.exception);
}
};
/**
* Fade the dom node out, update it, and fade it back.
*
* @private
* @method _hello
* @method fillResultAjax
* @param {JQuery} node
* @param {String} html
* @param {String} js
......@@ -358,9 +457,11 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
});
});
return promise.promise();
//return true;
};
//
/**
* Import an axis to the current's user's toolbar
*/
AdminPanel.prototype.importAxis = function () {
var axisimportid = $(this).data('axis');
if (axisimportid && parseInt(axisimportid) > 0) {
......@@ -381,7 +482,7 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
$("#message_import_axis").removeClass("alert-danger");
$("#message_import_axis").removeClass("alert-warning");
$("#message_import_axis").fadeOut(5000);
//maj axe
//maj axis
var divAxis = "<div id='editpdlplus_toolbar_"
+ toolbar[0].axeid
+ "' class='btn-group toolbar' style='display: none;'></div>";
......@@ -426,7 +527,10 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
}).fail(notification.exception);
}
};
//
/**
* Refresh tool view, preview and form for editing
*/
var refreshToolView = function () {
var selectid = $(this).val();
$(".editpdlplus_tool").each(function () {
......@@ -449,7 +553,6 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
//load proprieties
$('#editpdlplus_tool_item').html("");
var params = {toolid: selectid};
//this.test();
fragment.loadFragment('assignfeedback_editpdfplus', 'tooledit', contextid, params)
.done(function (html, js) {
fillResultAjax($('#editpdlplus_tool_item'), html, js)
......@@ -516,7 +619,6 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
$("#message_edit_tool").removeClass("alert-warning");
//mise à jour bar d'outils
$("#editpdlplus_toolbar_" + toolbar[0].axeid).html("");
//var newtool = null;
for (var i = 0; i < toolbar.length; i++) {
var toolTmp = new Tool();
toolTmp.initAdmin(toolbar[i]);
......@@ -524,9 +626,7 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
$("#editpdlplus_toolbar_" + toolbar[0].axeid).append(buttonTmp);
}
$(".editpdlplus_tool").on("click", refreshToolView);
//AdminPanel.prototype.refreshPrevisu();
$("#editpdlplus_tool_" + toolbar[0].selecttool).click();
//refreshToolView();
} else {
$("#message_edit_tool").show();
$("#message_edit_tool").html(toolbar[0].message);
......@@ -604,12 +704,12 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
//maj tool worspkace
initToolDisplay();
}.bind(this)).fail(notification.exception);
//templates.appendNodeContents('#editpdlplus_tool_item', html, js).done(function () {
//$(".editpdlplus_tool").on("click", this.refreshToolView);
//}.bind(this))/*.fail(notification.exception)*/;
}.bind(this)).fail(notification.exception);
};
//
/**
* Load content for adding a tool
*/
AdminPanel.prototype.openDivAddTool = function () {
$("#message_edit_tool").hide();
$('#editpdlplus_tool_item').html("");
......@@ -709,5 +809,6 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
}.bind(this)).fail(notification.exception);
}.bind(this)).fail(notification.exception);
};
return AdminPanel;
});
\ No newline at end of file
......@@ -19,9 +19,16 @@
*/
/**
* @module mod_assignfeedback_editpdfplus/annotation
* @param {Jquery} $
* @param {Global} global constantes
*/
define(['jquery', './global'],
function ($, global) {
/********************************
* CONSTRUCTOR and SUPER-CLASS *
********************************/
// I am the internal, static counter for the number of models
// that have been created in the system. This is used to
// power the unique identifier of each instance.
......@@ -54,8 +61,11 @@ define(['jquery', './global'],
Annotation.prototype.getInstanceID = function () {
return(this._instanceID);
};
/*var Annotation = function () {
};*/
/**************
* Parameters *
**************/
/**
* X position
* @property x
......@@ -133,7 +143,22 @@ define(['jquery', './global'],
* @public
*/
Annotation.cartridgey = 0;
/**
* mode readonly demo or not
* @property adminDemo
* @type Boolean
* @public
*/
Annotation.adminDemo = 0;
/*************
* FUNCTIONS *
*************/
/**
* Initialize tooltype object from an object from database with its base's id
* @param {object} config
*/
Annotation.prototype.init = function (config) {