jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jalka...@apache.org
Subject svn commit: r649969 - /incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java
Date Sun, 20 Apr 2008 20:12:37 GMT
Author: jalkanen
Date: Sun Apr 20 13:12:35 2008
New Revision: 649969

URL: http://svn.apache.org/viewvc?rev=649969&view=rev
Log:
JSPWIKI-241. Now uses proper routines instead of fixed defaults.

Modified:
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java?rev=649969&r1=649968&r2=649969&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/plugin/CurrentTimePlugin.java Sun Apr 20
13:12:35 2008
@@ -22,6 +22,9 @@
 
 import org.apache.log4j.Logger;
 import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.preferences.Preferences;
+import com.ecyrd.jspwiki.preferences.Preferences.TimeFormat;
+
 import java.util.*;
 import java.text.SimpleDateFormat;
 
@@ -37,25 +40,20 @@
 {
     private static Logger log = Logger.getLogger( CurrentTimePlugin.class );
 
-    public static final String DEFAULT_FORMAT = "HH:mm:ss dd-MMM-yyyy zzzz";
-
     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 = Prefernces.getDateFormat( pageContext );
+            SimpleDateFormat fmt;
             
+            if( formatString != null )
+                fmt = new SimpleDateFormat( formatString );
+            else
+                fmt = Preferences.getDateFormat( context, TimeFormat.DATETIME );
+
             Date d = new Date();  // Now.
 
             return fmt.format( d );



Mime
View raw message