<table width='100%' align="center" border="0" cellspacing="0" cellpadding="1" rules="none">
<%
  bg = ERbUtil::BGAttr.new
  list = @paper.list_by_commentator(@session.username, true)
%>
<tr bgcolor='#eeaaaa'><th colspan='4' align='center'>コメント待ち</th></tr>
<tr align='left' <%=bg%>>
<th width="10%">だれ</th>
<th width="10%">いつ</th>
<th>コメント</th>
<th width="10%" align="right"><small><%= list.size%> items</small></th>
<tr>
<tr>
<%
  list.each do |item|
    trbg = bg.to_s
%>
<tr <%= trbg%>>
<td>1. <%=h item['owner'] %></td>
<td><%=h item['time'].strftime('%m/%d') %></td>
<td colspan="2"><small><%=h item['text'] %></small></td>
</tr>
<%
    i = 1
    item['comment'].each do |c|
      i += 1
%>
<tr <%= trbg%>>
<td><%=i%>. <%=h c['who'] %></td>
<td><%=h c['time'].strftime('%m/%d') %></td>
<td><small><%=h c['text'] %></small></td>
<td align='right'><small><%= c['succ'] ? "OK" : "NG" %></small></td>
</tr>
<%
    end
%>
<%= form('comment', context) %>
<tr <%= trbg%>>
<input type="hidden" name="key" value="<%=h item['key'] %>" />
<td><%=i+1%>. <%=h @session.username %></td>
<td><small>
<input type="radio" name="status" value="OK" checked="checked" />OK
<input type="radio" name="status" value="NG" />NG
</small></td>
<td><small><input type="text" name="text" size="80" /></small></td>
<td align='right'><small><input type="submit" value="comment" /></small></td>
</tr>
</form>
<%
  end
%>
</table>
<table width='100%' align="center" border="0" cellspacing="0" cellpadding="1" rules="none">
<%
  bg = ERbUtil::BGAttr.new
  list = @paper.list_by_owner(@session.username, true)
%>
<tr bgcolor='#eeaaaa'><th colspan='4' align='center'>自分の回覧</th></tr>
<tr align='left' <%=bg%>>
<th width="10%">だれ</th>
<th width="10%">いつ</th>
<th>コメント</th>
<th width="10%" align="right"><small><%= list.size%> items</small></th>
<tr>
<%
  list.each do |item|
    trbg = bg.to_s
%>
<tr <%= trbg%>>
<td>1. <%=h @session.username%></td>
<td><%=h item['time'].strftime('%m/%d') %></td>
<td><small><%=h item['text'] %></small></td>
<td align='right'>[<%=a('remove', {'key'=>item['key']}, context)%>X</a>]</td>
</tr>
<%
    i = 1
    item['comment'].each do |c|
      i += 1
%>
<tr <%= trbg%>>
<td><%=i%>. <%=h c['who'] %></td>
<td><%=h c['time'].strftime('%m/%d') %></td>
<td><small><%=h c['text'] %></small></td>
<td align='right'><small><%= c['succ'] ? "OK" : "NG" %></small></td>
</tr>
<%
    end
    item['member'].each do |m|
      i += 1
%>
<tr <%= trbg%>>
<td><%=i%>. <%=h m%></td>
<td>-</td>
<td><small>-</small></td>
<td align='right'><small>-</small></td>
</tr>
<%
    end
  end

  if @mode == :edit
%>
<tr <%= bg%>>
<%= form('add') %>
<td colspan="2"><small><input type="text" name="commentator" value="foo bar" /></small></td>
<td><small><input type="text" name="text" size="80" /></small></td>
<td align='right'><input type="submit" value="add" /></td>
</form>
</tr>
<tr <%= bg%>><td colspan="4" align='right'>
<small>[<%=a('browse', {}, context)%>Close</a>]</small></td></tr>
<%
  else
%>
<tr <%= bg%>><td colspan="4" align='right'>
<small>[<%=a('edit', {}, context)%>Add</a>]</small></td></tr>
<%
  end
%>
</table>
</form>
