Gitlab CSE Unil

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

masque dynamique des champs non cernés par le type d'outil choisi

parent 10db78d5
This diff is collapsed.
......@@ -154,6 +154,65 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
}
}
};
var initToolDisplay = function () {
var typetool = parseInt($("#typetool").val());
var typetoolEntity = getTypeTool(typetool);
var confCartridge = false;
var confCartridgeColor = false;
if (typetoolEntity.configurable_cartridge && parseInt(typetoolEntity.configurable_cartridge) === 0) {
$("#libelle").hide();
$("label[for='libelle']").hide();
confCartridge = true;
} else {
$("#libelle").show();
$("label[for='libelle']").show();
}
if (typetoolEntity.configurable_cartridge_color && parseInt(typetoolEntity.configurable_cartridge_color) === 0) {
$("#cartridgecolor").hide();
$("label[for='cartridgecolor']").hide();
confCartridgeColor = true;
} else {
$("#cartridgecolor").show();
$("label[for='cartridgecolor']").show();
}
if (confCartridge && confCartridgeColor) {
$("#collapse3").parent().hide();
} else {
$("#collapse3").parent().show();
}
var confAnnotColor = false,
confAnnotTexts = false,
confAnnotReply = false;
if (typetoolEntity.configurable_color && parseInt(typetoolEntity.configurable_color) === 0) {
$("#color").hide();
$("label[for='color']").hide();
confAnnotColor = true;
} else {
$("#color").show();
$("label[for='color']").show();
}
if (typetoolEntity.configurable_texts && parseInt(typetoolEntity.configurable_texts) === 0) {
$(".textform").hide();
$("label[for='texts']").hide();
confAnnotTexts = true;
} else {
$(".textform").show();
$("label[for='texts']").show();
}
if (typetoolEntity.configurable_question && parseInt(typetoolEntity.configurable_question) === 0) {
$("#reply").hide();
$("label[for='reply']").hide();
confAnnotReply = true;
} else {
$("#reply").show();
$("label[for='reply']").show();
}
if (confAnnotColor && confAnnotReply && confAnnotTexts) {
$("#collapse4").parent().hide();
} else {
$("#collapse4").parent().show();
}
};
//
var initCanevas = function () {
$('#canevas').html("");
......@@ -490,6 +549,8 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
});
//maj affichage previsu
initCanevas();
//maj tool worspkace
initToolDisplay();
}.bind(this)).fail(notification.exception);
//templates.appendNodeContents('#editpdlplus_tool_item', html, js).done(function () {
//alert("jdikdi");
......
......@@ -46,7 +46,7 @@ class backup_assignfeedback_editpdfplus_subplugin extends backup_subplugin {
$subpluginelementfiles = new backup_nested_element('feedback_editpdfplus_files', null, array('gradeid'));
$subpluginelementannotations = new backup_nested_element('feedback_editpdfplus_annotations');
$subpluginelementannotation = new backup_nested_element('feedback_editpdfplus_annotation', null, array('gradeid', 'pageno', 'type', 'x', 'y', 'endx', 'endy', 'colour', 'path', 'draft'));
// Connect XML elements into the tree.
$subplugin->add_child($subpluginwrapper);
$subpluginelementannotations->add_child($subpluginelementannotation);
......@@ -64,5 +64,5 @@ class backup_assignfeedback_editpdfplus_subplugin extends backup_subplugin {
$subpluginelementfiles->annotate_files('assignfeedback_editpdfplus', 'stamps', 'gradeid');
return $subplugin;
}
}
......@@ -51,7 +51,7 @@ class restore_assignfeedback_editpdfplus_subplugin extends restore_subplugin {
// Now we have the list of comments and annotations per grade.
$elename = $this->get_namefor('feedback_editpdfplus_annotation');
$elepath = $this->get_pathfor('/feedback_editpdfplus_annotations/feedback_editpdfplus_annotation');
$elepath = $this->get_pathfor('/feedback_editpdfplus_annotations/feedback_editpdfplus_annotation');
$paths[] = new restore_path_element($elename, $elepath);
return $paths;
......@@ -64,11 +64,11 @@ class restore_assignfeedback_editpdfplus_subplugin extends restore_subplugin {
public function process_assignfeedback_editpdfplus_files($data) {
$data = (object)$data;
// In this case the id is the old gradeid which will be mapped.
$this->add_related_files('assignfeedback_editpdfplus',
\assignfeedback_editpdfplus\document_services::FINAL_PDF_FILEAREA, 'grade', null, $data->gradeid);
$this->add_related_files('assignfeedback_editpdfplus',
\assignfeedback_editpdfplus\document_services::PAGE_IMAGE_READONLY_FILEAREA, 'grade', null, $data->gradeid);
// In this case the id is the old gradeid which will be mapped.
$this->add_related_files('assignfeedback_editpdfplus',
\assignfeedback_editpdfplus\document_services::FINAL_PDF_FILEAREA, 'grade', null, $data->gradeid);
$this->add_related_files('assignfeedback_editpdfplus',
\assignfeedback_editpdfplus\document_services::PAGE_IMAGE_READONLY_FILEAREA, 'grade', null, $data->gradeid);
$this->add_related_files('assignfeedback_editpdfplus', 'stamps', 'grade', null, $data->gradeid);
}
......@@ -79,13 +79,13 @@ class restore_assignfeedback_editpdfplus_subplugin extends restore_subplugin {
public function process_assignfeedback_editpdfplus_feedback_editpdfplus_annotation($data) {
global $DB;
$data = (object)$data;
$oldgradeid = $data->gradeid;
// The mapping is set in the restore for the core assign activity
// when a grade node is processed.
$data->gradeid = $this->get_mappingid('grade', $data->gradeid);
$data = (object)$data;
$oldgradeid = $data->gradeid;
// The mapping is set in the restore for the core assign activity
// when a grade node is processed.
$data->gradeid = $this->get_mappingid('grade', $data->gradeid);
$DB->insert_record('assignfeedback_editpp_annot', $data);
$DB->insert_record('assignfeedback_editpp_annot', $data);
}
......
......@@ -56,6 +56,21 @@ class type_tool {
/** @var type */
public $configurable = 1;
/** @var type */
public $configurable_cartridge = 1;
/** @var type */
public $configurable_cartridge_color = 1;
/** @var type */
public $configurable_color = 1;
/** @var type */
public $configurable_texts = 1;
/** @var type */
public $configurable_question = 1;
/**
* Convert a compatible stdClass into an instance of this class.
* @param stdClass $record
......
......@@ -26,27 +26,6 @@
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
/*'mod/assignfeedback_editpdfplus:use' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
)
),*/
/*'mod/assignfeedback_editpdfplus:notify' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW
)
),*/
/*'mod/assignfeedback_editpdfplus:managetools' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW
)
),*/
'assignfeedback/editpdfplus:use' => array(
'captype' => 'write',
'contextlevel' => CONTEXT_MODULE,
......
......@@ -108,7 +108,7 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) {
// Editpdf savepoint reached.
upgrade_plugin_savepoint(true, 2017071202, 'assignfeedback', 'editpdfplus');
}
if ($oldversion < 2017081306) {
$sql = "UPDATE {assignfeedback_editpp_typet}
SET color = :htmlcolor
......@@ -150,6 +150,67 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) {
];
// Execute DB update for assign instances.
$DB->execute($sql, $params);
// Editpdf savepoint reached.
upgrade_plugin_savepoint(true, 2017081306, 'assignfeedback', 'editpdfplus');
}
if ($oldversion < 2017081601) {
$table = new xmldb_table('assignfeedback_editpp_typet');
$field = new xmldb_field('configurable_cartridge', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 1);
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('configurable_cartridge_color', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 1);
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('configurable_color', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 1);
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('configurable_texts', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 1);
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('configurable_question', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, 1);
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$sql = "UPDATE {assignfeedback_editpp_typet}
SET configurable_cartridge = 0,
configurable_cartridge_color = 0,
configurable_texts = 0,
configurable_question = 0
WHERE id = 3";
// Update query params.
$params = [];
// Execute DB update for assign instances.
$DB->execute($sql, $params);
$sql = "UPDATE {assignfeedback_editpp_typet}
SET configurable_cartridge_color = 0,
configurable_color = 0
WHERE id = 4";
// Execute DB update for assign instances.
$DB->execute($sql, []);
$sql = "UPDATE {assignfeedback_editpp_typet}
SET configurable_color = 0,
configurable_texts = 0
WHERE id = 7";
// Execute DB update for assign instances.
$DB->execute($sql, []);
$sql = "UPDATE {assignfeedback_editpp_typet}
SET configurable_color = 0
WHERE id = 6";
// Execute DB update for assign instances.
$DB->execute($sql, []);
// Editpdf savepoint reached.
upgrade_plugin_savepoint(true, 2017081601, 'assignfeedback', 'editpdfplus');
}
return true;
......
......@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2017081306;
$plugin->version = 2017081601;
$plugin->requires = 2017050500; // Requires this Moodle version.
$plugin->dependencies = array(
'assignfeedback_editpdf' => 2017050500
......
Markdown is supported
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