<%=form('add', context) %>
<table width='100%' align="center" border="0" cellspacing="0" cellpadding="1" rules="none">
<%
  bg = ERbUtil::BGAttr.new
%>
<tr align='left' <%=bg%>>
<th width='5%'>&nbsp;</th>
<th width='20%'><small>From:</small></th>
<th><small>Text:</small></th>
</tr>
<%
  fmt = "%m/%d"
  ary = @mbox.fetch_hash(@session.username)
  ary.each do |item|
%>
<tr <%= bg%>>
<td width='5%'><%=a('remove', {'key'=>item['key']}, context)%>×</a></td>
<td width='10%'><%=h item['time'].strftime(fmt)%> <%= item['from']%></td>
<td><%=h item['text'] %></td>
</tr>
<%
  end
%>
<tr <%= bg%>>
<td colspan="3" align='center'><small>[<%= ary.size %>件のメッセージ</a>]</small></td></tr>
</tr>
<%
  if @mode == :edit
%>
<tr align='left' <%=bg%>>
<th>&nbsp;</th><th><small>To:</small></th><th>&nbsp;</th></tr>
<tr <%= bg%>>
<td><input type="submit" value="Send"/></td>
<td><input size='5' type="text" name="to" /></td>
<td><input size='20' type="text" name="text" /></td>
</tr>
<tr <%= bg%>><td colspan="3" 
        align='center'><small>[<%=a('browse', {}, context)%>閉じる</a>]</small></td></tr>
<%
  else
%>
<tr <%= bg%>><td colspan="3"
        align='center'><small>[<%=a('edit', {}, context)%>送信</a>]</small></td></tr>
<%
  end
%>
</table>
</form>