roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r429378 - in /incubator/roller/branches/roller_3.0: src/org/apache/roller/business/ src/org/apache/roller/ui/rendering/servlets/ src/org/apache/roller/util/cache/ web/themes/andreas08/ web/themes/andreas08/styles/ web/themes/basic/ web/them...
Date Mon, 07 Aug 2006 16:14:51 GMT
Author: snoopdave
Date: Mon Aug  7 09:14:50 2006
New Revision: 429378

URL: http://svn.apache.org/viewvc?rev=429378&view=rev
Log:
More theme tweaks plus change to allow caching of content-type in page servlet

Removed:
    incubator/roller/branches/roller_3.0/web/themes/andreas08/styles/forms.css
Modified:
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/ThemeManagerImpl.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/PageServlet.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/PreviewServlet.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/util/cache/CachedContent.java
    incubator/roller/branches/roller_3.0/web/themes/andreas08/Weblog.vm
    incubator/roller/branches/roller_3.0/web/themes/andreas08/styles/layout-navtop-subright.css
    incubator/roller/branches/roller_3.0/web/themes/basic/Weblog.vm
    incubator/roller/branches/roller_3.0/web/themes/brushedmetal/Weblog.vm

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/business/ThemeManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/business/ThemeManagerImpl.java?rev=429378&r1=429377&r2=429378&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/business/ThemeManagerImpl.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/business/ThemeManagerImpl.java
Mon Aug  7 09:14:50 2006
@@ -284,12 +284,10 @@
             // Strip "_" from name to form link
             boolean navbar = true;
             String template_link = template_name;
-            if ("_css".equals(template_name)) {
-                navbar = false;
-                template_link = "theme.css";
-            } else if (template_name.startsWith("_") && template_name.length() >
1) {
+            if (template_name.startsWith("_") && template_name.length() > 1) {
                 navbar = false;
                 template_link = template_link.substring(1);
+                mLogger.debug("--- " + template_link);
             }
             
             String decorator = "_decorator";
@@ -306,9 +304,9 @@
                     theme,
                     theme_name+":"+template_name,
                     template_name,
-                    template_link,
-                    new String(chars),
                     template_name,
+                    new String(chars),
+                    template_link,
                     new Date(template_file.lastModified()),
                     "velocity",
                     true,
@@ -366,6 +364,7 @@
                 if (template != null) {
                     // User already has page by that name, so overwrite it.
                     template.setContents(theme_template.getContents());
+                    template.setLink(theme_template.getLink());
                     
                 } else {
                     // User does not have page by that name, so create new page.
@@ -374,7 +373,7 @@
                             website,                            // website
                             theme_template.getName(),           // name
                             theme_template.getDescription(),    // description
-                            theme_template.getName(),           // link
+                            theme_template.getLink(),           // link
                             theme_template.getContents(),       // contents
                             new Date(),                         // last mod
                             theme_template.getTemplateLanguage(), // temp lang

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/PageServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/PageServlet.java?rev=429378&r1=429377&r2=429378&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/PageServlet.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/PageServlet.java
Mon Aug  7 09:14:50 2006
@@ -38,7 +38,6 @@
 import org.apache.roller.config.RollerConfig;
 import org.apache.roller.config.RollerRuntimeConfig;
 import org.apache.roller.model.RollerFactory;
-import org.apache.roller.model.UserManager;
 import org.apache.roller.pojos.Template;
 import org.apache.roller.pojos.WeblogTemplate;
 import org.apache.roller.pojos.WebsiteData;
@@ -176,22 +175,11 @@
             response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
             return;
         }
-        
+                
         // set last-modified date
         response.setDateHeader("Last-Modified", lastModified);
         
-        
-        // set the content type
-        String pageLink = pageRequest.getWeblogPageName();
-        String mimeType = RollerContext.getServletContext().getMimeType(pageLink);
-        if(mimeType != null) {
-            // we found a match ... set the content type
-            response.setContentType(mimeType+"; charset=utf-8");
-        } else {
-            response.setContentType("text/html; charset=utf-8");
-        }
-        
-        
+                
         // generate cache key
         String cacheKey = null;
         if(isSiteWide) {
@@ -215,6 +203,7 @@
                 log.debug("HIT "+cacheKey);
                 
                 response.setContentLength(cachedContent.getContent().length);
+                response.setContentType(cachedContent.getContentType());
                 response.getOutputStream().write(cachedContent.getContent());
                 return;
                 
@@ -296,6 +285,7 @@
                 invalid = true;
             }
         }
+       
         
         if(invalid) {
             if(!response.isCommitted()) response.reset();
@@ -305,6 +295,18 @@
         
         
         // looks like we need to render content
+        
+        // set the content type
+        String mimeType = RollerContext.getServletContext().getMimeType(page.getLink());
+        String contentType = "text/html; charset=utf-8";
+        if(mimeType != null) {
+            // we found a match ... set the content type
+            contentType = mimeType+"; charset=utf-8";
+        } else if ("_css".equals(page.getName())) {
+            // TODO: store content-type for each page so this hack is unnecessary
+            contentType = "text/css; charset=utf-8";
+        }
+
         HashMap model = new HashMap();
         try {
             PageContext pageContext = JspFactory.getDefaultFactory().getPageContext(
@@ -368,7 +370,7 @@
         }
         
         // render content.  use size of about 24K for a standard page
-        CachedContent rendererOutput = new CachedContent(24567);
+        CachedContent rendererOutput = new CachedContent(24567, contentType);
         try {
             log.debug("Doing rendering");
             renderer.render(model, rendererOutput.getCachedWriter());

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/PreviewServlet.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/PreviewServlet.java?rev=429378&r1=429377&r2=429378&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/PreviewServlet.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/servlets/PreviewServlet.java
Mon Aug  7 09:14:50 2006
@@ -36,6 +36,7 @@
 import org.apache.roller.pojos.Template;
 import org.apache.roller.pojos.Theme;
 import org.apache.roller.pojos.WebsiteData;
+import org.apache.roller.ui.core.RollerContext;
 import org.apache.roller.util.cache.CachedContent;
 import org.apache.roller.ui.rendering.Renderer;
 import org.apache.roller.ui.rendering.RendererManager;
@@ -133,7 +134,16 @@
         log.debug("preview page found, dealing with it");
         
         // set the content type
-        response.setContentType("text/html; charset=utf-8");
+        String pageLink = previewRequest.getWeblogPageName();
+        String mimeType = RollerContext.getServletContext().getMimeType(pageLink);
+        String contentType = "text/html; charset=utf-8";
+        if(mimeType != null) {
+            // we found a match ... set the content type
+            contentType = mimeType+"; charset=utf-8";
+        } else if ("_css".equals(previewRequest.getWeblogPageName())) {
+            // TODO: store content-type for each page so this hack is unnecessary
+            contentType = "text/css; charset=utf-8";
+        }
         
         // looks like we need to render content
         Map model = new HashMap();
@@ -213,6 +223,7 @@
         
         // flush rendered content to response
         log.debug("Flushing response output");
+        response.setContentType(contentType);
         response.setContentLength(rendererOutput.getContent().length);
         response.getOutputStream().write(rendererOutput.getContent());
         

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/util/cache/CachedContent.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/util/cache/CachedContent.java?rev=429378&r1=429377&r2=429378&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/util/cache/CachedContent.java
(original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/util/cache/CachedContent.java
Mon Aug  7 09:14:50 2006
@@ -24,6 +24,9 @@
     // the byte array we use to maintain the cached content
     private byte[] content = new byte[0];
     
+    // content-type of data in byte array
+    private String contentType = null;
+    
     // Use a byte array output stream to cached the output bytes
     private transient ByteArrayOutputStream outstream = null;
     
@@ -50,6 +53,11 @@
         }
     }
     
+    public CachedContent(int size, String contentType) {
+        this(size);
+        this.contentType = contentType;
+    }
+    
     
     /**
      * Get the content cached in this object as a byte array.  If you convert
@@ -81,6 +89,11 @@
     
     public PrintWriter getCachedWriter() {
         return cachedWriter;
+    }
+    
+    
+    public String getContentType() {
+        return contentType;
     }
     
     

Modified: incubator/roller/branches/roller_3.0/web/themes/andreas08/Weblog.vm
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/themes/andreas08/Weblog.vm?rev=429378&r1=429377&r2=429378&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/themes/andreas08/Weblog.vm (original)
+++ incubator/roller/branches/roller_3.0/web/themes/andreas08/Weblog.vm Mon Aug  7 09:14:50
2006
@@ -1,13 +1,21 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 #set($themeDir = "$config.contextURL/themes/andreas08")
-<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
+<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">  
 <head>
     <title>$model.weblog.name</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <meta http-equiv="Content-Language" content="en" />
-    <base href="$model.weblog.URL"> 
-    #includeTemplate($model.weblog "_css")
+
+    <link rel="stylesheet" type="text/css" href="$url.home/page/css" />
+    <link rel="stylesheet" type="text/css" href='$url.themeResource("andreas08", "styles/tools.css")'
/>
+    <link rel="stylesheet" type="text/css" href="$url.themeResource("andreas08", "styles/typo.css")'
/>
+    <link rel="stylesheet" type="text/css" href='$url.themeResource("andreas08", "styles/lightbox.css")'
/>
+    <link rel="stylesheet" type="text/css" href='$url.themeResource("andreas08", "styles/nav-horizontal.css")'
/>
+    <link rel="stylesheet" type="text/css" href='$url.themeResource("andreas08", "styles/layout-navtop-subright.css")'
/>
+    <link rel="stylesheet" type="text/css" href='$url.themeResource("andreas08", "styles/layout.css")'
/>
+    <link rel="stylesheet" type="text/css" href='$url.themeResource("andreas08", "styles/andreas08.css")'
/>
+
     #showAutodiscoveryLinks($model.weblog)
     #showCommonJavascript()
     <script type="text/javascript" src="$url.themeResource("andreas08", "scripts/prototype.js")"></script>

Modified: incubator/roller/branches/roller_3.0/web/themes/andreas08/styles/layout-navtop-subright.css
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/themes/andreas08/styles/layout-navtop-subright.css?rev=429378&r1=429377&r2=429378&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/themes/andreas08/styles/layout-navtop-subright.css
(original)
+++ incubator/roller/branches/roller_3.0/web/themes/andreas08/styles/layout-navtop-subright.css
Mon Aug  7 09:14:50 2006
@@ -1,7 +1,5 @@
 /* A CSS Framework by Mike Stenhouse of Content with Style */
 
-@import url(nav-horizontal.css);
-
 /* NAV BAR AT THE TOP AND TWO COLUMNS OF CONTENT */
     div#content {
     }

Modified: incubator/roller/branches/roller_3.0/web/themes/basic/Weblog.vm
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/themes/basic/Weblog.vm?rev=429378&r1=429377&r2=429378&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/themes/basic/Weblog.vm (original)
+++ incubator/roller/branches/roller_3.0/web/themes/basic/Weblog.vm Mon Aug  7 09:14:50 2006
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
-    <link rel="stylesheet" type="text/css" href="$url.home/page/css.css" />
+    <link rel="stylesheet" type="text/css" href="$url.home/page/css" />
     #showAutodiscoveryLinks($model.weblog)
     #showCommonJavascript()
     <title>$utils.removeHTML($model.weblog.name) : $model.weblogPage.name</title>

Modified: incubator/roller/branches/roller_3.0/web/themes/brushedmetal/Weblog.vm
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/themes/brushedmetal/Weblog.vm?rev=429378&r1=429377&r2=429378&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/themes/brushedmetal/Weblog.vm (original)
+++ incubator/roller/branches/roller_3.0/web/themes/brushedmetal/Weblog.vm Mon Aug  7 09:14:50
2006
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html lang="en">
 <head>
-    <link rel="stylesheet" type="text/css" href="$url.home/page/css.css" />
+    <link rel="stylesheet" type="text/css" href="$url.home/page/css" />
     #showAutodiscoveryLinks($model.weblog)
     #showCommonJavascript()
    <title>$utils.removeHTML($model.weblog.name) : $model.weblogPage.name</title>



Mime
View raw message