From 8ca5c61262404a2896233899a0bcd2c86db050ec Mon Sep 17 00:00:00 2001 From: dairiki Date: Tue, 22 Jan 2002 15:36:43 +0000 Subject: [PATCH] Minor refactor of PageList row coloring. git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@1471 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/PageList.php | 27 +++++++++++++-------------- phpwiki.css | 6 +++--- themes/Hawaiian/Hawaiian.css | 6 +++--- themes/MacOSX/MacOSX.css | 6 +++--- themes/Portland/portland.css | 6 +++--- themes/WikiTrek/WikiTrek.css | 6 +++--- 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/lib/PageList.php b/lib/PageList.php index a88a844ec..d47e0d545 100644 --- a/lib/PageList.php +++ b/lib/PageList.php @@ -1,4 +1,4 @@ -_columns = array(new _PageList_Column_pagename); $this->_pages = array(); $this->_messageIfEmpty = _(""); - $this->_use_rowcolor = true; + $this->_group_rows = 3; } function setCaption ($caption_string) { @@ -240,7 +240,8 @@ class PageList { function _generateTable($caption) { $table = HTML::table(array('cellpadding' => 0, 'cellspacing' => 1, - 'border' => 0)); + 'border' => 0, + 'class' => 'pagelist')); $table->setAttr('summary', "FIXME: add brief summary and column names"); @@ -256,20 +257,13 @@ class PageList { $tbody = HTML::tbody(); $n = 0; foreach ($this->_pages as $page_handle) { - $n++; $row = HTML::tr(); $revision_handle = false; foreach ($this->_columns as $col) { $row->pushContent($col->format($page_handle, $revision_handle)); } - if ($this->_use_rowcolor == true) { - // alternate bgcolor for 3 rows every other 3 rows - if ((($n+2)/6 == round($n/6))||(($n+1)/6 == round($n/6))||(($n)/6 == round($n/6))) { - $row->setAttr('class','pagelistcolor'); - } else { - $row->setAttr('bgcolor','pagelistnocolor'); - } - } + $group = (int)($n++ / $this->_group_rows); + $row->setAttr('class', ($group % 2) ? 'oddrow' : 'evenrow'); $tbody->pushContent($row); } $table->pushContent($tbody); @@ -277,9 +271,14 @@ class PageList { } function _generateList($caption) { - $list = HTML::ul(); + $list = HTML::ul(array('class' => 'pagelist')); + $n = 0; foreach ($this->_pages as $page_handle) { - $list->pushContent(HTML::li(LinkWikiWord($page_handle->getName()))); + $group = (int)($n++ / $this->_group_rows); + $class = ($group % 2) ? 'oddrow' : 'evenrow'; + + $list->pushContent(HTML::li(array('class' => $class), + LinkWikiWord($page_handle->getName()))); } if ($caption) $html[] = HTML::p($caption); diff --git a/phpwiki.css b/phpwiki.css index c91cc6569..c5b116330 100644 --- a/phpwiki.css +++ b/phpwiki.css @@ -1,5 +1,5 @@ /* - $Id: phpwiki.css,v 1.23 2002-01-22 09:23:09 carstenklapp Exp $ + $Id: phpwiki.css,v 1.24 2002-01-22 15:36:42 dairiki Exp $ Classes: @@ -302,8 +302,8 @@ div.wiki-edithelp { .diff ins { background: #9f9; } /* PageList output */ -tr.pagelistcolor { background: #eeeeee; } -tr.pagelistnocolor { background: white; } +tr.pagelist .evenrow { background: #eeeeee; } +tr.pagelist .oddrow { background: white; } /* For emacs users * diff --git a/themes/Hawaiian/Hawaiian.css b/themes/Hawaiian/Hawaiian.css index 48d095b4c..5d1cf8d59 100644 --- a/themes/Hawaiian/Hawaiian.css +++ b/themes/Hawaiian/Hawaiian.css @@ -1,5 +1,5 @@ /* - $Id: Hawaiian.css,v 1.12 2002-01-22 09:23:08 carstenklapp Exp $ + $Id: Hawaiian.css,v 1.13 2002-01-22 15:36:42 dairiki Exp $ Classes: @@ -266,8 +266,8 @@ div.wiki-edithelp { .diff ins { background: #9f9; } /* PageList output */ -tr.pagelistcolor { background: #eeeeee; } -tr.pagelistnocolor { background: white; } +tr.pagelist .evenrow { background: #eeeeee; } +tr.pagelist .oddrow { background: white; } /* For emacs users * diff --git a/themes/MacOSX/MacOSX.css b/themes/MacOSX/MacOSX.css index 0c201aa40..f79423410 100644 --- a/themes/MacOSX/MacOSX.css +++ b/themes/MacOSX/MacOSX.css @@ -1,5 +1,5 @@ /* - $Id: MacOSX.css,v 1.14 2002-01-22 09:23:09 carstenklapp Exp $ + $Id: MacOSX.css,v 1.15 2002-01-22 15:36:42 dairiki Exp $ Classes: @@ -256,8 +256,8 @@ div.wiki-message { .diff ins { background: #9f9; } /* PageList output */ -tr.pagelistcolor { background: #eeeeee; } -tr.pagelistnocolor { background: white; } +tr.pagelist .evenrow { background: #eeeeee; } +tr.pagelist .oddrow { background: white; } /* For emacs users * diff --git a/themes/Portland/portland.css b/themes/Portland/portland.css index 63353e024..f1c590e43 100644 --- a/themes/Portland/portland.css +++ b/themes/Portland/portland.css @@ -1,5 +1,5 @@ /** - * $Id: portland.css,v 1.3 2002-01-22 09:23:08 carstenklapp Exp $ + * $Id: portland.css,v 1.4 2002-01-22 15:36:43 dairiki Exp $ * * PhpWiki style sheet for the printed page: * Black on white only, with no toolbar commands and no link icons. @@ -56,6 +56,6 @@ img { .wiki-edithelp { font-size: smaller; } /* PageList output */ -tr.pagelistcolor { background: #eeeeee; } -tr.pagelistnocolor { background: white; } +tr.pagelist .evenrow { background: #eeeeee; } +tr.pagelist .oddrow { background: white; } diff --git a/themes/WikiTrek/WikiTrek.css b/themes/WikiTrek/WikiTrek.css index 51c64f8ce..ded7c642e 100644 --- a/themes/WikiTrek/WikiTrek.css +++ b/themes/WikiTrek/WikiTrek.css @@ -1,5 +1,5 @@ /** - * $Id: WikiTrek.css,v 1.12 2002-01-22 09:23:09 carstenklapp Exp $ + * $Id: WikiTrek.css,v 1.13 2002-01-22 15:36:43 dairiki Exp $ * * This PhpWiki theme is experimental and will likely not appear as * part of any release. ("accessories not included"--download @@ -231,6 +231,6 @@ div.wiki-edithelp { font-size: smaller; /* PageList output */ -tr.pagelistcolor { background: #222222; } -tr.pagelistnocolor { background: black; } +tr.pagelist .evenrow { background: #222222; } +tr.pagelist .oddrow { background: black; } -- 2.45.2