Gitlab CSE Unil

Commit 38250c50 authored by M. Chardon's avatar M. Chardon
Browse files

correctif taille resize area verticalline annotation

parent e1bbcad8
......@@ -1642,7 +1642,7 @@ Y.extend(ANNOTATION, Y.Base, {
* @param {string} colorcartridge
* @return node
*/
get_div_resizearea: function (direction) {
get_div_resizearea: function (direction, minwidth, minheight) {
var plane = "horizontal";
if (direction === "up" || direction === "down") {
plane = "vertical";
......@@ -1652,9 +1652,15 @@ Y.extend(ANNOTATION, Y.Base, {
+ "class='assignfeedback_editpdfplus_resize assignfeedback_editpdfplus_resize_" + plane + "' ";
if (plane === "horizontal") {
var intery = Math.max(this.endy - this.y, 7);
if (minheight) {
intery = minheight;
}
div += "style='min-width:7px;min-height:" + intery + "px;' ";
} else {
var interx = Math.max(this.endx - this.x, 7);
if (minwidth) {
interx = minwidth;
}
div += "style='min-height:7px;min-width:" + interx + "px;' ";
}
div += "data-direction='" + direction + "' "
......@@ -1675,13 +1681,13 @@ Y.extend(ANNOTATION, Y.Base, {
* @param {int} x left position of the resize area
* @param {int} y top position of the resize area
*/
push_div_resizearea: function (direction, x, y) {
push_div_resizearea: function (direction, x, y, minwidth, minheight) {
var drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
var div = this.editor.get_dialogue_element('#' + this.divcartridge + "_resize_" + direction);
if (div) {
return;
}
var divresize = this.get_div_resizearea(direction);
var divresize = this.get_div_resizearea(direction, minwidth, minheight);
if (!divresize) {
return;
}
......@@ -3873,8 +3879,8 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
* Draw empty resize area on left and right
*/
draw_resizeAreas: function () {
this.push_div_resizearea('left', this.x - 2, this.y);
this.push_div_resizearea('right', this.endx - 2, this.y);
this.push_div_resizearea('left', this.x - this.marginDivResize, this.y);
this.push_div_resizearea('right', this.endx - this.marginDivResize, this.y);
},
/**
* Actions when resizing a shape:
......@@ -4228,11 +4234,23 @@ ANNOTATIONVERTICALLINE.ATTRS = {};
Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
/**
* Margin to let for resize area
* Margin to let for resize area on top and down
* @type Number
* @protected
*/
marginyDivResize: 2,
/**
* Margin to let for resize area on left and right
* @type Number
* @protected
*/
marginxDivResize: 7,
/**
* Min width for resize area
* @type Number
* @protected
*/
marginDivResize: 2,
minWidthDivResize: 15,
/**
* Draw a verticalline annotation
* @protected
......@@ -4412,8 +4430,8 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
* Draw empty resize area on top and down
*/
draw_resizeAreas: function () {
this.push_div_resizearea('up', this.x - 7, this.y - this.marginDivResize);
this.push_div_resizearea('down', this.x - 7, this.endy - this.marginDivResize);
this.push_div_resizearea('up', this.x - this.marginxDivResize, this.y - this.marginyDivResize, this.minWidthDivResize);
this.push_div_resizearea('down', this.x - this.marginxDivResize, this.endy - this.marginyDivResize, this.minWidthDivResize);
},
/**
* Actions when resizing a shape:
......@@ -4449,14 +4467,14 @@ Y.extend(ANNOTATIONVERTICALLINE, M.assignfeedback_editpdfplus.annotation, {
shape.moveTo(this.x, Math.min(newpointy, this.endy - this.minresizewidth));
shape.lineTo(this.x, this.endy);
shape.end();
divresize.setY(this.endy - height + decalage - this.marginDivResize);
divresize.setY(this.endy - height + decalage - this.marginyDivResize);
} else if (direction === 'down') {
height = Math.max(newpointy - this.y, this.minresizewidth);
shape.clear();
shape.moveTo(this.x, this.y);
shape.lineTo(this.x, this.y + height);
shape.end();
divresize.setY(this.y + height + decalage - this.marginDivResize);
divresize.setY(this.y + height + decalage - this.marginyDivResize);
}
},
/**
......
YUI.add("moodle-assignfeedback_editpdfplus-editor",function(e,t){var n=M.cfg.wwwroot+"/mod/assign/feedback/editpdfplus/ajax.php",r=M.cfg.wwwroot+"/mod/assign/feedback/editpdfplus/ajax_progress.php",i={DIALOGUE:"assignfeedback_editpdfplus_widget"},s={PREVIOUSBUTTON:".navigate-previous-button",NEXTBUTTON:" .navigate-next-button",PAGESELECT:".navigate-page-select",LOADINGICON:".loading",PROGRESSBARCONTAINER:".progress-info.progress-striped",DRAWINGREGION:".drawingregion",DRAWINGREGIONCLASS:"drawingregion",DRAWINGCANVAS:".drawingcanvas",DRAWINGTOOLBAR:"drawingtoolbar",SAVE:".savebutton",ANNOTATIONCOLOURBUTTON:".annotationcolourbutton",DELETEANNOTATIONBUTTON:".deleteannotationbutton",WARNINGMESSAGECONTAINER:".warningmessages",ICONMESSAGECONTAINER:".infoicon",UNSAVEDCHANGESDIV:".assignfeedback_editpdf_warningmessages",UNSAVEDCHANGESINPUT:'input[name="assignfeedback_editpdfplus_haschanges"]',UNSAVEDCHANGESDIVEDIT:".assignfeedback_editpdfplus_unsavedchanges_edit",HELPMESSAGETITLE:"#afppHelpmessageTitle",HELPMESSAGE:"#afppHelpmessageBody",USERINFOREGION:'[data-region="user-info"]',ROTATELEFTBUTTON:".rotateleftbutton",ROTATERIGHTBUTTON:".rotaterightbutton",DIALOGUE:"."+i.DIALOGUE,CUSTOMTOOLBARID:"#toolbaraxis",CUSTOMTOOLBARS:".customtoolbar",AXISCUSTOMTOOLBAR:".menuaxisselection",CUSTOMTOOLBARBUTTONS:".costumtoolbarbutton",GENERICTOOLBARBUTTONS:".generictoolbarbutton",HELPBTNCLASS:".helpmessage",STATUTSELECTOR:"#menustatutselection",QUESTIONSELECTOR:"#menuquestionselection",STUDENTVALIDATION:"#student_valide_button"},o="rgba(200, 200, 255, 0.9)",u="rgba(200, 200, 255, 0.5)",a={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)"},f=300,l={select:".selectbutton",drag:".dragbutton",resize:".resizebutton"},c={HIGHLIGHTPLUS:1,LINEPLUS:2,STAMPPLUS:3,FRAME:4,VERTICALLINE:5,STAMPCOMMENT:6,COMMENTPLUS:7,PEN:8,LINE:9,RECTANGLE:10,OVAL:11,HIGHLIGHT:12},h={HIGHLIGHTPLUS:"highlightplus",LINEPLUS:"lineplus",STAMPPLUS:"stampplus",FRAME:"frame",VERTICALLINE:"verticalline",STAMPCOMMENT:"stampcomment",COMMENTPLUS:"commentplus",PEN:"pen",LINE:"line",RECTANGLE:"rectangle",OVAL:"oval",HIGHLIGHT:"highlight"},p=2,d=function(e,t){this.x=parseInt(e,10),this.y=parseInt(t,10),this.clip=function(e){return this.x<e.x&&(this.x=e.x),this.x>e.x+e.width&&(this.x=e.x+e.width),this.y<e.y&&(this.y=e.y),this.y>e.y+e.height&&(this.y=e.y+e.height),this}};M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.point=d;var v=function(e,t,n,r){this.x=e,this.y=t,this.width=n,this.height=r,this.bound=function(e){var t=0,n=0,r=0,i=0,s=0,o;for(s=0;s<e.length;s++){o=e[s];if(o.x<t||s===0)t=o.x;if(o.x>n||s===0)n=o.x;if(o.y<r||s===0)r=o.y;if(o.y>i||s===0)i=o.y}return this.x=t,this.y=r,this.width=n-t,this.height=i-r,this},this.has_min_width=function(){return this.width>=5},this.has_min_height=function(){return this.height>=5},this.set_min_width=function(){this.width=5},this.set_min_height=function(){this.height=5}};M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.rect=v;var m=function(){this.start=!1,this.end=!1,this.starttime=0,this.annotationstart=!1,this.tool="drag",this.commentcolour="yellow",this.annotationcolour="red",this.path=[]};M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.edit=m;var g=function(e){this.editor=e,this.shapes=[],this.nodes=[],this.erase=function(){if(this.shapes)while(this.shapes.length>0)this.editor.graphic.removeShape(this.shapes.pop());if(this.nodes)while(this.nodes.length>0)this.nodes.pop().remove()},this.scroll_update=function(e,t){var n,r,i;for(n=0;n<this.nodes.length;n++)r=this.nodes[n].getData("x"),i=this.nodes[n].getData("y"),r!==undefined&&i!==undefined&&(this.nodes[n].setX(parseInt(r,10)-e),this.nodes[n].setY(parseInt(i,10)-t))},this.store_position=function(e,t,n){var r,i,o;r=this.editor.get_dialogue_element(s.DRAWINGREGION),i=parseInt(r.get("scrollLeft"),10),o=parseInt(r.get("scrollTop"),10),e.setData("x",t+i),e.setData("y",n+o)}};M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.drawable=g;var y=function(e){y.superclass.constructor.apply(this,[e])};y.NAME="annotation",y.ATTRS={},e.extend(y,e.Base,{editor:null,gradeid:0,pageno:0,x:0,y:0,endx:0,endy:0,path:"",toolid:0,colour:"red",drawable:!1,resizeAreas:[],tooltype:null,tooltypefamille:null,divcartridge:"",textannot:"",displaylock:1,displayrotation:0,borderstyle:"",parent_annot:0,parent_annot_element:null,id:0,shape_id:"",cartridgex:0,cartridgey:0,answerrequested:0,studentstatus:0,studentanswer:"",pdfdisplay:"footnote",minresizewidth:20,initializer:function(e){e.parent_annot_element?(this.editor=e.parent_annot_element.editor||null,this.gradeid=parseInt(e.parent_annot_element.gradeid,10)||0,this.pageno=parseInt(e.parent_annot_element.pageno,10)||0,this.cartridgex=parseInt(e.parent_annot_element.cartridgex,10)||0,this.cartridgey=parseInt(e.parent_annot_element.cartridgey,10)||0,this.colour=e.parent_annot_element.colour||"red",this.tooltype=e.tooltype,this.textannot=e.parent_annot_element.textannot,this.displaylock=parseInt(e.parent_annot_element.displaylock,10),this.displayrotation=e.parent_annot_element.displayrotation,this.borderstyle=e.parent_annot_element.borderstyle||"solid",this.parent_annot=parseInt(e.parent_annot_element.id,10),this.answerrequested=parseInt(e.parent_annot_element.answerrequested,10)||0,this.studentstatus=parseInt(e.parent_annot_element.studentstatus,10)||0,this.parent_annot_element=e.parent_annot_element):(this.editor=e.editor||null,this.gradeid=parseInt(e.gradeid,10)||0,this.pageno=parseInt(e.pageno,10)||0,this.cartridgex=parseInt(e.cartridgex,10)||0,this.cartridgey=parseInt(e.cartridgey,10)||0,this.colour=e.colour||"red",this.tooltype=e.tooltype,this.textannot=e.textannot,this.displaylock=parseInt(e.displaylock,10),this.displayrotation=e.displayrotation,this.borderstyle=
e.borderstyle||"solid",this.parent_annot=parseInt(e.parent_annot,10),this.answerrequested=parseInt(e.answerrequested,10)||0,this.studentstatus=parseInt(e.studentstatus,10)||0,this.studentanswer=e.studentanswer),this.id=e.id,this.x=parseInt(e.x,10)||0,this.y=parseInt(e.y,10)||0,this.endx=parseInt(e.endx,10)||0,this.endy=parseInt(e.endy,10)||0,this.path=e.path||"",this.toolid=e.toolid||this.editor.get_dialogue_element(c.RECTANGLE),this.drawable=!1,this.resizeAreas=[],this.pdfdisplay=e.pdfdisplay,this.tooltypefamille=this.editor.typetools[this.tooltype.type]},clean:function(){return this.parent_annot_element?{gradeid:this.gradeid,x:parseInt(this.x,10),y:parseInt(this.y,10),endx:parseInt(this.endx,10),endy:parseInt(this.endy,10),cartridgex:parseInt(this.cartridgex,10),cartridgey:parseInt(this.cartridgey,10),toolid:this.toolid,path:this.path,pageno:this.pageno,colour:this.colour,textannot:this.textannot,displaylock:parseInt(this.displaylock,10),displayrotation:parseInt(this.displayrotation,10),borderstyle:this.borderstyle,parent_annot:parseInt(this.parent_annot,10),divcartridge:this.divcartridge,parent_annot_div:this.parent_annot_element.divcartridge,pdfdisplay:this.pdfdisplay}:{gradeid:this.gradeid,x:parseInt(this.x,10),y:parseInt(this.y,10),endx:parseInt(this.endx,10),endy:parseInt(this.endy,10),cartridgex:parseInt(this.cartridgex,10),cartridgey:parseInt(this.cartridgey,10),toolid:this.toolid,path:this.path,pageno:this.pageno,colour:this.colour,textannot:this.textannot,displaylock:parseInt(this.displaylock,10),displayrotation:parseInt(this.displayrotation,10),borderstyle:this.borderstyle,parent_annot:parseInt(this.parent_annot,10),divcartridge:this.divcartridge,parent_annot_div:"",answerrequested:parseInt(this.answerrequested,10),studentstatus:parseInt(this.studentstatus,10),pdfdisplay:this.pdfdisplay}},light_clean:function(){return{id:this.id,studentstatus:parseInt(this.studentstatus,10),studentanswer:this.studentanswer}},draw_highlight:function(){var t,n=this.editor.get_dialogue_element(s.DRAWINGREGION),r=this.editor.get_dialogue_element(s.DRAWINGCANVAS).getXY(),i;if(this.editor.currentannotation===this){t=new M.assignfeedback_editpdfplus.rect,t.bound([new M.assignfeedback_editpdfplus.point(this.x-10,this.y-10),new M.assignfeedback_editpdfplus.point(this.endx+10,this.endy+10)]),i=this.editor.graphic.addShape({type:e.Rect,width:t.width,height:t.height,stroke:{weight:p,color:o},fill:{color:u},x:t.x,y:t.y}),this.drawable.shapes.push(i),i.editor=this.editor,i.on("clickoutside",e.rbind(this.editor.redraw_annotation,this.editor));var a=e.Node.create('<i class="fa fa-trash" aria-hidden="true"></i>'),f=e.Node.create('<a href="#" role="button"></a>');a.setAttrs({alt:M.util.get_string("deleteannotation","assignfeedback_editpdfplus")}),a.setStyles({backgroundColor:"white"}),f.addClass("deleteannotationbutton"),f.append(a),n.append(f),f.setData("annotation",this),f.setStyle("zIndex","200"),f.on("click",this.remove,this),f.on("key",this.remove,"space,enter",this),f.setX(r[0]+t.x+t.width-18),f.setY(r[1]+t.y+t.height-18),this.drawable.nodes.push(f)}return this.drawable},draw:function(){return this.draw_highlight(),this.drawable},get_color:function(){var e=a[this.colour];return e?(e=e.replace("rgb","rgba"),e=e.replace(")",",0.5)")):e=this.colour,e},get_color_cartridge:function(){var e=a[this.tooltype.cartridge_color];return e?(e=e.replace("rgb","rgba"),e=e.replace(")",",0.5)")):e=this.tooltype.cartridge_color,e===""?this.tooltypefamille.cartridge_color:e},init_div_cartridge_id:function(){var e=(new Date).toJSON().replace(/:/g,"").replace(/\./g,"");this.divcartridge="ct_"+this.tooltype.id+"_"+e},init_shape_id:function(e){if(!this.shape_id){var t=new Date,n=t.getTime();this.shape_id="ct_"+e+"_"+n}return this.shape_id},get_div_cartridge:function(t){var n="<div ";n+="id='"+this.divcartridge+"' ",n+="class='assignfeedback_editpdfplus_cartridge' ",n+="style='border-color: "+t+";'> ",n+="</div>";var r=e.Node.create(n);return this.editor.get("readonly")&&r.on("click",this.view_annot,this),r},get_div_cartridge_label:function(t,n){var r="<div ";r+="id='"+this.divcartridge+"_cartridge' ",r+="class='assignfeedback_editpdfplus_"+this.tooltypefamille.label+"_cartridge' ",this.editor.get("readonly")&&this.get_valref()===""?r+="style='border-right:none;padding-right:0px;color:"+t+";' ":r+="style='border-right-color: "+t+";color:"+t+";' ",r+="> ",r+=this.tooltype.cartridge,r+="</div>";var i=e.Node.create(r);return n&&!this.editor.get("readonly")?(i.on("mousedown",this.move_cartridge_begin,this),i):i},get_div_input:function(t){var n="<div ";n+="id='"+this.divcartridge+"_display' ",n+="style='color:"+t+"; ",this.editor.get("readonly")&&this.get_valref()===""&&(n+="padding:0px;"),n+="'></div>";var r=e.Node.create(n);return this.editor.get("readonly")||r.on("click",this.edit_annot,this),r},get_div_edition:function(){var t="<div ";t+="id='"+this.divcartridge+"_edit' ",t+="class='assignfeedback_editpdfplus_"+this.tooltypefamille.label+"_edition' ",t+="style='display:none;'> ",t+="<textarea id='"+this.divcartridge+"_editinput' type='text' value=\""+this.get_valref()+"\" class='form-control' style='margin-bottom:5px;' >"+this.get_valref()+"</textarea>",t+="</div>";var n=e.Node.create(t),r=this.tooltype.texts;if(r&&r.length>0){var i="<div class='btn-group-vertical aepp-toolbar-vertical'></div>",s=e.Node.create(i),o=r.split('","');for(var u=0;u<o.length;u++){var a="<button class='btn btn-outline-dark' type='button'>"+o[u].replace('"',"")+"</button>",f=e.Node.create(a);f.on("click",this.fill_input_edition,this,o[u].replace('"',"")),s.append(f),s.append("<br/>")}n.append(s)}return n},get_div_visu:function(t){var n="<div ";n+="id='"+this.divcartridge+"_visu' ",n+="class='assignfeedback_editpdfplus_"+this.tooltypefamille.label+"_visu' ",n+="style='display:none;color:"+t+";'> ",n+=this.get_valref().replace(/\n/g,"<br/>"),n+="</div>";var r=e.Node.create(n);if(this.answerrequested===1){var i=e.Node.create("<div></div>"),s=e.Node.create("<hr style='margin-bottom:0px;'/>"
),o=e.Node.create("<label style='display:inline;'>"+M.util.get_string("student_answer_lib","assignfeedback_editpdfplus")+"</label>"),u="";this.studentanswer&&this.studentanswer!=="0"&&this.studentanswer!=="1"&&(u=this.studentanswer);var a=e.Node.create("<br/><textarea id='"+this.divcartridge+"_studentanswer' type='text' value=\""+u+"\" class='form-control'>"+u+"</textarea>");u=this.studentanswer;var f="<button id='"+this.divcartridge+"_buttonsavestudentanswer' style='margin-left:110px;' class='btn' type='button'>"+"<i class='fa fa-floppy-o' aria-hidden='true'></i>"+"</button>",l=e.Node.create(f);l.on("click",this.save_studentanswer,this,null),i.append(s),i.append(o),i.append(l),i.append(a),r.append(i)}return r},get_div_container:function(t){var n="<div ";n+="class='assignfeedback_editpdfplus_"+this.tooltypefamille.label+"_conteneur' >",n+="</div>";var r=e.Node.create(n),i=this.get_div_input(t);i.addClass("assignfeedback_editpdfplus_"+this.tooltypefamille.label+"_input");var s=1;if(this.displaylock||this.displaylock>=0)s=this.displaylock;var o=e.Node.create("<input type='hidden' id='"+this.divcartridge+"_onof' value="+s+" />"),u=this.editor.get("readonly");return u||i.on("click",this.edit_annot,this),r.append(i),r.append(o),r.append(this.get_input_question()),r.append(this.get_input_pdfdisplay()),r},get_toolbar:function(){var t="<div id='"+this.divcartridge+"_toolbar' class='btn-group btn-group-sm aepp-toolbar'></div>",n=e.Node.create(t),r=this.editor.get("readonly");return r?n.append(this.get_button_student_status()):(n.append(this.get_button_visibility_left()),n.append(this.get_button_visibility_right()),n.append(this.get_button_save()),n.append(this.get_button_cancel()),this.tooltype.reply===1&&n.append(this.get_button_question()),n.append(this.get_button_pdfdisplay()),n.append(this.get_button_remove())),n},get_button_student_status:function(){var t='<label style="padding-left:20px;" class="radio-inline"><input type="radio" name="'+this.divcartridge+'_status" value=0 >'+M.util.get_string("student_statut_nc","assignfeedback_editpdfplus")+"</label>",n='<label class="radio-inline"><input type="radio" name="'+this.divcartridge+'_status" value=1 >'+'<i style="color:green;" class="fa fa-check" aria-hidden="true"></i>'+"</label>",r='<label class="radio-inline"><input type="radio" name="'+this.divcartridge+'_status" value=2 >'+'<i style="color:red;" class="fa fa-times" aria-hidden="true"></i>'+"</label> ",i=e.Node.create(t),s=e.Node.create(n),o=e.Node.create(r);i.on("click",this.change_status,this,0),s.on("click",this.change_status,this,1),o.on("click",this.change_status,this,2);var u=e.Node.create("<div id='"+this.divcartridge+"_radioContainer' style='display:inline;'></div>");return u.append(i),u.append(s),u.append(o),u},get_button_visibility_right:function(){var t="<button id='"+this.divcartridge+"_buttonedit_right' class='btn btn-sm btn-outline-dark' type='button'>";t+="<i class='fa fa-arrow-right' aria-hidden='true'></i>",t+="</button>";var n=e.Node.create(t);return n.on("click",this.change_visibility_annot,this,"r"),n},get_button_visibility_left:function(){var t="<button id='"+this.divcartridge+"_buttonedit_left' class='btn btn-sm btn-outline-dark' type='button'>";t+="<i class='fa fa-arrow-left' aria-hidden='true'></i>",t+="</button>";var n=e.Node.create(t);return n.on("click",this.change_visibility_annot,this,"l"),n},get_button_save:function(){var t="<button id='"+this.divcartridge+"_buttonsave' style='display:none;margin-left:110px;' class='btn btn-sm btn-outline-dark' type='button'>"+"<i class='fa fa-check' aria-hidden='true'></i>"+"</button>",n=e.Node.create(t);return n.on("click",this.save_annot,this,null),n},get_button_cancel:function(){var t="<button id='"+this.divcartridge+"_buttoncancel' style='display:none;' class='btn btn-sm btn-outline-dark' type='button'>"+"<i class='fa fa-undo' aria-hidden='true'></i>"+"</button>",n=e.Node.create(t);return n.on("click",this.cancel_edit,this),n},get_button_question:function(){var t="<button id='"+this.divcartridge+"_buttonquestion' style='display:none;margin-left:10px;' class='btn btn-sm btn-outline-dark' 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>",n=e.Node.create(t);return n.on("click",this.change_question_status,this),n},get_button_remove:function(){var t="<button id='"+this.divcartridge+"_buttonremove' style='display:none;margin-left:10px;' class='btn btn-sm btn-outline-dark' type='button'>"+"<i class='fa fa-trash' aria-hidden='true'></i>"+"</button>",n=e.Node.create(t);return n.on("click",this.remove_by_trash,this),n},get_button_pdfdisplay:function(){var t="<button id='"+this.divcartridge+"_buttonpdfdisplay' style='display:none;margin-left:10px;' class='btn btn-sm btn-outline-dark' type='button'>"+"<i class='fa fa-file-pdf-o' aria-hidden='true'></i>&nbsp;"+"<i class='fa fa-arrow-circle-o-down' aria-hidden='true'></i>"+"</button>",n=e.Node.create(t);return n.on("click",this.change_pdf_display,this),n},get_input_question:function(){var t=0;return this.answerrequested&&this.answerrequested===1&&(t=1),e.Node.create("<input type='hidden' id='"+this.divcartridge+"_question' value='"+t+"'/>")},get_input_pdfdisplay:function(){return e.Node.create("<input type='hidden' id='"+this.divcartridge+"_pdfdisplay' value='"+this.pdfdisplay+"'/>")},get_valref:function(){return this.textannot&&this.textannot.length>0&&typeof this.textannot=="string"?this.textannot:""},get_input_valref:function(){return e.Node.create("<input type='hidden' id='"+this.divcartridge+"_valref' value=\""+this.get_valref()+'"/>')},apply_visibility_annot:function(){var e=this.editor.get_dialogue_element("#"+this.divcartridge+"_display"),t=this.editor.get_dialogue_element("#"+this.divcartridge+"_onof"),n=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit_right"),r=this.editor.get_dialogue_element("#"+this
.divcartridge+"_buttonedit_left"),i=this.editor.get_dialogue_element("#"+this.divcartridge+"_radioContainer");t&&(t.get("value")==="1"?(n&&n.show(),r&&r.show()):t.get("value")==="0"?(n&&n.show(),r&&r.hide()):(n&&n.hide(),r&&r.show())),e&&e.setContent(this.get_text_to_diplay_in_cartridge()),this.tooltypefamille.label==="frame"&&n&&(n.hide(),r.hide()),i&&i.hide(),this.apply_question_status(),this.apply_pdfdisplay()},get_text_to_diplay_in_cartridge:function(){var e=this.get_valref(),t=this.editor.get_dialogue_element("#"+this.divcartridge+"_onof"),n="";return e===""&&!this.editor.get("readonly")&&(n="&nbsp;&nbsp;&nbsp;&nbsp"),t.get("value")==="1"&&e!==""?n=e.substr(0,20):t.get("value")==="0"&&e!==""?n="...":e!==""&&(n=e),this.answerrequested===1&&(n+='&nbsp;<span style="color:red;">[?]</span>'),n},change_visibility_annot:function(e,t){var n=this.editor.get_dialogue_element("#"+this.divcartridge+"_onof"),r=parseInt(n.get("value"),10);t==="r"?r+=1:r-=1,n.set("value",r),this.displaylock=r,this.apply_visibility_annot(),this.editor.save_current_page()},change_pdf_display:function(){var e=this.editor.get_dialogue_element("#"+this.divcartridge+"_pdfdisplay"),t=e.get("value");t==="footnote"?(e.set("value","inline"),this.pdfdisplay="inline"):(e.set("value","footnote"),this.pdfdisplay="footnote"),this.apply_pdfdisplay(),this.editor.save_current_page()},change_question_status:function(){var e=this.editor.get_dialogue_element("#"+this.divcartridge+"_question"),t=parseInt(e.get("value"),10),n=0;t===0&&(n=1),e.set("value",n),this.answerrequested=n,this.apply_question_status(),this.editor.save_current_page()},change_status:function(e,t){this.studentstatus=t;var n=this.editor.get_dialogue_element("#"+this.divcartridge+"_studentanswer");n&&(this.studentanswer=n.get("value"));var r=this.editor.annotationsparent[this.id];if(r)for(var i=0;i<r.length;i++)r[i].studentstatus=t;this.editor.save_current_page_edited(),this.hide_edit()},apply_question_status:function(){var e=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonquestion"),t=this.editor.get_dialogue_element("#"+this.divcartridge+"_question"),n=0;t&&(n=parseInt(t.get("value"),10)),e&&(n===1?e.setHTML('<i class="fa fa-question-circle-o"></i>'):e.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>'));return},apply_pdfdisplay:function(){var e=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonpdfdisplay"),t=this.editor.get_dialogue_element("#"+this.divcartridge+"_pdfdisplay"),n=t.get("value");e&&(n==="footnote"?e.setHTML("<i class='fa fa-file-pdf-o' aria-hidden='true'></i>&nbsp;<i class='fa fa-arrow-circle-o-down' aria-hidden='true'></i>"):e.setHTML("<i class='fa fa-file-pdf-o' aria-hidden='true'></i>&nbsp;<i class='fa fa-arrow-circle-o-right' aria-hidden='true'></i>"));return},move_cartridge_begin:function(e){e.preventDefault();var t=this.editor.get_dialogue_element(s.DRAWINGCANVAS),n=new M.assignfeedback_editpdfplus.point(e.clientX+t.get("docScrollX"),e.clientY+t.get("docScrollY")),r=this.editor.get_canvas_coordinates(n);this.oldx=r.x,this.oldy=r.y,t.on("mousemove",this.move_cartridge_continue,this),t.on("mouseup",this.move_cartridge_stop,this)},move_cartridge_continue:function(e){e.preventDefault();var t=this.editor.get_dialogue_element(s.DRAWINGCANVAS),n=new M.assignfeedback_editpdfplus.point(e.clientX+t.get("docScrollX"),e.clientY+t.get("docScrollY")),r=this.editor.get_canvas_coordinates(n),i=this.editor.get_dialogue_element(s.DRAWINGCANVAS).getXY(),o=r.x-this.oldx,u=r.y-this.oldy,a=this.editor.get_dialogue_element("#"+this.divcartridge);a.setX(i[0]+this.x+this.cartridgex+o),a.setY(i[1]+this.y+this.cartridgey+u)},move_cartridge_stop:function(e){e.preventDefault();var t=this.editor.get_dialogue_element(s.DRAWINGCANVAS);t.detach("mousemove",this.move_cartridge_continue,this),t.detach("mouseup",this.move_cartridge_stop,this);var n=new M.assignfeedback_editpdfplus.point(e.clientX+t.get("docScrollX"),e.clientY+t.get("docScrollY")),r=this.editor.get_canvas_coordinates(n),i=this.editor.get_dialogue_element(s.DRAWINGCANVAS).getXY(),o=r.x-this.oldx,u=r.y-this.oldy;this.cartridgex+=o,this.cartridgey+=u;var a=this.editor.get_dialogue_element("#"+this.divcartridge);a.setX(i[0]+this.x+this.cartridgex),a.setY(i[1]+this.y+this.cartridgey),this.editor.save_current_page()},draw_catridge:function(){return!0},replacement_cartridge:function(){return!0},draw_resizeAreas:function(){return!0},get_div_resizearea:function(t){var n="horizontal";if(t==="up"||t==="down")n="vertical";var r="<div id='"+this.divcartridge+"_resize_"+t+"' "+"class='assignfeedback_editpdfplus_resize assignfeedback_editpdfplus_resize_"+n+"' ";if(n==="horizontal"){var i=Math.max(this.endy-this.y,7);r+="style='min-width:7px;min-height:"+i+"px;' "}else{var s=Math.max(this.endx-this.x,7);r+="style='min-height:7px;min-width:"+s+"px;' "}return r+="data-direction='"+t+"' "+"> "+"</div>",e.Node.create(r)},remove_resizearea:function(){var t=e.all(".assignfeedback_editpdfplus_resize");t.remove()},push_div_resizearea:function(e,t,n){var r=this.editor.get_dialogue_element(s.DRAWINGCANVAS),i=this.editor.get_dialogue_element("#"+this.divcartridge+"_resize_"+e);if(i)return;var o=this.get_div_resizearea(e);if(!o)return;o.setX(t),o.setY(n),r.append(o),this.resizeAreas.push(o)},mousemoveResize:function(){return!0},mouseupResize:function(e,t){var n=this.editor.get_dialogue_element(s.DRAWINGCANVAS),r=n.getXY(),i=t.getData("direction");i==="right"?this.endx=e.clientX+n.get("docScrollX")-r[0]:i==="left"?this.x=e.clientX+n.get("docScrollX")-r[0]:i==="up"?this.y=e.clientY+n.get("docScrollY")-r[1]:i==="down"&&(this.endy=e.clientY+n.get("docScrollY")-r[1]),this.replacement_cartridge()},view_annot:function(t,n){if(!n||n!=="click"||this.editor.currentannotationreview!==this){this.editor.currentannotationreview=this;if(this.tooltype.type<=c.COMMENTPLUS&&!this.parent_annot_element){
var r=this.editor.get_dialogue_element("#"+this.divcartridge),i=this.editor.get_dialogue_element("#"+this.divcartridge+"_display"),s=this.editor.get_dialogue_element("#"+this.divcartridge+"_visu"),o=this.editor.get_dialogue_element("#"+this.divcartridge+"_radioContainer"),u=e.all("[name="+this.divcartridge+"_status]");i.hide(),s.show();if(this.answerrequested===1){var a=this.editor.get_dialogue_element("#"+this.divcartridge+"_studentanswer");a&&a.set(this.studentanswer)}for(var f=0;f<u.size();f++){var l=u.item(f);parseInt(l.get("value"),10)===this.studentstatus?l.set("checked",!0):l.set("checked",!1)}o.show(),o.set("style","display:inline;color:"+this.get_color_cartridge()+";"),r.setStyle("z-index",1e3),this.disabled_canvas_event(),r.detach(),r.on("clickoutside",this.hide_edit,this,"clickoutside")}}else this.editor.currentannotationreview=null},edit_annot:function(){if(this.tooltype.type<=c.COMMENTPLUS&&!this.parent_annot_element){var e=this.editor.get_dialogue_element("#"+this.divcartridge),t=this.editor.get_dialogue_element("#"+this.divcartridge+"_display");if(!t)return;var n=this.editor.get_dialogue_element("#"+this.divcartridge+"_edit"),r=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit_right"),i=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit_left"),s=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonsave"),o=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttoncancel"),u=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonquestion"),a=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonrotation"),f=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonpdfdisplay"),l=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonremove"),h=this.editor.get_dialogue_element("#"+this.divcartridge+"_editinput");t.hide(),r&&r.hide(),i&&i.hide(),a&&a.hide(),n.show(),s.show(),o.show(),u&&u.show(),f.show(),l.show(),e.setStyle("z-index",1e3),h&&h.set("focus","on"),this.disabled_canvas_event(),e.on("clickoutside",this.save_annot_clickout,this,"clickoutside")}},fill_input_edition:function(e,t){var n=this.editor.get_dialogue_element("#"+this.divcartridge+"_editinput");n&&n.set("value",t),this.save_annot(t)},save_annot_clickout:function(e,t){(t!=="clickoutside"||this.editor.currentannotation!==this)&&this.save_annot(null);return},save_annot:function(e){if(typeof e!="string"){var t=this.editor.get_dialogue_element("#"+this.divcartridge+"_editinput");t&&(e=t.get("value"))}this.textannot=e,this.editor.save_current_page(),e.length===0&&(e="&nbsp;&nbsp;"),this.hide_edit(),this.apply_visibility_annot()},save_studentanswer:function(){var e=this.editor.get_dialogue_element("#"+this.divcartridge+"_studentanswer");e&&(this.studentanswer=e.get("value"),this.editor.save_current_page_edited()),this.hide_edit(),this.apply_visibility_annot()},cancel_edit:function(e,t){if(t!=="clickoutside"||this.editor.currentannotation!==this){var n=this.get_valref(),r=this.editor.get_dialogue_element("#"+this.divcartridge+"_editinput");n&&r&&r.set("value",n),this.hide_edit(),this.apply_visibility_annot();var i=this.editor.get_dialogue_element("#"+this.divcartridge);i&&i.detach()}return},hide_edit:function(e,t){if(!t||t!=="clickoutside"||this.editor.currentannotation!==this){var n=this.editor.get_dialogue_element("#"+this.divcartridge),r=this.editor.get_dialogue_element("#"+this.divcartridge+"_display"),i=this.editor.get_dialogue_element("#"+this.divcartridge+"_edit"),s=this.editor.get_dialogue_element("#"+this.divcartridge+"_visu"),o=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonsave"),u=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttoncancel"),a=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonquestion"),f=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonrotation"),l=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonpdfdisplay"),c=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonremove"),h=this.editor.get_dialogue_element("#"+this.divcartridge+"_radioContainer");r&&(r.show(),r.set("style","display:inline;color:"+this.get_color_cartridge()+";")),f&&f.show(),i&&(i.hide(),o.hide(),u.hide()),s&&s.hide(),a&&a.hide(),l&&l.hide(),c&&c.hide(),n&&(n.setStyle("z-index",1),n.detach(),this.editor.get("readonly")&&n.on("click",this.view_annot,this,"click")),i&&this.enabled_canvas_event(),h&&h.hide()}},remove_by_trash:function(e){this.cancel_edit(),this.remove(e)},remove:function(e){var t,n;e.preventDefault(),t=this.editor.pages[this.editor.currentpage].annotations;for(n=0;n<t.length;n++)if(t[n]===this){t.splice(n,1),this.drawable&&this.drawable.erase(),this.editor.currentannotation=!1,this.editor.save_current_page();return}},move:function(t,n){var r=t-this.x,i=n-this.y,s,o,u,a,f;this.x+=r,this.y+=i,this.endx+=r,this.endy+=i,this.path&&(s=[],o=this.path.split(":"),e.each(o,function(e){u=e.split(","),a=parseInt(u[0],10),f=parseInt(u[1],10),s.push(a+r+","+(f+i))}),this.path=s.join(":")),this.drawable&&this.drawable.erase(),this.editor.drawables.push(this.draw()),this.remove_resizearea(),this.draw_resizeAreas()},draw_current_edit:function(e){var t=e&&!1;return t},init_from_edit:function(e){var t=new M.assignfeedback_editpdfplus.rect;return t.bound([e.start,e.end]),this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=t.x,this.y=t.y,this.endx=t.x+t.width,this.endy=t.y+t.height,this.colour=e.annotationcolour,this.path="",t.has_min_width()&&t.has_min_height()},disabled_canvas_event:function(){var e=this.editor.get_dialogue_element(s.DRAWINGCANVAS);e.detach()},enabled_canvas_event:function(){var e=this.editor.get_dialogue_element(s.DRAWINGCANVAS);e.on("gesturemovestart",this.editor.edit_start,null,this.editor),e.on("gesturemove",this.editor.edit_move,null,this.editor),e.on("gesturemoveend",this.editor.edit_end,null,this.editor)}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotation=y;var b=function(
e){b.superclass.constructor.apply(this,[e])};b.NAME="annotationline",b.ATTRS={},e.extend(b,M.assignfeedback_editpdfplus.annotation,{draw:function(){var t,n;return t=new M.assignfeedback_editpdfplus.drawable(this.editor),n=this.editor.graphic.addShape({type:e.Path,fill:!1,stroke:{weight:p,color:a[this.colour]}}),n.moveTo(this.x,this.y),n.lineTo(this.endx,this.endy),n.end(),t.shapes.push(n),this.drawable=t,b.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdfplus.drawable(this.editor),r;return r=this.editor.graphic.addShape({type:e.Path,fill:!1,stroke:{weight:p,color:a[t.annotationcolour]}}),r.moveTo(t.start.x,t.start.y),r.lineTo(t.end.x,t.end.y),r.end(),n.shapes.push(r),n},init_from_edit:function(e){return this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=e.start.x,this.y=e.start.y,this.endx=e.end.x,this.endy=e.end.y,this.colour=e.annotationcolour,this.path="",this.endx-this.x!==0||this.endy-this.y!==0}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotationline=b;var w=function(e){w.superclass.constructor.apply(this,[e])};w.NAME="annotationrectangle",w.ATTRS={},e.extend(w,M.assignfeedback_editpdfplus.annotation,{draw:function(){var t,n,r;return t=new M.assignfeedback_editpdfplus.drawable(this.editor),n=new M.assignfeedback_editpdfplus.rect,n.bound([new M.assignfeedback_editpdfplus.point(this.x,this.y),new M.assignfeedback_editpdfplus.point(this.endx,this.endy)]),r=this.editor.graphic.addShape({type:e.Rect,width:n.width,height:n.height,stroke:{weight:p,color:a[this.colour]},x:n.x,y:n.y}),t.shapes.push(r),this.drawable=t,w.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdfplus.drawable(this.editor),r,i;return i=new M.assignfeedback_editpdfplus.rect,i.bound([new M.assignfeedback_editpdfplus.point(t.start.x,t.start.y),new M.assignfeedback_editpdfplus.point(t.end.x,t.end.y)]),i.has_min_width()||i.set_min_width(),i.has_min_height()||i.set_min_height(),r=this.editor.graphic.addShape({type:e.Rect,width:i.width,height:i.height,stroke:{weight:p,color:a[t.annotationcolour]},x:i.x,y:i.y}),n.shapes.push(r),n}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotationrectangle=w;var E=function(e){E.superclass.constructor.apply(this,[e])};E.NAME="annotationoval",E.ATTRS={},e.extend(E,M.assignfeedback_editpdfplus.annotation,{draw:function(){var t,n,r;return t=new M.assignfeedback_editpdfplus.drawable(this.editor),n=new M.assignfeedback_editpdfplus.rect,n.bound([new M.assignfeedback_editpdfplus.point(this.x,this.y),new M.assignfeedback_editpdfplus.point(this.endx,this.endy)]),r=this.editor.graphic.addShape({type:e.Ellipse,width:n.width,height:n.height,stroke:{weight:p,color:a[this.colour]},x:n.x,y:n.y}),t.shapes.push(r),this.drawable=t,E.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdfplus.drawable(this.editor),r,i;return i=new M.assignfeedback_editpdfplus.rect,i.bound([new M.assignfeedback_editpdfplus.point(t.start.x,t.start.y),new M.assignfeedback_editpdfplus.point(t.end.x,t.end.y)]),i.has_min_width()||i.set_min_width(),i.has_min_height()||i.set_min_height(),r=this.editor.graphic.addShape({type:e.Ellipse,width:i.width,height:i.height,stroke:{weight:p,color:a[t.annotationcolour]},x:i.x,y:i.y}),n.shapes.push(r),n}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotationoval=E;var S=function(e){S.superclass.constructor.apply(this,[e])};S.NAME="annotationpen",S.ATTRS={},e.extend(S,M.assignfeedback_editpdfplus.annotation,{draw:function(){var t,n,r,i,s;return t=new M.assignfeedback_editpdfplus.drawable(this.editor),n=this.editor.graphic.addShape({type:e.Path,fill:!1,stroke:{weight:p,color:a[this.colour]}}),r=!0,i=this.path.split(":"),e.each(i,function(e){s=e.split(","),r?(n.moveTo(s[0],s[1]),r=!1):n.lineTo(s[0],s[1])},this),n.end(),t.shapes.push(n),this.drawable=t,S.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdfplus.drawable(this.editor),r,i;return r=this.editor.graphic.addShape({type:e.Path,fill:!1,stroke:{weight:p,color:a[t.annotationcolour]}}),i=!0,e.each(t.path,function(e){i?(r.moveTo(e.x,e.y),i=!1):r.lineTo(e.x,e.y)},this),r.end(),n.shapes.push(r),n},init_from_edit:function(e){var t=new M.assignfeedback_editpdfplus.rect,n=[],r=0;t.bound(e.path);for(r=0;r<e.path.length;r++)n.push(parseInt(e.path[r].x,10)+","+parseInt(e.path[r].y,10));return this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=t.x,this.y=t.y,this.endx=t.x+t.width,this.endy=t.y+t.height,this.colour=e.annotationcolour,this.path=n.join(":"),t.has_min_width()||t.has_min_height()}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotationpen=S;var x=function(e){x.superclass.constructor.apply(this,[e])};x.NAME="annotationhighlight",x.ATTRS={},e.extend(x,M.assignfeedback_editpdfplus.annotation,{draw:function(){var t,n,r,i;return t=new M.assignfeedback_editpdfplus.drawable(this.editor),r=new M.assignfeedback_editpdfplus.rect,r.bound([new M.assignfeedback_editpdfplus.point(this.x,this.y),new M.assignfeedback_editpdfplus.point(this.endx,this.endy)]),i=a[this.colour],i=i.replace("rgb","rgba"),i=i.replace(")",",0.5)"),n=this.editor.graphic.addShape({type:e.Rect,width:r.width,height:r.height,stroke:!1,fill:{color:i},x:r.x,y:r.y}),t.shapes.push(n),this.drawable=t,x.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdfplus.drawable(this.editor),r,i,s;return i=new M.assignfeedback_editpdfplus.rect,i.bound([new M.assignfeedback_editpdfplus.point(t.start.x,t.start.y),new M.assignfeedback_editpdfplus.point(t.end.x,t.end.y)]),i.has_min_width()||i.set_min_width(),s=a[t.annotationcolour],s=s.replace("rgb","rgba"),s=s.replace(")",",0.5)"),r=this.editor.graphic.addShape({type:e.Rect,width:i.width,height:20,
stroke:!1,fill:{color:s},x:i.x,y:t.start.y-10}),n.shapes.push(r),n},init_from_edit:function(e){var t=new M.assignfeedback_editpdfplus.rect;return t.bound([e.start,e.end]),this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=t.x,this.y=e.start.y,this.endx=t.x+t.width,this.endy=e.start.y+16,this.colour=e.annotationcolour,this.page="",t.has_min_width()}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotationhighlight=x;var T=function(e){T.superclass.constructor.apply(this,[e])};T.NAME="annotationhighlightplus",T.ATTRS={},e.extend(T,M.assignfeedback_editpdfplus.annotation,{marginDivResize:4,draw:function(){var t,n,r,i;return i=this.get_color(),this.init_shape_id("hightlightplus"),t=new M.assignfeedback_editpdfplus.drawable(this.editor),r=new M.assignfeedback_editpdfplus.rect,r.bound([new M.assignfeedback_editpdfplus.point(this.x,this.y),new M.assignfeedback_editpdfplus.point(this.endx,this.endy)]),n=this.editor.graphic.addShape({id:this.shape_id,type:e.Rect,width:r.width,height:r.height,stroke:!1,fill:{color:i,opacity:.5},x:r.x,y:r.y}),t.shapes.push(n),this.drawable=t,this.draw_catridge(),this.draw_resizeAreas(),T.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdfplus.drawable(this.editor),r,i,s;return i=new M.assignfeedback_editpdfplus.rect,i.bound([new M.assignfeedback_editpdfplus.point(t.start.x,t.start.y),new M.assignfeedback_editpdfplus.point(t.end.x,t.end.y)]),i.has_min_width()||i.set_min_width(),s=this.get_color(),r=this.editor.graphic.addShape({type:e.Rect,width:i.width,height:16,stroke:!1,fill:{color:s,opacity:.5},x:i.x,y:t.start.y-8}),n.shapes.push(r),n},init_from_edit:function(e){var t=new M.assignfeedback_editpdfplus.rect;return t.bound([e.start,e.end]),this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=t.x,this.y=e.start.y-8,this.endx=t.x+t.width,this.endy=e.start.y+16-8,this.page="",t.has_min_width()},draw_catridge:function(){var e;if(this.divcartridge===""){this.init_div_cartridge_id();var t=this.editor.get_dialogue_element(s.DRAWINGCANVAS),n=this.get_color_cartridge();e=this.get_div_cartridge(n),e.addClass("assignfeedback_editpdfplus_hightlightplus");var r=this.get_div_cartridge_label(n);e.append(r);var i=this.get_div_container(n),o=this.get_toolbar();i.append(o),e.append(i);if(!this.editor.get("readonly")){var u=this.get_div_edition();i.append(u)}else{var a=this.get_div_visu(n);i.append(a)}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);e.setX(this.x+this.cartridgex),e.setY(this.y+this.cartridgey),t.append(e),this.apply_visibility_annot()}else this.replacement_cartridge();return!0},replacement_cartridge:function(){var e=this.editor.get_dialogue_element(s.DRAWINGCANVAS).getXY(),t=this.editor.get_dialogue_element("#"+this.divcartridge);t&&(t.setX(e[0]+this.x+this.cartridgex),t.setY(e[1]+this.y+this.cartridgey))},draw_resizeAreas:function(){this.push_div_resizearea("left",this.x-this.marginDivResize,this.y),this.push_div_resizearea("right",this.endx-this.marginDivResize,this.y)},mousemoveResize:function(e,t,n){if(this.drawable.shapes.length===0)return;var r=this.drawable.shapes[0];if(!r)return;var i=n.getData("direction"),s=this.minresizewidth,o=this.editor.get_canvas_bounds(),u=t.x;u<0?u=0:o.width<u&&(u=o.width);var a=o.x;i==="right"?(s=Math.max(u-this.x,this.minresizewidth),r.set("width",s),n.setX(this.x+s+a-this.marginDivResize)):i==="left"&&(s=Math.max(this.endx-u,this.minresizewidth),r.set("x",Math.min(u,this.endx-this.minresizewidth)),r.set("width",s),n.setX(this.endx-s+a-this.marginDivResize))},remove:function(e){var t,n;e.preventDefault(),t=this.editor.pages[this.editor.currentpage].annotations;for(n=0;n<t.length;n++)if(t[n]===this){if(this.divcartridge!==""){var r=this.editor.get_dialogue_element("#"+this.divcartridge);r.remove()}this.remove_resizearea(),t.splice(n,1),this.drawable&&this.drawable.erase(),this.editor.currentannotation=!1,this.editor.save_current_page();return}}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotationhighlightplus=T;var N=function(e){N.superclass.constructor.apply(this,[e])};N.NAME="annotationstampplus",N.ATTRS={},e.extend(N,M.assignfeedback_editpdfplus.annotation,{draw:function(){var t=new M.assignfeedback_editpdfplus.drawable(this.editor),n=this.editor.get_dialogue_element(s.DRAWINGCANVAS),r,i;return i=this.editor.get_window_coordinates(new M.assignfeedback_editpdfplus.point(this.x,this.y)),r=e.Node.create("<div>"+this.tooltype.label+"</div>"),r.setStyles({position:"absolute",display:"inline-block",color:this.colour,border:"2px solid "+this.colour,padding:"0 2px"}),n.append(r),r.setX(i.x),r.setY(i.y),t.store_position(r,i.x,i.y),t.nodes.push(r),this.drawable=t,N.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdfplus.rect,r=new M.assignfeedback_editpdfplus.drawable(this.editor),i=this.editor.get_dialogue_element(s.DRAWINGREGION),o,u;return n.bound([t.start,t.end]),u=this.editor.get_window_coordinates(new M.assignfeedback_editpdfplus.point(n.x,n.y)),o=e.Node.create("<div>"+this.tooltype.label+"</div>"),o.setStyles({position:"absolute",display:"inline-block",color:this.colour,border:"2px solid "+this.colour,padding:"0 2px"}),i.append(o),o.setX(u.x),o.setY(u.y),r.store_position(o,u.x,u.y),r.nodes.push(o),r},init_from_edit:function(e){var t=new M.assignfeedback_editpdfplus.rect;return t.bound([e.start,e.end]),t.width<40&&(t.width=40),t.height<40&&(t.height=40),this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=t.x-5,this.y=t.y-10,this.endx=t.x+t.width,this.endy=t.y+t.height,!0},edit_annot:function(){return!0},move:function(e,t){var n=e-this.x,r=t-this.y;this.x+=n,this.y+=r,this.endx+=n,this.endy+=r,this.drawable&&this
.drawable.erase(),this.editor.drawables.push(this.draw())}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotationstampplus=N;var C=function(e){C.superclass.constructor.apply(this,[e])};C.NAME="annotationstampcomment",C.ATTRS={},e.extend(C,M.assignfeedback_editpdfplus.annotation,{draw:function(){var t=new M.assignfeedback_editpdfplus.drawable(this.editor),n=this.editor.get_dialogue_element(s.DRAWINGCANVAS),r,i;this.shape_id="ct_stampcomment_"+(new Date).toJSON().replace(/:/g,"").replace(/\./g,""),i=this.editor.get_window_coordinates(new M.assignfeedback_editpdfplus.point(this.x,this.y));var o=this.get_color_cartridge(),u='<i id="'+this.shape_id+'_img" '+'class="fa fa-arrows-h fa-2x" aria-hidden="true" style="color:'+o+';"></i>';return this.displayrotation>0&&(u='<i id="'+this.shape_id+'_img" '+'class="fa fa-arrows-v fa-2x" aria-hidden="true" style="color:'+o+';"></i>'),r=e.Node.create('<div id="'+this.shape_id+'">'+u+"</div>"),r.setStyles({position:"absolute",display:"inline-block"}),n.append(r),r.setY(i.y),r.setX(i.x),t.store_position(r,i.x,i.y),t.nodes.push(r),this.drawable=t,this.draw_catridge(),C.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdfplus.rect,r=new M.assignfeedback_editpdfplus.drawable(this.editor),i=this.editor.get_dialogue_element(s.DRAWINGREGION),o,u;n.bound([t.start,t.end]),u=this.editor.get_window_coordinates(new M.assignfeedback_editpdfplus.point(n.x,n.y));var a=this.get_color_cartridge(),f='<div><i class="fa fa-arrows-v fa-2x" aria-hidden="true" style="color:'+a+'"></i></div>';return o=e.Node.create(f),o.setStyles({position:"absolute",display:"inline-block"}),i.append(o),o.setX(u.x),o.setY(u.y),r.store_position(o,u.x,u.y),r.nodes.push(o),r},init_from_edit:function(e){var t=new M.assignfeedback_editpdfplus.rect;return t.bound([e.start,e.end]),t.width<30&&(t.width=30),t.height<30&&(t.height=30),this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=t.x-20,this.y=t.y-25,this.endx=t.x+t.width-20,this.endy=t.y+t.height-25,!0},draw_catridge:function(){var t;if(this.divcartridge===""){this.init_div_cartridge_id();var n=this.editor.get_dialogue_element(s.DRAWINGCANVAS),r=this.get_color_cartridge();t=this.get_div_cartridge(r),t.addClass("assignfeedback_editpdfplus_stampcomment");var i=this.get_div_cartridge_label(r,!0);t.append(i);var o=this.get_div_container(r),u=this.get_toolbar();if(!this.editor.get("readonly")){var a=0;this.displayrotation>0&&(a=1);var f=e.Node.create("<input type='hidden' id='"+this.divcartridge+"_rotation' value="+a+" />");u.append(f);var l="<button id='"+this.divcartridge+"_buttonrotation' class='btn btn-sm btn-outline-dark' type='button'>"+'<i class="fa fa-refresh" aria-hidden="true"></i>'+"</button>",c=e.Node.create(l);c.on("click",this.change_stamp,this),u.append(c)}o.append(u),t.append(o);if(!this.editor.get("readonly")){var h=this.get_div_edition();o.append(h)}else{var p=this.get_div_visu(r);o.append(p)}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);t.setX(this.x+this.cartridgex),t.setY(this.y+this.cartridgey),n.append(t),this.apply_visibility_annot()}else this.replacement_cartridge();return!0},replacement_cartridge:function(){var e=this.editor.get_dialogue_element(s.DRAWINGCANVAS).getXY(),t=this.editor.get_dialogue_element("#"+this.divcartridge);t&&(t.setX(e[0]+this.x+this.cartridgex),t.setY(e[1]+this.y+this.cartridgey))},change_stamp:function(){var e=this.editor.get_dialogue_element("#"+this.divcartridge+"_rotation"),t=this.editor.get_dialogue_element("#"+this.shape_id+"_img");e.get("value")==="0"?(this.displayrotation=1,e.set("value",1),t.removeClass("fa-arrows-h"),t.addClass("fa-arrows-v")):(e.set("value",0),t.removeClass("fa-arrows-v"),t.addClass("fa-arrows-h"),this.displayrotation=0),this.editor.save_current_page()},move:function(e,t){var n=e-this.x,r=t-this.y;this.x+=n,this.y+=r,this.endx+=n,this.endy+=r,this.drawable&&this.drawable.erase(),this.editor.drawables.push(this.draw())},remove:function(e){var t,n;e.preventDefault(),t=this.editor.pages[this.editor.currentpage].annotations;for(n=0;n<t.length;n++)if(t[n]===this){if(this.divcartridge!==""){var r="#"+this.divcartridge,i=this.editor.get_dialogue_element(r);i.remove()}t.splice(n,1),this.drawable&&this.drawable.erase(),this.editor.currentannotation=!1,this.editor.save_current_page();return}}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotationstampcomment=C;var k=function(e){k.superclass.constructor.apply(this,[e])};k.NAME="annotationframe",k.ATTRS={},e.extend(k,M.assignfeedback_editpdfplus.annotation,{children:[],oldx:0,oldy:0,marginDivResize:4,draw:function(){var t,n,r,i;return t=new M.assignfeedback_editpdfplus.drawable(this.editor),r=new M.assignfeedback_editpdfplus.rect,r.bound([new M.assignfeedback_editpdfplus.point(this.x,this.y),new M.assignfeedback_editpdfplus.point(this.endx,this.endy)]),i=this.get_color(),this.init_shape_id("frame"),n=this.editor.graphic.addShape({id:this.shape_id,type:e.Rect,width:r.width,height:r.height,stroke:{weight:2,color:this.get_color()},x:r.x,y:r.y}),this.parent_annot_element&&n.addClass("class_"+this.parent_annot_element.divcartridge),this.borderstyle==="dashed"?n.set("stroke",{dashstyle:[5,3]}):this.borderstyle==="dotted"&&n.set("stroke",{dashstyle:[2,2]}),t.shapes.push(n),this.drawable=t,this.draw_catridge(),this.draw_resizeAreas(),k.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdfplus.drawable(this.editor),r,i,s;return i=new M.assignfeedback_editpdfplus.rect,i.bound([new M.assignfeedback_editpdfplus.point(t.start.x,t.start.y),new M.assignfeedback_editpdfplus.point(t.end.x,t.end.y)]),i.has_min_width()||i.set_min_width(),s=this.get_color(),r=this.editor.graphic.addShape({type:e.Rect
,width:i.width,height:16,stroke:{weight:2,color:this.get_color()},x:i.x,y:t.start.y-8}),this.parent_annot_element&&r.addClass("class_"+this.parent_annot_element.divcartridge),this.borderstyle==="dashed"?r.set("stroke",{dashstyle:[5,3]}):this.borderstyle==="dotted"&&r.set("stroke",{dashstyle:[2,2]}),n.shapes.push(r),n},init_from_edit:function(e){var t=new M.assignfeedback_editpdfplus.rect;return t.bound([e.start,e.end]),this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=t.x,this.y=e.start.y-8,this.endx=t.x+t.width,this.endy=e.start.y+16-8,this.page="",t.has_min_width()},move:function(e,t){var n=e-this.x,r=t-this.y;this.x+=n,this.y+=r,this.endx+=n,this.endy+=r,this.drawable&&this.drawable.erase(),this.editor.drawables.push(this.draw()),this.remove_resizearea(),this.draw_resizeAreas()},get_color:function(){return this.colour},draw_catridge:function(){if(this.parent_annot_element===null&&this.parent_annot===0){var t;if(this.divcartridge===""){this.init_div_cartridge_id();var n=this.editor.get_dialogue_element(s.DRAWINGCANVAS),r=this.editor.graphic.getShapeById(this.shape_id);r&&r.addClass("class_"+this.divcartridge);var i=this.get_color();t=this.get_div_cartridge(i),t.addClass("assignfeedback_editpdfplus_frame"),t.setStyles({"border-style":this.borderstyle});var o=this.get_div_cartridge_label(i,!0);t.append(o);var u=this.get_div_container(i),a=this.get_toolbar();if(!this.editor.get("readonly")){var f="<button id='"+this.divcartridge+"_buttonpencil' class='btn btn-sm btn-outline-dark' type='button'>";f+='<i class="fa fa-eyedropper" aria-hidden="true"></i>',f+="</button>";var l=e.Node.create(f);l.on("click",this.display_picker,this);var c="<button id='"+this.divcartridge+"_buttonadd' class='btn btn-sm btn-outline-dark' type='button'>";c+='<i class="fa fa-plus" aria-hidden="true"></i>',c+="</button>";var h=e.Node.create(c);h.on("click",this.add_annot,this),a.append(l),a.append(h)}u.append(a),t.append(u);if(!this.editor.get("readonly")){var p=this.get_div_edition();u.append(p)}else{var d=this.get_div_visu(i);u.append(d)}if(!this.editor.get("readonly")){var v="margin:5px;border:2px #ccc ",m="min-width:20px;min-height:20px;",g="<div ";g+="id='"+this.divcartridge+"_picker' ",g+="class='assignfeedback_editpdfplus_frame_picker' ",g+="style='display:none;text-align:right;'> ",g+="</div>";var y=e.Node.create(g);u.append(y);var b=e.Node.create("<div style='display:inline-block;vertical-align:top;'></div>"),w=e.Node.create("<div style='display:inline-block;vertical-align:top;'></div>");y.append(b),y.append(w);var E=e.Node.create("<div style='background-color:white;"+v+"solid;"+m+"'></div>");E.on("click",this.change_color,this,"white");var S=e.Node.create("<div style='background-color:#E69F00;"+v+"solid;"+m+"'></div>");S.on("click",this.change_color,this,"#E69F00");var x=e.Node.create("<div style='background-color:#D55E00;"+v+"solid;"+m+"'></div>");x.on("click",this.change_color,this,"#D55E00");var T=e.Node.create("<div style='background-color:#009E73;"+v+"solid;"+m+"'></div>");T.on("click",this.change_color,this,"#009E73");var N=e.Node.create("<div style='background-color:#0072B2;"+v+"solid;"+m+"'></div>");N.on("click",this.change_color,this,"#0072B2");var C=e.Node.create("<div style='background-color:black;"+v+"solid;"+m+"'></div>");C.on("click",this.change_color,this,"black"),b.append(E),b.append(S),b.append(x),b.append(T),b.append(N),b.append(C);var k=e.Node.create("<div style='"+v+"solid;"+m+"'></div>");k.on("click",this.change_border,this,"solid");var L=e.Node.create("<div style='"+v+"dotted;"+m+"'></div>");L.on("click",this.change_border,this,"dotted");var A="<div style='"+v+"dashed;"+m+"'>"+"</div>",O=e.Node.create(A);O.on("click",this.change_border,this,"dashed"),w.append(k),w.append(L),w.append(O)}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);t.setX(this.cartridgex),t.setY(this.y+this.cartridgey),n.append(t),this.apply_visibility_annot();if(!this.editor.get("readonly")){var M=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit_right"),_=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit_left");M.hide(),_.hide()}}else this.replacement_cartridge()}return!0},replacement_cartridge:function(){var e=this.editor.get_dialogue_element(s.DRAWINGCANVAS).getXY(),t="#"+this.divcartridge,n=this.editor.get_dialogue_element(t);n&&(n.setX(e[0]+this.cartridgex),n.setY(e[1]+this.y+this.cartridgey))},draw_resizeAreas:function(){this.push_div_resizearea("left",this.x-2,this.y),this.push_div_resizearea("right",this.endx-2,this.y)},mousemoveResize:function(e,t,n){if(this.drawable.shapes.length===0)return;var r=this.drawable.shapes[0];if(!r)return;var i=n.getData("direction"),s=this.minresizewidth,o=this.editor.get_canvas_bounds(),u=t.x;u<0?u=0:o.width<u&&(u=o.width);var a=o.x;i==="right"?(s=Math.max(u-this.x,this.minresizewidth),r.set("width",s),n.setX(this.x+s+a-this.marginDivResize)):i==="left"&&(s=Math.max(this.endx-t.x,this.minresizewidth),r.set("x",Math.min(u,this.endx-this.minresizewidth)),r.set("width",s),n.setX(this.endx-s+a-this.marginDivResize))},move_cartridge_continue:function(e){e.preventDefault();var t=this.editor.get_dialogue_element(s.DRAWINGCANVAS),n=new M.assignfeedback_editpdfplus.point(e.clientX+t.get("docScrollX"),e.clientY+t.get("docScrollY")),r=this.editor.get_canvas_coordinates(n),i=this.editor.get_dialogue_element(s.DRAWINGCANVAS).getXY(),o=r.x-this.oldx,u=r.y-this.oldy,a=this.editor.get_dialogue_element("#"+this.divcartridge);a.setX(i[0]+this.cartridgex+o),a.setY(i[1]+this.y+this.cartridgey+u)},move_cartridge_stop:function(e){e.preventDefault();var t=this.editor.get_dialogue_element(s.DRAWINGCANVAS);t.detach("mousemove",this.move_cartridge_continue,this),t.detach("mouseup",this.move_cartridge_stop,this);var n=new M.assignfeedback_editpdfplus.point(e.clientX+t.get("docScrollX"
),e.clientY+t.get("docScrollY")),r=this.editor.get_canvas_coordinates(n),i=this.editor.get_dialogue_element(s.DRAWINGCANVAS).getXY(),o=r.x-this.oldx,u=r.y-this.oldy;this.cartridgex+=o,this.cartridgey+=u;var a=this.editor.get_dialogue_element("#"+this.divcartridge);a.setX(i[0]+this.cartridgex),a.setY(i[1]+this.y+this.cartridgey),this.editor.save_current_page()},add_annot:function(e){this.editor.currentedit.parent_annot_element=this,this.editor.handle_tool_button(e,h.FRAME,"ctbutton"+this.toolid,1)},display_picker:function(){var e=this.editor.get_dialogue_element("#"+this.divcartridge),t=this.editor.get_dialogue_element("#"+this.divcartridge+"_picker"),n=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonpencil");e.setStyle("z-index",1e3),t.show(),n.on("click",this.hide_picker,this)},hide_picker:function(){var e=this.editor.get_dialogue_element("#"+this.divcartridge+"_picker"),t=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonpencil"),n=this.editor.get_dialogue_element("#"+this.divcartridge);e.hide(),n.setStyle("z-index",0),t.on("click",this.display_picker,this)},change_color:function(e,t){this.colour=t;var n=this.editor.graphic.getShapeById(this.shape_id);n.set("stroke",{color:this.colour});var r=null;this.id?r=this.editor.annotationsparent[this.id]:r=this.editor.annotationsparent[this.divcartridge];if(r)for(var i=0;i<r.length;i++){r[i].colour=t;var s=this.editor.graphic.getShapeById(r[i].shape_id);s&&s.set("stroke",{color:this.colour})}var o=this.editor.get_dialogue_element("#"+this.divcartridge);o.setStyles({"border-color":this.colour,color:this.colour});var u=this.editor.get_dialogue_element("#"+this.divcartridge+"_cartridge");u.setStyles({"border-color":this.colour,color:this.colour});var a=this.editor.get_dialogue_element("#"+this.divcartridge+"_display");a.setStyles({color:this.colour}),this.hide_picker(),this.editor.save_current_page()},change_border:function(e,t){this.borderstyle=t;var n=this.editor.graphic.getShapeById(this.shape_id);this.borderstyle==="solid"?n.set("stroke",{dashstyle:"none"}):this.borderstyle==="dashed"?n.set("stroke",{dashstyle:[5,3]}):n.set("stroke",{dashstyle:[2,2]});var r=[];this.id?r=this.editor.annotationsparent[this.id]:r=this.editor.annotationsparent[this.divcartridge];if(r)for(var i=0;i<r.length;i++){r[i].borderstyle=t;var s=this.editor.graphic.getShapeById(r[i].shape_id);s&&(this.borderstyle==="solid"?s.set("stroke",{dashstyle:"none"}):this.borderstyle==="dashed"?s.set("stroke",{dashstyle:[5,3]}):s.set("stroke",{dashstyle:[2,2]}))}var o=this.editor.get_dialogue_element("#"+this.divcartridge);o.setStyles({"border-style":this.borderstyle});var u=this.editor.get_dialogue_element("#"+this.divcartridge+"_picker");u.hide(),this.editor.save_current_page()},edit_annot:function(){if(!this.parent_annot_element){var e=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonpencil"),t=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonadd");this.hide_picker(),e&&(e.hide(),t.hide()),k.superclass.edit_annot.call(this)}},hide_edit:function(){k.superclass.hide_edit.call(this);var e=this.editor.get_dialogue_element("#"+this.divcartridge+"_display"),t=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonpencil"),n=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonadd"),r=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit_right"),i=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit_left");e&&(e.set("style","display:inline;color:"+this.get_color()+";"),t&&(t.show(),n.show()),r&&r.hide(),i&&i.hide())},remove:function(e){var t;e.preventDefault(),t=this.editor.pages[this.editor.currentpage].annotations;for(var n=0;n<t.length;n++)if(t[n]===this){if(this.divcartridge!==""){var r="#"+this.divcartridge,i=this.editor.get_dialogue_element(r);i.remove()}this.remove_resizearea(),t.splice(n,1),this.drawable&&this.drawable.erase();var s=[];this.id?s=this.editor.annotationsparent[this.id]:s=this.editor.annotationsparent[this.divcartridge];if(s)for(var o=0;o<s.length;o++)for(var u=0;u<t.length;u++)t[u]===s[o]&&(t.splice(u,1),s[o].drawable&&s[o].drawable.erase());this.editor.currentannotation=!1,this.editor.save_current_page();return}}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotationframe=k;var L=function(e){L.superclass.constructor.apply(this,[e])};L.NAME="annotationverticalline",L.ATTRS={},e.extend(L,M.assignfeedback_editpdfplus.annotation,{marginDivResize:2,draw:function(){var t,n,r;return t=new M.assignfeedback_editpdfplus.drawable(this.editor),r=this.get_color(),this.init_shape_id("verticalline"),n=this.editor.graphic.addShape({id:this.shape_id,type:e.Path,fill:!1,stroke:{weight:p,color:r}}),n.moveTo(this.x,this.y),this.endy-this.y<=30&&(this.endy=this.y+30),n.lineTo(this.x,this.endy),n.end(),t.shapes.push(n),this.drawable=t,this.draw_catridge(),this.draw_resizeAreas(),L.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdfplus.drawable(this.editor),r,i,s;return i=new M.assignfeedback_editpdfplus.rect,i.bound([new M.assignfeedback_editpdfplus.point(t.start.x,t.start.y),new M.assignfeedback_editpdfplus.point(t.end.x,t.end.y)]),i.has_min_width()||i.set_min_width(),i.has_min_height()||i.set_min_height(),s=this.get_color(),r=this.editor.graphic.addShape({type:e.Path,fill:!1,stroke:{weight:p,color:s}}),r.moveTo(t.start.x,t.start.y),t.end.y-t.start.y<=30?r.lineTo(t.start.x,t.start.y+30):r.lineTo(t.start.x,t.end.y),r.end(),n.shapes.push(r),n},init_from_edit:function(e){return this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=e.start.x,this.y=e.start.y,this.endx=e.end.x+4,e.end.y-this.y<=30?this.endy=this.y+30:this.endy=e.end.y,this.page="",this.endx-this.x!==0||this.endy-this.y!==0},draw_catridge:function(){var e;if(this.divcartridge===""){this.init_div_cartridge_id();var t=this.editor.get_dialogue_element(s.DRAWINGCANVAS),n=this.get_color_cartridge();e=this.get_div_cartridge
(n),e.addClass("assignfeedback_editpdfplus_verticalline");var r=this.get_div_cartridge_label(n,!0);e.append(r);var i=this.get_div_container(n),o=this.get_toolbar();i.append(o),e.append(i);if(!this.editor.get("readonly")){var u=this.get_div_edition();i.append(u)}else{var a=this.get_div_visu(n);i.append(a)}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);e.setX(this.x+this.cartridgex),e.setY(this.y+this.cartridgey),t.append(e),this.apply_visibility_annot()}else this.replacement_cartridge();return!0},replacement_cartridge:function(){var e=this.editor.get_dialogue_element(s.DRAWINGCANVAS).getXY(),t=this.editor.get_dialogue_element("#"+this.divcartridge);t&&(t.setX(e[0]+this.x+this.cartridgex),t.setY(e[1]+this.y+this.cartridgey))},draw_resizeAreas:function(){this.push_div_resizearea("up",this.x-7,this.y-this.marginDivResize),this.push_div_resizearea("down",this.x-7,this.endy-this.marginDivResize)},mousemoveResize:function(e,t,n){if(this.drawable.shapes.length===0)return;var r=this.drawable.shapes[0];if(!r)return;var i=this.minresizewidth,s=n.getData("direction"),o=this.editor.get_canvas_bounds(),u=t.y;u<0?u=0:o.height<u&&(u=o.height);var a=o.y;s==="up"?(i=Math.max(this.endy-u,this.minresizewidth),r.clear(),r.moveTo(this.x,Math.min(u,this.endy-this.minresizewidth)),r.lineTo(this.x,this.endy),r.end(),n.setY(this.endy-i+a-this.marginDivResize)):s==="down"&&(i=Math.max(u-this.y,this.minresizewidth),r.clear(),r.moveTo(this.x,this.y),r.lineTo(this.x,this.y+i),r.end(),n.setY(this.y+i+a-this.marginDivResize))},remove:function(e){var t,n;e.preventDefault(),t=this.editor.pages[this.editor.currentpage].annotations;for(n=0;n<t.length;n++)if(t[n]===this){if(this.divcartridge!==""){var r="#"+this.divcartridge,i=this.editor.get_dialogue_element(r);i.remove()}this.remove_resizearea(),t.splice(n,1),this.drawable&&this.drawable.erase(),this.editor.currentannotation=!1,this.editor.save_current_page();return}}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotationverticalline=L;var A=function(e){A.superclass.constructor.apply(this,[e])};A.NAME="annotationcommentplus",A.ATTRS={},e.extend(A,M.assignfeedback_editpdfplus.annotation,{draw:function(){var t=new M.assignfeedback_editpdfplus.drawable(this.editor),n=this.editor.get_dialogue_element(s.DRAWINGCANVAS),r,i;i=this.editor.get_window_coordinates(new M.assignfeedback_editpdfplus.point(this.x,this.y));var o=this.get_color_cartridge();return r=e.Node.create('<div><i class="fa fa-commenting" aria-hidden="true" style="color:'+o+';"></i></div>'),r.setStyles({position:"absolute",display:"inline-block",zIndex:50,color:this.colour,padding:"0 2px"}),n.append(r),r.setX(i.x),r.setY(i.y),t.store_position(r,i.x,i.y),t.nodes.push(r),this.drawable=t,this.draw_catridge(),A.superclass.draw.apply(this)},draw_current_edit:function(t){var n=new M.assignfeedback_editpdfplus.rect,r=new M.assignfeedback_editpdfplus.drawable(this.editor),i=this.editor.get_dialogue_element(s.DRAWINGREGION),o,u;return n.bound([t.start,t.end]),u=this.editor.get_window_coordinates(new M.assignfeedback_editpdfplus.point(n.x,n.y)),o=e.Node.create("<div>"+this.tooltype.label+"</div>"),o.setStyles({position:"absolute",display:"inline-block",zIndex:50,color:this.colour,padding:"0 2px"}),i.append(o),o.setX(u.x),o.setY(u.y),r.store_position(o,u.x,u.y),r.nodes.push(o),r},init_from_edit:function(e){var t=new M.assignfeedback_editpdfplus.rect;return t.bound([e.start,e.end]),t.width<20&&(t.width=20),t.height<20&&(t.height=20),this.gradeid=this.editor.get("gradeid"),this.pageno=this.editor.currentpage,this.x=t.x-20,this.y=t.y-10,this.endx=t.x+t.width,this.endy=t.y+t.height,!0},draw_catridge:function(){var e;if(this.divcartridge===""){this.init_div_cartridge_id();var t=this.editor.get_dialogue_element(s.DRAWINGCANVAS),n=this.get_color_cartridge();e=this.get_div_cartridge(n),e.addClass("assignfeedback_editpdfplus_commentplus");var r=this.get_div_cartridge_label(n);e.append(r);var i=this.get_div_container(n),o=this.get_toolbar();i.append(o),e.append(i);if(!this.editor.get("readonly")){var u=this.get_div_edition();i.append(u)}else{var a=this.get_div_visu(n);i.append(a)}e.setX(this.x+20),e.setY(this.y),t.append(e),this.apply_visibility_annot()}else this.replacement_cartridge();return!0},replacement_cartridge:function(){var e=this.editor.get_dialogue_element(s.DRAWINGCANVAS).getXY(),t=this.editor.get_dialogue_element("#"+this.divcartridge);t&&(t.setX(e[0]+this.x+20),t.setY(e[1]+this.y))},apply_visibility_annot:function(){A.superclass.apply_visibility_annot.apply(this);var e=this.editor.get_dialogue_element("#"+this.divcartridge+"_display"),t=this.editor.get_dialogue_element("#"+this.divcartridge+"_onof"),n=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit_right"),r=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit_left");n&&(n.setHTML('<i class="fa fa-arrow-down" aria-hidden="true"></i>'),r.setHTML('<i class="fa fa-arrow-up" aria-hidden="true"></i>'),t.get("value")==="2"?e.setContent("<table><tr><td>"+this.get_text_to_diplay_in_cartridge().replace(/\n/g,"<br/>")+"</td></tr></table><br/>"):t.get("value")==="1"?r.setHTML('<i class="fa fa-arrow-left" aria-hidden="true"></i>'):t.get("value")==="0"&&n.setHTML('<i class="fa fa-arrow-right" aria-hidden="true"></i>'))},move:function(e,t){var n=e-this.x,r=t-this.y;this.x+=n,this.y+=r,this.endx+=n,this.endy+=r,this.drawable&&this.drawable.erase(),this.editor.drawables.push(this.draw())},remove:function(e){var t,n;e.preventDefault(),t=this.editor.pages[this.editor.currentpage].annotations;for(n=0;n<t.length;n++)if(t[n]===this){if(this.divcartridge!==""){var r="#"+this.divcartridge,i=this.editor.get_dialogue_element(r);i.remove()}t.splice(n,1),this.drawable&&this.drawable.erase(),this.editor.currentannotation=!1,this.editor.save_current_page();return}
}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotationcommentplus=A;var O="Dropdown menu",_;_=function(e){e.draggable=!1,e.centered=!1,e.width="auto",e.visible=!1,e.footerContent="",_.superclass.constructor.apply(this,[e])},e.extend(_,M.core.dialogue,{initializer:function(t){var n,r,i,s;_.superclass.initializer.call(this,t),s=this.get("boundingBox"),s.addClass("assignfeedback_editpdfplus_dropdown"),n=this.get("buttonNode"),r=this.bodyNode,i=e.Node.create("<h3/>"),i.addClass("accesshide"),i.setHTML(this.get("headerText")),r.prepend(i),r.on("clickoutside",function(e){this.get("visible")&&e.target.get("id")!==n.get("id")&&e.target.ancestor().get("id")!==n.get("id")&&(e.preventDefault(),this.hide())},this),n.on("click",function(e){e.preventDefault(),this.show()},this),n.on("key",this.show,"enter,space",this)},show:function(){var t=this.get("buttonNode"),n=_.superclass.show.call(this);return this.align(t,[e.WidgetPositionAlign.TL,e.WidgetPositionAlign.BL]),n}},{NAME:O,ATTRS:{headerText:{value:""},buttonNode:{value:null}}}),e.Base.modifyAttrs(_,{modal:{getter:function(){return!1}}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.dropdown=_;var D="Colourpicker",P;P=function(e){P.superclass.constructor.apply(this,[e])},e.extend(P,M.assignfeedback_editpdfplus.dropdown,{initializer:function(t){var n=e.Node.create('<ul role="menu" class="assignfeedback_editpdfplus_menu"/>'),r,i;e.each(this.get("colours"),function(t,r){var s,o,u;u=M.util.get_string(r,"assignfeedback_editpdfplus"),r==="white"||r==="yellowlemon"?i=e.Node.create('<span class="fa-stack fa-lg"><i class="fa fa-square fa-stack-2x" style="color:#E3E3E3;"></i><i class="fa fa-tint fa-stack-1x fa-inverse" aria-hidden="true" style="color:'+t+';">'+"</i>"+"</span>"):i=e.Node.create('<span class="fa-stack fa-lg"><i class="fa fa-square-o fa-stack-2x" style="color:#E3E3E3;"></i><i class="fa fa-tint fa-stack-1x" aria-hidden="true" style="color:'+t+';">'+"</i>"+"</span>"),i.setAttribute("data-colour",r),s=e.Node.create('<button class="btn btn-sm" type="button"></button>'),s.append(i),s.setAttribute("data-colour",r),s.setAttribute("data-rgb",t),s.setStyle("backgroundImage","none"),o=e.Node.create("<li/>"),o.append(s),n.append(o)},this),r=e.Node.create('<div style="max-width:50px;"></div>'),n.delegate("click",this.callback_handler,"button",this),n.delegate("key",this.callback_handler,"down:13","button",this),this.set("headerText",M.util.get_string("colourpicker","assignfeedback_editpdfplus")),r.append(n),this.set("bodyContent",r),P.superclass.initializer.call(this,t)},callback_handler:function(t){t.preventDefault();var n=this.get("callback"),r=this.get("context"),i;this.hide(),i=e.bind(n,r,t),i()}},{NAME:D,ATTRS:{colours:{value:{}},callback:{value:null},context:{value:null},iconprefix:{value:"colour_"}}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.colourpicker=P;var H=function(){H.superclass.constructor.apply(this,arguments)};H.prototype={oldannotationcoordinates:null,dialogue:null,panel:null,pagecount:0,currentpage:0,pages:[],documentstatus:0,loadingicon:null,pageimage:null,graphic:null,currentedit:new M.assignfeedback_editpdfplus.edit,currentdrawable:!1,drawables:[],drawablesannotations:[],currentannotation:null,lastannotation:null,lastannotationtool:null,annotationsparent:[],studentstatut:-1,questionstatut:-1,currentannotationreview:null,resizeareaselected:null,initializer:function(){var t;t=e.one("#"+this.get("linkid")),t&&(t.on("click",this.link_handler,this),t.on("key",this.link_handler,"down:13",this),require(["mod_assign/grading_review_panel"],function(n){var r=new n,i=r.getReviewPanel("assignfeedback_editpdfplus");i&&(i=e.one(i),i.empty(),t.ancestor(".fitem").hide(),this.open_in_panel(i)),this.currentedit.start=!1,this.currentedit.end=!1}.bind(this)))},refresh_button_state:function(){var t,n,r;r=this.get_dialogue_element(s.DRAWINGCANVAS),this.refresh_button_color_state();var i=e.all(".assignfeedback_editpdfplus_resize");i&&i.removeClass("assignfeedback_editpdfplus_resize_active"),this.currentedit.id?t=this.get_dialogue_element("#"+this.currentedit.id):t=this.get_dialogue_element(l[this.currentedit.tool]),t&&(t.addClass("active"),t.setAttribute("aria-pressed","true")),n=this.get_dialogue_element(s.DRAWINGREGION),n.setAttribute("data-currenttool",this.currentedit.tool);switch(this.currentedit.tool){case"drag":r.setStyle("cursor","move");break;case"highlight":r.setStyle("cursor","text");break;case"select":r.setStyle("cursor","default");break;case"resize":r.setStyle("cursor","default"),i.addClass("assignfeedback_editpdfplus_resize_active");break;default:r.setStyle("cursor","crosshair")}},refresh_button_color_state:function(){var e;e=this.get_dialogue_element(s.ANNOTATIONCOLOURBUTTON);if(this.currentedit.annotationcolour==="white")e.one("i").setStyle("color",this.currentedit.annotationcolour),e.setStyle("background-color","#EEEEEE");else{switch(this.currentedit.annotationcolour){case"yellowlemon":e.one("i").setStyle("color","#fff44f");break;case"yellow":e.one("i").setStyle("color","rgb(255,207,53)");break;default:e.one("i").setStyle("color",this.currentedit.annotationcolour)}e.setStyle("background-color","")}},get_canvas_bounds:function(){var e=this.get_dialogue_element(s.DRAWINGCANVAS),t=e.getXY(),n=t[0],r=t[1],i=parseInt(e.getStyle("width"),10),o=parseInt(e.getStyle("height"),10);return new M.assignfeedback_editpdfplus.rect(n,r,i,o)},get_canvas_coordinates:function(e){var t=this.get_canvas_bounds(),n=new M.assignfeedback_editpdfplus.point(e.x-t.x,e.y-t.y);return t.x=t.y=0,n.clip(t),n},get_window_coordinates:function(e){var t=this.get_canvas_bounds(),n=new M.assignfeedback_editpdfplus.point(e.x+t.x,e.y+t.y);return n},open_in_panel:function(t){var n,r;this.panel=t,t.append(this.get("body")),t.addClass(i.DIALOGUE),this.loadingicon=this.get_dialogue_element(s.LOADINGICON),n=this.get_dialogue_element(s.DRAWINGCANVAS
),this.graphic=new e.Graphic({render:n}),r=this.get_dialogue_element(s.DRAWINGREGION),r.on("scroll",this.move_canvas,this);if(!this.get("readonly")){n.on("gesturemovestart",this.edit_start,null,this),n.on("gesturemove",this.edit_move,null,this),n.on("gesturemoveend",this.edit_end,null,this),this.refresh_button_state(),n.on("windowresize",this.resize,this);var o=e.one(".collapse-buttons");o.on("click",this.temporise,this,this.resize,500)}this.start_generation()},link_handler:function(t){var n,r,o=!0;t.preventDefault(),this.dialogue||(this.dialogue=new M.core.dialogue({headerContent:this.get("header"),bodyContent:this.get("body"),footerContent:this.get("footer"),modal:!0,width:"840px",visible:!1,draggable:!0}),this.dialogue.get("boundingBox").addClass(i.DIALOGUE),this.loadingicon=this.get_dialogue_element(s.LOADINGICON),n=this.get_dialogue_element(s.DRAWINGCANVAS),this.graphic=new e.Graphic({render:n}),r=this.get_dialogue_element(s.DRAWINGREGION),r.on("scroll",this.move_canvas,this),this.get("readonly")||(n.on("gesturemovestart",this.edit_start,null,this),n.on("gesturemove",this.edit_move,null,this),n.on("gesturemoveend",this.edit_end,null,this),this.refresh_button_state()),this.start_generation(),n.on("windowresize",this.resize,this),o=!1),this.dialogue.centerDialogue(),this.dialogue.show(),this.dialogue.dd.on("drag:end",this.redraw,this),o&&this.resize()},start_generation:function(){this.poll_document_conversion_status()},poll_document_conversion_status:function(){var t=this.get("userid");e.io(n,{method:"get",context:this,sync:!1,data:{sesskey:M.cfg.sesskey,action:"pollconversions",userid:this.get("userid"),attemptnumber:this.get("attemptnumber"),assignmentid:this.get("assignmentid"),readonly:this.get("readonly")?1:0},on:{success:function(n,r){var i=e.one(s.USERINFOREGION);if(i){var o=i.getAttribute("data-userid");if(o&&o!=t)return}var u=this.handle_response_data(r),a=!1;if(u){this.documentstatus=u.status;if(u.status===0)a=!0;else if(u.status===1||u.status===3)a=!0;else if(u.status===2||u.status===-1)this.pagecount=u.pagecount,u.pageready===u.pagecount?this.prepare_pages_for_display(u):(this.update_page_load_progress(),this.start_document_to_image_conversion());a&&e.later(1e3,this,this.poll_document_conversion_status)}},failure:function(e,t){return new M.core.exception(t.responseText)}}})},start_document_to_image_conversion:function(){e.io(n,{method:"get",context:this,sync:!1,data:{sesskey:M.cfg.sesskey,action:"pollconversions",userid:this.get("userid"),attemptnumber:this.get("attemptnumber"),assignmentid:this.get("assignmentid"),readonly:this.get("readonly")?1:0},on:{success:function(e,t){var n=this.handle_response_data(t);n&&(this.documentstatus=n.status,n.status===2&&this.prepare_pages_for_display(n))},failure:function(e,t){return new M.core.exception(t.responseText)}}})},warning:function(t,n){var r=this.get_dialogue_element("div.assignfeedback_editpdfplus_warningmessages");r&&r.remove();var i=this.get_dialogue_element(s.ICONMESSAGECONTAINER),o=this.get_dialogue_element(s.WARNINGMESSAGECONTAINER),u=15,a=1,f="assignfeedback_editpdfplus_warningmessages label label-warning";n&&(u=4,f="assignfeedback_editpdfplus_warningmessages label label-info");var l=e.Node.create('<div class="'+f+'"></div>');l.append(i.one("*").cloneNode()),l.append(t),o.prepend(l),l.transition({duration:a,delay:u,opacity:0},function(){l.remove()})},prepare_pages_for_display:function(e){var t,n,r,i,s;if(!e.pagecount){this.dialogue&&this.dialogue.hide(),r=new M.core.alert({message:M.util.get_string("cannotopenpdf","assignfeedback_editpdfplus")}),r.show();return}this.pagecount=e.pagecount,this.pages=e.pages,this.tools=[];for(t=0;t<e.tools.length;t++){var o=e.tools[t];this.tools[o.id]=o}this.typetools=[];for(t=0;t<e.typetools.length;t++){var u=e.typetools[t];this.typetools[u.id]=u}this.axis=[];for(t=0;t<e.axis.length;t++){var a=e.axis[t];a.visibility=!0,this.axis[a.id]=a}for(t=0;t<this.pages.length;t++){var f=[];for(n=0;n<this.pages[t].annotations.length;n++){i=this.pages[t].annotations[n],i.parent_annot&&parseInt(i.parent_annot,10)!==0&&(i.parent_annot_element=f[i.parent_annot]);var l=i.toolid,c=this.create_annotation(this.typetools[this.tools[l].type].label,l,i,this.tools[l]);if(c.parent_annot_element){var h=c.parent_annot_element.id;this.annotationsparent[h]?this.annotationsparent[h][this.annotationsparent[h].length]=c:this.annotationsparent[h]=[c]}f[i.id]=c,this.pages[t].annotations[n]=c}}s=this.get("readonly"),!s&&e.partial&&this.warning(M.util.get_string("partialwarning","assignfeedback_editpdfplus",!1)),this.setup_navigation(),this.setup_toolbar_advanced(),this.change_page()},update_page_load_progress:function(){var t,n=0,i=this.get_dialogue_element(s.PROGRESSBARCONTAINER+" .bar");if(!i)return;t={method:"get",context:this,sync:!1,data:{sesskey:M.cfg.sesskey,action:"conversionstatus",userid:this.get("userid"),attemptnumber:this.get("attemptnumber"),assignmentid:this.get("assignmentid")},on:{success:function(i,o){n=0;var u=0,a=this.get_dialogue_element(s.PROGRESSBARCONTAINER+" .bar");a&&(u=o.response/this.pagecount*100,a.setStyle("width",u+"%"),a.ancestor(s.PROGRESSBARCONTAINER).setAttribute("aria-valuenow",u),u<100&&(M.util.js_pending("checkconversionstatus"),e.later(1e3,this,function(){M.util.js_complete("checkconversionstatus"),e.io(r,t)})))},failure:function(i,s){return n+=1,this.pagecount===0&&n<5&&(M.util.js_pending("checkconversionstatus"),e.later(1e3,this,function(){M.util.js_complete("checkconversionstatus"),e.io(r,t)})),new M.core.exception(s.responseText)}}},M.util.js_pending("checkconversionstatus"),e.later(1e3,this,function(){n=0,M.util.js_complete("checkconversionstatus"),e.io(r,t)})},handle_response_data:function(t){var n;try{n=e.JSON.parse(t.responseText);if(!n.error)return n;this.dialogue&&this.dialogue.hide(),new M.core.alert({message:M.util.get_string("cannotopenpdf","assignfeedback_editpdfplus"),visible:!0})}catch(r){this.dialogue&&this.dialogue.hide(),new M.core.alert({title:M.util.get_string("cannotopenpdf"
,"assignfeedback_editpdfplus"),visible:!0})}return},handle_axis_button:function(e,t,n){t.visibility=n.get("checked"),this.redraw()},setup_toolbar_advanced:function(){var t,n;if(this.get("readonly")){for(var r in this.axis){var i=this.axis[r],o=this.get_dialogue_element("#ctaxis"+i.id);o&&(o.set("checked","true"),o.on("click",this.handle_axis_button,this,i,o))}var u=this.get_dialogue_element(s.QUESTIONSELECTOR);u&&u.on("change",this.update_visu_annotation_q,this);var f=this.get_dialogue_element(s.STATUTSELECTOR);f&&f.on("change",this.update_visu_annotation,this);var l=this.get_dialogue_element(s.STUDENTVALIDATION);l&&l.on("click",this.update_student_feedback,this);return}var c=this.get_dialogue_element(s.ROTATELEFTBUTTON);c.on("click",this.rotatePDF,this,!0),c.on("key",this.rotatePDF,"down:13",this,!0);var h=this.get_dialogue_element(s.ROTATERIGHTBUTTON);h.on("click",this.rotatePDF,this,!1),h.on("key",this.rotatePDF,"down:13",this,!1),this.disable_touch_scroll();var p=this.get_dialogue_element(s.CUSTOMTOOLBARID+"1");p&&p.show();var d=this.get_dialogue_element(s.AXISCUSTOMTOOLBAR);d&&d.on("change",this.update_custom_toolbars,this),this.update_custom_toolbars(),e.all(s.CUSTOMTOOLBARBUTTONS).each(function(e){var t=e.get("id"),n=e.getAttribute("data-tool");e.on("click",this.handle_tool_button,this,n,t),e.on("key",this.handle_tool_button,"down:13",this,n,t),e.setAttribute("aria-pressed","false")},this),e.all(s.GENERICTOOLBARBUTTONS).each(function(e){var t=e.get("id"),n=e.getAttribute("data-tool");e.on("click",this.handle_tool_button,this,n,t),e.on("key",this.handle_tool_button,"down:13",this,n,t),e.setAttribute("aria-pressed","false")},this),t=this.get_dialogue_element(s.ANNOTATIONCOLOURBUTTON),n=new M.assignfeedback_editpdfplus.colourpicker({buttonNode:t,iconprefix:"colour_",colours:a,callback:function(e){var t=e.target.getAttribute("data-colour");t||(t=e.target.ancestor().getAttribute("data-colour")),this.currentedit.annotationcolour=t,this.refresh_button_color_state()},context:this});var v=this.get_dialogue_element(s.HELPBTNCLASS);v&&v.on("click",this.display_help_message,this)},update_student_feedback:function(){this.refresh_pdf()},update_visu_annotation_q:function(){var e=this.get_dialogue_element(s.QUESTIONSELECTOR+" option:checked"),t=parseInt(e.get("value"),10)-1;this.questionstatut=t,this.redraw()},update_visu_annotation:function(){var e=this.get_dialogue_element(s.STATUTSELECTOR+" option:checked"),t=parseInt(e.get("value"),10)-1;this.studentstatut=t,this.redraw()},update_custom_toolbars:function(){e.all(s.CUSTOMTOOLBARS).each(function(e){e.hide()},this);var t=this.get_dialogue_element(s.AXISCUSTOMTOOLBAR+" option:checked"),n=parseInt(t.get("value"),10),r=this.get_dialogue_element(s.CUSTOMTOOLBARID+""+n);r.show()},handle_tool_button:function(e,t,n,r){e.preventDefault(),this.handle_tool_button_action(t,n,r)},handle_tool_button_action:function(e,t,n){var r=this.get_dialogue_element(s.DRAWINGCANVAS),i;this.currentedit.id?i=this.get_dialogue_element("#"+this.currentedit.id):i=this.get_dialogue_element(l[this.currentedit.tool]),i&&(i.removeClass("active"),i.setAttribute("aria-pressed","false"),r.setStyle("cursor","auto")),this.currentedit.tool=e,this.currentedit.id=t,e!=="select"&&e!=="drag"&&e!=="resize"&&(this.lastannotationtool=e),e!=="select"&&this.redraw_annotation(),n||(this.currentedit.parent_annot_element=null),this.refresh_button_state()},redraw_annotation:function(){this.currentannotation=null;var t=this.pages[this.currentpage].annotations;e.each(t,function(e){e&&e.drawable&&(e.drawable.erase(),e.draw())})},stringify_current_page:function(){var t=[],n,r=0;for(r=0;r<this.pages[this.currentpage].annotations.length;r++)t[r]=this.pages[this.currentpage].annotations[r].clean();return n={annotations:t},e.JSON.stringify(n)},stringify_current_page_edited:function(){var t=[],n,r=0;for(r=0;r<this.pages[this.currentpage].annotations.length;r++)t[r]=this.pages[this.currentpage].annotations[r].light_clean();return n={annotations:t},e.JSON.stringify(n)},get_current_drawable:function(){var e,t=!1;if(!this.currentedit.start||!this.currentedit.end)return!1;if(this.currentedit.tool!=="comment"){var n=this.currentedit.id;this.currentedit.id&&this.currentedit.id[0]==="c"&&(n=this.currentedit.id.substr(8)),e=this.create_annotation(this.currentedit.tool,this.currentedit.id,{},this.tools[n]),e&&(t=e.draw_current_edit(this.currentedit))}return t},get_dialogue_element:function(e){return this.panel?this.panel.one(e):this.dialogue.get("boundingBox").one(e)},redraw_current_edit:function(){this.currentdrawable&&this.currentdrawable.erase(),this.currentdrawable=this.get_current_drawable()},edit_start:function(t){var n=this.get_dialogue_element(s.DRAWINGCANVAS),r=n.getXY(),i=n.get("docScrollY"),o=n.get("docScrollX"),u={x:t.clientX-r[0]+o,y:t.clientY-r[1]+i},a=!1;if(t.button===3)return;if(this.currentedit.starttime)return;this.currentedit.starttime=(new Date).getTime(),this.currentedit.start=u,this.currentedit.end={x:u.x,y:u.y};if(this.currentedit.tool==="select"){var f=this.currentedit.end.x,l=this.currentedit.end.y,c=this.pages[this.currentpage].annotations;e.each(c,function(e){(f-e.x)*(f-e.endx)<=0&&(l-e.y)*(l-e.endy)<=0&&(a=e)}),a?(this.lastannotation=this.currentannotation,this.currentannotation=a,this.lastannotation&&this.lastannotation!==a&&this.lastannotation.drawable&&(this.lastannotation.drawable.erase(),this.drawables.push(this.lastannotation.draw()),this.drawablesannotations.push(this.lastannotation)),this.currentannotation.drawable&&this.currentannotation.drawable.erase(),this.drawables.push(this.currentannotation.draw()),this.drawablesannotations.push(this.currentannotation)):(this.lastannotation=this.currentannotation,this.currentannotation=null,this.lastannotation&&this.lastannotation.drawable&&(this.lastannotation.drawable.erase(),this.drawables.push(this.lastannotation.draw()),this.drawablesannotations.push(this.lastannotation)))}if(this.currentedit.tool==="resize"){var h=this.pages[this.currentpage
].annotations,p=null;e.each(h,function(n){e.each(n.resizeAreas,function(e){t.target==e&&(p=n)})}),p&&(this.resizeareaselected=t.target.get("id"),t.target.getData("direction")==="left"||t.target.getData("direction")==="right"?n.setStyle("cursor","col-resize"):n.setStyle("cursor","row-resize"),this.lastannotation=this.currentannotation,this.currentannotation=p)}this.currentannotation&&(this.currentedit.annotationstart={x:this.currentannotation.x,y:this.currentannotation.y})},edit_move:function(e){e.preventDefault();var t=this.get_canvas_bounds(),n=this.get_dialogue_element(s.DRAWINGCANVAS),r=this.get_dialogue_element(s.DRAWINGREGION),i=new M.assignfeedback_editpdfplus.point(e.clientX+n.get("docScrollX"),e.clientY+n.get("docScrollY")),o=this.get_canvas_coordinates(i),u,a;if(o.x<0||o.x>t.width||o.y<0||o.y>t.height)return;this.currentedit.tool==="pen"&&this.currentedit.path.push(o);if(this.currentedit.tool==="select")this.currentannotation&&this.currentedit&&this.currentannotation.move(this.currentedit.annotationstart.x+o.x-this.currentedit.start.x,this.currentedit.annotationstart.y+o.y-this.currentedit.start.y);else if(this.currentedit.tool==="drag")u=o.x-this.currentedit.start.x,a=o.y-this.currentedit.start.y,r.getDOMNode().scrollLeft-=u,r.getDOMNode().scrollTop-=a;else if(this.currentedit.tool==="resize"&&this.resizeareaselected){var f=this.get_dialogue_element("#"+this.resizeareaselected);this.currentannotation.mousemoveResize(e,o,f)}else this.currentedit.start&&(this.currentedit.end=o,this.redraw_current_edit())},edit_end:function(e){var t,n;t=(new Date).getTime()-this.currentedit.start;if(t<f||this.currentedit.start===!1)return;var r=this.currentedit.id;this.currentedit.id&&this.currentedit.id[0]==="c"&&(r=this.currentedit.id.substr(8));if(this.currentedit.tool!=="select"&&this.currentedit.tool!=="drag"&&this.currentedit.tool!=="resize"){n=this.create_annotation(this.currentedit.tool,this.currentedit.id,{},this.tools[r]);if(n){this.currentdrawable&&this.currentdrawable.erase(),this.currentdrawable=!1;if(n.init_from_edit(this.currentedit)){this.currentannotation=n,n.draw_catridge(this.currentedit),n.edit_annot();if(n.parent_annot_element){var i=0;n.parent_annot_element.id?i=n.parent_annot_element.id:i=n.parent_annot_element.divcartridge,this.annotationsparent[i]?this.annotationsparent[i][this.annotationsparent[i].length]=n:this.annotationsparent[i]=[n]}this.pages[this.currentpage].annotations.push(n),this.drawables.push(n.draw()),this.drawablesannotations.push(n)}}}else if(this.currentedit.tool==="resize"&&this.resizeareaselected){var o=this.get_dialogue_element("#"+this.resizeareaselected);this.currentannotation.mouseupResize(e,o);var u=this.get_dialogue_element(s.DRAWINGCANVAS);u.setStyle("cursor","default"),this.resizeareaselected=null}this.save_current_page(),this.currentedit.starttime=0,this.currentedit.start=!1,this.currentedit.end=!1,this.currentedit.path=[],this.currentedit.tool!=="drag"&&this.currentedit.tool!=="resize"&&this.handle_tool_button_action("select")},temporise:function(e,t,n){e.preventDefault(),setTimeout(t,n)},resize:function(){var t,n,r,i,o;if(this.dialogue){if(!this.dialogue.get("visible"))return;this.dialogue.centerDialogue()}var u=document.getElementsByClassName(s.DRAWINGTOOLBAR);if(u.length>0){var a=u[0];r=a.getBoundingClientRect().height,i=a.getBoundingClientRect().bottom}else r=52,i=170;var f=document.querySelector("div[data-region='grade-actions-panel']");f?o=f.getBoundingClientRect().height:o=60,n=e.one("body").get("winHeight")-(o+i),n<100&&(n=100);var l=document.getElementsByClassName(s.DRAWINGREGIONCLASS);l.length>0?(t=l[0],t.style.top=r+"px",t.style.maxHeight=n+"px"):(t=this.get_dialogue_element(s.DRAWINGREGION),this.dialogue&&t.setStyle("maxHeight",n+"px"));try{this.redraw()}catch(c){}return!0},create_annotation:function(e,t,n,r){t!==null&&t[0]==="c"&&(n.toolid=t.substr(8));if(!n.tooltype||n.tooltype==="")n.tooltype=r;return n.tool=e,n.editor=this,n.tool===c.LINE+""||n.tool===h.LINE?new M.assignfeedback_editpdfplus.annotationline(n):n.tool===c.RECTANGLE+""||n.tool===h.RECTANGLE?new M.assignfeedback_editpdfplus.annotationrectangle(n):n.tool===c.OVAL+""||n.tool===h.OVAL?new M.assignfeedback_editpdfplus.annotationoval(n):n.tool===c.PEN+""||n.tool===h.PEN?new M.assignfeedback_editpdfplus.annotationpen(n):n.tool===c.HIGHLIGHT+""||n.tool===h.HIGHLIGHT?new M.assignfeedback_editpdfplus.annotationhighlight(n):n.tool===c.FRAME+""||n.tool===h.FRAME?(r&&n.colour===""&&(n.colour=this.typetools[r.type].color),!n.parent_annot&&!n.parent_annot_element&&(this.currentedit.parent_annot_element?n.parent_annot_element=this.currentedit.parent_annot_element:(n.parent_annot_element=null,n.parent_annot=0)),new M.assignfeedback_editpdfplus.annotationframe(n)):(r&&(r.colors&&r.colors.indexOf(",")!==-1?n.colour=r.colors.substr(0,r.colors.indexOf(",")):n.colour=r.colors,n.colour===""&&(n.colour=this.typetools[r.type].color)),n.tool===c.HIGHLIGHTPLUS+""||n.tool===h.HIGHLIGHTPLUS?new M.assignfeedback_editpdfplus.annotationhighlightplus(n):n.tool===c.STAMPPLUS+""||n.tool===h.STAMPPLUS?new M.assignfeedback_editpdfplus.annotationstampplus(n):n.tool===c.VERTICALLINE+""||n.tool===h.VERTICALLINE?new M.assignfeedback_editpdfplus.annotationverticalline(n):n.tool===c.STAMPCOMMENT+""||n.tool===h.STAMPCOMMENT?new M.assignfeedback_editpdfplus.annotationstampcomment(n):n.tool===c.COMMENTPLUS+""||n.tool===h.COMMENTPLUS?new M.assignfeedback_editpdfplus.annotationcommentplus(n):!1)},refresh_pdf:function(){var t=n,r;r={method:"post",context:this,sync:!1,data:{sesskey:M.cfg.sesskey,action:"generatepdf",userid:this.get("userid"),attemptnumber:this.get("attemptnumber"),assignmentid:this.get("assignmentid"),refresh:!0},on:{success:function(t,n){var r;try{r=e.JSON.parse(n.responseText);if(r.error)return new M.core.ajaxException(r);e.one(s.UNSAVEDCHANGESINPUT).set("value","true"),e.one(s.UNSAVEDCHANGESDIVEDIT).setStyle("opacity",1),e.one(s.UNSAVEDCHANGESDIVEDIT).setStyle("display","inline-block"),e.one(s.UNSAVEDCHANGESDIVEDIT
).transition({duration:1,delay:2,opacity:0},function(){e.one(s.UNSAVEDCHANGESDIVEDIT).setStyle("display","none")})}catch(i){return new M.core.exception(i)}},failure:function(e,t){return new M.core.exception(t.responseText)}}},e.io(t,r)},save_current_page:function(){this.clear_warnings(!1);var t=n,