<div class="fl" style="padding-bottom:10px; width:720px;">
  <span class="c_dark f14 fb fl mr15">
      作品
      <font class="f12 c_red">
        (<%= @student_work_count%>人已交)
      </font>
    <% my_work = @homework.student_works.where("user_id = #{User.current.id}").first %>
    <% if !@is_teacher && my_work.nil? && User.current.member_of_course?(@course) %>
       <span class="f12 c_red">您尚未提交作品</span>
        <%=link_to "提交作品",  new_student_work_url_without_domain(@homework.id),:class => 'blueCir ml5 f12' %>
    <% elsif !@is_teacher && my_work &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
       <span class="f12 c_red">您已提交且不可再修改，因为截止日期已过</span>
    <% elsif !@is_teacher && my_work &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
       <span class="f12 c_red">您已提交，您还可以修改</span>
    <% end %>
  </span>
  <%if @is_teacher || @homework.homework_detail_manual.comment_status == 3 || @homework.is_open == 1%>
      <div class="hworkSearchBox mr15">
        <input type="text" id="course_student_name" value="<%= @name%>" placeholder="姓名、学号、邮箱" class="hworkSearchInput" onkeypress="SearchByName('<%= student_work_index_path(:homework => @homework.id)%>',event);"/>
        <a class="hworkSearchIcon" id="search_in_student_work" onclick="SearchByName_1('<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)"></a>
      </div>
      <%= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit fl mr20"}) unless course_group_list(@course).empty?  %>
      <%if @homework.homework_type == 2 && @is_teacher %>
          <%= link_to "代码查重", work_canrepeat_student_work_index_path(homework:@homework.id, course_id:@course.id), class: 'BlueCirBtn fl',:remote => true %>
      <% end %>
  <% end%>
  <span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" onclick="show_or_hide_info();" style="display: none">[ 显示作业信息 ]</a> </span>
</div>
<div class="cl"></div>

<div class="fl">
  <% if @is_evaluation && !@stundet_works.empty?%>
      <%= render :partial => "evaluation_title"%>
  <% else%>
      <%= render :partial => "evaluation_un_title"%>
  <% end%>
</div>
<div class="cl"></div>

<script type="text/javascript">
  $(function(){
      if($("#homework_info_hidden").is(":hidden"))
      {
          $("#homework_info_show").show();
      }
      <% if !@is_evaluation && (!@is_teacher || params[:show_work_id].present?) || @message_student_work_id %>
          <% if @message_student_work_id %>
            <% work = @homework.student_works.where("id =?", @message_student_work_id).first %>
          <% else %>
            <% work= params[:show_work_id].nil? ? @homework.student_works.where("user_id = ?",User.current.id).first : StudentWork.find(params[:show_work_id]) %>
          <% end %>
          <% unless work.nil? %>
              location.hash = "<%=work.id %>";
              <% if @homework.homework_type == 2 %>
                  $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");

                  var program_name = "text/x-csrc";
                  var language = <%= @homework.language %>;
                  if (language == 1) {
                      program_name = 'text/x-csrc';
                  } else if(language==2){
                      program_name = 'text/x-c++src';
                  }else if(language==3){
                      program_name = 'text/x-cython';
                  } else if(language==4){
                      program_name = 'text/x-java';
                  }
                  var editor = CodeMirror(document.getElementById("work-code_<%= work.id%>"), {
                              mode: {name: program_name,
                                  version: 2,
                                  singleLineStringErrors: false},
                              lineNumbers: true,
                              indentUnit: 2,
                              matchBrackets: true,
                              readOnly: true,
                              value: $("#work-src_<%= work.id%>").text()
                          });
              <% elsif @homework.homework_type == 1 %>
                  $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
              <% elsif @homework.homework_type == 3 %>
                  <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
                  <% if pro && pro.student_work_id == work.id %>
                      $("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc"),:is_focus => @is_focus}) %>");
                  <% end %>
              <% end %>
            $('#score_<%= work.id%>').peSlider({range: 'min'});
          <% end %>
      <% end %>
  });

</script>