<% content_for :header_tags do %>
    <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'%>
    <%= javascript_include_tag 'homework','baiduTemplate' %>
    <script type="text/javascript">
      $(function(){
        $("#BluePopupBox a.BlueCirBtn").click();
      });
    </script>
<% end %>

<div class="HomeWorkCon">
  <div>
    <input  type="text" name="homework_common[name]" id="homework_name" class="InputBox  w701" maxlength="255" onfocus="$('#homework_editor').show()" onkeyup="regex_homework_name();" placeholder="发布作业，请先输入作业标题" value="<%= homework.name%>" >
    <p id="homework_name_span" class="c_red mt5"></p>
  </div>
  <div class="cl"></div>

  <div class=" mt10">
    <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true) unless edit_mode%>
    <div class="calendar_div fl">
      <input  type="text" name="homework_common[end_time]" id="homework_end_time" placeholder="截止日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= homework.end_time%>"  >
      <%= calendar_for('homework_end_time')%>
    </div>
  </div>
  <div class="cl"></div>
  <p id="homework_end_time_span" class="c_red mt5"></p>
  <div class="cl"></div>
  <div id="homework_editor" style="display: <%= edit_mode ? 'block':'none'%>">
    <div class="mt10">
      <% if edit_mode %>
          <%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON %>
      <% else %>
          <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
          <%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px" %>
      <% end %>
    </div>
    <div class="cl"></div>

    <div class="mt10 <%= defined?(select_course) ? 'none' : ''%>">
      <%= select_tag :course_id, options_for_select(get_as_teacher_courses(User.current), homework.course_id), {:class => "InputBox w709",:value => "请选择发布作业的课程"} %>
    </div>
    <p id="homework_course_id_span" class="c_red mt5"></p>
    <div class="cl"></div>

    <div id="homework_attachments">
      <!-- 编辑作业 && 作业类型为匿评作业   时没有编程选项-->
      <%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type == 1)} %>
    </div>


    <div class="mt5">
      <% if edit_mode %>
          <a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_homework('edit_homework_common_<%= homework.id%>');">确定</a>
          <span class="fr mr10 mt3">或</span>
          <%= link_to "取消",user_homeworks_user_path(User.current.id),:class => "fr mr10 mt3"%>
      <% else %>
          <a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_homework('new_homework_common');">发送</a>
          <span class="fr mr10 mt3">或</span>
          <a href="javascript:void(0);" class=" fr mr10 mt3" onclick="reset_homework();">取消</a>
      <% end %>
      <div class="cl"></div>
    </div>

    <input type="hidden" name="homework_type" value="<%= edit_mode ? homework.homework_type : 1 %>">

  </div>
</div>
<div class="cl"></div>

<script id="t:test-answer-list" type="text/html">
  <div class="mt10">
    <textarea class="InputBox  W320 fl mr10" placeholder="测试输入" name="program[input][]"></textarea><textarea class="InputBox  W320  fl mr5" placeholder="测试输出" name="program[output][]"></textarea>
    <a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
    <a href="javascript:void(0);" class=" fl icon_remove" title="删除测试组"></a>
    <div class="cl"></div>
  </div>
</script>

<script type="text/html" id="t:program-input-list">
  <div class="program-input">
    <input type="hidden" name="language_type" value="<!= language_type !>" />
    <! for(var i=0; i< input_groups.length; ++i) { !>
        <input  name="program[input][]" type="hidden" value="<!= input_groups[i].input !>" />
        <input  name="program[output][]" type="hidden" value="<!= input_groups[i].output !>" />
    <! } !>
  </div>
</script>

  
<div class="BluePopupBox" id="BluePopupBox" style="display:none">
  <%= render :partial => 'users/user_programing_attr', :locals => {:edit_mode => edit_mode, :homework=>homework} %>
</div><!----BluePopupBox end-->
