<script type="text/javascript">
    function reset_homework(){
        $("#homework_name").val("");
        $("#homework_publish_time").val("");
        $("#homework_end_time").val("");
        $("#course_id").val($("#option_select").val());
        $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true })%>");
        //homework_description_editor.html("");
        $("#homework_name_span").text("");
        $("#homework_end_time_span").text("");
        $("#homework_end_time_span").text("");
        $("#homework_course_id_span").text("");
        $("#homework_editor").toggle();
    }

    // 点击 checkbox选中引用的资源的时候，保存该资源的id到session里去
    function store_seleted_resource(dom){
        if(dom.attr('checked') == 'checked' ){
            $.get(
                            '<%= store_selected_resource_user_path %>'+'?save=y&res_id='+dom.val()
            )
        }else {
            $.get(
                            '<%= store_selected_resource_user_path %>'+'?save=n&res_id='+dom.val()
            )
        }
    }
</script>
<div class="homepageRightBanner mb10">
  <div class="NewsBannerName">作业</div>
</div>
<div class="cl"></div>

<% if @is_teacher%>
    <!-- 老师身份才可以发布作业 -->
    <div class="HomeWork mb10" nhname='homework_common_form'>
      <% homework = HomeworkCommon.new %>
      <% homework.homework_detail_manual = HomeworkDetailManual.new%>
      <%= labelled_form_for homework,:url => user_new_homework_users_path,:method => "post" do |f| %>
          <div id="HomeWorkCon">
            <%= render :partial => 'users/user_homework_form', :locals => { :homework => homework,:f => f,:edit_mode => false } %>
          </div>
      <% end%>
    </div><!----HomeWork end-->
<% end%>

<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homework_commons,:page => 0,:is_in_course => 0} %>
