Gitlab CSE Unil

Commit fb969cff authored by M. Chardon's avatar M. Chardon
Browse files

ajout fonctionnalité pour ne pas écraser les modif des étudiants

parent e000eadd
...@@ -4,11 +4,11 @@ This plugin is a fork of assignfeedback_editpdf, and is developed and maintained ...@@ -4,11 +4,11 @@ This plugin is a fork of assignfeedback_editpdf, and is developed and maintained
Author: Marion Chardon, <marion.chardon@unil.ch> Author: Marion Chardon, <marion.chardon@unil.ch>
Compatible with Moodle versions: 3.3, 3.5, 3.7 Compatible with Moodle versions: 3.3, 3.5, 3.6, 3.7
Note: Note:
- for 3.3, please check tag "3.3", not master version. - for 3.3, please check tag "3.3", not master version.
- for 3.5, please check branch "mdl_3.5", not master version. - for 3.5/3.6, please check branch "mdl_3.5", not master version.
## Description ## Description
......
<?php <?php
// This file is part of Moodle - http://moodle.org/ // This file is part of Moodle - http://moodle.org/
// //
// Moodle is free software: you can redistribute it and/or modify // Moodle is free software: you can redistribute it and/or modify
...@@ -92,13 +93,19 @@ class annotation { ...@@ -92,13 +93,19 @@ class annotation {
/** @var string pdfdisplay */ /** @var string pdfdisplay */
public $pdfdisplay = "footnote"; public $pdfdisplay = "footnote";
/** @var int draft */
public $draft = 1;
/** @var int draft_id */
public $draft_id = null;
/** /**
* Convert a compatible stdClass into an instance of this class. * Convert a compatible stdClass into an instance of this class.
* @param stdClass $record * @param stdClass $record
*/ */
public function __construct(\stdClass $record = null) { public function __construct(\stdClass $record = null) {
if ($record) { if ($record) {
$intcols = array('endx', 'endy', 'x', 'y'); $intcols = array('endx', 'endy', 'x', 'y', 'draft_id');
foreach ($this as $key => $value) { foreach ($this as $key => $value) {
if (isset($record->$key)) { if (isset($record->$key)) {
if (in_array($key, $intcols)) { if (in_array($key, $intcols)) {
...@@ -120,4 +127,23 @@ class annotation { ...@@ -120,4 +127,23 @@ class annotation {
return $this->textannot && !$this->parent_annot; return $this->textannot && !$this->parent_annot;
} }
public function clone_teacher_annotation($annotationRef) {
$this->x = $annotationRef->x;
$this->endx = $annotationRef->endx;
$this->y = $annotationRef->y;
$this->endy = $annotationRef->endy;
$this->cartridgex = $annotationRef->cartridgex;
$this->cartridgey = $annotationRef->cartridgey;
$this->path = $annotationRef->path;
$this->toolid = $annotationRef->toolid;
$this->textannot = $annotationRef->textannot;
$this->colour = $annotationRef->colour;
$this->displaylock = $annotationRef->displaylock;
$this->displayrotation = $annotationRef->displayrotation;
$this->borderstyle = $annotationRef->borderstyle;
$this->parent_annot = $annotationRef->parent_annot;
$this->answerrequested = $annotationRef->answerrequested;
$this->pdfdisplay = $annotationRef->pdfdisplay;
}
} }
...@@ -250,39 +250,85 @@ class page_editor { ...@@ -250,39 +250,85 @@ class page_editor {
* @return int - the number of annotations. * @return int - the number of annotations.
*/ */
public static function set_annotations($gradeid, $pageno, $annotations) { public static function set_annotations($gradeid, $pageno, $annotations) {
global $DB; global $CFG, $DB;
$annotationsRelease = $DB->get_records(self::BDDTABLEANNOTATION, array(self::GRADEID => $gradeid, self::DRAFLIB => 1));
$DB->delete_records(self::BDDTABLEANNOTATION, array(self::GRADEID => $gradeid, 'pageno' => $pageno, self::DRAFLIB => 1));
$added = 0; $added = 0;
$annotationdiv = array(); if (!$annotationsRelease || sizeof($annotationsRelease) == 0 || $CFG->preserve_student_on_update == 0) {
foreach ($annotations as $record) { $DB->delete_records(self::BDDTABLEANNOTATION, array(self::GRADEID => $gradeid, 'pageno' => $pageno, self::DRAFLIB => 1));
$currentdiv = $record->divcartridge; $annotationdiv = array();
if ($record->parent_annot_div != '') { foreach ($annotations as $record) {
//on est dans le cas d'une annotation liee $currentdiv = $record->divcartridge;
$idparent = $annotationdiv[$record->parent_annot_div]; $newid = self::create_annotation_for_draft($record, $annotationdiv, $gradeid, $pageno);
$record->parent_annot = intval($idparent); if ($newid) {
} if ($currentdiv != '') {
// Force these. $annotationdiv[$currentdiv] = $newid;
if (!($record instanceof annotation)) { }
$annotation = new annotation($record); $added++;
} else { }
$annotation = $record;
} }
$annotation->gradeid = $gradeid; } else {
$annotation->pageno = $pageno; $draftid = [];
$annotation->draft = 1; foreach ($annotations as $record) {
$newid = self::add_annotation($annotation); if (!$record->id) {
if ($newid) { $currentdiv = $record->divcartridge;
if ($currentdiv != '') { $newid = self::create_annotation_for_draft($record, $annotationdiv, $gradeid, $pageno);
$annotationdiv[$currentdiv] = $newid; if ($newid) {
if ($currentdiv != '') {
$annotationdiv[$currentdiv] = $newid;
}
$added++;
}
continue;
} }
$annotationDraft = self::get_annotation($record->id);
//maj annotation
$annotationDraft->clone_teacher_annotation($record);
$DB->update_record(self::BDDTABLEANNOTATION, $annotationDraft);
$added++; $added++;
$draftid[] = $annotationDraft->id;
}
foreach ($annotationsRelease as $annotation) {
if (in_array($annotation->id, $draftid)) {
continue;
}
//need to be deleted
self::remove_annotation($annotation->id);
} }
} }
return $added; return $added;
} }
/**
* create an annotation for a draft
* @param annotation|record $annotationRecord annotation to create
* @param array $annotationdiv array with parent's annotation's id
* @param type $gradeid grade id
* @param type $pageno page no
* @return int new annotation id
*/
private static function create_annotation_for_draft($annotationRecord, $annotationdiv, $gradeid, $pageno) {
if ($annotationRecord->parent_annot_div != '') {
//on est dans le cas d'une annotation liee
$idparent = $annotationdiv[$annotationRecord->parent_annot_div];
$annotationRecord->parent_annot = intval($idparent);
}
// Force these.
if (!($annotationRecord instanceof annotation)) {
$annotation = new annotation($annotationRecord);
} else {
$annotation = $annotationRecord;
}
$annotation->gradeid = $gradeid;
$annotation->pageno = $pageno;
$annotation->draft = 1;
return self::add_annotation($annotation);
}
/** /**
* Update a set of annotations to database * Update a set of annotations to database
* @global $DB * @global $DB
...@@ -328,7 +374,7 @@ class page_editor { ...@@ -328,7 +374,7 @@ class page_editor {
public static function unrelease_drafts($gradeid) { public static function unrelease_drafts($gradeid) {
global $DB; global $DB;
// Delete the non-draft annotations and comments. // Delete the non-draft annotations.
return $DB->delete_records(self::BDDTABLEANNOTATION, array(self::GRADEID => $gradeid, self::DRAFLIB => 0)); return $DB->delete_records(self::BDDTABLEANNOTATION, array(self::GRADEID => $gradeid, self::DRAFLIB => 0));
} }
...@@ -338,29 +384,79 @@ class page_editor { ...@@ -338,29 +384,79 @@ class page_editor {
* @return bool * @return bool
*/ */
public static function release_drafts($gradeid) { public static function release_drafts($gradeid) {
global $DB; global $CFG, $DB;
// Delete the previous non-draft annotations and comments.
$DB->delete_records(self::BDDTABLEANNOTATION, array(self::GRADEID => $gradeid, self::DRAFLIB => 0));
// Copy all the draft annotations and comments to non-drafts. $annotationsRelease = $DB->get_records(self::BDDTABLEANNOTATION, array(self::GRADEID => $gradeid, self::DRAFLIB => 0));
$parentlink = []; $parentlink = [];
$records = $DB->get_records(self::BDDTABLEANNOTATION, array(self::GRADEID => $gradeid, self::DRAFLIB => 1));
foreach ($records as $record) { if (!$annotationsRelease || sizeof($annotationsRelease) == 0 || $CFG->preserve_student_on_update == 0) {
$oldid = $record->id; // Delete the previous non-draft annotations.
unset($record->id); $DB->delete_records(self::BDDTABLEANNOTATION, array(self::GRADEID => $gradeid, self::DRAFLIB => 0));
$record->draft = 0;
$oldparentrecord = $record->parent_annot; // Copy all the draft annotations to non-drafts.
if ($record->parent_annot > 0) { $records = $DB->get_records(self::BDDTABLEANNOTATION, array(self::GRADEID => $gradeid, self::DRAFLIB => 1));
$record->parent_annot = $parentlink[$record->parent_annot]; foreach ($records as $record) {
$newid = $this->create_annotation_for_release($record, $parentlink);
$parentlink[$oldid] = $newid;
}
} else {
$records = $DB->get_records(self::BDDTABLEANNOTATION, array(self::GRADEID => $gradeid, self::DRAFLIB => 1));
$draftid = [];
// update existing annotations
foreach ($annotationsRelease as $annotation) {
$annotationDraft = self::get_annotation($annotation->draft_id);
//if no result, annotation has been deleted
if (!$annotationDraft) {
self::remove_annotation($annotation->id);
continue;
}
//maj annotation
$annotation = new annotation($annotation);
$annotation->clone_teacher_annotation($annotationDraft);
$DB->update_record(self::BDDTABLEANNOTATION, $annotation);
$parentlink[$annotation->draft_id] = $annotation->id;
$draftid[] = $annotation->draft_id;
}
//create only new annotations
foreach ($records as $record) {
if (in_array($record->id, $draftid)) {
continue;
}
//need to be created
$newid = self::create_annotation_for_release($record, $parentlink);
$parentlink[$oldid] = $newid;
} }
$newid = $DB->insert_record(self::BDDTABLEANNOTATION, $record);
$parentlink[$oldid] = $newid;
} }
return true; return true;
} }
/**
* create an annotation for a release draft
* @param annotation|record $annotationRecord annotation to create
* @param array $parentlink array with parent's annotation's id
* @return int new annotation id
*/
private static function create_annotation_for_release($annotationRecord, $parentlink) {
$oldid = $annotationRecord->id;
unset($annotationRecord->id);
$annotationRecord->draft = 0;
$annotationRecord->draft_id = $oldid;
if ($annotationRecord->parent_annot > 0) {
$annotationRecord->parent_annot = $parentlink[$annotationRecord->parent_annot];
}
// Force these.
if (!($annotationRecord instanceof annotation)) {
$annotation = new annotation($annotationRecord);
} else {
$annotation = $annotationRecord;
}
return self::add_annotation($annotation);
}
/** /**
* Has annotations or comments. * Has annotations or comments.
* @param int $gradeid * @param int $gradeid
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<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"/>
<FIELD NAME="draft_id" TYPE="int" LENGTH="10" NOTNULL="false"/>
</FIELDS> </FIELDS>
<KEYS> <KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/> <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
......
...@@ -370,5 +370,17 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) { ...@@ -370,5 +370,17 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2019061201, 'assignfeedback', 'editpdfplus'); upgrade_plugin_savepoint(true, 2019061201, 'assignfeedback', 'editpdfplus');
} }
if ($oldversion < 2019070100) {
/* annotation table */
$table = new xmldb_table('assignfeedback_editpp_annot');
$field = new xmldb_field('draft_id', XMLDB_TYPE_INTEGER, '10', null, false);
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Editpdfplus savepoint reached.
upgrade_plugin_savepoint(true, 2019070100, 'assignfeedback', 'editpdfplus');
}
return true; return true;
} }
...@@ -205,3 +205,7 @@ $string['delete_model_question'] = 'Do you want to delete this model?'; ...@@ -205,3 +205,7 @@ $string['delete_model_question'] = 'Do you want to delete this model?';
$string['feedback_configuration'] = 'Feedback: configuration'; $string['feedback_configuration'] = 'Feedback: configuration';
$string['axis_label'] = 'Name'; $string['axis_label'] = 'Name';
$string['axis_add'] = 'Add a new axis'; $string['axis_add'] = 'Add a new axis';
$string['erase_student_annotation'] = 'Student\'s modifications';
$string['erase_student_annotation_desc'] = 'Student\'s modifications on annotations update';
$string['erase_student_on_update'] = 'Preserve student\'s modifications on annotations update';
$string['erase_student_on_update_desc'] = 'Preserve student\'s modifications on annotations update, default false';
\ No newline at end of file
...@@ -204,3 +204,5 @@ $string['delete_model_question'] = 'Êtes-vous sûr de vouloir supprimer ce mode ...@@ -204,3 +204,5 @@ $string['delete_model_question'] = 'Êtes-vous sûr de vouloir supprimer ce mode
$string['feedback_configuration'] = 'Feedback : configuration'; $string['feedback_configuration'] = 'Feedback : configuration';
$string['axis_label'] = 'Nom'; $string['axis_label'] = 'Nom';
$string['axis_add'] = 'Add a new axis'; $string['axis_add'] = 'Add a new axis';
$string['erase_student_on_update'] = 'Erase student\'s modifications on annotations update';
$string['erase_student_on_update_desc'] = 'Erase student\'s modifications on annotations update, default true';
<?php <?php
// This file is part of Moodle - http://moodle.org/ // This file is part of Moodle - http://moodle.org/
// //
// Moodle is free software: you can redistribute it and/or modify // Moodle is free software: you can redistribute it and/or modify
...@@ -22,13 +23,12 @@ ...@@ -22,13 +23,12 @@
* The code is based on mod/assign/feedback/editpdf/settings.php by Davo Smith. * The code is based on mod/assign/feedback/editpdf/settings.php by Davo Smith.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
// Enabled by default. // Enabled by default.
$settings->add(new admin_setting_configcheckbox('assignfeedback_editpdfplus/default', $settings->add(new admin_setting_configcheckbox('assignfeedback_editpdfplus/default',
new lang_string('default', 'assignfeedback_editpdfplus'), new lang_string('default', 'assignfeedback_editpdfplus'),
new lang_string('default_help', 'assignfeedback_editpdfplus'), 0)); new lang_string('default_help', 'assignfeedback_editpdfplus'), 0));
// Base palette (contextid = 1) link. // Base palette (contextid = 1) link.
$basepaletteurl = $CFG->wwwroot . '/mod/assign/feedback/editpdfplus/view_admin.php?id=' . \context_system::instance()->id; $basepaletteurl = $CFG->wwwroot . '/mod/assign/feedback/editpdfplus/view_admin.php?id=' . \context_system::instance()->id;
...@@ -38,47 +38,50 @@ $settings->add(new admin_setting_heading('basepalette', get_string('basepalette' ...@@ -38,47 +38,50 @@ $settings->add(new admin_setting_heading('basepalette', get_string('basepalette'
$systempathslink = new moodle_url('/admin/settings.php', array('section' => 'systempaths')); $systempathslink = new moodle_url('/admin/settings.php', array('section' => 'systempaths'));
$systempathlink = html_writer::link($systempathslink, get_string('systempaths', 'admin')); $systempathlink = html_writer::link($systempathslink, get_string('systempaths', 'admin'));
$settings->add(new admin_setting_heading('pathtogs', get_string('pathtogs', 'admin'), $settings->add(new admin_setting_heading('pathtogs', get_string('pathtogs', 'admin'),
get_string('pathtogspathdesc', 'assignfeedback_editpdfplus', $systempathlink))); get_string('pathtogspathdesc', 'assignfeedback_editpdfplus', $systempathlink)));
$url = new moodle_url('/mod/assign/feedback/editpdfplus/testgs.php'); $url = new moodle_url('/mod/assign/feedback/editpdfplus/testgs.php');
$link = html_writer::link($url, get_string('testgs', 'assignfeedback_editpdfplus')); $link = html_writer::link($url, get_string('testgs', 'assignfeedback_editpdfplus'));
$settings->add(new admin_setting_heading('testgs', '', $link)); $settings->add(new admin_setting_heading('testgs', '', $link));
$settings->add(new admin_setting_heading('erase_student_annotation', get_string('erase_student_annotation', 'assignfeedback_editpdfplus'), get_string('erase_student_annotation_desc', 'assignfeedback_editpdfplus')));
$settings->add(new admin_setting_configcheckbox('preserve_student_on_update', get_string('erase_student_on_update', 'assignfeedback_editpdfplus'), get_string('erase_student_on_update_desc', 'assignfeedback_editpdfplus'), 0));
//$settings->add(new admin_setting_configtext("unsetting", "le nom ici", "description", 50, PARAM_INT, 20)); //$settings->add(new admin_setting_configtext("unsetting", "le nom ici", "description", 50, PARAM_INT, 20));
$settings->add(new admin_setting_heading('highlightplus',get_string('typetool_highlightplus','assignfeedback_editpdfplus'),get_string('typetool_highlightplus_desc','assignfeedback_editpdfplus'))); $settings->add(new admin_setting_heading('highlightplus', get_string('typetool_highlightplus', 'assignfeedback_editpdfplus'), get_string('typetool_highlightplus_desc', 'assignfeedback_editpdfplus')));
//$settings->add(new admin_setting_configcheckbox('highlightplus_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0)); //$settings->add(new admin_setting_configcheckbox('highlightplus_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0));
$settings->add(new admin_setting_configcolourpicker('highlightplus_color',get_string('adminplugin_color','assignfeedback_editpdfplus'),get_string('adminplugin_color_desc','assignfeedback_editpdfplus'),'#FFFF40')); $settings->add(new admin_setting_configcolourpicker('highlightplus_color', get_string('adminplugin_color', 'assignfeedback_editpdfplus'), get_string('adminplugin_color_desc', 'assignfeedback_editpdfplus'), '#FFFF40'));
$settings->add(new admin_setting_configcolourpicker('highlightplus_cartridge_color',get_string('adminplugin_cartridge_color','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_color_desc','assignfeedback_editpdfplus'),'#FF6F40')); $settings->add(new admin_setting_configcolourpicker('highlightplus_cartridge_color', get_string('adminplugin_cartridge_color', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_color_desc', 'assignfeedback_editpdfplus'), '#FF6F40'));
$settings->add(new admin_setting_configtext('highlightplus_cartridge_x',get_string('adminplugin_cartridge_x','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_x_desc','assignfeedback_editpdfplus'),0)); $settings->add(new admin_setting_configtext('highlightplus_cartridge_x', get_string('adminplugin_cartridge_x', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_x_desc', 'assignfeedback_editpdfplus'), 0));
$settings->add(new admin_setting_configtext('highlightplus_cartridge_y',get_string('adminplugin_cartridge_y','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_y_desc','assignfeedback_editpdfplus'),-24)); $settings->add(new admin_setting_configtext('highlightplus_cartridge_y', get_string('adminplugin_cartridge_y', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_y_desc', 'assignfeedback_editpdfplus'), -24));
$settings->add(new admin_setting_heading('stampplus',get_string('typetool_stampplus','assignfeedback_editpdfplus'),get_string('typetool_stampplus_desc','assignfeedback_editpdfplus'))); $settings->add(new admin_setting_heading('stampplus', get_string('typetool_stampplus', 'assignfeedback_editpdfplus'), get_string('typetool_stampplus_desc', 'assignfeedback_editpdfplus')));
//$settings->add(new admin_setting_configcheckbox('stampplus_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0)); //$settings->add(new admin_setting_configcheckbox('stampplus_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0));
$settings->add(new admin_setting_configcolourpicker('stampplus_color',get_string('adminplugin_color','assignfeedback_editpdfplus'),get_string('adminplugin_color_desc','assignfeedback_editpdfplus'),'#FF0000')); $settings->add(new admin_setting_configcolourpicker('stampplus_color', get_string('adminplugin_color', 'assignfeedback_editpdfplus'), get_string('adminplugin_color_desc', 'assignfeedback_editpdfplus'), '#FF0000'));
$settings->add(new admin_setting_heading('frame',get_string('typetool_frame','assignfeedback_editpdfplus'),get_string('typetool_frame_desc','assignfeedback_editpdfplus'))); $settings->add(new admin_setting_heading('frame', get_string('typetool_frame', 'assignfeedback_editpdfplus'), get_string('typetool_frame_desc', 'assignfeedback_editpdfplus')));
//$settings->add(new admin_setting_configcheckbox('frame_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0)); //$settings->add(new admin_setting_configcheckbox('frame_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0));
$settings->add(new admin_setting_configtext('frame_cartridge_x',get_string('adminplugin_cartridge_x','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_x_desc','assignfeedback_editpdfplus'),5)); $settings->add(new admin_setting_configtext('frame_cartridge_x', get_string('adminplugin_cartridge_x', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_x_desc', 'assignfeedback_editpdfplus'), 5));
$settings->add(new admin_setting_configtext('frame_cartridge_y',get_string('adminplugin_cartridge_y','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_y_desc','assignfeedback_editpdfplus'),-8)); $settings->add(new admin_setting_configtext('frame_cartridge_y', get_string('adminplugin_cartridge_y', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_y_desc', 'assignfeedback_editpdfplus'), -8));
$settings->add(new admin_setting_heading('verticalline',get_string('typetool_verticalline','assignfeedback_editpdfplus'),get_string('typetool_verticalline_desc','assignfeedback_editpdfplus'))); $settings->add(new admin_setting_heading('verticalline', get_string('typetool_verticalline', 'assignfeedback_editpdfplus'), get_string('typetool_verticalline_desc', 'assignfeedback_editpdfplus')));
//$settings->add(new admin_setting_configcheckbox('verticalline_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0)); //$settings->add(new admin_setting_configcheckbox('verticalline_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0));
$settings->add(new admin_setting_configcolourpicker('verticalline_color',get_string('adminplugin_color','assignfeedback_editpdfplus'),get_string('adminplugin_color_desc','assignfeedback_editpdfplus'),'#0000FF')); $settings->add(new admin_setting_configcolourpicker('verticalline_color', get_string('adminplugin_color', 'assignfeedback_editpdfplus'), get_string('adminplugin_color_desc', 'assignfeedback_editpdfplus'), '#0000FF'));
$settings->add(new admin_setting_configcolourpicker('verticalline_cartridge_color',get_string('adminplugin_cartridge_color','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_color_desc','assignfeedback_editpdfplus'),'#0000FF')); $settings->add(new admin_setting_configcolourpicker('verticalline_cartridge_color', get_string('adminplugin_cartridge_color', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_color_desc', 'assignfeedback_editpdfplus'), '#0000FF'));
$settings->add(new admin_setting_configtext('verticalline_cartridge_x',get_string('adminplugin_cartridge_x','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_x_desc','assignfeedback_editpdfplus'),5)); $settings->add(new admin_setting_configtext('verticalline_cartridge_x', get_string('adminplugin_cartridge_x', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_x_desc', 'assignfeedback_editpdfplus'), 5));
$settings->add(new admin_setting_configtext('verticalline_cartridge_y',get_string('adminplugin_cartridge_y','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_y_desc','assignfeedback_editpdfplus'),0)); $settings->add(new admin_setting_configtext('verticalline_cartridge_y', get_string('adminplugin_cartridge_y', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_y_desc', 'assignfeedback_editpdfplus'), 0));
$settings->add(new admin_setting_heading('stampcomment',get_string('typetool_stampcomment','assignfeedback_editpdfplus'),get_string('typetool_stampcomment_desc','assignfeedback_editpdfplus'))); $settings->add(new admin_setting_heading('stampcomment', get_string('typetool_stampcomment', 'assignfeedback_editpdfplus'), get_string('typetool_stampcomment_desc', 'assignfeedback_editpdfplus')));
//$settings->add(new admin_setting_configcheckbox('stampcomment_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0)); //$settings->add(new admin_setting_configcheckbox('stampcomment_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0));
//$settings->add(new admin_setting_configcolourpicker('stampcomment_color',get_string('adminplugin_color','assignfeedback_editpdfplus'),get_string('adminplugin_color_desc','assignfeedback_editpdfplus'),'#000099')); //$settings->add(new admin_setting_configcolourpicker('stampcomment_color',get_string('adminplugin_color','assignfeedback_editpdfplus'),get_string('adminplugin_color_desc','assignfeedback_editpdfplus'),'#000099'));
$settings->add(new admin_setting_configcolourpicker('stampcomment_cartridge_color',get_string('adminplugin_cartridge_color','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_color_desc','assignfeedback_editpdfplus'),'#000099')); $settings->add(new admin_setting_configcolourpicker('stampcomment_cartridge_color', get_string('adminplugin_cartridge_color', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_color_desc', 'assignfeedback_editpdfplus'), '#000099'));
$settings->add(new admin_setting_configtext('stampcomment_cartridge_x',get_string('adminplugin_cartridge_x','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_x_desc','assignfeedback_editpdfplus'),35)); $settings->add(new admin_setting_configtext('stampcomment_cartridge_x', get_string('adminplugin_cartridge_x', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_x_desc', 'assignfeedback_editpdfplus'), 35));
$settings->add(new admin_setting_configtext('stampcomment_cartridge_y',get_string('adminplugin_cartridge_y','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_y_desc','assignfeedback_editpdfplus'),6)); $settings->add(new admin_setting_configtext('stampcomment_cartridge_y', get_string('adminplugin_cartridge_y', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_y_desc', 'assignfeedback_editpdfplus'), 6));
$settings->add(new admin_setting_heading('commentplus',get_string('typetool_commentplus','assignfeedback_editpdfplus'),get_string('typetool_commentplus_desc','assignfeedback_editpdfplus'))); $settings->add(new admin_setting_heading('commentplus', get_string('typetool_commentplus', 'assignfeedback_editpdfplus'), get_string('typetool_commentplus_desc', 'assignfeedback_editpdfplus')));
//$settings->add(new admin_setting_configcheckbox('commentplus_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0)); //$settings->add(new admin_setting_configcheckbox('commentplus_configurable',get_string('is_not_configurable','assignfeedback_editpdfplus'),get_string('is_not_configurable_desc','assignfeedback_editpdfplus'),0));
$settings->add(new admin_setting_configcolourpicker('commentplus_cartridge_color',get_string('adminplugin_cartridge_color','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_color_desc','assignfeedback_editpdfplus'),'#000000')); $settings->add(new admin_setting_configcolourpicker('commentplus_cartridge_color', get_string('adminplugin_cartridge_color', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_color_desc', 'assignfeedback_editpdfplus'), '#000000'));
$settings->add(new admin_setting_configtext('commentplus_cartridge_x',get_string('adminplugin_cartridge_x','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_x_desc','assignfeedback_editpdfplus'),35)); $settings->add(new admin_setting_configtext('commentplus_cartridge_x', get_string('adminplugin_cartridge_x', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_x_desc', 'assignfeedback_editpdfplus'), 35));
$settings->add(new admin_setting_configtext('commentplus_cartridge_y',get_string('adminplugin_cartridge_y','assignfeedback_editpdfplus'),get_string('adminplugin_cartridge_y_desc','assignfeedback_editpdfplus'),6)); $settings->add(new admin_setting_configtext('commentplus_cartridge_y', get_string('adminplugin_cartridge_y', 'assignfeedback_editpdfplus'), get_string('adminplugin_cartridge_y_desc', 'assignfeedback_editpdfplus'), 6));
//get_config("ass:::", "unsetting") //get_config("ass:::", "unsetting")
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$plugin->version = 2019061203; $plugin->version = 2019070100;
$plugin->requires = 2019051100; // Moodle 3.7 $plugin->requires = 2019051100; // Moodle 3.7
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;
$plugin->release = "2.3.2 (Build: 2019061203)"; $plugin->release = "2.3.3 (Build: 2019070100)";
$plugin->component = 'assignfeedback_editpdfplus'; $plugin->component = 'assignfeedback_editpdfplus';
...@@ -834,6 +834,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -834,6 +834,7 @@ Y.extend(ANNOTATION, Y.Base, {
clean: function () { clean: function () {
if (this.parent_annot_element) { if (this.parent_annot_element) {
return { return {
id: this.id,
gradeid: this.gradeid, gradeid: this.gradeid,
x: parseInt(this.x, 10), x: parseInt(this.x, 10),
y: parseInt(this.y, 10), y: parseInt(this.y, 10),
...@@ -856,6 +857,7 @@ Y.extend(ANNOTATION, Y.Base, { ...@@ -856,6 +857,7 @@ Y.extend(ANNOTATION, Y.Base, {
}; };
} }
return { return {
id: this.id,
gradeid: this.gradeid, gradeid: this.gradeid,
x: parseInt(this.x, 10), x: parseInt(this.x, 10),
y: parseInt(this.y, 10), y: parseInt(this.y, 10),
......
YUI.add("moodle-assignfeedback_editpdfplus-editor",function(e,t){var n=M.cfg.wwwroot+"/mod/assign/feedback/editpdfplus/ajax.php",r=M.cfg.wwwroot+"/mod/assign/feedback/editpdfplus/ajax_progress.php",i={DIALOGUE:"assignfeedback_editpdfplus_widget"},s={PREVIOUSBUTTON:".navigate-previous-button",NEXTBUTTON:" .navigate-next-button",PAGESELECT:".navigate-page-select",LOADINGICON:".loading",PROGRESSBARCONTAINER:".progress-info.progress-striped",DRAWINGREGION:".drawingregion",DRAWINGREGIONCLASS:"drawingregion",DRAWINGCANVAS:".drawingcanvas",DRAWINGTOOLBAR:"drawingtoolbar",SAVE:".savebutton",ANNOTATIONCOLOURBUTTON:".annotationcolourbutton",DELETEANNOTATIONBUTTON:".deleteannotationbutton",WARNINGMESSAGECONTAINER:".warningmessages",ICONMESSAGECONTAINER:".infoicon",UNSAVEDCHANGESDIV:".assignfeedback_editpdf_warningmessages",UNSAVEDCHANGESINPUT:'input[name="assignfeedback_editpdfplus_haschanges"]',UNSAVEDCHANGESDIVEDIT:".assignfeedback_editpdfplus_unsavedchanges_edit",HELPMESSAGETITLE:"#afppHelpmessageTitle",HELPMESSAGE:"#afppHelpmessageBody",USERINFOREGION:'[data-region="user-info"]',ROTATELEFTBUTTON:".rotateleftbutton",ROTATERIGHTBUTTON:".rotaterightbutton",DIALOGUE:"."+i.DIALOGUE,CUSTOMTOOLBARID:"#toolbaraxis",CUSTOMTOOLBARS:".customtoolbar",AXISCUSTOMTOOLBAR:".menuaxisselection",CUSTOMTOOLBARBUTTONS:".costumtoolbarbutton",GENERICTOOLBARBUTTONS:".generictoolbarbutton",HELPBTNCLASS:".helpmessage",STATUTSELECTOR:"#menustatutselection",QUESTIONSELECTOR:"#menuquestionselection",STUDENTVALIDATION:"#student_valide_button"},o="rgba(200, 200, 255, 0.9)",u="rgba(200, 200, 255, 0.5)",a={white:"rgb(255,255,255)",yellowlemon:"rgb(255,255,0)",yellow:"rgb(255,207,53)",red:"rgb(239,69,64)",green:"rgb(152,202,62)",blue:"rgb(0,0,255)",black:"rgb(51,51,51)"},f=300,l={select:".selectbutton",drag:".dragbutton",resize:".resizebutton"},c={HIGHLIGHTPLUS:1,LINEPLUS:2,STAMPPLUS:3,FRAME:4,VERTICALLINE:5,STAMPCOMMENT:6,COMMENTPLUS:7,PEN:8,LINE:9,RECTANGLE:10,OVAL:11,HIGHLIGHT:12},h={HIGHLIGHTPLUS:"highlightplus",LINEPLUS:"lineplus",STAMPPLUS:"stampplus",FRAME:"frame",VERTICALLINE:"verticalline",STAMPCOMMENT:"stampcomment",COMMENTPLUS:"commentplus",PEN:"pen",LINE:"line",RECTANGLE:"rectangle",OVAL:"oval",HIGHLIGHT:"highlight"},p=2,d=function(e,t){this.x=parseInt(e,10),this.y=parseInt(t,10),this.clip=function(e){return this.x<e.x&&(this.x=e.x),this.x>e.x+e.width&&(this.x=e.x+e.width),this.y<e.y&&(this.y=e.y),this.y>e.y+e.height&&(this.y=e.y+e.height),this}};M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.point=d;var v=function(e,t,n,r){this.x=e,this.y=t,this.width=n,this.height=r,this.bound=function(e){var t=0,n=0,r=0,i=0,s=0,o;for(s=0;s<e.length;s++){o=e[s];if(o.x<t||s===0)t=o.x;if(o.x>n||s===0)n=o.x;if(o.y<r||s===0)r=o.y;if(o.y>i||s===0)i=o.y}return this.x=t,this.y=r,this.width=n-t,this.height=i-r,this},this.has_min_width=function(){return this.width>=5},this.has_min_height=function(){return this.height>=5},this.set_min_width=function(){this.width=5},this.set_min_height=function(){this.height=5}};M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.rect=v;var m=function(){this.start=!1,this.end=!1,this.starttime=0,this.annotationstart=!1,this.tool="drag",this.commentcolour="yellow",this.annotationcolour="red",this.path=[]};M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.edit=m;var g=function(e){this.editor=e,this.shapes=[],this.nodes=[],this.erase=function(){if(this.shapes)while(this.shapes.length>0)this.editor.graphic.removeShape(this.shapes.pop());if(this.nodes)while(this.nodes.length>0)this.nodes.pop().remove()},this.scroll_update=function(e,t){var n,r,i;for(n=0;n<this.nodes.length;n++)r=this.nodes[n].getData("x"),i=this.nodes[n].getData("y"),r!==undefined&&i!==undefined&&(this.nodes[n].setX(parseInt(r,10)-e),this.nodes[n].setY(parseInt(i,10)-t))},this.store_position=function(e,t,n){var r,i,o;r=this.editor.get_dialogue_element(s.DRAWINGREGION),i=parseInt(r.get("scrollLeft"),10),o=parseInt(r.get("scrollTop"),10),e.setData("x",t+i),e.setData("y",n+o)}};M.assignfeedback_editpdfplus=M.assignfeedback_editpdfplus||{},M.assignfeedback_editpdfplus.drawable=g;var y=function(e){y.superclass.constructor.apply(this,[e])};y.NAME="annotation",y.ATTRS={},e.extend(y,e.Base,{editor:null,gradeid:0,pageno:0,x:0,y:0,endx:0,endy:0,path:"",toolid:0,colour:"red",drawable:!1,resizeAreas:[],tooltype:null,tooltypefamille:null,divcartridge:"",textannot:"",displaylock:1,displayrotation:0,borderstyle:"",parent_annot:0,parent_annot_element:null,id:0,shape_id:"",cartridgex:0,cartridgey:0,answerrequested:0,studentstatus:0,studentanswer:"",pdfdisplay:"footnote",minresizewidth:20,initializer:function(e){e.parent_annot_element?(this.editor=e.parent_annot_element.editor||null,this.gradeid=parseInt(e.parent_annot_element.gradeid,10)||0,this.pageno=parseInt(e.parent_annot_element.pageno,10)||0,this.cartridgex=parseInt(e.parent_annot_element.cartridgex,10)||0,this.cartridgey=parseInt(e.parent_annot_element.cartridgey,10)||0,this.colour=e.parent_annot_element.colour||"red",this.tooltype=e.tooltype,this.textannot=e.parent_annot_element.textannot,this.displaylock=parseInt(e.parent_annot_element.displaylock,10),this.displayrotation=e.parent_annot_element.displayrotation,this.borderstyle=e.parent_annot_element.borderstyle||"solid",this.parent_annot=parseInt(e.parent_annot_element.id,10),this.answerrequested=parseInt(e.parent_annot_element.answerrequested,10)||0,this.studentstatus=parseInt(e.parent_annot_element.studentstatus,10)||0,this.parent_annot_element=e.parent_annot_element):(this.editor=e.editor||null,this.gradeid=parseInt(e.gradeid,10)||0,this.pageno=parseInt(e.pageno,10)||0,this.cartridgex=parseInt(e.cartridgex,10)||0,this.cartridgey=parseInt(e.cartridgey,10)||0,this.colour=e.colour||"red",this.tooltype=e.tooltype,this.textannot=e.textannot,this.displaylock=parseInt(e.displaylock,10),this.displayrotation=e.displayrotation,this.borderstyle= YUI.add("moodle-assignfeedback_editpdfplus-editor",function(e,t){var n=M.cfg.wwwroot+"/mod/assign/feedback/editpdfplus/ajax.php",r=M.cfg.wwwroot+"/mod/assign/feedback/editpdfplus/ajax_progress.php",i={DIALOGUE:"assignfeedback_editpdfplus_widget"},s={PREVIOUSBUTTON:".navigate-previous-button",NEXTBUTTON:" .navigate-next-button",PAGESELECT:".navigate-page-select",LOADINGICON:".loading",PROGRESSBARCONTAINER:".progress-info.progress-striped",DRAWINGREGION:".drawingregion",DRAWINGREGIONCLASS:"drawingregion",DRAWINGCANVAS:".drawingcanvas",DRAWINGTOOLBAR:"drawingtoolbar",SAVE:".savebutton",ANNOTATIONCOLOURBUTTON:".annotationcolourbutton",DELETEANNOTATIONBUTTON:".deleteannotationbutton",WARNINGMESSAGECONTAINER:".warningmessages",ICONMESSAGECONTAINER:".infoicon",UNSAVEDCHANGESDIV:".assignfeedback_editpdf_warningmessages",UNSAVEDCHANGESINPUT:'input[name="assignfeedback_editpdfplus_haschanges"]',UNSAVEDCHANGESDIVEDIT:".assignfe