1 <?php rcs_id('$Id: PageList.php,v 1.69 2004-03-17 20:23:43 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 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 * 'owner' _("Owner"), //todo: implement this again for PagePerm
25 * 'group' _("Group"), //todo: implement this for PagePerm
27 * More columns for special plugins:
28 * Todo: move this admin action away, not really an info column
29 * 'checkbox' A selectable checkbox appears at the left.
30 * 'remove' _("Remove")
31 * 'perm' _("Permission Mask")
33 * 'renamed_pagename' _("Rename to")
36 * Symbolic 'info=' arguments:
37 * 'all' All columns except remove, content and renamed_pagename
38 * 'most' pagename, mtime, author, size, hits, ...
39 * 'some' pagename, mtime, author
41 * FIXME: In this refactoring I have un-implemented _ctime, _cauthor, and
42 * number-of-revision. Note the _ctime and _cauthor as they were implemented
43 * were somewhat flawed: revision 1 of a page doesn't have to exist in the
44 * database. If lots of revisions have been made to a page, it's more than likely
45 * that some older revisions (include revision 1) have been cleaned (deleted).
48 * limit, offset, rows arguments for multiple pages/multiple rows.
50 * check PagePerm "list" access-type
52 * ->supportedArgs() which arguments are supported, so that the plugin
53 * doesn't explictly need to declare it
55 class _PageList_Column_base {
56 var $_tdattr = array();
58 function _PageList_Column_base ($default_heading, $align = false) {
59 $this->_heading = $default_heading;
62 // align="char" isn't supported by any browsers yet :(
63 //if (is_array($align))
64 // $this->_tdattr = $align;
66 $this->_tdattr['align'] = $align;
70 function format ($pagelist, $page_handle, &$revision_handle) {
71 return HTML::td($this->_tdattr,
73 $this->_getValue($page_handle, $revision_handle),
77 function setHeading ($heading) {
78 $this->_heading = $heading;
83 if (in_array($this->_field,PageList::sortable_columns())) {
84 // multiple comma-delimited sortby args: "+hits,+pagename"
85 // asc or desc: +pagename, -pagename
86 $sortby = PageList::sortby($this->_field,'flip_order');
87 //Fixme: pass all also other GET args along. (limit, p[])
88 $s = HTML::a(array('href' =>
89 $GLOBALS['request']->GetURLtoSelf(array('sortby' => $sortby,
91 'class' => 'pagetitle',
92 'title' => sprintf(_("Sort by %s"),$this->_field)),
93 HTML::raw(' '), HTML::u($this->_heading), HTML::raw(' '));
95 $s = HTML(HTML::raw(' '), HTML::u($this->_heading), HTML::raw(' '));
97 return HTML::th(array('align' => 'center'),$s);
102 function button_heading () {
103 global $Theme, $request;
105 if (in_array($this->_field,PageList::sortable_columns())) {
106 // multiple comma-delimited sortby args: "+hits,+pagename"
108 $noimg = HTML::img(array('src' => $Theme->getButtonURL('no_order'),
112 if ($request->getArg('sortby')) {
113 if (PageList::sortby($this->_field,'check')) { // show icon?
114 $sortby = PageList::sortby($request->getArg('sortby'),'flip_order');
115 $request->setArg('sortby',$sortby);
116 $desc = (substr($sortby,0,1) == '-'); // asc or desc? (+pagename, -pagename)
117 $src = $Theme->getButtonURL($desc ? 'asc_order' : 'desc_order');
119 $sortby = PageList::sortby($this->_field,'init');
122 $sortby = PageList::sortby($this->_field,'init');
126 $img->setAttr('alt', _("Click to sort"));
128 $img = HTML::img(array('src' => $src,
131 'alt' => _("Click to reverse sort order")));
133 $s = HTML::a(array('href' =>
134 //Fixme: pass all also other GET args along. (limit, p[])
135 //Fixme: convert to POST submit[sortby]
136 $request->GetURLtoSelf(array('sortby' => $sortby,
138 'class' => 'gridbutton',
139 'title' => sprintf(_("Click to sort by %s"),$this->_field)),
146 HTML::raw(' '));
148 $s = HTML(HTML::raw(' '), $this->_heading, HTML::raw(' '));
150 return HTML::th(array('align' => 'center', 'valign' => 'middle',
151 'class' => 'gridbutton'), $s);
155 class _PageList_Column extends _PageList_Column_base {
156 function _PageList_Column ($field, $default_heading, $align = false) {
157 $this->_PageList_Column_base($default_heading, $align);
159 $this->_need_rev = substr($field, 0, 4) == 'rev:';
160 $this->_iscustom = substr($field, 0, 7) == 'custom:';
161 if ($this->_iscustom)
162 $this->_field = substr($field, 7);
163 elseif ($this->_need_rev)
164 $this->_field = substr($field, 4);
166 $this->_field = $field;
169 function _getValue ($page_handle, &$revision_handle) {
170 if ($this->_need_rev) {
171 if (!$revision_handle)
172 $revision_handle = $page_handle->getCurrentRevision();
173 return $revision_handle->get($this->_field);
176 return $page_handle->get($this->_field);
181 class _PageList_Column_size extends _PageList_Column {
182 function _getValue ($page_handle, &$revision_handle) {
183 if (!$revision_handle)
184 $revision_handle = $page_handle->getCurrentRevision();
185 return $this->_getSize($revision_handle);
188 function _getSize($revision_handle) {
189 $bytes = @strlen($revision_handle->_data['%content']);
190 return ByteFormatter($bytes);
195 class _PageList_Column_bool extends _PageList_Column {
196 function _PageList_Column_bool ($field, $default_heading, $text = 'yes') {
197 $this->_PageList_Column($field, $default_heading, 'center');
198 $this->_textIfTrue = $text;
199 $this->_textIfFalse = new RawXml('—'); //mdash
202 function _getValue ($page_handle, &$revision_handle) {
203 $val = _PageList_Column::_getValue($page_handle, $revision_handle);
204 return $val ? $this->_textIfTrue : $this->_textIfFalse;
208 class _PageList_Column_checkbox extends _PageList_Column {
209 function _PageList_Column_checkbox ($field, $default_heading, $name='p') {
210 $this->_name = $name;
211 $heading = HTML::input(array('type' => 'button',
212 'title' => _("Click to de-/select all pages"),
214 'name' => $default_heading,
215 'value' => $default_heading,
216 'onclick' => "flipAll(this.form)"
218 $this->_PageList_Column($field, $heading, 'center');
220 function _getValue ($pagelist, $page_handle, &$revision_handle) {
221 $pagename = $page_handle->getName();
222 $selected = !empty($pagelist->_selected[$pagename]);
223 if (strstr($pagename,'[') or strstr($pagename,']')) {
224 $pagename = str_replace(array('[',']'),array('%5B','%5D'),$pagename);
227 return HTML::input(array('type' => 'checkbox',
228 'name' => $this->_name . "[$pagename]",
230 'checked' => 'CHECKED'));
232 return HTML::input(array('type' => 'checkbox',
233 'name' => $this->_name . "[$pagename]",
237 function format ($pagelist, $page_handle, &$revision_handle) {
238 return HTML::td($this->_tdattr,
240 $this->_getValue($pagelist, $page_handle, $revision_handle),
241 HTML::raw(' '));
245 class _PageList_Column_time extends _PageList_Column {
246 function _PageList_Column_time ($field, $default_heading) {
247 $this->_PageList_Column($field, $default_heading, 'right');
249 $this->Theme = &$Theme;
252 function _getValue ($page_handle, &$revision_handle) {
253 $time = _PageList_Column::_getValue($page_handle, $revision_handle);
254 return $this->Theme->formatDateTime($time);
258 class _PageList_Column_version extends _PageList_Column {
259 function _getValue ($page_handle, &$revision_handle) {
260 if (!$revision_handle)
261 $revision_handle = $page_handle->getCurrentRevision();
262 return $revision_handle->getVersion();
266 // If needed this could eventually become a subclass
267 // of a new _PageList_Column_action class for other actions.
268 // only for WikiAdminRemove or WikiAdminSelect
269 class _PageList_Column_remove extends _PageList_Column {
270 function _getValue ($page_handle, &$revision_handle) {
271 return Button(array('action' => 'remove'), _("Remove"),
272 $page_handle->getName());
276 // only for WikiAdminRename
277 class _PageList_Column_renamed_pagename extends _PageList_Column {
278 function _getValue ($page_handle, &$revision_handle) {
279 $post_args = $GLOBALS['request']->getArg('admin_rename');
280 $value = str_replace($post_args['from'], $post_args['to'],$page_handle->getName());
281 $div = HTML::div(" => ",HTML::input(array('type' => 'text',
282 'name' => 'rename[]',
283 'value' => $value)));
284 $new_page = $GLOBALS['request']->getPage($value);
285 if ($new_page->exists()) {
286 $div->setAttr('class','error');
287 $div->setAttr('title',_("This page already exists"));
293 // Output is hardcoded to limit of first 50 bytes. Otherwise
294 // on very large Wikis this will fail if used with AllPages
295 // (PHP memory limit exceeded)
296 class _PageList_Column_content extends _PageList_Column {
297 function _PageList_Column_content ($field, $default_heading, $align = false) {
298 _PageList_Column::_PageList_Column($field, $default_heading, $align);
300 if ($field == 'content') {
301 $this->_heading .= sprintf(_(" ... first %d bytes"),
303 } elseif ($field == 'hi_content') {
304 if (!empty($_POST['admin_replace'])) {
305 $search = $_POST['admin_replace']['from'];
306 $this->_heading .= sprintf(_(" ... around %s"),
311 function _getValue ($page_handle, &$revision_handle) {
312 if (!$revision_handle)
313 $revision_handle = $page_handle->getCurrentRevision();
314 // Not sure why implode is needed here, I thought
315 // getContent() already did this, but it seems necessary.
316 $c = implode("\n", $revision_handle->getContent());
317 if ($this->_field == 'hi_content') {
318 $search = $_POST['admin_replace']['from'];
319 if ($search and ($i = strpos($c,$search))) {
320 $l = strlen($search);
321 $j = max(0,$i - ($this->bytes / 2));
322 return HTML::div(array('style' => 'font-size:x-small'),
323 HTML::div(array('class' => 'transclusion'),
324 HTML::span(substr($c, $j, ($this->bytes / 2))),
325 HTML::span(array("style"=>"background:yellow"),$search),
326 HTML::span(substr($c, $i+$l, ($this->bytes / 2))))
329 $c = sprintf(_("%s not found"),
331 return HTML::div(array('style' => 'font-size:x-small','align'=>'center'),
334 } elseif (($len = strlen($c)) > $this->bytes) {
335 $c = substr($c, 0, $this->bytes);
337 include_once('lib/BlockParser.php');
338 // false --> don't bother processing hrefs for embedded WikiLinks
339 $ct = TransformText($c, $revision_handle->get('markup'), false);
340 return HTML::div(array('style' => 'font-size:x-small'),
341 HTML::div(array('class' => 'transclusion'), $ct),
342 // Don't show bytes here if size column present too
343 ($this->parent->_columns_seen['size'] or !$len) ? "" :
344 ByteFormatter($len, /*$longformat = */true));
348 class _PageList_Column_author extends _PageList_Column {
349 function _PageList_Column_author ($field, $default_heading, $align = false) {
350 _PageList_Column::_PageList_Column($field, $default_heading, $align);
351 global $WikiNameRegexp, $request;
352 $this->WikiNameRegexp = $WikiNameRegexp;
353 $this->dbi = &$request->getDbh();
356 function _getValue ($page_handle, &$revision_handle) {
357 $author = _PageList_Column::_getValue($page_handle, $revision_handle);
358 if (preg_match("/^$this->WikiNameRegexp\$/", $author) && $this->dbi->isWikiPage($author))
359 return WikiLink($author);
365 class _PageList_Column_perm extends _PageList_Column {
366 function _getValue ($page_handle, &$revision_handle) {
367 $perm_array = pagePermissions($page_handle->_pagename);
368 return pagePermissionsSimpleFormat($perm_array,
369 $page_handle->get('author'),$page_handle->get('group'));
372 var_dump($perm_array);
373 $xml = ob_get_contents();
380 class _PageList_Column_acl extends _PageList_Column {
381 function _getValue ($page_handle, &$revision_handle) {
382 $perm_tree = pagePermissions($page_handle->_pagename);
383 return pagePermissionsAclFormat($perm_tree);
386 var_dump($perm_array);
387 $xml = ob_get_contents();
394 class _PageList_Column_pagename extends _PageList_Column_base {
395 var $_field = 'pagename';
397 function _PageList_Column_pagename () {
398 $this->_PageList_Column_base(_("Page Name"));
400 $this->dbi = &$request->getDbh();
403 function _getValue ($page_handle, &$revision_handle) {
404 if ($this->dbi->isWikiPage($page_handle->getName()))
405 return WikiLink($page_handle);
407 return WikiLink($page_handle, 'unknown');
414 var $_group_rows = 3;
415 var $_columns = array();
416 var $_excluded_pages = array();
417 var $_rows = array();
419 var $_pagename_seen = false;
420 var $_types = array();
421 var $_options = array();
422 var $_selected = array();
423 var $_sortby = array();
425 function PageList ($columns = false, $exclude = false, $options = false) {
426 $this->_initAvailableColumns();
429 'all' => array_diff(array_keys($this->_types), // all but...
430 array('checkbox','remove','renamed_pagename',
431 'content','hi_content','perm','acl')),
432 'most' => array('pagename','mtime','author','size','hits'),
433 'some' => array('pagename','mtime','author')
436 if (!is_array($columns))
437 $columns = explode(',', $columns);
438 // expand symbolic columns:
439 foreach ($symbolic_columns as $symbol => $cols) {
440 if (in_array($symbol,$columns)) { // e.g. 'checkbox,all'
441 $columns = array_diff(array_merge($columns,$cols),array($symbol));
444 if (!in_array('pagename',$columns))
445 $this->_addColumn('pagename');
446 foreach ($columns as $col) {
447 $this->_addColumn($col);
450 $this->_addColumn('pagename');
452 $this->_options = $options;
453 if (!empty($options) and !empty($options['sortby'])) {
454 $sortby = $options['sortby'];
456 $sortby = $GLOBALS['request']->getArg('sortby');
458 $this->sortby($sortby,'init');
459 if (!empty($options) and !empty($options['limit'])) {
460 $limit = $options['limit'];
462 $limit = $GLOBALS['request']->getArg('limit');
465 if (!is_array($exclude))
466 $exclude = $this->explodePageList($exclude,false,$sortby,$limit);
467 $this->_excluded_pages = $exclude;
470 $this->_messageIfEmpty = _("<no matches>");
473 // Currently PageList takes these arguments:
474 // 1: info, 2: exclude, 3: hash of options
475 // Here we declare which options are supported, so that
476 // the calling plugin may simply merge this with its own default arguments
477 function supportedArgs () {
478 return array(//Currently supported options:
479 'info' => 'pagename',
480 'exclude' => '', // also wildcards and comma-seperated lists
482 // for the sort buttons in <th>
483 'sortby' => '', // same as for WikiDB::getAllPages
485 //PageList pager options:
486 // These options may also be given to _generate(List|Table) later
487 // But limit and offset might help the query WikiDB::getAllPages()
488 //cols => 1, // side-by-side display of list (1-3)
489 //limit => 50, // length of one column
490 //offset => 0, // needed internally for the pager
491 //paging => 'auto', // '': normal paging mode
492 // // 'auto': drop 'info' columns and enhance rows
493 // // when the list becomes large
494 // // 'none': don't page at all
498 function setCaption ($caption_string) {
499 $this->_caption = $caption_string;
502 function getCaption () {
503 // put the total into the caption if needed
504 if (is_string($this->_caption) && strstr($this->_caption, '%d'))
505 return sprintf($this->_caption, $this->getTotal());
506 return $this->_caption;
509 function setMessageIfEmpty ($msg) {
510 $this->_messageIfEmpty = $msg;
514 function getTotal () {
515 return count($this->_rows);
518 function isEmpty () {
519 return empty($this->_rows);
522 function addPage ($page_handle) {
523 if (is_string($page_handle)) {
524 if (empty($page_handle)) return;
525 if (in_array($page_handle, $this->_excluded_pages))
526 return; // exclude page.
527 $dbi = $GLOBALS['request']->getDbh();
528 $page_handle = $dbi->getPage($page_handle);
529 } elseif (is_object($page_handle)) {
530 if (in_array($page_handle->getName(), $this->_excluded_pages))
531 return; // exclude page.
533 //FIXME. only on sf.net
534 if (!is_object($page_handle)) {
535 trigger_error("PageList: Invalid page_handle $page_handle", E_USER_WARNING);
538 // enforce view permission
539 if (!mayAccessPage('view',$page_handle->getName()))
542 $group = (int)(count($this->_rows) / $this->_group_rows);
543 $class = ($group % 2) ? 'oddrow' : 'evenrow';
544 $revision_handle = false;
546 if (count($this->_columns) > 1) {
547 $row = HTML::tr(array('class' => $class));
548 foreach ($this->_columns as $col)
549 $row->pushContent($col->format($this, $page_handle, $revision_handle));
552 $col = $this->_columns[0];
553 $row = HTML::li(array('class' => $class),
554 $col->_getValue($page_handle, $revision_handle));
557 $this->_rows[] = $row;
560 function addPages ($page_iter) {
561 while ($page = $page_iter->next())
562 $this->addPage($page);
565 function addPageList (&$list) {
567 while ($page = next($list))
568 $this->addPage($page);
571 function getContent() {
572 // Note that the <caption> element wants inline content.
573 $caption = $this->getCaption();
575 if ($this->isEmpty())
576 return $this->_emptyList($caption);
577 elseif (count($this->_columns) == 1)
578 return $this->_generateList($caption);
580 return $this->_generateTable($caption);
583 function printXML() {
584 PrintXML($this->getContent());
588 return AsXML($this->getContent());
591 function sortable_columns() {
592 return array('pagename','mtime','hits');
596 * Handles sortby requests for the DB iterator and table header links
597 * Prefix the column with + or - like "+pagename","-mtime", ...
598 * supported columns: 'pagename','mtime','hits'
599 * supported actions: 'flip_order' "mtime" => "+mtime" => "-mtime" ...
600 * 'db' "-pagename" => "pagename DESC"
602 function sortby ($column, $action) {
603 if (empty($column)) return;
604 //support multiple comma-delimited sortby args: "+hits,+pagename"
605 if (strstr($column,',')) {
607 foreach (explode(',',$column) as $col) {
608 $result[] = $this->sortby($col,$action);
610 return join(",",$result);
612 if (substr($column,0,1) == '+') {
613 $order = '+'; $column = substr($column,1);
614 } elseif (substr($column,0,1) == '-') {
615 $order = '-'; $column = substr($column,1);
617 if (in_array($column,PageList::sortable_columns())) {
618 // default order: +pagename, -mtime, -hits
620 if (in_array($column,array('mtime','hits')))
624 if ($action == 'flip_order') {
625 return ($order == '+' ? '-' : '+') . $column;
626 } elseif ($action == 'init') {
627 $this->_sortby[$column] = $order;
628 return $order . $column;
629 } elseif ($action == 'check') {
630 return (!empty($this->_sortby[$column]) or
631 ($GLOBALS['request']->getArg('sortby') and
632 strstr($GLOBALS['request']->getArg('sortby'),$column)));
633 } elseif ($action == 'db') {
634 // asc or desc: +pagename, -pagename
635 return $column . ($order == '+' ? ' ASC' : ' DESC');
641 // echo implode(":",explodeList("Test*",array("xx","Test1","Test2")));
642 function explodePageList($input, $perm = false, $sortby=false, $limit=false) {
643 // expand wildcards from list of all pages
644 if (preg_match('/[\?\*]/',$input)) {
645 $dbi = $GLOBALS['request']->getDbh();
646 $allPagehandles = $dbi->getAllPages($perm,$sortby,$limit);
647 while ($pagehandle = $allPagehandles->next()) {
648 $allPages[] = $pagehandle->getName();
650 return explodeList($input, $allPages);
652 //TODO: do the sorting, normally not needed if used for exclude only
653 return explode(',',$input);
661 //Performance Fixme: Initialize only the requested objects
662 function _initAvailableColumns() {
663 if (!empty($this->_types))
669 => new _PageList_Column_content('rev:content', _("Content")),
670 'hi_content' // with highlighted search for SearchReplace
671 => new _PageList_Column_content('rev:hi_content', _("Content")),
673 => new _PageList_Column_remove('remove', _("Remove")),
675 => new _PageList_Column_renamed_pagename('rename', _("Rename to")),
677 => new _PageList_Column_perm('perm', _("Permission")),
679 => new _PageList_Column_acl('acl', _("ACL")),
681 => new _PageList_Column_checkbox('p', _("Select")),
683 => new _PageList_Column_pagename,
685 => new _PageList_Column_time('rev:mtime', _("Last Modified")),
687 => new _PageList_Column('hits', _("Hits"), 'right'),
689 => new _PageList_Column_size('rev:size', _("Size"), 'right'),
690 /*array('align' => 'char', 'char' => ' ')*/
692 => new _PageList_Column('rev:summary', _("Last Summary")),
694 => new _PageList_Column_version('rev:version', _("Version"),
697 => new _PageList_Column_author('rev:author', _("Last Author")),
699 => new _PageList_Column_author('owner', _("Owner")),
701 => new _PageList_Column_author('group', _("Group")),
703 => new _PageList_Column_bool('locked', _("Locked"),
706 => new _PageList_Column_bool('rev:is_minor_edit',
707 _("Minor Edit"), _("minor")),
709 => new _PageList_Column('rev:markup', _("Markup"))
713 function _addColumn ($column) {
715 $this->_initAvailableColumns();
717 if (isset($this->_columns_seen[$column]))
718 return false; // Already have this one.
719 $this->_columns_seen[$column] = true;
721 if (strstr($column, ':'))
722 list ($column, $heading) = explode(':', $column, 2);
724 if (!isset($this->_types[$column])) {
725 trigger_error(sprintf("%s: Bad column", $column), E_USER_NOTICE);
729 $col = $this->_types[$column];
730 if (!empty($heading))
731 $col->setHeading($heading);
733 $this->_columns[] = $col;
738 // make a table given the caption
739 function _generateTable($caption) {
740 $table = HTML::table(array('cellpadding' => 0,
743 'class' => 'pagelist'));
745 $table->pushContent(HTML::caption(array('align'=>'top'), $caption));
747 //Warning: This is quite fragile. It depends solely on a private variable
749 if (!empty($this->_columns_seen['checkbox'])) {
750 $table->pushContent($this->_jsFlipAll());
753 $table_summary = array();
754 foreach ($this->_columns as $col) {
755 $row->pushContent($col->button_heading());
756 if (is_string($col->_heading))
757 $table_summary[] = $col->_heading;
759 // Table summary for non-visual browsers.
760 $table->setAttr('summary', sprintf(_("Columns: %s."),
761 implode(", ", $table_summary)));
763 $table->pushContent(HTML::thead($row),
764 HTML::tbody(false, $this->_rows));
768 function _jsFlipAll() {
770 function flipAll(formObj) {
772 for (var i=0;i < formObj.length;i++) {
773 fldObj = formObj.elements[i];
774 if (fldObj.type == 'checkbox') {
775 if (isFirstSet == -1)
776 isFirstSet = (fldObj.checked) ? true : false;
777 fldObj.checked = (isFirstSet) ? false : true;
783 function _generateList($caption) {
784 $list = HTML::ul(array('class' => 'pagelist'), $this->_rows);
786 //Warning: This is quite fragile. It depends solely on a private variable
788 // questionable if its of use here anyway. this is a one-col list only.
789 if (!empty($this->_columns_seen['checkbox'])) {
790 $out->pushContent($this->_jsFlipAll());
793 $out->pushContent(HTML::p($caption));
794 $out->pushContent($list);
798 function _emptyList($caption) {
801 $html->pushContent(HTML::p($caption));
802 if ($this->_messageIfEmpty)
803 $html->pushContent(HTML::blockquote(HTML::p($this->_messageIfEmpty)));
809 /* List pages with checkboxes to select from.
810 * The [Select] button toggles via _jsFlipAll
813 class PageList_Selectable
816 function PageList_Selectable ($columns=false, $exclude=false) {
818 if (!is_array($columns))
819 $columns = explode(',', $columns);
820 if (!in_array('checkbox',$columns))
821 array_unshift($columns,'checkbox');
823 $columns = array('checkbox','pagename');
825 PageList::PageList($columns,$exclude);
828 function addPageList ($array) {
829 while (list($pagename,$selected) = each($array)) {
830 if ($selected) $this->addPageSelected($pagename);
831 $this->addPage($pagename);
835 function addPageSelected ($pagename) {
836 $this->_selected[$pagename] = 1;
839 //insert javascript when clicked on Selected Select/Deselect all
842 // (c-file-style: "gnu")
847 // c-hanging-comment-ender-p: nil
848 // indent-tabs-mode: nil