|
From: <ru...@us...> - 2009-03-25 09:56:29
|
Revision: 6700
http://phpwiki.svn.sourceforge.net/phpwiki/?rev=6700&view=rev
Author: rurban
Date: 2009-03-25 09:56:20 +0000 (Wed, 25 Mar 2009)
Log Message:
-----------
fix paging with dba (avoid double limit)
add _jsFlipAll again as a bigger page is faster than a 2nd file request
Modified Paths:
--------------
trunk/lib/PageList.php
trunk/lib/WikiDB.php
Modified: trunk/lib/PageList.php
===================================================================
--- trunk/lib/PageList.php 2009-03-25 09:14:26 UTC (rev 6699)
+++ trunk/lib/PageList.php 2009-03-25 09:56:20 UTC (rev 6700)
@@ -795,7 +795,10 @@
function addPages ($page_iter) {
// TODO: if limit check max(strlen(pagename))
$i = 0;
- if (isset($this->_options['limit'])) { // extract from,count from limit
+ if (isa($page_iter->_iter, "WikiDB_backend_dbaBase_pageiter")) {
+ $limit = 0;
+ }
+ elseif (isset($this->_options['limit'])) { // extract from,count from limit
list($from, $limit) = WikiDB_backend::limit($this->_options['limit']);
$limit += $from;
} else {
@@ -1393,7 +1396,8 @@
if (count($this->_sortby) > 0) $this->_sortPages();
// wikiadminutils hack. that's a way to pagelist non-pages
- $rows = isset($this->_rows) ? $this->_rows : array(); $i = 0;
+ $rows = isset($this->_rows) ? $this->_rows : array();
+ $i = 0;
$count = $this->getTotal();
$do_paging = ( isset($this->_options['paging'])
and !empty($this->_options['limit'])
@@ -1419,6 +1423,12 @@
$table->pushContent(HTML::caption(array('align'=>'top'), $caption));
}
+ //Warning: This is quite fragile. It depends solely on a private variable
+ // in ->_addColumn()
+ if (!empty($this->_columns_seen['checkbox'])) {
+ $table->pushContent($this->_jsFlipAll());
+ }
+
$row = HTML::tr();
$table_summary = array();
$i = 1; // start with 1!
@@ -1460,6 +1470,21 @@
}
}
+ function _jsFlipAll() {
+ return JavaScript("
+function flipAll(formObj) {
+ var isFirstSet = -1;
+ for (var i=0; i < formObj.length; i++) {
+ fldObj = formObj.elements[i];
+ if ((fldObj.type == 'checkbox') && (fldObj.name.substring(0,2) == 'p[')) {
+ if (isFirstSet == -1)
+ isFirstSet = (fldObj.checked) ? true : false;
+ fldObj.checked = (isFirstSet) ? false : true;
+ }
+ }
+}");
+ }
+
/* recursive stack for private sublist options (azhead, cols) */
function _saveOptions($opts) {
$stack = array('pages' => $this->_pages);
Modified: trunk/lib/WikiDB.php
===================================================================
--- trunk/lib/WikiDB.php 2009-03-25 09:14:26 UTC (rev 6699)
+++ trunk/lib/WikiDB.php 2009-03-25 09:56:20 UTC (rev 6700)
@@ -280,6 +280,8 @@
}
$result = $this->_backend->get_all_pages($include_empty, $sortby, $limit,
$exclude);
+ if (isa($this->_backend, "WikiDB_backend_dba"))
+ $limit = false;
return new WikiDB_PageIterator($this, $result,
array('include_empty' => $include_empty,
'exclude' => $exclude,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|