diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 9eef2c48f..c4eaeee70 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -50,17 +50,18 @@ class CoursesController < ApplicationController @syllabuses_num = Course.all.count #@syllabus_count = all_syllabuses.count # 我创建的课堂 - create_syllabuses = Course.where(:tea_id => @user.id) + #create_syllabuses = Course.where(:tea_id => @user.id) # 我参与的课堂 - join_syllabuses = @user.courses.where("is_delete = 0 and tea_id != #{@user.id}") - @join_syllabuses_count = join_syllabuses.where(:is_end => 0, :is_delete => 0).count - @create_syllabuses_count = create_syllabuses.where(:is_end => 0, :is_delete => 0).count + #join_syllabuses = @user.courses.where("is_delete = 0 and tea_id != #{@user.id}") + # @join_syllabuses_count = @user.courses.not_deleted_not_end.order("updated_at desc").select{ |course| !@user.has_teacher_role(course)}.count + # @create_syllabuses_count = @user.courses.not_deleted_not_end.order("updated_at desc").select{ |course| @user.has_teacher_role(course)}.count + @my_courses_count = @user.courses.not_deleted_not_end.count # 页面筛选的课程 if @select == "create" - @syllabuses = create_syllabuses.where("is_end = 0 and is_delete = 0 and name like '%#{@search}%'") + @syllabuses = @user.courses.not_deleted_not_end.where("name like '%#{@search}%'").order("updated_at desc").select{ |course| @user.has_teacher_role(course)} elsif @select == "join" - @syllabuses = join_syllabuses.where("is_end = 0 and is_delete = 0 and tea_id != #{@user.id} and name like '%#{@search}%'") + @syllabuses = @user.courses.not_deleted_not_end.where("name like '%#{@search}%'").order("updated_at desc").select{ |course| !@user.has_teacher_role(course)} elsif @select == "end" # 归档的课堂 end_syllabuses = Course.where("is_end = 1 and name like '%#{@search}%'") diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index ccc118f54..acd042a11 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -406,10 +406,15 @@ class MessagesController < ApplicationController def sticky_topic (render_403; return false) unless (User.current.admin? || User.current.allowed_to?(:as_teacher, @course)) @topic.update_attributes(:sticky => @topic.sticky == 1 ? 0 : 1) - if params[:is_board] - redirect_to course_boards_path(@course) - else - redirect_to board_message_path(@topic.board_id, @topic) + respond_to do |format| + format.js + format.html{ + if params[:is_board] + redirect_to course_boards_path(@course) + else + redirect_to board_message_path(@topic.board_id, @topic) + end + } end end diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index fb20d1bf7..2fb901d77 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -14,6 +14,24 @@ class ShixunsController < ApplicationController CODES = %W(2 3 4 5 6 7 8 9 A B C D E F G H J K L N M O P Q R S T U V W X Y Z) DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) + # 获取版本库文件目录 + def search_file_list + path = params[:path] + @path = to_path_param(path) + g = Gitlab.client + @dir = g.trees(@shixun.gpid, :path => @path).map{|tree|[tree.type, (@path.blank? ? tree.name : "#{@path}"+"/"+tree.name )]} + logger.info("dir is ##{@dir}") + respond_to do |format| + format.js + end + # render :json => {:dir => @dir} + end + + def achieve_ways + @repository = @shixun.repository + @entries = @repository.entries(@path, @rev) + # @entries = Gitlab.client.trees(@shixun.gpid).map{|tree| tree.name} + end def statistics_students pub_shixun = ApplyAction.where(:container_type => "ApplyShixun", :status => 1, :container_id => @shixun.id).last @@ -122,7 +140,7 @@ class ShixunsController < ApplicationController @content = params[:content] code_file = g.edit_file(@shixun.gpid, :content => params[:content], :file_path => @path, :branch_name => @rev, :commit_message => "shixun entry") # if @shixun.try(:status).to_i < 2 - shixun_modify_status_without_publish(@shixun, 1) + # shixun_modify_status_without_publish(@shixun, 1) # end respond_to do |format| format.js @@ -751,13 +769,13 @@ class ShixunsController < ApplicationController end def shixun_discuss - @discusses = @shixun.discusses.reorder("created_at desc") + @discusses = @shixun.discusses.where(:parent_id => nil).reorder("created_at desc") @discusses_count = @discusses.count - #@limit = 15 - #@is_remote = true - #@discusses_pages = Paginator.new @discusses_count, @limit, params['page'] || 1 - # @offset ||= @discusses_pages.offset - #@discusses = paginateHelper @discusses, @limit + @limit = 15 + @is_remote = true + @discusses_pages = Paginator.new @discusses_count, @limit, params['page'] || 1 + @offset ||= @discusses_pages.offset + @discusses = paginateHelper @discusses, @limit #@game_challenge = params[:challenge_id].blank? ? Challenge.find(@discusses.challenge_id) : Challenge.find(params[:challenge_id]) @game_challenge = Challenge.find(params[:challenge_id].to_i) end diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index e627ef519..52fa12073 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -690,7 +690,7 @@ class StudentWorkController < ApplicationController @score = student_work_score @work,User.current @is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin? if (@homework.homework_detail_manual.comment_status == 3 || @homework.homework_detail_manual.comment_status == 4) && !@is_teacher && @work.user != User.current - @student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc") + @student_work_scores = StudentWorksScore.where(:id => @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").select("max(id)")) else @student_work_scores = student_work_score_record(@work) end @@ -995,7 +995,9 @@ class StudentWorkController < ApplicationController @work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => @work.id).first @score = @new_score if @homework.homework_detail_manual.comment_status == 3 && !@is_teacher && @work.user != User.current - @student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc") + @st_cover = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").count > 1 ? 1 : 0 + @student_work_scores = StudentWorksScore.where(:id => @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").select("max(id)")) + #@student_work_scores = @work.student_works_scores.where("user_id = #{User.current.id} and reviewer_role = 3").order("updated_at desc") else @student_work_scores = student_work_score_record(@work) end diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index 9b3c17a95..4cdcc2ea3 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -140,13 +140,13 @@ module StudentWorkHelper end end - #获取学生作品的评分记录:同一个教师或教辅只显示未隐藏的评分 + #获取学生作品的评分记录:同一个教师或教辅只显示未隐藏的评分、匿评多次评分只取最新一条 def student_work_score_record work - # sql = "SELECT MAX(id) id FROM student_works_scores WHERE (reviewer_role = 2 OR reviewer_role = 1) AND score IS NOT NULL AND is_hidden = 0 AND student_work_id = #{work.id} GROUP BY user_id" - # tea_ts_ids = StudentWorksScore.find_by_sql sql - # tea_ts_ids = tea_ts_ids.empty? ? "(-1)" : "(" + tea_ts_ids.map{|tea| tea.id}.join(",") + ")" - # scores = work.student_works_scores.where("score IS NULL or reviewer_role = 3 or id in #{tea_ts_ids}").order("updated_at desc") - scores = work.student_works_scores.where(:is_hidden => false).order("created_at desc") + sql = "SELECT MAX(id) id FROM student_works_scores WHERE reviewer_role = 3 AND score IS NOT NULL AND is_hidden = 0 AND student_work_id = #{work.id} GROUP BY user_id" + st_ts_ids = StudentWorksScore.find_by_sql sql + st_ts_ids = st_ts_ids.empty? ? "(-1)" : "(" + st_ts_ids.map{|tea| tea.id}.join(",") + ")" + scores = work.student_works_scores.where("is_hidden = 0 and(reviewer_role = 1 or reviewer_role = 2 or id in #{st_ts_ids})").order("updated_at desc") + #scores = work.student_works_scores.where(:is_hidden => false).order("created_at desc") return scores end diff --git a/app/views/challenges/_evaluating_form.html.erb b/app/views/challenges/_evaluating_form.html.erb index 46e28bf47..2d92aacf5 100644 --- a/app/views/challenges/_evaluating_form.html.erb +++ b/app/views/challenges/_evaluating_form.html.erb @@ -18,12 +18,15 @@
  • - <%= f.text_field :path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "进入实训后将默认打开该文件,如:src/test/welcome.java", :maxlength => "256" %> + <%= f.text_field :path, :class => "panel-form-width-690 panel-box-sizing fl", :id => "shixun_file_path", :no_label => true, :placeholder => "进入实训后将默认打开该文件,如:src/test/welcome.java", :maxlength => "256" %> + +
  • +
  • - <%= f.text_field :exec_path, :class => "panel-form-width-690 panel-box-sizing fl", :no_label => true, :placeholder => "输入关卡需要执行的文件路径,如:src/test/main.java", :maxlength => "256" %> + <%= f.text_field :exec_path, :class => "panel-form-width-690 panel-box-sizing fl",:id => "shixun_file_path_play", :no_label => true, :placeholder => "输入关卡需要执行的文件路径,如:src/test/main.java", :maxlength => "256" %>
  • @@ -100,6 +103,24 @@ bt.LEFT_DELIMITER = ''; + // 获取版本库路径 + $("#shixun_file_path").on('click', function (e) { + file_path(); + $(this).addClass("change"); + }); + $("#shixun_file_path_play").on('click', function (e) { + file_path(); + $(this).addClass("change"); + }); + function file_path(){ + data = 0; + $.ajax({ + url: '<%= search_file_list_shixun_path(@shixun) %>', + dataType: "script" + }); + + } + $("#shixun_form").on('click', 'a.test_icon_add', function () { var html = bt('t:test-answer-list', null); $(this).parent().parent('.clearfix').after(html); @@ -155,8 +176,8 @@ $(inputs_labels[j]).html("组" + (j + 1)); } }); - }); + // 判断测试集是否锁定, 0未锁定,1锁定 function test_set_whether_lock(){ var lock = document.getElementsByName("test_set[lock][]"); diff --git a/app/views/courses/index.html.erb b/app/views/courses/index.html.erb index fe996262a..123447588 100644 --- a/app/views/courses/index.html.erb +++ b/app/views/courses/index.html.erb @@ -15,7 +15,7 @@
  • @@ -98,7 +102,7 @@
  • 所有状态 -
  • -
  • - 你的评阅: - - 不限 - - <% has_comment = User.current.student_works_scores.where(:student_work_id => @homework.student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).count %> - > - - > - -
  • + <% if @homework.homework_type != 4 %> +
  • + 你的评阅: + + 不限 + + <% has_comment = User.current.student_works_scores.where(:student_work_id => @homework.student_works.map(&:id), :reviewer_role => [1, 2]).group_by(&:student_work_id).count %> + > + + > + +
  • + <% end %>
  • 作品状态: diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb index 6a00131b2..9e798a956 100644 --- a/app/views/users/_course_message.html.erb +++ b/app/views/users/_course_message.html.erb @@ -52,21 +52,16 @@ diff --git a/config/routes.rb b/config/routes.rb index 41f47ea9a..3a15cc9bb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -107,6 +107,8 @@ RedmineApp::Application.routes.draw do get 'search_user_courses' post 'send_to_course' get 'statistics_students' + get 'search_file_list' + get 'achieve_ways' end collection do get 'shixun_courses' @@ -250,6 +252,11 @@ RedmineApp::Application.routes.draw do get 'add_departments_part' post 'save_school' post 'update_user_message' + post 'add_auto_users_trial' + post 'create_auto_users_trial' + match 'update_auto_users_trial', :via => [:get, :post] + match 'account', :via => [:get, :post] + post 'shixun_can_copy' end end # Enable Grack support diff --git a/public/stylesheets/css/edu-public.css b/public/stylesheets/css/edu-public.css index 259741b04..d179b2a74 100644 --- a/public/stylesheets/css/edu-public.css +++ b/public/stylesheets/css/edu-public.css @@ -58,7 +58,6 @@ $colors: #fff, #0072B5, #2C3E50; .edu-dropdown-menu li{ height:30px; line-height:30px; display: block; padding:0 15px; text-align: left;} .edu-dropdown-menu li label{ cursor: pointer;} .edu-dropdown-menu li:hover{ color: #FF7500!important;} -.edu-dropdown-menu.color li:hover{ color: #ff7500!important;} /*.edu-dropdown:hover .edu-dropdown-menu{ display: block;}*/ .animate{ -webkit-transition: all .3s; -moz-transition: all .3s; -ms-transition: all .3s; -ms-transition: all .3s; transition: all .3s; backface-visibility:hidden; -webkit-backface-visibility:hidden; /* Chrome and Safari */ -moz-backface-visibility:hidden; /* Firefox */ -ms-backface-visibility:hidden; /* Internet Explorer */} diff --git a/public/stylesheets/css/taskstyle.css b/public/stylesheets/css/taskstyle.css index d74dd10d9..566f9520a 100644 --- a/public/stylesheets/css/taskstyle.css +++ b/public/stylesheets/css/taskstyle.css @@ -70,7 +70,7 @@ a.rightbar-pause{ color:#29bd8b; font-size: 18px; margin-right:15px; margin-top: .panel-inner-title{ font-size: 14px; color: #666; max-width:85%; line-height:30px;word-wrap: break-word; margin-bottom: 10px} .panel-footer{ min-width:1000px; height: 210px!important;} /* 弹框 */ -.task-popup-text-center{ text-align: center; color: #666;} +.task-popup-text-center{ text-align: center; color: #333;} .task-popup-title{ border-bottom: 1px solid #eee; padding:10px 15px; } .task-popup-content{ padding:0px 15px 15px 15px;} .task-popup-submit{ margin: 0 auto 15px; width: 120px;} @@ -430,11 +430,11 @@ html>body #ajax-indicator-base { position: fixed; } /*二次回复的提示语的样式*/ .points-data-tip-top{position:absolute;left:100px;top:-30px;opacity:.7;width:150px;height:30px;z-index:9999;display:none;} -.data-tip-top{position:relative;box-shadow:0px 0px 8px #000;backgund:#000;color:#fff;word-wrap: break-word; +.data-tip-top1{position:relative;box-shadow:0px 0px 8px #000;background:#000;color:#fff;word-wrap: break-word; text-align:center;border-radius:4px;padding:0 10px;border:1px solid #000;} -.data-tip-top:after,.data-tip-top:before{position: absolute;content:'';width:0;height:0;left: 45%;bottom:-10px;border-left: 5px solid transparent; +.data-tip-top1:after,.data-tip-top1:before{position: absolute;content:'';width:0;height:0;left: 45%;bottom:-10px;border-left: 5px solid transparent; border-right: 5px solid transparent;border-top: 10px solid #000;} -.data-tip-top:before{bottom:-11px;} +.data-tip-top1:before{bottom:-11px;} /*选择题tab切换*/ .nav_option li{overflow: hidden;width: 110px; text-align: center;cursor: pointer;height: 38px;line-height: 38px;border-top-right-radius: 5px;border-top-left-radius: 5px;border:1px solid #e2e2e2;border-bottom: 0px;color: #FF7500;border-right: none;} .nav_option li:last-child{border-right: 1px solid #e2e2e2;}