roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agillil...@apache.org
Subject svn commit: r545682 - in /roller/trunk/apps/weblogger: src/java/org/apache/roller/weblogger/business/themes/ src/java/org/apache/roller/weblogger/pojos/ src/java/org/apache/roller/weblogger/pojos/wrapper/ src/java/org/apache/roller/weblogger/ui/struts2...
Date Sat, 09 Jun 2007 02:11:25 GMT
Author: agilliland
Date: Fri Jun  8 19:11:23 2007
New Revision: 545682

URL: http://svn.apache.org/viewvc?view=rev&rev=545682
Log:
refining theme stylesheet integration.

1. stylesheets are now a first class citizen of themes such that all themes provide a getStylesheet() method which returns the stylesheet for the theme if it is available.

2. stylesheets are treated a little better in our theme.xml descriptor files.  stylesheets are no longer just a simple path but are actually a template with a little special consideration.

3. there is no longer a need for different theme stylesheet and a stylesheet override, they are now just the same thing which makes things easier on users and theme developers.

4. the stylesheet editor in the UI can now start by copying the stylesheet from the theme, giving users a starting point for their css edits and eliminating the need for css styling overrides which is more confusing and error prone due to the way css inheritance works.

5. eliminated the old weblog.getPageByXXX() methods since those have been replaced with the getTheme().getTemplateByXXX() methods.

6. updated built-in themes to take advantage of these changes which simplifies the theme styling, eliminates the old _css template, and makes css customization easier.


Added:
    roller/trunk/apps/weblogger/web/themes/basic/basic-custom.css
      - copied unchanged from r545559, roller/trunk/apps/weblogger/web/themes/basic/_css.vm
    roller/trunk/apps/weblogger/web/themes/brushedmetal/brushedmetal-custom.css
      - copied unchanged from r545559, roller/trunk/apps/weblogger/web/themes/brushedmetal/_css.vm
    roller/trunk/apps/weblogger/web/themes/sotto/sotto-custom.css
      - copied, changed from r545559, roller/trunk/apps/weblogger/web/themes/sotto/_css.vm
Removed:
    roller/trunk/apps/weblogger/web/themes/basic/_css.vm
    roller/trunk/apps/weblogger/web/themes/brushedmetal/_css.vm
    roller/trunk/apps/weblogger/web/themes/sotto/_css.vm
    roller/trunk/apps/weblogger/web/themes/sotto/styles/
    roller/trunk/apps/weblogger/web/themes/sotto/theme.css
Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/SharedTheme.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeManagerImpl.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeMetadata.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeMetadataParser.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/WeblogCustomTheme.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/WeblogSharedTheme.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Theme.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.orm.xml
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogWrapper.java
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/StylesheetEdit.java
    roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties
    roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml
    roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/StylesheetEdit.jsp
    roller/trunk/apps/weblogger/web/themes/basic/Weblog.vm
    roller/trunk/apps/weblogger/web/themes/basic/theme.xml
    roller/trunk/apps/weblogger/web/themes/brushedmetal/Weblog.vm
    roller/trunk/apps/weblogger/web/themes/brushedmetal/theme.xml
    roller/trunk/apps/weblogger/web/themes/sotto/Weblog.vm
    roller/trunk/apps/weblogger/web/themes/sotto/theme.xml

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/SharedTheme.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/SharedTheme.java?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/SharedTheme.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/SharedTheme.java Fri Jun  8 19:11:23 2007
@@ -42,7 +42,6 @@
     protected String name = null;
     protected String description = null;
     protected String author = null;
-    protected String customStylesheet = null;
     protected Date lastModified = null;
     protected boolean enabled = false;
     
@@ -90,14 +89,6 @@
 
     public void setAuthor(String author) {
         this.author = author;
-    }
-
-    public String getCustomStylesheet() {
-        return customStylesheet;
-    }
-
-    public void setCustomStylesheet(String customStylesheet) {
-        this.customStylesheet = customStylesheet;
     }
     
     public Date getLastModified() {

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/SharedThemeFromDir.java Fri Jun  8 19:11:23 2007
@@ -31,9 +31,9 @@
 import java.util.Map;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.weblogger.pojos.Theme;
 import org.apache.roller.weblogger.pojos.ThemeResource;
 import org.apache.roller.weblogger.pojos.ThemeTemplate;
+import org.apache.roller.weblogger.pojos.WeblogTemplate;
 
 
 /**
@@ -51,6 +51,9 @@
     // 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();
@@ -94,6 +97,19 @@
     }
     
     
+    /**
+     * 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.
+     */
     public ThemeTemplate getDefaultTemplate() {
         return (ThemeTemplate) this.templatesByAction.get(ThemeTemplate.ACTION_WEBLOG);
     }
@@ -127,16 +143,6 @@
     
     
     /**
-     * Set the value for a given template name.
-     */
-    public void addTemplate(ThemeTemplate template) {
-        this.templatesByName.put(template.getName(), template);
-        this.templatesByLink.put(template.getLink(), template);
-        this.templatesByAction.put(template.getAction(), template);
-    }
-    
-    
-    /**
      * Get the collection of all resources associated with this Theme.
      *
      * It is assured that the resources are returned sorted by pathname.
@@ -160,14 +166,6 @@
     }
     
     
-    /**
-     * Set the value for a given resource path.
-     */
-    public void setResource(String path, SharedThemeResourceFromDir resource) {
-        this.resources.put(path, resource);
-    }
-    
-    
     public String toString() {
         StringBuffer sb = new StringBuffer();
         sb.append(name);
@@ -208,7 +206,6 @@
         setName(themeMetadata.getName());
         setDescription(themeMetadata.getName());
         setAuthor(themeMetadata.getAuthor());
-        setCustomStylesheet(themeMetadata.getCustomStylesheet());
         setLastModified(new Date());
         setEnabled(true);
         
@@ -220,6 +217,47 @@
             this.previewImage = new SharedThemeResourceFromDir(themeMetadata.getPreviewImage(), previewFile);
         }
         
+        // load stylesheet if possible
+        if(themeMetadata.getStylesheet() != null) {
+            
+            ThemeMetadataTemplate stylesheetTmpl = themeMetadata.getStylesheet();
+            
+            // construct File object from path
+            File templateFile = new File(this.themeDir + File.separator + 
+                    stylesheetTmpl.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 template file ["+templateFile+"]");
+            } else {
+                
+                // construct ThemeTemplate representing this file
+                // a few restrictions for now:
+                //   - decorator is always "_decorator" or null
+                SharedThemeTemplate theme_template = new SharedThemeTemplate(
+                        this,
+                        themeMetadata.getId()+":"+stylesheetTmpl.getName(),
+                        WeblogTemplate.ACTION_CUSTOM,
+                        stylesheetTmpl.getName(),
+                        stylesheetTmpl.getDescription(),
+                        contents,
+                        stylesheetTmpl.getLink(),
+                        new Date(templateFile.lastModified()),
+                        stylesheetTmpl.getTemplateLanguage(),
+                        false,
+                        false,
+                        null);
+                
+                // store it
+                this.stylesheet = theme_template;
+                
+                // add it to templates list
+                addTemplate(theme_template);
+            }
+        }
+        
         // go through static resources and add them to the theme
         String resourcePath = null;
         Iterator resourcesIter = themeMetadata.getResources().iterator();
@@ -250,23 +288,10 @@
             File templateFile = new File(this.themeDir + File.separator + 
                     templateMetadata.getContentsFile());
             
-            // Continue reading theme even if problem encountered with one file
-            if(!templateFile.exists() && !templateFile.canRead()) {
-                log.error("Couldn't read theme template file ["+templateFile+"]");
-                continue;
-            }
-            
-            char[] chars = null;
-            int length;
-            try {
-                chars = new char[(int) templateFile.length()];
-            	FileInputStream stream = new FileInputStream(templateFile);
-            	InputStreamReader reader = new InputStreamReader(stream, "UTF-8");
-                length = reader.read(chars);            
-            } catch (Exception noprob) {
-                log.error("Exception reading template file ["+templateFile+"]");
-                if (log.isDebugEnabled()) 
-                    log.debug(noprob);
+            String contents = loadTemplateFile(templateFile);
+            if(contents == null) {
+                // if we don't have any contents then skip this one
+                log.error("Couldn't load theme template file ["+templateFile+"]");
                 continue;
             }
             
@@ -284,7 +309,7 @@
                     templateMetadata.getAction(),
                     templateMetadata.getName(),
                     templateMetadata.getDescription(),
-                    new String(chars, 0, length),
+                    contents,
                     templateMetadata.getLink(),
                     new Date(templateFile.lastModified()),
                     templateMetadata.getTemplateLanguage(),
@@ -295,6 +320,53 @@
             // 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()) {
+            return null;
+        }
+        
+        char[] chars = null;
+        int length;
+        try {
+            chars = new char[(int) templateFile.length()];
+            FileInputStream stream = new FileInputStream(templateFile);
+            InputStreamReader reader = new InputStreamReader(stream, "UTF-8");
+            length = reader.read(chars);
+        } catch (Exception noprob) {
+            log.error("Exception reading 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())) {
+            this.templatesByAction.put(template.getAction(), template);
+        }
+    }
+    
+    
+    /**
+     * Set the value for a given resource path.
+     */
+    private void setResource(String path, SharedThemeResourceFromDir resource) {
+        this.resources.put(path, resource);
     }
     
 }

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeManagerImpl.java?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeManagerImpl.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeManagerImpl.java Fri Jun  8 19:11:23 2007
@@ -172,6 +172,7 @@
             
             Set importedActionTemplates = new HashSet();
             ThemeTemplate themeTemplate = null;
+            ThemeTemplate stylesheetTemplate = theme.getStylesheet();
             Iterator iter = theme.getTemplates().iterator();
             while ( iter.hasNext() ) {
                 themeTemplate = (ThemeTemplate) iter.next();
@@ -192,9 +193,11 @@
                 }
                 
                 // Weblog does not have this template, so create it.
+                boolean newTmpl = false;
                 if (template == null) {
                     template = new WeblogTemplate();
                     template.setWebsite(website);
+                    newTmpl = true;
                 }
 
                 // TODO: fix conflict situation
@@ -202,19 +205,22 @@
                 // matches 2 existing templates, 1 by action, the other by name
                 
                 // update template attributes
-                template.setAction(themeTemplate.getAction());
-                template.setName(themeTemplate.getName());
-                template.setDescription(themeTemplate.getDescription());
-                template.setLink(themeTemplate.getLink());
-                template.setContents(themeTemplate.getContents());
-                template.setHidden(themeTemplate.isHidden());
-                template.setNavbar(themeTemplate.isNavbar());
-                template.setTemplateLanguage(themeTemplate.getTemplateLanguage());
-                template.setDecoratorName(themeTemplate.getDecoratorName());
-                template.setLastModified(new Date());
-                
-                // save it
-                userMgr.savePage( template );
+                // NOTE: we don't want to copy the template data for an existing stylesheet
+                if(newTmpl || !themeTemplate.equals(stylesheetTemplate)) {
+                    template.setAction(themeTemplate.getAction());
+                    template.setName(themeTemplate.getName());
+                    template.setDescription(themeTemplate.getDescription());
+                    template.setLink(themeTemplate.getLink());
+                    template.setContents(themeTemplate.getContents());
+                    template.setHidden(themeTemplate.isHidden());
+                    template.setNavbar(themeTemplate.isNavbar());
+                    template.setTemplateLanguage(themeTemplate.getTemplateLanguage());
+                    template.setDecoratorName(themeTemplate.getDecoratorName());
+                    template.setLastModified(new Date());
+                    
+                    // save it
+                    userMgr.savePage( template );
+                }
             }
             
             // now, see if the weblog has left over action templates that
@@ -235,7 +241,9 @@
             
             // always update this weblog's theme and customStylesheet, then save
             website.setEditorTheme(WeblogTheme.CUSTOM);
-            website.setCustomStylesheetPath(theme.getCustomStylesheet());
+            if(theme.getStylesheet() != null) {
+                website.setCustomStylesheetPath(theme.getStylesheet().getLink());
+            }
             userMgr.saveWebsite(website);
             
             

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeMetadata.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeMetadata.java?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeMetadata.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeMetadata.java Fri Jun  8 19:11:23 2007
@@ -31,7 +31,7 @@
     private String name = null;
     private String author = null;
     private String previewImage = null;
-    private String customStylesheet = null;
+    private ThemeMetadataTemplate stylesheet = null;
     private Set templates = new HashSet();
     private Set resources = new HashSet();
     
@@ -96,12 +96,12 @@
         this.author = author;
     }
 
-    public String getCustomStylesheet() {
-        return customStylesheet;
+    public ThemeMetadataTemplate getStylesheet() {
+        return stylesheet;
     }
 
-    public void setCustomStylesheet(String customStylesheet) {
-        this.customStylesheet = customStylesheet;
+    public void setStylesheet(ThemeMetadataTemplate stylesheet) {
+        this.stylesheet = stylesheet;
     }
     
 }

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeMetadataParser.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeMetadataParser.java?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeMetadataParser.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/ThemeMetadataParser.java Fri Jun  8 19:11:23 2007
@@ -72,10 +72,10 @@
             throw new ThemeParsingException("No preview image specified");
         }
         
-        // grab the custom stylesheet path
-        Element customStylesheet = root.getChild("custom-stylesheet");
-        if(customStylesheet != null) {
-            theme.setCustomStylesheet(customStylesheet.getAttributeValue("path"));
+        // grab the stylesheet if it exists
+        Element stylesheet = root.getChild("stylesheet");
+        if(stylesheet != null) {
+            theme.setStylesheet(elementToStylesheet(stylesheet));
         }
         
         // now grab the static resources
@@ -142,6 +142,38 @@
         }
         if(StringUtils.isEmpty(template.getTemplateLanguage())) {
             throw new ThemeParsingException("templates must contain a 'templateLanguage' element");
+        }
+        if(StringUtils.isEmpty(template.getContentsFile())) {
+            throw new ThemeParsingException("templates must contain a 'contentsFile' element");
+        }
+        
+        return template;
+    }
+    
+    
+    private ThemeMetadataTemplate elementToStylesheet(Element element) 
+            throws ThemeParsingException {
+        
+        ThemeMetadataTemplate template = new ThemeMetadataTemplate();
+        
+        template.setName(element.getChildText("name"));
+        template.setDescription(element.getChildText("description"));
+        template.setLink(element.getChildText("link"));
+        template.setTemplateLanguage(element.getChildText("templateLanguage"));
+        template.setContentsFile(element.getChildText("contentsFile"));
+        
+        // validate template
+        if(StringUtils.isEmpty(template.getName())) {
+            throw new ThemeParsingException("stylesheet must contain a 'name' element");
+        }
+        if(StringUtils.isEmpty(template.getLink())) {
+            throw new ThemeParsingException("stylesheet must contain a 'link' element");
+        }
+        if(StringUtils.isEmpty(template.getTemplateLanguage())) {
+            throw new ThemeParsingException("stylesheet must contain a 'templateLanguage' element");
+        }
+        if(StringUtils.isEmpty(template.getContentsFile())) {
+            throw new ThemeParsingException("stylesheet must contain a 'contentsFile' element");
         }
         
         return template;

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/WeblogCustomTheme.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/WeblogCustomTheme.java?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/WeblogCustomTheme.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/WeblogCustomTheme.java Fri Jun  8 19:11:23 2007
@@ -58,10 +58,6 @@
     public String getAuthor() {
         return "N/A";
     }
-
-    public String getCustomStylesheet() {
-        return this.weblog.getCustomStylesheetPath();
-    }
     
     public Date getLastModified() {
         return this.weblog.getLastModified();
@@ -81,6 +77,19 @@
     }
     
     
+    /**
+     * Lookup the stylesheet template for this theme.
+     * Returns null if no stylesheet can be found.
+     */
+    public ThemeTemplate getStylesheet() throws WebloggerException {
+        return getTemplateByLink(this.weblog.getCustomStylesheetPath());
+    }
+    
+    
+    /**
+     * Lookup the default template.
+     * Returns null if the template cannot be found.
+     */
     public ThemeTemplate getDefaultTemplate() throws WebloggerException {
         UserManager userMgr = RollerFactory.getRoller().getUserManager();
         return userMgr.getPageByAction(this.weblog, ThemeTemplate.ACTION_WEBLOG);

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/WeblogSharedTheme.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/WeblogSharedTheme.java?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/WeblogSharedTheme.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/business/themes/WeblogSharedTheme.java Fri Jun  8 19:11:23 2007
@@ -65,10 +65,6 @@
     public String getDescription() {
         return this.theme.getDescription();
     }
-
-    public String getCustomStylesheet() {
-        return this.theme.getCustomStylesheet();
-    }
     
     public Date getLastModified() {
         return this.theme.getLastModified();
@@ -122,6 +118,30 @@
     
     
     /**
+     * Lookup the stylesheet template for this theme.
+     * Returns null if no stylesheet can be found.
+     */
+    public ThemeTemplate getStylesheet() throws WebloggerException {
+        // stylesheet is handled differently than other templates because with
+        // the stylesheet we want to return the weblog custom version if it
+        // exists, otherwise we return the shared theme version
+        
+        // load from theme first to see if we even support a stylesheet
+        ThemeTemplate stylesheet = this.theme.getStylesheet();
+        if(stylesheet != null) {
+            // now try getting custom version from weblog
+            UserManager umgr = RollerFactory.getRoller().getUserManager();
+            ThemeTemplate override = umgr.getPageByLink(this.weblog, stylesheet.getLink());
+            if(override != null) {
+                stylesheet = override;
+            }
+        }
+        
+        return stylesheet;
+    }
+    
+    
+    /**
      * Lookup the default template.
      */
     public ThemeTemplate getDefaultTemplate() throws WebloggerException {
@@ -156,6 +176,12 @@
         
         ThemeTemplate template = null;
         
+        // if name refers to the stylesheet then return result of getStylesheet()
+        ThemeTemplate stylesheet = getStylesheet();
+        if(name.equals(stylesheet.getName())) {
+            return stylesheet;
+        }
+        
         // first check if this user has selected a theme
         // if so then return the proper theme template
         template = this.theme.getTemplateByName(name);
@@ -180,6 +206,12 @@
             return null;
         
         ThemeTemplate template = null;
+        
+        // if name refers to the stylesheet then return result of getStylesheet()
+        ThemeTemplate stylesheet = getStylesheet();
+        if(link.equals(stylesheet.getLink())) {
+            return stylesheet;
+        }
         
         // first check if this user has selected a theme
         // if so then return the proper theme template

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Theme.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Theme.java?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Theme.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Theme.java Fri Jun  8 19:11:23 2007
@@ -54,13 +54,6 @@
     
     
     /**
-     * The path within the Theme to a custom stylesheet override, or null if
-     * no stylesheet override is set.
-     */
-    public String getCustomStylesheet();
-    
-    
-    /**
      * Is the Theme enable for use?
      */
     public boolean isEnabled();
@@ -70,6 +63,12 @@
      * Get the list of all templates associated with this Theme.
      */
     public List getTemplates() throws WebloggerException;
+    
+    
+    /**
+     * Lookup the stylesheet template for the Theme.
+     */
+    public ThemeTemplate getStylesheet() throws WebloggerException;
     
     
     /**

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.java?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.java Fri Jun  8 19:11:23 2007
@@ -218,80 +218,6 @@
     
     
     /**
-     * Lookup a Template for this website by action.
-     * 
-     * @roller.wrapPojoMethod type="pojo"
-     */
-    public ThemeTemplate getPageByAction(String action) throws WebloggerException {
-        
-        if(action == null)
-            return null;
-        
-        // look for the page in our Theme
-        Theme weblogTheme = getTheme();
-        if(weblogTheme != null) {
-            return weblogTheme.getTemplateByAction(action);
-        }
-        
-        return null;
-    }
-    
-    
-    /**
-     * Lookup a Template for this website by name.
-     * @roller.wrapPojoMethod type="pojo"
-     */
-    public ThemeTemplate getPageByName(String name) throws WebloggerException {
-        
-        if(name == null)
-            return null;
-        
-        // look for the page in our Theme
-        Theme weblogTheme = getTheme();
-        if(weblogTheme != null) {
-            return weblogTheme.getTemplateByName(name);
-        }
-        
-        return null;
-    }
-    
-    
-    /**
-     * Lookup a template for this website by link.
-     * @roller.wrapPojoMethod type="pojo"
-     */
-    public ThemeTemplate getPageByLink(String link) throws WebloggerException {
-        
-        if(link == null)
-            return null;
-        
-        // look for the page in our Theme
-        Theme weblogTheme = getTheme();
-        if(weblogTheme != null) {
-            return weblogTheme.getTemplateByLink(link);
-        }
-        
-        return null;
-    }
-    
-    
-    /**
-     * Get a list of all pages that are part of this website.
-     * @roller.wrapPojoMethod type="pojo-collection" class="org.apache.roller.weblogger.pojos.Template"
-     */
-    public List getPages() throws WebloggerException {
-        
-        // look for the pages in our Theme
-        Theme weblogTheme = getTheme();
-        if(weblogTheme != null) {
-            return weblogTheme.getTemplates();
-        }
-        
-        return Collections.EMPTY_LIST;
-    }
-    
-    
-    /**
      * Id of the Website.
      *
      * @roller.wrapPojoMethod type="simple"

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.orm.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.orm.xml?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.orm.xml (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/Weblog.orm.xml Fri Jun  8 19:11:23 2007
@@ -249,10 +249,8 @@
 			<transient name="todaysReferrers"/>
 			<transient name="uRL"/>
 			<transient name="userCount"/>
-            <transient name="defaultPage"/>
 			<transient name="entryCount"/>
             <transient name="initializedPlugins"/>
-			<transient name="pages"/>
             <transient name="weblogCategories"/>
             <transient name="localeInstance"/>
             <transient name="timeZoneInstance" />

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogWrapper.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogWrapper.java?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogWrapper.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/pojos/wrapper/WeblogWrapper.java Fri Jun  8 19:11:23 2007
@@ -60,25 +60,25 @@
     
     public ThemeTemplateWrapper getPageByAction(String action)
             throws WebloggerException {
-        return ThemeTemplateWrapper.wrap(this.pojo.getPageByAction(action));
+        return ThemeTemplateWrapper.wrap(this.pojo.getTheme().getTemplateByAction(action));
     }
     
     
     public ThemeTemplateWrapper getPageByName(String name)
             throws WebloggerException {
-        return ThemeTemplateWrapper.wrap(this.pojo.getPageByName(name));
+        return ThemeTemplateWrapper.wrap(this.pojo.getTheme().getTemplateByName(name));
     }
     
     
     public ThemeTemplateWrapper getPageByLink(String link)
             throws WebloggerException {
-        return ThemeTemplateWrapper.wrap(this.pojo.getPageByLink(link));
+        return ThemeTemplateWrapper.wrap(this.pojo.getTheme().getTemplateByLink(link));
     }
     
     
     public List getPages() throws WebloggerException {
         
-        List initialCollection = this.pojo.getPages();
+        List initialCollection = this.pojo.getTheme().getTemplates();
         
         // iterate through and wrap
         // we force the use of an ArrayList because it should be good enough to cover
@@ -255,9 +255,12 @@
     }
     
     
-    public String getCustomStylesheet() {
+    public String getStylesheet() throws WebloggerException {
         // custom stylesheet comes from the weblog theme
-        return URLUtilities.getWeblogPageURL(this.pojo, null, this.pojo.getTheme().getCustomStylesheet(), null, null, null, null, 0, false);
+        if(this.pojo.getTheme().getStylesheet() != null) {
+            return URLUtilities.getWeblogPageURL(this.pojo, null, this.pojo.getTheme().getStylesheet().getLink(), null, null, null, null, 0, false);
+        }
+        return null;
     }
     
     

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/StylesheetEdit.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/StylesheetEdit.java?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/StylesheetEdit.java (original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/StylesheetEdit.java Fri Jun  8 19:11:23 2007
@@ -24,8 +24,12 @@
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.RollerFactory;
 import org.apache.roller.weblogger.business.UserManager;
+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.ui.struts2.util.UIAction;
 import org.apache.roller.weblogger.util.cache.CacheManager;
 
@@ -57,36 +61,42 @@
     }
     
     
+    @Override
     public void myPrepare() {
-        String stylesheetPath = getActionWeblog().getTheme().getCustomStylesheet();
-        log.debug("custom stylesheet path is - "+stylesheetPath);
         
-        if(stylesheetPath != null) {
+        ThemeTemplate stylesheet = null;
+        try {
+            stylesheet = getActionWeblog().getTheme().getStylesheet();
+        } catch (WebloggerException ex) {
+            log.error("Error looking up stylesheet on weblog - "+getActionWeblog().getHandle(), ex);
+        }
+        
+        if(stylesheet != null) {
+            log.debug("custom stylesheet path is - "+stylesheet.getLink());
             try {
                 UserManager mgr = RollerFactory.getRoller().getUserManager();
-                setTemplate(mgr.getPageByLink(getActionWeblog(), stylesheetPath));
+                setTemplate(mgr.getPageByLink(getActionWeblog(), stylesheet.getLink()));
                 
                 if(getTemplate() == null) {
                     log.debug("custom stylesheet not found, creating it");
-                    // template doesn't exist yet, so create it
-                    WeblogTemplate stylesheet = new WeblogTemplate();
-                    stylesheet.setWebsite(getActionWeblog());
-                    stylesheet.setAction(stylesheet.ACTION_CUSTOM);
-                    stylesheet.setName(stylesheetPath);
-                    stylesheet.setDescription(stylesheetPath);
-                    stylesheet.setLink(stylesheetPath);
-                    stylesheet.setContents("");
-                    stylesheet.setHidden(false);
-                    stylesheet.setNavbar(false);
-                    stylesheet.setLastModified(new Date());
                     
-                    // all templates start out as velocity templates
-                    stylesheet.setTemplateLanguage("velocity");
+                    // template doesn't exist yet, so create it
+                    WeblogTemplate stylesheetTmpl = new WeblogTemplate();
+                    stylesheetTmpl.setWebsite(getActionWeblog());
+                    stylesheetTmpl.setAction(stylesheet.ACTION_CUSTOM);
+                    stylesheetTmpl.setName(stylesheet.getName());
+                    stylesheetTmpl.setDescription(stylesheet.getDescription());
+                    stylesheetTmpl.setLink(stylesheet.getLink());
+                    stylesheetTmpl.setContents(stylesheet.getContents());
+                    stylesheetTmpl.setHidden(false);
+                    stylesheetTmpl.setNavbar(false);
+                    stylesheetTmpl.setLastModified(new Date());
+                    stylesheetTmpl.setTemplateLanguage(stylesheet.getTemplateLanguage());
                     
-                    mgr.savePage(stylesheet);
+                    mgr.savePage(stylesheetTmpl);
                     RollerFactory.getRoller().flush();
                     
-                    setTemplate(stylesheet);
+                    setTemplate(stylesheetTmpl);
                 }
             } catch (WebloggerException ex) {
                 log.error("Error finding/adding stylesheet tempalate from weblog - "+getActionWeblog().getHandle(), ex);
@@ -106,12 +116,12 @@
         
         setContents(getTemplate().getContents());
         
-        return SUCCESS;
+        return INPUT;
     }
     
     
     /**
-     * Save an existing template.
+     * Save an existing stylesheet.
      */
     public String save() {
         
@@ -137,7 +147,7 @@
             CacheManager.invalidate(stylesheet);
             
             // success message
-            addMessage("pageForm.save.success", stylesheet.getName());
+            addMessage("stylesheetEdit.save.success", stylesheet.getName());
             
         } catch (WebloggerException ex) {
             log.error("Error updating stylesheet template for weblog - "+getActionWeblog().getHandle(), ex);
@@ -145,9 +155,64 @@
             addError("Error saving template");
         }
         
-        return SUCCESS;
+        return INPUT;
     }
-
+    
+    
+    /**
+     * Revert the stylesheet to its original state.
+     */
+    public String revert() {
+        
+        if(getTemplate() == null) {
+            // TODO: i18n
+            addError("Unable to locate stylesheet template");
+            return ERROR;
+        }
+        
+        // make sure we are still using a shared theme so that reverting is possible
+        if(WeblogTheme.CUSTOM.equals(getActionWeblog().getEditorTheme())) {
+            // TODO: i18n
+            addError("stylesheetEdit.error.customTheme");
+        }
+        
+        if(!hasActionErrors()) try {
+            
+            WeblogTemplate stylesheet = getTemplate();
+            
+            // lookup the theme used by this weblog
+            ThemeManager tmgr = RollerFactory.getRoller().getThemeManager();
+            Theme theme = tmgr.getTheme(getActionWeblog().getEditorTheme());
+            
+            // lookup 
+            stylesheet.setLastModified(new Date());
+            stylesheet.setContents(theme.getStylesheet().getContents());
+            
+            // save template and flush
+            UserManager mgr = RollerFactory.getRoller().getUserManager();
+            mgr.savePage(stylesheet);
+            RollerFactory.getRoller().flush();
+            
+            // notify caches
+            CacheManager.invalidate(stylesheet);
+            
+            // success message
+            addMessage("stylesheetEdit.revert.success", stylesheet.getName());
+            
+        } catch (WebloggerException ex) {
+            log.error("Error updating stylesheet template for weblog - "+getActionWeblog().getHandle(), ex);
+            // TODO: i18n
+            addError("Error saving template");
+        }
+        
+        return execute();
+    }
+    
+    
+    public boolean isCustomTheme() {
+        return (WeblogTheme.CUSTOM.equals(getActionWeblog().getEditorTheme()));
+    }
+    
     
     public WeblogTemplate getTemplate() {
         return template;

Modified: roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/classes/ApplicationResources.properties Fri Jun  8 19:11:23 2007
@@ -1267,13 +1267,22 @@
 
 stylesheetEdit.title=Stylesheet
 stylesheetEdit.subtitle=Edit weblog custom stylesheet
-stylesheetEdit.tip=This form allows you to edit the custom stylesheet for your \
-weblog so that you can easily alter the css styling of your weblog theme.
+stylesheetEdit.tip=This form allows you to edit the stylesheet for your theme.
+stylesheetEdit.revertTip=If you run into any problems you don't know how to \
+fix you can start over at any time by clicking the restore button.
+
 stylesheetEdit.save=Save
+stylesheetEdit.revert=Restore Stylesheet
 
 stylesheetEdit.noStylesheetOverride=Sorry, but the theme you are using does not \
 provide a custom stylesheet for you to edit.  lame huh?  feel free to complain \
 about it to your system administrator.
+
+stylesheetEdit.save.success=Stylesheet updated successfully.
+stylesheetEdit.revert.success=Stylesheet reverted successfully.
+
+stylesheetEdit.error.customTheme=Cannot revert stylesheet on custom themes.
+
 
 # ------------------------------------------------------------------ Tabbed Menu
 

Modified: roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/classes/struts.xml Fri Jun  8 19:11:23 2007
@@ -313,7 +313,7 @@
         
         <action name="stylesheetEdit!*" method="{1}"
                 class="org.apache.roller.weblogger.ui.struts2.editor.StylesheetEdit">
-            <result name="success" type="tiles">.StylesheetEdit</result>
+            <result name="input" type="tiles">.StylesheetEdit</result>
             <result name="error" type="tiles">.StylesheetEditError</result>
         </action>
         

Modified: roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/StylesheetEdit.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/StylesheetEdit.jsp?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/StylesheetEdit.jsp (original)
+++ roller/trunk/apps/weblogger/web/WEB-INF/jsps/editor/StylesheetEdit.jsp Fri Jun  8 19:11:23 2007
@@ -19,7 +19,10 @@
 
 <p class="subtitle"><s:text name="stylesheetEdit.subtitle" /></p>
 
-<p class="pagetip"><s:text name="stylesheetEdit.tip" /></p>
+<p class="pagetip">
+    <s:text name="stylesheetEdit.tip" />
+    <s:if test="!customTheme"><s:text name="stylesheetEdit.revertTip" /></s:if>
+</p>
                 
 <s:form action="stylesheetEdit!save">
     <s:hidden name="weblog" />
@@ -52,7 +55,10 @@
     <table style="width:100%">
         <tr>
             <td>
-                <s:submit key="stylesheetEdit.save" />
+                <s:submit key="stylesheetEdit.save" />&nbsp;&nbsp;
+                <s:if test="!customTheme">
+                    <s:submit key="stylesheetEdit.revert" action="stylesheetEdit!revert" />
+                </s:if>
             </td>
             <td align="right">
                 <!-- Add buttons to make this textarea taller or shorter -->

Modified: roller/trunk/apps/weblogger/web/themes/basic/Weblog.vm
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/themes/basic/Weblog.vm?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/web/themes/basic/Weblog.vm (original)
+++ roller/trunk/apps/weblogger/web/themes/basic/Weblog.vm Fri Jun  8 19:11:23 2007
@@ -4,9 +4,7 @@
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <title>$model.weblog.name : $model.weblogPage.name</title>
     #showAutodiscoveryLinks($model.weblog)
-    <style type="text/css">#includeTemplate($model.weblog "_css")</style>
-
-    <link rel="stylesheet" type="text/css" media="all" href="$model.weblog.customStylesheet">
+    <link rel="stylesheet" type="text/css" media="all" href="$model.weblog.stylesheet">
 </head>
 <body>
 

Modified: roller/trunk/apps/weblogger/web/themes/basic/theme.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/themes/basic/theme.xml?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/web/themes/basic/theme.xml (original)
+++ roller/trunk/apps/weblogger/web/themes/basic/theme.xml Fri Jun  8 19:11:23 2007
@@ -8,8 +8,14 @@
     <!-- theme preview image -->
     <preview-image path="sm-theme-basic.png" />
     
-    <!-- custom stylesheet -->
-    <custom-stylesheet path="basic-custom.css" />
+    <!-- stylesheet -->
+    <stylesheet>
+        <name>basic-custom.css</name>
+        <description>Stylesheet for Basic theme</description>
+	<link>basic-custom.css</link>
+        <templateLanguage>velocity</templateLanguage>
+        <contentsFile>basic-custom.css</contentsFile>
+    </stylesheet>
     
     <!-- templates -->
     <template action="weblog">
@@ -32,17 +38,6 @@
         <templateLanguage>velocity</templateLanguage>
         <contentType>text/html</contentType>
         <contentsFile>_day.vm</contentsFile>
-    </template>
-    
-    <template action="custom">
-        <name>_css</name>
-        <description>_css</description>
-	<link></link>
-        <navbar>false</navbar>
-        <hidden>true</hidden>
-        <templateLanguage>velocity</templateLanguage>
-        <contentType>text/css</contentType>
-        <contentsFile>_css.vm</contentsFile>
     </template>
     
     <!-- resources -->

Modified: roller/trunk/apps/weblogger/web/themes/brushedmetal/Weblog.vm
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/themes/brushedmetal/Weblog.vm?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/web/themes/brushedmetal/Weblog.vm (original)
+++ roller/trunk/apps/weblogger/web/themes/brushedmetal/Weblog.vm Fri Jun  8 19:11:23 2007
@@ -4,12 +4,7 @@
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <title>$model.weblog.name : $model.weblogPage.name</title>
     #showAutodiscoveryLinks($model.weblog)
-
-    <style type="text/css">
-    #includeTemplate($model.weblog "_css")
-    </style>
-
-    <link rel="stylesheet" type="text/css" media="all" href="$model.weblog.customStylesheet">
+    <link rel="stylesheet" type="text/css" media="all" href="$model.weblog.stylesheet">
 </head>
 
 <body>

Modified: roller/trunk/apps/weblogger/web/themes/brushedmetal/theme.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/themes/brushedmetal/theme.xml?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/web/themes/brushedmetal/theme.xml (original)
+++ roller/trunk/apps/weblogger/web/themes/brushedmetal/theme.xml Fri Jun  8 19:11:23 2007
@@ -8,8 +8,14 @@
     <!-- theme preview image -->
     <preview-image path="sm-theme-brushedmetal.png" />
     
-    <!-- custom stylesheet -->
-    <custom-stylesheet path="brushedmetal-custom.css" />
+    <!-- stylesheet -->
+    <stylesheet>
+        <name>brushedmetal-custom.css</name>
+        <description>Stylesheet for Brushed Metal theme</description>
+	<link>brushedmetal-custom.css</link>
+        <templateLanguage>velocity</templateLanguage>
+        <contentsFile>brushedmetal-custom.css</contentsFile>
+    </stylesheet>
     
     <!-- templates -->
     <template action="weblog">
@@ -32,17 +38,6 @@
         <templateLanguage>velocity</templateLanguage>
         <contentType>text/html</contentType>
         <contentsFile>_day.vm</contentsFile>
-    </template>
-    
-    <template action="custom">
-        <name>_css</name>
-        <description>_css</description>
-	<link></link>
-        <navbar>false</navbar>
-        <hidden>true</hidden>
-        <templateLanguage>velocity</templateLanguage>
-        <contentType>text/css</contentType>
-        <contentsFile>_css.vm</contentsFile>
     </template>
     
     <!-- resources -->

Modified: roller/trunk/apps/weblogger/web/themes/sotto/Weblog.vm
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/themes/sotto/Weblog.vm?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/web/themes/sotto/Weblog.vm (original)
+++ roller/trunk/apps/weblogger/web/themes/sotto/Weblog.vm Fri Jun  8 19:11:23 2007
@@ -2,15 +2,13 @@
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
 <html xmlns="http://www.w3.org/1999/xhtml">
-    <head>
+<head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <title>$model.weblog.name : $model.weblogPage.name</title>
     #showAutodiscoveryLinks($model.weblog)
-    <style type="text/css">#includeTemplate($model.weblog "_css")</style>
-    <link rel="stylesheet" type="text/css" href='$url.resource("styles/default.css")' />
+    <link rel="stylesheet" type="text/css" media="all" href="$model.weblog.stylesheet">
+</head>
 
-    <link rel="stylesheet" type="text/css" media="all" href="$model.weblog.customStylesheet">
-    </head>
 <body>
 
 <div id="mainContainer">

Copied: roller/trunk/apps/weblogger/web/themes/sotto/sotto-custom.css (from r545559, roller/trunk/apps/weblogger/web/themes/sotto/_css.vm)
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/themes/sotto/sotto-custom.css?view=diff&rev=545682&p1=roller/trunk/apps/weblogger/web/themes/sotto/_css.vm&r1=545559&p2=roller/trunk/apps/weblogger/web/themes/sotto/sotto-custom.css&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/web/themes/sotto/_css.vm (original)
+++ roller/trunk/apps/weblogger/web/themes/sotto/sotto-custom.css Fri Jun  8 19:11:23 2007
@@ -1,3 +1,21 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  The ASF licenses this file to You
+* under the Apache License, Version 2.0 (the "License"); you may not
+* use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+
 /*-------------------------------------------------------------
 Base styles
 --------------------------------------------------------------*/
@@ -183,3 +201,835 @@
     color: #444;
     width: 80%;
 }
+
+/**
+  * STANDARD ELEMENTS
+  */
+
+body
+{
+
+  background: #faf0e6;
+  /*background: #f88506;*/
+  color: #000;
+  font-weight: 400;
+  font-size: 85%;
+  font-family: Verdana, sans-serif;
+  text-align: center;
+  /*padding: 25px;
+  voice-family: "\"}\"";
+  voice-family: inherit;*/
+}
+
+a:link
+{
+  color: #314E6C;
+  /*cursor: hand;*/
+  voice-family: "\"}\"";
+  voice-family: inherit;
+  cursor: pointer;
+}
+
+a:visited
+{
+  color: #314E6C;
+}
+
+a:hover
+{
+  /*cursor: hand;*/
+  voice-family: "\"}\"";
+  voice-family: inherit;
+  cursor: pointer;
+}
+
+ul, dl
+{
+  padding: 0px 0px 0px 5px;
+  margin: 0px;
+}
+
+li, dt, dd, div.links a
+{
+  list-style-type: none;
+  margin: 0px 0px 3px 0px;
+  padding: 0px;
+  font-weight: 400;
+  font-size: 11px;
+  font-family: Arial, sans-serif;
+}
+
+li a, dd a, a.copyright, div.sidebarBox a, div.links a
+{
+  text-decoration: none !important;
+}
+
+li a:hover, dd a:hover, a.copyright:hover, div.links a:hover
+{
+  text-decoration: underline !important;
+}
+
+div.links
+{ 
+  line-height: 18px;
+}
+
+div.links div.rFolder {
+    margin-left: -5px;
+    margin-bottom: 10px;
+}
+
+dd
+{
+  margin-bottom: 10px;
+}
+
+img
+{
+  border: 1px solid #BAB5AB;
+}
+
+select
+{
+  font-family: Georgia, serif;
+}
+
+input.styled, textarea.styled, 
+div#searchAgain input /* added searchAgain for roller */,
+div.comments-form input
+{
+  border: 1px solid #999;
+  font-family: Georgia, serif;
+  font-size: 1em;
+}
+
+label.styled, div.styled
+{
+  font: 800 oblique .85em Georgia, serif;
+  color: #000;
+}
+
+/**
+ * PAGE SectionS
+ */
+
+#mainContainer
+{
+  border: 1px solid #999;
+  margin: auto;
+  margin-top: 25px;
+  /*overflow: hidden;*/
+  width: 720px;
+  text-align: left;
+  background: #fff;
+}
+
+#smallContainer
+{
+  border: 2px solid #ccc;
+  margin: auto;
+  overflow: hidden;
+  width: 450px;
+  text-align: left;
+  background: #fff;
+}
+
+#leftColumn
+{
+  padding: 0px 5px 0px 5px;
+  width: 186px;
+  float: left;
+  /*margin: auto;*/
+  font-family: Georgia, serif;
+  /*overflow: hidden;*/
+  /* IE 5+ Box Model Hack*/
+  voice-family: "\"}\"";
+  voice-family: inherit;
+  width: 176px;
+}
+
+#midColumn
+{
+  padding: 10px;
+  width: 530px;
+  /*margin: auto;
+  overflow: hidden;*/
+  float: left;
+  voice-family: "\"}\"";
+  voice-family: inherit;
+  width: 509px;
+}
+
+
+#mainColumn
+{
+  padding: 10px;
+  width: 720px;
+  /*overflow: hidden;*/
+  float: left;
+  voice-family: "\"}\"";
+  voice-family: inherit;
+  width: 700px;
+}
+
+#smallColumn
+{
+  padding: 10px;
+  width: 450px;
+  /*overflow: hidden;*/
+  float: left;
+  voice-family: "\"}\"";
+  voice-family: inherit;
+  width: 430px;
+}
+
+/**
+ * PAGEBANNER
+ */
+
+#pageBanner
+{
+  height: 70px;
+}
+
+#pageBanner h1 {
+  font-family: Futura, Arial, Helvetica, sans-serif;
+  margin: 0px 0px -10px 10px;
+  padding-top: 10px;
+  font-weight: lighter;
+  font-size: 44px;
+  font-stretch: narrower;
+}
+
+#pageBanner h1 a 
+{
+  background: transparent;
+  color: #6F89A1;
+  text-decoration: none;
+  font-style: normal;
+}
+
+#gutter
+{
+  border-top: 0.1em solid #ddd;
+  border-bottom: 0.1em solid #ddd;
+  /*background: #eee;*/
+  height: 52px;
+  background: #eee url($url.resource('images/bannerBackground.gif')) repeat-x;
+}
+
+#gutterimage1
+{
+  float: left;
+  margin: 0px;
+  width: 75px;
+  height: 50px;
+  border: 1px solid #ccc;
+  background: url($url.resource('images/daisy.jpg')) no-repeat;
+}
+
+#gutterimage2
+{
+  float: left;
+  margin: 0px;
+  width: 75px;
+  height: 50px;
+  border: 1px solid #ccc;
+  background: url($url.resource('images/clouds.jpg')) no-repeat;
+}
+
+#gutterimage3
+{
+  float: left;
+  margin: 0px;
+  width: 75px;
+  height: 50px;
+  border: 1px solid #ccc;
+  border-right: 2px solid #ccc;
+  background: url($url.resource('images/prairie.jpg')) no-repeat;
+}
+
+/**
+ * ADMINBAR
+ */
+
+ul.rNavigationBar
+{
+  border-bottom: 1px dotted #ddd;
+  padding: 0px;
+  height: 23px;
+}
+
+ul.rNavigationBar li
+{
+  display: inline;
+  text-align: center;
+}
+
+ul.rNavigationBar li a, ul.rNavigationBar a
+{
+  color: #999;
+  padding: 5px;
+  width: 120px;
+  float: left;
+  text-align: center;
+  text-decoration: none;
+}
+
+ul.rNavigationBar li a:hover
+{
+  background: #ddd url($url.resource('images/buttonBackground.gif')) repeat-x;
+  border-right: 1px dashed #ccc;
+  border-left: 1px dashed #ccc;
+}
+
+/**
+ * MENU
+ */
+ 
+#menu
+{
+    padding: 5px;
+    background: #fff;
+    text-align: center;
+    font-family: Arial, sans-serif;
+    border-bottom: 1px dashed #ddd;
+}	
+
+#menu a
+{
+    color: #999;
+    padding:0px 2px 0px 2px;
+}
+
+#menu a:link
+{
+    text-decoration: none;
+    font-size: 1em;
+}	
+
+#menu a:visited
+{
+    text-decoration: none;
+    font-size: 1em;
+}	
+
+#menu a:hover	
+{
+    text-decoration: underline;
+}	
+
+/**
+ * SEARCH
+ */
+
+.searchEntryTitle
+{
+    font: 400 .5em Georgia, serif;
+} 
+
+.searchResultBox
+{
+  border-bottom: 1px solid #ddd;
+}
+
+.searchResultTitle
+{
+    border-bottom: 1px solid #ddd;
+    font: 800 1.6em Georgia, serif;
+}
+
+/**
+ * STORYLIST
+ */
+
+.storyBox
+{
+  border-bottom: 1px solid #BAB5AB;
+}
+
+.storyBox h2
+{
+  /*color: #333;*/
+}
+
+.storyDateBox
+{
+  font-family: Georgia, serif;
+  float: left;
+  padding:0px 5px 5px 0px;
+  margin: 0px 10px 4px 0px;
+  border-right: 1px solid #B39169;
+  width: 70px;
+  position: relative;
+  /*background: #f7f7f7;*/
+}
+
+.storyDateBox h2
+{
+  font-weight: 400;
+  margin: 0px;
+  padding: 0px;
+}
+
+.storyDateBox h2 a
+{
+  text-decoration: none;
+  font-size: 36px;
+}
+
+.storyDate
+{
+  text-decoration: none;
+  font-size: 32px;
+}
+
+.storyDateBox span
+{
+  font-size: 11px;
+}
+
+/**
+ * STORY
+ */
+
+.storyTitle
+{
+    font: 400 oblique 1.7em Georgia, serif;
+    color: #111;
+}
+
+.story
+{
+  font-family: Verdana, sans-serif;
+  font-size: 12px;
+  line-height: 2em;
+  text-align: justify;
+  /*color: #222;*/
+  /*margin-bottom: 25px;*/
+}
+
+.story>a
+{
+}
+
+/**
+ * COMMENTS
+ */
+
+div.trackbackUrl {
+    background: transparent;
+    color: #006633;
+    margin-bottom: 10px;
+    padding-bottom: 5px;
+    border-bottom: 1px dotted silver;
+}
+
+#commentBox
+{
+  font-family: Arial;
+  color: #555
+}
+
+.comment
+{
+  padding-top: 10px;
+  padding-bottom: 10px;
+  line-height: 16px;
+}
+
+#commentBoxPreview
+{
+  font-family: Arial;
+  color: #555;
+  padding: 5px;
+  background: #eee;
+  border: 1px solid #aaa;
+}
+
+#commentBoxPreview h3
+{
+  margin: 0px;
+}
+
+.comments-head {
+    font-weight: 900;
+}
+
+.comment, .comments-form table {
+    font-family: Verdana, sans-serif;
+    font-size: 1em;
+}
+
+.commentFormInput,
+.commentFormTextarea {
+    font-family: Verdana, serif;
+    font-size: 1em;
+}
+
+div.comments-head {
+    padding-top: 10px;
+    background: transparent;
+    color: #990000;
+}
+
+span.enabled {
+    color: green;
+    font-style: italic;
+}
+
+span.disabled {
+    color: red;
+}
+/**
+ * FORM ROWS
+ */
+
+.formRow
+{
+  width: auto;
+}
+
+.formRowTitle
+{
+  text-align: left;
+  font: 800 oblique 11px Georgia, serif;
+}
+
+.formRowControl
+{
+  padding-top: 5px;
+}
+
+.formRowControl input, .formRowControl textarea
+{
+  border: 1px solid #999;
+  font-family: Georgia, serif;
+}
+
+/**
+ * SIDE COLUMN
+ */
+
+#quoteBox
+{
+  font-style: oblique;
+  font-family: Arial, sans-serif;
+}
+
+.sidebarHeading, div.rFolder
+{
+  border-bottom: 1px solid #999;
+  color: #990000;
+  padding: 0px 0px 3px 5px;
+  font-family: Georgia, serif;
+  font-weight: 400;
+  font-size: 12px;
+  font-variant: small-caps;
+}
+
+div.sidebarBox, form.sidebarBox
+{
+  margin-bottom: 25px;
+}
+
+#aboutBox
+{
+  font-size: 10px;
+  font-family: Arial, sans-serif;
+}
+
+#aboutBox a
+{
+  text-decoration: none;
+  border-bottom: 1px dotted #314E6C;
+}
+
+#blogChalk
+{
+  width: 35px;
+  height: 30px;
+  border:1px dashed #ddd;
+}
+
+/**
+ * CLASSES
+ */
+
+.noBorder
+{
+  border: 0em;
+}
+
+.standardSpacer
+{
+  overflow: hidden;
+}
+
+.floatSpacer
+{
+  clear: both;
+  overflow: hidden;
+}
+
+.noDisplay
+{
+  display: none;
+}
+
+.blockDisplay
+{
+  display: block;
+}
+
+.smallText
+{
+  font-size: 9px;
+  font-family: Verdana, sans-serif;
+}
+
+.storyLink
+{
+  font-family: Georgia, serif;
+  font-size: 1.0em;
+  margin-left: 1.0em;
+}
+
+.new
+{
+  color: blue;
+  font-size: 9px;
+}
+
+.draft
+{
+  font: 800 oblique 14px Georgia;
+  color: #aaa
+}
+
+.border
+{
+  border-bottom: 1px solid #ccc;
+}
+
+
+.sectionTitle
+{
+    font-family: Georgia, serif;
+    font-weight: 800;
+    font-style: oblique;
+    font-size: 1.2em;
+    color: #555;    
+}
+
+.heading
+{
+    font-family: Georgia, serif;
+    font-weight: 400;
+    font-style: oblique;
+    font-size: 1.0em;
+    color: #555;    
+}
+
+.blockquote
+{
+    margin-left: 15px;
+    margin-top: 15px;
+    margin-bottom: 15px;
+    margin-right: 15px;
+    line-height: 1.7em;
+    color: #444;
+    clear: both;
+    /*font: 400 oblique 12px Helvetica, sans-serif;*/
+    font-style: oblique;
+    font-family: "Courier New", "Andale Mono", "MS Sans Serif";
+}
+
+img.smiley 
+{
+    vertical-align: top;
+}
+
+/**
+ * CALENDAR
+ */
+
+#calendar
+{
+    border: 1px solid #999;
+}
+
+#sideCalendar, table.hCalendarTable
+{
+    width: 160px;
+}
+
+table.hCalendarTable {
+    font-size: 1em;
+}
+
+.thead, .hCalendarDayNameRow
+{
+    border-bottom: 1px solid #ffbf74;
+    text-align: center;
+    font-size: .9em;
+    font-weight: 400;
+    /*font-variant: small-caps;*/
+    color: #444;
+}
+
+.calLink, .hCalendarDayTitle
+{
+    font-size: .9em;
+    color: #555;
+    text-align: center;
+}
+
+.calLink a:link, div.hCalendarDayTitle a
+{
+    text-decoration: none;
+    font-size: 1.1em;
+    font-weight: 800;
+}
+
+.calLink a:hover, div.hCalendarDayTitle a:hover
+{
+    text-decoration: underline !important;
+    font-size: 1.1em;
+    font-weight: 800;
+}
+
+.calendar
+{
+	font-family:verdana, arial, sans-serif;
+	color:#666;
+	font-size:x-small;
+	font-weight:normal;
+	background:#FFF;
+	line-height:140%;
+	padding:2px;
+    text-align:left;
+}
+
+.calendarCaption, .hCalendarMonthYearRow
+{	
+	font-family: Georgia, serif;
+	color: #111;
+	font-size: .9em;
+	font-weight: 400;
+	padding: 2px;
+	letter-spacing: .3em;
+	background: #fff;
+	/*font-variant: small-caps;*/
+    text-transform: uppercase;
+	text-align: center;			
+}
+
+#calendar>caption 
+{
+    margin: 5px;
+}
+
+/*
+ * Yeah, this is a mess. Too lazy to code, easier to do the calendar through
+ * styles.
+ */
+#cell1, #cell3, #cell5, #cell7, #cell8, #cell10, #cell12, #cell14, #cell15,
+#cell17, #cell19, #cell21, #cell22, #cell24, #cell26, #cell28, #cell29, #cell31,
+#cell33, #cell35, #cell36, #cell38, #cell40, #cell42
+{
+    background: #f7f7f7;
+}
+
+#c1, #c3, #c5, #c7, #c8, #c10, #c12, #c14, #c15,
+#c17, #c19, #c21, #c22, #c24, #c26, #c28, #c29, #c31,
+#c33, #c35, #c36, #c38, #c40, #c42
+{
+    background: #f0f0f0;
+}
+
+
+/**
+ * Easier to use attr=[], but not well supported
+ */
+#cell1, #cell2, #cell3, #cell4, #cell5, #cell6, #cell7, #cell8, #cell9, #cell10,
+#cell11, #cell12, #cell13, #cell14, #cell15, #cell16, #cell17, #cell18, #cell19, #cell20,
+#cell21, #cell22, #cell23, #cell24, #cell25, #cell26, #cell27, #cell28, #cell29, #cell30,
+#cell31, #cell32, #cell33, #cell34, #cell35, #cell36, #cell37, #cell38, #cell39, #cell40,
+#cell41, #cell42
+{
+    border-top: 1px solid #999;
+    height: 120px;
+    width: 90px;
+    text-align: left;
+}
+
+#c1, #c2, #c3, #c4, #c5, #c6, #c7, #c8, #c9, #c10,
+#c11, #c12, #c13, #c14, #c15, #c16, #c17, #c18, #c19, #c20,
+#c21, #c22, #c23, #c24, #c25, #c26, #c27, #c28, #c29, #c30,
+#c31, #c32, #c33, #c34, #c35, #c36, #c37, #c38, #c39, #c40,
+#c41, #c42, td.hCalendarDay
+{
+    /*border-top: 1px solid #999;
+    height: 120px;
+    width: 90px;*/
+    font: 400 1em Arial, sans-serif;
+    text-align: center;
+}
+
+.hCalendarDayCurrent 
+{
+    border: 1px solid #ffbf74;
+}
+
+.day
+{
+    font: 800 1.1em Georgia, serif;
+    font-variant: small-caps;
+}
+
+.calendarMonth
+{
+    display: inline;
+    font-family: Georgia, serif;
+    font-weight: 400;
+    font-variant: small-caps;
+    /*font-style: oblique;*/
+    font-size: 1.6em;
+    color: #000;    
+}
+
+a.calendarLink
+{
+    font-family: Georgia, serif;
+    font-weight: 800;
+    font-size: 1.1em;
+}
+
+a.calendarLink:link, a.calendarLink:visited
+{
+    text-decoration: none;
+}
+
+a.calendarLink:hover
+{
+    text-decoration: underline;
+}
+
+/**
+ * INDEX
+ */
+
+.indexBox
+{
+  color: #999;
+  margin-top: 10%;
+  border: 4px solid #ccc;
+  height: 250px;
+  width: 200px;
+  margin-left: auto;
+  margin-right: auto;
+  margin-bottom: auto;
+  background: #fff;    
+}
+

Modified: roller/trunk/apps/weblogger/web/themes/sotto/theme.xml
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/web/themes/sotto/theme.xml?view=diff&rev=545682&r1=545681&r2=545682
==============================================================================
--- roller/trunk/apps/weblogger/web/themes/sotto/theme.xml (original)
+++ roller/trunk/apps/weblogger/web/themes/sotto/theme.xml Fri Jun  8 19:11:23 2007
@@ -8,8 +8,14 @@
     <!-- theme preview image -->
     <preview-image path="sm-theme-sotto.png" />
     
-    <!-- custom stylesheet -->
-    <custom-stylesheet path="sotto-custom.css" />
+    <!-- stylesheet -->
+    <stylesheet>
+        <name>sotto-custom.css</name>
+        <description>Stylesheet for Sotto theme</description>
+	<link>sotto-custom.css</link>
+        <templateLanguage>velocity</templateLanguage>
+        <contentsFile>sotto-custom.css</contentsFile>
+    </stylesheet>
     
     <!-- templates -->
     <template action="weblog">
@@ -34,20 +40,7 @@
         <contentsFile>_day.vm</contentsFile>
     </template>
     
-    <template action="custom">
-        <name>_css</name>
-        <description>_css</description>
-	<link></link>
-        <navbar>false</navbar>
-        <hidden>true</hidden>
-        <templateLanguage>velocity</templateLanguage>
-        <contentType>text/css</contentType>
-        <contentsFile>_css.vm</contentsFile>
-    </template>
-    
     <!-- resources -->
-    <resource path="theme.css" />
-    <resource path="styles/default.css" />
     <resource path="images/bannerBackground.gif" />
     <resource path="images/buttonBackground.gif" />
     <resource path="images/clouds.jpg" />



Mime
View raw message