logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

CVS: phpwiki/lib/plugin RecentChanges.php, 1.116, 1.117: msg#00057

Subject: CVS: phpwiki/lib/plugin RecentChanges.php, 1.116, 1.117
Update of /cvsroot/phpwiki/phpwiki/lib/plugin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9738/lib/plugin

Modified Files:
        RecentChanges.php 
Log Message:
added MonoBook UserContribs

Index: RecentChanges.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/RecentChanges.php,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -2 -b -p -d -r1.116 -r1.117
--- RecentChanges.php   13 May 2007 18:13:41 -0000      1.116
+++ RecentChanges.php   30 May 2007 20:43:31 -0000      1.117
@@ -128,12 +128,20 @@ extends _RecentChanges_Formatter
     function diffLink ($rev) {
         global $WikiTheme;
-        $button = $WikiTheme->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,")");
     }
 
@@ -166,11 +174,32 @@ extends _RecentChanges_Formatter
     }
 
+    /* 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'),
-                              "[",
+        return  HTML::span( array('class' => 'wiki-summary'),
+                           "(",
                               TransformLinks($summary, $rev->get('markup'), 
$rev->getPageName()),
-                              "]");
+                           ")");
     }
 
@@ -357,4 +386,5 @@ extends _RecentChanges_Formatter
                 if ($lines)
                     $html->pushContent($lines);
+               // for user contributions no extra date line
                 $html->pushContent(HTML::h3($date));
                 $lines = HTML::ul();
@@ -365,5 +395,4 @@ extends _RecentChanges_Formatter
             if (mayAccessPage('view', $rev->_pagename)) {
                 $lines->pushContent($this->format_revision($rev));
-
                 if ($first)
                     $this->setValidators($rev);
@@ -387,9 +416,8 @@ 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), ' ');
@@ -398,4 +426,13 @@ extends _RecentChanges_Formatter
             $line->pushContent($this->historyLink($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, ' ',
@@ -403,8 +440,73 @@ extends _RecentChanges_Formatter
                            ' ... ',
                            $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
@@ -474,5 +576,5 @@ extends _RecentChanges_HtmlFormatter
         if ( !($summary = $this->summary($rev)) )
             return '';
-        return HTML::strong(array('class' => 'wiki-summary'),
+        return HTML::span(array('class' => 'wiki-summary'),
                                 "[",
                                 /*TransformLinks(*/$summary,/* 
$rev->get('markup')),*/
@@ -967,4 +1069,6 @@ extends WikiPlugin
             elseif ($format == 'box')
                 $fmt_class = '_RecentChanges_BoxFormatter';
+            elseif ($format == 'contribs')
+                $fmt_class = '_RecentChanges_UserContribsFormatter';
             else
                 $fmt_class = '_RecentChanges_HtmlFormatter';
@@ -1056,4 +1160,7 @@ class DayButtonBar extends HtmlElement {
 
 // $Log$
+// Revision 1.117  2007/05/30 20:43:31  rurban
+// added MonoBook UserContribs
+//
 // Revision 1.116  2007/05/13 18:13:41  rurban
 // use all filters, not just the first, ignoring the others. improve wording a 
bit


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/


<Prev in Thread] Current Thread [Next in Thread>