<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
Copyright 2004-2005 The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<!-- Content Stylesheet for Site -->

    ## Defined variables
    #set ($bodybg = "#ffffff")
    #set ($bodyfg = "#000000")
    #set ($bodylink = "#525D76")

    #set ($titlebg = "#FFFFFF")
    #set ($titlefg = "#2222AA")

##    #set ($bannerbg = "#525D76")
    #set ($bannerbg = "#FFFFFF")
    #set ($bannerfg = "#2222AA")

    #set ($subbannerbg = "#828DA6")
    #set ($subbannerfg = "#ffffff")
    #set ($tablethbg = "#039acc")
    #set ($tabletdbg = "#a0ddf0")
    
<!-- start the processing -->
#document()
<!-- end the processing -->

## This is where the macro's live

#macro ( projectanchor $name $value )
#if ($value.startsWith("http://"))
    <a href="$value">$name</a>
## #elseif ($value.startsWith("/site")) 
##    <a href="http://logging.apache.org/site/$value">$name</a> 
#else
    <a href="$relativePath$value">$name</a>
#end
#end

#macro ( metaauthor $author $email )
            <meta name="author" value="$author">
            <meta name="email" value="$email">
#end

#macro ( image $value )
#if ($value.getAttributeValue("width"))
#set ($width=$value.getAttributeValue("width"))
#end
#if ($value.getAttributeValue("height"))
#set ($height=$value.getAttributeValue("height"))
#end
#if ($value.getAttributeValue("align"))
#set ($align=$value.getAttributeValue("align"))
#end
<img src="$relativePath$value.getAttributeValue("src")" width="$!width" height="$!height" align="$!align">
#end

#macro ( old_source $value )
    <div align="left">
    <table cellspacing="4" cellpadding="0" border="0">
    <tr>
      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
    </tr>
    <tr>
      <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      <td bgcolor="#ffffff"><pre>$escape.getText($value.getText())</pre></td>
      <td bgcolor="#023264" width="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
    </tr>
    <tr>
      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      <td bgcolor="#023264" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
      <td bgcolor="#023264" width="1" height="1"><img src="/images/void.gif" width="1" height="1" vspace="0" hspace="0" border="0"/></td>
    </tr>
    </table>
    </div>
#end

#macro ( source $value )

    <div class="syntax"><pre class="code">$escape.getText($value.getText())</pre></div>

#end

## ===================================
##          titleSection macro
## ===================================
#macro ( titleSection $titleSection)
  <font size="+2" color="$titlefg"><b>$titleSection.getAttributeValue("name")</b></font>
#end

## ================================
##          section macro
## ================================
#macro ( section $section $level )
  #if($section.getAttributeValue("id"))
  <h${level}><a id="$section.getAttributeValue("id")"></a>$section.getAttributeValue("name")</h${level}>
  #else
  <h${level}><a id="HC-$section.hashCode()"></a>$section.getAttributeValue("name")</h${level}>
  #end
  <div class="i1">
        #foreach ( $item in $section.getChildren() )
            #if ($items.getName().equals("img"))
                #image ($item)
            #elseif ($item.getName().equals("source"))
                #source ($item)
            #elseif ($item.getName().equals("table"))
                #table ($item)
            #elseif ($item.getName().equals("section"))
			    #set ($nextLevel = $level + 1)
                #section ($item $nextLevel )
			    #set ($nextLevel = $nextLevel - 1)
            #elseif ($item.getName().equals("sectionMenu"))
			    #set ($nextLevel = $level + 1)
                #sectionMenu1 ($item $item.getParent() $nextLevel)
			    #set ($nextLevel = $nextLevel - 1)
            #else
                $item
            #end
        #end
  </div>
#end

## ================================
##          sectionMenu1 macro
## ================================
#macro ( sectionMenu1 $sectionMenu $section $level )
	#if($sectionMenu.getAttributeValue("name"))
		<h${level}>$sectionMenu.getAttributeValue("name")</h${level}>
		<div class="i1">
			#foreach ( $items in $section.getChildren() )
				#if ($items.getName().equals("section"))
					#sectionMenu2 ($items )
				#end
			#end
		</div>
	#else
		#foreach ( $items in $section.getChildren() )
			#if ($items.getName().equals("section"))
				#sectionMenu2 ($items )
			#end
		#end
	#end
#end

## ================================
##          sectionMenu2 macro
## ================================
#macro ( sectionMenu2 $section )
  #if ($section.getAttributeValue("id"))
  <a href="#$section.getAttributeValue("id")">$section.getAttributeValue("name")</a><br/>
  #else
  <a href="#HC-$section.hashCode()">$section.getAttributeValue("name")</a><br/>
  #end
  <div class="i1">
        #foreach ( $items in $section.getChildren() )
            #if ($items.getName().equals("section"))
                #sectionMenu2 ($items )
            #end
        #end
  </div>
#end

## ===================================
##  make navigation bar
## ===================================

#macro ( makeNavigationBar )
  <!-- ============================================================ -->
  <div class="leftcol">
    #set ($menus = $project.getChild("body").getChildren("menu"))
    #foreach ( $menu in $menus )
       <div class="menu_header">$menu.getAttributeValue("name")</div>
       #foreach ($item in $menu.getChildren() )
       	 #set ($name = $item.getAttributeValue("name"))
       	 <div class="menu_item">#projectanchor($name $item.getAttributeValue("href"))</div>
       #end  
    #end
  </div> 
   
#end

## ====================================
##      getProjectImage
## ====================================
#macro (getProjectImage)
   ##<div class="banner">
   ##<table class="banner" width="100%" border="0">
   <table class="banner" border="0">
     <tr>
       <td valign="top">
         <a href="http://logging.apache.org/">
           <img src="http://logging.apache.org/images/ls-logo.jpg" border="0"/>
         </a>
       </td>
       <td align="right">
           #if ($project.getChild("logo"))
             #set ( $logoString = $project.getChild("logo").getAttributeValue("href") )
             #if ( $logoString.startsWith("/") )
     	       <a href="$project.getAttributeValue("href")">
      	         <img src="$relativePath$logoString" 
      	           alt="$project.getChild("logo").getText()" border="0"/>
      	       </a>
             #else
      	       <a href="$project.getAttributeValue("href")">
                 <img src="$relativePath/$logoString" alt="$project.getChild("logo").getText()" border="0"/>
      	       </a>
             #end
           #end  
       </td>
     </tr>
   </table>
   ##</div>
#end

#macro (printMeta $metaElement)
<meta #set ($attribs = $metaElement.getAttributes())
#foreach ($a in $attribs) $a.getName()="$a.getValue()" #end />
#end

#macro (messages $root)
  #foreach ( $m in $root.getChild("body").getChildren() )
    #if ($m.getName().equals("message"))
      <div class="big">
        <a name="$m.getAttributeValue('ref')">
         <table>
            <tr>
             <td valign="top"><b>Message:</b></td>
             <td class="msg_title">$m.getChild("title").getContent()</td>
            </tr>
         </table> 
        </a>
      </div>
      <div class="msg_meaning">
        $m.getChild("explanation").getContent()
      </div>
    #end
  #end
#end

#macro (document)
    #set ($properties =  $root.getChild("properties") )
    <!-- ====================================================================== -->
    <!-- GENERATED FILE, DO NOT EDIT, EDIT THE XML FILE IN xdocs INSTEAD! -->
    <!-- Main Page Section -->
    <!-- ====================================================================== -->
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

            #set ($authors = $root.getChild("properties").getChildren("author"))
            #foreach ( $au in $authors )
                #metaauthor ( $au.getText() $au.getAttributeValue("email") )
            #end

           #set ($metas = $root.getChildren("meta"))

            ##    Parse meta directives such as
            ##    <meta name="keyword" content="jakarta, java"/>
            #foreach ($meta in $metas) #printMeta($meta) #end

            ##    Support for <base> tags.
            #if ($root.getChild("properties").getChild("base"))
              #set ($url = $root.getChild("properties").getChild("base").getAttributeValue("href"))
              <base href="$url"/>
            #end
 
            <link href="$relativePath/css/site.css" rel="stylesheet" type="text/css"/>
            
			#foreach ( $cssItem in $project.getChildren("css") )
				<link href="$relativePath${cssItem.getAttributeValue("href")}" rel="stylesheet" type="text/css"/>
			#end

            <title>$project.getChild("title").getText() - $root.getChild("properties").getChild("title").getText()</title>
        </head>

        <body bgcolor="$bodybg" text="$bodyfg" link="$bodylink">        
           <!-- START Header table --> 
##           <table border="0" cellspacing="0" width="100%">
##                <!-- TOP IMAGE -->
##                <tr>
                    #getProjectImage()
##                </tr>
##            </table>
           <!-- END Header table --> 


	   <div class="centercol">
        ##     <hr noshade="" size="1"/>

           <!-- START main table --> 
##            <table id="main" border="0" width="100%" cellspacing="2" cellpadding="0">
##                <tr><td colspan="2">
##                    <hr noshade="" size="1"/>
##                </td></tr>
                
##                <tr>
##                    <!-- LEFT SIDE NAVIGATION -->
##                    <td id="navbar" valign="top" align="left" width="1">
##                    #makeNavigationBar()
##                    </td>
##                    <td id="mainContents" align="left" valign="top" width="*">

	               #foreach ( $item in $root.getChild("body").getChildren() )
                         #if ($item.getName().equals("img"))
                           #image ($item)
                         #elseif ($item.getName().equals("section"))
                           #section ($item 1)
                         #elseif ($item.getName().equals("source"))
                           #source ($item)
                         #elseif ($item.getName().equals("table"))
                           #table ($item)
                         #elseif ($item.getName().equals("sectionMenu"))
                           #sectionMenu1 ($item $item.getParent() 1)
                         #else
                          $item
                         #end 
                       #end

##                    #if ($root.getChild("body").getChild("titleSection"))
##                      #set ($titleSection = $root.getChild("body").getChild("titleSection"))
##                      #titleSection($titleSection)
##                    #end
##                    </td>
##                </tr>


      #messages ($root)	
             
                <!-- FOOTER -->
<p>&nbsp;</p>

##                <tr><td colspan="2">
##                    <hr noshade="" size="1"/>
##                </td></tr>
##                <tr><td colspan="2">
                    <div align="center"><font color="$bodylink" size="-1"><em>
                    Copyright &#169; 
		    #if($root.getChild("properties").getChild("copyright").getAttributeValue("year"))
		    	${root.getChild("properties").getChild("copyright").getAttributeValue("year")},
		    #elseif($project.getChild("copyright").getAttributeValue("year"))
			${project.getChild("copyright").getAttributeValue("year")},
		    #else
		    	1999-2005,
		    #end
		    #if($root.getChild("properties").getChild("copyright").getAttributeValue("holder"))
		    	${root.getChild("properties").getChild("copyright").getAttributeValue("holder")}
		    #elseif($project.getChild("copyright").getAttributeValue("holder"))
			${project.getChild("copyright").getAttributeValue("holder")}
		    #else
		    	Apache Software Foundation
		    #end
                    </em></font></div>
 ##               </td></tr>
 ##           </table>
           <!-- END main table --> 

           </div>

           <!-- LEFT SIDE NAVIGATION -->
           #makeNavigationBar()

        </body>
    </html>
#end





