<?cs include "header.cs" ?>
<?cs include "macros.cs" ?>

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

 
 <form id="prefs" method="get" action="">
  <?cs each item = mailarc.category.items ?>
  <div class="category_name"><?cs var:item.name ?></div>
  <ul>
  <?cs each subitem = item.items ?>
  <li class="category_li">
  <?cs if subitem.href ?><a  href="<?cs var:subitem.href ?>"><?cs var:subitem.year ?>/<?cs var:subitem.month ?> (<?cs var:subitem.count ?>)</a>
  <?cs else ?><?cs var:subitem.year ?>/<?cs var:subitem.month ?> (<?cs var:subitem.count ?>)
  <?cs /if ?>
  </li>
  <?cs /each ?>
  </ul>
  <?cs /each ?>
<?cs if false ?>
  <hr/>
  <div>
    <input type="checkbox" id="thread" name="thread" value="True"<?cs
    if:mailarc.thread ?> checked="checked"<?cs /if ?> />
   <label for="thread">スレッド</label>
  </div>
  <div class="buttons">
   <input type="submit" value="更新" />
  </div>
<?cs /if ?>
 </form>


  <h2><?cs var:mailarc.name ?>の<?cs var:mailarc.year ?>年<?cs var:mailarc.month ?>月のメール</h2>
 
 <?cs set idx = #0 ?>
 <?cs set group = '' ?>

 <?cs def:mailarc_row(items,depth) ?><?cs if:len(items) >0 ?>
   <ul class="thread_ul"><?cs each item = items ?>
	 <li class="thread_li">
      <a class="thread_subject" href="<?cs var:item.attr.subject.mail_href ?>"><?cs var:item.attr.subject ?></a><br />
      <span class="thread_from"><?cs var:item.attr.from ?></span>
      <span class="thread_senddate"><?cs var:item.attr.senddate ?></span>	 
	  <?cs if:item.items == True?>
       <?cs call:mailarc_row(item.items,depth+1) ?>
	  <?cs /if ?>
	 </li>
   <?cs /each ?></ul>
 <?cs /if ?><?cs /def ?>
<div id="mail_thread">
 <?cs if:mailarc.mode == "list" ?>
 <?cs call:mailarc_row(mailarc.items,0) ?>
 <?cs /if ?>
</div>
 

 <?cs if:mailarc.mode == "delete" ?>

  <h1><?cs var:title ?></h1>
  <form action="<?cs var:mailarc.href ?>" method="post">
   <input type="hidden" name="id" value="<?cs var:mailarc.id ?>" />
   <input type="hidden" name="action" value="delete" />
   <p><strong>このメールを本当に削除してもいいですか?</strong></p>
   <div class="buttons">
    <input type="submit" name="cancel" value="取り消し" />
    <input type="submit" value="削除" />
   </div>
  </form>
 
 <?cs /if?>
 
</div>
<?cs include "footer.cs" ?>
