[opencms-dev] CmsJspNavElement and getCmsObject

Christoph P. Kukulies kuku at physik.rwth-aachen.de
Fri Mar 31 09:40:41 CEST 2006


I'm looping through the site and want to build a kind of
sitemap tree , but what is listed in the list should be controlled
by a property that is applied to each item (file or folder) in the tree.

I chose the following method to get the navigation tree:
List list =
    builder.getSiteNavigation("/"+cms.property("locale","search")+"/",-1);
    Iterator it = list.iterator();

   while(it.hasNext()){
             String s="";
             out.println("<br>");
             CmsJspNavElement ne = (CmsJspNavElement)it.next();
             if(!ne.getResourceName().endsWith(".htm")){ // Hack
                  CmsObject no = ((CmsJspActionElement)ne).getCmsObject();
                  List items = no.readResources(filename,CmsResourceFilter.ALL);
              } else {
                  List items = null;
              } 
              java.util.Iterator nt = items.iterator();
      for(int i=0; i< ne.getNavTreeLevel();i++)
         s=s+"-";
      out.println(s + ne.getNavText() + ne.getLocale() + ne.getFileName() +
     "Resourcename:" + ne.getResourceName());
   
   }

The above is full of bugs and bad programming style, but I hope you get the
idea from this.

When I arrive at a navelement, that is a folder, I want to enumerate all
files in that folder.

My problem is to get the CmsObject in the moment when I arrive at 
a CmsJspNavElement (that's what I have in the list), to apply the 
readResources() method.

Hope someone could give me the right tip.


--
Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de



More information about the opencms-dev mailing list