From 37be077dd81cdd133d87047a96551fdf12e68a8c Mon Sep 17 00:00:00 2001 From: rurban Date: Wed, 30 May 2007 20:44:59 +0000 Subject: [PATCH] added MonoBook UserContribs git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@5713 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/display.php | 9 ++- lib/plugin/RecentChanges.php | 149 ++++++++++++++++++++++++++++++----- pgsrc/UserContribs | 10 +++ themes/MonoBook/main.css | 11 +++ 4 files changed, 155 insertions(+), 24 deletions(-) create mode 100644 pgsrc/UserContribs diff --git a/lib/display.php b/lib/display.php index fcfab235f..28aeb1c30 100644 --- a/lib/display.php +++ b/lib/display.php @@ -1,6 +1,6 @@ $transformedContent)); GeneratePage($template, $pagetitle, $revision, $args); - } elseif (!$format or $format == 'html' or $format == 'sidebar') { + } elseif (!$format or $format == 'html' or $format == 'sidebar' or $format == 'contribs') { $template = Template('browse', array('CONTENT' => $transformedContent)); GeneratePage($template, $pagetitle, $revision, $args); } elseif ($format == 'xml') { @@ -295,7 +295,7 @@ function displayPage(&$request, $template=false) { $format = $request->getArg('format'); /* Only single page versions. rss only if not already handled by RecentChanges. */ - if (!$format or $format == 'html' or $format == 'sidebar') { + if (!$format or $format == 'html' or $format == 'sidebar' or $format == 'contribs') { $template->printExpansion($toks); } elseif ($format == 'xml') { $template = new Template('htmldump', $request); @@ -348,6 +348,9 @@ function displayPage(&$request, $template=false) { } // $Log: not supported by cvs2svn $ +// Revision 1.72 2007/05/13 18:13:12 rurban +// LinkDatabase format exceptions +// // Revision 1.71 2007/02/17 22:39:05 rurban // format=rss overhaul // diff --git a/lib/plugin/RecentChanges.php b/lib/plugin/RecentChanges.php index e751f407f..15142288b 100644 --- a/lib/plugin/RecentChanges.php +++ b/lib/plugin/RecentChanges.php @@ -1,5 +1,5 @@ makeButton(_("(diff)"), $this->diffURL($rev), 'wiki-rc-action'); + $button = $WikiTheme->makeButton(_("diff"), $this->diffURL($rev), 'wiki-rc-action'); $button->setAttr('rel', 'nofollow'); - return $button; + return HTML("(",$button,")"); + } + + /* deletions: red, additions: green */ + function diffSummary ($rev) { + $html = $this->diffURL($rev); + return ''; } function historyLink ($rev) { global $WikiTheme; - return $WikiTheme->makeButton(_("(hist)"), $this->historyURL($rev), 'wiki-rc-action'); + $button = $WikiTheme->makeButton(_("hist"), $this->historyURL($rev), 'wiki-rc-action'); + $button->setAttr('rel', 'nofollow'); + return HTML("(",$button,")"); } function pageLink ($rev, $link_text=false) { @@ -165,13 +173,34 @@ extends _RecentChanges_Formatter return WikiLink($rev->get('author'), 'if_known'); } + /* Link to all users contributions (contribs and owns) */ + function authorContribs ($rev) { + $author = $rev->get('author'); + if (preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/", $author)) return ''; + return HTML('(', + Button(array('action' => _("RecentChanges"), + 'format' => 'contribs', + 'author' => $author, + 'days' => 360), + _("contribs"), + $author), + ' | ', + Button(array('action' => _("RecentChanges"), + 'format' => 'contribs', + 'owner' => $author, + 'days' => 360), + _("new pages"), + $author), + ')'); + } + function summaryAsHTML ($rev) { if ( !($summary = $this->summary($rev)) ) return ''; - return HTML::strong( array('class' => 'wiki-summary'), - "[", - TransformLinks($summary, $rev->get('markup'), $rev->getPageName()), - "]"); + return HTML::span( array('class' => 'wiki-summary'), + "(", + TransformLinks($summary, $rev->get('markup'), $rev->getPageName()), + ")"); } function rss_icon () { @@ -356,6 +385,7 @@ extends _RecentChanges_Formatter if (($date = $this->date($rev)) != $last_date) { if ($lines) $html->pushContent($lines); + // for user contributions no extra date line $html->pushContent(HTML::h3($date)); $lines = HTML::ul(); $last_date = $date; @@ -364,7 +394,6 @@ extends _RecentChanges_Formatter // enforce view permission if (mayAccessPage('view', $rev->_pagename)) { $lines->pushContent($this->format_revision($rev)); - if ($first) $this->setValidators($rev); $first = false; @@ -386,26 +415,99 @@ extends _RecentChanges_Formatter $time = $this->time($rev); if (! $rev->get('is_minor_edit')) - $time = HTML::strong(array('class' => 'pageinfo-majoredit'), $time); + $time = HTML::span(array('class' => 'pageinfo-majoredit'), $time); $line = HTML::li(array('class' => $class)); - if ($args['difflinks']) $line->pushContent($this->diffLink($rev), ' '); if ($args['historylinks']) $line->pushContent($this->historyLink($rev), ' '); - $line->pushContent($this->pageLink($rev), ' ', - $time, ' ', - $this->summaryAsHTML($rev), - ' ... ', - $this->authorLink($rev)); + if (isa($GLOBALS['WikiTheme'],'Theme_MonoBook')) { + $line->pushContent( + $args['historylinks'] ? '' : $this->historyLink($rev), + ' . . ', $this->pageLink($rev), '; ', + $time, ' . . ', + $this->authorLink($rev),' ', + $this->authorContribs($rev),' ', + $this->summaryAsHTML($rev)); + } else { + $line->pushContent($this->pageLink($rev), ' ', + $time, ' ', + $this->summaryAsHTML($rev), + ' ... ', + $this->authorLink($rev)); + } return $line; } + } +/* format=contribs: no seperation into extra dates + * 14:41, 3 December 2006 (hist) (diff) Talk:PhpWiki (added diff link) (top) + */ +class _RecentChanges_UserContribsFormatter +extends _RecentChanges_HtmlFormatter +{ + function title () { + extract($this->_args); + return array(_("UserContribs"),":",$author ? $author : $owner, + ' ', + $this->rss_icon(), + HTML::raw(' '), $this->rss2_icon(), + //HTML::raw(' '), $this->grazr_icon(), + HTML::raw(' '), $this->atom_icon()); + } + + function format ($changes) { + include_once('lib/InlineParser.php'); + + $html = HTML(HTML::h2(false, $this->title())); + $lines = HTML::ol(); + $first = true; $count = 0; + while ($rev = $changes->next()) { + if (mayAccessPage('view', $rev->_pagename)) { + $lines->pushContent($this->format_revision($rev)); + if ($first) + $this->setValidators($rev); + $first = false; + } + $count++; + } + $this->_args['limit'] = $count; + if (($desc = $this->description())) + $html->pushContent($desc); + if ($this->_args['daylist']) + $html->pushContent(new DayButtonBar($this->_args)); + if ($first) + $html->pushContent(HTML::p(array('class' => 'rc-empty'), + $this->empty_message())); + else + $html->pushContent($lines); + + return $html; + } + + function format_revision ($rev) { + $args = &$this->_args; + $class = 'rc-' . $this->importance($rev); + $time = $this->time($rev); + if (! $rev->get('is_minor_edit')) + $time = HTML::span(array('class' => 'pageinfo-majoredit'), $time); + + $line = HTML::li(array('class' => $class)); + + $line->pushContent($this->time($rev),", "); + $line->pushContent($this->date($rev)," "); + $line->pushContent($this->diffLink($rev), ' '); + $line->pushContent($this->historyLink($rev), ' '); + $line->pushContent($this->pageLink($rev), ' ', + $this->summaryAsHTML($rev)); + return $line; + } +} class _RecentChanges_SideBarFormatter extends _RecentChanges_HtmlFormatter @@ -473,10 +575,10 @@ extends _RecentChanges_HtmlFormatter function summaryAsHTML ($rev) { if ( !($summary = $this->summary($rev)) ) return ''; - return HTML::strong(array('class' => 'wiki-summary'), - "[", - /*TransformLinks(*/$summary,/* $rev->get('markup')),*/ - "]"); + return HTML::span(array('class' => 'wiki-summary'), + "[", + /*TransformLinks(*/$summary,/* $rev->get('markup')),*/ + "]"); } @@ -838,7 +940,7 @@ extends WikiPlugin function getVersion() { return preg_replace("/[Revision: $]/", '', - "\$Revision: 1.116 $"); + "\$Revision: 1.117 $"); } function managesValidators() { @@ -966,6 +1068,8 @@ extends WikiPlugin $fmt_class = '_RecentChanges_SideBarFormatter'; elseif ($format == 'box') $fmt_class = '_RecentChanges_BoxFormatter'; + elseif ($format == 'contribs') + $fmt_class = '_RecentChanges_UserContribsFormatter'; else $fmt_class = '_RecentChanges_HtmlFormatter'; } @@ -1055,6 +1159,9 @@ class DayButtonBar extends HtmlElement { } // $Log: not supported by cvs2svn $ +// Revision 1.116 2007/05/13 18:13:41 rurban +// use all filters, not just the first, ignoring the others. improve wording a bit +// // Revision 1.115 2007/04/08 16:24:10 rurban // Remove redundant code in ->authorLink(): 'if_known' does the same // diff --git a/pgsrc/UserContribs b/pgsrc/UserContribs new file mode 100644 index 000000000..1d176ee6d --- /dev/null +++ b/pgsrc/UserContribs @@ -0,0 +1,10 @@ +Date: Wed, 30 May 2007 15:43:12 +0200 +Mime-Version: 1.0 (Produced by PhpWiki 1.3.13) +Content-Type: application/x-phpwiki; + pagename=UserContribs; + flags=""; + markup=2; + charset=utf-8 +Content-Transfer-Encoding: binary + + diff --git a/themes/MonoBook/main.css b/themes/MonoBook/main.css index 703bfaea7..b9f9d141d 100644 --- a/themes/MonoBook/main.css +++ b/themes/MonoBook/main.css @@ -534,6 +534,17 @@ div.townBox dl dd { padding: 0; } +/* +** RecentChanges +*/ +.pageinfo-majoredit { + font-weight: normal; /*bold;*/ +} +.wiki-summary { + font-size: 94%; + font-style: italic; +} + /* Page history styling */ /* the auto-generated edit comments */ .autocomment { -- 2.45.0