jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jalka...@apache.org
Subject svn commit: r657317 - /incubator/jspwiki/branches/JSPWIKI_2_6_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java
Date Sat, 17 May 2008 08:10:47 GMT
Author: jalkanen
Date: Sat May 17 01:10:47 2008
New Revision: 657317

URL: http://svn.apache.org/viewvc?rev=657317&view=rev
Log:
JSPWIKI-260: More-link is fixed.

Modified:
    incubator/jspwiki/branches/JSPWIKI_2_6_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java

Modified: incubator/jspwiki/branches/JSPWIKI_2_6_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_6_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java?rev=657317&r1=657316&r2=657317&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_6_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java
(original)
+++ incubator/jspwiki/branches/JSPWIKI_2_6_BRANCH/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java
Sat May 17 01:10:47 2008
@@ -36,7 +36,6 @@
  *             producing a vertical list.<BR>
  *  maxwidth: maximum width, in chars, of generated links.
  *
- *  @author Janne Jalkanen
  */
 public class ReferringPagesPlugin
     extends AbstractReferralPlugin
@@ -47,6 +46,9 @@
     public static final String PARAM_EXTRAS   = "extras";
     public static final String PARAM_PAGE     = "page";
     
+    /**
+     *  {@inheritDoc}
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
@@ -54,6 +56,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();
@@ -75,32 +79,39 @@
                 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.getURL( WikiContext.INFO, 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");
-            }
 
-            return makeHTML( context, wikitext );
+                result.append(makeHTML(context, wikitext));
+            }
+            
+            return result.toString();
         }
 
         return "";



Mime
View raw message