You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by gm...@apache.org on 2014/08/31 00:44:08 UTC

svn commit: r1621546 - in /roller/trunk/app/src/main: java/org/apache/roller/weblogger/ui/struts2/editor/ThemeEdit.java resources/ApplicationResources.properties resources/ApplicationResources_ja_JP.properties webapp/WEB-INF/jsps/editor/ThemeEdit.jsp

Author: gmazza
Date: Sat Aug 30 22:44:07 2014
New Revision: 1621546

URL: http://svn.apache.org/r1621546
Log:
Restored import shared theme into custom template checkbox option, now that I realize its purpose.

Modified:
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/ThemeEdit.java
    roller/trunk/app/src/main/resources/ApplicationResources.properties
    roller/trunk/app/src/main/resources/ApplicationResources_ja_JP.properties
    roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/ThemeEdit.jsp

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/ThemeEdit.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/ThemeEdit.java?rev=1621546&r1=1621545&r2=1621546&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/ThemeEdit.java (original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/ThemeEdit.java Sat Aug 30 22:44:07 2014
@@ -29,7 +29,6 @@ import org.apache.roller.weblogger.busin
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.business.themes.SharedTheme;
 import org.apache.roller.weblogger.business.themes.ThemeManager;
-import org.apache.roller.weblogger.config.WebloggerRuntimeConfig;
 import org.apache.roller.weblogger.pojos.Theme;
 import org.apache.roller.weblogger.pojos.ThemeTemplate;
 import org.apache.roller.weblogger.pojos.ThemeTemplate.ComponentType;
@@ -57,6 +56,9 @@ public class ThemeEdit extends UIAction 
     // the currently selected theme, shared or custom
     private String themeId = null;
 
+    // import a shared theme into the blog's custom templates
+    private boolean importTheme = false;
+
     // a potentially new selected theme
     private String selectedThemeId = null;
 
@@ -81,6 +83,7 @@ public class ThemeEdit extends UIAction 
         if (WeblogTheme.CUSTOM.equals(getActionWeblog().getEditorTheme())) {
             setThemeId(null);
             setSelectedThemeId(null);
+            setImportTheme(false);
         } else {
             setThemeId(getActionWeblog().getTheme().getId());
             setSelectedThemeId(getThemeId());
@@ -121,13 +124,13 @@ public class ThemeEdit extends UIAction 
         if (WeblogTheme.CUSTOM.equals(getThemeType())) {
 
             // do theme import if necessary
-            SharedTheme t;
+            SharedTheme t = null;
 
             try {
                 ThemeManager themeMgr = WebloggerFactory.getWeblogger()
                         .getThemeManager();
-                t = themeMgr.getTheme(getSelectedThemeId());
-                if (!StringUtils.isEmpty(getSelectedThemeId())) {
+                if (importTheme && !StringUtils.isEmpty(selectedThemeId)) {
+                    t = themeMgr.getTheme(selectedThemeId);
                     themeMgr.importTheme(getActionWeblog(), t);
                 }
             } catch (Exception re) {
@@ -151,7 +154,10 @@ public class ThemeEdit extends UIAction 
                     // make sure to flush the page cache so ppl can see the change
                     CacheManager.invalidate(weblog);
 
-                    addMessage("themeEditor.setCustomTheme.success", t.getName());
+                    addMessage("themeEditor.setTheme.success", WeblogTheme.CUSTOM);
+                    if (importTheme && t != null) {
+                        addMessage("themeEditor.setCustomTheme.success", t.getName());
+                    }
                     addMessage("themeEditor.setCustomTheme.instructions");
 
                 } catch (WebloggerException re) {
@@ -277,6 +283,14 @@ public class ThemeEdit extends UIAction 
         this.themeId = theme;
     }
 
+    public boolean isImportTheme() {
+        return importTheme;
+    }
+
+    public void setImportTheme(boolean importTheme) {
+        this.importTheme = importTheme;
+    }
+
     public String getSelectedThemeId() {
         return selectedThemeId;
     }

Modified: roller/trunk/app/src/main/resources/ApplicationResources.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/ApplicationResources.properties?rev=1621546&r1=1621545&r2=1621546&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/ApplicationResources.properties (original)
+++ roller/trunk/app/src/main/resources/ApplicationResources.properties Sat Aug 30 22:44:07 2014
@@ -1285,9 +1285,12 @@ can be used to see how your blog''s main
 themeEditor.importWarning=WARNING: Updating your custom theme may overwrite some of your existing templates.
 themeEditor.importRequired=Since this is the first time you are going to try a \
 custom theme you must first copy templates from an existing theme.
-
+themeEditor.importAndOverwriteTemplates=Also import a theme into my already existing custom templates, overwriting any with the same name.
+themeEditor.importAndOverwriteTemplates.tooltip=You already have custom templates that can be used to render a blog (see Templates tab). \
+  Select this option to import a shared theme's templates, overwriting any of your existing templates that have the same name as the shared theme's\
+  templates.  Leave this unchecked to just switch from a shared to custom theme while retaining your present custom templates.
 themeEditor.setTheme.success=Theme set to {0}
-themeEditor.setCustomTheme.success=Theme set to custom, using templates from {0} theme
+themeEditor.setCustomTheme.success=Shared theme {0} imported into custom templates
 themeEditor.setCustomTheme.instructions=Use the Stylesheet and Templates tabs above to edit your custom theme.
 
 # ---------------------------------------------------------------------- Uploads

Modified: roller/trunk/app/src/main/resources/ApplicationResources_ja_JP.properties
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/resources/ApplicationResources_ja_JP.properties?rev=1621546&r1=1621545&r2=1621546&view=diff
==============================================================================
--- roller/trunk/app/src/main/resources/ApplicationResources_ja_JP.properties (original)
+++ roller/trunk/app/src/main/resources/ApplicationResources_ja_JP.properties Sat Aug 30 22:44:07 2014
@@ -1065,3 +1065,5 @@ at=at
 error.activate.user.missingActivationCode=\u30A2\u30AF\u30C6\u30A3\u30D9\u30FC\u30B7\u30E7\u30F3\u30B3\u30FC\u30C9\u304C\u4E0D\u660E\u3067\u3059
 userRegister.tip.openid.disabled=\u30ED\u30B0\u30A4\u30F3\u306B\u4F7F\u7528\u3057\u3066\u3044\u308B\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u78BA\u8A8D\u7528\u3082\u542B\u3081\u3066\uFF12\u5EA6\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002
 userRegister.tip.identification=\u3053\u306E\u30B5\u30A4\u30C8\u3067\u4F7F\u7528\u3059\u308B\u3042\u306A\u305F\u306E\u540D\u524D\u3001\u304A\u3088\u3073\u8A8D\u8A3C\u306B\u4F7F\u7528\u3059\u308B\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044
+generic.tagline=\u30BF\u30B0\u30E9\u30A4\u30F3
+generic.toggle=\u30C8\u30B0\u30EB

Modified: roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/ThemeEdit.jsp
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/ThemeEdit.jsp?rev=1621546&r1=1621545&r2=1621546&view=diff
==============================================================================
--- roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/ThemeEdit.jsp (original)
+++ roller/trunk/app/src/main/webapp/WEB-INF/jsps/editor/ThemeEdit.jsp Sat Aug 30 22:44:07 2014
@@ -92,15 +92,26 @@ function updateThemeChooser(selected) {
     </div>
 
     <div id="customOptioner" class="optioner" style="display:none;">
-        <s:if test="firstCustomization">
+        <%-- if already custom, an update must mean an import. --%>
+        <s:if test="customTheme">
             <p>
-                <s:text name="themeEditor.importRequired" />
+                <span class="warning"><s:text name="themeEditor.importWarning" /></span>
+                <s:hidden name="importTheme" value="true" />
             </p>
         </s:if>
+        <%-- shared, may be required to do an import if no custom templates present --%>
         <s:else>
-            <p>
-                <span class="warning"><s:text name="themeEditor.importWarning" /></span>
-            </p>
+            <s:if test="firstCustomization">
+                <p>
+                    <s:text name="themeEditor.importRequired" />
+                    <s:hidden name="importTheme" value="true" />
+                </p>
+            </s:if>
+            <s:else>
+                <%-- User has option not just to switch from shared to custom but also override present custom templates --%>
+                <s:checkbox name="importTheme"/> <s:text name="themeEditor.importAndOverwriteTemplates" />
+                    <tags:help key="themeEditor.importAndOverwriteTemplates.tooltip"/>
+            </s:else>
         </s:else>
     </div>