roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r541357 - in /roller/branches/roller_4.0_newbackend/src/org/apache/roller: business/hibernate/ pojos/ pojos/wrapper/ ui/core/ ui/core/filters/ ui/core/plugins/ ui/core/tags/calendar/ ui/core/tags/menu/ ui/core/util/menu/ ui/rendering/model/...
Date Thu, 24 May 2007 17:00:37 GMT
Author: snoopdave
Date: Thu May 24 10:00:35 2007
New Revision: 541357

URL: http://svn.apache.org/viewvc?view=rev&rev=541357
Log:
Merging latest from trunk

Modified:
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/BookmarkData.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/FolderData.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogEntryData.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogTemplate.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/wrapper/WebsiteDataWrapper.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/RollerContext.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/filters/CharEncodingFilter.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/plugins/TextEditor.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/plugins/XinhaEditor.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/tags/calendar/CalendarTag.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/tags/menu/MenuTag.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/util/menu/MenuHelper.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/MessageModel.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/SearchResultsFeedModel.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/SearchResultsFeedPager.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/SearchResultsPager.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesDayPager.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesMonthPager.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPermalinkPager.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/servlets/CommentServlet.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/servlets/TrackbackServlet.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/util/MailUtil.java
    roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/xmlrpc/MetaWeblogAPIHandler.java

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/business/hibernate/HibernateRollerImpl.java Thu May 24 10:00:35 2007
@@ -18,7 +18,6 @@
 
 package org.apache.roller.business.hibernate;
 
-import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
@@ -52,34 +51,25 @@
     private HibernatePersistenceStrategy strategy = null;
     
     // references to the managers we maintain
-    private BookmarkManager bookmarkManager = null;
+    private BookmarkManager   bookmarkManager = null;
     private PropertiesManager propertiesManager = null;
-    private RefererManager refererManager = null;
-    private UserManager userManager = null;
-    private WeblogManager weblogManager = null;
-    private PingQueueManager pingQueueManager = null;
-    private AutoPingManager autoPingManager = null;
+    private RefererManager    refererManager = null;
+    private UserManager       userManager = null;
+    private WeblogManager     weblogManager = null;
+    private PingQueueManager  pingQueueManager = null;
+    private AutoPingManager   autoPingManager = null;
     private PingTargetManager pingTargetManager = null;
-    private ThreadManager threadManager = null;
+    private ThreadManager     threadManager = null;
     
     
     protected HibernateRollerImpl() throws RollerException {
         try {
-            if (StringUtils.isNotEmpty(RollerConfig.getProperty("jdbc.driverClass"))) {
-                // create and configure for JDBC access
-                strategy = new HibernatePersistenceStrategy(
-                    RollerConfig.getProperty("hibernate.configResource"),
-                    RollerConfig.getProperty("hibernate.dialect"),
-                    RollerConfig.getProperty("jdbc.driverClass"),
-                    RollerConfig.getProperty("jdbc.connectionURL"),
-                    RollerConfig.getProperty("jdbc.username"),
-                    RollerConfig.getProperty("jdbc.password"));
-            } else {
-                // create an configure via config resource only
-                strategy = new HibernatePersistenceStrategy(
-                    RollerConfig.getProperty("hibernate.configResource"),
-                    RollerConfig.getProperty("hibernate.dialect"));
-            }
+            String dialect =  
+                RollerConfig.getProperty("hibernate.dialect");
+            String connectionProvider = 
+                RollerConfig.getProperty("hibernate.connectionProvider");
+            strategy = new HibernatePersistenceStrategy(
+                "/hibernate.cfg.xml", dialect, connectionProvider);
         } catch(Throwable t) {
             // if this happens then we are screwed
             mLogger.fatal("Error initializing Hibernate", t);
@@ -95,6 +85,11 @@
         if (me == null) {
             mLogger.debug("Instantiating HibernateRollerImpl");
             me = new HibernateRollerImpl();
+                                
+            // Now that Roller has been instantiated, initialize individual managers
+            me.getPropertiesManager();
+            me.getIndexManager();
+            me.getThemeManager();          
         }
         
         return me;

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/BookmarkData.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/BookmarkData.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/BookmarkData.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/BookmarkData.java Thu May 24 10:00:35 2007
@@ -32,10 +32,6 @@
  * the your BookmarkManager implementation.</p>
  *
  * @ejb:bean name="BookmarkData"
- * 
- * @struts.form include-all="true"
- *    extends="org.apache.struts.validator.ValidatorForm"
- * 
  * @hibernate.class lazy="true" table="bookmark"
  * @hibernate.cache usage="read-write"
  */

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/FolderData.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/FolderData.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/FolderData.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/FolderData.java Thu May 24 10:00:35 2007
@@ -39,11 +39,8 @@
  * set of Folders (there is no one root folder) and each Folder may contain
  * Folders or Bookmarks. Don't construct one of these yourself, instead use
  * the create method in your BookmarkManager implementation.</p>
- *
- * @struts.form include-all="true"
- *    extends="org.apache.struts.validator.ValidatorForm"
+ * 
  * @ejb:bean name="FolderData"
- *
  * @hibernate.class lazy="true" table="folder"
  * @hibernate.cache usage="read-write"
  */

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogEntryData.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogEntryData.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogEntryData.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogEntryData.java Thu May 24 10:00:35 2007
@@ -50,7 +50,7 @@
 import org.apache.roller.business.WeblogEntryPlugin;
 import org.apache.roller.business.WeblogManager;
 import org.apache.roller.util.DateUtil;
-import org.apache.roller.util.MessageUtilities;
+import org.apache.roller.util.I18nMessages;
 import org.apache.roller.util.URLUtilities;
 import org.apache.roller.util.UUIDGenerator;
 import org.apache.roller.util.Utilities;
@@ -1196,7 +1196,9 @@
                     // add read more
                     List args = new ArrayList();
                     args.add(readMoreLink);
-                    String readMore = MessageUtilities.getString("macro.weblog.readMoreLink", args);
+                    
+                    // TODO: we need a more appropriate way to get the view locale here
+                    String readMore = I18nMessages.getMessages(getWebsite().getLocaleInstance()).getString("macro.weblog.readMoreLink", args);
                     
                     displayContent += readMore;
                 }

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogTemplate.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogTemplate.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogTemplate.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/WeblogTemplate.java Thu May 24 10:00:35 2007
@@ -304,8 +304,12 @@
     }
     
     
-    public void setRequired(boolean req) {
-        // this is an absurd workaround for our struts formbean generation stuff
+    /**
+     * A convenience method for testing if this template represents a 'custom'
+     * template, meaning a template with action = ACTION_CUSTOM.
+     */
+    public boolean isCustom() {
+        return ACTION_CUSTOM.equals(getAction()) && !isRequired();
     }
     
     

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/wrapper/WebsiteDataWrapper.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/wrapper/WebsiteDataWrapper.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/wrapper/WebsiteDataWrapper.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/pojos/wrapper/WebsiteDataWrapper.java Thu May 24 10:00:35 2007
@@ -424,7 +424,7 @@
     
     public String getCustomStylesheet() {
         // custom stylesheet comes from the weblog theme
-        return this.pojo.getTheme().getCustomStylesheet();
+        return URLUtilities.getWeblogPageURL(this.pojo, null, this.pojo.getTheme().getCustomStylesheet(), null, null, null, null, 0, false);
     }
     
     
@@ -440,7 +440,7 @@
             return iconPath;
         } else {
             // otherwise it's just a plain old url
-            return URLUtilities.getWeblogResourceURL(this.pojo, iconPath, true);
+            return URLUtilities.getWeblogResourceURL(this.pojo, iconPath, false);
         }
         
     }

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/RollerContext.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/RollerContext.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/RollerContext.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/RollerContext.java Thu May 24 10:00:35 2007
@@ -21,15 +21,11 @@
 import java.io.File;
 import java.io.InputStream;
 import java.sql.Connection;
-import java.sql.SQLException;
 import java.util.Date;
 import java.util.Properties;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
-import javax.sql.DataSource;
 import org.acegisecurity.providers.ProviderManager;
 import org.acegisecurity.providers.dao.DaoAuthenticationProvider;
 import org.acegisecurity.providers.encoding.Md5PasswordEncoder;
@@ -40,6 +36,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
+import org.apache.roller.business.DatabaseProvider;
 import org.apache.roller.business.runnable.RollerTask;
 import org.apache.roller.business.utils.UpgradeDatabase;
 import org.apache.roller.config.PingConfig;
@@ -175,19 +172,10 @@
     /**
      * Trigger any database upgrade work that needs to be done.
      */
-    private void upgradeDatabaseIfNeeded() throws Exception {
-        
-        try {
-            InitialContext ic = new InitialContext();
-            DataSource ds = (DataSource)ic.lookup("java:comp/env/jdbc/rollerdb");
-            Connection con = ds.getConnection();
-            UpgradeDatabase.upgradeDatabase(con, RollerFactory.getRoller().getVersion());
-            con.close();
-        } catch (NamingException e) {
-            log.warn("Unable to access DataSource", e);
-        } catch (SQLException e) {
-            log.warn(e);
-        }
+    private void upgradeDatabaseIfNeeded() throws Exception {        
+        Connection con = DatabaseProvider.getDatabaseProvider().getConnection();
+        UpgradeDatabase.upgradeDatabase(con, RollerFactory.getRoller().getVersion());
+        con.close();
     }
     
     

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/filters/CharEncodingFilter.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/filters/CharEncodingFilter.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/filters/CharEncodingFilter.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/filters/CharEncodingFilter.java Thu May 24 10:00:35 2007
@@ -20,19 +20,15 @@
 
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
-import java.util.Locale;
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.struts.Globals;
+
 
 /**
  * Entry point filter for all requests. This filter ensures that the request 
@@ -41,9 +37,9 @@
  * This filter should normally be first and last in the chain.
  *
  * @author <a href="mailto:anil@busybuddha.org">Anil Gangolli</a>
- * @web.filter name="CharEncodingFilter"
  */
 public class CharEncodingFilter implements Filter {
+    
     private FilterConfig mFilterConfig = null;
     private static Log mLogger =
             LogFactory.getFactory().getInstance(CharEncodingFilter.class);

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/plugins/TextEditor.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/plugins/TextEditor.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/plugins/TextEditor.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/plugins/TextEditor.java Thu May 24 10:00:35 2007
@@ -18,7 +18,8 @@
 
 package org.apache.roller.ui.core.plugins;
 
-import org.apache.roller.util.MessageUtilities;
+import java.util.Locale;
+import org.apache.roller.util.I18nMessages;
 
 
 /**
@@ -35,7 +36,7 @@
     }
     
     public String getName() {
-        return MessageUtilities.getString("editor.text.name");
+        return "editor.text.name";
     }
     
     public String getJspPage() {

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/plugins/XinhaEditor.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/plugins/XinhaEditor.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/plugins/XinhaEditor.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/plugins/XinhaEditor.java Thu May 24 10:00:35 2007
@@ -18,7 +18,8 @@
 
 package org.apache.roller.ui.core.plugins;
 
-import org.apache.roller.util.MessageUtilities;
+import java.util.Locale;
+import org.apache.roller.util.I18nMessages;
 
 
 /**
@@ -35,7 +36,7 @@
     }
     
     public String getName() {
-        return MessageUtilities.getString("editor.xinha.name");
+        return "editor.xinha.name";
     }
     
     public String getJspPage() {

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/tags/calendar/CalendarTag.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/tags/calendar/CalendarTag.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/tags/calendar/CalendarTag.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/tags/calendar/CalendarTag.java Thu May 24 10:00:35 2007
@@ -21,10 +21,6 @@
 import org.apache.commons.beanutils.PropertyUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.struts.Globals;
-import org.apache.struts.config.ModuleConfig;
-import org.apache.struts.util.MessageResources;
-import org.apache.struts.util.RequestUtils;
 import org.apache.roller.ui.core.tags.HybridTag;
 import org.apache.roller.util.DateUtil;
 
@@ -33,13 +29,12 @@
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Locale;
+import java.util.ResourceBundle;
 import java.util.StringTokenizer;
 
-import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.Tag;
-import org.apache.roller.ui.core.RollerContext;
 
 
 /**
@@ -156,7 +151,7 @@
                     (HttpServletRequest)pageContext.getRequest();
             
             // get Resource Bundle
-            MessageResources resources = getResources(request);
+            ResourceBundle bundle = ResourceBundle.getBundle("ApplicationResources", mLocale);
             
             // go back to first day in month
             cal = model.getCalendar();
@@ -178,7 +173,7 @@
             // -------------------------
             pw.print("<table cellspacing=\"0\" border=\"0\" ");
             pw.print(" summary=\""
-                    +resources.getMessage(mLocale, "calendar.summary")
+                    +bundle.getString("calendar.summary")
                     +"\" class=\"hCalendarTable"
                     +mClassSuffix+"\">");
             pw.print("<tr>");
@@ -186,13 +181,13 @@
                     "class=\"hCalendarMonthYearRow"+mClassSuffix+"\">");
             if (model.getPrevMonth() != null) {
                 pw.print("<a href=\"" + model.computePrevMonthUrl()
-                        + "\" title=\"" + resources.getMessage(mLocale, "calendar.prev")
+                        + "\" title=\"" + bundle.getString("calendar.prev")
                         + "\" class=\"hCalendarNavBar\">&laquo;</a> ");
             }
             pw.print( formatTitle.format(day) );
             if (model.getNextMonth() != null) {
                 pw.print(" <a href=\"" + model.computeNextMonthUrl()
-                + "\" title=\"" + resources.getMessage(mLocale, "calendar.next")
+                + "\" title=\"" + bundle.getString("calendar.next")
                 + "\" class=\"hCalendarNavBar\">&raquo;</a>");
             }
             pw.print("</td></tr>");
@@ -246,7 +241,7 @@
             
             pw.print("<a href=\""+model.computeTodayMonthUrl()
             +"\" class=\"hCalendarNavBar\">"
-                    +resources.getMessage(mLocale, "calendar.today")
+                    +bundle.getString("calendar.today")
                     +"</a>");
             
             pw.print("</td>");
@@ -317,12 +312,6 @@
             pw.print(cal.get(Calendar.DAY_OF_MONTH));
             pw.print("</div></td>");
         }
-    }
-    private MessageResources getResources(HttpServletRequest request) {
-        ServletContext app = RollerContext.getServletContext();
-        ModuleConfig moduleConfig = RequestUtils.getModuleConfig(request, app);
-        return (MessageResources)app.getAttribute(Globals.MESSAGES_KEY +
-                moduleConfig.getPrefix());
     }
     
     /**

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/tags/menu/MenuTag.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/tags/menu/MenuTag.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/tags/menu/MenuTag.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/tags/menu/MenuTag.java Thu May 24 10:00:35 2007
@@ -20,12 +20,13 @@
 
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Locale;
 import java.util.Map;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import org.apache.velocity.VelocityContext;
 import org.apache.roller.ui.core.tags.VelocityTag;
-import org.apache.roller.ui.rendering.model.MessageModel;
+import org.apache.roller.util.I18nMessages;
 
 /**
  * @jsp.tag name="Menu"
@@ -49,7 +50,8 @@
         ctx.put("req", req );
         ctx.put("res", res );
         
-        MessageModel messageModel = new MessageModel();
+        // TODO: this doesn't support proper i18n
+        I18nMessages messageModel = I18nMessages.getMessages(Locale.getDefault());
         ctx.put("text", messageModel);
                 
         Map mapCtx = new HashMap();

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/util/menu/MenuHelper.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/util/menu/MenuHelper.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/util/menu/MenuHelper.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/core/util/menu/MenuHelper.java Thu May 24 10:00:35 2007
@@ -49,10 +49,10 @@
         try {
             // parse menus and cache so we can efficiently reuse them
             // TODO: there is probably a better way than putting the whole path
-            ParsedMenu editorMenu = unmarshall(MenuHelper.class.getResourceAsStream("/org/apache/roller/ui/authoring/struts2/editor-menu.xml"));
+            ParsedMenu editorMenu = unmarshall(MenuHelper.class.getResourceAsStream("/org/apache/roller/ui/struts2/editor/editor-menu.xml"));
             menus.put("editor", editorMenu);
             
-            ParsedMenu adminMenu = unmarshall(MenuHelper.class.getResourceAsStream("/org/apache/roller/ui/admin/struts2/admin-menu.xml"));
+            ParsedMenu adminMenu = unmarshall(MenuHelper.class.getResourceAsStream("/org/apache/roller/ui/struts2/admin/admin-menu.xml"));
             menus.put("admin", adminMenu);
             
         } catch (Exception ex) {

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/MessageModel.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/MessageModel.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/MessageModel.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/MessageModel.java Thu May 24 10:00:35 2007
@@ -21,7 +21,8 @@
 import java.util.List;
 import java.util.Map;
 import org.apache.roller.RollerException;
-import org.apache.roller.util.MessageUtilities;
+import org.apache.roller.ui.rendering.util.WeblogRequest;
+import org.apache.roller.util.I18nMessages;
 
 
 /**
@@ -30,6 +31,8 @@
  */
 public class MessageModel implements Model {  
     
+    I18nMessages messages = null;
+    
     
     /** Template context name to be used for model */
     public String getModelName() {
@@ -39,19 +42,27 @@
     
     /** Init page model based on request */
     public void init(Map initData) throws RollerException {
-        // no-op
+        
+        // we expect the init data to contain a weblogRequest object
+        WeblogRequest weblogRequest = (WeblogRequest) initData.get("weblogRequest");
+        if(weblogRequest == null) {
+            throw new RollerException("expected weblogRequest from init data");
+        }
+        
+        // get messages util based on desired locale
+        this.messages = I18nMessages.getMessages(weblogRequest.getLocaleInstance());
     }
     
     
     /** Return message string */
     public String get(String key) {
-        return MessageUtilities.getString(key);
+        return messages.getString(key);
     }
     
     
     /** Return parameterized message string */
     public String get(String key, List args) {
-        return MessageUtilities.getString(key, args);
+        return messages.getString(key, args);
     }
 
 }

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/SearchResultsFeedModel.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/SearchResultsFeedModel.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/SearchResultsFeedModel.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/SearchResultsFeedModel.java Thu May 24 10:00:35 2007
@@ -24,7 +24,6 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.ResourceBundle;
 import java.util.Set;
 import java.util.TreeSet;
 
@@ -61,9 +60,6 @@
 public class SearchResultsFeedModel implements Model {
 
     private static Log log = LogFactory.getLog(SearchResultsFeedModel.class);
-    
-    private static final ResourceBundle bundle = 
-            ResourceBundle.getBundle("ApplicationResources");
     
     private WeblogFeedRequest feedRequest = null;
 

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/model/SearchResultsModel.java Thu May 24 10:00:35 2007
@@ -22,7 +22,6 @@
 import java.sql.Timestamp;
 import java.util.Date;
 import java.util.Map;
-import java.util.ResourceBundle;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.TreeSet;
@@ -38,7 +37,6 @@
 import org.apache.roller.business.Roller;
 import org.apache.roller.business.RollerFactory;
 import org.apache.roller.business.WeblogManager;
-import org.apache.roller.pojos.WeblogCategoryData;
 import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.pojos.WeblogEntryWrapperComparator;
 import org.apache.roller.pojos.wrapper.WeblogCategoryDataWrapper;
@@ -47,6 +45,7 @@
 import org.apache.roller.ui.rendering.pagers.WeblogEntriesPager;
 import org.apache.roller.ui.rendering.util.WeblogSearchRequest;
 import org.apache.roller.util.DateUtil;
+import org.apache.roller.util.I18nMessages;
 
 
 /**
@@ -56,9 +55,6 @@
  */
 public class SearchResultsModel extends PageModel {
     
-    private static final ResourceBundle bundle = 
-            ResourceBundle.getBundle("ApplicationResources");
-    
     public static final int RESULTS_PER_PAGE = 10;
     
     
@@ -117,7 +113,7 @@
         
         if (search.getResultsCount() == -1) {
             // this means there has been a parsing (or IO) error
-            this.errorMessage = bundle.getString("error.searchProblem");
+            this.errorMessage = I18nMessages.getMessages(searchRequest.getLocaleInstance()).getString("error.searchProblem");
         } else {
             Hits hits = search.getResults();
             this.hits = search.getResultsCount();

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/AbstractWeblogEntriesPager.java Thu May 24 10:00:35 2007
@@ -24,13 +24,14 @@
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
+import java.util.Locale;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.config.RollerRuntimeConfig;
 import org.apache.roller.pojos.WebsiteData;
 import org.apache.roller.util.DateUtil;
-import org.apache.roller.util.MessageUtilities;
+import org.apache.roller.util.I18nMessages;
 import org.apache.roller.util.URLUtilities;
 
 
@@ -45,6 +46,9 @@
     
     private static Log log = LogFactory.getLog(AbstractWeblogEntriesPager.class);
     
+    // message utils for doing i18n messages
+    I18nMessages messageUtils = null;
+    
     WebsiteData weblog = null;
     String locale = null;
     String pageLink = null;
@@ -88,6 +92,20 @@
             this.page = page;
         }
         this.offset = length * page;
+        
+        // get a message utils instance to handle i18n of messages
+        Locale viewLocale = null;
+        if(locale != null) {
+            String[] langCountry = locale.split("_");
+            if(langCountry.length == 1) {
+                viewLocale = new Locale(langCountry[0]);
+            } else if(langCountry.length == 2) {
+                viewLocale = new Locale(langCountry[0], langCountry[1]);
+            }
+        } else {
+            viewLocale = weblog.getLocaleInstance();
+        }
+        this.messageUtils = I18nMessages.getMessages(viewLocale);
     }
     
     
@@ -102,7 +120,7 @@
     
     
     public String getHomeName() {
-        return MessageUtilities.getString("weblogEntriesPager.latest.home");
+        return messageUtils.getString("weblogEntriesPager.latest.home");
     }
     
     
@@ -116,7 +134,7 @@
     
     public String getNextName() {
         if (hasMoreEntries()) {
-            return MessageUtilities.getString("weblogEntriesPager.latest.next");
+            return messageUtils.getString("weblogEntriesPager.latest.next");
         }
         return null;
     }
@@ -132,7 +150,7 @@
     
     public String getPrevName() {
         if (page > 0) {
-            return MessageUtilities.getString("weblogEntriesPager.latest.prev");
+            return messageUtils.getString("weblogEntriesPager.latest.prev");
         }
         return null;
     }

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/SearchResultsFeedPager.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/SearchResultsFeedPager.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/SearchResultsFeedPager.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/SearchResultsFeedPager.java Thu May 24 10:00:35 2007
@@ -20,12 +20,11 @@
 
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
-import java.util.ResourceBundle;
-
 import org.apache.roller.pojos.WebsiteData;
 import org.apache.roller.ui.rendering.util.WeblogFeedRequest;
-import org.apache.roller.ui.rendering.util.WeblogSearchRequest;
+import org.apache.roller.util.I18nMessages;
 import org.apache.roller.util.URLUtilities;
 
 
@@ -34,6 +33,9 @@
  */
 public class SearchResultsFeedPager extends AbstractPager {
     
+    // message utils for doing i18n messages
+    I18nMessages messageUtils = null;
+    
     private List entries = null;
     
     private WebsiteData weblog = null;
@@ -43,8 +45,6 @@
     
     private String url = null;
     
-    private static ResourceBundle bundle =
-            ResourceBundle.getBundle("ApplicationResources");
             
     public SearchResultsFeedPager(String baseUrl, int pageNum,
             WeblogFeedRequest feedRequest, List entries, boolean more) {
@@ -63,6 +63,20 @@
         
         // does this pager have more results?
         this.moreResults = more;
+        
+        // get a message utils instance to handle i18n of messages
+        Locale viewLocale = null;
+        if(feedRequest.getLocale() != null) {
+            String[] langCountry = feedRequest.getLocale().split("_");
+            if(langCountry.length == 1) {
+                viewLocale = new Locale(langCountry[0]);
+            } else if(langCountry.length == 2) {
+                viewLocale = new Locale(langCountry[0], langCountry[1]);
+            }
+        } else {
+            viewLocale = weblog.getLocaleInstance();
+        }
+        this.messageUtils = I18nMessages.getMessages(viewLocale);
     }
     
     public List getItems() {
@@ -78,7 +92,7 @@
     }
 
     public String getHomeName() {
-        return bundle.getString("searchPager.home");
+        return messageUtils.getString("searchPager.home");
     }  
     
     protected String createURL(String url, Map params) {

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/SearchResultsPager.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/SearchResultsPager.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/SearchResultsPager.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/SearchResultsPager.java Thu May 24 10:00:35 2007
@@ -18,10 +18,11 @@
 
 package org.apache.roller.ui.rendering.pagers;
 
+import java.util.Locale;
 import java.util.Map;
-import java.util.ResourceBundle;
 import org.apache.roller.pojos.WebsiteData;
 import org.apache.roller.ui.rendering.util.WeblogSearchRequest;
+import org.apache.roller.util.I18nMessages;
 import org.apache.roller.util.URLUtilities;
 
 
@@ -30,6 +31,9 @@
  */
 public class SearchResultsPager implements WeblogEntriesPager {
     
+    // message utils for doing i18n messages
+    I18nMessages messageUtils = null;
+    
     private Map entries = null;
     
     private WebsiteData weblog = null;
@@ -39,9 +43,6 @@
     private int         page = 0;
     private boolean     moreResults = false;
     
-    private static ResourceBundle bundle =
-            ResourceBundle.getBundle("ApplicationResources");
-    
     
     public SearchResultsPager() {}
     
@@ -59,6 +60,20 @@
         
         // does this pager have more results?
         this.moreResults = more;
+        
+        // get a message utils instance to handle i18n of messages
+        Locale viewLocale = null;
+        if(locale != null) {
+            String[] langCountry = locale.split("_");
+            if(langCountry.length == 1) {
+                viewLocale = new Locale(langCountry[0]);
+            } else if(langCountry.length == 2) {
+                viewLocale = new Locale(langCountry[0], langCountry[1]);
+            }
+        } else {
+            viewLocale = weblog.getLocaleInstance();
+        }
+        this.messageUtils = I18nMessages.getMessages(viewLocale);
     }
     
     
@@ -72,7 +87,7 @@
     }
 
     public String getHomeName() {
-        return bundle.getString("searchPager.home");
+        return messageUtils.getString("searchPager.home");
     }
 
     
@@ -85,7 +100,7 @@
 
     public String getNextName() {
         if (getNextLink() != null) {
-            return bundle.getString("searchPager.next");
+            return messageUtils.getString("searchPager.next");
         }
         return null;
     }
@@ -99,7 +114,7 @@
 
     public String getPrevName() {
         if (getPrevLink() != null) {
-            return bundle.getString("searchPager.prev");
+            return messageUtils.getString("searchPager.prev");
         }
         return null;
     }

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesDayPager.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesDayPager.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesDayPager.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesDayPager.java Thu May 24 10:00:35 2007
@@ -36,7 +36,7 @@
 import org.apache.roller.pojos.WebsiteData;
 import org.apache.roller.pojos.wrapper.WeblogEntryDataWrapper;
 import org.apache.roller.util.DateUtil;
-import org.apache.roller.util.MessageUtilities;
+import org.apache.roller.util.I18nMessages;
 
 
 /**
@@ -46,8 +46,7 @@
     
     private static Log log = LogFactory.getLog(WeblogEntriesDayPager.class);
     
-    private SimpleDateFormat dayFormat = new SimpleDateFormat(
-            MessageUtilities.getString("weblogEntriesPager.day.dateFormat"));
+    private SimpleDateFormat dayFormat = new SimpleDateFormat();
     
     private Date day;
     private Date nextDay;
@@ -72,6 +71,9 @@
         
         super(weblog, locale, pageLink, entryAnchor, dateString, catPath, tags, page);
         
+        dayFormat = new SimpleDateFormat(
+            messageUtils.getString("weblogEntriesPager.day.dateFormat"));
+        
         getEntries();
         
         day = parseDate(dateString);
@@ -165,7 +167,7 @@
     
     
     public String getHomeName() {
-        return MessageUtilities.getString("weblogEntriesPager.day.home");
+        return messageUtils.getString("weblogEntriesPager.day.home");
     }
     
     
@@ -179,7 +181,7 @@
     
     public String getNextName() {
         if (getNextLink() != null) {
-            return MessageUtilities.getString("weblogEntriesPager.day.next", new Object[] {dayFormat.format(day)});
+            return messageUtils.getString("weblogEntriesPager.day.next", new Object[] {dayFormat.format(day)});
         }
         return null;
     }
@@ -195,7 +197,7 @@
     
     public String getPrevName() {
         if (getPrevLink() != null) {
-            return MessageUtilities.getString("weblogEntriesPager.day.prev", new Object[] {dayFormat.format(day)});
+            return messageUtils.getString("weblogEntriesPager.day.prev", new Object[] {dayFormat.format(day)});
         }
         return null;
     }
@@ -212,7 +214,7 @@
     
     public String getNextCollectionName() {
         if (nextDay != null) {
-            return MessageUtilities.getString("weblogEntriesPager.day.nextCollection", new Object[] {dayFormat.format(nextDay)});
+            return messageUtils.getString("weblogEntriesPager.day.nextCollection", new Object[] {dayFormat.format(nextDay)});
         }
         return null;
     }
@@ -229,7 +231,7 @@
     
     public String getPrevCollectionName() {
         if (prevDay != null) {
-            return MessageUtilities.getString("weblogEntriesPager.day.prevCollection", new Object[] {dayFormat.format(prevDay)});
+            return messageUtils.getString("weblogEntriesPager.day.prevCollection", new Object[] {dayFormat.format(prevDay)});
         }
         return null;
     }

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesMonthPager.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesMonthPager.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesMonthPager.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesMonthPager.java Thu May 24 10:00:35 2007
@@ -34,7 +34,7 @@
 import org.apache.roller.pojos.WebsiteData;
 import org.apache.roller.pojos.wrapper.WeblogEntryDataWrapper;
 import org.apache.roller.util.DateUtil;
-import org.apache.roller.util.MessageUtilities;
+import org.apache.roller.util.I18nMessages;
 
 
 /**
@@ -44,8 +44,7 @@
     
     private static Log log = LogFactory.getLog(WeblogEntriesMonthPager.class);
     
-    private SimpleDateFormat monthFormat = new SimpleDateFormat(
-            MessageUtilities.getString("weblogEntriesPager.month.dateFormat"));
+    private SimpleDateFormat monthFormat = new SimpleDateFormat();
     
     private Date month;
     private Date nextMonth;
@@ -70,6 +69,9 @@
         
         super(weblog, locale, pageLink, entryAnchor, dateString, catPath, tags, page);
         
+        monthFormat = new SimpleDateFormat(
+            messageUtils.getString("weblogEntriesPager.month.dateFormat"));
+        
         getEntries();
         
         month = parseDate(dateString);
@@ -155,7 +157,7 @@
     
     
     public String getHomeName() {
-        return MessageUtilities.getString("weblogEntriesPager.month.home");
+        return messageUtils.getString("weblogEntriesPager.month.home");
     }
     
     
@@ -169,7 +171,7 @@
     
     public String getNextName() {
         if (getNextLink() != null) {
-            return MessageUtilities.getString("weblogEntriesPager.month.next", new Object[] {monthFormat.format(month)});
+            return messageUtils.getString("weblogEntriesPager.month.next", new Object[] {monthFormat.format(month)});
         }
         return null;
     }
@@ -185,7 +187,7 @@
     
     public String getPrevName() {
         if (getPrevLink() != null) {
-            return MessageUtilities.getString("weblogEntriesPager.month.prev", new Object[] {monthFormat.format(month)});
+            return messageUtils.getString("weblogEntriesPager.month.prev", new Object[] {monthFormat.format(month)});
         }
         return null;
     }
@@ -202,7 +204,7 @@
     
     public String getNextCollectionName() {
         if (nextMonth != null) {
-            return MessageUtilities.getString("weblogEntriesPager.month.nextCollection", new Object[] {monthFormat.format(nextMonth)});
+            return messageUtils.getString("weblogEntriesPager.month.nextCollection", new Object[] {monthFormat.format(nextMonth)});
         }
         return null;
     }
@@ -219,7 +221,7 @@
     
     public String getPrevCollectionName() {
         if (prevMonth != null) {
-            return MessageUtilities.getString("weblogEntriesPager.month.prevCollection", new Object[] {monthFormat.format(prevMonth)});
+            return messageUtils.getString("weblogEntriesPager.month.prevCollection", new Object[] {monthFormat.format(prevMonth)});
         }
         return null;
     }

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPermalinkPager.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPermalinkPager.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPermalinkPager.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/pagers/WeblogEntriesPermalinkPager.java Thu May 24 10:00:35 2007
@@ -33,7 +33,7 @@
 import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.pojos.WebsiteData;
 import org.apache.roller.pojos.wrapper.WeblogEntryDataWrapper;
-import org.apache.roller.util.MessageUtilities;
+import org.apache.roller.util.I18nMessages;
 import org.apache.roller.util.Utilities;
 
 
@@ -92,7 +92,7 @@
     
     
     public String getHomeName() {
-        return MessageUtilities.getString("weblogEntriesPager.single.home");
+        return messageUtils.getString("weblogEntriesPager.single.home");
     }
     
     
@@ -107,7 +107,7 @@
     public String getNextName() {
         if (getNextEntry() != null) {
             String title = Utilities.truncateNicely(getNextEntry().getTitle(), 15, 20, "...");
-            return MessageUtilities.getString("weblogEntriesPager.single.next", new Object[] {title});
+            return messageUtils.getString("weblogEntriesPager.single.next", new Object[] {title});
         }
         return null;
     }
@@ -124,7 +124,7 @@
     public String getPrevName() {
         if (getPrevEntry() != null) {
             String title = Utilities.truncateNicely(getPrevEntry().getTitle(), 15, 20, "...");
-            return MessageUtilities.getString("weblogEntriesPager.single.prev", new Object[] {title});
+            return messageUtils.getString("weblogEntriesPager.single.prev", new Object[] {title});
         }
         return null;
     }

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/servlets/CommentServlet.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/servlets/CommentServlet.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/servlets/CommentServlet.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/servlets/CommentServlet.java Thu May 24 10:00:35 2007
@@ -23,7 +23,6 @@
 import java.text.MessageFormat;
 import java.util.Iterator;
 import java.util.List;
-import java.util.ResourceBundle;
 import java.util.Set;
 import java.util.TreeSet;
 import javax.mail.MessagingException;
@@ -60,12 +59,12 @@
 import org.apache.roller.util.GenericThrottle;
 import org.apache.roller.util.IPBanList;
 import org.apache.roller.util.MailUtil;
+import org.apache.roller.util.I18nMessages;
 import org.apache.roller.util.RollerMessages;
 import org.apache.roller.util.RollerMessages.RollerMessage;
 import org.apache.roller.util.URLUtilities;
 import org.apache.roller.util.Utilities;
 import org.apache.roller.util.cache.CacheManager;
-import org.apache.struts.util.RequestUtils;
 
 
 /**
@@ -86,7 +85,6 @@
 public class CommentServlet extends HttpServlet {
     
     private static Log log = LogFactory.getLog(CommentServlet.class);
-    private ResourceBundle bundle = ResourceBundle.getBundle("ApplicationResources");
     
     private static final String EMAIL_ADDR_REGEXP = "^.*@.*[.].{2,}$";
     
@@ -261,14 +259,16 @@
             cf.setPreview(comment);
         }
         
+        I18nMessages messageUtils = I18nMessages.getMessages(commentRequest.getLocaleInstance());
+        
         // check if comments are allowed for this entry
         // this checks site-wide settings, weblog settings, and entry settings
         if(!entry.getCommentsStillAllowed() || !entry.isPublished()) {
-            error = bundle.getString("comments.disabled");
+            error = messageUtils.getString("comments.disabled");
             
             // if this is a real comment post then authenticate request
         } else if(!preview && !this.authenticator.authenticate(request)) {
-            error = bundle.getString("error.commentAuthFailed");
+            error = messageUtils.getString("error.commentAuthFailed");
             log.debug("Comment failed authentication");
         }
         
@@ -289,14 +289,14 @@
             if (validationScore == 100 && weblog.getCommentModerationRequired()) {
                 // Valid comments go into moderation if required
                 comment.setStatus(CommentData.PENDING);
-                message = bundle.getString("commentServlet.submittedToModerator");
+                message = messageUtils.getString("commentServlet.submittedToModerator");
             } else if (validationScore == 100) {
                 // else they're approved
                 comment.setStatus(CommentData.APPROVED);
             } else {
                 // Invalid comments are marked as spam
                 comment.setStatus(CommentData.SPAM);
-                error = bundle.getString("commentServlet.commentMarkedAsSpam");
+                error = messageUtils.getString("commentServlet.commentMarkedAsSpam");
                 log.debug("Comment marked as spam");
             }
             
@@ -311,10 +311,7 @@
                     // Send email notifications, but only to subscribers if comment is 100% valid
                     boolean notifySubscribers = (validationScore == 100);
                     String rootURL = RollerRuntimeConfig.getAbsoluteContextURL();
-                    if (rootURL == null || rootURL.trim().length()==0) {
-                        rootURL = RequestUtils.serverURL(request) + request.getContextPath();
-                    }
-                    sendEmailNotification(comment, notifySubscribers, messages, rootURL);
+                    sendEmailNotification(comment, notifySubscribers, messages, rootURL, messageUtils);
                     
                     // only re-index/invalidate the cache if comment isn't moderated
                     if(!weblog.getCommentModerationRequired()) {
@@ -382,10 +379,7 @@
      */
     public static void sendEmailNotification(
             CommentData commentObject, boolean notifySubscribers,
-            RollerMessages messages, String rootURL) {
-        
-        // Send commment notifications in locale of server
-        ResourceBundle resources = ResourceBundle.getBundle("ApplicationResources");
+            RollerMessages messages, String rootURL, I18nMessages resources) {
         
         WeblogEntryData entry = commentObject.getWeblogEntry();
         WebsiteData site = entry.getWebsite();
@@ -591,10 +585,7 @@
      *
      * TODO: Make the addressing options configurable on a per-website basis.
      */
-    public static void sendEmailApprovalNotification(CommentData cd, String rootURL) {
-        
-        // Send commment notifications in locale of server
-        ResourceBundle resources = ResourceBundle.getBundle("ApplicationResources");
+    public static void sendEmailApprovalNotification(CommentData cd, String rootURL, I18nMessages resources) {
         
         WeblogEntryData entry = cd.getWeblogEntry();
         WebsiteData site = entry.getWebsite();
@@ -673,4 +664,3 @@
     }
     
 }
-

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/servlets/TrackbackServlet.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/servlets/TrackbackServlet.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/servlets/TrackbackServlet.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/ui/rendering/servlets/TrackbackServlet.java Thu May 24 10:00:35 2007
@@ -40,11 +40,9 @@
 import org.apache.roller.ui.rendering.util.CommentValidationManager;
 import org.apache.roller.ui.rendering.util.TrackbackLinkbackCommentValidator;
 import org.apache.roller.ui.rendering.util.WeblogTrackbackRequest;
-import org.apache.roller.util.LinkbackExtractor;
+import org.apache.roller.util.I18nMessages;
 import org.apache.roller.util.RollerMessages;
-import org.apache.roller.util.URLUtilities;
 import org.apache.roller.util.cache.CacheManager;
-import org.apache.struts.util.RequestUtils;
 
 
 /**
@@ -194,10 +192,8 @@
                     
                     // Send email notifications
                     String rootURL = RollerRuntimeConfig.getAbsoluteContextURL();
-                    if (rootURL == null || rootURL.trim().length()==0) {
-                        rootURL = RequestUtils.serverURL(request) + request.getContextPath();
-                    }
-                    CommentServlet.sendEmailNotification(comment, validationScore == 100, messages, rootURL);
+                    CommentServlet.sendEmailNotification(comment, validationScore == 100, messages, rootURL, 
+                            I18nMessages.getMessages(trackbackRequest.getLocaleInstance()));
                     
                     if(CommentData.PENDING.equals(comment.getStatus())) {
                         pw.println(this.getSuccessResponse("Trackback submitted to moderator"));

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/util/MailUtil.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/util/MailUtil.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/util/MailUtil.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/util/MailUtil.java Thu May 24 10:00:35 2007
@@ -213,7 +213,7 @@
         
         try {
             ResourceBundle resources = ResourceBundle.getBundle(
-                    "ApplicationResources", getLocaleInstance(user.getLocale()));
+                    "ApplicationResources", I18nUtils.toLocale(user.getLocale()));
             
             String from = RollerRuntimeConfig.getProperty(
                     "user.account.activation.mail.from");
@@ -243,34 +243,6 @@
         } catch (MessagingException e) {
             throw new RollerException("ERROR: Problem sending activation email.", e);
         }
-    }
-    
-    
-    // TODO: there is a better place for this, but i am being lazy :/
-    private static Locale getLocaleInstance(String locale) {
-        if (locale != null) {
-            String[] localeStr = StringUtils.split(locale, "_");
-            if (localeStr.length == 1) {
-                if (localeStr[0] == null)
-                    localeStr[0] = "";
-                return new Locale(localeStr[0]);
-            } else if (localeStr.length == 2) {
-                if (localeStr[0] == null)
-                    localeStr[0] = "";
-                if (localeStr[1] == null)
-                    localeStr[1] = "";
-                return new Locale(localeStr[0], localeStr[1]);
-            } else if (localeStr.length == 3) {
-                if (localeStr[0] == null)
-                    localeStr[0] = "";
-                if (localeStr[1] == null)
-                    localeStr[1] = "";
-                if (localeStr[2] == null)
-                    localeStr[2] = "";
-                return new Locale(localeStr[0], localeStr[1], localeStr[2]);
-            }
-        }
-        return Locale.getDefault();
     }
     
     

Modified: roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/xmlrpc/MetaWeblogAPIHandler.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/xmlrpc/MetaWeblogAPIHandler.java?view=diff&rev=541357&r1=541356&r2=541357
==============================================================================
--- roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/xmlrpc/MetaWeblogAPIHandler.java (original)
+++ roller/branches/roller_4.0_newbackend/src/org/apache/roller/webservices/xmlrpc/MetaWeblogAPIHandler.java Thu May 24 10:00:35 2007
@@ -25,9 +25,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Vector;
-
-import javax.servlet.http.HttpServletRequest;
-
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -44,8 +41,8 @@
 import org.apache.roller.util.RollerMessages;
 import org.apache.roller.util.URLUtilities;
 import org.apache.roller.util.Utilities;
-import org.apache.struts.util.RequestUtils;
 import org.apache.xmlrpc.XmlRpcException;
+
 
 /**
  * Roller XML-RPC Handler for the MetaWeblog API.



Mime
View raw message