diff --git a/app/assets/javascripts/debates.js.coffee b/app/assets/javascripts/debates.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/debates.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/debates.css.scss b/app/assets/stylesheets/debates.css.scss new file mode 100644 index 000000000..6c45b3be9 --- /dev/null +++ b/app/assets/stylesheets/debates.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the debates controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index aef0170ff..375596075 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -132,6 +132,8 @@ class ChallengesController < ApplicationController end end @index = params[:position].to_i - 1 + # 发起重置请求 + shixun_modify_status_without_publish(@shixun, 1) respond_to do |format| format.js end @@ -157,6 +159,8 @@ class ChallengesController < ApplicationController answer = params[:choice][:answer][index] == "0" ? false : true ChallengeQuestion.create(:option_name => test, :challenge_choose_id => @challenge_choose.id, :position => index, :right_key => answer) end + # 发起重置请求 + shixun_modify_status_without_publish(@shixun, 1) @challenge_choose.challenge_tags.delete_all unless @challenge_choose.challenge_tags.blank? unless params[:knowledge].blank? params[:knowledge][:input].each do |input| @@ -197,7 +201,8 @@ class ChallengesController < ApplicationController def destroy_challenge_choose @challenge_choose = ChallengeChoose.where(:id => params[:choose_id]).first @challenge_choose.destroy - + # 发起重置请求 + shixun_modify_status_without_publish(@shixun, 1) redirect_to edit_shixun_challenge_path(@challenge, :shixun_id => @shixun) end @@ -255,7 +260,7 @@ class ChallengesController < ApplicationController end end # 向jenkins端发送请求,构建公共测试用例 - add_shixun_modify_status(@shixun, 1) + shixun_modify_status_publish(@shixun, 1) elsif params[:tab].to_i == 5 @challenge_tags.delete_all unless @challenge_tags.blank? unless params[:knowledge].blank? diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 887b24d06..9eef2c48f 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -36,8 +36,9 @@ class CoursesController < ApplicationController before_filter :require_login, :only => [:join, :unjoin] #before_filter :allow_join, :only => [:join] require 'bundler/setup' - require 'simple_xlsx_reader' - + if RUBY_PLATFORM =~ /linux/ + require 'simple_xlsx_reader' + end # params[:search] 搜索课程的名称 # params[:select] "join" "create" "all" 参与的 创建的 所有的课程 # @@ -103,6 +104,17 @@ class CoursesController < ApplicationController @import_attachments = Attachment.where(:container_id => @course.id, :container_type => "ImportStudent") end + def shixun_statistics + @homeworks = @course.homework_commons.where("homework_type = 4").order("created_at asc") + filename="#{format_date(Time.now)}_#{@course.teacher.show_real_name.to_s}_#{@course.name}_实训数据报告"; + + respond_to do |format| + format.xls { + send_data(shixun_xls(@homeworks,@course), :type => 'application/octet-stream', :filename => filename_for_content_disposition("#{filename}.xls")) + } + end + end + # REDO:性能需要优化,这块是管理员后台任务,不影响用户使用 def sync_students school_id = User.find(@course.tea_id).try(:user_extensions).try(:school_id) @@ -1988,6 +2000,87 @@ class CoursesController < ApplicationController @results = paginateHelper @results, @limit end + def shixun_xls homeworks, course + xls_report = StringIO.new + book = Spreadsheet::Workbook.new + blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 + black = Spreadsheet::Format.new :color => :black, :weight => :bold, :size => 10 + current_row = 0 + homeworks.each_with_index do |homework, i| + sheet = book.create_worksheet :name => "第#{i+1}次作业" + sheet.row(0).default_format = blue + sheet[0,0] = "课堂编号" + sheet[0,1] = "主讲老师" + sheet[0,2] = "课堂名称" + sheet[0,3] = "作业编号" + sheet[0,4] = "作业/实训名称" + sheet[0,5] = "关卡" + sheet[0,6] = "学生id" + sheet[0,7] = "学生姓名" + sheet[0,8] = "经验值" + sheet[0,9] = "金币" + sheet[0,10] = "评测历史" + sheet[0,11] = "评测时间" + sheet[0,12] = "评测结果" + sheet[1,0] = course.id + sheet[1,1] = course.teacher.show_real_name + sheet[1,2] = course.name + sheet[1,3] = "# #{i + 1}" + sheet[1,4] = homework.name + current_row = 1 + shixun = homework.homework_commons_shixuns.shixun if homework.homework_commons_shixuns + if shixun + shixun.challenges.each_with_index do |challenge, j| + sheet[current_row,5] = "第#{j+1}关" + games = Game.where(:challenge_id => challenge.id, :user_id => homework.student_works.where("work_status != 0").map(&:user_id)) + count_exp_score = 0 + count_gold_score = 0 + count_test = 0 + count_time = 0 + if games.count > 0 + games.each do |game| + user = game.user + sheet[current_row,6] = user.login + sheet[current_row,7] = user.show_real_name + sheet[current_row,8] = game.final_score ? "+#{game.final_score.to_s} 经验值" : "--" + count_exp_score = count_exp_score + (game.final_score ? game.final_score.to_i : 0) + sheet[current_row,9] = game.final_score ? (game.answer_open? ? "#{-challenge.score.to_i} 金币" : "+#{game.final_score.to_i} 金币") : "--" + count_gold_score = count_gold_score + (game.final_score ? (game.answer_open? ? -challenge.score.to_i : game.final_score.to_i) : 0) + + count = game.outputs.count + if count > 0 + outputs = game.outputs.where(:test_set_position => 1).order("created_at asc") + outputs.each_with_index do |output, k| + count_test = count_test + 1 + sheet[current_row,10] = "第#{k+1}次评测" + sheet[current_row,11] = k == 0 ? game_spend_time((output.created_at - game.created_at).to_i) : game_spend_time((output.created_at - outputs[k-1].created_at).to_i) + count_time = count_time + (k == 0 ? (output.created_at - game.created_at).to_i : (output.created_at - outputs[k-1].created_at).to_i) + sheet[current_row,12] = game.outputs.where(:query_index => output.query_index).select{|ou| ou.result == false}.count > 0 ? "失败" : "成功" + current_row = current_row + 1 + end + else + current_row = current_row + 1 + end + end + else + current_row = current_row + 1 + end + + sheet[current_row,6] = "合计" + sheet[current_row,7] = games.count.to_s + "人" + sheet[current_row,8] = count_exp_score >= 0 ? "+#{count_exp_score} 经验值" : "-#{count_exp_score} 经验值" + sheet[current_row,9] = count_gold_score >= 0 ? "+#{count_gold_score} 金币" : "-#{count_gold_score} 金币" + sheet[current_row,10] = "共#{count_test}次评测" + sheet[current_row,11] = game_spend_time((count_time == 0 ? 0 : (count_time / count_test)).to_i)+"/次" + sheet.row(current_row).default_format = black + current_row = current_row + 1 + end + end + end + book.write xls_report + xls_report.string + end + def member_to_xls homeworks, course, members,groups xls_report = StringIO.new book = Spreadsheet::Workbook.new diff --git a/app/controllers/debates_controller.rb b/app/controllers/debates_controller.rb new file mode 100644 index 000000000..5e442e4bb --- /dev/null +++ b/app/controllers/debates_controller.rb @@ -0,0 +1,2 @@ +class DebatesController < ApplicationController +end diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index ed646354c..337f951aa 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -119,8 +119,10 @@ class ForumsController < ApplicationController end def index - order = "" + order = "sticky desc, created_at desc" @order_str = "" + @user = User.current +=begin if(params[:reorder_complex]) order = "replies_count #{params[:reorder_complex]}, #{Memo.table_name}.created_at #{params[:reorder_complex]}" @order_str = "reorder_complex="+params[:reorder_complex] @@ -134,6 +136,7 @@ class ForumsController < ApplicationController order = "#{Memo.table_name}.updated_at desc" @order_str = "reorder_time=desc" end +=end @memo = Memo.new(:forum => @forum) @memos = Memo.where("parent_id is null") @topic_count = @memos.count @@ -148,10 +151,13 @@ class ForumsController < ApplicationController @my_forums_count = Memo.where("author_id =? and parent_id is null", User.current.id).count @my_memos_count = Memo.where("author_id =? and parent_id is not null", User.current.id).count @errors = params[:errors] + memos_id = Memo.where("author_id =?", User.current.id).map(&:id) + @memos_praise_count = PraiseTread.where(:praise_tread_object_id => memos_id, :praise_tread_object_type => "Memo").count + respond_to do |format| format.js format.html { - render :layout => 'base_new_forum' + render :layout => 'base_edu' }# show.html.erb format.json { render json: @forum } end @@ -181,13 +187,10 @@ class ForumsController < ApplicationController end @memo = Memo.new(:forum => @forum) @topic_count = @forum.topics.count - @topic_pages = Paginator.new @topic_count, per_page_option, params['page'] - @memos = @forum.topics.includes(:last_reply). - limit(@topic_pages.per_page). - offset(@topic_pages.offset). - reorder(order). - preload(:author, {:last_reply => :author}). - all + @limit = 20 + @is_remote = true + @topic_pages = Paginator.new @topic_count, @limit, params['page'] || 1 + @memos = paginateHelper @forum.topics.includes(:last_reply).reorder(order).preload(:author, {:last_reply => :author}), @limit @my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and parent_id is null").count @my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and parent_id is not null").count @errors = params[:errors] diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 69194f1f8..cc68070d3 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -316,9 +316,9 @@ class GamesController < ApplicationController answer_right = [] @game_challenge.challenge_chooses.each_with_index do |choose, index| correct = (params[:answer][index] == choose.standard_answer) ? true : false - if choose.current_choose_outputs.blank? - ChooseOutputs.create(:challenge_choose_id => choose.id, :user_id => User.current.id, :answer => params[:answer][index], :correct => correct) - end + #choose.current_choose_outputs.delete if choose.current_choose_outputs.present? + #ChooseOutputs.create(:challenge_choose_id => choose.id, :user_id => User.current.id, :answer => params[:answer][index], :correct => correct) + Output.create(:game_id => @game.id, :test_set_position => choose.position, :actual_output => params[:answer][index], :result => correct, :query_index => @game.query_index) if @shixun.status > 1 && !@game.answer_open if correct score += choose.score @@ -332,14 +332,15 @@ class GamesController < ApplicationController end answer_right << correct end - @game.update_attributes(:status => 2, :end_time => Time.now) @had_done = @game.had_done - reward_grade(@game.user, @game.id, 'Game', score) - reward_experience(@game.user, @game.id, 'Game', score) - @game.update_attribute(:final_score, score) - + if @right + @game.update_attributes(:status => 2, :end_time => Time.now) + reward_grade(@game.user, @game.id, 'Game', score) + reward_experience(@game.user, @game.id, 'Game', score) + @game.update_attribute(:final_score, score) + end respond_to do |format| - format.js{redirect_to myshixun_game_path(@game, :myshixun_id => @myshixun, :choose => 1)} + format.js{redirect_to myshixun_game_path(@game, :myshixun_id => @myshixun, :choose => @right)} end end @@ -407,7 +408,7 @@ class GamesController < ApplicationController if(params[:choose] == "true") challenge.challenge_chooses.each_with_index do |choose, index| @answer += "第"+ ((index + 1).to_s) +"题:
" - @answer += choose.answer + @answer += (choose.answer.blank? ? choose.standard_answer : choose.answer) @answer += "


" end else @@ -434,11 +435,17 @@ class GamesController < ApplicationController user = User.current challenge_score = @game_challenge.score.to_i reward_grade(user, @game.id, 'Answer', -challenge_score) - @answer = @game_challenge.answer - @game.update_column(:answer_open, true) - respond_to do |format| - format.js + @answer = "" + if @game.challenge.st == 0 + @answer = @game_challenge.answer + else + @game_challenge.challenge_chooses.each_with_index do |choose, index| + @answer += "第"+ ((index + 1).to_s) +"题:
" + @answer += (choose.answer.blank? ? choose.standard_answer : choose.answer) + @answer += "


" + end end + @game.update_column(:answer_open, true) end def refresh_game_list diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 8a7630134..5d844b04a 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -850,36 +850,35 @@ end def classroom_classment @menu_type = 2 @sub_type = 2 - @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] + @sx_order = params[:sx_order].blank? ? "desc" : params[:sx_order] @courses = Course.where(:is_delete => 0) - @timing = Course.where(:is_end=>false).count - @end = Course.where(:is_end=>true).count + @timing=Course.where(:is_end=>false).count + @end=Course.where(:is_end=>true).count @course_lists = CourseList.where(:id => Course.where(:is_delete => 0 ).map(&:course_list_id) ) unless params[:school_id] || params[:search] || params[:keyword] || params[:status] - user_exs=UserExtensions.where(:school_id=> @courses.map(&:school_id)) - @schools = School.where(:id =>user_exs.map(&:school_id)) + user_exs=UserExtensions.where(:school_id=> @courses.map(&:school_id)) + @schools = School.where(:id =>user_exs.map(&:school_id)) end @search = params[:search] # 搜索字 @keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索 - status = params[:status].to_i - courselist = params[:course_list] + @status = params[:status] + @courselist = params[:course_list] + @school_id = params[:school_id] if params[:school_id] && params[:school_id] != '' - @school_id = params[:school_id] - @courses = @courses.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id").where("ue.school_id = #{params[:school_id]}") + @courses = Course.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id").where("ue.school_id = #{params[:school_id]}") end if params[:homepage_show] @courses = @courses.where(:homepage_show => params[:homepage_show].to_i) end - if courselist && courselist != '' - @courses = @courses.where(:course_list_id => courselist) + if params[:course_list] && params[:course_list] != '' + @courses = @courses.where(:course_list_id => @courselist) end if params[:status] && params[:status]!='' - @status = params[:status] - @courses =@courses.where(:is_end =>status) + @courses =@courses.where(:is_end => @status.to_i) end if "u_name" == @keyword if @search.blank? @@ -892,6 +891,7 @@ end @courses= @courses.where("name like '%#{@search}%'") end @courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").reorder("updatetime #{@sx_order}") + @export_courses = @courses @courses_count = @courses.count limit = 20 @is_remote = true @@ -901,6 +901,11 @@ end respond_to do |format| format.js format.html + format.xls{ + @export_courses = @export_courses.all + filename = "#{l(:label_course_list_xls)}.xls" + send_data(course_list_xls(@export_courses), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename)) + } end end @@ -1622,28 +1627,29 @@ end render_404 end - def course_list_xls course + def course_list_xls courses xls_report = StringIO.new book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet :name => "course" blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 sheet1.row(0).default_format = blue - sheet1.row(0).concat([l(:issue_xls_id),l(:issue_xls_tracker_id),l(:issue_xls_title),l(:issue_xls_description),l(:issue_xls_status),l(:issue_xls_assign),l(:issue_xls_priority),l(:issue_xls_author),l(:issue_xls_created_at),l(:milestone),l(:issue_xls_start),l(:issue_xls_due),l(:issue_xls_ratio)]) + sheet1.row(0).concat(["ID","课堂名称","成员","资源","普通作业"," 实训作业","试卷","私有","状态","创建者单位","创建者","动态时间"]) count_row = 1 - issues.each do |issue| - sheet1[count_row,0] = issue.id - sheet1[count_row,1] = issue_tracker_change(issue.tracker_id) - sheet1[count_row,2] = issue.subject - sheet1[count_row,3] = (issue.description.gsub(/<\/?.*?>/,"")).html_safe - sheet1[count_row,4] = issue_status_change(issue.status_id) - sheet1[count_row,5] = issue.assigned_to.try(:show_name) - sheet1[count_row,6] = issue_priority_change(issue.priority_id) - sheet1[count_row,7] = issue.author.show_name - sheet1[count_row,8] = issue.created_on.nil? ? issue.created_on : issue.created_on.strftime('%Y-%m-%d %H:%M:%S') - sheet1[count_row,9] = issue.fixed_version.try(:name) - sheet1[count_row,10] = issue.start_date.nil? ? issue.start_date : issue.start_date.strftime('%Y-%m-%d') - sheet1[count_row,11] = issue.due_date.nil? ? issue.due_date : issue.due_date.strftime('%Y-%m-%d') - sheet1[count_row,12] = issue_ratio_change(issue.done_ratio, issue.status_id) + courses.each do |course| + school = course.teacher.try(:user_extensions).try(:school).try(:name).blank? ? "--" : course.teacher.school_name + teacher_name = course.teacher ? course.teacher.show_real_name : "" + sheet1[count_row,0] = course.id + sheet1[count_row,1] = course.name + sheet1[count_row,2] = course.members.count + sheet1[count_row,3] = course.attachments.count + sheet1[count_row,4] = course.homework_commons.where(:homework_type => 1).count + sheet1[count_row,5] = course.homework_commons.where(:homework_type => 4).count + sheet1[count_row,6] = course.exercises.count + sheet1[count_row,7] = course.is_public.to_i == 1 ? '否' : '是' + sheet1[count_row,8] = course.is_end ? "已结束" : "正在进行" + sheet1[count_row,9] = school + sheet1[count_row,10] = teacher_name + sheet1[count_row,11] = format_time(course.updatetime) count_row += 1 end book.write xls_report diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 7f4c1d48e..7e9662563 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -1,6 +1,6 @@ class MemosController < ApplicationController default_search_scope :memos - before_filter :find_forum, :only => [:new, :create, :preview, :update] + before_filter :find_forum, :only => [:new, :create, :preview, :update, :reply] before_filter :find_attachments, :only => [:preview] before_filter :find_memo, :except => [:new, :create, :preview] before_filter :authenticate_user_edit, :only => [:edit, :update] @@ -29,13 +29,14 @@ class MemosController < ApplicationController def new # 如何是问吧主页来的,导航不显示具体贴吧名 + @user = User.current @memo = Memo.new - @my_forums_count = Memo.where("author_id =? and parent_id is null", User.current.id).count - @my_memos_count = Memo.where("author_id =? and parent_id is not null", User.current.id).count + @my_forums_count = Memo.where("author_id =? and parent_id is null",@user.id).count + @my_memos_count = Memo.where("author_id =? and parent_id is not null", @user.id).count @forums = Forum.reorder("topic_count desc,updated_at desc") respond_to do |format| format.js - format.html {render layout: 'base_new_forum'} + format.html {render layout: 'base_edu'} format.json { render json: @memo } end end @@ -88,6 +89,7 @@ class MemosController < ApplicationController REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE) def show + @user = User.current # 更新贴吧帖子留言对应的memo_messages的viewed字段 unless @memo.children.blank? @memo.children.each do |child| @@ -141,19 +143,20 @@ class MemosController < ApplicationController respond_to do |format| format.js - format.html {render :layout => 'base_new_forum'} + format.html {render :layout => 'base_edu'} format.json { render json: @memo } format.xml { render xml: @memo } end end def edit - @my_topic_count = 0 - @my_replies_count = Memo.where(:parent_id => @memo.id).count - @forums = Forum.reorder("topic_count desc,updated_at desc") - @replying = false + #@my_topic_count = 0 + #@my_replies_count = Memo.where(:parent_id => @memo.id).count + #@forums = Forum.reorder("topic_count desc,updated_at desc") + #@replying = false + @user = User.current respond_to do |format| - format.html {render :layout => 'base_new_forum'} + format.html {render :layout => 'base_edu'} end end @@ -173,7 +176,7 @@ class MemosController < ApplicationController @flag = @memo.save # @memo.root.update_attribute(:updated_at, @memo.updated_at) format.js - format.html {redirect_to back_memo_url, notice: "#{l :label_memo_update_succ}"} + format.html {redirect_to back_memo_url} else format.js format.html { render action: "edit" } @@ -182,12 +185,64 @@ class MemosController < ApplicationController end end + def reply + if params[:memo].present? && params[:memo][:parent_id].present? + parent = Memo.find params[:memo][:parent_id] + @memo = params[:activity_id].blank? ? parent : Memo.find(params[:activity_id].to_i) + @reply = Memo.new + @reply.author = User.current + @reply.forum_id = parent.forum_id + @reply.content = params[:content] + @reply.subject = "RE: #{@memo.subject}" + #@reply.reply_id = params[:id] + @reply.root_id = parent.root_id.nil? ? parent.id : parent.root_id + # @reply.reply_id = params[:id] + parent.children << @reply + else + @reply = Memo.new() + @reply.content = params[:content] + @reply.subject = @memo.subject + @reply.author = User.current + @reply.forum_id = @forum.id + #@reply.content = @quote + @reply.content + #@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject] + @reply.root_id = @memo.id + @reply.safe_attributes = params[:reply] + @memo.children << @reply + # @reply.reply_id = params[:id] + end + + redirect_to message_replies_forum_memo_path(@memo.forum, @memo, :user_activity_id => params[:user_activity_id]) + end + + def message_replies + @replies = Memo.where(:root_id => @memo.id).order("created_at desc") + @reply_count = @replies.count + @replies = get_no_children_comments_all @replies + #@limit_count = @replies.count + #@page = params[:page] ? params[:page].to_i + 1 : 0 + #@limit = 10 + #@replies = @replies[@page * @limit..@page * @limit + 9] + @reply = Message.new() + @user_activity_id = params[:user_activity_id].blank? ? @memo.id : params[:user_activity_id].to_i + respond_to do |format| + format.js + end + + end + def destroy @memo.destroy - respond_to do |format| - # format.html { redirect_to @back_url } - format.html { redirect_to back_memo_or_forum_url } + #format.html { redirect_to @back_url } + format.html { redirect_to forums_path } + format.js{ + @memo = Memo.find(params[:user_activity_id].to_i) + @replies = Memo.where(:root_id => @memo.id).order("created_at desc") + @reply_count = @replies.count + @replies = get_no_children_comments_all @replies + #redirect_to message_replies_forum_memo_path(@memo.forum, @memo, :user_activity_id => params[:user_activity_id]) + } format.json { head :no_content } end end @@ -196,7 +251,13 @@ class MemosController < ApplicationController def change_sticky @memo.sticky ? @memo.update_attribute(:sticky, false) : @memo.update_attribute(:sticky, true) respond_to do |format| - format.html { redirect_to forum_memo_path(@memo.forum, @memo) } + format.html { + if params[:index] + redirect_to forums_path + else + redirect_to forum_memo_path(@memo.forum, @memo) + end + } end end diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 813c790b4..a2aadf706 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -127,7 +127,6 @@ class MyshixunsController < ApplicationController compile_success = jsonTestDetails['compileSuccess'] # message = Base64.decode64(params[:msg]) unless params[:msg].blank? logger.info(outPut) - logger.info("##################"+ compile_success) game = Game.find(game_id) challenge = game.challenge unless jenkins_testsets.blank? @@ -135,7 +134,6 @@ class MyshixunsController < ApplicationController actual_output = tran_base64_decode64(j_test_set['output']) game_outputs = Output.create(:code => status, :game_id => game_id, :out_put => outPut, :test_set_position => j_test_set['caseId'], :actual_output => actual_output, :result => j_test_set['passed'].to_i, :query_index => game.query_index, :compile_success => compile_success.to_i) - logger.info("compile_success:"+ compile_success) # output = Output.where(:game_id => game.id, :test_set_position => j_test_set['caseId'].to_i).first # logger.info("#############{outPut}") # if output.nil? diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 2776a3a72..6ce0e4c63 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -24,6 +24,7 @@ class ShixunsController < ApplicationController @offset ||= @statistic_pages.offset @statistics = paginateHelper @statistics, @limit + end # push代码的时候会触发gitlab hook @@ -114,9 +115,9 @@ class ShixunsController < ApplicationController @rev = params[:rev] @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 + # if @shixun.try(:status).to_i < 2 shixun_modify_status_without_publish(@shixun, 1) - end + # end respond_to do |format| format.js end @@ -254,9 +255,9 @@ class ShixunsController < ApplicationController # 确定 sort 1升序 2 降序 @order = params[:order] || "myshixun_count" bsort = params[:sort] || "desc" - @sort = bsort == "desc" ? "asc" : "desc" + @sort = bsort == "asc" ? "desc" : "asc" if @order == "updated_at" - order_str = "#{Shixun.table_name}.updated_at #{bsort}" + order_str = "#{Shixun.table_name}.updated_at #{@sort}" else order_str = "myshixun_count #{bsort}, #{Shixun.table_name}.updated_at #{bsort}" end @@ -546,6 +547,10 @@ class ShixunsController < ApplicationController end def copy + unless (@shixun.can_copy && User.current.user_extensions.try(:identity) == 0 && User.current.professional_certification) + render_403 + return + end ActiveRecord::Base.transaction do begin new_shixun = Shixun.new @@ -574,10 +579,13 @@ class ShixunsController < ApplicationController gshixun = g.fork(@shixun.gpid, user_gid) raise "版本库创建失败" if gshixun.try(:id).blank? gshixun = g.edit_project(gshixun.id, new_shixun.identifier, new_shixun.identifier) - raise "版本库创建失败" if (gshixun.try(:name) != new_shixun.identifier || gshixun.try(:path) != new_shixun.identifier) + raise "实训复制失败" if (gshixun.try(:name) != new_shixun.identifier || gshixun.try(:path) != new_shixun.identifier) new_shixun.update_column(:gpid, gshixun.id) # 同步复制合作者,合作者加入到gitlab + unless User.current.manager_of_shixun?(@shixun) + ShixunMember.create!(:user_id => User.current.id, :shixun_id => new_shixun.try(:id), :role => 1) + end @shixun.shixun_members.each do |shixun_member| if ShixunMember.where(:shixun_id => new_shixun.try(:id), :user_id => shixun_member.user_id).blank? ShixunMember.create!(:user_id => shixun_member.try(:user_id), :shixun_id => new_shixun.try(:id), @@ -718,7 +726,7 @@ class ShixunsController < ApplicationController ActiveRecord::Base.transaction do begin @shixun.save! - if language != params[:language] + if language != params[:language] && @shixun.status != 2 # 已发布不触发重置 add_shixun_modify_status(@shixun, 1) end rescue diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3e5a0c0a3..1f545fd9e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -321,6 +321,11 @@ class UsersController < ApplicationController when 'Syllabus' @reply = JournalsForMessage.find params[:reply_id] @type = 'Syllabus' + when 'Memo' + @reply = Memo.find params[:reply_id] + @user_activity_id = params[:user_activity_id] + @activity_id = params[:activity_id] + @type = 'Memo' end respond_to do |format| format.js diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e13cf05b8..122d74478 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -101,6 +101,17 @@ module ApplicationHelper shixun_modify_status_without_publish shixun, type end + def shixun_modify_status_publish shixun, type + shixun_tomcat = Redmine::Configuration['shixun_tomcat'] + gameInfo = shixun.gameInfo + uri ="#{shixun_tomcat}/bridge/game/publishGame" + params = {gameInfo:gameInfo} + res = uri_exec uri, params + if res && res['code'].to_i != 0 + raise("实训云平台繁忙(繁忙等级:90)") + end + end + # 仅仅产生记录,用于已执行publish的方法 # ShixunModify中status 1:表示有更改,开启实训的时候需要重置,0:表示不需要重置或已重置完成 def shixun_modify_status_without_publish shixun, type @@ -503,7 +514,7 @@ module ApplicationHelper def new_homework_common_status status case status when 0 - "挂起" + "未发布" when 1 "提交中" when 2 @@ -523,7 +534,7 @@ module ApplicationHelper def homework_status_color status style = "" case status - when '挂起' + when '未发布' style = 'edu-filter-btn-yellow' when '提交中' style = 'edu-filter-btn-blue' @@ -571,7 +582,7 @@ module ApplicationHelper if ho_detail_manual case ho_detail_manual.comment_status when 0 - status = "挂起" + status = "未发布" when 1 if homework_common.end_time && homework_common.end_time >= Time.now status = "提交中" @@ -830,7 +841,7 @@ module ApplicationHelper end # 项目issue列表导出Excel功能 - def issue_list_xls issues + def issue_list_xls issues xls_report = StringIO.new book = Spreadsheet::Workbook.new sheet1 = book.create_worksheet :name => "issues" @@ -4775,7 +4786,7 @@ def get_hw_status homework_common str = "" if homework_common.homework_detail_manual if homework_common.homework_detail_manual.comment_status == 0 && homework_common.publish_time.nil? - str += '挂起' + str += '未发布' elsif homework_common.homework_detail_manual.comment_status == 0 str += '未发布' elsif homework_common.homework_detail_manual.comment_status == 1 diff --git a/app/helpers/debates_helper.rb b/app/helpers/debates_helper.rb new file mode 100644 index 000000000..f551d98d1 --- /dev/null +++ b/app/helpers/debates_helper.rb @@ -0,0 +1,2 @@ +module DebatesHelper +end diff --git a/app/models/challenge_choose.rb b/app/models/challenge_choose.rb index c14a0c02d..38b7d8685 100644 --- a/app/models/challenge_choose.rb +++ b/app/models/challenge_choose.rb @@ -7,6 +7,7 @@ class ChallengeChoose < ActiveRecord::Base has_many :challenge_tags, :dependent => :destroy has_many :challenge_questions, :dependent => :destroy has_one :choose_outputs, :dependent => :destroy + #has_many :outputs, :dependent => :destroy validates_presence_of :subject diff --git a/app/models/game.rb b/app/models/game.rb index 7c0e913ae..e278690c4 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -66,4 +66,18 @@ class Game < ActiveRecord::Base challenge = self.challenge challenge.try(:position).to_i == challenge.shixun.challenges.count ? true : false end + + def choose_correct_num + num = 0 + outputs = self.outputs.where(:query_index => (self.query_index - 1)) + if outputs.blank? + num = nil + else + outputs.each do |output| + num += output.result ? 1 : 0 + end + end + return num + end + end diff --git a/app/models/myshixun.rb b/app/models/myshixun.rb index 9e7e2a0aa..ace51c51f 100644 --- a/app/models/myshixun.rb +++ b/app/models/myshixun.rb @@ -48,7 +48,7 @@ class Myshixun < ActiveRecord::Base score = 0 self.games.each do |game| if game.status == 2 - score += game.final_score + score += game.final_score.to_i end end score diff --git a/app/models/output.rb b/app/models/output.rb index 4ce462eff..8f1547cfe 100644 --- a/app/models/output.rb +++ b/app/models/output.rb @@ -4,5 +4,5 @@ class Output < ActiveRecord::Base # compile_success 1 表示程序未报错,有正常输出, 0.表示程序抛异常了,报错! default_scope :order => 'query_index desc' belongs_to :game - + #belongs_to :challenge_choose end diff --git a/app/views/challenges/_choose_type.html.erb b/app/views/challenges/_choose_type.html.erb index 1947a3760..a47d921f9 100644 --- a/app/views/challenges/_choose_type.html.erb +++ b/app/views/challenges/_choose_type.html.erb @@ -4,8 +4,10 @@ <%= render :partial => "challenges/choose_tab" %>
- + 单选题 - + 多选题 + <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> + + 单选题 + + 多选题 + <% end %>
@@ -79,8 +81,6 @@ } } - - $(".stage-part-2").find(".nav_option li").eq(length-1).after(html); $.ajax({ diff --git a/app/views/challenges/_content_list.html.erb b/app/views/challenges/_content_list.html.erb index 71fb21030..cda61ccd4 100644 --- a/app/views/challenges/_content_list.html.erb +++ b/app/views/challenges/_content_list.html.erb @@ -5,8 +5,8 @@ <%= @challenges.count %> <% end %> <% if User.current.manager_of_shixun?(@shixun) && @shixun.status == 0 %> - +实践任务 - +选择题任务 + +实践任务 + +选择题任务 <% end %> @@ -19,7 +19,7 @@ <% if challenge.st == 0 %> <% else %> - + <% end%> diff --git a/app/views/challenges/_edit_evaluating.html.erb b/app/views/challenges/_edit_evaluating.html.erb index 891458a70..bb589188c 100644 --- a/app/views/challenges/_edit_evaluating.html.erb +++ b/app/views/challenges/_edit_evaluating.html.erb @@ -3,7 +3,7 @@
">

- <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> + <% if User.current.manager_of_shixun?(@shixun) %> 编辑 <% end %>

@@ -49,8 +49,8 @@ <% end %>

-
输入:

<%= match_specific_symbol test.input unless test.input.blank? %>

-
输出:

<%= match_specific_symbol test.output unless test.output.blank? %>

+
输入:

<%= match_specific_symbol test.input unless test.input.blank? %>

+
输出:

<%= match_specific_symbol test.output unless test.output.blank? %>

<% end %> <% else %> diff --git a/app/views/challenges/_single_or_multiple_question_show.html.erb b/app/views/challenges/_single_or_multiple_question_show.html.erb index d93673911..7a2503bb1 100644 --- a/app/views/challenges/_single_or_multiple_question_show.html.erb +++ b/app/views/challenges/_single_or_multiple_question_show.html.erb @@ -3,8 +3,11 @@
  • - 编辑 - 删除 + <% if @shixun.status == 0 && User.current.manager_of_shixun?(@shixun) %> + 编辑 + 删除 + + <% end %>
  • diff --git a/app/views/challenges/_task_pass_form.html.erb b/app/views/challenges/_task_pass_form.html.erb index 215f085d5..394bb633f 100644 --- a/app/views/challenges/_task_pass_form.html.erb +++ b/app/views/challenges/_task_pass_form.html.erb @@ -46,6 +46,28 @@ \ No newline at end of file diff --git a/app/views/courses/settings/_add_students.html.erb b/app/views/courses/settings/_add_students.html.erb index 9937847e4..b2364003d 100644 --- a/app/views/courses/settings/_add_students.html.erb +++ b/app/views/courses/settings/_add_students.html.erb @@ -26,9 +26,9 @@
  • -

    +

    -

    -

    +

    -

    -

    角色:

    +

    角色:

    - 取消 - 确定 + 取消 + 确定
    <% end %>
    diff --git a/app/views/courses/settings/_all_student_list.html.erb b/app/views/courses/settings/_all_student_list.html.erb index 5c2fd729e..ad54ce938 100644 --- a/app/views/courses/settings/_all_student_list.html.erb +++ b/app/views/courses/settings/_all_student_list.html.erb @@ -16,7 +16,7 @@ <% @course.course_groups.each do |group| %>
  • - <%= group.name %> + <%= group.name %> <%= group.members.count %>

    @@ -27,3 +27,13 @@
  • <%= render :partial => "courses/settings/all_student_list_block" %> + + \ No newline at end of file diff --git a/app/views/courses/settings/_all_student_list_block.html.erb b/app/views/courses/settings/_all_student_list_block.html.erb index 91792b86d..24e52571e 100644 --- a/app/views/courses/settings/_all_student_list_block.html.erb +++ b/app/views/courses/settings/_all_student_list_block.html.erb @@ -40,8 +40,9 @@ <% end %>
    - - + + + ×
    diff --git a/app/views/courses/settings/_all_teacher_list_ul.erb b/app/views/courses/settings/_all_teacher_list_ul.erb index db3e22090..9886dbec3 100644 --- a/app/views/courses/settings/_all_teacher_list_ul.erb +++ b/app/views/courses/settings/_all_teacher_list_ul.erb @@ -12,11 +12,20 @@ <% unless @course.course_groups.empty? %> <% @course.course_groups.each do |group| %>
  • -

    +

    <%= group.name %> <%= group.members.count %> -

  • <% end %> -<% end %> \ No newline at end of file +<% end %> + + \ No newline at end of file diff --git a/app/views/courses/settings/_has_group_student_list.html.erb b/app/views/courses/settings/_has_group_student_list.html.erb index 465e05525..5116e46e2 100644 --- a/app/views/courses/settings/_has_group_student_list.html.erb +++ b/app/views/courses/settings/_has_group_student_list.html.erb @@ -14,8 +14,8 @@ <% end %> <% unless @course.course_groups.empty? %> <% @course.course_groups.each do |group| %> -
  • -

    +

  • +

    <%= group.name %> <%= group.members.count %> @@ -26,4 +26,14 @@ <%= render :partial => "courses/settings/has_group_student_list_block" %> - \ No newline at end of file + + + \ No newline at end of file diff --git a/app/views/courses/settings/_has_group_student_list_block.html.erb b/app/views/courses/settings/_has_group_student_list_block.html.erb index 44178da15..5bf490f8c 100644 --- a/app/views/courses/settings/_has_group_student_list_block.html.erb +++ b/app/views/courses/settings/_has_group_student_list_block.html.erb @@ -34,8 +34,9 @@ <% end %>

    - - + + + ×
    diff --git a/app/views/courses/settings/_members.html.erb b/app/views/courses/settings/_members.html.erb index 1c1806e00..cdb8e9d0b 100644 --- a/app/views/courses/settings/_members.html.erb +++ b/app/views/courses/settings/_members.html.erb @@ -46,20 +46,22 @@ <% end %> - <% @apply_users.each_with_index do |apply, index| %> - <% user = User.find(apply.course_message_id) %> - - <%= @teacher_count + index + 1 %> - - <%= link_to user.show_real_name, user_path(user), :target => '_blank', :class => 'edu-txt-w140 task-hide mt5' %> - - <%= user.try(:login) %> - <%= apply.content && apply.content.include?('9') ? "教师" : "助教" %> - - <%= link_to '同意', dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>apply.id), :class=>'color-red mr5'%> - <%= link_to '拒绝', dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>apply.id), :class=>'color-red'%> - - + <% if is_teacher %> + <% @apply_users.each_with_index do |apply, index| %> + <% user = User.find(apply.course_message_id) %> + + <%= @teacher_count + index + 1 %> + + <%= link_to user.show_real_name, user_path(user), :target => '_blank', :class => 'edu-txt-w140 task-hide mt5' %> + + <%= user.try(:login) %> + <%= apply.content && apply.content.include?('9') ? "教师" : "助教" %> + + <%= link_to '同意', dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>apply.id), :class=>'color-red mr5'%> + <%= link_to '拒绝', dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>apply.id), :class=>'color-red'%> + + + <% end %> <% end %> diff --git a/app/views/courses/settings/_no_group_student_list.html.erb b/app/views/courses/settings/_no_group_student_list.html.erb index 42eae5fb0..96cf02f3f 100644 --- a/app/views/courses/settings/_no_group_student_list.html.erb +++ b/app/views/courses/settings/_no_group_student_list.html.erb @@ -14,7 +14,7 @@ <% unless @course.course_groups.empty? %> <% @course.course_groups.each do |group| %>
  • -

    +

    <%= group.name %> <%= group.members.count %> @@ -26,3 +26,14 @@ <%= render :partial => "courses/settings/no_group_student_list_block" %> + + + \ No newline at end of file diff --git a/app/views/courses/settings/_no_group_student_list_block.html.erb b/app/views/courses/settings/_no_group_student_list_block.html.erb index 2cb30a5a5..86b6ec0ff 100644 --- a/app/views/courses/settings/_no_group_student_list_block.html.erb +++ b/app/views/courses/settings/_no_group_student_list_block.html.erb @@ -20,8 +20,9 @@ <% end %>

    - - + + + ×
    diff --git a/app/views/courses/settings/_search_not_students_list.html.erb b/app/views/courses/settings/_search_not_students_list.html.erb index d0ad45ea1..882b28edc 100644 --- a/app/views/courses/settings/_search_not_students_list.html.erb +++ b/app/views/courses/settings/_search_not_students_list.html.erb @@ -7,7 +7,8 @@ diff --git a/app/views/courses/settings/_search_not_teachers_list.html.erb b/app/views/courses/settings/_search_not_teachers_list.html.erb index ae3b96c78..30f71c656 100644 --- a/app/views/courses/settings/_search_not_teachers_list.html.erb +++ b/app/views/courses/settings/_search_not_teachers_list.html.erb @@ -7,7 +7,8 @@ diff --git a/app/views/exercise/examination_setting.html b/app/views/exercise/examination_setting.html new file mode 100644 index 000000000..4f2e60585 --- /dev/null +++ b/app/views/exercise/examination_setting.html @@ -0,0 +1,392 @@ + + + + + + + + + + + + + + + + + + +
    +
    +
    +

    + + 班级首页 > 试卷列表> #22 +

    +
    +

    + + 实验四 多周期CPU与存储器实验 +

    + 返回 +
    + +
    +
    + +
    +
    +
    +

    发布设置

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

    发布设置

    +
    +
    +
    +
      +
    • + + + + +
    • +
    • + + + + + + 不能早于发布时间 +
    • +
    • + + + + +
    • +
    +
    +
    +
    +
    + +
    +
    +
    +

    答题设置

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

    答题设置

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

    主观题评分设置

    +
    +
    +
    +
      +
    • + + + + (选中则取各助教最终评分的平均分) +
      + + + (选中则只取最终次的助教评分) +
    • +
    +
      +
    • + + +
    • +
    • + + + + +
    • +
    • + + + +
    • +
    +
    +
    +
    +
    +
    +

    主观题评分设置

    +
    +
    +
    +
      +
    • + + + + (选中则取各助教最终评分的平均分) +
      + + + (选中则只取最终次的助教评分) +
    • +
    +
      +
    • + + + +
    • +
    • + + + +
    • +
    • + + + +
    • +
    +
    +
    +
    +
    + +
    +
    + +
    +

    公开设置

    +
    +
    +
    +
      +
    • + + + + (选中则在截止时间之后对班级学生公开所有成员的成绩,否则不公开) +
    • +
    • + + + + (选中则在截止时间之后对班级学生公开试卷题目的答案,否则不公开) +
    • +
    +
    +
    +
    +
    +
    +

    公开设置

    +
    +
    +
    +
      +
    • + + + + (选中则在截止时间之后对班级学生公开所有成员的成绩,否则不公开) +
    • +
    • + + + + (选中则在截止时间之后对班级学生公开试卷题目的答案,否则不公开) +
    • +
    +
    +
    +
    +
    +
    + 保存 + 取消 +
    +
    +
    +
    +
    +
    + + diff --git a/app/views/exercise/student_look_fortime.html b/app/views/exercise/student_look_fortime.html new file mode 100644 index 000000000..391b3d7fb --- /dev/null +++ b/app/views/exercise/student_look_fortime.html @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + +
    +
    +
    +

    + + 班级首页 > 试卷列表> #22>胡莎莎 +

    +
    +

    软件测试小测

    + 按时 + + 返回 +
    + +
    +

    试卷须知:
    + 共有选择、填空、简答、编程题4种题型,其中选择题包括单选题和多选题。
    + 请大家认真答题,本次作业成绩将计入期末成绩。

    +
    +
    +

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

    +

    合计 18 题,共 100

    +
    +
    + +
    + 满分 + 零分 + 其它 +

    总分:89

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

    第1题:[多选题]10

    + +

    10

    + +
    +

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

    +
    +
  • +
  • +
  • +
  • + + +
    + 标准答案:ABCD +
    + + + +
    +
    +

    第2题:[单选题]5

    +

    0

    +
    +

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

    +
    +
  • +
  • +
  • +
  • +
    +
    + 标准答案:A +
    +
    + +
    +
    +

    第3题:[填空题]5

    +

    0

    +
    +

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

    +
    +

    候选答案1:哈哈哈哈

    +

    候选答案1:呵呵呵呵

    +
    +
    + +
    +
    +

    第4题:[简答题]10

    +

    9

    +
    +

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

    +
    学生所填答案收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试.验收测试验收测.
    +
    +

    参考答案

    +

    黑盒测试也称功能测试或数据驱动测试,它是在已知产品所应具有的功能,通过测试来检测每个功能是否都能正常使用,在测试时,把程序看作一个不能打开的黑盆子,在完全不考虑程序内部结构和内部特性的情况下,

    +
    +
    + +
    +
    + + + + +
    +
    + 保存 + 取消 +
    +
    +
    +
    + + + + + + + diff --git a/app/views/exercise/student_write_answer.html b/app/views/exercise/student_write_answer.html new file mode 100644 index 000000000..2f4822b59 --- /dev/null +++ b/app/views/exercise/student_write_answer.html @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + +
    +
    +
    +

    + + 班级首页 > 试卷列表> #22>胡莎莎 +

    +
    +

    软件测试小测

    + + + 返回 +
    + +
    +

    试卷须知:
    + 共有选择、填空、简答、编程题4种题型,其中选择题包括单选题和多选题。
    + 请大家认真答题,本次作业成绩将计入期末成绩。

    +
    +
    +

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

    +

    合计 18 题,共 100

    +
    +
    +
    + 已答 + 未答 +

    交卷

    +
    +
    + 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/teacher_check_exam.html b/app/views/exercise/teacher_check_exam.html new file mode 100644 index 000000000..c5f04c08a --- /dev/null +++ b/app/views/exercise/teacher_check_exam.html @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + +
    +
    +
    +

    + + 班级首页 > 试卷列表> #22>胡莎莎 +

    +
    +

    软件测试小测

    + 按时 + + 返回 +
    + +
    +

    试卷须知:
    + 共有选择、填空、简答、编程题4种题型,其中选择题包括单选题和多选题。
    + 请大家认真答题,本次作业成绩将计入期末成绩。

    +
    +
    +

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

    +

    合计 18 题,共 100

    +
    +
    +
    + 主观题 + 已评 + 未评 +
    +
    + 1 + 2 + 3 + 4 + 5 +
    +
    + 客观题 + 正确 + 错误 +
    +
    + 1 + 2 + 3 + 4 + 5 +
    +
    +
    +
    +
    +

    第1题:[多选题]10

    +

    10

    +
    +

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

    +
    +
  • +
  • +
  • +
  • +
    +
    + 标准答案:ABCD +
    +
    + +
    +
    +

    第2题:[单选题]5

    +

    0

    +
    +

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

    +
    +
  • +
  • +
  • +
  • +
    +
    + 标准答案:A +
    +
    + +
    +
    +

    第3题:[填空题]5

    +

    0

    +
    +

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

    +
    +

    候选答案1:哈哈哈哈

    +

    候选答案1:呵呵呵呵

    +
    +
    + +
    +
    +

    第4题:[简答题]10

    +

    9

    +
    +

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

    +
    学生所填答案收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试验收测试.验收测试验收测.
    + 隐藏参考答案 +
    +

    参考答案

    +

    黑盒测试也称功能测试或数据驱动测试,它是在已知产品所应具有的功能,通过测试来检测每个功能是否都能正常使用,在测试时,把程序看作一个不能打开的黑盆子,在完全不考虑程序内部结构和内部特性的情况下,

    +
    +
    + +
    +
    + + + + +
    +
    + 保存 + 取消 +
    +
    +
    +
    +
    +
    +
    +
    + + + diff --git a/app/views/exercise/teacher_edit_exam.html b/app/views/exercise/teacher_edit_exam.html new file mode 100644 index 000000000..5d6d59945 --- /dev/null +++ b/app/views/exercise/teacher_edit_exam.html @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + +
    +
    +
    +

    + + 班级首页 > 试卷列表> #22>胡莎莎 +

    +
    +

    软件测试小测

    + 按时 + + 返回 +
    + +
    +

    试卷须知:
    + 共有选择、填空、简答、编程题4种题型,其中选择题包括单选题和多选题。
    + 请大家认真答题,本次作业成绩将计入期末成绩。

    +
    +
    +

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

    +

    合计 18 题,共 100

    +
    +
    +
    +
    +

    第1题:[多选题]10

    +

    + + + + + +

    +
    +

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

    +
    +
  • +
  • +
  • +
  • +
    +
    + 标准答案:ABCD +
    +
    +
    +
    +

    第2题:[单选题]5

    +

    + + + + + +

    +
    +

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

    +
    +
  • +
  • +
  • +
  • +
    +
    + 标准答案:A +
    +
    + +
    +
    +

    第3题:[填空题]5

    +

    + + + + + +

    +
    +

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

    +
    +

    候选答案1:哈哈哈哈

    +

    候选答案1:呵呵呵呵

    +
    +
    + +
    +
    +

    第4题:[简答题]10

    +

    + + + + + +

    +
    +

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

    +
    +

    参考答案

    +

    黑盒测试也称功能测试或数据驱动测试,它是在已知产品所应具有的功能,通过测试来检测每个功能是否都能正常使用,在测试时,把程序看作一个不能打开的黑盆子,在完全不考虑程序内部结构和内部特性的情况下,

    +
    +
    +
    +
    +
    单选题
    +
    多选题
    +
    填空题
    +
    简答题
    +
    +
    +
    +
    + + + diff --git a/app/views/exercise/teacher_examination_list.html b/app/views/exercise/teacher_examination_list.html new file mode 100644 index 000000000..104d04c57 --- /dev/null +++ b/app/views/exercise/teacher_examination_list.html @@ -0,0 +1,316 @@ + + + + + + + + + + + + + + + +
    +
    +
    +

    + + 胡莎莎 > 智能课堂> 计算机基础> 计算机基础学院工程专业 +

    +
    +
      +
    • + + 计算概论-2016计算机科学与技术/软件工程/网络工程 + + 邀请码:CZPU8 + +
    • +
    • + 欧阳建权 + 湘潭大学 + 教师1 + 学生260 + 分班1 + 学分260 + 结束97 天后 +
    • +
    + +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +

    试卷列表

    + + 新建 + + 题库选用 + 导出成绩 +
    +
    +
    +

    + 全部 + 挂起 + 提交中 + 补交中 + 评阅中 + 已结束 +

    +
    +
    +
    + + +
    + +
    +
    +
    +
    +
    +
    + # 1 + 实训样式 + + 挂起 + 未答 +
    +

    + 创建于21天前 + 更新于1天前 + 60已答 + 2未答 + 60未评 + 10  5 小时 10  +

    +
    + +
    +
    +
    + # 1 + 实训样式 + + 评阅中 +
    +

    + 创建于21天前 + 更新于1天前 + 60已答 + 2未答 + 60未评 + 10  5 小时 10  +

    +
    + +
    +
    +
    + # 1 + 实训样式 + + 提交中 +
    +

    + 创建于21天前 + 更新于1天前 + 60已答 + 2未答 + 60未评 + 10  5 小时 10  +

    +
    + +
    +
    +
    + # 1 + 实训样式 + + 评阅中 +
    +

    + 创建于21天前 + 更新于1天前 + 60已答 + 2未答 + 60未评 + 10  5 小时 10  +

    +
    + +
    +
    +
    + # 1 + 实训样式 + + 补交中 +
    +

    + 创建于21天前 + 更新于1天前 + 60已答 + 2未答 + 60未评 + 10  5 小时 10  +

    +
    + +
    +
    +
    + # 1 + 实训样式 + + 已结束 +
    +

    + 创建于21天前 + 更新于1天前 + 60已答 + 2未答 + 60未评 + 10  5 小时 10  +

    +
    + +
    + +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + diff --git a/app/views/exercise/teacher_score_list.html b/app/views/exercise/teacher_score_list.html new file mode 100644 index 000000000..d306ecdb0 --- /dev/null +++ b/app/views/exercise/teacher_score_list.html @@ -0,0 +1,229 @@ + + + + + + + + + + + + + + + + + +
    +
    +
    +

    + + 班级首页 > 试卷列表> #22 +

    +
    +

    + 实验四 多周期CPU与存储器实验 +

    + 返回 + 设置 + + 查看设置 +
    +
    + +
    + +
  • + 导出成绩 +
    +
    + + +
    + +
    +
  • +
  • + 你的评阅: + + 不限 + + + + + +
  • +
  • + 作品状态: + + 不限 + + + + + +
  • +
  • + 分班情况: + + 不限 + + + +
  • +
    + 提交时间排序 + | + 最终成绩排序 +

    242 个检索结果(学生:108人)

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    序号姓名学号提交状态提交时间客观题得分主观题教师评分主观题助教评分最终成绩操作
    48李航2015551337按时提交2016-11-24 17:53----91.0 + + 91.0 + + 评阅
    48胡莎莎2015551337延时提交2016-11-24 17:5395--91.0 + + 52.0 + + 评阅
    48李航2015551337未提交2016-11-24 17:53--65.065.0 + + 91.0 + + + 评阅 + + +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    + + diff --git a/app/views/exercise/teacher_send_examination.html b/app/views/exercise/teacher_send_examination.html new file mode 100644 index 000000000..e75a489d8 --- /dev/null +++ b/app/views/exercise/teacher_send_examination.html @@ -0,0 +1,358 @@ + + + + + + + + + + + + + + + + +
    +
    +
    +

    + + 班级首页 > 试卷 +

    +
    +

    新建试卷

    + 返回 +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    单选题
    +
    多选题
    +
    填空题
    +
    简答题
    +
    + + +
    +
    +

    单选题

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

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

    +
  • +
    + + +
    +
    +

    多选题

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

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

    +
  • +
    + + +
    +

    填空题

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

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

    +
  • +
    + +
    +

    简答题

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

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

    +
  • +
    + +
    +

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

    + + 合计 10 题,共 100  + +
    +
    +
    +
    + + + diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 78c46541f..a3bdfbb10 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -94,9 +94,10 @@
    - + + ×
    - +

    <%= render :partial => 'course_file_filter_order', :locals => {:remote => @is_remote, :sort => @sort, :order => @order} %> diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb index c1836895b..67c6a458d 100644 --- a/app/views/files/_course_list.html.erb +++ b/app/views/files/_course_list.html.erb @@ -1,3 +1,10 @@ + <% if curse_attachments.count != 0 %> <% curse_attachments.each do |file| %> <% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %> @@ -8,10 +15,15 @@

    <%= file.filename %>是私有资源
    <% end %> <% end %> +
    +
    + +
    +
    +
    - <% else %>
    <%= render :partial => "welcome/no_data" %> diff --git a/app/views/forums/_file_form.html.erb b/app/views/forums/_file_form.html.erb index cbb53c2cc..b8b0f5ff7 100644 --- a/app/views/forums/_file_form.html.erb +++ b/app/views/forums/_file_form.html.erb @@ -3,7 +3,7 @@ input.is_public_checkbox{margin-left:4px;margin-right:4px;}
    - + <% if defined?(container) && container && container.saved_attachments %> <% container.attachments.each_with_index do |attachment, i| %> @@ -47,7 +47,14 @@ <%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %> <%#= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'AnnexBtn fl mt3' %> - <%= button_tag "上传附件", :id => "upload_attachments", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %> + <%#= button_tag "上传附件", :id => "upload_attachments", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %> + + + + + 上传附件 + + <%= file_field_tag 'attachments[dummy][file]', :id => '_file', diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index 5b9f374f8..d583728d1 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -1,3 +1,87 @@ +
    +

    + + <%= @user.show_name %> > 讨论 +

    +
    +
    + +
      +
    • <%= @memos_praise_count %>
      被赞
    • +
    • <%= @my_memos_count %>
      回复/评论
    • +
    • <%= @my_forums_count %>
      主题
    • +
    +
    +
    +
    +
    +

    问吧

    + + 新话题 +
    +
    + <% @memos.each_with_index do |memo, index| %> +
    + + <%= image_tag(url_to_avatar(memo.author), :width => 50, :height => 50,:alt=>'用户头像', :class=>"bor-radius-all mt3" ) %> + +
    + <%= User.find(memo.author_id).try(:show_name) %> +

    + + <%= memo.subject %> + <% if memo.sticky %> + + <% end %> + +

    +

    <%= memo.content %>

    +

    + <%= memo.viewed_count %> + <%= get_praise_num(memo) %> + <%= Memo.where(:root_id => memo.id).count %> + + 最后更新:<%= time_from_now memo.updated_at %> +

    + <% if @user.admin? || @user == memo.author %> +
    + + +
    + <% end %> +
    +
    + <% end %> +
    +
    +
    +
      + <%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %> +
    +
    +
    +
    +
    +
    + +<% if false %> <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> <% end %> @@ -107,34 +191,34 @@ }); var first_click = true; -// function check_and_submit(){ -// if(!check_memo_name()){ -// return; -// } -// if($("textarea[name='memo[subject]']").val().trim() != "" && !memo_content.isEmpty() && first_click){ -// first_click = false; -// memo_content.sync(); -// $.ajax({ -// url:'/forums/'+'<%#= @forum.id.to_s%>'+'/memos', -// type:'post', -// data:$("#new_memo").serialize(), -// success:function(data){ -// -// }, -// error:function(){ -// alert('请检查当前网络连接') -// } -// }); -// //$("#new_memo").submit(); -// }else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.isEmpty()){ -// $("#error").html("主题和内容不能为空").show(); -// } -// else if($("textarea[name='memo[subject]']").val().trim() == "" && !memo_content.isEmpty() ){ -// $("#error").html("主题不能为空").show(); -// }else if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.isEmpty()){ -// $("#error").html("内容不能为空").show(); -// } -// } + // function check_and_submit(){ + // if(!check_memo_name()){ + // return; + // } + // if($("textarea[name='memo[subject]']").val().trim() != "" && !memo_content.isEmpty() && first_click){ + // first_click = false; + // memo_content.sync(); + // $.ajax({ + // url:'/forums/'+'<%#= @forum.id.to_s%>'+'/memos', + // type:'post', + // data:$("#new_memo").serialize(), + // success:function(data){ + // + // }, + // error:function(){ + // alert('请检查当前网络连接') + // } + // }); + // //$("#new_memo").submit(); + // }else if($("textarea[name='memo[subject]']").val().trim() == "" && memo_content.isEmpty()){ + // $("#error").html("主题和内容不能为空").show(); + // } + // else if($("textarea[name='memo[subject]']").val().trim() == "" && !memo_content.isEmpty() ){ + // $("#error").html("主题不能为空").show(); + // }else if($("textarea[name='memo[subject]']").val().trim() != "" && memo_content.isEmpty()){ + // $("#error").html("内容不能为空").show(); + // } + // } function check_memo_name(){ if($("#memo_subject").val().trim().length > 50){ @@ -156,4 +240,5 @@ memo_content.html('') $('#error').html('').hide(); } - \ No newline at end of file + +<% end %> diff --git a/app/views/games/_choice_question.html.erb b/app/views/games/_choice_question.html.erb index 8330ad846..0cddf1cf0 100644 --- a/app/views/games/_choice_question.html.erb +++ b/app/views/games/_choice_question.html.erb @@ -13,6 +13,7 @@
    <% @game_challenge.challenge_chooses.each_with_index do |choose, index| %> + <% output = @game.outputs.where(:test_set_position => choose.position).first %>

    <%= (index + 1).to_s + "." + (choose.category == 1 ? "单选题" : "多选题") %>

    @@ -22,16 +23,16 @@

    <% if choose.category == 1 %> - name="answer[<%= index + 1 %>]" category="<%= choose.category %>" value="<%= (question.position + 65).chr %>" id="result_<%= index %>_<%= i %>" class="ml-3 mr5 magic-radio ml5"> + name="answer[<%= index + 1 %>]" category="<%= choose.category %>" value="<%= (question.position + 65).chr %>" id="result_<%= index %>_<%= i %>" class="ml-3 mr5 magic-radio ml5"> <% else %> - name="answer[]" category="<%= choose.category %>" value="<%= (question.position + 65).chr %>" id="result_<%= index %>_<%= i %>" class="ml-3 mr5 magic-checkbox ml5"> + name="answer[]" category="<%= choose.category %>" value="<%= (question.position + 65).chr %>" id="result_<%= index %>_<%= i %>" class="ml-3 mr5 magic-checkbox ml5"> <% end %> - +

    <% end %> - +
    <% end %> + ×
    diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index e7fca0de0..9e77b7116 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -8,6 +8,9 @@ <%= link_to("题库选用", user_import_homeworks_user_path(User.current.id, :select_course => @course.id, :homework_type =>@homework_type), :class => "white-btn orange-btn fr mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") %> <% else %> <%= link_to '选用实训', shixuns_homework_common_index_path(:course => @course.id), :remote => true, :class => "white-btn orange-btn fr mr20", :title => "新建作业" %> + <% if User.current.admin? %> + <%= link_to("实训统计", shixun_statistics_course_path(@course, :format => "xls"), :class => "white-btn orange-btn fr mr10",:title=>"实训作业统计") %> + <% end %> <% end %> <% end %> diff --git a/app/views/layouts/_course_base_info.html.erb b/app/views/layouts/_course_base_info.html.erb index a275be916..893fb84cf 100644 --- a/app/views/layouts/_course_base_info.html.erb +++ b/app/views/layouts/_course_base_info.html.erb @@ -74,11 +74,11 @@ <% is_TE = get_user_member_roles_course @course, User.current, 9 %> <% is_ST = get_user_member_roles_course @course, User.current, 10 %> <% if !is_teacher && (is_TE || is_AD) %> - <%= link_to '切换为教师', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => (is_TE ? 9 : 3)), :class => "white-btn orange-btn font-14 fr", :title => "由学生身份切换至教师身份" %> +
    <%= link_to '切换为教师', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => (is_TE ? 9 : 3)), :class => "white-btn orange-btn font-14 " %>
    <% elsif !is_teacher && is_TA %> - <%= link_to '切换为助教', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => 7), :class => "white-btn orange-btn font-14 fr", :title => "由学生身份切换至助教身份" %> +
    <%= link_to '切换为助教', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => 10, :tar_role => 7), :class => "white-btn orange-btn font-14 " %>
    <% elsif is_teacher && is_ST %> - <%= link_to '切换为学生', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => (is_TA ? 7 : (is_TE ? 9 : 3)), :tar_role => 10), :class => "white-btn orange-btn font-14 fr", :title => "由教师身份切换至学生身份" %> +
    <%= link_to '切换为学生', switch_role_course_path(@course, :user_id => User.current.id, :curr_role => (is_TA ? 7 : (is_TE ? 9 : 3)), :tar_role => 10), :class => "white-btn orange-btn font-14 " %>
    <% end %> <% unless (is_teacher || is_TA || is_TE || is_ST) %> diff --git a/app/views/layouts/_group_children_list.html.erb b/app/views/layouts/_group_children_list.html.erb index 486e0aa76..417226ba8 100644 --- a/app/views/layouts/_group_children_list.html.erb +++ b/app/views/layouts/_group_children_list.html.erb @@ -13,9 +13,19 @@ <% @course.course_groups.each do |group| %>
  • <% count = group.members.count %> - <%=group.name %> - <%= count %> + <%=group.name %> + <%= count %>
  • <% end %> -<% end %> \ No newline at end of file +<% end %> + + diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 73acfb0e7..2085a3c5d 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -18,6 +18,7 @@
  • <%= link_to "全部实训", shixuns_path, :class => "new-nav-a font-16" %>
  • <%= link_to "实训路径", subjects_path, :class => "new-nav-a font-16" %>
  • <%= link_to "在线课堂", courses_path, :class => "new-nav-a font-16" %>
  • +
  • <%= link_to "讨论", forums_path, :class => "new-nav-a font-16" %>
  • diff --git a/app/views/layouts/base_shixun.html.erb b/app/views/layouts/base_shixun.html.erb index 8c9fa67de..345153daf 100644 --- a/app/views/layouts/base_shixun.html.erb +++ b/app/views/layouts/base_shixun.html.erb @@ -39,7 +39,9 @@ <% end %>
  • ">合作者
  • -
  • ">学员统计
  • + <% if @shixun.shixun_status == "已发布" %> +
  • ">学员统计
  • + <% end %> <% if User.current.manager_of_shixun?(@shixun) %>
  • ">配置
  • <% end %> diff --git a/app/views/memos/_common_reply_box.html.erb b/app/views/memos/_common_reply_box.html.erb new file mode 100644 index 000000000..def25d106 --- /dev/null +++ b/app/views/memos/_common_reply_box.html.erb @@ -0,0 +1,113 @@ +
    +

    全部回复(<%= count %>)

    +

    + 回复 + + + + <%= render :partial => 'praise_tread/activity_praise', :locals => {:activity => memo, :user_activity_id => memo.id, :type => "Memo"} %> + +

    +
    +
    + <% no_children_comments.each do |comment| %> + <% unless comment.nil? %> + +
    +
    + <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 50, :height => 50, :alt => "用户头像"), user_url_in_org(comment.creator_user), :target => '_blank' %> +
    +
    +
    +
    + <% if !comment.parent.nil? && !comment.parent.parent.nil? %> + <% parents_rely = [] %> + <% parents_rely = get_reply_parents_no_root parents_rely, comment %> + <% length = parents_rely.length %> +
    + <% if length <= 5 %> + <%#=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent, :type => memo.class.to_s, :user_activity_id => memo.id, :parent_id => comment.id} %> + <%=render :partial => 'messages/message_reply', :locals => {:comment => comment.parent, :parent_id => comment.id, :user_activity_id => memo.id, :type => memo.class.to_s} %> + <% else %> +
    +
    +
    +
    +
    + <%=render :partial => 'student_work/homework_reply_detail', :locals => {:comment => parents_rely[length - 1], :type => memo.class.to_s, :user_activity_id => memo.id, :parent_id => comment.id} %> +
    +
    + + <%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class, :user_activity_id => memo.id, :parent_id => comment.id),:remote=>true, :class => '' %> +
    + <%=render :partial => 'student_work/homework_reply_detail', :locals => {:comment => parents_rely[3], :type => memo.class.to_s, :user_activity_id => memo.id, :parent_id => comment.id} %> +
    + <%=render :partial => 'student_work/homework_reply_detail', :locals => {:comment => parents_rely[2], :type => memo.class.to_s, :user_activity_id => memo.id, :parent_id => comment.id} %> +
    + <%=render :partial => 'student_work/homework_reply_detail', :locals => {:comment => parents_rely[1], :type => memo.class.to_s, :user_activity_id => memo.id, :parent_id => comment.id} %> +
    + <%=render :partial => 'student_work/homework_reply_detail', :locals => {:comment => parents_rely[0], :type => memo.class.to_s, :user_activity_id => memo.id, :parent_id => comment.id} %> +
    + <% end %> +
    + <% end %> + +
    +
    <%= comment.content_detail.html_safe %>
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    + <%= link_to comment.creator_user.show_real_name, user_url_in_org(comment.creator_user), :class => "content-username hide fl" %> + <%= time_from_now(comment.created_at) %> +
    +

    + <% if comment.creator_user == User.current %> + 删除 + <% end %> + | + <%= link_to( + '回复'.html_safe, + {:controller => 'users' ,:action => 'reply_to',:reply_id => comment.id, :type => memo.class.to_s, :user_activity_id => memo.id}, + :remote => true, + :method => 'get', + :title => l(:button_reply),:class => "color-grey") %> + | + + <%=render :partial=> "praise_tread/edu_praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + +

    +
    +
    +
    +
    + <% end %> + <% end %> +
    + \ No newline at end of file diff --git a/app/views/memos/_form.html.erb b/app/views/memos/_form.html.erb index 57caae6fe..5ce666b75 100644 --- a/app/views/memos/_form.html.erb +++ b/app/views/memos/_form.html.erb @@ -1,6 +1,98 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> <% end %> +
      + +
    • + + +

      标题不能超过60个字符

      +
    • + <% if User.current.admin? %> +
    • + + + value="1" id="to_top" class="ml-3 mr5 magic-checkbox"> + + +
    • + <% end %> +
    • + + <%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %> + + <%= f.kindeditor :content, :editor_id => 'memo_content_editor', + :owner_id => @memo.nil? ? 0: @memo.id, + :owner_type => OwnerTypeHelper::MESSAGE, + :width => '89.8%', + :height => 300, + :minHeight=>300, + :class => 'talk_text fl', + :input_html => { :id => 'memo_content', + :class => 'talk_text fl', + :maxlength => 5000 } + %> + +

      内容不能为空

      +
    • +
    • + <%= render :partial => 'forums/file_form', :locals => {:container => @memo} %> +
    • +
    • + 保存 + 取消 +
    • +
    + + + + +<% if false %> +<%= content_for(:header_tags) do %> + <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> +<% end %>
    @@ -118,4 +210,5 @@ $("#memo_classify_tips").attr('style','color: #F00;'); } } - \ No newline at end of file + +<% end %> \ No newline at end of file diff --git a/app/views/memos/_memo_all_replies.html.erb b/app/views/memos/_memo_all_replies.html.erb index 3e5e69938..3b9a6ffe1 100644 --- a/app/views/memos/_memo_all_replies.html.erb +++ b/app/views/memos/_memo_all_replies.html.erb @@ -1,40 +1,77 @@ -<% @replies.each do |reply| %> - + $(".homepagePostReplyDes").mouseover(function(){ + $(this).find("a[id*='delete_memo_reply']").show(); + }).mouseout(function(){ + $(this).find("a[id*='delete_memo_reply']").hide(); + }); + -
    -
    - <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> -
    -
    -
    - <%= render :partial => 'users/message_contents', :locals => {:comment => reply, :type => 'Memo', :user_activity_id => @memo.id}%> -
    -
    -

    <%= reply.content.gsub(/\/script/, "script").gsub(/script/, " script").html_safe %>

    -
    -
    -
    +
    +
    + <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> +
    +
    +
    + <%= render :partial => 'users/message_contents', :locals => {:comment => reply, :type => 'Memo', :user_activity_id => @memo.id}%> +
    +
    +

    <%= reply.content.gsub(/\/script/, "script").gsub(/script/, " script").html_safe %>

    +
    +
    +
    <%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %> @@ -58,20 +95,21 @@ :title => l(:button_delete) ) if @memo.author.id == User.current.id || User.current.admin? || User.current == @forum.creator %> -
    +
    +
    +
    +
    +
    +
    +
    + <% end %> + <% if @limit_count > @page * @limit + 10 %> +
    +
    + + + <%= link_to '点击展开更多回复', forum_memo_path(@memo.forum_id, @memo, :page => @page),:remote=>true %>
    -
    -
    -
    -
    -<% end %> -<% if @limit_count > @page * @limit + 10 %> -
    -
    - - - <%= link_to '点击展开更多回复', forum_memo_path(@memo.forum_id, @memo, :page => @page),:remote=>true %> -
    -
    + <% end %> <% end %> \ No newline at end of file diff --git a/app/views/memos/create.js.erb b/app/views/memos/create.js.erb index 410c82d79..d6405143a 100644 --- a/app/views/memos/create.js.erb +++ b/app/views/memos/create.js.erb @@ -1 +1 @@ -window.location.href='<%= forum_memo_path(:forum_id=>@memo.forum_id,:id=>@memo.id ) %>' \ No newline at end of file +window.location.href='<%= forum_memo_path(:forum_id => @memo.forum_id, :id => @memo.id ) %>'; \ No newline at end of file diff --git a/app/views/memos/destroy.js.erb b/app/views/memos/destroy.js.erb new file mode 100644 index 000000000..29a97f44b --- /dev/null +++ b/app/views/memos/destroy.js.erb @@ -0,0 +1,2 @@ +$("#message_replies_box").html("<%= escape_javascript(render :partial => 'memos/memo_all_replies') %>"); +sd_create_editor_from_data(<%= @memo.id %>,"","100%", "<%= @memo.class.to_s %>"); \ No newline at end of file diff --git a/app/views/memos/edit.html.erb b/app/views/memos/edit.html.erb index ed705579b..2799abec4 100644 --- a/app/views/memos/edit.html.erb +++ b/app/views/memos/edit.html.erb @@ -1,60 +1,15 @@ -<%= content_for(:header_tags) do %> - <%= import_ke(enable_at: false, prettify: false, init_activity: false) %> - <%= javascript_include_tag 'new_user' %> -<% end %> - - - - - -<%= labelled_form_for(@memo, :url => forum_memo_path(@memo.forum_id, @memo),:html=>{:id => 'new_memo'}) do |f| %> - <%= render :partial => "memos/form", :locals => {:f => f} %> -<% end %> - -
    - <%= render :partial => "memos/my_show_count_message" %> -
    - - \ No newline at end of file +
    +

    + + <%= @user.show_name %> > 讨论 > 编辑 +

    +
    +

    编辑话题

    +
    +
    + <%#= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %> + <%= form_for @memo, :url => forum_memo_path(@memo.forum_id, @memo), :html => {:multipart => true, :id => 'memo-form'} do |f| %> + <%= render :partial => "memos/form", :locals => {:f => f} %> + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/memos/message_replies.js.erb b/app/views/memos/message_replies.js.erb new file mode 100644 index 000000000..a4683ca59 --- /dev/null +++ b/app/views/memos/message_replies.js.erb @@ -0,0 +1,9 @@ +<%# if @user_activity_id != @memo.id %> +/* $("#activity_post_reply_<%#= @user_activity_id %>").html("<%#= escape_javascript(render :partial => 'users/course_message_post_reply', + :locals => { :activity => @memo, + :user_activity_id => @user_activity_id}) %>"); + sd_create_editor_from_data(<%#= @user_activity_id%>,"","100%", "UserActivity");*/ +<%# else %> + $("#message_replies_box").html("<%= escape_javascript(render :partial => 'memos/memo_all_replies') %>"); + sd_create_editor_from_data(<%= @memo.id %>,"","100%", "<%= @memo.class.to_s %>"); +<%# end %> \ No newline at end of file diff --git a/app/views/memos/new.html.erb b/app/views/memos/new.html.erb index 1d14935ca..be251e67f 100644 --- a/app/views/memos/new.html.erb +++ b/app/views/memos/new.html.erb @@ -1,6 +1,29 @@ - -<%= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %> - <%= render :partial => "memos/form", :locals => {:f => f} %> -<% end %> +
    +

    + + <%= @user.show_name %> > 讨论 > 新建 +

    +
    +

    新建话题

    +
    +
    + <%#= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %> + <%= form_for @memo, :url => forum_memos_path(@forum), :html => {:multipart => true, :id => 'memo-form'} do |f| %> + <%= render :partial => "memos/form", :locals => {:f => f} %> + <% end %> +
    +
    -<%= render :partial => "forums/my_count_message" %> \ No newline at end of file + + + + +<% if false %> + + <%= labelled_form_for(@memo, :url => forum_memos_path(@forum)) do |f| %> + <%= render :partial => "memos/form", :locals => {:f => f} %> + <% end %> +<%#= render :partial => "forums/my_count_message" %> +<% end %> \ No newline at end of file diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index c5cf514a3..afa9a1eff 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -1,131 +1,224 @@ <%= content_for(:header_tags) do %> <%= import_ke(enable_at: false, prettify: false, init_activity: true) %> - <%= javascript_include_tag 'forum' %> <% end %> - -