roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r1201543 - in /roller/trunk: weblogger-business/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java
Date Sun, 13 Nov 2011 23:05:36 GMT
Author: snoopdave
Date: Sun Nov 13 23:05:36 2011
New Revision: 1201543

URL: http://svn.apache.org/viewvc?rev=1201543&view=rev
Log:
More fixes to ensure that deviceType is used to select correct template code in shared
related to https://issues.apache.org/jira/browse/ROL-1930

Modified:
    roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java
    roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java

Modified: roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java?rev=1201543&r1=1201542&r2=1201543&view=diff
==============================================================================
--- roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java
(original)
+++ roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java
Sun Nov 13 23:05:36 2011
@@ -21,8 +21,6 @@ package org.apache.roller.weblogger.busi
 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.WebloggerFactory;
 import org.apache.roller.weblogger.pojos.*;
 
 import java.io.File;

Modified: roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java?rev=1201543&r1=1201542&r2=1201543&view=diff
==============================================================================
--- roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java
(original)
+++ roller/trunk/weblogger-web/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java
Sun Nov 13 23:05:36 2011
@@ -65,10 +65,12 @@ public class ThemeResourceLoader extends
         if (name == null || name.length() < 1) {
             throw new ResourceNotFoundException("Need to specify a template name!");
         }
-        
+       
+		String deviceType = "standard";
 		if (name.contains("|")) {
 			String[] pair = name.split("\\|");
 			name = pair[0];
+			deviceType = pair[1];
 		}
 
         try {
@@ -81,15 +83,21 @@ public class ThemeResourceLoader extends
             ThemeManager themeMgr = WebloggerFactory.getWeblogger().getThemeManager();
             Theme theme = themeMgr.getTheme(split[0]);
             ThemeTemplate template = theme.getTemplateByName(split[1]);
-            
-            if(template == null)
+           
+            if (template == null)
                 throw new ResourceNotFoundException("Template ["+split[1]+
                         "] doesn't seem to be part of theme ["+split[0]+"]");
-            
+          
+			final String contents;
+			if (template.getTemplateCode(deviceType) != null) {
+				contents = template.getTemplateCode(deviceType).getTemplate();	
+			} else {
+				contents = template.getContents(); 
+			}
             logger.debug("Resource found!");
-            
+           
             // return the input stream
-            return new ByteArrayInputStream(template.getContents().getBytes("UTF-8"));
+            return new ByteArrayInputStream(contents.getBytes("UTF-8"));
             
         } catch (UnsupportedEncodingException uex) {
             // We expect UTF-8 in all JRE installation.



Mime
View raw message