Gitlab CSE Unil

Commit 1a3d957a authored by M. Chardon's avatar M. Chardon
Browse files

annotation stampcomment

parent cc9cf2f9
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){this.shape_id="ct_stampcomment_"+(new Date).toJSON().replace(/:/g,"").replace(/\./g,"");var c='<i id="'+this.shape_id+'_img" class="fa fa-arrows-h fa-2x" aria-hidden="true"></i>';this.displayrotation>0&&(c='<i id="'+this.shape_id+'_img" class="fa fa-arrows-v fa-2x" aria-hidden="true"></i>');var d="<div id='"+this.id+"'>"+c+"</div>";b.append(d),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_stampcomment"),this.get_div_cartridge_label(c,b);var d=this.get_div_container(c,b),e=0;this.displayrotation>0&&(e=1);var f="<input type='hidden' id='"+this.divcartridge+"_rotation' value="+e+" />";d.append(f);var g="<button id='"+this.divcartridge+"_buttonrotation' class='btn btn-default";this.adminDemo&&(g+=" disabled"),g+='\' type=\'button\'><i class="fa fa-refresh" aria-hidden="true"></i></button>',d.append(g),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+this.cartridgex),b.css("top",this.y+this.cartridgey-5),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
......@@ -24,10 +24,11 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
'core/ajax', 'core/str', /*'mod_assign/grading_form_change_checker'*/
'assignfeedback_editpdfplus/annotation', 'assignfeedback_editpdfplus/annotationhighlightplus',
'assignfeedback_editpdfplus/annotationstampplus', 'assignfeedback_editpdfplus/annotationframe',
'assignfeedback_editpdfplus/annotationcommentplus', 'assignfeedback_editpdfplus/annotationverticalline'],
'assignfeedback_editpdfplus/annotationcommentplus', 'assignfeedback_editpdfplus/annotationverticalline',
'assignfeedback_editpdfplus/annotationstampcomment'],
function ($/*, Y*/, notification, templates, fragment, ajax, str,
Annotation, AnnotationHighlightplus, AnnotationStampplus, AnnotationFrame,
AnnotationCommentplus, AnnotationVerticalline /*, checker*/) {
AnnotationCommentplus, AnnotationVerticalline, AnnotationStampcomment /*, checker*/) {
var contextid = null;
var currentTool = null;
......@@ -129,6 +130,11 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
this.annotationcurrent.x = 285;
this.annotationcurrent.y = 65;
this.annotationcurrent.endy = 175;
} else if (typetool === 6) {
this.annotationcurrent = new AnnotationStampcomment();
this.annotationcurrent.x = 188;
this.annotationcurrent.y = 118;
this.annotationcurrent.displayrotation=1;
} else if (typetool === 7) {
this.annotationcurrent = new AnnotationCommentplus();
this.annotationcurrent.x = 30;
......
// 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 AnnotationStampcomment() {
// Call the super constructor.
Annotation.call(this);
// Return this object reference.
return(this);
}
// The Friend class extends the base Model class.
AnnotationStampcomment.prototype = Object.create(Annotation.prototype);
/**
* Draw a highlight annotation
* @protected
* @method draw
* @return M.assignfeedback_editpdfplus.drawable
*/
AnnotationStampcomment.prototype.draw = function (canevas) {
if (canevas) {
this.shape_id = 'ct_stampcomment_' + (new Date().toJSON()).replace(/:/g, '').replace(/\./g, '');
var fleche = '<i id="'
+ this.shape_id
+ '_img" '
+ 'class="fa fa-arrows-h fa-2x" aria-hidden="true"></i>';
if (this.displayrotation > 0) {
fleche = '<i id="' + this.shape_id + '_img" '
+ 'class="fa fa-arrows-v fa-2x" aria-hidden="true"></i>';
}
var divStampComment = "<div id='" + this.id + "'>" + fleche + "</div>";
canevas.append(divStampComment);
$("#" + 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
*/
AnnotationStampcomment.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_stampcomment');
// inscription entete
this.get_div_cartridge_label(colorcartridge, divdisplay);
//creation input
var divconteneurdisplay = this.get_div_container(colorcartridge, divdisplay);
//if (!this.editor.get('readonly')) {
var rotationvalue = 0;
if (this.displayrotation > 0) {
rotationvalue = 1;
}
var inputrotationdisplay = "<input type='hidden' id='"
+ this.divcartridge
+ "_rotation' value="
+ rotationvalue
+ " />";
divconteneurdisplay.append(inputrotationdisplay);
var buttonrotation = "<button id='"
+ this.divcartridge
+ "_buttonrotation' class='btn btn-default";
if (this.adminDemo) {
buttonrotation += " disabled";
}
buttonrotation += "' type='button'>"
+ '<i class="fa fa-refresh" aria-hidden="true"></i>'
+ "</button>";
//buttonrotationdisplay.on('click', this.change_stamp, this);
divconteneurdisplay.append(buttonrotation);
//}
//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 + this.cartridgex);
divdisplay.css('top', this.y + this.cartridgey - 5);
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 AnnotationStampcomment;
});
\ No newline at end of file
Supports Markdown
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