Gitlab CSE Unil

Commit 0890c503 authored by M. Chardon's avatar M. Chardon
Browse files

- améliration visu admindemo des annotations

- création des annotations frame
- ajout fichier global.js pour les constantes
parent ec23e337
define(["jquery","core/notification","core/templates","core/fragment","core/ajax","core/str","assignfeedback_editpdfplus/annotation","assignfeedback_editpdfplus/annotationhighlightplus","assignfeedback_editpdfplus/annotationstampplus"],function(a,b,c,d,e,f,g,h,i){var j=null,k=null,l=null,m=null,n=function(a,b){this.init(),j=a,m=JSON.parse(b)};n.annotationcurrent=null,n.prototype.selectTool=null,n.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").change(),a(".editpdlplus_tool").on("click",r),this.selectTool=a(".editpdlplus_tool").first(),this.initTool(),a("#assignfeedback_editpdfplus_widget_admin_button_addaxis").on("click",this.openDivAddAxis),a("#assignfeedback_editpdfplus_widget_admin_button_editaxis").on("click",this.openDivEditAxis),a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").on("click",this.openDivDelAxis),a("#assignfeedback_editpdfplus_widget_admin_button_addtool").on("click",this.openDivAddTool)},n.prototype.test=function(){alert("test"),r()},n.prototype.initTool=function(){a(this.selectTool).removeClass("btn-default"),a(this.selectTool).addClass("btn-primary")};var o=function(a){for(var b=0;b<m.length;b++)if(m[b].id==a)return m[b]},p=function(){a("#canevas").html(""),this.annotationcurrent=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?(this.annotationcurrent=new h,this.annotationcurrent.x=83,this.annotationcurrent.y=82,this.annotationcurrent.endx=239,this.annotationcurrent.endy=98):3===b&&(this.annotationcurrent=new i,this.annotationcurrent.x=108,this.annotationcurrent.y=50),this.annotationcurrent){var c=o(b);this.annotationcurrent.tooltype=k,k.color?this.annotationcurrent.colour=k.color:this.annotationcurrent.colour=c.color,this.annotationcurrent.tooltypefamille=c,this.annotationcurrent.id="previsu_annot",this.annotationcurrent.draw(a("#canevas"))}};n.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 e={};d.loadFragment("assignfeedback_editpdfplus","axisadd",j,e).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},n.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 e=a("#editpdlplus_axes option:selected").val(),f={axeid:e};d.loadFragment("assignfeedback_editpdfplus","axisedit",j,f).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},n.prototype.openDivDelAxis=function(){a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_delaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body").html("");var e=a("#editpdlplus_axes option:selected").val(),f={axeid:e};d.loadFragment("assignfeedback_editpdfplus","axisdel",j,f).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)};var q=function(b,d,e){var f=a.Deferred();return b.fadeOut("fast",function(){c.replaceNodeContents(b,d,e),b.fadeIn("fast",function(){f.resolve()})}),f.promise()},r=function(){var c=f.get_string("admindeltool_messageok","assignfeedback_editpdfplus"),g=a(this).val();a(".editpdlplus_tool").each(function(){a(this).removeClass("btn-primary"),a(this).removeClass("btn-default");var b=a(this).data("enable");1===b&&a(this).val()!==g&&a(this).addClass("btn-default")}),a(this).addClass("btn-primary"),a("#editpdlplus_tool_item").html("");var h={toolid:g};d.loadFragment("assignfeedback_editpdfplus","tooledit",j,h).done(function(d,f){q(a("#editpdlplus_tool_item"),d,f).done(function(){k=new Object,k.typetool=a("#typetool").val(),k.color=a("#color").val(),k.libelle=a("#libelle").val(),k.catridgecolor=a("#catridgecolor").val(),k.texts=a("#texts").val(),k.button=a("#button").val(),k.enabled=a("#enabled").val(),k.reply=a("#reply").val(),k.order=a("#order").val(),a("#toolFormSubmit").on("click",function(){var c=a("#assignfeedback_editpdfplus_edit_tool"),d=c.serialize();e.call([{methodname:"assignfeedback_editpdfplus_submit_tool_edit_form",args:{jsonformdata:JSON.stringify(d)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").html("Modifications enregistrées"),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#editpdlplus_toolbar_"+b[0].axeid).html("");for(var c=0;c<b.length;c++){var d="btn-default";1!==b[c].enable&&(d=""),b[c].toolid===b[c].selecttool&&(d="btn-primary");var e="";4!==b[c].typetool&&1!==b[c].typetool||(e="text-decoration: underline;");var f=b[c].button;4!==b[c].typetool&&5!==b[c].typetool||(f="| "+f,4===b[c].typetool&&(f+=" |"));var g="<button class='btn "+d+" editpdlplus_tool' id='editpdlplus_tool_"+b[c].toolid+"' style='"+e+"' value='"+b[c].toolid+"' data-enable='"+b[c].enable+"'>"+f+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(g)}a(".editpdlplus_tool").on("click",r)}else a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(b.exception)}),a("#toolEnabled").on("click",function(){var b=a("#toolenabled").val();1==b?(a("#toolEnabled > i").addClass("fa-eye-slash"),a("#toolEnabled > i").removeClass("fa-eye"),a("#toolenabled").val(0)):(a("#toolEnabled > i").addClass("fa-eye"),a("#toolEnabled > i").removeClass("fa-eye-slash"),a("#toolenabled").val(1)),a("#toolFormSubmit").click()}),a("#toolClone").on("click",function(){l="clone",a("#assignfeedback_editpdfplus_widget_admin_button_addtool").click()}),a("#toolRemove").on("click",function(){if(!a(this).hasClass("disabled")){var d=a("#assignfeedback_editpdfplus_edit_tool"),f=d.serialize();e.call([{methodname:"assignfeedback_editpdfplus_submit_tool_del_form",args:{jsonformdata:JSON.stringify(f)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").html(c),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#editpdlplus_toolbar_"+b[0].axeid).html("");for(var d=0;d<b.length;d++){var e="btn-default";1!==b[d].enable&&(e=""),b[d].toolid===b[d].selecttool&&(e="btn-primary");var f="";4!==b[d].typetool&&1!==b[d].typetool||(f="text-decoration: underline;");var g=b[d].button;4!==b[d].typetool&&5!==b[d].typetool||(g="| "+g,4===b[d].typetool&&(g+=" |"));var h="<button class='btn "+e+" editpdlplus_tool' id='editpdlplus_tool_"+b[d].toolid+"' style='"+f+"' value='"+b[d].toolid+"' data-enable='"+b[d].enable+"'>"+g+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(h)}a(".editpdlplus_tool").on("click",r),a("#toolworkspace").html("")}else a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(b.exception)}}),p()}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)};return n.prototype.openDivAddTool=function(){var c=f.get_string("adminaddtool_messageok","assignfeedback_editpdfplus");a("#editpdlplus_tool_item").html(""),a(".btn-primary").addClass("btn-default"),a(".editpdlplus_tool").removeClass("btn-primary");var g=a("#editpdlplus_axes option:selected").val(),h={axisid:g};d.loadFragment("assignfeedback_editpdfplus","tooladd",j,h).done(function(d,f){q(a("#editpdlplus_tool_item"),d,f).done(function(){"clone"===l&&(a("#typetool").val(k.typetool),a("#color").val(k.color),a("#libelle").val(k.libelle),a("#catridgecolor").val(k.catridgecolor),a("#texts").val(k.texts),a("#button").val(k.button),a("#enabled").val(k.enabled),a("#reply").val(k.reply),a("#order").val(k.order),k=null,l=null),a("#toolFormSubmit").on("click",function(){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").html(c),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#editpdlplus_toolbar_"+b[0].axeid).html("");for(var d=0;d<b.length;d++){var e="btn-default";1!==b[d].enable&&(e=""),b[d].toolid===b[d].selecttool&&(e="btn-primary");var f="";4!==b[d].typetool&&1!==b[d].typetool||(f="text-decoration: underline;");var g=b[d].button;4!==b[d].typetool&&5!==b[d].typetool||(g="| "+g,4===b[d].typetool&&(g+=" |"));var h="<button class='btn "+e+" editpdlplus_tool' id='editpdlplus_tool_"+b[d].toolid+"' style='"+f+"' value='"+b[d].toolid+"' data-enable='"+b[d].enable+"'>"+g+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(h)}a(".editpdlplus_tool").on("click",r),a("#editpdlplus_tool_item").html("")}else a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(b.exception)})}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)},n});
\ No newline at end of file
define(["jquery","core/notification","core/templates","core/fragment","core/ajax","core/str","assignfeedback_editpdfplus/annotation","assignfeedback_editpdfplus/annotationhighlightplus","assignfeedback_editpdfplus/annotationstampplus","assignfeedback_editpdfplus/annotationframe"],function(a,b,c,d,e,f,g,h,i,j){var k=null,l=null,m=null,n=null,o=function(a,b){this.init(),k=a,n=JSON.parse(b)};o.annotationcurrent=null,o.prototype.selectTool=null,o.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").change(),a(".editpdlplus_tool").on("click",s),this.selectTool=a(".editpdlplus_tool").first(),this.initTool(),a("#assignfeedback_editpdfplus_widget_admin_button_addaxis").on("click",this.openDivAddAxis),a("#assignfeedback_editpdfplus_widget_admin_button_editaxis").on("click",this.openDivEditAxis),a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").on("click",this.openDivDelAxis),a("#assignfeedback_editpdfplus_widget_admin_button_addtool").on("click",this.openDivAddTool)},o.prototype.test=function(){alert("test"),s()},o.prototype.initTool=function(){a(this.selectTool).removeClass("btn-default"),a(this.selectTool).addClass("btn-primary")};var p=function(a){for(var b=0;b<n.length;b++)if(n[b].id==a)return n[b]},q=function(){a("#canevas").html(""),this.annotationcurrent=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?(this.annotationcurrent=new h,this.annotationcurrent.x=83,this.annotationcurrent.y=84,this.annotationcurrent.endx=239,this.annotationcurrent.endy=100):3===b?(this.annotationcurrent=new i,this.annotationcurrent.x=60,this.annotationcurrent.y=100):4===b&&(this.annotationcurrent=new j,this.annotationcurrent.x=279,this.annotationcurrent.y=113,this.annotationcurrent.endx=435,this.annotationcurrent.endy=129,this.annotationcurrent.parent_annot=0),this.annotationcurrent){var c=p(b);this.annotationcurrent.tooltype=l,l.color?this.annotationcurrent.colour=l.color:this.annotationcurrent.colour=c.color,this.annotationcurrent.tooltypefamille=c,this.annotationcurrent.id="previsu_annot",this.annotationcurrent.displaylock=1,this.annotationcurrent.adminDemo=1,this.annotationcurrent.draw(a("#canevas"))}};o.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 e={};d.loadFragment("assignfeedback_editpdfplus","axisadd",k,e).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},o.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 e=a("#editpdlplus_axes option:selected").val(),f={axeid:e};d.loadFragment("assignfeedback_editpdfplus","axisedit",k,f).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)},o.prototype.openDivDelAxis=function(){a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_delaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body").html("");var e=a("#editpdlplus_axes option:selected").val(),f={axeid:e};d.loadFragment("assignfeedback_editpdfplus","axisdel",k,f).done(function(a,b){c.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body",a,b)}.bind(this)).fail(b.exception)};var r=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=function(){var c=f.get_string("admindeltool_messageok","assignfeedback_editpdfplus"),g=a(this).val();a(".editpdlplus_tool").each(function(){a(this).removeClass("btn-primary"),a(this).removeClass("btn-default");var b=a(this).data("enable");1===b&&a(this).val()!==g&&a(this).addClass("btn-default")}),a(this).addClass("btn-primary"),a("#editpdlplus_tool_item").html("");var h={toolid:g};d.loadFragment("assignfeedback_editpdfplus","tooledit",k,h).done(function(d,f){r(a("#editpdlplus_tool_item"),d,f).done(function(){l=new Object,l.typetool=a("#typetool").val(),l.color=a("#color").val(),l.libelle=a("#libelle").val(),l.catridgecolor=a("#cartridgecolor").val(),l.texts=a("#texts").val(),l.button=a("#button").val(),l.enabled=a("#enabled").val(),l.reply=a("#reply").val(),l.order=a("#order").val(),a("#toolFormSubmit").on("click",function(){var c=a("#assignfeedback_editpdfplus_edit_tool"),d=c.serialize();e.call([{methodname:"assignfeedback_editpdfplus_submit_tool_edit_form",args:{jsonformdata:JSON.stringify(d)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").html("Modifications enregistrées"),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#editpdlplus_toolbar_"+b[0].axeid).html("");for(var c=0;c<b.length;c++){var d="btn-default";1!==b[c].enable&&(d=""),b[c].toolid===b[c].selecttool&&(d="btn-primary");var e="";4!==b[c].typetool&&1!==b[c].typetool||(e="text-decoration: underline;");var f=b[c].button;4!==b[c].typetool&&5!==b[c].typetool||(f="| "+f,4===b[c].typetool&&(f+=" |"));var g="<button class='btn "+d+" editpdlplus_tool' id='editpdlplus_tool_"+b[c].toolid+"' style='"+e+"' value='"+b[c].toolid+"' data-enable='"+b[c].enable+"'>"+f+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(g)}a(".editpdlplus_tool").on("click",s)}else a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(b.exception)}),a("#toolEnabled").on("click",function(){var b=a("#toolenabled").val();1==b?(a("#toolEnabled > i").addClass("fa-eye-slash"),a("#toolEnabled > i").removeClass("fa-eye"),a("#toolenabled").val(0)):(a("#toolEnabled > i").addClass("fa-eye"),a("#toolEnabled > i").removeClass("fa-eye-slash"),a("#toolenabled").val(1)),a("#toolFormSubmit").click()}),a("#toolClone").on("click",function(){m="clone",a("#assignfeedback_editpdfplus_widget_admin_button_addtool").click()}),a("#toolRemove").on("click",function(){if(!a(this).hasClass("disabled")){var d=a("#assignfeedback_editpdfplus_edit_tool"),f=d.serialize();e.call([{methodname:"assignfeedback_editpdfplus_submit_tool_del_form",args:{jsonformdata:JSON.stringify(f)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").html(c),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#editpdlplus_toolbar_"+b[0].axeid).html("");for(var d=0;d<b.length;d++){var e="btn-default";1!==b[d].enable&&(e=""),b[d].toolid===b[d].selecttool&&(e="btn-primary");var f="";4!==b[d].typetool&&1!==b[d].typetool||(f="text-decoration: underline;");var g=b[d].button;4!==b[d].typetool&&5!==b[d].typetool||(g="| "+g,4===b[d].typetool&&(g+=" |"));var h="<button class='btn "+e+" editpdlplus_tool' id='editpdlplus_tool_"+b[d].toolid+"' style='"+f+"' value='"+b[d].toolid+"' data-enable='"+b[d].enable+"'>"+g+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(h)}a(".editpdlplus_tool").on("click",s),a("#toolworkspace").html("")}else a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(b.exception)}}),q()}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)};return o.prototype.openDivAddTool=function(){var c=f.get_string("adminaddtool_messageok","assignfeedback_editpdfplus");a("#editpdlplus_tool_item").html(""),a(".btn-primary").addClass("btn-default"),a(".editpdlplus_tool").removeClass("btn-primary");var g=a("#editpdlplus_axes option:selected").val(),h={axisid:g};d.loadFragment("assignfeedback_editpdfplus","tooladd",k,h).done(function(d,f){r(a("#editpdlplus_tool_item"),d,f).done(function(){"clone"===m&&(a("#typetool").val(l.typetool),a("#color").val(l.color),a("#libelle").val(l.libelle),a("#cartridgecolor").val(l.catridgecolor),a("#texts").val(l.texts),a("#button").val(l.button),a("#enabled").val(l.enabled),a("#reply").val(l.reply),a("#order").val(l.order),l=null,m=null),a("#toolFormSubmit").on("click",function(){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").html(c),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#editpdlplus_toolbar_"+b[0].axeid).html("");for(var d=0;d<b.length;d++){var e="btn-default";1!==b[d].enable&&(e=""),b[d].toolid===b[d].selecttool&&(e="btn-primary");var f="";4!==b[d].typetool&&1!==b[d].typetool||(f="text-decoration: underline;");var g=b[d].button;4!==b[d].typetool&&5!==b[d].typetool||(g="| "+g,4===b[d].typetool&&(g+=" |"));var h="<button class='btn "+e+" editpdlplus_tool' id='editpdlplus_tool_"+b[d].toolid+"' style='"+f+"' value='"+b[d].toolid+"' data-enable='"+b[d].enable+"'>"+g+"</button>";a("#editpdlplus_toolbar_"+b[0].axeid).append(h)}a(".editpdlplus_tool").on("click",s),a("#editpdlplus_tool_item").html("")}else a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(b.exception)})}.bind(this)).fail(b.exception)}.bind(this)).fail(b.exception)},o});
\ No newline at end of file
define(["jquery"],function(a){function b(){return this._instanceID=d(),a("#tutu").val(),this}var c=0,d=function(){return++c};return b.getInstanceCount=function(){return c},b.prototype.getInstanceID=function(){return this._instanceID},b.x=0,b.y=0,b.endx=0,b.endy=0,b.path="",b.toolid=0,b.colour="red",b.tooltype=null,b.tooltypefamille=null,b.id=0,b.cartridgex=0,b.cartridgey=0,b.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,this.tooltypefamille=this.editor.typetools[this.tooltype.type]},b.prototype.draw=function(){},b.prototype.get_color=function(){var a="black";return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.colour,a},b.prototype.get_color_cartridge=function(){var a="black";return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.tooltype.cartridge_color,""===a?this.tooltypefamille.cartridge_color:a},b.prototype.init_div_cartridge_id=function(){var a=(new Date).toJSON().replace(/:/g,"").replace(/\./g,"");this.divcartridge="ct_"+this.tooltype.id+"_"+a},b.prototype.get_div_cartridge=function(a){var b="<div ";b+="id='"+this.divcartridge+"' ",b+="class='assignfeedback_editpdfplus_cartridge' ",b+="style='border-color: "+a+";'> ",b+="</div>";var c=Y.Node.create(b);return this.editor.get("readonly")&&c.on("click",this.view_annot,this),c},b.prototype.get_div_cartridge_label=function(a){var b="<div ";b+="id='"+this.divcartridge+"_cartridge' ",b+="class='assignfeedback_editpdfplus_"+this.tooltypefamille.label+"_cartridge' ",b+=this.editor.get("readonly")&&""===this.get_valref()?"style='border-right:none;padding-right:0px;color:"+a+";' ":"style='border-right-color: "+a+";color:"+a+";' ",b+="> ",b+=this.tooltype.cartridge,b+="</div>";var c=Y.Node.create(b);return c},b.prototype.get_div_input=function(a){var b="<div ";b+="id='"+this.divcartridge+"_display' ",b+="style='color:"+a+"; ",this.editor.get("readonly")&&""===this.get_valref()&&(b+="padding:0px;"),b+="'></div>";var c=Y.Node.create(b);return this.editor.get("readonly")||c.on("click",this.edit_annot,this),c},b.prototype.get_div_edition=function(){var a="<div ";a+="id='"+this.divcartridge+"_edit' ",a+="class='assignfeedback_editpdfplus_"+this.tooltypefamille.label+"_edition' ",a+="style='display:none;'> ",a+="<textarea id='"+this.divcartridge+"_editinput' type='text' value=\""+this.get_valref()+"\" class='form-control' style='margin-bottom:5px;' >"+this.get_valref()+"</textarea>",a+="</div>";var b=Y.Node.create(a),c=this.tooltype.texts;if(c&&c.length>0){for(var d="<div></div>",e=Y.Node.create(d),f=c.split('","'),g=0;g<f.length;g++){var h="<button class='btn btn-default' type='button' style='width:100%;font-size: x-small;'>"+f[g].replace('"',"")+"</button>",i=Y.Node.create(h);i.on("click",this.fill_input_edition,this,f[g].replace('"',"")),e.append(i),e.append("<br/>")}b.append(e)}return b},b.prototype.get_div_container=function(a){var b="<div ";b+="class='assignfeedback_editpdfplus_"+this.tooltypefamille.label+"_conteneur' >",b+="</div>";var c=Y.Node.create(b),d=this.get_div_input(a);d.addClass("assignfeedback_editpdfplus_"+this.tooltypefamille.label+"_input");var e=1;(this.displaylock||this.displaylock>=0)&&(e=this.displaylock);var f=Y.Node.create("<input type='hidden' id='"+this.divcartridge+"_onof' value="+e+" />"),g=this.editor.get("readonly");return g||d.on("click",this.edit_annot,this),c.append(d),c.append(f),c.append(this.get_input_question()),g=this.editor.get("readonly"),g?c.append(this.get_button_student_status()):(c.append(this.get_button_visibility_left()),c.append(this.get_button_visibility_right()),c.append(this.get_button_save()),c.append(this.get_button_cancel()),1===this.tooltype.reply&&c.append(this.get_button_question()),c.append(this.get_button_remove())),c},b.prototype.get_button_visibility_right=function(){var a="<button id='"+this.divcartridge+"_buttonedit_right' class='btn btn-default' type='button'>";a+="<i class='fa fa-arrow-right' aria-hidden='true'></i>",a+="</button>";var b=Y.Node.create(a);return b.on("click",this.change_visibility_annot,this,"r"),b},b.prototype.get_button_visibility_left=function(){var a="<button id='"+this.divcartridge+"_buttonedit_left' class='btn btn-default' type='button'>";a+="<i class='fa fa-arrow-left' aria-hidden='true'></i>",a+="</button>";var b=Y.Node.create(a);return b.on("click",this.change_visibility_annot,this,"l"),b},b.prototype.get_button_cancel=function(){var a="<button id='"+this.divcartridge+"_buttoncancel' style='display:none;' class='btn btn-default' type='button'><i class='fa fa-undo' aria-hidden='true'></i></button>",b=Y.Node.create(a);return b.on("click",this.cancel_edit,this),b},b.prototype.get_button_question=function(){var a="<button id='"+this.divcartridge+'_buttonquestion\' style=\'display:none;margin-left:10px;\' class=\'btn btn-default\' 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=Y.Node.create(a);return b.on("click",this.change_question_status,this),b},b.prototype.get_button_remove=function(){var a="<button id='"+this.divcartridge+"_buttonremove' style='display:none;margin-left:10px;' class='btn btn-default' type='button'><i class='fa fa-trash' aria-hidden='true'></i></button>",b=Y.Node.create(a);return b.on("click",this.remove_by_trash,this),b},b.prototype.apply_visibility_annot=function(){var a=this.editor.get_dialogue_element("#"+this.divcartridge+"_display"),b=this.editor.get_dialogue_element("#"+this.divcartridge+"_onof"),c=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit_right"),d=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit_left"),e=this.editor.get_dialogue_element("#"+this.divcartridge+"_radioContainer");b&&("1"===b.get("value")?(c&&c.show(),d&&d.show()):"0"===b.get("value")?(c&&c.show(),d&&d.hide()):(c&&c.hide(),d&&d.show())),a&&a.setContent(this.get_text_to_diplay_in_cartridge()),"frame"===this.tooltypefamille.label&&c&&(c.hide(),d.hide()),e&&e.hide(),this.apply_question_status()},b.prototype.get_text_to_diplay_in_cartridge=function(){var a=this.get_valref(),b=this.editor.get_dialogue_element("#"+this.divcartridge+"_onof"),c="";return""!==a||this.editor.get("readonly")||(c="&nbsp;&nbsp;&nbsp;&nbsp"),"1"===b.get("value")&&""!==a?c=a.substr(0,20):"0"===b.get("value")&&""!==a?c="...":""!==a&&(c=a),1===this.answerrequested&&(c+='&nbsp;<span style="color:red;">[?]</span>'),c},b.prototype.apply_question_status=function(){var a=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonquestion"),b=this.editor.get_dialogue_element("#"+this.divcartridge+"_question"),c=0;b&&(c=parseInt(b.get("value"),10)),a&&(1===c?a.setHTML('<i class="fa fa-question-circle-o"></i>'):a.setHTML('<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>'))},b.prototype.draw_catridge=function(){return!0},b.prototype.edit_annot=function(){if(!this.parent_annot_element){var a=this.editor.get_dialogue_element("#"+this.divcartridge),b=this.editor.get_dialogue_element("#"+this.divcartridge+"_display"),c=this.editor.get_dialogue_element("#"+this.divcartridge+"_edit"),d=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit_right"),e=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit_left"),f=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonsave"),g=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttoncancel"),h=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonquestion"),i=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonrotation"),j=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonremove"),k=this.editor.get_dialogue_element("#"+this.divcartridge+"_editinput");b.hide(),d&&d.hide(),e&&e.hide(),i&&i.hide(),c.show(),f.show(),g.show(),h&&h.show(),j.show(),a.setStyle("z-index",1e3),k&&k.set("focus","on"),this.disabled_canvas_event(),a.on("clickoutside",this.save_annot_clickout,this,"clickoutside")}},b.prototype.fill_input_edition=function(a,b){var c=this.editor.get_dialogue_element("#"+this.divcartridge+"_editinput");c&&c.set("value",b),this.save_annot(b)},b.prototype.save_annot_clickout=function(a,b){"clickoutside"===b&&this.editor.currentannotation===this||this.save_annot(null)},b.prototype.save_annot=function(a){if("string"!=typeof a){var b=this.editor.get_dialogue_element("#"+this.divcartridge+"_editinput");b&&(a=b.get("value"))}this.textannot=a,this.editor.save_current_page(),0===a.length&&(a="&nbsp;&nbsp;"),this.hide_edit(),this.apply_visibility_annot()},b.prototype.cancel_edit=function(a,b){if("clickoutside"!==b||this.editor.currentannotation!==this){var c=this.get_valref(),d=this.editor.get_dialogue_element("#"+this.divcartridge+"_editinput");c&&d&&d.set("value",c),this.hide_edit(),this.apply_visibility_annot();var e=this.editor.get_dialogue_element("#"+this.divcartridge);e&&e.detach()}},b.prototype.hide_edit=function(a,b){if(!b||"clickoutside"!==b||this.editor.currentannotation!==this){var c=this.editor.get_dialogue_element("#"+this.divcartridge),d=this.editor.get_dialogue_element("#"+this.divcartridge+"_display"),e=this.editor.get_dialogue_element("#"+this.divcartridge+"_edit"),f=this.editor.get_dialogue_element("#"+this.divcartridge+"_visu"),g=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonsave"),h=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttoncancel"),i=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonquestion"),j=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonrotation"),k=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonremove"),l=this.editor.get_dialogue_element("#"+this.divcartridge+"_radioContainer");d&&(d.show(),d.set("style","display:inline;color:"+this.get_color_cartridge()+";")),j&&j.show(),e&&(e.hide(),g.hide(),h.hide()),f&&f.hide(),i&&i.hide(),k&&k.hide(),c&&(c.setStyle("z-index",1),c.detach(),this.editor.get("readonly")&&c.on("click",this.view_annot,this,"click")),e&&this.enabled_canvas_event(),l&&l.hide()}},b});
\ No newline at end of file
define(["jquery","./global"],function(a,b){function c(){return this._instanceID=e(),a("#tutu").val(),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.tooltypefamille=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,this.tooltypefamille=this.editor.typetools[this.tooltype.type]},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.catridgecolor];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.tooltype.catridgecolor,a&&""!==a?a:this.tooltypefamille.cartridge_color},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+";'> ",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.tooltypefamille.label+"_cartridge' ",d+="style='border-right-color: "+b+";color:"+b+";' ",d+="> ",d+=this.tooltype.libelle,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.tooltypefamille.label+"_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('"',"")+"</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.tooltypefamille.label+"_conteneur' >",d+="</div>",c&&c.append(d);var e=a(".assignfeedback_editpdfplus_"+this.tooltypefamille.label+"_conteneur"),f=this.get_div_input(b,e);f.addClass("assignfeedback_editpdfplus_"+this.tooltypefamille.label+"_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),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_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.tooltypefamille.label&&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.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("display","inline-block"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y)}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' 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' 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.tooltypefamille.cartridge_x,10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltypefamille.cartridge_y,10)),c.css("left",this.cartridgex+15),c.css("top",this.y+this.cartridgey),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.draw=function(b){if(b){var c="<div id='"+this.id+"'></div>";b.append(c),a("#"+this.id).css("background-color",this.colour),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("float","left"),a("#"+this.id).css("margin-top",this.x),a("#"+this.id).css("margin-left",this.y)}},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.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("display","inline-block"),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.tooltypefamille.cartridge_x,10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltypefamille.cartridge_y,10)),b.css("left",this.x+this.cartridgex+17),b.css("top",this.y+this.cartridgey),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.draw=function(b){if(b){var c="<div id='"+this.id+"'></div>";b.append(c),a("#"+this.id).css("position","absolue"),a("#"+this.id).css("margin-top",this.x),a("#"+this.id).css("margin-left",this.y),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.button)}},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.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.button)}return this},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
......@@ -23,9 +23,9 @@
define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/fragment',
'core/ajax', 'core/str', /*'mod_assign/grading_form_change_checker'*/
'assignfeedback_editpdfplus/annotation', 'assignfeedback_editpdfplus/annotationhighlightplus',
'assignfeedback_editpdfplus/annotationstampplus'],
'assignfeedback_editpdfplus/annotationstampplus', 'assignfeedback_editpdfplus/annotationframe'],
function ($/*, Y*/, notification, templates, fragment, ajax, str,
Annotation, AnnotationHighlightplus, AnnotationStampplus /*, checker*/) {
Annotation, AnnotationHighlightplus, AnnotationStampplus, AnnotationFrame /*, checker*/) {
var contextid = null;
var currentTool = null;
......@@ -103,13 +103,20 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
if (typetool === 1) {
this.annotationcurrent = new AnnotationHighlightplus();
this.annotationcurrent.x = 83;
this.annotationcurrent.y = 82;
this.annotationcurrent.y = 84;
this.annotationcurrent.endx = 239;
this.annotationcurrent.endy = 98;
this.annotationcurrent.endy = 100;
} else if (typetool === 3) {
this.annotationcurrent = new AnnotationStampplus();
this.annotationcurrent.x = 108;
this.annotationcurrent.y = 50;
this.annotationcurrent.x = 60;
this.annotationcurrent.y = 100;
} else if (typetool === 4) {
this.annotationcurrent = new AnnotationFrame();
this.annotationcurrent.x = 279;
this.annotationcurrent.y = 113;
this.annotationcurrent.endx = 435;
this.annotationcurrent.endy = 129;
this.annotationcurrent.parent_annot = 0;
}
if (this.annotationcurrent) {
var typetoolEntity = getTypeTool(typetool);
......@@ -121,6 +128,8 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
}
this.annotationcurrent.tooltypefamille = typetoolEntity;
this.annotationcurrent.id = 'previsu_annot';
this.annotationcurrent.displaylock = 1;
this.annotationcurrent.adminDemo = 1;
this.annotationcurrent.draw($('#canevas'));
}
};
......@@ -219,7 +228,7 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
currentTool.typetool = $("#typetool").val();
currentTool.color = $("#color").val();
currentTool.libelle = $("#libelle").val();
currentTool.catridgecolor = $("#catridgecolor").val();
currentTool.catridgecolor = $("#cartridgecolor").val();
currentTool.texts = $("#texts").val();
currentTool.button = $("#button").val();
currentTool.enabled = $("#enabled").val();
......@@ -382,7 +391,7 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
$("#typetool").val(currentTool.typetool);
$("#color").val(currentTool.color);
$("#libelle").val(currentTool.libelle);
$("#catridgecolor").val(currentTool.catridgecolor);
$("#cartridgecolor").val(currentTool.catridgecolor);
$("#texts").val(currentTool.texts);
$("#button").val(currentTool.button);
$("#enabled").val(currentTool.enabled);
......
......@@ -20,8 +20,8 @@
/**
* @module mod_assignfeedback_editpdfplus/annotation
*/
define(['jquery'],
function ($) {
define(['jquery', './global'],
function ($, global) {
// 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.
......@@ -141,6 +141,7 @@ define(['jquery'],
* @public
*/
Annotation.cartridgey = 0;
Annotation.adminDemo = 0;
Annotation.prototype.init = function (config) {
this.cartridgex = parseInt(config.cartridgex, 10) || 0;
this.cartridgey = parseInt(config.cartridgey, 10) || 0;
......@@ -170,7 +171,7 @@ define(['jquery'],
* @protected
*/
Annotation.prototype.get_color = function () {
var color = 'black'; //ANNOTATIONCOLOUR[this.colour];
var color = global.ANNOTATIONCOLOUR[this.colour];
if (!color) {
color = this.colour;
} else {
......@@ -186,15 +187,15 @@ define(['jquery'],
* @protected
*/
Annotation.prototype.get_color_cartridge = function () {
var color = 'black'; //ANNOTATIONCOLOUR[this.tooltype.cartridge_color];
var color = global.ANNOTATIONCOLOUR[this.tooltype.catridgecolor];
if (!color) {
color = this.tooltype.cartridge_color;
color = this.tooltype.catridgecolor;
} else {
// Add an alpha channel to the rgb colour.
color = color.replace('rgb', 'rgba');
color = color.replace(')', ',0.5)');
}
if (color === '') {
if (!color || color === '') {
return this.tooltypefamille.cartridge_color;
}
return color;
......@@ -205,22 +206,31 @@ define(['jquery'],
*/
Annotation.prototype.init_div_cartridge_id = function () {
var date = (new Date().toJSON()).replace(/:/g, '').replace(/\./g, '');
this.divcartridge = 'ct_' + this.tooltype.id + '_' + date;
if (this.tooltype.id) {
this.divcartridge = 'ct_' + this.tooltype.id + '_' + date;
} else {
this.divcartridge = 'ct_' + this.id + '_' + date;
}
};
/**
* get the html node for the cartridge
* @param {string} colorcartridge
* @return node
*/
Annotation.prototype.get_div_cartridge = function (colorcartridge) {
Annotation.prototype.get_div_cartridge = function (colorcartridge, canevas) {
var div = "<div ";
div += "id='" + this.divcartridge + "' ";
div += "class='assignfeedback_editpdfplus_cartridge' ";
div += "style='border-color: " + colorcartridge + ";'> ";
div += "</div>";
var divdisplay = Y.Node.create(div);
if (this.editor.get('readonly')) {
divdisplay.on('click', this.view_annot, this);
if (canevas) {
canevas.append(div);
}
var divdisplay = $('#' + this.divcartridge);
if (this.adminDemo < 1) {
//if (this.editor.get('readonly')) {
// divdisplay.on('click', this.view_annot, this);
//}
}
return divdisplay;
};
......@@ -230,19 +240,22 @@ define(['jquery'],
* @param {boolean} draggable
* @return node
*/
Annotation.prototype.get_div_cartridge_label = function (colorcartridge/*, draggable*/) {
Annotation.prototype.get_div_cartridge_label = function (colorcartridge, canevas/*, draggable*/) {
var divcartridge = "<div ";
divcartridge += "id='" + this.divcartridge + "_cartridge' ";
divcartridge += "class='assignfeedback_editpdfplus_" + this.tooltypefamille.label + "_cartridge' ";
if (this.editor.get('readonly') && this.get_valref() === '') {
divcartridge += "style='border-right:none;padding-right:0px;color:" + colorcartridge + ";' ";
} else {
divcartridge += "style='border-right-color: " + colorcartridge + ";color:" + colorcartridge + ";' ";
}
//if (this.editor.get('readonly') && this.get_valref() === '') {
//divcartridge += "style='border-right:none;padding-right:0px;color:" + colorcartridge + ";' ";
//} else {
divcartridge += "style='border-right-color: " + colorcartridge + ";color:" + colorcartridge + ";' ";
//}
divcartridge += "> ";
divcartridge += this.tooltype.cartridge;
divcartridge += this.tooltype.libelle;
divcartridge += "</div>";
var divcartridgedisplay = Y.Node.create(divcartridge);
if (canevas) {
canevas.append(divcartridge);
}
var divcartridgedisplay = $('#' + this.divcartridge + "_cartridge");
/*if (draggable && !this.editor.get('readonly')) {
divcartridgedisplay.on('mousedown', this.move_cartridge_begin, this);
return divcartridgedisplay;
......@@ -254,51 +267,67 @@ define(['jquery'],
* @param {string} colorcartridge
* @return node
*/
Annotation.prototype.get_div_input = function (colorcartridge) {
Annotation.prototype.get_div_input = function (colorcartridge, canevas) {
var divinput = "<div ";
divinput += "id='" + this.divcartridge + "_display' ";
divinput += "style='color:" + colorcartridge + "; ";
if (this.editor.get('readonly') && this.get_valref() === '') {
divinput += "padding:0px;";
}
//if (this.editor.get('readonly') && this.get_valref() === '') {
// divinput += "padding:0px;";
//}
divinput += "'></div>";
var divinputdisplay = Y.Node.create(divinput);
if (!this.editor.get('readonly')) {
divinputdisplay.on('click', this.edit_annot, this);
}
canevas.append(divinput);
var divinputdisplay = $("#" + this.divcartridge + "_display");
//if (!this.editor.get('readonly')) {
divinputdisplay.on("click", {annotation: this}, this.edit_annot);
//}
return divinputdisplay;
};
/**
* get the html node for the edition of comment and parameters
* @return node
*/
Annotation.prototype.get_div_edition = function () {
Annotation.prototype.get_div_edition = function (canevas) {
var divedition = "<div ";
divedition += "id='" + this.divcartridge + "_edit' ";
divedition += "class='assignfeedback_editpdfplus_" + this.tooltypefamille.label + "_edition' ";
divedition += "style='display:none;'> ";
divedition += "<textarea id='"
+ this.divcartridge
+ "_editinput' type='text' value=\""
+ this.get_valref() + "\" class='form-control' style='margin-bottom:5px;' >"
+ this.get_valref() + "</textarea>";
+ "_editinput' type='text'"
//value=\""
//+ this.get_valref()
+ " class='form-control' style='margin-bottom:5px;'";
if (this.adminDemo === 1) {
divedition += ' readonly';
}
divedition += ">"
//+ this.get_valref()
+ "</textarea>";
divedition += "</div>";
var diveditiondisplay = Y.Node.create(divedition);
if (canevas) {
canevas.append(divedition);
}
var diveditiondisplay = $("#" + this.divcartridge + "_edit");
var propositions = this.tooltype.texts;
if (propositions && propositions.length > 0) {
var divproposition = "<div></div>";
var divpropositiondisplay = Y.Node.create(divproposition);
var divproposition = "<div id='" + this.divcartridge + "_edit_propositions'></div>";
diveditiondisplay.append(divproposition);
var divpropositiondisplay = $("#" + this.divcartridge + "_edit_propositions");
var propositionarray = propositions.split('","');
for (var i = 0; i < propositionarray.length; i++) {
var buttontmp = "<button class='btn btn-default' type='button' style='width:100%;font-size: x-small;'>"
var buttontmp = "<button class='btn btn-default";
if (this.adminDemo === 1) {
buttontmp += ' disabled';
}
buttontmp += "' type='button' style='width:100%;font-size: x-small;'>"
+ propositionarray[i].replace('"', '')
+ "</button>";
var buttontmpdisplay = Y.Node.create(buttontmp);
buttontmpdisplay.on('click', this.fill_input_edition, this, propositionarray[i].replace('"', ''));
divpropositiondisplay.append(buttontmpdisplay);
divpropositiondisplay.append(buttontmp);
if (this.adminDemo < 1) {
//buttontmpdisplay.on('click', this.fill_input_edition, this, propositionarray[i].replace('"', ''));
}
divpropositiondisplay.append("<br/>");
}
diveditiondisplay.append(divpropositiondisplay);
}
return diveditiondisplay;
};
......@@ -307,39 +336,39 @@ define(['jquery'],
* @param {string} colorcartridge
* @return node
*/
Annotation.prototype.get_div_container = function (colorcartridge) {
Annotation.prototype.get_div_container = function (colorcartridge, canevas) {
var divconteneur = "<div ";
divconteneur += "class='assignfeedback_editpdfplus_" + this.tooltypefamille.label + "_conteneur' >";
divconteneur += "</div>";
var divconteneurdisplay = Y.Node.create(divconteneur);
var divinputdisplay = this.get_div_input(colorcartridge);
if (canevas) {
canevas.append(divconteneur);
}
var divconteneurdisplay = $('.assignfeedback_editpdfplus_' + this.tooltypefamille.label + "_conteneur");
var divinputdisplay = this.get_div_input(colorcartridge, divconteneurdisplay);
divinputdisplay.addClass('assignfeedback_editpdfplus_' + this.tooltypefamille.label + '_input');
//var inputvalref = this.get_input_valref();
var onof = 1;
if (this.displaylock || this.displaylock >= 0) {
onof = this.displaylock;
}
var inputonof = Y.Node.create("<input type='hidden' id='" + this.divcartridge + "_onof' value=" + onof + " />");
var readonly = this.editor.get('readonly');
if (!readonly) {
divinputdisplay.on('click', this.edit_annot, this);
}
divconteneurdisplay.append(divinputdisplay);
divconteneurdisplay.append(inputonof);
divconteneurdisplay.append(this.get_input_question());
readonly = this.editor.get('readonly');
if (!readonly) {
divconteneurdisplay.append(this.get_button_visibility_left());
divconteneurdisplay.append(this.get_button_visibility_right());
divconteneurdisplay.append(this.get_button_save());
divconteneurdisplay.append(this.get_button_cancel());
if (this.tooltype.reply === 1) {
divconteneurdisplay.append(this.get_button_question());
}
divconteneurdisplay.append(this.get_button_remove());
} else {
divconteneurdisplay.append(this.get_button_student_status());
var inputonof = "<input type='hidden' id='" + this.divcartridge + "_onof' value=" + onof + " />";
if (canevas) {
divconteneurdisplay.append(inputonof);
}
//var readonly = this.editor.get('readonly');
//divconteneurdisplay.append(this.get_input_question());
//readonly = this.editor.get('readonly');
//if (!readonly) {
this.get_button_visibility_left(divconteneurdisplay);
this.get_button_visibility_right(divconteneurdisplay);
this.get_button_save(divconteneurdisplay);
this.get_button_cancel(divconteneurdisplay);
if (this.tooltype.reply === 1) {
this.get_button_question(divconteneurdisplay);
}
this.get_button_remove(divconteneurdisplay);
//} else {
// divconteneurdisplay.append(this.get_button_student_status());
//}
return divconteneurdisplay;
};
......@@ -347,43 +376,93 @@ define(['jquery'],
* get the html node for the button to set visibility on right
* @return node
*/
Annotation.prototype.get_button_visibility_right = function () {
Annotation.prototype.get_button_visibility_right = function (canevas) {
var buttonvisibility = "<button id='"
+ this.divcartridge
+ "_buttonedit_right' class='btn btn-default' type='button'>";
+ "_buttonedit_right' class='btn btn-default";
if (this.adminDemo === 1) {
buttonvisibility += ' disabled';