Gitlab CSE Unil

Commit 6976b668 authored by M. Chardon's avatar M. Chardon
Browse files

améliorations visu barre d'outil / taille fenêtre

parent 03bd1445
...@@ -201,7 +201,7 @@ class tool { ...@@ -201,7 +201,7 @@ class tool {
} }
$datatool = $this->typeObject->label; $datatool = $this->typeObject->label;
$iconparams = array('data-tool' => $datatool, $iconparams = array('data-tool' => $datatool,
'class' => $this->typeObject->label . ' costumtoolbarbutton btn btn-secondary', 'class' => $this->typeObject->label . ' costumtoolbarbutton btn btn-light',
'id' => 'ctbutton' . $this->id, 'id' => 'ctbutton' . $this->id,
'type' => 'button', 'type' => 'button',
'style' => $this->getStyleButton()); 'style' => $this->getStyleButton());
......
...@@ -54,7 +54,7 @@ class tool_generic extends tool { ...@@ -54,7 +54,7 @@ class tool_generic extends tool {
$iconhtml = \html_writer::tag("i", "", array('class' => self::DISPLAY_CLASS_BUTTON[$this->label], 'aria-hidden' => 'true')); $iconhtml = \html_writer::tag("i", "", array('class' => self::DISPLAY_CLASS_BUTTON[$this->label], 'aria-hidden' => 'true'));
$iconparams = array( $iconparams = array(
'data-tool' => $this->label, 'data-tool' => $this->label,
'class' => $this->label . 'button generictoolbarbutton btn btn-secondary', 'class' => $this->label . 'button generictoolbarbutton btn btn-light',
'type' => 'button' 'type' => 'button'
); );
if ($this->id) { if ($this->id) {
......
...@@ -114,7 +114,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base { ...@@ -114,7 +114,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
//Random id for plugin identification //Random id for plugin identification
$linkid = html_writer::random_id(); $linkid = html_writer::random_id();
$labelLaunchedEditor = ($widget->readonly) ? get_string('viewfeedbackonline', self::PLUGIN_NAME) : get_string('launcheditor', self::PLUGIN_NAME); $labelLaunchedEditor = ($widget->readonly) ? get_string('viewfeedbackonline', self::PLUGIN_NAME) : get_string('launcheditor', self::PLUGIN_NAME);
$links = html_writer::tag('a', $labelLaunchedEditor, array('id' => $linkid, self::HTMLCLASS => 'btn btn-secondary', 'href' => '#')); $links = html_writer::tag('a', $labelLaunchedEditor, array('id' => $linkid, self::HTMLCLASS => 'btn btn-light', 'href' => '#'));
$html .= '<input type="hidden" name="assignfeedback_editpdfplus_haschanges" value="false"/>'; $html .= '<input type="hidden" name="assignfeedback_editpdfplus_haschanges" value="false"/>';
$html .= html_writer::div($links, 'visibleifjs'); $html .= html_writer::div($links, 'visibleifjs');
...@@ -133,7 +133,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base { ...@@ -133,7 +133,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
$nav_prev = 'nav_prev'; $nav_prev = 'nav_prev';
$nav_next = 'nav_next'; $nav_next = 'nav_next';
} }
$classNav = "btn btn-secondary "; $classNav = "btn btn-light ";
$iconhtmlP = $this->render_toolbar_button_icon("fa-caret-left fa-2x"); $iconhtmlP = $this->render_toolbar_button_icon("fa-caret-left fa-2x");
$navigation .= $this->render_toolbar_button_html($iconhtmlP, array(self::HTMLDISABLED => 'true', $navigation .= $this->render_toolbar_button_html($iconhtmlP, array(self::HTMLDISABLED => 'true',
self::HTMLCLASS => $classNav . 'navigate-previous-button')); self::HTMLCLASS => $classNav . 'navigate-previous-button'));
...@@ -143,7 +143,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base { ...@@ -143,7 +143,7 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
$navigation .= $this->render_toolbar_button_html($iconhtmlN, array(self::HTMLDISABLED => 'true', $navigation .= $this->render_toolbar_button_html($iconhtmlN, array(self::HTMLDISABLED => 'true',
self::HTMLCLASS => $classNav . "navigate-next-button")); self::HTMLCLASS => $classNav . "navigate-next-button"));
$navigationBlock = $this->render_toolbar($navigation, "mr-auto"); $navigationBlock = $this->render_toolbar($navigation, "mr-3");
$toolbarRotationBlock = ''; $toolbarRotationBlock = '';
$toolbarBaseBlock = ''; $toolbarBaseBlock = '';
...@@ -219,20 +219,26 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base { ...@@ -219,20 +219,26 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
[get_string('question_select', self::PLUGIN_NAME), get_string('question_select_without', self::PLUGIN_NAME), get_string('question_select_with', self::PLUGIN_NAME)], 'questionselection', 0, FALSE, array(self::HTMLCLASS => 'form-control')); [get_string('question_select', self::PLUGIN_NAME), get_string('question_select_without', self::PLUGIN_NAME), get_string('question_select_with', self::PLUGIN_NAME)], 'questionselection', 0, FALSE, array(self::HTMLCLASS => 'form-control'));
$statuschoice = html_writer::select( $statuschoice = html_writer::select(
[get_string('statut_select', self::PLUGIN_NAME), get_string('statut_select_nc', self::PLUGIN_NAME), get_string('statut_select_ok', self::PLUGIN_NAME), get_string('statut_select_ko', self::PLUGIN_NAME)], 'statutselection', 0, FALSE, array(self::HTMLCLASS => 'form-control')); [get_string('statut_select', self::PLUGIN_NAME), get_string('statut_select_nc', self::PLUGIN_NAME), get_string('statut_select_ok', self::PLUGIN_NAME), get_string('statut_select_ko', self::PLUGIN_NAME)], 'statutselection', 0, FALSE, array(self::HTMLCLASS => 'form-control'));
$validatebutton = $this->render_toolbar_button_html(get_string('send_pdf_update', self::PLUGIN_NAME), array(self::HTMLCLASS => 'btn btn-secondary', 'id' => 'student_valide_button')); $validatebutton = $this->render_toolbar_button_html(get_string('send_pdf_update', self::PLUGIN_NAME), array(self::HTMLCLASS => 'btn btn-light', 'id' => 'student_valide_button'));
$toolbarAxis .= $this->render_toolbar($statuschoice); $toolbarAxis .= $this->render_toolbar($statuschoice);
$toolbarAxis .= $this->render_toolbar($questionchoice, 'mr-3'); $toolbarAxis .= $this->render_toolbar($questionchoice, 'mr-3');
$toolbarAxis .= $this->render_toolbar($validatebutton, 'mr-0'); $toolbarAxis .= $this->render_toolbar($validatebutton, 'mr-0');
} }
$pageheadercontent = $navigationBlock $pageheadercontent = "<div class='d-flex align-content-center flex-nowrap align-items-center'>"
. $navigationBlock
. $toolbarAdminBlock . $toolbarAdminBlock
. "<div class='d-fex flex-wrap align-content-center align-items-center'>"
. $toolbarRotationBlock . $toolbarRotationBlock
. $toolbarBaseBlock . $toolbarBaseBlock
. "<div class='btn-group btn-group-sm p-1'>"
. $toolbarAxis . $toolbarAxis
. $toolbarCostumdiv . $toolbarCostumdiv
. $toolbarDrawBlock; . '</div>'
$mainnavigation = html_writer::div($pageheadercontent, "btn-toolbar btn-group-sm bg-light p-1", array('role' => 'toolbar')); . $toolbarDrawBlock
. '</div>'
. '</div>';
$mainnavigation = html_writer::div($pageheadercontent, "drawingtoolbar btn-toolbar btn-group-sm bg-light p-1", array('role' => 'toolbar'));
$body .= $mainnavigation; $body .= $mainnavigation;
......
...@@ -42,18 +42,10 @@ ...@@ -42,18 +42,10 @@
.assignfeedback_editpdfplus_widget .drawingregion { .assignfeedback_editpdfplus_widget .drawingregion {
border: 1px solid #ccc; border: 1px solid #ccc;
left: 0.1em; overflow: scroll;
right: 1em;
/*top: 52px;*/
bottom: 0;
position: absolute;
overflow: auto;
background-color: #ccc; background-color: #ccc;
touch-action: none; touch-action: none;
} max-height: 600px;
.assignfeedback_editpdfplus_widget[data-region="review-panel-content"] .drawingregion {
top: 52px;
} }
.assignfeedback_editpdfplus_widget { .assignfeedback_editpdfplus_widget {
...@@ -87,9 +79,7 @@ ...@@ -87,9 +79,7 @@
top: 60px; top: 60px;
} }
.yui3-colourpicker-hidden, .yui3-colourpicker-hidden {
.yui3-commentsearch-hidden,
.yui3-commentmenu-hidden {
display: none; display: none;
} }
...@@ -247,7 +237,6 @@ ...@@ -247,7 +237,6 @@
} }
ul.assignfeedback_editpdfplus_menu { ul.assignfeedback_editpdfplus_menu {
margin: 0; margin: 0;
min-width: 200px;
max-height: 40vh; max-height: 40vh;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
......
...@@ -32,7 +32,9 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php', ...@@ -32,7 +32,9 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
LOADINGICON: '.loading', LOADINGICON: '.loading',
PROGRESSBARCONTAINER: '.progress-info.progress-striped', PROGRESSBARCONTAINER: '.progress-info.progress-striped',
DRAWINGREGION: '.drawingregion', DRAWINGREGION: '.drawingregion',
DRAWINGREGIONCLASS: 'drawingregion',
DRAWINGCANVAS: '.drawingcanvas', DRAWINGCANVAS: '.drawingcanvas',
DRAWINGTOOLBAR: 'drawingtoolbar',
SAVE: '.savebutton', SAVE: '.savebutton',
ANNOTATIONCOLOURBUTTON: '.annotationcolourbutton', ANNOTATIONCOLOURBUTTON: '.annotationcolourbutton',
DELETEANNOTATIONBUTTON: '.deleteannotationbutton', DELETEANNOTATIONBUTTON: '.deleteannotationbutton',
...@@ -5064,6 +5066,11 @@ EDITOR.prototype = { ...@@ -5064,6 +5066,11 @@ EDITOR.prototype = {
drawingcanvas.on('gesturemoveend', this.edit_end, null, this); drawingcanvas.on('gesturemoveend', this.edit_end, null, this);
this.refresh_button_state(); this.refresh_button_state();
//trigger when window is resized
drawingcanvas.on('windowresize', this.resize, this);
var buttonChooseView = Y.one('.collapse-buttons');
buttonChooseView.on('click', this.temporise, this, this.resize, 500);
} }
this.start_generation(); this.start_generation();
...@@ -5971,14 +5978,23 @@ EDITOR.prototype = { ...@@ -5971,14 +5978,23 @@ EDITOR.prototype = {
} }
}, },
/**
* Temporise a function.
* @public
* @method resize
*/
temporise: function (e, fct, timeout) {
e.preventDefault();
setTimeout(fct, timeout);
},
/** /**
* Resize the dialogue window when the browser is resized. * Resize the dialogue window when the browser is resized.
* @public * @public
* @method resize * @method resize
*/ */
resize: function () { resize: function () {
var drawingregion, drawregionheight; var drawingregion, drawregionheight, drawregiontop;
if (this.dialogue) { if (this.dialogue) {
if (!this.dialogue.get('visible')) { if (!this.dialogue.get('visible')) {
return; return;
...@@ -5986,16 +6002,35 @@ EDITOR.prototype = { ...@@ -5986,16 +6002,35 @@ EDITOR.prototype = {
this.dialogue.centerDialogue(); this.dialogue.centerDialogue();
} }
//calculate top div
var drawingregionheaderSelector = document.getElementsByClassName(SELECTOR.DRAWINGTOOLBAR);
if (drawingregionheaderSelector.length > 0) {
var drawingregionheader = drawingregionheaderSelector[0];
drawregiontop = drawingregionheader.getBoundingClientRect().height;
} else {
drawregiontop = '52';
}
// Make sure the dialogue box is not bigger than the max height of the viewport. // Make sure the dialogue box is not bigger than the max height of the viewport.
drawregionheight = Y.one('body').get('winHeight') - 120; // Space for toolbar + titlebar. drawregionheight = Y.one('body').get('winHeight') - 120; // Space for toolbar + titlebar.
if (drawregionheight < 100) { if (drawregionheight < 100) {
drawregionheight = 100; drawregionheight = 100;
} }
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); var drawingregionSelector = document.getElementsByClassName(SELECTOR.DRAWINGREGIONCLASS);
if (this.dialogue) { if (drawingregionSelector.length > 0) {
drawingregion.setStyle('maxHeight', drawregionheight + 'px'); drawingregion = drawingregionSelector[0];
drawingregion.style.top = drawregiontop + 'px';
drawingregion.style.maxHeight = drawregionheight + 'px';
} else {
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
if (this.dialogue) {
drawingregion.setStyle('maxHeight', drawregionheight + 'px');
}
} }
this.redraw(); try {
this.redraw();
} catch (exception) {
}
return true; return true;
}, },
......
...@@ -32,7 +32,9 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php', ...@@ -32,7 +32,9 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
LOADINGICON: '.loading', LOADINGICON: '.loading',
PROGRESSBARCONTAINER: '.progress-info.progress-striped', PROGRESSBARCONTAINER: '.progress-info.progress-striped',
DRAWINGREGION: '.drawingregion', DRAWINGREGION: '.drawingregion',
DRAWINGREGIONCLASS: 'drawingregion',
DRAWINGCANVAS: '.drawingcanvas', DRAWINGCANVAS: '.drawingcanvas',
DRAWINGTOOLBAR: 'drawingtoolbar',
SAVE: '.savebutton', SAVE: '.savebutton',
ANNOTATIONCOLOURBUTTON: '.annotationcolourbutton', ANNOTATIONCOLOURBUTTON: '.annotationcolourbutton',
DELETEANNOTATIONBUTTON: '.deleteannotationbutton', DELETEANNOTATIONBUTTON: '.deleteannotationbutton',
...@@ -5064,6 +5066,11 @@ EDITOR.prototype = { ...@@ -5064,6 +5066,11 @@ EDITOR.prototype = {
drawingcanvas.on('gesturemoveend', this.edit_end, null, this); drawingcanvas.on('gesturemoveend', this.edit_end, null, this);
this.refresh_button_state(); this.refresh_button_state();
//trigger when window is resized
drawingcanvas.on('windowresize', this.resize, this);
var buttonChooseView = Y.one('.collapse-buttons');
buttonChooseView.on('click', this.temporise, this, this.resize, 500);
} }
this.start_generation(); this.start_generation();
...@@ -5971,14 +5978,23 @@ EDITOR.prototype = { ...@@ -5971,14 +5978,23 @@ EDITOR.prototype = {
} }
}, },
/**
* Temporise a function.
* @public
* @method resize
*/
temporise: function (e, fct, timeout) {
e.preventDefault();
setTimeout(fct, timeout);
},
/** /**
* Resize the dialogue window when the browser is resized. * Resize the dialogue window when the browser is resized.
* @public * @public
* @method resize * @method resize
*/ */
resize: function () { resize: function () {
var drawingregion, drawregionheight; var drawingregion, drawregionheight, drawregiontop;
if (this.dialogue) { if (this.dialogue) {
if (!this.dialogue.get('visible')) { if (!this.dialogue.get('visible')) {
return; return;
...@@ -5986,16 +6002,35 @@ EDITOR.prototype = { ...@@ -5986,16 +6002,35 @@ EDITOR.prototype = {
this.dialogue.centerDialogue(); this.dialogue.centerDialogue();
} }
//calculate top div
var drawingregionheaderSelector = document.getElementsByClassName(SELECTOR.DRAWINGTOOLBAR);
if (drawingregionheaderSelector.length > 0) {
var drawingregionheader = drawingregionheaderSelector[0];
drawregiontop = drawingregionheader.getBoundingClientRect().height;
} else {
drawregiontop = '52';
}
// Make sure the dialogue box is not bigger than the max height of the viewport. // Make sure the dialogue box is not bigger than the max height of the viewport.
drawregionheight = Y.one('body').get('winHeight') - 120; // Space for toolbar + titlebar. drawregionheight = Y.one('body').get('winHeight') - 120; // Space for toolbar + titlebar.
if (drawregionheight < 100) { if (drawregionheight < 100) {
drawregionheight = 100; drawregionheight = 100;
} }
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); var drawingregionSelector = document.getElementsByClassName(SELECTOR.DRAWINGREGIONCLASS);
if (this.dialogue) { if (drawingregionSelector.length > 0) {
drawingregion.setStyle('maxHeight', drawregionheight + 'px'); drawingregion = drawingregionSelector[0];
drawingregion.style.top = drawregiontop + 'px';
drawingregion.style.maxHeight = drawregionheight + 'px';
} else {
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
if (this.dialogue) {
drawingregion.setStyle('maxHeight', drawregionheight + 'px');
}
} }
this.redraw(); try {
this.redraw();
} catch (exception) {
}
return true; return true;
}, },
......
...@@ -367,6 +367,11 @@ EDITOR.prototype = { ...@@ -367,6 +367,11 @@ EDITOR.prototype = {
drawingcanvas.on('gesturemoveend', this.edit_end, null, this); drawingcanvas.on('gesturemoveend', this.edit_end, null, this);
this.refresh_button_state(); this.refresh_button_state();
//trigger when window is resized
drawingcanvas.on('windowresize', this.resize, this);
var buttonChooseView = Y.one('.collapse-buttons');
buttonChooseView.on('click', this.temporise, this, this.resize, 500);
} }
this.start_generation(); this.start_generation();
...@@ -1274,14 +1279,23 @@ EDITOR.prototype = { ...@@ -1274,14 +1279,23 @@ EDITOR.prototype = {
} }
}, },
/**
* Temporise a function.
* @public
* @method resize
*/
temporise: function (e, fct, timeout) {
e.preventDefault();
setTimeout(fct, timeout);
},
/** /**
* Resize the dialogue window when the browser is resized. * Resize the dialogue window when the browser is resized.
* @public * @public
* @method resize * @method resize
*/ */
resize: function () { resize: function () {
var drawingregion, drawregionheight; var drawingregion, drawregionheight, drawregiontop;
if (this.dialogue) { if (this.dialogue) {
if (!this.dialogue.get('visible')) { if (!this.dialogue.get('visible')) {
return; return;
...@@ -1289,16 +1303,35 @@ EDITOR.prototype = { ...@@ -1289,16 +1303,35 @@ EDITOR.prototype = {
this.dialogue.centerDialogue(); this.dialogue.centerDialogue();
} }
//calculate top div
var drawingregionheaderSelector = document.getElementsByClassName(SELECTOR.DRAWINGTOOLBAR);
if (drawingregionheaderSelector.length > 0) {
var drawingregionheader = drawingregionheaderSelector[0];
drawregiontop = drawingregionheader.getBoundingClientRect().height;
} else {
drawregiontop = '52';
}
// Make sure the dialogue box is not bigger than the max height of the viewport. // Make sure the dialogue box is not bigger than the max height of the viewport.
drawregionheight = Y.one('body').get('winHeight') - 120; // Space for toolbar + titlebar. drawregionheight = Y.one('body').get('winHeight') - 120; // Space for toolbar + titlebar.
if (drawregionheight < 100) { if (drawregionheight < 100) {
drawregionheight = 100; drawregionheight = 100;
} }
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION); var drawingregionSelector = document.getElementsByClassName(SELECTOR.DRAWINGREGIONCLASS);
if (this.dialogue) { if (drawingregionSelector.length > 0) {
drawingregion.setStyle('maxHeight', drawregionheight + 'px'); drawingregion = drawingregionSelector[0];
drawingregion.style.top = drawregiontop + 'px';
drawingregion.style.maxHeight = drawregionheight + 'px';
} else {
drawingregion = this.get_dialogue_element(SELECTOR.DRAWINGREGION);
if (this.dialogue) {
drawingregion.setStyle('maxHeight', drawregionheight + 'px');
}
} }
this.redraw(); try {
this.redraw();
} catch (exception) {
}
return true; return true;
}, },
......
...@@ -30,7 +30,9 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php', ...@@ -30,7 +30,9 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
LOADINGICON: '.loading', LOADINGICON: '.loading',
PROGRESSBARCONTAINER: '.progress-info.progress-striped', PROGRESSBARCONTAINER: '.progress-info.progress-striped',
DRAWINGREGION: '.drawingregion', DRAWINGREGION: '.drawingregion',
DRAWINGREGIONCLASS: 'drawingregion',
DRAWINGCANVAS: '.drawingcanvas', DRAWINGCANVAS: '.drawingcanvas',
DRAWINGTOOLBAR: 'drawingtoolbar',
SAVE: '.savebutton', SAVE: '.savebutton',
ANNOTATIONCOLOURBUTTON: '.annotationcolourbutton', ANNOTATIONCOLOURBUTTON: '.annotationcolourbutton',
DELETEANNOTATIONBUTTON: '.deleteannotationbutton', DELETEANNOTATIONBUTTON: '.deleteannotationbutton',
......
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