Gitlab CSE Unil

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

modification de l'axe d'un tool ok

parent ca855e96
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.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-default",c="";1!==this.enabled&&(b="",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});
\ No newline at end of file
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-default",c="";1!==this.enabled&&(b="",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});
\ No newline at end of file
......@@ -225,6 +225,7 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
* Init tool form and preview
*/
AdminPanel.prototype.refreshPrevisu = function () {
currentTool.axis = $("#toolaxis").val();
currentTool.typetool = $("#typetool").val();
currentTool.colors = $("#color").val();
currentTool.cartridge = $("#libelle").val();
......@@ -559,6 +560,7 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
.done(function () {
currentTool = new Tool();
currentTool.id = selectid;
currentTool.axis = $("#toolaxis").val();
currentTool.typetool = $("#typetool").val();
var typetoolEntity = getTypeTool(currentTool.typetool);
currentTool.type = typetoolEntity;
......@@ -618,6 +620,7 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
$("#message_edit_tool").removeClass("alert-danger");
$("#message_edit_tool").removeClass("alert-warning");
//mise à jour bar d'outils
$("#editpdlplus_tool_" + toolbar[0].selecttool).remove();
$("#editpdlplus_toolbar_" + toolbar[0].axeid).html("");
for (var i = 0; i < toolbar.length; i++) {
var toolTmp = new Tool();
......@@ -626,6 +629,11 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
$("#editpdlplus_toolbar_" + toolbar[0].axeid).append(buttonTmp);
}
$(".editpdlplus_tool").on("click", refreshToolView);
var oldaxeid = $("#axisid").val();
if (oldaxeid !== toolbar[0].axeid) {
$("#editpdlplus_axes").val(toolbar[0].axeid);
$("#editpdlplus_axes").change();
}
$("#editpdlplus_tool_" + toolbar[0].selecttool).click();
} else {
$("#message_edit_tool").show();
......@@ -723,6 +731,7 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
.done(function () {
$("#canevas").hide();
if (action === "clone") {
$("#toolaxis").val(currentTool.axis);
$("#typetool").val(currentTool.typetool);
$("#color").val(currentTool.colors);
$("#libelle").val(currentTool.cartridge);
......@@ -738,6 +747,7 @@ define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
currentTool = new Tool();
$("#typetool").on("change", function () {
currentTool = new Tool();
currentTool.axis = $("#toolaxis").val();
currentTool.typetool = $("#typetool").val();
var typetoolEntity = getTypeTool(currentTool.typetool);
currentTool.type = typetoolEntity;
......
......@@ -166,6 +166,7 @@ define(['./global'],
*/
Tool.prototype.initAdmin = function (config) {
this.id = parseInt(config.toolid, 10) || 0;
this.axis = parseInt(config.axis, 10) || 0;
this.typetool = config.typetool;
this.label = config.button;
this.enabled = config.enable;
......
......@@ -72,10 +72,10 @@ class admin_editor {
public static function add_tool($data, $contextid) {
global $DB;
$maxindice = admin_editor::reorder_tool($data->axisid);
$maxindice = admin_editor::reorder_tool($data->toolaxis);
$tool = new tool();
$tool->axis = $data->axisid;
$tool->axis = $data->toolaxis;
$tool->cartridge = $data->libelle;
$tool->cartridge_color = $data->catridgecolor;
$tool->contextid = $contextid;
......@@ -225,6 +225,7 @@ class admin_editor {
$record = $DB->get_record('assignfeedback_editpp_tool', array('id' => $toolJson->toolid), '*', MUST_EXIST);
$tool = new tool($record);
$tool->axis = $toolJson->toolaxis;
$tool->type = $toolJson->typetool;
$tool->colors = $toolJson->color;
$tool->cartridge = $toolJson->libelle;
......
......@@ -129,6 +129,7 @@ $string['admintoolboxtypetool_type'] = 'Type';
$string['admintoolboxtoolbardisplay'] = 'Toolbar display';
$string['admintoolboxtoolbardisplay_button'] = 'Button';
$string['admintoolboxtoolbardisplay_order'] = 'Order';
$string['admintoolboxtoolbardisplay_axis'] = 'Axis';
$string['admintoolboxcartridge'] = 'Cartridge';
$string['admintoolboxcartridge_label'] = 'Label';
$string['admintoolboxcartridge_color'] = 'Color';
......
......@@ -129,6 +129,7 @@ $string['admintoolboxtypetool_type'] = 'Type';
$string['admintoolboxtoolbardisplay'] = 'Affichage barre d\'outil';
$string['admintoolboxtoolbardisplay_button'] = 'Bouton';
$string['admintoolboxtoolbardisplay_order'] = 'Ordre';
$string['admintoolboxtoolbardisplay_axis'] = 'Axe';
$string['admintoolboxcartridge'] = 'Cartouche';
$string['admintoolboxcartridge_label'] = 'Libellé';
$string['admintoolboxcartridge_color'] = 'Couleur';
......
......@@ -188,6 +188,8 @@ class assign_feedback_editpdfplus_admin {
foreach ($data->tools as $toolRef) {
$toolRef->libelle = get_string('typetool_' . $toolRef->label, 'assignfeedback_editpdfplus');
}
$axis = page_editor::get_axis(array($this->context->id));
$data->axis = $axis;
$renderer = $PAGE->get_renderer('assignfeedback_editpdfplus');
$html .= $renderer->render_assignfeedback_editpdfplus_widget_admin_toolform($data);
return $html;
......
......@@ -93,6 +93,18 @@
<div id="collapse2" class="panel-collapse collapse">
<div class="panel-body">
<table>
<tr>
<td style="width: 25%;">
<label class="control-label" for="toolaxis">{{# str }} admintoolboxtoolbardisplay_axis, assignfeedback_editpdfplus {{/ str }}</label>
</td>
<td>
<select class="form-control" id="toolaxis" name="toolaxis">
{{# axis }}
<option value='{{id}}'>{{label}}</option>
{{/ axis }}
</select>
</td>
</tr>
<tr>
<td style="width: 25%;">
<label class="control-label" for="button">
......@@ -196,7 +208,7 @@
<div style='display:none;'>
<input type="hidden" name="toolid" value="{{tool.id}}" />
<input type="hidden" name="axisid" value="{{tool.axis}}" />
<input type="hidden" name="axisid" id="axisid" value="{{tool.axis}}" />
<input type="hidden" name="courseid" value="{{courseid}}" />
<input type="hidden" name="sesskey" value="{{sesskey}}" />
<input type="hidden" name="enabled" id="toolenabled" value="{{tool.enabled}}" />
......@@ -219,6 +231,7 @@
require(['jquery','core/ajax','core/notification'], function($,ajax,notification) {
{{#tool.id}}$("#typetool").val({{tool.type}});{{/tool.id}}
{{#tool.id}}$("#toolaxis").val({{tool.axis}});{{/tool.id}}
var $collectionHolder;
......
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