roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ghu...@apache.org
Subject svn commit: r1240056 - in /roller/trunk/weblogger-business/src/main: java/org/apache/roller/weblogger/business/themes/ resources/org/apache/roller/weblogger/config/
Date Fri, 03 Feb 2012 09:58:02 GMT
Author: ghuber
Date: Fri Feb  3 09:58:02 2012
New Revision: 1240056

URL: http://svn.apache.org/viewvc?rev=1240056&view=rev
Log:
Theme reloading for mobile templates.

Modified:
    roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java
    roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeTemplateCode.java
    roller/trunk/weblogger-business/src/main/resources/org/apache/roller/weblogger/config/roller.properties

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=1240056&r1=1240055&r2=1240056&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
Fri Feb  3 09:58:02 2012
@@ -273,6 +273,13 @@ public class SharedThemeFromDir extends 
 					TemplateCode templateCode = createTemplateCode(theme_template.getId(), stylesheetTmpl.getTemplateCode(type));
 
 					theme_template.addTemplateCode(type, templateCode);
+					
+					// Set Last Modified
+					Date lstModified = theme_template.getLastModified();
+					if (getLastModified() == null
+							|| lstModified.after(getLastModified())) {
+						setLastModified(lstModified);
+					}
 				}
 				// store it
 				this.stylesheet = theme_template;
@@ -280,9 +287,6 @@ public class SharedThemeFromDir extends 
 				addTemplate(theme_template);
 			}
 
-			// Set Last Modified
-			setLastModified(new Date(templateFile.lastModified()));
-
 		}
 
 		// go through static resources and add them to the theme
@@ -362,21 +366,24 @@ public class SharedThemeFromDir extends 
 					templateMetadata.isNavbar());
 
 			for (String type : availableTypesList) {
-				TemplateCode templateCode = createTemplateCode(theme_template.getId(),
+				SharedThemeTemplateCode templateCode = createTemplateCode(theme_template.getId(),
 						templateMetadata.getTemplateCode(type));
 
 				theme_template.addTemplateCode(type, templateCode);
+				
+				// Set Last Modified
+				Date lstModified = templateCode.getLastModified();
+				if (getLastModified() == null
+						|| lstModified.after(getLastModified())) {
+					setLastModified(lstModified);
+				}
 			}
+			
+			theme_template.setLastModified(getLastModified());
 
 			// add it to the theme
 			addTemplate(theme_template);
 
-			// Set Last Modified
-			Date lstModified = new Date(templateFile.lastModified());
-			if (getLastModified() == null
-					|| lstModified.after(getLastModified())) {
-				setLastModified(lstModified);
-			}
 		}
 	}
     
@@ -429,8 +436,8 @@ public class SharedThemeFromDir extends 
         this.resources.put(normalizedPath, resource);
     }
 
-	private TemplateCode createTemplateCode(String templateId, ThemeMetadataTemplateCode templateCodeMetadata)
{
-		TemplateCode templateCode = new SharedThemeTemplateCode();
+	private SharedThemeTemplateCode createTemplateCode(String templateId, ThemeMetadataTemplateCode
templateCodeMetadata) {
+		SharedThemeTemplateCode templateCode = new SharedThemeTemplateCode();
 
 		// construct File object from path
 		File templateFile = new File(this.themeDir + File.separator
@@ -449,6 +456,7 @@ public class SharedThemeFromDir extends 
 		templateCode.setTemplateLanguage(templateCodeMetadata.getTemplateLang());
 		templateCode.setType(templateCodeMetadata.getType());
 		templateCode.setContentType(templateCodeMetadata.getContentType());
+		templateCode.setLastModified(new Date(templateFile.lastModified()));
 
 		return templateCode;
 	}

Modified: roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeTemplateCode.java
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeTemplateCode.java?rev=1240056&r1=1240055&r2=1240056&view=diff
==============================================================================
--- roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeTemplateCode.java
(original)
+++ roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeTemplateCode.java
Fri Feb  3 09:58:02 2012
@@ -22,6 +22,7 @@ import org.apache.roller.weblogger.pojos
 import org.apache.commons.lang.builder.EqualsBuilder;
 import org.apache.commons.lang.builder.HashCodeBuilder;
 import java.io.Serializable;
+import java.util.Date;
 
 /**
  * A pojo that will maintain different template codes for one template
@@ -33,6 +34,7 @@ public class SharedThemeTemplateCode imp
 	private String type = null;
 	private String ContentType = null;
 	private String templateLanguage = null;
+	private Date lastModified = null;
 
 	public SharedThemeTemplateCode(String templateId, String type) {
 		this.templateId = templateId;
@@ -71,6 +73,25 @@ public class SharedThemeTemplateCode imp
 	public void setType(String type) {
 		this.type = type;
 	}
+	
+	/**
+	 * Gets the last modified. File system date.
+	 * 
+	 * @return the last modified
+	 */
+	public Date getLastModified() {
+		return lastModified;
+	}
+
+	/**
+	 * Sets the last modified. File system date.
+	 * 
+	 * @param lastModified
+	 *            the new last modified
+	 */
+	public void setLastModified(Date lastModified) {
+		this.lastModified = lastModified;
+	}
 
 	// ------------------------------------------------------- Good citizenship
 

Modified: roller/trunk/weblogger-business/src/main/resources/org/apache/roller/weblogger/config/roller.properties
URL: http://svn.apache.org/viewvc/roller/trunk/weblogger-business/src/main/resources/org/apache/roller/weblogger/config/roller.properties?rev=1240056&r1=1240055&r2=1240056&view=diff
==============================================================================
--- roller/trunk/weblogger-business/src/main/resources/org/apache/roller/weblogger/config/roller.properties
(original)
+++ roller/trunk/weblogger-business/src/main/resources/org/apache/roller/weblogger/config/roller.properties
Fri Feb  3 09:58:02 2012
@@ -128,6 +128,7 @@ themes.dir=${webapp.context}
 
 # Allow theme reloading during development
 # NB remember also to always delete the style-sheet from the weblog you're using
+# See also velocity.properties for reloading macros in /WEB-INF/velocity... 
 themes.reload.mode=false
 
 #-----------------------------------------------------------------------------



Mime
View raw message