From 58c1625b63591265b9e6879f65f17dcd7c66a862 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Sep 2017 11:03:49 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E8=BA=AB=E4=BB=BD=E4=B8=BA=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=EF=BC=8C=E5=9C=A8=E5=B8=96=E5=AD=90=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=AF=B9=E9=9D=9E=E8=87=AA=E5=B7=B1=E5=8F=91=E5=B8=83=E7=9A=84?= =?UTF-8?q?=E5=B8=96=E5=AD=90=E5=BA=94=E8=AF=A5=E5=8F=AA=E6=9C=89=E5=8F=91?= =?UTF-8?q?=E9=80=81=E6=93=8D=E4=BD=9C=EF=BC=8C=E5=AF=B9=E8=87=AA=E5=B7=B1?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E7=9A=84=E5=B8=96=E5=AD=90=E5=BA=94=E8=AF=A5?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=BD=AE=E9=A1=B6=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/messages/_course_show.html.erb | 10 ++++------ app/views/users/_course_boardlist.html.erb | 14 +++++++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb index 2dda26d3b..d3493ee30 100644 --- a/app/views/messages/_course_show.html.erb +++ b/app/views/messages/_course_show.html.erb @@ -33,15 +33,13 @@ <% if User.current.logged? %>

- <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) || User.current == @topic.author %> - + + <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) %> + <% end %> - <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) || User.current == @topic.author %> - <% end %> - <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) %> - + <% end %>

<% end %> diff --git a/app/views/users/_course_boardlist.html.erb b/app/views/users/_course_boardlist.html.erb index d63d958ad..887f0dde4 100644 --- a/app/views/users/_course_boardlist.html.erb +++ b/app/views/users/_course_boardlist.html.erb @@ -85,11 +85,15 @@ From 9e83da1974d67076a1f6526ce088a6eb6615a216 Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 25 Sep 2017 15:03:24 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/homework_common/_new_common_homework.html.erb | 1 + app/views/student_work/new.html.erb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/homework_common/_new_common_homework.html.erb b/app/views/homework_common/_new_common_homework.html.erb index a5c0d6c77..8ba926895 100644 --- a/app/views/homework_common/_new_common_homework.html.erb +++ b/app/views/homework_common/_new_common_homework.html.erb @@ -22,6 +22,7 @@ <%= f.kindeditor :description, :editor_id => 'homework_description_editor', :owner_id => @homework.nil? ? 0: @homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, + :placeholder => "请在此输入您的作业描述", :width => '90%', :height => 200, :minHeight=>200, diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index 05111532b..a8c9fc348 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -1,6 +1,6 @@ <% content_for :header_tags do %> - <%= import_ke(enable_at: true, prettify: false, init_activity: false) %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> <% end %> \ No newline at end of file +
+ +
+

+ 保存 + 取消 +

+<% end %> \ No newline at end of file diff --git a/app/views/exercise/_edu_edit_form.html.erb b/app/views/exercise/_edu_edit_form.html.erb new file mode 100644 index 000000000..2b873d3a2 --- /dev/null +++ b/app/views/exercise/_edu_edit_form.html.erb @@ -0,0 +1,202 @@ +<% content_for :header_tags do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> +<% end %> +
+
+ <%= render :partial => 'show_head', :locals => {:exercise => @exercise} %> +
+
+ <% if is_edit %> + <%= render :partial => 'edit_head', :locals => {:exercise => @exercise} %> + <% else %> + <%= render :partial => 'new_head', :locals => {:exercise => @exercise} %> + <% end %> +
+
+ +
+ +
+ +
+ <%= render :partial => "exercise/new_question" %> +
+ +
+ +
+ + + + + + + +
+

+ 单选题 3 题,共 15  + 多选题 5 题,共 25  + 填空题 10 题,共 25  + 简答题 10 题,共 25  +

+ + 合计 10 题,共 100  + +
+ + \ No newline at end of file diff --git a/app/views/exercise/_exercise_index_tab.html.erb b/app/views/exercise/_exercise_index_tab.html.erb new file mode 100644 index 000000000..a9ae2f47a --- /dev/null +++ b/app/views/exercise/_exercise_index_tab.html.erb @@ -0,0 +1,21 @@ +

+ edu-filter-cir-grey mr5 font-12 fl" data-remote="true">全部 + <% if @is_teacher %> + edu-filter-cir-grey mr5 font-12 fl" data-remote="true">未发布 + <% end %> + edu-filter-cir-grey mr5 font-12 fl" data-remote="true">提交中 + edu-filter-cir-grey mr5 font-12 fl" data-remote="true">已截止 + + +

+
+ <%= form_tag(exercise_index_path(:course_id => @course.id, :type => @type), :remote => true , :method => 'get', :id => 'exercise_search_form') do %> +
+
+ + +
+ +
+ <% end %> +
\ No newline at end of file diff --git a/app/views/exercise/_exercises_list.html.erb b/app/views/exercise/_exercises_list.html.erb index 787ef20b7..56897c242 100644 --- a/app/views/exercise/_exercises_list.html.erb +++ b/app/views/exercise/_exercises_list.html.erb @@ -1,28 +1,66 @@ -
-

所有试卷 - (<%= @obj_count%>) -

- <% if @is_teacher%> - <%= link_to "新建试卷 ", new_exercise_path(:course_id => @course.id), :class => "newbtn" %> - <%= link_to "导入试卷", other_exercise_exercise_index_path(:course_id => @course.id), :remote=>true,:class => "newbtn"%> - <% end%> -
-
-
- <% if @exercises.count != 0 %> - <% @exercises.each_with_index do |exercise,index|%> -
    - <%= render :partial => 'exercise', :locals => {:exercise => exercise,:index => index} %> -
-
- <% end%> +<% if @exercises.count != 0 %> +
+ <% @exercises.each do |exercise| %> +
+
+ # <%= get_ex_index(exercise, @course, @is_teacher) + 1 %> + <%= link_to exercise.exercise_name, student_exercise_list_exercise_path(exercise), :class => "edu-class-inner-list fl color-grey3" %> + <% unless exercise.is_public %> + + <% end %> + <% ex_curr_status = exercise_curr_time exercise %> + <% if ex_curr_status[:status] != "" %> + <%= ex_curr_status[:status] %> + <% end %> +
+

+ 创建于<%=time_from_now exercise.created_at %> + 更新于<%=time_from_now exercise.updated_at %> + <%= exercise.exercise_users.where("commit_status = 1").count %>已答 + <%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %>未答 + <% count = exercise.exercise_users.where("commit_status = 1 and subjective_score = -1").count %> + <%= count %>未评 + <%= ex_curr_status[:time] %> + <% if exercise.try(:exercise_status) == 0 && exercise.publish_time %> + 将于 <%= format_time(exercise.publish_time).to_s %> 发布 + <% end %> +

+
+
+ +
    + <% if @is_teacher %> + <% if exercise.exercise_status == 1 %> +
  • <%= link_to "编辑", edit_exercise_path(exercise) %>
  • + <% end %> +
  • <%= link_to "预览", exercise_path(exercise) %>
  • +
  • <%= link_to "设置", setting_exercise_path(exercise) %>
  • +
  • <%= link_to "导出成绩", student_exercise_list_exercise_path(exercise.id,:course_id => @course.id, :format => 'xls') %>
  • + <% unless exercise.is_public %> +
  • + 设为公开 +
  • + <% end %> + +
  • 删除
  • + <% else %> -
      - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> -
    - -
    - <% else %> - <%= render :partial => "welcome/no_data" %> - <% end %> -
\ No newline at end of file + <% end %> + +
+
+ <% end %> +
+
+
+
    + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %> +
+
+
+
+<% else %> +
+ <%= render :partial => "welcome/no_data" %> +
+<% end %> \ No newline at end of file diff --git a/app/views/exercise/_new_MC.html.erb b/app/views/exercise/_new_MC.html.erb index 1ff27f1fc..6a0f34b6c 100644 --- a/app/views/exercise/_new_MC.html.erb +++ b/app/views/exercise/_new_MC.html.erb @@ -1,65 +1,62 @@ -<%= form_for(ExerciseQuestion.new, - :html => { :multipart => true }, - :url=>create_exercise_question_exercise_path(exercise.id), - :remote=>true ) do |f| %> -
-
- <% score = exercise.exercise_questions.where("question_type=1").last.nil? ? "": exercise.exercise_questions.where("question_type=1").last.question_score %> - - 分 - 请点击选项 - 标准答案: -
-
-
- - - -
-
-
    -
    - -
  • - A - - -
  • -
    -
  • - B - - -
  • -
    -
  • - C - - -
  • -
    -
  • - D - - -
  • -
    -
  • - E -
    新建选项
    -
  • -
    -
    -
    -
-
- -
-
+<% if exercise.id %> + <%= form_for(ExerciseQuestion.new, + :html => {:multipart => true}, + :url => create_exercise_question_exercise_path(exercise.id), + :remote => true ) do |f| %> +
+
+

单选题

+ + +
+
  • + + +
  • + +
  • + + + +
  • +
  • + + + +
  • +
  • + + + +
  • +
  • + + +
  • +
  • + <% score = exercise.exercise_questions.where("question_type=1").last.nil? ? "": exercise.exercise_questions.where("question_type=1").last.question_score %> + + + +

    + 温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案 + 保存 + 取消 +

    +
  • +
    +
    + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/exercise/create.js.erb b/app/views/exercise/create.js.erb index 65b8dd327..1ad55e671 100644 --- a/app/views/exercise/create.js.erb +++ b/app/views/exercise/create.js.erb @@ -1,4 +1,5 @@ -$("#polls_head_show").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:exercise => @exercise}) %>"); -$("#polls_head_edit").html("<%= escape_javascript(render :partial => 'edit_head', :locals => {:exercise => @exercise}) %>"); -$("#polls_head_edit").hide(); -$("#polls_head_show").show(); \ No newline at end of file +$("#exercise_head_show").html("<%= escape_javascript(render :partial => 'show_head') %>"); +$("#exercise_head_edit").html("<%= escape_javascript(render :partial => 'edit_head') %>"); +$("#exercise_head_edit").hide(); +$("#exercise_head_show").show(); +$("#new_exercise_question").html("<%= escape_javascript(render :partial => 'exercise/new_question') %>"); \ No newline at end of file diff --git a/app/views/exercise/create_exercise_question.js.erb b/app/views/exercise/create_exercise_question.js.erb index 09878440c..188e3c8b9 100644 --- a/app/views/exercise/create_exercise_question.js.erb +++ b/app/views/exercise/create_exercise_question.js.erb @@ -6,10 +6,10 @@ <% else %> $("#new_exercise_question").html('<%= escape_javascript(render :partial => 'new_question', :locals => {:exercise => @exercise}) %>'); $("#new_poll_question").html(""); - $("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>"); + //$("#exercise_submit").html("<%#= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>"); <%if @exercise_questions.question_type == 1%> - $("#mc_question_list>div").last().children().first().addClass("border_b"); - $("#mc_question_list").show().append("
    " + + //$("#mc_question_list>div").last().children().first().addClass("border_b"); + $("#exercise_question_list").append("
    " + "
    " + "<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_questions}) %>" + "
    " + diff --git a/app/views/exercise/destroy.js.erb b/app/views/exercise/destroy.js.erb deleted file mode 100644 index 82fbc95b3..000000000 --- a/app/views/exercise/destroy.js.erb +++ /dev/null @@ -1,2 +0,0 @@ -hideModal(); -$("#exercise").html("<%= escape_javascript(render :partial => 'exercises_list') %>"); \ No newline at end of file diff --git a/app/views/exercise/edit.html.erb b/app/views/exercise/edit.html.erb index 48d307c78..db0cef611 100644 --- a/app/views/exercise/edit.html.erb +++ b/app/views/exercise/edit.html.erb @@ -1,9 +1,14 @@ -<%= render :partial => 'exercise_form'%> - +<%#= render :partial => 'exercise_form'%> +
    +

    + + <%= link_to @course.name, course_path(@course) %> > <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> > <%= link_to @exercise.exercise_name, student_exercise_list_exercise_path(@exercise) %> > 编辑 +

    +
    +

    编辑试卷

    + <%= link_to "返回", student_exercise_list_exercise_path(@exercise), :class => "fr font-12 color-grey mr15 mt5" %> +
    + + <%= render :partial => "exercise/edu_edit_form", :locals => {:is_edit => true} %> +
    + diff --git a/app/views/exercise/index.html.erb b/app/views/exercise/index.html.erb index 6baa14d2e..5816d35d8 100644 --- a/app/views/exercise/index.html.erb +++ b/app/views/exercise/index.html.erb @@ -1,8 +1,12 @@ <%= stylesheet_link_tag 'polls', :media => 'all' %> -
    -
    - <%= render :partial => 'exercises_list'%> -
    + +
    +
    +
    +

    试卷列表

    + <% if @is_teacher %> + + 新建 + + + <% end %> +
    +
    +
    + <%= render :partial => "exercise/exercise_index_tab" %> +
    +
    + <%= render :partial => "exercise/exercises_list" %> +
    +
    +
    \ No newline at end of file diff --git a/app/views/exercise/index.js.erb b/app/views/exercise/index.js.erb new file mode 100644 index 000000000..a64ce1d4a --- /dev/null +++ b/app/views/exercise/index.js.erb @@ -0,0 +1,4 @@ +<% unless params[:page] %> + $("#exercise_index_tab").html("<%= j(render :partial => 'exercise/exercise_index_tab') %>"); +<% end %> +$("#exercise_index_list").html("<%= j(render :partial => 'exercise/exercises_list') %>"); \ No newline at end of file diff --git a/app/views/exercise/new.html.erb b/app/views/exercise/new.html.erb index 3d983d64f..ec179510e 100644 --- a/app/views/exercise/new.html.erb +++ b/app/views/exercise/new.html.erb @@ -1 +1,13 @@ -<%= render :partial => 'exercise_form'%> +<%#= render :partial => 'exercise_form'%> +
    +

    + + <%= link_to @course.name, course_path(@course) %> > <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> > 新建 +

    +
    +

    新建试卷

    + <%= link_to "返回", exercise_index_path(:course_id => @course.id), :class => "fr font-12 color-grey mr15 mt5" %> +
    + + <%= render :partial => "exercise/edu_edit_form", :locals =>{:is_edit => false} %> +
    diff --git a/app/views/exercise/set_public.js.erb b/app/views/exercise/set_public.js.erb new file mode 100644 index 000000000..6881ffb9f --- /dev/null +++ b/app/views/exercise/set_public.js.erb @@ -0,0 +1,2 @@ +$("#set_exercise_public_<%= @exercise.id %>").remove(); +$("#exercise_public_icon_<%= @exercise.id %>").remove(); \ No newline at end of file diff --git a/app/views/exercise/setting.html.erb b/app/views/exercise/setting.html.erb new file mode 100644 index 000000000..fee23afc7 --- /dev/null +++ b/app/views/exercise/setting.html.erb @@ -0,0 +1,376 @@ + +
    +

    + + <%= link_to @course.name, course_path(@course) %> > <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> > #<%= get_ex_index(@exercise, @course, @is_teacher) + 1 %> +

    +
    +

    + + <%= @exercise.exercise_name %> +

    + <%= link_to "返回", student_exercise_list_exercise_path(@exercise), :class => "fr font-12 mr15 mt3 color-grey" %> +
    + +
    +<% edit_mode = @is_new && @is_teacher %> +
    + +
    +
    +
    +
    +

    发布设置

    + 编辑 +
    +
    +
    +
      +
    • + + + +
    • +
    • + + +
      +
    • + + + + + + + + + +
    +
    +
    +
    + +
    +
    +

    答题设置

    +
    +
    +
    +
      +
    • + + + + +
    • +
    • + + > + + (选中则学生答题时,题目顺序按照题型随机显示) +
      + > + + (选中则学生答题时,选项顺序随机显示) +
    • +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + +
    +
    +

    公开设置

    +
    +
    +
    +
      +
    • + + > + + (选中则在截止时间之后对班级学生公开所有成员的成绩,否则不公开) +
    • +
    • + + > + + (选中则在截止时间之后对班级学生公开试卷题目的答案,否则不公开) +
    • +
    +
    +
    +
    +
    + + +
    + <%= form_tag(ex_setting_exercise_path(@exercise), :method => "post", :id => 'exercise_setting_form') do |f| %> +
    +
    +

    发布设置

    +
    +
    +
    +
      +
    • + + 1 ? 'disabled' : '' %> class="fl task-form-15 task-height-40 panel-box-sizing <%= @exercise.try(:exercise_status) > 1 ? 'disabled-bg' : '' %>" placeholder="请选择发布时间"> + + +
    • +
    • + + class="fl task-form-15 task-height-40 panel-box-sizing <%= @exercise.try(:exercise_status) == 3 ? 'disabled-bg' : '' %>" placeholder="请选择截止时间"> + + + + 不能早于发布时间 +
    • + + + + + + + + + + +
    +
    +
    +
    + +
    +
    +

    答题设置

    +
    +
    +
    +
      +
    • + + value="<%= @exercise.time.to_i == -1 ? '' : @exercise.time %>" class="fl task-form-15 task-height-40 panel-box-sizing" placeholder="60"> + + +
    • +
    • + + class="magic-checkbox fl mt5 magic-checkbox_show" id="dt_3" type="checkbox" <%= @exercise.question_random == 1 ? 'checked' : '' %>> + + (选中则学生答题时,题目顺序按照题型随机显示) +
      + class="magic-checkbox fl mt5 magic-checkbox_show" id="dt_4" type="checkbox" <%= @exercise.choice_random == 1 ? 'checked' : '' %>> + + (选中则学生答题时,选项顺序随机显示) +
    • +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + +
    +
    +

    公开设置

    +
    +
    +
    +
      +
    • + + > + + (选中则在截止时间之后对班级学生公开所有成员的成绩,否则不公开) +
    • +
    • + + > + + (选中则在截止时间之后对班级学生公开试卷题目的答案,否则不公开) +
    • +
    +
    +
    +
    + <% end %> +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + 保存 + 取消 +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/exercise/update.js.erb b/app/views/exercise/update.js.erb index 9724b2bd1..edfb7a7e6 100644 --- a/app/views/exercise/update.js.erb +++ b/app/views/exercise/update.js.erb @@ -1,5 +1,4 @@ -$("#polls_head_show").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:exercise => @exercise}) %>"); -$("#polls_head_edit").html("<%= escape_javascript(render :partial => 'edit_head', :locals => {:exercise => @exercise}) %>"); -$("#polls_head_edit").hide(); -$("#polls_head_show").show(); -$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>"); \ No newline at end of file +$("#exercise_head_show").html("<%= escape_javascript(render :partial => 'show_head') %>"); +$("#exercise_head_edit").html("<%= escape_javascript(render :partial => 'edit_head') %>"); +$("#exercise_head_edit").hide(); +$("#exercise_head_show").show(); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 0e6481557..ea06c7764 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -531,6 +531,9 @@ RedmineApp::Application.routes.draw do post 'send_to_course' get 'get_student_uncomplete_question' post 'edit_question_score' + get 'setting' + post 'ex_setting' + get 'set_public' end collection do #生成路径为 /exercise/方法名 @@ -543,7 +546,18 @@ RedmineApp::Application.routes.draw do end end - resources :homework_common, :except => [:show]do + resources :exercise_question do + member do + + end + + collection do + + end + end + + + resources :homework_common, :except => [:show]do member do get 'start_anonymous_comment' get 'stop_anonymous_comment' diff --git a/db/migrate/20170927015114_add_new_column_to_exercises.rb b/db/migrate/20170927015114_add_new_column_to_exercises.rb new file mode 100644 index 000000000..f9f44bd9b --- /dev/null +++ b/db/migrate/20170927015114_add_new_column_to_exercises.rb @@ -0,0 +1,7 @@ +class AddNewColumnToExercises < ActiveRecord::Migration + def change + add_column :exercises, :is_public, :boolean, :default => false + add_column :exercises, :score_open, :boolean, :default => true + add_column :exercises, :answer_open, :boolean, :default => true + end +end diff --git a/public/javascripts/edu/course.js b/public/javascripts/edu/course.js index de7d7b773..aa271bbdf 100644 --- a/public/javascripts/edu/course.js +++ b/public/javascripts/edu/course.js @@ -562,3 +562,131 @@ function delete_students(type, id, group_id){ return; } } + +function show_ex_edit_setting(){ + $("#show_exercise_setting").hide(); + $("#edit_exercise_setting").show(); + $("#exam_setting_submit_block").show(); + $("input[name='exercise_publish_time']").datetimepicker({ + allowBlank:true, + lang:'ch', + format:'Y-m-d H:i', + validateOnBlur:false, + onSelectDate:function() { + if($.trim($("input[name='exercise_end_time']").val()) == ""){ + var date = new Date(Date.parse($("input[name='exercise_publish_time']").val().replace(/-/g, "/"))); + $("input[name='exercise_end_time']").val(formate_time(new Date(date.setDate(date.getDate()+14)))); + } +// if($.trim($("input[name='homework_archive_time']").val()) == ""){ +// var date = new Date(Date.parse($("input[name='homework_end_time']").val().replace(/-/g, "/"))); +// $("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1)))); +// } + }, + onSelectTime:function() { + if($.trim($("input[name='exercise_end_time']").val()) == ""){ + var date = new Date(Date.parse($("input[name='exercise_publish_time']").val().replace(/-/g, "/"))); + $("input[name='exercise_end_time']").val(formate_time(new Date(date.setDate(date.getDate()+14)))); + } +// if($.trim($("input[name='homework_archive_time']").val()) == ""){ +// var date = new Date(Date.parse($("input[name='homework_end_time']").val().replace(/-/g, "/"))); +// $("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1)))); +// } + } + }); + + $("input[name='exercise_end_time']").datetimepicker({ + allowBlank:true, + lang:'ch', + format:'Y-m-d H:i', + validateOnBlur:false, +// onSelectDate:function() { +// if($.trim($("input[name='homework_archive_time']").val()) == ""){ +// var date = new Date(Date.parse($("input[name='homework_end_time']").val().replace(/-/g, "/"))); +// $("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1)))); +// } +// }, +// onSelectTime:function() { +// if($.trim($("input[name='homework_archive_time']").val()) == ""){ +// var date = new Date(Date.parse($("input[name='homework_end_time']").val().replace(/-/g, "/"))); +// $("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1)))); +// } +// } + }); +} + +function ex_setting_form_submit(){ + var myDate = new Date(); + var result = true; + if($("input[name='exercise_publish_time']").prop("disabled")==false && $.trim($("input[name='exercise_publish_time']").val()) != ""){ + var publish_time = Date.parse($("input[name='exercise_publish_time']").val()); + if(publish_time < myDate){ + $("#exercise_publish_time_notice").html("发布时间应晚于当前时间").show(); + result = false; + } else{ + $("#exercise_publish_time_notice").hide(); + } + if($.trim($("input[name='exercise_end_time']").val()) == ""){ + $("#exercise_end_time_notice").html("截止时间不能为空").show(); + result = false; + } + } + if($("input[name='exercise_end_time']").prop("disabled")==false && $.trim($("input[name='exercise_end_time']").val()) != ""){ + if($.trim($("input[name='exercise_publish_time']").val()) == ""){ + $("#exercise_publish_time").val(formate_time(myDate)); + } + var publish_time = Date.parse($("input[name='exercise_publish_time']").val()); + var end_time = Date.parse($("input[name='exercise_end_time']").val()); + if(end_time <= publish_time){ + $("#exercise_end_time_notice").html("截止时间应晚于发布时间").show(); + result = false; + } else if(end_time <= myDate) { + $("#exercise_end_time_notice").html("截止时间应晚于当前时间").show(); + result = false; + } else{ + $("#exercise_end_time_notice").hide(); + } + } + if(result){ + $("#exercise_setting_form").submit(); + } +} + +//添加标题时确定按钮 +function add_poll_question(doc,quest_type) +{ + var title = $.trim($("#poll_questions_title").val()); + var score = $.trim($("#question_score").val()); + var standard_ans = $.trim($("#exercise_choice_" + quest_type).val()); + if(title.length == 0 || score.length == 0){ + notice_box("题目标题/分数不能为空"); + doc.one('click', function(){ + add_poll_question($(this),quest_type); + }); + }else if(!/^[1-9][0-9]*$/.test(score)) { + notice_box("分数必须是非零开头的数字"); + doc.one('click', function(){ + add_poll_question($(this),quest_type); + }); + }else if(quest_type !=3 && quest_type !=4 && standard_ans.length == 0) { + notice_box("标准答案不能为空"); + doc.one('click', function(){ + add_poll_question($(this),quest_type); + }); + }else{ + doc.parent().parent().parent().parent().submit(); + } +} + +function pollsSubmit(doc){ + var title = $.trim($("#exercise_name").val()); + if(title.length == 0){ + notice_box("试卷标题不能为空"); + } else { + doc.parent().parent().submit(); + } +} + +function pollsCancel(){ + $("#exercise_head_edit").hide(); + $("#exercise_head_show").show(); +} \ No newline at end of file From 06940f58b327e1f414bbf141660fc946d48810f4 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 28 Sep 2017 19:16:13 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=95=88=E6=9E=9C?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E7=82=B9=E5=87=BB=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_edu_edit_form.html.erb | 261 +++---- app/views/exercise/_new_MC.html.erb | 16 +- app/views/exercise/_new_MCQ.html.erb | 14 +- app/views/exercise/_new_single.html.erb | 4 +- app/views/exercise/_show_MC.html.erb | 25 +- app/views/exercise/_show_MCQ.html.erb | 28 +- app/views/exercise/_show_multi.html.erb | 20 + app/views/exercise/_show_single.html.erb | 20 + .../exercise/create_exercise_question.js.erb | 6 +- .../stylesheets/window_js/mac_os_x.css | 666 +++++++++--------- .../stylesheets/window_js/mac_os_x_dialog.css | 320 ++++----- .../stylesheets/window_js/nuncio.css | 328 ++++----- .../stylesheets/window_js/spread.css | 216 +++--- 13 files changed, 1017 insertions(+), 907 deletions(-) diff --git a/app/views/exercise/_edu_edit_form.html.erb b/app/views/exercise/_edu_edit_form.html.erb index 2b873d3a2..83c684cec 100644 --- a/app/views/exercise/_edu_edit_form.html.erb +++ b/app/views/exercise/_edu_edit_form.html.erb @@ -15,7 +15,21 @@
    - + + + + + + + + + + + + + + +
    @@ -28,18 +42,18 @@ @@ -47,7 +61,7 @@
  • - +
  • @@ -64,52 +78,138 @@
    \ No newline at end of file diff --git a/app/views/exercise/_new_MC.html.erb b/app/views/exercise/_new_MC.html.erb index 6a0f34b6c..bb6261f4e 100644 --- a/app/views/exercise/_new_MC.html.erb +++ b/app/views/exercise/_new_MC.html.erb @@ -16,31 +16,31 @@
  • - +
  • - +
  • - +
  • diff --git a/app/views/exercise/_new_MCQ.html.erb b/app/views/exercise/_new_MCQ.html.erb index 56092db55..4e54ec274 100644 --- a/app/views/exercise/_new_MCQ.html.erb +++ b/app/views/exercise/_new_MCQ.html.erb @@ -16,30 +16,30 @@
  • - +
  • - +
  • - +
  • - +
  • <% score = exercise.exercise_questions.where("question_type=2").last.nil? ? "": exercise.exercise_questions.where("question_type=2").last.question_score %> diff --git a/app/views/exercise/_new_single.html.erb b/app/views/exercise/_new_single.html.erb index 5f386e6a6..7f781cba8 100644 --- a/app/views/exercise/_new_single.html.erb +++ b/app/views/exercise/_new_single.html.erb @@ -18,11 +18,11 @@
  • - +
  • - +
  • <% score = exercise.exercise_questions.where("question_type=3").last.nil? ? "": exercise.exercise_questions.where("question_type=3").last.question_score %> diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb index 054f74ae0..ec260c45d 100644 --- a/app/views/exercise/_show_MC.html.erb +++ b/app/views/exercise/_show_MC.html.erb @@ -1,4 +1,26 @@ -
    +
    +
    +

    第<%= exercise_question.question_number%>题:[单选题]<%= exercise_question.question_score %>

    +

    + + + + + +

    +
    +

    <%= exercise_question.question_title %>

    +
    + <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> +
  • + <% end %> +
    +
    + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> +
    +
    +<% if false%> +
    第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分   @@ -39,6 +61,7 @@
    + <% end %>
    diff --git a/app/views/exercise/_show_MCQ.html.erb b/app/views/exercise/_show_MCQ.html.erb index 6e9cbd256..26d8f5e94 100644 --- a/app/views/exercise/_show_MCQ.html.erb +++ b/app/views/exercise/_show_MCQ.html.erb @@ -1,4 +1,27 @@ -
    +
    +
    +

    第<%= exercise_question.question_number%>题:[多选题]<%= exercise_question.question_score %>

    +

    + + + + + +

    +
    +

    <%= exercise_question.question_title %>

    +
    + <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> +
  • + <% end %> +
    +
    + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> +
    +
    + +<% if false %> +
    第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分   @@ -39,6 +62,9 @@
    + +<% end %> +
    diff --git a/app/views/exercise/_show_multi.html.erb b/app/views/exercise/_show_multi.html.erb index 8a0c4fa60..6de83bde8 100644 --- a/app/views/exercise/_show_multi.html.erb +++ b/app/views/exercise/_show_multi.html.erb @@ -1,3 +1,22 @@ +
    +
    +

    第<%= exercise_question.question_number%>题:[简答题]<%= exercise_question.question_score %>

    +

    + + + + + +

    +
    +

    <%= exercise_question.question_title %>

    +
    +

    参考答案

    +

    <%= exercise_question.exercise_standard_answers.first.answer_text%>

    +
    +
    + +<% if false %>
    @@ -27,6 +46,7 @@
    <% end %>
    +<% end %>
    diff --git a/app/views/exercise/_show_single.html.erb b/app/views/exercise/_show_single.html.erb index d3298a5b9..229123398 100644 --- a/app/views/exercise/_show_single.html.erb +++ b/app/views/exercise/_show_single.html.erb @@ -1,3 +1,22 @@ +
    +
    +

    第<%= exercise_question.question_number%>题:[填空题]<%= exercise_question.question_score %>

    +

    + + + + + +

    +
    +

    <%= exercise_question.question_title %>

    +
    + <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> +

    候选答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%>

    + <% end %> +
    +
    +<% if false %>
    @@ -27,6 +46,7 @@ <% end %>
    +<% end %>
    diff --git a/app/views/exercise/create_exercise_question.js.erb b/app/views/exercise/create_exercise_question.js.erb index 188e3c8b9..af1b1af56 100644 --- a/app/views/exercise/create_exercise_question.js.erb +++ b/app/views/exercise/create_exercise_question.js.erb @@ -19,7 +19,7 @@ "
    "); <% end %> <%if @exercise_questions.question_type == 2%> - $("#mcq_question_list").show().append("
    " + + $("#exercise_question_list").append("
    " + "
    " + "<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" + "
    " + @@ -29,7 +29,7 @@ "
    "); <% end %> <%if @exercise_questions.question_type == 3%> - $("#single_question_list").show().append("
    " + + $("#exercise_question_list").append("
    " + "
    " + "<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_questions}) %>" + "
    " + @@ -39,7 +39,7 @@ "
    "); <% end %> <%if @exercise_questions.question_type == 4%> - $("#multi_question_list").show().append("
    " + + $("#exercise_question_list").append("
    " + "
    " + "<%= escape_javascript(render :partial => 'show_multi', :locals => {:exercise_question => @exercise_questions}) %>" + "
    " + diff --git a/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x.css b/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x.css index fdff45d8e..24751f868 100644 --- a/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x.css +++ b/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x.css @@ -1,333 +1,333 @@ -/* Focused windows */ -.overlay_mac_os_x { - background-color: #85BBEF; - filter:alpha(opacity=60); - -moz-opacity: 0.6; - opacity: 0.6; -} - -.mac_os_x_nw { - background: transparent url(mac_os_x/TL_Main.png) no-repeat 0 0; - width:24px; - height:30px; -} - -.mac_os_x_n { - background: transparent url(mac_os_x/T_Main.png) repeat-x 0 0; - height:30px; -} - -.mac_os_x_ne { - background: transparent url(mac_os_x/TR_Main.png) no-repeat 0 0; - width:31px; - height:30px; -} - -.mac_os_x_w { - background: transparent url(mac_os_x/L_Main.png) repeat-y top left; - width:16px; -} - -.mac_os_x_e { - background: transparent url(mac_os_x/R_Main.png) repeat-y top right; - width:16px; -} - -.mac_os_x_sw { - background: transparent url(mac_os_x/BL_Main.png) no-repeat 0 0; - width:31px; - height:40px; -} - -.mac_os_x_s { - background: transparent url(mac_os_x/B_Main.png) repeat-x 0 0; - height:40px; -} - -.mac_os_x_se, .mac_os_x_sizer { - background: transparent url(mac_os_x/BR_Main.png) no-repeat 0 0; - width:31px; - height:40px; -} - -.mac_os_x_sizer { - cursor:se-resize; -} - -.mac_os_x_close { - width: 19px; - height: 19px; - background: transparent url(mac_os_x/close.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:25px; - cursor:pointer; - z-index:1000; -} - -.mac_os_x_minimize { - width: 19px; - height: 19px; - background: transparent url(mac_os_x/minimize.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:45px; - cursor:pointer; - z-index:1000; -} - -.mac_os_x_maximize { - width: 19px; - height: 19px; - background: transparent url(mac_os_x/maximize.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:65px; - cursor:pointer; - z-index:1000; -} - -.mac_os_x_title { - float:left; - height:14px; - font-family: Tahoma, Arial, sans-serif; - font-size:12px; - text-align:center; - margin-top:8px; - width:100%; - color:#000; -} - -.mac_os_x_content { - overflow:auto; - color: #222; - font-family: Tahoma, Arial, sans-serif; - font-size: 10px; - background:#FFF; -} -.mac_os_x_s .status_bar { - padding-bottom:24px; -} - -/* FOR IE */ -* html .mac_os_x_nw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/TL_Main.png", sizingMethod="crop"); -} - -* html .mac_os_x_n { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/T_Main.png", sizingMethod="scale"); -} - -* html .mac_os_x_ne { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/TR_Main.png", sizingMethod="crop"); -} - -* html .mac_os_x_w { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/L_Main.png", sizingMethod="scale"); -} - -* html .mac_os_x_e { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/R_Main.png", sizingMethod="scale"); -} - -* html .mac_os_x_sw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BL_Main.png", sizingMethod="crop"); -} - -* html .mac_os_x_s { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/B_Main.png", sizingMethod="scale"); -} - -* html .mac_os_x_se { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BR_Main.png", sizingMethod="crop"); -} - -* html .mac_os_x_sizer { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BR_Main.png", sizingMethod="crop"); -} - - -/* Focused windows */ -.overlay_blur_os_x { - background-color: #85BBEF; - filter:alpha(opacity=60); - -moz-opacity: 0.6; - opacity: 0.6; -} - -.blur_os_x_nw { - background: transparent url(mac_os_x/TL.png) no-repeat 0 0; - width:24px; - height:30px; -} - -.blur_os_x_n { - background: transparent url(mac_os_x/T.png) repeat-x 0 0; - height:30px; -} - -.blur_os_x_ne { - background: transparent url(mac_os_x/TR.png) no-repeat 0 0; - width:31px; - height:30px; -} - -.blur_os_x_w { - background: transparent url(mac_os_x/L.png) repeat-y top left; - width:16px; -} - -.blur_os_x_e { - background: transparent url(mac_os_x/R.png) repeat-y top right; - width:16px; -} - -.blur_os_x_sw { - background: transparent url(mac_os_x/BL.png) no-repeat 0 0; - width:31px; - height:40px; -} - -.blur_os_x_s { - background: transparent url(mac_os_x/B.png) repeat-x 0 0; - height:40px; -} - -.blur_os_x_se, .blur_os_x_sizer { - background: transparent url(mac_os_x/BR.png) no-repeat 0 0; - width:31px; - height:40px; -} - -.blur_os_x_sizer { - cursor:se-resize; -} - -.blur_os_x_close { - width: 19px; - height: 19px; - background: transparent url(mac_os_x/close.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:25px; - cursor:pointer; - z-index:1000; -} - -.blur_os_x_minimize { - width: 19px; - height: 19px; - background: transparent url(mac_os_x/minimize.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:45px; - cursor:pointer; - z-index:1000; -} - -.blur_os_x_maximize { - width: 19px; - height: 19px; - background: transparent url(mac_os_x/maximize.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:65px; - cursor:pointer; - z-index:1000; -} - -.blur_os_x_title { - float:left; - height:14px; - font-family: Tahoma, Arial, sans-serif; - font-size:12px; - text-align:center; - margin-top:8px; - width:100%; - color:#000; -} - -.blur_os_x_content { - overflow:auto; - color: #222; - font-family: Tahoma, Arial, sans-serif; - font-size: 10px; - background:#FFF; -} -.blur_os_x_s .status_bar { - padding-bottom:24px; -} - -/* FOR IE */ -* html .blur_os_x_nw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/TL.png", sizingMethod="crop"); -} - -* html .blur_os_x_n { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/T.png", sizingMethod="scale"); -} - -* html .blur_os_x_ne { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/TR.png", sizingMethod="crop"); -} - -* html .blur_os_x_w { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/L.png", sizingMethod="scale"); -} - -* html .blur_os_x_e { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/R.png", sizingMethod="scale"); -} - -* html .blur_os_x_sw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BL.png", sizingMethod="crop"); -} - -* html .blur_os_x_s { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/B.png", sizingMethod="scale"); -} - -* html .blur_os_x_se { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BR.png", sizingMethod="crop"); -} - -* html .blur_os_x_sizer { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BR.png", sizingMethod="crop"); -} - +/* Focused windows */ +.overlay_mac_os_x { + background-color: #85BBEF; + filter:alpha(opacity=60); + -moz-opacity: 0.6; + opacity: 0.6; +} + +.mac_os_x_nw { + background: transparent url(mac_os_x/TL_Main.png) no-repeat 0 0; + width:24px; + height:30px; +} + +.mac_os_x_n { + background: transparent url(mac_os_x/T_Main.png) repeat-x 0 0; + height:30px; +} + +.mac_os_x_ne { + background: transparent url(mac_os_x/TR_Main.png) no-repeat 0 0; + width:31px; + height:30px; +} + +.mac_os_x_w { + background: transparent url(mac_os_x/L_Main.png) repeat-y top left; + width:16px; +} + +.mac_os_x_e { + background: transparent url(mac_os_x/R_Main.png) repeat-y top right; + width:16px; +} + +.mac_os_x_sw { + background: transparent url(mac_os_x/BL_Main.png) no-repeat 0 0; + width:31px; + height:40px; +} + +.mac_os_x_s { + background: transparent url(mac_os_x/B_Main.png) repeat-x 0 0; + height:40px; +} + +.mac_os_x_se, .mac_os_x_sizer { + background: transparent url(mac_os_x/BR_Main.png) no-repeat 0 0; + width:31px; + height:40px; +} + +.mac_os_x_sizer { + cursor:se-resize; +} + +.mac_os_x_close { + width: 19px; + height: 19px; + background: transparent url(mac_os_x/close.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:25px; + cursor:pointer; + z-index:1000; +} + +.mac_os_x_minimize { + width: 19px; + height: 19px; + background: transparent url(mac_os_x/minimize.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:45px; + cursor:pointer; + z-index:1000; +} + +.mac_os_x_maximize { + width: 19px; + height: 19px; + background: transparent url(mac_os_x/maximize.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:65px; + cursor:pointer; + z-index:1000; +} + +.mac_os_x_title { + float:left; + height:14px; + font-family: Tahoma, Arial, sans-serif; + font-size:12px; + text-align:center; + margin-top:8px; + width:100%; + color:#000; +} + +.mac_os_x_content { + overflow:auto; + color: #222; + font-family: Tahoma, Arial, sans-serif; + font-size: 10px; + background:#FFF; +} +.mac_os_x_s .status_bar { + padding-bottom:24px; +} + +/* FOR IE */ +* html .mac_os_x_nw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/TL_Main.png", sizingMethod="crop"); +} + +* html .mac_os_x_n { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/T_Main.png", sizingMethod="scale"); +} + +* html .mac_os_x_ne { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/TR_Main.png", sizingMethod="crop"); +} + +* html .mac_os_x_w { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/L_Main.png", sizingMethod="scale"); +} + +* html .mac_os_x_e { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/R_Main.png", sizingMethod="scale"); +} + +* html .mac_os_x_sw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BL_Main.png", sizingMethod="crop"); +} + +* html .mac_os_x_s { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/B_Main.png", sizingMethod="scale"); +} + +* html .mac_os_x_se { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BR_Main.png", sizingMethod="crop"); +} + +* html .mac_os_x_sizer { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BR_Main.png", sizingMethod="crop"); +} + + +/* Focused windows */ +.overlay_blur_os_x { + background-color: #85BBEF; + filter:alpha(opacity=60); + -moz-opacity: 0.6; + opacity: 0.6; +} + +.blur_os_x_nw { + background: transparent url(mac_os_x/TL.png) no-repeat 0 0; + width:24px; + height:30px; +} + +.blur_os_x_n { + background: transparent url(mac_os_x/T.png) repeat-x 0 0; + height:30px; +} + +.blur_os_x_ne { + background: transparent url(mac_os_x/TR.png) no-repeat 0 0; + width:31px; + height:30px; +} + +.blur_os_x_w { + background: transparent url(mac_os_x/L.png) repeat-y top left; + width:16px; +} + +.blur_os_x_e { + background: transparent url(mac_os_x/R.png) repeat-y top right; + width:16px; +} + +.blur_os_x_sw { + background: transparent url(mac_os_x/BL.png) no-repeat 0 0; + width:31px; + height:40px; +} + +.blur_os_x_s { + background: transparent url(mac_os_x/B.png) repeat-x 0 0; + height:40px; +} + +.blur_os_x_se, .blur_os_x_sizer { + background: transparent url(mac_os_x/BR.png) no-repeat 0 0; + width:31px; + height:40px; +} + +.blur_os_x_sizer { + cursor:se-resize; +} + +.blur_os_x_close { + width: 19px; + height: 19px; + background: transparent url(mac_os_x/close.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:25px; + cursor:pointer; + z-index:1000; +} + +.blur_os_x_minimize { + width: 19px; + height: 19px; + background: transparent url(mac_os_x/minimize.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:45px; + cursor:pointer; + z-index:1000; +} + +.blur_os_x_maximize { + width: 19px; + height: 19px; + background: transparent url(mac_os_x/maximize.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:65px; + cursor:pointer; + z-index:1000; +} + +.blur_os_x_title { + float:left; + height:14px; + font-family: Tahoma, Arial, sans-serif; + font-size:12px; + text-align:center; + margin-top:8px; + width:100%; + color:#000; +} + +.blur_os_x_content { + overflow:auto; + color: #222; + font-family: Tahoma, Arial, sans-serif; + font-size: 10px; + background:#FFF; +} +.blur_os_x_s .status_bar { + padding-bottom:24px; +} + +/* FOR IE */ +* html .blur_os_x_nw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/TL.png", sizingMethod="crop"); +} + +* html .blur_os_x_n { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/T.png", sizingMethod="scale"); +} + +* html .blur_os_x_ne { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/TR.png", sizingMethod="crop"); +} + +* html .blur_os_x_w { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/L.png", sizingMethod="scale"); +} + +* html .blur_os_x_e { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/R.png", sizingMethod="scale"); +} + +* html .blur_os_x_sw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BL.png", sizingMethod="crop"); +} + +* html .blur_os_x_s { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/B.png", sizingMethod="scale"); +} + +* html .blur_os_x_se { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BR.png", sizingMethod="crop"); +} + +* html .blur_os_x_sizer { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x/BR.png", sizingMethod="crop"); +} + diff --git a/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x_dialog.css b/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x_dialog.css index 4c89f602d..e663e3c5e 100644 --- a/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x_dialog.css +++ b/public/plugin_assets/redmine_code_review/stylesheets/window_js/mac_os_x_dialog.css @@ -1,160 +1,160 @@ -.overlay_mac_os_x_dialog { - background-color: #FF7224; - filter:alpha(opacity=60); - -moz-opacity: 0.6; - opacity: 0.6; -} - -.mac_os_x_dialog_nw { - background: transparent url(mac_os_x_dialog/L.png) repeat-y top left; - width:16px; - height:16px; -} - -.mac_os_x_dialog_n { - background: transparent url(mac_os_x_dialog/bg.gif) repeat 0 0; - height:18px; -} - -.mac_os_x_dialog_ne { - background: transparent url(mac_os_x_dialog/R.png) repeat-y top left; - width:16px; - height:16px; -} - -.mac_os_x_dialog_w { - background: transparent url(mac_os_x_dialog/L.png) repeat-y top left; - width:16px; -} - -.mac_os_x_dialog_e { - background: transparent url(mac_os_x_dialog/R.png) repeat-y top right; - width:16px; -} - -.mac_os_x_dialog_sw { - background: transparent url(mac_os_x_dialog/BL.png) no-repeat 0 0; - width:31px; - height:40px; -} - -.mac_os_x_dialog_s { - background: transparent url(mac_os_x_dialog/B.png) repeat-x 0 0; - height:40px; -} - -.mac_os_x_dialog_se, .mac_os_x_dialog_sizer { - background: transparent url(mac_os_x_dialog/BR.png) no-repeat 0 0; - width:31px; - height:40px; -} - -.mac_os_x_dialog_sizer { - cursor:se-resize; -} - -.mac_os_x_dialog_close { - width: 19px; - height: 19px; - background: transparent url(mac_os_x_dialog/close.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:25px; - cursor:pointer; - z-index:1000; -} - -.mac_os_x_dialog_minimize { - width: 19px; - height: 19px; - background: transparent url(mac_os_x_dialog/minimize.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:45px; - cursor:pointer; - z-index:1000; -} - -.mac_os_x_dialog_maximize { - width: 19px; - height: 19px; - background: transparent url(mac_os_x_dialog/maximize.gif) no-repeat 0 0; - position:absolute; - top:12px; - left:65px; - cursor:pointer; - z-index:1000; -} - -.mac_os_x_dialog_title { - float:left; - height:14px; - font-family: Tahoma, Arial, sans-serif; - font-size:12px; - text-align:center; - margin-top:6px; - width:100%; - color:#000; -} - -.mac_os_x_dialog_content { - overflow:auto; - color: #222; - font-family: Tahoma, Arial, sans-serif; - font-size: 10px; - background: transparent url(mac_os_x_dialog/bg.gif) repeat 0 0; -} - -.mac_os_x_dialog_buttons { - text-align: center; -} -/* FOR IE */ -* html .mac_os_x_dialog_nw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/L.png", sizingMethod="scale"); -} - - -* html .mac_os_x_dialog_ne { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/R.png", sizingMethod="scale"); -} - -* html .mac_os_x_dialog_w { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/L.png", sizingMethod="scale"); -} - -* html .mac_os_x_dialog_e { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/R.png", sizingMethod="scale"); -} - -* html .mac_os_x_dialog_sw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BL.png", sizingMethod="crop"); -} - -* html .mac_os_x_dialog_s { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/B.png", sizingMethod="scale"); -} - -* html .mac_os_x_dialog_se { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BR.png", sizingMethod="crop"); -} - -* html .mac_os_x_dialog_sizer { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BR.png", sizingMethod="crop"); -} - +.overlay_mac_os_x_dialog { + background-color: #FF7224; + filter:alpha(opacity=60); + -moz-opacity: 0.6; + opacity: 0.6; +} + +.mac_os_x_dialog_nw { + background: transparent url(mac_os_x_dialog/L.png) repeat-y top left; + width:16px; + height:16px; +} + +.mac_os_x_dialog_n { + background: transparent url(mac_os_x_dialog/bg.gif) repeat 0 0; + height:18px; +} + +.mac_os_x_dialog_ne { + background: transparent url(mac_os_x_dialog/R.png) repeat-y top left; + width:16px; + height:16px; +} + +.mac_os_x_dialog_w { + background: transparent url(mac_os_x_dialog/L.png) repeat-y top left; + width:16px; +} + +.mac_os_x_dialog_e { + background: transparent url(mac_os_x_dialog/R.png) repeat-y top right; + width:16px; +} + +.mac_os_x_dialog_sw { + background: transparent url(mac_os_x_dialog/BL.png) no-repeat 0 0; + width:31px; + height:40px; +} + +.mac_os_x_dialog_s { + background: transparent url(mac_os_x_dialog/B.png) repeat-x 0 0; + height:40px; +} + +.mac_os_x_dialog_se, .mac_os_x_dialog_sizer { + background: transparent url(mac_os_x_dialog/BR.png) no-repeat 0 0; + width:31px; + height:40px; +} + +.mac_os_x_dialog_sizer { + cursor:se-resize; +} + +.mac_os_x_dialog_close { + width: 19px; + height: 19px; + background: transparent url(mac_os_x_dialog/close.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:25px; + cursor:pointer; + z-index:1000; +} + +.mac_os_x_dialog_minimize { + width: 19px; + height: 19px; + background: transparent url(mac_os_x_dialog/minimize.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:45px; + cursor:pointer; + z-index:1000; +} + +.mac_os_x_dialog_maximize { + width: 19px; + height: 19px; + background: transparent url(mac_os_x_dialog/maximize.gif) no-repeat 0 0; + position:absolute; + top:12px; + left:65px; + cursor:pointer; + z-index:1000; +} + +.mac_os_x_dialog_title { + float:left; + height:14px; + font-family: Tahoma, Arial, sans-serif; + font-size:12px; + text-align:center; + margin-top:6px; + width:100%; + color:#000; +} + +.mac_os_x_dialog_content { + overflow:auto; + color: #222; + font-family: Tahoma, Arial, sans-serif; + font-size: 10px; + background: transparent url(mac_os_x_dialog/bg.gif) repeat 0 0; +} + +.mac_os_x_dialog_buttons { + text-align: center; +} +/* FOR IE */ +* html .mac_os_x_dialog_nw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/L.png", sizingMethod="scale"); +} + + +* html .mac_os_x_dialog_ne { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/R.png", sizingMethod="scale"); +} + +* html .mac_os_x_dialog_w { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/L.png", sizingMethod="scale"); +} + +* html .mac_os_x_dialog_e { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/R.png", sizingMethod="scale"); +} + +* html .mac_os_x_dialog_sw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BL.png", sizingMethod="crop"); +} + +* html .mac_os_x_dialog_s { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/B.png", sizingMethod="scale"); +} + +* html .mac_os_x_dialog_se { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BR.png", sizingMethod="crop"); +} + +* html .mac_os_x_dialog_sizer { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/mac_os_x_dialog/BR.png", sizingMethod="crop"); +} + diff --git a/public/plugin_assets/redmine_code_review/stylesheets/window_js/nuncio.css b/public/plugin_assets/redmine_code_review/stylesheets/window_js/nuncio.css index e2700e5b7..2c439bd00 100644 --- a/public/plugin_assets/redmine_code_review/stylesheets/window_js/nuncio.css +++ b/public/plugin_assets/redmine_code_review/stylesheets/window_js/nuncio.css @@ -1,164 +1,164 @@ -.overlay_nuncio img { border: none; } - -.overlay_nuncio { - background-color: #666666; -} - -.nuncio_nw { - width: 12px; - height: 28px; - background: url(nuncio/top_left.png) no-repeat; -} - -.nuncio_n { - background: url(nuncio/top_mid.png) repeat-x; - height: 28px; -} - -.nuncio_ne { - width: 21px; - height: 28px; - background: url(nuncio/top_right.png) no-repeat; -} - -.nuncio_e { - width: 21px; - background: url(nuncio/center_right.png) repeat-y top right; -} - -.nuncio_w { - width: 12px; - background: url(nuncio/center_left.png) repeat-y top left; -} - -.nuncio_sw { - width: 12px; - height: 18px; - background: url(nuncio/bottom_left.png) no-repeat; -} - -.nuncio_s { - background: url(nuncio/bottom_mid.png) repeat-x 0 0; - height: 18px; -} - -.nuncio_se, .nuncio_sizer { - width: 21px; - height: 18px; - background: url(nuncio/bottom_right.png) no-repeat; -} - -.nuncio_close { - width: 14px; - height: 14px; - background: url(nuncio/close.png) no-repeat; - position:absolute; - top:10px; - right:22px; - cursor:pointer; - z-index:2000; -} - -.nuncio_minimize { - width: 14px; - height: 15px; - background: url(nuncio/minimize.png) no-repeat; - position:absolute; - top:10px; - right:40px; - cursor:pointer; - z-index:2000; -} - -.nuncio_title { - float:left; - font-size:11px; - font-weight: bold; - font-style: italic; - color: #fff; - width: 100% -} - -.nuncio_content { - background: url(nuncio/overlay.png) repeat; - overflow:auto; - color: #ddd; - font-family: Tahoma, Arial, "sans-serif"; - font-size: 10px; -} - -.nuncio_sizer { - cursor:se-resize; -} - - -.top_draggable, .bottom_draggable { - cursor:move -} -/* FOR IE */ -* html .nuncio_nw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/top_left.png", sizingMethod="crop"); -} - -* html .nuncio_n { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/top_mid.png", sizingMethod="scale"); -} - -* html .nuncio_ne { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/top_right.png", sizingMethod="crop"); -} - -* html .nuncio_w { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/center_left.png", sizingMethod="scale"); -} - -* html .nuncio_e { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/center_right.png", sizingMethod="scale"); -} - -* html .nuncio_sw { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_left.png", sizingMethod="crop"); -} - -* html .nuncio_s { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_mid.png", sizingMethod="scale"); -} - -* html .nuncio_se { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_right.png", sizingMethod="crop"); -} - -* html .nuncio_sizer { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_right.png", sizingMethod="crop"); -} - -* html .nuncio_close { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/close.png", sizingMethod="crop"); -} - -* html .nuncio_minimize { - background-color: transparent; - background-image: none; - filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/minimize.png", sizingMethod="crop"); -} - +.overlay_nuncio img { border: none; } + +.overlay_nuncio { + background-color: #666666; +} + +.nuncio_nw { + width: 12px; + height: 28px; + background: url(nuncio/top_left.png) no-repeat; +} + +.nuncio_n { + background: url(nuncio/top_mid.png) repeat-x; + height: 28px; +} + +.nuncio_ne { + width: 21px; + height: 28px; + background: url(nuncio/top_right.png) no-repeat; +} + +.nuncio_e { + width: 21px; + background: url(nuncio/center_right.png) repeat-y top right; +} + +.nuncio_w { + width: 12px; + background: url(nuncio/center_left.png) repeat-y top left; +} + +.nuncio_sw { + width: 12px; + height: 18px; + background: url(nuncio/bottom_left.png) no-repeat; +} + +.nuncio_s { + background: url(nuncio/bottom_mid.png) repeat-x 0 0; + height: 18px; +} + +.nuncio_se, .nuncio_sizer { + width: 21px; + height: 18px; + background: url(nuncio/bottom_right.png) no-repeat; +} + +.nuncio_close { + width: 14px; + height: 14px; + background: url(nuncio/close.png) no-repeat; + position:absolute; + top:10px; + right:22px; + cursor:pointer; + z-index:2000; +} + +.nuncio_minimize { + width: 14px; + height: 15px; + background: url(nuncio/minimize.png) no-repeat; + position:absolute; + top:10px; + right:40px; + cursor:pointer; + z-index:2000; +} + +.nuncio_title { + float:left; + font-size:11px; + font-weight: bold; + font-style: italic; + color: #fff; + width: 100% +} + +.nuncio_content { + background: url(nuncio/overlay.png) repeat; + overflow:auto; + color: #ddd; + font-family: Tahoma, Arial, "sans-serif"; + font-size: 10px; +} + +.nuncio_sizer { + cursor:se-resize; +} + + +.top_draggable, .bottom_draggable { + cursor:move +} +/* FOR IE */ +* html .nuncio_nw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/top_left.png", sizingMethod="crop"); +} + +* html .nuncio_n { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/top_mid.png", sizingMethod="scale"); +} + +* html .nuncio_ne { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/top_right.png", sizingMethod="crop"); +} + +* html .nuncio_w { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/center_left.png", sizingMethod="scale"); +} + +* html .nuncio_e { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/center_right.png", sizingMethod="scale"); +} + +* html .nuncio_sw { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_left.png", sizingMethod="crop"); +} + +* html .nuncio_s { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_mid.png", sizingMethod="scale"); +} + +* html .nuncio_se { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_right.png", sizingMethod="crop"); +} + +* html .nuncio_sizer { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/bottom_right.png", sizingMethod="crop"); +} + +* html .nuncio_close { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/close.png", sizingMethod="crop"); +} + +* html .nuncio_minimize { + background-color: transparent; + background-image: none; + filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../themes/nuncio/minimize.png", sizingMethod="crop"); +} + diff --git a/public/plugin_assets/redmine_code_review/stylesheets/window_js/spread.css b/public/plugin_assets/redmine_code_review/stylesheets/window_js/spread.css index d7d722e8a..9bda2a68d 100644 --- a/public/plugin_assets/redmine_code_review/stylesheets/window_js/spread.css +++ b/public/plugin_assets/redmine_code_review/stylesheets/window_js/spread.css @@ -1,108 +1,108 @@ -.overlay_spread { - background-color: #85BBEF; - filter:alpha(opacity=60); - -moz-opacity: 0.6; - opacity: 0.6; -} - -.spread_nw { - background: transparent url(spread/left-top.gif) no-repeat 0 0; - width:10px; - height:25px; -} - -.spread_n { - background: transparent url(spread/top-middle.gif) repeat-x 0 0; - height:25px; -} - -.spread_ne { - background: transparent url(spread/right-top.gif) no-repeat 0 0; - width:10px; - height:25px; -} - -.spread_w { - background: transparent url(spread/frame-left.gif) repeat-y top left; - width:7px; -} - -.spread_e { - background: transparent url(spread/frame-right.gif) repeat-y top right; - width:7px; -} - -.spread_sw { - background: transparent url(spread/bottom-left-c.gif) no-repeat 0 0; - width:7px; - height:7px; -} - -.spread_s { - background: transparent url(spread/bottom-middle.gif) repeat-x 0 0; - height:7px; -} - -.spread_se, .spread_sizer { - background: transparent url(spread/bottom-right-c.gif) no-repeat 0 0; - width:7px; - height:7px; -} - -.spread_sizer { - cursor:se-resize; -} - -.spread_close { - width: 23px; - height: 23px; - background: transparent url(spread/button-close-focus.gif) no-repeat 0 0; - position:absolute; - top:0px; - right:11px; - cursor:pointer; - z-index:1000; -} - -.spread_minimize { - width: 23px; - height: 23px; - background: transparent url(spread/button-min-focus.gif) no-repeat 0 0; - position:absolute; - top:0px; - right:55px; - cursor:pointer; - z-index:1000; -} - -.spread_maximize { - width: 23px; - height: 23px; - background: transparent url(spread/button-max-focus.gif) no-repeat 0 0; - position:absolute; - top:0px; - right:33px; - cursor:pointer; - z-index:1000; -} - -.spread_title { - float:left; - height:14px; - font-family: Tahoma, Arial, sans-serif; - font-size:14px; - font-weight:bold; - text-align:left; - margin-top:2px; - width:100%; - color:#E47211; -} - -.spread_content { - overflow:auto; - color: #222; - font-family: Tahoma, Arial, sans-serif; - font-size: 10px; - background:#A9EA00; -} - +.overlay_spread { + background-color: #85BBEF; + filter:alpha(opacity=60); + -moz-opacity: 0.6; + opacity: 0.6; +} + +.spread_nw { + background: transparent url(spread/left-top.gif) no-repeat 0 0; + width:10px; + height:25px; +} + +.spread_n { + background: transparent url(spread/top-middle.gif) repeat-x 0 0; + height:25px; +} + +.spread_ne { + background: transparent url(spread/right-top.gif) no-repeat 0 0; + width:10px; + height:25px; +} + +.spread_w { + background: transparent url(spread/frame-left.gif) repeat-y top left; + width:7px; +} + +.spread_e { + background: transparent url(spread/frame-right.gif) repeat-y top right; + width:7px; +} + +.spread_sw { + background: transparent url(spread/bottom-left-c.gif) no-repeat 0 0; + width:7px; + height:7px; +} + +.spread_s { + background: transparent url(spread/bottom-middle.gif) repeat-x 0 0; + height:7px; +} + +.spread_se, .spread_sizer { + background: transparent url(spread/bottom-right-c.gif) no-repeat 0 0; + width:7px; + height:7px; +} + +.spread_sizer { + cursor:se-resize; +} + +.spread_close { + width: 23px; + height: 23px; + background: transparent url(spread/button-close-focus.gif) no-repeat 0 0; + position:absolute; + top:0px; + right:11px; + cursor:pointer; + z-index:1000; +} + +.spread_minimize { + width: 23px; + height: 23px; + background: transparent url(spread/button-min-focus.gif) no-repeat 0 0; + position:absolute; + top:0px; + right:55px; + cursor:pointer; + z-index:1000; +} + +.spread_maximize { + width: 23px; + height: 23px; + background: transparent url(spread/button-max-focus.gif) no-repeat 0 0; + position:absolute; + top:0px; + right:33px; + cursor:pointer; + z-index:1000; +} + +.spread_title { + float:left; + height:14px; + font-family: Tahoma, Arial, sans-serif; + font-size:14px; + font-weight:bold; + text-align:left; + margin-top:2px; + width:100%; + color:#E47211; +} + +.spread_content { + overflow:auto; + color: #222; + font-family: Tahoma, Arial, sans-serif; + font-size: 10px; + background:#A9EA00; +} + From 37f5b9ff46f28bae55a3d6b712887dcfcf7106dc Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Sep 2017 10:20:09 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E4=BD=9C=E5=93=81?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 102 ++++---- app/helpers/application_helper.rb | 12 + app/helpers/exercise_helper.rb | 20 ++ app/helpers/student_work_helper.rb | 12 - app/views/exercise/_exercises_list.html.erb | 4 +- app/views/exercise/_student_exercise.html.erb | 110 ++++++--- .../exercise/student_exercise_list.html.erb | 221 +++++++++--------- .../exercise/student_exercise_list.js.erb | 2 +- app/views/student_work/index.html.erb | 2 +- public/javascripts/edu/base_edu.js | 105 +++++++++ 10 files changed, 373 insertions(+), 217 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 70e06036a..6a52fa961 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -118,10 +118,9 @@ class ExerciseController < ApplicationController end def edit - @left_nav_type = 8 respond_to do |format| format.html{render :layout => 'base_edu'} - end + end end def update @@ -481,77 +480,68 @@ class ExerciseController < ApplicationController end def student_exercise_list -=begin - if @exercise.end_time <= Time.now - @course.student.each do |student| - if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,@exercise.id).empty? - ExerciseUser.create(:user_id => student.student_id, :exercise_id => @exercise.id, :start_at => @exercise.end_time, :status => true,:score=>0) - end - - s_score = calculate_student_score(@exercise, student.student) - exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", student.student_id, @exercise.id).first - exercise_user.update_attributes(:score => s_score) - end - end -=end - @name,@select_group = params[:name].to_s.strip || "",params[:group] + @order,@b_sort,@name,@group,@comment,@status = params[:order] || "end_at",params[:sort] || "desc",params[:name].to_s.strip || "",params[:ex_group], params[:ex_comment], params[:ex_status] @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - if @is_teacher - @all_exercises = @course.exercises.order("created_at desc") - else - @all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc") - end + student_id = @course.student.blank? ? "(-1)" : "(" + @course.student.map{|student| student.student_id}.join(",") + ")" - if @select_group - if @select_group == "0" - none_group_students = @course.members.select{ |member| member.course_group_id == 0 } - if none_group_students.empty? - student_in_group = '(0)' - else - student_in_group = '(' + none_group_students.map{ |member| member.user_id }.join(',') + ')' - end - elsif @select_group == "-1" - all_group_students = @course.members.select{ |member| member.course_group_id } - if all_group_students.empty? - student_in_group = '(0)' - else - student_in_group = '(' + all_group_students.map{ |member| member.user_id }.join(',') + ')' - end + if @group + group_students = @course.members.where(:course_group_id => @group).joins("join users on members.user_id = users.id").select{|m| m.roles.to_s.include?("Student")} + + if group_students.empty? + student_in_group = '(-1)' else - course_group = CourseGroup.find_by_id(@select_group) - group_students = course_group.users - if group_students.empty? - student_in_group = '(0)' - else - student_in_group = '(' + group_students.map{ |user| user.id }.join(',') + ')' - end + student_in_group = '(' + group_students.map{ |member| member.user_id }.join(',') + ')' end - if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time <= Time.now) - @exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id in #{student_id} and user_id in #{student_in_group}"), @name + + if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id, :commit_status => 1).empty? && @exercise.score_open && @exercise.end_time <= Time.now) + @exercise_users_list = @exercise.exercise_users.where("user_id in #{student_in_group}").order("#{@order} #{@b_sort}") @show_all = true; - elsif !@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time > Time.now - @exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id = ? and user_id in #{student_id} and user_id in #{student_in_group}",User.current.id), @name + elsif !@exercise.exercise_users.where(:user_id => User.current.id, :commit_status => 1).empty? + @exercise_users_list = @exercise.exercise_users.where("user_id = ? and user_id in #{student_in_group}",User.current.id) else @exercise_users_list = [] end else - if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time <= Time.now) - @exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id in #{student_id}"), @name + if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id, :commit_status => 1).empty? && @exercise.score_open && @exercise.end_time <= Time.now) + @exercise_users_list = @exercise.exercise_users.where("user_id in #{student_id}").order("#{@order} #{@b_sort}") @show_all = true; - elsif !@exercise.exercise_users.where("user_id = #{User.current.id}").empty? && @exercise.end_time > Time.now - @exercise_users_list = search_exercise_member @exercise.exercise_users.where("user_id = ? and user_id in #{student_id}",User.current.id), @name + elsif !@exercise.exercise_users.where(:user_id => User.current.id, :commit_status => 1).empty? + @exercise_users_list = @exercise.exercise_users.where("user_id = ? and user_id in #{student_id}",User.current.id) else @exercise_users_list = [] end end - @exercise_count = @exercise.exercise_users.where("commit_status = 1 and user_id in #{student_id}").count - @left_nav_type = 8 + + unless @comment.blank? + if @comment.include?('0') + @exercise_users_list = @exercise_users_list.where(:subjective_score => -1) + else + @exercise_users_list = @exercise_users_list.where("subjective_score != -1") + end + end + + unless @status.blank? + @exercise_users_list = @exercise_users_list.where(:commit_status => @status) + end + + @exercise_users_list = search_exercise_member @exercise_users_list, @name + + @score = @b_sort == "desc" ? "asc" : "desc" + @exercise_count = @exercise_users_list.count + @has_commit_count = @exercise.exercise_users.where(:commit_status => 1).count + @no_group_count = @course.members.where(:course_group_id => 0).select{|m| m.roles.to_s.include?("Student")}.count + @limit = 50 + @is_remote = true + @page = (params['page'] || 1).to_i + @exercise_pages = Paginator.new @exercise_count, @limit, @page + @offset ||= @exercise_pages.offset + @exercise_users_list = paginateHelper @exercise_users_list, @limit respond_to do |format| format.js - format.html + format.html{render :layout => 'base_edu'} format.xls { - filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@exercise.exercise_name}#{l(:excel_exercise_list)}.xls" + filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@exercise.exercise_name}#{l(:excel_exercise_list)}.xls" send_data(exercise_to_xls(@exercise_users_list), :type => "text/excel;charset=utf-8; header=present", :filename => filename_for_content_disposition(filename)) } @@ -948,7 +938,7 @@ class ExerciseController < ApplicationController else name = name.downcase select_exercises = exercises.select{ |exercise| - exercise.user[:login].to_s.downcase.include?(name) || exercise.user.user_extensions[:student_id].to_s.downcase.include?(name) || (exercise.user[:lastname].to_s.downcase + exercise.user[:firstname].to_s.downcase).include?(name) + exercise.user.user_extensions[:student_id].to_s.downcase.include?(name) || (exercise.user[:lastname].to_s.downcase + exercise.user[:firstname].to_s.downcase).include?(name) } end select_exercises diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ad90d5132..03a045d3a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,6 +33,18 @@ module ApplicationHelper extend Forwardable def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter + # 作品列表的提交状态 + def list_work_status status + case status + when 0 + str = "未提交" + when 1 + str = "按时提交" + when 2 + str = "延时提交" + end + end + # 定义当前关卡是否有权开启下一关 # :实训若发布了,必须通过当前关卡才能查看下一关 # :未发布的实训,除了最后一关,其它的关卡都可以进入下一关 diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb index 28dd0b260..abaa95c84 100644 --- a/app/helpers/exercise_helper.rb +++ b/app/helpers/exercise_helper.rb @@ -1,6 +1,26 @@ # encoding: utf-8 module ExerciseHelper + def un_commit_num exercise + course = exercise.course + exercise.exercise_users.where(:commit_status => 0, :user_id => course.student.map(&:student_id)).count + end + + def has_commit_num exercise + course = exercise.course + exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id)).count + end + + def un_comment_num exercise + course = exercise.course + exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id), :subjective_score => -1).count + end + + def has_comment_num exercise + course = exercise.course + exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id)).count - exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id), :subjective_score => -1).count + end + # 单选 def sigle_selection_standard_answer(params) size = params.ord - 96 diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index b016bbf61..9b3c17a95 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -85,18 +85,6 @@ module StudentWorkHelper str end - # 作品列表的提交状态 - def list_work_status status - case status - when 0 - str = "未提交" - when 1 - str = "按时提交" - when 2 - str = "延时提交" - end - end - # 作品的助教评分模式 def ta_score_mode homework mode = homework.homework_detail_manual.ta_mode == 1 ? '平均' : '复审' diff --git a/app/views/exercise/_exercises_list.html.erb b/app/views/exercise/_exercises_list.html.erb index 56897c242..bba27a232 100644 --- a/app/views/exercise/_exercises_list.html.erb +++ b/app/views/exercise/_exercises_list.html.erb @@ -18,8 +18,8 @@ 更新于<%=time_from_now exercise.updated_at %> <%= exercise.exercise_users.where("commit_status = 1").count %>已答 <%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %>未答 - <% count = exercise.exercise_users.where("commit_status = 1 and subjective_score = -1").count %> - <%= count %>未评 + <%# count = exercise.exercise_users.where("commit_status = 1 and subjective_score = -1").count %> + <%= un_commit_num exercise %>未评 <%= ex_curr_status[:time] %> <% if exercise.try(:exercise_status) == 0 && exercise.publish_time %> 将于 <%= format_time(exercise.publish_time).to_s %> 发布 diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index 04d874000..1a1ec09a8 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -1,30 +1,84 @@ -
    - - 测验 - - (<%= @exercise_count%>人已答) - - - <%if @is_teacher || @exercise.exercise_status == 3%> -
    - - -
    - <%= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@select_group), {:class => "classSplit"}) unless course_group_list(@course).empty? %> - <% end %> - +
    + <%= link_to "提交时间排序", student_exercise_list_exercise_path(@exercise, :order => "end_at", :sort => @score, :name => @name, :ex_group => @group, :ex_comment => @comment, :ex_status => @status), :class => "#{@order == 'end_at' ? 'color-orange03' : ''} fl ml15", :remote => true %> + | + <%= link_to "最终成绩排序", student_exercise_list_exercise_path(@exercise, :order => "score", :sort => @score, :name => @name, :ex_group => @group, :ex_comment => @comment, :ex_status => @status), :class => "#{@order == 'score' ? 'color-orange03' : ''} fl", :remote => true %> +

    <%= @exercise_count %> 个检索结果(学生:<%= @course.student.count %>人)

    +
    + + + + + + + + + + + + + + + + + <% @exercise_users_list.each_with_index do |exercise, index| %> + + + + + + + + + + + + + + + + + + + + + <% end %> + +
    序号姓名学号提交状态提交时间客观题得分主观题教师评分最终成绩操作
    <%= (@page - 1) * @limit + index + 1 %> + <%= link_to exercise.user.show_real_name, user_path(exercise.user),:class=>"color-grey3" %> + "> + <%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id %> + + <%= (list_work_status exercise.commit_status).html_safe %> + <%= exercise.commit_status == 0 ? '--' : format_time(exercise.end_at) %> + <%= exercise.objective_score == -1 ? "--" : format("%.1f",exercise.objective_score)%> + + <%= exercise.subjective_score == -1 ? "--" : format("%.1f",exercise.subjective_score)%> + + <%= exercise.score.nil? ? "--" : format("%.1f",exercise.score)%> + <%# unless exercise.score.nil? %> + + + + + + + + + + <%# end %> + + <% if exercise.commit_status > 0 %> + <%= link_to @is_teacher ? '评阅' : '查看', show_student_result_exercise_path(@exercise,:user_id => exercise.user_id), :target => "_blank" %> + <% else %> + -- + <% end %> +
    -
    - - -

    客观题由系统自动评分:
    - 单选题、多选题、填空题

    主观题需要人工评分,但未作答时系统
    自动评零分:
    问答题 -

    +
    +
    +
      + <%= pagination_links_full @exercise_pages, @exercise_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> +
    +
    -
    -
    - -
    - <%= render :partial => "student_table" %> -
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/app/views/exercise/student_exercise_list.html.erb b/app/views/exercise/student_exercise_list.html.erb index 10ba57ff3..2b51f9707 100644 --- a/app/views/exercise/student_exercise_list.html.erb +++ b/app/views/exercise/student_exercise_list.html.erb @@ -1,126 +1,113 @@ - -
    -
    -
    - - - <% if @is_teacher%> -
    - <%= link_to "导出成绩", student_exercise_list_exercise_path(@exercise.id,:course_id => @course.id, :format => 'xls'),:class=>'linkBlue', :id => "export_student_work"%> -
    - <% end%> -
    -
    - -
    -
    - <%= link_to @exercise.exercise_name, exercise_path(@exercise), :class => 'homepagePostTitle fl hidden m_w460', :title => "#{@exercise.exercise_name}", :target => '_blank' %> - <% if @exercise.exercise_status == 1 %> - 未发布 - <% elsif @exercise.exercise_status == 2 %> - 已发布 - <% elsif @exercise.exercise_status == 3 %> - 已截止 - <% end%> - [ 隐藏测验信息 ] -
    -
    发布者:<%= @exercise.user.show_name %>
    -
    -
    <%= @exercise.exercise_description.html_safe %>
    -
    - - -
    -
    -
    截止时间:<%= format_time @exercise.end_time %>
    - <% if @exercise.exercise_status == 1 %> -
    发布时间:<%= format_time @exercise.publish_time %>
    - <% end %> - <% if @exercise.end_time && @exercise.end_time.to_time.to_i > Time.now.to_i %> - <% end_time = @exercise.end_time.to_time.to_i %> -
    提交剩余时间: <%= (end_time - Time.now.to_i) / (24*60*60) %> 天 - <%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%> 小时 - <%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%>
    - <% else %> -
    提交已截止
    +
    +

    + + <%= link_to @course.name, course_path(@course) %> > <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> > #<%= get_ex_index(@exercise, @course, @is_teacher) + 1 %> +

    +
    +

    + <% unless @exercise.is_public %> + + <% end %> + <%= @exercise.exercise_name %> +

    + <%= link_to "返回", exercise_index_path(:course_id => @course.id), :class => "fr font-12 mr15 mt3 color-grey" %> + <% if @is_teacher %> + <%= link_to "设置", setting_exercise_path(@exercise), :class => "fr font-12 mr15 mt3 color-grey" %> + <% else %> + + <%= link_to "查看设置", setting_exercise_path(@exercise), :class => "fr font-12 mr15 mt3 color-grey" %> + <% end %> +
    +
    + +
    + + <% if @is_teacher %> +
    +
  • + <%= link_to "导出成绩", student_exercise_list_exercise_path(@exercise, :course_id => @course.id, :format => 'xls'), :id => "export_exercise_work", :class => "fr white-btn orange-btn ml10 mt8" %> +
    +
    + + +
    + +
    +
  • + +
  • + 你的评阅: + + 不限 + + > + + > + +
  • +
  • + 作品状态: + + 不限 + + > + + > + +
  • +
  • + 分班情况: + + 不限 + + <% @exercise.course.course_groups.each do |group| %> + > + <% end %> -
    -
  • -
    -
    + + + + + <% elsif User.current.member_of_course?(@exercise.course) %> + +

    + <% ex_user = @exercise.exercise_users.where(:user_id => User.current).first %> + <% if ex_user && ex_user.commit_status > 0 %> + 你已提交 + <%= link_to '查看答题', show_student_result_exercise_path(@exercise,:user_id => User.current.id), :class => "white-btn orange-btn fr" %> + <% else %> + 你未提交 + <% end %> +

    +

    + (<%= @has_commit_count %>人已交) + <% if @exercise.exercise_status == 2 && @exercise.end_time > Time.now %> + <% end_time = @exercise.end_time.to_time.to_i %> + 答题剩余时间:<%= (end_time - Time.now.to_i) / (24*60*60) %><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%>小时<%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%> + <% elsif @exercise.exercise_status == 3 %> + 提交已截止 + <% end %> +

    + <% end %> -
    -
    -
    - <%= render :partial => "exercise/student_exercise"%> -
    -
    +
    + <%= render :partial => "exercise/student_exercise"%>
    - -
    -
    \ No newline at end of file +
    \ No newline at end of file diff --git a/app/views/exercise/student_exercise_list.js.erb b/app/views/exercise/student_exercise_list.js.erb index dd9aa50c3..fe0a29278 100644 --- a/app/views/exercise/student_exercise_list.js.erb +++ b/app/views/exercise/student_exercise_list.js.erb @@ -1,2 +1,2 @@ $("#exercise_student_work_list").html("<%= escape_javascript(render :partial => 'exercise/student_exercise') %>"); -$("#export_student_work").replaceWith("<%= escape_javascript( link_to "导出成绩", student_exercise_list_exercise_path(@exercise.id,:course_id => @course.id, :group => @select_group, :name => @name, :format => 'xls'),:class=>'linkBlue', :id => 'export_student_work') %>"); \ No newline at end of file +$("#export_exercise_work").replaceWith("<%= escape_javascript(link_to "导出成绩", student_exercise_list_exercise_path(@exercise, :course_id => @course.id, :format => 'xls'), :class => "fr white-btn orange-btn ml10 mt8", :id => "export_exercise_work") %>"); \ No newline at end of file diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 64b5e823d..613b7754a 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -223,7 +223,7 @@ <% end %>
    - +
    diff --git a/public/javascripts/edu/base_edu.js b/public/javascripts/edu/base_edu.js index cae5f4018..f59f4babe 100644 --- a/public/javascripts/edu/base_edu.js +++ b/public/javascripts/edu/base_edu.js @@ -945,6 +945,111 @@ function SearchByName_1() }); } +$(function(){ + $("#ex_comment_no_limit").live('click', function(){ + if(!$(this).hasClass("color-orange03")){ + $(this).addClass("color-orange03"); + $("input[name='ex_comment[]']").attr("checked", false); + $.ajax({ + url: '/exercise/'+$("#exercise_id").val()+'/student_exercise_list?name='+$("#student_user_name").val(), + type: 'get', + data: $("#exercise_user_search_form").serialize(), + remote: true, + success: function(data){ + } + }); + } + }); + $("input[name='ex_comment[]']").live('click', function(){ + if($("input[name='ex_comment[]']:checked").length == 2 || $("input[name='ex_comment[]']:checked").length == 0){ + $("input[name='ex_comment[]']:checked").attr("checked", false); + $("#ex_comment_no_limit").addClass("color-orange03"); + } else{ + $("#ex_comment_no_limit").removeClass("color-orange03"); + } + $.ajax({ + url: '/exercise/'+$("#exercise_id").val()+'/student_exercise_list?name='+$("#student_user_name").val(), + type: 'get', + data: $("#exercise_user_search_form").serialize(), + remote: true, + success: function(data){ + } + }); + }); + $("#ex_status_no_limit").live('click', function(){ + if(!$(this).hasClass("color-orange03")){ + $(this).addClass("color-orange03"); + $("input[name='ex_status[]']").attr("checked", false); + $.ajax({ + url: '/exercise/'+$("#exercise_id").val()+'/student_exercise_list?name='+$("#student_user_name").val(), + type: 'get', + data: $("#exercise_user_search_form").serialize(), + remote: true, + success: function(data){ + } + }); + } + }); + $("input[name='ex_status[]']").live('click', function(){ + if($("input[name='ex_status[]']:checked").length == 2 || $("input[name='ex_status[]']:checked").length == 0){ + $("input[name='ex_status[]']:checked").attr("checked", false); + $("#ex_status_no_limit").addClass("color-orange03"); + } else{ + $("#ex_status_no_limit").removeClass("color-orange03"); + } + $.ajax({ + url: '/exercise/'+$("#exercise_id").val()+'/student_exercise_list?name='+$("#student_user_name").val(), + type: 'get', + data: $("#exercise_user_search_form").serialize(), + remote: true, + success: function(data){ + } + }); + }); + $("#ex_group_no_limit").live('click', function(){ + if(!$(this).hasClass("color-orange03")){ + $(this).addClass("color-orange03"); + $("input[name='ex_group[]']").attr("checked", false); + $.ajax({ + url: '/exercise/'+$("#exercise_id").val()+'/student_exercise_list?name='+$("#student_user_name").val(), + type: 'get', + data: $("#exercise_user_search_form").serialize(), + remote: true, + success: function(data){ + } + }); + } + }); + $("input[name='ex_group[]']").live('click', function(){ + if($("input[name='ex_group[]']:checked").length == $("input[name='ex_group[]']").length || $("input[name='ex_group[]']:checked").length == 0){ + $("input[name='ex_group[]']:checked").attr("checked", false); + $("#ex_group_no_limit").addClass("color-orange03"); + } else{ + $("#ex_group_no_limit").removeClass("color-orange03"); + } + $.ajax({ + url: '/exercise/'+$("#exercise_id").val()+'/student_exercise_list?name='+$("#student_user_name").val(), + type: 'get', + data: $("#exercise_user_search_form").serialize(), + remote: true, + success: function(data){ + } + }); + }); +}); + +function SearchByName_ex() +{ + $.ajax({ + url: '/exercise/'+$("#exercise_id").val()+'/student_exercise_list?name='+$("#student_user_name").val(), + type: 'get', + data: $("#exercise_user_search_form").serialize(), + remote: true, + success: function(data){ + } + }); +} + function choose_course(user_id, hw_id) { $.ajax({ type: 'get', From e13bb9316f858024cacda4b35be9bb1c2416163b Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Sep 2017 15:55:37 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E6=8F=92?= =?UTF-8?q?=E5=85=A5=E3=80=81=E4=B8=8A=E4=B8=8B=E7=A7=BB=E5=8A=A8=E3=80=81?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=AD=89=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 61 ++++---- app/views/exercise/_edit_head.html.erb | 4 +- app/views/exercise/_edu_edit_form.html.erb | 65 +++----- app/views/exercise/_exercise_content.html.erb | 90 ++++------- app/views/exercise/_exercises_list.html.erb | 2 +- app/views/exercise/_new_MC.html.erb | 9 +- app/views/exercise/_new_MCQ.html.erb | 11 +- app/views/exercise/_new_head.html.erb | 2 +- app/views/exercise/_new_multi.html.erb | 5 +- app/views/exercise/_new_single.html.erb | 9 +- app/views/exercise/_show_MC.html.erb | 146 +++--------------- app/views/exercise/_show_MCQ.html.erb | 145 +++-------------- app/views/exercise/_show_head.html.erb | 2 +- app/views/exercise/_show_multi.html.erb | 98 ++---------- app/views/exercise/_show_single.html.erb | 117 ++------------ .../exercise/_total_questions_score.html.erb | 18 ++- .../exercise/create_exercise_question.js.erb | 10 +- .../exercise/delete_exercise_question.js.erb | 6 +- app/views/exercise/edit.html.erb | 1 + app/views/exercise/update_question_num.js.erb | 6 +- config/routes.rb | 2 +- public/javascripts/edu/course.js | 25 ++- public/stylesheets/css/edu-class.css | 2 + 23 files changed, 227 insertions(+), 609 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 6a52fa961..534a2fdc2 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -188,17 +188,14 @@ class ExerciseController < ApplicationController option = { :question_title => question_title, :question_type => params[:question_type] || 1, - :question_number => params[:question_type] == "1"? @exercise.exercise_questions.where("question_type = 1").count + 1 : - (params[:question_type] == "2" ? (@exercise.exercise_questions.where("question_type = 2").count + 1) : - (params[:question_type] == "3" ? (@exercise.exercise_questions.where("question_type = 3").count + 1) : - @exercise.exercise_questions.where("question_type = 4").count + 1)), + :question_number => @exercise.exercise_questions.count + 1, :question_score => params[:question_score] } @exercise_questions = @exercise.exercise_questions.new option # params[:question_answer] 题目选项 if params[:question_answer] for i in 1..params[:question_answer].count - answer = (params[:question_answer].values[i-1].nil? || params[:question_answer].values[i-1].empty?) ? l(:label_new_answer) : params[:question_answer].values[i-1] + answer = params[:question_answer][i-1] question_option = { :choice_position => i, :choice_text => answer @@ -207,20 +204,23 @@ class ExerciseController < ApplicationController end end # 如果是插入的话,那么从插入的这个id以后的question_num都将要+1 - if params[:quest_id] + if params[:quest_id] != "0" @is_insert = true - if @exercise_questions.question_type == 1 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number + 1") - #@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1") - elsif @exercise_questions.question_type == 2 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number + 1") - elsif @exercise_questions.question_type == 3 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number + 1") - else - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).update_all(" question_number = question_number + 1") + insert_que = ExerciseQuestion.find params[:quest_id] + if insert_que + @exercise.exercise_questions.where("question_number>?",insert_que.question_number).update_all("question_number = question_number + 1") + # if @exercise_questions.question_type == 1 + # ExerciseQuestion.where("question_number>?",params[:quest_num].to_i).update_all(" question_number = question_number + 1") + # elsif @exercise_questions.question_type == 2 + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number + 1") + # elsif @exercise_questions.question_type == 3 + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number + 1") + # else + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).update_all(" question_number = question_number + 1") + # end + # @exercise_question_num = params[:quest_num].to_i + @exercise_questions.question_number = insert_que.question_number + 1 end - # @exercise_question_num = params[:quest_num].to_i - @exercise_questions.question_number = params[:quest_num].to_i + 1 end if @exercise_questions.save # params[:exercise_choice] 标准答案参数 @@ -229,7 +229,7 @@ class ExerciseController < ApplicationController for i in 1..params[:exercise_choice].count standart_answer = ExerciseStandardAnswer.new standart_answer.exercise_question_id = @exercise_questions.id - standart_answer.answer_text = params[:exercise_choice].values[i-1] + standart_answer.answer_text = params[:exercise_choice][i-1] standart_answer.save end elsif @exercise_questions.question_type == 4 @@ -337,16 +337,17 @@ class ExerciseController < ApplicationController @exercise_question = ExerciseQuestion.find params[:exercise_question] @exercise = @exercise_question.exercise - if @exercise_question.question_type == 1 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number - 1") - #@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1") - elsif @exercise_question.question_type == 2 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number - 1") - elsif @exercise_question.question_type == 3 - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number - 1") - else - ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).update_all(" question_number = question_number - 1") - end + ExerciseQuestion.where("question_number>?",params[:quest_num].to_i).update_all("question_number = question_number - 1") + # if @exercise_question.question_type == 1 + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number - 1") + # #@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1") + # elsif @exercise_question.question_type == 2 + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number - 1") + # elsif @exercise_question.question_type == 3 + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number - 1") + # else + # ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).update_all(" question_number = question_number - 1") + # end # @exercise_question_num = params[:quest_num].to_i # @exercise_questions.question_number = params[:quest_num].to_i - 1 # @@ -368,12 +369,12 @@ class ExerciseController < ApplicationController exercise_questions = @exercise.exercise_questions if @exercise_question if params[:opr] == 'up' && @exercise_question.question_number > 1 - @before_que = exercise_questions.where("question_type = #{@exercise_question.question_type} and question_number = #{@exercise_question.question_number - 1}").first + @before_que = exercise_questions.where("question_number = #{@exercise_question.question_number - 1}").first if @before_que && @exercise_question.update_attribute('question_number', @exercise_question.question_number - 1) @before_que.update_attribute('question_number', @before_que.question_number + 1) end elsif params[:opr] == 'down' && @exercise_question.question_number < exercise_questions.count - @after_que = exercise_questions.where("question_type = #{@exercise_question.question_type} and question_number = #{@exercise_question.question_number + 1}").first + @after_que = exercise_questions.where("question_number = #{@exercise_question.question_number + 1}").first if @after_que && @exercise_question.update_attribute('question_number', @exercise_question.question_number + 1) @after_que.update_attribute('question_number', @after_que.question_number - 1) end diff --git a/app/views/exercise/_edit_head.html.erb b/app/views/exercise/_edit_head.html.erb index 487900208..1aa23f3d8 100644 --- a/app/views/exercise/_edit_head.html.erb +++ b/app/views/exercise/_edit_head.html.erb @@ -6,7 +6,7 @@

    - 保存 - 取消 + 保存 + 取消

    <% end %> \ No newline at end of file diff --git a/app/views/exercise/_edu_edit_form.html.erb b/app/views/exercise/_edu_edit_form.html.erb index 83c684cec..1a26bafeb 100644 --- a/app/views/exercise/_edu_edit_form.html.erb +++ b/app/views/exercise/_edu_edit_form.html.erb @@ -14,22 +14,14 @@
    +
    + <%= render :partial => "exercise/total_questions_score" %> +
    +
    - - - - - - - - - - - - - - - + <% if is_edit %> + <%= render :partial => "exercise/exercise_content" %> + <% end %>
    @@ -44,7 +36,7 @@
  • - +
  • @@ -52,7 +44,7 @@ @@ -60,23 +52,11 @@ -
    -

    - 单选题 3 题,共 15  - 多选题 5 题,共 25  - 填空题 10 题,共 25  - 简答题 10 题,共 25  -

    - - 合计 10 题,共 100  - -
    - \ No newline at end of file diff --git a/app/views/exercise/_new_MCQ.html.erb b/app/views/exercise/_new_MCQ.html.erb index 4e54ec274..70bebd42a 100644 --- a/app/views/exercise/_new_MCQ.html.erb +++ b/app/views/exercise/_new_MCQ.html.erb @@ -7,6 +7,7 @@

    多选题

    +
    @@ -18,21 +19,21 @@ - +
  • - +
  • - +
  • @@ -44,7 +45,7 @@
  • <% score = exercise.exercise_questions.where("question_type=2").last.nil? ? "": exercise.exercise_questions.where("question_type=2").last.question_score %> - +

    温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案 @@ -58,7 +59,7 @@ \ No newline at end of file diff --git a/app/views/exercise/_new_head.html.erb b/app/views/exercise/_new_head.html.erb index b7387d6ea..d651b3d0d 100644 --- a/app/views/exercise/_new_head.html.erb +++ b/app/views/exercise/_new_head.html.erb @@ -12,6 +12,6 @@

  • - 保存 + 保存

    <% end %> \ No newline at end of file diff --git a/app/views/exercise/_new_multi.html.erb b/app/views/exercise/_new_multi.html.erb index 688ed9da6..2ed014967 100644 --- a/app/views/exercise/_new_multi.html.erb +++ b/app/views/exercise/_new_multi.html.erb @@ -6,6 +6,7 @@

    简答题

    +
  • @@ -17,7 +18,7 @@
  • <% score = exercise.exercise_questions.where("question_type=4").last.nil? ? "": exercise.exercise_questions.where("question_type=4").last.question_score %> - +

    温馨提示:[简答题]属于主观题需要人工评分,未作答的情况下系统将自动评分 @@ -32,7 +33,7 @@ \ No newline at end of file diff --git a/app/views/exercise/_new_single.html.erb b/app/views/exercise/_new_single.html.erb index 7f781cba8..a92b7a7ae 100644 --- a/app/views/exercise/_new_single.html.erb +++ b/app/views/exercise/_new_single.html.erb @@ -7,17 +7,18 @@

    填空题

  • +
  • - +
  • - +
  • @@ -27,7 +28,7 @@
  • <% score = exercise.exercise_questions.where("question_type=3").last.nil? ? "": exercise.exercise_questions.where("question_type=3").last.question_score %> - +

    温馨提示:[填空题]属于客观题将由系统自动评分,请设置标准答案 @@ -41,7 +42,7 @@ \ No newline at end of file diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb index ec260c45d..dde727bca 100644 --- a/app/views/exercise/_show_MC.html.erb +++ b/app/views/exercise/_show_MC.html.erb @@ -2,159 +2,55 @@

    第<%= exercise_question.question_number%>题:[单选题]<%= exercise_question.question_score %>

    - - - - - + <% if exercise_question.question_number < @exercise.exercise_questions.count %> + + <% end %> + <% unless exercise_question.question_number == 1 %> + + <% end %> + + +

    -

    <%= exercise_question.question_title %>

    +
    <%= exercise_question.question_title %>
    <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> -
  • +
  • + + +
  • <% end %>
    标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
    -<% if false%> -
    -
    -
    - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分   - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> - -
    -
    -

    <%= exercise_question.question_title %>

    -
    -
    - - - <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> - - - - <% end %> - -
    - -
    -
    -
    - <% end %> -
    +
    \ No newline at end of file diff --git a/app/views/exercise/_show_MCQ.html.erb b/app/views/exercise/_show_MCQ.html.erb index 26d8f5e94..d02c0b9ba 100644 --- a/app/views/exercise/_show_MCQ.html.erb +++ b/app/views/exercise/_show_MCQ.html.erb @@ -2,17 +2,24 @@

    第<%= exercise_question.question_number%>题:[多选题]<%= exercise_question.question_score %>

    - - - - - + <% if exercise_question.question_number < @exercise.exercise_questions.count %> + + <% end %> + <% unless exercise_question.question_number == 1 %> + + <% end %> + + +

    -

    <%= exercise_question.question_title %>

    +
    <%= exercise_question.question_title %>
    <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> -
  • +
  • + + +
  • <% end %>
    @@ -20,132 +27,20 @@
    -<% if false %> -
    -
    -
    - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分   - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> - -
    -
    -

    <%= exercise_question.question_title %>

    -
    - -
    - - - <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> - - - - <% end %> - -
    - -
    -
    -
    - -<% end %> - -
    +
    \ No newline at end of file diff --git a/app/views/exercise/_show_head.html.erb b/app/views/exercise/_show_head.html.erb index e411bce95..a392bce81 100644 --- a/app/views/exercise/_show_head.html.erb +++ b/app/views/exercise/_show_head.html.erb @@ -4,7 +4,7 @@
    -
    <%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description).html_safe%>
    +
    <%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description).html_safe%>
    \ No newline at end of file diff --git a/app/views/exercise/_show_single.html.erb b/app/views/exercise/_show_single.html.erb index 229123398..39520d7de 100644 --- a/app/views/exercise/_show_single.html.erb +++ b/app/views/exercise/_show_single.html.erb @@ -2,124 +2,39 @@

    第<%= exercise_question.question_number%>题:[填空题]<%= exercise_question.question_score %>

    - - - - - + <% if exercise_question.question_number < @exercise.exercise_questions.count %> + + <% end %> + <% unless exercise_question.question_number == 1 %> + + <% end %> + + +

    -

    <%= exercise_question.question_title %>

    +
    <%= exercise_question.question_title %>
    <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>

    候选答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%>

    <% end %>
    -<% if false %> -
    -
    -
    - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分 - -
    -
    -

    <%= exercise_question.question_title %>

    -
    -
    - <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> - 参考答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%>
    - <% end %> -
    -
    -<% end %> -
    +
    \ No newline at end of file diff --git a/app/views/exercise/_total_questions_score.html.erb b/app/views/exercise/_total_questions_score.html.erb index bd6bc291a..6119a820a 100644 --- a/app/views/exercise/_total_questions_score.html.erb +++ b/app/views/exercise/_total_questions_score.html.erb @@ -1,8 +1,12 @@ -
    " id="current_score_div"> - 单选题 <%= exercise.exercise_questions.where("question_type=1").count %> 题,共<%= current_score[1] %>分 - 多选题 <%= exercise.exercise_questions.where("question_type=2").count %> 题,共<%= current_score[2] %>分 - 填空题 <%= exercise.exercise_questions.where("question_type=3").count %> 题,共<%= current_score[3] %>分 - 问答题 <%= exercise.exercise_questions.where("question_type=4").count %> 题,共<%= current_score[4] %>分 - 合计 <%= exercise.exercise_questions.count %> 题,共<%= current_score[0] %> -
    +<% current_score = get_current_score @exercise %> +
    "> +

    + 单选题 <%= @exercise.exercise_questions.where("question_type=1").count %> 题,共 <%= current_score[1] %>  + 多选题 <%= @exercise.exercise_questions.where("question_type=2").count %> 题,共 <%= current_score[2] %>  + 填空题 <%= @exercise.exercise_questions.where("question_type=3").count %> 题,共 <%= current_score[3] %>  + 简答题 <%= @exercise.exercise_questions.where("question_type=4").count %> 题,共 <%= current_score[4] %>  +

    + + 合计 <%= @exercise.exercise_questions.count %> 题,共 <%= current_score[0] %>  +
    \ No newline at end of file diff --git a/app/views/exercise/create_exercise_question.js.erb b/app/views/exercise/create_exercise_question.js.erb index af1b1af56..41510a199 100644 --- a/app/views/exercise/create_exercise_question.js.erb +++ b/app/views/exercise/create_exercise_question.js.erb @@ -1,8 +1,6 @@ <% if @is_insert %> - $("#poll_content").html('<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise})%>'); - $("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>"); - <% current_score = get_current_score @exercise %> - $("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score}) %>"); + $("#exercise_question_list").html("<%= escape_javascript(render :partial => 'exercise/exercise_content') %>"); + $("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score') %>"); <% else %> $("#new_exercise_question").html('<%= escape_javascript(render :partial => 'new_question', :locals => {:exercise => @exercise}) %>'); $("#new_poll_question").html(""); @@ -48,7 +46,5 @@ "
    " + "
    "); <% end %> -$("#total_questions_score").show(); -<% current_score = get_current_score @exercise %> -$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score}) %>"); +$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score') %>"); <% end %> diff --git a/app/views/exercise/delete_exercise_question.js.erb b/app/views/exercise/delete_exercise_question.js.erb index 0d20f1ccb..88e8297d2 100644 --- a/app/views/exercise/delete_exercise_question.js.erb +++ b/app/views/exercise/delete_exercise_question.js.erb @@ -1,5 +1,3 @@ hideModal(); -$("#poll_content").html("<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise}) %>"); -<% current_score = get_current_score @exercise %> -$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score}) %>"); -$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>"); \ No newline at end of file +$("#exercise_question_list").html("<%= escape_javascript(render :partial => 'exercise/exercise_content') %>"); +$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score') %>"); \ No newline at end of file diff --git a/app/views/exercise/edit.html.erb b/app/views/exercise/edit.html.erb index db0cef611..18b73f51d 100644 --- a/app/views/exercise/edit.html.erb +++ b/app/views/exercise/edit.html.erb @@ -7,6 +7,7 @@

    编辑试卷

    <%= link_to "返回", student_exercise_list_exercise_path(@exercise), :class => "fr font-12 color-grey mr15 mt5" %> + <%= link_to "设置", setting_exercise_path(@exercise), :class => "fr font-12 mr15 mt5 color-grey" %>
    <%= render :partial => "exercise/edu_edit_form", :locals => {:is_edit => true} %> diff --git a/app/views/exercise/update_question_num.js.erb b/app/views/exercise/update_question_num.js.erb index 4a3bef3f9..d1284e659 100644 --- a/app/views/exercise/update_question_num.js.erb +++ b/app/views/exercise/update_question_num.js.erb @@ -7,7 +7,7 @@ <% elsif @before_que.question_type == 3%> $("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @before_que}) %>"); <% elsif @before_que.question_type == 4%> - $("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_mulit', :locals => {:exercise_question => @before_que}) %>"); + $("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_multi', :locals => {:exercise_question => @before_que}) %>"); <% end%> <% elsif @after_que %> $("#poll_questions_<%= @exercise_question.id%>").insertAfter($("#poll_questions_<%= @after_que.id%>")); @@ -18,7 +18,7 @@ <% elsif @after_que.question_type == 3%> $("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @after_que}) %>"); <% elsif @after_que.question_type == 4%> - $("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_mulit', :locals => {:exercise_question => @after_que}) %>"); + $("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_multi', :locals => {:exercise_question => @after_que}) %>"); <% end%> <% end %> <% if @exercise_question.question_type == 1%> @@ -28,5 +28,5 @@ <% elsif @exercise_question.question_type == 3%> $("#show_poll_questions_<%= @exercise_question.id %>").html("<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_question}) %>"); <% elsif @exercise_question.question_type == 4%> - $("#show_poll_questions_<%= @exercise_question.id %>").html("<%= escape_javascript(render :partial => 'show_mulit', :locals => {:exercise_question => @exercise_question}) %>"); + $("#show_poll_questions_<%= @exercise_question.id %>").html("<%= escape_javascript(render :partial => 'show_multi', :locals => {:exercise_question => @exercise_question}) %>"); <% end%> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index ea06c7764..e659931c4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -527,7 +527,7 @@ RedmineApp::Application.routes.draw do post 'create_exercise_question' post 'commit_answer' get 'commit_exercise' - post 'update_question_num' + get 'update_question_num' post 'send_to_course' get 'get_student_uncomplete_question' post 'edit_question_score' diff --git a/public/javascripts/edu/course.js b/public/javascripts/edu/course.js index aa271bbdf..67072ab97 100644 --- a/public/javascripts/edu/course.js +++ b/public/javascripts/edu/course.js @@ -652,7 +652,7 @@ function ex_setting_form_submit(){ } //添加标题时确定按钮 -function add_poll_question(doc,quest_type) +function add_ex_question(doc,quest_type) { var title = $.trim($("#poll_questions_title").val()); var score = $.trim($("#question_score").val()); @@ -660,24 +660,24 @@ function add_poll_question(doc,quest_type) if(title.length == 0 || score.length == 0){ notice_box("题目标题/分数不能为空"); doc.one('click', function(){ - add_poll_question($(this),quest_type); + add_ex_question($(this),quest_type); }); }else if(!/^[1-9][0-9]*$/.test(score)) { notice_box("分数必须是非零开头的数字"); doc.one('click', function(){ - add_poll_question($(this),quest_type); + add_ex_question($(this),quest_type); }); }else if(quest_type !=3 && quest_type !=4 && standard_ans.length == 0) { notice_box("标准答案不能为空"); doc.one('click', function(){ - add_poll_question($(this),quest_type); + add_ex_question($(this),quest_type); }); }else{ doc.parent().parent().parent().parent().submit(); } } -function pollsSubmit(doc){ +function ex_head_submit(doc){ var title = $.trim($("#exercise_name").val()); if(title.length == 0){ notice_box("试卷标题不能为空"); @@ -686,7 +686,20 @@ function pollsSubmit(doc){ } } -function pollsCancel(){ +function ex_head_cancel(){ $("#exercise_head_edit").hide(); $("#exercise_head_show").show(); +} + +function exQuestionEdit(question_id){ + var forms = $("form.new_exercise_question"); + if($.trim($("#insert_new_poll_question_"+question_id).html()) == "") { + if(forms.length > 0){ + notice_box("请先保存正在编辑的题目再新建。"); + } else{ + $("#show_poll_questions_"+question_id).hide(); + $("#edit_poll_questions_"+question_id).show(); + $("#poll_questions_title_"+question_id).focus(); + } + } } \ No newline at end of file diff --git a/public/stylesheets/css/edu-class.css b/public/stylesheets/css/edu-class.css index b4ab73fce..43d2c6c32 100644 --- a/public/stylesheets/css/edu-class.css +++ b/public/stylesheets/css/edu-class.css @@ -404,3 +404,5 @@ a.uploadIcon {width:100px; height:33px;color:#ffffff;} /*课堂改版*/ .sy_member_div:hover{background:#EFF2F7;} .real-name:hover,.operation:hover{color: #FF9e6a!important;} +/*试卷*/ +pre.exercise_que_title{font-family: '微软雅黑','宋体';white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;} From f98f554aaf0b7f4f241a558916782251a0b5e1e3 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 29 Sep 2017 18:18:38 +0800 Subject: [PATCH 11/16] =?UTF-8?q?=E8=AF=95=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 28 +++--- app/models/students_for_course.rb | 23 ++++- app/views/exercise/_exercise_student.html.erb | 97 +++++++++++++++++++ app/views/exercise/setting.html.erb | 48 ++++----- .../exercise/student_exercise_list.html.erb | 9 +- lib/tasks/exercise_publish.rake | 16 +-- 6 files changed, 170 insertions(+), 51 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 534a2fdc2..d07d9b34b 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -38,20 +38,10 @@ class ExerciseController < ApplicationController end def show - publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now) - publish_exercises.each do |exercise| - exercise.update_column('exercise_status', 2) - course = exercise.course - course.members.each do |m| - exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) - end - end - unless User.current.member_of_course?(@course) || User.current.admin? render_403 return end - @exercise = Exercise.find params[:id] @exercise.course_messages.each do |message| if User.current.id == message.user_id && message.viewed == 0 message.update_attributes(:viewed => true) if message.viewed == 0 @@ -59,25 +49,30 @@ class ExerciseController < ApplicationController end @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? exercise_end = @exercise.end_time.nil? ? false : @exercise.end_time > Time.now - if @exercise.time == -1 - @can_edit_excercise = exercise_end + if User.current.member_of_course?(@course) && !@is_teacher + if @exercise.time == -1 + @can_edit_excercise = exercise_end + else + @can_edit_excercise = !has_commit_exercise?(@exercise.id,User.current.id) && exercise_end + end else - @can_edit_excercise = !has_commit_exercise?(@exercise.id,User.current.id)&& exercise_end + @can_edit_excercise = false end unless @is_teacher @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first if @exercise_user.nil? eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false) @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first + elsif @exercise_user.start_at.nil? + @exercise_user.update_attributes(:start_at => Time.now) end #score = calculate_student_score(@exercise, User.current) #@exercise_user.update_attributes(:objective_score => score, :score => (score + (@exercise_user.subjective_score > 0 ? @exercise_user.subjective_score : 0))) end # @percent = get_percent(@exercise,User.current) @exercise_questions = @exercise.exercise_questions - @left_nav_type = 8 respond_to do |format| - format.html {render :layout => 'base_courses'} + format.html {render :layout => 'base_edu'} end #end end @@ -107,6 +102,7 @@ class ExerciseController < ApplicationController exercise.exercise_description = params[:exercise][:exercise_description] exercise.user_id = User.current.id exercise.course_id = params[:course_id] + exercise.time = -1 exercise.exercise_status = 1 if exercise.save @exercise = exercise @@ -154,7 +150,7 @@ class ExerciseController < ApplicationController def ex_setting @exercise.publish_time = params[:exercise_publish_time] if params[:exercise_publish_time] @exercise.end_time = params[:exercise_end_time] if params[:exercise_end_time] - @exercise.time = params[:time] != "" ? params[:time] : -1 + @exercise.time = -1 @exercise.question_random = params[:question_random] ? 1 : 0 @exercise.choice_random = params[:choice_random] ? 1 : 0 @exercise.score_open = params[:score_open] ? 1 : 0 diff --git a/app/models/students_for_course.rb b/app/models/students_for_course.rb index 95157f2da..662d57bd2 100644 --- a/app/models/students_for_course.rb +++ b/app/models/students_for_course.rb @@ -10,7 +10,7 @@ class StudentsForCourse < ActiveRecord::Base validates_uniqueness_of :student_id, :scope => :course_id after_destroy :delete_student_works, :delete_course_homework_statistic - after_create :recovery_student_works, :create_student_works + after_create :recovery_student_works, :create_student_works, :create_exercise_users #退出班级或删除学生时隐藏学生的作品 def delete_student_works @@ -58,6 +58,27 @@ class StudentsForCourse < ActiveRecord::Base end end + # 加入班级时创建已发布试卷的作品 + def create_exercise_users + course = self.course + str = "" + exercises = course.exercises.where("exercise_status > 0") + if exercises.count != 0 + exercises.each do |ex| + if ex.exercise_users.where("user_id = #{self.student_id}").count == 0 + if str != "" + str += "," + end + str += "(#{ex.id},#{self.student_id}, 0, '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}', '#{Time.now.strftime('%Y-%m-%d %H:%M:%S')}')" + end + end + if str != "" + sql = "insert into exercise_users (exercise_id, user_id, commit_status, created_at, updated_at) values" + str + ActiveRecord::Base.connection.execute sql + end + end + end + #加入班级时创建一条记录 def create_course_homework_statistic # if CourseHomeworkStatistics.where(:user_id => self.student_id, :course_id => self.course_id).count == 0 diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb index bae12dab5..ad62644f0 100644 --- a/app/views/exercise/_exercise_student.html.erb +++ b/app/views/exercise/_exercise_student.html.erb @@ -42,6 +42,103 @@ //} } + +
    +

    + + <%= link_to @course.name, course_path(@course) %> > <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> > <%= link_to @exercise.exercise_name, student_exercise_list_exercise_path(@exercise) %> > <%= @exercise_user.user.show_real_name %> +

    +
    +

    + <% unless @exercise.is_public %> + + <% end %> + <%= @exercise.exercise_name %> +

    + + <%= format_time @exercise_user.start_at %> 开始答题 +
    + + <% unless @exercise.try(:exercise_description).nil? %> +
    +
    <%= @exercise.try(:exercise_description).html_safe%>
    +
    + <% end %> + +
    + <%= render :partial => "exercise/total_questions_score" %> +
    + +
    +
    + 已答 + 未答 +

    交卷

    +
    +
    + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 +
    +
    +
    +
    +
    +

    第1题:[多选题]10

    +
    +

    黑盒测试和白盒测试的区别

    +
    +
  • +
  • +
  • +
  • +
    +
    + +
    +
    +

    第2题:[单选题]5

    +
    +

    黑盒测试和白盒测试的区别

    +
    +
  • +
  • +
  • +
  • +
    +
    + +
    +
    +

    第3题:[填空题]5

    +
    +

    黑盒测试和白盒测试()区别

    +
    + +
    +
    + +
    +
    +

    第4题:[简答题]10

    +
    +

    黑盒测试和白盒测试的区别

    +
    + +
    +
    +
    +
    + +
    diff --git a/app/views/exercise/setting.html.erb b/app/views/exercise/setting.html.erb index fee23afc7..cc40a9eff 100644 --- a/app/views/exercise/setting.html.erb +++ b/app/views/exercise/setting.html.erb @@ -66,18 +66,18 @@
      -
    • - - - - -
    • + + + + + + + + + + + +
    • > @@ -193,18 +193,18 @@
        -
      • - - value="<%= @exercise.time.to_i == -1 ? '' : @exercise.time %>" class="fl task-form-15 task-height-40 panel-box-sizing" placeholder="60"> - - -
      • + + + + + + + + + + + +
      • class="magic-checkbox fl mt5 magic-checkbox_show" id="dt_3" type="checkbox" <%= @exercise.question_random == 1 ? 'checked' : '' %>> diff --git a/app/views/exercise/student_exercise_list.html.erb b/app/views/exercise/student_exercise_list.html.erb index 2b51f9707..dfa06302b 100644 --- a/app/views/exercise/student_exercise_list.html.erb +++ b/app/views/exercise/student_exercise_list.html.erb @@ -17,7 +17,7 @@

        <% unless @exercise.is_public %> - + <% end %> <%= @exercise.exercise_name %>

        @@ -89,9 +89,12 @@ <% ex_user = @exercise.exercise_users.where(:user_id => User.current).first %> <% if ex_user && ex_user.commit_status > 0 %> 你已提交 - <%= link_to '查看答题', show_student_result_exercise_path(@exercise,:user_id => User.current.id), :class => "white-btn orange-btn fr" %> - <% else %> + <%= link_to '查看答题', exercise_path(@exercise,:user_id => User.current.id), :class => "white-btn orange-btn fr" %> + <% else %> 你未提交 + <% if @exercise.exercise_status == 2 %> + <%= link_to '开始答题', exercise_path(@exercise,:user_id => User.current.id), :class => "white-btn orange-btn fr" %> + <% end %> <% end %>

        diff --git a/lib/tasks/exercise_publish.rake b/lib/tasks/exercise_publish.rake index 2c7423715..f7ec0403a 100644 --- a/lib/tasks/exercise_publish.rake +++ b/lib/tasks/exercise_publish.rake @@ -12,7 +12,7 @@ namespace :exercise_publish do answer = get_user_answer(question, user) standard_answer = get_user_standard_answer(question, user) unless answer.empty? - # 问答题有多个答案 + # 填空题有多个答案 if question.question_type == 3 && !standard_answer.empty? if standard_answer.include?(answer.first.answer_text) score1 = score1+ question.question_score unless question.question_score.nil? @@ -39,6 +39,9 @@ namespace :exercise_publish do exercises.each do |exercise| exercise.update_column('exercise_status', 2) course = exercise.course + course.student.each do |student| + ExerciseUser.create(:user_id => student.student_id, :exercise_id => exercise.id, :commit_status => 0) + end course.members.each do |m| exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) end @@ -48,7 +51,6 @@ namespace :exercise_publish do end task :end => :environment do - include ExerciseHelper exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) exercises.each do |exercise| course = exercise.course @@ -56,12 +58,12 @@ namespace :exercise_publish do course.student.each do |student| exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", student.student_id, exercise.id).first if exercise_user - exercise_user = ExerciseUser.create(:user_id => student.student_id, :exercise_id => exercise.id, :start_at => exercise.end_time, :status => true,:score=>0) - else - exercise_user.update_column('commit_status', 1) + if exercise_user.commit_status == 0 && !exercise_user.start_at.nil? + exercise_user.update_attributes(:commit_status => 1, :end_at => Time.now) + end + s_score = calculate_student_score(exercise, student.student) + exercise_user.update_attributes(:objective_score => s_score, :score => (s_score + (exercise_user.subjective_score > 0 ? exercise_user.subjective_score : 0))) end - s_score = calculate_student_score(exercise, student.student) - exercise_user.update_attributes(:objective_score => s_score, :score => (s_score + (exercise_user.subjective_score > 0 ? exercise_user.subjective_score : 0))) end end end From cd3c25d6005d7f9aed51453e986f9f86b9e79908 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 29 Sep 2017 19:25:06 +0800 Subject: [PATCH 12/16] =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=AF=95=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_edit_MC.html.erb | 41 ++++++++++ app/views/exercise/_edit_MCQ.html.erb | 47 ++++++++++++ app/views/exercise/_edit_multi.html.erb | 28 +++++++ app/views/exercise/_edit_single.html.erb | 41 +++++++++- app/views/exercise/_edu_edit_form.html.erb | 74 +++++++++++++++---- .../exercise/student_exercise_list.html.erb | 4 +- 6 files changed, 218 insertions(+), 17 deletions(-) diff --git a/app/views/exercise/_edit_MC.html.erb b/app/views/exercise/_edit_MC.html.erb index 9dbb510b2..f7142ad09 100644 --- a/app/views/exercise/_edit_MC.html.erb +++ b/app/views/exercise/_edit_MC.html.erb @@ -21,6 +21,46 @@ } +

        +
        +
        +

        单选题

        + +
        +
      • + + + +
      • + <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> +
      • + + + +
      • +
        + <% end %> +
      • + + +
      • +
      • + + + +

        + 温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案 + 保存 + 取消 +

        +
      • +
      +
      +<% if false %>
      @@ -65,4 +105,5 @@
      +<% end%> <% end%> \ No newline at end of file diff --git a/app/views/exercise/_edit_MCQ.html.erb b/app/views/exercise/_edit_MCQ.html.erb index a9790c470..49a8d49cc 100644 --- a/app/views/exercise/_edit_MCQ.html.erb +++ b/app/views/exercise/_edit_MCQ.html.erb @@ -20,7 +20,53 @@ "
    • "); } +
      +
      +
      +

      多选题

      + + + + +
      +
    • + + + +
    • + <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> +
    • + + + +
    • +
      + <% end %> + + +
    • + + +
    • + +
    • + + + +

      + 温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案 + 保存 + 取消 +

      +
    • +
      +
      +<% if false %>
      @@ -67,4 +113,5 @@
      + <% end %> <% end%> \ No newline at end of file diff --git a/app/views/exercise/_edit_multi.html.erb b/app/views/exercise/_edit_multi.html.erb index 2e2721282..0ed8c59c0 100644 --- a/app/views/exercise/_edit_multi.html.erb +++ b/app/views/exercise/_edit_multi.html.erb @@ -7,6 +7,33 @@ } +
      +

      简答题

      + + +
    • + + + +
    • +
    • + + +
    • +
    • + + + +

      + 温馨提示:[简答题]属于主观题需要人工评分,未作答的情况下系统将自动评分 +   参考答案仅作为人工评分的参考 + 保存 + 取消 +

      +
    • +
      + +<% if false %>
      @@ -36,4 +63,5 @@
      +<% end%> <% end%> \ No newline at end of file diff --git a/app/views/exercise/_edit_single.html.erb b/app/views/exercise/_edit_single.html.erb index 661ff12af..57256efa8 100644 --- a/app/views/exercise/_edit_single.html.erb +++ b/app/views/exercise/_edit_single.html.erb @@ -1,5 +1,6 @@ <%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%> + <% if false %> + <% end %> +
      +

      填空题

      +
    • + + + + + +
    • + <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> +
    • + + + +
    • +
      + <% end %> + +
    • + + +
    • + +
    • + + + +

      + 温馨提示:[填空题]属于客观题将由系统自动评分,请设置标准答案 + 保存 + 取消 +

      +
    • +
      + + <% if false %>
      @@ -60,4 +98,5 @@
      -<% end%> \ No newline at end of file +<% end %> +<% end %> \ No newline at end of file diff --git a/app/views/exercise/_edu_edit_form.html.erb b/app/views/exercise/_edu_edit_form.html.erb index 1a26bafeb..637027531 100644 --- a/app/views/exercise/_edu_edit_form.html.erb +++ b/app/views/exercise/_edu_edit_form.html.erb @@ -66,9 +66,11 @@ var html = bt('t:set-fillin-lists', null); $(item).parent().parent('.clearfix').before(html); var inputs = document.getElementsByName("exercise_choice[]"); - var inputs_spans = document.getElementsByName("fill_span"); + var inputs_spans=$(item).parents(".fillin_Temp").find("li span[name='fill_span']"); + //var inputs_spans = document.getElementsByName("fill_span"); for (var j = 0; j < inputs_spans.length; j++) { - $(inputs_spans[j]).html("答案 "+(j+1)); + var countChar=convert_to_chi_num(j+1); + $(inputs_spans[j]).html("答案 "+countChar); } // for (var i = 0; i < inputs.length; i++) { // autoTextarea(inputs[i], 0, 140); @@ -76,11 +78,47 @@ $(inputs[inputs.length - 1]).focus(); } +function convert_to_chi_num(num){ + var toChar=""; + switch(num){ + case 1: + return toChar="一"; + break; + case 2: + return toChar="二"; + break; + case 3: + return toChar="三"; + break; + case 4: + return toChar="四"; + break; + case 5: + return toChar="五"; + break; + case 6: + return toChar="六"; + break; + case 7: + return toChar="七"; + break; + case 8: + return toChar="八"; + break; + case 9: + return toChar="九"; + break; + } +} + function removefill(item){ + var temp=$(item).parents(".fillin_Temp"); $(item).parents('li').remove(); - var inputs_spans = document.getElementsByName("fill_span"); - for (var j = 0; j < inputs_spans.length; j++) { - $(inputs_spans[j]).html("答案 "+(j+1)); + var inputs_spans=temp.find("li span[name='fill_span']"); + //var inputs_spans = document.getElementsByName("fill_span"); + for (var j = 0; j < parseInt(inputs_spans.length); j++) { + var countChar=convert_to_chi_num(j+1); + $(inputs_spans[j]).html("答案 "+countChar); } } @@ -88,8 +126,11 @@ function removeMuli(item){ var temp=$(item).parents("li").siblings("div").find(".current-option"); var count=0; - $(item).parents('li').remove(); var muil=$(item).parents(".multiple_Temp").find(".check-option-bg"); + if($(item).parents("li").find("label span").hasClass("check-option-bg")){ + count++; + } + $(item).parents('li').remove(); var inputs_spans = document.getElementsByName("option_spans"); for (var j = 0; j < inputs_spans.length; j++) { if(j >= 0 && j <= 26){ @@ -100,7 +141,7 @@ } temp.html(""); - if(parseInt(muil.length)>0){ + if(parseInt(muil.length)-count>0){ for(var i=0;i= 0 && j <= 26){ $(inputs_spans[j]).html(String.fromCharCode(65 + j)); @@ -151,7 +193,8 @@ var html = bt('t:set-option-list', null); $(item).parent().parent('.clearfix').before(html); var inputs = document.getElementsByName("question_answer[]"); - var inputs_spans = document.getElementsByName("option_span"); + var inputs_spans=$(item).parents(".single_Temp").find("li span[name='option_span']"); + //var inputs_spans = document.getElementsByName("option_span"); for (var j = 0; j < inputs_spans.length; j++) { if(j >= 0 && j <= 26){ $(inputs_spans[j]).html(String.fromCharCode(65 + j)); @@ -161,10 +204,13 @@ } function removeSingle(item){ var temp=$(item).parents("li").siblings("div").find(".current-option"); - temp.html(""); - - $(item).parents('li').remove(); var singl=$(item).parents(".single_Temp").find(".check-option-bg"); + temp.html(""); + var count=0; + if($(item).parents("li").find("label span").hasClass("check-option-bg")){ + count++; + } + $(item).parents('li').remove(); var inputs_spans = document.getElementsByName("option_span"); for (var j = 0; j < inputs_spans.length; j++) { if(j >= 0 && j <= 26){ @@ -174,8 +220,8 @@ function removeSingle(item){ } } - if(singl.length>0){ - for(var i=0;i0){ + for(var i=0;i

      <% unless @exercise.is_public %> - + <% end %> - <%= @exercise.exercise_name %> + <%= @exercise.exercise_name %>

      <%= link_to "返回", exercise_index_path(:course_id => @course.id), :class => "fr font-12 mr15 mt3 color-grey" %> <% if @is_teacher %> From 799d97d640ed19a5d42a946f566b8082520abf58 Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 30 Sep 2017 14:36:17 +0800 Subject: [PATCH 13/16] =?UTF-8?q?=E8=80=81=E5=B8=88=E8=AF=84=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 57 +- app/helpers/exercise_helper.rb | 29 + app/models/exercise_question.rb | 14 + app/views/exercise/_exercise_student.html.erb | 537 ++++++------------ .../_exercise_student_result.html.erb | 416 ++++++-------- app/views/exercise/_student_exercise.html.erb | 6 +- app/views/exercise/commit_exercise.js.erb | 2 +- app/views/exercise/setting.html.erb | 4 +- app/views/exercise/show.html.erb | 12 +- .../exercise/student_exercise_list.html.erb | 18 +- app/views/layouts/base_edu.html.erb | 3 + lib/tasks/exercise_publish.rake | 2 +- public/stylesheets/css/taskstyle.css | 2 +- 13 files changed, 459 insertions(+), 643 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index d07d9b34b..8a88ff4df 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class ExerciseController < ApplicationController layout "base_courses" @@ -48,16 +49,7 @@ class ExerciseController < ApplicationController end end @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? - exercise_end = @exercise.end_time.nil? ? false : @exercise.end_time > Time.now - if User.current.member_of_course?(@course) && !@is_teacher - if @exercise.time == -1 - @can_edit_excercise = exercise_end - else - @can_edit_excercise = !has_commit_exercise?(@exercise.id,User.current.id) && exercise_end - end - else - @can_edit_excercise = false - end + unless @is_teacher @exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first if @exercise_user.nil? @@ -66,11 +58,20 @@ class ExerciseController < ApplicationController elsif @exercise_user.start_at.nil? @exercise_user.update_attributes(:start_at => Time.now) end + + exercise_end = @exercise.end_time.nil? ? false : @exercise.end_time > Time.now + if @exercise.time == -1 + @can_edit_excercise = exercise_end && @exercise_user.commit_status == 0 + else + @can_edit_excercise = !has_commit_exercise?(@exercise.id,User.current.id) && exercise_end + end #score = calculate_student_score(@exercise, User.current) #@exercise_user.update_attributes(:objective_score => score, :score => (score + (@exercise_user.subjective_score > 0 ? @exercise_user.subjective_score : 0))) + else + @can_edit_excercise = false end # @percent = get_percent(@exercise,User.current) - @exercise_questions = @exercise.exercise_questions + #@exercise_questions = @exercise.exercise_questions respond_to do |format| format.html {render :layout => 'base_edu'} end @@ -503,7 +504,7 @@ class ExerciseController < ApplicationController if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id, :commit_status => 1).empty? && @exercise.score_open && @exercise.end_time <= Time.now) @exercise_users_list = @exercise.exercise_users.where("user_id in #{student_id}").order("#{@order} #{@b_sort}") @show_all = true; - elsif !@exercise.exercise_users.where(:user_id => User.current.id, :commit_status => 1).empty? + elsif User.current.member_of_course?(@course) @exercise_users_list = @exercise.exercise_users.where("user_id = ? and user_id in #{student_id}",User.current.id) else @exercise_users_list = [] @@ -688,11 +689,11 @@ class ExerciseController < ApplicationController else # 更新提交状态 cur_exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", User.current, @exercise.id).first - cur_exercise_user.update_attributes(:status => 1, :commit_status => 1) - if @exercise.time && @exercise.time != -1 + cur_exercise_user.update_attributes(:status => 1, :commit_status => 1, :end_at => Time.now) + #if @exercise.time && @exercise.time != -1 score = calculate_student_score(@exercise, User.current) - cur_exercise_user.update_attributes(:score => score) - end + cur_exercise_user.update_attributes(:objective_score => score, :score => score + (cur_exercise_user.subjective_score > 0 ? cur_exercise_user.subjective_score : 0)) + #end # 答题过程中需要统计完成量 #@uncomplete_question = get_uncomplete_question(@exercise, User.current) # 获取改学生的考试得分 @@ -746,16 +747,20 @@ class ExerciseController < ApplicationController #查看学生的答卷情况 def show_student_result - @user = User.find params[:user_id] - @can_edit_excercise = false - @exercise_questions = @exercise.exercise_questions - #score = calculate_student_score(@exercise, @user) - #eu = get_exercise_user(@exercise.id, @user.id) - #eu.update_attributes(:score => score) - @exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first - @left_nav_type = 8 - respond_to do |format| - format.html {render :layout => 'base_courses'} + @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? + if @is_teacher || (User.current.member_of_course?(@exercise.course) && @exercise.exercise_status > 2) + @user = User.find params[:user_id] + #@can_edit_excercise = false + @exercise_questions = @exercise.exercise_questions + #score = calculate_student_score(@exercise, @user) + #eu = get_exercise_user(@exercise.id, @user.id) + #eu.update_attributes(:score => score) + @exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first + respond_to do |format| + format.html {render :layout => 'base_edu'} + end + else + render_403 end end diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb index abaa95c84..203ffd327 100644 --- a/app/helpers/exercise_helper.rb +++ b/app/helpers/exercise_helper.rb @@ -21,6 +21,24 @@ module ExerciseHelper exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id)).count - exercise.exercise_users.where(:commit_status => 1, :user_id => course.student.map(&:student_id), :subjective_score => -1).count end + def answer_is_correct eq, user + is_correct = false + case eq.question_type + when 1 + answer = get_user_answer(eq, user) + standard_answer = get_user_standard_answer(eq, user) + is_correct = !answer.empty? && !standard_answer.empty? && answer.first.exercise_choice.choice_position == standard_answer.first.exercise_choice_id + when 2 + standard_answer = get_user_standard_answer(eq, user) + is_correct = !standard_answer.empty? && get_mulscore(eq, user).to_i == standard_answer.first.exercise_choice_id + when 3 + answer = get_user_answer(eq, user) + standard_answer = get_user_standard_answer(eq, user) + is_correct = !answer.empty? && !standard_answer.empty? && standard_answer.include?(answer.first.answer_text) + end + is_correct + end + # 单选 def sigle_selection_standard_answer(params) size = params.ord - 96 @@ -180,6 +198,17 @@ module ExerciseHelper uncomplete_question end + def question_commit_status question, user + status = "" + case question.question_type + when 3, 4 + get_anwser_vote_text(question.id,user.id) == "" ? status = "未答" : status = "" + when 1, 2 + get_user_answer(question,user).empty? ? status = "未答" : status = "" + end + status + end + #获取文本题答案 def get_anwser_vote_text(question_id,user_id) pv = ExerciseAnswer.find_by_exercise_question_id_and_user_id(question_id,user_id) diff --git a/app/models/exercise_question.rb b/app/models/exercise_question.rb index 5189b0274..c6a4f40df 100644 --- a/app/models/exercise_question.rb +++ b/app/models/exercise_question.rb @@ -1,3 +1,4 @@ +#encoding: utf-8 class ExerciseQuestion < ActiveRecord::Base include Redmine::SafeAttributes @@ -5,4 +6,17 @@ class ExerciseQuestion < ActiveRecord::Base has_many :exercise_choices, :order => "#{ExerciseChoice.table_name}.choice_position",:dependent => :destroy has_many :exercise_answers, :dependent => :destroy has_many :exercise_standard_answers, :dependent => :destroy + + def question_type_name + case self.question_type + when 1 + "单选题" + when 2 + "多选题" + when 3 + "填空题" + when 4 + "简答题" + end + end end diff --git a/app/views/exercise/_exercise_student.html.erb b/app/views/exercise/_exercise_student.html.erb index ad62644f0..d06dc69dc 100644 --- a/app/views/exercise/_exercise_student.html.erb +++ b/app/views/exercise/_exercise_student.html.erb @@ -3,7 +3,7 @@ $("#RSide").removeAttr("id"); $("#homework_page_right").css("min-height",$("#courseLSide").height()-33); $("#Container").css("width","1000px"); - var end_time = <%=exercise.end_time.to_i%>; + var end_time = <%=@exercise.end_time.to_i%>; getTime(end_time); /*start_time = new Date(); start_time.setFullYear(<%#=exercise_user.start_at.year%>); @@ -60,8 +60,8 @@
      <% unless @exercise.try(:exercise_description).nil? %> -
      -
      <%= @exercise.try(:exercise_description).html_safe%>
      +
      +
      <%= @exercise.try(:exercise_description).html_safe%>
      <% end %> @@ -73,389 +73,206 @@
      已答 未答 -

      交卷

      + <% if @exercise.question_random == 1 %> + <% question_list = @exercise.exercise_questions.shuffle %> + <% end %> +
      - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 + <% question_list.each_with_index do |eq, index| %> + <%= index + 1 %> + <% end %>
      -
      -
      -

      第1题:[多选题]10

      -
      -

      黑盒测试和白盒测试的区别

      -
      -
    • -
    • -
    • -
    • -
      -
      - -
      -
      -

      第2题:[单选题]5

      -
      -

      黑盒测试和白盒测试的区别

      -
      -
    • -
    • -
    • -
    • -
      -
      - -
      -
      -

      第3题:[填空题]5

      -
      -

      黑盒测试和白盒测试()区别

      -
      - -
      -
      - -
      -
      -

      第4题:[简答题]10

      -
      -

      黑盒测试和白盒测试的区别

      -
      - -
      -
      -
      -
      - - -
      -
      -
      -

      <%= exercise.exercise_name%>

      - -
      - 开始时间:<%=Time.parse(h(exercise_user.start_at)).strftime("%Y-%m-%d %H:%M:%S")%> - 截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S")%> - <% unless exercise.time == -1 %> - 测验时长:<%=exercise.time %>分钟 - <% end %> - -
      -
      <%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%>
      -
      -
      - - <% current_score = get_current_score exercise %> -
      - <%= render :partial => 'exercise/total_questions_score', :locals => {:exercise => exercise, :current_score => current_score} %> -
      - - <% mc_question_list = exercise.exercise_questions.where("question_type=1") %> - <% mcq_question_list = exercise.exercise_questions.where("question_type=2") %> - <% single_question_list = exercise.exercise_questions.where("question_type=3") %> - <% multi_question_list = exercise.exercise_questions.where("question_type=4") %> - <% if exercise.question_random == 1 %> - <% mc_question_list = mc_question_list.shuffle %> - <% mcq_question_list = mcq_question_list.shuffle %> - <% single_question_list = single_question_list.shuffle %> - <% multi_question_list =multi_question_list.shuffle %> + <% question_list.each_with_index do |exercise_question, i| %> +
      +
      +

      第<%= i + 1 %>题:[<%= exercise_question.question_type_name %>]<%= exercise_question.question_score %>

      +
      +
      <%= exercise_question.question_title %>
      + <% case exercise_question.question_type %> + <% when 1 %> +
      + <% exercise_choices = @exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %> + <% exercise_choices.each_with_index do |exercise_choice,index| %> +
    • + + <%= answer_be_selected?(exercise_choice,User.current) ? "checked" : "" %>> + +
    • + <% end %> +
      + <% when 2 %> +
      + <% exercise_choices = @exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %> + <% exercise_choices.each_with_index do |exercise_choice,index| %> +
    • + + <%= answer_be_selected?(exercise_choice,User.current) ? "checked" : "" %>> + +
    • + <% end %> +
      + <% when 3 %> +
      + + +
      + <% when 4 %> +
      + + +
      + <% end %> +
      <% end %> -
      "> -

      单选题

      - <% mc_question_list.each_with_index do |exercise_question, list_index| %> -
      -
      -
      -
      - 第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分) -
      -
      -
      - - - <% exercise_choices = exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %> - <% exercise_choices.each_with_index do |exercise_choice,index| %> - - - - <% end %> - -
      - -
      -
      -
      -
      -
      - <% end %> -
      -
      "> -

      多选题

      - <% mcq_question_list.each_with_index do |exercise_question,list_index| %> -
      -
      -
      -
      - 第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分) -
      -
      -
      - - - <% exercise_choices = exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %> - <% exercise_choices.each_with_index do |exercise_choice,index| %> - - - - <% end %> - -
      - -
      -
      -
      -
      -
      - <% end %> -
      -
      "> -

      填空题

      - <% single_question_list.each_with_index do |exercise_question, list_index| %> -
      -
      -
      -
      - 第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分) -
      -
      -
      - - > -
      -
      -
      -
      - <% end %> -
      -
      "> -

      问答题

      - <% multi_question_list.each_with_index do |exercise_question, list_index| %> -
      -
      -
      -
      - 第<%= list_index+1%>题:<%= exercise_question.question_title %>  (<%= exercise_question.question_score %>分) -
      -
      -
      - - -
      -
      -
      -
      - <% end %> -
      - -
      -

      答题情况

      -
      - 单选题: - <% mc_question_list.each_with_index do |exercise_question, list_index| %> - <%= list_index + 1 %> - <% end %> -
      -
      -
      - 多选题: - <% mcq_question_list.each_with_index do |exercise_question, list_index| %> - <%= list_index + 1 %> - <% end %> -
      -
      -
      - 填空题: - <% single_question_list.each_with_index do |exercise_question, list_index| %> - <%= list_index + 1 %> - <% end %> -
      -
      -
      - 问答题: - <% multi_question_list.each_with_index do |exercise_question, list_index| %> - <%= list_index + 1 %> - <% end %> -
      -
      -
      - - -
      -
      - + + <% if @can_edit_excercise %> +
      +

      + 交卷 +

      +
      + <% end %>
      + -
      -
      -
      -

      <%= exercise.exercise_name%>

      -
      - 开始时间:<%=Time.parse(h(exercise_user.start_at)).strftime("%Y-%m-%d %H:%M:%S") %> - 截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S")%> - <% unless exercise.time == -1 %> - 测验时长:<%=exercise.time %>分钟 + + +
      +

      + + <%= link_to @course.name, course_path(@course) %> > <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> > <%= link_to @exercise.exercise_name, student_exercise_list_exercise_path(@exercise) %> > <%= @exercise_user.user.show_real_name %> +

      +
      +

      + <% unless @exercise.is_public %> + + <% end %> + <%= @exercise.exercise_name %> +

      + + <%= link_to "返回", student_exercise_list_exercise_path(@exercise), :class => "fr font-12 mr15 mt3 color-grey" %> +
      + +<% unless @exercise.try(:exercise_description).nil? %> +
      +
      <%= @exercise.try(:exercise_description).html_safe%>
      +
      +<% end %> + +
      + <%= render :partial => "exercise/total_questions_score" %> +
      + +
      +
      + 客观题 + 正确 + 错误 +

      总分:<%= @exercise_user.score.nil? ? "--" : format("%.1f",@exercise_user.score)%>

      +
      +
      + <% @exercise.exercise_questions.where(:question_type => [1, 2, 3]).each_with_index do |eq, index| %> + <% is_correct = answer_is_correct(eq, user) %> + <%= eq.question_number %> + <% end %> +
      +
      + 主观题 + 已评 + 未评 +
      +
      + <% @exercise.exercise_questions.where(:question_type => 4).each_with_index do |eq, index| %> + <% ea = User.current.exercise_answer.where(:exercise_question_id => eq.id).first %> + <%= eq.question_number %> + <% end %> +
      + +
      +
      + <% @exercise.exercise_questions.each_with_index do |exercise_question, i| %> +
      +
      +

      第<%= exercise_question.question_number %>题:[<%= exercise_question.question_type_name %>]<%= exercise_question.question_score %>分<%= question_commit_status exercise_question, @exercise_user.user %>

      + <% if exercise_question.question_type != 4 %> + <% is_correct = answer_is_correct(exercise_question, user) %> +

      <%= is_correct ? exercise_question.question_score : 0 %>

      + <% else %> + <% answer = get_user_answer(exercise_question, user)%> +

      mr3"><%= answer.empty? ? 0 : (answer.first.score == -1 ? "未批" : answer.first.score) %><%= answer.empty? ? "分" : (answer.first.score == -1 ? "" : "分") %>

      <% end %> - <%# time = exercise_user.end_at - exercise_user.start_at %>
      -
      <%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%>
      -
      -
      -
      -
      得分:<%=exercise_user.score %>
      - <% if User.current.admin? || User.current.allowed_to?(:as_teacher,exercise.course) || (exercise.exercise_status == 3 && exercise.show_result == 1) %> - <%= link_to '返回统计结果>>',student_exercise_list_exercise_path(exercise.id,:course_id => exercise.course.id) , :class => "fr linkBlue" %> - <% end %> -
      -
      - <% mc_question_list = exercise.exercise_questions.where("question_type=1") %> - <% mcq_question_list = exercise.exercise_questions.where("question_type=2") %> - <% single_question_list = exercise.exercise_questions.where("question_type=3") %> - <% multi_question_list = exercise.exercise_questions.where("question_type=4") %> - -
      "> -

      单选题

      - <% mc_question_list.each_with_index do |exercise_question, list_index| %> -
      -
      -
      -
      -
      - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分   - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> - -
      -
      -

      <%= exercise_question.question_title %>

      -
      - -
      -
      - - - <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> - - - - <% end %> - -
      - -
      -
      -
      +
      <%= exercise_question.question_title %>
      + <% case exercise_question.question_type %> + <% when 1 %> +
      + <% exercise_choices = @exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %> + <% exercise_choices.each_with_index do |exercise_choice,index| %> +
    • + > + +
    • + <% end %>
      -
      - <% end %> -
      - -
      "> -

      多选题

      - <% mcq_question_list.each_with_index do |exercise_question, list_index| %> -
      -
      -
      -
      -
      - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分   - 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %> - -
      -
      -

      <%= exercise_question.question_title %>

      + <% if @is_teacher || @exercise.answer_open %> +
      + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
      - -
      -
      - - - <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> - - - - <% end %> - -
      - -
      -
      -
      + <% end %> + <% when 2 %> +
      + <% exercise_choices = @exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %> + <% exercise_choices.each_with_index do |exercise_choice,index| %> +
    • + > + +
    • + <% end %>
      -
      - <% end %> -
      - -
      "> -

      填空题

      - <% single_question_list.each_with_index do |exercise_question,list_index| %> -
      -
      -
      -
      -
      - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分 - -
      -
      -

      <%= exercise_question.question_title %>

      + <% if @is_teacher || @exercise.answer_open %> +
      + 标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
      - -
      -
      + <% end %> + <% when 3 %> + <% unless get_anwser_vote_text(exercise_question.id,user.id) == "" %> +
      <%= get_anwser_vote_text(exercise_question.id,user.id).html_safe %>
      + <% end %> + <% if @is_teacher || @exercise.answer_open %> +
      <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> - 参考答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%>
      +

      候选答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%>

      <% end %>
      -
      - > + <% end %> + <% when 4 %> + <% unless get_anwser_vote_text(exercise_question.id,user.id) == "" %> +
      <%= get_anwser_vote_text(exercise_question.id,user.id).html_safe %>
      + <% end %> + <% if exercise_question.exercise_standard_answers.count > 0 && (@is_teacher || @exercise.answer_open) %> + -
      -
      -
      - <% end %> -
      - -
      "> -

      问答题

      - <% multi_question_list.each_with_index do |exercise_question, list_index| %> -
      -
      -
      -
      -
      - 第<%= exercise_question.question_number%>题.  <%= exercise_question.question_score %>分 - -
      +
      +

      参考答案

      +
      <%= exercise_question.exercise_standard_answers.first.answer_text%>
      +
      + <% end %> + <% if !answer.empty? && @is_teacher %> +
      +
      + + + + +
      +
      + 保存
      -

      <%= exercise_question.question_title %>

      -
      - <% if exercise_question.exercise_standard_answers.count > 0 %> -
      - 参考答案:
      <%= exercise_question.exercise_standard_answers.first.answer_text%>
      -
      - <% end %> -
      - -
      -
      -
      -
      - <% end %> -
      -
      - -
      - + <% end %> + <% end %> +
      + <% end %> +
      \ No newline at end of file diff --git a/app/views/exercise/_student_exercise.html.erb b/app/views/exercise/_student_exercise.html.erb index 1a1ec09a8..ef0daf3f9 100644 --- a/app/views/exercise/_student_exercise.html.erb +++ b/app/views/exercise/_student_exercise.html.erb @@ -64,7 +64,11 @@ <% if exercise.commit_status > 0 %> - <%= link_to @is_teacher ? '评阅' : '查看', show_student_result_exercise_path(@exercise,:user_id => exercise.user_id), :target => "_blank" %> + <% if @is_teacher %> + <%= link_to '评阅', show_student_result_exercise_path(@exercise,:user_id => exercise.user_id), :target => "_blank" %> + <% else %> + <%= link_to '查看', exercise.commit_status == 1 ? exercise_path(@exercise,:user_id => exercise.user_id) : show_student_result_exercise_path(@exercise,:user_id => exercise.user_id), :target => "_blank" %> + <% end %> <% else %> -- <% end %> diff --git a/app/views/exercise/commit_exercise.js.erb b/app/views/exercise/commit_exercise.js.erb index d91806fbb..8633682ba 100644 --- a/app/views/exercise/commit_exercise.js.erb +++ b/app/views/exercise/commit_exercise.js.erb @@ -1 +1 @@ -notice_box_redirect("<%= exercise_index_path(:course_id => @course.id) %>", "提交成功"); \ No newline at end of file +notice_box_redirect("<%= student_exercise_list_exercise_path(@exercise) %>", "提交成功"); \ No newline at end of file diff --git a/app/views/exercise/setting.html.erb b/app/views/exercise/setting.html.erb index cc40a9eff..5e6272494 100644 --- a/app/views/exercise/setting.html.erb +++ b/app/views/exercise/setting.html.erb @@ -26,7 +26,9 @@

      发布设置

      - 编辑 + <% if @is_teacher %> + 编辑 + <% end %>
      diff --git a/app/views/exercise/show.html.erb b/app/views/exercise/show.html.erb index c488ec203..71011cf9d 100644 --- a/app/views/exercise/show.html.erb +++ b/app/views/exercise/show.html.erb @@ -1,10 +1,10 @@ <%= stylesheet_link_tag 'polls', :media => 'all' %> <% if @is_teacher %> - <%= render :partial => 'exercise_teacher', :locals =>{:exercise =>@exercise, :exercise_questions => @exercise_questions} %> + <%= render :partial => 'exercise_teacher' %> <% else %> - <% if @can_edit_excercise %> - <%=render :partial => 'exercise_student', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user} %> - <% else %> - <%=render :partial => 'exercise_student_result', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user,:user=>User.current} %> - <% end %> + <%# if @can_edit_excercise %> + <%=render :partial => 'exercise_student' %> + <%# else %> + <%#=render :partial => 'exercise_student_result', :locals => {:user=>User.current} %> + <%# end %> <% end %> \ No newline at end of file diff --git a/app/views/exercise/student_exercise_list.html.erb b/app/views/exercise/student_exercise_list.html.erb index dfa06302b..249974693 100644 --- a/app/views/exercise/student_exercise_list.html.erb +++ b/app/views/exercise/student_exercise_list.html.erb @@ -87,14 +87,16 @@

      <% ex_user = @exercise.exercise_users.where(:user_id => User.current).first %> - <% if ex_user && ex_user.commit_status > 0 %> - 你已提交 - <%= link_to '查看答题', exercise_path(@exercise,:user_id => User.current.id), :class => "white-btn orange-btn fr" %> - <% else %> - 你未提交 - <% if @exercise.exercise_status == 2 %> - <%= link_to '开始答题', exercise_path(@exercise,:user_id => User.current.id), :class => "white-btn orange-btn fr" %> - <% end %> + <% if ex_user %> + <% if ex_user.commit_status > 0 %> + 你已提交 + <%= link_to '查看答题', ex_user.commit_status == 1 ? exercise_path(@exercise,:user_id => User.current.id) : show_student_result_exercise_path(@exercise,:user_id => User.current.id), :class => "white-btn orange-btn fr" %> + <% else %> + 你未提交 + <% if @exercise.exercise_status == 2 %> + <%= link_to (ex_user.start_at.nil? ? "开始答题" : "继续答题"), exercise_path(@exercise,:user_id => User.current.id), :class => "white-btn orange-btn fr" %> + <% end %> + <% end %> <% end %>

      diff --git a/app/views/layouts/base_edu.html.erb b/app/views/layouts/base_edu.html.erb index fa4982b2b..ef5b5a61c 100644 --- a/app/views/layouts/base_edu.html.erb +++ b/app/views/layouts/base_edu.html.erb @@ -48,6 +48,9 @@

      + diff --git a/lib/tasks/exercise_publish.rake b/lib/tasks/exercise_publish.rake index f7ec0403a..94867f58d 100644 --- a/lib/tasks/exercise_publish.rake +++ b/lib/tasks/exercise_publish.rake @@ -62,7 +62,7 @@ namespace :exercise_publish do exercise_user.update_attributes(:commit_status => 1, :end_at => Time.now) end s_score = calculate_student_score(exercise, student.student) - exercise_user.update_attributes(:objective_score => s_score, :score => (s_score + (exercise_user.subjective_score > 0 ? exercise_user.subjective_score : 0))) + exercise_user.update_attributes(:objective_score => s_score, :score => (s_score + (exercise_user.subjective_score && exercise_user.subjective_score > 0 ? exercise_user.subjective_score : 0))) end end end diff --git a/public/stylesheets/css/taskstyle.css b/public/stylesheets/css/taskstyle.css index 7f741358a..c60a99993 100644 --- a/public/stylesheets/css/taskstyle.css +++ b/public/stylesheets/css/taskstyle.css @@ -433,5 +433,5 @@ html>body #ajax-indicator-base { position: fixed; } /*---------------------试卷----------------------*/ .question_item_con{font-weight: normal!important;border:1px solid #EEEEEE!important;color: #333!important;background: #FFFFff!important;position: relative} .exam_operator{cursor: pointer;position: absolute;right: 15px;top: 11px;} -.question_item_con .write_answer{border:1px solid #EEEEEE;background:#EFF9FD;padding: 10px 15px;text-align:justify;} +.question_item_con .write_answer{border-top:1px solid #EEEEEE;background:#EFF9FD;padding: 10px 15px;text-align:justify;} .add_item_part{width: auto;padding: 2px 20px;border: 1px solid #CCCCCC;border-radius: 3px;margin-left: 15px;cursor: pointer;} \ No newline at end of file From 1b5b77b6c55d190996b6f71abecc5bebc91a8d95 Mon Sep 17 00:00:00 2001 From: cxt Date: Sat, 30 Sep 2017 16:10:07 +0800 Subject: [PATCH 14/16] =?UTF-8?q?=E6=B5=8B=E9=AA=8C=E7=9A=84=E7=BC=96?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_controller.rb | 4 +- app/views/exercise/_edit_MC.html.erb | 3 +- app/views/exercise/_edit_MCQ.html.erb | 3 +- app/views/exercise/_edit_multi.html.erb | 2 +- app/views/exercise/_edit_single.html.erb | 50 ++----------------- app/views/exercise/_edu_edit_form.html.erb | 23 ++++++--- app/views/exercise/_new_MC.html.erb | 6 +-- app/views/exercise/_new_MCQ.html.erb | 6 +-- app/views/exercise/_new_question.html.erb | 4 ++ app/views/exercise/_new_single.html.erb | 8 +-- .../exercise/create_exercise_question.js.erb | 48 +----------------- .../exercise/update_exercise_question.js.erb | 4 +- public/javascripts/edu/course.js | 36 ++++++++++++- 13 files changed, 77 insertions(+), 120 deletions(-) diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb index 8a88ff4df..6fe639260 100644 --- a/app/controllers/exercise_controller.rb +++ b/app/controllers/exercise_controller.rb @@ -192,7 +192,7 @@ class ExerciseController < ApplicationController # params[:question_answer] 题目选项 if params[:question_answer] for i in 1..params[:question_answer].count - answer = params[:question_answer][i-1] + answer = (params[:question_answer].values[i-1].nil? || params[:question_answer].values[i-1].empty?) ? l(:label_new_answer) : params[:question_answer].values[i-1] question_option = { :choice_position => i, :choice_text => answer @@ -226,7 +226,7 @@ class ExerciseController < ApplicationController for i in 1..params[:exercise_choice].count standart_answer = ExerciseStandardAnswer.new standart_answer.exercise_question_id = @exercise_questions.id - standart_answer.answer_text = params[:exercise_choice][i-1] + standart_answer.answer_text = params[:exercise_choice].values[i-1] standart_answer.save end elsif @exercise_questions.question_type == 4 diff --git a/app/views/exercise/_edit_MC.html.erb b/app/views/exercise/_edit_MC.html.erb index f7142ad09..6d49b607d 100644 --- a/app/views/exercise/_edit_MC.html.erb +++ b/app/views/exercise/_edit_MC.html.erb @@ -28,9 +28,10 @@
    • + - +
    • <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
    • diff --git a/app/views/exercise/_edit_MCQ.html.erb b/app/views/exercise/_edit_MCQ.html.erb index 49a8d49cc..2442942a7 100644 --- a/app/views/exercise/_edit_MCQ.html.erb +++ b/app/views/exercise/_edit_MCQ.html.erb @@ -30,9 +30,10 @@
    • + - +
    • <% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %> diff --git a/app/views/exercise/_edit_multi.html.erb b/app/views/exercise/_edit_multi.html.erb index 0ed8c59c0..e56fa4c32 100644 --- a/app/views/exercise/_edit_multi.html.erb +++ b/app/views/exercise/_edit_multi.html.erb @@ -14,7 +14,7 @@
    • - +
    • diff --git a/app/views/exercise/_edit_single.html.erb b/app/views/exercise/_edit_single.html.erb index 57256efa8..42f2735fe 100644 --- a/app/views/exercise/_edit_single.html.erb +++ b/app/views/exercise/_edit_single.html.erb @@ -20,19 +20,19 @@ } <% end %> -
      +

      填空题

    • - +
    • <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
    • - +
    • @@ -55,48 +55,4 @@

      - - <% if false %> -
      -
      - - 分 -
      -
      -
      - - - -
      - -
      -
        -
        - <% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %> -
      • - - - -
      • -
        - <% end %> -
      • -
        新建参考答案
        -
      • -
        -
        -
        -
      -
      - -
      -
      - -<% end %> <% end %> \ No newline at end of file diff --git a/app/views/exercise/_edu_edit_form.html.erb b/app/views/exercise/_edu_edit_form.html.erb index 637027531..3744d083d 100644 --- a/app/views/exercise/_edu_edit_form.html.erb +++ b/app/views/exercise/_edu_edit_form.html.erb @@ -52,7 +52,7 @@ @@ -65,6 +65,7 @@ bt.RIGHT_DELIMITER = '!>'; var html = bt('t:set-fillin-lists', null); $(item).parent().parent('.clearfix').before(html); + $(item).parent().parent('.clearfix').prev().find('textarea').attr("name", "exercise_choice["+new Date().getTime()+"]"); var inputs = document.getElementsByName("exercise_choice[]"); var inputs_spans=$(item).parents(".fillin_Temp").find("li span[name='fill_span']"); //var inputs_spans = document.getElementsByName("fill_span"); @@ -126,6 +127,7 @@ function convert_to_chi_num(num){ function removeMuli(item){ var temp=$(item).parents("li").siblings("div").find(".current-option"); var count=0; + var exercise_choice = $(item).parents(".multiple_Temp").find("input[name='exercise_choice']"); var muil=$(item).parents(".multiple_Temp").find(".check-option-bg"); if($(item).parents("li").find("label span").hasClass("check-option-bg")){ count++; @@ -145,9 +147,9 @@ function convert_to_chi_num(num){ for(var i=0;i \ No newline at end of file diff --git a/app/views/exercise/_new_MC.html.erb b/app/views/exercise/_new_MC.html.erb index 0971ecd93..c8f2d5db6 100644 --- a/app/views/exercise/_new_MC.html.erb +++ b/app/views/exercise/_new_MC.html.erb @@ -19,21 +19,21 @@ - +
    • - +
    • - +
    • diff --git a/app/views/exercise/_new_MCQ.html.erb b/app/views/exercise/_new_MCQ.html.erb index 70bebd42a..3d4f37dd3 100644 --- a/app/views/exercise/_new_MCQ.html.erb +++ b/app/views/exercise/_new_MCQ.html.erb @@ -19,21 +19,21 @@ - +
    • - +
    • - +
    • diff --git a/app/views/exercise/_new_question.html.erb b/app/views/exercise/_new_question.html.erb index 63cbf52c8..307d6728f 100644 --- a/app/views/exercise/_new_question.html.erb +++ b/app/views/exercise/_new_question.html.erb @@ -13,6 +13,7 @@ } else{ //$.get("<%#= new_exercise_question_path(:exercise => @exercise, :type => "MC") %>"); $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>@exercise}) %>"); + $("#poll_questions_title").focus(); //sd_create_editor_from_data(<%#= @exercise.id %>, null, "100%", "<%#= @exercise.class.to_s %>"); } } @@ -25,6 +26,7 @@ notice_box("请先保存正在编辑的题目再新建。"); } else{ $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>@exercise}) %>"); + $("#poll_questions_title").focus(); } } @@ -36,6 +38,7 @@ notice_box("请先保存正在编辑的题目再新建。"); } else{ $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>@exercise}) %>"); + $("#poll_questions_title").focus(); } } @@ -47,6 +50,7 @@ notice_box("请先保存正在编辑的题目再新建。"); } else{ $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_multi', :locals => {:exercise=>@exercise}) %>"); + $("#poll_questions_title").focus(); } } diff --git a/app/views/exercise/_new_single.html.erb b/app/views/exercise/_new_single.html.erb index a92b7a7ae..5ff8e43df 100644 --- a/app/views/exercise/_new_single.html.erb +++ b/app/views/exercise/_new_single.html.erb @@ -12,13 +12,13 @@
    • - - + +
    • - - + +
    • diff --git a/app/views/exercise/create_exercise_question.js.erb b/app/views/exercise/create_exercise_question.js.erb index 41510a199..8ccc46e94 100644 --- a/app/views/exercise/create_exercise_question.js.erb +++ b/app/views/exercise/create_exercise_question.js.erb @@ -1,50 +1,4 @@ -<% if @is_insert %> $("#exercise_question_list").html("<%= escape_javascript(render :partial => 'exercise/exercise_content') %>"); $("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score') %>"); -<% else %> $("#new_exercise_question").html('<%= escape_javascript(render :partial => 'new_question', :locals => {:exercise => @exercise}) %>'); - $("#new_poll_question").html(""); - //$("#exercise_submit").html("<%#= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>"); - <%if @exercise_questions.question_type == 1%> - //$("#mc_question_list>div").last().children().first().addClass("border_b"); - $("#exercise_question_list").append("
      " + - "
      " + - "<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_questions}) %>" + - "
      " + - "" + - "
      "); - <% end %> - <%if @exercise_questions.question_type == 2%> - $("#exercise_question_list").append("
      " + - "
      " + - "<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" + - "
      " + - "" + - "
      "); - <% end %> - <%if @exercise_questions.question_type == 3%> - $("#exercise_question_list").append("
      " + - "
      " + - "<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_questions}) %>" + - "
      " + - "" + - "
      "); - <% end %> - <%if @exercise_questions.question_type == 4%> - $("#exercise_question_list").append("
      " + - "
      " + - "<%= escape_javascript(render :partial => 'show_multi', :locals => {:exercise_question => @exercise_questions}) %>" + - "
      " + - "" + - "
      "); - <% end %> -$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score') %>"); -<% end %> + $("#new_poll_question").html(""); \ No newline at end of file diff --git a/app/views/exercise/update_exercise_question.js.erb b/app/views/exercise/update_exercise_question.js.erb index 89dfb27b6..624df0dc5 100644 --- a/app/views/exercise/update_exercise_question.js.erb +++ b/app/views/exercise/update_exercise_question.js.erb @@ -20,6 +20,4 @@ $("#poll_questions_<%= @exercise_question.id%>").html("
      {:exercise_question => @exercise_question}) %>" + "<% end%>" + "
      "); -<% current_score = get_current_score @exercise %> -$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score}) %>"); -$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise_question.exercise}) %>"); +$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score') %>"); \ No newline at end of file diff --git a/public/javascripts/edu/course.js b/public/javascripts/edu/course.js index 67072ab97..dd1f59d95 100644 --- a/public/javascripts/edu/course.js +++ b/public/javascripts/edu/course.js @@ -695,11 +695,45 @@ function exQuestionEdit(question_id){ var forms = $("form.new_exercise_question"); if($.trim($("#insert_new_poll_question_"+question_id).html()) == "") { if(forms.length > 0){ - notice_box("请先保存正在编辑的题目再新建。"); + notice_box("请先保存正在编辑的题目再编辑。"); } else{ $("#show_poll_questions_"+question_id).hide(); $("#edit_poll_questions_"+question_id).show(); $("#poll_questions_title_"+question_id).focus(); } } +} + +//修改标题时确定按钮 +function edit_poll_question(doc,id,quest_type) +{ + var title = $.trim($("#poll_questions_title_" + id).val()); + var score = $.trim($("#poll_question_score_"+ id).val()); + var standard_ans = $.trim($("#exercise_choice_" + id).val()); + if(title.length == 0 || score.length == 0){ + notice_box("题目标题/分数不能为空"); + }else if(!/^[1-9][0-9]*$/.test(score)) { + notice_box("分数必须是非零开头的数字"); + }else if(quest_type !=3 && quest_type !=4 && standard_ans.length == 0) { + notice_box("标准答案不能为空"); + }else if(quest_type ==3) { + var div = $("#poll_answers_" + id); + var candiate_answer = $(".candiate_answer",div); + if(candiate_answer.length > 0) { + for(i=0;i Date: Sat, 30 Sep 2017 16:30:43 +0800 Subject: [PATCH 15/16] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_edu_edit_form.html.erb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/views/exercise/_edu_edit_form.html.erb b/app/views/exercise/_edu_edit_form.html.erb index 3744d083d..13df8ea2a 100644 --- a/app/views/exercise/_edu_edit_form.html.erb +++ b/app/views/exercise/_edu_edit_form.html.erb @@ -129,12 +129,14 @@ function convert_to_chi_num(num){ var count=0; var exercise_choice = $(item).parents(".multiple_Temp").find("input[name='exercise_choice']"); var muil=$(item).parents(".multiple_Temp").find(".check-option-bg"); + var pare=$(item).parents(".multiple_Temp"); if($(item).parents("li").find("label span").hasClass("check-option-bg")){ count++; } $(item).parents('li').remove(); - var inputs_spans = document.getElementsByName("option_spans"); - for (var j = 0; j < inputs_spans.length; j++) { + var inputs_spans=pare.find("li span[name='option_spans']"); + //var inputs_spans = document.getElementsByName("option_spans"); + for (var j = 0; j < parseInt(inputs_spans.length)-count; j++) { if(j >= 0 && j <= 26){ if(j >= 0 && j <= 26){ $(inputs_spans[j]).html(String.fromCharCode(65 + j)); @@ -212,14 +214,16 @@ function removeSingle(item){ var temp=$(item).parents("li").siblings("div").find(".current-option"); var exercise_choice = $(item).parents(".single_Temp").find("input[name='exercise_choice']"); var singl=$(item).parents(".single_Temp").find(".check-option-bg"); + var pare=$(item).parents(".single_Temp"); temp.html(""); var count=0; if($(item).parents("li").find("label span").hasClass("check-option-bg")){ count++; } $(item).parents('li').remove(); - var inputs_spans = document.getElementsByName("option_span"); - for (var j = 0; j < inputs_spans.length; j++) { + var inputs_spans=pare.find("li span[name='option_span']"); + //var inputs_spans = document.getElementsByName("option_span"); + for (var j = 0; j < parseInt(inputs_spans.length)-count; j++) { if(j >= 0 && j <= 26){ if(j >= 0 && j <= 26){ $(inputs_spans[j]).html(String.fromCharCode(65 + j)); From 18b01609ccb4baa7ac6178b9f4c8c459f0a89782 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Sat, 30 Sep 2017 18:23:35 +0800 Subject: [PATCH 16/16] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=A4=9A=E9=80=89?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/exercise/_edit_MCQ.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/exercise/_edit_MCQ.html.erb b/app/views/exercise/_edit_MCQ.html.erb index 2442942a7..bf6d672f1 100644 --- a/app/views/exercise/_edit_MCQ.html.erb +++ b/app/views/exercise/_edit_MCQ.html.erb @@ -27,7 +27,7 @@ - +