Gitlab CSE Unil

Commit 385ca59e authored by M. Chardon's avatar M. Chardon
Browse files

selection et deselection des boutons

parent aa703b4b
......@@ -127,7 +127,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
default:
break;
}
$iconparams = array('data-tool' => $datatool, 'class' => $class . 'button');
$iconparams = array('data-tool' => $datatool, 'class' => $class . 'button costumtoolbarbutton', 'id' => 'ctbutton' . $fulltool->id);
}
if (!empty($accesskey)) {
......@@ -251,7 +251,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
$toolbarCostumdiv .
$toolbar001 .
$clearfix, 'pageheader');
debugging($pageheader);
//debugging($pageheader);
$body .= $pageheader;
......
......@@ -79,10 +79,10 @@
<FIELD NAME="contextid" TYPE="int" LENGTH="18" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="axis" TYPE="int" LENGTH="9" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="type" TYPE="int" LENGTH="9" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="colors" TYPE="char" LENGTH="200" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="colors" TYPE="char" LENGTH="300" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="image" TYPE="binary" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="thumbnail" TYPE="binary" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="cartridge" TYPE="char" LENGTH="5" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="cartridge" TYPE="char" LENGTH="10" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="texts" TYPE="char" LENGTH="200" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="position" TYPE="int" LENGTH="18" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="label" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false"/>
......
......@@ -287,7 +287,7 @@ class assign_feedback_editpdfplus extends assign_feedback_plugin {
global $DB;
$comments = $DB->count_records('assignfeedback_editpp_cmnt', array('gradeid' => $grade->id, 'draft' => 0));
$annotations = $DB->count_records('assignfeedback_editpdfp_annot', array('gradeid' => $grade->id, 'draft' => 0));
$annotations = $DB->count_records('assignfeedback_editpp_annot', array('gradeid' => $grade->id, 'draft' => 0));
return $comments == 0 && $annotations == 0;
}
......@@ -301,7 +301,7 @@ class assign_feedback_editpdfplus extends assign_feedback_plugin {
$grades = $DB->get_records('assign_grades', array('assignment' => $this->assignment->get_instance()->id), '', 'id');
if ($grades) {
list($gradeids, $params) = $DB->get_in_or_equal(array_keys($grades), SQL_PARAMS_NAMED);
$DB->delete_records_select('assignfeedback_editpdfp_annot', 'gradeid ' . $gradeids, $params);
$DB->delete_records_select('assignfeedback_editpp_annot', 'gradeid ' . $gradeids, $params);
$DB->delete_records_select('assignfeedback_editpp_cmnt', 'gradeid ' . $gradeids, $params);
}
return true;
......
......@@ -47,7 +47,8 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
DIALOGUE : '.' + CSS.DIALOGUE,
CUSTOMTOOLBARID : '#toolbaraxis',
CUSTOMTOOLBARS : '.customtoolbar',
AXISCUSTOMTOOLBAR : '.menuaxisselection'
AXISCUSTOMTOOLBAR : '.menuaxisselection',
CUSTOMTOOLBARBUTTONS : '.costumtoolbarbutton'
},
SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)',
SELECTEDFILLCOLOUR = 'rgba(200, 200, 255, 0.5)',
......@@ -78,7 +79,14 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
//'stamp': '.stampbutton',
'select': '.selectbutton',
'drag': '.dragbutton',
'highlight': '.highlightbutton'
'highlight': '.highlightbutton'/*,
/*'highlightplus': '.highlightplusbutton',
'lineplus': '.lineplusbutton',
'stampplus': '.stampplusbutton',
'frame': '.framebutton',
'verticalline': '.verticallinebutton',
'stampcomment': '.stampcommentbutton',
'commentplus': '.commentplusbutton'*/
},
TOOLTYPE = {
'PEN' : 8,
......@@ -3294,7 +3302,11 @@ EDITOR.prototype = {
imgurl = M.util.image_url('colour_' + this.currentedit.annotationcolour, 'assignfeedback_editpdfplus');
button.one('img').setAttribute('src', imgurl);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
console.log(this.currentedit.tool);
if (this.currentedit.id)
currenttoolnode = this.get_dialogue_element('#' + this.currentedit.id);
else
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.addClass('assignfeedback_editpdfplus_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'true');
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
......@@ -3607,6 +3619,13 @@ EDITOR.prototype = {
customtoolbar.show();
var axisselector = this.get_dialogue_element(SELECTOR.AXISCUSTOMTOOLBAR);
axisselector.on('change', this.update_custom_toolbars, this);
Y.all(SELECTOR.CUSTOMTOOLBARBUTTONS).each(function (toolnode) {
var toolid = toolnode.get('id');
var toollib = toolnode.getAttribute('data-tool');
toolnode.on('click', this.handle_tool_button, this, toollib, toolid);
toolnode.on('key', this.handle_tool_button, 'down:13', this, toollib, toolid);
toolnode.setAttribute('aria-pressed', 'false');
}, this);
searchcommentsbutton = this.get_dialogue_element(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton.on('click', this.open_search_comments, this);
......@@ -3689,16 +3708,11 @@ EDITOR.prototype = {
}*/
},
update_custom_toolbars: function () {
/*var customtoolbars = this.get_dialogue_element(SELECTOR.CUSTOMTOOLBARS).each(function(e){
e.hide();
});
//customtoolbars.hide();*/
Y.all(SELECTOR.CUSTOMTOOLBARS).each(function (toolbar) {
toolbar.hide();
}, this);
var axisselector = this.get_dialogue_element(SELECTOR.AXISCUSTOMTOOLBAR+' option:checked');
var axisid= axisselector.get('value');
//alert(axisid);
var axisselector = this.get_dialogue_element(SELECTOR.AXISCUSTOMTOOLBAR + ' option:checked');
var axisid = axisselector.get('value');
var customtoolbar = this.get_dialogue_element(SELECTOR.CUSTOMTOOLBARID + '' + axisid);
customtoolbar.show();
},
......@@ -3707,16 +3721,23 @@ EDITOR.prototype = {
* @protected
* @method handle_tool_button
*/
handle_tool_button: function (e, tool) {
handle_tool_button: function (e, tool, toolid) {
var currenttoolnode;
console.log(tool);
e.preventDefault();
// Change style of the pressed button.
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
if (this.currentedit.id) {
currenttoolnode = this.get_dialogue_element("#" + this.currentedit.id);
} else {
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
}
currenttoolnode.removeClass('assignfeedback_editpdfplus_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'false');
//update le currentedit object with the new tool
this.currentedit.tool = tool;
this.currentedit.id = toolid;
if (tool !== "comment" && tool !== "select" && tool !== "drag" && tool !== "stamp") {
this.lastannotationtool = tool;
......
......@@ -47,7 +47,8 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
DIALOGUE : '.' + CSS.DIALOGUE,
CUSTOMTOOLBARID : '#toolbaraxis',
CUSTOMTOOLBARS : '.customtoolbar',
AXISCUSTOMTOOLBAR : '.menuaxisselection'
AXISCUSTOMTOOLBAR : '.menuaxisselection',
CUSTOMTOOLBARBUTTONS : '.costumtoolbarbutton'
},
SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)',
SELECTEDFILLCOLOUR = 'rgba(200, 200, 255, 0.5)',
......@@ -78,7 +79,14 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
//'stamp': '.stampbutton',
'select': '.selectbutton',
'drag': '.dragbutton',
'highlight': '.highlightbutton'
'highlight': '.highlightbutton'/*,
/*'highlightplus': '.highlightplusbutton',
'lineplus': '.lineplusbutton',
'stampplus': '.stampplusbutton',
'frame': '.framebutton',
'verticalline': '.verticallinebutton',
'stampcomment': '.stampcommentbutton',
'commentplus': '.commentplusbutton'*/
},
TOOLTYPE = {
'PEN' : 8,
......@@ -3294,7 +3302,11 @@ EDITOR.prototype = {
imgurl = M.util.image_url('colour_' + this.currentedit.annotationcolour, 'assignfeedback_editpdfplus');
button.one('img').setAttribute('src', imgurl);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
console.log(this.currentedit.tool);
if (this.currentedit.id)
currenttoolnode = this.get_dialogue_element('#' + this.currentedit.id);
else
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.addClass('assignfeedback_editpdfplus_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'true');
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
......@@ -3607,6 +3619,13 @@ EDITOR.prototype = {
customtoolbar.show();
var axisselector = this.get_dialogue_element(SELECTOR.AXISCUSTOMTOOLBAR);
axisselector.on('change', this.update_custom_toolbars, this);
Y.all(SELECTOR.CUSTOMTOOLBARBUTTONS).each(function (toolnode) {
var toolid = toolnode.get('id');
var toollib = toolnode.getAttribute('data-tool');
toolnode.on('click', this.handle_tool_button, this, toollib, toolid);
toolnode.on('key', this.handle_tool_button, 'down:13', this, toollib, toolid);
toolnode.setAttribute('aria-pressed', 'false');
}, this);
searchcommentsbutton = this.get_dialogue_element(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton.on('click', this.open_search_comments, this);
......@@ -3689,16 +3708,11 @@ EDITOR.prototype = {
}*/
},
update_custom_toolbars: function () {
/*var customtoolbars = this.get_dialogue_element(SELECTOR.CUSTOMTOOLBARS).each(function(e){
e.hide();
});
//customtoolbars.hide();*/
Y.all(SELECTOR.CUSTOMTOOLBARS).each(function (toolbar) {
toolbar.hide();
}, this);
var axisselector = this.get_dialogue_element(SELECTOR.AXISCUSTOMTOOLBAR+' option:checked');
var axisid= axisselector.get('value');
//alert(axisid);
var axisselector = this.get_dialogue_element(SELECTOR.AXISCUSTOMTOOLBAR + ' option:checked');
var axisid = axisselector.get('value');
var customtoolbar = this.get_dialogue_element(SELECTOR.CUSTOMTOOLBARID + '' + axisid);
customtoolbar.show();
},
......@@ -3707,16 +3721,23 @@ EDITOR.prototype = {
* @protected
* @method handle_tool_button
*/
handle_tool_button: function (e, tool) {
handle_tool_button: function (e, tool, toolid) {
var currenttoolnode;
console.log(tool);
e.preventDefault();
// Change style of the pressed button.
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
if (this.currentedit.id) {
currenttoolnode = this.get_dialogue_element("#" + this.currentedit.id);
} else {
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
}
currenttoolnode.removeClass('assignfeedback_editpdfplus_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'false');
//update le currentedit object with the new tool
this.currentedit.tool = tool;
this.currentedit.id = toolid;
if (tool !== "comment" && tool !== "select" && tool !== "drag" && tool !== "stamp") {
this.lastannotationtool = tool;
......
......@@ -234,7 +234,11 @@ EDITOR.prototype = {
imgurl = M.util.image_url('colour_' + this.currentedit.annotationcolour, 'assignfeedback_editpdfplus');
button.one('img').setAttribute('src', imgurl);
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
//console.log(this.currentedit.tool);
if (this.currentedit.id)
currenttoolnode = this.get_dialogue_element('#' + this.currentedit.id);
else
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
currenttoolnode.addClass('assignfeedback_editpdfplus_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'true');
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
......@@ -547,6 +551,13 @@ EDITOR.prototype = {
customtoolbar.show();
var axisselector = this.get_dialogue_element(SELECTOR.AXISCUSTOMTOOLBAR);
axisselector.on('change', this.update_custom_toolbars, this);
Y.all(SELECTOR.CUSTOMTOOLBARBUTTONS).each(function (toolnode) {
var toolid = toolnode.get('id');
var toollib = toolnode.getAttribute('data-tool');
toolnode.on('click', this.handle_tool_button, this, toollib, toolid);
toolnode.on('key', this.handle_tool_button, 'down:13', this, toollib, toolid);
toolnode.setAttribute('aria-pressed', 'false');
}, this);
searchcommentsbutton = this.get_dialogue_element(SELECTOR.SEARCHCOMMENTSBUTTON);
searchcommentsbutton.on('click', this.open_search_comments, this);
......@@ -632,8 +643,8 @@ EDITOR.prototype = {
Y.all(SELECTOR.CUSTOMTOOLBARS).each(function (toolbar) {
toolbar.hide();
}, this);
var axisselector = this.get_dialogue_element(SELECTOR.AXISCUSTOMTOOLBAR+' option:checked');
var axisid= axisselector.get('value');
var axisselector = this.get_dialogue_element(SELECTOR.AXISCUSTOMTOOLBAR + ' option:checked');
var axisid = axisselector.get('value');
var customtoolbar = this.get_dialogue_element(SELECTOR.CUSTOMTOOLBARID + '' + axisid);
customtoolbar.show();
},
......@@ -642,16 +653,23 @@ EDITOR.prototype = {
* @protected
* @method handle_tool_button
*/
handle_tool_button: function (e, tool) {
handle_tool_button: function (e, tool, toolid) {
var currenttoolnode;
console.log(tool);
e.preventDefault();
// Change style of the pressed button.
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
if (this.currentedit.id) {
currenttoolnode = this.get_dialogue_element("#" + this.currentedit.id);
} else {
currenttoolnode = this.get_dialogue_element(TOOLSELECTOR[this.currentedit.tool]);
}
currenttoolnode.removeClass('assignfeedback_editpdfplus_selectedbutton');
currenttoolnode.setAttribute('aria-pressed', 'false');
//update le currentedit object with the new tool
this.currentedit.tool = tool;
this.currentedit.id = toolid;
if (tool !== "comment" && tool !== "select" && tool !== "drag" && tool !== "stamp") {
this.lastannotationtool = tool;
......
......@@ -45,7 +45,8 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
DIALOGUE : '.' + CSS.DIALOGUE,
CUSTOMTOOLBARID : '#toolbaraxis',
CUSTOMTOOLBARS : '.customtoolbar',
AXISCUSTOMTOOLBAR : '.menuaxisselection'
AXISCUSTOMTOOLBAR : '.menuaxisselection',
CUSTOMTOOLBARBUTTONS : '.costumtoolbarbutton'
},
SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)',
SELECTEDFILLCOLOUR = 'rgba(200, 200, 255, 0.5)',
......@@ -76,7 +77,14 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
//'stamp': '.stampbutton',
'select': '.selectbutton',
'drag': '.dragbutton',
'highlight': '.highlightbutton'
'highlight': '.highlightbutton'/*,
/*'highlightplus': '.highlightplusbutton',
'lineplus': '.lineplusbutton',
'stampplus': '.stampplusbutton',
'frame': '.framebutton',
'verticalline': '.verticallinebutton',
'stampcomment': '.stampcommentbutton',
'commentplus': '.commentplusbutton'*/
},
TOOLTYPE = {
'PEN' : 8,
......
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