Author: ssmiweve
Date: 2008-10-21 14:27:49 +0200 (Tue, 21 Oct 2008)
New Revision: 6884

Modified:
   
trunk/view-config-spi/src/main/java/no/sesat/search/view/SearchTabFactory.java
Log:
bug where _only_ the current site and parent site where searched for a tab.
 all sites in the ancestory are now searched.

Modified: 
trunk/view-config-spi/src/main/java/no/sesat/search/view/SearchTabFactory.java
===================================================================
--- 
trunk/view-config-spi/src/main/java/no/sesat/search/view/SearchTabFactory.java  
    2008-10-20 19:51:02 UTC (rev 6883)
+++ 
trunk/view-config-spi/src/main/java/no/sesat/search/view/SearchTabFactory.java  
    2008-10-21 12:27:49 UTC (rev 6884)
@@ -179,20 +179,18 @@
         LOG.trace(tabsByName);
 
         SearchTab tab = getTabImpl(id);
-        if(null == tab && null != context.getSite().getParent()){
+        Site site = context.getSite().getParent();
+        while(null == tab && null != site){
             // not found in this site's views.xml. look in parent's site.
             final SearchTabFactory factory = instanceOf(ContextWrapper.wrap(
                     Context.class,
-                    new SiteContext(){
-                        public Site getSite(){
-                            return context.getSite().getParent();
-                        }
-                    },
+                    site.getSiteContext(),
                     context
                 ));
             tab = factory.getTabByName(id);
-
-        }else{
+            site = site.getParent();
+        }
+        if(null != tab){
             LOG.trace("found tab for " + id + " against SearchTabFactory for " 
+ context.getSite());
         }
 
@@ -210,20 +208,18 @@
         LOG.trace("getTabByKey(" + key + ')');
 
         SearchTab tab = getTabByKeyImpl(key);
-        if(null == tab && null != context.getSite().getParent()){
+        Site site = context.getSite().getParent();
+        while(null == tab && null != site){
             // not found in this site's views.xml. look in parent's site.
             final SearchTabFactory factory = instanceOf(ContextWrapper.wrap(
                     Context.class,
-                    new SiteContext(){
-                        public Site getSite(){
-                            return context.getSite().getParent();
-                        }
-                    },
+                    site.getSiteContext(),
                     context
                 ));
             tab = factory.getTabByKeyImpl(key);
-
-        }else{
+            site = site.getParent();
+        }
+        if(null != tab){
             LOG.trace("found tab for " + key + " against SearchTabFactory for 
" + context.getSite());
         }
 

_______________________________________________
Kernel-commits mailing list
[email protected]
http://sesat.no/mailman/listinfo/kernel-commits

Reply via email to