Changeset 6125

Show
Ignore:
Timestamp:
01/27/12 17:19:20 (4 months ago)
Author:
mtld
Message:

pass custom sitemap attributes to view

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pustefix-core/src/main/java/de/schlund/pfixcore/workflow/SiteMap.java

    r6090 r6125  
    4141import org.w3c.dom.Document; 
    4242import org.w3c.dom.Element; 
     43import org.w3c.dom.NamedNodeMap; 
     44import org.w3c.dom.Node; 
    4345import org.xml.sax.InputSource; 
    4446import org.xml.sax.SAXException; 
     
    179181            page.internal = Boolean.valueOf(internal); 
    180182        } 
     183        NamedNodeMap map = pageElem.getAttributes(); 
     184        if(map != null) { 
     185            for(int i=0; i<map.getLength(); i++) { 
     186                Node attrNode = map.item(i); 
     187                String attrName = attrNode.getNodeName(); 
     188                if(!("name".equals(attrName)||("internal").equals(attrName))) { 
     189                    page.customAttributes.put(attrName, attrNode.getNodeValue()); 
     190                } 
     191            } 
     192        } 
    181193        pageNameToPage.put(page.name, page); 
    182194        String alias = pageElem.getAttribute("alias").trim(); 
     
    231243        Element elem = parent.getOwnerDocument().createElement("page"); 
    232244        elem.setAttribute("name", page.name); 
     245        Map<String, String> cusAttrs = page.customAttributes; 
     246        Iterator<String> it = cusAttrs.keySet().iterator(); 
     247        while(it.hasNext()) { 
     248            String attrName = it.next(); 
     249            String attrVal = cusAttrs.get(attrName); 
     250            elem.setAttribute(attrName, attrVal); 
     251        } 
    233252        String alias = getAlias(page.name, lang); 
    234253        if(!page.name.equals(alias)) elem.setAttribute("alias", alias);