You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by gh...@apache.org on 2013/10/11 15:06:34 UTC
svn commit: r1531282 - in /roller/trunk/app/src/main:
java/org/apache/roller/weblogger/business/themes/
java/org/apache/roller/weblogger/ui/rendering/velocity/ resources/
webapp/WEB-INF/velocity/ webapp/WEB-INF/velocity/templates/
webapp/themes/basic/
Author: ghuber
Date: Fri Oct 11 13:06:33 2013
New Revision: 1531282
URL: http://svn.apache.org/r1531282
Log:
jQuery mobile rocks..
Added:
roller/trunk/app/src/main/webapp/themes/basic/basic-mobile-custom.css
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/RollerVelocity.java
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java
roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/VelocityRenderer.java
roller/trunk/app/src/main/resources/ApplicationResources.properties
roller/trunk/app/src/main/webapp/WEB-INF/velocity/templates/error-parse.vm
roller/trunk/app/src/main/webapp/WEB-INF/velocity/weblog.vm
roller/trunk/app/src/main/webapp/themes/basic/_day-mobile.vm
roller/trunk/app/src/main/webapp/themes/basic/permalink-mobile.vm
roller/trunk/app/src/main/webapp/themes/basic/searchresults-mobile.vm
roller/trunk/app/src/main/webapp/themes/basic/theme.xml
roller/trunk/app/src/main/webapp/themes/basic/weblog-mobile.vm
Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java?rev=1531282&r1=1531281&r2=1531282&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java Fri Oct 11 13:06:33 2013
@@ -32,52 +32,49 @@ import org.apache.roller.weblogger.pojos
import org.apache.roller.weblogger.pojos.ThemeTemplate;
import org.apache.roller.weblogger.pojos.WeblogTemplate;
-
/**
- * The Theme object encapsulates all elements of a single weblog theme. It
- * is used mostly to contain all the templates for a theme, but does contain
- * other theme related attributes such as name, last modifed date, etc.
+ * The Theme object encapsulates all elements of a single weblog theme. It is
+ * used mostly to contain all the templates for a theme, but does contain other
+ * theme related attributes such as name, last modifed date, etc.
*/
public class SharedThemeFromDir extends SharedTheme {
-
+
private static Log log = LogFactory.getLog(SharedThemeFromDir.class);
-
+
// the filesystem directory where we should read this theme from
private String themeDir = null;
-
+
// the theme preview image
private ThemeResource previewImage = null;
-
+
// the theme stylesheet
private ThemeTemplate stylesheet = null;
-
+
// we keep templates in a Map for faster lookups by name
// the Map contains ... (template name, ThemeTemplate)
private Map templatesByName = new HashMap();
-
+
// we keep templates in a Map for faster lookups by link
// the Map contains ... (template link, List<tThemeTemplate>)
private Map templatesByLink = new HashMap();
-
+
// we keep templates in a Map for faster lookups by action
// the Map contains ... (template action, ThemeTemplate)
private Map templatesByAction = new HashMap();
-
+
// we keep resources in a Map for faster lookups by path
// the Map contains ... (resource path, ThemeResource)
private Map resources = new HashMap();
-
-
- public SharedThemeFromDir(String themeDirPath)
+
+ public SharedThemeFromDir(String themeDirPath)
throws ThemeInitializationException {
-
+
this.themeDir = themeDirPath;
-
+
// load the theme elements and cache 'em
loadThemeFromDisk();
}
-
/**
* Get a resource representing the preview image for this theme.
*/
@@ -85,320 +82,333 @@ public class SharedThemeFromDir extends
return this.previewImage;
}
-
/**
* Get the collection of all templates associated with this Theme.
*/
public List getTemplates() {
return new ArrayList(this.templatesByName.values());
}
-
-
+
/**
- * Lookup the stylesheet.
- * Returns null if no stylesheet defined.
+ * Lookup the stylesheet. Returns null if no stylesheet defined.
*/
public ThemeTemplate getStylesheet() {
return this.stylesheet;
}
-
-
+
/**
- * Looup the default template, action = weblog.
- * Returns null if the template cannot be found.
+ * Looup the default template, action = weblog. Returns null if the template
+ * cannot be found.
*/
public ThemeTemplate getDefaultTemplate() {
- return (ThemeTemplate) this.templatesByAction.get(ThemeTemplate.ACTION_WEBLOG);
+ return (ThemeTemplate) this.templatesByAction
+ .get(ThemeTemplate.ACTION_WEBLOG);
}
-
-
+
/**
- * Lookup the specified template by name.
- * Returns null if the template cannot be found.
+ * Lookup the specified template by name. Returns null if the template
+ * cannot be found.
*/
public ThemeTemplate getTemplateByName(String name) {
return (ThemeTemplate) this.templatesByName.get(name);
}
-
-
+
/**
- * Lookup the specified template by link.
- * Returns null if the template cannot be found.
+ * Lookup the specified template by link. Returns null if the template
+ * cannot be found.
*/
- public ThemeTemplate getTemplateByLink(String link) {
+ public ThemeTemplate getTemplateByLink(String link) {
return (ThemeTemplate) this.templatesByLink.get(link);
}
-
-
+
/**
- * Lookup the specified template by action.
- * Returns null if the template cannot be found.
+ * Lookup the specified template by action. Returns null if the template
+ * cannot be found.
*/
public ThemeTemplate getTemplateByAction(String action) {
return (ThemeTemplate) this.templatesByAction.get(action);
}
-
-
+
/**
* Get the collection of all resources associated with this Theme.
- *
+ *
* It is assured that the resources are returned sorted by pathname.
*/
public List getResources() {
-
+
// make sure resources are sorted.
List myResources = new ArrayList(this.resources.values());
Collections.sort(myResources);
-
+
return myResources;
}
-
-
+
/**
- * Lookup the specified resource by path.
- * Returns null if the resource cannot be found.
+ * Lookup the specified resource by path. Returns null if the resource
+ * cannot be found.
*/
public ThemeResource getResource(String path) {
return (ThemeResource) this.resources.get(path);
}
-
-
+
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(name);
sb.append("\n");
-
+
Iterator it = this.templatesByName.values().iterator();
- while(it.hasNext()) {
+ while (it.hasNext()) {
sb.append(it.next());
sb.append("\n");
}
-
+
return sb.toString();
-
+
}
-
-
- /**
- * Load all the elements of this theme from disk and cache them.
- */
- private void loadThemeFromDisk() throws ThemeInitializationException {
-
- log.debug("Parsing theme descriptor for " + this.themeDir);
-
- ThemeMetadata themeMetadata = null;
- try {
- // lookup theme descriptor and parse it
- ThemeMetadataParser parser = new ThemeMetadataParser();
- InputStream is = new FileInputStream(this.themeDir + File.separator + "theme.xml");
- themeMetadata = parser.unmarshall(is);
- } catch (Exception ex) {
- throw new ThemeInitializationException("Unable to parse theme descriptor for theme " + this.themeDir, ex);
- }
-
- log.debug("Loading Theme " + themeMetadata.getName());
-
- // use parsed theme descriptor to load Theme data
- setId(themeMetadata.getId());
- setName(themeMetadata.getName());
- setDescription(themeMetadata.getName());
- setType(themeMetadata.getType());
- setAuthor(themeMetadata.getAuthor());
- setLastModified(null);
- setEnabled(true);
-
- // load resource representing preview image
- File previewFile = new File(this.themeDir + File.separator + themeMetadata.getPreviewImage());
- if (!previewFile.exists() || !previewFile.canRead()) {
- log.warn("Couldn't read theme [" + this.getName() + "] preview image file [" + themeMetadata.getPreviewImage() + "]");
- } else {
- this.previewImage = new SharedThemeResourceFromDir(themeMetadata.getPreviewImage(), previewFile);
- }
-
- //avaialble types in the Roller
- List<String> availableTypesList = new ArrayList<String>();
- availableTypesList.add("standard");
- availableTypesList.add("mobile");
-
- // load stylesheet if possible
- if (themeMetadata.getStylesheet() != null) {
-
- ThemeMetadataTemplate stylesheetTmpl = themeMetadata.getStylesheet();
- // getting the template codes for available types
- ThemeMetadataTemplateCode standardTemplateCode = stylesheetTmpl.getTemplateCodeTable().get("standard");
- ThemeMetadataTemplateCode mobileTemplateCode = stylesheetTmpl.getTemplateCodeTable().get("mobile");
-
- // If no template code present for any type
- if (standardTemplateCode == null && mobileTemplateCode == null) {
- throw new ThemeInitializationException("Error in getting template codes for template");
- } else if (mobileTemplateCode == null) {
- //cloning the standard template code if no mobile is present
- mobileTemplateCode = new ThemeMetadataTemplateCode();
- mobileTemplateCode.setContentsFile(standardTemplateCode.getContentsFile());
- mobileTemplateCode.setContentType(standardTemplateCode.getContentType());
- mobileTemplateCode.setTemplateLang(standardTemplateCode.getTemplateLang());
- mobileTemplateCode.setType("mobile");
-
- stylesheetTmpl.addTemplateCode("mobile", mobileTemplateCode);
- }
-
-
- // construct File object from path
- // we are getting the file path from standard as the default and load it to initially.
- File templateFile = new File(this.themeDir + File.separator
- + standardTemplateCode.getContentsFile());
-
- // read stylesheet contents
- String contents = loadTemplateFile(templateFile);
- if (contents == null) {
- // if we don't have any contents then skip this one
- log.error("Couldn't load stylesheet theme [" + this.getName() + "] template file [" + templateFile + "]");
- } else {
-
- // construct ThemeTemplate representing this file
- // here we set content and template language from standard template code assuming it is the default
- SharedThemeTemplate theme_template = new SharedThemeTemplate(
- this,
- themeMetadata.getId() + ":" + stylesheetTmpl.getName(),
- WeblogTemplate.ACTION_CUSTOM,
- stylesheetTmpl.getName(),
- stylesheetTmpl.getDescription(),
- contents,
- stylesheetTmpl.getLink(),
- new Date(templateFile.lastModified()),
- standardTemplateCode.getTemplateLang(),
- false,
- false);
-
-
- for (String type : availableTypesList) {
- 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;
-
- addTemplate(theme_template);
- }
-
- }
-
- // go through static resources and add them to the theme
- String resourcePath = null;
- Iterator resourcesIter = themeMetadata.getResources().iterator();
- while (resourcesIter.hasNext()) {
- resourcePath = (String) resourcesIter.next();
-
- // construct ThemeResource object from resource
- File resourceFile = new File(this.themeDir + File.separator + resourcePath);
-
- // Continue reading theme even if problem encountered with one file
- if (!resourceFile.exists() || !resourceFile.canRead()) {
- log.warn("Couldn't read theme [" + this.getName() + "] resource file [" + resourcePath + "]");
- continue;
- }
-
- // add it to the theme
- setResource(resourcePath, new SharedThemeResourceFromDir(resourcePath, resourceFile));
-
- // Set Last Modified
- Date lstModified = new Date(resourceFile.lastModified());
- if (getLastModified() == null
- || lstModified.after(getLastModified())) {
- setLastModified(lstModified);
- }
-
- }
-
- // go through templates and read in contents to a ThemeTemplate
- SharedThemeTemplate theme_template = null;
- ThemeMetadataTemplate templateMetadata = null;
- Iterator templatesIter = themeMetadata.getTemplates().iterator();
- while (templatesIter.hasNext()) {
- templateMetadata = (ThemeMetadataTemplate) templatesIter.next();
-
- //getting the template codes for available types
- ThemeMetadataTemplateCode standardTemplateCode = templateMetadata.getTemplateCodeTable().get("standard");
- ThemeMetadataTemplateCode mobileTemplateCode = templateMetadata.getTemplateCodeTable().get("mobile");
-
- //If no template code present for any type
- if (standardTemplateCode == null && mobileTemplateCode == null) {
- throw new ThemeInitializationException("Error in getting template codes for template");
- } else if (mobileTemplateCode == null) {
- //cloning the standard template code if no mobile is present
- mobileTemplateCode = new ThemeMetadataTemplateCode();
- mobileTemplateCode.setContentsFile(standardTemplateCode.getContentsFile());
- mobileTemplateCode.setContentType(standardTemplateCode.getContentType());
- mobileTemplateCode.setTemplateLang(standardTemplateCode.getTemplateLang());
- mobileTemplateCode.setType("mobile");
-
- templateMetadata.addTemplateCode("mobile", mobileTemplateCode);
- }
-
- // construct File object from path
- File templateFile = new File(this.themeDir + File.separator
- + standardTemplateCode.getContentsFile());
-
- String contents = loadTemplateFile(templateFile);
- if (contents == null) {
- // if we don't have any contents then skip this one
- throw new ThemeInitializationException("Couldn't load theme [" + this.getName() + "] template file [" + templateFile + "]");
- }
-
- // construct ThemeTemplate representing this file
- theme_template = new SharedThemeTemplate(
- this,
- themeMetadata.getId() + ":" + templateMetadata.getName(),
- templateMetadata.getAction(),
- templateMetadata.getName(),
- templateMetadata.getDescription(),
- contents,
- templateMetadata.getLink(),
- new Date(templateFile.lastModified()),
- standardTemplateCode.getTemplateLang(),
- templateMetadata.isHidden(),
- templateMetadata.isNavbar());
-
- for (String type : availableTypesList) {
- 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);
-
- }
- }
-
-
+
+ /**
+ * Load all the elements of this theme from disk and cache them.
+ */
+ private void loadThemeFromDisk() throws ThemeInitializationException {
+
+ log.debug("Parsing theme descriptor for " + this.themeDir);
+
+ ThemeMetadata themeMetadata = null;
+ try {
+ // lookup theme descriptor and parse it
+ ThemeMetadataParser parser = new ThemeMetadataParser();
+ InputStream is = new FileInputStream(this.themeDir + File.separator
+ + "theme.xml");
+ themeMetadata = parser.unmarshall(is);
+ } catch (Exception ex) {
+ throw new ThemeInitializationException(
+ "Unable to parse theme descriptor for theme "
+ + this.themeDir, ex);
+ }
+
+ log.debug("Loading Theme " + themeMetadata.getName());
+
+ // use parsed theme descriptor to load Theme data
+ setId(themeMetadata.getId());
+ setName(themeMetadata.getName());
+ setDescription(themeMetadata.getName());
+ setType(themeMetadata.getType());
+ setAuthor(themeMetadata.getAuthor());
+ setLastModified(null);
+ setEnabled(true);
+
+ // load resource representing preview image
+ File previewFile = new File(this.themeDir + File.separator
+ + themeMetadata.getPreviewImage());
+ if (!previewFile.exists() || !previewFile.canRead()) {
+ log.warn("Couldn't read theme [" + this.getName()
+ + "] preview image file ["
+ + themeMetadata.getPreviewImage() + "]");
+ } else {
+ this.previewImage = new SharedThemeResourceFromDir(
+ themeMetadata.getPreviewImage(), previewFile);
+ }
+
+ // avaialble types in the Roller
+ List<String> availableTypesList = new ArrayList<String>();
+ availableTypesList.add("standard");
+ availableTypesList.add("mobile");
+
+ // load stylesheet if possible
+ if (themeMetadata.getStylesheet() != null) {
+
+ ThemeMetadataTemplate stylesheetTmpl = themeMetadata
+ .getStylesheet();
+ // getting the template codes for available types
+ ThemeMetadataTemplateCode standardTemplateCode = stylesheetTmpl
+ .getTemplateCodeTable().get("standard");
+ ThemeMetadataTemplateCode mobileTemplateCode = stylesheetTmpl
+ .getTemplateCodeTable().get("mobile");
+
+ // If no template code present for any type
+ if (standardTemplateCode == null && mobileTemplateCode == null) {
+ throw new ThemeInitializationException(
+ "Error in getting template codes for template");
+ } else if (mobileTemplateCode == null) {
+ // cloning the standard template code if no mobile is present
+ mobileTemplateCode = new ThemeMetadataTemplateCode();
+ mobileTemplateCode.setContentsFile(standardTemplateCode
+ .getContentsFile());
+ mobileTemplateCode.setContentType(standardTemplateCode
+ .getContentType());
+ mobileTemplateCode.setTemplateLang(standardTemplateCode
+ .getTemplateLang());
+ mobileTemplateCode.setType("mobile");
+
+ stylesheetTmpl.addTemplateCode("mobile", mobileTemplateCode);
+ }
+
+ // construct File object from path
+ // we are getting the file path from standard as the default and
+ // load it to initially.
+ File templateFile = new File(this.themeDir + File.separator
+ + standardTemplateCode.getContentsFile());
+
+ // read stylesheet contents
+ String contents = loadTemplateFile(templateFile);
+ if (contents == null) {
+ // if we don't have any contents then skip this one
+ log.error("Couldn't load stylesheet theme [" + this.getName()
+ + "] template file [" + templateFile + "]");
+ } else {
+
+ // construct ThemeTemplate representing this file
+ // here we set content and template language from standard
+ // template code assuming it is the default
+ SharedThemeTemplate theme_template = new SharedThemeTemplate(
+ this, themeMetadata.getId() + ":"
+ + stylesheetTmpl.getName(),
+ WeblogTemplate.ACTION_CUSTOM, stylesheetTmpl.getName(),
+ stylesheetTmpl.getDescription(), contents,
+ stylesheetTmpl.getLink(), new Date(
+ templateFile.lastModified()),
+ standardTemplateCode.getTemplateLang(), false, false);
+
+ for (String type : availableTypesList) {
+ SharedThemeTemplateCode templateCode = createTemplateCode(
+ theme_template.getId(),
+ stylesheetTmpl.getTemplateCode(type));
+
+ theme_template.addTemplateCode(type, templateCode);
+
+ // Set Last Modified
+ Date lstModified = templateCode.getLastModified();
+ if (getLastModified() == null
+ || lstModified.after(getLastModified())) {
+ setLastModified(lstModified);
+ }
+ }
+ // store it
+ this.stylesheet = theme_template;
+
+ // Update last modified
+ theme_template.setLastModified(getLastModified());
+
+ addTemplate(theme_template);
+ }
+
+ }
+
+ // go through static resources and add them to the theme
+ String resourcePath = null;
+ Iterator resourcesIter = themeMetadata.getResources().iterator();
+ while (resourcesIter.hasNext()) {
+ resourcePath = (String) resourcesIter.next();
+
+ // construct ThemeResource object from resource
+ File resourceFile = new File(this.themeDir + File.separator
+ + resourcePath);
+
+ // Continue reading theme even if problem encountered with one file
+ if (!resourceFile.exists() || !resourceFile.canRead()) {
+ log.warn("Couldn't read theme [" + this.getName()
+ + "] resource file [" + resourcePath + "]");
+ continue;
+ }
+
+ // add it to the theme
+ setResource(resourcePath, new SharedThemeResourceFromDir(
+ resourcePath, resourceFile));
+
+ // Set Last Modified
+ Date lstModified = new Date(resourceFile.lastModified());
+ if (getLastModified() == null
+ || lstModified.after(getLastModified())) {
+ setLastModified(lstModified);
+ }
+
+ }
+
+ // go through templates and read in contents to a ThemeTemplate
+ SharedThemeTemplate theme_template = null;
+ ThemeMetadataTemplate templateMetadata = null;
+ Iterator templatesIter = themeMetadata.getTemplates().iterator();
+ while (templatesIter.hasNext()) {
+ templateMetadata = (ThemeMetadataTemplate) templatesIter.next();
+
+ // getting the template codes for available types
+ ThemeMetadataTemplateCode standardTemplateCode = templateMetadata
+ .getTemplateCodeTable().get("standard");
+ ThemeMetadataTemplateCode mobileTemplateCode = templateMetadata
+ .getTemplateCodeTable().get("mobile");
+
+ // If no template code present for any type
+ if (standardTemplateCode == null && mobileTemplateCode == null) {
+ throw new ThemeInitializationException(
+ "Error in getting template codes for template");
+ } else if (mobileTemplateCode == null) {
+ // cloning the standard template code if no mobile is present
+ mobileTemplateCode = new ThemeMetadataTemplateCode();
+ mobileTemplateCode.setContentsFile(standardTemplateCode
+ .getContentsFile());
+ mobileTemplateCode.setContentType(standardTemplateCode
+ .getContentType());
+ mobileTemplateCode.setTemplateLang(standardTemplateCode
+ .getTemplateLang());
+ mobileTemplateCode.setType("mobile");
+
+ templateMetadata.addTemplateCode("mobile", mobileTemplateCode);
+ }
+
+ // construct File object from path
+ File templateFile = new File(this.themeDir + File.separator
+ + standardTemplateCode.getContentsFile());
+
+ String contents = loadTemplateFile(templateFile);
+ if (contents == null) {
+ // if we don't have any contents then skip this one
+ throw new ThemeInitializationException("Couldn't load theme ["
+ + this.getName() + "] template file [" + templateFile
+ + "]");
+ }
+
+ // construct ThemeTemplate representing this file
+ theme_template = new SharedThemeTemplate(this,
+ themeMetadata.getId() + ":" + templateMetadata.getName(),
+ templateMetadata.getAction(), templateMetadata.getName(),
+ templateMetadata.getDescription(), contents,
+ templateMetadata.getLink(), new Date(
+ templateFile.lastModified()),
+ standardTemplateCode.getTemplateLang(),
+ templateMetadata.isHidden(), templateMetadata.isNavbar());
+
+ for (String type : availableTypesList) {
+ 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);
+
+ }
+ }
+
/**
* Load a single template file as a string, returns null if can't read file.
*/
private String loadTemplateFile(File templateFile) {
// Continue reading theme even if problem encountered with one file
- if(!templateFile.exists() && !templateFile.canRead()) {
+ if (!templateFile.exists() && !templateFile.canRead()) {
return null;
}
-
+
char[] chars = null;
int length;
try {
@@ -407,29 +417,28 @@ public class SharedThemeFromDir extends
InputStreamReader reader = new InputStreamReader(stream, "UTF-8");
length = reader.read(chars);
} catch (Exception noprob) {
- log.error("Exception reading theme [" + this.getName() + "] template file ["+templateFile+"]");
+ log.error("Exception reading theme [" + this.getName()
+ + "] template file [" + templateFile + "]");
if (log.isDebugEnabled()) {
log.debug(noprob);
}
return null;
}
-
+
return new String(chars, 0, length);
}
-
-
- /**
+
+ /**
* Set the value for a given template name.
*/
private void addTemplate(ThemeTemplate template) {
this.templatesByName.put(template.getName(), template);
this.templatesByLink.put(template.getLink(), template);
- if(!ThemeTemplate.ACTION_CUSTOM.equals(template.getAction())) {
+ if (!ThemeTemplate.ACTION_CUSTOM.equals(template.getAction())) {
this.templatesByAction.put(template.getAction(), template);
}
}
-
-
+
/**
* Set the value for a given resource path.
*/
@@ -439,29 +448,32 @@ public class SharedThemeFromDir extends
this.resources.put(normalizedPath, resource);
}
- private SharedThemeTemplateCode createTemplateCode(String templateId, ThemeMetadataTemplateCode templateCodeMetadata) {
- SharedThemeTemplateCode 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
+ + templateCodeMetadata.getContentsFile());
+
+ // read stylesheet contents
+ String contents = loadTemplateFile(templateFile);
+ if (contents == null) {
+ // if we don't have any contents then load no string
+ contents = "";
+ log.error("Couldn't load stylesheet theme [" + this.getName()
+ + "] template file [" + templateFile + "]");
+ }
- // construct File object from path
- File templateFile = new File(this.themeDir + File.separator
- + templateCodeMetadata.getContentsFile());
-
- // read stylesheet contents
- String contents = loadTemplateFile(templateFile);
- if (contents == null) {
- // if we don't have any contents then load no string
- contents = "";
- log.error("Couldn't load stylesheet theme [" + this.getName() + "] template file [" + templateFile + "]");
- }
-
- templateCode.setTemplateId(templateId);
- templateCode.setTemplate(contents);
- templateCode.setTemplateLanguage(templateCodeMetadata.getTemplateLang());
- templateCode.setType(templateCodeMetadata.getType());
- templateCode.setContentType(templateCodeMetadata.getContentType());
- templateCode.setLastModified(new Date(templateFile.lastModified()));
+ templateCode.setTemplateId(templateId);
+ templateCode.setTemplate(contents);
+ templateCode
+ .setTemplateLanguage(templateCodeMetadata.getTemplateLang());
+ templateCode.setType(templateCodeMetadata.getType());
+ templateCode.setContentType(templateCodeMetadata.getContentType());
+ templateCode.setLastModified(new Date(templateFile.lastModified()));
- return templateCode;
- }
+ return templateCode;
+ }
}
Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/RollerVelocity.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/RollerVelocity.java?rev=1531282&r1=1531281&r2=1531282&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/RollerVelocity.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/RollerVelocity.java Fri Oct 11 13:06:33 2013
@@ -65,6 +65,7 @@ public class RollerVelocity {
// Override for theme reloading
if (themeReload) {
velocityProps.setProperty("class.resource.loader.cache", "false");
+ velocityProps.setProperty("class.resource.loader.modificationCheckInterval", "2");
velocityProps.setProperty("webapp.resource.loader.cache", "false");
velocityProps.setProperty("webapp.resource.loader.modificationCheckInterval", "2");
velocityProps.setProperty("velocimacro.library.autoreload", "true");
Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java?rev=1531282&r1=1531281&r2=1531282&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/ThemeResourceLoader.java Fri Oct 11 13:06:33 2013
@@ -47,96 +47,99 @@ import org.apache.roller.weblogger.pojos
*/
public class ThemeResourceLoader extends ResourceLoader {
- private static Log logger = LogFactory.getFactory().getInstance(
- ThemeResourceLoader.class);
+ private static Log logger = LogFactory.getFactory().getInstance(
+ ThemeResourceLoader.class);
- public void init(ExtendedProperties configuration) {
- logger.debug(configuration);
- }
-
- public InputStream getResourceStream(String name)
- throws ResourceNotFoundException {
-
- logger.debug("Looking for: " + name);
-
- 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 {
- // parse the name ... theme templates name are
- // <theme>:<template>|<deviceType>
- String[] split = name.split(":", 2);
- if (split.length < 2) {
- throw new ResourceNotFoundException("Invalid ThemeRL key "
- + name);
+ public void init(ExtendedProperties configuration) {
+ logger.debug(configuration);
+ }
+
+ public InputStream getResourceStream(String name)
+ throws ResourceNotFoundException {
+
+ if (log.isDebugEnabled())
+ logger.debug("Looking for: " + name);
+
+ 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 {
+ // parse the name ... theme templates name are
+ // <theme>:<template>|<deviceType>
+ String[] split = name.split(":", 2);
+ if (split.length < 2) {
+ throw new ResourceNotFoundException("Invalid ThemeRL key "
+ + name);
}
- // lookup the template from the proper theme
- ThemeManager themeMgr = WebloggerFactory.getWeblogger()
- .getThemeManager();
- Theme theme = themeMgr.getTheme(split[0]);
- ThemeTemplate template = theme.getTemplateByName(split[1]);
-
- if (template == null) {
- throw new ResourceNotFoundException("Template [" + split[1]
- + "] doesn't seem to be part of theme [" + split[0]
- + "]");
+ // lookup the template from the proper theme
+ ThemeManager themeMgr = WebloggerFactory.getWeblogger()
+ .getThemeManager();
+ Theme theme = themeMgr.getTheme(split[0]);
+ ThemeTemplate template = theme.getTemplateByName(split[1]);
+
+ 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(contents.getBytes("UTF-8"));
-
- } catch (UnsupportedEncodingException uex) {
- // We expect UTF-8 in all JRE installation.
- // This rethrows as a Runtime exception after logging.
- logger.error(uex);
- throw new RuntimeException(uex);
-
- } catch (ThemeNotFoundException tnfe) {
- String msg = "ThemeResourceLoader Error: " + tnfe.getMessage();
- logger.error(msg, tnfe);
- throw new ResourceNotFoundException(msg);
-
- } catch (WebloggerException re) {
- String msg = "RollerResourceLoader Error: " + re.getMessage();
- logger.error(msg, re);
- throw new ResourceNotFoundException(msg);
- }
- }
-
- /**
- * Files loaded by this resource loader are not reloadable here, as they are
- * stored in shared themes and there is no way velocity can trigger a
- * reload.
- *
- * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#isSourceModified(org.apache.velocity.runtime.resource.Resource)
- */
- public boolean isSourceModified(Resource resource) {
- return false;
- }
-
- /**
- * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource)
- */
- public long getLastModified(Resource resource) {
- return 0;
- }
+ final String contents;
+ if (template.getTemplateCode(deviceType) != null) {
+ contents = template.getTemplateCode(deviceType).getTemplate();
+ } else {
+ contents = template.getContents();
+ }
+
+ if (log.isDebugEnabled())
+ logger.debug("Resource found!");
+
+ // return the input stream
+ return new ByteArrayInputStream(contents.getBytes("UTF-8"));
+
+ } catch (UnsupportedEncodingException uex) {
+ // We expect UTF-8 in all JRE installation.
+ // This rethrows as a Runtime exception after logging.
+ logger.error(uex);
+ throw new RuntimeException(uex);
+
+ } catch (ThemeNotFoundException tnfe) {
+ String msg = "ThemeResourceLoader Error: " + tnfe.getMessage();
+ logger.error(msg, tnfe);
+ throw new ResourceNotFoundException(msg);
+
+ } catch (WebloggerException re) {
+ String msg = "RollerResourceLoader Error: " + re.getMessage();
+ logger.error(msg, re);
+ throw new ResourceNotFoundException(msg);
+ }
+ }
+
+ /**
+ * Files loaded by this resource loader are not reloadable here, as they are
+ * stored in shared themes and there is no way velocity can trigger a
+ * reload.
+ *
+ * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#isSourceModified(org.apache.velocity.runtime.resource.Resource)
+ */
+ public boolean isSourceModified(Resource resource) {
+ return false;
+ }
+
+ /**
+ * @see org.apache.velocity.runtime.resource.loader.ResourceLoader#getLastModified(org.apache.velocity.runtime.resource.Resource)
+ */
+ public long getLastModified(Resource resource) {
+ return 0;
+ }
}
Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/VelocityRenderer.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/VelocityRenderer.java?rev=1531282&r1=1531281&r2=1531282&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/VelocityRenderer.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/velocity/VelocityRenderer.java Fri Oct 11 13:06:33 2013
@@ -35,6 +35,7 @@ import org.apache.velocity.context.Conte
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
+import org.apache.velocity.exception.VelocityException;
/**
* Renderer that renders using the Velocity template engine.
@@ -106,6 +107,16 @@ public class VelocityRenderer implements
velocityTemplate = RollerVelocity.getTemplate("error-page.vm",
deviceType);
+ } catch (VelocityException ex) {
+
+ // in the case of a parsing error including a macro we want to
+ // render an error page instead so the user knows what was wrong
+ velocityException = ex;
+
+ // need to lookup error page template
+ velocityTemplate = RollerVelocity.getTemplate("error-page.vm",
+ deviceType);
+
} catch (Exception ex) {
// some kind of generic/unknown exception, dump it to the logs
log.error(
@@ -195,6 +206,18 @@ public class VelocityRenderer implements
// and we're done
return;
+ } catch (VelocityException ex) {
+
+ // in the case of a parsing error including a macro we want to
+ // render an error page instead so the user knows what was wrong
+ velocityException = ex;
+
+ // need to lookup parse error template
+ renderException(model, out, "error-parse.vm");
+
+ // and we're done
+ return;
+
} catch (Exception ex) {
// wrap and rethrow so caller can deal with it
throw new RenderingException("Error during rendering", ex);
Modified: roller/trunk/app/src/main/resources/ApplicationResources.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/ApplicationResources.properties?rev=1531282&r1=1531281&r2=1531282&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/ApplicationResources.properties (original)
+++ roller/trunk/app/src/main/resources/ApplicationResources.properties Fri Oct 11 13:06:33 2013
@@ -573,7 +573,7 @@ does not permit sending tracbacks to the
error.title.403=Access Denied
error.text.403=You do not have the privileges necessary to access the requested page.
-error.title.404=Sorry! We couldn''t find your document
+error.title.404=Sorry! We couldn't find your document
error.text.404=The file that you requested could not be found on this server.
error.permissions.deniedSave=Access Denied (you logged in as a different user?)
@@ -927,6 +927,7 @@ macro.weblog.allcategories=All
macro.weblog.nolanguages=This site does not support multiple languages.
macro.weblog.notifyMeOfComments=Notify me by email of new comments
macro.weblog.noEntriesForDate=No entries found for specified date
+macro.weblog.noEntriesForCategory=No entries found for specified category
# -------------------------------------------------------------------- Main page
Modified: roller/trunk/app/src/main/webapp/WEB-INF/velocity/templates/error-parse.vm
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/WEB-INF/velocity/templates/error-parse.vm?rev=1531282&r1=1531281&r2=1531282&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/WEB-INF/velocity/templates/error-parse.vm (original)
+++ roller/trunk/app/src/main/webapp/WEB-INF/velocity/templates/error-parse.vm Fri Oct 11 13:06:33 2013
@@ -18,28 +18,47 @@
#*
Velocity #parse error include page
*#
+<style>
+ span.error {
+ display: block;
+ background-color: #fcc;
+ color: #c00;
+ border: 1px solid red;
+ margin: 5px 10px 5px 10px;
+ padding: 10px;
+ font-weight: bold;
+ }
+ span.error ul {
+ list-style-type: none;
+ margin-top: 0px;
+ margin-left: 0;
+ margin-bottom: 0;
+ padding: 3px;
+ }
+ .dottedtable {border: 1px dotted #CCCCCC;}
+</style>
<span class="error">
<ul>
<li>Velocity template error</li>
</ul>
</span>
<div style="padding: 15px 25px 25px 25px">
- <table width="80%" border="1px" style="border-collapse: collapse; border: 1px dotted #CCCCCC">
+ <table width="80%" border="1px" class="dottedtable" style="border-collapse: collapse;">
<tr>
- <td style="border: 1px dotted #CCCCCC" width="20%">Exception</td>
- <td style="border: 1px dotted #CCCCCC">Velocity template error : $exceptionDevice</td>
+ <td class="dottedtable" width="20%">Exception</td>
+ <td class="dottedtable">Velocity template error : $exceptionDevice</td>
</tr>
<tr>
- <td style="border: 1px dotted #CCCCCC" width="20%">Message</td>
- <td style="border: 1px dotted #CCCCCC">$utils.autoformat($utils.escapeHTML($exception.getMessage()))</td>
+ <td class="dottedtable" width="20%">Message</td>
+ <td class="dottedtable">$utils.autoformat($utils.escapeHTML($exception.getMessage()))</td>
</tr>
<tr>
- <td style="border: 1px dotted #CCCCCC"" width="20%">Type</td>
- <td style="border: 1px dotted #CCCCCC">$exceptionSource</td>
+ <td class="dottedtable" width="20%">Type</td>
+ <td class="dottedtable">$exceptionSource</td>
</tr>
<tr>
- <td style="border: 1px dotted #CCCCCC" width="20%">Exception</td>
- <td style="border: 1px dotted #CCCCCC">$!exception.getClass().getName()</td>
+ <td class="dottedtable" width="20%">Exception</td>
+ <td class="dottedtable">$!exception.getClass().getName()</td>
</tr>
</table>
</div>
Modified: roller/trunk/app/src/main/webapp/WEB-INF/velocity/weblog.vm
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/WEB-INF/velocity/weblog.vm?rev=1531282&r1=1531281&r2=1531282&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/WEB-INF/velocity/weblog.vm (original)
+++ roller/trunk/app/src/main/webapp/WEB-INF/velocity/weblog.vm Fri Oct 11 13:06:33 2013
@@ -29,6 +29,7 @@ These are the documented macros in order
#showMobileNextPrevEntriesControl($pager)
#showWeblogEntryComments($entry)
+ #showMobileWeblogEntryComments($entry)
#showWeblogEntryCommentForm($entry)
#showWeblogEntryLinksList($entries)
@@ -65,8 +66,9 @@ Parse and include page template from web
#macro(includeTemplate $weblog $pageName)
#set($pageArg = false)## This is required for such constructs; see Velocity docs and ROL-689
#set($pageArg = $weblog.getPageByName($pageName))
- #if ($pageArg)
- #parse($pageArg.id "|" $model.deviceType)
+ #if ($pageArg)
+ #set($pageId = $pageArg.id+'|'+$model.deviceType)
+ #parse($pageId)
#end
#end
@@ -143,8 +145,9 @@ Shows weblog entries pager via default d
#set($dayPage = $model.weblog.getPageByName("_day"))
#set($map = $pager.getEntries())
#foreach($day in $map.keySet())
- #set($entries = $map.get($day))
- #parse($dayPage.id "|" $model.deviceType)
+ #set($entries = $map.get($day))
+ #set($pageId = $dayPage.id+'|'+$model.deviceType)
+ #parse($pageId)
#end
#end
@@ -205,8 +208,8 @@ Shows weblog entries pager via default d
</a>
</li>
#end
- ## We do not want the home link on the first page >> || $nextLink
- #if ($prevLink)
+ ## If we do not want the home link on the first page remove >> || $nextLink
+ #if ($prevLink || $nextLink)
<li>
<a href="$pager.getHomeLink()" data-transition="fade" data-theme="c" data-icon="home">
$pager.getHomeName()
@@ -274,6 +277,52 @@ Show comments for weblog entry according
#end
</div>
#end
+## Mobile Version
+#macro(showMobileWeblogEntryComments $entry)
+ <!-- showMobileWeblogEntryComments -->
+ #if($model.commentForm.preview)
+ #set($comments = [$model.commentForm.previewComment])
+ #set( $heading = $text.get( "macro.weblog.preview" ))
+ #else
+ #set($comments = $entry.getComments(true, true))
+ #set( $heading = $text.get( "macro.weblog.comments" ))
+ #end
+ #if($comments.size() > 0)
+ <ul data-role="listview" data-divider-theme="b" data-inset="true">
+ <li data-role="list-divider">
+ $heading
+ </li>
+ #foreach( $comment in $comments )
+ #if($comment.approved || $model.commentForm.preview)
+ ##<li data-role="list-divider" data-theme="c">
+ ## TODO
+ ##<a name="comment-$comment.timestamp" id="comment-$comment.timestamp"></a>
+ ##</li>
+ <li data-theme="c">
+ <p class="ui-li-desc content-textbox">
+ $comment.content
+ </p>
+ <p class="ui-li-desc content-textbox">
+ $text.get("macro.weblog.postedby")
+ #if (!$utils.isEmpty($comment.name) && !$utils.isEmpty($comment.url))
+ <a rel="nofollow" href="$comment.url"><b>$comment.name</b></a>
+ #elseif (!$utils.isEmpty($comment.name))
+ <b>$comment.name</b>
+ #elseif ($comment.remoteHost)
+ <b>$comment.remoteHost</b>
+ #else
+ <b>$text.get("macro.weblog.comment.unknown")</b>
+ #end
+
+ $text.get("macro.weblog.on") $utils.formatDate($comment.postTime, $text.get( "macro.weblog.datepattern" ))
+ ##<a href="$url.comment($entry.anchor, $comment.timestamp)" title="$text.get( "macro.weblog.commentpermalink.title" )" data-role="button" data-inline="true" data-mini="true">#</a>
+ </p>
+ </li>
+ #end
+ #end
+ </ul>
+ #end
+#end
#**
@@ -294,8 +343,7 @@ Show comments form for weblog entry.
<span class="status">$cform.message</span>
#end
- <form method="post" action="$url.entry($entry.anchor)" focus="name"
- name="commentForm" onsubmit="fixURL(this); return validateComments(this)">
+ <form method="post" action="$url.entry($entry.anchor)" focus="name" name="commentForm" onsubmit="fixURL(this); return validateComments(this)">
<input type="hidden" name="method" value="post" />
<ul>
@@ -312,20 +360,18 @@ Show comments form for weblog entry.
<input type="text" name="url" class="text large" value="$cform.url" size="50" maxlength="255" />
</li>
- #if ($config.commentEmailNotify)
- <li><input type="checkbox" class="checkbox" id="notify" name="notify" #if($cform.notify)CHECKED #end/>
- <label for="notify" class="choice">$text.get( "macro.weblog.notifyMeOfComments" )</label>
- </li>
- #end
+ #if ($config.commentEmailNotify)
+ <li><input type="checkbox" class="checkbox" id="notify" name="notify" #if($cform.notify)CHECKED #end/>
+ <label for="notify" class="choice">$text.get( "macro.weblog.notifyMeOfComments" )</label>
+ </li>
+ #end
<li>
<input type="checkbox" class="checkbox" id="rememberInfo" name="rememberInfo" />
<label for="rememberInfo" class="choice">$text.get( "macro.weblog.rememberinfo" )</label>
</li>
<li>
<label class="desc">$text.get( "macro.weblog.yourcomment" )</label>
-
- <textarea name="content" class="textarea large" cols="40" rows="10">$cform.content</textarea>
-
+ <textarea name="content" class="textarea large" cols="40" rows="10">$cform.content</textarea>
</li>
<li class="info">
<span class="comments-syntax-indicator">
@@ -402,7 +448,6 @@ Show comments form for weblog entry.
#else
<span class="status">$text.get( "comments.disabled" )</span>
#end
-
</div>
#end
@@ -519,7 +564,7 @@ Show weblog's categories in specified pa
#end
## Mobile version
#macro(showMobileCategoryLinksList $categoryObject)
- <a href="#categories" data-rel="popup" data-role="button">Categories</a>
+ <!-- showMobileCategoryLinksList -->
<div data-role="popup" id="categories" data-theme="none">
<div data-role="collapsible-set" data-theme="b" data-content-theme="c" data-collapsed-icon="arrow-r" data-expanded-icon="arrow-d" style="margin:0; width:250px;">
<div data-role="collapsible" data-collapsed="false" data-inset="false">
@@ -530,10 +575,12 @@ Show weblog's categories in specified pa
#else
<li class="ui-btn-active"><a href="$url.category($categoryObject.path)" data-transition="fade">$text.get("macro.weblog.allcategories")</a></li>
#end
+ #set($active = $text.get("macro.weblog.allcategories"))
#set($cats = $categoryObject.getWeblogCategories())
#foreach($cat in $cats)
#if ($model.weblogCategory && $model.weblogCategory.path == $cat.path || ($model.permalink && $model.weblogEntry.category.path == $cat.path))
<li class="ui-btn-active"><a href="$url.category($cat.path)" data-transition="fade">$cat.name</a></li>
+ #set($active = $cat.name)
#else
<li><a href="$url.category($cat.path)" data-transition="fade">$cat.name</a></li>
#end
@@ -542,6 +589,7 @@ Show weblog's categories in specified pa
</div>
</div>
</div>
+ <a href="#categories" data-rel="popup" data-role="button">Categories - $active</a>
#end
#**
@@ -954,8 +1002,8 @@ Show next/prev pager for search results.
</a>
</li>
#end
- ## We do not want the home link on the first page >> || $nextLink
- #if ($prevLink)
+ ## If we do not want the home link on the first page remove >> || $nextLink
+ #if ($prevLink || $nextLink)
<li>
<a href="$pager.getHomeLink()" data-transition="fade" data-theme="c" data-icon="home">
$pager.getHomeName()
Modified: roller/trunk/app/src/main/webapp/themes/basic/_day-mobile.vm
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/themes/basic/_day-mobile.vm?rev=1531282&r1=1531281&r2=1531282&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/themes/basic/_day-mobile.vm (original)
+++ roller/trunk/app/src/main/webapp/themes/basic/_day-mobile.vm Fri Oct 11 13:06:33 2013
@@ -1,4 +1,36 @@
-#foreach( $entry in $entries )
-<ul data-role="listview" data-inset="true" data-dividertheme="b">
- <li><a href=$entry.permalink>$entry.title</a></li>
-#end
+<!-- _day-mobile -->
+<ul data-role="listview" data-divider-theme="b" data-inset="true">
+ <li data-role="list-divider">$utils.formatDate($day, "EEEE MMM dd, yyyy")</li>
+ ## Loop entries
+ #foreach( $entry in $entries )
+ <li data-role="list-divider" data-theme="c">
+ #if($utils.isEmpty($entry.text))
+ $entry.transformedText
+ #else
+ $entry.transformedSummary
+ #end
+ #if ($utils.isUserAuthorizedToAuthor($entry.website))
+ <a href="$url.editEntry($entry.anchor)" data-role="button" data-inline="true" data-mini="true">$text.get("macro.weblog.entrypermalink.edit")</a>
+ #end
+ #set($commentCount = $entry.commentCount)
+ #if($entry.commentsStillAllowed || $commentCount > 0)
+ #set($link = "$url.comments($entry.anchor)" )
+ <a href="$link" class="commentsLink"data-role="button" data-inline="true" data-mini="true">$text.get("macro.weblog.comments") [$commentCount]</a>
+ #end
+ </li>
+ <li data-theme="c">
+ <a href="$entry.permalink" data-transition="slide">
+ <h3>$entry.title</h3>
+ #if($model.permalink)
+ <p class="ui-li-desc content-textbox">
+ $entry.displayContent
+ </p>
+ #end
+ <p class="ui-li-desc content-textbox">
+ Posted at $utils.formatDate($entry.pubTime, "hh:mma MMM dd, yyyy")
+ by $entry.creator.screenName in <span class="category">$entry.category.name</span>
+ </p>
+ </a>
+ </li>
+ #end ## End for #foreach
+</ul>
Added: roller/trunk/app/src/main/webapp/themes/basic/basic-mobile-custom.css
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/themes/basic/basic-mobile-custom.css?rev=1531282&view=auto
==============================================================================
--- roller/trunk/app/src/main/webapp/themes/basic/basic-mobile-custom.css (added)
+++ roller/trunk/app/src/main/webapp/themes/basic/basic-mobile-custom.css Fri Oct 11 13:06:33 2013
@@ -0,0 +1,100 @@
+/*-------------------------------------------------------------
+Base styles
+--------------------------------------------------------------*/
+
+a {
+ text-decoration: none;
+}
+
+body {
+ background: white;
+ font-family:"Lucida Grande", lucida, Geneva, Arial, sans-serif;
+}
+
+.img {
+ border: 0px;
+ margin: 0px;
+}
+
+div.next-previous {
+ font-size: 80%;
+ text-align: center;
+ padding: .5em 0 .5em 0;
+}
+
+/* category chooser ----------------------------------------------- */
+
+.category-chooser {
+ margin: -50%;
+ width:100%;
+}
+.rCategory li {
+ font-size: 80%;
+ display: inline;
+ list-style-type: none;
+ padding-right: 20px;
+}
+li.selected {
+ font-weight: bold;
+}
+
+/* other lists ----------------------------------------------- */
+
+/* #* wrap text *# */
+.ui-page .ui-content .ui-listview .ui-li-desc, .box .ui-li-desc, .ui-popup .ui-title {
+ white-space: normal;
+ font-size: 16px;
+ margin: 0.5em 0 0.5em 0;
+}
+
+
+/* comments ----------------------------------------------- */
+
+div.comments-form span.status {
+ display: block;
+ background: white;
+ color: green;
+ border: 1px solid green;
+ margin: 10px 0px;
+ padding: 10px;
+ font-size: 18px;
+ font-weight: bold;
+}
+
+span.error {
+ display: block;
+ background: white;
+ color: #c00;
+ border: 1px solid #c00;
+ margin: 10px 0px;
+ padding: 10px;
+ font-size: 18px;
+ font-weight: bold;
+}
+
+form ul{ position: relative; list-style: none; }
+form li{ line-height: 2em; margin: 0; padding: 1px 1px 6px 9px; }
+
+/*-------------------------------------------------------------
+Basic theme styles
+--------------------------------------------------------------*/
+
+.mobile{
+ width:250px;
+ height: 51px;
+ background: url($url.resource("images/forward_mobile.png")) top left no-repeat;
+ padding-top:17px;
+ padding-left:60px;
+}
+
+.content-textbox {
+ background: none repeat scroll 0 0 #F9F9F9;
+ box-shadow: 0 0 3px #CCCCCC;
+ line-height: 1.2em;
+ margin-bottom: 15px;
+ margin-top: 10px;
+ padding: 8px;
+}
+.content-textbox p {
+ margin: 0 0 8px;
+}
\ No newline at end of file
Modified: roller/trunk/app/src/main/webapp/themes/basic/permalink-mobile.vm
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/themes/basic/permalink-mobile.vm?rev=1531282&r1=1531281&r2=1531282&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/themes/basic/permalink-mobile.vm (original)
+++ roller/trunk/app/src/main/webapp/themes/basic/permalink-mobile.vm Fri Oct 11 13:06:33 2013
@@ -1,10 +1,12 @@
<!DOCTYPE html>
<html>
<head>
+ <meta charset="UTF-8">
<title>$model.weblogEntry.title : $model.weblog.name</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
+ <link rel="stylesheet" type="text/css" href="$model.weblog.stylesheet">
+ <link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
@@ -17,6 +19,7 @@
<script type="text/javascript" src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>
+<!-- permalink-mobile -->
<body>
<div data-role="page" data-theme="b">
@@ -24,7 +27,7 @@
<div data-role="header" data-theme="b">
<h1>$model.weblogEntry.title : $model.weblog.name</h1>
##<a data-rel="back" data-icon="back" data-theme="a">Go back</a>
- <a href=$url.home data-icon="home" data-theme = "a">Home</a>
+ <a href=$url.home data-icon="home" data-theme = "a">Weblog</a>
</div>
<div data-role="content" data-theme="c">
@@ -41,11 +44,21 @@
## show entry
#showWeblogEntriesPager($pager)
- ## show comments and comment form
- ## TODO
- #showWeblogEntryComments($model.weblogEntry)
- ## TODO
- ##showWeblogEntryCommentForm($model.weblogEntry)
+ ## show comments
+ #showMobileWeblogEntryComments($model.weblogEntry)
+
+ ## show comment form
+
+ <ul data-role="listview" data-divider-theme="b" data-inset="true">
+ <li data-role="list-divider">
+ Comment
+ </li>
+ ##<li data-role="list-divider" data-theme="c">
+ ##</li>
+ <li data-theme="c">
+ #showWeblogEntryCommentForm($model.weblogEntry)
+ </li>
+ <ul>
</div>
Modified: roller/trunk/app/src/main/webapp/themes/basic/searchresults-mobile.vm
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/themes/basic/searchresults-mobile.vm?rev=1531282&r1=1531281&r2=1531282&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/themes/basic/searchresults-mobile.vm (original)
+++ roller/trunk/app/src/main/webapp/themes/basic/searchresults-mobile.vm Fri Oct 11 13:06:33 2013
@@ -1,10 +1,12 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta charset="UTF-8">
<title>Search Results for '$model.term' : $model.weblog.name</title>
- #showAutodiscoveryLinks($model.weblog)
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+
+ <link rel="stylesheet" type="text/css" href="$model.weblog.stylesheet">
+ <link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
@@ -17,6 +19,7 @@
<script type="text/javascript" src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>
+<!-- searchresults-mobile -->
<body>
<div data-role="page">
@@ -25,23 +28,26 @@
##<a data-rel="back" data-icon="back" data-theme = "a">back</a>
<a href=$url.home data-icon="home" data-theme = "a">Home</a>
</div>
- <br>
-
- #set($rootCategory = $model.weblog.getWeblogCategory("nil"))
- #showMobileCategoryLinksList($rootCategory)
-
- <h3>Search Results for '$model.term'</h3>
-
- ## show next/previous paging controls
- #set($pager = $model.getWeblogEntriesPager())
- <div class="next-previous">
- #showMobileSearchAgainForm($model.weblog)
- #showMobileNextPrevSearchControl($pager)
+
+ <div data-role="content" data-theme="d">
+
+ #set($rootCategory = $model.weblog.getWeblogCategory("nil"))
+ #showMobileCategoryLinksList($rootCategory)
+
+ <h3>Search Results for '$model.term'</h3>
+
+ ## show next/previous paging controls
+ #set($pager = $model.getWeblogEntriesPager())
+ <div class="next-previous">
+ #showMobileSearchAgainForm($model.weblog)
+ #showMobileNextPrevSearchControl($pager)
+ </div>
+
+ ## show entries
+ #showWeblogEntriesPager($pager)
+
</div>
-
- ## show entries
- #showWeblogEntriesPager($pager)
-
+
</div>
<div data-role="footer" data-theme="b">
Modified: roller/trunk/app/src/main/webapp/themes/basic/theme.xml
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/themes/basic/theme.xml?rev=1531282&r1=1531281&r2=1531282&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/themes/basic/theme.xml (original)
+++ roller/trunk/app/src/main/webapp/themes/basic/theme.xml Fri Oct 11 13:06:33 2013
@@ -20,6 +20,12 @@
<contentsFile>basic-custom.css</contentsFile>
<type>standard</type>
</templateCode>
+ <templateCode>
+ <templateLanguage>velocity</templateLanguage>
+ <contentType>text/html</contentType>
+ <contentsFile>basic-mobile-custom.css</contentsFile>
+ <type>mobile</type>
+ </templateCode>
</stylesheet>
<!-- templates -->
Modified: roller/trunk/app/src/main/webapp/themes/basic/weblog-mobile.vm
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/themes/basic/weblog-mobile.vm?rev=1531282&r1=1531281&r2=1531282&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/themes/basic/weblog-mobile.vm (original)
+++ roller/trunk/app/src/main/webapp/themes/basic/weblog-mobile.vm Fri Oct 11 13:06:33 2013
@@ -1,11 +1,14 @@
<!DOCTYPE html>
<html>
<head>
+ <meta charset="UTF-8">
<title>$model.weblog.name</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
+
+ <link rel="stylesheet" type="text/css" href="$model.weblog.stylesheet">
+ <link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
-
+
<script type="text/javascript">
$(document).bind("mobileinit", function(){
@@ -16,6 +19,7 @@
<script type="text/javascript" src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
</head>
+<!-- weblog-mobile -->
<body>
<script type="text/javascript">
@@ -41,7 +45,7 @@
<div data-role="page" id ="home">
<div data-role="header" data-theme="b">
- <h1>$model.weblog.name </h1>
+ <h1>$model.weblog.name</h1>
<a href=$url.absoluteSite data-icon="home" data-theme="a">Home</a>
<a href="#home" id="btnStandard" data-role="button">View Standard</a>
</div>
@@ -61,7 +65,19 @@
</div>
## Show entries
- #showWeblogEntriesPager($pager)
+ #if($pager.entries.size() > 0)
+ #showWeblogEntriesPager($pager)
+ #else
+ ## No entries.
+ <ul data-role="listview" data-divider-theme="b" data-inset="true">
+ <li data-role="list-divider">$utils.formatDate($utils.now, "EEEE MMM dd, yyyy")</li>
+ <li data-theme="c">
+ <span class="ui-li-desc content-textbox">
+ <h3>$text.get("macro.weblog.noEntriesForCategory")</h3>
+ </span>
+ </li>
+ </ul>
+ #end
</div>