Gitlab CSE Unil

Commit 450e2abe authored by M. Chardon's avatar M. Chardon
Browse files

merge commit

parents af994601 02fdea37
......@@ -49,7 +49,7 @@ See this <a href="https://gitlabriset.unil.ch/Marion.Chardon/editpdfplus/wikis/c
An administrator profile will be able to give to a course the right to use this plugin or not.
1. Go to the course (or course category) permissions settings
2. Look for the ***mod/assignfeedback_editpdfplus:use*** capability
2. Look for the ***assignfeedback/editpdfplus:use*** capability
3. Add the manager, teacher and student roles to it
The 'Annotate PDF advanced' plugin will then be used in place of the standard 'Annotate PDF' plugin in the corresponding course (or course category), or wherever you give users this capability.
......
......@@ -167,7 +167,7 @@ if ($action === 'pollconversions') {
}
if ($refresh) {
$teachers = get_users_by_capability($context, 'mod/assignfeedback_editpdfplus:notify');
$teachers = get_users_by_capability($context, 'assignfeedback/editpdfplus:notify');
$contextb = $assignment->get_context();
$course = $assignment->get_course();
$coursemodule = $assignment->get_course_module();
......
define(["jquery","core/notification","core/templates","core/fragment"],function(a,b,c,d){var e=null,f=function(a){this.init(),e=a};return f.prototype.selectTool=null,f.prototype.init=function(){var b=a("#editpdlplus_axes").val();a("#editpdlplus_toolbar_"+b).show(),a("#editpdlplus_axes").on("change",function(){a(".toolbar").hide();var b=a("#editpdlplus_axes").val();a("#editpdlplus_toolbar_"+b).show()}),a(".editpdlplus_tool").on("click",function(){var b=a(this).val();a(".editpdlplus_tool").each(function(){a(this).removeClass("btn-primary"),a(this).removeClass("btn-default");var c=a(this).data("enable");1===c&&a(this).val()!==b&&a(this).addClass("btn-default")}),a(this).addClass("btn-primary")}),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)},f.prototype.initTool=function(){a(this.selectTool).removeClass("btn-default"),a(this.selectTool).addClass("btn-primary")},f.prototype.openDivAddAxis=function(){a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body").html("");var f={};d.loadFragment("assignfeedback_editpdfplus","axisadd",e,f).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},f.prototype.openDivEditAxis=function(){a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_editaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body").html("");var f=a("#editpdlplus_axes option:selected").val(),g={axeid:f};d.loadFragment("assignfeedback_editpdfplus","axisedit",e,g).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},f});
\ 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=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();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",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(){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled","disabled");var e={};d.loadFragment("assignfeedback_editpdfplus","axisadd",o,e).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()}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.color,p.cartridgeColor=b.cartridge_color,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.typetool=a("#typetool").val();var b=v(p.typetool);p.type=b,p.colors=b.color,p.cartridgeColor=b.cartridge_color,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","./global"],function(a,b){function c(){return this._instanceID=e(),this}var d=0,e=function(){return++d};return c.getInstanceCount=function(){return d},c.prototype.getInstanceID=function(){return this._instanceID},c.x=0,c.y=0,c.endx=0,c.endy=0,c.path="",c.toolid=0,c.colour="red",c.tooltype=null,c.id=0,c.cartridgex=0,c.cartridgey=0,c.adminDemo=0,c.prototype.init=function(a){this.cartridgex=parseInt(a.cartridgex,10)||0,this.cartridgey=parseInt(a.cartridgey,10)||0,this.colour=a.colour||"red",this.tooltype=a.tooltype,this.id=a.id,this.x=parseInt(a.x,10)||0,this.y=parseInt(a.y,10)||0,this.endx=parseInt(a.endx,10)||0,this.endy=parseInt(a.endy,10)||0,this.path=a.path||"",this.toolid=a.toolid},c.prototype.initAdminDemo=function(a){this.id="previsu_annot",this.displaylock=1,this.adminDemo=1,this.tooltype=a,this.colour=a.get_color()},c.prototype.draw=function(){},c.prototype.get_color=function(){var a=b.ANNOTATIONCOLOUR[this.colour];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.colour,a},c.prototype.get_color_cartridge=function(){var a=b.ANNOTATIONCOLOUR[this.tooltype.get_color_cartridge()];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.tooltype.get_color_cartridge(),a},c.prototype.init_div_cartridge_id=function(){var a=(new Date).toJSON().replace(/:/g,"").replace(/\./g,"");this.tooltype.id?this.divcartridge="ct_"+this.tooltype.id+"_"+a:this.divcartridge="ct_"+this.id+"_"+a},c.prototype.get_div_cartridge=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"' ",d+="class='assignfeedback_editpdfplus_cartridge' ",d+="style='border-color: "+b+";position:relative;'> ",d+="</div>",c&&c.append(d);var e=a("#"+this.divcartridge);return this.adminDemo<1,e},c.prototype.get_div_cartridge_label=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"_cartridge' ",d+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_cartridge' ",d+="style='border-right-color: "+b+";color:"+b+";' ",d+="> ",d+=this.tooltype.cartridge,d+="</div>",c&&c.append(d);var e=a("#"+this.divcartridge+"_cartridge");return e},c.prototype.get_div_input=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"_display' ",d+="style='color:"+b+"; ",d+="'></div>",c.append(d);var e=a("#"+this.divcartridge+"_display");return e.on("click",{annotation:this},this.edit_annot),e},c.prototype.get_div_edition=function(b){var c="<div ";c+="id='"+this.divcartridge+"_edit' ",c+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_edition' ",c+="style='display:none;'> ",c+="<textarea id='"+this.divcartridge+"_editinput' type='text' class='form-control' style='margin-bottom:5px;'",1===this.adminDemo&&(c+=" readonly"),c+="></textarea>",c+="</div>",b&&b.append(c);var d=a("#"+this.divcartridge+"_edit"),e=this.tooltype.texts;if(e&&e.length>0){var f="<div id='"+this.divcartridge+"_edit_propositions'></div>";d.append(f);for(var g=a("#"+this.divcartridge+"_edit_propositions"),h=e.split('","'),i=0;i<h.length;i++){var j="<button class='btn btn-default";1===this.adminDemo&&(j+=" disabled"),j+="' type='button' style='width:100%;font-size: x-small;'>"+h[i].replace(/"/g,"")+"</button>",g.append(j),this.adminDemo<1,g.append("<br/>")}}return d},c.prototype.get_div_container=function(b,c){var d="<div ";d+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_conteneur' >",d+="</div>",c&&c.append(d);var e=a(".assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_conteneur"),f=this.get_div_input(b,e);f.addClass("assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_input");var g=1;(this.displaylock||this.displaylock>=0)&&(g=this.displaylock);var h="<input type='hidden' id='"+this.divcartridge+"_onof' value="+g+" />";return c&&e.append(h),e.append(this.get_input_question()),this.get_button_visibility_left(e),this.get_button_visibility_right(e),this.get_button_save(e),this.get_button_cancel(e),1===this.tooltype.reply&&this.get_button_question(e),this.get_button_remove(e),e},c.prototype.get_input_question=function(){var a=0;return this.answerrequested&&1===this.answerrequested&&(a=1),"<input type='hidden' id='"+this.divcartridge+"_question' value='"+a+"'/>"},c.prototype.get_button_visibility_right=function(b){var c="<button id='"+this.divcartridge+"_buttonedit_right' class='btn btn-default";1===this.adminDemo&&(c+=" disabled"),c+="' type='button'>",c+="<i class='fa fa-arrow-right' aria-hidden='true'></i>",c+="</button>",b&&b.append(c);var d=a("#"+this.divcartridge+"_buttonedit_right");return this.adminDemo<1,d},c.prototype.get_button_visibility_left=function(b){var c="<button id='"+this.divcartridge+"_buttonedit_left' class='btn btn-default";1===this.adminDemo&&(c+=" disabled"),c+="' type='button'>",c+="<i class='fa fa-arrow-left' aria-hidden='true'></i>",c+="</button>",b&&b.append(c);var d=a("#"+this.divcartridge+"_buttonedit_left");return this.adminDemo<1,d},c.prototype.get_button_save=function(b){var c="<button id='"+this.divcartridge+"_buttonsave' style='display:none;margin-left:110px;' class='btn btn-default";1===this.adminDemo&&(c+=" disabled"),c+="' type='button'><i class='fa fa-check' aria-hidden='true'></i></button>",b&&b.append(c);var d=a("#"+this.divcartridge+"_buttonsave");return this.adminDemo<1&&d.on("click",this.save_annot),d},c.prototype.get_button_cancel=function(b){var c="<button id='"+this.divcartridge+"_buttoncancel' style='display:none;' class='btn btn-default";1===this.adminDemo&&(c+=" disabled"),c+="' type='button'><i class='fa fa-undo' aria-hidden='true'></i></button>",b&&b.append(c);var d=a("#"+this.divcartridge+"_buttoncancel");return this.adminDemo<1,d},c.prototype.get_button_question=function(b){var c="<button id='"+this.divcartridge+"_buttonquestion' style='display:none;margin-left:10px;' class='btn btn-default";1===this.adminDemo&&(c+=" disabled"),c+='\' type=\'button\'><span class="fa-stack fa-lg" style="line-height: 1em;width: 1em;"><i class="fa fa-question-circle-o fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x text-danger"></i></span></button>',b&&b.append(c);var d=a("#"+this.divcartridge+"_buttonquestion");return this.adminDemo<1,d},c.prototype.get_button_remove=function(b){var c="<button id='"+this.divcartridge+"_buttonremove' style='display:none;margin-left:10px;' class='btn btn-default";1===this.adminDemo&&(c+=" disabled"),c+="' type='button'><i class='fa fa-trash' aria-hidden='true'></i></button>",b&&b.append(c);var d=a("#"+this.divcartridge+"_buttonremove");return this.adminDemo<1,d},c.prototype.apply_visibility_annot=function(){var b=a("#"+this.divcartridge+"_display"),c=a("#"+this.divcartridge+"_onof"),d=a("#"+this.divcartridge+"_buttonedit_right"),e=a("#"+this.divcartridge+"_buttonedit_left"),f=a("#"+this.divcartridge+"_radioContainer");c&&("1"===c.val()?(d&&d.show(),e&&e.show()):"0"===c.val()?(d&&d.show(),e&&e.hide()):(d&&d.hide(),e&&e.show())),b&&b.html(this.get_text_to_diplay_in_cartridge()),"frame"===this.tooltype.getToolTypeLabel()&&d&&(d.hide(),e.hide()),f&&f.hide(),this.apply_question_status()},c.prototype.get_text_to_diplay_in_cartridge=function(){var b=this.get_valref(),c=a("#"+this.divcartridge+"_onof"),d="";return""===b&&(d="&nbsp;&nbsp;&nbsp;&nbsp"),"1"===c.val()&&""!==b?d=b.substr(0,20):"0"===c.val()&&""!==b?d="...":""!==b&&(d=b),1===this.answerrequested&&(d+='&nbsp;<span style="color:red;">[?]</span>'),d},c.prototype.apply_question_status=function(){var b=a("#"+this.divcartridge+"_buttonquestion"),c=a("#"+this.divcartridge+"_question"),d=0;c&&(d=parseInt(c.val(),10)),b&&(1===d?b.html('<i class="fa fa-question-circle-o"></i>'):b.html('<span class="fa-stack fa-lg" style="line-height: 1em;width: 1em;"><i class="fa fa-question-circle-o fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x text-danger"></i></span>'))},c.prototype.draw_catridge=function(){return!0},c.prototype.edit_annot=function(c){if(c.data.annotation.tooltype.typetool<=b.TOOLTYPE.COMMENTPLUS){var d=c.data.annotation,e=a("#"+d.divcartridge),f=a("#"+d.divcartridge+"_display"),g=a("#"+d.divcartridge+"_edit"),h=a("#"+d.divcartridge+"_buttonedit_right"),i=a("#"+d.divcartridge+"_buttonedit_left"),j=a("#"+d.divcartridge+"_buttonsave"),k=a("#"+d.divcartridge+"_buttoncancel"),l=a("#"+d.divcartridge+"_buttonquestion"),m=a("#"+d.divcartridge+"_buttonrotation"),n=a("#"+d.divcartridge+"_buttonremove"),o=a("#"+d.divcartridge+"_editinput");f.hide(),h&&h.hide(),i&&i.hide(),m&&m.hide(),g.show(),j.show(),k.show(),l&&l.show(),n.show(),e.css("z-index",1e3),o&&o.attr("focus","on"),c.data.annotation.disabled_canvas_event(),a("#canevas").on("click",{annotation:d,action:"clickoutside"},d.save_annot_clickout)}},c.prototype.fill_input_edition=function(b,c){var d=a("#"+this.divcartridge+"_editinput");d&&d.set("value",c),this.save_annot(c)},c.prototype.save_annot_clickout=function(a){"canevas"===a.target.id&&1===a.data.annotation.adminDemo&&a.data.annotation.cancel_edit()},c.prototype.save_annot=function(b){if("string"!=typeof b){var c=a("#"+this.divcartridge+"_editinput");c&&(b=c.val())}this.textannot=b,0===b.length&&(b="&nbsp;&nbsp;"),this.hide_edit(),this.apply_visibility_annot()},c.prototype.cancel_edit=function(){var b=this.get_valref(),c=a("#"+this.divcartridge+"_editinput");b&&c&&c.set("value",b),this.hide_edit(),this.apply_visibility_annot();var d=a("#"+this.divcartridge);d&&d.off()},c.prototype.hide_edit=function(b,c){if(!c||"clickoutside"!==c||this.editor.currentannotation!==this){var d=a("#"+this.divcartridge),e=a("#"+this.divcartridge+"_display"),f=a("#"+this.divcartridge+"_edit"),g=a("#"+this.divcartridge+"_visu"),h=a("#"+this.divcartridge+"_buttonsave"),i=a("#"+this.divcartridge+"_buttoncancel"),j=a("#"+this.divcartridge+"_buttonquestion"),k=a("#"+this.divcartridge+"_buttonrotation"),l=a("#"+this.divcartridge+"_buttonremove"),m=a("#"+this.divcartridge+"_radioContainer");e&&(e.show(),e.css("color",this.get_color_cartridge())),k&&k.show(),f&&(f.hide(),h.hide(),i.hide()),g&&g.hide(),j&&j.hide(),l&&l.hide(),d&&(d.css("z-index",1),a("#canevas").off()),f&&this.enabled_canvas_event(),m&&m.hide()}},c.prototype.disabled_canvas_event=function(){var c=a(b.SELECTOR.DRAWINGCANVAS);c.off("click")},c.prototype.enabled_canvas_event=function(){},c.prototype.change_visibility_annot=function(b){var c=a("#"+this.divcartridge+"_onof"),d=parseInt(c.val(),10);"r"===b?d+=1:d-=1,c.val(d),this.displaylock=d,this.apply_visibility_annot()},c.prototype.get_valref=function(){return this.textannot&&this.textannot.length>0&&"string"==typeof this.textannot?this.textannot:""},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=30,this.y=90},c.prototype.draw=function(b){if(b){var c="<div id='"+this.id+"'><i class='fa fa-commenting' aria-hidden='true' style='color:black;'></i></div>";b.append(c),a("#"+this.id).css("color",this.get_color()),a("#"+this.id).css("width",this.endx-this.x),a("#"+this.id).css("height",this.endy-this.y),a("#"+this.id).css("padding","0 2px"),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y)}this.draw_catridge(b)},c.prototype.draw_catridge=function(a){var b;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var c=this.get_color_cartridge();b=this.get_div_cartridge(c,a),b.addClass("assignfeedback_editpdfplus_commentplus"),this.get_div_cartridge_label(c,b);var d=this.get_div_container(c,b);this.get_div_edition(d),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),b.css("left",this.x+20),b.css("top",this.y-20),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=279,this.y=113,this.endx=435,this.endy=129,this.parent_annot=0,this.colour="#FF0000"},c.prototype.initChildAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a.tooltype),this.x=144,this.y=192,this.endx=296,this.endy=208,this.parent_annot=a.id,this.id="previsu_annot_child",this.colour="#FF0000"},c.prototype.draw=function(b){if(b){var c="<div id='"+this.id+"'></div>";b.append(c),a("#"+this.id).css("width",this.endx-this.x),a("#"+this.id).css("height",this.endy-this.y),a("#"+this.id).css("border","solid 2px red"),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y),a("#"+this.id).css("box-sizing","inherit")}return this.draw_catridge(b),this},c.prototype.draw_catridge=function(b){if(!this.parent_annot_element&&0===this.parent_annot){var c;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var d=a("#"+this.id);d&&d.addClass("class_"+this.divcartridge);var e=this.get_color();c=this.get_div_cartridge(e,b),c.addClass("assignfeedback_editpdfplus_frame"),this.get_div_cartridge_label(e,c,!0);var f=this.get_div_container(e,c),g="<button id='"+this.divcartridge+"_buttonpencil' class='btn btn-default";this.adminDemo&&(g+=" disabled"),g+="' type='button'>",g+='<i class="fa fa-eyedropper" aria-hidden="true"></i>',g+="</button>";var h="<button id='"+this.divcartridge+"_buttonadd' class='btn btn-default";this.adminDemo&&(h+=" disabled"),h+="' type='button'>",h+='<i class="fa fa-plus" aria-hidden="true"></i>',h+="</button>",f.append(g),f.append(h),this.get_div_edition(f),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),c.css("left",this.cartridgex+15),c.css("top",this.y+this.cartridgey-12),this.apply_visibility_annot()}}return!0},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=83,this.y=84,this.endx=239,this.endy=100},c.prototype.draw=function(b){if(b){var c="<div id='"+this.id+"'></div>";b.append(c),a("#"+this.id).css("background-color",this.get_color()),a("#"+this.id).css("width",this.endx-this.x),a("#"+this.id).css("height",this.endy-this.y),a("#"+this.id).css("opacity",.5),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y)}this.draw_catridge(b)},c.prototype.draw_catridge=function(a){var b;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var c=this.get_color_cartridge();b=this.get_div_cartridge(c,a),b.addClass("assignfeedback_editpdfplus_hightlightplus"),this.get_div_cartridge_label(c,b);var d=this.get_div_container(c,b);this.get_div_edition(d),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),b.css("left",this.x+this.cartridgex),b.css("top",this.y+this.cartridgey-15),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=188,this.y=118,this.displayrotation=1},c.prototype.draw=function(b){if(b){this.shape_id="ct_stampcomment_"+(new Date).toJSON().replace(/:/g,"").replace(/\./g,"");var c='<i id="'+this.shape_id+'_img" class="fa fa-arrows-h fa-2x" aria-hidden="true"></i>';this.displayrotation>0&&(c='<i id="'+this.shape_id+'_img" class="fa fa-arrows-v fa-2x" aria-hidden="true"></i>');var d="<div id='"+this.id+"'>"+c+"</div>";b.append(d),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y)}this.draw_catridge(b)},c.prototype.draw_catridge=function(a){var b;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var c=this.get_color_cartridge();b=this.get_div_cartridge(c,a),b.addClass("assignfeedback_editpdfplus_stampcomment"),this.get_div_cartridge_label(c,b);var d=this.get_div_container(c,b),e=0;this.displayrotation>0&&(e=1);var f="<input type='hidden' id='"+this.divcartridge+"_rotation' value="+e+" />";d.append(f);var g="<button id='"+this.divcartridge+"_buttonrotation' class='btn btn-default";this.adminDemo&&(g+=" disabled"),g+='\' type=\'button\'><i class="fa fa-refresh" aria-hidden="true"></i></button>',d.append(g),this.get_div_edition(d),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),b.css("left",this.x+this.cartridgex),b.css("top",this.y+this.cartridgey-30),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a,c){b.prototype.initAdminDemo.call(this,a,c),this.x=60,this.y=100},c.prototype.draw=function(b){if(b){var c="<div id='"+this.id+"'></div>";b.append(c),a("#"+this.id).css("position","relative"),a("#"+this.id).css("top",this.y),a("#"+this.id).css("left",this.x),a("#"+this.id).css("color",this.colour),a("#"+this.id).css("border","2px solid "+this.colour),a("#"+this.id).css("padding","0 2px"),a("#"+this.id).css("display","inline-block"),a("#"+this.id).append(this.tooltype.label)}return this},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=285,this.y=65,this.endy=175},c.prototype.draw=function(b){if(b){var c="<div id='"+this.id+"'></div>";b.append(c),a("#"+this.id).css("background-color",this.get_color()),a("#"+this.id).css("width",3),this.endy-this.y<=30&&(this.endy=this.y+30),a("#"+this.id).css("height",this.endy-this.y),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y)}this.draw_catridge(b)},c.prototype.draw_catridge=function(a){var b;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var c=this.get_color_cartridge();b=this.get_div_cartridge(c,a),b.addClass("assignfeedback_editpdfplus_verticalline"),this.get_div_cartridge_label(c,b);var d=this.get_div_container(c,b);this.get_div_edition(d),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),b.css("left",this.x+this.cartridgex),b.css("top",this.y+this.cartridgey-109),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
define([],function(){function a(){return this}return a.ANNOTATIONCOLOUR={white:"rgb(255,255,255)",yellowlemon:"rgb(255,255,0)",yellow:"rgb(255,207,53)",red:"rgb(239,69,64)",green:"rgb(152,202,62)",blue:"rgb(0,0,255)",black:"rgb(51,51,51)"},a.TOOLTYPE={HIGHLIGHTPLUS:1,LINEPLUS:2,STAMPPLUS:3,FRAME:4,VERTICALLINE:5,STAMPCOMMENT:6,COMMENTPLUS:7,PEN:8,LINE:9,RECTANGLE:10,OVAL:11,HIGHLIGHT:12},a.SELECTOR={DRAWINGCANVAS:".drawingcanvas"},a.CSS={DIALOGUE:"assignfeedback_editpdfplus_widget"},a});
\ No newline at end of file
define(["jquery","./global"],function(a,b){function c(){return this._instanceID=e(),this}var d=0,e=function(){return++d};return c.getInstanceCount=function(){return d},c.prototype.getInstanceID=function(){return this._instanceID},c.id=-1,c.axis=-1,c.typetool=-1,c.type=null,c.colors="",c.cartridge="",c.cartridgeColor="",c.texts="",c.label="",c.reply=!0,c.enabled=!0,c.orderTool=1e3,c.prototype.init=function(a){this.id=parseInt(a.id,10)||0,this.axis=parseInt(a.axis,10)||0,this.type=a.type,this.colors=a.colors,this.cartridge=a.cartridge,this.cartridgeColor=a.cartridgeColor,this.texts=a.texts,this.label=a.label,this.reply=a.reply,this.enabled=a.enabled,this.orderTool=a.orderTool},c.prototype.initAdmin=function(a){this.id=parseInt(a.toolid,10)||0,this.typetool=a.typetool,this.label=a.button,this.enabled=a.enable,this.orderTool=a.orderTool},c.prototype.getToolTypeLabel=function(){return this.type.label},c.prototype.getToolTypeCartX=function(){return this.type.cartridgeX},c.prototype.getToolTypeCartY=function(){return this.type.cartridgeY},c.prototype.get_color=function(){var a=b.ANNOTATIONCOLOUR[this.colors];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.colors,a&&""!==a?a:this.type.get_color()},c.prototype.get_color_cartridge=function(){var a=b.ANNOTATIONCOLOUR[this.cartridgeColor];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.cartridgeColor,a&&""!==a?a:this.type.get_color_cartridge()},c.prototype.getButton=function(a){var b="btn-default",c="";1!==this.enabled&&(b="",c="background-image:none;background-color:#CCCCCC;"),this.id===a&&(b="btn-primary"),4!==this.typetool&&1!==this.typetool||(c+="text-decoration: underline;");var d=this.label;4!==this.typetool&&5!==this.typetool||(d="| "+d,4===this.typetool&&(d+=" |"));var e="<button class='btn "+b+" editpdlplus_tool' id='editpdlplus_tool_"+this.id+"' style='"+c+"' value='"+this.id+"' data-enable='"+this.enabled+"'>"+d+"</button>";return e},c});
\ No newline at end of file
define(["jquery","./global"],function(a,b){function c(){return this._instanceID=e(),this}var d=0,e=function(){return++d};return c.getInstanceCount=function(){return d},c.prototype.getInstanceID=function(){return this._instanceID},c.id=-1,c.label="",c.color="",c.cartridgeColor="",c.cartridgeX=0,c.cartridgeY=0,c.configurableCartridge=1,c.configurableCartridgeColor=1,c.configurableColor=1,c.configurableTexts=1,c.configurableQuestion=1,c.prototype.init=function(a){this.id=parseInt(a.id,10)||0},c.prototype.initAdmin=function(a){this.id=parseInt(a.id,10)||0,this.label=a.label,this.color=a.color,this.cartridgeColor=a.cartridge_color,this.cartridgeX=a.cartridge_x,this.cartridgeY=a.cartridge_y,this.configurableCartridge=a.configurable_cartridge,this.configurableCartridgeColor=a.configurable_cartridge_color,this.configurableColor=a.configurable_color,this.configurableTexts=a.configurable_texts,this.configurableQuestion=a.configurable_question},c.prototype.get_color=function(){var a=b.ANNOTATIONCOLOUR[this.color];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.color,a},c.prototype.get_color_cartridge=function(){var a=b.ANNOTATIONCOLOUR[this.cartridgeColor];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.cartridgeColor,a},c});
\ No newline at end of file
......@@ -20,64 +20,261 @@
/**
* @module mod_assignfeedback_editpdfplus/admin_panel
*/
define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/fragment'/*,
'core/ajax', 'core/str', 'mod_assign/grading_form_change_checker'*/],
function ($/*, Y*/, notification, templates, fragment/*, ajax, str, checker*/) {
define(['jquery'/*, 'core/yui'*/, '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 ($/*, Y*/, notification, templates, fragment, ajax, str, Tool, ToolType,
AnnotationHighlightplus, AnnotationStampplus, AnnotationFrame,
AnnotationCommentplus, AnnotationVerticalline, AnnotationStampcomment /*, checker*/) {
var contextid = null;
var currentTool = null;
var action = null;
var typetools = null;
/**
* AdminPanel class.
*
* @class AdminPanel
*/
var AdminPanel = function (contextidP) {
var AdminPanel = function (contextidP, typetoolsP) {
//this.registerEventListeners();
this.init();
contextid = contextidP;
this.initTypeTool(typetoolsP);
this.init();
};
var annotationcurrent = null;
//messages
AdminPanel.messageDelOk = "";
AdminPanel.messageDelKo = "";
AdminPanel.messageko = "";
AdminPanel.messageaddok = "";
AdminPanel.messageaddlibelleko = "";
AdminPanel.messageEditOk = "";
//
//AdminPanel.prototype.contextid;
//
AdminPanel.prototype.selectTool = null;
AdminPanel.prototype.initTypeTool = function (typeToolsP) {
var typetoolsTmp = JSON.parse(typeToolsP);
typetools = [];
for (var i = 0; i < typetoolsTmp.length; i++) {
var typeToolTmp = new ToolType();
typeToolTmp.initAdmin(typetoolsTmp[i]);
typetools[i] = typeToolTmp;
}
};
//
AdminPanel.prototype.init = function () {
var selectAxis = $("#editpdlplus_axes").val();
$("#editpdlplus_toolbar_" + selectAxis).show();
$("#editpdlplus_axes").on("change", function () {
$(".toolbar").hide();
var selectAxis = $("#editpdlplus_axes").val();
$("#editpdlplus_toolbar_" + selectAxis).show();
});
//
$(".editpdlplus_tool").on("click", function () {
var selectid = $(this).val();
$(".editpdlplus_tool").each(function () {
$(this).removeClass("btn-primary");
$(this).removeClass("btn-default");
var enabled = $(this).data('enable');
if (enabled === 1 && $(this).val() !== selectid) {
$(this).addClass("btn-default");
var canBeDelete = $("#editpdlplus_axes option:selected").data('delete');
if (canBeDelete) {
if (parseInt(canBeDelete) > 0) {
$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").addClass("disabled");
} else {
$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled");
}
});
$(this).addClass("btn-primary");
} else {
$("#editpdlplus_axes option[value='" + selectAxis + "']").data('delete', 0);
$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled");
}
$('#toolworkspace').html("");
});
$("#editpdlplus_axes").change();
//
$(".editpdlplus_tool").on("click", refreshToolView);
this.selectTool = $(".editpdlplus_tool").first();
this.initTool();
this.initToolUI();
$("#assignfeedback_editpdfplus_widget_admin_button_addaxis").on("click", this.openDivAddAxis);
$("#assignfeedback_editpdfplus_widget_admin_button_editaxis").on("click", this.openDivEditAxis);
$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").on("click", this.openDivDelAxis);
$("#assignfeedback_editpdfplus_widget_admin_button_addtool").on("click", this.openDivAddTool);
$(".btn-primary").click();
$(".btnimport").on('click', this.importAxis);
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();
};
//
AdminPanel.prototype.initTool = function () {
AdminPanel.prototype.initToolUI = function () {
$(this.selectTool).removeClass("btn-default");
$(this.selectTool).addClass("btn-primary");
};
//
AdminPanel.prototype.refreshPrevisu = function () {
currentTool.typetool = $("#typetool").val();
currentTool.colors = $("#color").val();
currentTool.cartridge = $("#libelle").val();
currentTool.cartridgeColor = $("#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.label = $("#button").val();
currentTool.enabled = $("#enabled").val();
currentTool.reply = 0;
if ($("#reply").is(':checked')) {
currentTool.reply = 1;
}
currentTool.orderTool = $("#order").val();
initCanevas();
initToolDisplay();
};
//
var getTypeTool = function (toolid) {
for (var i = 0; i < typetools.length; i++) {
if (typetools[i].id == toolid) {
return typetools[i];
}
}
};
var initToolDisplay = function () {
var typetool = parseInt($("#typetool").val());
var typetoolEntity = getTypeTool(typetool);
var confCartridge = false;
var confCartridgeColor = false;
if (typetoolEntity.configurableCartridge && parseInt(typetoolEntity.configurableCartridge) === 0) {
$("#libelle").hide();
$("label[for='libelle']").hide();
confCartridge = true;
} else {
$("#libelle").show();
$("label[for='libelle']").show();
}
if (typetoolEntity.configurableCartridgeColor && parseInt(typetoolEntity.configurableCartridgeColor) === 0) {
$("#cartridgecolor").hide();
$("label[for='cartridgecolor']").hide();
confCartridgeColor = true;
} else {
$("#cartridgecolor").show();
$("label[for='cartridgecolor']").show();
}
if (confCartridge && confCartridgeColor) {
$("#collapse3").parent().hide();
} else {
$("#collapse3").parent().show();
}
var confAnnotColor = false,
confAnnotTexts = false,
confAnnotReply = false;
if (typetoolEntity.configurableColor && parseInt(typetoolEntity.configurableColor) === 0) {
$("#color").hide();
$("label[for='color']").hide();
confAnnotColor = true;
} else {
$("#color").show();
$("label[for='color']").show();
}
if (typetoolEntity.configurableTexts && parseInt(typetoolEntity.configurableTexts) === 0) {
$(".textform").hide();
$("label[for='texts']").hide();
confAnnotTexts = true;
} else {
$(".textform").show();
$("label[for='texts']").show();
}
if (typetoolEntity.configurableQuestion && parseInt(typetoolEntity.configurableQuestion) === 0) {
$("#reply").hide();
$("label[for='reply']").hide();
confAnnotReply = true;
} else {
$("#reply").show();
$("label[for='reply']").show();
}
if (confAnnotColor && confAnnotReply && confAnnotTexts) {
$("#collapse4").parent().hide();
} else {
$("#collapse4").parent().show();
}
};
//
var initCanevas = function () {
$('#canevas').html("");
annotationcurrent = null;
var typetool = parseInt($("#typetool").val());
if (typetool === 3 || typetool === 4 || typetool === 7) {
$('#canevas').css("background-image", "url(" + $("#map01").val() + ")");
} else if (typetool === 1 || typetool === 6) {
$('#canevas').css("background-image", "url(" + $("#map02").val() + ")");
} else if (typetool === 5) {
$('#canevas').css("background-image", "url(" + $("#map03").val() + ")");
}
if (typetool === 1) {
annotationcurrent = new AnnotationHighlightplus();
} else if (typetool === 3) {
annotationcurrent = new AnnotationStampplus();
} else if (typetool === 4) {
annotationcurrent = new AnnotationFrame();
var annotChild = new AnnotationFrame();
} else if (typetool === 5) {
annotationcurrent = new AnnotationVerticalline();
} else if (typetool === 6) {
annotationcurrent = new AnnotationStampcomment();
} else if (typetool === 7) {
annotationcurrent = new AnnotationCommentplus();
}
if (annotationcurrent) {
var typetoolEntity = getTypeTool(typetool);
currentTool.type = typetoolEntity;
currentTool.reply = 0;
if ($("#reply").is(':checked')) {
currentTool.reply = 1;
}
annotationcurrent.initAdminDemo(currentTool);
annotationcurrent.draw($('#canevas'));
if (annotChild) {
annotChild.initChildAdminDemo(annotationcurrent);
annotChild.draw($('#canevas'));
}
}
};
//
AdminPanel.prototype.openDivAddAxis = function () {
$("#message_edit_tool").hide();
$("#axistool").hide();
$('#assignfeedback_editpdfplus_widget_admin_div_addaxis').show();
$('#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body').html("");
$('#assignfeedback_editpdfplus_widget_admin_toolheader').hide();
$('#assignfeedback_editpdfplus_widget_admin_toolworkspace').hide();
$("#editpdlplus_axes").prop('disabled', 'disabled');
var params = {};
fragment.loadFragment('assignfeedback_editpdfplus', 'axisadd', contextid, params)
.done(function (html, js) {
......@@ -87,9 +284,13 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
};
//
AdminPanel.prototype.openDivEditAxis = function () {
$("#message_edit_tool").hide();
$("#axistool").hide();
$('#assignfeedback_editpdfplus_widget_admin_div_editaxis').show();
$('#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body').html("");
$('#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.
......@@ -107,6 +308,390 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
html, js);
}.bind(this)).fail(notification.exception);
};
//
AdminPanel.prototype.openDivDelAxis = function () {
var canBeDelete = $("#editpdlplus_axes option:selected").data('delete');
if (canBeDelete !== null && parseInt(canBeDelete) === 0) {
$("#message_edit_tool").hide();
$("#axistool").hide();
$('#assignfeedback_editpdfplus_widget_admin_div_delaxis').show();
$('#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body').html("");
$('#assignfeedback_editpdfplus_widget_admin_toolheader').hide();
$('#assignfeedback_editpdfplus_widget_admin_toolworkspace').hide();
$("#editpdlplus_axes").prop('disabled', 'disabled');
var axeid = $("#editpdlplus_axes option:selected").val();
var params = {axeid: axeid};
fragment.loadFragment('assignfeedback_editpdfplus', 'axisdel', contextid, params)
.done(function (html, js) {
templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body',
html, js);
}.bind(this)).fail(notification.exception);
}
};
/**
* Fade the dom node out, update it, and fade it back.
*