Gitlab CSE Unil

Commit 84afbb80 authored by M. Chardon's avatar M. Chardon
Browse files

documentation et améliration visu si liste des axes vide

parent d4f303fd
This diff is collapsed.
......@@ -20,15 +20,15 @@
/**
* @module mod_assignfeedback_editpdfplus/admin_panel
*/
define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/fragment',
define(['jquery', 'core/notification', 'core/templates', 'core/fragment',
'core/ajax', 'core/str', 'assignfeedback_editpdfplus/tool', 'assignfeedback_editpdfplus/tooltype',
'assignfeedback_editpdfplus/annotationhighlightplus',
'assignfeedback_editpdfplus/annotationstampplus', 'assignfeedback_editpdfplus/annotationframe',
'assignfeedback_editpdfplus/annotationcommentplus', 'assignfeedback_editpdfplus/annotationverticalline',
'assignfeedback_editpdfplus/annotationstampcomment'],
function ($/*, Y*/, notification, templates, fragment, ajax, str, Tool, ToolType,
function ($, notification, templates, fragment, ajax, str, Tool, ToolType,
AnnotationHighlightplus, AnnotationStampplus, AnnotationFrame,
AnnotationCommentplus, AnnotationVerticalline, AnnotationStampcomment /*, checker*/) {
AnnotationCommentplus, AnnotationVerticalline, AnnotationStampcomment) {
var contextid = null;
var currentTool = null;
......@@ -71,17 +71,22 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
$("#editpdlplus_axes").on("change", function () {
$(".toolbar").hide();
var selectAxis = $("#editpdlplus_axes").val();
$("#editpdlplus_toolbar_" + selectAxis).show();
var canBeDelete = $("#editpdlplus_axes option:selected").data('delete');
if (canBeDelete) {
if (parseInt(canBeDelete) > 0) {
$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").addClass("disabled");
if (selectAxis && selectAxis !== "") {
$("#editpdlplus_toolbar_" + selectAxis).show();
var canBeDelete = $("#editpdlplus_axes option:selected").data('delete');
if (canBeDelete) {
if (parseInt(canBeDelete) > 0) {
$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").addClass("disabled");
} else {
$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled");
}
} else {
$("#editpdlplus_axes option[value='" + selectAxis + "']").data('delete', 0);
$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled");
}
} else {
$("#editpdlplus_axes option[value='" + selectAxis + "']").data('delete', 0);
$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled");
$("#assignfeedback_editpdfplus_widget_admin_workspace").hide();
$("#assignfeedback_editpdfplus_widget_admin_toolheader").hide();
}
$('#toolworkspace').html("");
});
......@@ -268,8 +273,14 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
};
//
AdminPanel.prototype.openDivAddAxis = function () {
$("#message_edit_tool").hide();
$("#axistool").hide();
var selectAxis = $("#editpdlplus_axes").val();
if (selectAxis && selectAxis !== "") {
$("#message_edit_tool").hide();
$("#axistool").hide();
} else {
$("#assignfeedback_editpdfplus_widget_admin_workspace").show();
$("#editpdlplus_axes_worspace").hide();
}
$('#assignfeedback_editpdfplus_widget_admin_div_addaxis').show();
$('#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body').html("");
$('#assignfeedback_editpdfplus_widget_admin_toolheader').hide();
......@@ -401,6 +412,10 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
//maj visu
$("#editpdlplus_axes").change();
$("a[href^='#collapseadmin1'").click();
$("#axistool").show();
$('#assignfeedback_editpdfplus_widget_admin_toolheader').show();
$('#assignfeedback_editpdfplus_widget_admin_workspace').show();
$('#assignfeedback_editpdfplus_widget_admin_toolworkspace').show();
} else {
$("#message_import_axis").show();
$("#message_import_axis").html(toolbar[0].message);
......
......@@ -111,6 +111,11 @@ $string['admintitle'] = 'Feedback configuration';
$string['adminsubtitle'] = 'Configuration of tools bar for advanded PDF annotation';
$string['admincurrenttoolbar'] = 'Current toolbar';
$string['adminaxis'] = 'Axis';
$string['adminaxisimporttitle'] = 'Axis imporation';
$string['adminaxisimport'] = 'Avaibled axis to import';
$string['adminaxisimport_name'] = 'Name';
$string['adminaxisimport_tool'] = 'Tools';
$string['adminaxisimport_action'] = 'Import';
$string['admintools'] = 'Tools';
$string['adminaddtool'] = 'Add a new tool';
$string['admintoolboxaction'] = 'Action';
......
......@@ -111,6 +111,11 @@ $string['admintitle'] = 'Feedback configuration';
$string['adminsubtitle'] = 'Configuration de la barre d\'outils de l\'annotation PDF avancée';
$string['admincurrenttoolbar'] = 'Barre d\'outils en cours';
$string['adminaxis'] = 'Axes';
$string['adminaxisimporttitle'] = 'Importation axe';
$string['adminaxisimport'] = 'Axes disponibles à l\'importation';
$string['adminaxisimport_name'] = 'Nom';
$string['adminaxisimport_tool'] = 'Outils';
$string['adminaxisimport_action'] = 'Importer';
$string['admintools'] = 'Outils';
$string['adminaddtool'] = 'Ajout d\'un nouvel outil';
$string['admintoolboxaction'] = 'Action';
......
......@@ -49,32 +49,13 @@ class assign_feedback_editpdfplus_admin {
public function view() {
global $PAGE;
//$PAGE->requires->js_call_amd('assignfeedback_editpdfplus/admin_panel', 'init');
$html = '';
//$toform = null;
$renderer = $PAGE->get_renderer('assignfeedback_editpdfplus');
/* $formAddAxis = new axis_form(new moodle_url('/mod/assign/feedback/editpdfplus/view_admin.php?id=' . $this->course->id, array('id' => $this->course->id))); //Form processing and displaying is done here
if ($formAddAxis->is_cancelled()) {
//Handle form cancel operation, if cancel button is present on form
} else if ($fromform = $formAddAxis->get_data()) {
//In this case you process validated data. $mform->get_data() returns data posted in form.
$label = $fromform->label;
$axe = $this->addAxis($label);
$formAddAxis->set_data($toform);
return $axe; //"<option>tutu</option>";
} else {
// this branch is executed if the form is submitted but the data doesn't validate and the form should be redisplayed
// or on the first display of the form.
//Set default data (if any)
$formAddAxis->set_data($toform);
} */
$axisimportform = new axis_import_form(null, array('id' => $this->course->id), null, null, array('id' => "assignfeedback_editpdfplus_import_axis"));
$axisimportform->id = "assignfeedback_editpdfplus_import_axis";
$axisimportform->title = "";
$axisimportform->action = "import";
$widget = $this->get_widget();
//$widget->axisaddform = $formAddAxis;
$widget->axisimportform = $axisimportform;
$widget->courseid = $this->course->id;
$html .= $renderer->render_assignfeedback_editpdfplus_widget_admin($widget);
......@@ -183,7 +164,6 @@ class assign_feedback_editpdfplus_admin {
$toolRef->libelle = get_string('typetool_' . $toolRef->label, 'assignfeedback_editpdfplus');
}
$renderer = $PAGE->get_renderer('assignfeedback_editpdfplus');
//$formTool->courseid = $this->course->id;
$html .= $renderer->render_assignfeedback_editpdfplus_widget_admin_toolform($data);
return $html;
}
......@@ -230,7 +210,6 @@ class assign_feedback_editpdfplus_admin {
$toolbar = new stdClass();
$toolbar->axis = $ax;
$toolbar->tools = array();
//$toolbars[$ax->id]['label'] = $ax->label;
foreach ($tools as $tool) {
if ($tool->axis == $ax->id) {
if ($tool->enabled == "1") {
......
......@@ -353,7 +353,7 @@ ul.assignfeedback_editpdfplus_menu {
background-color: #fffeeb;
padding: 0;
line-height: normal;
display:inline-block;
display: inline-block;
}
.assignfeedback_editpdfplus_highlightplus_cartridge,
.assignfeedback_editpdfplus_frame_cartridge,
......@@ -478,4 +478,24 @@ ul.assignfeedback_editpdfplus_menu {
}
.assignfeedback_editpdfplus_widget_admin .panel-heading > a {
color: black;
}
.assignfeedback_editpdfplus_widget_admin table {
width: 100%;
}
.assignfeedback_editpdfplus_widget_admin_col1 {
width: 17%;
vertical-align: top;
}
.assignfeedback_editpdfplus_widget_admin_col2 {
padding-left: 20px;
vertical-align: top;
}
#message_edit_tool {
margin-top: 10px;
margin-bottom: 0;
display: none;
width: 50%;
}
#editpdlplus_tool_item {
margin-top: 15px;
}
\ No newline at end of file
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template assignfeedback_editpdfplus/admin
Admin template for manage axis.
Context variables required for this template:
* courseid - Course id
* context - Context id
* axisimportform - Moodle form to import an axis
* toolbars - All toolbars for the current course
* axis - All axis for the current coure
* toollibs - All avaibled type's tool
* toolbarsDispo - All toolbars which can be import by the current user
}}
<div class="assignfeedback_editpdfplus_widget_admin">
<h5>{{# str }} adminsubtitle, assignfeedback_editpdfplus {{/ str }}</h5>
<!--div class="panel-group" id="adminAccordion"-->
<div class="panel panel-default">
<div class="panel-heading">
<a data-toggle="collapse" href="#collapseadmin1" >Importation axe</a>
<a data-toggle="collapse" href="#collapseadmin1" >{{# str }} adminaxisimporttitle, assignfeedback_editpdfplus {{/ str }}</a>
</div>
<div id="collapseadmin1" class="panel-collapse collapse">
<div class="panel-body">
Axes disponibles à l'importation
{{# str }} adminaxisimport, assignfeedback_editpdfplus {{/ str }}
{{{ axisimportform.render }}}
<input type="hidden" id="courseid" value="{{courseid}}" />
<table class='table table-bordered table-striped'>
<thead>
<tr>
<!--th>Cours / activité</th-->
<th>Nom</th>
<th>Outils</th>
<th>Importer</th>
<th>{{# str }} adminaxisimport_name, assignfeedback_editpdfplus {{/ str }}</th>
<th>{{# str }} adminaxisimport_tool, assignfeedback_editpdfplus {{/ str }}</th>
<th>{{# str }} adminaxisimport_action, assignfeedback_editpdfplus {{/ str }}</th>
</tr>
</thead>
<tbody>
{{# toolbarsDispo }}
<tr>
<!--td></td-->
<td>{{axis.label}}</td>
<td>
<div class="btn-group">
......@@ -53,9 +77,9 @@
</div>
<div class="panel-body">
<div id="message_import_axis" class="alert" style="display:none;"></div>
<table style="width: 100%">
<table>
<tr>
<td style="width: 17%">
<td class='assignfeedback_editpdfplus_widget_admin_col1'>
<h6>
{{# str }} adminaxis, assignfeedback_editpdfplus {{/ str }}
<button type="button" class="btn btn-default" id="assignfeedback_editpdfplus_widget_admin_button_addaxis">
......@@ -63,7 +87,7 @@
</button>
</h6>
</td>
<td id='assignfeedback_editpdfplus_widget_admin_toolheader' style="padding-left: 20px;">
<td id='assignfeedback_editpdfplus_widget_admin_toolheader' class='assignfeedback_editpdfplus_widget_admin_col2'>
<h6>
{{# str }} admintools, assignfeedback_editpdfplus {{/ str }}
<button type="button" class="btn btn-default" id="assignfeedback_editpdfplus_widget_admin_button_addtool">
......@@ -71,27 +95,10 @@
</button>
</h6>
</td>
<td></td>
</tr>
<!--div class='row'>
<div class='col-sm-2'>
<h6>
{{# str }} adminaxis, assignfeedback_editpdfplus {{/ str }}
<button type="button" class="btn btn-default" id="assignfeedback_editpdfplus_widget_admin_button_addaxis">
<i class="fa fa-plus" aria-hidden="true"></i>
</button>
</h6>
</div>
<div class='col-sm-10' id='assignfeedback_editpdfplus_widget_admin_toolheader'>
<h6>
{{# str }} admintools, assignfeedback_editpdfplus {{/ str }}
<button type="button" class="btn btn-default" id="assignfeedback_editpdfplus_widget_admin_button_addtool">
<i class="fa fa-plus" aria-hidden="true"></i>
</button>
</h6>
</div>
</div-->
<tr id='assignfeedback_editpdfplus_widget_admin_workspace'>
<td style="vertical-align: top;">
<td id='editpdlplus_axes_worspace' class='assignfeedback_editpdfplus_widget_admin_col1'>
<select id='editpdlplus_axes' class='form-control'>
{{# axis }}
<option value="{{id}}" data-delete="{{children}}">{{label}}</option>
......@@ -108,7 +115,7 @@
</div>
</div>
</td>
<td id='assignfeedback_editpdfplus_widget_admin_toolworkspace' style="padding-left: 20px;vertical-align: top;">
<td id='assignfeedback_editpdfplus_widget_admin_toolworkspace' class='assignfeedback_editpdfplus_widget_admin_col2'>
<div id='editpdlplus_toolbars'>
{{# toolbars }}
<div id="editpdlplus_toolbar_{{axis.id}}" class="btn-group toolbar" style="display: none;">
......@@ -121,9 +128,9 @@
{{/ toolbars }}
</div>
<div class="alert" id="message_edit_tool" style="margin-top: 10px;margin-bottom: 0px;display: none;width: 50%;"></div>
<div class="alert" id="message_edit_tool"></div>
<div id="editpdlplus_tool_item" style="margin-top: 15px;"></div>
<div id="editpdlplus_tool_item"></div>
</td>
<td>
<div id="assignfeedback_editpdfplus_widget_admin_div_addaxis" style="display:none;">
......@@ -137,58 +144,9 @@
</div>
</td>
</tr>
<!--div class='row' id='assignfeedback_editpdfplus_widget_admin_workspace'>
<div class='col-sm-2'>
<select id='editpdlplus_axes' class='form-control'>
{{# axis }}
<option value="{{id}}" data-delete="{{children}}">{{label}}</option>
{{/ axis }}
</select>
<div class="panel panel-default" id="axistool">
<div class="panel-body" style="text-align: center;">
<button type="button" class="btn btn-default" id="assignfeedback_editpdfplus_widget_admin_button_editaxis">
<i class="fa fa-pencil" aria-hidden="true"></i>
</button>
<button type="button" class="btn btn-default" id="assignfeedback_editpdfplus_widget_admin_button_delaxis">
<i class="fa fa-remove" aria-hidden="true"></i>
</button>
</div>
</div>
</div>
<div class='col-sm-10' id='assignfeedback_editpdfplus_widget_admin_toolworkspace'>
<div id='editpdlplus_toolbars'>
{{# toolbars }}
<div id="editpdlplus_toolbar_{{axis.id}}" class="btn-group toolbar" style="display: none;">
{{# tools }}
<button class="btn {{button}} editpdlplus_tool" id="editpdlplus_tool_{{id}}" value="{{id}}" style="{{style}}" data-enable="{{enabled}}">
{{label}}
</button>
{{/ tools }}
</div>
{{/ toolbars }}
</div>
<div class="alert col-sm-5" id="message_edit_tool" style="margin-top: 10px;margin-bottom: 0px;display: none;"></div>
<div id="editpdlplus_tool_item" class="alert col-sm-12" style="margin-top: 0px;"></div>
</div>
<div class='col-sm-10'>
<div id="assignfeedback_editpdfplus_widget_admin_div_addaxis" style="display:none;">
<div class="panel-body"></div>
</div>
<div id="assignfeedback_editpdfplus_widget_admin_div_editaxis" style="display:none;">
<div class="panel-body"></div>
</div>
<div id="assignfeedback_editpdfplus_widget_admin_div_delaxis" style="display:none;">
<div class="panel-body"></div>
</div>
</div>
</div-->
</table>
</div>
</div>
<!--/div-->
</div>
{{# js }}
......
......@@ -33,9 +33,16 @@ require(['jquery','core/ajax','core/notification'], function($,ajax,notification
}else{
$('#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body > .panel > .panel-body').append("<div class='alert alert-danger' style='margin-top: 5px;'>"+message[0].message+"</div>");
}
$("#axistool").show();
$('#assignfeedback_editpdfplus_widget_admin_toolheader').show();
$('#assignfeedback_editpdfplus_widget_admin_toolworkspace').show();
var selectAxis = $("#editpdlplus_axes").val();
if (selectAxis && selectAxis !== "") {
$("#axistool").show();
$('#assignfeedback_editpdfplus_widget_admin_toolheader').show();
$('#assignfeedback_editpdfplus_widget_admin_toolworkspace').show();
} else {
$("#assignfeedback_editpdfplus_widget_admin_workspace").hide();
$('#assignfeedback_editpdfplus_widget_admin_toolheader').hide();
$('#assignfeedback_editpdfplus_widget_admin_toolworkspace').hide();
}
$("#editpdlplus_axes").prop('disabled',false);
}).fail(notification.exception);
});
......
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template assignfeedback_editpdfplus/axis_form
Admin template for add or edit one axis.
Context variables required for this template:
* courseid - Course id
* title - Title of the page (add or edit)
* render - form render for adding or editing axis
* id - form id
* action - label of action 'edit' or 'add'
}}
<div class="panel panel-default">
......@@ -39,6 +64,7 @@ require(['jquery','core/ajax','core/notification'], function($,ajax,notification
$("#editpdlplus_axes option:selected").html(axe[0].axelabel);
}
$("#axistool").show();
$("#editpdlplus_axes_worspace").show();
$('#assignfeedback_editpdfplus_widget_admin_toolheader').show();
$('#assignfeedback_editpdfplus_widget_admin_toolworkspace').show();
$("#editpdlplus_axes").prop('disabled',false);
......@@ -52,9 +78,16 @@ require(['jquery','core/ajax','core/notification'], function($,ajax,notification
$('#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body').html("");
$('#assignfeedback_editpdfplus_widget_admin_div_editaxis').hide();
}
$("#axistool").show();
$('#assignfeedback_editpdfplus_widget_admin_toolheader').show();
$('#assignfeedback_editpdfplus_widget_admin_toolworkspace').show();
var selectAxis = $("#editpdlplus_axes").val();
if (selectAxis && selectAxis !== "") {
$("#axistool").show();
$('#assignfeedback_editpdfplus_widget_admin_toolheader').show();
$('#assignfeedback_editpdfplus_widget_admin_toolworkspace').show();
} else {
$("#assignfeedback_editpdfplus_widget_admin_workspace").hide();
$('#assignfeedback_editpdfplus_widget_admin_toolheader').hide();
$("#editpdlplus_axes_worspace").show();
}
$("#editpdlplus_axes").prop('disabled',false);
});
});
......
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