MDL-42029 Editpdf: Page selector should indicate what page you are on

This commit is contained in:
Jerome Mouneyrac 2013-10-16 11:55:30 +08:00
parent f8eff10319
commit ea6d86743f
6 changed files with 19 additions and 8 deletions

View File

@ -143,9 +143,9 @@ class assignfeedback_editpdf_renderer extends plugin_renderer_base {
$iconhtml = $this->pix_icon($nav_prev, $iconalt, 'assignfeedback_editpdf');
$navigation1 .= html_writer::tag('button', $iconhtml, array('disabled'=>'true',
'class'=>'navigate-previous-button', 'accesskey' => $this->get_shortcut('navigate-previous-button')));
$pageoptions = html_writer::tag('option', get_string('gotopage', 'assignfeedback_editpdf'), array('value'=>''));
$navigation1 .= html_writer::tag('select', $pageoptions, array('disabled'=>'true',
'class'=>'navigate-page-select', 'accesskey' => $this->get_shortcut('navigate-page-select')));
$navigation1 .= html_writer::tag('select', null, array('disabled'=>'true',
'aria-label' => get_string('gotopage', 'assignfeedback_editpdf'), 'class'=>'navigate-page-select',
'accesskey' => $this->get_shortcut('navigate-page-select')));
$iconalt = get_string('navigatenext', 'assignfeedback_editpdf');
$iconhtml = $this->pix_icon($nav_next, $iconalt, 'assignfeedback_editpdf');
$navigation1 .= html_writer::tag('button', $iconhtml, array('disabled'=>'true',
@ -239,7 +239,8 @@ class assignfeedback_editpdf_renderer extends plugin_renderer_base {
'deleteannotation',
'stamp',
'stamppicker',
'cannotopenpdf'
'cannotopenpdf',
'pagenumber'
), 'assignfeedback_editpdf');
return $html;

View File

@ -59,6 +59,7 @@ $string['loadingeditor'] = 'Loading PDF editor';
$string['navigatenext'] = 'Next page';
$string['navigateprevious'] = 'Previous page';
$string['oval'] = 'Oval';
$string['pagenumber'] = 'Page {$a}';
$string['pagexofy'] = 'Page {$a->page} of {$a->total}';
$string['pen'] = 'Pen';
$string['pluginname'] = 'Annotate PDF';

View File

@ -3690,6 +3690,9 @@ EDITOR.prototype = {
this.loadingicon.hide();
drawingcanvas.setStyle('backgroundImage', 'url("' + page.url + '")');
// Update page select.
Y.one(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.redraw();
},
@ -3713,7 +3716,7 @@ EDITOR.prototype = {
for (i = 0; i < this.pages.length; i++) {
option = Y.Node.create('<option/>');
option.setAttribute('value', i);
option.setHTML((i+1));
option.setHTML(M.util.get_string('pagenumber', 'assignfeedback_editpdf', i+1));
pageselect.append(option);
}
}

View File

@ -3690,6 +3690,9 @@ EDITOR.prototype = {
this.loadingicon.hide();
drawingcanvas.setStyle('backgroundImage', 'url("' + page.url + '")');
// Update page select.
Y.one(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.redraw();
},
@ -3713,7 +3716,7 @@ EDITOR.prototype = {
for (i = 0; i < this.pages.length; i++) {
option = Y.Node.create('<option/>');
option.setAttribute('value', i);
option.setHTML((i+1));
option.setHTML(M.util.get_string('pagenumber', 'assignfeedback_editpdf', i+1));
pageselect.append(option);
}
}

View File

@ -879,6 +879,9 @@ EDITOR.prototype = {
this.loadingicon.hide();
drawingcanvas.setStyle('backgroundImage', 'url("' + page.url + '")');
// Update page select.
Y.one(SELECTOR.PAGESELECT).set('value', this.currentpage);
this.redraw();
},
@ -902,7 +905,7 @@ EDITOR.prototype = {
for (i = 0; i < this.pages.length; i++) {
option = Y.Node.create('<option/>');
option.setAttribute('value', i);
option.setHTML((i+1));
option.setHTML(M.util.get_string('pagenumber', 'assignfeedback_editpdf', i+1));
pageselect.append(option);
}
}