Skip to content
This repository was archived by the owner on May 24, 2022. It is now read-only.

added new option: pagesize #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/controllers/collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function doIndex() {

}';
}
x("pagesize", 10);
x("pagesize", $this->_server->pageSize());
}
else {
$row = null;
Expand Down Expand Up @@ -335,7 +335,7 @@ public function doIndex() {
//pagination
$pagesize = xi("pagesize");
if ($pagesize < 1) {
$pagesize = 10;
$pagesize = $this->_server->pageSize();
}
import("lib.page.RPageStyle1");
$page = new RPageStyle1();
Expand Down
15 changes: 15 additions & 0 deletions app/models/MServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class MServer {
private $_docsNatureOrder = false;
private $_docsRender = "default";

private $_pagesize = 10;

/**
* the server you are operating
*
Expand Down Expand Up @@ -99,6 +101,9 @@ public function __construct(array $config) {
case "docs_render":
$this->_docsRender = $value;
break;
case "pagesize":
$this->_pagesize = $value;
break;
}
}
if (empty($this->_mongoName)) {
Expand Down Expand Up @@ -284,6 +289,16 @@ public function docsRender() {
return $this->_docsRender;
}

/**
* Get documents for page
*
* @return integer
* @since 1.1.8
*/
public function pageSize() {
return $this->_pagesize;
}

public function auth($username, $password, $db = "admin") {
if ($db === "") {
if (!$this->_mongoAuth && $this->_mongoDb) {
Expand Down
2 changes: 2 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
//$MONGO["servers"][$i]["docs_nature_order"] = false;//whether show documents by nature order, default is by _id field
//$MONGO["servers"][$i]["docs_render"] = "default";//document highlight render, can be "default" or "plain"

$MONGO["servers"][$i]["pagesize"] = 10;//docs for page

$i ++;

/**
Expand Down