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
This diff is collapsed.
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}); 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 \ No newline at end of file
...@@ -137,6 +137,7 @@ define(['jquery', './global'], ...@@ -137,6 +137,7 @@ define(['jquery', './global'],
* @public * @public
*/ */
Annotation.cartridgex = 0; Annotation.cartridgex = 0;
/** /**
* position y of the cartridge. * position y of the cartridge.
* @property cartridgey * @property cartridgey
...@@ -144,6 +145,15 @@ define(['jquery', './global'], ...@@ -144,6 +145,15 @@ define(['jquery', './global'],
* @public * @public
*/ */
Annotation.cartridgey = 0; Annotation.cartridgey = 0;
/**
* appreciation of the annotation.
* @property appreciation
* @type Int
* @public
*/
Annotation.appreciation = 0;
/** /**
* mode readonly demo or not * mode readonly demo or not
* @property adminDemo * @property adminDemo
......
...@@ -125,6 +125,15 @@ define(['./global'], ...@@ -125,6 +125,15 @@ define(['./global'],
* @type Boolean * @type Boolean
*/ */
Tool.reply = true; 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 * If the tool can be used in annotation workspace
* @property enabled * @property enabled
......
...@@ -99,6 +99,10 @@ class admin_editor { ...@@ -99,6 +99,10 @@ class admin_editor {
$tool->cartridge_color = $data->catridgecolor; $tool->cartridge_color = $data->catridgecolor;
$tool->contextid = $contextid; $tool->contextid = $contextid;
$tool->label = $data->button; $tool->label = $data->button;
$tool->appreciation = 0;
if($data->appreciation) {
$tool->appreciation = $data->appreciation;
}
$tool->reply = 0; $tool->reply = 0;
if ($data->reply == "on") { if ($data->reply == "on") {
$tool->reply = 1; $tool->reply = 1;
...@@ -304,6 +308,7 @@ class admin_editor { ...@@ -304,6 +308,7 @@ class admin_editor {
$tool->texts = $tool_json->texts; $tool->texts = $tool_json->texts;
$tool->label = $tool_json->button; $tool->label = $tool_json->button;
$tool->enabled = $tool_json->enabled; $tool->enabled = $tool_json->enabled;
$tool->appreciation = $tool_json->appreciation;
if ($tool_json->reply == "on") { if ($tool_json->reply == "on") {
$tool->reply = 1; $tool->reply = 1;
} else { } else {
......
...@@ -75,6 +75,9 @@ class annotation { ...@@ -75,6 +75,9 @@ class annotation {
/** @var bool displayrotation for displaying the sign of the annotation */ /** @var bool displayrotation for displaying the sign of the annotation */
public $displayrotation = 0; public $displayrotation = 0;
/** @var int appreciation of the annotation -1 = negative 0 = neutral 1 = positive */
public $appreciation = 0;
/** @var string borderstyle */ /** @var string borderstyle */
public $borderstyle = ''; public $borderstyle = '';
...@@ -140,6 +143,7 @@ class annotation { ...@@ -140,6 +143,7 @@ class annotation {
$this->colour = $annotationRef->colour; $this->colour = $annotationRef->colour;
$this->displaylock = $annotationRef->displaylock; $this->displaylock = $annotationRef->displaylock;
$this->displayrotation = $annotationRef->displayrotation; $this->displayrotation = $annotationRef->displayrotation;
$this->appreciation = $annotationRef->appreciation;
$this->borderstyle = $annotationRef->borderstyle; $this->borderstyle = $annotationRef->borderstyle;
//$this->parent_annot = $annotationRef->parent_annot; //$this->parent_annot = $annotationRef->parent_annot;
$this->answerrequested = $annotationRef->answerrequested; $this->answerrequested = $annotationRef->answerrequested;
......
...@@ -67,6 +67,9 @@ class tool { ...@@ -67,6 +67,9 @@ class tool {
/** @var boolean, allow reply or not */ /** @var boolean, allow reply or not */
public $reply = 0; 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 */ /** @var boolean, if tool is actived or not */
public $enabled = 1; public $enabled = 1;
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<FIELD NAME="studentstatus" TYPE="char" LENGTH="50" NOTNULL="false" SEQUENCE="false"/> <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="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="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="borderstyle" TYPE="char" LENGTH="20" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="parent_annot" TYPE="int" LENGTH="10" 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"/> <FIELD NAME="pdfdisplay" TYPE="char" LENGTH="20" NOTNULL="false"/>
...@@ -67,6 +68,7 @@ ...@@ -67,6 +68,7 @@
<FIELD NAME="texts" TYPE="char" LENGTH="500" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="texts" TYPE="char" LENGTH="500" NOTNULL="false" SEQUENCE="false"/>
<FIELD NAME="label" TYPE="char" LENGTH="20" NOTNULL="true" 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="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="enabled" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="order_tool" TYPE="int" LENGTH="11" NOTNULL="false" SEQUENCE="false"/> <FIELD NAME="order_tool" TYPE="int" LENGTH="11" NOTNULL="false" SEQUENCE="false"/>
</FIELDS> </FIELDS>
......
...@@ -382,5 +382,24 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) { ...@@ -382,5 +382,24 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2019070100, 'assignfeedback', 'editpdfplus'); 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; return true;
} }
...@@ -155,6 +155,10 @@ $string['admintoolboxannotation'] = 'Annotation'; ...@@ -155,6 +155,10 @@ $string['admintoolboxannotation'] = 'Annotation';
$string['admintoolboxannotation_color'] = 'Color'; $string['admintoolboxannotation_color'] = 'Color';
$string['admintoolboxannotation_texts'] = 'Predefined texts'; $string['admintoolboxannotation_texts'] = 'Predefined texts';
$string['admintoolboxannotation_reply'] = 'Question/answer'; $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_messageok'] = 'Tool deleted';
$string['admindeltool_messageko'] = 'Error on delete'; $string['admindeltool_messageko'] = 'Error on delete';
$string['adminaddtool_messageok'] = 'Tool added'; $string['adminaddtool_messageok'] = 'Tool added';
......
...@@ -154,6 +154,10 @@ $string['admintoolboxannotation'] = 'Annotation'; ...@@ -154,6 +154,10 @@ $string['admintoolboxannotation'] = 'Annotation';
$string['admintoolboxannotation_color'] = 'Couleur'; $string['admintoolboxannotation_color'] = 'Couleur';
$string['admintoolboxannotation_texts'] = 'Textes prédéfinis'; $string['admintoolboxannotation_texts'] = 'Textes prédéfinis';
$string['admintoolboxannotation_reply'] = 'Question/réponse'; $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_messageok'] = 'Outil supprimé';
$string['admindeltool_messageko'] = 'Erreur à la suppression'; $string['admindeltool_messageko'] = 'Erreur à la suppression';
$string['adminaddtool_messageok'] = 'Ajout enregistré'; $string['adminaddtool_messageok'] = 'Ajout enregistré';
......
...@@ -179,6 +179,16 @@ ...@@ -179,6 +179,16 @@
<input type="checkbox" id="reply" {{#tool.reply}}checked {{/tool.reply}}name="reply" /> <input type="checkbox" id="reply" {{#tool.reply}}checked {{/tool.reply}}name="reply" />
</div> </div>
</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> </div>
</div> </div>
...@@ -208,8 +218,11 @@ ...@@ -208,8 +218,11 @@
{{# js }} {{# js }}
require(['jquery','core/ajax','core/notification'], function($,ajax,notification) { require(['jquery','core/ajax','core/notification'], function($,ajax,notification) {
{{#tool.id}}$("#typetool").val({{tool.type}});{{/tool.id}} {{#tool.id}}
{{#tool.id}}$("#toolaxis").val({{tool.axis}});{{/tool.id}} $("#typetool").val({{tool.type}});
$("#toolaxis").val({{tool.axis}});
$("#appreciation").val({{tool.appreciation}});
{{/tool.id}}
var $collectionHolder; var $collectionHolder;
......
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$plugin->version = 2019070102; $plugin->version = 2019100801;
$plugin->requires = 2019051100; // Moodle 3.7 $plugin->requires = 2019051100; // Moodle 3.7
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;
$plugin->release = "2.3.5 (Build: 2019070102)"; $plugin->release = "2.4.0 (Build: 2019100801)";
$plugin->component = 'assignfeedback_editpdfplus'; $plugin->component = 'assignfeedback_editpdfplus';
...@@ -57,7 +57,8 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php', ...@@ -57,7 +57,8 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
HELPBTNCLASS: '.helpmessage', HELPBTNCLASS: '.helpmessage',
STATUTSELECTOR: '#menustatutselection', STATUTSELECTOR: '#menustatutselection',
QUESTIONSELECTOR: '#menuquestionselection', QUESTIONSELECTOR: '#menuquestionselection',
STUDENTVALIDATION: '#student_valide_button' STUDENTVALIDATION: '#student_valide_button',
NOHIDE: 'noHide'
}, },
SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)', SELECTEDBORDERCOLOUR = 'rgba(200, 200, 255, 0.9)',
SELECTEDFILLCOLOUR = 'rgba(200, 200, 255, 0.5)', SELECTEDFILLCOLOUR = 'rgba(200, 200, 255, 0.5)',
...@@ -690,6 +691,16 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -690,6 +691,16 @@ Y.extend(ANNOTATION, Y.Base, {
* @public * @public
*/ */
displayrotation: 0, 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...) * Border style for cartridge and other element (frame...)
* @property borderstyle * @property borderstyle
...@@ -767,12 +778,21 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -767,12 +778,21 @@ Y.extend(ANNOTATION, Y.Base, {
* @public * @public
*/ */
pdfdisplay: "footnote", pdfdisplay: "footnote",
/** /**
* minimum size for resize area * minimum size for resize area
* @type Int * @type Int
* @public * @public
*/ */
minresizewidth: 20, minresizewidth: 20,
/**
* used to check if the annotation needs to be minimized
* @type Int
* @public
*/
hideAnnot: 1,
/** /**
* Initialise the annotation. * Initialise the annotation.
* *
...@@ -790,7 +810,8 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -790,7 +810,8 @@ Y.extend(ANNOTATION, Y.Base, {
this.tooltype = config.tooltype; this.tooltype = config.tooltype;
this.textannot = config.parent_annot_element.textannot; this.textannot = config.parent_annot_element.textannot;
this.displaylock = parseInt(config.parent_annot_element.displaylock, 10); 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.borderstyle = config.parent_annot_element.borderstyle || 'solid';
this.parent_annot = parseInt(config.parent_annot_element.id, 10); this.parent_annot = parseInt(config.parent_annot_element.id, 10);
this.answerrequested = parseInt(config.parent_annot_element.answerrequested, 10) || 0; this.answerrequested = parseInt(config.parent_annot_element.answerrequested, 10) || 0;
...@@ -806,7 +827,8 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -806,7 +827,8 @@ Y.extend(ANNOTATION, Y.Base, {
this.tooltype = config.tooltype; this.tooltype = config.tooltype;
this.textannot = config.textannot; this.textannot = config.textannot;
this.displaylock = parseInt(config.displaylock, 10); 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.borderstyle = config.borderstyle || 'solid';
this.parent_annot = parseInt(config.parent_annot, 10); this.parent_annot = parseInt(config.parent_annot, 10);
this.answerrequested = parseInt(config.answerrequested, 10) || 0; this.answerrequested = parseInt(config.answerrequested, 10) || 0;
...@@ -849,12 +871,14 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -849,12 +871,14 @@ Y.extend(ANNOTATION, Y.Base, {
textannot: this.textannot, textannot: this.textannot,
displaylock: parseInt(this.displaylock, 10), displaylock: parseInt(this.displaylock, 10),
displayrotation: parseInt(this.displayrotation, 10), displayrotation: parseInt(this.displayrotation, 10),
appreciation: parseInt(this.appreciation, 10),
borderstyle: this.borderstyle, borderstyle: this.borderstyle,
parent_annot: parseInt(this.parent_annot, 10), parent_annot: parseInt(this.parent_annot, 10),
divcartridge: this.divcartridge, divcartridge: this.divcartridge,
parent_annot_div: this.parent_annot_element.divcartridge, parent_annot_div: this.parent_annot_element.divcartridge,
answerrequested: parseInt(this.answerrequested, 10), answerrequested: parseInt(this.answerrequested, 10),
pdfdisplay: this.pdfdisplay pdfdisplay: this.pdfdisplay,
appreciationdisplay: this.appreciationdisplay
}; };
} }
return { return {
...@@ -873,13 +897,15 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -873,13 +897,15 @@ Y.extend(ANNOTATION, Y.Base, {
textannot: this.textannot, textannot: this.textannot,
displaylock: parseInt(this.displaylock, 10), displaylock: parseInt(this.displaylock, 10),
displayrotation: parseInt(this.displayrotation, 10), displayrotation: parseInt(this.displayrotation, 10),
appreciation: parseInt(this.appreciation, 10),
borderstyle: this.borderstyle, borderstyle: this.borderstyle,
parent_annot: parseInt(this.parent_annot, 10), parent_annot: parseInt(this.parent_annot, 10),
divcartridge: this.divcartridge, divcartridge: this.divcartridge,
parent_annot_div: '', parent_annot_div: '',
answerrequested: parseInt(this.answerrequested, 10), answerrequested: parseInt(this.answerrequested, 10),
studentstatus: parseInt(this.studentstatus, 10), studentstatus: parseInt(this.studentstatus, 10),
pdfdisplay: this.pdfdisplay pdfdisplay: this.pdfdisplay,
appreciationdisplay: this.appreciationdisplay
}; };
}, },
/** /**
...@@ -1185,6 +1211,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1185,6 +1211,7 @@ Y.extend(ANNOTATION, Y.Base, {
divconteneurdisplay.append(inputonof); divconteneurdisplay.append(inputonof);
divconteneurdisplay.append(this.get_input_question()); divconteneurdisplay.append(this.get_input_question());
divconteneurdisplay.append(this.get_input_pdfdisplay()); divconteneurdisplay.append(this.get_input_pdfdisplay());
divconteneurdisplay.append(this.get_input_appreciationdisplay());
return divconteneurdisplay; return divconteneurdisplay;
}, },
...@@ -1202,6 +1229,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1202,6 +1229,7 @@ Y.extend(ANNOTATION, Y.Base, {
divtoolbardisplay.append(this.get_button_visibility_right()); divtoolbardisplay.append(this.get_button_visibility_right());
divtoolbardisplay.append(this.get_button_save()); divtoolbardisplay.append(this.get_button_save());
divtoolbardisplay.append(this.get_button_cancel()); divtoolbardisplay.append(this.get_button_cancel());
divtoolbardisplay.append(this.get_button_appreciation());
if (this.tooltype.reply === 1) { if (this.tooltype.reply === 1) {
divtoolbardisplay.append(this.get_button_question()); divtoolbardisplay.append(this.get_button_question());
} }
...@@ -1347,6 +1375,30 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1347,6 +1375,30 @@ Y.extend(ANNOTATION, Y.Base, {
buttontrashdisplay.on('click', this.change_pdf_display, this); buttontrashdisplay.on('click', this.change_pdf_display, this);
return buttontrashdisplay; 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 * get the html node for the hidden input to keep information about question state
* @return node * @return node
...@@ -1365,6 +1417,28 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1365,6 +1417,28 @@ Y.extend(ANNOTATION, Y.Base, {
get_input_pdfdisplay: function () { get_input_pdfdisplay: function () {
return Y.Node.create("<input type='hidden' id='" + this.divcartridge + "_pdfdisplay' value='" + this.pdfdisplay + "'/>"); 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 * get the final reference text value
* @return node * @return node
...@@ -1429,6 +1503,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1429,6 +1503,7 @@ Y.extend(ANNOTATION, Y.Base, {
} }
this.apply_question_status(); this.apply_question_status();
this.apply_pdfdisplay(); this.apply_pdfdisplay();
this.apply_appreciationdisplay();
}, },
/** /**
* get the html node for the text to display for the annotation, according to parameters * get the html node for the text to display for the annotation, according to parameters
...@@ -1475,6 +1550,9 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1475,6 +1550,9 @@ Y.extend(ANNOTATION, Y.Base, {
* change question status of the annotation (with or not) * change question status of the annotation (with or not)
*/ */
change_pdf_display: function () { change_pdf_display: function () {
window.console.log('pdfdisplay');
var pdfdisplayvalue = this.editor.get_dialogue_element('#' + this.divcartridge + "_pdfdisplay"); var pdfdisplayvalue = this.editor.get_dialogue_element('#' + this.divcartridge + "_pdfdisplay");
var value = pdfdisplayvalue.get('value'); var value = pdfdisplayvalue.get('value');
if (value === "footnote") { if (value === "footnote") {
...@@ -1484,9 +1562,42 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -1484,9 +1562,42 @@ Y.extend(