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");
......
......@@ -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,
......
......@@ -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
......
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