You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2006/07/18 02:26:20 UTC

svn commit: r422928 - in /incubator/roller/branches/roller_3.0: metadata/database/ src/org/apache/roller/pojos/ src/org/apache/roller/ui/authoring/struts/actions/ src/org/apache/roller/ui/authoring/struts/formbeans/ web/WEB-INF/classes/ web/WEB-INF/jsp...

Author: agilliland
Date: Mon Jul 17 17:26:20 2006
New Revision: 422928

URL: http://svn.apache.org/viewvc?rev=422928&view=rev
Log:
new db columns for weblogentry.locale and website.enablemultilang and website.showalllangs, plus UI controls to modify these values.

- added column weblogentry.locale to store the Locale for each entry.

- added column website.enablemultilang as a boolean column which stores whether or not the weblog wants to make use of the multi-language blogging features.

- added column website.showalllangs as a boolean column which stores whether or not the default view of a weblog (no locale specified) should show all languages or only a single language.

- added getters/setters to affect these properties in WebsiteData.

- added form elements and processing logic in jsps and struts actions/forms.


Added:
    incubator/roller/branches/roller_3.0/metadata/database/240-to-300-migration.vm
      - copied, changed from r422768, incubator/roller/branches/roller_3.0/metadata/database/240-to-300-migration
Removed:
    incubator/roller/branches/roller_3.0/metadata/database/240-to-300-migration
Modified:
    incubator/roller/branches/roller_3.0/metadata/database/control.vm
    incubator/roller/branches/roller_3.0/src/org/apache/roller/pojos/WebsiteData.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryPageModel.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/authoring/struts/formbeans/WeblogEntryFormEx.java
    incubator/roller/branches/roller_3.0/web/WEB-INF/classes/ApplicationResources.properties
    incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/WeblogEdit.jsp
    incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/edit-website.jsp

Copied: incubator/roller/branches/roller_3.0/metadata/database/240-to-300-migration.vm (from r422768, incubator/roller/branches/roller_3.0/metadata/database/240-to-300-migration)
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/metadata/database/240-to-300-migration.vm?p2=incubator/roller/branches/roller_3.0/metadata/database/240-to-300-migration.vm&p1=incubator/roller/branches/roller_3.0/metadata/database/240-to-300-migration&r1=422768&r2=422928&rev=422928&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/metadata/database/240-to-300-migration (original)
+++ incubator/roller/branches/roller_3.0/metadata/database/240-to-300-migration.vm Mon Jul 17 17:26:20 2006
@@ -6,4 +6,9 @@
 
 -- Roller 3.0 schema changes
 
-alter table website add column pagemodels varchar(512) default null;
\ No newline at end of file
+alter table website add column pagemodels varchar(512) default null;
+
+#addColumnNotNull("website" "enablemultilang" $BOOLEAN_SQL_TYPE $BOOLEAN_FALSE)
+#addColumnNotNull("website" "showalllangs" $BOOLEAN_SQL_TYPE $BOOLEAN_TRUE)
+
+alter table weblogentry add column locale varchar(20) default null;
\ No newline at end of file

Modified: incubator/roller/branches/roller_3.0/metadata/database/control.vm
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/metadata/database/control.vm?rev=422928&r1=422927&r2=422928&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/metadata/database/control.vm (original)
+++ incubator/roller/branches/roller_3.0/metadata/database/control.vm Mon Jul 17 17:26:20 2006
@@ -5,7 +5,7 @@
 Follow the installation guide for instructions on setting up your database.
 
 #** Define templates to be generated **#
-#set( $templates = ["createdb", "200-to-210-migration", "210-to-230-migration", "230-to-240-migration"]) 
+#set( $templates = ["createdb", "200-to-210-migration", "210-to-230-migration", "230-to-240-migration", "240-to-300-migration"]) 
 
 #** Define special macro needed for alter table with not-null restriction **#
 #macro(addColumnNotNull $table $column $type $default)

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/pojos/WebsiteData.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/pojos/WebsiteData.java?rev=422928&r1=422927&r2=422928&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/pojos/WebsiteData.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/pojos/WebsiteData.java Mon Jul 17 17:26:20 2006
@@ -87,6 +87,9 @@
     private int     entryDisplayCount = 15;
     private Date    lastModified     = new Date();
     private String  pageModels       = new String();
+    private boolean enableMultiLang = false;
+    private boolean showAllLangs = true;
+    
     
     // Associated objects
     private UserData           creator = null; 
@@ -1037,6 +1040,44 @@
         this.lastModified = lastModified;
     }
   
+    
+    /**
+     * Is multi-language blog support enabled for this weblog?
+     *
+     * If false then urls with various locale restrictions should fail.
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @ejb:persistent-field
+     * @hibernate.property column="enablemultilang" not-null="true"
+     */
+    public boolean isEnableMultiLang() {
+        return enableMultiLang;
+    }
+
+    public void setEnableMultiLang(boolean enableMultiLang) {
+        this.enableMultiLang = enableMultiLang;
+    }
+    
+    
+    /**
+     * Should the default weblog view show entries from all languages?
+     *
+     * If false then the default weblog view only shows entry from the
+     * default locale chosen for this weblog.
+     *
+     * @roller.wrapPojoMethod type="simple"
+     * @ejb:persistent-field
+     * @hibernate.property column="showalllangs" not-null="true"
+     */
+    public boolean isShowAllLangs() {
+        return showAllLangs;
+    }
+
+    public void setShowAllLangs(boolean showAllLangs) {
+        this.showAllLangs = showAllLangs;
+    }
+    
+    
     /** 
      * @roller.wrapPojoMethod type="simple"
      */
@@ -1190,5 +1231,6 @@
         }
         return recentComments;
     }
+    
 }
 

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryPageModel.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryPageModel.java?rev=422928&r1=422927&r2=422928&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryPageModel.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/authoring/struts/actions/WeblogEntryPageModel.java Mon Jul 17 17:26:20 2006
@@ -47,6 +47,7 @@
 import org.apache.roller.config.RollerRuntimeConfig;
 import org.apache.roller.model.PluginManager;
 import org.apache.roller.model.Roller;
+import org.apache.roller.pojos.WebsiteData;
 
 /**
  * All data needed to render the edit-weblog page.
@@ -107,6 +108,10 @@
         getRequest().setAttribute("leftPage","/weblog/WeblogEditSidebar.jsp");
     }
     
+    public WebsiteData getWeblog() {
+        return this.rollerRequest.getWebsite();
+    }
+            
     public String getTitle() 
     {
         if (StringUtils.isEmpty(form.getId()))

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/authoring/struts/formbeans/WeblogEntryFormEx.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/authoring/struts/formbeans/WeblogEntryFormEx.java?rev=422928&r1=422927&r2=422928&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/authoring/struts/formbeans/WeblogEntryFormEx.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/authoring/struts/formbeans/WeblogEntryFormEx.java Mon Jul 17 17:26:20 2006
@@ -102,6 +102,7 @@
         }
         status = WeblogEntryData.DRAFT;
         allowComments = Boolean.TRUE;
+        locale = rreq.getWebsite().getLocale();
         
         // we want pubTime and updateTime to be empty for new entries -- AG
         //updateTime = new Timestamp(new Date().getTime());

Modified: incubator/roller/branches/roller_3.0/web/WEB-INF/classes/ApplicationResources.properties
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/classes/ApplicationResources.properties?rev=422928&r1=422927&r2=422928&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/classes/ApplicationResources.properties (original)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/classes/ApplicationResources.properties Mon Jul 17 17:26:20 2006
@@ -1324,6 +1324,7 @@
 weblogEdit.formatEntryWith=Format entry with plugins:
 weblogEdit.hours=Hours
 weblogEdit.link=Link
+weblogEdit.locale=Language
 weblogEdit.minutes=Minutes
 weblogEdit.noUpdateTime=Not updated
 weblogEdit.pageTitle=Edit Weblog
@@ -1502,6 +1503,7 @@
 
 # --- General settings
 
+websiteSettings.generalSettings=General Settings
 websiteSettings.websiteTitle=Title
 websiteSettings.websiteDescription=Description
 websiteSettings.emailAddress=Email address of weblog owner
@@ -1509,6 +1511,13 @@
 websiteSettings.entryDisplayCount=Number of entries to display on weblog
 websiteSettings.active=Weblog is active (and should be included in community listings)
 websiteSettings.editorSettings=Editor
+
+# --- i18n settings
+
+websiteSettings.languageSettings=Internationalization Settings
+websiteSettings.enableMultiLang=I publish my weblog in multiple languages
+websiteSettings.showAllLangs=Show my weblog entries from all languages on my homepage
+
 
 # These are hidden now
 websiteSettings.templateSettings=Template Settings

Modified: incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/WeblogEdit.jsp
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/WeblogEdit.jsp?rev=422928&r1=422927&r2=422928&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/WeblogEdit.jsp (original)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/WeblogEdit.jsp Mon Jul 17 17:26:20 2006
@@ -149,7 +149,22 @@
        <html:optionsCollection name="model" property="categories" value="id" label="path"  />
        </html:select>
     </td></tr>
-        
+    
+    <c:choose>
+        <c:when test="${model.weblog.enableMultiLang}">
+            <tr><td class="entryEditFormLabel">
+                <label for="locale"><fmt:message key="weblogEdit.locale" /></label>
+            </td><td>
+                <html:select property="locale" size="1" tabindex="5">
+                    <html:options collection="locales" property="value" labelProperty="label"/>
+                </html:select>
+            </td></tr>
+        </c:when>
+        <c:otherwise>
+            <html:hidden property="locale"/>
+        </c:otherwise>
+    </c:choose>
+    
     <tr>
         <td class="entryEditFormLabel">
             <label for="link"><fmt:message key="weblogEdit.pubTime" /></label>

Modified: incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/edit-website.jsp
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/edit-website.jsp?rev=422928&r1=422927&r2=422928&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/edit-website.jsp (original)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/jsps/authoring/edit-website.jsp Mon Jul 17 17:26:20 2006
@@ -40,6 +40,12 @@
 
 <table class="formtableNoDesc">
 
+    <%-- ***** General settings ***** --%>
+    
+    <tr>
+        <td colspan="3"><h2><fmt:message key="websiteSettings.generalSettings" /></h2></td>
+    </tr>
+    
     <tr>
         <td class="label"><fmt:message key="websiteSettings.websiteTitle" />
         <td class="field"><html:text property="name" size="40"/></input></td>
@@ -59,6 +65,48 @@
     </tr>
     
     <tr>
+        <td class="label"><fmt:message key="websiteSettings.editor" /></td>
+        <td class="field">
+            <html:select property="editorPage" size="1">
+                <html:options name="editorPagesList" />
+            </html:select></p>
+       </td>
+        <td class="description"><%-- <fmt:message key="websiteSettings.tip." /> --%></td>
+    </tr>
+    
+    <tr>
+        <td class="label"><fmt:message key="websiteSettings.active" /></td>
+        <td class="field"><html:checkbox property="active" /></input></td>
+        <td class="description"></td>
+    </tr>
+    
+    <tr>
+        <td class="label"><fmt:message key="websiteSettings.entryDisplayCount" /></td>
+        <td class="field"><html:text property="entryDisplayCount" size="4"/></input></td>
+        <td class="description"><%-- <fmt:message key="websiteSettings.tip." /> --%></td>
+    </tr>
+
+    
+    <%-- ***** Language/i18n settings ***** --%>
+    
+    
+    <tr>
+        <td colspan="3"><h2><fmt:message key="websiteSettings.languageSettings" /></h2></td>
+    </tr>
+    
+    <tr>
+        <td class="label"><fmt:message key="websiteSettings.enableMultiLang" /></td>
+        <td class="field"><html:checkbox property="enableMultiLang" /></td>
+        <td class="description"><%-- <fmt:message key="websiteSettings.tip." /> --%></td>
+    </tr>
+    
+    <tr>
+        <td class="label"><fmt:message key="websiteSettings.showAllLangs" /></td>
+        <td class="field"><html:checkbox property="showAllLangs" /></td>
+        <td class="description"><%-- <fmt:message key="websiteSettings.tip." /> --%></td>
+    </tr>
+    
+    <tr>
         <td class="label"><fmt:message key="createWebsite.locale" />
         <td class="field">
             <html:select property="locale" size="1" >
@@ -78,30 +126,9 @@
         <td class="description"><%-- <fmt:message key="websiteSettings.tip." /> --%></td>
     </tr>
     
-    <tr>
-        <td class="label"><fmt:message key="websiteSettings.editor" /></td>
-        <td class="field">
-            <html:select property="editorPage" size="1">
-                <html:options name="editorPagesList" />
-            </html:select></p>
-       </td>
-        <td class="description"><%-- <fmt:message key="websiteSettings.tip." /> --%></td>
-    </tr>
-    
-    <tr>
-        <td class="label"><fmt:message key="websiteSettings.entryDisplayCount" /></td>
-        <td class="field"><html:text property="entryDisplayCount" size="4"/></input></td>
-        <td class="description"><%-- <fmt:message key="websiteSettings.tip." /> --%></td>
-    </tr>
-
-    <tr>
-        <td class="label"><fmt:message key="websiteSettings.active" /></td>
-        <td class="field"><html:checkbox property="active" /></input></td>
-        <td class="description"></td>
-    </tr>
-
     
     <%-- ***** Comment settings ***** --%>
+    
     
     <tr>
         <td colspan="3"><h2><fmt:message key="websiteSettings.commentSettings" /></h2></td>