jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajaqu...@apache.org
Subject svn commit: r682148 [2/8] - in /incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki: parser/ plugin/ preferences/ providers/ render/ rpc/ rpc/atom/ rpc/json/ rss/ search/ tags/ ui/ ui/admin/ ui/admin/beans/ ui/progress/
Date Sun, 03 Aug 2008 12:22:18 GMT
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Counter.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Counter.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Counter.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Counter.java Sun Aug  3 05:22:13 2008
@@ -28,6 +28,8 @@
  *  <P>Parameters
  *  <UL>
  *    <LI>name - Name of the counter.  Optional.
+ *    <LI>increment - The amount to increment, may be a negative value, default is 1.  Optional.
+ *    <LI>showResult - Should the counter value be visible on the page, default is true.  Optional.
  *  </UL>
  *
  *  Stores a variable in the WikiContext called "counter", with the name of the
@@ -41,8 +43,17 @@
 {
     // private static Logger log = Logger.getLogger( Counter.class );
 
-    static final String VARIABLE_NAME = "counter";
-
+    public static final String  PARAM_NAME          = "name";
+    public static final String  PARAM_INCREMENT     = "increment";
+    public static final String  PARAM_SHOW_RESULT   = "showResult";
+    public static final String  PARAM_START         = "start";
+    public static final String  DEFAULT_NAME        = "counter";
+    private static final int     DEFAULT_INCREMENT   = 1;
+    private static final boolean DEFAULT_SHOW_RESULT = true;
+
+    /**
+     *  {@inheritDoc}
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
@@ -50,32 +61,74 @@
         //  First, determine which kind of name we use to store in
         //  the WikiContext.
         //
-        String  countername = (String)params.get( "name" );
+        String  countername = (String)params.get(  PARAM_NAME);
 
         if( countername == null ) 
         {
-            countername = VARIABLE_NAME;
+            countername = DEFAULT_NAME;
         }
         else
         {
-            countername = VARIABLE_NAME+"-"+countername;
+            countername = DEFAULT_NAME+"-"+countername;
         }
 
         //
-        //  Fetch, increment, and store back.
+        //  Fetch the old value
         //
         Integer val = (Integer)context.getVariable( countername );
 
         if( val == null )
         {
-            val = new Integer( 0 );
+            val = 0;
         }
+        
+        //
+        //  Check if we need to reset this
+        //
+        
+        String start = (String)params.get( PARAM_START );
+        
+        if( start != null )
+        {
+            val = Integer.parseInt( start );
+        }
+        else
+        {
+            //
+            //  Determine how much to increment
+            //
+            Object incrementObj = params.get( PARAM_INCREMENT );
+        
+            int increment = DEFAULT_INCREMENT;
+        
+            if (incrementObj != null) 
+            {
+                increment = (new Integer((String)incrementObj)).intValue();
+            }
 
-        val = new Integer( val.intValue() + 1 );
-
+            val = val + increment;
+        }
+        
         context.setVariable( countername, val );
 
-        return val.toString();
+        //
+        // check if we want to hide the result (just count, don't show result on the page
+        //
+        Object showObj = params.get(PARAM_SHOW_RESULT);
+        
+        boolean show = DEFAULT_SHOW_RESULT;
+        
+        if( showObj != null ) 
+        {
+            show = TextUtil.isPositive( (String) showObj );
+        }
+        
+        if( show )
+        {
+            return val.toString();
+        } 
+       
+        return "";
     }
 
 }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java Sun Aug  3 05:22:13 2008
@@ -20,10 +20,14 @@
  */
 package com.ecyrd.jspwiki.plugin;
 
-import org.apache.log4j.Logger;
-import com.ecyrd.jspwiki.*;
-import java.util.*;
 import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import com.ecyrd.jspwiki.WikiContext;
+import com.ecyrd.jspwiki.preferences.Preferences;
+import com.ecyrd.jspwiki.preferences.Preferences.TimeFormat;
 
 /**
  *  Just displays the current date and time.
@@ -35,25 +39,24 @@
 public class CurrentTimePlugin
     implements WikiPlugin
 {
-    private static Logger log = Logger.getLogger( CurrentTimePlugin.class );
-
-    public static final String DEFAULT_FORMAT = "HH:mm:ss dd-MMM-yyyy zzzz";
+    // private static Logger log = Logger.getLogger( CurrentTimePlugin.class );
 
+    /**
+     *  {@inheritDoc}
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
         String formatString = (String)params.get("format");
-
-        if( formatString == null )
-        {
-            formatString = DEFAULT_FORMAT;
-        }
-
-        log.debug("Date format string is: "+formatString);
-
+        
         try
         {
-            SimpleDateFormat fmt = new SimpleDateFormat( formatString );
+            SimpleDateFormat fmt;
+            
+            if( formatString != null )
+                fmt = new SimpleDateFormat( formatString );
+            else
+                fmt = Preferences.getDateFormat( context, TimeFormat.DATETIME );
 
             Date d = new Date();  // Now.
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Denounce.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Denounce.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Denounce.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Denounce.java Sun Aug  3 05:22:13 2008
@@ -46,16 +46,16 @@
     public static final String PARAM_LINK = "link";
     public static final String PARAM_TEXT = "text";
 
-    public static final String PROPERTYFILE = "com/ecyrd/jspwiki/plugin/denounce.properties";
-    public static final String PROP_AGENTPATTERN   = "denounce.agentpattern.";
-    public static final String PROP_HOSTPATTERN    = "denounce.hostpattern.";
-    public static final String PROP_REFERERPATTERN = "denounce.refererpattern.";
-
-    public static final String PROP_DENOUNCETEXT   = "denounce.denouncetext";
-
-    private static ArrayList c_refererPatterns = new ArrayList();
-    private static ArrayList c_agentPatterns   = new ArrayList();
-    private static ArrayList c_hostPatterns    = new ArrayList();
+    private static final String PROPERTYFILE = "com/ecyrd/jspwiki/plugin/denounce.properties";
+    private static final String PROP_AGENTPATTERN   = "denounce.agentpattern.";
+    private static final String PROP_HOSTPATTERN    = "denounce.hostpattern.";
+    private static final String PROP_REFERERPATTERN = "denounce.refererpattern.";
+
+    private static final String PROP_DENOUNCETEXT   = "denounce.denouncetext";
+
+    private static ArrayList<Pattern> c_refererPatterns = new ArrayList<Pattern>();
+    private static ArrayList<Pattern> c_agentPatterns   = new ArrayList<Pattern>();
+    private static ArrayList<Pattern> c_hostPatterns    = new ArrayList<Pattern>();
 
     private static String    c_denounceText    = "";
 
@@ -119,6 +119,9 @@
         }
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Groups.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Groups.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Groups.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Groups.java Sun Aug  3 05:22:13 2008
@@ -25,12 +25,8 @@
 import java.util.Comparator;
 import java.util.Map;
 
-import net.sourceforge.stripes.action.UrlBinding;
-import net.sourceforge.stripes.util.UrlBuilder;
-
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.action.GroupActionBean;
 import com.ecyrd.jspwiki.auth.PrincipalComparator;
 import com.ecyrd.jspwiki.auth.authorize.GroupManager;
 
@@ -44,8 +40,11 @@
 public class Groups
     implements WikiPlugin
 {
-    private static final Comparator COMPARATOR = new PrincipalComparator();
+    private static final Comparator<Principal> COMPARATOR = new PrincipalComparator();
     
+    /**
+     *  {@inheritDoc}
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
@@ -61,18 +60,12 @@
         {
             String name = groups[i].getName();
             
-            // Make Stripes URL
-            String groupUrl = GroupActionBean.class.getAnnotation(UrlBinding.class).value();
-            UrlBuilder urlBuilder = new UrlBuilder(  groupUrl, true );
-            urlBuilder.addParameter("group", name);
-            String url = urlBuilder.toString();
-            
-            // Make re-written URL
-            String rewriteUrl = context.getContext().getResponse().encodeURL( url );
+            // Make URL
+            String url = engine.getURLConstructor().makeURL( WikiContext.VIEW_GROUP, name, false, null );
             
             // Create hyperlink
             s.append( "<a href=\"" );
-            s.append( rewriteUrl );
+            s.append( url );
             s.append( "\">" );
             s.append( name );
             s.append( "</a>" );

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/IfPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/IfPlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/IfPlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/IfPlugin.java Sun Aug  3 05:22:13 2008
@@ -104,13 +104,28 @@
  */
 public class IfPlugin implements WikiPlugin
 {
+    /** The parameter name for setting the group to check.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_GROUP    = "group";
+
+    /** The parameter name for setting the user id to check.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_USER     = "user";
+    
+    /** The parameter name for setting the ip address to check.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_IP       = "ip";
+    
+    /** The parameter name for setting the page name to check.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_PAGE     = "page";
+    
+    /** The parameter name for setting the contents of the page to check.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_CONTAINS = "contains";
+    
+    /** The parameter name for setting the variable name to check.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_VAR      = "var";
+    
+    /** The parameter name for setting the exact content to check.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_IS       = "is";
+    
+    /** The parameter name for checking whether a page/var exists.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_EXISTS   = "exists";
 
     /**
@@ -133,6 +148,8 @@
      *
      * @param context   The current WikiContext.
      * @param params    The parameter Map which contains key-value pairs.
+     * @throws PluginException If something goes wrong
+     * @return True, if the condition holds.
      */
     public static boolean ifInclude( WikiContext context, Map params ) throws PluginException
     {

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Image.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Image.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Image.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Image.java Sun Aug  3 05:22:13 2008
@@ -22,7 +22,6 @@
 
 import java.util.*;
 import com.ecyrd.jspwiki.*;
-import com.ecyrd.jspwiki.action.AttachActionBean;
 import com.ecyrd.jspwiki.attachment.AttachmentManager;
 import com.ecyrd.jspwiki.attachment.Attachment;
 import com.ecyrd.jspwiki.providers.ProviderException;
@@ -61,6 +60,9 @@
         return TextUtil.replaceEntities( (String) params.get( paramId ) );
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
@@ -97,7 +99,7 @@
 
             if( att != null )
             {
-                src = context.getContext().getURL( AttachActionBean.class, att.getName() );
+                src = context.getURL( WikiContext.ATTACH, att.getName() );
             }
         }
         catch( ProviderException e )

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/IndexPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/IndexPlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/IndexPlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/IndexPlugin.java Sun Aug  3 05:22:13 2008
@@ -1,236 +1,161 @@
-/*
+/* 
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.  
  */
 package com.ecyrd.jspwiki.plugin;
 
-import java.io.StringWriter;
 import java.util.*;
+import java.util.regex.Pattern;
 
+import org.apache.ecs.Element;
+import org.apache.ecs.xhtml.div;
+import org.apache.ecs.xhtml.span;
 import org.apache.log4j.Logger;
-import org.apache.oro.text.GlobCompiler;
-import org.apache.oro.text.regex.*;
 
-import com.ecyrd.jspwiki.*;
-import com.ecyrd.jspwiki.action.ViewActionBean;
+import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.providers.ProviderException;
 
 /**
- *  Builds an index of all pages.
- *  <P>Parameters</P>
- *  <UL>
- *    <LI>itemsPerLine: How many items should be allowed per line before break.
- *    If set to zero (the default), will not write breaks.
- *    <LI>include: Include only these pages.
- *    <LI>exclude: Exclude with this pattern.
- *  </UL>
- *
- *  @author Alain Ravet
- *  @author Janne Jalkanen
- *  @since 1.9.9
+ *  A plugin which creates an index of pages according to a certain
+ *  pattern.
+ *  <p>
+ *  This is a complete rewrite of the old IndexPlugin under an Apache license.
+ *  <p>
+ *  Usage:
+ *  <ul>
+ *    <li><b>include</b> - A regexp pattern for marking which pages should be included.</li>
+ *    <li><b>exclude</b> - A regexp pattern for marking which pages should be excluded.</li>
+ *  </ul>
+ *  The default is to include all pages.
  */
 public class IndexPlugin implements WikiPlugin
 {
-    protected static final Logger log = Logger.getLogger(IndexPlugin.class);
-
-    public  static final String INITIALS_COLOR                  = "red" ;
-    private static final int    DEFAULT_ITEMS_PER_LINE          = 0     ;
-
-    private static final String PARAM_ITEMS_PER_LINE            = "itemsPerLine";
-    private static final String PARAM_INCLUDE                   = "include";
-    private static final String PARAM_EXCLUDE                   = "exclude";
-
-    private int                 m_currentNofPagesOnLine         = 0;
-    private int                 m_itemsPerLine;
-    protected String            m_previousPageFirstLetter       = "";
-    protected StringWriter      m_bodyPart      =   new StringWriter();
-    protected StringWriter      m_headerPart    =   new StringWriter();
-    private Pattern             m_includePattern;
-    private Pattern             m_excludePattern;
-
-
-    public String execute( WikiContext wikiContext , Map params )
-        throws PluginException
+    public static final String PARAM_INCLUDE = "include";
+    public static final String PARAM_EXCLUDE = "exclude";
+    private static Logger log = Logger.getLogger( IndexPlugin.class );
+    
+    /**
+     *  {@inheritDoc}
+     */
+    public String execute( WikiContext context, Map params ) throws PluginException
     {
-        //
-        //  Parse arguments and create patterns.
-        //
-        PatternCompiler compiler = new GlobCompiler();
-        m_itemsPerLine = TextUtil.parseIntParameter( (String) params.get(PARAM_ITEMS_PER_LINE),
-                                                     DEFAULT_ITEMS_PER_LINE );
+        String include = (String)params.get( PARAM_INCLUDE );
+        String exclude = (String)params.get( PARAM_EXCLUDE );
+        
+        List<String> pages;
+        div masterDiv = new div();
+        masterDiv.setClass( "index" );
+        
+        div indexDiv = new div();
+        
+        masterDiv.addElement( indexDiv );
+        indexDiv.setClass( "header" );
         try
         {
-            String ptrn = (String) params.get(PARAM_INCLUDE);
-            if( ptrn == null ) ptrn = "*";
-            m_includePattern = compiler.compile(ptrn);
-
-            ptrn = (String) params.get(PARAM_EXCLUDE);
-            if( ptrn == null ) ptrn = "";
-            m_excludePattern = compiler.compile(ptrn);
-        }
-        catch( MalformedPatternException e )
-        {
-            throw new PluginException("Illegal pattern detected."); // FIXME, make a proper error.
-        }
-
-        //
-        //  Get pages, then sort.
-        //
-
-        final Collection        allPages      = getAllPagesSortedByName( wikiContext );
-
-        //
-        //  Build the page.
-        //
-        buildIndexPageHeaderAndBody( wikiContext, allPages );
-
-        StringBuffer res = new StringBuffer();
-
-        res.append( "<div class=\"index\">\n" );
-        res.append( "<div class=\"header\">\n" );
-        res.append( m_headerPart.toString() );
-        res.append( "</div>\n" );
-        res.append( "<div class=\"body\">\n" );
-        res.append( m_bodyPart.toString() );
-        res.append( "</div>\n</div>\n" );
-
-        return res.toString();
-    }
-
-
-    private void buildIndexPageHeaderAndBody( WikiContext context,
-                                              final Collection allPages )
-    {
-        PatternMatcher matcher = new Perl5Matcher();
-
-        for( Iterator i = allPages.iterator (); i.hasNext ();)
-        {
-            WikiPage curPage = (WikiPage) i.next();
-
-            if( matcher.matches( curPage.getName(), m_includePattern ) )
+            pages = listPages( context, include, exclude );
+            Collections.sort( pages );
+            
+            char initialChar = ' ';
+            
+            div currentDiv = new div();
+            
+            for( String name : pages )
             {
-                if( !matcher.matches( curPage.getName(), m_excludePattern ) )
+                if( name.charAt( 0 ) != initialChar )
                 {
-                    ++m_currentNofPagesOnLine;
-
-                    String    pageNameFirstLetter           = curPage.getName().substring(0,1).toUpperCase();
-                    boolean   sameFirstLetterAsPreviousPage = m_previousPageFirstLetter.equals(pageNameFirstLetter);
-
-                    if( !sameFirstLetterAsPreviousPage )
-                    {
-                        addLetterToIndexHeader( pageNameFirstLetter );
-                        addLetterHeaderWithLine( pageNameFirstLetter );
-
-                        m_currentNofPagesOnLine   = 1;
-                        m_previousPageFirstLetter = pageNameFirstLetter;
-                    }
-
-                    addPageToIndex( context, curPage );
-                    breakLineIfTooLong();
+                    if( initialChar != ' ' ) indexDiv.addElement( " - " );
+                    initialChar = name.charAt( 0 );
+                    
+                    masterDiv.addElement( makeHeader(initialChar) );
+            
+                    currentDiv = new div();
+                    currentDiv.setClass("body");
+                    masterDiv.addElement( currentDiv );
+                    
+                    indexDiv.addElement( "<a href='#"+initialChar+"'>"+initialChar+"</a>" );
                 }
+                else
+                {
+                    currentDiv.addElement( ", " );
+                }
+                
+                String link = "<a href='"+
+                              context.getURL( WikiContext.VIEW, name )+
+                              "'>"+name+"</a>";
+                
+                currentDiv.addElement( link );
             }
-        } // for
-    }
-
-
-    /**
-     *  Gets all pages, then sorts them.
-     */
-    static Collection getAllPagesSortedByName( WikiContext wikiContext )
-    {
-        final WikiEngine engine = wikiContext.getEngine();
-
-        final PageManager pageManager = engine.getPageManager();
-        if( pageManager == null )
-            return null;
-
-        Collection result = new TreeSet( new Comparator() {
-            public int compare( Object o1, Object o2 )
-            {
-                if( o1 == null || o2 == null ) return 0;
-
-                WikiPage page1 = (WikiPage)o1;
-                WikiPage page2 = (WikiPage)o2;
-
-                return page1.getName().compareTo( page2.getName() );
-            }
-        });
-
-        try
-        {
-            Collection allPages = pageManager.getAllPages();
-            result.addAll( allPages );
         }
         catch( ProviderException e )
         {
-            log.fatal("PageProvider is unable to list pages: ", e);
+            log.warn("Could not load page index",e);
+            throw new PluginException( e.getMessage() );
         }
-
-        return result;
+        
+        return masterDiv.toString();
     }
-
-
-    private void addLetterToIndexHeader( final String firstLetter )
+    
+    /**
+     *  Create the DOM for a heading
+     * @param initialChar
+     * @return A span element.
+     */
+    private Element makeHeader( char initialChar )
     {
-        final boolean noLetterYetInTheIndex = ! "".equals(m_previousPageFirstLetter);
-
-        if( noLetterYetInTheIndex )
-        {
-            m_headerPart.write(" - " );
-        }
+        span s = new span();
+        s.setClass( "section" );
+        s.addElement( "<a name='"+initialChar+"'>"+initialChar+"</a>" );
 
-        m_headerPart.write("<a href=\"#"  + firstLetter + "\">" + firstLetter + "</a>" );
+        return s;
     }
 
-
-    private void addLetterHeaderWithLine( final String firstLetter )
-    {
-        m_bodyPart.write("\n<br /><br />" +
-                         "<span class=\"section\">"+
-                         "<a name=\"" + firstLetter + "\">"+
-                         firstLetter+"</a></span>" +
-                         "<hr />\n" );
-    }
-
-    protected void addPageToIndex( WikiContext context, WikiPage curPage )
+    /**
+     *  Grabs a list of all pages and filters them according to the include/exclude patterns.
+     *  
+     * @param context
+     * @param include
+     * @param exclude
+     * @return A list containing page names which matched the filters.
+     * @throws ProviderException
+     */
+    private List<String> listPages( WikiContext context, String include, String exclude )
+        throws ProviderException
     {
-        final boolean notFirstPageOnLine = 2 <= m_currentNofPagesOnLine;
-
-        if( notFirstPageOnLine )
+        Pattern includePtrn = include != null ? Pattern.compile( include ) : Pattern.compile(".*");
+        Pattern excludePtrn = exclude != null ? Pattern.compile( exclude ) : Pattern.compile("\\p{Cntrl}"); // There are no control characters in page names
+        
+        ArrayList<String> result = new ArrayList<String>();
+        
+        Collection pages = context.getEngine().getReferenceManager().findCreated();
+        
+        for( Iterator i = pages.iterator(); i.hasNext(); )
         {
-            m_bodyPart.write(",&nbsp; ");
-        }
+            String pageName = (String) i.next();
 
-        m_bodyPart.write("<a href=\""+
-                         context.getContext().getURL(ViewActionBean.class, curPage.getName())+"\">"+
-                         context.getEngine().beautifyTitleNoBreak(curPage.getName())+
-                         "</a>");
-    }
-
-    protected void breakLineIfTooLong()
-    {
-        final boolean limitReached = m_itemsPerLine == m_currentNofPagesOnLine;
-
-        if( limitReached )
-        {
-            m_bodyPart.write( "<br />\n" );
-            m_currentNofPagesOnLine = 0;
+            if( excludePtrn.matcher( pageName ).matches() ) continue;
+            if( includePtrn.matcher( pageName ).matches() )
+            {
+                result.add( pageName );
+            }
         }
+        
+        return result;
     }
 
 }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/InitializablePlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/InitializablePlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/InitializablePlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/InitializablePlugin.java Sun Aug  3 05:22:13 2008
@@ -40,6 +40,9 @@
     /**
      *  Called whenever the plugin is being instantiated for
      *  the first time.
+     *  
+     *  @param engine The WikiEngine.
+     *  @throws PluginException If something goes wrong.
      */
 
     public void initialize( WikiEngine engine )

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/InsertPage.java Sun Aug  3 05:22:13 2008
@@ -21,8 +21,6 @@
 package com.ecyrd.jspwiki.plugin;
 
 import com.ecyrd.jspwiki.*;
-import com.ecyrd.jspwiki.action.EditActionBean;
-import com.ecyrd.jspwiki.action.ViewActionBean;
 import com.ecyrd.jspwiki.auth.*;
 import com.ecyrd.jspwiki.auth.permissions.PermissionFactory;
 
@@ -46,8 +44,15 @@
 
     private static final String DEFAULT_STYLE = "";
 
+    /** This attribute is stashed in the WikiContext to make sure that we don't
+     *  have circular references.
+     */
     public static final String ATTR_RECURSE    = "com.ecyrd.jspwiki.plugin.InsertPage.recurseCheck";
     
+    /**
+     *  {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
@@ -79,7 +84,7 @@
                 //  Check for recursivity
                 //
                 
-                List previousIncludes = (List)context.getVariable( ATTR_RECURSE );
+                List<String> previousIncludes = (List)context.getVariable( ATTR_RECURSE );
                 
                 if( previousIncludes != null )
                 {
@@ -90,7 +95,7 @@
                 }
                 else
                 {
-                    previousIncludes = new ArrayList();
+                    previousIncludes = new ArrayList<String>();
                 }
                
                 previousIncludes.add( page.getName() );
@@ -134,7 +139,7 @@
                 if( pageData.length() > maxlen ) 
                 {
                     pageData = pageData.substring( 0, maxlen )+" ...";
-                    moreLink = "<p><a href=\""+context.getContext().getURL(ViewActionBean.class,includedPage)+"\">More...</a></p>";
+                    moreLink = "<p><a href=\""+context.getURL(WikiContext.VIEW,includedPage)+"\">More...</a></p>";
                 }
 
                 res.append("<div style=\""+style+"\""+(clazz != null ? " class=\""+clazz+"\"" : "")+">");
@@ -157,7 +162,7 @@
                 else
                 {
                     res.append("There is no page called '"+includedPage+"'.  Would you like to ");
-                    res.append("<a href=\""+context.getContext().getURL( EditActionBean.class, includedPage )+"\">create it?</a>");
+                    res.append("<a href=\""+context.getURL( WikiContext.EDIT, includedPage )+"\">create it?</a>");
                 }
             }
         }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ListLocksPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ListLocksPlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ListLocksPlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ListLocksPlugin.java Sun Aug  3 05:22:13 2008
@@ -32,6 +32,9 @@
 public class ListLocksPlugin
     implements WikiPlugin
 {
+    /**
+     *  {@inheritDoc}
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Note.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Note.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Note.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Note.java Sun Aug  3 05:22:13 2008
@@ -27,7 +27,6 @@
 import com.ecyrd.jspwiki.TextUtil;
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.action.NoneActionBean;
 
 /**
  * Outputs an image with the supplied text as the <tt>title</tt> which is shown as a tooltip by
@@ -45,9 +44,19 @@
  */
 public class Note implements WikiPlugin
 {
+    /**
+     *  Property name for setting the image for the note.  Value is <tt>{@value}</tt>.
+     */
     public static final String PROP_NOTE_IMAGE    = "notePlugin.imageName";
+    
+    /**
+     *  The default name for the note.  Value is <tt>{@value}</tt>.
+     */
     public static final String DEFAULT_NOTE_IMAGE = "note.png";
 
+    /**
+     *  {@inheritDoc}
+     */
     public String execute(WikiContext context, Map params) throws PluginException
     {
         String commandline = (String) params.get(PluginManager.PARAM_CMDLINE);
@@ -76,7 +85,7 @@
                                                                     engine.getTemplateDir(), 
                                                                     commentImage );
 
-        return ctx.getContext().getURL( NoneActionBean.class, resource );
+        return ctx.getURL( WikiContext.NONE, resource );
     }
 
 
@@ -84,7 +93,6 @@
      *  Cleans the side.
      * 
      * @param commandline
-     * @return
      */
     private String clean(String commandline)
     {

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ParserStagePlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ParserStagePlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ParserStagePlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ParserStagePlugin.java Sun Aug  3 05:22:13 2008
@@ -29,7 +29,6 @@
  *  Implements a Plugin interface for the parser stage.  Please see PluginManager
  *  for further documentation.
  * 
- *  @author jalkanen
  *  @since 2.5.30
  */
 public interface ParserStagePlugin

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/PluginException.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/PluginException.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/PluginException.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/PluginException.java Sun Aug  3 05:22:13 2008
@@ -22,6 +22,10 @@
 
 import com.ecyrd.jspwiki.WikiException;
 
+/**
+ *  Provides a generic PluginException.  This is the kind of
+ *  an exception that the plugins should throw.
+ */
 public class PluginException
     extends WikiException
 {
@@ -29,18 +33,34 @@
 
     private final Throwable m_throwable;
 
+    /**
+     *  Create a PluginException.
+     *  
+     *  @param message {@inheritDoc}
+     */
     public PluginException( String message )
     {
         super( message );
         m_throwable = null;
     }
 
+    /**
+     *  Create a PluginException with the given original exception wrapped.
+     *  
+     *  @param message {@inheritDoc}
+     *  @param original The original exception.
+     */
     public PluginException( String message, Throwable original )
     {
         super( message );
         m_throwable = original;
     }
 
+    /**
+     *  Return the original exception.
+     *  
+     *  @return The original exception.
+     */
     public Throwable getRootThrowable()
     {
         return m_throwable;

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/PluginManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/PluginManager.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/PluginManager.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/PluginManager.java Sun Aug  3 05:22:13 2008
@@ -1,21 +1,22 @@
 /*
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2001 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.  
  */
 package com.ecyrd.jspwiki.plugin;
 
@@ -129,7 +130,6 @@
  *      new page load is guaranteed to invoke the plugin, unlike with the ParserStagePlugins.</li>
  *  </ul>
  *
- *  @author Janne Jalkanen
  *  @since 1.6.1
  */
 public class PluginManager extends ModuleManager
@@ -144,7 +144,7 @@
      */
     public static final String DEFAULT_PACKAGE = "com.ecyrd.jspwiki.plugin";
 
-    public static final String DEFAULT_FORMS_PACKAGE = "com.ecyrd.jspwiki.forms";
+    private static final String DEFAULT_FORMS_PACKAGE = "com.ecyrd.jspwiki.forms";
 
     /**
      *  The property name defining which packages will be searched for properties.
@@ -173,7 +173,7 @@
      */
     public static final String PARAM_DEBUG     = "debug";
 
-    private ArrayList<String> m_searchPath = new ArrayList<String>();
+    private ArrayList<String>  m_searchPath = new ArrayList<String>();
 
     private Pattern m_pluginPattern;
 
@@ -182,12 +182,13 @@
     /**
      *  Keeps a list of all known plugin classes.
      */
-    private Map<String,WikiPluginInfo> m_pluginClassMap = new HashMap<String,WikiPluginInfo>();
+    private Map<String, WikiPluginInfo> m_pluginClassMap = new HashMap<String, WikiPluginInfo>();
 
 
     /**
      *  Create a new PluginManager.
      *
+     *  @param engine WikiEngine which owns this manager.
      *  @param props Contents of a "jspwiki.properties" file.
      */
     public PluginManager( WikiEngine engine, Properties props )
@@ -229,6 +230,8 @@
 
     /**
      * Enables or disables plugin execution.
+     * 
+     * @param enabled True, if plugins should be globally enabled; false, if disabled.
      */
     public void enablePlugins( boolean enabled )
     {
@@ -239,6 +242,8 @@
      * Returns plugin execution status. If false, plugins are not
      * executed when they are encountered on a WikiPage, and an
      * empty string is returned in their place.
+     * 
+     * @return True, if plugins are enabled; false otherwise.
      */
     public boolean pluginsEnabled()
     {
@@ -435,10 +440,10 @@
      *
      * @throws IOException If the parsing fails.
      */
-    public Map<String,Object> parseArgs( String argstring )
+    public Map parseArgs( String argstring )
         throws IOException
     {
-        HashMap<String,Object>arglist = new HashMap<String,Object>();
+        HashMap<String, Object> arglist = new HashMap<String, Object>();
 
         //
         //  Protection against funny users.
@@ -485,7 +490,7 @@
                 break;
 
               case StreamTokenizer.TT_NUMBER:
-                s = Integer.toString( new Double(tok.nval).intValue() );
+                s = Integer.toString( (int) tok.nval );
                 potentialEmptyLine = false;
                 break;
 
@@ -552,6 +557,8 @@
      *
      *  @return HTML as returned by the plugin, or possibly an error
      *  message.
+     *  
+     *  @throws PluginException From the plugin itself, it propagates, waah!
      */
     public String execute( WikiContext context,
                            String commandline )
@@ -598,6 +605,16 @@
         return commandline;
     }
 
+    /**
+     *  Parses a plugin invocation and returns a DOM element.
+     *  
+     *  @param context The WikiContext
+     *  @param commandline The line to parse
+     *  @param pos The position in the stream parsing.
+     *  @return A DOM element
+     *  @throws PluginException If plugin invocation is faulty
+     */
+   @SuppressWarnings("unchecked")
    public PluginContent parsePluginLine( WikiContext context, String commandline, int pos )
         throws PluginException
     {
@@ -613,7 +630,7 @@
                 String args     = commandline.substring(res.endOffset(0),
                                                         commandline.length() -
                                                         (commandline.charAt(commandline.length()-1) == '}' ? 1 : 0 ) );
-                Map<String,Object> arglist = parseArgs( args );
+                Map<String, Object> arglist = parseArgs( args );
 
                 // set wikitext bounds of plugin as '_bounds' parameter, e.g., [345,396]
                 if ( pos != -1 )
@@ -780,7 +797,7 @@
         /**
          *  Initializes a plugin, if it has not yet been initialized.
          *
-         *  @param engine
+         *  @param engine The WikiEngine
          */
         protected void initializePlugin( WikiEngine engine )
         {
@@ -804,12 +821,22 @@
             }
         }
 
+        /**
+         *  {@inheritDoc}
+         */
+        @Override
         protected void initializeFromXML( Element el )
         {
             super.initializeFromXML( el );
             m_alias = el.getChildText("alias");
         }
 
+        /**
+         *  Create a new WikiPluginInfo based on the Class information.
+         *  
+         *  @param clazz The class to check
+         *  @return A WikiPluginInfo instance
+         */
         protected static WikiPluginInfo newInstance( Class clazz )
         {
             WikiPluginInfo info = new WikiPluginInfo( clazz.getName() );
@@ -953,6 +980,8 @@
         /**
          *  Returns a string suitable for debugging.  Don't assume that the format
          *  would stay the same.
+         *  
+         *  @return Something human-readable
          */
         public String toString()
         {
@@ -963,18 +992,27 @@
     /**
      *  {@inheritDoc}
      */
-    public Collection<WikiModuleInfo> modules()
+    public Collection modules()
     {
         TreeSet<WikiModuleInfo> ls = new TreeSet<WikiModuleInfo>();
         
-        for( WikiModuleInfo wmi : m_pluginClassMap.values() )
+        for( Iterator i = m_pluginClassMap.values().iterator(); i.hasNext(); )
         {
+            WikiModuleInfo wmi = (WikiModuleInfo)i.next();
+            
             if( !ls.contains(wmi) ) ls.add(wmi);
         }
         
         return ls;
     }
 
+    /**
+     *  Executes parse stage, unless plugins are disabled.
+     *  
+     *  @param content The content item.
+     *  @param context A WikiContext
+     *  @throws PluginException If something goes wrong.
+     */
     // FIXME: This method needs to be reintegrated with execute() above, since they
     //        share plenty of code.
     public void executeParse(PluginContent content, WikiContext context)

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/RPCSamplePlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/RPCSamplePlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/RPCSamplePlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/RPCSamplePlugin.java Sun Aug  3 05:22:13 2008
@@ -36,7 +36,7 @@
     /**
      *  This method is called when the Javascript is encountered by
      *  the browser.
-     *  @param echo
+     *  @param echo The parameter
      *  @return the string <code>JSON says:</code>, plus the value 
      *  supplied by the <code>echo</code> parameter
      */
@@ -46,7 +46,9 @@
     }
     
 
-    
+    /**
+     *  {@inheritDoc}
+     */
     public String execute(WikiContext context, Map params) throws PluginException
     {
         JSONRPCManager.registerJSONObject( context, this );

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/RecentChangesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/RecentChangesPlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/RecentChangesPlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/RecentChangesPlugin.java Sun Aug  3 05:22:13 2008
@@ -31,8 +31,10 @@
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
 import com.ecyrd.jspwiki.WikiPage;
-import com.ecyrd.jspwiki.action.*;
 import com.ecyrd.jspwiki.attachment.Attachment;
+import com.ecyrd.jspwiki.i18n.InternationalizationManager;
+import com.ecyrd.jspwiki.preferences.Preferences;
+import com.ecyrd.jspwiki.preferences.Preferences.TimeFormat;
 
 /**
  *  Returns the Recent Changes.
@@ -44,9 +46,9 @@
 public class RecentChangesPlugin
     implements WikiPlugin
 {
-    private static final String PARAM_FORMAT = "format";
-    private static final String PARAM_TIME_FORMAT = "timeFormat";
-    private static final String PARAM_DATE_FORMAT = "dateFormat";
+    public static final String PARAM_FORMAT = "format";
+    public static final String PARAM_TIME_FORMAT = "timeFormat";
+    public static final String PARAM_DATE_FORMAT = "dateFormat";
 
     /** How many days we show by default. */
     private static final int    DEFAULT_DAYS = 100*365;
@@ -101,8 +103,8 @@
         {
             Date olddate   = new Date(0);
 
-            DateFormat fmt = getDateFormat(params);
-            DateFormat tfmt = getTimeFormat(params);
+            DateFormat fmt = getDateFormat( context, params );
+            DateFormat tfmt = getTimeFormat( context, params );
 
             table rt = new table();
             rt.setCellPadding(spacing).setClass("recentchanges");
@@ -131,7 +133,7 @@
                     olddate = lastmod;
                 }
 
-                String link = context.getContext().getURL( pageref instanceof Attachment ? AttachActionBean.class : ViewActionBean.class, 
+                String link = context.getURL( pageref instanceof Attachment ? WikiContext.ATTACH : WikiContext.VIEW, 
                                               pageref.getName() ) ;
                 
                 a linkel = new a(link,engine.beautifyTitle(pageref.getName()));
@@ -145,8 +147,9 @@
                 //
                 if( pageref instanceof Attachment )
                 {
-                    linkel = new a().setHref(context.getContext().getURL(PageInfoActionBean.class,pageref.getName()));
-                    linkel.addElement( new img().setBorder(0).setSrc(context.getContext().getURL(NoneActionBean.class, "images/attachment_small.png")));
+                    linkel = new a().setHref(context.getURL(WikiContext.INFO,pageref.getName()));
+                    linkel.setClass("infolink");
+                    linkel.addElement( new img().setSrc(context.getURL(WikiContext.NONE, "images/attachment_small.png")));
 
                     col.addElement( linkel );
                 }
@@ -162,9 +165,7 @@
                 else
                 {
                     td infocol = (td) new td().setClass("lastchange");
-                    Map<String,String> urlParams = new HashMap<String,String>();
-                    urlParams.put("r1", "-1");
-                    infocol.addElement( new a(context.getContext().getURL(DiffActionBean.class, pageref.getName(), urlParams),tfmt.format(lastmod)) );
+                    infocol.addElement( new a(context.getURL(WikiContext.DIFF, pageref.getName(), "r1=-1"),tfmt.format(lastmod)) );
                     row.addElement(infocol);
                 }
 
@@ -183,7 +184,7 @@
                     {
                         if( engine.pageExists(author) )
                         {
-                            authorinfo.addElement( new a(context.getContext().getURL(ViewActionBean.class, author),author) );
+                            authorinfo.addElement( new a(context.getURL(WikiContext.VIEW, author),author) );
                         }
                         else
                         {
@@ -192,7 +193,7 @@
                     }
                     else
                     {
-                        authorinfo.addElement("unknown");
+                        authorinfo.addElement( context.getBundle(InternationalizationManager.CORE_BUNDLE).getString( "common.unknownauthor" ) );
                     }
 
                     row.addElement( authorinfo );
@@ -228,24 +229,24 @@
     // locale, but that is at odds with the 1st version of this plugin. We seek to preserve the
     // behaviour of that first version, so to get the default format, the user must explicitly do
     // something like: dateFormat='' timeformat='' which is a odd, but probably okay.
-    private DateFormat getTimeFormat(Map params)
+    private DateFormat getTimeFormat( WikiContext context, Map params )
     {
         String formatString = get(params, "HH:mm:ss", PARAM_TIME_FORMAT);
 
         if ("".equals(formatString.trim()))
-            return SimpleDateFormat.getTimeInstance();
+            return Preferences.getDateFormat( context, TimeFormat.TIME );
 
         return new SimpleDateFormat(formatString);
     }
 
 
 
-    private DateFormat getDateFormat(Map params)
+    private DateFormat getDateFormat( WikiContext context, Map params )
     {
         String formatString = get(params, "dd.MM.yyyy", PARAM_DATE_FORMAT);
 
         if ("".equals(formatString.trim()))
-            return SimpleDateFormat.getDateInstance();
+            return Preferences.getDateFormat( context, TimeFormat.DATE );
 
         return new SimpleDateFormat(formatString);
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferredPagesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferredPagesPlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferredPagesPlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferredPagesPlugin.java Sun Aug  3 05:22:13 2008
@@ -20,6 +20,14 @@
 */
 package com.ecyrd.jspwiki.plugin;
 
+import java.util.*;
+
+import org.apache.log4j.Logger;
+import org.apache.oro.text.regex.*;
+
+import com.ecyrd.jspwiki.*;
+
+
 /**
  *  Displays the pages referring to the current page.
  *
@@ -36,21 +44,12 @@
  *
  *  @author Dirk Frederickx
  */
-
-import java.util.*;
-
-import org.apache.log4j.Logger;
-import org.apache.oro.text.regex.*;
-
-import com.ecyrd.jspwiki.*;
-import com.ecyrd.jspwiki.action.ViewActionBean;
-
 public class ReferredPagesPlugin implements WikiPlugin
 {
     private static Logger log = Logger.getLogger( ReferredPagesPlugin.class );
     private WikiEngine     m_engine;
     private int            m_depth;
-    private HashSet        m_exists  = new HashSet();
+    private HashSet<String> m_exists  = new HashSet<String>();
     private StringBuffer   m_result  = new StringBuffer(1024);
     private PatternMatcher m_matcher = new Perl5Matcher();
     private Pattern        m_includePattern;
@@ -58,15 +57,33 @@
     private boolean m_formatCompact  = true;
     private boolean m_formatSort     = false;
 
+    /** The parameter name for the root page to start from.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_ROOT    = "page";
+
+    /** The parameter name for the depth.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_DEPTH   = "depth";
+
+    /** The parameter name for the type of the references.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_TYPE    = "type";
+    
+    /** The parameter name for the included pages.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_INCLUDE = "include";
+    
+    /** The parameter name for the excluded pages.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_EXCLUDE = "exclude";
+    
+    /** The parameter name for the format.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_FORMAT  = "format";
+    
+    /** The minimum depth. Value is <tt>{@value}</tt>. */
     public static final int    MIN_DEPTH = 1;
+    
+    /** The maximum depth. Value is <tt>{@value}</tt>. */
     public static final int    MAX_DEPTH = 8;
 
+    /**
+     *  {@inheritDoc}
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
@@ -155,7 +172,8 @@
      * Retrieves a list of all referred pages. Is called recursively
      * depending on the depth parameter
      */
-    protected void getReferredPages( WikiContext context, String pagename, int depth )
+    @SuppressWarnings("unchecked")
+    private void getReferredPages( WikiContext context, String pagename, int depth )
     {
         if( depth >= m_depth ) return;  // end of recursion
         if( pagename == null ) return;
@@ -163,19 +181,19 @@
 
         ReferenceManager mgr = m_engine.getReferenceManager();
 
-        Collection allPages = mgr.findRefersTo( pagename );
+        Collection<String> allPages = mgr.findRefersTo( pagename );
 
         handleLinks( context, allPages, ++depth, pagename );
     }
 
-    protected void handleLinks(WikiContext context,Collection links, int depth, String pagename)
+    private void handleLinks(WikiContext context,Collection<String> links, int depth, String pagename)
     {
         boolean isUL = false;
-        HashSet localLinkSet = new HashSet();  // needed to skip multiple
+        HashSet<String> localLinkSet = new HashSet<String>();  // needed to skip multiple
         // links to the same page
         localLinkSet.add(pagename);
 
-        ArrayList allLinks = new ArrayList();
+        ArrayList<String> allLinks = new ArrayList<String>();
 
         if( links != null )
             allLinks.addAll( links );
@@ -220,7 +238,7 @@
                     isUL = true; m_result.append("<ul>\n");
                 }
 
-                String href = context.getContext().getURL(ViewActionBean.class,link);  
+                String href = context.getURL(WikiContext.VIEW,link);
                 m_result.append("<li><a class=\"wikipage\" href=\""+ href +"\">"+link+"</a></li>\n" );
 
                 m_exists.add( link );

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java Sun Aug  3 05:22:13 2008
@@ -22,7 +22,6 @@
 
 import org.apache.log4j.Logger;
 import com.ecyrd.jspwiki.*;
-import com.ecyrd.jspwiki.action.PageInfoActionBean;
 
 import java.text.MessageFormat;
 import java.util.*;
@@ -30,24 +29,41 @@
 /**
  *  Displays the pages referring to the current page.
  *
- *  Parameters: <BR>
- *  max: How many items to show.<BR>
- *  extras: How to announce extras.<BR>
- *  From AbstractReferralPlugin:<BR>
- *  separator: How to separate generated links; default is a wikitext line break,
- *             producing a vertical list.<BR>
- *  maxwidth: maximum width, in chars, of generated links.
- *
+ *  Parameters:
+ *  <ul>
+ *  <li><b>max</b> - How many items to show.</li>
+ *  <li><b>extras</b> - How to announce extras.</li>
+ *  <li><b>page</b> - Which page to get the table of contents from.</li>
+ *  </ul>
+ *  
+ *  From AbstractReferralPlugin:
+ *  <ul>
+ *  <li><b>separator</b> - How to separate generated links; default is a wikitext line break,
+ *             producing a vertical list.</li>
+ *  <li><b>maxwidth</b> - maximum width, in chars, of generated links.</li>
+ *  </ul>
  */
 public class ReferringPagesPlugin
     extends AbstractReferralPlugin
 {
     private static Logger log = Logger.getLogger( ReferringPagesPlugin.class );
 
+    /** Parameter name for setting the maximum items to show.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_MAX      = "max";
+
+    /** Parameter name for setting the text to show when the maximum items is overruled.  
+     *  Value is <tt>{@value}</tt>. 
+     */
     public static final String PARAM_EXTRAS   = "extras";
+    
+    /**
+     *  Parameter name for choosing the page.  Value is <tt>{@value}</tt>.
+     */
     public static final String PARAM_PAGE     = "page";
     
+    /**
+     *  {@inheritDoc}
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
@@ -55,6 +71,8 @@
         String pageName = (String)params.get( PARAM_PAGE );
         ResourceBundle rb = context.getBundle(WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
         
+        StringBuffer result = new StringBuffer( 256 );
+        
         if( pageName == null )
         {
             pageName = context.getPage().getName();
@@ -76,32 +94,51 @@
                 extras = rb.getString("referringpagesplugin.more");
             }
             
-            log.debug( "Fetching referring pages for "+page.getName()+
-                       " with a max of "+items);
+            if( log.isDebugEnabled() )
+                log.debug( "Fetching referring pages for "+page.getName()+
+                           " with a max of "+items);
         
             if( links != null && links.size() > 0 )
             {
                 links = filterCollection( links );
                 wikitext = wikitizeCollection( links, m_separator, items );
 
+                result.append( makeHTML( context, wikitext ) );
+                
                 if( items < links.size() && items > 0 )
                 {
-                    Object[] args = { "" + ( links.size() - items),
-                                      context.getContext().getURL( PageInfoActionBean.class, page.getName() ) };
-                    extras = MessageFormat.format(extras, args); 
-                    wikitext += extras;
+                    Object[] args = { "" + ( links.size() - items) };
+                    extras = MessageFormat.format(extras, args);
+                    
+                    result.append( "<br />" );
+                    result.append( "<a class='morelink' href='"+context.getURL( WikiContext.INFO, page.getName() )+"' ");
+                    result.append( ">"+extras+"</a><br />");
                 }
             }
 
             //
-            //  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");
+                
+                result.append( makeHTML( context, wikitext ) );
             }
-
-            return makeHTML( context, wikitext );
+            else
+            {
+                if( m_show.equals( PARAM_SHOW_VALUE_COUNT ) )
+                {
+                    result = new StringBuffer();
+                    result.append( links.size() );
+                    if( m_lastModified )
+                    {
+                        result.append( " (" + m_dateFormat.format( m_dateLastModified ) + ")" );
+                    }
+                }
+            }
+            
+            return result.toString();
         }
 
         return "";

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Search.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Search.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Search.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/Search.java Sun Aug  3 05:22:13 2008
@@ -31,7 +31,6 @@
 import com.ecyrd.jspwiki.SearchResult;
 import com.ecyrd.jspwiki.WikiContext;
 import com.ecyrd.jspwiki.WikiEngine;
-import com.ecyrd.jspwiki.action.ViewActionBean;
 import com.ecyrd.jspwiki.providers.ProviderException;
 
 /**
@@ -42,13 +41,24 @@
 {
     static Logger log = Logger.getLogger(Search.class);
     
+    /** Parameter name for setting the query string.  Value is <tt>{@value}</tt>. */
     public static final String PARAM_QUERY = "query";
+
+    /** Parameter name for setting the name of the set where the results are stored.  
+     *  Value is <tt>{@value}</tt>. 
+     */
     public static final String PARAM_SET   = "set";
+    
+    /** The default name of the result set. */
     public static final String DEFAULT_SETNAME = "_defaultSet";
+    
+    /** The parameter name for setting the how many results will be fetched.
+     *  Value is <tt>{@value}</tt>.
+     */
     public static final String PARAM_MAX   = "max";
     
-    /* (non-Javadoc)
-     * @see com.ecyrd.jspwiki.plugin.WikiPlugin#execute(com.ecyrd.jspwiki.WikiContext, java.util.Map)
+    /**
+     * {@inheritDoc}
      */
     public String execute( WikiContext context, Map params ) throws PluginException
     {
@@ -120,7 +130,7 @@
             
             td name = new td().setWidth("30%");
             name.addElement( "<a href=\""+
-                             context.getContext().getURL( ViewActionBean.class, sr.getPage().getName() )+
+                             context.getURL( WikiContext.VIEW, sr.getPage().getName() )+
                              "\">"+engine.beautifyTitle(sr.getPage().getName())+"</a>");
             row.addElement( name );
             

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/SessionsPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/SessionsPlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/SessionsPlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/SessionsPlugin.java Sun Aug  3 05:22:13 2008
@@ -47,8 +47,12 @@
 public class SessionsPlugin
     implements WikiPlugin
 {
+    /** The parameter name for setting the property value. */
     public static final String PARAM_PROP = "property";
     
+    /**
+     *  {@inheritDoc}
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
@@ -75,7 +79,7 @@
             Principal[] principals = WikiSession.userPrincipals(engine);
             // we do not assume that the principals are sorted, so first count
             // them :
-            HashMap distinctPrincipals = new HashMap();
+            HashMap<String,Integer> distinctPrincipals = new HashMap<String,Integer>();
             for (int i = 0; i < principals.length; i++)
             {
                 String principalName = principals[i].getName();
@@ -83,15 +87,15 @@
                 if (distinctPrincipals.containsKey(principalName))
                 {
                     // we already have an entry, increase the counter:
-                    int numSessions = ((Integer) distinctPrincipals.get(principalName)).intValue();
+                    int numSessions = distinctPrincipals.get(principalName).intValue();
                     // store the new value:
-                    distinctPrincipals.put(principalName, new Integer(++numSessions));
+                    distinctPrincipals.put(principalName, ++numSessions);
                 }
                 else
                 {
                     // first time we see this entry, add entry to HashMap with
                     // value 1
-                    distinctPrincipals.put(principalName, new Integer(1));
+                    distinctPrincipals.put(principalName, 1);
                 }
             }
             //
@@ -101,7 +105,7 @@
             while (entries.hasNext())
             {
                 Map.Entry entry = (Map.Entry)entries.next();
-                s.append((entry.getKey().toString() + "(" + entry.getValue().toString() + "), "));
+                s.append( entry.getKey().toString() + "(" + entry.getValue().toString() + "), " );
             }
             // remove the last comma and blank :
             return s.substring(0, s.length() - 2);

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/TableOfContents.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/TableOfContents.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/TableOfContents.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/TableOfContents.java Sun Aug  3 05:22:13 2008
@@ -22,7 +22,6 @@
 
 import org.apache.log4j.Logger;
 import com.ecyrd.jspwiki.*;
-import com.ecyrd.jspwiki.action.ViewActionBean;
 import com.ecyrd.jspwiki.parser.Heading;
 import com.ecyrd.jspwiki.parser.HeadingListener;
 import com.ecyrd.jspwiki.parser.JSPWikiMarkupParser;
@@ -32,7 +31,13 @@
 import java.io.IOException;
 
 /**
- *  Provides a table of contents.
+ *  Provides a table of contents.  Possible parameters are:
+ *  <ul>
+ *  <li><b>title</b> - The title of the table of contents.</li>
+ *  <li><b>numbered</b> - if true, generates automatically numbers for the headings.</li>
+ *  <li><b>start</b> - If using a numbered list, sets the start number.</li>
+ *  <li><b>prefix</b> - If using a numbered list, sets the prefix used for the list.</li>
+ *  </ul>
  *
  *  @since 2.2
  */
@@ -41,9 +46,16 @@
 {
     private static Logger log = Logger.getLogger( TableOfContents.class );
 
+    /** Parameter name for setting the title. */
     public static final String PARAM_TITLE = "title";
+    
+    /** Parameter name for setting whether the headings should be numbered. */
     public static final String PARAM_NUMBERED = "numbered";
+    
+    /** Parameter name for setting where the numbering should start. */
     public static final String PARAM_START = "start";
+    
+    /** Parameter name for setting what the prefix for the heading is. */
     public static final String PARAM_PREFIX = "prefix";
 
     private static final String VAR_ALREADY_PROCESSING = "__TableOfContents.processing";
@@ -57,6 +69,9 @@
     private int m_level3Index = 0;
     private int m_lastLevel = 0;
 
+    /**
+     *  {@inheritDoc}
+     */
     public void headingAdded( WikiContext context, Heading hd )
     {
         log.debug("HD: "+hd.m_level+", "+hd.m_titleText+", "+hd.m_titleAnchor);
@@ -98,7 +113,7 @@
         String titleSection = hd.m_titleSection.replace( '%', '_' );
         String pageName = context.getEngine().encodeName(context.getPage().getName()).replace( '%', '_' );
 
-        String url = context.getContext().getURL( ViewActionBean.class, context.getPage().getName() );
+        String url = context.getURL( WikiContext.VIEW, context.getPage().getName() );
         String sectref = "#section-"+pageName+"-"+titleSection;
 
         m_buf.append( "<a class=\"wikipage\" href=\""+url+sectref+"\">");
@@ -124,6 +139,9 @@
         m_lastLevel = hd.m_level;
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/UndefinedPagesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/UndefinedPagesPlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/UndefinedPagesPlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/UndefinedPagesPlugin.java Sun Aug  3 05:22:13 2008
@@ -21,6 +21,7 @@
 package com.ecyrd.jspwiki.plugin;
 
 import com.ecyrd.jspwiki.*;
+
 import java.util.*;
 
 /**
@@ -35,6 +36,10 @@
 public class UndefinedPagesPlugin
     extends AbstractReferralPlugin
 {
+    /**
+     *  {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
@@ -43,12 +48,27 @@
 
         super.initialize( context, params );
 
-        TreeSet sortedSet = new TreeSet();
+        TreeSet<String> sortedSet = new TreeSet<String>();
+
+        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 );
     }

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/UnusedPagesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/UnusedPagesPlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/UnusedPagesPlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/UnusedPagesPlugin.java Sun Aug  3 05:22:13 2008
@@ -45,11 +45,12 @@
     /**
      *  {@inheritDoc}
      */
+    @SuppressWarnings("unchecked")
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
         ReferenceManager refmgr = context.getEngine().getReferenceManager();
-        Collection links = refmgr.findUnreferenced();
+        Collection<String> links = refmgr.findUnreferenced();
         //
         // filter out attachments if "excludeattachments" was requested:
         //
@@ -71,13 +72,26 @@
 
         super.initialize( context, params );
 
-        TreeSet sortedSet = new TreeSet();
-
+        TreeSet<String> sortedSet = new TreeSet<String>();
+        
+        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() + " (" + m_dateFormat.format(m_dateLastModified) + ")";
+            }
+        }
+        else
+        {
+            wikitext = wikitizeCollection(sortedSet, m_separator, ALL_ITEMS);
+        }        
         return makeHTML( context, wikitext );
     }
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogArchivePlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogArchivePlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogArchivePlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogArchivePlugin.java Sun Aug  3 05:22:13 2008
@@ -1,26 +1,26 @@
 /* 
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2003 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.  
  */
 package com.ecyrd.jspwiki.plugin;
 
 import com.ecyrd.jspwiki.*;
-import com.ecyrd.jspwiki.action.ViewActionBean;
 import com.ecyrd.jspwiki.providers.ProviderException;
 import org.apache.log4j.Logger;
 
@@ -40,6 +40,9 @@
 
     private SimpleDateFormat m_monthUrlFormat;
 
+    /**
+     *  {@inheritDoc}
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
@@ -52,12 +55,10 @@
 
         if( weblogName == null ) weblogName = context.getPage().getName();
         
-        Map<String,String> dateParams = new HashMap<String,String>();
-        dateParams.put("weblog.startDate", "'ddMMyy'");
-        dateParams.put("weblog.days", "%d");
+
         m_monthUrlFormat = new SimpleDateFormat("'"+
-                                                context.getContext().getURL( ViewActionBean.class, weblogName,dateParams)+
-                                                "'");
+                                                context.getURL( WikiContext.VIEW, weblogName,
+                                                                "weblog.startDate='ddMMyy'&amp;weblog.days=%d")+"'");
 
         StringBuffer sb = new StringBuffer();
 
@@ -116,11 +117,12 @@
         return sb.toString();
     }
 
+    @SuppressWarnings("unchecked")
     private SortedSet collectMonths( WikiEngine engine, String page )
         throws ProviderException
     {
         Comparator comp = new ArchiveComparator();
-        TreeSet res = new TreeSet( comp );
+        TreeSet<Calendar> res = new TreeSet<Calendar>( comp );
 
         WeblogPlugin pl = new WeblogPlugin();
 

Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogEntryPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogEntryPlugin.java?rev=682148&r1=682147&r2=682148&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogEntryPlugin.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/plugin/WeblogEntryPlugin.java Sun Aug  3 05:22:13 2008
@@ -1,26 +1,26 @@
 /* 
     JSPWiki - a JSP-based WikiWiki clone.
 
-    Copyright (C) 2002 Janne Jalkanen (Janne.Jalkanen@iki.fi)
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation; either version 2.1 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.  
  */
 package com.ecyrd.jspwiki.plugin;
 
 import com.ecyrd.jspwiki.*;
-import com.ecyrd.jspwiki.action.NewBlogEntryActionBean;
 import com.ecyrd.jspwiki.providers.ProviderException;
 import org.apache.log4j.Logger;
 
@@ -36,7 +36,7 @@
 {
     private static Logger     log = Logger.getLogger(WeblogEntryPlugin.class);
 
-    public static final int MAX_BLOG_ENTRIES = 10000; // Just a precaution.
+    private static final int MAX_BLOG_ENTRIES = 10000; // Just a precaution.
 
     public static final String PARAM_ENTRYTEXT = "entrytext";
     /** 
@@ -47,6 +47,15 @@
     // "page" for uniform naming with WeblogPlugin...
     public static final String PARAM_BLOGNAME = "page"; 
 
+    /**
+     *  Returns a new page name for entries.  It goes through the list of
+     *  all blog pages, and finds out the next in line.
+     *  
+     *  @param engine A WikiEngine
+     *  @param blogName The page (or blog) name.
+     *  @return A new name.
+     *  @throws ProviderException If something goes wrong.
+     */
     public String getNewEntryPage( WikiEngine engine, String blogName )
         throws ProviderException
     {
@@ -65,6 +74,9 @@
         return blogPage;
     }
 
+    /**
+     *  {@inheritDoc}
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
@@ -83,9 +95,7 @@
         if( entryText == null ) 
             entryText = rb.getString("weblogentryplugin.newentry");
         
-        Map<String,String> blogParams = new HashMap<String,String>();
-        blogParams.put("page", engine.encodeName(weblogName));
-        String url = context.getContext().getURL( NewBlogEntryActionBean.class, null, blogParams );
+        String url = context.getURL( WikiContext.NONE, "NewBlogEntry.jsp", "page="+engine.encodeName(weblogName) );
             
         sb.append("<a href=\""+url+"\">"+entryText+"</a>");
 



Mime
View raw message