<%= form('add', context) %>
<table width='100%' align="center" border="0" cellspacing="0" cellpadding="1" rules="none">
<%
  bg = ERbUtil::BGAttr.new
  list = @todo.fetch_hash(@session.username)
%>
<tr align='right'>
<th colspan="4"><small>ToDo: <%= list.size%> items</small></th>
<tr>
<%
  list.each do |item|
    if item['time'] < Time.now + 24 * 60 * 60
      trbg = 'bgcolor="#eeaaaa"'
    else
      trbg = bg.to_s
    end
%>
<tr <%= trbg%>>
<td width="5%"><small><%= item['priority'] %></small></td>
<td width="15%"><%=h item['time'].strftime('%m/%d') %></td>
<td><%=h item['text'] %></td>
<td width="5%">[<%=a('remove', {'key'=>item['key']}, context)%>X</a>]</td>
</tr>
<%
  end
%>
<%
  if @mode == :edit
    trbg = 'bgcolor="#eeeedd"'
%>
<tr <%= trbg%>>
<th colspan="2">Prio.</th>
<td colspan="2"><small><input type="text" name="priority" 
            value="50" size="3"/></small></td>
</tr>
<tr <%= trbg%>>
<th colspan="2">Date</th>
<td colspan="2"><small><input type="text" name="time" size="12"
     value="<%= Time.now.strftime('%Y-%m-%d')%>"/></small></td>
</tr>
<tr <%= trbg%>>
<th colspan="2">Memo</th>
<td colspan="2"><small><input type="text" name="text" size="12"/></small></td>
</tr>
<tr <%= trbg%>>
<td colspan="4" align="right"><small><input type="submit" value="add"/></small></td>
</tr>
<tr><td colspan="4" 
        align='right'><small>[<%=a('browse', {}, context)%>Close</a>]</small></td></tr>
<%
  else
%>
<tr><td colspan="4"
x        align='right'><small>[<%=a('edit', {}, context)%>Add</a>]</small></td></tr>
<%
  end
%>
</table>
</form>