<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="layout.html" />
  <xi:include href="macros.html" />
  <head>
    <title>${_('MailArchive')}</title>
    <link href="${req.href.chrome('mailarchive/css/mailarchive.css')}" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="${req.href.chrome('mailarchive/js/mailarchive.js')}"></script>
    <script type="text/javascript">
      var ajaxmail_base_url = './';
    </script>
  </head>

  <body>

    <div id="content" class="mailarc">

     <form id="prefs" method="get" action="">
       <input type="hidden" name="category" value="${req.args.get('category')}" />
       <div>表示切替</div>
       <fieldset>
         <legend>ソート</legend>
         <ul>
           <li><label><input type="radio" name="reversemode" value="on" checked="${req.args.get('reversemode') == 'on' or None}" />降順</label>
           </li>
           <li><label><input type="radio" name="reversemode" value="off" checked="${req.args.get('reversemode') != 'on' or None}" />昇順</label>
           </li>
         </ul>
       </fieldset>
       <fieldset>
         <legend>ツリー表示</legend>
         <ul>
           <li><label><input type="radio" name="flatmode" value="off" checked="${req.args.get('flatmode') != 'on' or None}" />ON</label>
           </li>
           <li><label><input type="radio" name="flatmode" value="on" checked="${req.args.get('flatmode') == 'on' or None}"  />OFF</label>
           </li>
         </ul>
       </fieldset>
       <div class="buttons">
         <input type="submit" name="update" value="更新"/>
       </div>
     </form>
    
     <form py:if="len(mls) > 0" id="prefs" method="get" action="">
       <py:for each="ml in mls">
       <div class="category_name">$ml.name</div>
       <ul>
       <py:for each="subitem in ml.yearmonths">
         <li class="category_li">
         <py:choose test="subitem.href">
           <py:when test="">
             <a href="${subitem.href + '&amp;reversemode='}">$subitem.year/$subitem.month ($subitem.count)</a>
           </py:when>
           <py:otherwise>
             $subitem.year/$subitem.month ($subitem.count)
           </py:otherwise>
         </py:choose>
         </li>
       </py:for>
       </ul>
       </py:for>
     </form>

     <h2 py:if="len(mails)>0">
       $nameの$year年$month月のメール <span class="numresults" py:if="page_results">(${page_results.displayed_items()})</span>
     </h2>
     <h2 py:if="len(mails)==0">
       参照可能なメールはありません。
     </h2>
 
<xi:include py:with="paginator = page_results" href="page_index.html" />

    <xi:include href="mail_thread.html" />
    
    <div py:if="len(mails)>0" id="mail_thread_${id}">
      <py:for each="mail in mails">
        ${show_thread(mail, cached_mails, highlight_ids=highlight_ids, flatmode=flatmode)}
      </py:for>
    </div>

<xi:include py:with="paginator = page_results" href="page_index.html" />

      <div id="help">
      </div>

    </div>
  </body>
</html>


