Gitlab CSE Unil

Commit 15c7df55 authored by M. Chardon's avatar M. Chardon
Browse files

annotation commentplus

parent 54103858
This diff is collapsed.
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.draw=function(b){if(b){var c="<div id='"+this.id+"'><i class='fa fa-commenting' aria-hidden='true' style='color:black;'></i></div>";b.append(c),a("#"+this.id).css("color",this.get_color()),a("#"+this.id).css("width",this.endx-this.x),a("#"+this.id).css("height",this.endy-this.y),a("#"+this.id).css("padding","0 2px"),a("#"+this.id).css("position","absolute"),a("#"+this.id).css("display","inline-block"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y)}this.draw_catridge(b)},c.prototype.draw_catridge=function(a){var b;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var c=this.get_color_cartridge();b=this.get_div_cartridge(c,a),b.addClass("assignfeedback_editpdfplus_commentplus"),this.get_div_cartridge_label(c,b);var d=this.get_div_container(c,b);this.get_div_edition(d),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltypefamille.cartridge_x,10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltypefamille.cartridge_y,10)),b.css("left",this.x+20),b.css("top",this.y),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
......@@ -23,9 +23,11 @@
define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/fragment',
'core/ajax', 'core/str', /*'mod_assign/grading_form_change_checker'*/
'assignfeedback_editpdfplus/annotation', 'assignfeedback_editpdfplus/annotationhighlightplus',
'assignfeedback_editpdfplus/annotationstampplus', 'assignfeedback_editpdfplus/annotationframe'],
'assignfeedback_editpdfplus/annotationstampplus', 'assignfeedback_editpdfplus/annotationframe',
'assignfeedback_editpdfplus/annotationcommentplus'],
function ($/*, Y*/, notification, templates, fragment, ajax, str,
Annotation, AnnotationHighlightplus, AnnotationStampplus, AnnotationFrame /*, checker*/) {
Annotation, AnnotationHighlightplus, AnnotationStampplus, AnnotationFrame,
AnnotationCommentplus /*, checker*/) {
var contextid = null;
var currentTool = null;
......@@ -122,6 +124,10 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
annotChild.y = 216;
annotChild.endx = 296;
annotChild.endy = 232;
} else if (typetool === 7) {
this.annotationcurrent = new AnnotationCommentplus();
this.annotationcurrent.x = 30;
this.annotationcurrent.y = 90;
}
if (this.annotationcurrent) {
var typetoolEntity = getTypeTool(typetool);
......
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/*
* @package assignfeedback_editpdfplus
* @copyright 2017 Université de Lausanne
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* @module mod_assignfeedback_editpdfplus/annotationhighlightplus
*/
define(['jquery', './annotation'],
function ($, Annotation) {
// I return an initialized object.
function AnnotationCommentplus() {
// Call the super constructor.
Annotation.call(this);
// Return this object reference.
return(this);
}
// The Friend class extends the base Model class.
AnnotationCommentplus.prototype = Object.create(Annotation.prototype);
/**
* Draw a highlight annotation
* @protected
* @method draw
* @return M.assignfeedback_editpdfplus.drawable
*/
AnnotationCommentplus.prototype.draw = function (canevas) {
if (canevas) {
var divComment = "<div id='" + this.id + "'>"
+ "<i class='fa fa-commenting' aria-hidden='true' style='color:black;'></i>"
+ "</div>";
canevas.append(divComment);
$("#" + this.id).css('color', this.get_color());
$("#" + this.id).css('width', this.endx - this.x);
$("#" + this.id).css('height', this.endy - this.y);
$("#" + this.id).css('padding', '0 2px');
$("#" + this.id).css('position', 'absolute');
$("#" + this.id).css('display', 'inline-block');
$("#" + this.id).css('left', this.x);
$("#" + this.id).css('top', this.y);
}
this.draw_catridge(canevas);
return;
};
/**
* Display cartridge and toolbox for the annotation
* @returns {Boolean} res
*/
AnnotationCommentplus.prototype.draw_catridge = function (canevas) {
var divdisplay;
if (!this.divcartridge || this.divcartridge === '') {
this.init_div_cartridge_id();
//init cartridge
var colorcartridge = this.get_color_cartridge();
divdisplay = this.get_div_cartridge(colorcartridge, canevas);
divdisplay.addClass('assignfeedback_editpdfplus_commentplus');
// inscription entete
this.get_div_cartridge_label(colorcartridge, divdisplay);
//creation input
var divconteneurdisplay = this.get_div_container(colorcartridge, divdisplay);
//creation de la div d'edition
//if (!this.editor.get('readonly')) {
this.get_div_edition(divconteneurdisplay);
//} else {
//var divvisudisplay = this.get_div_visu(colorcartridge);
//divconteneurdisplay.append(divvisudisplay);
//}
//positionnement de la div par rapport a l'annotation
if (!this.cartridgex || this.cartridgex === 0) {
this.cartridgex = parseInt(this.tooltypefamille.cartridge_x, 10);
}
if (!this.cartridgey || this.cartridgey === 0) {
this.cartridgey = parseInt(this.tooltypefamille.cartridge_y, 10);
}
divdisplay.css('left', this.x + 20);
divdisplay.css('top', this.y);
this.apply_visibility_annot();
} else {
//divdisplay = this.editor.get_dialogue_element('#' + this.divcartridge);
//divdisplay.setX(offsetcanvas[0] + this.x + this.cartridgex);
//divdisplay.setY(offsetcanvas[1] + this.y + this.cartridgey);
}
return true;
};
return AnnotationCommentplus;
});
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment