1 <?php rcs_id('$Id: PageList.php,v 1.119 2004-11-11 14:34:11 rurban Exp $');
4 * List a number of pagenames, optionally as table with various columns.
5 * This library relieves some work for these plugins:
7 * AllPages, BackLinks, LikePages, MostPopular, TitleSearch, WikiAdmin* and more
9 * It also allows dynamic expansion of those plugins to include more
10 * columns in their output.
12 * Column 'info=' arguments:
14 * 'pagename' _("Page Name")
15 * 'mtime' _("Last Modified")
17 * 'summary' _("Last Summary")
18 * 'version' _("Version")),
19 * 'author' _("Last Author")),
20 * 'locked' _("Locked"), _("locked")
21 * 'minor' _("Minor Edit"), _("minor")
22 * 'markup' _("Markup")
24 * 'creator' _("Creator")
26 * 'checkbox' selectable checkbox at the left.
29 * Special, custom columns: Either theme or plugin (WikiAdmin*) specific.
30 * 'remove' _("Remove")
31 * 'perm' _("Permission Mask")
33 * 'renamed_pagename' _("Rename to")
34 * 'ratingwidget', ... wikilens theme specific.
35 * 'custom' See plugin/_WikiTranslation
37 * Symbolic 'info=' arguments:
38 * 'all' All columns except the special columns
39 * 'most' pagename, mtime, author, size, hits, ...
40 * 'some' pagename, mtime, author
42 * FIXME: In this refactoring I (Jeff) have un-implemented _ctime, _cauthor, and
43 * number-of-revision. Note the _ctime and _cauthor as they were implemented
44 * were somewhat flawed: revision 1 of a page doesn't have to exist in the
45 * database. If lots of revisions have been made to a page, it's more than likely
46 * that some older revisions (include revision 1) have been cleaned (deleted).
49 * paging support: limit, offset args
50 * check PagePerm "list" access-type,
51 * all columns are sortable (Thanks to the wikilens team).
52 * cols > 1, comma, azhead, ordered (OL lists)
53 * ->supportedArgs() which arguments are supported, so that the plugin
54 * doesn't explictly need to declare it
57 * fix memory exhaustion on large pagelists with old --memory-limit php's only.
58 * Status: improved 2004-06-25 16:19:36 rurban
59 * but needs further testing.
61 class _PageList_Column_base {
62 var $_tdattr = array();
64 function _PageList_Column_base ($default_heading, $align = false) {
65 $this->_heading = $default_heading;
68 // align="char" isn't supported by any browsers yet :(
69 //if (is_array($align))
70 // $this->_tdattr = $align;
72 $this->_tdattr['align'] = $align;
76 function format ($pagelist, $page_handle, &$revision_handle) {
77 return HTML::td($this->_tdattr,
79 $this->_getValue($page_handle, $revision_handle),
83 function getHeading () {
84 return $this->_heading;
87 function setHeading ($heading) {
88 $this->_heading = $heading;
94 if (1 /* or in_array($this->_field, PageList::sortable_columns())*/) {
95 // multiple comma-delimited sortby args: "+hits,+pagename"
96 // asc or desc: +pagename, -pagename
97 $sortby = PageList::sortby($this->_field, 'flip_order');
98 //Fixme: pass all also other GET args along. (limit, p[])
99 //TODO: support GET and POST
100 $s = HTML::a(array('href' =>
101 $GLOBALS['request']->GetURLtoSelf(array('sortby' => $sortby,
103 'class' => 'pagetitle',
104 'title' => sprintf(_("Sort by %s"), $this->_field)),
105 HTML::raw(' '), HTML::u($this->_heading), HTML::raw(' '));
107 $s = HTML(HTML::raw(' '), HTML::u($this->_heading), HTML::raw(' '));
109 return HTML::th(array('align' => 'center'),$s);
112 // new grid-style sortable heading
114 function button_heading ($pagelist, $colNum) {
115 global $WikiTheme, $request;
117 if (1 /* or in_array($this->_field, PageList::sortable_columns()) */) {
118 // multiple comma-delimited sortby args: "+hits,+pagename"
120 $noimg_src = $WikiTheme->getButtonURL('no_order');
122 $noimg = HTML::img(array('src' => $noimg_src,
128 $noimg = HTML::raw(' ');
129 if ($request->getArg('sortby')) {
130 if ($pagelist->sortby($colNum, 'check')) { // show icon?
131 $sortby = $pagelist->sortby($request->getArg('sortby'), 'flip_order');
132 $request->setArg('sortby', $sortby);
133 $desc = (substr($sortby,0,1) == '-'); // asc or desc? (+pagename, -pagename)
134 $src = $WikiTheme->getButtonURL($desc ? 'asc_order' : 'desc_order');
136 $sortby = $pagelist->sortby($colNum, 'init');
139 $sortby = $pagelist->sortby($colNum, 'init');
143 //$img->setAttr('alt', _("Click to sort"));
145 $img = HTML::img(array('src' => $src,
149 'alt' => _("Click to reverse sort order")));
151 $s = HTML::a(array('href' =>
152 //Fixme: pass all also other GET args along. (limit is ok, p[])
153 //Fixme: convert to POST submit[sortby]
154 $request->GetURLtoSelf(array('sortby' => $sortby,
155 /*'nocache' => '1'*/)),
156 'class' => 'gridbutton',
157 'title' => sprintf(_("Click to sort by %s"), $this->_field)),
164 HTML::raw(' '));
166 $s = HTML(HTML::raw(' '), $this->_heading, HTML::raw(' '));
168 return HTML::th(array('align' => 'center', 'valign' => 'middle',
169 'class' => 'gridbutton'), $s);
173 * Take two columns of this type and compare them.
174 * An undefined value is defined to be < than the smallest defined value.
175 * This base class _compare only works if the value is simple (e.g., a number).
177 * @param $colvala $this->_getValue() of column a
178 * @param $colvalb $this->_getValue() of column b
180 * @return -1 if $a < $b, 1 if $a > $b, 0 otherwise.
182 function _compare($colvala, $colvalb) {
183 if (is_string($colvala))
184 return strcmp($colvala,$colvalb);
186 if (($colvala === $colvalb) || (!isset($colvala) && !isset($colvalb))) {
189 $ret = (!isset($colvala) || ($colvala < $colvalb)) ? -1 : 1;
195 class _PageList_Column extends _PageList_Column_base {
196 function _PageList_Column ($field, $default_heading, $align = false) {
197 $this->_PageList_Column_base($default_heading, $align);
199 $this->_need_rev = substr($field, 0, 4) == 'rev:';
200 $this->_iscustom = substr($field, 0, 7) == 'custom:';
201 if ($this->_iscustom) {
202 $this->_field = substr($field, 7);
204 elseif ($this->_need_rev)
205 $this->_field = substr($field, 4);
207 $this->_field = $field;
210 function _getValue ($page_handle, &$revision_handle) {
211 if ($this->_need_rev) {
212 if (!$revision_handle)
213 // columns which need the %content should override this. (size, hi_content)
214 $revision_handle = $page_handle->getCurrentRevision(false);
215 return $revision_handle->get($this->_field);
218 return $page_handle->get($this->_field);
222 function _getSortableValue ($page_handle, &$revision_handle) {
223 $val = $this->_getValue($page_handle, $revision_handle);
224 if ($this->_field == 'hits')
226 elseif (is_object($val))
227 return $val->asString();
229 return (string) $val;
233 /* overcome a call_user_func limitation by not being able to do:
234 * call_user_func_array(array(&$class, $class_name), $params);
235 * So we need $class = new $classname($params);
236 * And we add a 4th param to get at the parent $pagelist object
238 class _PageList_Column_custom extends _PageList_Column {
239 function _PageList_Column_custom($params) {
240 $this->_pagelist =& $params[3];
241 $this->_PageList_Column($params[0], $params[1], $params[2]);
245 class _PageList_Column_size extends _PageList_Column {
246 function format (&$pagelist, $page_handle, &$revision_handle) {
247 return HTML::td($this->_tdattr,
249 $this->_getValue($pagelist, $page_handle, $revision_handle),
250 HTML::raw(' '));
253 function _getValue (&$pagelist, $page_handle, &$revision_handle) {
254 if (!$revision_handle or (!$revision_handle->_data['%content']
255 or $revision_handle->_data['%content'] === true)) {
256 $revision_handle = $page_handle->getCurrentRevision(true);
257 unset($revision_handle->_data['%pagedata']['_cached_html']);
259 $size = $this->_getSize($revision_handle);
260 // we can safely purge the content when it is not sortable
261 if (empty($pagelist->_sortby[$this->_field]))
262 unset($revision_handle->_data['%content']);
266 function _getSortableValue ($page_handle, &$revision_handle) {
267 if (!$revision_handle)
268 $revision_handle = $page_handle->getCurrentRevision(true);
269 return (empty($revision_handle->_data['%content']))
270 ? 0 : strlen($revision_handle->_data['%content']);
273 function _getSize($revision_handle) {
274 $bytes = @strlen($revision_handle->_data['%content']);
275 return ByteFormatter($bytes);
280 class _PageList_Column_bool extends _PageList_Column {
281 function _PageList_Column_bool ($field, $default_heading, $text = 'yes') {
282 $this->_PageList_Column($field, $default_heading, 'center');
283 $this->_textIfTrue = $text;
284 $this->_textIfFalse = new RawXml('—'); //mdash
287 function _getValue ($page_handle, &$revision_handle) {
288 //FIXME: check if $this is available in the parent (->need_rev)
289 $val = _PageList_Column::_getValue($page_handle, $revision_handle);
290 return $val ? $this->_textIfTrue : $this->_textIfFalse;
294 class _PageList_Column_checkbox extends _PageList_Column {
295 function _PageList_Column_checkbox ($field, $default_heading, $name='p') {
296 $this->_name = $name;
297 $heading = HTML::input(array('type' => 'button',
298 'title' => _("Click to de-/select all pages"),
300 'name' => $default_heading,
301 'value' => $default_heading,
302 'onclick' => "flipAll(this.form)"
304 $this->_PageList_Column($field, $heading, 'center');
306 function _getValue ($pagelist, $page_handle, &$revision_handle) {
307 $pagename = $page_handle->getName();
308 $selected = !empty($pagelist->_selected[$pagename]);
309 if (strstr($pagename,'[') or strstr($pagename,']')) {
310 $pagename = str_replace(array('[',']'),array('%5B','%5D'),$pagename);
313 return HTML::input(array('type' => 'checkbox',
314 'name' => $this->_name . "[$pagename]",
316 'checked' => 'CHECKED'));
318 return HTML::input(array('type' => 'checkbox',
319 'name' => $this->_name . "[$pagename]",
323 function format ($pagelist, $page_handle, &$revision_handle) {
324 return HTML::td($this->_tdattr,
326 $this->_getValue($pagelist, $page_handle, $revision_handle),
327 HTML::raw(' '));
329 // don't sort this javascript button
330 function button_heading ($pagelist, $colNum) {
331 $s = HTML(HTML::raw(' '), $this->_heading, HTML::raw(' '));
332 return HTML::th(array('align' => 'center', 'valign' => 'middle',
333 'class' => 'gridbutton'), $s);
337 class _PageList_Column_time extends _PageList_Column {
338 function _PageList_Column_time ($field, $default_heading) {
339 $this->_PageList_Column($field, $default_heading, 'right');
341 $this->Theme = &$WikiTheme;
344 function _getValue ($page_handle, &$revision_handle) {
345 $time = _PageList_Column::_getValue($page_handle, $revision_handle);
346 return $this->Theme->formatDateTime($time);
350 class _PageList_Column_version extends _PageList_Column {
351 function _getValue ($page_handle, &$revision_handle) {
352 if (!$revision_handle)
353 $revision_handle = $page_handle->getCurrentRevision();
354 return $revision_handle->getVersion();
358 // Output is hardcoded to limit of first 50 bytes. Otherwise
359 // on very large Wikis this will fail if used with AllPages
360 // (PHP memory limit exceeded)
361 class _PageList_Column_content extends _PageList_Column {
362 function _PageList_Column_content ($field, $default_heading, $align = false) {
363 $this->_PageList_Column($field, $default_heading, $align);
365 if ($field == 'content') {
366 $this->_heading .= sprintf(_(" ... first %d bytes"),
368 } elseif ($field == 'hi_content') {
369 global $HTTP_POST_VARS;
370 if (!empty($HTTP_POST_VARS['admin_replace'])) {
371 $search = $HTTP_POST_VARS['admin_replace']['from'];
372 $this->_heading .= sprintf(_(" ... around %s"),
378 function _getValue ($page_handle, &$revision_handle) {
379 if (!$revision_handle or (!$revision_handle->_data['%content']
380 or $revision_handle->_data['%content'] === true)) {
381 $revision_handle = $page_handle->getCurrentRevision(true);
383 // Not sure why implode is needed here, I thought
384 // getContent() already did this, but it seems necessary.
385 $c = implode("\n", $revision_handle->getContent());
386 if (empty($pagelist->_sortby[$this->_field]))
387 unset($revision_handle->_data['%content']);
388 if ($this->_field == 'hi_content') {
389 global $HTTP_POST_VARS;
390 unset($revision_handle->_data['%pagedata']['_cached_html']);
391 $search = $HTTP_POST_VARS['admin_replace']['from'];
392 if ($search and ($i = strpos($c,$search))) {
393 $l = strlen($search);
394 $j = max(0,$i - ($this->bytes / 2));
395 return HTML::div(array('style' => 'font-size:x-small'),
396 HTML::div(array('class' => 'transclusion'),
397 HTML::span(substr($c, $j, ($this->bytes / 2))),
398 HTML::span(array("style"=>"background:yellow"),$search),
399 HTML::span(substr($c, $i+$l, ($this->bytes / 2))))
402 $c = sprintf(_("%s not found"),
404 return HTML::div(array('style' => 'font-size:x-small','align'=>'center'),
407 } elseif (($len = strlen($c)) > $this->bytes) {
408 $c = substr($c, 0, $this->bytes);
410 include_once('lib/BlockParser.php');
411 // false --> don't bother processing hrefs for embedded WikiLinks
412 $ct = TransformText($c, $revision_handle->get('markup'), false);
413 if (empty($pagelist->_sortby[$this->_field]))
414 unset($revision_handle->_data['%pagedata']['_cached_html']);
415 return HTML::div(array('style' => 'font-size:x-small'),
416 HTML::div(array('class' => 'transclusion'), $ct),
417 // Don't show bytes here if size column present too
418 ($this->parent->_columns_seen['size'] or !$len) ? "" :
419 ByteFormatter($len, /*$longformat = */true));
422 function _getSortableValue ($page_handle, &$revision_handle) {
423 return substr(_PageList_Column::_getValue($page_handle, $revision_handle),0,50);
427 class _PageList_Column_author extends _PageList_Column {
428 function _PageList_Column_author ($field, $default_heading, $align = false) {
429 _PageList_Column::_PageList_Column($field, $default_heading, $align);
430 $this->dbi =& $GLOBALS['request']->getDbh();
433 function _getValue ($page_handle, &$revision_handle) {
434 $author = _PageList_Column::_getValue($page_handle, $revision_handle);
435 if (isWikiWord($author) && $this->dbi->isWikiPage($author))
436 return WikiLink($author);
442 class _PageList_Column_owner extends _PageList_Column_author {
443 function _getValue ($page_handle, &$revision_handle) {
444 $author = $page_handle->getOwner();
445 if (isWikiWord($author) && $this->dbi->isWikiPage($author))
446 return WikiLink($author);
452 class _PageList_Column_creator extends _PageList_Column_author {
453 function _getValue ($page_handle, &$revision_handle) {
454 $author = $page_handle->getCreator();
455 if (isWikiWord($author) && $this->dbi->isWikiPage($author))
456 return WikiLink($author);
462 class _PageList_Column_pagename extends _PageList_Column_base {
463 var $_field = 'pagename';
465 function _PageList_Column_pagename () {
466 $this->_PageList_Column_base(_("Page Name"));
468 $this->dbi = &$request->getDbh();
471 function _getValue ($page_handle, &$revision_handle) {
472 if ($this->dbi->isWikiPage($page_handle->getName()))
473 return WikiLink($page_handle);
475 return WikiLink($page_handle, 'unknown');
478 function _getSortableValue ($page_handle, &$revision_handle) {
479 return $page_handle->getName();
483 * Compare two pagenames for sorting. See _PageList_Column::_compare.
485 function _compare($colvala, $colvalb) {
486 return strcmp($colvala, $colvalb);
491 var $_group_rows = 3;
492 var $_columns = array();
493 var $_columnsMap = array(); // Maps column name to column number.
494 var $_excluded_pages = array();
495 var $_pages = array();
497 var $_pagename_seen = false;
498 var $_types = array();
499 var $_options = array();
500 var $_selected = array();
501 var $_sortby = array();
504 function PageList ($columns = false, $exclude = false, $options = false) {
506 $this->_options = $options;
508 // let plugins predefine only certain objects, such its own custom pagelist columns
509 if (!empty($this->_options['types'])) {
510 $this->_types = $this->_options['types'];
511 unset($this->_options['types']);
513 $this->_initAvailableColumns();
516 'all' => array_diff(array_keys($this->_types), // all but...
517 array('checkbox','remove','renamed_pagename',
518 'content','hi_content','perm','acl')),
519 'most' => array('pagename','mtime','author','hits'),
520 'some' => array('pagename','mtime','author')
523 if (!is_array($columns))
524 $columns = explode(',', $columns);
525 // expand symbolic columns:
526 foreach ($symbolic_columns as $symbol => $cols) {
527 if (in_array($symbol,$columns)) { // e.g. 'checkbox,all'
528 $columns = array_diff(array_merge($columns,$cols),array($symbol));
531 if (!in_array('pagename',$columns))
532 $this->_addColumn('pagename');
533 foreach ($columns as $col) {
534 $this->_addColumn($col);
537 // If 'pagename' is already present, _addColumn() will not add it again
538 $this->_addColumn('pagename');
540 foreach (array('sortby','limit','paging','count','dosort') as $key) {
541 if (!empty($options) and !empty($options[$key])) {
542 $this->_options[$key] = $options[$key];
544 $this->_options[$key] = $GLOBALS['request']->getArg($key);
547 $this->_options['sortby'] = $this->sortby($this->_options['sortby'], 'init');
549 if (is_string($exclude) and !is_array($exclude))
550 $exclude = $this->explodePageList($exclude, false,
551 $this->_options['sortby'],
552 $this->_options['limit']);
553 $this->_excluded_pages = $exclude;
555 $this->_messageIfEmpty = _("<no matches>");
558 // Currently PageList takes these arguments:
559 // 1: info, 2: exclude, 3: hash of options
560 // Here we declare which options are supported, so that
561 // the calling plugin may simply merge this with its own default arguments
562 function supportedArgs () {
563 return array(// Currently supported options:
564 /* what columns, what pages */
565 'info' => 'pagename',
566 'exclude' => '', // also wildcards, comma-seperated lists
567 // and <!plugin-list !> arrays
568 /* select pages by meta-data: */
569 'author' => false, // current user by []
570 'owner' => false, // current user by []
571 'creator' => false, // current user by []
573 /* for the sort buttons in <th> */
574 'sortby' => '', // same as for WikiDB::getAllPages (unsorted is faster)
576 /* PageList pager options:
577 * These options may also be given to _generate(List|Table) later
578 * But limit and offset might help the query WikiDB::getAllPages()
580 'limit' => 0, // number of rows (pagesize)
581 'paging' => 'auto', // 'auto' top + bottom rows if applicable
582 // // 'top' top only if applicable
583 // // 'bottom' bottom only if applicable
584 // // 'none' don't page at all
585 // (TODO: clarify what if $paging==false ?)
587 /* list-style options (with single pagename column only so far) */
588 'cols' => 1, // side-by-side display of list (1-3)
589 'azhead' => 0, // 1: group by initials
590 // 2: provide shortcut links to initials also
591 'comma' => 0, // condensed comma-seperated list,
592 // 1 if without links, 2 if with
593 'commasep' => false, // Default: ', '
594 'ordered' => false, // OL or just UL lists (ignored for comma)
598 function setCaption ($caption_string) {
599 $this->_caption = $caption_string;
602 function getCaption () {
603 // put the total into the caption if needed
604 if (is_string($this->_caption) && strstr($this->_caption, '%d'))
605 return sprintf($this->_caption, $this->getTotal());
606 return $this->_caption;
609 function setMessageIfEmpty ($msg) {
610 $this->_messageIfEmpty = $msg;
614 function getTotal () {
615 return !empty($this->_options['count'])
616 ? (integer) $this->_options['count'] : count($this->_pages);
619 function isEmpty () {
620 return empty($this->_pages);
623 function addPage($page_handle) {
624 if (!empty($this->_excluded_pages)) {
625 if (!in_array((is_string($page_handle) ? $page_handle : $page_handle->getName()),
626 $this->_excluded_pages))
627 $this->_pages[] = $page_handle;
629 $this->_pages[] = $page_handle;
633 function _getPageFromHandle($page_handle) {
634 if (is_string($page_handle)) {
635 if (empty($page_handle)) return $page_handle;
636 //$dbi = $GLOBALS['request']->getDbh(); // no, safe memory!
637 $page_handle = $GLOBALS['request']->_dbi->getPage($page_handle);
643 * Take a PageList_Page object, and return an HTML object to display
644 * it in a table or list row.
646 function _renderPageRow (&$page_handle, $i = 0) {
647 $page_handle = $this->_getPageFromHandle($page_handle);
648 //FIXME. only on sf.net
649 if (!is_object($page_handle)) {
650 trigger_error("PageList: Invalid page_handle $page_handle", E_USER_WARNING);
653 if (!isset($page_handle)
654 or empty($page_handle)
655 or (!empty($this->_excluded_pages)
656 and in_array($page_handle->getName(), $this->_excluded_pages)))
657 return; // exclude page.
659 // enforce view permission
660 if (!mayAccessPage('view', $page_handle->getName()))
663 $group = (int)($i / $this->_group_rows);
664 $class = ($group % 2) ? 'oddrow' : 'evenrow';
665 $revision_handle = false;
666 $this->_maxlen = max($this->_maxlen, strlen($page_handle->getName()));
668 if (count($this->_columns) > 1) {
669 $row = HTML::tr(array('class' => $class));
670 foreach ($this->_columns as $col)
671 $row->pushContent($col->format($this, $page_handle, $revision_handle));
673 $col = $this->_columns[0];
674 $row = $col->_getValue($page_handle, $revision_handle);
680 function addPages ($page_iter) {
681 //Todo: if limit check max(strlen(pagename))
682 while ($page = $page_iter->next()) {
683 $this->addPage($page);
687 function addPageList (&$list) {
688 if (empty($list)) return; // Protect reset from a null arg
689 foreach ($list as $page) {
690 if (is_object($page))
691 $page = $page->_pagename;
692 $this->addPage((string)$page);
698 $dbi =& $request->getDbh();
699 if (isa($dbi,'WikiDB_SQL')) {
700 extract($dbi->_backend->_table_names);
701 $res = $dbi->_backend->_dbh->getOne("SELECT max(length(pagename)) FROM $page_tbl");
702 if (DB::isError($res) || empty($res)) return false;
704 } elseif (isa($dbi,'WikiDB_ADODB')) {
705 extract($dbi->_backend->_table_names);
706 $row = $dbi->_backend->_dbh->getRow("SELECT max(length(pagename)) FROM $page_tbl");
707 return $row ? $row[0] : false;
712 function getContent() {
713 // Note that the <caption> element wants inline content.
714 $caption = $this->getCaption();
716 if ($this->isEmpty())
717 return $this->_emptyList($caption);
718 elseif (count($this->_columns) == 1)
719 return $this->_generateList($caption);
721 return $this->_generateTable($caption);
724 function printXML() {
725 PrintXML($this->getContent());
729 return AsXML($this->getContent());
733 * Handle sortby requests for the DB iterator and table header links.
734 * Prefix the column with + or - like "+pagename","-mtime", ...
737 * 'init' : unify with predefined order. "pagename" => "+pagename"
738 * 'flip_order' : "mtime" => "+mtime" => "-mtime" ...
739 * 'db' : "-pagename" => "pagename DESC"
742 * Now all columns are sortable. (patch by DanFr)
743 * Some columns have native DB backend methods, some not.
745 function sortby ($column, $action) {
748 if (empty($column)) return '';
749 if (is_int($column)) {
750 $column = $this->_columns[$column - 1]->_field;
751 //$column = $col->_field;
753 //if (!is_string($column)) return '';
754 // support multiple comma-delimited sortby args: "+hits,+pagename"
756 if (strstr($column, ',')) {
757 $result = ($action == 'check') ? true : array();
758 foreach (explode(',', $column) as $col) {
759 if ($action == 'check')
760 $result = $result && $this->sortby($col, $action);
762 $result[] = $this->sortby($col, $action);
764 // 'check' returns true/false for every col. return true if all are true.
765 // i.e. the unsupported 'every' operator in functional languages.
766 if ($action == 'check')
769 return join(",", $result);
771 if (substr($column,0,1) == '+') {
772 $order = '+'; $column = substr($column,1);
773 } elseif (substr($column,0,1) == '-') {
774 $order = '-'; $column = substr($column,1);
776 // default initial order: +pagename, -mtime, -hits
778 if (in_array($column, array('mtime','hits')))
782 if ($action == 'flip_order') {
783 return ($order == '+' ? '-' : '+') . $column;
784 } elseif ($action == 'init') {
785 $this->_sortby[$column] = $order;
786 return $order . $column;
787 } elseif ($action == 'check') {
788 return (!empty($this->_sortby[$column])
789 or ($request->getArg('sortby')
790 and strstr($request->getArg('sortby'),$column)));
791 } elseif ($action == 'db') {
792 // Performance enhancement: use native DB sort if possible.
793 if (method_exists($request->_dbi->_backend, 'sortable_columns')
794 and (in_array($column, $request->_dbi->_backend->sortable_columns()))) {
795 // omit this sort method from the _sortPages call at rendering
796 // asc or desc: +pagename, -pagename
797 return $column . ($order == '+' ? ' ASC' : ' DESC');
805 // echo implode(":",explodeList("Test*",array("xx","Test1","Test2")));
806 function explodePageList($input, $include_empty = false, $sortby=false, $limit=false) {
807 // expand wildcards from list of all pages
808 if (preg_match('/[\?\*]/',$input)) {
809 $dbi = $GLOBALS['request']->getDbh();
810 $allPagehandles = $dbi->getAllPages($include_empty, $sortby, $limit);
811 while ($pagehandle = $allPagehandles->next()) {
812 $allPages[] = $pagehandle->getName();
814 return explodeList($input, $allPages);
816 //TODO: do the sorting, normally not needed if used for exclude only
817 return explode(',',$input);
821 function allPagesByAuthor(&$wildcard, $include_empty=false, $sortby=false, $limit=false) {
822 $dbi = $GLOBALS['request']->getDbh();
823 $allPagehandles = $dbi->getAllPages($include_empty, $sortby, $limit);
825 if ($wildcard === '[]') {
826 $wildcard = $GLOBALS['request']->_user->getAuthenticatedId();
827 if (!$wildcard) return $allPages;
829 $do_glob = preg_match('/[\?\*]/', $wildcard);
830 while ($pagehandle = $allPagehandles->next()) {
831 $name = $pagehandle->getName();
832 $author = $pagehandle->getAuthor();
835 if (glob_match($wildcard, $author))
837 } elseif ($wildcard == $author) {
841 // TODO: purge versiondata_cache
846 function allPagesByOwner(&$wildcard, $include_empty=false, $sortby=false, $limit=false) {
847 $dbi = $GLOBALS['request']->getDbh();
848 $allPagehandles = $dbi->getAllPages($include_empty, $sortby, $limit);
850 if ($wildcard === '[]') {
851 $wildcard = $GLOBALS['request']->_user->getAuthenticatedId();
852 if (!$wildcard) return $allPages;
854 $do_glob = preg_match('/[\?\*]/', $wildcard);
855 while ($pagehandle = $allPagehandles->next()) {
856 $name = $pagehandle->getName();
857 $owner = $pagehandle->getOwner();
860 if (glob_match($wildcard, $owner))
862 } elseif ($wildcard == $owner) {
870 function allPagesByCreator(&$wildcard, $include_empty=false, $sortby=false, $limit=false) {
871 $dbi = $GLOBALS['request']->getDbh();
872 $allPagehandles = $dbi->getAllPages($include_empty, $sortby, $limit);
874 if ($wildcard === '[]') {
875 $wildcard = $GLOBALS['request']->_user->getAuthenticatedId();
876 if (!$wildcard) return $allPages;
878 $do_glob = preg_match('/[\?\*]/', $wildcard);
879 while ($pagehandle = $allPagehandles->next()) {
880 $name = $pagehandle->getName();
881 $creator = $pagehandle->getCreator();
884 if (glob_match($wildcard, $creator))
886 } elseif ($wildcard == $creator) {
897 /** Plugin and theme hooks:
898 * If the pageList is initialized with $options['types'] these types are also initialized,
899 * overriding the standard types.
901 function _initAvailableColumns() {
902 global $customPageListColumns;
906 => new _PageList_Column_content('rev:content', _("Content")),
907 // new: plugin specific column types initialised by the relevant plugins
909 'hi_content' // with highlighted search for SearchReplace
910 => new _PageList_Column_content('rev:hi_content', _("Content")),
912 => new _PageList_Column_remove('remove', _("Remove")),
913 // initialised by the plugin
915 => new _PageList_Column_renamed_pagename('rename', _("Rename to")),
917 => new _PageList_Column_perm('perm', _("Permission")),
919 => new _PageList_Column_acl('acl', _("ACL")),
922 => new _PageList_Column_checkbox('p', _("Select")),
924 => new _PageList_Column_pagename,
926 => new _PageList_Column_time('rev:mtime', _("Last Modified")),
928 => new _PageList_Column('hits', _("Hits"), 'right'),
930 => new _PageList_Column_size('rev:size', _("Size"), 'right'),
931 /*array('align' => 'char', 'char' => ' ')*/
933 => new _PageList_Column('rev:summary', _("Last Summary")),
935 => new _PageList_Column_version('rev:version', _("Version"),
938 => new _PageList_Column_author('rev:author', _("Last Author")),
940 => new _PageList_Column_owner('author_id', _("Owner")),
942 => new _PageList_Column_creator('author_id', _("Creator")),
945 => new _PageList_Column_author('group', _("Group")),
948 => new _PageList_Column_bool('locked', _("Locked"),
951 => new _PageList_Column_bool('rev:is_minor_edit',
952 _("Minor Edit"), _("minor")),
954 => new _PageList_Column('rev:markup', _("Markup")),
955 // 'rating' initialised by the wikilens theme hook: addPageListColumn
958 => new _PageList_Column_rating('rating', _("Rate")),
961 if (empty($this->_types))
962 $this->_types = array();
963 // add plugin specific pageList columns, initialized by $options['types']
964 $this->_types = array_merge($standard_types, $this->_types);
965 // add theme custom specific pageList columns:
966 // set the 4th param as the current pagelist object.
967 if (!empty($customPageListColumns)) {
968 foreach ($customPageListColumns as $column => $params) {
969 $class_name = array_shift($params);
971 $class = new $class_name($params);
973 $this->_types = array_merge($this->_types, $customPageListColumns);
977 function getOption($option) {
978 if (array_key_exists($option, $this->_options)) {
979 return $this->_options[$option];
987 * Add a column to this PageList, given a column name.
988 * The name is a type, and optionally has a : and a label. Examples:
993 * mtime:Last modified
995 * If this function is called multiple times for the same type, the
996 * column will only be added the first time, and ignored the succeeding times.
997 * If you wish to add multiple columns of the same type, use addColumnObject().
1000 * @return true if column is added, false otherwise
1002 function _addColumn ($column) {
1004 if (isset($this->_columns_seen[$column]))
1005 return false; // Already have this one.
1006 if (!isset($this->_types[$column]))
1007 $this->_initAvailableColumns();
1008 $this->_columns_seen[$column] = true;
1010 if (strstr($column, ':'))
1011 list ($column, $heading) = explode(':', $column, 2);
1013 // FIXME: these column types have hooks (objects) elsewhere
1014 // Omitting this warning should be overridable by the extension
1015 if (!isset($this->_types[$column])) {
1016 $silently_ignore = array('numbacklinks',
1017 'rating',/*'ratingwidget',*/
1018 'coagreement', 'minmisery',
1020 'averagerating', 'top3recs');
1021 if (!in_array($column, $silently_ignore))
1022 trigger_error(sprintf("%s: Bad column", $column), E_USER_NOTICE);
1025 // FIXME: anon users might rate and see ratings also.
1026 // Defer this logic to the plugin.
1027 if ($column == 'rating' and !$GLOBALS['request']->_user->isSignedIn())
1030 $this->addColumnObject($this->_types[$column]);
1036 * Add a column to this PageList, given a column object.
1038 * @param $col object An object derived from _PageList_Column.
1040 function addColumnObject($col) {
1041 if (is_array($col)) {// custom column object
1043 $class_name = array_shift($params);
1044 $params[3] =& $this;
1045 $col = new $class_name($params);
1047 $heading = $col->getHeading();
1048 if (!empty($heading))
1049 $col->setHeading($heading);
1051 $this->_columns[] = $col;
1052 $this->_columnsMap[$col->_field] = count($this->_columns); // start with 1
1056 * Compare _PageList_Page objects.
1058 function _pageCompare(&$a, &$b) {
1059 if (empty($this->_sortby) or count($this->_sortby) == 0) {
1060 // No columns to sort by
1064 $pagea = $this->_getPageFromHandle($a); // If a string, convert to page
1065 assert(isa($pagea, 'WikiDB_Page'));
1066 $pageb = $this->_getPageFromHandle($b); // If a string, convert to page
1067 assert(isa($pageb, 'WikiDB_Page'));
1068 foreach ($this->_sortby as $colNum => $direction) {
1069 if (!is_int($colNum)) // or column fieldname
1070 $colNum = $this->_columnsMap[$colNum];
1071 $col = $this->_columns[$colNum - 1];
1073 assert(isset($col));
1074 $revision_handle = false;
1075 $aval = $col->_getSortableValue($pagea, $revision_handle);
1076 $bval = $col->_getSortableValue($pageb, $revision_handle);
1078 $cmp = $col->_compare($aval, $bval);
1079 if ($direction === "-") // Reverse the sense of the comparison
1083 // This is the first comparison that is not equal-- go with it
1091 * Put pages in order according to the sortby arg, if given
1092 * If the sortby cols are already sorted by the DB call, don't do usort.
1093 * TODO: optimize for multiple sortable cols
1095 function _sortPages() {
1096 if (count($this->_sortby) > 0) {
1097 $need_sort = $this->_options['dosort'];
1098 foreach ($this->_sortby as $col => $dir) {
1099 if (! $this->sortby($col, 'db'))
1102 if ($need_sort) { // There are some columns to sort by
1103 usort(&$this->_pages, array($this, '_pageCompare'));
1106 //unset($GLOBALS['PhpWiki_pagelist']);
1109 function limit($limit) {
1110 if (is_array($limit)) return $limit;
1111 if (strstr($limit, ','))
1112 return split(',', $limit);
1114 return array(0, $limit);
1117 function pagingTokens($numrows = false, $ncolumns = false, $limit = false) {
1118 if ($numrows === false)
1119 $numrows = $this->getTotal();
1120 if ($limit === false)
1121 $limit = $this->_options['limit'];
1122 if ($ncolumns === false)
1123 $ncolumns = count($this->_columns);
1125 list($offset, $pagesize) = $this->limit($limit);
1127 (!$offset and $numrows <= $pagesize) or
1128 ($offset + $pagesize < 0))
1131 $request = &$GLOBALS['request'];
1132 $pagename = $request->getArg('pagename');
1133 $defargs = $request->args;
1137 $tokens['PREV'] = false; $tokens['PREV_LINK'] = "";
1138 $tokens['COLS'] = count($this->_columns);
1139 $tokens['COUNT'] = $numrows;
1140 $tokens['OFFSET'] = $offset;
1141 $tokens['SIZE'] = $pagesize;
1142 $tokens['NUMPAGES'] = (int)($numrows / $pagesize)+1;
1143 $tokens['ACTPAGE'] = (int) (($offset+1) / $pagesize)+1;
1145 $prev['limit'] = min(0,$offset - $pagesize) . ",$pagesize";
1146 $prev['count'] = $numrows;
1147 $tokens['LIMIT'] = $prev['limit'];
1148 $tokens['PREV'] = true;
1149 $tokens['PREV_LINK'] = WikiURL($pagename, $prev);
1150 $prev['limit'] = "0,$pagesize";
1151 $tokens['FIRST_LINK'] = WikiURL($pagename, $prev);
1154 $tokens['NEXT'] = false; $tokens['NEXT_LINK'] = "";
1155 if ($offset + $pagesize < $numrows) {
1156 $next['limit'] = min($offset + $pagesize, $numrows - $pagesize) . ",$pagesize";
1157 $next['count'] = $numrows;
1158 $tokens['LIMIT'] = $next['limit'];
1159 $tokens['NEXT'] = true;
1160 $tokens['NEXT_LINK'] = WikiURL($pagename, $next);
1161 $next['limit'] = $numrows - $pagesize . ",$pagesize";
1162 $tokens['LAST_LINK'] = WikiURL($pagename, $next);
1167 // make a table given the caption
1168 function _generateTable($caption) {
1169 if (count($this->_sortby) > 0) $this->_sortPages();
1171 $rows = array(); $i = 0;
1172 foreach ($this->_pages as $pagenum => $page) {
1173 $rows[] = $this->_renderPageRow($page, $i++);
1176 $table = HTML::table(array('cellpadding' => 0,
1179 'class' => 'pagelist'));
1181 $table->pushContent(HTML::caption(array('align'=>'top'), $caption));
1183 //Warning: This is quite fragile. It depends solely on a private variable
1184 // in ->_addColumn()
1185 if (!empty($this->_columns_seen['checkbox'])) {
1186 $table->pushContent($this->_jsFlipAll());
1188 $do_paging = ( isset($this->_options['paging'])
1189 and !empty($this->_options['limit'])
1190 and $this->getTotal()
1191 and $this->_options['paging'] != 'none' );
1193 $table_summary = array();
1194 $i = 1; // start with 1!
1195 foreach ($this->_columns as $col) {
1196 $heading = $col->button_heading($this, $i);
1198 and isset($col->_field)
1199 and $col->_field == 'pagename'
1200 and ($maxlen = $this->maxLen())) {
1201 $heading->setAttr('width', $maxlen * 7);
1203 $row->pushContent($heading);
1204 if (is_string($col->getHeading()))
1205 $table_summary[] = $col->getHeading();
1208 // Table summary for non-visual browsers.
1209 $table->setAttr('summary', sprintf(_("Columns: %s."),
1210 join(", ", $table_summary)));
1211 $table->pushContent(HTML::colgroup(array('span' => count($this->_columns))));
1213 $tokens = $this->pagingTokens($this->getTotal(),
1214 count($this->_columns),
1215 $this->_options['limit']);
1216 if ($tokens === false) {
1217 $table->pushContent(HTML::thead($row),
1218 HTML::tbody(false, $rows));
1222 $paging = Template("pagelink", $tokens);
1223 if ($this->_options['paging'] != 'bottom')
1224 $table->pushContent(HTML::thead($paging));
1225 $table->pushContent(HTML::tbody(false, HTML($row, $rows)));
1226 if ($this->_options['paging'] != 'top')
1227 $table->pushContent(HTML::tfoot($paging));
1230 $table->pushContent(HTML::thead($row),
1231 HTML::tbody(false, $rows));
1236 function _jsFlipAll() {
1238 function flipAll(formObj) {
1239 var isFirstSet = -1;
1240 for (var i=0; i < formObj.length; i++) {
1241 fldObj = formObj.elements[i];
1242 if ((fldObj.type == 'checkbox') && (fldObj.name.substring(0,2) == 'p[')) {
1243 if (isFirstSet == -1)
1244 isFirstSet = (fldObj.checked) ? true : false;
1245 fldObj.checked = (isFirstSet) ? false : true;
1251 // 'cols' - split into several columns
1252 // 'azhead' - support <h3> grouping into initials
1253 // 'ordered' - OL or UL list (not yet inherited to all plugins)
1254 // 'comma' - condensed comma-list only, 1: no links, >1: with links
1255 function _generateList($caption='') {
1256 if (empty($this->_pages)) return; // stop recursion
1259 $out->pushContent(HTML::p($caption));
1261 // need a recursive switch here for the azhead and cols grouping.
1262 if (!empty($this->_options['cols']) and $this->_options['cols'] > 1) {
1263 $count = count($this->_pages);
1264 $length = $count / $this->_options['cols'];
1265 $width = sprintf("%d", 100 / $this->_options['cols']).'%';
1266 $cols = HTML::tr(array('valign' => 'top'));
1267 for ($i=0; $i < $count; $i += $length) {
1268 $save_pages = $this->_pages;
1269 $save_cols = $this->_options['cols'];
1270 $this->_options['cols'] = 0; // avoid endless recursion!
1271 $this->_pages = array_slice($this->_pages, $i, $length);
1272 $cols->pushContent(HTML::td(/*array('width' => $width),*/
1273 $this->_generateList()));
1274 $this->_pages = $save_pages;
1275 $this->_options['cols'] = $save_cols;
1277 // speed up table rendering by defining colgroups
1278 $out->pushContent(HTML::table(HTML::colgroup(array('span' => $this->_options['cols'],
1279 'width' => $width)),
1284 // Ignore azhead if not sorted by pagename
1285 if (!empty($this->_options['azhead'])
1286 and strstr($this->sortby($this->_options['sortby'], 'init'), "pagename")
1289 $cur_h = substr($this->_pages[0]->getName(), 0, 1);
1290 $out->pushContent(HTML::h3($cur_h));
1291 // group those pages together with same $h
1293 for ($i=0; $i < count($this->_pages); $i++) {
1294 $page =& $this->_pages[$i];
1295 $h = substr($page->getName(), 0, 1);
1296 if ($h != $cur_h and $i > $j) {
1297 $save_pages = $this->_pages;
1298 $save_cols = $this->_options['cols'];
1299 $save_azhead = $this->_options['azhead'];
1300 $this->_options['cols'] = 0; // avoid endless recursion!
1301 $this->_options['azhead'] = 0;
1302 $this->_pages = array_slice($this->_pages, $j, $i - $j);
1303 $out->pushContent($this->_generateList());
1304 $this->_pages = $save_pages;
1305 $this->_options['cols'] = $save_cols;
1306 $this->_options['azhead'] = $save_azhead;
1308 $out->pushContent(HTML::h3($h));
1315 if (!empty($this->_options['comma'])) {
1316 if ($this->_options['comma'] == 1)
1317 $out->pushContent($this->_generateCommaListAsString());
1319 $out->pushContent($this->_generateCommaList($this->_options['comma']));
1323 $do_paging = ( isset($this->_options['paging'])
1324 and !empty($this->_options['limit'])
1325 and $this->getTotal()
1326 and $this->_options['paging'] != 'none' );
1328 $tokens = $this->pagingTokens($this->getTotal(),
1329 count($this->_columns),
1330 $this->_options['limit']);
1332 $paging = Template("pagelink", $tokens);
1333 $out->pushContent(HTML::table($paging));
1336 if (!empty($this->_options['ordered']))
1337 $list = HTML::ol(array('class' => 'pagelist'));
1339 $list = HTML::ul(array('class' => 'pagelist'));
1341 foreach ($this->_pages as $pagenum => $page) {
1342 $pagehtml = $this->_renderPageRow($page);
1343 $group = ($i++ / $this->_group_rows);
1344 //TODO: here we switch every row, in tables every third.
1345 // unification or parametrized?
1346 $class = ($group % 2) ? 'oddrow' : 'evenrow';
1347 $list->pushContent(HTML::li(array('class' => $class), $pagehtml));
1349 $out->pushContent($list);
1350 if ( $do_paging and $tokens ) {
1351 $out->pushContent(HTML::table($paging));
1357 // Condense list without a href links: "Page1, Page2, ..."
1358 // Alternative $seperator = HTML::Raw(' · ')
1359 function _generateCommaListAsString() {
1360 if (defined($this->_options['commasep']))
1361 $seperator = $this->_options['commasep'];
1365 foreach ($this->_pages as $pagenum => $page) {
1366 if ($s = $this->_renderPageRow($page)) // some pages are not viewable
1367 $pages[] = is_string($s) ? $s : $s->asString();
1369 return HTML(join($seperator, $pages));
1373 // Normal WikiLink list.
1374 // Future: 1 = reserved for plain string (see above)
1375 // 2 and more => HTML link specialization?
1376 function _generateCommaList($style = false) {
1377 if (defined($this->_options['commasep']))
1378 $seperator = HTLM::Raw($this->_options['commasep']);
1382 $html->pushContent($this->_renderPageRow($this->_pages[0]));
1383 next($this->_pages);
1384 foreach ($this->_pages as $pagenum => $page) {
1385 if ($s = $this->_renderPageRow($page)) // some pages are not viewable
1386 $html->pushContent($seperator, $s);
1391 function _emptyList($caption) {
1394 $html->pushContent(HTML::p($caption));
1395 if ($this->_messageIfEmpty)
1396 $html->pushContent(HTML::blockquote(HTML::p($this->_messageIfEmpty)));
1402 /* List pages with checkboxes to select from.
1403 * The [Select] button toggles via _jsFlipAll
1406 class PageList_Selectable
1409 function PageList_Selectable ($columns=false, $exclude=false, $options = false) {
1411 if (!is_array($columns))
1412 $columns = explode(',', $columns);
1413 if (!in_array('checkbox',$columns))
1414 array_unshift($columns,'checkbox');
1416 $columns = array('checkbox','pagename');
1418 $this->PageList($columns, $exclude, $options);
1421 function addPageList ($array) {
1422 while (list($pagename,$selected) = each($array)) {
1423 if ($selected) $this->addPageSelected((string)$pagename);
1424 $this->addPage((string)$pagename);
1428 function addPageSelected ($pagename) {
1429 $this->_selected[$pagename] = 1;
1433 // $Log: not supported by cvs2svn $
1434 // Revision 1.118 2004/11/01 10:43:55 rurban
1435 // seperate PassUser methods into seperate dir (memory usage)
1436 // fix WikiUser (old) overlarge data session
1437 // remove wikidb arg from various page class methods, use global ->_dbi instead
1440 // Revision 1.117 2004/10/14 21:06:01 rurban
1441 // fix dumphtml with USE_PATH_INFO (again). fix some PageList refs
1443 // Revision 1.116 2004/10/14 19:19:33 rurban
1444 // loadsave: check if the dumped file will be accessible from outside.
1445 // and some other minor fixes. (cvsclient native not yet ready)
1447 // Revision 1.115 2004/10/14 17:15:05 rurban
1448 // remove class _PageList_Page, fix sortby=0 (start with 1, use strings), fix _PageList_Column_content for old phps, hits as int
1450 // Revision 1.114 2004/10/12 13:13:19 rurban
1451 // php5 compatibility (5.0.1 ok)
1453 // Revision 1.113 2004/10/05 17:00:03 rurban
1454 // support paging for simple lists
1455 // fix RatingDb sql backend.
1456 // remove pages from AllPages (this is ListPages then)
1458 // Revision 1.112 2004/10/04 23:39:58 rurban
1459 // list of page objects
1461 // Revision 1.111 2004/09/24 18:50:45 rurban
1462 // fix paging of SqlResult
1464 // Revision 1.110 2004/09/17 14:43:31 rurban
1467 // Revision 1.109 2004/09/17 14:22:10 rurban
1470 // Revision 1.108 2004/09/17 12:46:22 rurban
1471 // seperate pagingTokens()
1472 // support new default args: comma (1 and 2), commasep, ordered, cols,
1475 // Revision 1.107 2004/09/14 10:29:08 rurban
1476 // exclude pages already in addPages to simplify plugins
1478 // Revision 1.106 2004/09/06 10:22:14 rurban
1479 // oops, forgot global request
1481 // Revision 1.105 2004/09/06 08:38:30 rurban
1482 // modularize paging helper (for SqlResult)
1484 // Revision 1.104 2004/08/18 11:01:55 rurban
1485 // fixed checkbox list Select button:
1486 // no GET request on click,
1487 // only select the list checkbox entries, no other options.
1489 // Revision 1.103 2004/07/09 10:06:49 rurban
1490 // Use backend specific sortby and sortable_columns method, to be able to
1491 // select between native (Db backend) and custom (PageList) sorting.
1492 // Fixed PageList::AddPageList (missed the first)
1493 // Added the author/creator.. name to AllPagesBy...
1494 // display no pages if none matched.
1495 // Improved dba and file sortby().
1496 // Use &$request reference
1498 // Revision 1.102 2004/07/08 21:32:35 rurban
1499 // Prevent from more warnings, minor db and sort optimizations
1501 // Revision 1.101 2004/07/08 19:04:41 rurban
1502 // more unittest fixes (file backend, metadata RatingsDb)
1504 // Revision 1.100 2004/07/07 15:02:26 dfrankow
1505 // Take out if that prevents column sorting
1507 // Revision 1.99 2004/07/02 18:49:02 dfrankow
1508 // Change one line so that if addPageList() is passed null, it is still
1509 // okay. The unit tests do this (ask to list AllUsers where there are no
1510 // users, or something like that).
1512 // Revision 1.98 2004/07/01 08:51:22 rurban
1513 // dumphtml: added exclude, print pagename before processing
1515 // Revision 1.97 2004/06/29 09:11:10 rurban
1516 // More memory optimization:
1517 // don't cache unneeded _cached_html and %content for content and size columns
1518 // (only if sortable, which will fail for too many pages)
1520 // Revision 1.96 2004/06/29 08:47:42 rurban
1521 // Memory optimization (reference to parent, smart bool %content)
1522 // Fixed class grouping in table
1524 // Revision 1.95 2004/06/28 19:00:01 rurban
1525 // removed non-portable LIMIT 1 (it's getOne anyway)
1526 // removed size from info=most: needs to much memory
1528 // Revision 1.94 2004/06/27 10:26:02 rurban
1529 // oci8 patch by Philippe Vanhaesendonck + some ADODB notes+fixes
1531 // Revision 1.93 2004/06/25 14:29:17 rurban
1532 // WikiGroup refactoring:
1533 // global group attached to user, code for not_current user.
1534 // improved helpers for special groups (avoid double invocations)
1535 // new experimental config option ENABLE_XHTML_XML (fails with IE, and document.write())
1536 // fixed a XHTML validation error on userprefs.tmpl
1538 // Revision 1.92 2004/06/21 17:01:39 rurban
1539 // fix typo and rating method call
1541 // Revision 1.91 2004/06/21 16:22:29 rurban
1542 // add DEFAULT_DUMP_DIR and HTML_DUMP_DIR constants, for easier cmdline dumps,
1543 // fixed dumping buttons locally (images/buttons/),
1544 // support pages arg for dumphtml,
1545 // optional directory arg for dumpserial + dumphtml,
1546 // fix a AllPages warning,
1547 // show dump warnings/errors on DEBUG,
1548 // don't warn just ignore on wikilens pagelist columns, if not loaded.
1549 // RateIt pagelist column is called "rating", not "ratingwidget" (Dan?)
1551 // Revision 1.90 2004/06/18 14:38:21 rurban
1552 // adopt new PageList style
1554 // Revision 1.89 2004/06/17 13:16:08 rurban
1555 // apply wikilens work to PageList: all columns are sortable (slightly fixed)
1557 // Revision 1.88 2004/06/14 11:31:35 rurban
1558 // renamed global $Theme to $WikiTheme (gforge nameclash)
1559 // inherit PageList default options from PageList
1560 // default sortby=pagename
1561 // use options in PageList_Selectable (limit, sortby, ...)
1562 // added action revert, with button at action=diff
1563 // added option regex to WikiAdminSearchReplace
1565 // Revision 1.87 2004/06/13 16:02:12 rurban
1566 // empty list of pages if user=[] and not authenticated.
1568 // Revision 1.86 2004/06/13 15:51:37 rurban
1569 // Support pagelist filter for current author,owner,creator by []
1571 // Revision 1.85 2004/06/13 15:33:19 rurban
1572 // new support for arguments owner, author, creator in most relevant
1573 // PageList plugins. in WikiAdmin* via preSelectS()
1575 // Revision 1.84 2004/06/08 13:51:56 rurban
1576 // some comments only
1578 // Revision 1.83 2004/05/18 13:35:39 rurban
1579 // improve Pagelist layout by equal pagename width for limited lists
1581 // Revision 1.82 2004/05/16 22:07:35 rurban
1582 // check more config-default and predefined constants
1583 // various PagePerm fixes:
1584 // fix default PagePerms, esp. edit and view for Bogo and Password users
1585 // implemented Creator and Owner
1586 // BOGOUSERS renamed to BOGOUSER
1587 // fixed syntax errors in signin.tmpl
1589 // Revision 1.81 2004/05/13 12:30:35 rurban
1590 // fix for MacOSX border CSS attr, and if sort buttons are not found
1592 // Revision 1.80 2004/04/20 00:56:00 rurban
1593 // more paging support and paging fix for shorter lists
1595 // Revision 1.79 2004/04/20 00:34:16 rurban
1596 // more paging support
1598 // Revision 1.78 2004/04/20 00:06:03 rurban
1599 // themable paging support
1601 // Revision 1.77 2004/04/18 01:11:51 rurban
1602 // more numeric pagename fixes.
1603 // fixed action=upload with merge conflict warnings.
1604 // charset changed from constant to global (dynamic utf-8 switching)
1607 // (c-file-style: "gnu")
1611 // c-basic-offset: 4
1612 // c-hanging-comment-ender-p: nil
1613 // indent-tabs-mode: nil