Gitlab CSE Unil

Commit 9a0554d6 authored by M. Chardon's avatar M. Chardon
Browse files

bug outil CON avec les frame enfants

parent 37c852c7
......@@ -693,7 +693,7 @@ Y.extend(ANNOTATION, Y.Base, {
this.borderstyle = config.parent_annot_element.borderstyle || 'solid';
this.parent_annot = config.parent_annot_element.id;
this.parent_annot_element = config.parent_annot_element;
config.parent_annot_element.children.push(this);
//config.parent_annot_element.children.push(this);
} else {
this.editor = config.editor || null;
this.gradeid = parseInt(config.gradeid, 10) || 0;
......@@ -915,6 +915,12 @@ Y.extend(ANNOTATION, Y.Base, {
buttoncanceldisplay.on('click', this.cancel_edit, this);
return buttoncanceldisplay;
},
get_button_question: function () {
var buttonquestion = "<button id='" + this.divcartridge + "_buttonquestion' ><img src='" + M.util.image_url('help', 'core') + "' /><img src='" + M.util.image_url('t/stop', 'core') + "' /></button>";
var buttonquestiondisplay = Y.Node.create(buttonquestion);
buttonquestiondisplay.on('click', this.change_question_status, this);
return buttonquestiondisplay;
},
get_valref: function () {
if (this.textannot && this.textannot.length > 0 && typeof this.textannot === 'string') {
return this.textannot;
......@@ -970,6 +976,9 @@ Y.extend(ANNOTATION, Y.Base, {
this.apply_visibility_annot();
this.editor.save_current_page();
},
change_question_status: function () {
//var buttonquestion = this.editor.get_dialogue_element('#' + this.divcartridge + "_buttonquestion");
},
move_cartridge_begin: function (e) {
e.preventDefault();
......@@ -1020,7 +1029,6 @@ Y.extend(ANNOTATION, Y.Base, {
this.drawable.shapes.push(shape);
shape.editor = this.editor;
//shape.on('clickoutside', this.remove_selection, this);
shape.on('clickoutside', Y.rbind(this.editor.redraw_annotation, this.editor));
// Add a delete X to the annotation.
......@@ -1049,12 +1057,6 @@ Y.extend(ANNOTATION, Y.Base, {
}
return this.drawable;
},
remove_selection: function (e) {
Y.log('remove_selection');
if (this.drawable) {
this.drawable.erase();
}
},
/**
* Draw an annotation
* @public
......@@ -1139,7 +1141,9 @@ Y.extend(ANNOTATION, Y.Base, {
divdisplay.show();
divdisplay.set('style', 'display:inline;color:' + this.get_color_cartridge() + ';');
}
buttonplus.show();
if (buttonplus) {
buttonplus.show();
}
divedit.hide();
buttonsave.hide();
buttoncancel.hide();
......@@ -2112,6 +2116,9 @@ Y.extend(ANNOTATIONHIGHLIGHTPLUS, M.assignfeedback_editpdfplus.annotation, {
divconteneurdisplay.append(buttoncanceldisplay);*/
var divconteneurdisplay = this.get_div_container(colorcartridge);
divdisplay.append(divconteneurdisplay);
if (this.tooltype.reply===1) {
divconteneurdisplay.append(this.get_button_question());
}
//creation de la div d'edition
if (!this.editor.get('readonly')) {
......@@ -2864,7 +2871,6 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
highlightcolour = this.get_color();
//var date = (new Date().toJSON()).replace(/:/g, '').replace(/\./g, '');
this.shape_id = 'ct_frame_' + (new Date().toJSON()).replace(/:/g, '').replace(/\./g, '');
shape = this.editor.graphic.addShape({
id: this.shape_id,
......@@ -2878,6 +2884,9 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
x: bounds.x,
y: bounds.y
});
if (this.parent_annot_element) {
shape.addClass('class_' + this.parent_annot_element.divcartridge);
}
if (this.borderstyle === 'dashed') {
shape.set("stroke", {
dashstyle: [5, 3]
......@@ -2932,6 +2941,9 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
x: bounds.x,
y: edit.start.y - 8
});
if (this.parent_annot_element) {
shape.addClass('class_' + this.parent_annot_element.divcartridge);
}
if (this.borderstyle === 'dashed') {
shape.set("stroke", {
dashstyle: [5, 3]
......@@ -2964,7 +2976,6 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
this.y = edit.start.y - 8;
this.endx = bounds.x + bounds.width;
this.endy = edit.start.y + 16 - 8;
//this.colour = edit.annotationcolour;
this.page = '';
return (bounds.has_min_width());
......@@ -3000,6 +3011,12 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
this.init_div_cartridge_id();
var drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
//rattachement de la shape
var shapechd = this.editor.graphic.getShapeById(this.shape_id);
if (shapechd) {
shapechd.addClass('class_' + this.divcartridge);
}
//init cartridge
var colorcartridge = this.get_color();
var divdisplay = this.get_div_cartridge(colorcartridge);
......@@ -3013,19 +3030,6 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
//creation input
var divconteneurdisplay = this.get_div_container(colorcartridge);
/*var divconteneur = "<div ";
divconteneur += "class='assignfeedback_editpdfplus_frame_conteneur' >";
divconteneur += "</div>";
var divconteneurdisplay = Y.Node.create(divconteneur);
var divinputdisplay = this.get_div_input(colorcartridge);
divinputdisplay.addClass('assignfeedback_editpdfplus_frame_input');
var inputvalref = this.get_input_valref();
var buttonsave = "<button id='" + this.divcartridge + "_buttonsave' style='display:none;margin-left:110px;'><img src='" + M.util.image_url('t/check', 'core') + "' /></button>";
var buttonsavedisplay = Y.Node.create(buttonsave);
buttonsavedisplay.on('click', this.save_annot, this, null);
var buttoncancel = "<button id='" + this.divcartridge + "_buttoncancel' style='display:none;'><img src='" + M.util.image_url('t/reset', 'core') + "' /></button>";
var buttoncanceldisplay = Y.Node.create(buttoncancel);
buttoncanceldisplay.on('click', this.cancel_edit, this);*/
if (!this.editor.get('readonly')) {
var buttonrender = "<button id='" + this.divcartridge + "_buttonpencil'><img src='";
buttonrender += M.util.image_url('e/text_highlight_picker', 'core');
......@@ -3037,14 +3041,9 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
buttonadd += "' /></button>";
var buttonadddisplay = Y.Node.create(buttonadd);
buttonadddisplay.on('click', this.add_annot, this);
//divconteneurdisplay.append(divinputdisplay);
//divconteneurdisplay.append(inputvalref);
//divconteneurdisplay.append(buttonsavedisplay);
//divconteneurdisplay.append(buttoncanceldisplay);
divconteneurdisplay.append(buttonrenderdisplay);
divconteneurdisplay.append(buttonadddisplay);
}
//divdisplay.append(divconteneurdisplay);
divdisplay.append(divconteneurdisplay);
//creation de la div d'edition
......@@ -3191,10 +3190,16 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
shape.set("stroke", {
color: this.colour
});
for (var i = 0; i < this.children.length; i++) {
if (this.children[i] && (this.children[i].parent_annot === this.id || this.children[i].parent_annot_element.divcartridge === this.divcartridge)) {
this.children[i].colour = colour;
var shapechd = this.editor.graphic.getShapeById(this.children[i].shape_id);
var shapesChildren = null;
if (this.id) {
shapesChildren = this.editor.annotationsparent[this.id];
} else {
shapesChildren = this.editor.annotationsparent[this.divcartridge];
}
if (shapesChildren) {
for (var i = 0; i < shapesChildren.length; i++) {
shapesChildren[i].colour = colour;
var shapechd = this.editor.graphic.getShapeById(shapesChildren[i].shape_id);
if (shapechd) {
shapechd.set("stroke", {
color: this.colour
......@@ -3235,10 +3240,16 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
dashstyle: [2, 2]
});
}
for (i = 0; i < this.children.length; i++) {
if (this.children[i] && (this.children[i].parent_annot === this.id || this.children[i].parent_annot_element.divcartridge === this.divcartridge)) {
this.children[i].borderstyle = border;
var shapechd = this.editor.graphic.getShapeById(this.children[i].shape_id);
var shapesChildren = [];
if (this.id) {
shapesChildren = this.editor.annotationsparent[this.id];
} else {
shapesChildren = this.editor.annotationsparent[this.divcartridge];
}
if (shapesChildren) {
for (var i = 0; i < shapesChildren.length; i++) {
shapesChildren[i].borderstyle = border;
var shapechd = this.editor.graphic.getShapeById(shapesChildren[i].shape_id);
if (shapechd) {
if (this.borderstyle === 'solid') {
shapechd.set("stroke", {
......@@ -3262,7 +3273,6 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
});
var divpalette = this.editor.get_dialogue_element('#' + this.divcartridge + "_picker");
divpalette.hide();
//Y.log('change_border : ' + this.borderstyle);
this.editor.save_current_page();
},
edit_annot: function (e) {
......@@ -3305,7 +3315,6 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
if (annotations[i] === this) {
if (this.divcartridge !== '') {
var divid = '#' + this.divcartridge;
//Y.log('draw_catridge : ' + divid);
var divdisplay = this.editor.get_dialogue_element(divid);
divdisplay.remove();
}
......@@ -3313,20 +3322,33 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
if (this.drawable) {
this.drawable.erase();
}
if (this.children && this.children.length > 0) {
for (i = 0; i < this.children.length; i++) {
if (this.children[i] && (this.children[i].parent_annot === this.id || this.children[i].parent_annot_element.divcartridge === this.divcartridge)) {
for (var j = 0; j < annotations.length; j++) {
if (annotations[j] === this.children[i]) {
annotations.splice(j, 1);
if (this.children[i].drawable) {
this.children[i].drawable.erase();
}
var shapesChildren = [];
if (this.id) {
shapesChildren = this.editor.annotationsparent[this.id];
} else {
shapesChildren = this.editor.annotationsparent[this.divcartridge];
}
if (shapesChildren) {
for (var i = 0; i < shapesChildren.length; i++) {
for (var j = 0; j < annotations.length; j++) {
if (annotations[j] === shapesChildren[i]) {
annotations.splice(j, 1);
if (shapesChildren[i].drawable) {
shapesChildren[i].drawable.erase();
}
//shapesChildren[i].destroy();
}
}
}
}
/*var children = Y.all('.class_' + this.divcartridge).get('nodes');
for (var i = 0; i < children.length; i++) {
var shapechd = this.editor.graphic.getShapeById(children[i].get('id'));
if (shapechd) {
shapechd.destroy();
}
}*/
this.editor.currentannotation = false;
this.editor.save_current_page();
return;
......@@ -3335,7 +3357,6 @@ Y.extend(ANNOTATIONFRAME, M.assignfeedback_editpdfplus.annotation, {
}
});
M.assignfeedback_editpdfplus = M.assignfeedback_editpdfplus || {};
M.assignfeedback_editpdfplus.annotationframe = ANNOTATIONFRAME;
// This file is part of Moodle - http://moodle.org/
......@@ -5514,6 +5535,7 @@ EDITOR.prototype = {
* @public
*/
editingcomment: false,
annotationsparent: [],
/**
* Called during the initialisation process of the object.
* @method initializer
......@@ -5803,7 +5825,7 @@ EDITOR.prototype = {
* @method all_pages_loaded
*/
all_pages_loaded: function (responsetext) {
var data, i, j, comment, error;
var data, i, j, k, comment, error;
try {
data = Y.JSON.parse(responsetext);
if (data.error || !data.pagecount) {
......@@ -5860,6 +5882,13 @@ EDITOR.prototype = {
data.parent_annot_element = parentannot[data.parent_annot];
}
var newannot = this.create_annotation(this.typetools[this.tools[data.toolid].type].label, data.toolid, data, this.tools[data.toolid]);
if (newannot.parent_annot_element) {
if (this.annotationsparent[newannot.parent_annot_element.id]) {
this.annotationsparent[newannot.parent_annot_element.id][this.annotationsparent[newannot.parent_annot_element.id].length] = newannot;
} else {
this.annotationsparent[newannot.parent_annot_element.id] = [newannot];
}
}
parentannot[data.id] = newannot;
this.pages[i].annotations[j] = newannot;
}
......@@ -5961,7 +5990,7 @@ EDITOR.prototype = {
* @method handle_tool_button
*/
handle_tool_button: function (e, tool, toolid, has_parent) {
Y.log('handle_tool_button : ' + tool + ' - ' + toolid);
Y.log('handle_tool_button : ' + tool + ' - ' + toolid + ' - ' + has_parent);
e.preventDefault();
this.handle_tool_button_action(tool, toolid, has_parent);
},
......@@ -6238,6 +6267,19 @@ EDITOR.prototype = {
this.currentannotation = annotation;
annotation.draw_catridge(this.currentedit);
annotation.edit_annot();
if (annotation.parent_annot_element) {
var index = 0;
if (annotation.parent_annot_element.id) {
index = annotation.parent_annot_element.id;
} else {
index = annotation.parent_annot_element.divcartridge;
}
if (this.annotationsparent[index]) {
this.annotationsparent[index][this.annotationsparent[index].length] = annotation;
} else {
this.annotationsparent[index] = [annotation];
}
}
this.pages[this.currentpage].annotations.push(annotation);
this.drawables.push(annotation.draw());
this.drawablesannotations.push(annotation);
......
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",s={DIALOGUE:"assignfeedback_editpdfplus_widget"},o={PREVIOUSBUTTON:".navigate-previous-button",NEXTBUTTON:" .navigate-next-button",SEARCHCOMMENTSBUTTON:".searchcommentsbutton",SEARCHFILTER:".assignfeedback_editpdfplus_commentsearch input",SEARCHCOMMENTSLIST:".assignfeedback_editpdfplus_commentsearch ul",PAGESELECT:".navigate-page-select",LOADINGICON:".loading",PROGRESSBARCONTAINER:".progress-info.progress-striped",DRAWINGREGION:".drawingregion",DRAWINGCANVAS:".drawingcanvas",SAVE:".savebutton",COMMENTCOLOURBUTTON:".commentcolourbutton",COMMENTMENU:".commentdrawable a",ANNOTATIONCOLOURBUTTON:".annotationcolourbutton",DELETEANNOTATIONBUTTON:".deleteannotationbutton",UNSAVEDCHANGESDIV:".assignfeedback_editpdfplus_unsavedchanges",UNSAVEDCHANGESINPUT:'input[name="assignfeedback_editpdfplus_haschanges"]',STAMPSBUTTON:".currentstampbutton",DIALOGUE:"."+s.DIALOGUE,CUSTOMTOOLBARID:"#toolbaraxis",CUSTOMTOOLBARS:".customtoolbar",AXISCUSTOMTOOLBAR:".menuaxisselection",CUSTOMTOOLBARBUTTONS:".costumtoolbarbutton"},u="rgba(200, 200, 255, 0.9)",a="rgba(200, 200, 255, 0.5)",f="rgb(51, 51, 51)",l={white:"rgb(255,255,255)",yellow:"rgb(255,236,174)",red:"rgb(249,181,179)",green:"rgb(214,234,178)",blue:"rgb(203,217,237)",clear:"rgba(255,255,255, 0)"},c={white:"rgb(255,255,255)",yellow:"rgb(255,207,53)",red:"rgb(239,69,64)",green:"rgb(152,202,62)",blue:"rgb(125,159,211)",black:"rgb(51,51,51)"},h=300,p={pen:".penbutton",line:".linebutton",rectangle:".rectanglebutton",oval:".ovalbutton",select:".selectbutton",drag:".dragbutton",highlight:".highlightbutton"},d={HIGHLIGHTPLUS:1,LINEPLUS:2,STAMPPLUS:3,FRAME:4,VERTICALLINE:5,STAMPCOMMENT:6,COMMENTPLUS:7,PEN:8,LINE:9,RECTANGLE:10,OVAL:11,HIGHLIGHT:12},v={HIGHLIGHTPLUS:"highlightplus",LINEPLUS:"lineplus",STAMPPLUS:"stampplus",FRAME:"frame",VERTICALLINE:"verticalline",STAMPCOMMENT:"stampcomment",COMMENTPLUS:"commentplus",PEN:"pen",LINE:"line",RECTANGLE:"rectangle",OVAL:"oval",HIGHLIGHT:"highlight"},m=4,g=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=g;var y=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=y;var b=function(){this.start=!1,this.end=!1,this.starttime=0,this.annotationstart=!1,this.tool="drag",this.commentcolour="yellow",this.annotationcolour="red",this.stamp="",this.path=[]};M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.edit=b;var w=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,s;r=this.editor.get_dialogue_element(o.DRAWINGREGION),i=parseInt(r.get("scrollLeft"),10),s=parseInt(r.get("scrollTop"),10),e.setData("x",t+i),e.setData("y",n+s)}};M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.drawable=w;var E=function(e){E.superclass.constructor.apply(this,[e])};E.NAME="annotation",E.ATTRS={},e.extend(E,e.Base,{editor:null,gradeid:0,pageno:0,x:0,y:0,endx:0,endy:0,path:"",toolid:0,colour:"red",drawable:!1,tooltype:null,tooltypefamille:null,divcartridge:"",textannot:"",displaylock:0,displayrotation:0,borderstyle:"",parent_annot:0,parent_annot_element:null,id:0,shape_id:"",cartridgex:0,cartridgey:0,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.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.cartridgex=parseInt(e.parent_annot_element.cartridgex,10)||0,this.cartridgey=parseInt(e.parent_annot_element.cartridgey,10)||0,this.path=e.path||"",this.toolid=e.toolid||this.editor.get_dialogue_element(d.RECTANGLE),this.colour=e.parent_annot_element.colour||"red",this.drawable=!1,this.tooltype=e.tooltype,this.textannot=e.parent_annot_element.textannot,this.displaylock=e.parent_annot_element.displaylock,this.displayrotation=e.parent_annot_element.displayrotation,this.borderstyle=e.parent_annot_element.borderstyle||"solid",this.parent_annot=e.parent_annot_element.id,this.parent_annot_element=e.parent_annot_element,e.parent_annot_element.children.push(this)):(this.editor=e.editor||null,this.gradeid=parseInt(e.gradeid,10)||0,this.pageno=parseInt(e.pageno,10)||0,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.cartridgex=parseInt(e.cartridgex,10)||0,this.cartridgey=parseInt(e.cartridgey,10)||0,this.path=e.path||"",this.toolid=e.toolid||this.editor.get_dialogue_element(d.RECTANGLE),this.colour=e.colour||"red",this.drawable=!1
,this.tooltype=e.tooltype,this.textannot=e.textannot,this.displaylock=e.displaylock,this.displayrotation=e.displayrotation,this.borderstyle=e.borderstyle||"solid",this.parent_annot=e.parent_annot,this.id=e.id),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:this.parent_annot,divcartridge:this.divcartridge,parent_annot_div:this.parent_annot_element.divcartridge}:{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:this.parent_annot,divcartridge:this.divcartridge,parent_annot_div:""}},get_color:function(){var e=c[this.colour];return e?(e=e.replace("rgb","rgba"),e=e.replace(")",",0.5)")):e=this.colour,e},get_color_cartridge:function(){var e=c[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},get_div_cartridge:function(t){var n="<div ";return n+="id='"+this.divcartridge+"' ",n+="class='assignfeedback_editpdfplus_cartridge' ",n+="style='border-color: "+t+";'> ",n+="</div>",e.Node.create(n)},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+="style='display:none;'> ",t+="<input id='"+this.divcartridge+"_editinput' type='text' value=\""+this.get_valref()+'" />',t+="</div>";var n=e.Node.create(t),r=this.tooltype.texts;if(r&&r.length>0){var s="<div></div>",o=e.Node.create(s),u=r.split('","');for(i=0;i<u.length;i++){var a="<p class='btn btn-default'>"+u[i].replace('"',"")+"</p>",f=e.Node.create(a);f.on("click",this.fill_input_edition,this,u[i].replace('"',"")),o.append(f)}n.append(o)}return n},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=this.get_input_valref(),o=0;this.displaylock==="1"&&(o=1);var u=e.Node.create("<input type='hidden' id='"+this.divcartridge+"_onof' value="+o+" />"),a=this.editor.get("readonly");a||i.on("click",this.edit_annot,this),r.append(i),r.append(s),r.append(u);var a=this.editor.get("readonly");return a||(r.append(this.get_button_visibility()),r.append(this.get_button_save()),r.append(this.get_button_cancel())),r},get_button_visibility:function(){var t="<button id='"+this.divcartridge+"_buttonedit' ";t+="><img src='",this.displaylock===1?t+=M.util.image_url("t/left","core"):t+=M.util.image_url("t/right","core"),t+="' /></button>";var n=e.Node.create(t);return n.on("click",this.change_visibility_annot,this),n},get_button_save:function(){var t="<button id='"+this.divcartridge+"_buttonsave' style='display:none;margin-left:110px;'><img src='"+M.util.image_url("t/check","core")+"' /></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;'><img src='"+M.util.image_url("t/reset","core")+"' /></button>",n=e.Node.create(t);return n.on("click",this.cancel_edit,this),n},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+"_valref").get("value"),r=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit");n===""&&(this.editor.get("readonly")?e.setContent(""):e.setContent("&nbsp;&nbsp;&nbsp;&nbsp")),t.get("value")==="0"?(n!==""&&e.setContent(n.substr(0,20)),r&&r.one("img").setAttribute("src",M.util.image_url("t/right","core"))):(n!==""&&e.setContent(n),r&&r.one("img").setAttribute("src",M.util.image_url("t/left","core")))},change_visibility_annot:function(){var e=this.editor.get_dialogue_element("#"+this.divcartridge+"_onof");e.get("value")==="0"?(e.set("value",1),this.displaylock=1):(e.set("value",0),this.displaylock=2),this.apply_visibility_annot(),this.editor
.save_current_page()},move_cartridge_begin:function(e){e.preventDefault();var t=this.editor.get_dialogue_element(o.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;var i=this.editor.get_dialogue_element("#"+this.divcartridge+"_cartridge");i.on("mousemove",this.move_cartridge_continue,this),i.on("mouseup",this.move_cartridge_stop,this)},draw_highlight:function(){var t,n=this.editor.get_dialogue_element(o.DRAWINGREGION),r=this.editor.get_dialogue_element(o.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:m,color:u},fill:{color:a},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 s=e.Node.create('<img src="'+M.util.image_url("trash","assignfeedback_editpdfplus")+'"/>'),f=e.Node.create('<a href="#" role="button"></a>');s.setAttrs({alt:M.util.get_string("deleteannotation","assignfeedback_editpdfplus")}),s.setStyles({backgroundColor:"white"}),f.addClass("deleteannotationbutton"),f.append(s),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},remove_selection:function(e){this.drawable&&this.drawable.erase()},draw:function(){return this.draw_highlight(),this.drawable},draw_catridge:function(e){return!0},edit_annot:function(e){if(this.tooltype.type<=d.COMMENTPLUS&&!this.parent_annot_element){var t=this.editor.get_dialogue_element("#"+this.divcartridge),n=this.editor.get_dialogue_element("#"+this.divcartridge+"_display"),r=this.editor.get_dialogue_element("#"+this.divcartridge+"_edit"),i=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit"),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+"_editinput");n.hide(),i&&i.hide(),r.show(),s.show(),o.show(),t.setStyle("z-index",1e3),u.set("focus","on"),this.disabled_canvas_event(),t.on("clickoutside",this.cancel_edit,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:function(e){if(typeof e!="string"){var t=this.editor.get_dialogue_element("#"+this.divcartridge+"_editinput");e=t.get("value")}this.textannot=e,this.editor.save_current_page(),e.length===0&&(e="&nbsp;&nbsp;");var n=this.editor.get_dialogue_element("#"+this.divcartridge+"_valref");n.set("value",e),this.hide_edit(),this.apply_visibility_annot()},cancel_edit:function(e,t){if(t!=="clickoutside"||this.editor.currentannotation!==this){var n=this.editor.get_dialogue_element("#"+this.divcartridge+"_valref"),r=this.editor.get_dialogue_element("#"+this.divcartridge+"_editinput");if(n){var i=n.get("value");r.set("value",i)}this.hide_edit();var s=this.editor.get_dialogue_element("#"+this.divcartridge);s.detach()}return},hide_edit:function(){var e=this.editor.get_dialogue_element("#"+this.divcartridge),t=this.editor.get_dialogue_element("#"+this.divcartridge+"_display"),n=this.editor.get_dialogue_element("#"+this.divcartridge+"_edit"),r=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit"),i=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonsave"),s=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttoncancel");t&&(t.show(),t.set("style","display:inline;color:"+this.get_color_cartridge()+";")),r.show(),n.hide(),i.hide(),s.hide(),e.setStyle("z-index",1),this.enabled_canvas_event()},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())},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(o.DRAWINGCANVAS);e.detach()},enabled_canvas_event:function(){var e=this.editor.get_dialogue_element(o.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=E;var S=function(e){S.superclass.constructor.apply(this,[e])};S.NAME="annotationline",S.ATTRS={},e.extend(S,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:m,color:c[this.colour]}}),n.moveTo(this.x,this.y),n.lineTo(this.endx,this.endy),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;return r=this.editor.graphic.addShape({type:e.Path,fill:!1,stroke:{weight:m,color:c[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=S;var x=function(e){x.superclass.constructor.apply(this,[e])};x.NAME="annotationrectangle",x.ATTRS={},e.extend(x,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:m,color:c[this.colour]},x:n.x,y:n.y}),t.shapes.push(r),this.drawable=t,x.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:m,color:c[t.annotationcolour]},x:i.x,y:i.y}),n.shapes.push(r),n}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotationrectangle=x;var T=function(e){T.superclass.constructor.apply(this,[e])};T.NAME="annotationoval",T.ATTRS={},e.extend(T,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:m,color:c[this.colour]},x:n.x,y:n.y}),t.shapes.push(r),this.drawable=t,T.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:m,color:c[t.annotationcolour]},x:i.x,y:i.y}),n.shapes.push(r),n}}),M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.annotationoval=T;var N=function(e){N.superclass.constructor.apply(this,[e])};N.NAME="annotationpen",N.ATTRS={},e.extend(N,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:m,color:c[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,N.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:m,color:c[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=N;var C=function(e){C.superclass.constructor.apply(this,[e])};C.NAME="annotationhighlight",C.ATTRS={},e.extend(C,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=c[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,C.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=c[t.annotationcolour],s=s.replace("rgb","rgba"),s=s.replace(")",",0.5)"),r=this.editor.graphic.addShape({type:e.Rect,width:i.width,height:16,stroke:!1,fill:{color:s},x:i.x,y:t.start.y}),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=C;var k=function(e){k.superclass.constructor.apply(this,[e])};k.NAME="annotationhighlightplus",k.ATTRS={},e.extend(k,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=this.get_color(),n=this.editor.graphic.addShape({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(),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:!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(e){var t=this.editor.get_dialogue_element(o.DRAWINGCANVAS).getXY();if(this.divcartridge===""){this.init_div_cartridge_id();var n=this.editor.get_dialogue_element(o.DRAWINGCANVAS),r=this.get_color_cartridge(),i=this.get_div_cartridge(r);i.addClass("assignfeedback_editpdfplus_hightlightplus");var s=this.get_div_cartridge_label(r);i.append(s);var u=this.get_div_container(r);i.append(u);if(!this.editor.get("readonly")){var a=this.get_div_edition();a.addClass("assignfeedback_editpdfplus_hightlightplus_edition"),u.append(a)}if(!this.cartridgex||this.cartridgex===0)this.cartridgex=parseInt(this.tooltypefamille.cartridge_x);if(!this.cartridgey||this.cartridgey===0)this.cartridgey=parseInt(this.tooltypefamille.cartridge_y);i.setX(this.x+this.cartridgex),i.setY(this.y+this.cartridgey),n.append(i),this.apply_visibility_annot()}else{var i=this.editor.get_dialogue_element("#"+this.divcartridge);i.setX(t[0]+this.x+this.cartridgex),i.setY(t[1]+this.y+this.cartridgey)}return!0},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()}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=k;var L=function(e){L.superclass.constructor.apply(this,[e])};L.NAME="annotationstamp",L.ATTRS={},e.extend(L,M.assignfeedback_editpdfplus.annotation,{draw:function(){var t=new M.assignfeedback_editpdfplus.drawable(this.editor),n=this.editor.get_dialogue_element(o.DRAWINGCANVAS),r,i;return i=this.editor.get_window_coordinates(new M.assignfeedback_editpdfplus.point(this.x,this.y)),r=e.Node.create("<div/>"),r.setStyles({position:"absolute",display:"inline-block",backgroundImage:"url("+this.editor.get_stamp_image_url(this.path)+")",width:this.endx-this.x,height:this.endy-this.y,backgroundSize:"100% 100%",zIndex:50}),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,L.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(o.DRAWINGREGION),s,u;return n.bound([t.start,t.end]),u=this.editor.get_window_coordinates(new M.assignfeedback_editpdfplus.point(n.x,n.y)),s=e.Node.create("<div/>"),s.setStyles({position:"absolute",display:"inline-block",backgroundImage:"url("+this.editor.get_stamp_image_url(t.stamp)+")",width:n.width,height:n.height,backgroundSize:"100% 100%",zIndex:50}),i.append(s),s.setX(u.x),s.setY(u.y),r.store_position(s,u.x,u.y),r.nodes.push(s),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,this.y=t.y,this.endx=t.x+t.width,this.endy=t.y+t.height,this.colour=e.annotationcolour,this.path=e.stamp,!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.annotationstamp=L;var A=function(e){A.superclass.constructor.apply(this,[e])};A.NAME="annotationstampplus",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(o.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,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(o.DRAWINGREGION),s,u;return n.bound([t.start,t.end]),u=this.editor.get_window_coordinates(new M.assignfeedback_editpdfplus.point(n.x,n.y)),s=e.Node.create("<div>"+this.tooltype.label+"</div>"),s.setStyles({position:"absolute",display:"inline-block",color
:this.colour,border:"2px solid "+this.colour,padding:"0 2px"}),i.append(s),s.setX(u.x),s.setY(u.y),r.store_position(s,u.x,u.y),r.nodes.push(s),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-20,this.y=t.y-10,this.endx=t.x+t.width,this.endy=t.y+t.height,!0},edit_annot:function(e){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=A;var O=function(e){O.superclass.constructor.apply(this,[e])};O.NAME="annotationstampcomment",O.ATTRS={},e.extend(O,M.assignfeedback_editpdfplus.annotation,{draw:function(){var t=new M.assignfeedback_editpdfplus.drawable(this.editor),n=this.editor.get_dialogue_element(o.DRAWINGCANVAS),r,i;return this.shape_id="ct_frame_"+(new Date).toJSON().replace(/:/g,"").replace(/\./g,""),i=this.editor.get_window_coordinates(new M.assignfeedback_editpdfplus.point(this.x,this.y)),r=e.Node.create('<div id="'+this.shape_id+'"/>'),r.setStyles({position:"absolute",display:"inline-block",backgroundImage:"url("+M.util.image_url("twoway_h","assignfeedback_editpdfplus")+")",width:this.endx-this.x,height:this.endy-this.y,backgroundSize:"100% 100%"}),this.displayrotation>0&&r.setStyles({backgroundImage:"url("+M.util.image_url("twoway_v","assignfeedback_editpdfplus")+")"}),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(),O.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(o.DRAWINGREGION),s,u;return n.bound([t.start,t.end]),u=this.editor.get_window_coordinates(new M.assignfeedback_editpdfplus.point(n.x,n.y)),s=e.Node.create("<div/>"),s.setStyles({position:"absolute",display:"inline-block",backgroundImage:"url("+M.util.image_url("twoway_h","assignfeedback_editpdfplus")+")",width:n.width,height:n.height,backgroundSize:"100% 100%"}),i.append(s),s.setX(u.x),s.setY(u.y),r.store_position(s,u.x,u.y),r.nodes.push(s),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,this.colour=e.annotationcolour,this.path=e.stampcomment,!0},draw_catridge:function(t){var n=this.editor.get_dialogue_element(o.DRAWINGCANVAS).getXY();if(this.divcartridge===""){this.init_div_cartridge_id();var r=this.editor.get_dialogue_element(o.DRAWINGCANVAS),i=this.get_color_cartridge(),s=this.get_div_cartridge(i);s.addClass("assignfeedback_editpdfplus_stampcomment");var u=this.get_div_cartridge_label(i);s.append(u);var a=this.get_div_container(i);s.append(a);if(!this.editor.get("readonly")){var f=0;this.displayrotation>0&&(f=1);var l=e.Node.create("<input type='hidden' id='"+this.divcartridge+"_rotation' value="+f+" />");a.append(l);var c="<button id='"+this.divcartridge+"_buttonrotation'><img src='"+M.util.image_url("e/restore_draft","core")+"' /></button>",h=e.Node.create(c);h.on("click",this.change_stamp,this),a.append(h)}if(!this.editor.get("readonly")){var p=this.get_div_edition();p.addClass("assignfeedback_editpdfplus_stampcomment_edition"),a.append(p)}if(!this.cartridgex||this.cartridgex===0)this.cartridgex=parseInt(this.tooltypefamille.cartridge_x);if(!this.cartridgey||this.cartridgey===0)this.cartridgey=parseInt(this.tooltypefamille.cartridge_y);s.setX(this.x+this.cartridgex),s.setY(this.y+this.cartridgey),r.append(s),this.apply_visibility_annot()}else{var s=this.editor.get_dialogue_element("#"+this.divcartridge);s.setX(n[0]+this.x+this.cartridgex),s.setY(n[1]+this.y+this.cartridgey)}return!0},change_stamp:function(){var e=this.editor.get_dialogue_element("#"+this.divcartridge+"_rotation"),t=this.editor.get_dialogue_element("#"+this.shape_id);e.get("value")==="0"?(this.displayrotation=1,e.set("value",1),t.setStyles({backgroundImage:"url("+M.util.image_url("twoway_v","assignfeedback_editpdfplus")+")"})):(e.set("value",0),t.setStyles({backgroundImage:"url("+M.util.image_url("twoway_h","assignfeedback_editpdfplus")+")"}),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=O;var _=function(e){_.superclass.constructor.apply(this,[e])};_.NAME="annotationframe",_.ATTRS={},e.extend(_,M.assignfeedback_editpdfplus.annotation,{children:[],oldx:0,oldy:0,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.shape_id="ct_frame_"+(new Date).toJSON().replace(/:/g,"").replace(/\./g,""),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.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(),_.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.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())},get_color:function(){return this.colour},draw_catridge:function(t){if(this.parent_annot_element===null&&this.parent_annot===0){var n=this.editor.get_dialogue_element(o.DRAWINGCANVAS).getXY();if(this.divcartridge===""){this.init_div_cartridge_id();var r=this.editor.get_dialogue_element(o.DRAWINGCANVAS),i=this.get_color(),s=this.get_div_cartridge(i);s.addClass("assignfeedback_editpdfplus_frame"),s.setStyles({"border-style":this.borderstyle});var u=this.get_div_cartridge_label(i,!0);s.append(u);var a=this.get_div_container(i);if(!this.editor.get("readonly")){var f="<button id='"+this.divcartridge+"_buttonpencil'><img src='";f+=M.util.image_url("e/text_highlight_picker","core"),f+="' /></button>";var l=e.Node.create(f);l.on("click",this.display_picker,this);var c="<button id='"+this.divcartridge+"_buttonadd'><img src='";c+=M.util.image_url("t/add","core"),c+="' /></button>";var h=e.Node.create(c);h.on("click",this.add_annot,this),a.append(l),a.append(h)}s.append(a);if(!this.editor.get("readonly")){var p=this.get_div_edition();p.addClass("assignfeedback_editpdfplus_frame_edition"),a.append(p)}if(!this.editor.get("readonly")){var d="<div ";d+="id='"+this.divcartridge+"_picker' ",d+="class='assignfeedback_editpdfplus_frame_picker' ",d+="style='display:none;text-align:right;'> ",d+="</div>";var v=e.Node.create(d);a.append(v);var m=e.Node.create("<div style='display:inline-block;vertical-align:top;'></div>"),g=e.Node.create("<div style='display:inline-block;vertical-align:top;'></div>");v.append(m),v.append(g);var y=e.Node.create("<div style='margin:5px;background-color:white;border:2px solid #ccc;min-width:20px;min-height:20px;'></div>");y.on("click",this.change_color,this,"white");var b=e.Node.create("<div style='margin:5px;background-color:orange;border:2px solid #ccc;min-width:20px;min-height:20px;'></div>");b.on("click",this.change_color,this,"orange");var w=e.Node.create("<div style='margin:5px;background-color:red;border:2px solid #ccc;min-width:20px;min-height:20px;'></div>");w.on("click",this.change_color,this,"red");var E=e.Node.create("<div style='margin:5px;background-color:green;border:2px solid #ccc;min-width:20px;min-height:20px;'></div>");E.on("click",this.change_color,this,"green");var S=e.Node.create("<div style='margin:5px;background-color:blue;border:2px solid #ccc;min-width:20px;min-height:20px;'></div>");S.on("click",this.change_color,this,"blue");var x=e.Node.create("<div style='margin:5px;background-color:black;border:2px solid #ccc;min-width:20px;min-height:20px;'></div>");x.on("click",this.change_color,this,"black"),m.append(y),m.append(b),m.append(w),m.append(E),m.append(S),m.append(x);var T=e.Node.create("<div style='margin:5px;border:2px solid #ccc;min-width:20px;min-height:20px;'></div>");T.on("click",this.change_border,this,"solid");var N=e.Node.create("<div style='margin:5px;border:2px dotted #ccc;min-width:20px;min-height:20px;'></div>");N.on("click",this.change_border,this,"dotted");var C=e.Node.create("<div style='margin:5px;border:2px dashed #ccc;min-width:20px;min-height:20px;'></div>");C.on("click",this.change_border,this,"dashed"),g.append(T),g.append(N),g.append(C)}if(!this.cartridgex||this.cartridgex===0)this.cartridgex=parseInt(this.tooltypefamille.cartridge_x);if(!this.cartridgey||this.cartridgey===0)this.cartridgey=parseInt(this.tooltypefamille.cartridge_y);s.setX(this.cartridgex),s.setY(this.y+this.cartridgey),r.append(s),this.apply_visibility_annot();if(!this.editor.get("readonly")){var k=this.editor.get_dialogue_element("#"+this.divcartridge+"_buttonedit");k.hide()}}else{var L="#"+this.divcartridge,s=this.editor.get_dialogue_element(L);s.setX(n[0]+this.cartridgex),s.setY(n[1]+this.y+this.cartridgey)}}return!0},move_cartridge_continue:function(e){e.preventDefault();var t=this.editor.get_dialogue_element(o.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(o.DRAWINGCANVAS).getXY(),s=r.x-this.oldx,u=r.y-this.oldy,a=this.editor.get_dialogue_element("#"+this.divcartridge);a.setX(i[0]+this.cartridgex+s),a.setY(i[1]+this.y+this.cartridgey+u)},move_cartridge_stop:function(e){e.preventDefault();var t=this.editor.get_dialogue_element("#"+this.divcartridge+"_cartridge");t.detach("mousemove",this.move_cartridge_continue,this),t.detach("mouseup",this.move_cartridge_stop,this);var n=this.editor.get_dialogue_element(o.DRAWINGCANVAS),r=new M.assignfeedback_editpdfplus.point(e.clientX+n.get("docScrollX"),e.clientY+n.get("docScrollY")),i=this.editor.get_canvas_coordinates(r),s=this.editor.get_dialogue_element(o.DRAWINGCANVAS).getXY(),u=i.x-this.oldx,a=i.y-this.oldy;this.cartridgex+=u,this.cartridgey+=a;var t=this.editor.get_dialogue_element
("#"+this.divcartridge);t.setX(s[0]+this.cartridgex),t.setY(s[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,v.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});for(var r=0;r<this.children.length;r++)if(this.children[r]&&(this.children[r].parent_annot===this.id||this.children[r].parent_annot_element.divcartridge===this.divcartridge)){this.children[r].colour=t;var i=this.editor.graphic.getShapeById(this.children[r].shape_id);i&&i.set("stroke",{color:this.colour})}var s=this.editor.get_dialogue_element("#"+this.divcartridge);s.setStyles({"border-color":this.colour,color:this.colour});var o=this.editor.get_dialogue_element("#"+this.divcartridge+"_cartridge");o.setStyles({"border-color":this.colour,color:this.colour});var u=this.editor.get_dialogue_element("#"+this.divcartridge+"_display");u.setStyles({color:this.colour}),this.hide_picker(),this.editor.save_current_page()},change_border:function(