Skip to content
Snippets Groups Projects
Commit 462e9e37 authored by Michael Große's avatar Michael Große
Browse files

Disable the ``last`` button when filtering groups

Since we cannot effectively filter for groups and have to work with
incremental prefetching, the ``last`` button is mostly broken/buggy.
Hence it is disabled in this usecase.
parent c52f6cd2
No related branches found
No related tags found
No related merge requests found
......@@ -387,12 +387,16 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin {
if (isset($filter['grps'])) {
$this->users = array_fill_keys($result, false);
$usermanager = plugin_load("admin", "usermanager", false);
$usermanager->setLastdisabled(true);
if (!isset($this->_grpsusers[$this->_filterToString($filter)])){
$this->_fillGroupUserArray($filter,$usermanager->getStart() + 3*$usermanager->getPagesize());
} elseif (count($this->_grpsusers[$this->_filterToString($filter)]) < getStart() + 3*$usermanager->getPagesize()) {
$this->_fillGroupUserArray($filter,$usermanager->getStart() + 3*$usermanager->getPagesize() - count($this->_grpsusers[$this->_filterToString($filter)]));
}
$result = $this->_grpsusers[$this->_filterToString($filter)];
} else {
$usermanager = plugin_load("admin", "usermanager", false);
$usermanager->setLastdisabled(false);
}
}
......@@ -470,6 +474,8 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin {
$result = array();
if (!isset($filter['grps'])) {
$usermanager = plugin_load("admin", "usermanager", false);
$usermanager->setLastdisabled(false);
foreach($this->users as $user => &$info) {
if($i++ < $start) {
continue;
......@@ -483,6 +489,8 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin {
}
}
} else {
$usermanager = plugin_load("admin", "usermanager", false);
$usermanager->setLastdisabled(true);
if (!isset($this->_grpsusers[$this->_filterToString($filter)]) || count($this->_grpsusers[$this->_filterToString($filter)]) < ($start+$limit)) {
$this->_fillGroupUserArray($filter,$start+$limit - count($this->_grpsusers[$this->_filterToString($filter)]) +1);
}
......
......@@ -31,6 +31,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
protected $_edit_userdata = array();
protected $_disabled = ''; // if disabled set to explanatory string
protected $_import_failures = array();
protected $_lastdisabled = false; // set to true if last user is unknown and last button is hence buggy
/**
* Constructor
......@@ -95,6 +96,13 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
return $this->_pagesize;
}
/**
* @param boolean $lastdisabled
*/
public function setLastdisabled($lastdisabled) {
$this->_lastdisabled = $lastdisabled;
}
/**
* Handle user request
*
......@@ -850,6 +858,10 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin {
$buttons['last'] = $buttons['next'] = (($this->_start + $this->_pagesize) >= $this->_user_total) ? $disabled : '';
}
if ($this->_lastdisabled) {
$buttons['last'] = $disabled;
}
return $buttons;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment