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 @@
- <%= @syllabuses_num %>
全部
- - <%= @create_syllabuses_count + @join_syllabuses_count %>
我的课堂
+ - <%= @my_courses_count %>
我的课堂
<%= link_to "+ 新建".html_safe, new_course_path, :class => "fr font-16 white-btn orange-btn mt10" %>
<%= link_to "+ 加入课堂".html_safe, join_private_courses_courses_path, :remote => true, :method => "post", :class => "fr mr30 font-16 white-btn orange-btn mt10" %>
diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb
index b75e3a929..98e1391c5 100644
--- a/app/views/games/_game_show.html.erb
+++ b/app/views/games/_game_show.html.erb
@@ -81,7 +81,7 @@
-
-
-
-
-<% if false %>
-
+
\ No newline at end of file
diff --git a/app/views/homework_common/_homework_index_list.html.erb b/app/views/homework_common/_homework_index_list.html.erb
index cadda3248..4013d1c29 100644
--- a/app/views/homework_common/_homework_index_list.html.erb
+++ b/app/views/homework_common/_homework_index_list.html.erb
@@ -36,10 +36,12 @@
<%= link_to had_uncommit_studentwork_count(homework_common), student_work_index_path(:homework => homework_common.id, :tab => 2, :status => ['0']), :class => 'color-orange03 mr5', :target => '_blank' %>
未交
-
- <%= link_to had_unevaluate_count(homework_common), student_work_index_path(:homework => homework_common.id, :tab => 2, :comment => ['0']), :class => 'color-orange03 mr5', :target => '_blank' %>
- 未评
-
+ <% if homework_common.homework_type != 4 %>
+
+ <%= link_to had_unevaluate_count(homework_common), student_work_index_path(:homework => homework_common.id, :tab => 2, :comment => ['0']), :class => 'color-orange03 mr5', :target => '_blank' %>
+ 未评
+
+ <% end %>
<% else %>
<%= link_to had_commit_studentwork_count(homework_common), student_work_index_path(:homework => homework_common.id, :tab => 2), :class => 'color-orange03 mr5', :target => '_blank' %>
diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb
index e2a125e0b..d3493ee30 100644
--- a/app/views/messages/_course_show.html.erb
+++ b/app/views/messages/_course_show.html.erb
@@ -37,7 +37,6 @@
<% 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 %>
diff --git a/app/views/messages/sticky_topic.js.erb b/app/views/messages/sticky_topic.js.erb
new file mode 100644
index 000000000..936731f48
--- /dev/null
+++ b/app/views/messages/sticky_topic.js.erb
@@ -0,0 +1 @@
+$("#user_activity_<%= params[:user_activity_id]%>").replaceWith("<%= j(render :partial => 'users/course_message', :locals => {:activity => @topic, :user_activity_id => params[:user_activity_id],:is_course=>1,:is_board=>0}) %>");
\ No newline at end of file
diff --git a/app/views/shixuns/_achieve_ways.html.erb b/app/views/shixuns/_achieve_ways.html.erb
new file mode 100644
index 000000000..72471053a
--- /dev/null
+++ b/app/views/shixuns/_achieve_ways.html.erb
@@ -0,0 +1,71 @@
+
+
+
+
+
diff --git a/app/views/shixuns/index.html.erb b/app/views/shixuns/index.html.erb
index 6c6b6d9a3..22507525c 100644
--- a/app/views/shixuns/index.html.erb
+++ b/app/views/shixuns/index.html.erb
@@ -90,6 +90,10 @@
+ -
+
+
+
@@ -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 @@
-
- <% if activity.author.id == User.current.id%>
- -
- <%= link_to(
- l(:button_edit),
- edit_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
- :class => 'postOptionLink'
- ) if activity.course_editable_by?(User.current) %>
-
- <% if activity.course_destroyable_by?(User.current) %>
- -
- 删除
-
- <% end %>
+ - 发 送
+ <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) %>
+ - <%= activity.sticky == 1 ? '取消置顶' : '置 顶'.html_safe %>
+ <% end %>
+ <% if User.current.admin? || User.current.allowed_to?(:as_teacher, @course) || User.current == activity.author %>
+ - 编 辑
+ -
+ 删 除
+
<% end %>
- - <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
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;}
- <%= link_to dis.user.show_name, user_path(dis.user), :class => "fl link-color-grey mr20" ,:style => "display: block" %> - <%= time_from_now dis.created_at %> - <% if dis.try(:challenge_id).present? %> - [第<%= Challenge.find(dis.try(:challenge_id)).try(:position) %>关] - <% end %> - + <% @discusses.each do |dis| %> +
+ <%= link_to image_tag(url_to_avatar(dis.user), :alt => "头像", :width => 35, :height => 35), user_path(dis.user),:class => "fl mt5", :target => '_blank' %>
+
+
-
+
- <% end %>
-
-
- <% end %>
-
-
-
-
+ <% end %>
<% end %>
-
+ <%= link_to dis.user.show_name, user_path(dis.user), :class => "fl link-color-grey mr20" ,:style => "display: block" %> + <%= time_from_now dis.created_at %> + <% if dis.try(:challenge_id).present? %> + [第<%= Challenge.find(dis.try(:challenge_id)).try(:position) %>关] + <% end %> + <%= render :partial => "discusses/dis_praise", :locals => {:discuss => dis} %> @@ -138,15 +27,15 @@ <% end %> -
-<%= dis.content %>
+ +<%= dis.content %>
- - <% dis.children.each do |child| %> -- 老师回复 - <%= time_from_now child.created_at %> +
+ <% dis.children.each do |child| %> ++ 老师回复 + <%= time_from_now child.created_at %> <%= render :partial => "discusses/dis_praise", :locals => {:discuss => child} %> @@ -155,9 +44,9 @@ 删除 <% end %> -
-<%= child.content %>
- - -- <%= pagination_links_full @discusses_pages, @discusses_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> -
- + ++ <%= pagination_links_full @discusses_pages, @discusses_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> +
+ +