<div class="conbox">
  <h2 class="conbox-h2">查重结果</h2>
  <div class="chabox">
    <ul class="chabox-header">
      <li class="chabox-w-500" style = "width:437px" >被查作品</li>
      <li class="chabox-w-500" style = "width:561px" >疑被抄袭作品</li>
      <div class="cl"></div>
    </ul>
    <ul class="chabox-top">
      <li  class="chabox-w-40 " >序号</li>
      <li class="chabox-w-401" >作品名称</li>
      <li>姓名</li>
      <li>学号 </li>
      <li class="chabox-r-line">时间 </li>
      <li class="chabox-w-401">作品名称</li>
      <li>姓名</li>
      <li>学号 </li>
      <li class="chabox-r-line">时间 </li>
      <li >相似度 </li>
      <li >对比 </li>
    </ul>

    <%if @homework.homework_type == 2 %>
        <% @student_works.each_with_index do |student_work,index|%>
        <ul class="chabox-con" id = "chabox-con-<%=student_work.id%>" >
          <li  class="chabox-w-40 chabox-txt-left"  ><%=index+1%></li>
          <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
          <li class="chabox-w-401 chabox-txt-left" style =" text-align:left; text-indent:1em; " ><%=student_work_name%></li>
          <li><%=student_work.user.show_name%></li>
          <li><%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> </li>
          <li class="chabox-r-line"><%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%></li>
          <% if student_work.simi_id.to_i > 0 && @works_hash[student_work.simi_id.to_i] %>
              <% simi_student_work = @works_hash[student_work.simi_id.to_i] %>
              <% simi_student_work_name = simi_student_work.name.nil? || simi_student_work.name.empty? ? simi_student_work.user.show_name + '的作品' : simi_student_work.name%>
              <li class="chabox-w-401 chabox-txt-left" style =" text-align:left; text-indent:1em; " ><%=simi_student_work_name%></li>
              <li><%=simi_student_work.user.show_name%></li>
              <li><%= simi_student_work.user.user_extensions.nil? ? "--" : simi_student_work.user.user_extensions.student_id%></li>
              <li class="chabox-r-line"><%= Time.parse(format_time(simi_student_work.created_at)).strftime("%m-%d %H:%M")%></li>
              <% if student_work.simi_value.to_i >= 90  %>
                  <li style = "color:red" ><%=student_work.simi_value.to_i%>%</li>
              <% else %>
                  <li ><%=student_work.simi_value.to_i%>%</li>
              <% end %>

              <!--@works_hash[student_work.id].description -->
              <!--<li ><a href="javascript:void(0);"  target="_blank" class="cha-btn" onclick = "show_code_compare()">查看</a>-->
              <li >
                <%= link_to("查看", show_comparecode_course_path(:homework_id => @homework.id,:src_id => student_work.id,:dst_id => student_work.simi_id.to_i),:class => "cha-btn",:remote => true ) %>
              </li>
          <%else%>
              <li class="chabox-w-401">--</li>
              <li>--</li>
              <li>--</li>
              <li class="chabox-r-line">--</li>
              <li >--</li>
              <li >  </li>
          <% end %>
        </ul>
        <%end%>
    <%end%>
  </div>
  <div class="cl"></div>
</div>

<script type="text/javascript">
    function show_code_compare() {

//        $("#ajax-modal").html('<%= escape_javascript( render :partial => 'courses/show_compare_code' ,:locals => {:src_code=> 1,:src_name=> 2,:dst_name=> 3, :dst_code=> 4,:language=> 5,})%>');
//        showModal('ajax-modal', '950px');
//        $('#ajax-modal').siblings().remove();
//        $('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal();' style='margin-left: 935px;' class='resourceClose'></a>");
//        $('#ajax-modal').parent().css("top", "20%").css("left", "26.5%").css("position", "absolute");
//        $('#ajax-modal').parent().addClass("resourceUploadPopup");
//        $('#ajax-modal').css("padding-left", "16px").css("padding-bottom", "16px");
//
//        function closeModal() {
//            hideModal($(".contrast-box"));
//        }
    }

</script>