Gitlab CSE Unil

Commit 6976b668 authored by M. Chardon's avatar M. Chardon
Browse files

améliorations visu barre d'outil / taille fenêtre

parent 03bd1445
...@@ -201,7 +201,7 @@ class tool { ...@@ -201,7 +201,7 @@ class tool {
} }
$datatool = $this->typeObject->label; $datatool = $this->typeObject->label;
$iconparams = array('data-tool' => $datatool, $iconparams = array('data-tool' => $datatool,
'class' => $this->typeObject->label . ' costumtoolbarbutton btn btn-secondary', 'class' => $this->typeObject->label . ' costumtoolbarbutton btn btn-light',
'id' => 'ctbutton' . $this->id, 'id' => 'ctbutton' . $this->id,
'type' => 'button', 'type' => 'button',
'style' => $this->getStyleButton()); 'style' => $this->getStyleButton());
......
...@@ -54,7 +54,7 @@ class tool_generic extends tool { ...@@ -54,7 +54,7 @@ class tool_generic extends tool {
$iconhtml = \html_writer::tag("i", "", array('class' => self::DISPLAY_CLASS_BUTTON[$this->label], 'aria-hidden' => 'true')); $iconhtml = \html_writer::tag("i", "", array('class' => self::DISPLAY_CLASS_BUTTON[$this->label], 'aria-hidden' => 'true'));
$iconparams = array( $iconparams = array(
'data-tool' => $this->label, 'data-tool' => $this->label,
'class' => $this->label . 'button generictoolbarbutton btn btn-secondary', 'class' => $this->label . 'button generictoolbarbutton btn btn-light',
'type' => 'button' 'type' => 'button'
); );
if ($this->id) { if ($this->id) {
......
...@@ -114,7 +114,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base { ...@@ -114,7 +114,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
//Random id for plugin identification //Random id for plugin identification
$linkid = html_writer::random_id(); $linkid = html_writer::random_id();
$labelLaunchedEditor = ($widget->readonly) ? get_string('viewfeedbackonline', self::PLUGIN_NAME) : get_string('launcheditor', self::PLUGIN_NAME); $labelLaunchedEditor = ($widget->readonly) ? get_string('viewfeedbackonline', self::PLUGIN_NAME) : get_string('launcheditor', self::PLUGIN_NAME);
$links = html_writer::tag('a', $labelLaunchedEditor, array('id' => $linkid, self::HTMLCLASS => 'btn btn-secondary', 'href' => '#')); $links = html_writer::tag('a', $labelLaunchedEditor, array('id' => $linkid, self::HTMLCLASS => 'btn btn-light', 'href' => '#'));
$html .= '<input type="hidden" name="assignfeedback_editpdfplus_haschanges" value="false"/>'; $html .= '<input type="hidden" name="assignfeedback_editpdfplus_haschanges" value="false"/>';
$html .= html_writer::div($links, 'visibleifjs'); $html .= html_writer::div($links, 'visibleifjs');
...@@ -133,7 +133,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base { ...@@ -133,7 +133,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
$nav_prev = 'nav_prev'; $nav_prev = 'nav_prev';
$nav_next = 'nav_next'; $nav_next = 'nav_next';
} }
$classNav = "btn btn-secondary "; $classNav = "btn btn-light ";
$iconhtmlP = $this->render_toolbar_button_icon("fa-caret-left fa-2x"); $iconhtmlP = $this->render_toolbar_button_icon("fa-caret-left fa-2x");
$navigation .= $this->render_toolbar_button_html($iconhtmlP, array(self::HTMLDISABLED => 'true', $navigation .= $this->render_toolbar_button_html($iconhtmlP, array(self::HTMLDISABLED => 'true',
self::HTMLCLASS => $classNav . 'navigate-previous-button')); self::HTMLCLASS => $classNav . 'navigate-previous-button'));
...@@ -143,7 +143,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base { ...@@ -143,7 +143,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
$navigation .= $this->render_toolbar_button_html($iconhtmlN, array(self::HTMLDISABLED => 'true', $navigation .= $this->render_toolbar_button_html($iconhtmlN, array(self::HTMLDISABLED => 'true',
self::HTMLCLASS => $classNav . "navigate-next-button")); self::HTMLCLASS => $classNav . "navigate-next-button"));
$navigationBlock = $this->render_toolbar($navigation, "mr-auto"); $navigationBlock = $this->render_toolbar($navigation, "mr-3");
$toolbarRotationBlock = ''; $toolbarRotationBlock = '';
$toolbarBaseBlock = ''; $toolbarBaseBlock = '';
...@@ -219,20 +219,26 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base { ...@@ -219,20 +219,26 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
[get_string('question_select', self::PLUGIN_NAME), get_string('question_select_without', self::PLUGIN_NAME), get_string('question_select_with', self::PLUGIN_NAME)], 'questionselection', 0, FALSE, array(self::HTMLCLASS => 'form-control')); [get_string('question_select', self::PLUGIN_NAME), get_string('question_select_without', self::PLUGIN_NAME), get_string('question_select_with', self::PLUGIN_NAME)], 'questionselection', 0, FALSE, array(self::HTMLCLASS => 'form-control'));
$statuschoice = html_writer::select( $statuschoice = html_writer::select(
[get_string('statut_select', self::PLUGIN_NAME), get_string('statut_select_nc', self::PLUGIN_NAME), get_string('statut_select_ok', self::PLUGIN_NAME), get_string('statut_select_ko', self::PLUGIN_NAME)], 'statutselection', 0, FALSE, array(self::HTMLCLASS => 'form-control')); [get_string('statut_select', self::PLUGIN_NAME), get_string('statut_select_nc', self::PLUGIN_NAME), get_string('statut_select_ok', self::PLUGIN_NAME), get_string('statut_select_ko', self::PLUGIN_NAME)], 'statutselection', 0, FALSE, array(self::HTMLCLASS => 'form-control'));
$validatebutton = $this->render_toolbar_button_html(get_string('send_pdf_update', self::PLUGIN_NAME), array(self::HTMLCLASS => 'btn btn-secondary', 'id' => 'student_valide_button')); $validatebutton = $this->render_toolbar_button_html(get_string('send_pdf_update', self::PLUGIN_NAME), array(self::HTMLCLASS => 'btn btn-light', 'id' => 'student_valide_button'));
$toolbarAxis .= $this->render_toolbar($statuschoice); $toolbarAxis .= $this->render_toolbar($statuschoice);
$toolbarAxis .= $this->render_toolbar($questionchoice, 'mr-3'); $toolbarAxis .= $this->render_toolbar($questionchoice, 'mr-3');
$toolbarAxis .= $this->render_toolbar($validatebutton, 'mr-0'); $toolbarAxis .= $this->render_toolbar($validatebutton, 'mr-0');
} }
$pageheadercontent = $navigationBlock $pageheadercontent = "<div class='d-flex align-content-center flex-nowrap align-items-center'>"
. $navigationBlock
. $toolbarAdminBlock . $toolbarAdminBlock
. "<div class='d-fex flex-wrap align-content-center align-items-center'>"
. $toolbarRotationBlock . $toolbarRotationBlock
. $toolbarBaseBlock . $toolbarBaseBlock
. "<div class='btn-group btn-group-sm p-1'>"
. $toolbarAxis . $toolbarAxis
. $toolbarCostumdiv . $toolbarCostumdiv
. $toolbarDrawBlock; . '</div>'
$mainnavigation = html_writer::div($pageheadercontent, "btn-toolbar btn-group-sm bg-light p-1", array('role' => 'toolbar')); . $toolbarDrawBlock
. '</div>'
. '</div>';
$mainnavigation = html_writer::div($pageheadercontent, "drawingtoolbar btn-toolbar btn-group-sm bg-light p-1", array('role' => 'toolbar'));
$body .= $mainnavigation; $body .= $mainnavigation;
......
...@@ -42,18 +42,10 @@ ...@@ -42,18 +42,10 @@
.assignfeedback_editpdfplus_widget .drawingregion { .assignfeedback_editpdfplus_widget .drawingregion {
border: 1px solid #ccc; border: 1px solid #ccc;
left: 0.1em; overflow: scroll;
right: 1em;
/*top: 52px;*/
bottom: 0;
position: absolute;
overflow: auto;
background-color: #ccc; background-color: #ccc;
touch-action: none; touch-action: none;
} max-height: 600px;
.assignfeedback_editpdfplus_widget[data-region="review-panel-content"] .drawingregion {
top: 52px;
} }
.assignfeedback_editpdfplus_widget { .assignfeedback_editpdfplus_widget {
...@@ -87,9 +79,7 @@ ...@@ -87,9 +79,7 @@
top: 60px; top: 60px;
} }
.yui3-colourpicker-hidden, .yui3-colourpicker-hidden {
.yui3-commentsearch-hidden,
.yui3-commentmenu-hidden {
display: none; display: none;
} }
...@@ -247,7 +237,6 @@ ...@@ -247,7 +237,6 @@
} }
ul.assignfeedback_editpdfplus_menu { ul.assignfeedback_editpdfplus_menu {
margin: 0; margin: 0;
min-width: 200px;
max-height: 40vh; max-height: 40vh;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
......
...@@ -32,7 +32,9 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php', ...@@ -32,7 +32,9 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
LOADINGICON: '.loading', LOADINGICON: '.loading',
PROGRESSBARCONTAINER: '.progress-info.progress-striped', PROGRESSBARCONTAINER: '.progress-info.progress-striped',
DRAWINGREGION: '.drawingregion', DRAWINGREGION: '.drawingregion',
DRAWINGREGIONCLASS: 'drawingregion',
DRAWINGCANVAS: '.drawingcanvas', DRAWINGCANVAS: '.drawingcanvas',
DRAWINGTOOLBAR: 'drawingtoolbar',
SAVE: '.savebutton', SAVE: '.savebutton',
ANNOTATIONCOLOURBUTTON: '.annotationcolourbutton', ANNOTATIONCOLOURBUTTON: '.annotationcolourbutton',
DELETEANNOTATIONBUTTON: '.deleteannotationbutton', DELETEANNOTATIONBUTTON: '.deleteannotationbutton',
...@@ -5064,6 +5066,11 @@ EDITOR.prototype = { ...@@ -5064,6 +5066,11 @@ EDITOR.prototype = {
drawingcanvas.on('gesturemoveend', this.edit_end, null, this); drawingcanvas.on('gesturemoveend', this.edit_end, null, this);
this.refresh_button_state(); this.refresh_button_state();
//trigger when window is resized
drawingcanvas.on('windowresize', this.resize, this);
var buttonChooseView = Y.one('.collapse-buttons');
buttonChooseView.on('click', this.temporise, this, this.resize, 500);
} }
this.start_generation(); this.start_generation();
...@@ -5971,14 +5978,23 @@ EDITOR.prototype = { ...@@ -5971,14 +5978,23 @@ EDITOR.prototype = {
} }
}, },
/**
* Temporise a function.
* @public
* @method resize
*/
temporise: function (e, fct, timeout) {
e.preventDefault();
setTimeout(fct, timeout);
},
/** /**
* Resize the dialogue window when the browser is resized. * Resize the dialogue window when the browser is resized.
* @public * @public
* @method resize * @method resize
*/ */
resize: function () { resize: function () {
var drawingregion, drawregionheight; var drawingregion, drawregionheight, drawregiontop;
if (this.dialogue) { if (this.dialogue) {
if (!this.dialogue.get('visible')) { if (!this.dialogue.get('visible')) {
return; return;
...@@ -5986,16 +6002,35 @@ EDITOR.prototype = { ...@@ -5986,16 +6002,35 @@ EDITOR.prototype = {
this.dialogue.centerDialogue(); this.dialogue.centerDialogue();
} }
//calculate top div
var drawingregionheaderSelector = document.getElementsByClassName(SELECTOR.DRAWINGTOOLBAR);
if (drawingregionheaderSelector.length > 0) {
var drawingregionheader = drawingregionheaderSelector[0];
drawregiontop = drawingregionheader.getBoundingClientRect().height;
} else {
drawregiontop = '52';
}
// Make sure the dialogue box is not bigger than the max height of the viewport. // Make sure the dialogue box is not bigger than the max height of the viewport.
drawregionheight = Y.one('body').get('winHeight') - 120; // Space for toolbar + titlebar. drawregionheight = Y.one('body').get('winHeight') - 120; // Space for toolbar + titlebar.
if (drawregionheight < 100) { if (drawregionheight < 100) {
drawregionheight = 100; drawregionheight = 100;
} }
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); var drawingregionSelector = document.getElementsByClassName(SELECTOR.DRAWINGREGIONCLASS);
if (this.dialogue) { if (drawingregionSelector.length > 0) {
drawingregion.setStyle('maxHeight', drawregionheight + 'px'); drawingregion = drawingregionSelector[0];
drawingregion.style.top = drawregiontop + 'px';
drawingregion.style.maxHeight = drawregionheight + 'px';
} else {
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
if (this.dialogue) {
drawingregion.setStyle('maxHeight', drawregionheight + 'px');
}
} }
this.redraw(); try {
this.redraw();
} catch (exception) {
}
return true; return true;
}, },
......
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",DRAWINGCANVAS:".drawingcanvas",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"},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,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",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 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"},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,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",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.
)||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.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},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 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.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},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"&&
);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 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"?
())),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},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("#"+ (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},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"
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())},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 ),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())},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.