You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2005/07/09 22:49:42 UTC

svn commit: r209964 - in /incubator/roller/trunk: src/org/roller/presentation/website/actions/ThemeEditorAction.java src/org/roller/presentation/website/actions/WebsiteFormAction.java web/website/theme-editor.jsp

Author: agilliland
Date: Sat Jul  9 13:49:41 2005
New Revision: 209964

URL: http://svn.apache.org/viewcvs?rev=209964&view=rev
Log:
Added a little extra debugging + code to ensure the default page id gets properly set when a user is copying down templates for customization.

Removed a check for defaultpageid != defaultdaypageid from WebsiteForm because it was causing a null pointer with websites that don't have any page templates.

Fixed a display bug in theme editor jsp so that the customize options is not showed when custom themes are disabled.


Modified:
    incubator/roller/trunk/src/org/roller/presentation/website/actions/ThemeEditorAction.java
    incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java
    incubator/roller/trunk/web/website/theme-editor.jsp

Modified: incubator/roller/trunk/src/org/roller/presentation/website/actions/ThemeEditorAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/website/actions/ThemeEditorAction.java?rev=209964&r1=209963&r2=209964&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/website/actions/ThemeEditorAction.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/website/actions/ThemeEditorAction.java Sat Jul  9 13:49:41 2005
@@ -350,6 +350,8 @@
     private void saveThemePages(WebsiteData website, Theme theme)
         throws RollerException {
         
+        mLogger.debug("Setting custom templates for website: "+website.getName());
+        
         try {
             UserManager userMgr = RollerFactory.getRoller().getUserManager();
             
@@ -366,11 +368,6 @@
                     // User already has page by that name, so overwrite it.
                     template.setContents(theme_template.getContents());
                     
-                    // make absolute sure that the "Weblog" template is the
-                    // default page ... it's possible for the user to change this :/
-                    if(theme_template.getName().equals("Weblog"))
-                        website.setDefaultPageId(template.getId());
-                    
                 } else {
                     // User does not have page by that name, so create new page.
                     template = new WeblogTemplate( null,
@@ -390,11 +387,14 @@
             
             // if this is the first time someone is customizing a theme then
             // we need to set a default page
-            if(website.getDefaultPageId() == null) {
+            if(website.getDefaultPageId() == null ||
+                    website.getDefaultPageId().equals("dummy")) {
                 // we have to go back to the db to figure out the id
                 WeblogTemplate template = userMgr.getPageByName(website, "Weblog");
-                if(template != null)
+                if(template != null) {
+                    mLogger.debug("Setting default page to "+template.getId());
                     website.setDefaultPageId(template.getId());
+                }
             }
             
             // save our updated website

Modified: incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java?rev=209964&r1=209963&r2=209964&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/website/actions/WebsiteFormAction.java Sat Jul  9 13:49:41 2005
@@ -142,8 +142,10 @@
                     form.setEnableBloggerApi( Boolean.FALSE );
                 }
 
+                /* we don't need this check any longer -- Allen G
                 if(!form.getDefaultPageId().equals(form.getWeblogDayPageId()))
-                {                    
+                {
+                */               
                     WebsiteData wd = umgr.retrieveWebsite(form.getId());
                     wd.save(); // should throw if save not permitted
 
@@ -186,7 +188,8 @@
                 
                     List epages = Arrays.asList(StringUtils.split(
                        StringUtils.deleteWhitespace(editorPages), ","));
-                    request.setAttribute("editorPagesList", epages);                
+                    request.setAttribute("editorPagesList", epages);
+                /*
                 }
                 else
                 {
@@ -195,6 +198,7 @@
                         "CHANGES REJECTED: Cannot set default page template "
                         +"and day template to same template");
                 }
+                */
             }
             else
             {

Modified: incubator/roller/trunk/web/website/theme-editor.jsp
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/web/website/theme-editor.jsp?rev=209964&r1=209963&r2=209964&view=diff
==============================================================================
--- incubator/roller/trunk/web/website/theme-editor.jsp (original)
+++ incubator/roller/trunk/web/website/theme-editor.jsp Sat Jul  9 13:49:41 2005
@@ -4,6 +4,7 @@
 String customTheme = org.roller.pojos.Theme.CUSTOM;
 request.setAttribute("customTheme", customTheme);
 boolean allowCustom = org.roller.config.RollerRuntimeConfig.getBooleanProperty("themes.customtheme.allowed");
+request.setAttribute("allowCustom", new Boolean(allowCustom));
 
 String username = "";
 try {
@@ -44,8 +45,7 @@
                                 tabindex="4" />
                         </c:when>
                         
-                        <c:when test="${currentTheme ne customTheme}">
-                          <c:if test="${allowCustom}">
+                        <c:when test="${(currentTheme ne customTheme) and allowCustom}">
                             If you like you may customize a personal copy of this theme.<br/>
                             <fmt:message key="themeEditor.saveWarning" /><br/>
                             <input type="button" 
@@ -53,7 +53,6 @@
                                 name="customizeButton" 
                                 onclick="this.form.method.value='customize';this.form.submit()"
                                 tabindex="4" />
-                          </c:if>
                         </c:when>
                   </c:choose>	
 		</p>
@@ -113,4 +112,4 @@
     // -->
 </script>
 
-<%@ include file="/theme/footer.jsp"%>
\ No newline at end of file
+<%@ include file="/theme/footer.jsp"%>