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
This diff is collapsed.
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);
......
This diff is collapsed.
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/*
* @package assignfeedback_editpdfplus
* @copyright 2017 Université de Lausanne
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* @module mod_assignfeedback_editpdfplus/annotationhighlightplus
*/
define(['jquery', './annotation'],
function ($, Annotation) {
// I return an initialized object.
function AnnotationFrame() {
// Call the super constructor.
Annotation.call(this);
// Return this object reference.
return(this);
}
// The Friend class extends the base Model class.
AnnotationFrame.prototype = Object.create(Annotation.prototype);
/**
* Draw a highlight annotation
* @protected
* @method draw
* @return M.assignfeedback_editpdfplus.drawable
*/
AnnotationFrame.prototype.draw = function (canevas) {
//this.shape_id = 'ct_frame_' + (new Date().toJSON()).replace(/:/g, '').replace(/\./g, '');
if (canevas) {
var divFrame = "<div id='" + this.id + "'></div>";
canevas.append(divFrame);
$("#" + this.id).css('width', this.endx - this.x);
$("#" + this.id).css('height', this.endy - this.y);
$("#" + this.id).css('border', 'solid 2px red');
$("#" + this.id).css('position', 'relative');
$("#" + this.id).css('display', 'inline-block');
$("#" + this.id).css('left', this.x);
$("#" + this.id).css('top', this.y);
}
this.draw_catridge(canevas);
return this;
};
/**
* Display cartridge and toolbox for the annotation
* @returns {Boolean} res
*/
AnnotationFrame.prototype.draw_catridge = function (canevas) {
if (!this.parent_annot_element && this.parent_annot === 0) {
var divdisplay;
if (!this.divcartridge || this.divcartridge === '') {
this.init_div_cartridge_id();
//rattachement de la shape
var shapechd = $("#" + this.id);
if (shapechd) {
shapechd.addClass('class_' + this.divcartridge);
}
//init cartridge
var colorcartridge = this.get_color();
divdisplay = this.get_div_cartridge(colorcartridge, canevas);
divdisplay.addClass('assignfeedback_editpdfplus_frame');
// inscription entete
this.get_div_cartridge_label(colorcartridge, divdisplay, true);
//creation input
var divconteneurdisplay = this.get_div_container(colorcartridge, divdisplay);
//if (!this.editor.get('readonly')) {
var buttonrender = "<button id='"
+ this.divcartridge
+ "_buttonpencil' class='btn btn-default' type='button'>";
buttonrender += '<i class="fa fa-eyedropper" aria-hidden="true"></i>';
buttonrender += "</button>";
//var buttonrenderdisplay = Y.Node.create(buttonrender);
//buttonrenderdisplay.on('click', this.display_picker, this);
var buttonadd = "<button id='"
+ this.divcartridge
+ "_buttonadd' class='btn btn-default' type='button'>";
buttonadd += '<i class="fa fa-plus" aria-hidden="true"></i>';
buttonadd += "</button>";
//var buttonadddisplay = Y.Node.create(buttonadd);
//buttonadddisplay.on('click', this.add_annot, this);
divconteneurdisplay.append(buttonrender);
divconteneurdisplay.append(buttonadd);
//}
//creation de la div d'edition
//if (!this.editor.get('readonly')) {
this.get_div_edition(divconteneurdisplay);
//} else {
//var divvisudisplay = this.get_div_visu(colorcartridge);
//divconteneurdisplay.append(divvisudisplay);
//}
//positionnement de la div par rapport a l'annotation
if (!this.cartridgex || this.cartridgex === 0) {
this.cartridgex = parseInt(this.tooltypefamille.cartridge_x, 10);
}
if (!this.cartridgey || this.cartridgey === 0) {
this.cartridgey = parseInt(this.tooltypefamille.cartridge_y, 10);
}
divdisplay.css('left', this.cartridgex + 15);
divdisplay.css('top', this.y + this.cartridgey);
this.apply_visibility_annot();
} else {
//divdisplay = this.editor.get_dialogue_element('#' + this.divcartridge);
//divdisplay.setX(offsetcanvas[0] + this.x + this.cartridgex);
//divdisplay.setY(offsetcanvas[1] + this.y + this.cartridgey);
}
}
return true;
};
return AnnotationFrame;
});
\ No newline at end of file
......@@ -41,35 +41,66 @@ define(['jquery', './annotation'],
if (canevas) {
var divHighlight = "<div id='" + this.id + "'></div>";
canevas.append(divHighlight);
$("#" + this.id).css('background-color', this.colour);
$("#" + this.id).css('background-color', this.get_color());
$("#" + this.id).css('width', this.endx - this.x);
$("#" + this.id).css('height', this.endy - this.y);
$("#" + this.id).css('opacity', .5);
$("#" + this.id).css('float', 'left');
$("#" + this.id).css('margin-top', this.x);
$("#" + this.id).css('margin-left', this.y);
$("#" + this.id).css('position', 'relative');
$("#" + this.id).css('display', 'inline-block');
$("#" + this.id).css('left', this.x);
$("#" + this.id).css('top', this.y);
}
this.draw_catridge(canevas);
/* shape = this.editor.graphic.addShape({
type: Y.Rect,
width: bounds.width,
height: bounds.height,
stroke: false,
fill: {
color: highlightcolour,
opacity: 0.5
},
x: bounds.x,
y: bounds.y
});*/
return;
};
/**
* Display cartridge and toolbox for the annotation
* @returns {Boolean} res
*/
AnnotationHighlightplus.prototype.draw_catridge = function (canevas) {
var divdisplay;
if (!this.divcartridge || this.divcartridge === '') {
this.init_div_cartridge_id();
/*drawable.shapes.push(shape);
this.drawable = drawable;*/
//init cartridge
var colorcartridge = this.get_color_cartridge();
divdisplay = this.get_div_cartridge(colorcartridge, canevas);
divdisplay.addClass('assignfeedback_editpdfplus_hightlightplus');
//divdisplay.css('display', 'inline-block');
//this.draw_catridge();
// inscription entete
/*var divcartridge = */this.get_div_cartridge_label(colorcartridge, divdisplay);
return;
//creation input
var divconteneurdisplay = this.get_div_container(colorcartridge, divdisplay);
//creation de la div d'edition
//if (!this.editor.get('readonly')) {
this.get_div_edition(divconteneurdisplay);
//} else {
//var divvisudisplay = this.get_div_visu(colorcartridge);
//divconteneurdisplay.append(divvisudisplay);
//}
//positionnement de la div par rapport a l'annotation
if (!this.cartridgex || this.cartridgex === 0) {
this.cartridgex = parseInt(this.tooltypefamille.cartridge_x, 10);
}
if (!this.cartridgey || this.cartridgey === 0) {
this.cartridgey = parseInt(this.tooltypefamille.cartridge_y, 10);
}
divdisplay.css('left', this.x + this.cartridgex + 17);
divdisplay.css('top', this.y + this.cartridgey);
this.apply_visibility_annot();
} else {
//divdisplay = this.editor.get_dialogue_element('#' + this.divcartridge);
//divdisplay.setX(offsetcanvas[0] + this.x + this.cartridgex);
//divdisplay.setY(offsetcanvas[1] + this.y + this.cartridgey);
}
return true;
};
return AnnotationHighlightplus;
......
......@@ -41,9 +41,9 @@ define(['jquery', './annotation'],
if (canevas) {
var divStamp = "<div id='" + this.id + "'></div>";
canevas.append(divStamp);
$("#" + this.id).css('position', 'absolue');
$("#" + this.id).css('margin-top', this.x);
$("#" + this.id).css('margin-left', this.y);
$("#" + this.id).css('position', 'relative');
$("#" + this.id).css('top', this.y);
$("#" + this.id).css('left', this.x);
$("#" + this.id).css('color', this.colour);
$("#" + this.id).css('border', '2px solid ' + this.colour);
$("#" + this.id).css('padding', '0 2px');
......
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/*
* @package assignfeedback_editpdfplus
* @copyright 2017 Université de Lausanne
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* @module mod_assignfeedback_editpdfplus/global
*/
define([],
function () {
/**
* Global class.
*
* @class Global
*/
function Global() {
// Return this object reference.
return(this);
}
Global.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)'
};
Global.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
};
Global.SELECTOR = {
DRAWINGCANVAS: '.drawingcanvas'
};
Global.CSS = {
DIALOGUE: 'assignfeedback_editpdfplus_widget'
};
return Global;
});
\ No newline at end of file
......@@ -33,3 +33,7 @@ $settings->add(new admin_setting_heading('pathtogs', get_string('pathtogs', 'adm
$url = new moodle_url('/mod/assign/feedback/editpdfplus/testgs.php');
$link = html_writer::link($url, get_string('testgs', 'assignfeedback_editpdfplus'));
$settings->add(new admin_setting_heading('testgs', '', $link));
//$settings->add(new admin_setting_configtext("unsetting", "le nom ici", "description", 50, PARAM_INT, 20));
//get_config("ass:::", "unsetting")
\ No newline at end of file
......@@ -353,6 +353,7 @@ ul.assignfeedback_editpdfplus_menu {
background-color: #fffeeb;
padding: 0;
line-height: normal;
display:inline-block;
}
.assignfeedback_editpdfplus_highlightplus_cartridge,
.assignfeedback_editpdfplus_frame_cartridge,
......
......@@ -136,7 +136,7 @@
<input id='map02' type='hidden' value='{{map02}}' />
<input id='map03' type='hidden' value='{{map03}}' />
<!--{{# pix }} cross, assignfeedback_editpdfplus, previsu {{/ pix }}-->
<div id="canevas" style="background-image: url('{{map01}}');background-repeat: no-repeat; border-width: 1px; border-style: solid; height: 330px;" >
<div id="canevas" style="background-image: url('{{map01}}');background-repeat: no-repeat; border-width: 1px; border-style: solid; height: 330px;" class="drawingcanvas">
</div>
</div>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment