diff --git a/Gemfile b/Gemfile index 660a7ff49..2b43cade3 100644 --- a/Gemfile +++ b/Gemfile @@ -26,6 +26,7 @@ gem 'spreadsheet' gem 'ruby-ole' gem 'rails_kindeditor',path:'lib/rails_kindeditor' #gem "rmagick", ">= 2.0.0" +gem 'binding_of_caller' group :development do gem 'grape-swagger' diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 57c1a8587..076e0b1c7 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -3,6 +3,9 @@ module Mobile module Apis class Courses < Grape::API resource :courses do + def self.get_service + CoursesService.new + end desc "获取所有课程" params do optional :school_id, type: Integer, desc: '传入学校id,返回该学校课程列表' @@ -337,9 +340,56 @@ module Mobile get ':course_id/student_works_list' do cs = CoursesService.new student_works = cs.student_work_list params,current_user - present :data,student_works.all,with:Mobile::Entities::StudentWork + present :data,student_works,with:Mobile::Entities::StudentWork + present :status,0 end + desc '讨论区信息' + params do + requires :token,type:String + requires :course_id,type:Integer,desc:'课程id' + optional :page,type:Integer,desc:'页码' + end + get ':course_id/board_message_list' do + cs = CoursesService.new + board_messages_list = cs.board_message_list params,current_user + present :data,board_messages_list.all,with:Mobile::Entities::Message + present :status,0 + end + + desc '讨论区某主题的回复列表' + params do + requires :token,type:String + requires :board_id,type:Integer,desc:'讨论区id' + requires :msg_id,type:Integer,desc:'讨论主题id' + optional :page,type:Integer,desc:'页码' + end + get ':board_id/board_message_reply_list' do + cs = Courses.get_service + board_messages_list = cs.board_message_reply_list params,current_user + present :data,board_messages_list.all,with:Mobile::Entities::Message + present :status,0 + end + + desc '讨论区回复' + params do + requires :token,type:String + requires :board_id,type:Integer,desc:'讨论区id' + requires :parent_id,type:Integer,desc:'本回复父id' + requires :subject,type:String,desc:'本回复主题' + requires :content,type:String,desc:'本回复内容' + requires :root_id,type:Integer,desc:'本回复根id' + requires :quote,type:String,desc:'本回复引用内容' + end + post ':board_id/board_message_reply' do + cs = Courses.get_service + board_messages = cs.board_message_reply params,current_user + present :data,board_messages,with:Mobile::Entities::Message + present :status,0 + end + + + end end diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index c0685ea0a..8b37ca8e4 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -1,6 +1,8 @@ class HomeworkCommonController < ApplicationController + require 'net/http' + require 'json' layout "base_courses" - before_filter :find_course, :only => [:index,:new,:create] + before_filter :find_course, :only => [:index,:new,:create,:next_step] before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy] before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment] before_filter :member_of_course, :only => [:index] @@ -16,20 +18,37 @@ class HomeworkCommonController < ApplicationController end def new + respond_to do |format| + format.html + end + end + + #新建作业下一步 + def next_step + @homework_type = params[:homework_common_type] + @homework = HomeworkCommon.new @homework.safe_attributes = params[:homework_common] @homework.late_penalty = 0 @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') @homework.publish_time = Time.now.strftime('%Y-%m-%d') - #匿评作业相关属性 - @homework_detail_manual = HomeworkDetailManual.new - @homework_detail_manual.ta_proportion = 0.6 - @homework_detail_manual.absence_penalty = 0 - @homework_detail_manual.evaluation_num = 3 - @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') - @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') - @homework.homework_detail_manual = @homework_detail_manual + if @homework_type == "1" + #匿评作业相关属性 + @homework_detail_manual = HomeworkDetailManual.new + @homework_detail_manual.ta_proportion = 0.6 + @homework_detail_manual.absence_penalty = 0 + @homework_detail_manual.evaluation_num = 3 + @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') + @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + @homework.homework_detail_manual = @homework_detail_manual + elsif @homework_type == "2" + #编程作业相关属性 + @homework_detail_programing = HomeworkDetailPrograming.new + @homework.homework_detail_programing = @homework_detail_programing + end + + respond_to do |format| format.html end @@ -50,15 +69,57 @@ class HomeworkCommonController < ApplicationController homework.save_attachments(params[:attachments]) render_attachment_warning_if_needed(homework) - #匿评作业相关属性 - homework_detail_manual = HomeworkDetailManual.new - homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 - homework_detail_manual.comment_status = 1 - homework_detail_manual.evaluation_start = params[:evaluation_start] - homework_detail_manual.evaluation_end = params[:evaluation_end] - homework_detail_manual.evaluation_num = params[:evaluation_num] - homework_detail_manual.absence_penalty = params[:absence_penalty] - homework.homework_detail_manual = homework_detail_manual + if homework.homework_type == 2 + homework_detail_programing = HomeworkDetailPrograming.new + homework_detail_programing.language = "C++" + homework_detail_programing.standard_code = params[:standard_code] + + question = {title:homework.name,content:homework.description} + question[:input] = [] + question[:output] = [] + if params[:input] && params[:output] + params[:input].each do |k,v| + if params[:output].include? k + homework_test = HomeworkTest.new + homework_test.input = v + homework_test.output = params[:output][k] + homework.homework_tests << homework_test + question[:input] << homework_test.input + question[:output] << homework_test.output + end + end + end + + # uri = URI('http://test.gitlab.trustie.net/api/questions.json') + # req = Net::HTTP::Post.new(uri, initheader = {'Content-Type' =>'application/json'}) + # req.body = question.to_json + # res = Net::HTTP.start(uri.hostname, uri.port) do |http| + # http.request(req) + # end + + uri = URI('http://192.168.80.21:8080/api/questions.json') + body = question.to_json + res = Net::HTTP.new(uri.host, uri.port).start do |client| + request = Net::HTTP::Post.new(uri.path) + request.body = body + request["Content-Type"] = "application/json" + client.request(request) + end + result = JSON.parse(res.body) + homework_detail_programing.question_id = result["id"] if result["status"] && result["status"] == 0 + + homework.homework_detail_programing = homework_detail_programing + else + #匿评作业相关属性 + homework_detail_manual = HomeworkDetailManual.new + homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 + homework_detail_manual.comment_status = 1 + homework_detail_manual.evaluation_start = params[:evaluation_start] + homework_detail_manual.evaluation_end = params[:evaluation_end] + homework_detail_manual.evaluation_num = params[:evaluation_num] + homework_detail_manual.absence_penalty = params[:absence_penalty] + homework.homework_detail_manual = homework_detail_manual + end if homework.save respond_to do |format| @@ -98,10 +159,10 @@ class HomeworkCommonController < ApplicationController end @homework.late_penalty = params[:late_penalty] end - @homework.course_id = @course.id + # @homework.course_id = @course.id #匿评作业相关属性 - if @homework.homework_type == 1 + if @homework.homework_type == 1 && @homework_detail_manual @homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6 @homework_detail_manual.evaluation_start = params[:evaluation_start] @homework_detail_manual.evaluation_end = params[:evaluation_end] @@ -117,18 +178,49 @@ class HomeworkCommonController < ApplicationController end @homework_detail_manual.absence_penalty = params[:absence_penalty] end - else #不是匿评作业,缺评扣分为0分,每个作品的缺评扣分改为0分,防止某些作业在结束匿评之后改为普通作业 + elsif @homework.homework_type == 0 #普通作业,缺评扣分为0分,每个作品的缺评扣分改为0分,防止某些作业在结束匿评之后改为普通作业 @homework.student_works.where("absence_penalty != 0").each do |student_work| student_work.late_penalty = 0 student_work.save end - @homework_detail_manual.absence_penalty = 0 + @homework_detail_manual.absence_penalty = 0 if @homework_detail_manual + end + + if @homework.homework_type == 2 && @homework_detail_programing #编程作业 + @homework_detail_programing.language = "C++" + @homework_detail_programing.standard_code = params[:standard_code] + homework_tests = @homework.homework_tests + #需要删除的测试 + ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i) + ids.each do |id| + homework_test = HomeworkTest.find id + homework_test.destroy if homework_test + end + if params[:input] && params[:output] + params[:input].each do |k,v| + if params[:output].include? k + homework_test = HomeworkTest.find_by_id k + if homework_test #已存在的测试,修改 + homework_test.input = v + homework_test.output = params[:output][k] + else #不存在的测试,增加 + homework_test = HomeworkTest.new + homework_test.input = v + homework_test.output = params[:output][k] + homework_test.homework_common = @homework + end + homework_test.save + end + end + end end @homework.save_attachments(params[:attachments]) render_attachment_warning_if_needed(@homework) - if @homework.save && @homework_detail_manual.save + if @homework.save + @homework_detail_manual.save if @homework_detail_manual + @homework_detail_programing.save if @homework_detail_programing respond_to do |format| format.html { flash[:notice] = l(:notice_successful_edit) @@ -227,6 +319,7 @@ class HomeworkCommonController < ApplicationController def find_homework @homework = HomeworkCommon.find params[:id] @homework_detail_manual = @homework.homework_detail_manual + @homework_detail_programing = @homework.homework_detail_programing @course = @homework.course rescue render_404 diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 69d8bc3a6..a89ae846e 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -25,6 +25,7 @@ class MyController < ApplicationController helper :issues helper :users helper :custom_fields + helper :user_score BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues, 'issuesreportedbyme' => :label_reported_issues, @@ -88,6 +89,23 @@ class MyController < ApplicationController end end + def clear_user_avatar_temp + @user = User.current + diskfile = disk_filename('User', @user.id) + diskfile1 = diskfile + 'temp' + File.delete(diskfile1) if File.exist?(diskfile1) + end + def save_user_avatar + @user = User.current + diskfile = disk_filename('User', @user.id) + diskfile1 = diskfile + 'temp' + begin + FileUtils.mv diskfile1, diskfile, force: true if File.exist? diskfile1 + ensure + File.delete(diskfile1) if File.exist?(diskfile1) + end + end + # Edit user's account def account @user = User.current @@ -119,6 +137,8 @@ class MyController < ApplicationController @se.identity = params[:identity].to_i if params[:identity] @se.technical_title = params[:technical_title] if params[:technical_title] @se.student_id = params[:no] if params[:no] + @se.brief_introduction = params[:brief_introduction] + @se.description = params[:description] if @user.save && @se.save # 头像保存 @@ -137,6 +157,7 @@ class MyController < ApplicationController File.delete(diskfile1) if File.exist?(diskfile1) end + render :layout=>'base_users_new' end # Destroys user's account @@ -159,6 +180,7 @@ class MyController < ApplicationController # Manage user's password def password + @act='password' @user = User.current unless @user.change_password_allowed? flash.now[:error] = l(:notice_can_t_change_password) @@ -178,12 +200,14 @@ class MyController < ApplicationController flash.now[:error] = l(:notice_account_wrong_password) end end + #render :template => 'my/account',:layout=>'base_users_new' rescue Exception => e if e.message == 'wrong password' flash.now[:error] = l(:notice_account_wrong_password) else flash.now[:error] = e.message end + render :template => 'my/account',:layout=>'base_users_new' end # Create a new feeds key diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index d8a9d88c3..758747e02 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -23,7 +23,7 @@ class PollController < ApplicationController def show @poll = Poll.find params[:id] - if @poll.polls_status != 2 && !User.current.allowed_to?(:as_teacher,@course) + if @poll.polls_status != 2 && (!User.current.allowed_to?(:as_teacher,@course) || User.current.admin?) render_403 return end @@ -393,7 +393,7 @@ class PollController < ApplicationController end def is_member_of_course - render_403 unless(@course && User.current.member_of_course?(@course)) + render_403 unless(@course && (User.current.member_of_course?(@course) || User.current.admin?)) end def is_course_teacher diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index cc858cc19..20cdc6659 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -2,47 +2,87 @@ class StudentWorkController < ApplicationController layout "base_courses" include StudentWorkHelper require 'bigdecimal' + require "base64" before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list] before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work] before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work] before_filter :author_of_work, :only => [:edit, :update, :destroy] before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list] + protect_from_forgery :except => :set_program_score def index - @order,@b_sort,@name = params[:order] || "score",params[:sort] || "desc",params[:name] || "" + @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group] @is_teacher = User.current.allowed_to?(:as_teacher,@course) - #老师 || 非匿评作业 || 匿评结束 显示所有的作品 - @show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 || User.current.admin? - if @show_all - if @homework.homework_type == 1 || @is_teacher || User.current.admin? #超级管理员 || 老师 || 匿评结束 显示所有的作品 - if @order == "name" - @stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name - else - @stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name - end - else #剩余情况: 学生 && 非匿评作业 如果未提交作品,只能看到自己的,提交了作品,能看到所有作品 - my_work = @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) - if my_work.empty? - @stundet_works = [] - else + unless @group == "0" || @group.nil? + group_students = CourseGroup.find_by_id(@group).users + if group_students.empty? + student_in_group = '(0)' + else + student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')' + end + #老师 || 非匿评作业 || 匿评结束 显示所有的作品 + @show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 || User.current.admin? + if @show_all + if @homework.homework_type == 1 || @is_teacher || User.current.admin? #超级管理员 || 老师 || 匿评结束 显示所有的作品 if @order == "name" - @stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name + @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name else - @stundet_works = search_homework_member @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name + @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name + end + else #剩余情况: 学生 && 非匿评作业 如果未提交作品,只能看到自己的,提交了作品,能看到所有作品 + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + if my_work.empty? + @stundet_works = [] + else + if @order == "name" + @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name + else + @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name + end end end + else #学生 + if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品 + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品 + @is_evaluation = true + my_work = @homework.student_works.where(:user_id => User.current.id) + @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} + end end - else #学生 - if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品 - @stundet_works = @homework.student_works.select("*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) - elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品 - @is_evaluation = true - my_work = @homework.student_works.where(:user_id => User.current.id) - @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} + else + #老师 || 非匿评作业 || 匿评结束 显示所有的作品 + @show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 || User.current.admin? + if @show_all + if @homework.homework_type == 1 || @is_teacher || User.current.admin? #超级管理员 || 老师 || 匿评结束 显示所有的作品 + if @order == "name" + @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name + else + @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name + end + else #剩余情况: 学生 && 非匿评作业 如果未提交作品,只能看到自己的,提交了作品,能看到所有作品 + my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + if my_work.empty? + @stundet_works = [] + else + if @order == "name" + @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name + else + @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name + end + end + end + else #学生 + if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品 + @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) + elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品 + @is_evaluation = true + my_work = @homework.student_works.where(:user_id => User.current.id) + @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} + end end end @homework_commons = @course.homework_commons.order("created_at desc") - @homework_commons = @course.homework_commons.order("created_at desc") @score = @b_sort == "desc" ? "asc" : "desc" respond_to do |format| format.html @@ -80,7 +120,24 @@ class StudentWorkController < ApplicationController stundet_work.late_penalty = 0 end render_attachment_warning_if_needed(stundet_work) + if stundet_work.save + if @homework.homework_type == 2 && @homework.homework_detail_programing #编程作业,学生提交作品后计算系统得分 + url = "http://192.168.80.21:8080/api/questions/#{@homework.homework_detail_programing.question_id}/solutions.json" + solutions = { + student_work_id:stundet_work.id, + src:Base64.encode64(stundet_work.description), + language:1 + } + uri = URI(url) + body = solutions.to_json + res = Net::HTTP.new(uri.host, uri.port).start do |client| + request = Net::HTTP::Post.new(uri.path) + request.body = body + request["Content-Type"] = "application/json" + client.request(request) + end + end respond_to do |format| format.html { flash[:notice] = l(:notice_successful_create) @@ -99,8 +156,12 @@ class StudentWorkController < ApplicationController end def edit - respond_to do |format| - format.html + if @homework.homework_type == 2 #编程作业不能修改作业 + render_403 + else + respond_to do |format| + format.html + end end end @@ -135,7 +196,9 @@ class StudentWorkController < ApplicationController end def destroy - if @work.destroy + if @homework.homework_type == 2 #编程作业,作品提交后不可以删除 + render_403 + elsif @work.destroy respond_to do |format| format.html { redirect_to student_work_index_url(:homework => @homework.id) @@ -154,6 +217,12 @@ class StudentWorkController < ApplicationController if @score @score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" @score.score = params[:score] if params[:score] + if User.current.admin? + @score.reviewer_role = 1 + else + role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name + @score.reviewer_role = get_role_by_name(role) + end @is_new = false else @score = StudentWorksScore.new @@ -161,8 +230,12 @@ class StudentWorkController < ApplicationController @score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" @score.user_id = User.current.id @score.student_work_id = @work.id - role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name - User.current.admin? ? @score.reviewer_role = 1 : @score.reviewer_role = get_role_by_name(role) + if User.current.admin? + @score.reviewer_role = 1 + else + role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name + @score.reviewer_role = get_role_by_name(role) + end @is_new = true end @@ -180,8 +253,10 @@ class StudentWorkController < ApplicationController if @work.student_score.nil? @work.final_score = @work.teaching_asistant_score else - final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}") - final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}")) + ta_proportion = @homework.homework_detail_manual.ta_proportion if @homework.homework_detail_manual + ta_proportion = @homework.homework_detail_programing.ta_proportion if @homework.homework_detail_programing + final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}") + final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) final_score = final_ta_score + final_s_score @work.final_score = format("%.2f",final_score.to_f) end @@ -303,6 +378,45 @@ class StudentWorkController < ApplicationController end end + #设置编程作业得分 + def set_program_score + stundet_work = StudentWork.find_by_id params[:student_work_id] + @course = stundet_work.homework_common.course + student_score_count = 0 + if stundet_work && params[:results] && params[:results].class.to_s == "Array" + homework_common = stundet_work.homework_common + params[:results].each do |result| + homework_test = homework_common.homework_tests.where("input = '#{result[:input]}' AND output = '#{result[:output]}'").first + if homework_test + student_work_test = StudentWorkTest.new + student_work_test.student_work = stundet_work + student_work_test.homework_test = homework_test + student_work_test.result = result[:status] + if student_work_test.result == 0 + student_score_count += 1 + end + student_work_test.save! + end + end + unless homework_common.homework_tests.empty? + stundet_work.student_score = student_score_count * 100.0 / homework_common.homework_tests.count + + if stundet_work.teacher_score.nil? + if stundet_work.teaching_asistant_score.nil? + stundet_work.final_score = stundet_work.student_score + else + final_ta_score = BigDecimal.new("#{stundet_work.teaching_asistant_score}") * BigDecimal.new("#{homework_common.homework_detail_programing.ta_proportion}") + final_s_score = BigDecimal.new("#{stundet_work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{homework_common.homework_detail_programing.ta_proportion}")) + final_score = final_ta_score + final_s_score + stundet_work.final_score = format("%.1f",final_score.to_f) + end + end + + stundet_work.save! + end + end + end + private #获取作业 def find_homework diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0655c323b..d6597f3da 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -26,10 +26,10 @@ class UsersController < ApplicationController menu_item :user_homework, :only => :user_homeworks menu_item :user_project, :only => [:user_projects, :watch_projects] # menu_item :requirement_focus, :only => :watch_bids - menu_item :requirement_focus, :only => :watch_contests + menu_item :requirement_focus, :only => :watch_contests menu_item :user_newfeedback, :only => :user_newfeedback - - + + #Ended by young # edit @@ -39,23 +39,28 @@ class UsersController < ApplicationController before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_contests, :info, :user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, - :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index] + :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index, + :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist] #edit has been deleted by huang, 2013-9-23 - before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, - :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, + before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, + :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, - :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index] + :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index, + :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist] before_filter :auth_user_extension, only: :show #before_filter :rest_user_score, only: :show #before_filter :select_entry, only: :user_projects accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx - + #william before_filter :require_login, :only => [:tag_save,:tag_saveEx] #before_filter :refresh_changests, :only =>[:user_activities,:user_courses,:user_projects,:user_newfeedback] + #visitor + before_filter :recorded_visitor, :only => [:show,:user_fanslist,:user_watchlist,:user_visitorlist] + helper :sort include SortHelper helper :custom_fields @@ -76,6 +81,9 @@ class UsersController < ApplicationController # fq helper :words + helper :project_score + helper :issues + include UsersHelper def refresh_changests if !(@user.nil?) && !(@user.memberships.nil?) @@ -104,34 +112,41 @@ class UsersController < ApplicationController #added by young def user_projects - if User.current.admin? - @memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}") - else - cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" - @memberships = @user.memberships.all(:conditions => cond) - end - @memberships = @memberships.sort {|a,b| b.created_on.to_i <=> a.created_on.to_i} - # unless @memberships.nil? - # @user_projects = [] - # @memberships.each do |membership| - # @user_projects << membership.project - # end - # @user_projects = @user_projects.sort {|a,b| b.created_on.to_i <=> a.created_on.to_i} - # end - #events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20) - #@events_by_day = events.group_by(&:event_date) - @state = 0 - #add by huang + + #add by huang unless User.current.admin? if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?) render_404 - return + return end end - #end - + #end + # if User.current.admin? + # @memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}") + # else + # cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" + # @memberships = @user.memberships.all(:conditions => cond) + # end + #events = Redmine::Activity::Fetcher.new(User.current, :author => @user).events(nil, nil, :limit => 20) + #@events_by_day = events.group_by(&:event_date) + # @state = 0 + + limit = 10; + query = Project.joins("join members m on #{Project.table_name}.id=m.project_id") + query = query.where("m.user_id = ? and #{Project.table_name}.project_type=?",@user.id,Project::ProjectType_project) + if(params[:status] == '1') + query = query.where("#{Project.table_name}.user_id = ?",@user.id); + elsif(params[:status] == '2') + query = query.where("#{Project.table_name}.user_id <> ?",@user.id); + end + @obj_count = query.count(); + + @obj_pages = Paginator.new @obj_count,limit,params['page'] + @list = query.order("#{Project.table_name}.updated_on desc,#{Project.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); + @params = params + respond_to do |format| - format.html + format.html{render :layout=>'base_users_new'} format.api end end @@ -168,21 +183,21 @@ class UsersController < ApplicationController # format.api # end end - + #new add by linchun - def watch_contests - @bids = Contest.watched_by(@user) + def watch_contests + @bids = Contest.watched_by(@user) @offset, @limit = api_offset_and_limit({:limit => 10}) @contest_count = @contests.count @contest_pages = Paginator.new @contest_count, @limit, params['page'] - @offset ||= @contest_pages.reverse_offset + @offset ||= @contest_pages.reverse_offset unless @offset == 0 @contest = @contests.offset(@offset).limit(@limit).all.reverse else limit = @bid_count % @limit @contest = @contests.offset(@offset).limit(limit).all.reverse end - + respond_to do |format| format.html { render :layout => 'base_users' @@ -219,9 +234,9 @@ class UsersController < ApplicationController end end # end - + # added by huang - def user_homeworks + def user_homeworks # @membership = @user.memberships.all(:conditions => Project.visible_condition(User.current)) # @memberships = [] # @membership.each do |membership| @@ -240,46 +255,63 @@ class UsersController < ApplicationController # return # end # end - end - - + end + + include CoursesHelper - def user_courses + def user_courses unless User.current.admin? if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?) render_404 - return + return end end - + #@user.coursememberships.all(:conditions => Course.visible_condition(User.current)) - if User.current == @user || User.current.admin? - membership = @user.coursememberships.all - else - membership = @user.coursememberships.all(:conditions => Course.visible_condition(User.current)) + limit = 10; + query = Course.joins("join members m on #{Course.table_name}.id=m.course_id") + query = query.where("m.user_id = ?",@user.id) + if(params[:status] == '1') + query = query.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now); + elsif(params[:status] == '2') + query = query.where("endup_time < ?",Time.now); end + @obj_count = query.count(); - membership.sort! {|older, newer| newer.created_on <=> older.created_on } - @memberships = [] - membership.collect { |e| @memberships.push(e)} - ## 判断课程是否过期 [需封装] - @memberships_doing = [] - @memberships_done = [] - #now_time = Time.now.year - @memberships.map { |e| - #end_time = e.course.get_time.year - isDone = course_endTime_timeout?(e.course) - if isDone - @memberships_done.push e - else - @memberships_doing.push e - end - } + @obj_pages = Paginator.new @obj_count,limit,params['page'] + @list = query.order("#{Course.table_name}.updated_at desc,#{Course.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); + @params = params + render :layout=>'base_users_new' + + # if User.current == @user || User.current.admin? + # membership = @user.coursememberships.all + # else + # membership = @user.coursememberships.all(:conditions => Course.visible_condition(User.current)) + # end + # + # membership.sort! {|older, newer| newer.created_on <=> older.created_on } + # @memberships = [] + # membership.collect { |e| + # @memberships.push(e) + # } + # ## 判断课程是否过期 [需封装] + # @memberships_doing = [] + # @memberships_done = [] + # #now_time = Time.now.year + # @memberships.map { |e| + # #end_time = e.course.get_time.year + # isDone = course_endTime_timeout?(e.course) + # if isDone + # @memberships_done.push e + # else + # @memberships_doing.push e + # end + # } # respond_to do |format| - # format.html - # format.api + # format.html + # format.api # end end @@ -306,7 +338,7 @@ class UsersController < ApplicationController #end def index - + @status = params[:status] || 1 sort_init 'login', 'asc' sort_update %w(login firstname lastname mail admin created_on last_login_on) @@ -322,7 +354,7 @@ class UsersController < ApplicationController # 先内连一下statuses 保证排序之后数量一致 scope = User.visible. joins("INNER JOIN user_statuses ON users.id = user_statuses.user_id") - + # unknow scope = scope.in_group(params[:group_id]) if params[:group_id].present? @@ -359,7 +391,7 @@ class UsersController < ApplicationController # limit and offset @users = @users.limit(@user_pages.per_page).offset(@user_pages.offset) - + @user_base_tag = params[:id] ? 'base_users':'users_base' respond_to do |format| format.html { @@ -369,7 +401,7 @@ class UsersController < ApplicationController format.api end end - + def search sort_init 'login', 'asc' sort_update %w(login firstname lastname mail admin created_on last_login_on) @@ -413,8 +445,212 @@ class UsersController < ApplicationController format.api end end - + + def user_courses4show + query = Course.joins("join members m on #{Course.table_name}.id=m.course_id") + query = query.where("m.user_id = ?",@user.id) + if User.current == @user #看自己 + else + if @user.user_extensions!=nil && @user.user_extensions.identity == 0 #看老师 + query = query.joins("join member_roles r on m.id = r.member_id") + query = query.where("r.role_id in(3,7,9)") + end + query = query.where(Course.table_name+".is_public = 1") + # or exists (select 1 from courses c2,members m2 where c2.id=m2.course_id and c2.id=#{Course.table_name}.id and m2.user_id= User.current.id) + end + + if params[:lastid]!=nil && !params[:lastid].empty? + query = query.where("( (#{Course.table_name}.updated_at=? and #{Course.table_name}.id < ?) or #{Course.table_name}.updated_atnil + end + def user_projects4show + query = Project.joins("join members m on #{Project.table_name}.id=m.project_id") + query = query.where("m.user_id = ? and #{Project.table_name}.project_type=?",@user.id,Project::ProjectType_project) + if User.current == @user #看自己 + else + query = query.where(Project.table_name+".is_public = 1") + # TODO or exists (select 1 from project c2,members m2 where c2.id=m2.course_id and c2.id=#{Project.table_name}.id and m2.user_id= User.current.id) + end + + if params[:lastid]!=nil && !params[:lastid].empty? + query = query.where("( (#{Project.table_name}.updated_on=? and #{Project.table_name}.id < ?) or #{Project.table_name}.updated_onnil + end + + # def user_course_activities + # @list = [] + # lastid = nil + # if params[:lastid]!=nil && !params[:lastid].empty? + # lastid = params[:lastid]; + # end + # + # user_ids = [] + # if @user == User.current + # watcher = User.watched_by(@user) + # watcher.push(User.current) + # user_ids = watcher.map{|x| x.id} + # else + # user_ids << @user.id + # end + # + # query_rec_count = 8 + # query_times = 10 #query_times次没查到query_rec_count条记录就不查了 + # query_i = 0; + # while( true ) + # query_i = query_i+1 + # if(query_i>query_times) + # break + # end + # query = Activity.where(user_id: user_ids) + # if(lastid != nil) + # query = query.where("id < ?",lastid) + # end + # lastid,item_list = query_activities(query,'course'); + # for item in item_list + # @list << item + # if @list.count() >= query_rec_count + # break + # end + # end + # if @list.count() >= query_rec_count + # break + # end + # if lastid == nil + # break + # end + # end + # render :layout=>nil + # end + # + # def user_project_activities + # @list = [] + # lastid = nil + # if params[:lastid]!=nil && !params[:lastid].empty? + # lastid = params[:lastid]; + # end + # + # user_ids = [] + # if @user == User.current + # watcher = User.watched_by(@user) + # watcher.push(User.current) + # user_ids = watcher.map{|x| x.id} + # else + # user_ids << @user.id + # end + # + # query_rec_count = 8 + # query_times = 10 #query_times次没查到query_rec_count条记录就不查了 + # query_i = 0; + # while( true ) + # query_i = query_i+1 + # if(query_i>query_times) + # break + # end + # query = Activity.where(user_id: user_ids) + # if(lastid != nil) + # query = query.where("id < ?",lastid) + # end + # lastid,item_list = query_activities(query,'project'); + # for item in item_list + # @list << item + # if @list.count() >= query_rec_count + # break + # end + # end + # if @list.count() >= query_rec_count + # break + # end + # if lastid == nil + # break + # end + # end + # render :action=>'user_course_activities',:layout=>nil + # end + def user_course_activities + lastid = nil + if params[:lastid]!=nil && !params[:lastid].empty? + lastid = params[:lastid]; + end + + user_ids = [] + if @user == User.current + watcher = User.watched_by(@user) + watcher.push(User.current) + user_ids = watcher.map{|x| x.id} + else + user_ids << @user.id + end + + query = Activity.joins("join courses c on c.id=#{Activity.table_name}.activity_container_id and #{Activity.table_name}.activity_container_type='Course'") + query = query.where("#{Activity.table_name}.user_id in (?)", user_ids) + if User.current != @user #看别人 + if @user.user_extensions!=nil && @user.user_extensions.identity == 0 #看老师 + query = query.joins("join members m on c.id=m.course_id and m.user_id = #{@user.id}") + query = query.joins("join member_roles r on m.id = r.member_id") + query = query.where("r.role_id in(3,7,9)") + end + query = query.where("c.is_public=1") + end + if(lastid != nil) + query = query.where("#{Activity.table_name}.id < ?",lastid) + end + query = query.order("#{Activity.table_name}.id desc") + @list = query_activities(query) + + render :layout=>nil + end + + def user_project_activities + lastid = nil + if params[:lastid]!=nil && !params[:lastid].empty? + lastid = params[:lastid]; + end + + user_ids = [] + if @user == User.current + watcher = User.watched_by(@user) + watcher.push(User.current) + user_ids = watcher.map{|x| x.id} + else + user_ids << @user.id + end + + query = Activity.joins("join projects c on c.id=#{Activity.table_name}.activity_container_id and #{Activity.table_name}.activity_container_type='Project'") + query = query.where(user_id: user_ids) + if User.current != @user #看别人 + query = query.where("c.is_public=1") + end + if(lastid != nil) + query = query.where("#{Activity.table_name}.id < ?",lastid) + end + query = query.order("#{Activity.table_name}.id desc") + @list = query_activities(query); + + render :action=>'user_course_activities',:layout=>nil + end + + def user_feedback4show + query = @user.journals_for_messages + if params[:lastid]!=nil && !params[:lastid].empty? + query = query.where("#{JournalsForMessage.table_name}.id < ?",params[:lastid]) + end + logger.info('xxoo') + @list = query.order("#{JournalsForMessage.table_name}.id desc").limit(3).all + logger.info('aavv') + render :layout=>nil,:locals => {:feed_list=>@list} + end + def show + render :layout=>'base_users_new' + end + + def show_old pre_count = 10 #limit # Time 2015-02-04 11:46:34 # Author lizanle @@ -430,9 +666,9 @@ class UsersController < ApplicationController end when "2" message = [] - if @user == User.current + if @user == User.current message = JournalsForMessage.reference_message(@user.id) - message += Journal.reference_message(@user.id) + message += Journal.reference_message(@user.id) end @activity_count = message.size @info_pages = Paginator.new @activity_count, pre_count, params['page'] @@ -463,7 +699,7 @@ class UsersController < ApplicationController p_ids = [] Project.where(id: project_ids).each do |x| p_ids << x.id unless x.visible?(User.current) - end + end ids = [] ids << Issue.where(id: act_ids, project_id: p_ids).map{|x| x.id} @@ -482,7 +718,7 @@ class UsersController < ApplicationController p_ids = [] Project.where(id: project_ids).each do |x| p_ids << x.id unless x.visible?(User.current) - end + end ids << Journal.where(id: act_ids, journalized_id: p_ids, journalized_type: 'Project').map{|x| x.id} #News @@ -491,16 +727,16 @@ class UsersController < ApplicationController p_ids = [] Project.where(id: project_ids).each do |x| p_ids << x.id unless x.visible?(User.current) - end + end ids << News.where(id: act_ids, project_id: p_ids).map{|x| x.id} project_ids = News.where(id: act_ids).select('distinct course_id').map{|x| x.course_id} c_ids = [] Course.where(id: project_ids).each do |x| c_ids << x.id unless x.is_public !=0 && User.current.member_of_course?(x) - end + end ids << News.where(id: act_ids, course_id: p_ids).map{|x| x.id} - + #Message act_ids = activity.where(act_type: 'Message').select('act_id').map{|x| x.act_id} board_ids = Message.where(id: act_ids).select('distinct board_id').map{|x| x.board_id} @@ -508,14 +744,14 @@ class UsersController < ApplicationController p_ids = [] Project.where(id: project_ids).each do |x| p_ids << x.id unless x.visible?(User.current) - end + end ids << Message.where(id: act_ids, board_id: p_ids).map{|x| x.id} - + project_ids = Board.where(id: board_ids).select('distinct course_id').map{|x| x.course_id} c_ids = [] Course.where(id: project_ids).each do |x| c_ids << x.id unless x.is_public !=0 && User.current.member_of_course?(x) - end + end ids << Message.where(id: act_ids, board_id: c_ids).map{|x| x.id} logger.debug "filter ids #{ids}" @@ -533,33 +769,33 @@ class UsersController < ApplicationController # (e.act_type == "Message" && !e.act.board.nil? && ((!e.act.board.project.nil? && !e.act.board.project.visible?(User.current)) || (!e.act.board.course.nil? && e.act.board.course.is_public == 0 && !User.current.member_of_course?(e.act.board.course)))))) # } # - + @activity_count = activity.count @activity_pages = Paginator.new @activity_count, pre_count, params['page'] @activity = activity.slice(@activity_pages.offset,@activity_pages.per_page) @state = 0 end - + if params[:user].present? - + user_temp = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{params[:user]}%' or lastname like '%#{params[:user]}%'") - + if user_temp.size > 1 - activity = Activity.where('user_id in (?)', user_temp).where('user_id in (?)', watcher).order('id desc') + activity = Activity.where('user_id in (?)', user_temp).where('user_id in (?)', watcher).order('id desc') elsif user_temp.size == 1 - activity = Activity.where('user_id = ?', user_temp).where('user_id in (?)', watcher).order('id desc') + activity = Activity.where('user_id = ?', user_temp).where('user_id in (?)', watcher).order('id desc') else activity = Activity.where("1 = 0") end @offset, @limit = api_offset_and_limit({:limit => 10}) - @activity_count = activity.count + @activity_count = activity.count @activity_pages = Paginator.new @activity_count, @limit, params['page'] @offset ||= @activity_pages.offset - @activity = activity.offset(@offset).limit(@limit) + @activity = activity.offset(@offset).limit(@limit) @state = 0 end - - + + #Modified by nie unless User.current.admin? if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?) @@ -581,17 +817,17 @@ class UsersController < ApplicationController def info message = [] - if @user == User.current + if @user == User.current message = JournalsForMessage.reference_message(@user.id) - message += Journal.reference_message(@user.id) + message += Journal.reference_message(@user.id) end @offset, @limit = api_offset_and_limit({:limit => 10}) @info_count = message.size @info_pages = Paginator.new @info_count, @limit, params['page'] @offset ||= @info_pages.offset - + messages = message.sort {|x,y| y.created_on <=> x.created_on } - + @message = messages[@offset, @limit] unless User.current.admin? @@ -607,7 +843,7 @@ class UsersController < ApplicationController end end #### end - + def new @user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option) @@ -665,7 +901,7 @@ class UsersController < ApplicationController @auth_sources = AuthSource.all @membership ||= Member.new end - + def watch_projects @watch_projects = Project.joins(:watchers).where("project_type <>? and watchable_type = ? and `watchers`.user_id = ?", '1','Project', @user.id) @state = 1 @@ -835,42 +1071,66 @@ class UsersController < ApplicationController end end ###add by huang - def user_watchlist + def user_watchlist + limit = 10; + query = User.watched_by(@user.id); + @obj_count = query.count(); + @obj_pages = Paginator.new @obj_count,limit,params['page'] + @list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); + + render :template=>'users/user_fanslist',:layout=>'base_users_new' end ###add by huang - def user_fanslist - + def user_fanslist + limit = 10; + query = @user.watcher_users; + @obj_count = query.count(); + @obj_pages = Paginator.new @obj_count,limit,params['page'] + @list = query.order("#{Watcher.table_name}.id desc").limit(limit).offset(@obj_pages.offset).all(); + @action = 'fans' + render :layout=>'base_users_new' end - + def user_visitorlist + limit = 10; + #query = @user.watcher_users; + query = User.joins("join visitors v on #{User.table_name}.id=v.user_id") + query = query.where("v.master_id=?",@user.id) + @obj_count = query.count(); + @obj_pages = Paginator.new @obj_count,limit,params['page'] + @list = query.order("v.updated_on desc").limit(limit).offset(@obj_pages.offset).all(); + @action = 'visitor' + render :template=>'users/user_fanslist',:layout=>'base_users_new' + end + #william def update_extensions(user_extensions) user_extensions = params[:user_extensions] unless user_extensions.nil? user_extensions = UserExtensions.find_by_id(user_extensions.user_id) - + # user_extensions. end end # added by bai def topic_score_index - + end - + def project_score_index - + end - + def activity_score_index - + end - + def influence_score_index - + end - + def score_index - + end # end def topic_new_score_index @@ -916,7 +1176,7 @@ class UsersController < ApplicationController # 必填自己的工作单位,其实就是学校 def auth_user_extension - if @user == User.current && @user.user_extensions.nil? + if @user == User.current && @user.user_extensions.nil? flash[:error] = l(:error_complete_occupation) redirect_to my_account_url end @@ -944,4 +1204,20 @@ class UsersController < ApplicationController render_404 end end + + def recorded_visitor + if(User.current.logged? && User.current != @user) + #impl = Visitor.where('user_id=? and master_id=?',User.current.id,@user.id).find; + # impl = Visitor.find_by_sql('user_id=? and master_id=?',[User.current.id,@user.id]); + impl = Visitor.find_by_user_id_and_master_id(User.current.id,@user.id); + if(impl.nil?) + impl = Visitor.new + impl.user_id = User.current.id + impl.master_id = @user.id + else + impl.updated_on = Time.now + end + impl.save + end + end end diff --git a/app/controllers/watchers_controller.rb b/app/controllers/watchers_controller.rb index f6d01a03d..35e1d5ba4 100644 --- a/app/controllers/watchers_controller.rb +++ b/app/controllers/watchers_controller.rb @@ -16,12 +16,15 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. class WatchersController < ApplicationController before_filter :require_login#, :find_watchables, :only => [:watch, :unwatch] + + helper :users + def watch s = WatchesService.new watchables = s.watch params.merge(:current_user_id => User.current.id) respond_to do |format| format.html { redirect_to_referer_or {render :text => (true ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} - format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables} } + format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'add'} } end rescue Exception => e if e.message == "404" @@ -37,7 +40,7 @@ class WatchersController < ApplicationController watchables = s.unwatch params.merge(:current_user_id => User.current.id) respond_to do |format| format.html { redirect_to_referer_or {render :text => (false ? 'Watcher added.' : 'Watcher removed.'), :layout => true}} - format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables} } + format.js { render :partial => 'set_watcher', :locals => {:user => User.current, :watched => watchables,:params=>params,:opt=>'delete'} } end rescue Exception => e if e.message == "404" diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index cc6c4f47e..4ff01d36c 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -13,11 +13,12 @@ class WordsController < ApplicationController end refer_user_id = params[:new_form][:reference_user_id].to_i - @user.add_jour(User.current, message, refer_user_id) + list = @user.add_jour(User.current, message, refer_user_id) unless refer_user_id == 0 || refer_user_id == User.current.id - User.find(refer_user_id).add_jour(User.current, message, refer_user_id) + list = User.find(refer_user_id).add_jour(User.current, message, refer_user_id) end - @user.count_new_jour + @jour = list.last + # @user.count_new_jour # if a_message.size > 5 # @message = a_message[-5, 5] # else @@ -26,8 +27,8 @@ class WordsController < ApplicationController # @message_count = a_message.count end end - @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse - @jour = paginateHelper @jours,10 + # @jours = @user.journals_for_messages.where('m_parent_id IS NULL').reverse + # @jour = paginateHelper @jours,10 respond_to do |format| # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} diff --git a/app/helpers/activities_helper.rb b/app/helpers/activities_helper.rb index ede2ed78a..cf8679da6 100644 --- a/app/helpers/activities_helper.rb +++ b/app/helpers/activities_helper.rb @@ -42,4 +42,30 @@ module ActivitiesHelper end sorted_events end + + def get_container_type(activity) + #问卷 + if activity.act_type == 'Poll' + return ['Course',activity.act.polls_group_id] + end + #注册 + if activity.act_type == 'Principal' + return ['Principal',activity.act.id] + end + #留言 + if activity.act_type == 'JournalsForMessage' + return [activity.act.jour_type,activity.act.jour_id] + end + + # HomeworkCommon Issue Journal Message News + if activity.act.respond_to?('course') && activity.act.course + return ['Course',activity.act.course.id] + end + if activity.act.respond_to?('project') && activity.act.project + return ['Project',activity.act.project.id] + end + + # Contest Contestnotification + return ['Unknow',0] + end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a31bd6189..47a3b59ae 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2292,6 +2292,8 @@ module ApplicationHelper else link = "启动匿评".html_safe end + elsif homework.homework_type == 2 && homework.homework_detail_programing #编程作业作业 + link = "编程作业".html_safe else link = "启动匿评".html_safe end @@ -2305,6 +2307,8 @@ module ApplicationHelper else if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前 "#{l(:label_edit_homework)}".html_safe + elsif homework.homework_type == 2 #编程作业不能修改作品 + "作品已交".html_safe else link_to l(:label_edit_homework), edit_student_work_path(work.id),:class => 'fr mr10 work_edit' end @@ -2324,7 +2328,7 @@ module ApplicationHelper elsif homework.homework_type == 0 "未启用匿评".html_safe elsif homework.homework_type == 2 - "编程作业".html_safe + " 编程作业  ".html_safe end end @@ -2339,4 +2343,8 @@ module ApplicationHelper end end + #将文本内的/n转换为
+ def text_format text + text.gsub("\n","
").html_safe + end end diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index f88b1ff21..f24d5078f 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -80,4 +80,22 @@ module StudentWorkHelper end color end + + #获取分班信息 + def course_group_list course + result = [] + if course.course_groups && !course.course_groups.empty? + base = [] + base << l(:label_chose_group) + base << 0 + result << base + course.course_groups.each do |group| + option = [] + option << group.name + option << group.id + result << option + end + end + result + end end \ No newline at end of file diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index af2d5abc4..1926be0e8 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -303,4 +303,237 @@ module UsersHelper end end end + + def get_watcher_users(obj) + count = User.watched_by(obj.id).count + if count == 0 + return [0,[]] + end + list = User.watched_by(obj.id).order("#{Watcher.table_name}.id desc").limit(10).all + return [count,list]; + end + + def get_fans_users(obj) + count = obj.watcher_users.count + if count == 0 + return [0,[]] + end + list = obj.watcher_users.order("#{Watcher.table_name}.id desc").limit(10).all + return [count,list]; + end + def get_visitor_users(obj) + query = Visitor.where("master_id=?",obj.id) + count = query.count + if count == 0 + return [0,[]] + end + list = query.order("updated_on desc").limit(10).all + return [count,list]; + end + + def get_create_course_count(user) + return Course.where("tea_id = ?",user.id).count() + end + def get_join_course_count(user) + return user.coursememberships.count() - get_create_course_count(user) + end + def get_homework_commons_count(user) + return HomeworkCommon.where("user_id = ?",user.id).count() + end + def get_projectandcourse_attachment_count(user) + return Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count() + end + def get_create_project_count(user) + return Project.where("user_id = ? and project_type = ?",user.id,Project::ProjectType_project).count() + end + def get_join_project_count(user) + return user.memberships.count(conditions: "projects.project_type = #{Project::ProjectType_project}") - get_create_project_count(user) + end + def get_create_issue_count(user) + return Issue.where("author_id = ?",user.id).count() + end + def get_resolve_issue_count(user) + return Issue.where("assigned_to_id = ? and status_id=3",user.id).count() + end + def get_anonymous_evaluation_count(user) + return StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count() + end + + + # def query_activities(query,type) + # query_rec_count = 8 + # # query = query.where("act_type='JournalsForMessage'") + # #query = query.where("act_type not in (?)", ['JournalsForMessage','Message','HomeworkCommon','News','Issue','Journal','Poll']) + # list = query.order("id desc").limit(query_rec_count).all + # + # result = []; + # for item in list + # container = get_activity_container(item,type) + # if( activity_is_show(item,container) ) + # result << { :item=>item,:e=>container } + # end + # end + # return [lastid,result] + # end + # def get_activity_container activity,type + # e = nil; + # if type == 'Project' + # if activity.act_type == 'Poll' + # # 项目没有问卷 + # # e = Project.find_by_id(activity.act.polls_group_id) + # else + # e = activity.act.project if activity.act.respond_to?('project') + # end + # end + # if type == 'Course' + # if activity.act_type == 'Poll' + # e = Course.find_by_id(activity.act.polls_group_id) + # else + # e = activity.act.course if activity.act.respond_to?('course') + # end + # end + # + # return e; + # end + def query_activities(query) + list = query.limit(8).all + result = []; + for item in list + container = get_activity_container(item) + result << { :item=>item,:e=>container } + end + return result + end + def get_activity_container activity + return activity.activity_container + # if type == 'Project' + # return activity.act.project if activity.act.respond_to?('project') + # end + # if type == 'Course' + # if activity.act_type == 'Poll' + # return Course.find_by_id(activity.act.polls_group_id) + # end + # return activity.act.course if activity.act.respond_to?('course') + # end + # return nil; + end + + # def activity_is_show(activity,e) + # if(!e) + # return false + # end + # + # if activity.user_id == User.current.id + # return true + # end + # if( e.visible? ) + # return true + # end + # return false + # end + def get_activity_act_showname_htmlclear(activity) + str = get_activity_act_showname(activity) + str = str.gsub(/<.*>/,'') + str = str.lstrip.rstrip + if str == '' + str = 'RE:' + end + return str.html_safe + end + def get_activity_act_showname(activity) + case activity.act_type + when "HomeworkCommon" + return activity.act.name + when "Issue" + return activity.act.subject + when "Journal" + return details_to_strings(activity.act.details,true).to_s + when "JournalsForMessage" + return activity.act.notes + when "Message" + return activity.act.subject + when "News" + return activity.act.title + when "Poll" + return activity.act.polls_name + when "Contest" + return '' + when "Contestnotification" + return '' + when "Principal" + return '' + else + return activity.act_type + end + end + def get_activity_act_createtime(activity) + case activity.act_type + when "HomeworkCommon" + return activity.act.created_at + when "Poll" + return activity.act.created_at + else + return activity.act.created_on + end + end + def get_activity_container_url e + if !e.visible? + return "javascript:;" + end + + if e.class.to_s == 'Course' + return url_for(:controller => 'courses', :action=>"show", :id=>e.id, :host=>Setting.host_course) + end + return url_for(:controller => 'projects', :action=>"show", :id=>e.id, :host=>Setting.host_name) + end + def get_activity_url(activity,e) + if !e.visible? + return "javascript:;" + end + + case activity.act_type + # when "Contest" + # when "Contestnotification" + # when "Principal" + when "HomeworkCommon" + return homework_common_index_path( :course=>e.id ) + when "Issue" + return issue_path(activity.act.id) + when "Journal" + return issue_path( activity.act.journalized_id ) + when "JournalsForMessage" + return e.class.to_s == 'Course' ? course_feedback_path(e) : project_feedback_path(e) + when "Message" + return e.class.to_s == 'Course' ? course_boards_path(e) : project_boards_path(e) + when "News" + return news_path(activity.act) + #return e.class.to_s == 'Course' ? course_news_index_path(e) : project_news_index_path(e) + when "Poll" + return poll_index_path( :polls_group_id=>activity.act.polls_group_id, :polls_type=>e.class.to_s ) + else + return 'javascript:;' + end + end + def get_activity_opt(activity,e) + case activity.act_type + when "HomeworkCommon" + return '创建了作业' + when "News" + return e.class.to_s == 'Course' ? '发布了通知' : '添加了新闻' + when "Issue" + return '发表了问题' + when "Journal" + return '回复了问题' + when "JournalsForMessage" + return e.class.to_s == 'Course' ? '发表了留言' : '提交了反馈' + #return ( activity.act.reply_id == nil || activity.act.reply_id == 0 ) ? '' : '' + when "Message" + return ( activity.act.parent_id == nil || activity.act.parent_id == '' ) ? '发布了帖子' : '回复了帖子' + when "Poll" + return '发布了问卷' + else + return '有了新动态' + end + end + end diff --git a/app/models/activity.rb b/app/models/activity.rb index 5ec778641..679cb9599 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -2,9 +2,20 @@ class Activity < ActiveRecord::Base attr_accessible :act_id, :act_type, :user_id belongs_to :act, :polymorphic => true belongs_to :user + belongs_to :activity_container, polymorphic: true validates :act_id, presence: true validates :act_type, presence: true validates :user_id, presence: true include Trustie::Cache::ClearCourseEvent + + before_create :set_container_type_val + + #helper :activities + include ActivitiesHelper + def set_container_type_val + container_type,container_id =get_container_type(self) + self.activity_container_type = container_type + self.activity_container_id = container_id + end end diff --git a/app/models/homework_test.rb b/app/models/homework_test.rb index f7d9b20bc..7c477bfaf 100644 --- a/app/models/homework_test.rb +++ b/app/models/homework_test.rb @@ -2,4 +2,5 @@ class HomeworkTest < ActiveRecord::Base attr_accessible :input, :output, :homework_common_id belongs_to :homework_common + has_one :student_work_test end diff --git a/app/models/student_work.rb b/app/models/student_work.rb index e2be18423..c80d1315b 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -7,6 +7,13 @@ class StudentWork < ActiveRecord::Base has_many :student_works_evaluation_distributions, :dependent => :destroy has_many :student_works_scores, :dependent => :destroy belongs_to :project + has_one :student_work_test + + before_destroy :delete_praise acts_as_attachable + + def delete_praise + PraiseTread.where("praise_tread_object_id = #{self.id} AND praise_tread_object_type = 'StudentWork'").destroy_all + end end diff --git a/app/models/student_work_test.rb b/app/models/student_work_test.rb new file mode 100644 index 000000000..d9ac5e935 --- /dev/null +++ b/app/models/student_work_test.rb @@ -0,0 +1,42 @@ +# encoding: utf-8 +class StudentWorkTest < ActiveRecord::Base + attr_accessible :student_work_id, :homework_test_id + + belongs_to :homework_test + belongs_to :student_work + + def status_to_s + case self.result + when -1 + '编译出错' + when -2 + '答题错误' + when -3 + '答案错误' + when 1 + '运行出错' + when 2 + '超时' + when 3 + '内存超出' + when 4 + '输出超出' + when 5 + '禁用函数' + when 6 + '其他错误' + when 0 + '成功' + else + '未知错误' + end + end + + def test_score + if self.result == 0 + format("%.1f",100.0 / self.student_work.homework_common.homework_tests.count) + else + 0 + end + end +end diff --git a/app/models/user_extensions.rb b/app/models/user_extensions.rb index d9a0f520a..726918729 100644 --- a/app/models/user_extensions.rb +++ b/app/models/user_extensions.rb @@ -12,6 +12,8 @@ class UserExtensions < ActiveRecord::Base belongs_to :user belongs_to :school, :class_name => 'School', :foreign_key => :school_id attr_accessible :user_id,:birthday,:brief_introduction,:gender,:location,:occupation,:work_experience,:zip_code,:identity, :technical_title,:student_id + validates_length_of :description, :maximum => 255 + validates_length_of :brief_introduction, :maximum => 255 TEACHER = 0 STUDENT = 1 ENTERPRISE = 2 diff --git a/app/models/visitor.rb b/app/models/visitor.rb new file mode 100644 index 000000000..6563fde16 --- /dev/null +++ b/app/models/visitor.rb @@ -0,0 +1,3 @@ +class Visitor < ActiveRecord::Base + belongs_to :user +end \ No newline at end of file diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 1439f961d..e4e84a7c4 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -678,12 +678,11 @@ class CoursesService end # 课程讨论区 - # latest_message = course.boards.first.topics.page(1).per(2) - # unless latest_message.first.nil? - # latest_course_dynamics << {:type => 2, :time => latest_message.first.created_on, :count =>course.boards.nil? ? 0 : course.boards.first.topics.count, - # :topics => latest_message.all} - # dynamics_count += 1 - # end + latest_message = course.boards.first.topics.page(1).per(2) + unless latest_message.first.nil? + latest_course_dynamics << {:type => 2, :time => latest_message.first.created_on, :count =>course.boards.nil? ? 0 : course.boards.first.topics.count, + :topics => latest_message.all} + end # 课程资源 # latest_attachment = course.attachments.order("created_on desc").page(1).per(2) @@ -788,6 +787,45 @@ class CoursesService student_works end + # 获取课程的讨论区信息 + def board_message_list params,current_user + # 课程讨论区 + course = Course.find(params[:course_id]) + latest_message = course.boards.first.topics.page(params[:page] || 1).per(10) + end + + #获取回复列表 + def board_message_reply_list params,current_user + board = Board.find(params[:board_id]) + reply_list = board.topics.where("id = #{params[:msg_id]}").first.children.order("created_on desc").page(params[:page] || 1).per(10) + end + + #回复讨论区 + def board_message_reply params,current_user + author = Message.find(params[:parent_id]).author + quote = "
" << author.realname << "(" << author.nickname << ")写到:
" << params[:quote] <<"
" + reply = Message.new + reply.author = current_user + reply.board = Board.find(params[:board_id]) + params[:reply] = {} + params[:reply][:subject] = params[:subject] #本回复标题 + params[:reply][:content] = params[:content] #本回复内容 + params[:reply][:quote] = {} + params[:reply][:quote][:quote] = params[:quote] #本回复引用的内容,也是父id内容 + params[:reply][:parent_topic] = params[:parent_id] # 父id + params[:reply][:board_id] = params[:board_id] #讨论区id + params[:reply][:id] = params[:root_id] #根id + reply.safe_attributes = params[:reply] + if params[:root_id] == params[:parent_id] + reply.content = reply.content + else + reply.content = quote + reply.content + end + + Message.find(params[:root_id]).children << reply + reply + end + # # 开启匿评 # #statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限 # def start_anonymous_comment params,current_user diff --git a/app/views/avatar/upload.js.erb b/app/views/avatar/upload.js.erb index 1fa90c5a3..41cf3ab77 100644 --- a/app/views/avatar/upload.js.erb +++ b/app/views/avatar/upload.js.erb @@ -1,4 +1,8 @@ +<% if @source_type=='User' %> +var imgSpan = $("img[nhname='avatar_image']"); +imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'}); +<% else %> var imgSpan = jQuery('#avatar_image'); imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'}); - +<% end %> \ No newline at end of file diff --git a/app/views/bids/new_contest.html.erb b/app/views/bids/new_contest.html.erb index 216816bd1..899aea1e7 100644 --- a/app/views/bids/new_contest.html.erb +++ b/app/views/bids/new_contest.html.erb @@ -1,10 +1,10 @@ - -

<%=l(:label_newtype_contest)%>

+ + -<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'create_contest'} do |f| %> -
- <%= render :partial => 'form_contest', :locals => { :f => f } %> - <%= submit_tag l(:button_create) %> - <%= javascript_tag "$('#bid_name').focus();" %> - <% end %> -
\ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/app/views/courses/_show_member_score.html.erb b/app/views/courses/_show_member_score.html.erb index bdc1fa147..2d08e853e 100644 --- a/app/views/courses/_show_member_score.html.erb +++ b/app/views/courses/_show_member_score.html.erb @@ -19,7 +19,7 @@
  • 作业名称得分
  • <% @member_score.homework_common_list.each do |homework_common| %>
  • - + <%= homework_common.name %> diff --git a/app/views/courses/finishcourse.js.erb b/app/views/courses/finishcourse.js.erb index 2399062fd..0ca89aa19 100644 --- a/app/views/courses/finishcourse.js.erb +++ b/app/views/courses/finishcourse.js.erb @@ -1,8 +1,8 @@ <% if @save_flag %> - $('#finish_course_<%=@course.id%>').replaceWith("<%= escape_javascript(set_course_time(@course_prefs))%>"); +$('#finish_course_<%=@course.id%>').replaceWith("<%= escape_javascript(set_course_time(@course_prefs))%>"); +var html = "<%= escape_javascript( render( :partial => 'users/course_form', :locals => {:item => @course_prefs} ) )%>"; +$('#nh_course_<%=@course.id%>').replaceWith(html); // alert("关闭成功"); <% else %> - alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。'); -<% end %> - - +alert('权限不足,设置失败,请在论坛提交问题,等待管理员处理。'); +<% end %> \ No newline at end of file diff --git a/app/views/courses/join_private_courses.js.erb b/app/views/courses/join_private_courses.js.erb index fecfb13cd..d1bce7d86 100644 --- a/app/views/courses/join_private_courses.js.erb +++ b/app/views/courses/join_private_courses.js.erb @@ -1,7 +1,8 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_private_course') %>'); showModal('ajax-modal', '540px'); $('#ajax-modal').css('height','330px'); -$('#ajax-modal').siblings().remove(); +//$('#ajax-modal').siblings().remove(); +$('#ajax-modal').siblings().hide(); $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); diff --git a/app/views/homework_common/_homework_common_form.html.erb b/app/views/homework_common/_homework_detail_manual_form.html.erb similarity index 97% rename from app/views/homework_common/_homework_common_form.html.erb rename to app/views/homework_common/_homework_detail_manual_form.html.erb index 4542be9f5..ffec93e73 100644 --- a/app/views/homework_common/_homework_common_form.html.erb +++ b/app/views/homework_common/_homework_detail_manual_form.html.erb @@ -10,7 +10,6 @@
  • -
    <% if edit_mode %> <%= f.kindeditor :description,:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %> diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb new file mode 100644 index 000000000..008f88138 --- /dev/null +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -0,0 +1,125 @@ + + +
    +
    +

    编程评测设置

    +
    +
      +
    • + + +
      +
    • + +
    • + + <%= select_tag :ta_proportion,options_for_select(ta_proportion_option,homework.homework_detail_programing.ta_proportion), {:class => "fl mb10 h26 w70"} %> + × 教辅评分 +   +   + + × 系统评分 + = 学生得分 +
      +
    • +
    • + + 如果教师对学生作品进行了评分,则教师评分为学生最终得分。 +
      +
    • + +
    • + + +
      +
    • + + <% if edit_mode %> + <% homework.homework_tests.each do |homework_test|%> +
      +
    • + + +
    • +
    • + + +
    • +
    • + + + 测试 +
    • +
      +
      + <% end%> + <% else %> +
      +
    • + + +
    • +
    • + + +
    • +
    • + + + 测试 +
    • +
      +
      + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/homework_common/edit.html.erb b/app/views/homework_common/edit.html.erb index 50feca946..5b65b5982 100644 --- a/app/views/homework_common/edit.html.erb +++ b/app/views/homework_common/edit.html.erb @@ -7,10 +7,18 @@
    - <%= form_for @homework do |f| %> - <%= render :partial => 'homework_common/homework_common_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> - 提交 - <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> + <%if @homework.homework_type == 2%> + <%= form_for @homework do |f| %> + <%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> + 提交 + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> + <% end%> + <% else %> + <%= form_for @homework do |f| %> + <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %> + 提交 + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> + <% end%> <% end%>
    diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index db7dad9c7..2de96bca1 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -48,6 +48,32 @@
    + <% if homework.homework_type == 2 && homework.homework_detail_programing%> + + + "> + + + + <% homework.homework_tests.each do |test|%> + "> + + + + <% end%> + +
    + 输入 + + 输出 +
    + <%=test.input%> + + <%= test.output%> +
    + <% end%> +
    +
    <% unless homework.attachments.empty?%> 附件: diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index dc67b5079..01fcb9f4d 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -1,17 +1,27 @@ -<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> -<%= error_messages_for 'homework_common' %> -

    <%= l(:label_course_homework_new)%>

    -
    - <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> - <%= hidden_field_tag "course",@course.id%> - <%= render :partial => 'homework_common/homework_common_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> - 提交 - <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> +
    + <%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%> + +

    + 请选择将要发布的作业类型 +

    + + + 人工评分的作业(支持匿名互评、灵活设置评分比例) + +
    + + + 自动评测的编程作业(支持C++程序的自动评分) + +
    + + 下一步 + <% end%>
    diff --git a/app/views/homework_common/next_step.html.erb b/app/views/homework_common/next_step.html.erb new file mode 100644 index 000000000..75e9f4c0a --- /dev/null +++ b/app/views/homework_common/next_step.html.erb @@ -0,0 +1,30 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> +<%= error_messages_for 'homework_common' %> +
    +

    + <%= l(:label_course_homework_new)%> +

    +
    +<% if @homework_type == "1"%> +
    + <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> + <%= hidden_field_tag "course",@course.id%> + <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> + 提交 + <%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> + <% end%> +
    +<% elsif @homework_type == "2"%> +
    + <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> + <%= hidden_field_tag "course",@course.id%> + <%= hidden_field_tag "homework_common[homework_type]","2"%> + <%= render :partial => 'homework_common/homework_detail_programing_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> + 提交 + <%= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> + <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> + <% end%> +
    +
    +<% end%> \ No newline at end of file diff --git a/app/views/layouts/_base_footer_new.html.erb b/app/views/layouts/_base_footer_new.html.erb new file mode 100644 index 000000000..b4856d2af --- /dev/null +++ b/app/views/layouts/_base_footer_new.html.erb @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index b800a1722..16fa44c73 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -101,10 +101,7 @@ addSlipMenu(); addProjectSlipMenu (); addCourseSlipMenu(); - }); - - jQuery(document).ready(function($) { - $('.sub_menu').find("a").attr('target', '_blank'); + $('.sub_menu').find("a").attr('target', '_blank'); $('.project_sub_menu').find("a").attr('target', '_blank'); $('.course_sub_menu').find("a").attr('target', '_blank'); }); diff --git a/app/views/layouts/_base_header_new.html.erb b/app/views/layouts/_base_header_new.html.erb new file mode 100644 index 000000000..9f074dbbf --- /dev/null +++ b/app/views/layouts/_base_header_new.html.erb @@ -0,0 +1,76 @@ + +
    \ No newline at end of file diff --git a/app/views/layouts/_user_fans_list.html.erb b/app/views/layouts/_user_fans_list.html.erb new file mode 100644 index 000000000..8c39c528c --- /dev/null +++ b/app/views/layouts/_user_fans_list.html.erb @@ -0,0 +1,12 @@ + <% fans_count,fans_list = get_fans_users(user) %> +
    +

    粉丝

    更多 +
    +
    + <% for fans in fans_list %> + <%= link_to image_tag(url_to_avatar(fans), :style => "width:38px;height:38px;"), user_path(fans), :class => "pic_members", :title => "#{fans.name}" %> + <% end %> +
    +
    +
    + \ No newline at end of file diff --git a/app/views/layouts/_user_watch_btn.html.erb b/app/views/layouts/_user_watch_btn.html.erb new file mode 100644 index 000000000..71eea7166 --- /dev/null +++ b/app/views/layouts/_user_watch_btn.html.erb @@ -0,0 +1,8 @@ +<% if(User.current.logged? && User.current!=target)%> + <%if(target.watched_by?(User.current))%> + 取消 + <% else %> + 关注 + <% end %> +<% end %> \ No newline at end of file diff --git a/app/views/layouts/_user_watch_list.html.erb b/app/views/layouts/_user_watch_list.html.erb new file mode 100644 index 000000000..00c0cdc40 --- /dev/null +++ b/app/views/layouts/_user_watch_list.html.erb @@ -0,0 +1,11 @@ + <% watcher_count,watcher_list = get_watcher_users(user) %> +
    +

    关注

    更多 +
    +
    + <% for watcher in watcher_list %> + <%= link_to image_tag(url_to_avatar(watcher), :style => "width:38px;height:38px;"), user_path(watcher), :class => "pic_members", :title => "#{watcher.name}" %> + <% end %> +
    +
    +
    \ No newline at end of file diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb new file mode 100644 index 000000000..ef6d82245 --- /dev/null +++ b/app/views/layouts/base_users_new.html.erb @@ -0,0 +1,332 @@ +<% @nav_dispaly_home_path_label = 1 + @nav_dispaly_main_course_label = 1 + @nav_dispaly_main_project_label = 1 + @nav_dispaly_main_contest_label = 1 %> +<% @nav_dispaly_forum_label = 1%> +<% @nav_dispaly_user_label = show_item_on_navbar(params) %> +<% @center_flag = (User.current == @user) %> + + + + +<%= h html_title %> + + +<%= csrf_meta_tag %> +<%= favicon %> +<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'public_new', 'leftside_new','users', :media => 'all' %> +<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> +<%= javascript_heads %> +<%= heads_for_theme %> +<%= call_hook :view_layouts_base_html_head %> + +<%= yield :header_tags -%> + + + + + + + +
    + <%= render :partial => 'layouts/base_header_new'%> + +
    + +
    +
    +
    + +
    + <%=link_to @user.name, user_path(@user),:class=>"fl c_dark fb f14" %> + <% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %> + + <% end %> + + <%= render :partial => 'layouts/user_watch_btn', :locals => {:target => @user} %> +
    +
    + +
    + <%=l(:label_user_watcher)%>(<%= link_to User.watched_by(@user.id).count.to_s, {:controller=>"users", :action=>"user_watchlist",:id=>@user.id},:class=>"c_blue",:nh_name=>"watcher_count" %>) + + <%=l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)%>(<%= link_to @user.watcher_users.count.to_s, {:controller=>"users", :action=>"user_fanslist",:id=>@user.id},:class=>"c_blue",:nh_name=>"fans_count"%>) + 积分(<%= link_to(format("%.2f" ,get_option_number(@user,1).total_score ).to_i, + {:controller => 'users', :action => 'show_new_score', :remote => true, :id => @user.id }, :class => 'c_blue',:id => 'user_score') %>) +
    +
    + <% if (@user.user_extensions) %> +
    <%= @user.user_extensions.brief_introduction %>
    + <% end %> +
    + +
    +
      +
    • 加入时间 :
    • + <% if @user.user_extensions!=nil && @user.user_extensions.identity == 2 %> +
    • <%= l(:label_company_name) %> :
    • + <% elsif !@user.firstname.empty? || !@user.lastname.empty? %> +
    • 真实姓名 :
    • + <% end %> + <% unless @user.user_extensions.nil? %> + <% if @user.user_extensions.identity == 0 %> +
    • 职称 :
    • + <% end %> + <% if @user.user_extensions && @user.user_extensions.location && !@user.user_extensions.location.empty?%> +
    • 地区 :
    • + <% end %> + <% if (@user.user_extensions.identity == 0 || @user.user_extensions.identity == 1) && !@user.user_extensions.school.nil? %> +
    • 工作单位 :
    • + <% elsif @user.user_extensions.identity == 3 && !@user.user_extensions.occupation.nil? && !@user.user_extensions.occupation.empty? %> +
    • 工作单位 :
    • + <% elsif @user.user_extensions.identity == 2 %> +
    • 工作单位 :
    • + <% end %> + <% if (!@user.user_extensions.description.nil? && !@user.user_extensions.description.empty?) %> +
    • 个人简介 :
    • + <% end %> + <% end %> +
    +
      +
    • <%= format_date(@user.created_on) %>
    • +
    • <%= @user.show_name %>
    • + <% unless @user.user_extensions.nil? %> + <% if @user.user_extensions.identity == 0 %> +
    • <%= get_technical_title @user %>
    • + <% end %> + <% if @user.user_extensions && @user.user_extensions.location && !@user.user_extensions.location.empty?%> +
    • <%= @user.user_extensions.location %>  <%= @user.user_extensions.location_city %>
    • + <% end %> + + <% if (@user.user_extensions.identity == 0 || @user.user_extensions.identity == 1) && !@user.user_extensions.school.nil? %> +
    • <%= @user.user_extensions.school.name %>
    • + <% elsif @user.user_extensions.identity == 3 && !@user.user_extensions.occupation.nil? && !@user.user_extensions.occupation.empty? %> +
    • <%= @user.user_extensions.occupation %>
    • + <% elsif @user.user_extensions.identity == 2 %> +
    • <%= @user.show_name %>
    • + <% end %> + <% if (!@user.user_extensions.description.nil? && !@user.user_extensions.description.empty?) %> +
    • <%= @user.user_extensions.description %>
    • + <% end %> + <% end %> +
    +
    +
    + + <% if @center_flag %> + + <% end %> +
    + +
    +
      + <% if !@user.user_extensions.nil? && @user.user_extensions.identity == 0 %> +
    • 创建课程 :
    • +
    • 发布作业 :
    • + <% end %> +
    • 加入课程 :
    • +
    • 参加匿评 :
    • +
    • 发布资源 :
    • +
    • 创建项目 :
    • +
    • 加入项目 :
    • +
    • 发布缺陷 :
    • +
    • 解决缺陷 :
    • +
    +
      + <% if !@user.user_extensions.nil? && @user.user_extensions.identity == 0 %> +
    • <%= get_create_course_count(@user) %>
    • +
    • <%= get_homework_commons_count(@user) %>
    • + <% end %> +
    • <%= get_join_course_count(@user) %>
    • +
    • <%= get_anonymous_evaluation_count(@user) %>
    • +
    • <%= get_projectandcourse_attachment_count(@user) %>
    • +
    • <%= get_create_project_count(@user) %>
    • +
    • <%= get_join_project_count(@user) %>
    • +
    • <%= get_create_issue_count(@user) %>
    • +
    • <%= get_resolve_issue_count(@user) %>
    • +
    +
    +
    + +
    + + <%= render :partial => 'layouts/user_watch_list', :locals => {:user => @user} %> + <%= render :partial => 'layouts/user_fans_list', :locals => {:user => @user} %> + <% visitor_count,visitor_list = get_visitor_users(@user) %> +
    +

    访客

    更多 +
    +
    + <% for visitor in visitor_list %> + <%= link_to image_tag(url_to_avatar(visitor.user), :style => "width:38px;height:38px;"), user_path(visitor.user), :class => "pic_members", :title => "#{visitor.user.name}" %> + <% end %> +
    +
    +
    + +
    + + <%= yield %> + +
    +
    + + <%= render :partial => 'layouts/new_footer'%> +
    +
    + +<%= render :partial => 'layouts/new_feedback' %> + + +<%= javascript_include_tag '/javascripts/avatars.js' %> + + + + diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 6c0c3a78a..580ddf773 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -1,743 +1,544 @@ -<% @nav_dispaly_home_path_label = 1 - @nav_dispaly_main_course_label = 1 - @nav_dispaly_main_project_label = 1 - @nav_dispaly_main_contest_label = 1 %> -<% @nav_dispaly_forum_label = 1%> + - +
    - -
    - <%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %> - <%= call_hook(:view_my_account_contextual, :user => @user) %>
    -

    - <%= l(:label_my_account) %> -

    -<%= error_messages_for 'user' %> -
    -<%= labelled_form_for :user, @user, - :url => {:action => "account"}, - :html => {:id => 'my_account_form', +
    + +

    <%= l(:lable_school_list)%>

    +    +
    +
      + <% @ss = School.find_by_sql("select distinct province from schools") %> + <% @ss.each do |s| %> +
    • + <%= s.province %> + +
    • + <% end %> +
    +
    - :method => :post} do |f| %> - -
    -
    - -

    - <%= f.text_field :login, :required => true, :size => 25, :name => "login", :style => 'border:1px solid #d3d3d3;'%> - <%= l(:label_max_number) %> -
    -

    - -

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

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

    <%= l(:lable_school_list)%>

    -    -
    -
      - <% @ss = School.find_by_sql("select distinct province from schools") %> - <% @ss.each do |s| %> -
    • - <%= s.province %> - -
    • - <% end %> -
    -
    - -
    -
      - -
    -
    -
    - - - - - - - -

    - <%= f.text_field :mail, :required => true %> -

    - -

    - <%= f.select :language, :Chinese => :zh, :English => :en %> -

    - - - <% if !User.current.user_extensions.nil? %> - <% province = User.current.user_extensions.location %> - <% city = User.current.user_extensions.location_city %> - <% identity = User.current.user_extensions.identity %> - <% occupation1 = User.current.user_extensions.occupation %> - <% occupation = User.current.user_extensions.occupation %> - <% title = User.current.user_extensions.technical_title %> - <% language = User.current.language %> - <% else %> - <% province = "湖南省" %> - <% city = "长沙"%> - <% identity = ""%> - <% occupation1 = ""%> - <% title = "" %> - <% language = ""%> - <% end %> - - -

    - - -

    - - - - -
    - - - <% if Setting.openid? %> -

    - <%= f.text_field :identity_url %> -

    - <% end %> - - <% @user.custom_field_values.select(&:editable?).each do |value| %> -

    <%= custom_field_tag_with_label :user, value %>

    - <% end %> - <%= call_hook(:view_my_account, :user => @user, :form => f) %> -
    - - - - - - - - +<%= stylesheet_link_tag 'nyan' %> +<%= javascript_include_tag '/javascripts/jquery.leanModal.min.js' %> +<% if !User.current.user_extensions.nil? %> + <% province = User.current.user_extensions.location %> + <% city = User.current.user_extensions.location_city %> + <% identity = User.current.user_extensions.identity %> + <% occupation1 = User.current.user_extensions.occupation %> + <% occupation = User.current.user_extensions.occupation %> + <% title = User.current.user_extensions.technical_title %> + <% language = User.current.language %> +<% else %> + <% province = "湖南省" %> + <% city = "长沙"%> + <% identity = ""%> + <% occupation1 = ""%> + <% title = "" %> + <% language = ""%> <% end %> -<% html_title(l(:label_my_account)) -%> - + \ No newline at end of file diff --git a/app/views/my/clear_user_avatar_temp.js.erb b/app/views/my/clear_user_avatar_temp.js.erb new file mode 100644 index 000000000..9513bdac4 --- /dev/null +++ b/app/views/my/clear_user_avatar_temp.js.erb @@ -0,0 +1,7 @@ + $("img[nhname='avatar_image']").attr('src',$("#nh_user_tx").attr('src')); + $('#ajax-modal').html($("#nh_tx_dialog_html").html()); + showModal('ajax-modal','460px'); + $('#ajax-modal').siblings().hide(); + $('#ajax-modal').parent().removeClass("alert_praise"); + //$('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("alert_box"); \ No newline at end of file diff --git a/app/views/my/save_user_avatar.js.erb b/app/views/my/save_user_avatar.js.erb new file mode 100644 index 000000000..ce4bae501 --- /dev/null +++ b/app/views/my/save_user_avatar.js.erb @@ -0,0 +1,2 @@ +$("#nh_user_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:216px;height:216px;",:alt=>"头像") %>'); +hideModal(); \ No newline at end of file diff --git a/app/views/projects/join_project.js.erb b/app/views/projects/join_project.js.erb index 85e9e294b..92cdfcf2c 100644 --- a/app/views/projects/join_project.js.erb +++ b/app/views/projects/join_project.js.erb @@ -1,7 +1,8 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/join_project') %>'); showModal('ajax-modal', '540px'); $('#ajax-modal').css('height','260px'); -$('#ajax-modal').siblings().remove(); +//$('#ajax-modal').siblings().remove(); +$('#ajax-modal').siblings().hide(); $('#ajax-modal').before("" + ""); $('#ajax-modal').parent().removeClass("alert_praise"); diff --git a/app/views/student_work/_evaluation_student_work.html.erb b/app/views/student_work/_evaluation_student_work.html.erb index 0f66452c7..b5bdd6f55 100644 --- a/app/views/student_work/_evaluation_student_work.html.erb +++ b/app/views/student_work/_evaluation_student_work.html.erb @@ -9,7 +9,7 @@ <%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
  • - <%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%> + <%= link_to student_work.name, student_work_path(student_work.id),:remote => true,:title => student_work.name, :class => "c_blue02"%>
  • <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %> @@ -26,7 +26,7 @@
  • <%= student_work.student_score.nil? ? "--" : format("%.1f",student_work.student_score)%> - <% unless student_work.student_score.nil?%> + <% unless student_work.student_score.nil? || student_work.homework_common.homework_type == 2%> (<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>) diff --git a/app/views/student_work/_evaluation_student_work_title.html.erb b/app/views/student_work/_evaluation_student_work_title.html.erb index 0e4151065..f19438f78 100644 --- a/app/views/student_work/_evaluation_student_work_title.html.erb +++ b/app/views/student_work/_evaluation_student_work_title.html.erb @@ -2,42 +2,46 @@ 学号
  • - <%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> <% if @show_all && @order == "name"%> - + <%= link_to "",student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • 作品名称
  • - <%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> <% if @show_all && @order == "created_at"%> - <%= link_to "",student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> + <%= link_to "",student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • - <%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> <% if @show_all && @order == "teacher_score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • - <%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> <% if @show_all && @order == "teaching_asistant_score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • -
  • - <%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> +
  • + <% if @homework.homework_type == 1%> + <%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <% elsif @homework.homework_type == 2%> + <%= link_to "系统",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <% end %> <% if @show_all && @order == "student_score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • - <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> <% if @show_all && @order == "score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • \ No newline at end of file diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb new file mode 100644 index 000000000..8060b8a79 --- /dev/null +++ b/app/views/student_work/_programing_work_show.html.erb @@ -0,0 +1,75 @@ +
    +
    + + +
    + <%@work.student_works_scores.order("updated_at desc").each do |score|%> +
    + <%= render :partial => 'student_work_score',:locals => {:score => score}%> +
    + <% end%> +
    + 收起 +
    \ No newline at end of file diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb index dfe61d3db..2b7d49402 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -36,7 +36,7 @@
  • 内容:
    - <%= textilizable @work.description%> + <%= text_format @work.description%>
  • diff --git a/app/views/student_work/_student_work_title.html.erb b/app/views/student_work/_student_work_title.html.erb index c46f7dc79..24e6a1b37 100644 --- a/app/views/student_work/_student_work_title.html.erb +++ b/app/views/student_work/_student_work_title.html.erb @@ -2,36 +2,36 @@ 学号
  • - <%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> <% if @show_all && @order == "name"%> - + <%= link_to "",student_work_index_path(:homework => @homework.id,:order => "name", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • 作品名称
  • - <%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> <% if @show_all && @order == "created_at"%> - <%= link_to "",student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> + <%= link_to "",student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • - <%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> <% if @show_all && @order == "teacher_score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • - <%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> <% if @show_all && @order == "teaching_asistant_score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • - <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> + <%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%> <% if @show_all && @order == "score"%> - <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> + <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => @score == 'desc' ? 'st_up' : 'st_down'%> <% end%>
  • \ No newline at end of file diff --git a/app/views/student_work/add_score.js.erb b/app/views/student_work/add_score.js.erb index 9298de8fc..1de92b51a 100644 --- a/app/views/student_work/add_score.js.erb +++ b/app/views/student_work/add_score.js.erb @@ -2,20 +2,23 @@ $("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :parti $('#score_<%= @work.id%>').peSlider({range: 'min'}); <% if @is_new%> -$("#score_list_<%= @work.id%>").prepend("
    <%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>
    "); + $("#score_list_<%= @work.id%>").prepend("
    <%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>
    "); <% else %> -$("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>"); + $("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>"); <% end%> + $("#score_list_<%= @work.id%>").removeAttr("style"); <% if @is_teacher %> -<% if @homework.homework_type == 1%> -$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_student_work',:locals => {:student_work => @work}) %>"); -<% else%> -$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>"); -<% end%> + <% if @homework.homework_type == 1%> + $("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_student_work',:locals => {:student_work => @work}) %>"); + <% elsif @homework.homework_type == 2%> + $("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_student_work',:locals => {:student_work => @work}) %>"); + <% else%> + $("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>"); + <% end%> <% else %> -$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work}) %>"); + $("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work}) %>"); <% end%> diff --git a/app/views/student_work/edit.html.erb b/app/views/student_work/edit.html.erb index dfa995f47..6e36447d2 100644 --- a/app/views/student_work/edit.html.erb +++ b/app/views/student_work/edit.html.erb @@ -2,14 +2,6 @@

    编辑作品

    - - - - - - - -
    <%= labelled_form_for @work,:html => { :multipart => true } do |f|%> diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 76ae71459..1eaee54af 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -48,8 +48,9 @@ <%= link_to "所有作品(#{@stundet_works.count})".html_safe,student_work_index_path(:homework => @homework.id), :class => "fl"%> <% if @show_all%> - - 搜索 + + <%= select_tag(:late_penalty,options_for_select(course_group_list(@course),@group), {:class => "fl h22 w100 ml10"}) if @is_teacher %> + 搜索 <%= link_to("缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank") if((@is_teacher || User.current.admin?) && @homework.homework_type == 1) %> <% end%> <% if @is_teacher%> @@ -89,7 +90,7 @@
    <% end%> <% else %> - <% if @homework.homework_type == 1%> + <% if @homework.homework_type == 1 || @homework.homework_type == 2%>
      <%= render :partial => 'evaluation_student_work_title'%>
    @@ -126,13 +127,31 @@ <%= student_anonymous_comment @homework %> <%= student_new_homework @homework %> <% end %> -
    +
    <%= @homework.description.html_safe %>
    -
    + + <% if @homework.homework_type == 2 && @homework.homework_detail_programing%> + + + <% @homework.homework_tests.each do |test|%> + "> + + + + <% end%> + +
    + <%=test.input%> + + <%= test.output%> +
    + <% end%> +
    +
    <% unless @homework.attachments.empty?%> 附件: diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index b4162c4da..eda09114e 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -33,9 +33,12 @@

    <%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %> - 项目信息 - - + <% if @homework.homework_type != 2%> + + 项目信息 + + + <% end%>

    @@ -46,17 +49,23 @@

    - - <%= f.text_area "description", :class => "w620 hwork_txt ", :maxlength => 3000, :placeholder => "最多3000个汉字", :onkeyup => "regexStudentWorkDescription();"%> + + <%= f.text_area "description", :class => "w620 hwork_txt ", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%>

    -

    - - <%= render :partial => 'attachments/new_form' %> -

    -
    + <% if @homework.homework_type != 2%> +

    + + <%= render :partial => 'attachments/new_form' %> +

    +
    + <% end%>

    提交作品 <%= link_to "返  回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white"%> diff --git a/app/views/student_work/set_program_score.html.erb b/app/views/student_work/set_program_score.html.erb new file mode 100644 index 000000000..6ea169c64 --- /dev/null +++ b/app/views/student_work/set_program_score.html.erb @@ -0,0 +1 @@ +成功 \ No newline at end of file diff --git a/app/views/student_work/show.js.erb b/app/views/student_work/show.js.erb index fa12e097d..1c8874c2f 100644 --- a/app/views/student_work/show.js.erb +++ b/app/views/student_work/show.js.erb @@ -2,6 +2,10 @@ if($("#about_hwork_<%= @work.id%>").children().length > 0) {$("#about_hwork_<%= @work.id%>").html("");} else { - $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>"); + <% if @homework.homework_type == 2%> + $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show') %>"); + <% else%> + $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>"); + <% end%> $('#score_<%= @work.id%>').peSlider({range: 'min'}); } \ No newline at end of file diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb index 82b69ab63..0d1c4ef19 100644 --- a/app/views/users/_course_form.html.erb +++ b/app/views/users/_course_form.html.erb @@ -1,74 +1,46 @@ -

    -
      - <% for membership in memberships %> -
    • - - - - - -
      - <%= image_tag(url_to_avatar(membership.course), :class => 'avatar') %> - - - - - - - - - - - -
      - - <%= link_to_course(membership.course) %> - - - <%= render :partial => 'courses/set_course_time', :locals => {:course => membership.course} %> - <% if (User.current == @user && (!@user.allowed_to?(:as_teacher,membership.course)))%> - <%= join_in_course(membership.course, User.current) %> - <% end %> - -      - <%= l(:label_x_base_courses_member, :count => membership.course.members.count) %> - (<%= "#{membership.course.members.count}" %>) -    - <%= l(:label_homework) %> - ( - - <%= link_to (membership.course.homework_commons.count), homework_common_index_path(:course => membership.course.id) %> - - ) -    - <%= l(:label_course_news) %> - ( - - <%= link_to (membership.course.news.count), {:controller => 'news', :action => 'index', :course_id => membership.course.id} %> - ) - -
      -

      - <%= textilizable membership.course.short_description %> -

      -
      - - <% @course = Course.find_by_extra(membership.course.extra) %> - <% unless (@course.nil? || @course.teacher.nil? || @course.teacher.name.nil?) %> - - <%= l(:label_main_teacher) %> - : <%= link_to(@course.teacher.realname, user_path(@course.teacher)) %> - - - <%= l(:label_course_term) %> - : <%= @course.time %><%= get_course_term_locales @course %> - - <% end %> -
      -
      -
    • - +<% can_edit_flag = User.current.allowed_to?(:as_teacher,item) || User.current.admin? %> +<% course_end_flag = course_endTime_timeout?(item) %> +
    -
    -<%= call_hook :view_account_left_bottom, :user => @user %> \ No newline at end of file +
    +
    + + + + + + + + + + + + + +
    主讲老师: + <%= item.teacher.show_name %> + 课程作业:<%= item.homework_commons.count %>
    学生人数:item.id,:role=>2, :host=>Setting.host_course) %>"><%= studentCount(item) %>开课学期:<%= item.time %><%= get_course_term_locales item %>
    +
    +
    + <% if(course_end_flag) %> + 课程结束 + <% elsif(can_edit_flag) %> + 发布作业 + <% else %> + 提交作品 + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/users/_show_new_score.html.erb b/app/views/users/_show_new_score.html.erb index c0e731a65..2081c38d6 100644 --- a/app/views/users/_show_new_score.html.erb +++ b/app/views/users/_show_new_score.html.erb @@ -4,7 +4,7 @@
    - +
    <%= image_tag(url_to_avatar(@user), :class => 'avatar2') %><%= image_tag(url_to_avatar(@user), :class => 'avatar2',:style=>'max-width:150px;max-height:150px;') %> diff --git a/app/views/users/_user_fans_item.html.erb b/app/views/users/_user_fans_item.html.erb new file mode 100644 index 000000000..66181d23b --- /dev/null +++ b/app/views/users/_user_fans_item.html.erb @@ -0,0 +1,50 @@ +
    + +
    + <%= item.show_name %> +
    +
    + <% if item.user_extensions && !item.user_extensions.brief_introduction.nil? && !item.user_extensions.brief_introduction.empty? %> +

    个性签名:<%= item.user_extensions.brief_introduction %>

    + <% end %> +
    <%= h @user.name %>
    + + + <% if (item.user_extensions.identity == 0 || item.user_extensions.identity == 1) && !item.user_extensions.school.nil? %> + + + <% elsif item.user_extensions.identity == 3 && !item.user_extensions.occupation.nil? && !item.user_extensions.occupation.empty? %> + + + <% elsif item.user_extensions.identity == 2 %> + + + <% end %> +
    加入时间:<%= format_date(item.created_on) %>工作单位: +
  • + <%= item.user_extensions.school.name %> +
  • +
    工作单位: +
  • + <%= item.user_extensions.occupation %> +
  • +
    工作单位: +
  • + <%= item.show_name %> +
  • +
    + + + <% if(User.current.logged? && User.current != item )%> + <%if(item.watched_by?(User.current))%> + 取消关注 + <% else %> + 添加关注 + <% end %> + <% end %> +
    + diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 496211e82..ab3bf9f73 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,661 +1,348 @@ -<% if User.current.id == @user.id %> - -
    - <%= form_tag(:controller => 'users', :action => "show") do %> - - <% end %> -<% end %> - -<%= render_flash_messages %> -<% unless @state == 2 %> - <% unless @activity.empty? %> -
    - <% @activity.each do |e| %> - <%# 以下一行代码解决有未知的活动无法转换成Model报错%> - <% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next;) if e.act_type.safe_constantize.nil? %> - <% act = e.act %> - <% unless act.nil? %> - <% if e.act_type == 'JournalsForMessage' || e.act_type == 'HomeworkCommon' || e.act_type == 'Journal'|| e.act_type == 'Changeset' || e.act_type == 'Message' || e.act_type == 'Principal' || e.act_type == 'News' || e.act_type == 'Issue' || e.act_type == 'Contest' %> - - - - - - -
    - <%= image_tag(url_to_avatar(e.user), :class => "avatar") %> - - - <% case e.act_type %> - <% when 'JournalsForMessage' %> - - - - - - - - - - <% when 'HomeworkCommon' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'Journal' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - <% if act.notes.nil? %> - <% desStr = '' %> - <% else %> - <% desStr= textAreailizable(act, :notes) %> - <% end %> - - - - - - <% when 'Changeset' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'Message' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'Principal' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'News' %> - - <% if e.user == User.current %> - - <% else %> - - <% end %> - - - - - - - - <% when 'Issue' %> - <% if e.user == User.current %> - - - - - - - - - - - <% else %> - - - - - - - - - - <% end %> - - <% when 'Contest' %> - - <% if e.user == User.current && @show_contest == 1 %> - - <% else %> - - <% end %> - - - - - - - <% else %> - <% end %> -
    - <% if User.current.login == e.user.try(:login) %> - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - <% if User.current.language == "zh" %> - - <%= l(:label_i_have_feedback) %> - <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %> - <%= l(:label_of_feedback) + l(:label_layouts_feedback) %> - - <% else %> - - <%= l(:label_i_have_feedback) %> - <%= l(:label_layouts_feedback) + l(:label_of_feedback) %> - <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %> - - <% end %> - <% else %> - - <%= link_to("#{e.user.name}", user_path(e.user_id)) %> - - <% if User.current.language == "zh" %> - - <%= l(:label_have_feedback) %> - <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %> - <%= l(:label_of_feedback) + l(:label_layouts_feedback) %> - - <% else %> - - <%= l(:label_have_feedback) %> - <%= l(:label_layouts_feedback) + l(:label_of_feedback) %> - <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %> - - <% end %> - <% end %> -
    -

    - <%= textAreailizable act.notes %> -

    - -
    - - <%= user_jour_feed_back_url e %> - -
    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - - - <%= l(:label_i_new_activity) %> - - <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), student_work_index_path(:homework => e.act_id) %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> -   - - <%= l(:label_new_activity) %> -   - <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), student_work_index_path(:homework => e.act_id) %> -
    -

    - <%= textAreailizable act, :description %> -

    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_at)).to_s %> - -
    - - - - - - - - -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to(l(:label_activity_project)+":"+act.issue.project.name, project_path(act.issue.project.id)) %> - <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), - {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to(l(:label_activity_project)+":"+act.issue.project.name, project_path(act.issue.project.id)) %> - <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), - {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %> -
    -

    - <%= desStr %> -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to format_activity_title(act.title), - {:controller => 'repositories', - :action => 'revision', - :id => act.repository.project, - :repository_id => act.repository.identifier_param, - :rev => act.identifier} %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to format_activity_title(act.title), - {:controller => 'repositories', - :action => 'revision', - :id => act.repository.project, - :repository_id => act.repository.identifier_param, - :rev => act.identifier} %> -
    -

    - <%= textAreailizable act, :long_comments %> -

    -
    -
    - - <%= format_time(e.act.committed_on) %> - -
    -
    - <%= link_to l(:label_find_all_comments), - {:controller => 'repositories', - :action => 'revision', - :id => act.repository.project, - :repository_id => act.repository.identifier_param, - :rev => act.identifier} if e.act.count!= 0 %> - - - <%= l(:label_comments_count, :count => e.act.count) %> - -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), - act.board.project ? project_boards_path(act.board.project,:topic_id => act.id) : course_boards_path(act.board.course,:topic_id => act.id), - :class => "problem_tit fl fb " %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), - {:controller => 'messages', - :action => 'show', - :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %> -
    -

    - <%= textAreailizable(act, :content) %> -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_new_user) %> - - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_user) %> - -
    -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to format_activity_title(" #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %> -
    -

    - <%= textAreailizable act, :description %> -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    - - <%= link_to l(:label_find_all_comments), {:controller => 'news', :action => 'show', :id => act.id} if e.act.comments_count!= 0 %> - - - <%= l(:label_comments_count, :count => e.act.comments_count) %> - -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> -   - <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), - {:controller => 'issues', - :action => 'show', - :id => act.id} %> -
    - <%= textAreailizable act, :description %> -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    - - <%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} if e.act.journals.count!= 0 %> - - - <%= l(:label_comments_count, :count => e.act.journals.count) %> - -
    -
    - - <%= link_to(h(e.user), user_path(e.user_id)) %> -   - - <%= l(:label_new_activity) %> -   - <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), - {:controller => 'issues', - :action => 'show', - :id => act.id} %> -
    - <%= textAreailizable act, :description %> -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    - - <%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} if e.act.journals.count!= 0 %> - - - <%= l(:label_comments_count, :count => e.act.journals.count) %> - -
    -
    - - <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> - -   - - <%= l(:label_i_new_activity) %> - -   - <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %> - - - <%= link_to(h(e.user), user_path(e.user_id)) %> - -   - - <%= l(:label_new_activity) %> - -   - <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %> -
    -

    - <%= textAreailizable act, :description %> -

    -
    -
    - - <%= (l(:label_update_time).to_s << ': ' << format_time(e.act.created_on)).to_s %> - -
    -
    -
    - - - <% end %> - <% end %> - <% end %> -
    - - <% else %> - <% if @user == User.current %> - <%= l(:label_user_activities_no) %> - <% else %> -

    - <%= l(:label_user_activities_other) %> -

    - <% end %> - <% end %> - -<% else %> - <% unless @message.empty? %> -
    - <% @message.each do |e| -%> - - - - - -
    <%= image_tag(url_to_avatar(e.user), :class => "avatar") %> - - - - - - - - - - - -
    - <%= link_to(h(e.user), user_path(e.user)) %> - <% if e.instance_of?(JournalsForMessage) %> - <% if e.reply_id == User.current.id %> - <% if e.jour_type == 'Bid' %> - <%= l(:label_in_bids) %><%= link_to(e.jour.name, respond_path(e.jour)) %> <%= l(:label_quote_my_words) %> - <% elsif e.jour_type == 'User' %> - <%= l(:label_in_users) %><%= link_to(e.jour.firstname, feedback_path(e.jour)) %> <%= l(:label_quote_my_words) %> - <% elsif e.jour_type == 'Project' %> - <%= l(:label_in_projects) %><%= link_to(e.jour.name, feedback_path(e.jour)) %> <%= l(:label_reply_plural) %> - <% end %> - <% else %> - <%= l(:label_about_requirement) %><%= link_to(e.jour.name, respond_path(e.jour_id)) %> <%= l(:label_have_respond) %> - <% end %> - <% else %> - <% if e.journal_reply.nil? || e.journal_reply.reply_id != User.current.id %> - <%= l(:label_about_issue) %><%= link_to(e.issue.subject, issue_path(e.journalized_id)) %><%= l(:label_have_respond) %> - - <% else %> - <%= l(:label_in_issues) %><%= link_to(e.issue.subject, issue_path(e.issue)) %><%= l(:label_quote_my_words) %> - <% end %> - <% end %> -
    -

    - <%= textAreailizable e.notes %> -

    -
    - - <%= format_time e.created_on %> - -
    -
    - <% end %> -
    - - - + +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +<% @center_flag = (User.current == @user) %> +<% if @center_flag %> +
    + + <% if @user.allowed_to?(:add_project, nil, :global => true) %> + 新建项目 <% else %> -

    - <%= l(:label_no_user_respond_you) %> -

    + 加入项目 <% end %> - + <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> + 新建课程 + <% else %> + + 加入课程 + <% end %> +
    +
    <% end %> - + -<% html_title(l(:label_activity)) -%> diff --git a/app/views/users/show_new_score.js.erb b/app/views/users/show_new_score.js.erb index 4baee5c04..40ef7d5c5 100644 --- a/app/views/users/show_new_score.js.erb +++ b/app/views/users/show_new_score.js.erb @@ -1,3 +1,4 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_new_score') %>'); showModal('ajax-modal', '400px'); +$('#ajax-modal').siblings().show(); $('#ajax-modal').addClass('new-watcher'); diff --git a/app/views/users/user_course_activities.html.erb b/app/views/users/user_course_activities.html.erb new file mode 100644 index 000000000..bdebee6a5 --- /dev/null +++ b/app/views/users/user_course_activities.html.erb @@ -0,0 +1,19 @@ +<% for rec in @list %> +
    + + + <%= rec[:e].name %> + + <%# if( rec[:e].is_public == false || rec[:e].is_public == 0 ) %> + + <%# end %> + + <%= rec[:item].user.show_name %> + <%= get_activity_opt(rec[:item],rec[:e]) %> + + <%= get_activity_act_showname_htmlclear(rec[:item]) %> + + <%= time_tag(get_activity_act_createtime(rec[:item])).html_safe %> +
    +<% end %> \ No newline at end of file diff --git a/app/views/users/user_courses.html.erb b/app/views/users/user_courses.html.erb index 6e0a1ca17..36e061efa 100644 --- a/app/views/users/user_courses.html.erb +++ b/app/views/users/user_courses.html.erb @@ -1,33 +1,31 @@ -<% if @user.user_extensions.identity == UserExtensions::TEACHER %> - <%= render :partial => 'my_course' %> -<% else %> - <%= render :partial => 'my_joinedcourse' %> -<% end %> - +
    + + <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> + 新建课程 + <% else %> + 加入课程 + <% end %> +
    +
    - -<% html_title(l(:label_user_course)) -%> \ No newline at end of file +
    +
    +
    +

    所有课程

    + +
    +
    + <% for item in @list %> + <%= render :partial => 'course_form', :locals => {:item => item} %> + <% end %> +

    <%= l(:label_no_data) %>

    +
    +
      + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> +
    +
    +
    \ No newline at end of file diff --git a/app/views/users/user_courses4show.html.erb b/app/views/users/user_courses4show.html.erb new file mode 100644 index 000000000..7aab1b2a5 --- /dev/null +++ b/app/views/users/user_courses4show.html.erb @@ -0,0 +1,16 @@ +<% for item in @list %> + + +<% end %> diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb index 92cc1cfb7..0b42da9f8 100644 --- a/app/views/users/user_fanslist.html.erb +++ b/app/views/users/user_fanslist.html.erb @@ -1,52 +1,25 @@ - -

    <%= l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count) %>

    -
    - <% for user in @user.watcher_users %> -
      -
    • - - - - - -
      - <%= link_to image_tag(url_to_avatar(user), :class => "avatar"),user_path(user),:title => "#{user.name}" %> - - - - - - - - - - - - - - -
      - <%= content_tag "div", link_to(user.name, user_path(user)), :class => "project_avatar_name" %> -

      - <% cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" %> - <% memberships = user.memberships.all(:conditions => cond) %> - <%= l(:label_x_contribute_to, :count => memberships.count) %> - <% for member in memberships %> - <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %> - <% end %> - -

      - <% user_courses = user_courses_list(user) %> - <%= l(:label_x_course_contribute_to, :count => user_courses.count) %> - <%= ":" unless user_courses.empty? %> - <% for course in user_courses %> - <%= link_to course.name,{:controller => 'courses',:action => 'show',id:course.id, host: Setting.host_course} %><%= (user_courses.last == course) ? '' : ',' %> - <% end %> -

      -
      <%= l(:label_user_joinin) %><%= format_date(user.created_on) %> -
      -
      -
    • -
    - <% end %> -
    \ No newline at end of file +
    +
    +
    + <% if @action == 'fans' %> +

    粉丝

    +
    共有<%=@obj_count%>名粉丝
    + <% elsif @action == 'visitor' %> +

    访客

    +
    共有<%=@obj_count%>访客
    + <% else %> +

    关注

    +
    一共关注<%=@obj_count%>
    + <% end %> +
    +
    + <% for item in @list %> + <%= render :partial => 'users/user_fans_item', :locals => {:item => item,:target=>@user} %> + <% end %> +

    <%= l(:label_no_data) %>

    +
    +
      + <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> +
    +
    +
    diff --git a/app/views/users/user_feedback4show.html.erb b/app/views/users/user_feedback4show.html.erb new file mode 100644 index 000000000..0a1fc8af2 --- /dev/null +++ b/app/views/users/user_feedback4show.html.erb @@ -0,0 +1,36 @@ +<% for item in feed_list %> +
    + + <%= image_tag url_to_avatar(item.user),:width => '27',:height => '27' %> + + <%= item.user.show_name %> + <% if item.at_user %> +  回复 + <%= item.at_user.show_name %> + <% end %> +  :  +
    <%=item.notes.html_safe%>
    + <% if JournalsForMessage.create_by_user? User.current %> + 回复 + <% end %> + <% if User.current.admin? || item.user.id == User.current.id %> + item.id,:user_id=>item.user.id) %>" data-confirm="您确定要删除吗?" data-remote="true" data-method="delete" class="fl mt5 c_purple ml5">删除 + <% end %> + <%= time_tag(item.created_on).html_safe %> +
    + +
    +<% end %> diff --git a/app/views/users/user_projects.html.erb b/app/views/users/user_projects.html.erb index 69dda693e..9c1fc4eee 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -1,66 +1,56 @@ - +
    + + <% if @user.allowed_to?(:add_project, nil, :global => true) %> + 新建项目 + <% else %> + 加入项目 + <% end %> +
    +
    - - \ No newline at end of file diff --git a/app/views/users/user_projects4show.html.erb b/app/views/users/user_projects4show.html.erb new file mode 100644 index 000000000..3c709bd5d --- /dev/null +++ b/app/views/users/user_projects4show.html.erb @@ -0,0 +1,16 @@ +<% for item in @list %> + +<% end %> diff --git a/app/views/watchers/_set_watcher.js.erb b/app/views/watchers/_set_watcher.js.erb index 3f469f5c6..da794d18b 100644 --- a/app/views/watchers/_set_watcher.js.erb +++ b/app/views/watchers/_set_watcher.js.erb @@ -1,11 +1,70 @@ +<% if( params[:object_type] == 'user') %> + <% if( params[:target_id] == params[:object_id] ) %> + <% target = User.find_by_id(params[:target_id]) %> + //btn + var btn_html = "<%= escape_javascript( render( :partial => 'layouts/user_watch_btn', :locals => {:target => target} ) )%>"; + $('#user_watch_id').replaceWith(btn_html); + //count + $("*[nh_name='fans_count']").html("<%= target.watcher_users.count.to_s %>"); + //left list + var list_left_html = "<%= escape_javascript( render( :partial => 'layouts/user_fans_list', :locals => {:user => target} ) )%>"; + $('#fans_nav_list').replaceWith(list_left_html); + //list + if( $("#nh_fans_list") != undefined && $("#nh_fans_list").length != 0 ){ + <% if( opt == 'add') %> + var list_html = "<%= escape_javascript( render( :partial => 'users/user_fans_item', :locals => {:item=>User.current,:target => target} ) )%>"; + $("#nh_fans_list").after(list_html); + $("#nodata").hide(); + <% else %> + $("#fans_item_<%= User.current.id %>",$("#nh_fans_list").parent('div')).remove(); + if( $('>div',$("#nh_fans_list").parent('div')).length == 1 ){ + $("#nodata").show(); + } + <% end %> + } + + <% elsif( params[:target_id] == User.current.id.to_s )%> + <% target = User.find_by_id(params[:target_id]) %> + <% item = User.find_by_id(params[:object_id]) %> + //count + $("*[nh_name='watcher_count']").html("<%= User.watched_by(target.id).count.to_s %>"); + //left list + var list_left_html = "<%= escape_javascript( render( :partial => 'layouts/user_watch_list', :locals => {:user => target} ) )%>"; + $('#watcher_nav_list').replaceWith(list_left_html); + //list + if( $("#nh_wacth_list") != undefined && $("#nh_wacth_list").length != 0 ){ + <% if( opt == 'delete') %> + $("#fans_item_<%= item.id %>",$("#nh_wacth_list").parent('div')).remove(); + if( $('>div',$("#nh_wacth_list").parent('div')).length == 1 ){ + $("#nodata").show(); + } + <% end %> + }else if($("#nh_fans_list") != undefined && $("#nh_fans_list").length != 0){ + var list_html = "<%= escape_javascript( render( :partial => 'users/user_fans_item', :locals => {:item=>item,:target => target} ) )%>"; + $('#fans_item_<%= item.id %>').replaceWith(list_html); + } + + <% else %> + <% target = User.find_by_id(params[:target_id]) %> + <% item = User.find_by_id(params[:object_id]) %> + //list + var list_html = "<%= escape_javascript( render( :partial => 'users/user_fans_item', :locals => {:item=>item,:target => target} ) )%>"; + $('#fans_item_<%= item.id %>').replaceWith(list_html); + <% end %> + +<% else %> + <% selector = ".#{watcher_css(watched)}" %> <% id_selector = "#{watcher_css(watched)}" %> if($("<%= selector %>").get(0) == undefined) { - $("#<%= id_selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link_for_project(watched, user) %>")}); + $("#<%= id_selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link_for_project(watched, user) %>")}); } else { - $("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link(watched, user) %>")}); + $("<%= selector %>").each(function(){$(this).replaceWith("<%= escape_javascript watcher_link(watched, user) %>")}); } +<% end %> + + diff --git a/app/views/words/create.js.erb b/app/views/words/create.js.erb index 16f26d5f7..046bc7d1d 100644 --- a/app/views/words/create.js.erb +++ b/app/views/words/create.js.erb @@ -1,9 +1,15 @@ -//$('#message').html('<#%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages,:show_name => true})) %>'); +//$('#message').html('<%#= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages,:show_name => true})) %>'); +<% if !@jour.nil? && @jour.jour_type == 'Principal' %> + var html = $("
    "+"<%= escape_javascript( render(:template => 'users/user_feedback4show',:locals => {:feed_list=>[@jour]} )) %>"+"
    "); + $("div[nhname='container']",$("#nh_messages")).prepend(html.html()); + $('#new_message_cancel_btn').click(); + var params = init_list_more_div_params($("#nh_messages")); + change_status_4_list_more_div(params); + +<% else %> $('#history').html('<%= escape_javascript(render(:partial => 'users/history',:locals => { :journals => @jour, :state => false})) %>') $('#jour_count').html('<%= @obj_count%>') $('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>'); $('#new_form_user_message').val(""); -if($('#new_message_cancel_btn') != undefined && $('#new_message_cancel_btn').length!=0){ - $('#new_message_cancel_btn').click(); -} -$('#new_form_reference_user_id').val(""); \ No newline at end of file +$('#new_form_reference_user_id').val(""); +<% end %> diff --git a/app/views/words/create_reply.js.erb b/app/views/words/create_reply.js.erb index eeb4e3ef6..8e57d7b0e 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -1,5 +1,14 @@ <% if @save_succ %> - var pre_append = $('<%= j( + <% if !@jfm.nil? && @jfm.jour_type == 'Principal' %> + var html = $("
    "+"<%= escape_javascript( render(:template => 'users/user_feedback4show',:locals => {:feed_list=>[@jfm]} )) %>"+"
    "); + $("div[nhname='container']",$("#nh_messages")).prepend(html.html()); +// $('#new_message_cancel_btn').click(); + $("a[nhname='reply_btn']",$("#nh_jours_<%= @jfm.m_reply_id %>")).click(); + var params = init_list_more_div_params($("#nh_messages")); + change_status_4_list_more_div(params); + <% else %> + + var pre_append = $('<%= j( render :partial => "words/journal_reply_items", :locals => {:reply => @jfm, :journal => @jfm.parent, :m_reply_id => @jfm,:show_name => @show_name} ) %>').hide(); @@ -12,6 +21,8 @@ textarea1.val(''); $('#course_respond_form_<%=@jfm.m_reply_id.to_s%>').hide(); setMaxLengthItem(pre_append.find('textarea')[0]); + <% end %> + <% else %> alert("<%= l(:label_feedback_fail) %>"); <% end %> \ No newline at end of file diff --git a/app/views/words/destroy.js.erb b/app/views/words/destroy.js.erb index dabd3a8c7..94f40064c 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -1,6 +1,12 @@ <% if @journal_destroyed.nil? %> alert('<%=l(:notice_failed_delete)%>'); <% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication'].include? @journal_destroyed.jour_type)%> + <% if @user && @jours_count%> + $("#nh_jours_<%= @journal_destroyed.id %>",$("div[nhname='container']",$("#nh_messages"))).remove(); + var params = init_list_more_div_params($("#nh_messages")); + change_status_4_list_more_div(params); + <% else %> + <% if @bid && @jours_count %> $('#jours_count').html("<%= @jours_count %>"); <% elsif @course && @jours_count%> @@ -12,6 +18,8 @@ destroyedItem.fadeOut(600,function(){ destroyedItem.remove(); }); + + <% end %> <% else %> $('#message').html('<%= escape_javascript(render(:partial => 'words/message', :locals => {:jour => @jour, :state => false, :user => @user, :feedback_pages => @feedback_pages})) %>'); $('#new_form_reference_user_id').val(""); diff --git a/config/locales/my/zh.yml b/config/locales/my/zh.yml index 35fd4e48a..4220aceca 100644 --- a/config/locales/my/zh.yml +++ b/config/locales/my/zh.yml @@ -31,9 +31,11 @@ zh: label_account_identity_developer: 开发者 label_account_identity_enterprise: 组织 label_account_identity_studentID: 请输入学号 - + + field_brief_introduction_my: 个人签名 + field_description: 个人简介 field_is_required: 必填 - field_firstname: 名字 + field_firstname: 名字或组织名 firstname_empty: 名字不能为空 field_firstname_eg: '(例:张三丰,请填写[三丰])' field_lastname: 姓氏 diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 7eaa33938..12797ea1f 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2026,6 +2026,7 @@ zh: label_file_lost_list: 缺失文件列表 lable_unset: 未设置 + label_chose_group: 请选择分班 diff --git a/config/routes.rb b/config/routes.rb index 0132b8fc6..6ad495a1a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -85,7 +85,7 @@ RedmineApp::Application.routes.draw do get 'alert_anonymous_comment' end collection do - + post 'next_step' end end @@ -100,6 +100,7 @@ RedmineApp::Application.routes.draw do get 'student_work_absence_penalty' get 'absence_penalty_list' get 'evaluation_list' + post 'set_program_score' end end @@ -297,6 +298,12 @@ RedmineApp::Application.routes.draw do match 'user_watchlist', :to => 'users#user_watchlist', :via => :get, :as => "user_watchlist" #add by huang match 'user_fanslist', :to => 'users#user_fanslist', :via => :get, :as => "user_fanslist" #add by huang match 'user_courses', :to => 'users#user_courses', :via => :get + match 'user_courses4show', :to => 'users#user_courses4show', :via => :get + match 'user_projects4show', :to => 'users#user_projects4show', :via => :get + match 'user_course_activities', :to => 'users#user_course_activities', :via => :get + match 'user_project_activities', :to => 'users#user_project_activities', :via => :get + match 'user_feedback4show', :to => 'users#user_feedback4show', :via => :get + match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get match 'user_homeworks', :to => 'users#user_homeworks', :via => :get match 'watch_projects', :to => 'users#watch_projects', :via => :get # added by bai @@ -340,6 +347,8 @@ RedmineApp::Application.routes.draw do match 'my/remove_block', :via => :post match 'my/order_blocks', :via => :post match 'my/change_mail_notification', via: :get + match 'my/save_user_avatar', :to => 'my#save_user_avatar', :via => [:get, :post] + match 'my/clear_user_avatar_temp', :to => 'my#clear_user_avatar_temp', :via => [:get, :post] get 'my/page2', :to => 'my#page2', :as => "my_page2" diff --git a/db/migrate/20150708025533_add_proportion_to_programing.rb b/db/migrate/20150708025533_add_proportion_to_programing.rb new file mode 100644 index 000000000..b3da59c25 --- /dev/null +++ b/db/migrate/20150708025533_add_proportion_to_programing.rb @@ -0,0 +1,9 @@ +class AddProportionToPrograming < ActiveRecord::Migration + def up + add_column :homework_detail_programings, :ta_proportion, :float, :default => 0.1 + end + + def down + remove_column :homework_detail_programings, :ta_proportion + end +end diff --git a/db/migrate/20150708085629_change_studen_work_desc.rb b/db/migrate/20150708085629_change_studen_work_desc.rb new file mode 100644 index 000000000..af3c25671 --- /dev/null +++ b/db/migrate/20150708085629_change_studen_work_desc.rb @@ -0,0 +1,9 @@ +class ChangeStudenWorkDesc < ActiveRecord::Migration + def up + change_column :student_works,:description,:text,:limit => 4294967295 + end + + def down + change_column :student_works,:description,:text + end +end diff --git a/db/migrate/20150709071731_add_question_id_to_homework.rb b/db/migrate/20150709071731_add_question_id_to_homework.rb new file mode 100644 index 000000000..d1be59431 --- /dev/null +++ b/db/migrate/20150709071731_add_question_id_to_homework.rb @@ -0,0 +1,9 @@ +class AddQuestionIdToHomework < ActiveRecord::Migration + def up + add_column :homework_detail_programings, :question_id, :integer + end + + def down + remove_column :homework_detail_programings, :question_id + end +end diff --git a/db/migrate/20150713161100_add_description_to_user_extensions.rb b/db/migrate/20150713161100_add_description_to_user_extensions.rb new file mode 100644 index 000000000..97cca4222 --- /dev/null +++ b/db/migrate/20150713161100_add_description_to_user_extensions.rb @@ -0,0 +1,9 @@ +class AddDescriptionToUserExtensions < ActiveRecord::Migration + def up + add_column :user_extensions, :description, :string, default: '' + end + + def down + remove_column :user_extensions, :description + end +end \ No newline at end of file diff --git a/db/migrate/20150714161100_create_visitors.rb b/db/migrate/20150714161100_create_visitors.rb new file mode 100644 index 000000000..2430b6002 --- /dev/null +++ b/db/migrate/20150714161100_create_visitors.rb @@ -0,0 +1,14 @@ +class CreateVisitors < ActiveRecord::Migration + def change + create_table :visitors do |t| + t.integer :user_id + t.integer :master_id + t.datetime :updated_on + t.datetime :created_on + + end + add_index "visitors", ["user_id"], :name => "index_visitors_user_id" + add_index "visitors", ["master_id"], :name => "index_visitors_master_id" + add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" + end +end \ No newline at end of file diff --git a/db/migrate/20150714162200_add_activity_container_type_to_activities.rb b/db/migrate/20150714162200_add_activity_container_type_to_activities.rb new file mode 100644 index 000000000..9effc48a2 --- /dev/null +++ b/db/migrate/20150714162200_add_activity_container_type_to_activities.rb @@ -0,0 +1,11 @@ +class AddActivityContainerTypeToActivities < ActiveRecord::Migration + def up + add_column :activities, :activity_container_id, :int + add_column :activities, :activity_container_type, :string, default: '' + end + + def down + remove_column :activities, :activity_container_type + remove_column :activities, :activity_container_id + end +end \ No newline at end of file diff --git a/db/migrate/20150715070534_create_test_result.rb b/db/migrate/20150715070534_create_test_result.rb new file mode 100644 index 000000000..4816fbcb8 --- /dev/null +++ b/db/migrate/20150715070534_create_test_result.rb @@ -0,0 +1,14 @@ +class CreateTestResult < ActiveRecord::Migration + def up + create_table :student_work_tests do |t| + t.integer :student_work_id + t.integer :homework_test_id + t.integer :result + t.timestamps + end + end + + def down + drop_table :student_work_tests + end +end diff --git a/db/migrate/20150715162300_change_activities_container_type.rb b/db/migrate/20150715162300_change_activities_container_type.rb new file mode 100644 index 000000000..0adffd66a --- /dev/null +++ b/db/migrate/20150715162300_change_activities_container_type.rb @@ -0,0 +1,13 @@ +class ChangeActivitiesContainerType < ActiveRecord::Migration + def up + activities = Activity.where("activity_container_type = ''") + activities.each do |activity| + activity.set_container_type_val + activity.save + end + end + + def down + Activity.where("activity_container_type <> ''").update_all(activity_container_type: '',activity_container_id:nil) + end +end \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 78dfb5eee..383545cf6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150702073308) do +ActiveRecord::Schema.define(:version => 20150715070534) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -586,8 +586,10 @@ ActiveRecord::Schema.define(:version => 20150702073308) do t.string "language" t.text "standard_code", :limit => 2147483647 t.integer "homework_common_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.float "ta_proportion", :default => 0.1 + t.integer "question_id" end create_table "homework_evaluations", :force => true do |t| @@ -721,16 +723,6 @@ ActiveRecord::Schema.define(:version => 20150702073308) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_details_copy", :force => true do |t| - t.integer "journal_id", :default => 0, :null => false - t.string "property", :limit => 30, :default => "", :null => false - t.string "prop_key", :limit => 30, :default => "", :null => false - t.text "old_value" - t.text "value" - end - - add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" - create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" @@ -1229,20 +1221,28 @@ ActiveRecord::Schema.define(:version => 20150702073308) do t.integer "project_id" end + create_table "student_work_tests", :force => true do |t| + t.integer "student_work_id" + t.integer "homework_test_id" + t.integer "result" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "student_works", :force => true do |t| t.string "name" - t.text "description" + t.text "description", :limit => 2147483647 t.integer "homework_common_id" t.integer "user_id" t.float "final_score" t.float "teacher_score" t.float "student_score" t.float "teaching_asistant_score" - t.integer "project_id", :default => 0 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "late_penalty", :default => 0 - t.integer "absence_penalty", :default => 0 + t.integer "project_id", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "late_penalty", :default => 0 + t.integer "absence_penalty", :default => 0 end create_table "student_works_evaluation_distributions", :force => true do |t| diff --git a/public/images/pic_uersall.png b/public/images/pic_uersall.png new file mode 100644 index 000000000..6f94640e3 Binary files /dev/null and b/public/images/pic_uersall.png differ diff --git a/public/javascripts/course.js b/public/javascripts/course.js index c8e3b533e..db1f761f2 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -394,6 +394,7 @@ function show_bid_dead_line(year,month,day,divname) + "" + "

    作品提交还剩:

    "); } + //验证新建作业的名字 function regex_homework_name() { @@ -414,6 +415,7 @@ function regex_homework_name() //验证匿评数量 function regex_evaluation_num() { + if($("#evaluation_num").length == 0){ return true;} var evaluation_num = $.trim($("#evaluation_num").val()); var regex = /^\d+$/; if(evaluation_num=="") @@ -471,15 +473,18 @@ $(function(){ }); //第一次加载时,如果未开启匿评作业,隐藏显示匿评配置信息 $(function(){ - if($("#homework_common_homework_type").attr("checked") == "checked") + if($("#homework_common_homework_type").attr("id") != null && $("#homework_common_homework_type").val() != 2) { - $("#evaluation_setting").show(); - $("#ta_proportion").removeAttr("disabled"); - } - else - { - $("#evaluation_setting").hide(); - $("#ta_proportion").attr("disabled","disabled"); + if($("#homework_common_homework_type").attr("checked") == "checked") + { + $("#evaluation_setting").show(); + $("#ta_proportion").removeAttr("disabled"); + } + else + { + $("#evaluation_setting").hide(); + $("#ta_proportion").attr("disabled","disabled"); + } } }); @@ -501,6 +506,25 @@ function submit_homework(id) } } +//增加测试结果 +function add_programing_test(obj) { + var now = new Date().getTime(); + obj.after("
  • " + + "
  • " + + "
  • " + + "" + + "测试
  • "); +} +//删除测试结果 +function remove_programing_test(obj) { + if(obj.siblings("div").length == 0){ + alert("至少需要一组测试"); + } + else{ + obj.remove(); + } +} + function show_window (id1,id2,top,left) { $('#'+ id1).css('top',top); $('#'+ id1).css('left',left); @@ -837,14 +861,14 @@ function clickOK(path) }); } //查询 -function SearchByName(obj,url,event) +function SearchByName(name,group,url,event) { var keycode = (event.keyCode ? event.keyCode : event.which); if(keycode == '13'){ - location.href = url + "&name=" + obj.val(); + location.href = url + "&name=" + name + "&group=" + group; } } -function SearchByName_1(obj,url) +function SearchByName_1(name,group,url) { - location.href = url + "&name=" + obj.val(); + location.href = url + "&name=" + name + "&group=" + group; } diff --git a/public/javascripts/header.js b/public/javascripts/header.js index e27f758d3..06748d726 100644 --- a/public/javascripts/header.js +++ b/public/javascripts/header.js @@ -1,11 +1,15 @@ function addSlipMenu () { - var loggedas = $('#current_user_li:first'); + var loggedas = $('#current_user_li a:first'); var sub_menu = $('#user_sub_menu'); - loggedas.mouseenter(function(event) { + loggedas.mouseenter(function() { sub_menu.show(); + $('#my_projects_ul').hide(); + $('#my_courses_ul').hide(); }); - sub_menu.mouseleave(function(event) { + sub_menu.mouseleave(function() { sub_menu.hide(); + $('#my_projects_ul').hide(); + $('#my_courses_ul').hide(); }); } @@ -13,24 +17,26 @@ function addProjectSlipMenu () { var loggedas = $('#my_projects_li'); var project_sub_menu = $('#my_projects_ul'); var course_sub_menu = $('#my_courses_ul'); - loggedas.mouseenter(function(event) { + loggedas.mouseenter(function() { course_sub_menu.hide(); project_sub_menu.show(); }); - loggedas.mouseleave(function(event) { + loggedas.mouseleave(function() { project_sub_menu.hide(); + course_sub_menu.hide(); }); } function addCourseSlipMenu () { var loggedas = $('#my_courses_li'); var project_sub_menu = $('#my_projects_ul'); var course_sub_menu = $('#my_courses_ul'); - loggedas.mouseenter(function(event) { + loggedas.mouseenter(function() { project_sub_menu.hide(); course_sub_menu.show(); }); - loggedas.mouseleave(function(event) { + loggedas.mouseleave(function() { course_sub_menu.hide(); + project_sub_menu.hide(); }); } diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index 41514ab12..abeec52d3 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -30,6 +30,10 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;} .box_h3{ color:#15bccf; text-align:center; font-size:16px;} .box_p{ color:#404040; margin-bottom:5px;} .fb_item{ color:#919191; border:1px solid #919191; height:28px; margin-bottom:10px; padding-left:5px; width:290px;} +a.icon_addm{ background:url(../images/img_floatbox.png) 0 -33px no-repeat; width:16px; height:16px; display:block; margin:5px 0 0 5px;} +a:hover.icon_addm{background:url(../images/img_floatbox.png) 0 -61px no-repeat; } +a.icon_removem{ background:url(../images/img_floatbox.png) -22px -33px no-repeat;width:16px; height:16px; display:block; margin:5px 0 0 5px} +a:hover.icon_removem{background:url(../images/img_floatbox.png) -22px -61px no-repeat;} a.btn_free{ background:#ff5722; display:block; width:80px; text-align:center; color:#fff; height:26px; padding-top:3px; margin-bottom:10px;} a:hover.btn_free{ background:#d63502;} /*成员邀请*/ @@ -338,7 +342,6 @@ a:hover.st_add{ color:#ff8e15;} .upbtn{ margin:40px 0 0 15px; display:block; padding:2px 5px; border:1px solid #eaeaea;} .upbtn:hover{border:1px solid #64bdd9; color:#64bdd9;cursor: pointer;} .upload_file{margin-left: -60px;margin-top: 40px;width: 50px;position: absolute;height: 24px;opacity: 0;cursor: pointer} - /* 功能倒计时*/ .w_img{ float:left; margin:10px 10px 15px 0px;} .w_p{ float:left; color:#15bccf; font-size:16px; font-weight:bold; margin-top:70px; } @@ -349,7 +352,9 @@ a:hover.st_add{ color:#ff8e15;} .upload_con h2{ display:block; background:#eaeaea; font-size:14px; color:#343333; height:31px; width: auto; margin-top:25px; padding-left:20px; padding-top:5px;} .upload_box{ width:430px; margin:15px auto;} +a.link_file{ background:url(../images/pic_file.png) 0 2px no-repeat; padding-left:20px; } a:hover.link_file{ background:url(../images/pic_file.png) 0 -25px no-repeat; color:#3ca5c6;} +.r_txt_tit{width:510px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#09658c; font-size:14px;} blockquote {background: #eeeeee;padding: 10px;margin-bottom: 10px;word-break: break-all;word-wrap: break-word;} .respond-form{display: none;margin: auto;clear: both;} @@ -561,8 +566,8 @@ a.files_tag_select{ background:#64bdd9; color:#fff; border:1px solid #64bdd9; pa .hwork_new_left{ width:220px; float:left; } .hwork_new_right{ width:350px; float:left; margin-left:40px;} .w305{ width:305px;} -.icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;} -a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;} +.icon_add{ background:url(../stylesheets/images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;} +a:hover.icon_add{background:url(../stylesheets/images/icons.png) -20px -310px no-repeat;} /* 20150505讨论区*/ .w664{ width:664px;} @@ -598,10 +603,12 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} /*.talk_new{ border-bottom:1px dashed #d9d9d9; padding-bottom:10px;}*/ #about_newtalk{ display:none;} +/* 20150423作业评分*/ .ml14{ margin-left:14px;} .w548{ width:552px;} .w547{ width:544px;} .w196{ width:196px;} +.w186{ width:186px;} .w459{ width:459px;} .hwork_new_set{border:1px dashed #CCC; background:#f5f5f5; text-align:center; padding:10px 0; margin-bottom:10px;} .hwork_new_grey{background:#dbdbdb; width:610px; padding:10px 20px; margin:0 auto; text-align:left; margin-bottom:5px;} @@ -610,6 +617,8 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} .w305{ width:305px;} .icon_add{background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;} a:hover.icon_add{background:url(images/icons.png) -20px -310px no-repeat;} +.icon_remove{background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:left;} +a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;} /* 20150506上传头像*/ .uppicBox{ width:265px; height:265px; background:#f2f2f5; float:left; color:#666; text-align:center;} @@ -656,6 +665,7 @@ a:hover.ping_pic{border:1px solid #64bdd9;} a.down_btn{ border:1px solid #CCC; color:#999; padding:0px 5px; font-size:12px; text-align:center; display:block;} a:hover.down_btn{ background:#14ad5a; color:#fff; border:1px solid #14ad5a;} .fr{ float:right;} +.min_search{ width:140px; height:20px; border:1px solid #d0d0d0; color:#666; background:url(../images/public_icon.png) 185px -193px no-repeat; } .li_min_search{ float:right; margin-right:-10px;} .info_ni_download{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 200px;margin-top: 10px;} .info_ni{ width:100px; padding:5px;position: absolute;display:none;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left;margin-left: 50px;margin-top: -5px;} @@ -674,6 +684,12 @@ input#score{ width:40px;} .ui-slider .ui-slider-handle:hover,.ui-slider .ui-slider-handle:focus{background:#64bdd9;} .ui-slider .ui-slider-handle:active{background-image:none;} .ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;top:0;height:100%;background:#64bdd9;left:0;} +/* 编程作品 */ +.border_ce{ border:1px solid #e4e4e4; } +.border_ce tr td{ height:26px; } +.td_tit{width:155px; text-align:center;} +.td_50{width:50px; text-align:center;} +a.work_list_tit{width:610px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} .filename { background: url(../images/pic_file.png) 0 -25px no-repeat;color: #3ca5c6;max-width: 150px;border: none; padding-left: 20px;margin-right: 10px;margin-bottom: 5px; white-space: nowrap; text-overflow:ellipsis;} .evaluation{position: relative;} diff --git a/public/stylesheets/leftside_new.css b/public/stylesheets/leftside_new.css new file mode 100644 index 000000000..c2d4d043c --- /dev/null +++ b/public/stylesheets/leftside_new.css @@ -0,0 +1,67 @@ +.topbar_info02{ margin:5px 10px;width:480px; } +.topbar_info02 p{color: #7f7f7f;} +.search{ margin-top:8px; float:right; margin-right:5px;} +/*信息*/ +.project_info{ background:#fff; padding:10px; padding-right:0px;width:222px; padding-right:8px; margin-bottom:10px;} +.pr_info_id{ width:137px; color:#5a5a5a; font-size:14px; margin-top:5px;} +.pr_info_logo{ border:1px solid #eaeaea; width:60px; height:60px; padding:1px;} +.pr_info_logo:hover{ border:1px solid #64bdd9; } +.pr_info_join{} +a.pr_join_a{ color:#fff; display:block; padding:0 5px 0 3px; padding-top:2px; height:20px; margin-right:5px; float:left; text-align:center; background-color:#64bdd9; float:left; } +a:hover.pr_join_a{ background:#41a8c8;} +.pr_join_span{color: #fff; display:block; padding:0 5px; padding-top:2px; height:20px; margin-right:5px; float:left; text-align:center; background: #CCC;} +.pr_setting{ display:block; background:url(../images/leftside.png) -1px 0 no-repeat; width:11px; height:11px; margin-top:3px; float:left; } +.pr_copy{ display:block; background:url(../images/leftside.png) -1px -23px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } +.pr_close{ display:block; background:url(../images/leftside.png) -1px -49px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } +.pr_add{display:block; background:url(../images/leftside.png) 0px -71px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } +.pr_arrow{display:block; background:url(../images/leftside.png) 0px -90px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } +.pr_info_name{ color:#3e4040; font-size:14px; line-height:1.5;} +.pr_info_name:hover{ color:#3ca5c6;} +.pr_info_score{ font-size:14px; color:#3e4040; } +.pr_info_score a{ color:#ff7143;} +.pr_info_score a:hover{ color:#64bdd9;} + +.img_private{ background:url(../images/new_project/img_project.png) 0 0 no-repeat; width:33px; height:16px; color:#fff; font-size:12px; padding-left:7px; } +/*.img_private{ background:url(../images/project/img_project.png) 0 0 no-repeat; width:33px; height:16px; color:#fff; font-size:12px; padding-left:7px; }*/ +.info_foot_num{ color:#3ca5c6; } +.pr_info_foot{ color:#7f7f7f; margin-top:5px; } +.info_foot_num:hover{ color:#2390b2;} +.info_box{background:#fff; padding:10px;width:220px; } +.info_box ul li{ font-size:12px; color: #3e4040; line-height:1.7;} + +/*左侧导航*/ +.subNavBox{width:240px; background:#fff;margin:10px 10px 0 0;} +.subNav{border-bottom:solid 1px #e5e3da;cursor:pointer;font-weight:bold;font-size:14px;color:#3ca5c6; height:26px;padding-left:10px;background-color:#fff; padding-top:2px;} +.subNav_jiantou{background:url(../images/jiantou1.jpg) no-repeat;background-position:95% 50%; background-color:#fff;} +.subNav_jiantou:hover{color:#0781b4; } +.currentDd{color:#0781b4;} +.currentDt{background-color:#fff;} +.navContent{display: none;border-bottom:solid 1px #e5e3da; } +.navContent li a{display:block;width:240px;heigh:28px;text-align:center;font-size:12px;line-height:28px;color:#333} +.navContent li a:hover{color:#fff;background-color:#b3e0ee} +a.subnav_num{ font-weight:normal; color:#ff7143; font-size:12px;} +a.subnav_green{ background:#28be6c; color:#fff; font-size:12px; font-weight:normal;height:18px; padding:0px 5px; padding-top:2px; display:block; margin-top:2px; margin-bottom:5px; float:right; margin-right:5px;} +a:hover.subnav_green{ background:#14ad5a;} + + +/*简介*/ +.project_intro{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; color:#6d6d6d; line-height:1.9;} +.course_description{max-height: 112px;overflow:hidden; word-break: break-all;word-wrap: break-word;} +.course_description_none{max-height: none;} +.lg-foot{ border:1px solid #e8eef2; color: #929598; text-align:center; width:220px; height:23px; cursor:pointer;} +.lg-foot:hover{ color:#787b7e; border:1px solid #d4d4d4;} +/****标签(和资源库的tag样式一致)***/ +.project_Label{ width:220px; padding:10px; background:#fff; margin-top:10px; padding-top:5px; margin-bottom:10px;} +a.yellowBtn{ display:inline-block;color:#0d90c3; height:22px;} +.submit{height:21px;border:0; cursor:pointer; background:url(../images/btn.png) no-repeat 0 0;width:42px; margin-top:2px; margin-left:3px; } +.isTxt{background:#fbfbfb url(../images/inputBg.png) repeat-x left top;height:22px;line-height:22px;border:1px solid #c1c1c1;padding:0 5px;color:#666666;} +.re_tag{ width: auto; padding:0 5px; padding-top:2px; height:20px; border:1px solid #f8df8c; background:#fffce6; margin-right:5px; } +.re_tag a{ color:#0d90c3;} +.tag_h{ } +.tag_h span,.tag_h a{ margin-bottom:5px;} + + + + + + diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 27792347a..8e16c9436 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -79,6 +79,7 @@ h4{ font-size:14px; color:#3b3b3b;} .mr50{margin-right: 50px;} .mr55{margin-right: 55px;} .mr70{margin-right: 70px;} +.mt1{margin-top: 1px;} .mt3{ margin-top:3px;} .mt5{ margin-top:5px;} .mt8{ margin-top:8px;} @@ -109,6 +110,7 @@ h4{ font-size:14px; color:#3b3b3b;} .w350{ width:350px;} .w610{ width:610px;} .w600{ width:600px;} +.h20{height: 20px;} .h22{ height:22px;} .h26{ height:26px;} .h50{ height:50px;} @@ -166,6 +168,7 @@ a.green_btn{background:#28be6c;color:#fff;font-size:14px; font-weight:normal; pa a:hover.green_btn{ background:#14ad5a;} .blue_btn{ background:#64bdd9; color:#fff; font-size:14px; font-weight:normal;padding:2px 10px; text-align:center;} a.blue_btn{background:#64bdd9;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center;} +a.orange_btn_homework{background:#d63502;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center;} a:hover.blue_btn{ background:#329cbd;cursor: pointer;} a.orange_btn{ background:#ff5722;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center; } a:hover.orange_btn{ background:#d63502;} diff --git a/public/stylesheets/public_new.css b/public/stylesheets/public_new.css new file mode 100644 index 000000000..428da5712 --- /dev/null +++ b/public/stylesheets/public_new.css @@ -0,0 +1,432 @@ +/* CSS Document */ +/* 2015-06-26 */ +body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{ margin:0; padding:0;} +body,table,input,textarea,select,button { font-family: "微软雅黑","宋体"; font-size:12px;line-height:1.5; background:#eaebec;} +div,img,tr,td,table{ border:0;} +table,tr,td{border:0;cellspacing:0; cellpadding:0;} +ol,ul,li{ list-style-type:none} +a:link,a:visited{color:#7f7f7f;text-decoration:none;} +a:hover,a:active{color:#000;} + +/*常用*/ +select,input,textarea{ border:1px solid #64bdd9; background:#fff; color:#000; padding-left:5px; } +.sub_btn{ cursor:pointer; -moz-border-radius:3px; -webkit-border-radius:3px; border:1px solid #707070; color:#000; border-radius:3px; padding:1px 10px; background:#dbdbdb;} +.sub_btn:hover{ background:#b5e2fa; color:#000; border:1px solid #3c7fb1;} +table{ background:#fff;} +.more{ font-weight:normal; color:#999; font-size:12px;} +.no_line{ border-bottom:none;} +.line{border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;} +.no_border{ border:none;background:none;} +.min_search{ width:150px; height:20px; border:1px solid #d0d0d0; color:#666; background:url(../images/public_icon.png) 135px -193px no-repeat; cursor:pointer;} + +/* font & color */ +h2{ font-size:18px; color:#15bccf;} +h3{ font-size:14px; color:#e8770d;} +h4{ font-size:14px; color:#3b3b3b;} +.f12{font-size:12px; font-weight:normal;} +.f14{font-size:14px;} +.f16{font-size:16px;} +.f18{font-size:18px;} +.fb{font-weight:bold;} +.lh20{line-height:20px;} +.lh22{line-height:22px;} +.lh24{line-height:24px;} +.lh26{line-height:26px;} +.fmYh{font-family:"MicroSoft Yahei";} +.font999{ color:#999;} +.fontRed{color:#770000;} +.text_c{ text-align:center;} + +/* Float & Clear */ +.cl{ clear:both; overflow:hidden; } +.fl{float:left;display:inline;} +.fr{float:right;display:inline;} +.f_l{ float:left;} +.f_r{ float:right;} +.clearfix:after{clear:both;content:".";display:block;font-size:0;height:0;line-height:0;visibility:hidden} +.clearfix{clear:both;zoom:1} +.break_word{ word-break:break-all; word-wrap: break-word;} +.white_space{white-space:nowrap;} + +/* Spacing */ +.ml2{ margin-left:2px;} +.ml3{ margin-left:3px;} +.ml4{ margin-left:4px;} +.ml5{ margin-left:5px;} +.ml8{ margin-left:8px;} +.ml10{ margin-left:10px;} +.ml15{ margin-left:15px;} +.ml20{ margin-left:20px;} +.ml40{ margin-left:40px;} +.ml45{ margin-left:45px;} +.ml55{ margin-left:55px;} +.ml30{ margin-left:30px;} +.ml60{ margin-left:60px;} +.ml80{ margin-left:80px;} +.ml90{ margin-left:90px;} +.ml100{ margin-left:100px;} +.ml110{ margin-left:110px;} +.mr5{ margin-right:5px;} +.mr10{ margin-right:10px;} +.mr20{ margin-right:20px;} +.mr30{ margin-right:30px;} +.mr40{ margin-right:40px;} +.mt3{ margin-top:3px;} +.mt5{ margin-top:5px;} +.mt8{ margin-top:8px;} +.mt10{ margin-top:10px;} +.mb5{ margin-bottom:5px;} +.mb10{ margin-bottom:10px;} +.mb20{ margin-bottom:20px;} +.pl15{ padding-left:15px;} +.w20{ width:20px;} +.w60{ width:60px;} +.w70{ width:70px;} +.w90{ width:90px;} +.w210{ width:210px;} +.w150{ width:150px;} +.w280{ width:280px;} +.w430{ width:470px;} +.w520{ width:520px;} +.w543{ width:543px;} +.w557{ width:557px;} +.w583{ width:583px;} +.w350{ width:350px;} +.w610{ width:610px;} +.w600{ width:600px;} +.h22{ height:22px;} +.h26{ height:26px;} +.h50{ height:50px;} +.h70{ height:70px;} +.h150{ height:150px;} + +/* Font & background Color */ +a.b_grey{ background: #F5F5F5;} +a.b_dgrey{ background: #CCC;} +a.c_orange{color:#ff5722;} +a:hover.c_orange{color: #d33503;} +a.c_lorange{color:#ff9900;} +a:hover.c_lorange{color:#fff;} +a.c_blue{ color:#15bccf;} +a.c_dblue{ color:#09658c;} +a:hover.c_dblue{ color:#15bccf;} +a.c_white{ color:#fff;} +a.c_dorange{ color:#fd6e2a;} +a.c_dark{color: #3e4040;} +a:hover.c_dark{color: #3ca5c6;} +a.b_blue{background: #64bdd9;} +a:hover.b_blue{background: #41a8c8;} +a.b_green{background:#28be6c;} +a:hover.b_green{background:#14ad5a;} +a.c_blue02{color: #3ca5c6;} +a:hover.c_blue02{color: #0781b4;} +a.c_red{ color:#F00;} +a:hover.c_red{ color: #C00;} +a.c_purple{color: #426e9a;} +a:hover.c_purple{color: #d33503;} +a.c_green{ color:#28be6c;} + +.b_grey{ background: #F5F5F5;} +.b_dgrey{ background: #CCC;} +.c_orange{color:#e8770d;} +.c_dark{ color:#2d2d2d;} +.c_lorange{ color:#ff9900;} +.c_purple{color: #6883b6;} +.c_blue{ color:#15bccf;} +.c_red{ color:#F00;} +.c_green{ color:#28be6c;} +.c_dblue{ color:#09658c;} +.b_blue{background:#64bdd9;} +.b_green{background:#28be6c;} +.b_w{ background:#fff;} + +/* commonBtn */ +.grey_btn{ background:#d9d9d9; color:#656565;font-size:14px; font-weight:normal; text-align:center;padding:2px 10px;} +a.grey_btn{ background:#d9d9d9; color:#656565;font-size:14px; font-weight:normal; text-align:center;padding:2px 10px;} +a:hover.grey_btn{ background:#717171; color:#fff;} +.grey_n_btn{ background:#d9d9d9; color:#656565; font-weight:normal;padding:2px 10px; text-align:center;} +a.grey_n_btn{background:#d9d9d9; color:#656565;font-weight:normal; padding:2px 10px; text-align:center;} +a:hover.grey_n_btn{ background:#717171; color:#fff;} +.green_btn{ background:#28be6c; color:#fff; font-size:14px; font-weight:normal;padding:2px 10px; text-align:center;} +a.green_btn{background:#28be6c;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center;} +a:hover.green_btn{ background:#14ad5a;} +.blue_btn{ background:#64bdd9; color:#fff; font-size:14px; font-weight:normal;padding:2px 10px; text-align:center;} +a.blue_btn{background:#64bdd9;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center;} +a:hover.blue_btn{ background:#329cbd;} +a.orange_btn{ background:#ff5722;color:#fff;font-size:14px; font-weight:normal; padding:2px 10px; text-align:center; } +a:hover.orange_btn{ background:#d63502;} + +.green_u_btn{border:1px solid #3cb761; padding:2px 10px; color:#3cb761;} +a.green_u_btn{border:1px solid #3cb761; padding:2px 10px; color:#3cb761;} +a:hover.green_u_btn{ background:#3cb761; color:#fff;} +.orange_u_btn{border:1px solid #ff5d31; padding:2px 10px; color:#ff5d31;} +a.orange_u_btn{border:1px solid #ff5d31; padding:2px 10px; color:#ff5d31;} +a:hover.orange_u_btn{background:#ff5d31; color:#fff;} +.bgreen_u_btn{border:1px solid #1abc9c; padding:2px 10px; color:#1abc9c;} +a.bgreen_u_btn{border:1px solid #1abc9c1; padding:2px 10px; color:#1abc9c;} +a:hover.bgreen_u_btn{background:#1abc9c; color:#fff;} +.blue_u_btn{border:1px solid #64bdd9; padding:2px 10px; color:#64bdd9;} +a.blue_u_btn{border:1px solid #64bdd9; padding:2px 10px; color:#64bdd9;} +a:hover.blue_u_btn{background:#64bdd9; color:#fff;} +.blue_n_btn{ background:#64bdd9; color:#fff; font-weight:normal;padding:2px 10px; text-align:center;} +a.blue_n_btn{background:#64bdd9;color:#fff;font-weight:normal; padding:2px 10px; text-align:center;} +a:hover.blue_n_btn{ background:#329cbd;} +.green_n_btn{background:#3cb761; padding:2px 10px; color:#fff;} +a.green_n_btn{background:#3cb761; padding:2px 10px; color:#fff;} +a:hover.green_n_btn{ background:#14ad5a;} +.orange_n_btn{background:#ff5d31; padding:2px 10px; color:#fff;} +a.orange_n_btn{background:#ff5d31; padding:2px 10px; color:#fff;} +a:hover.orange_n_btn{background:#d63502;} +.bgreen_n_btn{background:#1abc9c; padding:2px 10px; color:#fff;} +a.bgreen_n_btn{background:#1abc9c; padding:2px 10px; color:#fff;} +a:hover.bgreen_n_btn{background:#08a384;} + +.nolink_btn{ background:#BCBCBC; color: #fff; padding:2px 5px;} +.more_btn{-moz-border-radius:3px; -webkit-border-radius:3px; border:1px solid #9DCEFF; color:#9DCEFF; border-radius:3px; padding:0px 3px;} +.upbtn{ margin:42px 0 0 10px; border:none; color:#999; width:150px;} +.red_btn_cir{ background:#e74c3c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} +.green_btn_cir{ background:#28be6c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} +.blue_btn_cir{ background:#3498db; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;} +.orange_btn_cir{ background:#e67e22; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} +.bgreen_btn_cir{ background:#1abc9c; padding:1px 10px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal; font-size:12px;} +/* commonpic */ +.pic_date{ display:block; background:url(../images/public_icon.png) -31px 0 no-repeat; width:16px; height:15px; float:left;} +.pic_add{ display:block; background:url(../images/public_icon.png) -31px -273px no-repeat; width:16px; height:15px; float:left;} +.pic_sch{ display:block; background:url(../images/public_icon.png) -31px -195px no-repeat; width:16px; height:15px; float:left;} +.pic_mes{ display:block; background:url(../images/public_icon.png) 0px -376px no-repeat; width:20px; height:15px; padding-left:18px;} +.pic_img{ display:block; background:url(../images/public_icon.png) -31px -419px no-repeat; width:20px; height:15px; } +.pic_del{ display:block; background:url(../images/public_icon.png) 0px -235px no-repeat; width:20px; height:15px; } +.pic_del:hover{ background:url(../images/public_icon.png) -32px -235px no-repeat; } +.pic_stats{display:block; background:url(../images/public_icon.png) 0px -548px no-repeat; width:20px; height:15px;} +.pic_files{display:block; background:url(../images/public_icon.png) 0px -578px no-repeat; width:20px; height:15px;} +.pic_text{display:block; background:url(../images/public_icon.png) 0px -609px no-repeat; width:20px; height:18px;} +.pic_text02{display:block; background:url(../images/public_icon.png) 0px -642px no-repeat; width:20px; height:19px;} +.pic_edit{display:block; background:url(../images/public_icon.png) 0px -32px no-repeat; width:20px; height:15px;} +.pic_edit:hover{display:block; background:url(../images/public_icon.png) -32px -32px no-repeat; width:20px; height:15px;} + + + + + +/*框架主类容*/ +#Container{ width:1000px; margin:0 auto; } + +/*头部导航*/ +#Header{ margin:10px 0; background:#15bccf; height:40px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; } +.logo{ margin:5px 10px; } +#TopNav{} +#TopNav ul li{ margin-top:8px;} +.topnav_a a{ font-size:14px; font-weight:bold; color:#fff; margin-right:10px;} +.topnav_a a:hover{color: #a1ebff;} +#TopUser{} +#TopUser ul li{ margin-top:8px;} +.topuser_a a{ font-size:14px; font-weight:bold; color:#fff; margin-right:10px;} +.topuser_a a:hover{color: #a1ebff;} +#TopUser02{ } +#TopUser02 li{ float: left;} +#TopUser02 li a{ margin-right:10px;color: #FFF;text-align: center;} +#TopUser02 li a:hover{color: #a1ebff;} +#TopUser02 div{ position: absolute;visibility: hidden;background:#fff;border: 1px solid #15bccf;} +#TopUser02 div a{position: relative;display: block;white-space: nowrap;text-align: left; line-height:1.9; margin-left:5px;background: #fff;color:#15bccf; font-weight:normal;} +#TopUser02 div a:hover{ color:#e8770d; font-weight: bold;} +/*头部导航下拉*/ +div#menu {height:41px; font-size:14px; font-weight:bold; } +div#menu ul {float: left;} +div#menu ul.menu { padding-left: 30px; } +div#menu li {position: relative; z-index: 9; margin: 0; display: block; float: left; } +div#menu li:hover>ul { left: -2px;} +div#menu a {position: relative;z-index: 10; height: 41px; display: block; float: left;line-height: 41px; text-decoration: none; font-size:14px; } +div#menu a:hover, div#menu a:hover span { color: #a1ebff; } +div#menu li.current a {} +div#menu {display: block; cursor: pointer; background-repeat: no-repeat;background-position: 95% 0;padding-right: 15px; _padding-right: 20px;} +div#menu ul a.parent {background: url(../images/item.png) -20px -30px no-repeat; width:60px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +div#menu ul a.parent:hover {background: url(../images/item.png) -20px -60px no-repeat;} +div#menu ul ul a.parent {background: url(../images/item.png) -20px 6px no-repeat;} +div#menu ul ul a.parent:hover {background: url(../images/item.png) -20px -11px no-repeat;} +/* menu::level1 */ +div#menu a { padding: 5px 12px 0 10px;line-height: 30px; color: #fff;} +div#menu li { background: url(images/main-delimiter.png) 98% 4px no-repeat; } +div#menu li.last { background: none; } +/* menu::level2 */ +div#menu ul ul li { background: none; } +div#menu ul ul { position: absolute;top: 38px; left: -999em; width: 90px; padding: 5px 0 0 0; background:#fff; border:1px solid #15bccf; margin-top:1px;} +div#menu ul ul a {padding: 0 0 0 15px; height: auto; float: none;display: block; line-height: 24px; font-size:12px; font-weight:normal;color:#15bccf;} +div#menu ul ul a:hover { color:#ff9900;} +div#menu ul ul li.last { margin-left:15px; } +div#menu ul ul li {width: 100%;} +/* menu::level3 */ +div#menu ul ul ul {padding: 0;margin: -38px 0 0 92px !important; width:140px; } +div#menu ul ul ul li a{ width:125px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf;} + +/*主类容*/ +#Main{ background:#fff; margin-bottom:10px;} +#content{} +#content02{ background:#fff; padding:10px; margin-bottom:10px;} +/*主类容搜索*/ +#TopBar{ height:60px; margin-bottom:10px; background:#fff;} +.topbar_info02{ margin:5px 10px;width:480px; } +.topbar_info02 p{color: #7f7f7f;} +.search{ margin-top:8px; margin-left:71px;} +.search_form{margin-top:8px;margin-left:72px;} +.topbar_info{ width:350px; color:#5c5c5c; font-size:16px; margin-right:50px; line-height:1.3; padding-left:100px;} +a.search_btn{ display:block; background:#15bccf; color:#fff; width:60px; height:24px; text-align:center; padding-top:3px;} +a:hover.search_btn{ background: #0fa9bb;} +.search_text{ border:1px solid #15bccf; background:#fff; width:220px; height:25px; padding-left:5px; } +/*主类容左右分栏*/ +#LSide{ width:240px; } +#RSide{ width:730px; margin-left:10px; background:#fff; padding:10px; margin-bottom:10px;} + + +/*底部*/ +#Footer{ padding-top:10px; background:#fff; margin-bottom:10px;} +.copyright{ width:780px; margin:0 auto;height:30px; } +.footlogo{ width:580px; margin:0 auto;height:50px; } +/*意见反馈*/ +html{ overflow-x:hidden;} +.scrollsidebar{ position: fixed; bottom:1px; right:1px; background:none; } +.side_content{width:154px; height:auto; overflow:hidden; float:left; } +.side_content .side_list {width:154px;overflow:hidden;} +.show_btn{ width:0; height:112px; overflow:hidden; float:left; margin-top:190px;cursor:pointer;} +.show_btn span { display:none;} +.close_btn{width:24px;height:24px;cursor:pointer;} +.side_title,.side_bottom,.close_btn,.show_btn {background:url(../images/sidebar_bg.png) no-repeat; } +.side_title {height:35px;} +.side_bottom { height:8px;} +.side_center {font-family:Verdana, Geneva, sans-serif; padding:0px 12px; font-size:12px;} +.close_btn { float:right; display:block; width:21px; height:16px; margin:9px 10px 0 0; _margin:16px 5px 0 0;} +.close_btn span { display:none;} +.side_center .custom_service p { text-align:center; padding:6px 0; margin:0; vertical-align:middle;} +.msgserver { margin-top:5px;} +/*.msgserver a { background:url(../images/sidebar_bg.png) no-repeat -119px -112px; padding-left:22px; height:21px; display:block; }*/ +.msgserver a { height:21px; display:block; } +.opnionText{box-shadow:none; width:122px; height:180px; border-color: #DFDFDF; background:#fff; color:#999; padding:3px; font-size:12px;overflow:auto; background-attachment:fixed;border-style:solid;} +a.opnionButton{ display:block; background:#15bccf; width:130px; height:23px; margin-top:5px; text-align:center; padding-top:3px;} +a:hover.opnionButton{background: #0fa9bb; } +/* blue skin as the default skin */ +.side_title {background-position:-195px 0;} +.side_center {background:url(../images/blue_line.png) repeat-y center; } +.side_bottom {background-position:-195px -50px;} +a.close_btn {background-position:-44px 0;} +a:hover.close_btn {background-position:-66px 0;} +.show_btn {background-position:-119px 0;} +.msgserver a {color:#15bccf; } +.msgserver a:hover { text-decoration:underline; } + + +/***** Ajax indicator ******/ +#ajax-indicator { + position: absolute; /* fixed not supported by IE */ + background-color:#eee; + border: 1px solid #bbb; + top:35%; + left:40%; + width:20%; + font-weight:bold; + text-align:center; + padding:0.6em; + z-index:100000; + opacity: 0.5; +} + +html>body #ajax-indicator { position: fixed; } + +#ajax-indicator span { + background-position: 0% 40%; + background-repeat: no-repeat; + background-image: url(../images/loading.gif); + padding-left: 26px; + vertical-align: bottom; +} + +div.modal { + border-radius: 5px; + background: #fff; + z-index: 50; + padding: 4px; +} +.ui-widget-content { + border: 1px solid #ddd; + color: #333; +} +.ui-widget { + font-family: Verdana, sans-serif; + font-size: 1.1em; +} +.ui-dialog .ui-dialog-content { + position: relative; + border: 0; + padding: .5em 1em; + background: none; + overflow: auto; + zoom: 1; +} +.ui-widget-overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} +.ui-widget-overlay { + background: #666 url(http://forge.trustie.net/stylesheets/jquery/images/xui-bg_diagonals-thick_20_666666_40x40.png.pagespeed.ic.9mfuw_R0z1.png) 50% 50% repeat; + opacity: .5; + filter: Alpha(Opacity=50); +} +/***** end Ajax indicator ******/ + +/***** Flash & error messages ****/ +#errorExplanation, div.flash, .nodata, .warning, .conflict { + padding: 4px 4px 4px 30px; + margin-bottom: 12px; + font-size: 1.1em; + border: 2px solid; +} + +div.flash {margin-top: 8px;} + +div.flash.error, #errorExplanation { + background: url(../images/exclamation.png) 8px 50% no-repeat; + background-color: #ffe3e3; + border-color: #dd0000; + color: #880000; +} + +div.flash.notice { + background: url(../images/true.png) 8px 5px no-repeat; + background-color: #dfffdf; + border-color: #9fcf9f; + color: #005f00; +} + +div.flash.warning, .conflict { + background: url(../images/warning.png) 8px 5px no-repeat; + background-color: #FFEBC1; + border-color: #FDBF3B; + color: #A6750C; + text-align: left; +} + +.nodata, .warning { + text-align: center; + background-color: #FFEBC1; + border-color: #FDBF3B; + color: #A6750C; +} + +#errorExplanation ul { font-size: 0.9em;} +#errorExplanation h2, #errorExplanation p { display: none; } + +.conflict-details {font-size:80%;} +/***** end Flash & error messages ****/ + + +/*弹出框*/ +.black_overlay{display:none;position:fixed;top:0px;left:0px;width:100%;height:100%;background-color:black;z-index:1001;-moz-opacity:0.8;opacity:.80;filter:alpha(opacity=80);} +.white_content{display:none;position:fixed;top:15%;left:30%;width:420px;height: auto; margin-bottom:20px;padding:16px;border:3px solid #15bccf;background-color:white;z-index:1002;overflow:auto;} +.white_content02{display:none;position:fixed;top:15%;left:30%;width:200px;height: auto; margin-bottom:20px;padding:10px;border:3px solid #15bccf;background-color:white;z-index:1002;overflow:auto;} +.newhwork_content{ display:none;position:fixed;top:15%;left:30%;width:600px;height: auto; margin-bottom:20px;padding:16px;border:3px solid #15bccf;background-color:white;z-index:1002;overflow:auto;} +.floatbox{ width:420px; border:3px solid #15bccf; background:#fff; padding:5px;} +a.box_close{ display:block; float:right; width:16px; height:16px; background:url(../images/img_floatbox.png) 0 0 no-repeat;} +a:hover.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;} + +div.ke-statusbar{height:1px; border-top:none;} \ No newline at end of file diff --git a/public/stylesheets/users.css b/public/stylesheets/users.css new file mode 100644 index 000000000..ddfb02e18 --- /dev/null +++ b/public/stylesheets/users.css @@ -0,0 +1,127 @@ +#RSide{ min-height:860px;} +/* 左侧信息*/ +.users_info{background:#fff; padding:10px; width:230px; padding-right:0px; margin-bottom:10px; } +.pic_head{ width:214px; height:214px; border:1px solid #cbcbcb; padding:2px; position:relative;} +.pic_head:hover{border:1px solid #64bdd9;} +.usersphoto_edit{ position:absolute; left:198px; top:200px;} +.icon_male{ background:url(../images/pic_uersall.png) 0 0 no-repeat; width:15px; height:15px;} +.icon_female{ background:url(../images/pic_uersall.png) 0 -24px no-repeat; width:15px; height:15px;} +.pf_intro{ width:222px; margin-top:5px; color:#696969;word-break: break-all; } +.leftbox{ width:230px; padding:10px; padding-right:0px; padding-bottom:5px;background:#fff; margin-bottom:10px; margin-right:10px;} +.pic_members{ background:url(../images/pic_users.jpg) 0 0 no-repeat; display:block; width:38px; height:38px; border:1px solid #e9edf0; margin-right:5px; margin-bottom:5px;float:left;} +.pic_members:hover{border:1px solid #c9c9c9;} +/*新建*/ +.top_new{ height:26px; border-bottom:10px solid #eaebed; padding:10px; background:#fff; float:left; margin-left:10px; width:730px; } +.top_new_bg{ background:url(../images/pic_uersall.png) -43px 3px no-repeat; height:26px; width:260px;} +.top_newcourses_bg{ background:url(../images/pic_uersall.png) -43px -29px no-repeat; height:28px; width:260px;} +.top_newproject_bg{ background:url(../images/pic_uersall.png) -43px -56px no-repeat; height:26px; width:260px;} +.newbtn{ height:24px; background:#18ca74; color:#fff; font-size:14px; padding:2px 12px 0 12px;} +.newbtn:hover{background: #14ad5a;} +a.newbtn_add{ display:block; background:url(../images/pic_uersall.png) -265px 3px no-repeat; height:20px; width:15px;} +a.newbtn_t{ font-size:14px; font-weight:bold; color:#fff;} +/*留言*/ +a.icon_face{background:url(../images/public_icon.png) 0px -671px no-repeat; display:block; height:25px; width:40px; padding-left:25px; padding-top:3px; } +a:hover.icon_face{background:url(../images/public_icon.png) -79px -671px no-repeat; } +.inputUsers_message{ border:1px solid #d2d2d2; width:718px; height:48px; color:#666; padding:5px; margin-bottom:5px;} +.inputUsers_message02{ border:1px solid #d2d2d2; width:618px; height:26px; color:#666; padding:5px; margin-bottom:5px; } +.message_list_box{ background:#f5f5f5; padding:10px;} +.users_pic{ width:27px; height:27px; border:1px solid #e3e3e3;} +.users_pic:hover{ border:1px solid #a5a5a5;} +.massage_txt{ max-width:360px; color: #666;word-break:break-all;} +.massage_time{ color:#8d8d8d; margin-top:5px;} +.message_list{ border-bottom:1px dashed #c9c9c9; padding-bottom:10px; margin-bottom:10px;} +.message_list_more{ text-align:center; width:720px;} +/*课程动态*/ +.line_box{ width:728px; border:1px solid #d9d9d9; padding-bottom:10px;} +.users_courses_list{ height:24px; border-bottom:1px dashed #CCC; margin-bottom:10px;} +.users_coursename{max-width:135px; font-weight:bold; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; margin-right:5px; } +.course_name{max-width:60px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.c_grey{ color:#8d8d8d;} +.users_courses_txt{max-width:330px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.users_top{ height:39px; border-bottom:1px solid #d9d9d9; margin-bottom:10px;} +.users_h4{border-bottom:1px solid #d9d9d9; height:29px; padding:10px 0 0 10px; margin-bottom:10px; } +/*弹框*/ +.white_content_users{display:none;position:fixed;top:45%;left:45%;width:210px;height: auto; margin-bottom:20px;padding:10px;border:3px solid #15bccf;background-color:white;z-index:1002;overflow:auto;} +a.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;} +/*我的课程*/ +.courses_top{ height:27px; border-bottom:3px solid #ebebeb;} +.courses_h2{ font-size:16px; font-weight:bold; color:#64bddb; border-bottom:3px solid #64bddb; padding-bottom:3px; padding-right:3px;} +.courses_select{} +a.select_btn{ border:1px solid #acacac; padding:0px 10px; color:#989898; display:block;} +a.select_btn:hover{ background:#64bddb; color:#fff;} +a.select_btn_select{ background:#64bddb; color:#fff;} +.courses_list_pic{ border:1px solid #ede7e9; width:64px; height:64px; padding:1px;} +.courses_list_pic:hover{border:1px solid #64bdd9;} +.courses_list_title{ max-width:500px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.pic_eye_blue{display:block; background:url(../images/pic_uersall.png) -372px 3px no-repeat; width:16px; height:15px; } +.pic_eye_grey{display:block; background:url(../images/pic_uersall.png) -372px -10px no-repeat; width:16px; height:15px; } +.td_w70{ width:70px;} +.td_w60{ width:60px;} +.td_w110{ width:110px;} +.mt20{ margin-top:20px;} +.courses_list{ padding-bottom:10px; } +.courses_list_table{ color:#6e6e6e;} +/****翻页***/ +.wlist{float:right;} +.wlist li{float:left;} +.wlist a{ float:left; border:1px solid #64bdd9; padding:0 5px; margin-left:3px; color:#64bdd9;} +.wlist a:hover{border:1px solid #64bdd9; background-color:#64bdd9; color:#fff; text-decoration:none;} +.wlist_select a { background-color:#48aac9; color:#fff;} +/* 设置 */ +#users_setting{clear:both;width:730px;/*滑动门的宽度*/} +/* TAB 切换效果 */ +.users_tb_{ border-bottom:3px solid #CCC; height:26px; } +.users_tb_ ul{height:26px; } +.users_tb_ li{float:left;height:26px;width: 90px;cursor:pointer; font-size:14px; text-align:center; } +/* 控制显示与隐藏css类 */ +.users_normaltab { color:#666; } +.users_hovertab { color:#64bdd9; border-bottom:3px solid #64bdd9; font-weight:bold;} +.users_normaltab a { color:#64bdd9 ; } +.users_hovertab a{color:#fff; background-color:#64bdd9; text-decoration:none;} +.users_dis{display:block; } +.users_undis{display:none;} +.users_ctt{ font-size:14px; color:#666; margin-top:10px;} +.setting_left{ width:85px; text-align:right; float:left;} +.setting_left li{ height:28px;line-height:28px;} +.setting_right{width:500px; text-align:left; float:left; margin-left:8px;} +.setting_right li{ height:28px;line-height:28px;} +.users_ctt ul li{ margin-bottom:10px;} +.users_ctt input,.users_ctt select,.users_ctt textarea{ border:1px solid #CCC;} +.users_ctt input,.users_ctt select,.users_ctt option{ height:26px;} +.users_ctt input,.users_ctt textarea{ margin-left:2px;} +.users_ctt textarea{ margin-bottom:none;} +.w450{ width:450px;} +.w210{ width:200px;} +.w70{ width:70px;} +.h200{ height:200px;} +/* 个人主页*/ +a.gz_btn{display:block; background:url(../images/pic_uersall.png) -318px -25px no-repeat; width:33px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;} +a:hover.gz_btn{ color:#ff5722;} +a.qx_btn{display:block; background:url(../images/pic_uersall.png) -318px -47px no-repeat; width:33px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;} +a:hover.qx_btn{color:#64bdd9;} +a.c_lgrey{ color:#CCC;} +a:hover.c_lgrey{ color:#3ca5c6;} +.leftbox_ul_left{ width:60px; float:left; text-align:right; } +.leftbox_ul_right{ width:155px; float:left; margin-left:10px; } +.leftbox_ul_left li,.leftbox_ul_right li{ margin-bottom:5px;} +.c_dgrey{ color:#696969;} +.home_courses_list{ width:364px; margin-bottom:10px; } +.home_list_title{ max-width:260px; font-size:14px; font-weight:bold;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.users_list{ } +.users_course_intro{ width:530px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} + +/* 20150506上传头像*/ +.uppicBox{ width:265px; height:265px; background:#f2f2f5; float:left; color:#666; text-align:center;} +.showpicBox{width:133px; height:250px; background:#f2f2f5; float:left; margin-left:20px; text-align:center; padding-top:15px; color:#666;} +.mr2{ margin-right:2px;} +.uppic_btn{border:none; width:150px; background:none; margin-bottom:5px; color:#666; margin-top:105px;} +/* 新建作品*/ +.mr8{ margin-right:8px;} +.mt2{ margin-top:2px;} +.fans_sign{ width:560px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +.newhwork_div ul li{ margin-bottom:10px; font-size:14px; color:#666;} +.newhwork_div input,.newhwork_div select{ height:26px;border:1px solid #CCC; } +.newhwork_div textarea{border:1px solid #CCC;} +.w460{ width:460px;} + +a.hidepic>img{display:none;} \ No newline at end of file