roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r1172075 [3/4] - in /roller/trunk: ./ planet-business/ planet-business/src/main/java/org/apache/roller/planet/ planet-business/src/main/java/org/apache/roller/planet/business/ planet-business/src/main/java/org/apache/roller/planet/config/ p...
Date Sat, 17 Sep 2011 22:00:40 GMT
Propchange: roller/trunk/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntryTagAggregate.orm.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1 +1,2 @@
 /roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogEntryTagAggregate.orm.xml:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/WeblogEntryTagAggregate.orm.xml:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/WeblogHitCount.orm.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1 +1,2 @@
 /roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogHitCount.orm.xml:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/WeblogHitCount.orm.xml:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/WeblogPermission.orm.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1 +1,2 @@
 /roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogPermission.orm.xml:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/WeblogPermission.orm.xml:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/WeblogReferrer.orm.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1 +1,2 @@
 /roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogReferrer.orm.xml:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/WeblogReferrer.orm.xml:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/WeblogTemplate.orm.xml
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1 +1,2 @@
 /roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/WeblogTemplate.orm.xml:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/WeblogTemplate.orm.xml:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/datamodel40.png
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1 +1,2 @@
 /roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/datamodel40.png:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/datamodel40.png:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/package.html
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1 +1,2 @@
 /roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/package.html:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/package.html:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/wrapper/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1,3 +1,4 @@
 /roller/branches/roller_mavenized/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/wrapper:894711-895418
 /roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper:713070-782269
 /roller/branches/roller_mediablogging/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/wrapper:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/main/resources/org/apache/roller/weblogger/pojos/wrapper:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/main/resources/sql/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1,3 +1,4 @@
 /roller/branches/roller_mavenized/weblogger-business/src/main/resources/sql:894711-895418
 /roller/branches/roller_mediablogging/apps/weblogger/src/sql:713070-782269
 /roller/branches/roller_mediablogging/weblogger-business/src/main/resources/sql:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/main/resources/sql:1139921-1160032

Modified: roller/trunk/weblogger-business/src/main/resources/sql/createdb.vm
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-business/src/main/resources/sql/createdb.vm?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-business/src/main/resources/sql/createdb.vm (original)
+++ roller/trunk/weblogger-business/src/main/resources/sql/createdb.vm Sat Sep 17 22:00:34 2011
@@ -91,6 +91,7 @@ create table webpage (
     templatelang    varchar(20) not null,
     decorator       varchar(255) default null,
     outputtype      varchar(48) default null,
+    type            varchar(16) default null,
     #columnNotNullWithDefault('action' 'varchar(16)' 'custom')
 );
 create index wp_name_idx on webpage( name$!db.INDEXSIZE );
@@ -115,8 +116,8 @@ create table website (
     emailfromaddress  varchar(255),
     emailaddress      varchar(255) not null,
     editortheme       varchar(255),
-    locale            varchar(20), 
-    timezone          varchar(50),  
+    locale            varchar(20),
+    timezone          varchar(50),
     defaultplugins    varchar(255),
     isenabled         $db.BOOLEAN_SQL_TYPE_TRUE not null,
     isactive          $db.BOOLEAN_SQL_TYPE_TRUE not null,
@@ -140,6 +141,24 @@ alter table website add constraint ws_ha
 -- This index is not necessary because of handle is already a primary key.
 -- create index ws_handle_idx    on website(handle);
 
+
+create table rol_weblogtheme (
+    id              varchar(48)  not null primary key,
+    weblogid varchar(48) not null,
+    name            varchar(255)  not null,
+    custom          $db.BOOLEAN_SQL_TYPE_FALSE not null,
+    #columnNotNullWithDefault('type' 'varchar(16)' 'standard')
+);
+
+create table rol_templatecode (
+    id                 varchar(48)  not null primary key,
+    templateid varchar(48) not null,
+    template     $db.TEXT_SQL_TYPE not null,
+    templatelang varchar(48),
+    contenttype  varchar(48),
+    #columnNotNullWithDefault('type' 'varchar(16)' 'standard')
+);
+
 create table folder (
     id               varchar(48) not null primary key,
     name             varchar(255) not null,

Modified: roller/trunk/weblogger-business/src/main/resources/sql/droptables.sql
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-business/src/main/resources/sql/droptables.sql?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-business/src/main/resources/sql/droptables.sql (original)
+++ roller/trunk/weblogger-business/src/main/resources/sql/droptables.sql Sat Sep 17 22:00:34 2011
@@ -55,6 +55,8 @@ drop table weblogentry;
 drop table weblogcategoryassoc;
 drop table weblogcategory;
 drop table webpage;
+drop table rol_weblogtheme;
+drop table rol_templatecode;
 
 -- core platform tables
 drop table roller_permission;

Propchange: roller/trunk/weblogger-business/src/test/java/org/apache/roller/weblogger/business/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1,3 +1,4 @@
 /roller/branches/roller_mavenized/weblogger-business/src/test/java/org/apache/roller/weblogger/business:894711-895418
 /roller/branches/roller_mediablogging/apps/weblogger/test/java/org/apache/roller/weblogger/business:713070-782269
 /roller/branches/roller_mediablogging/weblogger-business/src/test/java/org/apache/roller/weblogger/business:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/test/java/org/apache/roller/weblogger/business:1139921-1160032

Modified: roller/trunk/weblogger-business/src/test/java/org/apache/roller/weblogger/business/WeblogPageTest.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-business/src/test/java/org/apache/roller/weblogger/business/WeblogPageTest.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-business/src/test/java/org/apache/roller/weblogger/business/WeblogPageTest.java (original)
+++ roller/trunk/weblogger-business/src/test/java/org/apache/roller/weblogger/business/WeblogPageTest.java Sat Sep 17 22:00:34 2011
@@ -80,6 +80,7 @@ public class WeblogPageTest extends Test
         testPage.setLastModified(new java.util.Date());
         testPage.setWebsite(TestUtils.getManagedWebsite(testWeblog));
         testPage.setTemplateLanguage("velocity");
+        testPage.setType("standard");
     }
     
     public void tearDown() throws Exception {

Propchange: roller/trunk/weblogger-business/src/test/java/org/apache/roller/weblogger/planet/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1,3 +1,4 @@
 /roller/branches/roller_mavenized/weblogger-business/src/test/java/org/apache/roller/weblogger/planet:894711-895418
 /roller/branches/roller_mediablogging/apps/weblogger/test/java/org/apache/roller/weblogger/planet:713070-782269
 /roller/branches/roller_mediablogging/weblogger-business/src/test/java/org/apache/roller/weblogger/planet:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/test/java/org/apache/roller/weblogger/planet:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/test/java/org/apache/roller/weblogger/util/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1,3 +1,4 @@
 /roller/branches/roller_mavenized/weblogger-business/src/test/java/org/apache/roller/weblogger/util:894711-895418
 /roller/branches/roller_mediablogging/apps/weblogger/test/java/org/apache/roller/weblogger/util:713070-782269
 /roller/branches/roller_mediablogging/weblogger-business/src/test/java/org/apache/roller/weblogger/util:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/test/java/org/apache/roller/weblogger/util:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/test/resources/WEB-INF/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1,3 +1,4 @@
 /roller/branches/roller_mavenized/weblogger-business/src/test/resources/WEB-INF:894711-895418
 /roller/branches/roller_mediablogging/apps/weblogger/testdata/WEB-INF:713070-782269
 /roller/branches/roller_mediablogging/weblogger-business/src/test/resources/WEB-INF:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/test/resources/WEB-INF:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/test/resources/adminapi-testdata/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1,3 +1,4 @@
 /roller/branches/roller_mavenized/weblogger-business/src/test/resources/adminapi-testdata:894711-895418
 /roller/branches/roller_mediablogging/apps/weblogger/testdata/adminapi-testdata:713070-782269
 /roller/branches/roller_mediablogging/weblogger-business/src/test/resources/adminapi-testdata:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/test/resources/adminapi-testdata:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/test/resources/planet-custom.properties
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1 +1,2 @@
 /roller/branches/roller_mediablogging/apps/weblogger/testdata/planet-custom.properties:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/test/resources/planet-custom.properties:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/test/resources/roller-custom.properties
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1 +1,2 @@
 /roller/branches/roller_mediablogging/apps/weblogger/testdata/roller-custom.properties:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/test/resources/roller-custom.properties:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/test/resources/uploadsdir/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1,3 +1,4 @@
 /roller/branches/roller_mavenized/weblogger-business/src/test/resources/uploadsdir:894711-895418
 /roller/branches/roller_mediablogging/apps/weblogger/testdata/uploadsdir:713070-782269
 /roller/branches/roller_mediablogging/weblogger-business/src/test/resources/uploadsdir:713070-782269
+/roller/branches/roller_mobile/weblogger-business/src/test/resources/uploadsdir:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/test/resources/uploadsdir/testblog1/sub1/hawk.jpg
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -0,0 +1 @@
+/roller/branches/roller_mobile/weblogger-business/src/test/resources/uploadsdir/testblog1/sub1/hawk.jpg:1139921-1160032

Propchange: roller/trunk/weblogger-business/src/test/resources/uploadsdir/testblog1/sub1/sub2/nasa.jpg
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -0,0 +1 @@
+/roller/branches/roller_mobile/weblogger-business/src/test/resources/uploadsdir/testblog1/sub1/sub2/nasa.jpg:1139921-1160032

Modified: roller/trunk/weblogger-war-assembly/pom.xml
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-war-assembly/pom.xml?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-war-assembly/pom.xml (original)
+++ roller/trunk/weblogger-war-assembly/pom.xml Sat Sep 17 22:00:34 2011
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.roller</groupId>
         <artifactId>roller-project</artifactId>
-        <version>5.0.0</version>
+        <version>5.1.0-mobile-dev</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 

Modified: roller/trunk/weblogger-web/pom.xml
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/pom.xml?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/pom.xml (original)
+++ roller/trunk/weblogger-web/pom.xml Sat Sep 17 22:00:34 2011
@@ -8,14 +8,14 @@
     <parent>
         <groupId>org.apache.roller</groupId>
         <artifactId>roller-project</artifactId>
-        <version>5.0.0</version>
+        <version>5.1.0-mobile-dev</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
     <name>Apache Roller Weblogger Web Module</name>
     <groupId>org.apache.roller</groupId>
     <artifactId>roller-weblogger-web</artifactId>
-    <version>5.0.0</version>
+    <version>5.1.0-mobile-dev</version>
     <packaging>jar</packaging>
 
     <dependencies>
@@ -23,13 +23,13 @@
         <dependency>
             <groupId>org.apache.roller</groupId>
             <artifactId>roller-core</artifactId>
-            <version>5.0.0</version>
+            <version>5.1.0-mobile-dev</version>
         </dependency>
 
         <dependency>
             <groupId>org.apache.roller</groupId>
             <artifactId>roller-planet-business</artifactId>
-            <version>5.0.0</version>
+            <version>5.1.0-mobile-dev</version>
             <exclusions>
                 <exclusion>
                     <artifactId>geronimo-jms_1.1_spec</artifactId>
@@ -49,7 +49,7 @@
         <dependency>
             <groupId>org.apache.roller</groupId>
             <artifactId>roller-weblogger-business</artifactId>
-            <version>5.0.0</version>
+            <version>5.1.0-mobile-dev</version>
         </dependency>
 
         <!-- OpenJPA deps -->
@@ -389,7 +389,7 @@
         <dependency>
             <groupId>org.apache.roller</groupId>
             <artifactId>test-utils</artifactId>
-            <version>5.0.0</version>
+            <version>5.1.0-mobile-dev</version>
             <scope>test</scope>
             <exclusions>
                 <exclusion>

Propchange: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1,3 +1,4 @@
 /roller/branches/roller_mavenized/weblogger-web/src/main/java/org/apache/roller/weblogger/ui:894711-895418
 /roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui:713070-782269
 /roller/branches/roller_mediablogging/weblogger-web/src/main/java/org/apache/roller/weblogger/ui:713070-782269
+/roller/branches/roller_mobile/weblogger-web/src/main/java/org/apache/roller/weblogger/ui:1139921-1160032

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/RendererManager.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/RendererManager.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/RendererManager.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/RendererManager.java Sat Sep 17 22:00:34 2011
@@ -23,8 +23,12 @@ import java.util.Iterator;
 import java.util.Set;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.weblogger.WebloggerException;
+import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.pojos.Template;
+import org.apache.roller.weblogger.pojos.ThemeTemplate;
+import org.apache.roller.weblogger.pojos.WeblogTemplateCode;
 
 
 /**
@@ -107,7 +111,7 @@ public class RendererManager {
      * instance and tries to find a Renderer for the content.  If no Renderer
      * can be found then we throw an exception.
      */
-    public static Renderer getRenderer(Template template) 
+    public static Renderer getRenderer(Template template)
             throws RenderingException {
         
         Renderer renderer = null;
@@ -126,5 +130,24 @@ public class RendererManager {
         throw new RenderingException("No renderer found for template "+
                 template.getId()+"!");
     }
+
+    public static ThemeTemplate prepareTemplate(ThemeTemplate page, String type)throws RenderingException{
+        try {
+            WeblogTemplateCode templateCode = page.getTemplateCode(type);
+
+            if(templateCode != null){
+            page.setContents(templateCode.getTemplate());
+            page.setTemplateLanguage(templateCode.getTemplateLanguage());
+            }
+            else{
+                // if there is no template code present we fall back to default template
+                return page;
+            }
+        } catch (WebloggerException e) {
+            throw new RenderingException("Error while loading template code for template :"+page.getId(),e);
+        }
+         return page;
+
+    }
     
 }

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/model/PageModel.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/model/PageModel.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/model/PageModel.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/model/PageModel.java Sat Sep 17 22:00:34 2011
@@ -32,6 +32,7 @@ import org.apache.roller.weblogger.pojos
 import org.apache.roller.weblogger.pojos.wrapper.WeblogCategoryWrapper;
 import org.apache.roller.weblogger.pojos.wrapper.WeblogEntryWrapper;
 import org.apache.roller.weblogger.pojos.wrapper.WeblogWrapper;
+import org.apache.roller.weblogger.ui.rendering.mobile.MobileDeviceRepository;
 import org.apache.roller.weblogger.ui.rendering.pagers.WeblogEntriesDayPager;
 import org.apache.roller.weblogger.ui.rendering.pagers.WeblogEntriesLatestPager;
 import org.apache.roller.weblogger.ui.rendering.pagers.WeblogEntriesMonthPager;
@@ -54,6 +55,7 @@ public class PageModel implements Model 
     private WeblogEntryCommentForm commentForm = null;
     private Map requestParameters = null;
     private Weblog weblog = null;
+    private String type = null;
     
     
     /**
@@ -106,6 +108,8 @@ public class PageModel implements Model 
         
         // extract weblog object
         weblog = pageRequest.getWeblog();
+
+        this.type = weblogRequest.getType();
     }    
     
     
@@ -121,7 +125,7 @@ public class PageModel implements Model 
      * Get weblog being displayed.
      */
     public WeblogWrapper getWeblog() {
-        return WeblogWrapper.wrap(weblog, urlStrategy);
+        return WeblogWrapper.wrap(weblog, urlStrategy, getType());
     }
     
     
@@ -313,5 +317,12 @@ public class PageModel implements Model 
         }
         return null;
     }
-    
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
 }

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PageServlet.java Sat Sep 17 22:00:34 2011
@@ -18,47 +18,50 @@
 
 package org.apache.roller.weblogger.ui.rendering.servlets;
 
-import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Pattern;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.JspFactory;
-import javax.servlet.jsp.PageContext;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.HitCountQueue;
+import org.apache.roller.weblogger.business.WeblogEntryManager;
+import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.referrers.IncomingReferrer;
 import org.apache.roller.weblogger.business.referrers.ReferrerQueueManager;
 import org.apache.roller.weblogger.business.themes.ThemeManager;
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
-import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.business.WeblogEntryManager;
 import org.apache.roller.weblogger.pojos.StaticThemeTemplate;
 import org.apache.roller.weblogger.pojos.ThemeTemplate;
-import org.apache.roller.weblogger.pojos.WeblogEntry;
 import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.WeblogEntry;
 import org.apache.roller.weblogger.ui.core.RollerContext;
-import org.apache.roller.weblogger.ui.rendering.util.InvalidRequestException;
-import org.apache.roller.weblogger.ui.rendering.util.WeblogPageRequest;
-import org.apache.roller.weblogger.util.cache.CachedContent;
 import org.apache.roller.weblogger.ui.rendering.Renderer;
 import org.apache.roller.weblogger.ui.rendering.RendererManager;
+import org.apache.roller.weblogger.ui.rendering.RenderingException;
+import org.apache.roller.weblogger.ui.rendering.mobile.MobileDeviceRepository;
 import org.apache.roller.weblogger.ui.rendering.model.ModelLoader;
-import org.apache.roller.weblogger.ui.rendering.util.cache.SiteWideCache;
+import org.apache.roller.weblogger.ui.rendering.util.InvalidRequestException;
+import org.apache.roller.weblogger.ui.rendering.util.ModDateHeaderUtil;
 import org.apache.roller.weblogger.ui.rendering.util.WeblogEntryCommentForm;
+import org.apache.roller.weblogger.ui.rendering.util.WeblogPageRequest;
+import org.apache.roller.weblogger.ui.rendering.util.cache.SiteWideCache;
 import org.apache.roller.weblogger.ui.rendering.util.cache.WeblogPageCache;
-import org.apache.roller.weblogger.ui.rendering.util.ModDateHeaderUtil;
 import org.apache.roller.weblogger.util.BlacklistChecker;
 import org.apache.roller.weblogger.util.I18nMessages;
+import org.apache.roller.weblogger.util.cache.CachedContent;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.JspFactory;
+import javax.servlet.jsp.PageContext;
+import java.io.IOException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
 
 /**
  * Provides access to weblog pages.
@@ -122,6 +125,8 @@ public class PageServlet extends HttpSer
 
         log.debug("Entering");
 
+
+
         // do referrer processing, if it's enabled
         // NOTE: this *must* be done first because it triggers a hibernate flush
         // which will close the active session and cause lazy init exceptions otherwise
@@ -138,6 +143,7 @@ public class PageServlet extends HttpSer
         }
 
 
+
         Weblog weblog = null;
         boolean isSiteWide = false;
 
@@ -237,6 +243,14 @@ public class PageServlet extends HttpSer
 
         log.debug("Looking for template to use for rendering");
 
+        // Get the type from user agent
+        String type = MobileDeviceRepository.getRequestType(request);
+
+        // for previews we explicitly set the type attribute
+        if(request.getParameter("type") != null){
+            type = request.getParameter("type");
+        }
+
         // figure out what template to use
         ThemeTemplate page = null;
 
@@ -316,6 +330,13 @@ public class PageServlet extends HttpSer
 
         log.debug("page found, dealing with it");
 
+        // load the correct template using template codes.
+        try {
+            page = RendererManager.prepareTemplate(page, type);
+        } catch (RenderingException e) {
+            log.error("error while preparing template ", e);
+        }
+
         // validation.  make sure that request input makes sense.
         boolean invalid = false;
         if (pageRequest.getWeblogPageName() != null && page.isHidden()) {
@@ -422,7 +443,6 @@ public class PageServlet extends HttpSer
             // Load models for pages
             String pageModels = WebloggerConfig.getProperty("rendering.pageModels");
             ModelLoader.loadModels(pageModels, model, initData, true);
-
             // Load special models for site-wide blog
             if (WebloggerRuntimeConfig.isSiteWideWeblog(weblog.getHandle())) {
                 String siteModels = WebloggerConfig.getProperty("rendering.siteModels");
@@ -636,4 +656,4 @@ public class PageServlet extends HttpSer
 
         return false;
     }
-}
\ No newline at end of file
+}

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PreviewServlet.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PreviewServlet.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PreviewServlet.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/PreviewServlet.java Sat Sep 17 22:00:34 2011
@@ -18,33 +18,31 @@
 
 package org.apache.roller.weblogger.ui.rendering.servlets;
 
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.JspFactory;
-import javax.servlet.jsp.PageContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
-import org.apache.roller.weblogger.pojos.Template;
-import org.apache.roller.weblogger.pojos.Theme;
-import org.apache.roller.weblogger.pojos.ThemeTemplate;
-import org.apache.roller.weblogger.pojos.WeblogTheme;
-import org.apache.roller.weblogger.pojos.Weblog;
+import org.apache.roller.weblogger.pojos.*;
 import org.apache.roller.weblogger.ui.core.RollerContext;
-import org.apache.roller.weblogger.util.cache.CachedContent;
 import org.apache.roller.weblogger.ui.rendering.Renderer;
 import org.apache.roller.weblogger.ui.rendering.RendererManager;
+import org.apache.roller.weblogger.ui.rendering.RenderingException;
 import org.apache.roller.weblogger.ui.rendering.model.ModelLoader;
 import org.apache.roller.weblogger.ui.rendering.util.WeblogPreviewRequest;
+import org.apache.roller.weblogger.util.cache.CachedContent;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.JspFactory;
+import javax.servlet.jsp.PageContext;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
 
 
 /**
@@ -81,13 +79,19 @@ public class PreviewServlet extends Http
         Weblog weblog = null;
         
         WeblogPreviewRequest previewRequest = null;
+
+         String type = null;
+
         try {
             previewRequest = new WeblogPreviewRequest(request);
-            
+
+            // type of the page we are going to preview
+            type = previewRequest.getType();
+
             // lookup weblog specified by preview request
             weblog = previewRequest.getWeblog();
-            if(weblog == null) {
-                throw new WebloggerException("unable to lookup weblog: "+
+            if (weblog == null) {
+                throw new WebloggerException("unable to lookup weblog: " +
                         previewRequest.getWeblogHandle());
             }
         } catch (Exception e) {
@@ -174,6 +178,13 @@ public class PreviewServlet extends Http
         
         
         log.debug("preview page found, dealing with it");
+
+        // load the correct template using template codes.
+        try {
+            page = RendererManager.prepareTemplate((ThemeTemplate) page, type);
+        } catch (RenderingException e) {
+            log.error("error while preparing template ", e);
+        }
         
         // set the content type
         String pageLink = previewRequest.getWeblogPageName();

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/SearchServlet.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/SearchServlet.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/SearchServlet.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/servlets/SearchServlet.java Sat Sep 17 22:00:34 2011
@@ -18,27 +18,19 @@
 
 package org.apache.roller.weblogger.ui.rendering.servlets;
 
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.jsp.JspFactory;
-import javax.servlet.jsp.PageContext;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
-import org.apache.roller.weblogger.config.WebloggerConfig;
-import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.themes.ThemeManager;
+import org.apache.roller.weblogger.config.WebloggerConfig;
+import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
 import org.apache.roller.weblogger.pojos.ThemeTemplate;
 import org.apache.roller.weblogger.pojos.Weblog;
 import org.apache.roller.weblogger.ui.rendering.Renderer;
 import org.apache.roller.weblogger.ui.rendering.RendererManager;
+import org.apache.roller.weblogger.ui.rendering.RenderingException;
+import org.apache.roller.weblogger.ui.rendering.mobile.MobileDeviceRepository;
 import org.apache.roller.weblogger.ui.rendering.model.Model;
 import org.apache.roller.weblogger.ui.rendering.model.ModelLoader;
 import org.apache.roller.weblogger.ui.rendering.model.SearchResultsModel;
@@ -49,6 +41,17 @@ import org.apache.roller.weblogger.ui.re
 import org.apache.roller.weblogger.util.I18nMessages;
 import org.apache.roller.weblogger.util.cache.CachedContent;
 
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.jsp.JspFactory;
+import javax.servlet.jsp.PageContext;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
 
 /**
  * Handles search queries for weblogs.
@@ -95,6 +98,10 @@ public class SearchServlet extends HttpS
             response.sendError(HttpServletResponse.SC_NOT_FOUND);
             return;
         }
+
+        //is a mobile request
+
+       String  type = MobileDeviceRepository.getRequestType(request);
         
         // do we need to force a specific locale for the request?
         if(searchRequest.getLocale() == null && !weblog.isShowAllLangs()) {
@@ -104,9 +111,10 @@ public class SearchServlet extends HttpS
         // lookup template to use for rendering
         ThemeTemplate page = null;
         try {
-            // first try looking for a specific search page
+
+            // try looking for a specific search page
             page = weblog.getTheme().getTemplateByAction(ThemeTemplate.ACTION_SEARCH);
-            
+
             // if not found then fall back on default page
             if(page == null) {
                 page = weblog.getTheme().getDefaultTemplate();
@@ -197,7 +205,14 @@ public class SearchServlet extends HttpS
 				log.error("ERROR - reloading theme " + ex);
 			}
 		}
-		
+
+        //prepare template for detected type
+        try {
+            page = RendererManager.prepareTemplate(page ,type);
+        } catch (RenderingException e) {
+            log.debug("Error while preparing page template");
+        }
+
         // lookup Renderer we are going to use
         Renderer renderer = null;
         try {

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/util/ParsedRequest.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/util/ParsedRequest.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/util/ParsedRequest.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/util/ParsedRequest.java Sat Sep 17 22:00:34 2011
@@ -25,6 +25,7 @@ import org.apache.roller.weblogger.Weblo
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.pojos.User;
+import org.apache.roller.weblogger.ui.rendering.mobile.MobileDeviceRepository;
 
 
 /**
@@ -46,6 +47,8 @@ public abstract class ParsedRequest {
     
     // lightweight attributes
     private String authenticUser = null;
+
+    private String type = "standard";
     
     // heavyweight attributes
     private User user = null;
@@ -70,6 +73,8 @@ public abstract class ParsedRequest {
         if(prince != null) {
             this.authenticUser = prince.getName();
         }
+        // set the detected type of the request
+        type = MobileDeviceRepository.getRequestType(request);
         
     }
     
@@ -107,5 +112,12 @@ public abstract class ParsedRequest {
     public boolean isLoggedIn() {
         return (this.authenticUser != null);
     }
-    
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
 }

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/util/WeblogPageRequest.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/util/WeblogPageRequest.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/util/WeblogPageRequest.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/util/WeblogPageRequest.java Sat Sep 17 22:00:34 2011
@@ -18,25 +18,26 @@
 
 package org.apache.roller.weblogger.ui.rendering.util;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.servlet.http.HttpServletRequest;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
-import org.apache.roller.weblogger.config.WebloggerConfig;
-import org.apache.roller.weblogger.business.WebloggerFactory;
-import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WeblogEntryManager;
+import org.apache.roller.weblogger.business.WebloggerFactory;
+import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.pojos.ThemeTemplate;
 import org.apache.roller.weblogger.pojos.WeblogCategory;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
 import org.apache.roller.weblogger.pojos.WeblogTemplate;
+import org.apache.roller.weblogger.ui.rendering.mobile.MobileDeviceRepository;
 import org.apache.roller.weblogger.util.URLUtilities;
 import org.apache.roller.weblogger.util.Utilities;
 
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 
 /**
  * Represents a request for a Roller weblog page.
@@ -351,9 +352,10 @@ public class WeblogPageRequest extends W
 
     public ThemeTemplate getWeblogPage() {
         
+
         if(weblogPage == null && weblogPageName != null) {
             try {
-                weblogPage = getWeblog().getTheme().getTemplateByLink(weblogPageName);                
+                weblogPage = getWeblog().getTheme().getTemplateByLink(weblogPageName);
             } catch (WebloggerException ex) {
                 log.error("Error getting weblog page "+weblogPageName, ex);
             }

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/util/WeblogPreviewRequest.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/util/WeblogPreviewRequest.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/util/WeblogPreviewRequest.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/util/WeblogPreviewRequest.java Sat Sep 17 22:00:34 2011
@@ -43,6 +43,7 @@ public class WeblogPreviewRequest extend
     // lightweight attributes
     private String themeName = null;
     private String previewEntry = null;
+    private String type = "standard";
     
     // heavyweight attributes
     private Theme theme = null;
@@ -58,12 +59,17 @@ public class WeblogPreviewRequest extend
         if(request.getParameter("theme") != null) {
             this.themeName = request.getParameter("theme");
         }
+
+        //we may need to know the type of page we are going to previiew
+         if(request.getParameter("type") != null) {
+             this.setType(request.getParameter("type"));
+         }
         
         // we may also have a specific entry to preview
         if(request.getParameter("previewEntry") != null) {
             this.previewEntry = URLUtilities.decode(request.getParameter("previewEntry"));
         }
-        
+
         if(log.isDebugEnabled()) {
             log.debug("theme = "+this.themeName);
         }
@@ -146,5 +152,12 @@ public class WeblogPreviewRequest extend
     public void setWeblogEntry(WeblogEntry weblogEntry) {
         this.weblogEntry = weblogEntry;
     }
-    
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
 }

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/core/CreateWeblog.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/core/CreateWeblog.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/core/CreateWeblog.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/core/CreateWeblog.java Sat Sep 17 22:00:34 2011
@@ -18,24 +18,26 @@
 
 package org.apache.roller.weblogger.ui.struts2.core;
 
-import java.util.List;
 import org.apache.commons.lang.CharSetUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
-import org.apache.roller.weblogger.config.WebloggerConfig;
-import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
+import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.themes.ThemeManager;
-import org.apache.roller.weblogger.business.UserManager;
+import org.apache.roller.weblogger.config.WebloggerConfig;
+import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
 import org.apache.roller.weblogger.pojos.User;
 import org.apache.roller.weblogger.pojos.Weblog;
 import org.apache.roller.weblogger.pojos.WeblogPermission;
+import org.apache.roller.weblogger.pojos.WeblogThemeAssoc;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.Utilities;
 import org.apache.struts2.interceptor.validation.SkipValidation;
 
+import java.util.List;
+
 
 /**
  * Allows user to create a new website.
@@ -126,7 +128,7 @@ public class CreateWeblog extends UIActi
             String def = WebloggerRuntimeConfig.getProperty("users.editor.pages");
             String[] defs = Utilities.stringToStringArray(def,",");
             wd.setEditorPage(defs[0]);
-            
+
             try {
                 // add weblog and flush
                 WebloggerFactory.getWeblogger().getWeblogManager().addWeblog(wd);
@@ -184,8 +186,7 @@ public class CreateWeblog extends UIActi
         ThemeManager themeMgr = WebloggerFactory.getWeblogger().getThemeManager();
         return themeMgr.getEnabledThemesList();
     }
-    
-    
+
     public CreateWeblogBean getBean() {
         return bean;
     }

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/core/CreateWeblogBean.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/core/CreateWeblogBean.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/core/CreateWeblogBean.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/core/CreateWeblogBean.java Sat Sep 17 22:00:34 2011
@@ -88,5 +88,5 @@ public class CreateWeblogBean {
     public void setTimeZone(String timeZone) {
         this.timeZone = timeZone;
     }
-    
+
 }

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/StylesheetEdit.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/StylesheetEdit.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/StylesheetEdit.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/StylesheetEdit.java Sat Sep 17 22:00:34 2011
@@ -18,22 +18,19 @@
 
 package org.apache.roller.weblogger.ui.struts2.editor;
 
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.themes.ThemeManager;
-import org.apache.roller.weblogger.pojos.Theme;
-import org.apache.roller.weblogger.pojos.ThemeTemplate;
-import org.apache.roller.weblogger.pojos.WeblogPermission;
-import org.apache.roller.weblogger.pojos.WeblogTemplate;
-import org.apache.roller.weblogger.pojos.WeblogTheme;
+import org.apache.roller.weblogger.pojos.*;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
 
 /**
  * Action which handles editing for a weblog stylesheet override template.
@@ -47,6 +44,9 @@ public class StylesheetEdit extends UIAc
     
     // the contents of the stylesheet override
     private String contents = null;
+
+    // type of the stylesheet template code in active
+    private String type = "standard";
     
     
     public StylesheetEdit() {
@@ -75,9 +75,9 @@ public class StylesheetEdit extends UIAc
         if(stylesheet != null) {
             log.debug("custom stylesheet path is - "+stylesheet.getLink());
             try {
-                setTemplate(WebloggerFactory.getWeblogger().getWeblogManager()
+                 setTemplate(WebloggerFactory.getWeblogger().getWeblogManager()
                         .getPageByLink(getActionWeblog(), stylesheet.getLink()));
-                
+
                 if(getTemplate() == null) {
                     log.debug("custom stylesheet not found, creating it");
                     
@@ -93,7 +93,19 @@ public class StylesheetEdit extends UIAc
                     stylesheetTmpl.setNavbar(false);
                     stylesheetTmpl.setLastModified(new Date());
                     stylesheetTmpl.setTemplateLanguage(stylesheet.getTemplateLanguage());
-                    
+
+                    // create template codes for available template code Types
+                    WeblogTemplateCode standardTemplateCode = new WeblogTemplateCode(stylesheetTmpl.getId(),"standard");
+                    standardTemplateCode.setTemplate(stylesheetTmpl.getContents());
+                    standardTemplateCode.setTemplateLanguage(stylesheetTmpl.getTemplateLanguage());
+
+                    WeblogTemplateCode mobileTemplateCode = new WeblogTemplateCode(stylesheetTmpl.getId(),"mobile");
+                    mobileTemplateCode.setTemplate(stylesheetTmpl.getContents());
+                    mobileTemplateCode.setTemplateLanguage(stylesheetTmpl.getTemplateLanguage());
+
+                    WebloggerFactory.getWeblogger().getWeblogManager().saveTemplateCode(standardTemplateCode);
+                    WebloggerFactory.getWeblogger().getWeblogManager().saveTemplateCode(mobileTemplateCode);
+
                     WebloggerFactory.getWeblogger().getWeblogManager().savePage(stylesheetTmpl);
                     WebloggerFactory.getWeblogger().flush();
                     
@@ -114,8 +126,20 @@ public class StylesheetEdit extends UIAc
         if(getTemplate() == null) {
             return ERROR;
         }
-        
-        setContents(getTemplate().getContents());
+        WeblogTemplateCode templateCode = null;
+        try {
+            templateCode = getTemplate().getTemplateCode(getType());
+        } catch (WebloggerException e) {
+            log.error("Error loading Weblog template code for stylesheet", e);
+        }
+         // if there is a template code load that template
+        if(templateCode != null) {
+            setContents(templateCode.getTemplate());
+        }
+        // if not fall back for default template code
+        else{
+           setContents(getTemplate().getContents());
+        }
         
         return INPUT;
     }
@@ -137,10 +161,14 @@ public class StylesheetEdit extends UIAc
             WeblogTemplate stylesheet = getTemplate();
             
             stylesheet.setLastModified(new Date());
-            stylesheet.setContents(getContents());
+            WeblogTemplateCode templateCode = stylesheet.getTemplateCode(getType());
+            templateCode.setTemplate(getContents());
+
+            //  stylesheet.setContents(getContents());
             
             // save template and flush
             WebloggerFactory.getWeblogger().getWeblogManager().savePage(stylesheet);
+            WebloggerFactory.getWeblogger().getWeblogManager().saveTemplateCode(templateCode);
             WebloggerFactory.getWeblogger().flush();
             
             // notify caches
@@ -183,11 +211,19 @@ public class StylesheetEdit extends UIAc
             // lookup the theme used by this weblog
             ThemeManager tmgr = WebloggerFactory.getWeblogger().getThemeManager();
             Theme theme = tmgr.getTheme(getActionWeblog().getEditorTheme());
+
+            //get weblogTemplateCode
+            WeblogTemplateCode templateCode = theme.getStylesheet().getTemplateCode(type);
+            stylesheet.setContents(templateCode.getTemplate());
             
             // lookup 
             stylesheet.setLastModified(new Date());
-            stylesheet.setContents(theme.getStylesheet().getContents());
-            
+            //stylesheet.setContents(theme.getStylesheet().getContents());
+
+            //save template code which was persisted in DB
+            WeblogTemplateCode existingTemplateCode = stylesheet.getTemplateCode(getType());
+            existingTemplateCode.setTemplate(templateCode.getTemplate());
+            WebloggerFactory.getWeblogger().getWeblogManager().saveTemplateCode(existingTemplateCode);
             // save template and flush
             WebloggerFactory.getWeblogger().getWeblogManager().savePage(stylesheet);
             WebloggerFactory.getWeblogger().flush();
@@ -228,5 +264,12 @@ public class StylesheetEdit extends UIAc
     public void setContents(String contents) {
         this.contents = contents;
     }
-    
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
 }

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateEdit.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateEdit.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateEdit.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateEdit.java Sat Sep 17 22:00:34 2011
@@ -18,10 +18,6 @@
 
 package org.apache.roller.weblogger.ui.struts2.editor;
 
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -30,11 +26,17 @@ import org.apache.roller.weblogger.busin
 import org.apache.roller.weblogger.config.WebloggerConfig;
 import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.pojos.WeblogTemplate;
+import org.apache.roller.weblogger.pojos.WeblogTemplateCode;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.Utilities;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 import org.apache.struts2.interceptor.validation.SkipValidation;
 
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
 
 /**
  * Action which handles editing for a single WeblogTemplate.
@@ -48,6 +50,8 @@ public class TemplateEdit extends UIActi
     
     // the template we are working on
     private WeblogTemplate template = null;
+
+    private String type = null;
     
     
     public TemplateEdit() {
@@ -62,7 +66,7 @@ public class TemplateEdit extends UIActi
         return Collections.singletonList(WeblogPermission.ADMIN);
     }
     
-    
+
     public void myPrepare() {
         try {
             setTemplate(WebloggerFactory.getWeblogger().getWeblogManager().getPage(getBean().getId()));
@@ -70,8 +74,8 @@ public class TemplateEdit extends UIActi
             log.error("Error looking up template - "+getBean().getId(), ex);
         }
     }
-    
-    
+
+
     /**
      * Show template edit page.
      */
@@ -86,7 +90,21 @@ public class TemplateEdit extends UIActi
         
         WeblogTemplate page = getTemplate();
         getBean().copyFrom(template);
-        
+
+        WeblogTemplateCode templateCode = null;
+
+        // look for the template code
+        try {
+           templateCode = WebloggerFactory.getWeblogger().getWeblogManager().
+                   getTemplateCodeByType(template.getId(), getBean().getType());
+        } catch (WebloggerException e) {
+            log.error("Unable to look weblog code for template "+template.getName() +"of type "+getBean().getType());
+        }
+         //set the content for the type.
+        if(templateCode != null){
+            getBean().setContents(templateCode.getTemplate());
+        }
+
         // empty content-type indicates that page uses auto content-type detection
         if (StringUtils.isEmpty(page.getOutputContentType())) {
             getBean().setAutoContentType(Boolean.TRUE);
@@ -97,6 +115,49 @@ public class TemplateEdit extends UIActi
         
         return INPUT;
     }
+
+    /**
+     * This is to sync mobile theme and standard theme if name or link changed
+     */
+      private void synchronizeThemes(){
+
+          boolean isModified = false;
+          WeblogTemplate mobileTemplate = null;
+          WeblogTemplate standardTemplate = null;
+          try {
+              mobileTemplate = WebloggerFactory.getWeblogger().getWeblogManager().
+                      getPage(getBean().getMobileTemplateId());
+              standardTemplate = WebloggerFactory.getWeblogger().getWeblogManager().
+                      getPage(getBean().getStandardTemplateId());
+          } catch (WebloggerException e) {
+              log.error("error in looking up theme ", e);
+          }
+
+          if (standardTemplate != null && mobileTemplate != null) {
+              // if standard template has a different tempalte version we are going to change mobile accordingly
+              if (!mobileTemplate.getName().equals(standardTemplate.getName() + ".Mobile")) {
+                  mobileTemplate.setName(standardTemplate.getName() + ".Mobile");
+                  isModified = true;
+              }
+              if (!mobileTemplate.getLink().equals(standardTemplate.getLink())) {
+                  mobileTemplate.setLink(standardTemplate.getLink());
+                  isModified = true;
+              }
+              if (isModified) {
+                  // save template and flush
+                  try {
+                      WebloggerFactory.getWeblogger().getWeblogManager().savePage(mobileTemplate);
+                      WebloggerFactory.getWeblogger().flush();
+                  } catch (WebloggerException e) {
+                      log.error("Error syncing with standard template", e);
+                  }
+                  // notify caches
+                  CacheManager.invalidate(mobileTemplate);
+              }
+
+          }
+
+      }
     
     
     /**
@@ -127,12 +188,24 @@ public class TemplateEdit extends UIActi
                 template.setOutputContentType(null);
             }
             
-            // save template and flush
+            // save template
             WebloggerFactory.getWeblogger().getWeblogManager().savePage(template);
-            WebloggerFactory.getWeblogger().flush();
-            
+
+
+            //save template code
+            WeblogTemplateCode templateCode = WebloggerFactory.getWeblogger().getWeblogManager().
+                    getTemplateCodeByType(template.getId(),getBean().getType());
+            templateCode.setTemplate(getBean().getContents());
+
+            WebloggerFactory.getWeblogger().getWeblogManager().saveTemplateCode(templateCode);
+
+            //flush
+             WebloggerFactory.getWeblogger().flush();
+
             // notify caches
             CacheManager.invalidate(template);
+
+           // synchronizeThemes();
             
             // success message
             addMessage("pageForm.save.success", template.getName());
@@ -145,7 +218,43 @@ public class TemplateEdit extends UIActi
         
         return INPUT;
     }
-    
+
+
+    public String loadMobileTheme(){
+         if(getTemplate() == null) {
+            // TODO: i18n
+            addError("Unable to locate specified template");
+            return LIST;
+        }
+
+             WeblogTemplate mobile = null;
+
+        try {
+                mobile = WebloggerFactory.getWeblogger().getWeblogManager().getPageByName(getActionWeblog(),
+                    template.getName()+".mobile");
+        } catch (WebloggerException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+
+         if(mobile == null){
+            addError("Unable to locate specified template");
+            return LIST;
+         }
+        getBean().copyFrom(mobile);
+
+
+        // empty content-type indicates that page uses auto content-type detection
+        if (StringUtils.isEmpty(mobile.getOutputContentType())) {
+            getBean().setAutoContentType(Boolean.TRUE);
+        } else {
+            getBean().setAutoContentType(Boolean.FALSE);
+            getBean().setManualContentType(mobile.getOutputContentType());
+        }
+
+        return INPUT;
+    }
+
+
     
     private void myValidate() {
         
@@ -159,8 +268,8 @@ public class TemplateEdit extends UIActi
                 log.error("Error checking page name uniqueness", ex);
             }
         }
-        
-        // if link changed make sure there isn't a conflict
+
+      // if link changed make sure there isn't a conflict
         if(!StringUtils.isEmpty(getBean().getLink()) &&
                 !getBean().getLink().equals(getTemplate().getLink())) {
             try {
@@ -195,6 +304,15 @@ public class TemplateEdit extends UIActi
 
     public void setTemplate(WeblogTemplate template) {
         this.template = template;
+
     }
-    
-}
+
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+}
\ No newline at end of file

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateEditBean.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateEditBean.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateEditBean.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/TemplateEditBean.java Sat Sep 17 22:00:34 2011
@@ -18,9 +18,8 @@
 
 package org.apache.roller.weblogger.ui.struts2.editor;
 
-import java.util.Locale;
-import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.pojos.WeblogTemplate;
+import org.apache.struts2.components.If;
 
 
 /**
@@ -39,6 +38,13 @@ public class TemplateEditBean {
     private boolean hidden = false;
     private Boolean autoContentType = Boolean.TRUE;
     private String manualContentType = null;
+    private String type = null;
+
+     // template ID of mobile template version
+    private String mobileTemplateId = null;
+
+    // template ID of standard template version
+    private String standardTemplateId = null;
     
     
     public String getId() {
@@ -84,7 +90,7 @@ public class TemplateEditBean {
     public String getContents() {
         return this.contents;
     }
-    
+
     public void setContents( String contents ) {
         this.contents = contents;
     }
@@ -131,7 +137,9 @@ public class TemplateEditBean {
     
     
     public void copyTo(WeblogTemplate dataHolder) {
-        
+
+        // change the default content of template if we are changing standard type code
+        if("standard".equals(getType()))
         dataHolder.setContents(getContents());
         
         // the rest of the template properties can only be modified when
@@ -159,11 +167,37 @@ public class TemplateEditBean {
         this.navbar = dataHolder.isNavbar();
         this.hidden = dataHolder.isHidden();
         this.templateLanguage = dataHolder.getTemplateLanguage();
-        
         setManualContentType(dataHolder.getOutputContentType());
         if(getManualContentType() != null) {
             setAutoContentType(Boolean.FALSE);
         }
     }
 
+    public String getMobileTemplateId() {
+        return mobileTemplateId;
+    }
+
+    public void setMobileTemplateId(String mobileTemplateId) {
+        this.mobileTemplateId = mobileTemplateId;
+    }
+
+    public String getStandardTemplateId() {
+        return standardTemplateId;
+    }
+
+    public void setStandardTemplateId(String standardTemplateId) {
+        this.standardTemplateId = standardTemplateId;
+    }
+
+    public boolean isMobile() {
+        return (id.equals(mobileTemplateId));
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
 }

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java Sat Sep 17 22:00:34 2011
@@ -18,10 +18,6 @@
 
 package org.apache.roller.weblogger.ui.struts2.editor;
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -29,9 +25,15 @@ import org.apache.roller.weblogger.Weblo
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.pojos.WeblogTemplate;
+import org.apache.roller.weblogger.pojos.WeblogTemplateCode;
 import org.apache.roller.weblogger.pojos.WeblogTheme;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
 
 /**
  * Templates listing page.
@@ -49,6 +51,7 @@ public class Templates extends UIAction 
     // name and action of new template if we are adding a template
     private String newTmplName = null;
     private String newTmplAction = null;
+    private String type = null;
     
     
     public Templates() {
@@ -68,12 +71,12 @@ public class Templates extends UIAction 
         // query for templates list
         try {
             
-            // get current list of templates, minus custom stylesheet
-            List<WeblogTemplate> raw = WebloggerFactory.getWeblogger().getWeblogManager().getPages(getActionWeblog()); 
+             // get current list of templates, minus custom stylesheet
+            List<WeblogTemplate> raw = WebloggerFactory.getWeblogger().getWeblogManager().getPages(getActionWeblog());
             List<WeblogTemplate> pages = new ArrayList<WeblogTemplate>();
             pages.addAll(raw);
             if(getActionWeblog().getTheme().getStylesheet() != null) {
-                pages.remove(WebloggerFactory.getWeblogger().getWeblogManager().getPageByLink(getActionWeblog(), 
+                pages.remove(WebloggerFactory.getWeblogger().getWeblogManager().getPageByLink(getActionWeblog(),
                         getActionWeblog().getTheme().getStylesheet().getLink()));
             }
             setTemplates(pages);
@@ -127,6 +130,10 @@ public class Templates extends UIAction 
             newTemplate.setHidden(false);
             newTemplate.setNavbar(false);
             newTemplate.setLastModified( new Date() );
+
+            if(WeblogTemplate.ACTION_CUSTOM.equals(getNewTmplAction())){
+                newTemplate.setLink(getNewTmplName());
+            }
             
             // all templates start out as velocity templates
             newTemplate.setTemplateLanguage("velocity");
@@ -138,7 +145,20 @@ public class Templates extends UIAction 
             
             // save the new Template
             WebloggerFactory.getWeblogger().getWeblogManager().savePage( newTemplate );
-            
+
+            //Create weblog template codes for available types.
+            WeblogTemplateCode standardTemplCode = new WeblogTemplateCode(newTemplate.getId(),"standard");
+            WeblogTemplateCode mobileTemplCode = new WeblogTemplateCode(newTemplate.getId(),"mobile");
+
+            standardTemplCode.setTemplate(newTemplate.getContents());
+            standardTemplCode.setTemplateLanguage("velocity");
+
+            mobileTemplCode.setTemplate(newTemplate.getContents());
+            mobileTemplCode.setTemplateLanguage("velocity");
+
+            WebloggerFactory.getWeblogger().getWeblogManager().saveTemplateCode(standardTemplCode);
+            WebloggerFactory.getWeblogger().getWeblogManager().saveTemplateCode(mobileTemplCode);
+
             // if this person happened to create a Weblog template from
             // scratch then make sure and set the defaultPageId
             if(WeblogTemplate.DEFAULT_PAGE.equals(newTemplate.getName())) {
@@ -148,10 +168,9 @@ public class Templates extends UIAction 
             
             // flush results to db
             WebloggerFactory.getWeblogger().flush();
-            
-            // reset form fields
-            setNewTmplName(null);
-            setNewTmplAction(null);
+
+            // add roller generated mobile template
+            //addMobileTemplate();
             
         } catch (WebloggerException ex) {
             log.error("Error adding new template for weblog - "+getActionWeblog().getHandle(), ex);
@@ -161,7 +180,7 @@ public class Templates extends UIAction 
         
         return execute();
     }
-    
+
     
     // validation when adding a new template
     private void myValidate() {
@@ -187,6 +206,8 @@ public class Templates extends UIAction 
         } catch (WebloggerException ex) {
             log.error("Error checking for existing template", ex);
         }
+
+
     }
     
     
@@ -221,5 +242,6 @@ public class Templates extends UIAction 
     public void setNewTmplAction(String newTmplAction) {
         this.newTmplAction = newTmplAction;
     }
-    
+
+
 }

Propchange: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/webservices/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1,3 +1,4 @@
 /roller/branches/roller_mavenized/weblogger-web/src/main/java/org/apache/roller/weblogger/webservices:894711-895418
 /roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/webservices:713070-782269
 /roller/branches/roller_mediablogging/weblogger-web/src/main/java/org/apache/roller/weblogger/webservices:713070-782269
+/roller/branches/roller_mobile/weblogger-web/src/main/java/org/apache/roller/weblogger/webservices:1139921-1160032

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/RollerWeblogHandler.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/RollerWeblogHandler.java?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/RollerWeblogHandler.java (original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/webservices/adminprotocol/RollerWeblogHandler.java Sat Sep 17 22:00:34 2011
@@ -18,31 +18,24 @@
 
 package org.apache.roller.weblogger.webservices.adminprotocol;
 
-import java.io.Reader;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Collections;
-import java.util.Date;
-import javax.servlet.http.HttpServletRequest;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.jdom.Document;
 import org.apache.roller.weblogger.WebloggerException;
-import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
 import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WebloggerFactory;
+import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
 import org.apache.roller.weblogger.pojos.User;
 import org.apache.roller.weblogger.pojos.Weblog;
 import org.apache.roller.weblogger.pojos.WeblogPermission;
-import org.apache.roller.weblogger.util.cache.CacheManager;
 import org.apache.roller.weblogger.util.Utilities;
-import org.apache.roller.weblogger.webservices.adminprotocol.sdk.Entry;
-import org.apache.roller.weblogger.webservices.adminprotocol.sdk.EntrySet;
-import org.apache.roller.weblogger.webservices.adminprotocol.sdk.UnexpectedRootElementException;
-import org.apache.roller.weblogger.webservices.adminprotocol.sdk.WeblogEntry;
-import org.apache.roller.weblogger.webservices.adminprotocol.sdk.WeblogEntrySet;
+import org.apache.roller.weblogger.util.cache.CacheManager;
+import org.apache.roller.weblogger.webservices.adminprotocol.sdk.*;
+import org.jdom.Document;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.Reader;
+import java.net.MalformedURLException;
+import java.util.*;
 
 /**
  * This class handles requests concerning Roller weblog resources.
@@ -53,6 +46,7 @@ class RollerWeblogHandler extends Handle
     
     /** Theme name used when creating weblogs */
     private static final String DEFAULT_THEME = "basic";
+
     
     public RollerWeblogHandler(HttpServletRequest request) throws HandlerException {
         super(request);

Propchange: roller/trunk/weblogger-web/src/test/java/org/apache/roller/weblogger/ui/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Sep 17 22:00:34 2011
@@ -1,3 +1,4 @@
 /roller/branches/roller_mavenized/weblogger-web/src/test/java/org/apache/roller/weblogger/ui:894711-895418
 /roller/branches/roller_mediablogging/apps/weblogger/test/java/org/apache/roller/weblogger/ui:713070-782269
 /roller/branches/roller_mediablogging/weblogger-web/src/test/java/org/apache/roller/weblogger/ui:713070-782269
+/roller/branches/roller_mobile/weblogger-web/src/test/java/org/apache/roller/weblogger/ui:1139921-1160032

Modified: roller/trunk/weblogger-webapp/pom.xml
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-webapp/pom.xml?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-webapp/pom.xml (original)
+++ roller/trunk/weblogger-webapp/pom.xml Sat Sep 17 22:00:34 2011
@@ -7,14 +7,14 @@
     <parent>
         <groupId>org.apache.roller</groupId>
         <artifactId>roller-project</artifactId>
-        <version>5.0.0</version>
+        <version>5.1.0-mobile-dev</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
     <name>Apache Roller Weblogger Web Application</name>
     <groupId>org.apache.roller</groupId>
     <artifactId>roller-weblogger-webapp</artifactId>
-    <version>5.0.0</version>
+    <version>5.1.0-mobile-dev</version>
     <packaging>war</packaging>
 
     <dependencies>
@@ -22,7 +22,7 @@
         <dependency>
             <groupId>org.apache.roller</groupId>
             <artifactId>roller-weblogger-web</artifactId>
-            <version>5.0.0</version>
+            <version>5.1.0-mobile-dev</version>
         </dependency>
         
         <dependency>
@@ -100,7 +100,7 @@
                     <dependency>
                         <groupId>org.apache.roller</groupId>
                         <artifactId>test-utils</artifactId>
-                        <version>5.0.0</version>
+                        <version>5.1.0-mobile-dev</version>
                     </dependency>
                     <dependency>
                         <groupId>log4j</groupId>
@@ -110,7 +110,7 @@
                     <dependency>
                         <groupId>org.apache.roller</groupId>
                         <artifactId>test-utils</artifactId>
-                        <version>5.0.0</version>
+                        <version>5.1.0-mobile-dev</version>
                     </dependency>
                     
                     <dependency>

Modified: roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp (original)
+++ roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/core/CreateWeblog.jsp Sat Sep 17 22:00:34 2011
@@ -22,6 +22,8 @@
 function previewImage(theme) {
     document.preview.src="<s:property value="siteURL" />/roller-ui/authoring/previewtheme?theme="+theme;
 }
+
+
 function handlePreview(handle) {
     previewSpan = document.getElementById("handlePreview");
     var n1 = previewSpan.childNodes[0];
@@ -108,6 +110,7 @@ function handlePreview(handle) {
     </td>
     <td class="description"><s:text name="createWebsite.tip.theme" /></td>
 </tr>
+
 </table>
 
 <br />
@@ -120,4 +123,4 @@ function handlePreview(handle) {
 <script type="text/javascript">
     document.forms[0].elements[0].focus();
 </script>
-    
\ No newline at end of file
+    

Modified: roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/StylesheetEdit.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/StylesheetEdit.jsp?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/StylesheetEdit.jsp (original)
+++ roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/StylesheetEdit.jsp Sat Sep 17 22:00:34 2011
@@ -22,15 +22,52 @@
 <p class="pagetip">
     <s:text name="stylesheetEdit.tip" />
     <s:if test="!customTheme"><s:text name="stylesheetEdit.revertTip" /></s:if>
+    <s:if test="$(type == null)"><s:param name="type">standard</s:param></s:if>
 </p>
                 
 <s:form action="stylesheetEdit!save">
     <s:hidden name="weblog" />
-    
+    <s:hidden name="type"/>
+    <s:set name="type" value="type"/>
+
+     <table class="menuTabTable" cellspacing="0" >
+     <tr>
+          <s:if test="%{#type=='standard'}">
+        <td class="menuTabSelected">
+    </s:if>
+    <s:else>
+        <td class="menuTabUnselected">
+    </s:else>
+
+          <div class="menu-tr">
+           <s:url id="styleEdit" action="stylesheetEdit">
+               <s:param name="weblog" value="actionWeblog.handle" />
+               <s:param name="type">standard</s:param>
+           </s:url>
+	       <div class="menu-tl">&nbsp;&nbsp;<s:a href="%{styleEdit}">Standard</s:a>&nbsp;&nbsp; </div>
+	    </div></td>
+
+          <td class="menuTabSeparator"></td>
+        <s:if test="%{#type == 'mobile'}">
+        <td class="menuTabSelected">
+    </s:if>
+    <s:else>
+        <td class="menuTabUnselected">
+    </s:else>
+        <div class="menu-tr">
+
+           <s:url id="styleEdit" action="stylesheetEdit">
+                 <s:param name="weblog" value="actionWeblog.handle" />
+                 <s:param name="type">mobile</s:param>
+           </s:url>
+	       <div class="menu-tl">&nbsp;&nbsp;<s:a href="%{styleEdit}">Mobile</s:a>&nbsp;&nbsp; </div>
+	    </div></td>
+
+     </tr>
+        </table>
+
     <%-- ================================================================== --%>
     <%-- Template editing area w/resize buttons --%>
-    
-    <br />
     <s:textarea name="contents" cols="80" rows="30" cssStyle="width:100%" />
     
     <script type="text/javascript"><!--

Modified: roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/TemplateEdit.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/TemplateEdit.jsp?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/TemplateEdit.jsp (original)
+++ roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/TemplateEdit.jsp Sat Sep 17 22:00:34 2011
@@ -34,6 +34,7 @@
 <s:form action="templateEdit!save" id="template">
     <s:hidden name="weblog" />
     <s:hidden name="bean.id"/>
+    <s:hidden name ="bean.type"/>
     
     <%-- ================================================================== --%>
     <%-- Name, link and desription: disabled when page is a required page --%>
@@ -42,7 +43,7 @@
         <tr>
             <td class="label"><s:text name="pageForm.name" />&nbsp;</td>
             <td class="field">
-                <s:if test="template.required">
+                <s:if test="template.required || bean.mobile">
                     <s:textfield name="bean.name" size="50" readonly="true" cssStyle="background: #e5e5e5" />
                 </s:if>
                 <s:else>
@@ -64,6 +65,7 @@
         <!--
         var weblogURL = '<s:property value="actionWeblog.absoluteURL" />';
         var originalLink = '<s:property value="bean.link" />';
+        var type = '<s:property value="bean.type" /> ' ;
         
         // Update page URL when user changes link
         function updatePageURLDisplay() {
@@ -81,7 +83,7 @@
             if (originalLink != document.getElementById('template_bean_link').value) {
                 window.alert("Link changed, not launching page");
             } else {
-                window.open(weblogURL + 'page/' + originalLink, '_blank');
+                window.open(weblogURL + 'page/' + originalLink+'?type='+type, '_blank');
             }
         }
         -->
@@ -99,7 +101,6 @@
                 <td class="description"></td>
             </tr>
         </s:if>
-        
         <tr>
             <td class="label" valign="top" style="padding-top: 4px"><s:text name="pageForm.description" />&nbsp;</td>
             <td class="field">
@@ -114,11 +115,52 @@
         </tr>
         
     </table>
-    
+
+     <s:set name="tabMenu" value="menu"/>
+     <s:set name="type" value="bean.type"/>
+
+    <table class="menuTabTable" cellspacing="0" >
+     <tr>
+          <s:if test="%{#type=='standard'}">
+        <td class="menuTabSelected">
+    </s:if>
+    <s:else>
+        <td class="menuTabUnselected">
+    </s:else>
+
+          <div class="menu-tr">
+           <s:url id="edit" action="templateEdit">
+               <s:param name="weblog" value="actionWeblog.handle" />
+               <s:param name="bean.id" value="template.id" />
+               <s:param name="bean.type">standard</s:param>
+           </s:url>
+	       <div class="menu-tl">&nbsp;&nbsp;<s:a href="%{edit}">Standard</s:a>&nbsp;&nbsp; </div>
+	    </div></td>
+
+
+          <td class="menuTabSeparator"></td>
+        <s:if test="%{#type == 'mobile'}">
+        <td class="menuTabSelected">
+    </s:if>
+    <s:else>
+        <td class="menuTabUnselected">
+    </s:else>
+        <div class="menu-tr">
+
+           <s:url id="edit" action="templateEdit">
+               <s:param name="weblog" value="actionWeblog.handle" />
+               <s:param name="bean.id" value="template.id" />
+                 <s:param name="bean.type">mobile</s:param>
+           </s:url>
+	       <div class="menu-tl">&nbsp;&nbsp;<s:a href="%{edit}">Mobile</s:a>&nbsp;&nbsp; </div>
+	    </div></td>
+
+     </tr>
+        </table>
     <%-- ================================================================== --%>
     <%-- Template editing area w/resize buttons --%>
-    
-    <br />
+
+
     <s:textarea name="bean.contents" cols="80" rows="30" cssStyle="width:100%" />
     
     <script type="text/javascript"><!--

Modified: roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/Templates.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/Templates.jsp?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/Templates.jsp (original)
+++ roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/Templates.jsp Sat Sep 17 22:00:34 2011
@@ -56,6 +56,7 @@
                 <s:url id="edit" action="templateEdit">
                     <s:param name="weblog" value="actionWeblog.handle" />
                     <s:param name="bean.id" value="#p.id" />
+                    <s:param name="bean.type">standard</s:param>
                 </s:url>
                 <s:a href="%{edit}"><s:property value="#p.name" /></s:a>
             </td>

Modified: roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/ThemeEditSharedThemesOnly.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/ThemeEditSharedThemesOnly.jsp?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/ThemeEditSharedThemesOnly.jsp (original)
+++ roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/jsps/editor/ThemeEditSharedThemesOnly.jsp Sat Sep 17 22:00:34 2011
@@ -27,6 +27,11 @@ function fullPreview() {
     selected=document.getElementById('themeEdit_themeId').selectedIndex;
     window.open('<s:url value="/roller-ui/authoring/preview/%{actionWeblog.handle}"/>?theme='+document.getElementById('themeEdit_themeId').options[selected].value, '_preview', '');
 }
+
+function previewMobileImage(element, theme) {
+    element.src="<s:property value="siteURL" />/themes/" + theme + "/sm-theme-" + theme + ".png";
+}
+
 -->
 </script>
 

Modified: roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/velocity/weblog.vm
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/velocity/weblog.vm?rev=1172075&r1=1172074&r2=1172075&view=diff
==============================================================================
--- roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/velocity/weblog.vm (original)
+++ roller/trunk/weblogger-webapp/src/main/webapp/WEB-INF/velocity/weblog.vm Sat Sep 17 22:00:34 2011
@@ -895,5 +895,20 @@ Include Javascript code needed for expan
 #end
 
 
+#macro(_Jave $type)
+<script type="text/javascript">
+     var type = '$type';
+    function setCookie(c_name, value, exdays) {
+        var exdate = new Date();
+        exdate.setDate(exdate.getDate() + exdays);
+        var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
+        document.cookie = c_name + "=" + c_value;
+    }
+    setCookie("roller_user_request_type", type, 30);
+
+</script>
+#end
+
+
 
 



Mime
View raw message