Author: jalkanen
Date: Sun May 11 11:27:54 2008
New Revision: 655352

URL: http://svn.apache.org/viewvc?rev=655352&view=rev
Log:
[JSPWIKI-260] ReferringPagesPlugin now creates the "more" link URL properly.  
This also impacts the localization of the "referringpagesplugin.more" in 
PluginResources.

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/build.xml
    
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/i18n/InternationalizationManager.java
    
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/WikiPlugin.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java
    incubator/jspwiki/trunk/tests/TranslationsCheck.java
    
incubator/jspwiki/trunk/tests/com/ecyrd/jspwiki/plugin/ReferringPagesPluginTest.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=655352&r1=655351&r2=655352&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Sun May 11 11:27:54 2008
@@ -2,6 +2,16 @@
 
         * 2.7.0-svn-22
         
+        * [JSPWIKI-260] ReferringPagesPlugin now creates the "more"
+        link URL properly.  This also impacts the localization of
+        the "referringpagesplugin.more" in PluginResources.
+        
+        * Moved plugin resources from etc/i18n/com/ecyrd/jspwiki/plugin 
+        to etc/i18n/plugin.  Can't remember who suggested this.  Also
+        cleaned build.xml to make sure the plugin files are created
+        properly.  Can't remember who suggested this, neither can
+        I seem to find the JIRA issue...
+        
         * [JSPWIKI-224] TranslatorReader now is just a proxy to the
         JSPWikiMarkupParser.  It will be finally gone in 3.0.
         

Modified: incubator/jspwiki/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/build.xml?rev=655352&r1=655351&r2=655352&view=diff
==============================================================================
--- incubator/jspwiki/trunk/build.xml (original)
+++ incubator/jspwiki/trunk/build.xml Sun May 11 11:27:54 2008
@@ -295,7 +295,7 @@
               used. FIXME: Figure out a better way to do this in the future. 
-->
          <copy file="${code.i18n}/CoreResources.properties" 
tofile="${code.i18n}/CoreResources_en.properties"/>
          <copy file="${code.i18n}/templates/default.properties" 
tofile="${code.i18n}/templates/default_en.properties"/>
-         <copy 
file="${code.i18n}/com/ecyrd/jspwiki/plugin/PluginResources.properties" 
tofile="${code.i18n}/com/ecyrd/jspwiki/plugin/PluginResources_en.properties"/>
+         <copy file="${code.i18n}/plugin/PluginResources.properties" 
tofile="${code.i18n}/plugin/PluginResources_en.properties"/>
       <jar jarfile="${jarfile}">
          <fileset dir="${code.build}" includes="**/*.class" />
          <fileset dir="${code.src}" includes="com/**/*.properties" />
@@ -1297,8 +1297,8 @@
        <copy file="etc/i18n/templates/default.properties"
                  
tofile="${tmplt.i18n.dir}/${ant.project.name}_${i18n.template}/etc/i18n/templates/default_${i18n.template}.properties"
                  overwrite="true"/>
-       <copy file="src/com/ecyrd/jspwiki/plugin/PluginResources.properties"
-                 
tofile="${tmplt.i18n.dir}/${ant.project.name}_${i18n.template}/src/com/ecyrd/jspwiki/plugin/PluginResources_${i18n.template}.properties"
+       <copy file="etc/i18n/plugin/PluginResources.properties"
+                 
tofile="${tmplt.i18n.dir}/${ant.project.name}_${i18n.template}/etc/i18n/plugin/PluginResources_${i18n.template}.properties"
                  overwrite="true" />
 
        <echo message="Now you can start translating at 
${tmplt.i18n.dir}/${ant.project.name}_${i18n.template}." />

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/i18n/InternationalizationManager.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/i18n/InternationalizationManager.java?rev=655352&r1=655351&r2=655352&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/i18n/InternationalizationManager.java
 (original)
+++ 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/i18n/InternationalizationManager.java
 Sun May 11 11:27:54 2008
@@ -61,7 +61,7 @@
     {
         return get( CORE_BUNDLE, Locale.ENGLISH, key );
     }
-
+    
     /**
      *  Finds a resource bundle.
      *

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java?rev=655352&r1=655351&r2=655352&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java 
(original)
+++ 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/ReferringPagesPlugin.java 
Sun May 11 11:27:54 2008
@@ -47,6 +47,9 @@
     public static final String PARAM_EXTRAS   = "extras";
     public static final String PARAM_PAGE     = "page";
     
+    /**
+     *  [EMAIL PROTECTED]
+     */
     public String execute( WikiContext context, Map params )
         throws PluginException
     {
@@ -54,6 +57,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,20 +80,25 @@
                 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 />");
                 }
             }
 
@@ -98,21 +108,23 @@
             if (links == null || links.size() == 0)
             {
                 wikitext = rb.getString("referringpagesplugin.nobody");
+                
+                result.append( makeHTML( context, wikitext ) );
             }
             else
             {
-
-                if (m_show.equals(PARAM_SHOW_VALUE_COUNT))
+                if( m_show.equals( PARAM_SHOW_VALUE_COUNT ) )
                 {
-                    wikitext = "" + links.size();
-                    if (m_lastModified)
+                    result = new StringBuffer();
+                    result.append( links.size() );
+                    if( m_lastModified )
                     {
-                        wikitext = links.size() + " (" + 
m_dateFormat.format(m_dateLastModified) + ")";
+                        result.append( " (" + m_dateFormat.format( 
m_dateLastModified ) + ")" );
                     }
                 }
             }
             
-            return makeHTML( context, wikitext );
+            return result.toString();
         }
 
         return "";

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/WikiPlugin.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/WikiPlugin.java?rev=655352&r1=655351&r2=655352&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/WikiPlugin.java 
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/WikiPlugin.java Sun 
May 11 11:27:54 2008
@@ -31,7 +31,7 @@
  */
 public interface WikiPlugin
 {
-    static final String CORE_PLUGINS_RESOURCEBUNDLE = 
"com.ecyrd.jspwiki.plugin.PluginResources";
+    static final String CORE_PLUGINS_RESOURCEBUNDLE = "plugin.PluginResources";
 
     /**
      *  This is the main entry point for any plugin.  The parameters are 
parsed,

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java?rev=655352&r1=655351&r2=655352&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java 
(original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/preferences/Preferences.java 
Sun May 11 11:27:54 2008
@@ -257,15 +257,19 @@
             default:
                 throw new InternalWikiException( "Got a TimeFormat for which 
we have no value!" );
         }
-
+        
         try
         {
-            TimeZone tz = TimeZone.getTimeZone( prefTimeZone );
-            // TimeZone tz = TimeZone.getDefault();
-            // tz.setRawOffset(Integer.parseInt(prefTimeZone));
-
             SimpleDateFormat fmt = new SimpleDateFormat( prefDateFormat, 
clientLocale );
-            fmt.setTimeZone( tz );
+
+            if( prefTimeZone != null )
+            {
+                TimeZone tz = TimeZone.getTimeZone( prefTimeZone );
+                // TimeZone tz = TimeZone.getDefault();
+                // tz.setRawOffset(Integer.parseInt(prefTimeZone));
+
+                fmt.setTimeZone( tz );
+            }
 
             return fmt;
         }

Modified: incubator/jspwiki/trunk/tests/TranslationsCheck.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/TranslationsCheck.java?rev=655352&r1=655351&r2=655352&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/TranslationsCheck.java (original)
+++ incubator/jspwiki/trunk/tests/TranslationsCheck.java Sun May 11 11:27:54 
2008
@@ -54,9 +54,9 @@
              "/etc/i18n/templates/default_" + suffix + ".properties");
         detectDuplicates("/etc/i18n/templates/default_" + suffix + 
".properties");
 
-        diff("/src/com/ecyrd/jspwiki/plugin/PluginResources.properties",
-             "/src/com/ecyrd/jspwiki/plugin/PluginResources_" + suffix + 
".properties");
-        detectDuplicates("/src/com/ecyrd/jspwiki/plugin/PluginResources_" + 
suffix + ".properties");
+        diff("/etc/i18n/plugin/PluginResources.properties",
+             "/etc/i18n/plugin/PluginResources_" + suffix + ".properties");
+        detectDuplicates("/etc/i18n/plugin/PluginResources_" + suffix + 
".properties");
         
         System.out.println("Duplicates overall (two or more occurences):");
         System.out.println("--------------------------------------------");

Modified: 
incubator/jspwiki/trunk/tests/com/ecyrd/jspwiki/plugin/ReferringPagesPluginTest.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/com/ecyrd/jspwiki/plugin/ReferringPagesPluginTest.java?rev=655352&r1=655351&r2=655352&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/tests/com/ecyrd/jspwiki/plugin/ReferringPagesPluginTest.java
 (original)
+++ 
incubator/jspwiki/trunk/tests/com/ecyrd/jspwiki/plugin/ReferringPagesPluginTest.java
 Sun May 11 11:27:54 2008
@@ -96,10 +96,10 @@
             count++;
         }
     
-        // there are always 2 more "<a" 's in the result 
-        assertEquals( 5+2, count );
+        // there is one extra "<a" in the result 
+        assertEquals( 5+1, count );
     
-        String expected = ">2 more</a>";
+        String expected = ">...and 2 more</a>";
         count =0;
         while( (index = res.indexOf(expected,index+1)) != -1 )
         {
@@ -182,7 +182,7 @@
         
         String dateString = 
result.substring(result.indexOf("(")+1,result.indexOf(")"));
         // the date should be parseable:
-        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss dd-MMM-yyyy zzz");
         df.parse(dateString);
 
         // test if the proper exception is thrown:


Reply via email to