logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

CVS: phpwiki/lib/plugin RecentChanges.php, 1.109, 1.110: msg#00372

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

Modified Files:
        RecentChanges.php 
Log Message:
new arg: only_new

Index: RecentChanges.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/plugin/RecentChanges.php,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -2 -b -p -d -r1.109 -r1.110
--- RecentChanges.php   19 Mar 2006 14:26:29 -0000      1.109
+++ RecentChanges.php   22 Jan 2007 23:51:36 -0000      1.110
@@ -2,5 +2,5 @@
 rcs_id('$Id$');
 /**
- Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam
+ Copyright 1999,2000,2001,2002,2007 $ThePhpWikiProgrammingTeam
 
  This file is part of PhpWiki.
@@ -203,5 +203,7 @@ extends _RecentChanges_Formatter
         if (isset($caption) and $caption == _("Recent Comments"))
             $edits = _("comments");
-
+       if ($only_new) {
+            $edits = _("created new pages");
+       }
         if ($timespan = $days > 0) {
             if (intval($days) != $days)
@@ -731,4 +733,28 @@ class NonDeletedRevisionIterator extends
 }
 
+/**
+ * only_new: Only new created pages
+ */
+class NewPageRevisionIterator extends WikiDB_PageRevisionIterator
+{
+    /** Constructor
+     *
+     * @param $revisions object a WikiDB_PageRevisionIterator.
+     */
+    function NewPageRevisionIterator ($revisions) {
+        $this->_revisions = $revisions;
+    }
+
+    function next () {
+        while (($rev = $this->_revisions->next())) {
+            if ($rev->getVersion() == 1)
+                return $rev;
+        }
+        $this->free();
+        return false;
+    }
+
+}
+
 class WikiPlugin_RecentChanges
 extends WikiPlugin
@@ -767,4 +793,5 @@ extends WikiPlugin
                      'show_all'     => false,
                      'show_deleted' => 'sometimes',
+                    'only_new'     => false,
                      'limit'        => false,
                      'format'       => false,
@@ -819,5 +846,7 @@ extends WikiPlugin
             $show_deleted = $args['show_minor'];
 
-        if (!$show_deleted)
+        if ($args['only_new'])
+            $changes = new NewPageRevisionIterator($changes);
+        elseif (!$show_deleted)
             $changes = new NonDeletedRevisionIterator($changes, 
!$args['show_all']);
 
@@ -896,4 +925,6 @@ class DayButtonBar extends HtmlElement {
             else
                 $caption = _("Show changes for:");
+           if ($only_new)
+                $caption = _("All new pages since:");
         }
 
@@ -928,4 +959,7 @@ class DayButtonBar extends HtmlElement {
 
 // $Log$
+// Revision 1.110  2007/01/22 23:51:36  rurban
+// new arg: only_new
+//
 // Revision 1.109  2006/03/19 14:26:29  rurban
 // sf.net patch by Matt Brown: Add rel=nofollow to more actions


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


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