Author: agilliland
Date: Wed Jun  6 15:36:31 2007
New Revision: 544976

URL: http://svn.apache.org/viewvc?view=rev&rev=544976
Log:
make it so that the current custom stylesheet template doesn't show up in 
templates list.  this is to prevent confusion for users by seeing the template 
show up automatically and have the same contents as the stylesheet override 
template.


Modified:
    
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java

Modified: 
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java
URL: 
http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java?view=diff&rev=544976&r1=544975&r2=544976
==============================================================================
--- 
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java
 (original)
+++ 
roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/ui/struts2/editor/Templates.java
 Wed Jun  6 15:36:31 2007
@@ -42,7 +42,7 @@
     private static Log log = LogFactory.getLog(Templates.class);
     
     // list of templates to display
-    private List templates = Collections.EMPTY_LIST;
+    private List<WeblogTemplate> templates = Collections.EMPTY_LIST;
     
     // list of template action types user is allowed to create
     private List availableActions = Collections.EMPTY_LIST;
@@ -69,7 +69,14 @@
         // query for templates list
         try {
             UserManager mgr = RollerFactory.getRoller().getUserManager();
-            setTemplates(mgr.getPages(getActionWeblog()));
+            
+            // get current list of templates, minus custom stylesheet
+            List<WeblogTemplate> pages = mgr.getPages(getActionWeblog());
+            if(getActionWeblog().getTheme().getCustomStylesheet() != null) {
+                pages.remove(mgr.getPageByLink(getActionWeblog(), 
+                        getActionWeblog().getTheme().getCustomStylesheet()));
+            }
+            setTemplates(pages);
             
             // build list of action types that may be added
             List availableActions = new ArrayList();
@@ -83,8 +90,7 @@
                 availableActions.add(WeblogTemplate.ACTION_WEBLOG);
                 availableActions.add(WeblogTemplate.ACTION_TAGSINDEX);
                 
-                List<WeblogTemplate> pages = getTemplates();
-                for(WeblogTemplate tmpPage : pages) {
+                for(WeblogTemplate tmpPage : getTemplates()) {
                     
if(!WeblogTemplate.ACTION_CUSTOM.equals(tmpPage.getAction())) {
                         availableActions.remove(tmpPage.getAction());
                     }
@@ -186,11 +192,11 @@
     }
     
     
-    public List getTemplates() {
+    public List<WeblogTemplate> getTemplates() {
         return templates;
     }
 
-    public void setTemplates(List templates) {
+    public void setTemplates(List<WeblogTemplate> templates) {
         this.templates = templates;
     }
 


Reply via email to