<script>
  function submit_homework_user()
  {
      $(".edit_user").submit();
  }
</script>

<%= error_messages_for 'member' %>
<div style="float:left; width:60%;padding-left: 10px;padding-right: 10px"
     xmlns="http://www.w3.org/1999/html" id = "homework_of_users">
  <table class="list members" style="width: 100%">
    <thead>
    <tr>
      <th>
        <%= l(:label_user) %>
      </th>
      <th>
        <%= l(:label_role_plural) %>
      </th>
      <th style="width:10%"></th>
    </tr>
    </thead>
    <tbody>
        <!-- 发布人员不能被删除，将发布人员放在第一位 -->
        <tr id="member-<%= homework.user.id %>" class="<%= cycle 'odd', 'even' %> member" style="text-align: center">
          <td style="width: 40%"><%= link_to_user homework.user %></td>
          <td style="text-align: center;width: 50%"> 发布人员 </td>
          <td></td>
        </tr>
        <% hoemwork_users.each do |user| %>
            <tr id="member-<%= user.id %>" class="<%= cycle 'odd', 'even' %> member" style="text-align: center">
              <% if homework.user != user %>
                  <td style="width: 40%">
                    <%= link_to_user user %>
                  </td>
                  <td style="text-align: center;width: 50%">
                    参与人员
                  </td>
                  <td>
                    <%= link_to l(:button_delete),destory_homework_users_homework_attach_path(:user_id=>user),:remote => true, :method => :post, :confirm => l(:label_delete_confirm)  %>
                  </td>
              <% end %>
            </tr>
        <% end %>
    </tbody>
  </table>
</div>

<div class="splitcontentright" style="width: 37%">
  <%= form_for(hoemwork_users, {:url => add_homework_users_homework_attach_path(homework), :remote => true, :method => :post}) do |f| %>
    <fieldset style=" border:none; margin-top:10px;">
        <legend style=" font-weight:bold; color:#15bccf;">
          <%= l(:label_member_new) %>
        </legend>
        <p style="padding-left: 20px;">
          <%= label_tag "principal_search", l(:label_principal_search) %>
          <%= text_field_tag 'principal_search', nil ,{:class => "N_search",:style => "width:50%;"}%>
        </p>
        <%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript get_homework_member_list_homework_attach_index_path(:q => params[:q], :bid_id => params[:id]||homework, :format => 'js') }')" %>
        <div id="principals_for_new_member" style="padding-left: 20px;">
          <%= render_new_members_for_homework(members) %>
        </div>
        <p style="padding-left: 20px;">
          <a href="javascript:" class="tijiao"  id='member-add-submit' onclick="submit_homework_user();">
            <%= l(:button_add)  %>
          </a>
        </p>
    </fieldset>
  <% end %>
</div>
