socialforge/app/views/homework_common/edit.html.erb

64 lines
3.1 KiB
Plaintext

<script type="text/javascript">
<% if @hw_status != 1 %>
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
<% end %>
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 })%>");
//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();
}
function cancel_edit(){
<% if @is_manage.to_i == 1 %>
window.location.href='<%=manage_or_receive_homeworks_user_path(User.current.id) %>';
<% elsif @is_manage.to_i == 2 %>
window.location.href='<%=my_homeworks_user_path(User.current.id) %>';
<% elsif @hw_status == 3 %>
window.location.href='<%=homework_common_index_path(:course => @course.id) %>';
<% elsif @hw_status == 1 %>
window.location.href='<%=user_path(User.current.id) %>';
<% elsif @hw_status == 2 %>
window.location.href='<%=course_path(@course.id) %>';
<% end %>
}
</script>
<div class="homepageRightBanner mb10 <%= (@hw_status == 2 || @hw_status == 3 || @hw_status == 5) ? 'ml10' : '' %>">
<div class="NewsBannerName">编辑作业</div>
</div>
<div class="cl"></div>
<!-- 老师身份才可以发布作业 -->
<div class="HomeWork mb10 ml10" nhname='homework_common_form'>
<% committed_work_count = @homework.student_works.has_committed.count %>
<% stu_pro_count = @homework.student_work_projects.count %>
<% if committed_work_count != 0 %>
<% if @homework.homework_type == 1 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。</p>
<% elsif @homework.homework_type == 2 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和测试集。</p>
<% elsif @homework.homework_type == 3 %>
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和分组设置(可扩大分组范围)。</p>
<% end %>
<% elsif stu_pro_count != 0 && @homework.homework_type == 3 %>
<p class="c_red mb5">已有<%=stu_pro_count %>个学生关联项目,不允许再修改作业类型。</p>
<% end %>
<%= form_for @homework do |f| %>
<input type="text" name="hw_status" class="none" value="<%= @hw_status%>"/>
<input type="text" name="is_manage" class="none" value="<%= @is_manage%>"/>
<div id="HomeWorkCon">
<%= render :partial => 'users/user_homework_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
</div>
<% end%>
</div><!----HomeWork end-->