Gitlab CSE Unil

Commit 065b0666 authored by Francois.Morier-Genoud's avatar Francois.Morier-Genoud
Browse files

minimal version complet: added appreciation on annotation

parent 64cc55a0
define(["jquery","./global"],function(a,b){function c(){return this._instanceID=e(),this}var d=0,e=function(){return++d};return c.getInstanceCount=function(){return d},c.prototype.getInstanceID=function(){return this._instanceID},c.x=0,c.y=0,c.endx=0,c.endy=0,c.path="",c.toolid=0,c.colour="red",c.tooltype=null,c.id=0,c.cartridgex=0,c.cartridgey=0,c.adminDemo=0,c.prototype.init=function(a){this.cartridgex=parseInt(a.cartridgex,10)||0,this.cartridgey=parseInt(a.cartridgey,10)||0,this.colour=a.colour||"red",this.tooltype=a.tooltype,this.id=a.id,this.x=parseInt(a.x,10)||0,this.y=parseInt(a.y,10)||0,this.endx=parseInt(a.endx,10)||0,this.endy=parseInt(a.endy,10)||0,this.path=a.path||"",this.toolid=a.toolid},c.prototype.initAdminDemo=function(a){this.id="previsu_annot",this.displaylock=1,this.adminDemo=1,this.tooltype=a,this.colour=a.get_color()},c.prototype.draw=function(){},c.prototype.get_color=function(){var a=b.ANNOTATIONCOLOUR[this.colour];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.colour,a},c.prototype.get_color_cartridge=function(){var a=b.ANNOTATIONCOLOUR[this.tooltype.get_color_cartridge()];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.tooltype.get_color_cartridge(),a},c.prototype.init_div_cartridge_id=function(){var a=(new Date).toJSON().replace(/:/g,"").replace(/\./g,"");this.tooltype.id?this.divcartridge="ct_"+this.tooltype.id+"_"+a:this.divcartridge="ct_"+this.id+"_"+a},c.prototype.get_div_cartridge=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"' ",d+="class='assignfeedback_editpdfplus_cartridge' ",d+="style='border-color: "+b+";position:relative;'> ",d+="</div>",c&&c.append(d);var e=a("#"+this.divcartridge);return this.adminDemo<1,e},c.prototype.get_div_cartridge_label=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"_cartridge' ",d+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_cartridge' ",d+="style='border-right-color: "+b+";color:"+b+";' ",d+="> ",d+=this.tooltype.cartridge,d+="</div>",c&&c.append(d);var e=a("#"+this.divcartridge+"_cartridge");return e},c.prototype.get_div_input=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"_display' ",d+="style='color:"+b+"; ",d+="'></div>",c.append(d);var e=a("#"+this.divcartridge+"_display");return e.on("click",{annotation:this},this.edit_annot),e},c.prototype.get_div_edition=function(b){var c="<div ";c+="id='"+this.divcartridge+"_edit' ",c+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_edition' ",c+="style='display:none;'> ",c+="<textarea id='"+this.divcartridge+"_editinput' type='text' class='form-control' style='margin-bottom:5px;'",1===this.adminDemo&&(c+=" readonly"),c+="></textarea>",c+="</div>",b&&b.append(c);var d=a("#"+this.divcartridge+"_edit"),e=this.tooltype.texts;if(e&&e.length>0){for(var f="<div class='btn-group-vertical aepp-toolbar-vertical'></div>",g=a(f),h=e.split('","'),i=0;i<h.length;i++){var j="<button class='btn btn-outline-dark'";1===this.adminDemo&&(j+=" disabled"),j+=" type='button'>"+h[i].replace(/"/g,"")+"</button>",g.append(j),this.adminDemo<1,g.append("<br/>")}d.append(g)}return d},c.prototype.get_div_container=function(b,c){var d="<div ";d+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_conteneur' >",d+="</div>",c&&c.append(d);var e=a(".assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_conteneur"),f=this.get_div_input(b,e);f.addClass("assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_input");var g=1;(this.displaylock||this.displaylock>=0)&&(g=this.displaylock);var h="<input type='hidden' id='"+this.divcartridge+"_onof' value="+g+" />";return c&&e.append(h),e.append(this.get_input_question()),e},c.prototype.get_toolbar=function(){var b=a("<div id='"+this.divcartridge+"_toolbar' class='btn-group btn-group-sm aepp-toolbar'></div>");return b.append(this.get_button_visibility_left()),b.append(this.get_button_visibility_right()),b.append(this.get_button_save()),b.append(this.get_button_cancel()),1===this.tooltype.reply&&b.append(this.get_button_question()),b.append(this.get_button_remove()),b},c.prototype.get_input_question=function(){var a=0;return this.answerrequested&&1===this.answerrequested&&(a=1),"<input type='hidden' id='"+this.divcartridge+"_question' value='"+a+"'/>"},c.prototype.get_button_visibility_right=function(){var b="<button id='"+this.divcartridge+"_buttonedit_right' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'>",b+="<i class='fa fa-arrow-right' aria-hidden='true'></i>",b+="</button>";var c=a(b);return this.adminDemo<1,c},c.prototype.get_button_visibility_left=function(){var b="<button id='"+this.divcartridge+"_buttonedit_left' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'>",b+="<i class='fa fa-arrow-left' aria-hidden='true'></i>",b+="</button>";var c=a(b);return this.adminDemo<1,c},c.prototype.get_button_save=function(){var b="<button id='"+this.divcartridge+"_buttonsave' style='display:none;margin-left:110px;' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'><i class='fa fa-check' aria-hidden='true'></i></button>";var c=a(b);return this.adminDemo<1&&c.on("click",this.save_annot),c},c.prototype.get_button_cancel=function(){var b="<button id='"+this.divcartridge+"_buttoncancel' style='display:none;' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'><i class='fa fa-undo' aria-hidden='true'></i></button>";var c=a(b);return this.adminDemo<1,c},c.prototype.get_button_question=function(){var b="<button id='"+this.divcartridge+"_buttonquestion' style='display:none;margin-left:10px;' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=' 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>';var c=a(b);return this.adminDemo<1,c},c.prototype.get_button_remove=function(){var b="<button id='"+this.divcartridge+"_buttonremove' style='display:none;margin-left:10px;' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'><i class='fa fa-trash' aria-hidden='true'></i></button>";var c=a(b);return this.adminDemo<1,c},c.prototype.apply_visibility_annot=function(){var b=a("#"+this.divcartridge+"_display"),c=a("#"+this.divcartridge+"_onof"),d=a("#"+this.divcartridge+"_buttonedit_right"),e=a("#"+this.divcartridge+"_buttonedit_left"),f=a("#"+this.divcartridge+"_radioContainer");c&&("1"===c.val()?(d&&d.show(),e&&e.show()):"0"===c.val()?(d&&d.show(),e&&e.hide()):(d&&d.hide(),e&&e.show())),b&&b.html(this.get_text_to_diplay_in_cartridge()),"frame"===this.tooltype.getToolTypeLabel()&&d&&(d.hide(),e.hide()),f&&f.hide(),this.apply_question_status()},c.prototype.get_text_to_diplay_in_cartridge=function(){var b=this.get_valref(),c=a("#"+this.divcartridge+"_onof"),d="";return""===b&&(d="&nbsp;&nbsp;&nbsp;&nbsp"),"1"===c.val()&&""!==b?d=b.substr(0,20):"0"===c.val()&&""!==b?d="...":""!==b&&(d=b),1===this.answerrequested&&(d+='&nbsp;<span style="color:red;">[?]</span>'),d},c.prototype.apply_question_status=function(){var b=a("#"+this.divcartridge+"_buttonquestion"),c=a("#"+this.divcartridge+"_question"),d=0;c&&(d=parseInt(c.val(),10)),b&&(1===d?b.html('<i class="fa fa-question-circle-o"></i>'):b.html('<span class="fa-stack fa-lg" style="line-height: 1em;width: 1em;"><i class="fa fa-question-circle-o fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x text-danger"></i></span>'))},c.prototype.draw_catridge=function(){return!0},c.prototype.edit_annot=function(c){if(c.data.annotation.tooltype.typetool<=b.TOOLTYPE.COMMENTPLUS){var d=c.data.annotation,e=a("#"+d.divcartridge),f=a("#"+d.divcartridge+"_display"),g=a("#"+d.divcartridge+"_edit"),h=a("#"+d.divcartridge+"_buttonedit_right"),i=a("#"+d.divcartridge+"_buttonedit_left"),j=a("#"+d.divcartridge+"_buttonsave"),k=a("#"+d.divcartridge+"_buttoncancel"),l=a("#"+d.divcartridge+"_buttonquestion"),m=a("#"+d.divcartridge+"_buttonrotation"),n=a("#"+d.divcartridge+"_buttonremove"),o=a("#"+d.divcartridge+"_editinput");f.hide(),h&&h.hide(),i&&i.hide(),m&&m.hide(),g.show(),j.show(),k.show(),l&&l.show(),n.show(),e.css("z-index",1e3),o&&o.attr("focus","on"),c.data.annotation.disabled_canvas_event(),a("#canevas").on("click",{annotation:d,action:"clickoutside"},d.save_annot_clickout)}},c.prototype.fill_input_edition=function(b,c){var d=a("#"+this.divcartridge+"_editinput");d&&d.set("value",c),this.save_annot(c)},c.prototype.save_annot_clickout=function(a){"canevas"===a.target.id&&1===a.data.annotation.adminDemo&&a.data.annotation.cancel_edit()},c.prototype.save_annot=function(b){if("string"!=typeof b){var c=a("#"+this.divcartridge+"_editinput");c&&(b=c.val())}this.textannot=b,0===b.length&&(b="&nbsp;&nbsp;"),this.hide_edit(),this.apply_visibility_annot()},c.prototype.cancel_edit=function(){var b=this.get_valref(),c=a("#"+this.divcartridge+"_editinput");b&&c&&c.set("value",b),this.hide_edit(),this.apply_visibility_annot();var d=a("#"+this.divcartridge);d&&d.off()},c.prototype.hide_edit=function(b,c){if(!c||"clickoutside"!==c||this.editor.currentannotation!==this){var d=a("#"+this.divcartridge),e=a("#"+this.divcartridge+"_display"),f=a("#"+this.divcartridge+"_edit"),g=a("#"+this.divcartridge+"_visu"),h=a("#"+this.divcartridge+"_buttonsave"),i=a("#"+this.divcartridge+"_buttoncancel"),j=a("#"+this.divcartridge+"_buttonquestion"),k=a("#"+this.divcartridge+"_buttonrotation"),l=a("#"+this.divcartridge+"_buttonremove"),m=a("#"+this.divcartridge+"_radioContainer");e&&(e.show(),e.css("color",this.get_color_cartridge())),k&&k.show(),f&&(f.hide(),h.hide(),i.hide()),g&&g.hide(),j&&j.hide(),l&&l.hide(),d&&(d.css("z-index",1),a("#canevas").off()),f&&this.enabled_canvas_event(),m&&m.hide()}},c.prototype.disabled_canvas_event=function(){var c=a(b.SELECTOR.DRAWINGCANVAS);c.off("click")},c.prototype.enabled_canvas_event=function(){},c.prototype.change_visibility_annot=function(b){var c=a("#"+this.divcartridge+"_onof"),d=parseInt(c.val(),10);"r"===b?d+=1:d-=1,c.val(d),this.displaylock=d,this.apply_visibility_annot()},c.prototype.get_valref=function(){return this.textannot&&this.textannot.length>0&&"string"==typeof this.textannot?this.textannot:""},c});
\ No newline at end of file
define(["jquery","./global"],function(a,b){function c(){return this._instanceID=e(),this}var d=0,e=function(){return++d};return c.getInstanceCount=function(){return d},c.prototype.getInstanceID=function(){return this._instanceID},c.x=0,c.y=0,c.endx=0,c.endy=0,c.path="",c.toolid=0,c.colour="red",c.tooltype=null,c.id=0,c.cartridgex=0,c.cartridgey=0,c.appreciation=0,c.adminDemo=0,c.prototype.init=function(a){this.cartridgex=parseInt(a.cartridgex,10)||0,this.cartridgey=parseInt(a.cartridgey,10)||0,this.colour=a.colour||"red",this.tooltype=a.tooltype,this.id=a.id,this.x=parseInt(a.x,10)||0,this.y=parseInt(a.y,10)||0,this.endx=parseInt(a.endx,10)||0,this.endy=parseInt(a.endy,10)||0,this.path=a.path||"",this.toolid=a.toolid},c.prototype.initAdminDemo=function(a){this.id="previsu_annot",this.displaylock=1,this.adminDemo=1,this.tooltype=a,this.colour=a.get_color()},c.prototype.draw=function(){},c.prototype.get_color=function(){var a=b.ANNOTATIONCOLOUR[this.colour];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.colour,a},c.prototype.get_color_cartridge=function(){var a=b.ANNOTATIONCOLOUR[this.tooltype.get_color_cartridge()];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.tooltype.get_color_cartridge(),a},c.prototype.init_div_cartridge_id=function(){var a=(new Date).toJSON().replace(/:/g,"").replace(/\./g,"");this.tooltype.id?this.divcartridge="ct_"+this.tooltype.id+"_"+a:this.divcartridge="ct_"+this.id+"_"+a},c.prototype.get_div_cartridge=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"' ",d+="class='assignfeedback_editpdfplus_cartridge' ",d+="style='border-color: "+b+";position:relative;'> ",d+="</div>",c&&c.append(d);var e=a("#"+this.divcartridge);return this.adminDemo<1,e},c.prototype.get_div_cartridge_label=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"_cartridge' ",d+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_cartridge' ",d+="style='border-right-color: "+b+";color:"+b+";' ",d+="> ",d+=this.tooltype.cartridge,d+="</div>",c&&c.append(d);var e=a("#"+this.divcartridge+"_cartridge");return e},c.prototype.get_div_input=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"_display' ",d+="style='color:"+b+"; ",d+="'></div>",c.append(d);var e=a("#"+this.divcartridge+"_display");return e.on("click",{annotation:this},this.edit_annot),e},c.prototype.get_div_edition=function(b){var c="<div ";c+="id='"+this.divcartridge+"_edit' ",c+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_edition' ",c+="style='display:none;'> ",c+="<textarea id='"+this.divcartridge+"_editinput' type='text' class='form-control' style='margin-bottom:5px;'",1===this.adminDemo&&(c+=" readonly"),c+="></textarea>",c+="</div>",b&&b.append(c);var d=a("#"+this.divcartridge+"_edit"),e=this.tooltype.texts;if(e&&e.length>0){for(var f="<div class='btn-group-vertical aepp-toolbar-vertical'></div>",g=a(f),h=e.split('","'),i=0;i<h.length;i++){var j="<button class='btn btn-outline-dark'";1===this.adminDemo&&(j+=" disabled"),j+=" type='button'>"+h[i].replace(/"/g,"")+"</button>",g.append(j),this.adminDemo<1,g.append("<br/>")}d.append(g)}return d},c.prototype.get_div_container=function(b,c){var d="<div ";d+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_conteneur' >",d+="</div>",c&&c.append(d);var e=a(".assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_conteneur"),f=this.get_div_input(b,e);f.addClass("assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_input");var g=1;(this.displaylock||this.displaylock>=0)&&(g=this.displaylock);var h="<input type='hidden' id='"+this.divcartridge+"_onof' value="+g+" />";return c&&e.append(h),e.append(this.get_input_question()),e},c.prototype.get_toolbar=function(){var b=a("<div id='"+this.divcartridge+"_toolbar' class='btn-group btn-group-sm aepp-toolbar'></div>");return b.append(this.get_button_visibility_left()),b.append(this.get_button_visibility_right()),b.append(this.get_button_save()),b.append(this.get_button_cancel()),1===this.tooltype.reply&&b.append(this.get_button_question()),b.append(this.get_button_remove()),b},c.prototype.get_input_question=function(){var a=0;return this.answerrequested&&1===this.answerrequested&&(a=1),"<input type='hidden' id='"+this.divcartridge+"_question' value='"+a+"'/>"},c.prototype.get_button_visibility_right=function(){var b="<button id='"+this.divcartridge+"_buttonedit_right' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'>",b+="<i class='fa fa-arrow-right' aria-hidden='true'></i>",b+="</button>";var c=a(b);return this.adminDemo<1,c},c.prototype.get_button_visibility_left=function(){var b="<button id='"+this.divcartridge+"_buttonedit_left' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'>",b+="<i class='fa fa-arrow-left' aria-hidden='true'></i>",b+="</button>";var c=a(b);return this.adminDemo<1,c},c.prototype.get_button_save=function(){var b="<button id='"+this.divcartridge+"_buttonsave' style='display:none;margin-left:110px;' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'><i class='fa fa-check' aria-hidden='true'></i></button>";var c=a(b);return this.adminDemo<1&&c.on("click",this.save_annot),c},c.prototype.get_button_cancel=function(){var b="<button id='"+this.divcartridge+"_buttoncancel' style='display:none;' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'><i class='fa fa-undo' aria-hidden='true'></i></button>";var c=a(b);return this.adminDemo<1,c},c.prototype.get_button_question=function(){var b="<button id='"+this.divcartridge+"_buttonquestion' style='display:none;margin-left:10px;' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=' 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>';var c=a(b);return this.adminDemo<1,c},c.prototype.get_button_remove=function(){var b="<button id='"+this.divcartridge+"_buttonremove' style='display:none;margin-left:10px;' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'><i class='fa fa-trash' aria-hidden='true'></i></button>";var c=a(b);return this.adminDemo<1,c},c.prototype.apply_visibility_annot=function(){var b=a("#"+this.divcartridge+"_display"),c=a("#"+this.divcartridge+"_onof"),d=a("#"+this.divcartridge+"_buttonedit_right"),e=a("#"+this.divcartridge+"_buttonedit_left"),f=a("#"+this.divcartridge+"_radioContainer");c&&("1"===c.val()?(d&&d.show(),e&&e.show()):"0"===c.val()?(d&&d.show(),e&&e.hide()):(d&&d.hide(),e&&e.show())),b&&b.html(this.get_text_to_diplay_in_cartridge()),"frame"===this.tooltype.getToolTypeLabel()&&d&&(d.hide(),e.hide()),f&&f.hide(),this.apply_question_status()},c.prototype.get_text_to_diplay_in_cartridge=function(){var b=this.get_valref(),c=a("#"+this.divcartridge+"_onof"),d="";return""===b&&(d="&nbsp;&nbsp;&nbsp;&nbsp"),"1"===c.val()&&""!==b?d=b.substr(0,20):"0"===c.val()&&""!==b?d="...":""!==b&&(d=b),1===this.answerrequested&&(d+='&nbsp;<span style="color:red;">[?]</span>'),d},c.prototype.apply_question_status=function(){var b=a("#"+this.divcartridge+"_buttonquestion"),c=a("#"+this.divcartridge+"_question"),d=0;c&&(d=parseInt(c.val(),10)),b&&(1===d?b.html('<i class="fa fa-question-circle-o"></i>'):b.html('<span class="fa-stack fa-lg" style="line-height: 1em;width: 1em;"><i class="fa fa-question-circle-o fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x text-danger"></i></span>'))},c.prototype.draw_catridge=function(){return!0},c.prototype.edit_annot=function(c){if(c.data.annotation.tooltype.typetool<=b.TOOLTYPE.COMMENTPLUS){var d=c.data.annotation,e=a("#"+d.divcartridge),f=a("#"+d.divcartridge+"_display"),g=a("#"+d.divcartridge+"_edit"),h=a("#"+d.divcartridge+"_buttonedit_right"),i=a("#"+d.divcartridge+"_buttonedit_left"),j=a("#"+d.divcartridge+"_buttonsave"),k=a("#"+d.divcartridge+"_buttoncancel"),l=a("#"+d.divcartridge+"_buttonquestion"),m=a("#"+d.divcartridge+"_buttonrotation"),n=a("#"+d.divcartridge+"_buttonremove"),o=a("#"+d.divcartridge+"_editinput");f.hide(),h&&h.hide(),i&&i.hide(),m&&m.hide(),g.show(),j.show(),k.show(),l&&l.show(),n.show(),e.css("z-index",1e3),o&&o.attr("focus","on"),c.data.annotation.disabled_canvas_event(),a("#canevas").on("click",{annotation:d,action:"clickoutside"},d.save_annot_clickout)}},c.prototype.fill_input_edition=function(b,c){var d=a("#"+this.divcartridge+"_editinput");d&&d.set("value",c),this.save_annot(c)},c.prototype.save_annot_clickout=function(a){"canevas"===a.target.id&&1===a.data.annotation.adminDemo&&a.data.annotation.cancel_edit()},c.prototype.save_annot=function(b){if("string"!=typeof b){var c=a("#"+this.divcartridge+"_editinput");c&&(b=c.val())}this.textannot=b,0===b.length&&(b="&nbsp;&nbsp;"),this.hide_edit(),this.apply_visibility_annot()},c.prototype.cancel_edit=function(){var b=this.get_valref(),c=a("#"+this.divcartridge+"_editinput");b&&c&&c.set("value",b),this.hide_edit(),this.apply_visibility_annot();var d=a("#"+this.divcartridge);d&&d.off()},c.prototype.hide_edit=function(b,c){if(!c||"clickoutside"!==c||this.editor.currentannotation!==this){var d=a("#"+this.divcartridge),e=a("#"+this.divcartridge+"_display"),f=a("#"+this.divcartridge+"_edit"),g=a("#"+this.divcartridge+"_visu"),h=a("#"+this.divcartridge+"_buttonsave"),i=a("#"+this.divcartridge+"_buttoncancel"),j=a("#"+this.divcartridge+"_buttonquestion"),k=a("#"+this.divcartridge+"_buttonrotation"),l=a("#"+this.divcartridge+"_buttonremove"),m=a("#"+this.divcartridge+"_radioContainer");e&&(e.show(),e.css("color",this.get_color_cartridge())),k&&k.show(),f&&(f.hide(),h.hide(),i.hide()),g&&g.hide(),j&&j.hide(),l&&l.hide(),d&&(d.css("z-index",1),a("#canevas").off()),f&&this.enabled_canvas_event(),m&&m.hide()}},c.prototype.disabled_canvas_event=function(){var c=a(b.SELECTOR.DRAWINGCANVAS);c.off("click")},c.prototype.enabled_canvas_event=function(){},c.prototype.change_visibility_annot=function(b){var c=a("#"+this.divcartridge+"_onof"),d=parseInt(c.val(),10);"r"===b?d+=1:d-=1,c.val(d),this.displaylock=d,this.apply_visibility_annot()},c.prototype.get_valref=function(){return this.textannot&&this.textannot.length>0&&"string"==typeof this.textannot?this.textannot:""},c});
\ No newline at end of file
define(["./global"],function(a){function b(){return this._instanceID=d(),this}var c=0,d=function(){return++c};return b.getInstanceCount=function(){return c},b.prototype.getInstanceID=function(){return this._instanceID},b.id=-1,b.axis=-1,b.typetool=-1,b.type=null,b.colors="",b.cartridge="",b.cartridgeColor="",b.texts="",b.label="",b.reply=!0,b.enabled=!0,b.orderTool=1e3,b.prototype.init=function(a){this.id=parseInt(a.id,10)||0,this.axis=parseInt(a.axis,10)||0,this.type=a.type,this.colors=a.colors,this.cartridge=a.cartridge,this.cartridgeColor=a.cartridgeColor,this.texts=a.texts,this.label=a.label,this.reply=a.reply,this.enabled=a.enabled,this.orderTool=a.orderTool},b.prototype.initAdmin=function(a){this.id=parseInt(a.toolid,10)||0,this.axis=parseInt(a.axis,10)||0,this.typetool=a.typetool,this.label=a.button,this.enabled=a.enable,this.orderTool=a.orderTool},b.prototype.getToolTypeLabel=function(){return this.type.label},b.prototype.getToolTypeCartX=function(){return this.type.cartridgeX},b.prototype.getToolTypeCartY=function(){return this.type.cartridgeY},b.prototype.get_color=function(){var b=a.ANNOTATIONCOLOUR[this.colors];return b?(b=b.replace("rgb","rgba"),b=b.replace(")",",0.5)")):b=this.colors,b&&""!==b?b:this.type.get_color()},b.prototype.get_color_cartridge=function(){var b=a.ANNOTATIONCOLOUR[this.cartridgeColor];return b?(b=b.replace("rgb","rgba"),b=b.replace(")",",0.5)")):b=this.cartridgeColor,b&&""!==b?b:this.type.get_color_cartridge()},b.prototype.getButton=function(a){var b=" btn-sm",c="";1!==this.enabled&&(c="background-image:none;background-color:#CCCCCC;"),this.id===a&&(b="btn-primary"),4!==this.typetool&&1!==this.typetool||(c+="text-decoration: underline;");var d=this.label;4!==this.typetool&&5!==this.typetool||(d="| "+d,4===this.typetool&&(d+=" |"));var e="<button class='btn "+b+" editpdlplus_tool' id='editpdlplus_tool_"+this.id+"' style='"+c+"' value='"+this.id+"' data-enable='"+this.enabled+"'>"+d+"</button>";return e},b.prototype.getButtonSortable=function(a){return"<li style='float: left;display: block;'>"+this.getButton(a)+"</li>"},b});
\ No newline at end of file
define(["./global"],function(a){function b(){return this._instanceID=d(),this}var c=0,d=function(){return++c};return b.getInstanceCount=function(){return c},b.prototype.getInstanceID=function(){return this._instanceID},b.id=-1,b.axis=-1,b.typetool=-1,b.type=null,b.colors="",b.cartridge="",b.cartridgeColor="",b.texts="",b.label="",b.reply=!0,b.appreciation=0,b.enabled=!0,b.orderTool=1e3,b.prototype.init=function(a){this.id=parseInt(a.id,10)||0,this.axis=parseInt(a.axis,10)||0,this.type=a.type,this.colors=a.colors,this.cartridge=a.cartridge,this.cartridgeColor=a.cartridgeColor,this.texts=a.texts,this.label=a.label,this.reply=a.reply,this.enabled=a.enabled,this.orderTool=a.orderTool},b.prototype.initAdmin=function(a){this.id=parseInt(a.toolid,10)||0,this.axis=parseInt(a.axis,10)||0,this.typetool=a.typetool,this.label=a.button,this.enabled=a.enable,this.orderTool=a.orderTool},b.prototype.getToolTypeLabel=function(){return this.type.label},b.prototype.getToolTypeCartX=function(){return this.type.cartridgeX},b.prototype.getToolTypeCartY=function(){return this.type.cartridgeY},b.prototype.get_color=function(){var b=a.ANNOTATIONCOLOUR[this.colors];return b?(b=b.replace("rgb","rgba"),b=b.replace(")",",0.5)")):b=this.colors,b&&""!==b?b:this.type.get_color()},b.prototype.get_color_cartridge=function(){var b=a.ANNOTATIONCOLOUR[this.cartridgeColor];return b?(b=b.replace("rgb","rgba"),b=b.replace(")",",0.5)")):b=this.cartridgeColor,b&&""!==b?b:this.type.get_color_cartridge()},b.prototype.getButton=function(a){var b="",c="";1!==this.enabled&&(c="background-image:none;background-color:#CCCCCC;"),this.id===a&&(b="btn-primary"),4!==this.typetool&&1!==this.typetool||(c+="text-decoration: underline;");var d=this.label;4!==this.typetool&&5!==this.typetool||(d="| "+d,4===this.typetool&&(d+=" |"));var e="<button class='btn "+b+" editpdlplus_tool' id='editpdlplus_tool_"+this.id+"' style='"+c+"' value='"+this.id+"' data-enable='"+this.enabled+"'>"+d+"</button>";return e},b.prototype.getButtonSortable=function(a){return"<li style='float: left;display: block;'>"+this.getButton(a)+"</li>"},b});
\ No newline at end of file
......@@ -137,6 +137,7 @@ define(['jquery', './global'],
* @public
*/
Annotation.cartridgex = 0;
/**
* position y of the cartridge.
* @property cartridgey
......@@ -144,6 +145,15 @@ define(['jquery', './global'],
* @public
*/
Annotation.cartridgey = 0;
/**
* appreciation of the annotation.
* @property appreciation
* @type Int
* @public
*/
Annotation.appreciation = 0;
/**
* mode readonly demo or not
* @property adminDemo
......
......@@ -125,6 +125,15 @@ define(['./global'],
* @type Boolean
*/
Tool.reply = true;
/**
* default appreciation of the annotation.
* @property appreciation
* @type Int
* @public
*/
Tool.appreciation = 0;
/**
* If the tool can be used in annotation workspace
* @property enabled
......
......@@ -99,6 +99,10 @@ class admin_editor {
$tool->cartridge_color = $data->catridgecolor;
$tool->contextid = $contextid;
$tool->label = $data->button;
$tool->appreciation = 0;
if($data->appreciation) {
$tool->appreciation = $data->appreciation;
}
$tool->reply = 0;
if ($data->reply == "on") {
$tool->reply = 1;
......@@ -304,6 +308,7 @@ class admin_editor {
$tool->texts = $tool_json->texts;
$tool->label = $tool_json->button;
$tool->enabled = $tool_json->enabled;
$tool->appreciation = $tool_json->appreciation;
if ($tool_json->reply == "on") {
$tool->reply = 1;
} else {
......
......@@ -75,6 +75,9 @@ class annotation {
/** @var bool displayrotation for displaying the sign of the annotation */
public $displayrotation = 0;
/** @var int appreciation of the annotation -1 = negative 0 = neutral 1 = positive */
public $appreciation = 0;
/** @var string borderstyle */
public $borderstyle = '';
......@@ -140,6 +143,7 @@ class annotation {
$this->colour = $annotationRef->colour;
$this->displaylock = $annotationRef->displaylock;
$this->displayrotation = $annotationRef->displayrotation;
$this->appreciation = $annotationRef->appreciation;
$this->borderstyle = $annotationRef->borderstyle;
//$this->parent_annot = $annotationRef->parent_annot;
$this->answerrequested = $annotationRef->answerrequested;
......
......@@ -67,6 +67,9 @@ class tool {
/** @var boolean, allow reply or not */
public $reply = 0;
/** @var int default appreciation of the annotation -1 = negative 0 = neutral 1 = positive */
public $appreciation = 0;
/** @var boolean, if tool is actived or not */
public $enabled = 1;
......
......@@ -25,6 +25,7 @@
<FIELD NAME="studentstatus" TYPE="char" LENGTH="50" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="displaylock" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="displayrotation" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="appreciation" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="borderstyle" TYPE="char" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="parent_annot" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="pdfdisplay" TYPE="char" LENGTH="20" NOTNULL="false"/>
......@@ -67,6 +68,7 @@
<FIELD NAME="texts" TYPE="char" LENGTH="500" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="label" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="reply" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="appreciation" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="enabled" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="order_tool" TYPE="int" LENGTH="11" NOTNULL="false" SEQUENCE="false"/>
</FIELDS>
......
......@@ -382,5 +382,24 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2019070100, 'assignfeedback', 'editpdfplus');
}
if ($oldversion < 2019100801) {
/* annotation table */
$table = new xmldb_table('assignfeedback_editpp_annot');
$field = new xmldb_field('appreciation', XMLDB_TYPE_INTEGER, '2', null, true, false, 0);
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
/* tool table */
$table = new xmldb_table('assignfeedback_editpp_tool');
$field = new xmldb_field('appreciation', XMLDB_TYPE_INTEGER, '2', null, true, false, 0);
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Editpdfplus savepoint reached.
upgrade_plugin_savepoint(true, 2019100801, 'assignfeedback', 'editpdfplus');
}
return true;
}
......@@ -155,6 +155,10 @@ $string['admintoolboxannotation'] = 'Annotation';
$string['admintoolboxannotation_color'] = 'Color';
$string['admintoolboxannotation_texts'] = 'Predefined texts';
$string['admintoolboxannotation_reply'] = 'Question/answer';
$string['admintoolboxannotation_appreciation'] = 'Default appreciation';
$string['appreciation_negative'] = 'Negative';
$string['appreciation_neutral'] = 'Neutral';
$string['appreciation_positive'] = 'Positive';
$string['admindeltool_messageok'] = 'Tool deleted';
$string['admindeltool_messageko'] = 'Error on delete';
$string['adminaddtool_messageok'] = 'Tool added';
......
......@@ -154,6 +154,10 @@ $string['admintoolboxannotation'] = 'Annotation';
$string['admintoolboxannotation_color'] = 'Couleur';
$string['admintoolboxannotation_texts'] = 'Textes prédéfinis';
$string['admintoolboxannotation_reply'] = 'Question/réponse';
$string['admintoolboxannotation_appreciation'] = 'Appréciation par défault';
$string['appreciation_negative'] = 'Négative';
$string['appreciation_neutral'] = 'Neutre';
$string['appreciation_positive'] = 'Positive';
$string['admindeltool_messageok'] = 'Outil supprimé';
$string['admindeltool_messageko'] = 'Erreur à la suppression';
$string['adminaddtool_messageok'] = 'Ajout enregistré';
......
......@@ -179,6 +179,16 @@
<input type="checkbox" id="reply" {{#tool.reply}}checked {{/tool.reply}}name="reply" />
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 form-control-label" for="reply">{{# str }} admintoolboxannotation_appreciation, assignfeedback_editpdfplus {{/ str }}</label>
<div class="col-sm-9">
<select class="form-control" id="appreciation" name="appreciation">
<option value='-1'>{{# str }} appreciation_negative, assignfeedback_editpdfplus {{/ str }}</option>
<option selected="selected" value='0'>{{# str }} appreciation_neutral, assignfeedback_editpdfplus {{/ str }}</option>
<option value='1'>{{# str }} appreciation_positive, assignfeedback_editpdfplus {{/ str }}</option>
</select>
</div>
</div>
</div>
</div>
</div>
......@@ -208,8 +218,11 @@
{{# js }}
require(['jquery','core/ajax','core/notification'], function($,ajax,notification) {
{{#tool.id}}$("#typetool").val({{tool.type}});{{/tool.id}}
{{#tool.id}}$("#toolaxis").val({{tool.axis}});{{/tool.id}}
{{#tool.id}}
$("#typetool").val({{tool.type}});
$("#toolaxis").val({{tool.axis}});
$("#appreciation").val({{tool.appreciation}});
{{/tool.id}}
var $collectionHolder;
......
......@@ -25,9 +25,9 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2019070102;
$plugin->version = 2019100801;
$plugin->requires = 2019051100; // Moodle 3.7
$plugin->maturity = MATURITY_STABLE;
$plugin->release = "2.3.5 (Build: 2019070102)";
$plugin->release = "2.4.0 (Build: 2019100801)";
$plugin->component = 'assignfeedback_editpdfplus';
......@@ -57,7 +57,8 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
HELPBTNCLASS: '.helpmessage',
STATUTSELECTOR: '#menustatutselection',
QUESTIONSELECTOR: '#menuquestionselection',
STUDENTVALIDATION: '#student_valide_button'
STUDENTVALIDATION: '#student_valide_button',
NOHIDE: 'noHide'
},
SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)',
SELECTEDFILLCOLOUR = 'rgba(200, 200, 255, 0.5)',
......@@ -690,6 +691,16 @@ Y.extend(ANNOTATION, Y.Base, {
* @public
*/
displayrotation: 0,
/**
* Appreciation of the annotation
* -1 = negative 0 = neutral 1 = positive
* @property appreciation
* @type Int
* @public
*/
appreciation: 0,
/**
* Border style for cartridge and other element (frame...)
* @property borderstyle
......@@ -767,12 +778,21 @@ Y.extend(ANNOTATION, Y.Base, {
* @public
*/
pdfdisplay: "footnote",
/**
* minimum size for resize area
* @type Int
* @public
*/
minresizewidth: 20,
/**
* used to check if the annotation needs to be minimized
* @type Int
* @public
*/
hideAnnot: 1,
/**
* Initialise the annotation.
*
......@@ -790,7 +810,8 @@ Y.extend(ANNOTATION, Y.Base, {
this.tooltype = config.tooltype;
this.textannot = config.parent_annot_element.textannot;
this.displaylock = parseInt(config.parent_annot_element.displaylock, 10);
this.displayrotation = config.parent_annot_element.displayrotation;
this.displayrotation = parseInt(config.parent_annot_element.displayrotation, 10);
this.appreciation = parseInt(config.parent_annot_element.appreciation, 10) || 0;
this.borderstyle = config.parent_annot_element.borderstyle || 'solid';
this.parent_annot = parseInt(config.parent_annot_element.id, 10);
this.answerrequested = parseInt(config.parent_annot_element.answerrequested, 10) || 0;
......@@ -806,7 +827,8 @@ Y.extend(ANNOTATION, Y.Base, {
this.tooltype = config.tooltype;
this.textannot = config.textannot;
this.displaylock = parseInt(config.displaylock, 10);
this.displayrotation = config.displayrotation;
this.displayrotation = parseInt(config.displayrotation, 10);
this.appreciation = parseInt(config.appreciation, 10) || 0;
this.borderstyle = config.borderstyle || 'solid';
this.parent_annot = parseInt(config.parent_annot, 10);
this.answerrequested = parseInt(config.answerrequested, 10) || 0;
......@@ -849,12 +871,14 @@ Y.extend(ANNOTATION, Y.Base, {
textannot: this.textannot,
displaylock: parseInt(this.displaylock, 10),
displayrotation: parseInt(this.displayrotation, 10),
appreciation: parseInt(this.appreciation, 10),
borderstyle: this.borderstyle,
parent_annot: parseInt(this.parent_annot, 10),
divcartridge: this.divcartridge,
parent_annot_div: this.parent_annot_element.divcartridge,
answerrequested: parseInt(this.answerrequested, 10),
pdfdisplay: this.pdfdisplay
pdfdisplay: this.pdfdisplay,
appreciationdisplay: this.appreciationdisplay
};
}
return {
......@@ -873,13 +897,15 @@ Y.extend(ANNOTATION, Y.Base, {
textannot: this.textannot,
displaylock: parseInt(this.displaylock, 10),
displayrotation: parseInt(this.displayrotation, 10),
appreciation: parseInt(this.appreciation, 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
pdfdisplay: this.pdfdisplay,
appreciationdisplay: this.appreciationdisplay
};
},
/**
......@@ -1185,6 +1211,7 @@ Y.extend(ANNOTATION, Y.Base, {
divconteneurdisplay.append(inputonof);
divconteneurdisplay.append(this.get_input_question());
divconteneurdisplay.append(this.get_input_pdfdisplay());
divconteneurdisplay.append(this.get_input_appreciationdisplay());
return divconteneurdisplay;
},
......@@ -1202,6 +1229,7 @@ Y.extend(ANNOTATION, Y.Base, {
divtoolbardisplay.append(this.get_button_visibility_right());
divtoolbardisplay.append(this.get_button_save());
divtoolbardisplay.append(this.get_button_cancel());
divtoolbardisplay.append(this.get_button_appreciation());
if (this.tooltype.reply === 1) {
divtoolbardisplay.append(this.get_button_question());
}
......@@ -1347,6 +1375,30 @@ Y.extend(ANNOTATION, Y.Base, {
buttontrashdisplay.on('click', this.change_pdf_display, this);
return buttontrashdisplay;
},
/**
* get the html node for the button to change appreciation for the annotation
* @return node
*/
get_button_appreciation: function () {
//aaaa
var iconClass = 'fa fa-meh-o';
var buttonappreciation = "<button id='"
+ this.divcartridge
+ "_buttonappreciation' style='display:none;margin-left:10px;' class='btn btn-sm btn-outline-dark "
+ SELECTOR.NOHIDE
+ "' "
+ "type='button'>"
+ "<i class='"+iconClass+" "+SELECTOR.NOHIDE+"' aria-hidden='true'></i>"
+ "</button>";
var buttonappreciationdisplay = Y.Node.create(buttonappreciation);
buttonappreciationdisplay.on('click', this.change_appreciation_display, this);
return buttonappreciationdisplay;
},
/**
* get the html node for the hidden input to keep information about question state
* @return node
......@@ -1365,6 +1417,28 @@ Y.extend(ANNOTATION, Y.Base, {
get_input_pdfdisplay: function () {
return Y.Node.create("<input type='hidden' id='" + this.divcartridge + "_pdfdisplay' value='" + this.pdfdisplay + "'/>");
},
/**
* get the html node for the hidden input to keep information about appreciation state
* @return node
*/
get_input_appreciationdisplay: function () {
window.console.log(this.appreciation);
var appreciation = this.appreciation;
if(!this.id && this.tooltype.appreciation) {
appreciation = this.tooltype.appreciation;
}
window.console.log(appreciation);
return Y.Node.create(
"<input type='hidden' id='" + this.divcartridge + "_appreciationdisplay' value='" + appreciation + "'/>"
);
},
/**
* get the final reference text value
* @return node
......@@ -1429,6 +1503,7 @@ Y.extend(ANNOTATION, Y.Base, {
}
this.apply_question_status();
this.apply_pdfdisplay();
this.apply_appreciationdisplay();
},
/**
* get the html node for the text to display for the annotation, according to parameters
......@@ -1475,6 +1550,9 @@ Y.extend(ANNOTATION, Y.Base, {
* change question status of the annotation (with or not)
*/
change_pdf_display: function () {
window.console.log('pdfdisplay');
var pdfdisplayvalue = this.editor.get_dialogue_element('#' + this.divcartridge + "_pdfdisplay");
var value = pdfdisplayvalue.get('value');
if (value === "footnote") {
......@@ -1484,9 +1562,42 @@ Y.extend(ANNOTATION, Y.Base, {
pdfdisplayvalue.set('value', "footnote");
this.pdfdisplay = "footnote";
}
this.hideAnnot = 0;
this.apply_pdfdisplay();
this.editor.save_current_page();
},
/**
* change appreciation of the annotation (positive, neutral, negative)
*/
change_appreciation_display: function () {
window.console.log('ChangeAppreciation');
var appreciationdisplayvalue = this.editor.get_dialogue_element('#' + this.divcartridge + "_appreciationdisplay");
if(appreciationdisplayvalue !== null) {
var value = appreciationdisplayvalue.get('value');
if (value == 1) {
appreciationdisplayvalue.set('value', 0);
this.appreciation = 0;
} else if (value == -1) {
appreciationdisplayvalue.set('value', 1);
this.appreciation = 1;
} else {
appreciationdisplayvalue.set('value', -1);
this.appreciation = -1;
}
this.hideAnnot = 0;
this.apply_appreciationdisplay();
this.editor.save_current_page();
}
},
/**
* change question status of the annotation (with or not)
*/
......@@ -1499,6 +1610,9 @@ Y.extend(ANNOTATION, Y.Base, {
}
questionvalue.set('value', finalvalue);
this.answerrequested = finalvalue;
this.hideAnnot = 0;
this.apply_question_status();
this.editor.save_current_page();
},
......@@ -1566,6 +1680,35 @@ Y.extend(ANNOTATION, Y.Base, {
}
return;