You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ja...@apache.org on 2008/11/03 22:33:40 UTC

svn commit: r710169 - in /incubator/jspwiki/trunk: ./ etc/i18n/ etc/i18n/plugin/ etc/i18n/templates/ src/com/ecyrd/jspwiki/ src/com/ecyrd/jspwiki/attachment/ src/com/ecyrd/jspwiki/plugin/ src/webdocs/templates/default/

Author: jalkanen
Date: Mon Nov  3 13:33:38 2008
New Revision: 710169

URL: http://svn.apache.org/viewvc?rev=710169&view=rev
Log:
Merged with 2.8 branch. JSPWIKI-407.

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/etc/i18n/CoreResources.properties
    incubator/jspwiki/trunk/etc/i18n/CoreResources_fi.properties
    incubator/jspwiki/trunk/etc/i18n/CoreResources_nl.properties
    incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources.properties
    incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources_fi.properties
    incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources_nl.properties
    incubator/jspwiki/trunk/etc/i18n/templates/default_fi.properties
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/VariableManager.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentManager.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentServlet.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/ListLocksPlugin.java
    incubator/jspwiki/trunk/src/webdocs/templates/default/GroupContent.jsp
    incubator/jspwiki/trunk/src/webdocs/templates/default/GroupTab.jsp

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Mon Nov  3 13:33:38 2008
@@ -1,3 +1,7 @@
+2008-11-03  Janne Jalkanen <ja...@apache.org>
+
+        * Merged changes from 2.8: JSPWIKI-407.
+
 2008-11-02  Janne Jalkanen <ja...@apache.org>
 
         * Merged changes from 2.8 branch: JSPWIKI-288, JSPWIKI-406,

Modified: incubator/jspwiki/trunk/etc/i18n/CoreResources.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/CoreResources.properties?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/CoreResources.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/CoreResources.properties Mon Nov  3 13:33:38 2008
@@ -196,3 +196,14 @@
 
 # RSSImageLinkTag
 rss.title=RSS feed for page {0}
+
+# AttachmentManager
+attach.unwanted.file=Unwanted file name.
+attach.empty.file=Empty file name given.
+attach.parent.not.exist=Parent page does not exist
+
+# VariableManager
+varmgr.not.logged.in=not logged in
+varmgr.authenticated=authenticated
+varmgr.asserted=asserted
+varmgr.anonymous=anonymous

Modified: incubator/jspwiki/trunk/etc/i18n/CoreResources_fi.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/CoreResources_fi.properties?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/CoreResources_fi.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/CoreResources_fi.properties Mon Nov  3 13:33:38 2008
@@ -155,3 +155,15 @@
 
 # RSSImageLinkTag
 rss.title=Sivun &quot;{0}&quot; RSS-syöte
+
+# Attachments
+attach.empty.file = Tyhjä tiedostonnimi.
+attach.parent.not.exist = Yläsivua ei ole olemassa.
+attach.unwanted.file = Kielletty tiedostonimi.
+
+# Variables
+varmgr.anonymous = anonyymi
+varmgr.asserted = asetettu
+varmgr.authenticated = kirjautunut
+varmgr.not.logged.in = kirjautumaton
+

Modified: incubator/jspwiki/trunk/etc/i18n/CoreResources_nl.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/CoreResources_nl.properties?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/CoreResources_nl.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/CoreResources_nl.properties Mon Nov  3 13:33:38 2008
@@ -195,4 +195,16 @@
 install.installer.validate.logdir=Je moet de log directory opgeven.
 
 # RSSImageLinkTag
-rss.title=RSS feed voor pagina {0}
\ No newline at end of file
+rss.title=RSS feed voor pagina {0}
+
+
+# AttachmentManager
+attach.unwanted.file=Ongewenste bestandsnaam
+attach.empty.file=Geen bestandsnaam opgegeven
+attach.parent.not.exist=De parent pagina bestaat niet
+
+# VariableManager
+varmgr.not.logged.in=niet ingelogd
+varmgr.authenticated=geauthenticeerd
+varmgr.asserted=aangenomen identiteit
+varmgr.anonymous=anoniem

Modified: incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources.properties?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources.properties Mon Nov  3 13:33:38 2008
@@ -46,4 +46,11 @@
 formoutput.missingargument = Argument &#39;{0}&#39; required for Form plugin
 formselect.namemissing = Select element is missing parameter &#39;name&#39;.
 formtextarea.noneedtoshow = (no need to show textarea field now)
-formtextarea.namemissing = Textarea element is missing parameter &#39;name&#39;.
\ No newline at end of file
+formtextarea.namemissing = Textarea element is missing parameter &#39;name&#39;.
+
+# ListLocks plugin
+plugin.listlocks.page=Page
+plugin.listlocks.locked.by=Locked by
+plugin.listlocks.acquired=Acquired
+plugin.listlocks.expires=Expires
+plugin.listlocks.no.locks.exist=No locks exist currently.
\ No newline at end of file

Modified: incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources_fi.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources_fi.properties?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources_fi.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources_fi.properties Mon Nov  3 13:33:38 2008
@@ -48,3 +48,10 @@
 plugin.error.notallowed = Ei lupaa käyttää laajennusta {0}
 plugin.error.notawikiplugin = Luokka {0} ei ole wikilaajennus
 plugin.error.parsingarguments = Gnöö: Ei voitu parsia parametreja {0}
+
+# ListLocks plugin
+plugin.listlocks.acquired = Lukko luotu
+plugin.listlocks.expires = Lukko umpeutuu
+plugin.listlocks.locked.by = Lukitsija
+plugin.listlocks.no.locks.exist = Ei lukkoja tällä hetkellä.
+plugin.listlocks.page = Sivu

Modified: incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources_nl.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources_nl.properties?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources_nl.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/plugin/PluginResources_nl.properties Mon Nov  3 13:33:38 2008
@@ -55,3 +55,10 @@
 formselect.namemissing=Het element 'select' verwacht een parameter 'name'.
 formtextarea.noneedtoshow=(form textarea is hier niet nodig)
 formtextarea.namemissing=Het element 'textarea' verwacht de parameter 'name'.
+
+# ListLocks plugin
+plugin.listlocks.page=Pagina
+plugin.listlocks.locked.by=In gebruik door
+plugin.listlocks.acquired=Sinds
+plugin.listlocks.expires=Loopt af
+plugin.listlocks.no.locks.exist=Er zijn momenteel geen locks.
\ No newline at end of file

Modified: incubator/jspwiki/trunk/etc/i18n/templates/default_fi.properties
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/etc/i18n/templates/default_fi.properties?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/etc/i18n/templates/default_fi.properties (original)
+++ incubator/jspwiki/trunk/etc/i18n/templates/default_fi.properties Mon Nov  3 13:33:38 2008
@@ -127,9 +127,6 @@
 # GroupContent.jsp
 
 group.tab=Näytä ryhmä
-group.areyousure=Oletko varma, että haluat poistaa ryhmän &quot;{0}&quot;? \
-    Käyttäjät eivät ehkä enää pääse sivuille, joiden pääsynvalvontalistoissa on tämä ryhmä. \\n\\n \
-    Jos painat OK, ryhmä poistetaan välittömästi.
 group.doesnotexist=Tätä ryhmää ei ole olemassa.
 group.createsuggestion=Mikset {0}
 group.createit=loisi sitä?

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/VariableManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/VariableManager.java?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/VariableManager.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/VariableManager.java Mon Nov  3 13:33:38 2008
@@ -22,10 +22,7 @@
 
 import java.lang.reflect.Method;
 import java.security.Principal;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
+import java.util.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
@@ -33,6 +30,7 @@
 import org.apache.log4j.Logger;
 
 import com.ecyrd.jspwiki.filters.PageFilter;
+import com.ecyrd.jspwiki.i18n.InternationalizationManager;
 import com.ecyrd.jspwiki.modules.InternalModule;
 
 /**
@@ -481,14 +479,15 @@
         public String getLoginstatus()
         {
             WikiSession session = m_context.getWikiSession();
-            return session.getStatus();
+            return m_context.getBundle(InternationalizationManager.CORE_BUNDLE).getString( "varmgr." + session.getStatus());
         }
 
         public String getUsername()
         {
             Principal wup = m_context.getCurrentUser();
-
-            return wup != null ? wup.getName() : "not logged in";
+            
+            ResourceBundle rb = m_context.getBundle( InternationalizationManager.CORE_BUNDLE );
+            return wup != null ? wup.getName() : rb.getString( "varmgr.not.logged.in" );
         }
 
         public String getRequestcontext()

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentManager.java?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentManager.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentManager.java Mon Nov  3 13:33:38 2008
@@ -487,7 +487,8 @@
         //
         if( !m_engine.getPageManager().pageExists( att.getParentName() ) )
         {
-            throw new ProviderException("Parent page does not exist");
+            // the caller should catch the exception and use the exception text as an i18n key
+            throw new ProviderException(  "attach.parent.not.exist"  );
         }
         
         m_provider.putAttachmentData( att, in );
@@ -603,9 +604,10 @@
     {
         if( filename == null || filename.trim().length() == 0 )
         {
-            AttachmentServlet.log.error("Empty file name given.");
+            log.error("Empty file name given.");
     
-            throw new WikiException("Empty file name given.");
+            // the caller should catch the exception and use the exception text as an i18n key
+            throw new WikiException(  "attach.empty.file" );
         }
     
         //
@@ -618,8 +620,9 @@
         {
             log.info( "Attempt to upload a file with a .jsp/.jspf extension.  In certain cases this" +
             		" can trigger unwanted security side effects, so we're preventing it." );
-            
-            throw new WikiException( "Unwanted file name." );
+            //
+            // the caller should catch the exception and use the exception text as an i18n key
+            throw new WikiException(  "attach.unwanted.file"  );
         }
     
         //

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentServlet.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentServlet.java?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentServlet.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentServlet.java Mon Nov  3 13:33:38 2008
@@ -54,6 +54,7 @@
 import com.ecyrd.jspwiki.dav.methods.DavMethod;
 import com.ecyrd.jspwiki.dav.methods.PropFindMethod;
 import com.ecyrd.jspwiki.filters.RedirectException;
+import com.ecyrd.jspwiki.i18n.InternationalizationManager;
 import com.ecyrd.jspwiki.providers.ProviderException;
 import com.ecyrd.jspwiki.ui.progress.ProgressItem;
 import com.ecyrd.jspwiki.util.HttpUtil;
@@ -723,8 +724,9 @@
         }
         catch( WikiException e )
         {
-            log.error( "Illegal filename given: "+e.getMessage() );
-            throw new RedirectException( e.getMessage(), errorPage );
+            // this is a kludge, the exception that is caught here contains the i18n key
+            // here we have the context available, so we can internationalize it properly :
+            throw new RedirectException(context.getBundle( InternationalizationManager.CORE_BUNDLE ).getString( e.getMessage() ), errorPage );
         }
         
         //
@@ -800,8 +802,14 @@
             {
                 att.setAttribute( WikiPage.CHANGENOTE, changenote );
             }
-
+            
+            try {
             m_engine.getAttachmentManager().storeAttachment( att, data );
+            } catch (ProviderException pe) {
+                // this is a kludge, the exception that is caught here contains the i18n key
+                // here we have the context available, so we can internationalize it properly :
+                throw new ProviderException( context.getBundle( InternationalizationManager.CORE_BUNDLE ).getString( pe.getMessage() ) );
+            }
 
             log.info( "User " + user + " uploaded attachment to " + parentPage +
                       " called "+filename+", size " + att.getSize() );

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/ListLocksPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/ListLocksPlugin.java?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/ListLocksPlugin.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/ListLocksPlugin.java Mon Nov  3 13:33:38 2008
@@ -44,15 +44,19 @@
 
         PageManager mgr = context.getEngine().getPageManager();
         List locks = mgr.getActiveLocks();
+        ResourceBundle rb = context.getBundle(WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
 
         result.append("<table class=\"wikitable\">\n");
         result.append("<tr>\n");
-        result.append("<th>Page</th><th>Locked by</th><th>Acquired</th><th>Expires</th>\n");
+        result.append( "<th>" + rb.getString( "plugin.listlocks.page" ) + "</th><th>" + rb.getString( "plugin.listlocks.locked.by" )
+                       + "</th><th>" + rb.getString( "plugin.listlocks.acquired" ) + "</th><th>"
+                       + rb.getString( "plugin.listlocks.expires" ) + "</th>\n" );
         result.append("</tr>");
 
         if( locks.size() == 0 )
         {
-            result.append("<tr><td colspan=\"4\" class=\"odd\">No locks exist currently.</td></tr>\n");
+            result.append( "<tr><td colspan=\"4\" class=\"odd\">" + rb.getString( "plugin.listlocks.no.locks.exist" )
+                           + "</td></tr>\n" );
         }
         else
         {

Modified: incubator/jspwiki/trunk/src/webdocs/templates/default/GroupContent.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/templates/default/GroupContent.jsp?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/templates/default/GroupContent.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/templates/default/GroupContent.jsp Mon Nov  3 13:33:38 2008
@@ -6,6 +6,7 @@
 <%@ page import="com.ecyrd.jspwiki.auth.PrincipalComparator" %>
 <%@ page import="com.ecyrd.jspwiki.auth.authorize.Group" %>
 <%@ page import="com.ecyrd.jspwiki.auth.authorize.GroupManager" %>
+<%@ page import="com.ecyrd.jspwiki.preferences.Preferences" %>
 <%@ page import="org.apache.log4j.*" %>
 <%@ page errorPage="/Error.jsp" %>
 <%@ page import="javax.servlet.jsp.jstl.fmt.*" %>
@@ -35,12 +36,12 @@
     creator = group.getCreator();
     if ( group.getCreated() != null )
     {
-      created = group.getCreated().toString();
+      created = Preferences.renderDate(WikiContext.findContext( pageContext ), group.getCreated(),Preferences.TimeFormat.DATETIME);
     }
     modifier = group.getModifier();
     if ( group.getLastModified() != null )
     {
-      modified = group.getLastModified().toString();
+      modified = Preferences.renderDate(WikiContext.findContext( pageContext ), group.getLastModified(),Preferences.TimeFormat.DATETIME) ; 
     }
   }
   name = TextUtil.replaceEntities(name);

Modified: incubator/jspwiki/trunk/src/webdocs/templates/default/GroupTab.jsp
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/webdocs/templates/default/GroupTab.jsp?rev=710169&r1=710168&r2=710169&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/webdocs/templates/default/GroupTab.jsp (original)
+++ incubator/jspwiki/trunk/src/webdocs/templates/default/GroupTab.jsp Mon Nov  3 13:33:38 2008
@@ -7,6 +7,7 @@
 <%@ page import="com.ecyrd.jspwiki.auth.PrincipalComparator" %>
 <%@ page import="com.ecyrd.jspwiki.auth.authorize.Group" %>
 <%@ page import="com.ecyrd.jspwiki.auth.authorize.GroupManager" %>
+<%@ page import="com.ecyrd.jspwiki.preferences.Preferences" %>
 <%@ page import="org.apache.log4j.*" %>
 <%@ page errorPage="/Error.jsp" %>
 <%@ page import="javax.servlet.jsp.jstl.fmt.*" %>
@@ -34,11 +35,11 @@
       
       ss.append( delim );
       mf = new MessageFormat(LocaleSupport.getLocalizedMessage(pageContext, "grp.createdon") );
-      args = new Object[]{(group.getCreated()==null) ? "" : group.getCreated().toString(), group.getCreator()};
+      args = new Object[]{(group.getCreated()==null) ? "" : Preferences.renderDate(WikiContext.findContext( pageContext ), group.getCreated(),Preferences.TimeFormat.DATETIME), group.getCreator()};
       ss.append( mf.format( args ) );
       
       mf = new MessageFormat(LocaleSupport.getLocalizedMessage(pageContext, "grp.lastmodified") );
-      args = new Object[]{(group.getCreated()==null) ? "" : group.getCreated().toString(), group.getModifier()};
+      args = new Object[]{(group.getLastModified()==null) ? "" : Preferences.renderDate(WikiContext.findContext( pageContext ), group.getLastModified(),Preferences.TimeFormat.DATETIME), group.getModifier()};
       ss.append( mf.format( args ) );
       
       ss.append( "\", " );