mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-31929: Repositories wikimedia and youtube lack paging
repositories wikimedia and youtube: - save last search in - process parameter 'page' - remove buttons 'Refresh', 'Search' and 'Logout' since they don't have meaning filepicker: - allow unknown number of pages (['pages'] = -1), show one 'Next' page after the current (both JS and non-JS modes) repository wikimedia: - add non-AJAX search form to make it work with JS disabled
This commit is contained in:
parent
23778a4dfa
commit
20ee508499
6 changed files with 109 additions and 21 deletions
|
@ -1370,15 +1370,21 @@ M.core_filepicker.init = function(Y, options) {
|
|||
var r = this.active_repo;
|
||||
var str = '';
|
||||
var action = '';
|
||||
if(r.pages > 1) {
|
||||
var lastpage = r.pages
|
||||
var lastpagetext = r.pages
|
||||
if (r.pages == -1) {
|
||||
lastpage = r.page + 1
|
||||
lastpagetext = M.str.moodle.next
|
||||
}
|
||||
if(lastpage > 1) {
|
||||
str += '<div class="fp-paging" id="paging-'+html_id+'-'+client_id+'">';
|
||||
str += this.get_page_button(1)+'1</a> ';
|
||||
|
||||
var span = 5;
|
||||
var ex = (span-1)/2;
|
||||
|
||||
if (r.page+ex>=r.pages) {
|
||||
var max = r.pages;
|
||||
if (r.page+ex>=lastpage) {
|
||||
var max = lastpage;
|
||||
} else {
|
||||
if (r.page<span) {
|
||||
var max = span;
|
||||
|
@ -1405,11 +1411,11 @@ M.core_filepicker.init = function(Y, options) {
|
|||
}
|
||||
|
||||
// won't display upper boundary
|
||||
if (max==r.pages) {
|
||||
str += this.get_page_button(r.pages)+r.pages+'</a>';
|
||||
if (max==lastpage) {
|
||||
str += this.get_page_button(lastpage)+lastpagetext+'</a>';
|
||||
} else {
|
||||
str += this.get_page_button(max)+max+'</a>';
|
||||
str += ' ... '+this.get_page_button(r.pages)+r.pages+'</a>';
|
||||
str += ' ... '+this.get_page_button(lastpage)+lastpagetext+'</a>';
|
||||
}
|
||||
str += '</div>';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue