MDL-42571 assignfeedback_editpdf: Fixed second PDF view

This commit is contained in:
Bence Laky 2015-11-12 10:21:39 +00:00
parent bcf2ea710c
commit da91de7821
11 changed files with 213 additions and 183 deletions

View File

@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2015051100;
$plugin->version = 2015111200;
$plugin->requires = 2015050500;
$plugin->component = 'assignfeedback_editpdf';

View File

@ -26,23 +26,23 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
DIALOGUE : 'assignfeedback_editpdf_widget'
},
SELECTOR = {
PREVIOUSBUTTON : '.' + CSS.DIALOGUE + ' .navigate-previous-button',
NEXTBUTTON : '.' + CSS.DIALOGUE + ' .navigate-next-button',
SEARCHCOMMENTSBUTTON : '.' + CSS.DIALOGUE + ' .searchcommentsbutton',
PREVIOUSBUTTON : '.navigate-previous-button',
NEXTBUTTON : ' .navigate-next-button',
SEARCHCOMMENTSBUTTON : '.searchcommentsbutton',
SEARCHFILTER : '.assignfeedback_editpdf_commentsearch input',
SEARCHCOMMENTSLIST : '.assignfeedback_editpdf_commentsearch ul',
PAGESELECT : '.' + CSS.DIALOGUE + ' .navigate-page-select',
LOADINGICON : '.' + CSS.DIALOGUE + ' .loading',
PROGRESSBARCONTAINER : '.' + CSS.DIALOGUE + ' .progress-info.progress-striped',
DRAWINGREGION : '.' + CSS.DIALOGUE + ' .drawingregion',
DRAWINGCANVAS : '.' + CSS.DIALOGUE + ' .drawingcanvas',
SAVE : '.' + CSS.DIALOGUE + ' .savebutton',
COMMENTCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .commentcolourbutton',
COMMENTMENU : ' .commentdrawable a',
ANNOTATIONCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .annotationcolourbutton',
DELETEANNOTATIONBUTTON : '.' + CSS.DIALOGUE + ' .deleteannotationbutton',
PAGESELECT : '.navigate-page-select',
LOADINGICON : '.loading',
PROGRESSBARCONTAINER : '.progress-info.progress-striped',
DRAWINGREGION : '.drawingregion',
DRAWINGCANVAS : '.drawingcanvas',
SAVE : '.savebutton',
COMMENTCOLOURBUTTON : '.commentcolourbutton',
COMMENTMENU : '.commentdrawable a',
ANNOTATIONCOLOURBUTTON : '.annotationcolourbutton',
DELETEANNOTATIONBUTTON : '.deleteannotationbutton',
UNSAVEDCHANGESDIV : '.assignfeedback_editpdf_unsavedchanges',
STAMPSBUTTON : '.' + CSS.DIALOGUE + ' .currentstampbutton',
STAMPSBUTTON : '.currentstampbutton',
DIALOGUE : '.' + CSS.DIALOGUE
},
SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)',
@ -66,14 +66,14 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
},
CLICKTIMEOUT = 300,
TOOLSELECTOR = {
'comment': '.' + CSS.DIALOGUE + ' .commentbutton',
'pen': '.' + CSS.DIALOGUE + ' .penbutton',
'line': '.' + CSS.DIALOGUE + ' .linebutton',
'rectangle': '.' + CSS.DIALOGUE + ' .rectanglebutton',
'oval': '.' + CSS.DIALOGUE + ' .ovalbutton',
'stamp': '.' + CSS.DIALOGUE + ' .stampbutton',
'select': '.' + CSS.DIALOGUE + ' .selectbutton',
'highlight': '.' + CSS.DIALOGUE + ' .highlightbutton'
'comment': '.commentbutton',
'pen': '.penbutton',
'line': '.linebutton',
'rectangle': '.rectanglebutton',
'oval': '.ovalbutton',
'stamp': '.stampbutton',
'select': '.selectbutton',
'highlight': '.highlightbutton'
},
STROKEWEIGHT = 4;
// This file is part of Moodle - http://moodle.org/
@ -498,7 +498,7 @@ var DRAWABLE = function(editor) {
this.store_position = function(container, x, y) {
var drawingregion, scrollx, scrolly;
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION);
scrollx = parseInt(drawingregion.get('scrollLeft'), 10);
scrolly = parseInt(drawingregion.get('scrollTop'), 10);
container.setData('x', x + scrollx);
@ -680,8 +680,8 @@ Y.extend(ANNOTATION, Y.Base, {
*/
draw_highlight : function() {
var bounds,
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
offsetcanvas = Y.one(SELECTOR.DRAWINGCANVAS).getXY(),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY(),
shape;
if (this.editor.currentannotation === this) {
@ -1553,7 +1553,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
*/
draw : function() {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
@ -1595,7 +1595,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
draw_current_edit : function(edit) {
var bounds = new M.assignfeedback_editpdf.rect(),
drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
@ -2245,8 +2245,8 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
commentslist,
filtertext;
filternode = Y.one(SELECTOR.SEARCHFILTER);
commentslist = Y.one(SELECTOR.SEARCHCOMMENTSLIST);
filternode = this.get('editor').get_dialogue_element(SELECTOR.SEARCHFILTER);
commentslist = this.get('editor').get_dialogue_element(SELECTOR.SEARCHCOMMENTSLIST);
filtertext = filternode.get('value');
@ -2505,7 +2505,7 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
this.draw = function(focus) {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
node,
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
container,
menu,
position,
@ -3272,7 +3272,7 @@ EDITOR.prototype = {
var button, currenttoolnode, imgurl;
// Initalise the colour buttons.
button = Y.one(SELECTOR.COMMENTCOLOURBUTTON);
button = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
imgurl = M.util.image_url('background_colour_' + this.currentedit.commentcolour, 'assignfeedback_editpdf');
button.one('img').setAttribute('src', imgurl);
@ -3283,15 +3283,15 @@ EDITOR.prototype = {
button.one('img').setStyle('borderStyle', 'solid');
}
button = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON);
button = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
imgurl = M.util.image_url('colour_' + this.currentedit.annotationcolour, 'assignfeedback_editpdf');
button.one('img').setAttribute('src', imgurl);
currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.addClass('assignfeedback_editpdf_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'true');
button = Y.one(SELECTOR.STAMPSBUTTON);
button = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
button.one('img').setAttrs({'src': this.get_stamp_image_url(this.currentedit.stamp),
'height': '16',
'width': '16'});
@ -3302,7 +3302,7 @@ EDITOR.prototype = {
* @method get_canvas_bounds
*/
get_canvas_bounds : function() {
var canvas = Y.one(SELECTOR.DRAWINGCANVAS),
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
offsetcanvas = canvas.getXY(),
offsetleft = offsetcanvas[0],
offsettop = offsetcanvas[1],
@ -3361,12 +3361,12 @@ EDITOR.prototype = {
// Add custom class for styling.
this.dialogue.get('boundingBox').addClass(CSS.DIALOGUE);
this.loadingicon = Y.one(SELECTOR.LOADINGICON);
this.loadingicon = this.get_dialogue_element(SELECTOR.LOADINGICON);
drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS);
drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
this.graphic = new Y.Graphic({render : SELECTOR.DRAWINGCANVAS});
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
drawingregion.on('scroll', this.move_canvas, this);
if (!this.get('readonly')) {
@ -3446,7 +3446,7 @@ EDITOR.prototype = {
var pagetotal = this.get('pagetotal');
// Update the progress bar.
var progressbarcontainer = Y.one(SELECTOR.PROGRESSBARCONTAINER);
var progressbarcontainer = this.get_dialogue_element(SELECTOR.PROGRESSBARCONTAINER);
var progressbar = progressbarcontainer.one('.bar');
if (progressbar) {
// Calculate progress.
@ -3573,7 +3573,7 @@ EDITOR.prototype = {
picker,
filename;
searchcommentsbutton = Y.one(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton = this.get_dialogue_element(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton.on('click', this.open_search_comments, this);
searchcommentsbutton.on('key', this.open_search_comments, 'down:13', this);
@ -3582,7 +3582,7 @@ EDITOR.prototype = {
}
// Setup the tool buttons.
Y.each(TOOLSELECTOR, function(selector, tool) {
toolnode = Y.one(selector);
toolnode = this.get_dialogue_element(selector);
toolnode.on('click', this.handle_tool_button, this, tool);
toolnode.on('key', this.handle_tool_button, 'down:13', this, tool);
toolnode.setAttribute('aria-pressed', 'false');
@ -3590,7 +3590,7 @@ EDITOR.prototype = {
// Set the default tool.
commentcolourbutton = Y.one(SELECTOR.COMMENTCOLOURBUTTON);
commentcolourbutton = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
picker = new M.assignfeedback_editpdf.colourpicker({
buttonNode: commentcolourbutton,
colours: COMMENTCOLOUR,
@ -3606,7 +3606,7 @@ EDITOR.prototype = {
context: this
});
annotationcolourbutton = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON);
annotationcolourbutton = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
picker = new M.assignfeedback_editpdf.colourpicker({
buttonNode: annotationcolourbutton,
iconprefix: 'colour_',
@ -3628,11 +3628,11 @@ EDITOR.prototype = {
stampfiles = this.get('stampfiles');
if (stampfiles.length <= 0) {
Y.one(TOOLSELECTOR.stamp).ancestor().hide();
this.get_dialogue_element(TOOLSELECTOR.stamp).ancestor().hide();
} else {
filename = stampfiles[0].substr(stampfiles[0].lastIndexOf('/') + 1);
this.currentedit.stamp = filename;
currentstampbutton = Y.one(SELECTOR.STAMPSBUTTON);
currentstampbutton = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
picker = new M.assignfeedback_editpdf.stamppicker({
buttonNode: currentstampbutton,
@ -3665,7 +3665,7 @@ EDITOR.prototype = {
e.preventDefault();
// Change style of the pressed button.
currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.removeClass('assignfeedback_editpdf_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'false');
this.currentedit.tool = tool;
@ -3725,6 +3725,15 @@ EDITOR.prototype = {
return drawable;
},
/**
* Find an element within the dialogue.
* @protected
* @method get_dialogue_element
*/
get_dialogue_element : function(selector) {
return this.dialogue.get('boundingBox').one(selector);
},
/**
* Redraw the active edit.
@ -3746,7 +3755,7 @@ EDITOR.prototype = {
*/
edit_start : function(e) {
e.preventDefault();
var canvas = Y.one(SELECTOR.DRAWINGCANVAS),
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
offset = canvas.getXY(),
scrolltop = canvas.get('docScrollY'),
scrollleft = canvas.get('docScrollX'),
@ -3817,7 +3826,7 @@ EDITOR.prototype = {
edit_move : function(e) {
e.preventDefault();
var bounds = this.get_canvas_bounds(),
canvas = Y.one(SELECTOR.DRAWINGCANVAS),
canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
clientpoint = new M.assignfeedback_editpdf.point(e.clientX + canvas.get('docScrollX'),
e.clientY + canvas.get('docScrollY')),
point = this.get_canvas_coordinates(clientpoint);
@ -3914,7 +3923,7 @@ EDITOR.prototype = {
if (drawregionheight < 100) {
drawregionheight = 100;
}
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
drawingregion.setStyle('maxHeight', drawregionheight +'px');
this.redraw();
return true;
@ -3974,7 +3983,8 @@ EDITOR.prototype = {
if (jsondata.error) {
return new M.core.ajaxException(jsondata);
}
Y.one(SELECTOR.UNSAVEDCHANGESDIV).addClass('haschanges');
Y.one('#' + this.get('linkid')).siblings(SELECTOR.UNSAVEDCHANGESDIV)
.item(0).addClass('haschanges');
} catch (e) {
return new M.core.exception(e);
}
@ -4038,13 +4048,13 @@ EDITOR.prototype = {
* @method change_page
*/
change_page : function() {
var drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS),
var drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
page,
previousbutton,
nextbutton;
previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON);
nextbutton = Y.one(SELECTOR.NEXTBUTTON);
previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON);
nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON);
if (this.currentpage > 0) {
previousbutton.removeAttribute('disabled');
@ -4064,7 +4074,7 @@ EDITOR.prototype = {
drawingcanvas.setStyle('height', page.height + 'px');
// Update page select.
Y.one(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.get_dialogue_element(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.resize(); // Internally will call 'redraw', after checking the dialogue size.
},
@ -4082,7 +4092,7 @@ EDITOR.prototype = {
previousbutton,
nextbutton;
pageselect = Y.one(SELECTOR.PAGESELECT);
pageselect = this.get_dialogue_element(SELECTOR.PAGESELECT);
var options = pageselect.all('option');
if (options.size() <= 1) {
@ -4099,8 +4109,8 @@ EDITOR.prototype = {
this.change_page();
}, this);
previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON);
nextbutton = Y.one(SELECTOR.NEXTBUTTON);
previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON);
nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON);
previousbutton.on('click', this.previous_page, this);
previousbutton.on('key', this.previous_page, 'down:13', this);
@ -4144,7 +4154,7 @@ EDITOR.prototype = {
move_canvas: function() {
var drawingregion, x, y, i;
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
x = parseInt(drawingregion.get('scrollLeft'), 10);
y = parseInt(drawingregion.get('scrollTop'), 10);

View File

@ -26,23 +26,23 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
DIALOGUE : 'assignfeedback_editpdf_widget'
},
SELECTOR = {
PREVIOUSBUTTON : '.' + CSS.DIALOGUE + ' .navigate-previous-button',
NEXTBUTTON : '.' + CSS.DIALOGUE + ' .navigate-next-button',
SEARCHCOMMENTSBUTTON : '.' + CSS.DIALOGUE + ' .searchcommentsbutton',
PREVIOUSBUTTON : '.navigate-previous-button',
NEXTBUTTON : ' .navigate-next-button',
SEARCHCOMMENTSBUTTON : '.searchcommentsbutton',
SEARCHFILTER : '.assignfeedback_editpdf_commentsearch input',
SEARCHCOMMENTSLIST : '.assignfeedback_editpdf_commentsearch ul',
PAGESELECT : '.' + CSS.DIALOGUE + ' .navigate-page-select',
LOADINGICON : '.' + CSS.DIALOGUE + ' .loading',
PROGRESSBARCONTAINER : '.' + CSS.DIALOGUE + ' .progress-info.progress-striped',
DRAWINGREGION : '.' + CSS.DIALOGUE + ' .drawingregion',
DRAWINGCANVAS : '.' + CSS.DIALOGUE + ' .drawingcanvas',
SAVE : '.' + CSS.DIALOGUE + ' .savebutton',
COMMENTCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .commentcolourbutton',
COMMENTMENU : ' .commentdrawable a',
ANNOTATIONCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .annotationcolourbutton',
DELETEANNOTATIONBUTTON : '.' + CSS.DIALOGUE + ' .deleteannotationbutton',
PAGESELECT : '.navigate-page-select',
LOADINGICON : '.loading',
PROGRESSBARCONTAINER : '.progress-info.progress-striped',
DRAWINGREGION : '.drawingregion',
DRAWINGCANVAS : '.drawingcanvas',
SAVE : '.savebutton',
COMMENTCOLOURBUTTON : '.commentcolourbutton',
COMMENTMENU : '.commentdrawable a',
ANNOTATIONCOLOURBUTTON : '.annotationcolourbutton',
DELETEANNOTATIONBUTTON : '.deleteannotationbutton',
UNSAVEDCHANGESDIV : '.assignfeedback_editpdf_unsavedchanges',
STAMPSBUTTON : '.' + CSS.DIALOGUE + ' .currentstampbutton',
STAMPSBUTTON : '.currentstampbutton',
DIALOGUE : '.' + CSS.DIALOGUE
},
SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)',
@ -66,14 +66,14 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
},
CLICKTIMEOUT = 300,
TOOLSELECTOR = {
'comment': '.' + CSS.DIALOGUE + ' .commentbutton',
'pen': '.' + CSS.DIALOGUE + ' .penbutton',
'line': '.' + CSS.DIALOGUE + ' .linebutton',
'rectangle': '.' + CSS.DIALOGUE + ' .rectanglebutton',
'oval': '.' + CSS.DIALOGUE + ' .ovalbutton',
'stamp': '.' + CSS.DIALOGUE + ' .stampbutton',
'select': '.' + CSS.DIALOGUE + ' .selectbutton',
'highlight': '.' + CSS.DIALOGUE + ' .highlightbutton'
'comment': '.commentbutton',
'pen': '.penbutton',
'line': '.linebutton',
'rectangle': '.rectanglebutton',
'oval': '.ovalbutton',
'stamp': '.stampbutton',
'select': '.selectbutton',
'highlight': '.highlightbutton'
},
STROKEWEIGHT = 4;
// This file is part of Moodle - http://moodle.org/
@ -498,7 +498,7 @@ var DRAWABLE = function(editor) {
this.store_position = function(container, x, y) {
var drawingregion, scrollx, scrolly;
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION);
scrollx = parseInt(drawingregion.get('scrollLeft'), 10);
scrolly = parseInt(drawingregion.get('scrollTop'), 10);
container.setData('x', x + scrollx);
@ -680,8 +680,8 @@ Y.extend(ANNOTATION, Y.Base, {
*/
draw_highlight : function() {
var bounds,
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
offsetcanvas = Y.one(SELECTOR.DRAWINGCANVAS).getXY(),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY(),
shape;
if (this.editor.currentannotation === this) {
@ -1553,7 +1553,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
*/
draw : function() {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
@ -1595,7 +1595,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
draw_current_edit : function(edit) {
var bounds = new M.assignfeedback_editpdf.rect(),
drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
@ -2245,8 +2245,8 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
commentslist,
filtertext;
filternode = Y.one(SELECTOR.SEARCHFILTER);
commentslist = Y.one(SELECTOR.SEARCHCOMMENTSLIST);
filternode = this.get('editor').get_dialogue_element(SELECTOR.SEARCHFILTER);
commentslist = this.get('editor').get_dialogue_element(SELECTOR.SEARCHCOMMENTSLIST);
filtertext = filternode.get('value');
@ -2505,7 +2505,7 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
this.draw = function(focus) {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
node,
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
container,
menu,
position,
@ -3272,7 +3272,7 @@ EDITOR.prototype = {
var button, currenttoolnode, imgurl;
// Initalise the colour buttons.
button = Y.one(SELECTOR.COMMENTCOLOURBUTTON);
button = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
imgurl = M.util.image_url('background_colour_' + this.currentedit.commentcolour, 'assignfeedback_editpdf');
button.one('img').setAttribute('src', imgurl);
@ -3283,15 +3283,15 @@ EDITOR.prototype = {
button.one('img').setStyle('borderStyle', 'solid');
}
button = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON);
button = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
imgurl = M.util.image_url('colour_' + this.currentedit.annotationcolour, 'assignfeedback_editpdf');
button.one('img').setAttribute('src', imgurl);
currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.addClass('assignfeedback_editpdf_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'true');
button = Y.one(SELECTOR.STAMPSBUTTON);
button = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
button.one('img').setAttrs({'src': this.get_stamp_image_url(this.currentedit.stamp),
'height': '16',
'width': '16'});
@ -3302,7 +3302,7 @@ EDITOR.prototype = {
* @method get_canvas_bounds
*/
get_canvas_bounds : function() {
var canvas = Y.one(SELECTOR.DRAWINGCANVAS),
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
offsetcanvas = canvas.getXY(),
offsetleft = offsetcanvas[0],
offsettop = offsetcanvas[1],
@ -3361,12 +3361,12 @@ EDITOR.prototype = {
// Add custom class for styling.
this.dialogue.get('boundingBox').addClass(CSS.DIALOGUE);
this.loadingicon = Y.one(SELECTOR.LOADINGICON);
this.loadingicon = this.get_dialogue_element(SELECTOR.LOADINGICON);
drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS);
drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
this.graphic = new Y.Graphic({render : SELECTOR.DRAWINGCANVAS});
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
drawingregion.on('scroll', this.move_canvas, this);
if (!this.get('readonly')) {
@ -3446,7 +3446,7 @@ EDITOR.prototype = {
var pagetotal = this.get('pagetotal');
// Update the progress bar.
var progressbarcontainer = Y.one(SELECTOR.PROGRESSBARCONTAINER);
var progressbarcontainer = this.get_dialogue_element(SELECTOR.PROGRESSBARCONTAINER);
var progressbar = progressbarcontainer.one('.bar');
if (progressbar) {
// Calculate progress.
@ -3573,7 +3573,7 @@ EDITOR.prototype = {
picker,
filename;
searchcommentsbutton = Y.one(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton = this.get_dialogue_element(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton.on('click', this.open_search_comments, this);
searchcommentsbutton.on('key', this.open_search_comments, 'down:13', this);
@ -3582,7 +3582,7 @@ EDITOR.prototype = {
}
// Setup the tool buttons.
Y.each(TOOLSELECTOR, function(selector, tool) {
toolnode = Y.one(selector);
toolnode = this.get_dialogue_element(selector);
toolnode.on('click', this.handle_tool_button, this, tool);
toolnode.on('key', this.handle_tool_button, 'down:13', this, tool);
toolnode.setAttribute('aria-pressed', 'false');
@ -3590,7 +3590,7 @@ EDITOR.prototype = {
// Set the default tool.
commentcolourbutton = Y.one(SELECTOR.COMMENTCOLOURBUTTON);
commentcolourbutton = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
picker = new M.assignfeedback_editpdf.colourpicker({
buttonNode: commentcolourbutton,
colours: COMMENTCOLOUR,
@ -3606,7 +3606,7 @@ EDITOR.prototype = {
context: this
});
annotationcolourbutton = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON);
annotationcolourbutton = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
picker = new M.assignfeedback_editpdf.colourpicker({
buttonNode: annotationcolourbutton,
iconprefix: 'colour_',
@ -3628,11 +3628,11 @@ EDITOR.prototype = {
stampfiles = this.get('stampfiles');
if (stampfiles.length <= 0) {
Y.one(TOOLSELECTOR.stamp).ancestor().hide();
this.get_dialogue_element(TOOLSELECTOR.stamp).ancestor().hide();
} else {
filename = stampfiles[0].substr(stampfiles[0].lastIndexOf('/') + 1);
this.currentedit.stamp = filename;
currentstampbutton = Y.one(SELECTOR.STAMPSBUTTON);
currentstampbutton = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
picker = new M.assignfeedback_editpdf.stamppicker({
buttonNode: currentstampbutton,
@ -3665,7 +3665,7 @@ EDITOR.prototype = {
e.preventDefault();
// Change style of the pressed button.
currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.removeClass('assignfeedback_editpdf_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'false');
this.currentedit.tool = tool;
@ -3725,6 +3725,15 @@ EDITOR.prototype = {
return drawable;
},
/**
* Find an element within the dialogue.
* @protected
* @method get_dialogue_element
*/
get_dialogue_element : function(selector) {
return this.dialogue.get('boundingBox').one(selector);
},
/**
* Redraw the active edit.
@ -3746,7 +3755,7 @@ EDITOR.prototype = {
*/
edit_start : function(e) {
e.preventDefault();
var canvas = Y.one(SELECTOR.DRAWINGCANVAS),
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
offset = canvas.getXY(),
scrolltop = canvas.get('docScrollY'),
scrollleft = canvas.get('docScrollX'),
@ -3817,7 +3826,7 @@ EDITOR.prototype = {
edit_move : function(e) {
e.preventDefault();
var bounds = this.get_canvas_bounds(),
canvas = Y.one(SELECTOR.DRAWINGCANVAS),
canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
clientpoint = new M.assignfeedback_editpdf.point(e.clientX + canvas.get('docScrollX'),
e.clientY + canvas.get('docScrollY')),
point = this.get_canvas_coordinates(clientpoint);
@ -3914,7 +3923,7 @@ EDITOR.prototype = {
if (drawregionheight < 100) {
drawregionheight = 100;
}
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
drawingregion.setStyle('maxHeight', drawregionheight +'px');
this.redraw();
return true;
@ -3974,7 +3983,8 @@ EDITOR.prototype = {
if (jsondata.error) {
return new M.core.ajaxException(jsondata);
}
Y.one(SELECTOR.UNSAVEDCHANGESDIV).addClass('haschanges');
Y.one('#' + this.get('linkid')).siblings(SELECTOR.UNSAVEDCHANGESDIV)
.item(0).addClass('haschanges');
} catch (e) {
return new M.core.exception(e);
}
@ -4038,13 +4048,13 @@ EDITOR.prototype = {
* @method change_page
*/
change_page : function() {
var drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS),
var drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
page,
previousbutton,
nextbutton;
previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON);
nextbutton = Y.one(SELECTOR.NEXTBUTTON);
previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON);
nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON);
if (this.currentpage > 0) {
previousbutton.removeAttribute('disabled');
@ -4064,7 +4074,7 @@ EDITOR.prototype = {
drawingcanvas.setStyle('height', page.height + 'px');
// Update page select.
Y.one(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.get_dialogue_element(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.resize(); // Internally will call 'redraw', after checking the dialogue size.
},
@ -4082,7 +4092,7 @@ EDITOR.prototype = {
previousbutton,
nextbutton;
pageselect = Y.one(SELECTOR.PAGESELECT);
pageselect = this.get_dialogue_element(SELECTOR.PAGESELECT);
var options = pageselect.all('option');
if (options.size() <= 1) {
@ -4099,8 +4109,8 @@ EDITOR.prototype = {
this.change_page();
}, this);
previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON);
nextbutton = Y.one(SELECTOR.NEXTBUTTON);
previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON);
nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON);
previousbutton.on('click', this.previous_page, this);
previousbutton.on('key', this.previous_page, 'down:13', this);
@ -4144,7 +4154,7 @@ EDITOR.prototype = {
move_canvas: function() {
var drawingregion, x, y, i;
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
x = parseInt(drawingregion.get('scrollLeft'), 10);
y = parseInt(drawingregion.get('scrollTop'), 10);

View File

@ -170,8 +170,8 @@ Y.extend(ANNOTATION, Y.Base, {
*/
draw_highlight : function() {
var bounds,
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
offsetcanvas = Y.one(SELECTOR.DRAWINGCANVAS).getXY(),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
offsetcanvas = this.editor.get_dialogue_element(SELECTOR.DRAWINGCANVAS).getXY(),
shape;
if (this.editor.currentannotation === this) {

View File

@ -42,7 +42,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
*/
draw : function() {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;
@ -84,7 +84,7 @@ Y.extend(ANNOTATIONSTAMP, M.assignfeedback_editpdf.annotation, {
draw_current_edit : function(edit) {
var bounds = new M.assignfeedback_editpdf.rect(),
drawable = new M.assignfeedback_editpdf.drawable(this.editor),
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
node,
position;

View File

@ -159,7 +159,7 @@ var COMMENT = function(editor, gradeid, pageno, x, y, width, colour, rawtext) {
this.draw = function(focus) {
var drawable = new M.assignfeedback_editpdf.drawable(this.editor),
node,
drawingregion = Y.one(SELECTOR.DRAWINGREGION),
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION),
container,
menu,
position,

View File

@ -73,8 +73,8 @@ Y.extend(COMMENTSEARCH, M.core.dialogue, {
commentslist,
filtertext;
filternode = Y.one(SELECTOR.SEARCHFILTER);
commentslist = Y.one(SELECTOR.SEARCHCOMMENTSLIST);
filternode = this.get('editor').get_dialogue_element(SELECTOR.SEARCHFILTER);
commentslist = this.get('editor').get_dialogue_element(SELECTOR.SEARCHCOMMENTSLIST);
filtertext = filternode.get('value');

View File

@ -100,7 +100,7 @@ var DRAWABLE = function(editor) {
this.store_position = function(container, x, y) {
var drawingregion, scrollx, scrolly;
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.editor.get_dialogue_element(SELECTOR.DRAWINGREGION);
scrollx = parseInt(drawingregion.get('scrollLeft'), 10);
scrolly = parseInt(drawingregion.get('scrollTop'), 10);
container.setData('x', x + scrollx);

View File

@ -219,7 +219,7 @@ EDITOR.prototype = {
var button, currenttoolnode, imgurl;
// Initalise the colour buttons.
button = Y.one(SELECTOR.COMMENTCOLOURBUTTON);
button = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
imgurl = M.util.image_url('background_colour_' + this.currentedit.commentcolour, 'assignfeedback_editpdf');
button.one('img').setAttribute('src', imgurl);
@ -230,15 +230,15 @@ EDITOR.prototype = {
button.one('img').setStyle('borderStyle', 'solid');
}
button = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON);
button = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
imgurl = M.util.image_url('colour_' + this.currentedit.annotationcolour, 'assignfeedback_editpdf');
button.one('img').setAttribute('src', imgurl);
currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.addClass('assignfeedback_editpdf_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'true');
button = Y.one(SELECTOR.STAMPSBUTTON);
button = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
button.one('img').setAttrs({'src': this.get_stamp_image_url(this.currentedit.stamp),
'height': '16',
'width': '16'});
@ -249,7 +249,7 @@ EDITOR.prototype = {
* @method get_canvas_bounds
*/
get_canvas_bounds : function() {
var canvas = Y.one(SELECTOR.DRAWINGCANVAS),
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
offsetcanvas = canvas.getXY(),
offsetleft = offsetcanvas[0],
offsettop = offsetcanvas[1],
@ -308,12 +308,12 @@ EDITOR.prototype = {
// Add custom class for styling.
this.dialogue.get('boundingBox').addClass(CSS.DIALOGUE);
this.loadingicon = Y.one(SELECTOR.LOADINGICON);
this.loadingicon = this.get_dialogue_element(SELECTOR.LOADINGICON);
drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS);
drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS);
this.graphic = new Y.Graphic({render : SELECTOR.DRAWINGCANVAS});
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
drawingregion.on('scroll', this.move_canvas, this);
if (!this.get('readonly')) {
@ -393,7 +393,7 @@ EDITOR.prototype = {
var pagetotal = this.get('pagetotal');
// Update the progress bar.
var progressbarcontainer = Y.one(SELECTOR.PROGRESSBARCONTAINER);
var progressbarcontainer = this.get_dialogue_element(SELECTOR.PROGRESSBARCONTAINER);
var progressbar = progressbarcontainer.one('.bar');
if (progressbar) {
// Calculate progress.
@ -520,7 +520,7 @@ EDITOR.prototype = {
picker,
filename;
searchcommentsbutton = Y.one(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton = this.get_dialogue_element(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton.on('click', this.open_search_comments, this);
searchcommentsbutton.on('key', this.open_search_comments, 'down:13', this);
@ -529,7 +529,7 @@ EDITOR.prototype = {
}
// Setup the tool buttons.
Y.each(TOOLSELECTOR, function(selector, tool) {
toolnode = Y.one(selector);
toolnode = this.get_dialogue_element(selector);
toolnode.on('click', this.handle_tool_button, this, tool);
toolnode.on('key', this.handle_tool_button, 'down:13', this, tool);
toolnode.setAttribute('aria-pressed', 'false');
@ -537,7 +537,7 @@ EDITOR.prototype = {
// Set the default tool.
commentcolourbutton = Y.one(SELECTOR.COMMENTCOLOURBUTTON);
commentcolourbutton = this.get_dialogue_element(SELECTOR.COMMENTCOLOURBUTTON);
picker = new M.assignfeedback_editpdf.colourpicker({
buttonNode: commentcolourbutton,
colours: COMMENTCOLOUR,
@ -553,7 +553,7 @@ EDITOR.prototype = {
context: this
});
annotationcolourbutton = Y.one(SELECTOR.ANNOTATIONCOLOURBUTTON);
annotationcolourbutton = this.get_dialogue_element(SELECTOR.ANNOTATIONCOLOURBUTTON);
picker = new M.assignfeedback_editpdf.colourpicker({
buttonNode: annotationcolourbutton,
iconprefix: 'colour_',
@ -575,11 +575,11 @@ EDITOR.prototype = {
stampfiles = this.get('stampfiles');
if (stampfiles.length <= 0) {
Y.one(TOOLSELECTOR.stamp).ancestor().hide();
this.get_dialogue_element(TOOLSELECTOR.stamp).ancestor().hide();
} else {
filename = stampfiles[0].substr(stampfiles[0].lastIndexOf('/') + 1);
this.currentedit.stamp = filename;
currentstampbutton = Y.one(SELECTOR.STAMPSBUTTON);
currentstampbutton = this.get_dialogue_element(SELECTOR.STAMPSBUTTON);
picker = new M.assignfeedback_editpdf.stamppicker({
buttonNode: currentstampbutton,
@ -612,7 +612,7 @@ EDITOR.prototype = {
e.preventDefault();
// Change style of the pressed button.
currenttoolnode = Y.one(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.removeClass('assignfeedback_editpdf_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'false');
this.currentedit.tool = tool;
@ -672,6 +672,15 @@ EDITOR.prototype = {
return drawable;
},
/**
* Find an element within the dialogue.
* @protected
* @method get_dialogue_element
*/
get_dialogue_element : function(selector) {
return this.dialogue.get('boundingBox').one(selector);
},
/**
* Redraw the active edit.
@ -693,7 +702,7 @@ EDITOR.prototype = {
*/
edit_start : function(e) {
e.preventDefault();
var canvas = Y.one(SELECTOR.DRAWINGCANVAS),
var canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
offset = canvas.getXY(),
scrolltop = canvas.get('docScrollY'),
scrollleft = canvas.get('docScrollX'),
@ -764,7 +773,7 @@ EDITOR.prototype = {
edit_move : function(e) {
e.preventDefault();
var bounds = this.get_canvas_bounds(),
canvas = Y.one(SELECTOR.DRAWINGCANVAS),
canvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
clientpoint = new M.assignfeedback_editpdf.point(e.clientX + canvas.get('docScrollX'),
e.clientY + canvas.get('docScrollY')),
point = this.get_canvas_coordinates(clientpoint);
@ -861,7 +870,7 @@ EDITOR.prototype = {
if (drawregionheight < 100) {
drawregionheight = 100;
}
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
drawingregion.setStyle('maxHeight', drawregionheight +'px');
this.redraw();
return true;
@ -921,7 +930,8 @@ EDITOR.prototype = {
if (jsondata.error) {
return new M.core.ajaxException(jsondata);
}
Y.one(SELECTOR.UNSAVEDCHANGESDIV).addClass('haschanges');
Y.one('#' + this.get('linkid')).siblings(SELECTOR.UNSAVEDCHANGESDIV)
.item(0).addClass('haschanges');
} catch (e) {
return new M.core.exception(e);
}
@ -985,13 +995,13 @@ EDITOR.prototype = {
* @method change_page
*/
change_page : function() {
var drawingcanvas = Y.one(SELECTOR.DRAWINGCANVAS),
var drawingcanvas = this.get_dialogue_element(SELECTOR.DRAWINGCANVAS),
page,
previousbutton,
nextbutton;
previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON);
nextbutton = Y.one(SELECTOR.NEXTBUTTON);
previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON);
nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON);
if (this.currentpage > 0) {
previousbutton.removeAttribute('disabled');
@ -1011,7 +1021,7 @@ EDITOR.prototype = {
drawingcanvas.setStyle('height', page.height + 'px');
// Update page select.
Y.one(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.get_dialogue_element(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.resize(); // Internally will call 'redraw', after checking the dialogue size.
},
@ -1029,7 +1039,7 @@ EDITOR.prototype = {
previousbutton,
nextbutton;
pageselect = Y.one(SELECTOR.PAGESELECT);
pageselect = this.get_dialogue_element(SELECTOR.PAGESELECT);
var options = pageselect.all('option');
if (options.size() <= 1) {
@ -1046,8 +1056,8 @@ EDITOR.prototype = {
this.change_page();
}, this);
previousbutton = Y.one(SELECTOR.PREVIOUSBUTTON);
nextbutton = Y.one(SELECTOR.NEXTBUTTON);
previousbutton = this.get_dialogue_element(SELECTOR.PREVIOUSBUTTON);
nextbutton = this.get_dialogue_element(SELECTOR.NEXTBUTTON);
previousbutton.on('click', this.previous_page, this);
previousbutton.on('key', this.previous_page, 'down:13', this);
@ -1091,7 +1101,7 @@ EDITOR.prototype = {
move_canvas: function() {
var drawingregion, x, y, i;
drawingregion = Y.one(SELECTOR.DRAWINGREGION);
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
x = parseInt(drawingregion.get('scrollLeft'), 10);
y = parseInt(drawingregion.get('scrollTop'), 10);

View File

@ -24,23 +24,23 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
DIALOGUE : 'assignfeedback_editpdf_widget'
},
SELECTOR = {
PREVIOUSBUTTON : '.' + CSS.DIALOGUE + ' .navigate-previous-button',
NEXTBUTTON : '.' + CSS.DIALOGUE + ' .navigate-next-button',
SEARCHCOMMENTSBUTTON : '.' + CSS.DIALOGUE + ' .searchcommentsbutton',
PREVIOUSBUTTON : '.navigate-previous-button',
NEXTBUTTON : ' .navigate-next-button',
SEARCHCOMMENTSBUTTON : '.searchcommentsbutton',
SEARCHFILTER : '.assignfeedback_editpdf_commentsearch input',
SEARCHCOMMENTSLIST : '.assignfeedback_editpdf_commentsearch ul',
PAGESELECT : '.' + CSS.DIALOGUE + ' .navigate-page-select',
LOADINGICON : '.' + CSS.DIALOGUE + ' .loading',
PROGRESSBARCONTAINER : '.' + CSS.DIALOGUE + ' .progress-info.progress-striped',
DRAWINGREGION : '.' + CSS.DIALOGUE + ' .drawingregion',
DRAWINGCANVAS : '.' + CSS.DIALOGUE + ' .drawingcanvas',
SAVE : '.' + CSS.DIALOGUE + ' .savebutton',
COMMENTCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .commentcolourbutton',
COMMENTMENU : ' .commentdrawable a',
ANNOTATIONCOLOURBUTTON : '.' + CSS.DIALOGUE + ' .annotationcolourbutton',
DELETEANNOTATIONBUTTON : '.' + CSS.DIALOGUE + ' .deleteannotationbutton',
PAGESELECT : '.navigate-page-select',
LOADINGICON : '.loading',
PROGRESSBARCONTAINER : '.progress-info.progress-striped',
DRAWINGREGION : '.drawingregion',
DRAWINGCANVAS : '.drawingcanvas',
SAVE : '.savebutton',
COMMENTCOLOURBUTTON : '.commentcolourbutton',
COMMENTMENU : '.commentdrawable a',
ANNOTATIONCOLOURBUTTON : '.annotationcolourbutton',
DELETEANNOTATIONBUTTON : '.deleteannotationbutton',
UNSAVEDCHANGESDIV : '.assignfeedback_editpdf_unsavedchanges',
STAMPSBUTTON : '.' + CSS.DIALOGUE + ' .currentstampbutton',
STAMPSBUTTON : '.currentstampbutton',
DIALOGUE : '.' + CSS.DIALOGUE
},
SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)',
@ -64,13 +64,13 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdf/ajax.php',
},
CLICKTIMEOUT = 300,
TOOLSELECTOR = {
'comment': '.' + CSS.DIALOGUE + ' .commentbutton',
'pen': '.' + CSS.DIALOGUE + ' .penbutton',
'line': '.' + CSS.DIALOGUE + ' .linebutton',
'rectangle': '.' + CSS.DIALOGUE + ' .rectanglebutton',
'oval': '.' + CSS.DIALOGUE + ' .ovalbutton',
'stamp': '.' + CSS.DIALOGUE + ' .stampbutton',
'select': '.' + CSS.DIALOGUE + ' .selectbutton',
'highlight': '.' + CSS.DIALOGUE + ' .highlightbutton'
'comment': '.commentbutton',
'pen': '.penbutton',
'line': '.linebutton',
'rectangle': '.rectanglebutton',
'oval': '.ovalbutton',
'stamp': '.stampbutton',
'select': '.selectbutton',
'highlight': '.highlightbutton'
},
STROKEWEIGHT = 4;