### Eclipse Workspace Patch 1.0
#P JSPWiki
Index: src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java
===================================================================
RCS file: /p/cvs/JSPWiki/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java,v
retrieving revision 1.18
diff -u -r1.18 ReferringPagesPlugin.java
--- src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java	20 Jan 2008 13:11:06 -0000	1.18
+++ src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java	25 Jan 2008 15:12:35 -0000
@@ -93,13 +93,25 @@
             }
 
             //
-            //  If nothing was left after filtering or during search
+            // If nothing was left after filtering or during search
             //
-            if( links == null || links.size() == 0 )
+            if (links == null || links.size() == 0)
             {
                 wikitext = rb.getString("referringpagesplugin.nobody");
             }
+            else
+            {
 
+                if (m_show.equals(PARAM_SHOW_VALUE_COUNT))
+                {
+                    wikitext = "" + links.size();
+                    if (m_lastModified)
+                    {
+                        wikitext = links.size() + " (" + df.format(m_dateLastModified) + ")";
+                    }
+                }
+            }
+            
             return makeHTML( context, wikitext );
         }
 
Index: src/com/ecyrd/jspwiki/plugin/UndefinedPagesPlugin.java
===================================================================
RCS file: /p/cvs/JSPWiki/src/com/ecyrd/jspwiki/plugin/UndefinedPagesPlugin.java,v
retrieving revision 1.13
diff -u -r1.13 UndefinedPagesPlugin.java
--- src/com/ecyrd/jspwiki/plugin/UndefinedPagesPlugin.java	27 May 2007 01:19:38 -0000	1.13
+++ src/com/ecyrd/jspwiki/plugin/UndefinedPagesPlugin.java	25 Jan 2008 15:12:35 -0000
@@ -20,6 +20,7 @@
 package com.ecyrd.jspwiki.plugin;
 
 import com.ecyrd.jspwiki.*;
+
 import java.util.*;
 
 /**
@@ -44,11 +45,26 @@
         super.initialize( context, params );
 
         TreeSet sortedSet = new TreeSet();
+
+        links = filterCollection( links );
+
         sortedSet.addAll( links );
         
-        filterCollection( links );
+        String wikitext = null;
+        
+        if (m_lastModified)
+        {
+            throw new PluginException("parameter " + PARAM_LASTMODIFIED + " is not valid for the UndefinedPagesPlugin");
+        }
         
-        String wikitext = wikitizeCollection( sortedSet, m_separator, ALL_ITEMS );
+        if (m_show.equals(PARAM_SHOW_VALUE_COUNT))
+        {
+            wikitext = "" + links.size();
+        }
+        else
+        {
+            wikitext = wikitizeCollection(sortedSet, m_separator, ALL_ITEMS);
+        }
         
         return makeHTML( context, wikitext );
     }
Index: src/com/ecyrd/jspwiki/plugin/UnusedPagesPlugin.java
===================================================================
RCS file: /p/cvs/JSPWiki/src/com/ecyrd/jspwiki/plugin/UnusedPagesPlugin.java,v
retrieving revision 1.12
diff -u -r1.12 UnusedPagesPlugin.java
--- src/com/ecyrd/jspwiki/plugin/UnusedPagesPlugin.java	1 Sep 2007 20:12:46 -0000	1.12
+++ src/com/ecyrd/jspwiki/plugin/UnusedPagesPlugin.java	25 Jan 2008 15:12:35 -0000
@@ -72,12 +72,25 @@
         super.initialize( context, params );
 
         TreeSet sortedSet = new TreeSet();
-
+        
+        links = filterCollection( links );
+        
         sortedSet.addAll( links );
 
-        filterCollection( links );
-        String wikitext = wikitizeCollection( sortedSet, m_separator, ALL_ITEMS );
+        String wikitext = null;
         
+        if (m_show.equals(PARAM_SHOW_VALUE_COUNT))
+        {
+            wikitext = "" + links.size();
+            if (m_lastModified & links.size()!=0)
+            {
+                wikitext = links.size() + " (" + df.format(m_dateLastModified) + ")";
+            }
+        }
+        else
+        {
+            wikitext = wikitizeCollection(sortedSet, m_separator, ALL_ITEMS);
+        }        
         return makeHTML( context, wikitext );
     }
 
Index: src/com/ecyrd/jspwiki/plugin/AbstractReferralPlugin.java
===================================================================
RCS file: /p/cvs/JSPWiki/src/com/ecyrd/jspwiki/plugin/AbstractReferralPlugin.java,v
retrieving revision 1.18
diff -u -r1.18 AbstractReferralPlugin.java
--- src/com/ecyrd/jspwiki/plugin/AbstractReferralPlugin.java	9 Jun 2007 04:52:29 -0000	1.18
+++ src/com/ecyrd/jspwiki/plugin/AbstractReferralPlugin.java	25 Jan 2008 15:12:35 -0000
@@ -20,10 +20,8 @@
 package com.ecyrd.jspwiki.plugin;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
@@ -58,6 +56,10 @@
 
     public static final String PARAM_EXCLUDE   = "exclude";
     public static final String PARAM_INCLUDE   = "include";
+    public static final String PARAM_SHOW = "show";
+    public static final String PARAM_SHOW_VALUE_PAGES = "pages";
+    public static final String PARAM_SHOW_VALUE_COUNT = "count";
+    public static final String PARAM_LASTMODIFIED = "showLastModified";
 
     protected           int      m_maxwidth = Integer.MAX_VALUE;
     protected           String   m_before = ""; // null not blank
@@ -66,6 +68,12 @@
 
     protected           Pattern[]  m_exclude;
     protected           Pattern[]  m_include;
+    
+    protected           String m_show = "pages";
+    protected           boolean m_lastModified=false;
+    // the last modified date of the page that has been last modified:
+    protected           Date m_dateLastModified = new Date(0);
+    protected           SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
     protected           WikiEngine m_engine;
 
@@ -157,7 +165,34 @@
         }
 
         // log.debug( "Requested maximum width is "+m_maxwidth );
+        s = (String) params.get(PARAM_SHOW);
+
+        if (s != null)
+        {
+            if (s.equalsIgnoreCase("count"))
+            {
+                m_show = "count";
+            }
+        }
+
+        s = (String) params.get(PARAM_LASTMODIFIED);
+
+        if (s != null)
+        {
+            if (s.equalsIgnoreCase("true"))
+            {
+                if (m_show.equals("count"))
+                {
+                    m_lastModified = true;
+                }
+                else
+                    throw new PluginException("showLastModified=true is only valid if show=count is also specified");
+                {
+                }
+            }
+        }
     }
+    
 
     protected Collection filterCollection( Collection c )
     {
@@ -204,6 +239,23 @@
             if( includeThis )
             {
                 result.add( pageName );
+                //
+                //  if we want to show the last modified date of the most recently change page, we keep a "high watermark" here:
+                WikiPage page = null;
+                if (m_lastModified) {
+                    page = m_engine.getPage(pageName);
+                    if (page!= null)
+                    {
+                        Date lastModPage = page.getLastModified();
+                        if (log.isDebugEnabled()) {
+                            log.debug("lastModified Date of page " + pageName + " : " + m_dateLastModified);
+                        }
+                        if (lastModPage.after(m_dateLastModified)){
+                            m_dateLastModified=lastModPage;
+                        }
+                    }
+                        
+                }
             }
         }
 
