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/api/mobile/entities/course_dynamic.rb b/app/api/mobile/entities/course_dynamic.rb index fe31668ff..6077a8722 100644 --- a/app/api/mobile/entities/course_dynamic.rb +++ b/app/api/mobile/entities/course_dynamic.rb @@ -4,56 +4,50 @@ module Mobile include Redmine::I18n def self.course_dynamic_expose(field) expose field do |c,opt| - if field == :update_time - (format_time(c[field]) if (c.is_a?(Hash) && c.key?(field))) - elsif field == :news_count - obj = nil - c[:dynamics].each do |d| - if d[:type] == 1 - obj = d[:count] - end - end - obj - elsif field == :document_count - obj = nil - c[:dynamics].each do |d| - if d[:type] == 3 - obj = d[:count] - end - end - obj - elsif field == :topic_count - obj = nil - c[:dynamics].each do |d| - if d[:type] == 2 - obj = d[:count] - end - end - obj - elsif field == :homework_count - obj = nil - c[:dynamics].each do |d| - if d[:type] == 4 - obj = d[:count] - end - end - obj - else + # if field == :news_count + # obj = nil + # c[:dynamics].each do |d| + # if d[:type] == 1 + # obj = d[:count] + # end + # end + # obj + # elsif field == :document_count + # obj = nil + # c[:dynamics].each do |d| + # if d[:type] == 3 + # obj = d[:count] + # end + # end + # obj + # elsif field == :topic_count + # obj = nil + # c[:dynamics].each do |d| + # if d[:type] == 2 + # obj = d[:count] + # end + # end + # obj + # elsif field == :homework_count + # obj = nil + # c[:dynamics].each do |d| + # if d[:type] == 4 + # obj = d[:count] + # end + # end + # obj + # else c[field] if (c.is_a?(Hash) && c.key?(field)) - end + # end end end - course_dynamic_expose :type - course_dynamic_expose :count course_dynamic_expose :course_name course_dynamic_expose :course_term course_dynamic_expose :course_time course_dynamic_expose :course_id course_dynamic_expose :course_img_url course_dynamic_expose :message - course_dynamic_expose :update_time - course_dynamic_expose :count course_dynamic_expose :news_count course_dynamic_expose :document_count course_dynamic_expose :topic_count @@ -63,62 +57,32 @@ module Mobile course_dynamic_expose :current_user_is_member course_dynamic_expose :current_user_is_teacher - expose :documents,using:Mobile::Entities::Attachment do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 3 - obj = d[:documents] - end - end - obj - end + # expose :documents,using:Mobile::Entities::Attachment do |f,opt| + # obj = nil + # f[:dynamics].each do |d| + # if d[:type] == 3 + # obj = d[:documents] + # end + # end + # obj + # end expose :topics,using:Mobile::Entities::Message do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 2 - obj = d[:topics] - end - end - obj + f[:topics] end expose :homeworks,using:Mobile::Entities::Homework do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 4 - obj = d[:homeworks] - end - end - obj + f[:homeworks] end expose :news,using:Mobile::Entities::News do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 1 - obj = d[:news] - end - end - obj + f[:news] end expose :better_students,using:Mobile::Entities::User do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 6 - obj = d[:better_students] - end - end - obj + f[:better_students] end expose :active_students,using:Mobile::Entities::User do |f,opt| - obj = nil - f[:dynamics].each do |d| - if d[:type] == 7 - obj = d[:active_students] - end - end - obj + f[:active_students] end end diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 086ecfb7f..25536615a 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -337,6 +337,19 @@ class AdminController < ApplicationController format.html end end + + #学校列表 + def schools + @school_name = params[:school_name] + if @school_name + @schools = School.where("name like '%#{@school_name}%'") + else + @schools = School.all + end + respond_to do |format| + format.html + end + end #移动端版本管理 def mobile_version @versions = PhoneAppVersion.reorder('created_at desc') @@ -382,4 +395,74 @@ class AdminController < ApplicationController end + #留言列表 + def leave_messages + @jour = JournalsForMessage.where("jour_type = 'Principal' or jour_type = 'Course'").reorder('created_on desc') + case params[:format] + when 'xml', 'json' + @offset, @limit = api_offset_and_limit({:limit => 30}) + else + @limit = 30#per_page_option + end + + @jour_count = @jour.count + @jour_pages = Paginator.new @jour_count, @limit, params['page'] + @offset ||= @jour_pages.offset + @jour = @jour.limit(@limit).offset(@offset).all + + respond_to do |format| + format.html + end + end + + #帖子 + def messages_list + @memo = Memo.reorder("created_at desc") + +=begin + case params[:format] + when 'xml', 'json' + @offset, @limit = api_offset_and_limit({:limit => 30}) + else + @limit = 30#per_page_option + end + + @memo_count = @memo.count + @memo_pages = Paginator.new @memo_count, @limit, params['page'] + @offset ||= @memo_pages.offset + @memo = @memo.limit(@limit).offset(@offset).all +=end + + respond_to do |format| + format.html + end + end + + #课程讨论区的帖子 + def course_messages + #@boards=Board.where('course_id is NULL') + #@course_ms = Message.reorder('created_on desc') + @course_ms=Message.joins("join boards on messages.board_id=boards.id where boards.course_id is not NULL").reorder('created_on desc') + end + + #项目讨论区的帖子 + def project_messages + @project_ms=Message.joins("join boards on messages.board_id=boards.id where boards.project_id != -1").reorder('created_on desc') + end + + #通知 + def notices + @news = News.where('course_id is not NULL').order('created_on desc') + end + + #最近登录用户列表 + def latest_login_users + @user = User.order('last_login_on desc') + end + + #作业 + def homework + @homework = HomeworkCommon.order('end_time desc') + end + end diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index a301a1e6c..ee953e913 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -514,6 +514,8 @@ private end def has_login - render_403 unless User.current.logged? + unless @attachment && @attachment.container_type == "PhoneAppVersion" + render_403 unless User.current.logged? + end end end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a0a61786c..29f2e00f4 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -20,11 +20,10 @@ class CoursesController < ApplicationController menu_item l(:label_sort_by_influence), :only => :index before_filter :can_show_course, :except => [] - before_filter :logged_user_by_apptoken,:only => [:show,:new_homework,:feedback] - before_filter :find_course, :except => [ :index, :search,:list, :new,:join,:unjoin, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_private_courses] - before_filter :authorize_course, :only => [:show, :settings, :edit, :update, :modules, :close, :reopen, :view_homework_attaches, :course] - before_filter :authorize_course_global, :only => [:view_homework_attaches, :new,:create] - before_filter :require_admin, :only => [:copy, :archive, :unarchive, :destroy, :calendar] + before_filter :logged_user_by_apptoken,:only => [:show,:feedback] + before_filter :find_course, :except => [ :index, :search, :new,:join,:unjoin, :create, :new_join, :course,:join_private_courses] + before_filter :authorize_course, :only => [:show, :settings, :update, :course] + before_filter :authorize_course_global, :only => [:new,:create] before_filter :toggleCourse, :only => [:finishcourse, :restartcourse] before_filter :require_login, :only => [:join, :unjoin] @@ -40,9 +39,14 @@ class CoursesController < ApplicationController else @state = 5 #未登录 end - respond_to do |format| - format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} } - end + # if @state == 1 || @state == 3 + # respond_to course_path(course.id) + # else + respond_to do |format| + format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} } + end + #end + rescue Exception => e @state = 4 #已经加入了课程 respond_to do |format| @@ -102,74 +106,17 @@ class CoursesController < ApplicationController # 课程搜索 # add by nwb def search - courses_all = Course.all_course - name = params[:name] - if name.blank? - @courses = [] - @courses_all = [] - @course_count = 0 - @course_pages = Paginator.new @course_count, per_page_option, params['page'] + if params[:name].empty? + courses = Course.visible + @courses = paginateHelper courses,10 else - @courses = courses_all.visible - if params[:name].present? - @courses_all = @courses.like(params[:name]) - else - @courses_all = @courses; - end - @course_count = @courses_all.count - @course_pages = Paginator.new @course_count, per_page_option, params['page'] - - # 课程的动态数 - @course_activity_count=Hash.new - @courses_all.each do |course| - @course_activity_count[course.id]=0 - end - - case params[:course_sort_type] - when '0' - @courses = @courses_all.order("created_at desc") - @s_type = 0 - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - - @course_activity_count=get_course_activity @courses,@course_activity_count - - when '1' - @courses = @courses_all.order("course_ac_para desc") - @s_type = 1 - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - - @course_activity_count=get_course_activity @courses,@course_activity_count - - when '2' - @courses = @courses_all.order("watchers_count desc") - @s_type = 2 - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - - @course_activity_count=get_course_activity @courses,@course_activity_count - - when '3' - @course_activity_count=get_course_activity @courses_all,@course_activity_count_array - @courses=handle_course @courses_all,@course_activity_count - @s_type = 3 - @courses = @courses[@course_pages.offset, @course_pages.per_page] - - else - @s_type = 0 - @courses = @courses_all.order("created_at desc") - @courses = @courses.offset(@course_pages.offset).limit(@course_pages.per_page) - - @course_activity_count=get_course_activity @courses,@course_activity_count - - end + courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'") + @courses = paginateHelper courses,10 end respond_to do |format| format.html { render :layout => 'course_base' - scope = Course - unless params[:closed] - scope = scope.active - end } format.atom { courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all @@ -605,7 +552,7 @@ class CoursesController < ApplicationController def toggleCourse @course_prefs = Course.find_by_extra(@course.extra) - unless (@course_prefs.teacher == User.current || User.current.admin?) + unless (User.current.allowed_to?(:as_teacher,@course_prefs) || User.current.admin?) render_403 end end @@ -659,92 +606,9 @@ class CoursesController < ApplicationController end def show - if params[:jump] && redirect_to_course_menu_item(@course, params[:jump]) - return - end - @users_by_role = @course.users_by_role - if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id))) - @user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id) - end - @key = User.current.rss_key - #新增内容 - @days = Setting.activity_days_default.to_i - if params[:from] - begin; @date_to = params[:from].to_date + 1; rescue; end - end - has = { - "show_course_files" => true, - "show_course_news" => true, - "show_course_messages" => true, - #"show_course_journals_for_messages" => true, - # "show_bids" => true, - # "show_homeworks" => true, - "show_polls" => true - } - @date_to ||= Date.today + 1 - @date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date - @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id])) - if @author.nil? - # 显示老师和助教的活动 - # @authors = searchTeacherAndAssistant(@course) - @authors = course_all_member(@course) - events = [] - key = "course_events_#{@course.id}".to_sym - if Rails.env.production? && Setting.course_cahce_enabled? - events = Rails.cache.read(key) || [] - end - if events.empty? - @authors.each do |author| - @activity = Redmine::Activity::Fetcher.new(User.current, :course => @course, - :with_subprojects => false, - :author => author.user) - - @activity.scope_select {|t| has["show_#{t}"]} - # modify by nwb - # 添加私密性判断 - if User.current.member_of_course?(@course)|| User.current.admin? - events += @activity.events(@days, @course.created_at) - else - events += @activity.events(@days, @course.created_at, :is_public => 1) - end - end - Rails.cache.write(key, events) if Rails.env.production? && Setting.course_cahce_enabled? - end - else - # @author = @course.teacher - @activity = Redmine::Activity::Fetcher.new(User.current, :course => @course, - :with_subprojects => false, - :author => @author) - - @activity.scope_select {|t| has["show_#{t}"]} - # modify by nwb - # 添加私密性判断 - if User.current.member_of_course?(@course)|| User.current.admin? - events = @activity.events(@days, @course.created_at) - else - events = @activity.events(@days, @course.created_at, :is_public => 1) - end - end - - # 无新动态时,显示老动态 - if events.count == 0 - if User.current.member_of_course?(@course)|| User.current.admin? - events = @activity.events - else - events = @activity.events(:is_public => 1) - end - end - @sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category' - if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id))) - @user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id) - end - - sorted_events = sort_activity_events_course(events) - events = paginateHelper sorted_events,10 - @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} - # documents - - + course_activities = @course.course_activities.order("created_at desc") + @canShowRealName = User.current.member_of_course? @course + @course_activities = paginateHelper course_activities,10 respond_to do |format| format.html{render :layout => 'base_courses'} format.api @@ -809,6 +673,12 @@ class CoursesController < ApplicationController end end + #删除课程 + #删除课程只是将课程的is_delete状态改为false,is_delete为false状态的课程只有管理员可以看到 + def destroy + + end + private def allow_join course if course_endTime_timeout? course diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 19c1214e2..7b81d12db 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -177,11 +177,11 @@ class FilesController < ApplicationController def index @flag = params[:flag] || false #sort_init 'filename', 'asc' - sort_init 'created_on', 'desc' - sort_update 'created_on' => "#{Attachment.table_name}.created_on", - 'filename' => "#{Attachment.table_name}.filename", - 'size' => "#{Attachment.table_name}.filesize", - 'downloads' => "#{Attachment.table_name}.downloads" + # sort_init 'created_on', 'desc' + # sort_update 'created_on' => "#{Attachment.table_name}.created_on", + # 'filename' => "#{Attachment.table_name}.filename", + # 'size' => "#{Attachment.table_name}.filesize", + # 'downloads' => "#{Attachment.table_name}.downloads" sort = "" @sort = "" @order = "" diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index 8b37ca8e4..87c1e288b 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -1,6 +1,7 @@ class HomeworkCommonController < ApplicationController require 'net/http' require 'json' + require "base64" layout "base_courses" 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] @@ -18,6 +19,28 @@ class HomeworkCommonController < ApplicationController end def new + @homework_type = "1" + + @homework = HomeworkCommon.new + @homework.safe_attributes = params[:homework_common] + @homework.late_penalty = 2 + @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') + @homework.publish_time = Time.now.strftime('%Y-%m-%d') + + if @homework_type == "1" + #匿评作业相关属性 + @homework_detail_manual = HomeworkDetailManual.new + @homework_detail_manual.ta_proportion = 0.6 + @homework_detail_manual.absence_penalty = 2 + @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 @@ -29,7 +52,7 @@ class HomeworkCommonController < ApplicationController @homework = HomeworkCommon.new @homework.safe_attributes = params[:homework_common] - @homework.late_penalty = 0 + @homework.late_penalty = 2 @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') @homework.publish_time = Time.now.strftime('%Y-%m-%d') @@ -37,7 +60,7 @@ class HomeworkCommonController < ApplicationController #匿评作业相关属性 @homework_detail_manual = HomeworkDetailManual.new @homework_detail_manual.ta_proportion = 0.6 - @homework_detail_manual.absence_penalty = 0 + @homework_detail_manual.absence_penalty = 2 @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') @@ -71,18 +94,20 @@ class HomeworkCommonController < ApplicationController if homework.homework_type == 2 homework_detail_programing = HomeworkDetailPrograming.new - homework_detail_programing.language = "C++" + homework_detail_programing.language = params[:language] homework_detail_programing.standard_code = params[:standard_code] - + homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6 question = {title:homework.name,content:homework.description} question[:input] = [] question[:output] = [] - if params[:input] && params[:output] + if params[:input] && params[:output] && params[:result] 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_test.result = params[:result][k] + homework_test.error_msg = params[:error_msg] homework.homework_tests << homework_test question[:input] << homework_test.input question[:output] << homework_test.output @@ -122,6 +147,8 @@ class HomeworkCommonController < ApplicationController end if homework.save + homework_detail_programing.save if homework_detail_programing + homework_detail_manual.save if homework_detail_manual respond_to do |format| format.html { flash[:notice] = l(:notice_successful_create) @@ -151,7 +178,7 @@ class HomeworkCommonController < ApplicationController @homework.description = params[:homework_common][:description] @homework.end_time = params[:homework_common][:end_time] @homework.publish_time = params[:homework_common][:publish_time] - @homework.homework_type = params[:homework_common][:homework_type] + @homework.homework_type = params[:homework_common][:homework_type] if params[:homework_common][:homework_type] unless @homework.late_penalty == params[:late_penalty] @homework.student_works.where("created_at > '#{@homework.end_time} 23:59:59'").each do |student_work| student_work.late_penalty = params[:late_penalty] @@ -187,8 +214,9 @@ class HomeworkCommonController < ApplicationController end if @homework.homework_type == 2 && @homework_detail_programing #编程作业 - @homework_detail_programing.language = "C++" + @homework_detail_programing.language = params[:language] @homework_detail_programing.standard_code = params[:standard_code] + @homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6 homework_tests = @homework.homework_tests #需要删除的测试 ids = homework_tests.map(&:id) - params[:input].keys.map(&:to_i) @@ -196,23 +224,45 @@ class HomeworkCommonController < ApplicationController homework_test = HomeworkTest.find id homework_test.destroy if homework_test end - if params[:input] && params[:output] + if params[:input] && params[:output] && params[:result] 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] + homework_test.result = params[:result][k] + homework_test.error_msg = params[:error_msg] else #不存在的测试,增加 homework_test = HomeworkTest.new homework_test.input = v homework_test.output = params[:output][k] + homework_test.result = params[:result][k] + homework_test.error_msg = params[:error_msg] homework_test.homework_common = @homework end homework_test.save end end end + + #发送修改作业的请求 + question = {title:@homework.name,content:@homework.description} + question[:input] = [] + question[:output] = [] + @homework.homework_tests.each do |test| + question[:input] << test.input + question[:output] << test.output + end + uri = URI("http://192.168.80.21:8080/api/questions/#{@homework_detail_programing.question_id}.json") + body = question.to_json + res = Net::HTTP.new(uri.host, uri.port).start do |client| + request = Net::HTTP::Put.new(uri.path) + request.body = body + request["Content-Type"] = "application/json" + client.request(request) + end + result = JSON.parse(res.body) end @homework.save_attachments(params[:attachments]) @@ -308,6 +358,24 @@ class HomeworkCommonController < ApplicationController end end + def programing_test + test = {language:params[:language],src:Base64.encode64(params[:src]),input:[params[:input]],output:[params[:output]]} + @index = params[:index] + uri = URI('http://192.168.80.21:8080/api/realtime.json') + body = test.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) + @err_msg = result["compile_error_msg"] + result["results"].each do |re| + @result = re["status"] + end + end + private #获取课程 def find_course diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 539d84e65..0995d1304 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -112,7 +112,19 @@ class IssuesController < ApplicationController end def show - + # 当前用户查看指派给他的缺陷消息,则设置消息为已读 + query = @issue.forge_messages + if User.current.id == @issue.assigned_to_id + query.update_all(:viewed => true) + end + # 缺陷状态更新 + query_journals = @issue.journals + if User.current.id == @issue.author_id + query_journals.each do |query_journal| + query_journal.forge_messages.update_all(:viewed => true) + end + end + # @journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all @journals.each_with_index {|j,i| j.indice = i+1} @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 69d8bc3a6..103030d51 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,8 @@ class MyController < ApplicationController # Manage user's password def password + begin + @act='password' @user = User.current unless @user.change_password_allowed? flash.now[:error] = l(:notice_can_t_change_password) @@ -174,16 +197,20 @@ class MyController < ApplicationController Token.delete_user_all_tokens(@user) logout_user redirect_to signin_url(back_url: my_account_path) + return else - flash.now[:error] = l(:notice_account_wrong_password) + #flash.now[:error] = l(:notice_account_wrong_password) end end rescue Exception => e if e.message == 'wrong password' - flash.now[:error] = l(:notice_account_wrong_password) + # flash.now[:error] = l(:notice_account_wrong_password) else - flash.now[:error] = e.message + # flash.now[:error] = e.message end + flash.now[:error] = l(:notice_account_old_wrong_password) + end + render :template => 'my/account',:layout=>'base_users_new' end # Create a new feeds key diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 56b4a30fc..1a8e75b54 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -71,10 +71,15 @@ class NewsController < ApplicationController scope = @course ? @course.news.course_visible : News.course_visible @news_count = scope.count - #@news_pages = Paginator.new @news_count, @limit, params['page'] - #@offset ||= scope_page.offset - scope_order = scope.all(:include => [:author, :course], - :order => "#{News.table_name}.created_on DESC") + @q = params[:subject] + if params[:subject].nil? || params[:subject].blank? + scope_order = scope.all(:include => [:author, :course], + :order => "#{News.table_name}.created_on DESC") + else + scope_order = scope.where("#{News.table_name}.title like '#{'%' << params[:subject].to_s << '%'}'").all(:include => [:author, :course], + :order => "#{News.table_name}.created_on DESC") + end + # :offset => @offset, # :limit => @limit) @newss = paginateHelper scope_order,10 @@ -83,6 +88,7 @@ class NewsController < ApplicationController @news = News.new render :layout => 'base_courses' } + format.js format.api format.atom { render_feed(@newss, :title => (@course ? @course.name : Setting.app_title) + ": #{l(:label_news_plural)}") } end @@ -141,7 +147,7 @@ class NewsController < ApplicationController ids = params[:asset_id].split(',') update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS end - # ض̬ļ¼add start + # ������ض�̬�ļ�¼add start teachers = searchTeacherAndAssistant(@course) for teacher in teachers if(teacher.user_id != User.current.id) @@ -155,7 +161,7 @@ class NewsController < ApplicationController notify.save() end end - # ض̬ļ¼add end + # ������ض�̬�ļ�¼add end render_attachment_warning_if_needed(@news) flash[:notice] = l(:notice_successful_create) redirect_to course_news_index_url(@course) diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index 758747e02..edf8c2259 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -1,3 +1,4 @@ +#encoding utf-8 class PollController < ApplicationController before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll] before_filter :find_container, :only => [:new,:create, :index] @@ -137,11 +138,19 @@ class PollController < ApplicationController @poll_questions.poll_answers.new question_option end end - if @poll_questions.save - respond_to do |format| - format.js - end + # 如果是插入的话,那么从插入的这个id以后的question_num都将要+1 + if params[:quest_id] + @is_insert = true + @poll.poll_questions.where("question_number > #{params[:quest_num].to_i}").update_all(" question_number = question_number + 1") + @poll_question_num = params[:quest_num].to_i + @poll_questions.question_number = params[:quest_num].to_i + 1 end + if @poll_questions.save + respond_to do |format| + format.js + end + end + end #修改题目 @@ -328,6 +337,37 @@ class PollController < ApplicationController end end + + def import_poll + @poll = Poll.find(params[:to_id]) + question_num = @poll.poll_questions.select("max(question_number) question_number").first.question_number + import_poll = Poll.find(params[:import_id]) + import_poll.poll_questions.each_with_index do |question,index| + option = { + :is_necessary => question.is_necessary, + :question_title => question.question_title, + :question_type => question.question_type, + :question_number => question_num + index+1 + } + poll_questions = @poll.poll_questions.new option + for i in 1..question.poll_answers.count + answer = question.poll_answers[i-1][:answer_text] + question_option = { + :answer_position => i, + :answer_text => answer + } + poll_questions.poll_answers.new question_option + end + @poll.poll_questions << poll_questions + end + if @poll.save + @poll = Poll.find(params[:to_id]) + respond_to do |format| + format.js + end + end + end + #重新发布问卷 def republish_poll @poll.poll_questions.each do |poll_question| @@ -371,6 +411,70 @@ class PollController < ApplicationController end end + # 将其他地方的问卷导出来 + def other_poll + # 查作者是我,或者作者是当前课程的老师,且不在当前课程内的问卷 进行导入 + tea_ids = '(' + tea_ids << Course.find(params[:polls_group_id]).tea_id.to_s << ','<< User.current.id.to_s << ')' + @polls = Poll.where("user_id in #{tea_ids} and polls_type = 'course' and polls_group_id != #{params[:polls_group_id]}") + @polls_group_id = params[:polls_group_id] + respond_to do |format| + format.js + end + end + + # 将问卷导入本课程 + def import_other_poll + course_id = params[:course_id] + @course = Course.find(course_id) + params[:polls].each_with_index do |p,i| + poll = Poll.find(p) + option = { + :polls_name => poll.polls_name || l(:label_poll_new), + :polls_type => 'Course', + :polls_group_id => course_id, + :polls_status => 1, + :user_id => User.current.id, + :published_at => Time.now, + :closed_at => Time.now, + :show_result => 1, + :polls_description => poll.polls_description + } + @poll = Poll.create option + + poll.poll_questions.each do | q| + #question_title = params[:poll_questions_title].nil? || params[:poll_questions_title].empty? ? l(:label_enter_single_title) : params[:poll_questions_title] + option = { + :is_necessary => q[:is_necessary], + :question_title => q[:question_title], + :question_type => q[:question_type] || 1, + :question_number => q[:question_number] + } + @poll_questions = @poll.poll_questions.new option + + for i in 1..q.poll_answers.count + answer = q.poll_answers[i-1].nil? ? l(:label_new_answer) : q.poll_answers[i-1][:answer_text] + question_option = { + :answer_position => i, + :answer_text => answer + } + @poll_questions.poll_answers.new question_option + end + end + @poll.save + end + @is_teacher = User.current.allowed_to?(:as_teacher,@course) + if @is_teacher + polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}") + else + polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2") + end + @polls = paginateHelper polls,20 #分页 + respond_to do |format| + format.js + end + end + private def find_poll_and_course @poll = Poll.find params[:id] diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index e6e93947c..f042bba50 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -86,8 +86,14 @@ class ProjectsController < ApplicationController @project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10) else @project_pages = Project.project_entities.visible.page(params[:page] ).per(10) + @project_pages = Project.project_entities.visible.page(params[:page] ).per(10) end @projects = @project_pages.order("created_on desc") + @limit = 10#per_page_option + + @project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count + @project_pages = Paginator.new @project_count, @limit, params['page'] + respond_to do |format| format.html { render :layout => 'base' @@ -150,11 +156,15 @@ class ProjectsController < ApplicationController end def new - @issue_custom_fields = IssueCustomField.sorted.all - @trackers = Tracker.sorted.all - @project = Project.new - @project.safe_attributes = params[:project] - render :layout => 'base' + if User.current.login? + @issue_custom_fields = IssueCustomField.sorted.all + @trackers = Tracker.sorted.all + @project = Project.new + @project.safe_attributes = params[:project] + render :layout => 'base' + else + redirect_to signin_url + end end def share @@ -167,6 +177,10 @@ class ProjectsController < ApplicationController end def create + unless User.current.login? + redirect_to signin_url + return + end @issue_custom_fields = IssueCustomField.sorted.all @trackers = Tracker.sorted.all @project = Project.new @@ -280,11 +294,11 @@ class ProjectsController < ApplicationController # 根据私密性,取出符合条件的所有数据 if User.current.member_of?(@project) || User.current.admin? - @events_pages = ForgeActivity.where("project_id = ?",@project).order("created_at desc").page(params['page'|| 1]).per(20); + @events_pages = ForgeActivity.where("project_id = ? and forge_act_type != ?",@project, "Document" ).order("created_at desc").page(params['page'|| 1]).per(20); #events = @activity.events(@date_from, @date_to) else @events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public - = ?",@project,1).order("created_at desc") + = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc") .page(params['page'|| 1]).per(10); # @events = @activity.events(@date_from, @date_to, :is_public => 1) end diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 607c9b5db..e0aea0c2e 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -250,6 +250,14 @@ update return -1 end end + + if params[:to] == 'gitlab' + g = Gitlab.client + g.post('/session', body: {email: User.current.mail, password: User.current.hashed_password}) + redirect_to "http://192.168.41.130:3000/gitlab-org/gitlab-shell/tree/master" + return + end + #if( !User.current.member_of?(@project) || @project.hidden_repo) @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty? @@ -441,6 +449,8 @@ update def stats @project_id = params[:id] @repository_id = @repository.identifier + # 提交次数统计 + @status_commit_count = Changeset.count(:conditions => ["#{Changeset.table_name}.repository_id = ?", @repository.id]) render :layout => 'base_projects' end @@ -451,6 +461,12 @@ update data = graph_commits_per_month(@repository) when "commits_per_author" data = graph_commits_per_author(@repository) + when "author_commits_per_month" + data = graph_author_commits_per_month(@repository) + when "author_commits_six_month" + data = author_commits_six_month(@repository) + when "author_code_six_months" + data = author_code_six_month(@repository) end if data headers["Content-Type"] = "image/svg+xml" @@ -476,7 +492,18 @@ update if params[:repository_id].present? @repository = @project.repositories.find_by_identifier_param(params[:repository_id]) else - @repository = @project.repository + # 多版本库,如果一个版本库为空则去下一个 + rep_count = @project.repositories.count + if @project.repository.nil? + for i in 0..rep_count + unless @project.repositories[i].nil? + @repository = @project.repositories[i] + break + end + end + else + @repository = @project.repository + end end (render_404; return false) unless @repository @path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s @@ -540,11 +567,12 @@ update :stack => :side, :scale_integers => true, :step_x_labels => 2, - :show_data_values => false, + :show_data_values => true, :graph_title => l(:label_commits_per_month), :show_graph_title => true ) + # 具状图 graph.add_data( :data => commits_by_month[0..11].reverse, :title => l(:label_revision_plural) @@ -560,7 +588,7 @@ update def graph_commits_per_author(repository) commits_by_author = Changeset.count(:all, :group => :committer, :conditions => ["repository_id = ?", repository.id]) - commits_by_author.to_a.sort! {|x, y| x.last <=> y.last} + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25) changes_by_author = Change.count(:all, :group => :committer, :include => :changeset, :conditions => ["#{Changeset.table_name}.repository_id = ?", repository.id]) h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o} @@ -582,7 +610,7 @@ update :fields => fields, :stack => :side, :scale_integers => true, - :show_data_values => false, + :show_data_values => true, :rotate_y_labels => false, :graph_title => l(:label_commits_per_author), :show_graph_title => true @@ -597,6 +625,123 @@ update ) graph.burn end + + # 用户最近一年的提交次数 + def graph_author_commits_per_month(repository) + @date_to = Date.today + @date_from = @date_to << 12 + @date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day) + commits_by_author = Changeset.count(:all, :group => :committer, + :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25) + + fields = commits_by_author.collect {|r| r.first} + commits_data = commits_by_author.collect {|r| r.last} + + fields = fields + [""]*(10 - fields.length) if fields.length<10 + commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 + + # Remove email adress in usernames + fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } + + graph = SVG::Graph::BarHorizontal.new( + :height => 400, + :width => 600, + :fields => fields, + :stack => :side, + :scale_integers => true, + :show_data_values => true, + :rotate_y_labels => false, + :graph_title => l(:label_author_commits_year), + :show_graph_title => true, + :no_css => true + ) + graph.add_data( + :data => commits_data, + :title => l(:label_revision_commit_count) + ) + graph.burn + end + + # 用户最近六个月的提交次数 + def author_commits_six_month(repository) + @date_to = Date.today + @date_from = @date_to << 6 + @date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day) + commits_by_author = Changeset.count(:all, :group => :committer, + :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25) + + fields = commits_by_author.collect {|r| r.first} + commits_data = commits_by_author.collect {|r| r.last} + + fields = fields + [""]*(10 - fields.length) if fields.length<10 + commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 + + # Remove email adress in usernames + fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } + + graph = SVG::Graph::BarHorizontal.new( + :height => 400, + :width => 600, + :fields => fields, + :stack => :side, + :scale_integers => true, + :show_data_values => true, + :rotate_y_labels => false, + :graph_title => l(:label_author_commits_six_month), + :show_graph_title => true + ) + graph.add_data( + :data => commits_data, + :title => l(:label_revision_commit_count) + ) + graph.burn + end + + # 最近六个月代码量统计 + def author_code_six_month(repository) + @date_to = Date.today + @date_from = @date_to << 6 + @date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day) + commits_by_author = Changeset.count(:group => :committer, :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to]) + commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40) + all_author = [] + commits_by_author.each do |cba| + all_author << cba.first + end + # all_author = all_author.collect {|c| c.gsub(%r{/ /<.+@.+>}, '') } + all_author = all_author.collect {|c| c.split.first } + commits_by_author = repository.commits(all_author, "#{@date_from}", "#{@date_to}", repository.id == 150 ? "szzh" : 'master') + + fields = commits_by_author.collect {|r| r.first} + commits_data = commits_by_author.collect {|r| r.last} + + fields = fields + [""]*(10 - fields.length) if fields.length<10 + commits_data = commits_data + [0]*(10 - commits_data.length) if commits_data.length<10 + + # Remove email adress in usernames + fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') } + + graph = SVG::Graph::BarHorizontal.new( + :height => 400, + :width => 600, + :fields => fields, + :stack => :side, + :scale_integers => true, + :show_data_values => true, + :rotate_y_labels => false, + :graph_title => l(:label_author_code_six_month), + :show_graph_title => true + ) + graph.add_data( + :data => commits_data, + :title => l(:lable_revision_code_count) + ) + graph.burn + end + + def check_hidden_repo project = Project.find(params[:id]) if !User.current.member_of?(project) diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index 008fe00fc..3e0c280ac 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -4,28 +4,21 @@ class SchoolController < ApplicationController def upload uploaded_io = params[:logo] - school_id = 0 - schools = School.where("name = ?", params[:school]) - - schools.each do |s| - school_id = s.id - end - + school_id ||= params[:id] unless uploaded_io.nil? File.open(Rails.root.join('public', 'images', 'school', school_id.to_s+'.png'), 'wb') do |file| file.write(uploaded_io.read) end - s1 = School.find(school_id) s1.logo_link = '/images/school/'+school_id.to_s+'.png' s1.save - - - end + end + redirect_to admin_schools_url(:school_name => params[:school_name]) end def upload_logo - + @school = School.find params[:id] + @school_name = params[:school_name] end #获取制定学校开设的课程数 diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 20cdc6659..01f858442 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -13,8 +13,9 @@ class StudentWorkController < ApplicationController def index @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group] @is_teacher = User.current.allowed_to?(:as_teacher,@course) - unless @group == "0" || @group.nil? - group_students = CourseGroup.find_by_id(@group).users + course_group = CourseGroup.find_by_id(@group) if @group + if course_group + group_students = course_group.users if group_students.empty? student_in_group = '(0)' else @@ -127,7 +128,7 @@ class StudentWorkController < ApplicationController solutions = { student_work_id:stundet_work.id, src:Base64.encode64(stundet_work.description), - language:1 + language:@homework.homework_detail_programing.language } uri = URI(url) body = solutions.to_json @@ -156,7 +157,7 @@ class StudentWorkController < ApplicationController end def edit - if @homework.homework_type == 2 #编程作业不能修改作业 + if !User.current.admin? && @homework.homework_type == 2 #编程作业不能修改作业 render_403 else respond_to do |format| @@ -386,8 +387,8 @@ class StudentWorkController < ApplicationController 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 + homework_tests = homework_common.homework_tests.where("input = '#{result[:input]}' AND output = '#{result[:output]}'") + homework_tests.each do |homework_test| student_work_test = StudentWorkTest.new student_work_test.student_work = stundet_work student_work_test.homework_test = homework_test @@ -395,6 +396,7 @@ class StudentWorkController < ApplicationController if student_work_test.result == 0 student_score_count += 1 end + student_work_test.error_msg = params[:compile_error_msg] student_work_test.save! end end @@ -443,7 +445,7 @@ class StudentWorkController < ApplicationController #判断是不是当前作品的提交者 #提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品 def author_of_work - render_403 unless (User.current.id == @work.user_id || User.current.admin?) && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) + render_403 unless User.current.admin? || (User.current.id == @work.user_id && @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 ) end def teacher_of_course @@ -466,22 +468,60 @@ class StudentWorkController < ApplicationController sheet1 = book.create_worksheet :name => "homework" blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 sheet1.row(0).default_format = blue - sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), - l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)]) - count_row = 1 - items.each do |homework| - sheet1[count_row,0]=homework.user.id - sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s - sheet1[count_row,2] = homework.user.login - sheet1[count_row,3] = homework.user.user_extensions.student_id - sheet1[count_row,4] = homework.user.mail - sheet1[count_row,5] = homework.name - sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) - sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) - sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) - sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) - sheet1[count_row,10] = format_time(homework.created_at) - count_row += 1 + if @homework.homework_type == 0 #普通作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + # sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,8] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,9] = format_time(homework.created_at) + count_row += 1 + end + elsif @homework.homework_type == 1 #匿评作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score), l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,10] = format_time(homework.created_at) + count_row += 1 + end + elsif @homework.homework_type == 2 #编程作业 + sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name), + l(:excel_t_score),l(:excel_ta_score), l(:excel_s_score),l(:excel_f_score),l(:excel_commit_time)]) + count_row = 1 + items.each do |homework| + sheet1[count_row,0]=homework.user.id + sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s + sheet1[count_row,2] = homework.user.login + sheet1[count_row,3] = homework.user.user_extensions.student_id + sheet1[count_row,4] = homework.user.mail + sheet1[count_row,5] = homework.name + sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score) + sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score) + sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score) + sheet1[count_row,9] = homework.respond_to?("score") ? homework.score.nil? ? l(:label_without_score) : format("%.2f",homework.score) : l(:label_without_score) + sheet1[count_row,10] = format_time(homework.created_at) + count_row += 1 + end end book.write xls_report xls_report.string diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0655c323b..969d2d366 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -26,10 +26,11 @@ 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 - - + menu_item :user_messages, :only => :user_messages + + #Ended by young # edit @@ -39,23 +40,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,:user_messages] #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,:user_messages] 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 +82,9 @@ class UsersController < ApplicationController # fq helper :words + helper :project_score + helper :issues + include UsersHelper def refresh_changests if !(@user.nil?) && !(@user.memberships.nil?) @@ -87,6 +96,41 @@ class UsersController < ApplicationController end end + # 用户消息 + def user_messages + unless User.current.logged? + render_403 + return + end + # 当前用户查看消息,则设置消息为已读 + querys = @user.course_messages + if User.current.id == @user.id + querys.update_all(:viewed => true) + end + if @user.course_messages + if params[:type].nil? + @user_course_messages = @user.course_messages.reverse + @user_project_messges = @user.forge_messages.reverse + else + case params[:type] + when 'homework' + @user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "HomeworkCommon"} + #@user_course_messages = ForgeMessage.find_by_sql("select * from course_messages where user_id='#{@user.id}' and course_message_type = 'HomeworkCommon' order by created_at desc;") + when 'message' + @user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "Message"} + when 'news' + @user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "News"} + when 'poll' + @user_course_messages = @user.course_messages.reverse.select{|x| x.course_message_type == "Poll"} + end + end + respond_to do |format| + format.html{render :layout=>'base_users_new'} + format.api + end + end + end + def user_projects_index if User.current.admin? memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}").first @@ -104,34 +148,22 @@ 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 unless User.current.admin? if !@user.active? #|| (@user != User.current && @memberships.empty? && events.empty?) render_404 - return + return end end - #end - + projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc") + if(params[:status] == '1') + projects = projects.where("projects.user_id = ?",@user.id) + elsif(params[:status] == '2') + projects = projects.where("projects.user_id <> ?",@user.id) + end + @list = paginateHelper projects,10 + @params = params[:status] respond_to do |format| - format.html + format.html{render :layout=>'base_users_new'} format.api end end @@ -168,21 +200,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 +251,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,65 +272,42 @@ 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?) + if !@user.active? 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)) - 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 - # end + courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc") + if(params[:status] == '1') + courses = courses.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now) + elsif(params[:status] == '2') + courses = courses.where("endup_time < ?",Time.now) + end + @list = paginateHelper courses,10 + @params = params[:status] + render :layout=>'base_users_new' end # modified by fq def user_newfeedback - @jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') - @jours.update_all(:is_readed => true, :status => false) - @jours.each do |journal| - fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) + jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') + if User.current == @user + jours.update_all(:is_readed => true, :status => false) + jours.each do |journal| + fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false) + end end - - #@limit = 10 - #@feedback_count = @jours.count - #@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] - #@offset ||= @feedback_pages.offset - @jour = paginateHelper @jours,10 + @jour = paginateHelper jours,10 @state = false + render :layout=>'base_users_new' end - # end def user_comments @@ -306,7 +315,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 +331,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 +368,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 +378,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 +422,122 @@ 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).order("#{Course.table_name}.id desc") + 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") + end + + if params[:lastid]!=nil && !params[:lastid].empty? + query = query.where(" #{Course.table_name}.id < ?",params[:lastid],) + end + @list = query.limit(8) + + render :layout=>nil + 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 + 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 +553,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 +586,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 +605,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 +614,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 +631,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 +656,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 +704,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 +730,7 @@ class UsersController < ApplicationController end end #### end - + def new @user = User.new(:language => Setting.default_language, :mail_notification => Setting.default_notification_option) @@ -665,7 +788,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 +958,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 +1063,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 +1091,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/welcome_controller.rb b/app/controllers/welcome_controller.rb index 9ce107f8b..6b14db9bb 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -100,44 +100,6 @@ class WelcomeController < ApplicationController @course_page = FirstPage.find_by_page_type('course') @school_id = params[:school_id] || User.current.user_extensions.school.try(:id) || 117 @logoLink ||= logolink() - - ##3-8月份为查找春季课程,9-2月份为查找秋季课程 - #month_now = Time.now.strftime("%m").to_i - #year_now = Time.new.strftime("%Y").to_i - #(month_now >= 3 && month_now < 9) ? course_term = l(:label_spring) : course_term = l(:label_autumn) - ##year_now -= 1 if year_now < 3 - #@school_id.nil? ? @cur_school_course = [] : @cur_school_course = find_miracle_course(10,7,@school_id, year_now, course_term) - ##未登录或者当前学校未开设课程 - #if @cur_school_course.empty? - # @has_course = false - # User.current.logged? ? course_count = 9 : course_count = 10 - # @cur_school_course += find_all_new_hot_course(course_count, @school_id, year_now, course_term) - # while @cur_school_course.count < 9 do - # if course_term == l(:label_spring) - # course_term = l(:label_autumn) - # year_now -= 1 - # else - # course_term = l(:label_spring) - # end - # @cur_school_course += find_all_new_hot_course((10-@cur_school_course.count), nil, year_now, course_term) - # end - #else - # if @cur_school_course.count < 9 - # @has_course = false - # @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, @school_id, year_now, course_term) - # if @cur_school_course.count < 9 - # if course_term == l(:label_spring) - # course_term = l(:label_autumn) - # year_now -= 1 - # else - # course_term = l(:label_spring) - # end - # @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, nil, year_now, course_term) - # end - # else - # @has_course = true - # end - #end end def logolink() diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index cc6c4f47e..fc723d5d5 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -4,7 +4,7 @@ class WordsController < ApplicationController include ApplicationHelper before_filter :find_user, :only => [:new, :create, :destroy, :more, :back] def create - if params[:new_form][:user_message].size>0 + if params[:new_form][:user_message].size>0 && User.current.logged? unless params[:user_id].nil? if params[:reference_content] message = params[:new_form][:user_message] + "\n" + params[:reference_content] @@ -13,26 +13,18 @@ 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 - # if a_message.size > 5 - # @message = a_message[-5, 5] - # else - # @message = a_message - # end - # @message_count = a_message.count + @jour = list.last 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').order('created_on DESC') + @jour = paginateHelper jours,10 respond_to do |format| - # format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} format.js - #format.api { render_api_ok } end end @@ -88,10 +80,10 @@ class WordsController < ApplicationController elsif @journal_destroyed.jour_type == "Principal" @user = User.find(@journal_destroyed.jour_id) @jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count + @is_user = true end respond_to do |format| format.js - #format.api { render_api_ok } end end @@ -204,7 +196,15 @@ class WordsController < ApplicationController flash[:error] = feedback.errors.full_messages[0] redirect_to project_feedback_url(params[:id]) end + end + #给用户留言 + def leave_user_message + @user = User.find(params[:id]) + if params[:new_form][:user_message].size>0 && User.current.logged? && @user + @user.add_jour(User.current, params[:new_form][:user_message]) + end + redirect_to feedback_path(@user) end # add by nwb diff --git a/app/helpers/activities_helper.rb b/app/helpers/activities_helper.rb index ede2ed78a..c8cb20ba9 100644 --- a/app/helpers/activities_helper.rb +++ b/app/helpers/activities_helper.rb @@ -42,4 +42,33 @@ module ActivitiesHelper end sorted_events end + + def get_container_type(activity) + if activity.act.nil? + return ['Unknow',0] + end + #问卷 + 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,activity.act.user_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/api_helper.rb b/app/helpers/api_helper.rb index fa231607a..f26f5c19b 100644 --- a/app/helpers/api_helper.rb +++ b/app/helpers/api_helper.rb @@ -1,5 +1,11 @@ # encoding: utf-8 module ApiHelper + ONE_MINUTE = 60 * 1000 + ONE_HOUR = 60 * ONE_MINUTE + ONE_DAY = 24 * ONE_HOUR + ONE_MONTH = 30 * ONE_DAY + + ONE_YEAR = 12 * ONE_MONTH #获取用户的工作单位 def get_user_work_unit user work_unit = "" @@ -66,7 +72,7 @@ module ApiHelper (user.language.nil? || user.language == "") ? 'zh':user.language end - # 获取课程作业的状态 + # 学生获取课程作业的状态 def get_homework_status homework homework_status = "" if !homework.nil? @@ -75,9 +81,9 @@ module ApiHelper when 1 homework_status = show_homework_deadline homework when 2 - homework_status = "正在匿评中" + homework_status = "正在匿评" when 3 - homework_status = "匿评已结束" + homework_status = "匿评结束" end elsif homework.homework_type == 0 homework_status = "未启用匿评" @@ -163,5 +169,37 @@ module ApiHelper end + # 获取当前时间 + def time_from_now time + lastUpdateTime = time.to_i*1000 + + currentTime = Time.now.to_i*1000 + timePassed = currentTime - lastUpdateTime; + timeIntoFormat = 0 + updateAtValue = "" + if timePassed < 0 + updateAtValue = "时间有问题" + elsif timePassed < ONE_MINUTE + updateAtValue = "一分钟前" + elsif timePassed < ONE_HOUR + timeIntoFormat = timePassed / ONE_MINUTE + updateAtValue = timeIntoFormat.to_s + "分钟前" + elsif (timePassed < ONE_DAY) + timeIntoFormat = timePassed / ONE_HOUR + updateAtValue = timeIntoFormat.to_s + "小时前" + elsif (timePassed < ONE_MONTH) + timeIntoFormat = timePassed / ONE_DAY + updateAtValue = timeIntoFormat.to_s + "天前" + elsif (timePassed < ONE_YEAR) + timeIntoFormat = timePassed / ONE_MONTH + updateAtValue = timeIntoFormat.to_s + "个月前" + else + timeIntoFormat = timePassed / ONE_YEAR + updateAtValue = timeIntoFormat.to_s + "年前" + end + updateAtValue + + end + end \ No newline at end of file diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 47a3b59ae..9b9bf5f76 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1812,7 +1812,7 @@ module ApplicationHelper #获取用户未过期的课程 def get_user_course user courses_doing = [] - user.courses.each do |course| + user.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course| if !course_endTime_timeout?(course) courses_doing.push course end @@ -1824,7 +1824,9 @@ module ApplicationHelper def attachment_candown attachment candown = false if attachment.container - if attachment.container.class.to_s != "HomeworkAttach" && attachment.container.class.to_s != "StudentWork" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project + if attachment.container.class.to_s=="PhoneAppVersion" + candown = true + elsif attachment.container.class.to_s != "HomeworkAttach" && attachment.container.class.to_s != "StudentWork" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project project = attachment.container.project candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1) elsif attachment.container.is_a?(Project) @@ -1850,6 +1852,7 @@ module ApplicationHelper candown = true elsif attachment.container.class.to_s=="StudentWork" candown = true + elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses course = attachment.container.courses.first candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1) @@ -2345,6 +2348,128 @@ module ApplicationHelper #将文本内的/n转换为
def text_format text - text.gsub("\n","
").html_safe + text.gsub("&","&").gsub("<","<").gsub(">",">").gsub("\n","
").html_safe + end + + #评分规则显示 + def scoring_rules late_penalty,homework_id,is_teacher,absence_penalty=nil + if absence_penalty + if late_penalty.to_i == 0 && absence_penalty.to_i == 0 + notice = "尚未设置评分规则" + if is_teacher + notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green") + end + elsif late_penalty.to_i != 0 && absence_penalty.to_i == 0 + notice = "迟交扣#{late_penalty}分,缺评扣分未设置" + elsif late_penalty.to_i == 0 && absence_penalty.to_i != 0 + notice = "迟交扣分未设置,缺评一个作品扣#{absence_penalty}分" + elsif late_penalty.to_i != 0 && absence_penalty.to_i != 0 + notice = "迟交扣#{late_penalty}分,缺评一个作品扣#{absence_penalty}分" + end + else + if late_penalty.to_i == 0 + notice = "尚未设置评分规则" + if is_teacher + notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green") + end + else + notice = "迟交扣#{late_penalty}分" + end + end + notice.html_safe + end + + #老师C语言的标准代码 + def c_stantard_code_teacher + "// 老师您好!这是一个C语言的样例程序 +// 程序功能:输入两个整数,输出两者之和 +// 测试集合:老师可以给出多组测试集,例如: +// 输入1和2,输出3 +// 输入3和4,输出7 +// ... ... +// 系统将根据您给出的测试集对学生代码进行自动评分 + +// 特别提醒:程序采用命令行传参方式,输入通过argv传入 +// 否则您的作业标准代码将不能通过测试 + +#include //引用必须头文件 +int main(int argc, char** argv) { + int a = atoi(argv[1]); //将第一个输入转成整型 + int b = atoi(argv[2]); //将第二个输入转换为整型 + + printf(\"%d\",a+b); //输出a+b + return 0; +}".html_safe + end + + #老师C++语言的标准代码 + def c_stantard_code_teacher_ + "// 老师您好!这是一个C++语言的样例程序 +// 程序功能:输入两个整数,输出两者之和 +// 测试集合:老师可以给出多组测试集,例如: +// 输入1和2,输出3 +// 输入3和4,输出7 +// ... ... +// 系统将根据您给出的测试集对学生代码进行自动评分 + +// 特别提醒:程序采用命令行传参方式,输入通过argv传入 +// 否则您的作业标准代码将不能通过测试 + +#include //引用必须头文件 +#include +using namespace std; +int main(int argc, char** argv){ + int a = atoi(argv[1]); //将第一个输入转成整型 + int b = atoi(argv[2]); //将第二个输入转换为整型 + cout< //引用必须头文件 +int main(int argc, char** argv) { + int a = atoi(argv[1]); //将第一个输入转成整型 + int b = atoi(argv[2]); //将第二个输入转换为整型 + + printf(\"%d\",a+b); //输出a+b + return 0; +}".html_safe + end + + #学生C++语言的标准代码 + def c_stantard_code_student_ + "// 同学好!这是一个C++语言的样例程序 +// 程序功能:输入两个整数,输出两者之和 +// 测试集合:老师可以给出多组测试集,例如: +// 输入1和2,输出3 +// 输入3和4,输出7 +// ... ... +// 系统将根据您给出的测试集对学生代码进行自动评分 + +// 特别提醒:程序采用命令行传参方式,输入通过argv传入 +// 否则您的作业标准代码将不能通过测试 + +#include //引用必须头文件 +#include +using namespace std; +int main(int argc, char** argv){ + int a = atoi(argv[1]); //将第一个输入转成整型 + int b = atoi(argv[2]); //将第二个输入转换为整型 + cout< activity.course_act.id) + when "News" + title = "通知公告 " + activity.course_act.title + url = course_news_index_path(activity.course) + when "Attachment" + title = "课件 " + activity.course_act.filename + url = course_files_path(activity.course) + when "Message" + title = "课程讨论区 " + activity.course_act.subject + url = course_boards_path(activity.course,:parent_id => activity.course_act.parent_id ? activity.course_act.parent_id : activity.course_act.id, :topic_id => activity.course_act.id) + when "JournalsForMessage" + title = "留言 " + activity.course_act.notes + url = course_feedback_path(activity.course) + when "Poll" + title = "问卷 " + activity.course_act.polls_name + url = poll_path(activity.course_act_id) + end + end + link_to title.gsub(/<(?!img)[^>]*>/,'').html_safe, url, :class => "problem_tit c_dblue fl fb" + end + + #课程动态的描述 + def course_activity_desc activity + desc = "" + if activity.course_act + case activity.course_act_type + when "Course" + desc = "" + when "HomeworkCommon" + desc = activity.course_act.description + when "News" + desc = activity.course_act.description + when "Attachment" + desc = "" + when "Message" + desc = activity.course_act.content + when "JournalsForMessage" + desc = "" + when "Poll" + desc = activity.course_act.polls_description + end + end + desc.html_safe + end end diff --git a/app/helpers/homework_common_helper.rb b/app/helpers/homework_common_helper.rb index a2ff6dbab..43f815250 100644 --- a/app/helpers/homework_common_helper.rb +++ b/app/helpers/homework_common_helper.rb @@ -27,6 +27,19 @@ module HomeworkCommonHelper type end + def programing_languages_options + type = [] + option = [] + option << "C" + option << 1 + type << option + option_1 = [] + option_1 << "C++" + option_1 << 2 + type << option_1 + type + end + #缺评扣分 def absence_penalty_option type = [] @@ -53,31 +66,31 @@ module HomeworkCommonHelper link end - #评分规则显示 - def scoring_rules late_penalty,homework_id,is_teacher,absence_penalty=nil - if absence_penalty - if late_penalty.to_i == 0 && absence_penalty.to_i == 0 - notice = "尚未设置评分规则" - if is_teacher - notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green") - end - elsif late_penalty.to_i != 0 && absence_penalty.to_i == 0 - notice = "迟交扣#{late_penalty}分,缺评扣分未设置" - elsif late_penalty.to_i == 0 && absence_penalty.to_i != 0 - notice = "迟交扣分未设置,缺评一个作品扣#{absence_penalty}分" - elsif late_penalty.to_i != 0 && absence_penalty.to_i != 0 - notice = "迟交扣#{late_penalty}分,缺评一个作品扣#{absence_penalty}分" - end - else - if late_penalty.to_i == 0 - notice = "尚未设置评分规则" - if is_teacher - notice += ",请 " + link_to("设置",edit_homework_common_path(homework_id),:class => "c_green") - end + #将状态转换为错误信息 + def status_to_err_msg status + case status.to_i + when -1 + '编译出错' + when -2 + '输入和输出不匹配' + when -3 + '输入和输出不匹配' + when 1 + '运行出错' + when 2 + '超时' + when 3 + '内存超出' + when 4 + '输出超出' + when 5 + '禁用函数' + when 6 + '其他错误' + when 0 + '成功' else - notice = "迟交扣#{late_penalty}分" - end + '未知错误' end - notice.html_safe end end \ No newline at end of file diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb index 06b154d36..9dd0bed8c 100644 --- a/app/helpers/members_helper.rb +++ b/app/helpers/members_helper.rb @@ -38,7 +38,7 @@ module MembersHelper scope = [] end principals = paginateHelper scope,10 - s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5') + s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals') links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| link_to text, autocomplete_project_memberships_path(project, parameters.merge(:q => params[:q],:flag => true, :format => 'js')), :remote => true } diff --git a/app/helpers/poll_helper.rb b/app/helpers/poll_helper.rb index 3156f1b3a..22ee21936 100644 --- a/app/helpers/poll_helper.rb +++ b/app/helpers/poll_helper.rb @@ -74,4 +74,13 @@ module PollHelper end end + #带勾选框的问卷列表 + def poll_check_box_tags(name,polls,current_poll) + s = '' + polls.each do |poll| + s << "
" + end + s.html_safe + end + end \ No newline at end of file diff --git a/app/helpers/praise_tread_helper.rb b/app/helpers/praise_tread_helper.rb index 90ce6d61d..c142f0973 100644 --- a/app/helpers/praise_tread_helper.rb +++ b/app/helpers/praise_tread_helper.rb @@ -20,9 +20,9 @@ module PraiseTreadHelper # when 0 # return @record.tread_num.nil? ? 0 : @record.tread_num # end - return (@record.praise_num.to_i-@record.tread_num.to_i) + return ((@record.praise_num.nil? ? 0 : @record.praise_num.to_i)-(@record.tread_num.nil? ? 0 : @record.tread_num.to_i)) else - return 0 + return 0 end end diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 5cbc3af5a..c77eba0c5 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -236,13 +236,14 @@ module RepositoriesHelper # 判断项目是否有主版本库 def judge_main_repository(pro) if pro.repositories.blank? - return false + status = false else - pro.repositories.sort.each do |rep| - rep.is_default? - return true + pro.repositories.each do |rep| + status = true and break if rep.is_default? + status = false end end + status end # def cvs_field_tags(form, repository) # content_tag('p', form.text_field( diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index af2d5abc4..49865d335 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -303,4 +303,207 @@ 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) + user.courses.visible.where("tea_id = ?",user.id).count + end + + #获取加入课程数 + def get_join_course_count(user) + user.courses.visible.count - get_create_course_count(user) + end + + #发布作业数 + def get_homework_commons_count(user) + HomeworkCommon.where("user_id = ?",user.id).count + end + + #资源数 + def get_projectandcourse_attachment_count(user) + Attachment.where("author_id = ? and container_type in ('Project','Course')",user.id).count + end + + #创建项目数 + def get_create_project_count(user) + user.projects.visible.where("projects.user_id=#{user.id}").count + end + + #加入项目数 + def get_join_project_count(user) + user.projects.visible.count - get_create_project_count(user) + end + + #创建缺陷数 + def get_create_issue_count(user) + Issue.where("author_id = ?",user.id).count + end + + #解决缺陷数 + def get_resolve_issue_count(user) + Issue.where("assigned_to_id = ? and status_id=3",user.id).count + end + + #参与匿评数 + def get_anonymous_evaluation_count(user) + StudentWorksScore.where("user_id = ? and reviewer_role=3",user.id).count + end + + def query_activities(query) + list = query.limit(13).all + result = [] + for item in list + container = get_activity_container(item) + result << { :item=>item,:e=>container } + end + result + end + + def get_activity_container activity + return activity.activity_container + end + + def get_activity_act_showname_htmlclear(activity) + str = get_activity_act_showname(activity) + str = str.gsub(/<.*>/,'') + str = str.gsub(/\r/,'') + str = str.gsub(/\n/,'') + 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" + arr = details_to_strings(activity.act.details,true) + arr << activity.act.notes + str = '' + arr.each { |item| str = str+item } + return str + 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..63081be6f 100644 --- a/app/models/activity.rb +++ b/app/models/activity.rb @@ -2,9 +2,23 @@ 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 + params =get_container_type(self) + self.activity_container_type = params[0] + self.activity_container_id = params[1] + if(self.act_type == 'JournalsForMessage') + self.user_id = params[2] + end + end end diff --git a/app/models/attachment.rb b/app/models/attachment.rb index f999e27d6..f7fb9b1aa 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -27,6 +27,8 @@ class Attachment < ActiveRecord::Base belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" # 被ForgeActivity虚拟关联 has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy # end include UserScoreHelper @@ -71,8 +73,8 @@ class Attachment < ActiveRecord::Base cattr_accessor :thumbnails_storage_path @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") - before_save :files_to_final_location - after_create :office_conver, :be_user_score,:act_as_forge_activity# user_score + before_save :files_to_final_location,:act_as_course_activity + after_create :office_conver, :be_user_score,:act_as_forge_activity after_update :office_conver, :be_user_score after_destroy :delete_from_disk,:down_user_score @@ -552,4 +554,10 @@ class Attachment < ActiveRecord::Base end end + #课程动态公共表记录 + def act_as_course_activity + if self.container_type == "Course" && self.course_acts.empty? + self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.container_id) + end + end end diff --git a/app/models/course.rb b/app/models/course.rb index 6d71ad967..26220f245 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -33,6 +33,11 @@ class Course < ActiveRecord::Base has_many :student_works, :through => :homework_commons, :dependent => :destroy has_many :course_groups, :dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy + + has_many :course_activities + has_many :course_messages acts_as_taggable acts_as_nested_set :order => 'name', :dependent => :destroy @@ -44,7 +49,7 @@ class Course < ActiveRecord::Base validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/ validates_length_of :description, :maximum => 10000 before_save :self_validate - after_create :create_board_sync + after_create :create_board_sync, :act_as_course_activity before_destroy :delete_all_members safe_attributes 'extra', @@ -310,6 +315,11 @@ class Course < ActiveRecord::Base end end + #课程动态公共表记录 + def act_as_course_activity + self.course_acts << CourseActivity.new(:user_id => self.tea_id,:course_id => self.id) + end + #项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题 #def name # read_attribute('name') || Project.find_by_identifier(self.extra).try(:name) diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb new file mode 100644 index 000000000..02b6dacf1 --- /dev/null +++ b/app/models/course_activity.rb @@ -0,0 +1,7 @@ +class CourseActivity < ActiveRecord::Base + attr_accessible :user_id, :course_act_id,:course_act_type,:course_id + # 虚拟关联 + belongs_to :course_act ,:polymorphic => true + belongs_to :course + belongs_to :user +end diff --git a/app/models/course_message.rb b/app/models/course_message.rb new file mode 100644 index 000000000..59089829d --- /dev/null +++ b/app/models/course_message.rb @@ -0,0 +1,12 @@ +class CourseMessage < ActiveRecord::Base + attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed + + # 多态 虚拟关联 + belongs_to :course_message ,:polymorphic => true + belongs_to :course + belongs_to :user + validates :user_id,presence: true + validates :course_id,presence: true + validates :course_message_id,presence: true + validates :course_message_type, presence: true +end diff --git a/app/models/dts.rb b/app/models/dts.rb new file mode 100644 index 000000000..3a9dcbcfb --- /dev/null +++ b/app/models/dts.rb @@ -0,0 +1,5 @@ +class Dts < ActiveRecord::Base + attr_accessible :Category, :Defect, :Description, :File, :IPLine, :IPLineCode, :Method, :Num, :PreConditions, :Review, :StartLine, :TraceInfo, :Variable, :project_id + + belongs_to :project +end diff --git a/app/models/forge_message.rb b/app/models/forge_message.rb new file mode 100644 index 000000000..1543fab58 --- /dev/null +++ b/app/models/forge_message.rb @@ -0,0 +1,20 @@ +class ForgeMessage < ActiveRecord::Base + # 公共表中活动类型,命名规则:TYPE_OF_{类名}_ACT + TYPE_OF_ISSUE_ACT = "Issue" + TYPE_OF_MESSAGE_ACT = "Message" + TYPE_OF_ATTACHMENT_ACT = "Attachment" + TYPE_OF_DOCUMENT_ACT = "Document" + TYPE_OF_JOURNAL_ACT = "Journal" + TYPE_OF_WIKI_ACT = "Wiki" + TYPE_OF_NEWS_ACT = "News" + + attr_accessible :forge_message_id, :forge_message_type, :project_id, :user_id, :viewed + + belongs_to :forge_message ,:polymorphic => true + belongs_to :project + belongs_to :user + validates :user_id,presence: true + validates :project_id,presence: true + validates :forge_message_id,presence: true + validates :forge_message_type, presence: true +end diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 291c14563..217c7d770 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -13,17 +13,40 @@ class HomeworkCommon < ActiveRecord::Base has_many :student_works, :dependent => :destroy has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表 has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动 + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy + # 课程消息 + has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy acts_as_attachable acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" }, :description => :description, :author => :author, :url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}} - after_create :act_as_activity, :send_mail + after_create :act_as_activity, :send_mail, :act_as_course_activity, :act_as_course_message after_destroy :delete_kindeditor_assets def act_as_activity self.acts << Activity.new(:user_id => self.user_id) end + + #课程动态公共表记录 + def act_as_course_activity + if self.course + self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.course_id) + end + end + + #课程作业消息记录 + def act_as_course_message + if self.course + self.course.members.each do |m| + if m.user_id != self.user_id + self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false) + end + end + end + end + #删除对应的图片 def delete_kindeditor_assets delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON diff --git a/app/models/homework_test.rb b/app/models/homework_test.rb index 7c477bfaf..df2848194 100644 --- a/app/models/homework_test.rb +++ b/app/models/homework_test.rb @@ -1,6 +1,6 @@ class HomeworkTest < ActiveRecord::Base - attr_accessible :input, :output, :homework_common_id + attr_accessible :input, :output, :homework_common_id,:result,:error_msg belongs_to :homework_common - has_one :student_work_test + has_many :student_work_test end diff --git a/app/models/issue.rb b/app/models/issue.rb index c2670a0cc..66627c00a 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -49,6 +49,8 @@ class Issue < ActiveRecord::Base has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy # end has_many :praise_tread, as: :praise_tread_object, dependent: :destroy + # ForgeMessage虚拟关联(多态) + has_many :forge_messages, :class_name => 'ForgeMessage',:as =>:forge_message ,:dependent => :destroy acts_as_nested_set :scope => 'root_id', :dependent => :destroy @@ -80,7 +82,7 @@ class Issue < ActiveRecord::Base attr_reader :current_journal # fq - after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity + after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message after_update :be_user_score after_destroy :down_user_score # after_create :be_user_score @@ -138,6 +140,16 @@ class Issue < ActiveRecord::Base :project_id => self.project_id) end # end + + # 发布缺陷forge_messages中添加记录 + def act_as_forge_message + # 指派给自己的缺陷不提示消息 + unless self.author_id == self.assigned_to_id + self.forge_messages << ForgeMessage.new(:user_id => self.assigned_to_id, + :project_id => self.project_id, + :viewed => false) + end + end # Returns a SQL conditions string used to find all issues visible by the specified user @@ -235,9 +247,10 @@ class Issue < ActiveRecord::Base base_reload(*args) end - def to_param - @to_param ||= "#{id}_#{self.project.name}(#{self.project.issues.index(self).to_i+1}-#{self.project.issues.count})"#.parameterize - end + # 之所以注释是以为最终以id形式显示,另外如果项目名称带点号或者纯数字会出现问题 + # def to_param + # @to_param ||= "#{id}_#{self.project.name}(#{self.project.issues.index(self).to_i+1}-#{self.project.issues.count})"#.parameterize + # end # Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields def available_custom_fields diff --git a/app/models/journal.rb b/app/models/journal.rb index 3b660132e..c705b1a09 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -29,6 +29,8 @@ class Journal < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy # 被ForgeActivity虚拟关联 has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + # 被ForgeMessage虚拟关联 + has_many :forge_messages, :class_name => 'ForgeMessage',:as =>:forge_message ,:dependent => :destroy # end attr_accessor :indice @@ -48,7 +50,7 @@ class Journal < ActiveRecord::Base before_create :split_private_notes # fq - after_save :act_as_activity,:be_user_score,:act_as_forge_activity + after_save :act_as_activity,:be_user_score,:act_as_forge_activity, :act_as_forge_message # end #after_destroy :down_user_score #before_save :be_user_score @@ -163,10 +165,17 @@ class Journal < ActiveRecord::Base # Description 公共表中需要保存一份该记录 def act_as_forge_activity self.forge_acts << ForgeActivity.new(:user_id => self.user_id, - :project_id => self.issue.project.id) + :project_id => self.issue.project.id) end + # 缺陷状态更改,消息提醒 + def act_as_forge_message + self.forge_messages << ForgeMessage.new(:user_id => self.issue.author_id, + :project_id => self.issue.project_id, + :viewed => false) + end + # 更新用户分数 -by zjc def be_user_score #新建了缺陷留言且留言不为空,不为空白 diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index b15c9b2d1..bcae58174 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -56,9 +56,11 @@ class JournalsForMessage < ActiveRecord::Base acts_as_attachable has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy validates :notes, presence: true, if: :is_homework_jour? - after_create :act_as_activity #huang + after_create :act_as_activity, :act_as_course_activity after_create :reset_counters! after_destroy :reset_counters! after_save :be_user_score @@ -177,4 +179,11 @@ class JournalsForMessage < ActiveRecord::Base def delete_kindeditor_assets delete_kindeditor_assets_from_disk self.id,7 end + + #课程动态公共表记录 + def act_as_course_activity + if self.jour_type == 'Course' + self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.jour_id) + end + end end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 5ae9df001..a25aff6bb 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -388,7 +388,8 @@ class Mailer < ActionMailer::Base @user = applied.user recipients = @project.manager_recipients s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) - @applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members') + @token = Token.get_token_from_user(@user, 'autologin') + @applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members', :token => @token.value) mail :to => recipients, :subject => s end diff --git a/app/models/message.rb b/app/models/message.rb index 15d358789..aa62cd625 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -32,7 +32,12 @@ class Message < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy # 被ForgeActivity虚拟关联 has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy # end + # 课程消息 + has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy + #end has_many :ActivityNotifies,:as => :activity, :dependent => :destroy @@ -68,7 +73,7 @@ class Message < ActiveRecord::Base after_update :update_messages_board after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets - after_create :act_as_activity,:be_user_score,:act_as_forge_activity, :send_mail + after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_course_message, :send_mail #before_save :be_user_score scope :visible, lambda {|*args| @@ -185,6 +190,61 @@ class Message < ActiveRecord::Base :project_id => self.board.project.id) end end + + #课程动态公共表记录 + def act_as_course_activity + if self.course + self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.board.course_id) + end + end + + # 课程讨论区添加消息 + # 老师发帖所有人都能收到消息 + # 学生发帖,有人回复则给该学生消息,没回复则不给其它人发送消息 + # 帖子被回复的可以收到消息通知 + def act_as_course_message + if self.course + if self.parent_id.nil? #主贴 + self.course.members.each do |m| + if self.author.allowed_to?(:as_teacher, self.course) # 老师 + if m.user_id != self.author_id # 自己的帖子不给自己发送消息 + self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false) + end + end + end + else # 回帖 + #if self.author.allowed_to?(:as_teacher, self.course) # 老师 + self.course.members.each do |m| + if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息 + self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false) + end + end + #end + end + end + # if self.author.allowed_to?(:as_teacher, self.course) # 如果发帖人是老师 + # self.course.members.each do |m| + # if self.parent_id.nil? # 主贴 + # if m.user_id != self.author_id # 自己的帖子不给自己发送消息 + # self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false) + # end + # else # 回帖只针对主贴发送消息 + # if m.user_id == Message.find(self.parent_id).author_id + # self.course_messages << CourseMessage.new(:user_id => self.parent_id, :course_id => self.board.course_id, :viewed => false) + # end + # end + # end + # else # 学生只针对主贴回复 + # unless self.parent_id.nil? + # self.course.members.each do |m| + # if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息 + # self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false) + # end + # end + # end + # end + #end + end #更新用户分数 -by zjc def be_user_score diff --git a/app/models/news.rb b/app/models/news.rb index 7d33d760e..99d26d456 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -28,7 +28,12 @@ class News < ActiveRecord::Base has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy # 被ForgeActivity虚拟关联 has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy # end + # 课程消息 + has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy + #end has_many :ActivityNotifies,:as => :activity, :dependent => :destroy @@ -49,7 +54,7 @@ class News < ActiveRecord::Base :author_key => :author_id acts_as_watchable - after_create :act_as_activity,:act_as_forge_activity,:add_author_as_watcher, :send_mail + after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_course_messge, :add_author_as_watcher, :send_mail after_destroy :delete_kindeditor_assets @@ -121,6 +126,25 @@ class News < ActiveRecord::Base end end + #课程动态公共表记录 + def act_as_course_activity + if self.course + self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.course_id) + end + end + + #课程通知 消息发送 + #消息发送原则:除了消息的发布者,课程的其它成员都能收到消息提醒 + def act_as_course_messge + if self.course + self.course.members.each do |m| + if m.user_id != self.author_id + self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false) + end + end + end + end + # Time 2015-03-31 13:50:54 # Author lizanle # Description 删除news后删除对应的资源 @@ -132,4 +156,4 @@ class News < ActiveRecord::Base Mailer.run.news_added(self) if Setting.notified_events.include?('news_added') end -end +end \ No newline at end of file diff --git a/app/models/poll.rb b/app/models/poll.rb index 64e9df79a..62f91380b 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -8,7 +8,12 @@ class Poll < ActiveRecord::Base has_many :users, :through => :poll_users #该文件被哪些用户提交答案过 # 添加课程的poll动态 has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy - after_create :act_as_activity + # 课程动态 + has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy + after_create :act_as_activity, :act_as_course_activity + # 课程消息 + has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy + after_create :act_as_activity, :act_as_course_activity, :act_as_course_message acts_as_event :title => Proc.new {|o| "#{l(:label_course_poll)}: #{o.polls_name}" }, :description => :polls_description, @@ -27,4 +32,26 @@ class Poll < ActiveRecord::Base self.acts << Activity.new(:user_id => self.user_id) end + #课程动态公共表记录 + def act_as_course_activity + if self.polls_type == "Course" + if self.polls_status == 2 #问卷是发布状态 + self.course_acts << CourseActivity.new(:user_id => self.user_id,:course_id => self.polls_group_id) + elsif self.polls_status == 1 #问卷是新建状态 + self.course_acts.destroy_all + end + end + end + + # 发布问卷,出了发布者外,其他人都能收到消息通知 + def act_as_course_message + if self.polls_type == "Course" + Course.find(self.polls_group_id).members.each do |m| + if m.user_id != self.user_id + self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.polls_group_id, :viewed => false) + end + end + end + end + end diff --git a/app/models/project.rb b/app/models/project.rb index f201e6e3c..77711edff 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -68,6 +68,7 @@ class Project < ActiveRecord::Base has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy has_many :applied_projects has_many :invite_lists + has_one :dts # end #ADDED BY NIE @@ -90,6 +91,8 @@ class Project < ActiveRecord::Base has_many :tags, :through => :project_tags, :class_name => 'Tag' has_many :project_tags, :class_name => 'ProjectTags' + # 关联虚拟表 + has_many :forge_messages belongs_to :organization diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index c1f0020eb..7c484e87f 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -38,6 +38,12 @@ class Repository::Git < Repository 'Git' end + def commits(authors, start_date, end_date, branch='master') + scm.commits(authors, start_date, end_date,branch).map {|commit| + [commit[:author], commit[:num]] + } + end + def report_last_commit extra_report_last_commit end diff --git a/app/models/student_work.rb b/app/models/student_work.rb index c80d1315b..b95c11c11 100644 --- a/app/models/student_work.rb +++ b/app/models/student_work.rb @@ -7,7 +7,7 @@ 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 + has_many :student_work_test before_destroy :delete_praise diff --git a/app/models/student_work_test.rb b/app/models/student_work_test.rb index d9ac5e935..413528b82 100644 --- a/app/models/student_work_test.rb +++ b/app/models/student_work_test.rb @@ -1,12 +1,12 @@ # encoding: utf-8 class StudentWorkTest < ActiveRecord::Base - attr_accessible :student_work_id, :homework_test_id + attr_accessible :student_work_id, :homework_test_id, :result, :error_msg belongs_to :homework_test belongs_to :student_work def status_to_s - case self.result + case self.result.to_i when -1 '编译出错' when -2 @@ -33,7 +33,7 @@ class StudentWorkTest < ActiveRecord::Base end def test_score - if self.result == 0 + if self.result.to_i == 0 format("%.1f",100.0 / self.student_work.homework_common.homework_tests.count) else 0 diff --git a/app/models/user.rb b/app/models/user.rb index 005c394a8..9f88ff53a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -109,7 +109,6 @@ class User < Principal has_many :contests, :foreign_key => 'author_id', :dependent => :destroy has_many :softapplications, :foreign_key => 'user_id', :dependent => :destroy has_many :journals_for_messages, :as => :jour, :dependent => :destroy - has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1" has_many :journal_replies, :dependent => :destroy has_many :activities, :dependent => :destroy has_many :students_for_courses @@ -128,8 +127,15 @@ class User < Principal has_many :messages, :foreign_key => 'author_id' has_one :user_score, :dependent => :destroy has_many :documents # 项目中关联的文档再次与人关联 +# 关联虚拟表 + has_many :forge_messages + has_many :course_messages # end +# 虚拟转换 + has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1" + has_many :issue_assigns, :class_name => 'ForgeMessage', :conditions => 'viewed=0 and forge_message_type="Issue"' + has_many :status_updates, :class_name => 'ForgeMessage', :conditions => 'viewed=0 and forge_message_type="Journal"' # 邮件邀请状态 # has_many :invite_lists # end @@ -235,6 +241,28 @@ class User < Principal # ====================================================================== + # 查询用户未读过的记录 + # 用户留言记录 + def count_new_jour + count = self.new_jours.count + # count = self.journals_for_messages(:conditions => ["status=? and is_readed = ? " ,1, 0]).count + end + + # 查询指派给我的缺陷记录 + def count_new_issue_assign_to + self.issue_assigns + end + + # 新消息统计 + def count_new_message + count = CourseMessage.where("user_id =? and viewed =?", User.current.id, 0).count + end + # 查询指派给我的缺陷记录 + def issue_status_update + self.status_updates + end + # end + def extensions self.user_extensions ||= UserExtensions.new end @@ -258,7 +286,7 @@ class User < Principal ###添加留言 fq def add_jour(user, notes, reference_user_id = 0, options = {}) if options.count == 0 - self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id, :status => true) + self.journals_for_messages << JournalsForMessage.new(:user_id => user.id, :notes => notes, :reply_id => reference_user_id, :status => true, :is_readed => false) else jfm = self.journals_for_messages.build(options) jfm.save @@ -291,11 +319,7 @@ class User < Principal name end ## end - - def count_new_jour - count = self.new_jours.count - end - + #added by nie def count_new_journal_reply count = self.journal_reply.count @@ -418,7 +442,7 @@ class User < Principal end def nickname(formatter = nil) - login + login.nil? || (login && login.empty?) ? "AnonymousUser" : login end def name(formatter = nil) 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..c2944fed5 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -654,37 +654,42 @@ class CoursesService return end if current_user == @user || current_user.admin? - membership = @user.coursememberships.page(1).per(15) + membership = @user.coursememberships else - membership = @user.coursememberships.page(1).per(15).all(:conditions => Course.visible_condition(current_user)) + membership = @user.coursememberships.all(:conditions => Course.visible_condition(current_user)) end if membership.nil? || membership.count == 0 raise l(:label_no_courses, :locale => get_user_language(current_user)) end - membership.sort! { |older, newer| newer.created_on <=> older.created_on } + #membership.sort! { |older, newer| newer.created_on <=> older.created_on } #定义一个数组集合,存放hash数组,该hash数组包括课程的信息,并包含课程的最新发布的资源,最新的讨论区留言,最新的作业,最新的通知 result = [] #对用户所有的课程进行循环,找到每个课程最新发布的资源,最新的讨论区留言,最新的作业,最新的通知,并存进数组 + membership.each do |mp| course = mp.course latest_course_dynamics = [] + notices_count = 0 + topic_count = 0 + topics = nil + homeworkss = nil + notices = nil # 课程通知 latest_news = course.news.page(1).per(2).order("created_on desc") unless latest_news.first.nil? - latest_course_dynamics << {:type => 1, :time => latest_news.first.created_on,:count=>course.news.count, - :news => latest_news.all} + notices_count = course.news.count + notices = latest_news.all + latest_course_dynamics << {:time => latest_news.first.created_on } 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? + topic_count = course.boards.nil? ? 0 : course.boards.first.topics.count + topics = latest_message.all + latest_course_dynamics << {:time => latest_message.first.created_on} + end # 课程资源 # latest_attachment = course.attachments.order("created_on desc").page(1).per(2) # unless latest_attachment.first.nil? @@ -695,14 +700,17 @@ class CoursesService #课程作业 已经交的学生列表(暂定显示6人),未交的学生列表,作业的状态 homeworks = course.homework_commons.page(1).per(2).order('created_at desc') unless homeworks.first.nil? - latest_course_dynamics << {:type => 4, :time => homeworks.first.updated_at, :count=>course.homework_commons.count , :homeworks => homeworks} + homeworkss = homeworks + latest_course_dynamics << {:time => homeworks.first.updated_at} end latest_course_dynamics.sort! { |order, newer| newer[:time] <=> order[:time] } # 课程学霸 学生总分数排名靠前的5个人 homework_count = course.homework_commons.count sql = "select users.*,ROUND(sum(student_works.final_score),2) score from student_works left outer join users on student_works.user_id = users.id" << " where homework_common_id in ( select id from homework_commons where homework_commons.course_id = #{course.id}) GROUP BY student_works.user_id ORDER BY score desc limit 0,4" + better_students = User.find_by_sql(sql) + # 找出在课程讨论区发帖回帖数最多的 active_students = [] sql1 = " select users.*,count(author_id)*2 active_count from messages " << @@ -711,20 +719,41 @@ class CoursesService " GROUP BY messages.author_id ORDER BY count(author_id) desc " << " limit 0,4" active_students = User.find_by_sql(sql1) + if homework_count != 0 && !better_students.empty? - latest_course_dynamics <<{:type=> 6,:time=>Time.now.to_s,:count=> 4,:better_students=> better_students} + latest_course_dynamics <<{:time=>"1970-01-01 0:0:0 +0800"} end unless active_students.empty? - latest_course_dynamics <<{:type=> 7,:time=>Time.now.to_s,:count=> 4,:active_students=>active_students} + latest_course_dynamics <<{:time=>"1970-01-01 0:0:0 +0800"} end latest_course_dynamic = latest_course_dynamics.first unless latest_course_dynamic.nil? - result << {:course_name => course.name,:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course), :course_id => course.id, :course_img_url => url_to_avatar(course), :course_time => course.time, :course_term => course.term,:message => "", :dynamics => latest_course_dynamics, - :course_student_num=>course ? course.members.count : 0,:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "前"} + result << {:course_name => course.name, + :current_user_is_member => current_user.member_of_course?(course), + :current_user_is_teacher => is_course_teacher(current_user,course), + :course_id => course.id, + :course_img_url => url_to_avatar(course), + :course_time => course.time, + :course_term => course.term, + :news_count => notices_count, + :homework_count => homework_count, + :topic_count => topic_count, + :news => notices, + :homeworks => homeworkss, + :topics => topics, + :better_students => better_students, + :active_students => active_students, + :message => "", + :course_student_num=>course ? course.members.count : 0, + #:time_from_now=> distance_of_time_in_words(Time.now, latest_course_dynamic[:time].to_time) << "前", + :time_from_now=>time_from_now(latest_course_dynamic[:time].to_time), #.strftime('%Y-%m-%d %H:%M:%S').to_s, + :time=>latest_course_dynamic[:time].to_time} end + end #返回数组集合 - result.sort! { |order, newer| newer[:update_time] <=> order[:update_time] } + result.sort! { |order, newer| newer[:time] <=> order[:time] } + result end @@ -760,7 +789,7 @@ class CoursesService # 获取某次作业的所有作业列表 def student_work_list params,current_user - is_teacher = User.current.allowed_to?(:as_teacher,Course.find(params[:course_id])) + is_teacher = current_user.allowed_to?(:as_teacher,Course.find(params[:course_id])) homework = HomeworkCommon.find(params[:homework_id]) student_works = [] #老师 || 非匿评作业 || 匿评结束 显示所有的作品 @@ -788,6 +817,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/account/lost_password.html.erb b/app/views/account/lost_password.html.erb index 8ed93f36c..3c6c57f52 100644 --- a/app/views/account/lost_password.html.erb +++ b/app/views/account/lost_password.html.erb @@ -9,7 +9,7 @@

- <%= text_field_tag 'mail', nil, :size => 40 %> + <%= text_field_tag 'mail', nil, :size => 40, :placeholder => '请输入注册邮箱'%> <%= submit_tag l(:button_submit) %>

diff --git a/app/views/admin/_tab_messages.erb b/app/views/admin/_tab_messages.erb new file mode 100644 index 000000000..ec04246ba --- /dev/null +++ b/app/views/admin/_tab_messages.erb @@ -0,0 +1,8 @@ +
+
    +
  • <%= link_to l(:label_forum), {:action => 'messages_list'}, class: "#{current_page?(messages_list_path)? 'selected' : nil }" %>
  • +
  • <%= link_to l(:label_borad_course), {:action => 'course_messages'}, class: "#{current_page?(course_messages_path)? 'selected' : nil }" %>
  • +
  • <%= link_to l(:label_borad_project), {:action => 'project_messages'}, class: "#{current_page?(project_messages_path)? 'selected' : nil }" %>
  • + +
+
\ No newline at end of file diff --git a/app/views/admin/course_messages.html.erb b/app/views/admin/course_messages.html.erb new file mode 100644 index 000000000..8564d13dc --- /dev/null +++ b/app/views/admin/course_messages.html.erb @@ -0,0 +1,66 @@ +

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

+ +<%= render 'tab_messages' %> +

<%=l(:label_borad_course) %>

+
+ + + + + + + + + + + + + <% @count=0%> + <% for course in @course_ms -%> + + <% @count=@count + 1 %> + "> + + + + + + + + + <% end %> + +
+ 序号 + + 来源 + + 作者 + + 时间 + + 标题 + + 回复数 +
+ <%= @count %> + + <%= Board.where('id=?',course.board_id).first.course_id %> + <%= course.try(:author)%><% else %><%=course.try(:author).try(:realname) %><% end %>'> + <% if course.try(:author).try(:realname) == ' '%> + <%= link_to(course.try(:author), user_path(course.author)) %> + <% else %> + <%= link_to(course.try(:author).try(:realname), user_path(course.author)) %> + <% end %> + + <%= format_date(course.created_on) %> + + <%= course.subject %> + + <%=course.replies_count %> +
+
+ +<% html_title(l(:label_message_plural)) -%> diff --git a/app/views/admin/homework.html.erb b/app/views/admin/homework.html.erb new file mode 100644 index 000000000..360ca4e39 --- /dev/null +++ b/app/views/admin/homework.html.erb @@ -0,0 +1,62 @@ +

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

+ +
+ + + + + + + + + + + + + <%@count=0 %> + <% for homework in @homework do %> + <% @count+=1 %> + + + + + + + + + <% end %> + +
+ 序号 + + 作业名称 + + 课程名称 + + 作者 + + 提交作品数 + + 提交截止日期 +
+ <%=@count %> + + <%=link_to(homework.name, student_work_index_path(:homework => homework.id))%> + + <%= link_to(homework.course.name, course_path(homework.course.id)) %> + <%= homework.try(:user)%><% else %><%=homework.try(:user).try(:realname) %><% end %>'> + <% if homework.try(:user).try(:realname) == ' '%> + <%= link_to(homework.try(:user), user_path(homework.user_id)) %> + <% else %> + <%= link_to(homework.try(:user).try(:realname), user_path(homework.user_id)) %> + <% end %> + + <%=StudentWork.where('homework_common_id=?',homework.id).count %> + + <%=format_date(homework.end_time) %> +
+
+ +<% html_title(l(:label_user_homework)) -%> diff --git a/app/views/admin/latest_login_users.html.erb b/app/views/admin/latest_login_users.html.erb new file mode 100644 index 000000000..dc35daec8 --- /dev/null +++ b/app/views/admin/latest_login_users.html.erb @@ -0,0 +1,73 @@ +

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

+ +
+ + + + + + + + + + + + + <% @count=0 %> + <% for user in @user do %> + + <% @count +=1 %> + + + + + + + + <% end %> + +
+ 序号 + + 登录时间 + + 用户id + + 用户姓名 + + 用户昵称 + + 用户身份 +
+ <%=@count %> + + <%=format_date(user.last_login_on) %> + + <%=user.id %> + <%= user.login%><% else %><%=user.try(:realname) %><% end %>'> + <% if user.try(:realname) == ' '%> + <%= link_to(user.login, user_path(user)) %> + <% else %> + <%= link_to(user.try(:realname), user_path(user)) %> + <% end %> + + <%=link_to(user.login, user_path(user)) %> + + <% case user.user_extensions.identity %> + <% when 0 %> + <%='老师' %> + <% when 1 %> + <%='学生' %> + <% when 2 %> + <%='企业' %> + <% when 3 %> + <%='开发者' %> + <% else %> + <%='未知身份' %> + <% end %> +
+
+ +<% html_title(l(:label_latest_login_user_list)) -%> diff --git a/app/views/admin/leave_messages.html.erb b/app/views/admin/leave_messages.html.erb new file mode 100644 index 000000000..975c60b15 --- /dev/null +++ b/app/views/admin/leave_messages.html.erb @@ -0,0 +1,79 @@ +

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

+ + +
+ + + + + + + + + + + + + + <% @count=0%> + <% for journal in @jour -%> + <% @count=@count + 1 %> + "> + + + + + + + + + <% end %> + +
+ 序号 + + 类型 + + 来源 + + 留言人 + + 留言时间 + + 留言内容 + + 回复数 +
+ <%= @count %> + + <%case journal.jour_type %> + <% when 'Principal' %> + <%='用户主页' %> + <% when 'Course' %> + <%='课程' %> + <% end %> + + <%= journal.jour_id %> + + <%= link_to(journal.try(:user).try(:realname).truncate(6, omission: '...'), user_path(journal.user)) %> + + <%= format_date(journal.created_on) %> + + <%= journal.notes.truncate(15, omission: '...') %> + + <% if(journal.m_reply_count) %> + <%=journal.m_reply_count%> + <% else %> + <%=0 %> + <% end %> +
+
+ + +<% html_title(l(:label_leave_message_list)) -%> diff --git a/app/views/admin/messages_list.html.erb b/app/views/admin/messages_list.html.erb new file mode 100644 index 000000000..77cdbbc69 --- /dev/null +++ b/app/views/admin/messages_list.html.erb @@ -0,0 +1,69 @@ +

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

+ +<%= render 'tab_messages' %> +

<%=l(:label_forum) %>

+
+ + + + + + + + + + + + + <% @count=0%> + <% for memo in @memo -%> + <% @count=@count + 1 %> + "> + + + + + + + + <% end %> + +
+ 序号 + + 来源 + + 作者 + + 时间 + + 标题 + + 回复数 +
+ <%= @count %> + + <%= memo.forum_id %> + <%= memo.try(:author)%><% else %><%=memo.try(:author).try(:realname) %><% end %>'> + <% if memo.try(:author).try(:realname) == ' '%> + <%= link_to(memo.try(:author), user_path(memo.author)) %> + <% else %> + <%= link_to(memo.try(:author).try(:realname), user_path(memo.author)) %> + <% end %> + + <%= format_date(memo.created_at) %> + + <%= memo.subject %> + + <%=memo.replies_count %> +
+
+ + +<% html_title(l(:label_message_plural)) -%> diff --git a/app/views/admin/notices.html.erb b/app/views/admin/notices.html.erb new file mode 100644 index 000000000..56f212720 --- /dev/null +++ b/app/views/admin/notices.html.erb @@ -0,0 +1,74 @@ +

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

+ +
+ + + + + + + + + + + + + + + <% @count=0%> + <% for news in @news -%> + <% @count=@count + 1 %> + "> + + + + + + + + + + <% end %> + +
+ 序号 + + 课程id + + 课程名称 + + 主讲老师 + + 作者 + + 时间 + + 标题 + + 回复数 +
+ <%= @count %> + + <%=news.course_id %> + + <%=link_to(news.course.name, course_path(news.course)) %> + + <%=link_to(news.course.try(:teacher).try(:realname), user_path(news.course.teacher)) %> + <%= news.try(:author)%><% else %><%=news.try(:author).try(:realname) %><% end %>'> + <% if news.try(:author).try(:realname) == ' '%> + <%= link_to(news.try(:author), user_path(news.author)) %> + <% else %> + <%= link_to(news.try(:author).try(:realname), user_path(news.author)) %> + <% end %> + + <%= format_date(news.created_on) %> + + <%= link_to(news.title, news_path(news)) %> + + <%=news.comments_count %> +
+
+ +<% html_title(l(:label_notification_list)) -%> diff --git a/app/views/admin/project_messages.html.erb b/app/views/admin/project_messages.html.erb new file mode 100644 index 000000000..af2978422 --- /dev/null +++ b/app/views/admin/project_messages.html.erb @@ -0,0 +1,66 @@ +

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

+ +<%= render 'tab_messages' %> +

<%=l(:label_borad_project) %>

+
+ + + + + + + + + + + + + <% @count=0%> + <% for project in @project_ms -%> + + <% @count=@count + 1 %> + "> + + + + + + + + + <% end %> + +
+ 序号 + + 来源 + + 作者 + + 时间 + + 标题 + + 回复数 +
+ <%= @count %> + + <%= Board.where('id=?',project.board_id).first.project_id %> + <%= project.try(:author)%><% else %><%=project.try(:author).try(:realname) %><% end %>'> + <% if project.try(:author).try(:realname) == ' '%> + <%= link_to(project.try(:author), user_path(project.author)) %> + <% else %> + <%= link_to(project.try(:author).try(:realname), user_path(project.author)) %> + <% end %> + + <%= format_date(project.created_on) %> + + <%= project.subject %> + + <%=project.replies_count %> +
+
+ +<% html_title(l(:label_message_plural)) -%> diff --git a/app/views/admin/schools.html.erb b/app/views/admin/schools.html.erb new file mode 100644 index 000000000..0956981e8 --- /dev/null +++ b/app/views/admin/schools.html.erb @@ -0,0 +1,50 @@ +

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

+<%= form_tag({:controller => 'admin', :action => 'schools' }, :method => :get,:id=>"search_course_form") do %> + <%= submit_tag "搜索",:style => "float: right;margin-right: 15px;"%> + +<% end %> +
+ +
+ + + + + + + + + + + <% @schools.each do |school|%> + "> + + + + + + <% end%> + +
+ 序号 + + LOGO + + 学校名称 +
+ <%= school.id %> + + <%= image_tag(school.logo_link,width:40,height:40) %> + + + <%= link_to school.name,"http://#{Setting.host_course}/?school_id=#{school.id}" %> + + + <%= link_to("修改", upload_logo_school_path(school.id,:school_name => @school_name), :class => 'icon icon-copy') %> + <%#= link_to(l(:button_delete), organization_path(school.id), :method => :delete,:confirm => l(:text_are_you_sure), :class => 'icon icon-del') %> +
+
+ +<% html_title(l(:label_project_plural)) -%> diff --git a/app/views/applied_project/_set_applied.js.erb b/app/views/applied_project/_set_applied.js.erb index 33d862d1c..472da3c09 100644 --- a/app/views/applied_project/_set_applied.js.erb +++ b/app/views/applied_project/_set_applied.js.erb @@ -17,6 +17,8 @@ if (window.Messenger) { Messenger().post({ id: "label_apply_project_waiting", message: "<%= l(:label_apply_project_waiting) %>", - showCloseButton: true, + showCloseButton: true }); }; + +$("#applied_project_link_<%= @project.id%>").replaceWith("<%= escape_javascript(link_to "加入项目",appliedproject_path(:user_id => User.current.id,:project_id => @project.id,:project_join => true),:class => "blue_n_btn fr mt20", :remote => "true",:method => "post",:id => "applied_project_link_#{@project.id}") %>"); diff --git a/app/views/applied_project/applied_join_project.js.erb b/app/views/applied_project/applied_join_project.js.erb index 846d2a61d..ae9d3f467 100644 --- a/app/views/applied_project/applied_join_project.js.erb +++ b/app/views/applied_project/applied_join_project.js.erb @@ -6,6 +6,7 @@ <% elsif @status == 2%> alert("<%= l('project.join.tips.success') %>"); hideModal($("#popbox")); + $("#applied_project_link_<%= @project.id%>").replaceWith("<%=escape_javascript(link_to '取消申请',appliedproject_applied_path(:project_id => @project.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{@project.id}")%>"); <% elsif @status == 3%> alert("<%= l('project.join.tips.has') %>"); <%else%> diff --git a/app/views/attachments/_project_file_links.html.erb b/app/views/attachments/_project_file_links.html.erb index b6d934c64..3b76689f5 100644 --- a/app/views/attachments/_project_file_links.html.erb +++ b/app/views/attachments/_project_file_links.html.erb @@ -29,32 +29,32 @@ <% is_float ||= false %> <% for attachment in attachments %>
-

- <%if is_float%> -

- <% end%> - +

+ <%if is_float%> +

+ <% end%> + <% if options[:length] %> <%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%> <% else %> <%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true -%> <% end %> - <%if is_float%> -
- <% end%> + <%if is_float%> +
+ <% end%> - <% if attachment.is_text? %> - <%= link_to image_tag('magnifier.png'), - :controller => 'attachments', - :action => 'show', - :id => attachment, - :filename => attachment.filename%> - <% end %> + <% if attachment.is_text? %> + <%= link_to image_tag('magnifier.png'), + :controller => 'attachments', + :action => 'show', + :id => attachment, + :filename => attachment.filename%> + <% end %>
- <%= h(" - #{attachment.description}") unless attachment.description.blank? %> -
+ <%= h(" - #{attachment.description}") unless attachment.description.blank? %> + ( <%= number_to_human_size attachment.filesize %>) @@ -66,6 +66,16 @@ :class => 'delete delete-homework-icon', :remote => true, :title => l(:button_delete) %> + <% elsif attachment.container_type == 'Issue' %> + <% if User.current == attachment.author %> + <%= link_to image_tag('delete.png'), attachment_path(attachment), + :data => {:confirm => l(:text_are_you_sure)}, + :method => :delete, + :class => 'delete', + #:remote => true, + #:id => "attachments_" + attachment.id.to_s, + :title => l(:button_delete) %> + <% end %> <% else %> <%= link_to image_tag('delete.png'), attachment_path(attachment), :data => {:confirm => l(:text_are_you_sure)}, @@ -89,13 +99,13 @@

<% end %>
- <% if defined?(thumbnails) && thumbnails %> - <% images = attachments.select(&:thumbnailable?) %> - <% if images.any? %> + <% if defined?(thumbnails) && thumbnails %> + <% images = attachments.select(&:thumbnailable?) %> + <% if images.any? %> <% images.each do |attachment| %>
<%= thumbnail_issue_tag(attachment) %>
<% end %> - <% end %> - <% end %> + <% end %> + <% end %>
diff --git a/app/views/avatar/_avatar_form.html.erb b/app/views/avatar/_avatar_form.html.erb index 632ea5d4d..43aaf9132 100644 --- a/app/views/avatar/_avatar_form.html.erb +++ b/app/views/avatar/_avatar_form.html.erb @@ -43,7 +43,7 @@
-<%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %> +<%= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "btn_addPic", :style => "text-decoration:none;" %> <%= l(:button_upload_photo) %> 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/boards/_form.html.erb b/app/views/boards/_form.html.erb index 47ae0672d..a4f58dcc3 100644 --- a/app/views/boards/_form.html.erb +++ b/app/views/boards/_form.html.erb @@ -1,7 +1,7 @@ <%= error_messages_for @board %>
-

+

<%= f.text_field :name, :required => true %>

diff --git a/app/views/boards/show.html.erb b/app/views/boards/show.html.erb index 5520f526d..609294161 100644 --- a/app/views/boards/show.html.erb +++ b/app/views/boards/show.html.erb @@ -1,12 +1,5 @@

@@ -69,7 +31,7 @@   作品名称    : - <%= f.text_field "name", :required => true, :size => 60, :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onkeyup => "regexName();" %> + <%= f.text_field "name", :required => true, :size => 60, :class => "w430 bo", :maxlength => 254, :placeholder => "作品名称", :onkeyup => "regexHomeworkCommonName();" %>

@@ -79,7 +41,7 @@   作品描述    :  - <%= f.text_area "description", :class => "w620", :maxlength => 3000, :style => "width:430px", :placeholder => "最多3000个汉字", :onkeyup => "regexDescription();"%> + <%= f.text_area "description", :class => "w620", :maxlength => 3000, :style => "width:430px", :placeholder => "最多3000个汉字", :onkeyup => "regexHomeworkCommonDescription();"%>

diff --git a/app/views/homework_common/_homework_detail_manual_form.html.erb b/app/views/homework_common/_homework_detail_manual_form.html.erb index ffec93e73..59294f82d 100644 --- a/app/views/homework_common/_homework_detail_manual_form.html.erb +++ b/app/views/homework_common/_homework_detail_manual_form.html.erb @@ -48,11 +48,12 @@
  • - <%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %> + <%#= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %> +  分
  • -
  • +
  • <%= f.check_box :homework_type, :class => "mb10 mt5 fl" %>
    diff --git a/app/views/homework_common/_homework_detail_programing_form.html.erb b/app/views/homework_common/_homework_detail_programing_form.html.erb index 008f88138..829905327 100644 --- a/app/views/homework_common/_homework_detail_programing_form.html.erb +++ b/app/views/homework_common/_homework_detail_programing_form.html.erb @@ -43,7 +43,8 @@
  • - <%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %> + <%#= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %> +  分
  • @@ -56,9 +57,7 @@
    • - + <%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70",:onchange => "homework_language_change($(this));"} %>
    • @@ -80,7 +79,7 @@
    • - +
    • @@ -89,16 +88,25 @@
    • - +
    • - +
    • - 测试 + <% if homework_test.result && !homework_test.result.to_s.empty?%> + <% if homework_test.result == 0%> + 正确 + <% else%> + 错误 + <% end%> + <% else%> + 测试 + <% end%> +
    • @@ -107,19 +115,79 @@
    • - +
    • - +
    • - 测试 + 测试 +
    • <% end %> + + "> + + + + + + +
      + 错误信息: + + <% if homework.homework_tests.first && homework.homework_tests.first && homework.homework_tests.first.error_msg %> + <%= homework.homework_tests.first.error_msg%> + <% end%> +
    -
\ No newline at end of file +
+ + \ No newline at end of file diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb index db7dad9c7..4a804ae60 100644 --- a/app/views/homework_common/index.html.erb +++ b/app/views/homework_common/index.html.erb @@ -48,15 +48,55 @@
-
- <% unless homework.attachments.empty?%> + <% if homework.homework_type == 2 && homework.homework_detail_programing%> + <% if @is_teacher%> + + + "> + + + + <% homework.homework_tests.each do |test|%> + "> + + + + <% end%> + +
+ 输入 + + 输出 +
+ <%=test.input%> + + <%= test.output%> +
+
+ <% end%> + +
+ 开发语言: +
+ <% if homework.homework_detail_programing.language.to_i == 1%> + C + <% elsif homework.homework_detail_programing.language.to_i == 2%> + C++ + <% end%> +
+
+
+ <% end%> + + <% unless homework.attachments.empty?%> +
附件:
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework.attachments} %>
- <% end%> -
-
+
+
+ <% end%>
扣分标准: diff --git a/app/views/homework_common/new.html.erb b/app/views/homework_common/new.html.erb index 01fcb9f4d..6fc0fff0e 100644 --- a/app/views/homework_common/new.html.erb +++ b/app/views/homework_common/new.html.erb @@ -1,27 +1,17 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor" %> +<%= error_messages_for 'homework_common' %>

<%= l(:label_course_homework_new)%>

-
- <%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%> - -

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

- - - 人工评分的作业(支持匿名互评、灵活设置评分比例) - -
- - - 自动评测的编程作业(支持C++程序的自动评分) - -
- - 下一步 - +
+ <%= 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%>
diff --git a/app/views/homework_common/next_step.html.erb b/app/views/homework_common/next_step.html.erb index 75e9f4c0a..e84d0f87a 100644 --- a/app/views/homework_common/next_step.html.erb +++ b/app/views/homework_common/next_step.html.erb @@ -11,7 +11,7 @@ <%= 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 "上一步", 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%>
@@ -22,7 +22,7 @@ <%= 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 "上一步", 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%>
diff --git a/app/views/homework_common/programing_test.js.erb b/app/views/homework_common/programing_test.js.erb new file mode 100644 index 000000000..d1643329b --- /dev/null +++ b/app/views/homework_common/programing_test.js.erb @@ -0,0 +1,12 @@ +$("#test_send_<%= @index%>").replaceWith(" fl ml5 mt1 programing_test' onclick='programing_test(<%= @index%>)' id='test_send_<%= @index%>'><%= @result == 0 ? '正确' : '错误'%>"); +$("#test_result_<%= @index%>").val("<%= @result%>"); +<% if @err_msg || @result != 0%> + $("#homework_work_test_show").show(); + $("#homework_work_test_desc").text("<%= escape_javascript(@err_msg || status_to_err_msg(@result))%>"); + <% if @err_msg%> + $("#homework_test_error_msg").val("<%= escape_javascript(@err_msg)%>"); + <% end%> +<% else%> + $("#homework_work_test_show").hide(); + $("#homework_test_error_msg").val(""); +<% end%> \ No newline at end of file diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 8c12d62e0..01cbea1c1 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -6,7 +6,7 @@
<%= link_to "#{@issue.project.name}"+">", project_issues_path(@issue.project) %> - <%= "#" + @issue.project_index %> + <%= "#" + @issue.id.to_s %>
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_footer_public.html.erb b/app/views/layouts/_base_footer_public.html.erb new file mode 100644 index 000000000..dba26f1f6 --- /dev/null +++ b/app/views/layouts/_base_footer_public.html.erb @@ -0,0 +1,46 @@ + +
\ 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 16fa44c73..8dbacb523 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -18,7 +18,7 @@
<% end -%> 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..c224ee0ab --- /dev/null +++ b/app/views/layouts/_base_header_new.html.erb @@ -0,0 +1,72 @@ + +
\ No newline at end of file diff --git a/app/views/layouts/_new_header.html.erb b/app/views/layouts/_new_header.html.erb index a756009f0..9252e23b9 100644 --- a/app/views/layouts/_new_header.html.erb +++ b/app/views/layouts/_new_header.html.erb @@ -26,7 +26,7 @@
  • <%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id},target:"_blank", :class => "parent" %>
      - <% user_course.reverse.each do |course| %> + <% user_course.each do |course| %>
    • <%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id},target:"_blank" %>
    • @@ -40,7 +40,7 @@
    • <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name},target:"_blank", :class => "parent" %>
        - <% User.current.projects.reverse.each do |project| %> + <% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
      • <%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name }, target:"_blank" %>
      • @@ -53,6 +53,9 @@
    • + + + <% end -%> <%= header_render_menu :account_menu -%>
    diff --git a/app/views/layouts/_user_courses_list.html.erb b/app/views/layouts/_user_courses_list.html.erb index a5cd6f273..ce9282ee7 100644 --- a/app/views/layouts/_user_courses_list.html.erb +++ b/app/views/layouts/_user_courses_list.html.erb @@ -4,7 +4,7 @@
      <% course_index = 0 %> - <% User.current.courses.reverse.each do |course| %> + <% User.current.courses.each do |course| %> <% if !course_endTime_timeout?(course) %> <%= render :partial => 'layouts/user_homework_list', :locals => {:course => course,:course_index => course_index} %> <% course_index += 1 %> 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_project_list.html.erb b/app/views/layouts/_user_project_list.html.erb index 4df61b01b..924bfa9d4 100644 --- a/app/views/layouts/_user_project_list.html.erb +++ b/app/views/layouts/_user_project_list.html.erb @@ -2,7 +2,7 @@
    • <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
        - <% User.current.projects.reverse.each do |project| %> + <% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
      • <%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
      • 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..578319b68 --- /dev/null +++ b/app/views/layouts/_user_watch_btn.html.erb @@ -0,0 +1,11 @@ +<% if User.current.logged?%> + <% if User.current == target%> + 编辑资料 + <%else%> + <%if(target.watched_by?(User.current))%> + 取消关注 + <% else %> + 添加关注 + <% end %> + <% 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..7ccc8660d --- /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_courses.html.erb b/app/views/layouts/base_courses.html.erb index 7a32cb67d..3242d79e9 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -113,7 +113,7 @@
        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..09d437da4 --- /dev/null +++ b/app/views/layouts/base_users_new.html.erb @@ -0,0 +1,343 @@ +<% @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 %> +<%= javascript_include_tag "avatars"%> +<%= 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? %> + <% if @user.user_extensions.identity == 0 %> +
        • 真实姓名 :
        • + <% end %> + <% 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.last_login_on) %>
        • + <% if @user.user_extensions.identity == 0 %> +
        • <%= @user.show_name %>
        • + <% end %> + <% 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 @user.user_extensions && @user.user_extensions.identity == 0 %> + <% if(get_create_course_count(@user)) != 0 %> +
        • 创建课程 :
        • + <% end %> + <% if(get_homework_commons_count(@user)) != 0 %> +
        • 发布作业 :
        • + <% end %> + <% end %> + <% if (get_join_course_count(@user) != 0) %> +
        • 加入课程 :
        • + <% end %> + <% if @user.user_extensions.identity == 1 %> +
        • 参加匿评 :
        • + <% end %> + <% if (get_projectandcourse_attachment_count(@user) != 0) %> +
        • 发布资源 :
        • + <% end %> + <% if (get_create_project_count(@user) != 0) %> +
        • 创建项目 :
        • + <% end %> + <% if (get_join_project_count(@user) != 0) %> +
        • 加入项目 :
        • + <% end %> + <% if (get_create_issue_count(@user) != 0) %> +
        • 发布缺陷 :
        • + <% end %> + <% if (get_resolve_issue_count(@user) != 0) %> +
        • 解决缺陷 :
        • + <% end %> +
        +
          + <% if @user.user_extensions && @user.user_extensions.identity == 0 %> + <% if(get_create_course_count(@user)) != 0 %> +
        • <%= get_create_course_count(@user) %>
        • + <% end %> + <% if(get_homework_commons_count(@user)) != 0 %> +
        • <%= get_homework_commons_count(@user) %>
        • + <% end %> + <% end %> + <% if (get_join_course_count(@user) != 0) %> +
        • <%= get_join_course_count(@user) %>
        • + <% end %> + <% if @user.user_extensions.identity == 1 %> +
        • <%= get_anonymous_evaluation_count(@user) %>
        • + <% end %> + <% if (get_projectandcourse_attachment_count(@user) != 0) %> +
        • <%= get_projectandcourse_attachment_count(@user) %>
        • + <% end %> + <% if (get_create_project_count(@user) != 0) %> +
        • <%= get_create_project_count(@user) %>
        • + <% end %> + <% if (get_join_project_count(@user) != 0) %> +
        • <%= get_join_project_count(@user) %>
        • + <% end %> + <% if (get_create_issue_count(@user) != 0) %> +
        • <%= get_create_issue_count(@user) %>
        • + <% end %> + <% if (get_resolve_issue_count(@user) != 0) %> +
        • <%= get_resolve_issue_count(@user) %>
        • + <% end %> +
        +
        +
        + + + + +
        +

        <%= l(:label_tag)%>:

        +
        +
        + <%= render :partial => 'tags/user_tag', :locals => {:obj => @user,:object_flag => "1"}%> +
        +
        +
        +
        + + <%= 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) %> + <% if(User.current.admin?) %> +
        +

        访客

        更多 +
        +
        + <% 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 %> +
        +
        +
        + <% end %> + +
        + + <%= yield %> + +
        +
        + + <%= render :partial => 'layouts/new_footer'%> +
        +
        + +<%= render :partial => 'layouts/new_feedback' %> + + + + + + + + + diff --git a/app/views/mailer/message_posted.html.erb b/app/views/mailer/message_posted.html.erb index c55f4b000..ed8cb8626 100644 --- a/app/views/mailer/message_posted.html.erb +++ b/app/views/mailer/message_posted.html.erb @@ -8,8 +8,9 @@ <% if @message.project %> <%=h @message.board.project.name %> - <%=h @message.board.name %>: <%= link_to(h(@message.subject), @message_url,:style=>'color:#1b55a7; font-weight:bold;') %> <% elsif @message.course %> - <%=h @message.board.course.name %> - <%=h @message.board.name %>: <%= link_to(h(@message.subject), @message_url,:style=>'color:#1b55a7; font-weight:bold;') %> - <% end %> + <%=h @message.board.course.name %> - <%=h @message.board.name %>: + <%= link_to(h(@message.subject), @message_url + "?topic_id=#{@message.id}&&parent_id=#{@message.parent_id ? @message.parent_id : @message.id}",:style=>'color:#1b55a7; font-weight:bold;') %> + <% end %> <%= l(:mail_issue_title_active)%>

          diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 59dc1e674..7bd1b0bc2 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -81,7 +81,7 @@ :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> <%= l(:label_course_homework) %> - <%= link_to truncate(bid.name.html_safe,length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value), + <%= link_to truncate(bid.name.html_safe,length: 30,omission: '...'), student_work_index_url(:homework => bid.id,:token => @token.value), :class => 'wmail_info', :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> @@ -225,10 +225,10 @@ :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> <%= l(:label_project_issue_update) %> <% if issues_journal.notes.blank? || issues_journal.notes.nil? %> - <%= link_to truncate(l(:label_isuue_mail_status),length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), + <%= link_to truncate(issues_journal.issue.subject.html_safe, length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <% else %> - <%= link_to truncate(issues_journal.notes.html_safe,length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), + <%= link_to truncate(issues_journal.notes.html_safe, length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value), :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <% end %> <%= format_time(issues_journal.created_on) %> diff --git a/app/views/members/autocomplete.js.erb b/app/views/members/autocomplete.js.erb index 01faf7da9..5f21ee38e 100644 --- a/app/views/members/autocomplete.js.erb +++ b/app/views/members/autocomplete.js.erb @@ -1,4 +1,9 @@ <% if @project%> + var checked = $("#principals input:checked").size(); + if(checked > 0) + { + alert('翻页或搜索后将丢失当前选择的用户数据!'); + } <% if @flag == "true"%> $('#principals_for_new_member').html('<%= escape_javascript(render_project_members(@project)) %>'); <% else%> diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb index 55a2410b0..586279504 100644 --- a/app/views/memos/show.html.erb +++ b/app/views/memos/show.html.erb @@ -7,7 +7,9 @@ <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
          - <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%> + + <%= render :partial => "/praise_tread/praise_tread",:locals => {:obj => @memo,:show_flag => true,:user_id =>User.current.id,:horizontal => true}%> +
          <%= link_to image_tag(url_to_avatar(@memo.author), :class => "avatar"), user_path(@memo.author) %> diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 6c0c3a78a..c23266afd 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -1,743 +1,552 @@ -<% @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', - - :method => :post} do |f| %> - - +
          - +
          + +

          <%= l(:lable_school_list)%>

          +    +
          +
            + <% @ss = School.find_by_sql("select distinct province from schools") %> + <% @ss.each do |s| %> +
          • + <%= s.province %> + +
          • + <% end %> +
          +
          + +
          +
            + +
          +
          +
          - - - - - +<%= 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..788678673 --- /dev/null +++ b/app/views/my/clear_user_avatar_temp.js.erb @@ -0,0 +1,8 @@ + $("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"); + $('#ajax-modal').parent().css("border", "2px solid #15bccf").css("border-radius", "0").css(" -webkit-border-radius", "0").css(" -moz-border-radius", "0"); \ 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..54cb3de48 --- /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:214px;height:214px;overflow:hidden",:alt=>"头像") %>'); +hideModal(); \ No newline at end of file diff --git a/app/views/news/_course_news.html.erb b/app/views/news/_course_news.html.erb index c89f0af26..e2c50fe24 100644 --- a/app/views/news/_course_news.html.erb +++ b/app/views/news/_course_news.html.erb @@ -2,70 +2,39 @@ btn_tips = l(:label_news_notice) label_tips = l(:label_course_news) %> +

          <%= label_tips %>

          -

          - <%= l(:label_total_news) %> - <%= @news_count %> - <%= l(:label_course_news_count) %> -

          - <% if @course && User.current.allowed_to?(:manage_news, @course) %> - <%= link_to(btn_tips,new_course_news_path(@course),:class => 'problem_new_btn fl c_dorange')%> -
          - - <% end %> -
          -
          - -
          - <% if @newss.empty? %> -

          - <%= l(:label_no_data) %> +

          +

          + <%= l(:label_total_news) %> + <%= @news_count %> + <%= l(:label_course_news_count) %>

          - <% else %> - <% @newss.each do |news| %> -
          - <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> -
          - <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> - - <%= l(:label_release_news) %>: - - <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> - <%=link_to "#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w" %> -
          -
          - -
          -
          - <%= news.description.html_safe %> -
          -
          -
          - -
          - <%= l(:label_create_time)%>:<%= format_time(news.created_on)%> - <%= link_to_attachments_course news %> -
          - <%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %> -
          -
          -
          + <% if @course && User.current.allowed_to?(:manage_news, @course) %> + <%= link_to(btn_tips,new_course_news_path(@course),:class => 'problem_new_btn fl c_dorange')%> +
          <% end %> - <% end %> +
          + +
          - -
            - <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> -
          +
          + <%= render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count} %> +
          <% content_for :header_tags do %> <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> <%= stylesheet_link_tag 'scm' %> diff --git a/app/views/news/_course_news_list.html.erb b/app/views/news/_course_news_list.html.erb new file mode 100644 index 000000000..da963b3cd --- /dev/null +++ b/app/views/news/_course_news_list.html.erb @@ -0,0 +1,47 @@ +
          +<% if newss.empty? %> +

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

          +<% else %> + <% newss.each do |news| %> +
          + <%= link_to image_tag(url_to_avatar(news.author),:width => 42,:height => 42), user_path(news.author), :class => "problem_pic fl" %> +
          + <%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %> + + <%= l(:label_release_news) %>: + + <%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %> + <%=link_to "#{news.comments.all.count}".html_safe, news_path(news.id), :class => "pro_mes_w" %> +
          +
          + +
          +
          + <%= news.description.html_safe %> +
          +
          +
          + +
          + <%= l(:label_create_time)%>:<%= format_time(news.created_on)%> + <%= link_to_attachments_course news %> +
          + <%#= render :partial => 'student_work/work_attachments', :locals => {:attachments => news.attachments} %> +
          +
          +
          + + <% end %> +<% end %> +
          + + +
            + <%= 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/news/index.js.erb b/app/views/news/index.js.erb new file mode 100644 index 000000000..04671917b --- /dev/null +++ b/app/views/news/index.js.erb @@ -0,0 +1 @@ +$("#news_list").html("<%= escape_javascript(render :partial => 'course_news_list', :locals=>{ :newss=>@newss,:obj_pages=>@obj_pages, :obj_count=>@obj_count})%>"); \ No newline at end of file diff --git a/app/views/poll/_new_MC.html.erb b/app/views/poll/_new_MC.html.erb index 8c47baa01..e5f2a6b82 100644 --- a/app/views/poll/_new_MC.html.erb +++ b/app/views/poll/_new_MC.html.erb @@ -1,5 +1,6 @@ <%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%> + <% insert_begin = insert_begin %>
          diff --git a/app/views/poll/_other_poll.html.erb b/app/views/poll/_other_poll.html.erb new file mode 100644 index 000000000..40ecbc569 --- /dev/null +++ b/app/views/poll/_other_poll.html.erb @@ -0,0 +1,37 @@ +
          +
          +

          选择问卷导入本课程

          +
          +
          + <%= form_tag import_other_poll_poll_index_path, + method: :post, + remote: true, + id: "relation_file_form" do %> + + <%= content_tag('div', poll_check_box_tags('polls[]', polls,polls_group_id), :id => 'courses',:style=> 'width: 300px;')%> + 导  入 + 取  消 + <% end -%> +
          + + +
          +
          + + \ No newline at end of file diff --git a/app/views/poll/_poll.html.erb b/app/views/poll/_poll.html.erb index 180fed0f0..1828ede6d 100644 --- a/app/views/poll/_poll.html.erb +++ b/app/views/poll/_poll.html.erb @@ -2,11 +2,13 @@ <% poll_name = poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%> <% if @is_teacher%>
        • - <% if has_commit %> - <%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%> - <% else %> - <%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %> - <% end %> +
          + <% if has_commit %> + <%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%> + <% else %> + <%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %> + <% end %> +
        • <% if poll.polls_status == 1%> @@ -41,6 +43,7 @@
        • 导出
        • <% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
        • <%= link_to "导出", export_poll_poll_path(poll.id,:format => "xls"), :class => "polls_de fr ml5"%>
        • + <% end%> diff --git a/app/views/poll/_poll_form.html.erb b/app/views/poll/_poll_form.html.erb index 74ca9fb32..c5c016583 100644 --- a/app/views/poll/_poll_form.html.erb +++ b/app/views/poll/_poll_form.html.erb @@ -2,27 +2,262 @@
          @@ -9,9 +12,11 @@ * <%end%>
          + <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> +
          @@ -29,4 +34,15 @@
          -
          \ No newline at end of file +
          + +
          +
          + \ No newline at end of file diff --git a/app/views/poll/_show_MCQ.html.erb b/app/views/poll/_show_MCQ.html.erb index 63b9d1c1f..f13cf17d3 100644 --- a/app/views/poll/_show_MCQ.html.erb +++ b/app/views/poll/_show_MCQ.html.erb @@ -12,6 +12,7 @@ <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> +
          @@ -29,4 +30,15 @@
          -
          \ No newline at end of file +
          + +
          +
          + \ No newline at end of file diff --git a/app/views/poll/_show_head.html.erb b/app/views/poll/_show_head.html.erb index 4a1b2256d..752a5b310 100644 --- a/app/views/poll/_show_head.html.erb +++ b/app/views/poll/_show_head.html.erb @@ -1,5 +1,8 @@ +
          + +

          <%= poll.polls_name%>

          <%= @poll.polls_description.nil? ? "" : @poll.polls_description.html_safe%>
          diff --git a/app/views/poll/_show_mulit.html.erb b/app/views/poll/_show_mulit.html.erb index 2d52fffb5..6c98b8257 100644 --- a/app/views/poll/_show_mulit.html.erb +++ b/app/views/poll/_show_mulit.html.erb @@ -13,9 +13,21 @@ <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> +
          -
          \ No newline at end of file +
        + +
        +
        + \ No newline at end of file diff --git a/app/views/poll/_show_single.html.erb b/app/views/poll/_show_single.html.erb index 8caa7b1a5..68b93d244 100644 --- a/app/views/poll/_show_single.html.erb +++ b/app/views/poll/_show_single.html.erb @@ -12,8 +12,20 @@ <%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id), method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %> +
        -
  • \ No newline at end of file +
    + +
    +
    + \ No newline at end of file diff --git a/app/views/poll/create_poll_question.js.erb b/app/views/poll/create_poll_question.js.erb index ac44ebb4c..8a597514e 100644 --- a/app/views/poll/create_poll_question.js.erb +++ b/app/views/poll/create_poll_question.js.erb @@ -1,4 +1,8 @@ +<% if @is_insert %> + $("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>'); +<% else %> $("#new_poll_question").html(""); + $("#poll_content").append("
    " + "
    " + "<% if @poll_questions.question_type == 1%>" + @@ -23,4 +27,4 @@ $("#poll_content").append("
    " + "<% end%>" + "
    " + "
    "); - +<% end %> diff --git a/app/views/poll/import_other_poll.js.erb b/app/views/poll/import_other_poll.js.erb new file mode 100644 index 000000000..f60cea1c5 --- /dev/null +++ b/app/views/poll/import_other_poll.js.erb @@ -0,0 +1 @@ +$('#polls_list').html('<%= escape_javascript(render :partial => 'polls_list', :locals => {:polls => @polls,:obj_pages=>@obj_pages,:obj_count=>@obj_count}) %>
    '); \ No newline at end of file diff --git a/app/views/poll/import_poll.js.erb b/app/views/poll/import_poll.js.erb new file mode 100644 index 000000000..9f1d8e7cb --- /dev/null +++ b/app/views/poll/import_poll.js.erb @@ -0,0 +1,4 @@ +/** + * Created by lizanle on 2015/7/29. + */ +$("#poll_content").html('<%= escape_javascript(render :partial => 'poll_content', :locals => {:poll => @poll})%>'); \ No newline at end of file diff --git a/app/views/poll/index.html.erb b/app/views/poll/index.html.erb index bede915b4..92a42cbac 100644 --- a/app/views/poll/index.html.erb +++ b/app/views/poll/index.html.erb @@ -80,6 +80,11 @@ $('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().addClass("popbox_polls"); } + + function closeModal() + { + hideModal($("#popbox_upload")); + }
    <%= render :partial => 'poll_list'%> diff --git a/app/views/poll/other_poll.js.erb b/app/views/poll/other_poll.js.erb new file mode 100644 index 000000000..eee4ed4a1 --- /dev/null +++ b/app/views/poll/other_poll.js.erb @@ -0,0 +1,13 @@ + +<% if @polls.empty? %> + alert('您目前还没有自己新建的问卷'); +<% else %> + $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>'); + + + showModal('ajax-modal', '513px'); + $('#ajax-modal').siblings().remove(); + $('#ajax-modal').before(""); + $('#ajax-modal').parent().css("top","").css("left",""); + $('#ajax-modal').parent().addClass("popbox_polls"); +<% end %> \ No newline at end of file diff --git a/app/views/projects/_development_group.html.erb b/app/views/projects/_development_group.html.erb index d4bc7012a..915637ec5 100644 --- a/app/views/projects/_development_group.html.erb +++ b/app/views/projects/_development_group.html.erb @@ -31,7 +31,7 @@ - - <% elsif e.forge_act_type == "Document" %> -
    - <%= image_tag(url_to_avatar(e.user), :width => "42", :height => "42") %> -
    - - <%= h(e.project) if @project.nil? || @project.id != e.project_id %> - <%= link_to h(e.user), user_path(e.user_id), :class => "problem_name c_orange fl" %> <%= l(:label_new_activity) %> : - <%= link_to format_activity_title("#{l(:label_document)}: #{act.title}"), {:controller => 'documents', :action => 'show', :id => act.id}, :class => "problem_tit fl fb" %>
    -

    <%= textAreailizable act,:description %>
    - <%= l :label_create_time %> :<%= format_activity_day(act.created_on) %> <%= format_time(act.created_on, false) %>

    -
    -
    -
    <% elsif e.forge_act_type == "Attachment" %>
    diff --git a/app/views/repositories/stats.html.erb b/app/views/repositories/stats.html.erb index 5fd791810..0bce15069 100644 --- a/app/views/repositories/stats.html.erb +++ b/app/views/repositories/stats.html.erb @@ -1,11 +1,30 @@

    <%= l(:label_statistics) %>

    -

    - <%= tag("embed", :width => 670, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_month")) %> -

    -

    - <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_author")) %> -

    -

    <%= link_to l(:button_back), :action => 'show', :id => @project %>

    -<% html_title(l(:label_repository), l(:label_statistics)) -%> +<% if @status_commit_count ==0 %> +
    该项目目前还没有提交过代码!
    +<% else %> +
    修订 是版本库的提交次数, 显示为橘红色。

    +
    变更 是对版本库中文件的修改次数, 显示为蓝色。
    + +

    + <%= tag("embed", :width => 670, :height => 300, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_month")) %> +

    +

    + <%# 用户每月提交代码次数 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "commits_per_author")) %> +

    +

    + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_per_month")) %> +

    +

    + <%# 用户最近六个月的提交次数 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_commits_six_month")) %> +

    +

    + <%# 用户最近六个月的代码量 %> + <%= tag("embed", :width => 670, :height => 400, :type => "image/svg+xml", :src => url_for(:controller => 'repositories', :action => 'graph', :id => @project, :repository_id => @repository.identifier_param, :graph => "author_code_six_months")) %> +

    +

    <%= link_to l(:button_back), :action => 'show', :id => @project %>

    + <% html_title(l(:label_repository), l(:label_statistics)) -%> +<% end %> \ No newline at end of file diff --git a/app/views/school/upload_logo.html.erb b/app/views/school/upload_logo.html.erb index 97a3f171c..26da7e081 100644 --- a/app/views/school/upload_logo.html.erb +++ b/app/views/school/upload_logo.html.erb @@ -1,5 +1,28 @@ -<%= form_tag({action: :upload},method: "post", multipart: true) do %> - <%= text_field_tag 'school'%> - <%= file_field_tag 'logo' %> - <%= submit_tag('Upload') %> + + +<%= form_tag(upload_school_path(@school.id),method: "post", multipart: true) do %> + <%#= text_field_tag 'school'%> +
    + + <%= image_tag(@school.logo_link, id: "avatar_image", :class=>"school_avatar")%> + 上传图片 + <%= file_field_tag 'logo',:style => "display:none;", :id => "file", :onchange => "showPreview(this)"%> +
    +
    + <%= submit_tag('上传') %> + <%= submit_tag('取消') %> +
    +
    <% end %> + diff --git a/app/views/student_work/_evaluation_student_work.html.erb b/app/views/student_work/_evaluation_student_work.html.erb index b5bdd6f55..368c636df 100644 --- a/app/views/student_work/_evaluation_student_work.html.erb +++ b/app/views/student_work/_evaluation_student_work.html.erb @@ -9,7 +9,8 @@ <%= 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.id),:remote => true,:title => student_work.name, :class => "c_blue02"%> + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> + <%= 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") %> @@ -47,8 +48,10 @@  <%= student_work.final_score%> 分。 迟交扣分  <%= student_work.late_penalty%> 分, - 缺评扣分 -  <%= student_work.absence_penalty%> 分, + <% if student_work.homework_common.homework_type == 1%> + 缺评扣分 +  <%= student_work.absence_penalty%> 分, + <% end%> 最终成绩为  <%= format("%.1f",score)%> 分。
  • diff --git a/app/views/student_work/_evaluation_work.html.erb b/app/views/student_work/_evaluation_work.html.erb index 11ce7b080..be07269c3 100644 --- a/app/views/student_work/_evaluation_work.html.erb +++ b/app/views/student_work/_evaluation_work.html.erb @@ -18,7 +18,8 @@ <% end%>
  • - <%= link_to student_work.name, student_work_path(student_work),:remote => true, :title => student_work.name, :class => "c_blue02"%> + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? '匿名的作品' : student_work.name%> + <%= link_to student_work_name, student_work_path(student_work),:remote => true, :title => student_work.name, :class => "c_blue02"%>
  • <% my_score = student_work_score(student_work,User.current) %>
  • diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb index 8060b8a79..b259e20a5 100644 --- a/app/views/student_work/_programing_work_show.html.erb +++ b/app/views/student_work/_programing_work_show.html.erb @@ -23,40 +23,42 @@
  • -
  • 测试结果: - - - - - - - - - - - - - - - <%@homework.homework_tests.each do |test|%> - "> - - - - + <% if @is_teacher%> +
  • 测试结果: +
  • - <%= test.input%> - - <%= test.output%> - <%= test.student_work_test.nil? ? "正在编译" : test.student_work_test.status_to_s%><%= test.student_work_test.nil? ? "0" : test.student_work_test.test_score%>
    + + + + + - <% end%> + <%@homework.homework_tests.each do |test|%> + "> + + + <% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%> + + + + <% end%> + <% student_work_test = @work.student_work_test.first%> + <% if student_work_test && student_work_test.error_msg && !student_work_test.error_msg.empty?%> + + + + <% end%> - -
    输入输出测试结果
    <%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%>
    + <%= student_work_test.error_msg%> +
    -
    -
  • - <% if @is_teacher%> + + +
    +
    <%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%> @@ -72,4 +74,5 @@ <% 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 2b7d49402..f6580659e 100644 --- a/app/views/student_work/_show.html.erb +++ b/app/views/student_work/_show.html.erb @@ -36,7 +36,7 @@
  • 内容:
    - <%= text_format @work.description%> + <%= text_format(@work.description) if @work.description%>
  • diff --git a/app/views/student_work/_student_work.html.erb b/app/views/student_work/_student_work.html.erb index dd7ab7e2d..f7eb7514d 100644 --- a/app/views/student_work/_student_work.html.erb +++ b/app/views/student_work/_student_work.html.erb @@ -9,7 +9,8 @@ <%= 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"%> + <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%> + <%= link_to student_work_name, student_work_path(student_work),: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") %> diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index b9148a88f..0250a7eed 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -48,28 +48,30 @@ <%= 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 %> - 搜索 + + <%= select_tag(:late_penalty,options_for_select(course_group_list(@course),@group), {:class => "fl h22 w100 ml10"}) if(@is_teacher && course_group_list(@course).count > 0) %> + 搜索 <%= 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%>
    - <% if @homework.student_works.empty?%> - <%= link_to "附件", "javascript:void(0)", class: "down_btn fr zip_download_alert", :onclick => "alert('没有学生提交作业,无法下载附件')" %> - <% else%> - <%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json), - remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %> + <% unless @homework.homework_type == 2%> + <% if @homework.student_works.empty?%> + <%= link_to "附件", "javascript:void(0)", class: "down_btn fr zip_download_alert", :onclick => "alert('没有学生提交作业,无法下载附件')" %> + <% else%> + <%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json), + remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %> + <% end%> +
    + 使用 + winzip + 工具进行解压可能会导致 + 下载文件乱码 + ,建议您使用 + winrar + 工具进行解压 +
    <% end%> -
    - 使用 - winzip - 工具进行解压可能会导致 - 下载文件乱码 - ,建议您使用 - winrar - 工具进行解压 -
    <%= link_to("匿评", evaluation_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr') if @homework.homework_type == 1%> <%= link_to("缺评", absence_penalty_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr') if @homework.homework_type == 1%> <%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%> @@ -127,13 +129,53 @@ <%= student_anonymous_comment @homework %> <%= student_new_homework @homework %> <% end %> -
    +
    <%= @homework.description.html_safe %>
    -
    + + <% if @homework.homework_type == 2 && @homework.homework_detail_programing%> + <% if @is_teacher%> + + + "> + + + + <% @homework.homework_tests.each do |test|%> + "> + + + + <% end%> + +
    + 输入 + + 输出 +
    + <%=test.input%> + + <%= test.output%> +
    +
    + <% end%> + +
    + 开发语言: +
    + <% if @homework.homework_detail_programing.language.to_i == 1%> + C + <% elsif @homework.homework_detail_programing.language.to_i == 2%> + C++ + <% end%> +
    +
    +
    + <% end%> +
    <% unless @homework.attachments.empty?%> 附件: @@ -147,15 +189,10 @@
    扣分标准:
    - 迟交扣 - <%= @homework.late_penalty%> - 分 <% if @homework.homework_type == 1%> - ,缺评一个作品扣 - <%= @homework.homework_detail_manual.absence_penalty%> - 分 + <%= scoring_rules @homework.late_penalty,@homework.id,@is_teacher,@homework.homework_detail_manual.absence_penalty%> <% else%> - 。 + <%= scoring_rules @homework.late_penalty,@homework.id,@is_teacher%> <% end%>
    diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb index eda09114e..c72f9d422 100644 --- a/app/views/student_work/new.html.erb +++ b/app/views/student_work/new.html.erb @@ -44,7 +44,7 @@

    - + <%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "bo02 mb10"} %>

    @@ -54,7 +54,11 @@ <%= @homework.homework_type == 2 ? "提交代码" : "作品描述"%>    : - <%= f.text_area "description", :class => "w620 hwork_txt ", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%> + <% if @homework.homework_type == 2 && @homework.homework_detail_programing%> + <%= f.text_area "description", :class => "w620 hwork_txt h400", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => @homework.homework_detail_programing.language == "1" ? c_stantard_code_student : c_stantard_code_student_%> + <% else %> + <%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%> + <% end%>

    diff --git a/app/views/tags/_project_tag.html.erb b/app/views/tags/_project_tag.html.erb index ce80e36ab..408f3ba1d 100644 --- a/app/views/tags/_project_tag.html.erb +++ b/app/views/tags/_project_tag.html.erb @@ -1,15 +1,6 @@ -
    - <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
    +
    + <%= render :partial => "tags/tag_project_new_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
    -<% if User.current.logged?%> - <%= l(:label_add_tag)%> - -<% end%> diff --git a/app/views/tags/_tag_name.html.erb b/app/views/tags/_tag_name.html.erb index cb00ac8d7..7cd7bc02b 100644 --- a/app/views/tags/_tag_name.html.erb +++ b/app/views/tags/_tag_name.html.erb @@ -42,7 +42,7 @@ <% else %>
    - + <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> <% case object_flag %> diff --git a/app/views/tags/_tag_project_new_name.html.erb b/app/views/tags/_tag_project_new_name.html.erb new file mode 100644 index 000000000..e657071bc --- /dev/null +++ b/app/views/tags/_tag_project_new_name.html.erb @@ -0,0 +1,30 @@ +<% @tags = obj.reload.tag_list %> +<% if non_list_all && @tags.size > 0 %> + +<% else %> + + <% if @tags.size > 0 %> + <% @tags.each do |tag| %> + + <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %> + + <%= link_to('x', remove_tag_path(:tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag), :remote => true, :confirm => l(:text_are_you_sure) ) if (ProjectInfo.find_by_project_id(obj.id)).try(:user_id) == User.current.id %> + + + <% end %> + <% end %> +<% end %> + +<% if User.current.logged?%> + <%= l(:label_add_tag)%> + +<% end%> + + diff --git a/app/views/tags/_tag_user_new_name.html.erb b/app/views/tags/_tag_user_new_name.html.erb new file mode 100644 index 000000000..95730c22c --- /dev/null +++ b/app/views/tags/_tag_user_new_name.html.erb @@ -0,0 +1,30 @@ +<% @tags = obj.reload.tag_list %> +<% if non_list_all && @tags.size > 0 %> + +<% else %> + + <% if @tags.size > 0 %> + <% @tags.each do |tag| %> + + <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %> + + <%= link_to('x', remove_tag_path(:tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag), :remote => true, :confirm => l(:text_are_you_sure) ) if User.current.eql?(obj) %> + + + <% end %> + <% end %> +<% end %> + +<% if User.current.logged?%> + <%= l(:label_add_tag)%> + +<% end%> + + diff --git a/app/views/tags/_user_tag.html.erb b/app/views/tags/_user_tag.html.erb new file mode 100644 index 000000000..d04fb50a6 --- /dev/null +++ b/app/views/tags/_user_tag.html.erb @@ -0,0 +1,5 @@ +
    +
    + <%= render :partial => "tags/tag_user_new_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
    +
    diff --git a/app/views/tags/remove_tag.js.erb b/app/views/tags/remove_tag.js.erb index b8c65c13e..4c4409c1c 100644 --- a/app/views/tags/remove_tag.js.erb +++ b/app/views/tags/remove_tag.js.erb @@ -2,6 +2,12 @@ <% if @object_flag == '3'%> $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>'); +<% elsif @object_flag == '1'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_user_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>'); +<% elsif @object_flag == '2'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>'); <% elsif @object_flag == '6'%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name', diff --git a/app/views/tags/tag_save.js.erb b/app/views/tags/tag_save.js.erb index 74a38c99d..5a29c113c 100644 --- a/app/views/tags/tag_save.js.erb +++ b/app/views/tags/tag_save.js.erb @@ -4,6 +4,14 @@ $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_n :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); //$('#put-tag-form-issue').hide(); $('#name-issue').val(""); +<% elsif @obj_flag == '1'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_user_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name3').val(""); +<% elsif @obj_flag == '2'%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project_new_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name2').val(""); <% elsif @obj_flag == '6'%> <%if @course%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); diff --git a/app/views/users/_course_form.html.erb b/app/views/users/_course_form.html.erb index 82b69ab63..dc277805c 100644 --- a/app/views/users/_course_form.html.erb +++ b/app/views/users/_course_form.html.erb @@ -1,74 +1,51 @@ -
    -
      - <% 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) %> + 发布作业 + <% elsif User.current.member_of_course? item %> + 提交作品 + <% elsif User.current.logged?%> + <%= link_to "加入课程",try_join_path(:object_id => item.id), :class => "blue_n_btn fr mt20", :remote => "true",:id => "try_join_course_link"%> + <% 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..4ca8fbefc --- /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/_user_jour_reply.html.erb b/app/views/users/_user_jour_reply.html.erb new file mode 100644 index 000000000..60eda9fcd --- /dev/null +++ b/app/views/users/_user_jour_reply.html.erb @@ -0,0 +1,40 @@ +<% parent_jour = JournalsForMessage.where("id = #{reply.m_reply_id}").first %> +<% if parent_jour%> +
    + <%= link_to image_tag(url_to_avatar(reply.user),:width => '32',:height => '32'), user_path(reply.user),:class => "users_pic_sub fl mr5" %> +
    + <%= link_to "#{reply.user.nickname} ".html_safe, user_path(reply.user),:class => 'course_name fl c_blue02 ', :target => "_blank"%> +  回复  + <%= link_to "#{parent_jour.user.nickname} : ".html_safe, user_path(parent_jour.user),:class => 'course_name fl c_blue02 mr5 ', :target => "_blank"%> +
    + <%= reply.notes.html_safe %> +
    +
    + + <%= time_tag(reply.created_on).html_safe%> + +
    + <%= link_to l(:button_reply),'javascript:void(0);',:nhname=>"sub_reply_btn", :class => "ml5 c_purple" %> + <% if User.current.admin? || reply.user == User.current%> + <%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => reply, :user_id => reply.user}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "c_purple ml5", :title => l(:button_delete)) %> + <% end %> +
    +
    + +
    +
    +<% end%> \ No newline at end of file diff --git a/app/views/users/_user_jours_new.html.erb b/app/views/users/_user_jours_new.html.erb new file mode 100644 index 000000000..0fe301641 --- /dev/null +++ b/app/views/users/_user_jours_new.html.erb @@ -0,0 +1,44 @@ +
    + <%= link_to image_tag(url_to_avatar(jour.user),:width => '46',:height => '46'), user_path(jour.user),:class => "users_pic fl" %> +
    +
    + <%= link_to "#{jour.user.nickname} : ".html_safe, user_path(jour.user),:class => 'fl c_blue02 f14 fb mb5', :target => "_blank"%> +
    +
    +
    + <%= jour.notes.html_safe %> +
    +
    + + <%= time_tag(jour.created_on).html_safe %> + +
    + <%= link_to l(:button_reply),'javascript:void(0);',:nhname=>"reply_btn", :class => "ml5 c_purple" %> + <% if User.current.admin? || jour.user == User.current%> + <%= link_to(l(:label_newfeedback_delete), {:controller => 'words', :action => 'destroy', :object_id => jour, :user_id => jour.user}, + :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "ml5 c_purple", :title => l(:button_delete)) %> + <% end %> +
    +
    + +
    + +
    + <% fetch_user_leaveWord_reply(jour).each do |reply|%> + <%= render :partial => 'user_jour_reply', :locals => {:reply => reply} %> + <% end %> +
    +
    \ No newline at end of file diff --git a/app/views/users/_user_show.html.erb b/app/views/users/_user_show.html.erb index 8e3d27666..7cbb20e40 100644 --- a/app/views/users/_user_show.html.erb +++ b/app/views/users/_user_show.html.erb @@ -23,8 +23,19 @@
    - <%= l(:label_x_has_fans,:count=>user.watcher_users.count)%> - <%= l(:label_has_watchers,:count=>User.watched_by(user.id).count) %> + <%= l(:label_x_has_fans,:count=>user.watcher_users.count, :remote => true)%> + <%= l(:label_has_watchers,:count=>User.watched_by(user.id).count, :remote => true) %> + <% if User.current.logged?%> + <% if User.current == user%> + 编辑资料 + <%else%> + <%if(user.watched_by?(User.current))%> + 取消关注 + <% else %> + 添加关注 + <% end %> + <% end%> + <% end %>
    diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 496211e82..b2e6258ee 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -1,661 +1,40 @@ -<% if User.current.id == @user.id %> - -
    - <%= form_tag(:controller => 'users', :action => "show") do %> - +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"user" %> +<% @center_flag = (User.current == @user) %> +
    + + <% if @user.allowed_to?(:add_project, nil, :global => true) %> + 新建项目 + <% else %> + 加入项目 <% 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 %> -
    - - + <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> + 新建课程 <% else %> -

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

    + + 加入课程 <% 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..ed5b66ed4 --- /dev/null +++ b/app/views/users/user_course_activities.html.erb @@ -0,0 +1,28 @@ +<% 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]) %> + <% if(( rec[:e].is_public == false || rec[:e].is_public == 0 )&& !rec[:e].visible?)%> + + <%= get_activity_act_showname_htmlclear(rec[:item]) %> + + <% else %> + + <%= get_activity_act_showname_htmlclear(rec[:item]) %> + + <% end %> + + <%= 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..769642e99 100644 --- a/app/views/users/user_courses.html.erb +++ b/app/views/users/user_courses.html.erb @@ -1,33 +1,29 @@ -<% 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) %> + 新建课程 + <% 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_messages.html.erb b/app/views/users/user_messages.html.erb new file mode 100644 index 000000000..cf3e13ff9 --- /dev/null +++ b/app/views/users/user_messages.html.erb @@ -0,0 +1,79 @@ +
    +
    +
    + + +
    + <% if !@user_course_messages.blank? %> + <% @user_course_messages.each do |ucm| %> + <% if ucm.course_message_type == "News" %> + + <% end %> + <% if ucm.course_message_type == "HomeworkCommon" %> + + <% end %> + <% if ucm.course_message_type == "Poll" %> + + <% end %> + <% if ucm.course_message_type == "Message" %> + + <% end %> +
    + <% end %> + <% else %> +
    暂无消息!
    + <% end %> +
    +
    +
    +
    diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index deb360efd..a8107ce5f 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -1,7 +1,40 @@ -<% reply_allow = JournalsForMessage.create_by_user? User.current %> -<%= stylesheet_link_tag 'css', :media => 'all' %> +
    + + <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> + 新建课程 + <% end %> +
    +
    -<%= render :partial => 'user_jours', - :locals => { :journals => @jour, :state => false} -%> -<% html_title(l(:label_responses)) -%> \ No newline at end of file +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"user" %> +
    + + + +
    +
    + <%= form_for('new_form',:url => leave_user_message_path(@user.id),:method => "post") do |f|%> + +

    +
    + 取消 + 留言 + <% end%> +
    +
    + +
    + <%if @jour%> + <% @jour.each do |jour|%> + <%= render :partial => 'user_jours_new', :locals => {:jour => jour} %> + <%end%> + <% end%> + +
      + <%= 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_projects.html.erb b/app/views/users/user_projects.html.erb index 69dda693e..d76964020 100644 --- a/app/views/users/user_projects.html.erb +++ b/app/views/users/user_projects.html.erb @@ -1,66 +1,70 @@ - - - - + <% for item in @list %> + <% creator = User.find(item.user_id)%> +
    + +
    + item.id, :host=>Setting.host_name) %>" class="courses_list_title f14 fb c_blue02 fl" title="<%= item.name %>"><%= item.name %> +
    +
    + + + + + + + + + + + + + +
    创建者:<%= creator.show_name %>创建时间:<%= format_date(item.created_on) %>
    成员人数:item.id, :host=>Setting.host_name) %>"><%= item.members.count %>项目类型:<%= item.project_new_type == 1 ? l(:label_development_team) : (item.project_new_type == 2 ? l(:label_research_group) : l(:label_friend_organization))%>
    +
    +
    + <% if User.current.member_of? item%> + item.id, :host=>Setting.host_name) %>" target="_blank" class="blue_n_btn fr mt20">发布问题 + <% elsif User.current.logged?%> + <% if item.applied_projects.find_by_user_id(User.current.id)%> + <%= link_to '取消申请',appliedproject_applied_path(:project_id => item.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{item.id}"%> + <% else%> + <%= link_to "加入项目",appliedproject_path(:user_id => User.current.id,:project_id => item.id,:project_join => true),:class => "blue_n_btn fr mt20", :remote => "true",:method => "post",:id => "applied_project_link_#{item.id}" %> + <% end%> -
  • - <% end %> - -<% else %> -<% if @user != User.current %> -

    <%= l(:label_project_un) %>

    -<% else %> -

    <%= l(:label_project_unadd) %>

    -<% end %> - -<% end %> -<%= call_hook :view_account_left_bottom, :user => @user %> -
    - -<% html_title(l(:label_user_project)) -%> \ No newline at end of file + <% end%> +
    + + <% 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_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/versions/_form.html.erb b/app/views/versions/_form.html.erb index f0ed7c84f..6ff8b070f 100644 --- a/app/views/versions/_form.html.erb +++ b/app/views/versions/_form.html.erb @@ -14,20 +14,20 @@ <%= f.select :status, Version::VERSION_STATUSES.collect {|s| [l("version_status_#{s}"), s]}, :label => "" %> -
  • - - <%= f.text_field :wiki_page_title, :size =>60, :label => "", :disabled => @project.wiki.nil? %> -
  • + + + +
  • <%= f.text_field :effective_date, :size => 10, :readonly => true,:class=>"fl" ,:style=>"margin-left:7px;",:label=>""%> <%= calendar_for('version_effective_date') %>
  • -
  • - - <%= f.select :sharing, @version.allowed_sharings.collect {|v| [format_version_sharing(v), v]},:label=>"" %> -
  • + + + + <% @version.custom_field_values.each do |value| %> diff --git a/app/views/versions/_overview.html.erb b/app/views/versions/_overview.html.erb index 47d65c34a..8d34a20da 100644 --- a/app/views/versions/_overview.html.erb +++ b/app/views/versions/_overview.html.erb @@ -13,5 +13,5 @@ project_issues_path(version.project, :status_id => 'o', :fixed_version_id => version, :set_filter => 1), :class =>"c_dblue") %>)

    <% else %> -

    <%= l(:label_roadmap_no_issues) %>

    +
    <%= l(:label_roadmap_no_issues) %>
    <% end %> diff --git a/app/views/versions/show.html.erb b/app/views/versions/show.html.erb index 1a7fce16d..6bfacbe86 100644 --- a/app/views/versions/show.html.erb +++ b/app/views/versions/show.html.erb @@ -4,7 +4,7 @@
    <%= link_to(l(:button_edit), edit_version_path(@version), :class => 'icon icon-edit') if User.current.allowed_to?(:manage_versions, @version.project) %> -<%= link_to_if_authorized(l(:button_edit_associated_wikipage, +<%#= link_to_if_authorized(l(:button_edit_associated_wikipage, :page_title => @version.wiki_page_title.truncate(30, omission: '...')), {:controller => 'wiki', :action => 'edit', @@ -17,7 +17,7 @@ <%= call_hook(:view_versions_show_contextual, { :version => @version, :project => @project }) %>
    -

    +

    <%= h(@version.name) %>

    @@ -27,11 +27,11 @@
    <% if @version.estimated_hours > 0 || User.current.allowed_to?(:view_time_entries, @project) %> -
    <%= l(:label_time_tracking) %> +
    <%= l(:label_time_tracking) %>
    -

    <%= l(:field_estimated_hours) %>:

    +

    <%= l(:field_estimated_hours) %>:

    <%= html_hours(l_hours(@version.estimated_hours)) %> @@ -40,7 +40,7 @@ <% if User.current.allowed_to?(:view_time_entries, @project) %>
    -

    <%= l(:label_spent_time) %>:

    +

    <%= l(:label_spent_time) %>:

    <%= html_hours(l_hours(@version.spent_hours)) %> 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/welcome/course.html.erb b/app/views/welcome/course.html.erb index 143c32dbe..4edec2202 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -56,21 +56,11 @@ <% end %> - - <%= l(:label_welcome_trustie_course) %> + <%= l(:label_welcome_trustie_course) %> <% else %> <% unless @course_page.nil? %> - <%= l(:label_welcome_trustie_course) %> , @@ -112,7 +102,6 @@ course_term = "春季学期" end %> - <%# (month_now >= 3 && month_now < 9) ? course_term = "春季学期" : course_term = "秋季学期" %> <% cur_school_course = @school_id.nil? ? [] : find_miracle_course(10,7,@school_id, year_now, course_term) %> <% if cur_school_course.count == 0 %> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index c03b0de76..816d6550a 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -45,10 +45,10 @@ <% if @organization.nil? %> <% unless @first_page.nil? %> - <%= l(:label_welcome_trustie_project)%>,  - <%= l(:label_welcome_trustie_project_description)%> + + <%= @first_page.description.html_safe %> <% end %> <% else %> diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb index 28fab1243..c58f42dea 100644 --- a/app/views/wiki/show.html.erb +++ b/app/views/wiki/show.html.erb @@ -74,11 +74,11 @@ <% end %>

    -<% other_formats_links do |f| %> - <%= f.link_to 'PDF', :url => {:id => @page.title, :version => params[:version]} %> - <%= f.link_to 'HTML', :url => {:id => @page.title, :version => params[:version]} %> - <%= f.link_to 'TXT', :url => {:id => @page.title, :version => params[:version]} %> -<% end if User.current.allowed_to?(:export_wiki_pages, @project) %> +<%# other_formats_links do |f| %> + <%#= f.link_to 'PDF', :url => {:id => @page.title, :version => params[:version]} %> + <%#= f.link_to 'HTML', :url => {:id => @page.title, :version => params[:version]} %> + <%#= f.link_to 'TXT', :url => {:id => @page.title, :version => params[:version]} %> +<%# end if User.current.allowed_to?(:export_wiki_pages, @project) %> <% content_for :sidebar do %> <%= render :partial => 'sidebar' %> <% end %> diff --git a/app/views/words/_journal_reply_items.html.erb b/app/views/words/_journal_reply_items.html.erb index a0998f539..db848d2cd 100644 --- a/app/views/words/_journal_reply_items.html.erb +++ b/app/views/words/_journal_reply_items.html.erb @@ -6,7 +6,7 @@
    <% if show_name %> - <%= image_tag url_to_avatar(journal.user),:width => '30',:height => '30' %> + <%= image_tag url_to_avatar(reply.user),:width => '30',:height => '30' %> <% else %> <%= image_tag url_to_avatar(nil),:width => '30',:height => '30' %> <% 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..6aad1bfb5 100644 --- a/app/views/words/create_reply.js.erb +++ b/app/views/words/create_reply.js.erb @@ -1,5 +1,13 @@ <% if @save_succ %> - var pre_append = $('<%= j( + <% if !@jfm.nil? && @jfm.jour_type == 'Principal' %> + $("#<%= @jfm.m_parent_id%>").children("div[nhname='reply_list']").prepend("<%= escape_javascript( render(:partial => 'users/user_jour_reply',:locals => {:reply=>@jfm} )) %>"); + div_1 = $("#<%= @jfm.m_reply_id%>").children("div[nhname='div_form']"); + div_1.hide(); + div_2 = $("#<%= @jfm.m_reply_id%>").children("div[nhname='sub_div_form']"); + div_2.hide(); + <% 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 +20,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..c138a7ea7 100644 --- a/app/views/words/destroy.js.erb +++ b/app/views/words/destroy.js.erb @@ -1,18 +1,27 @@ <% if @journal_destroyed.nil? %> alert('<%=l(:notice_failed_delete)%>'); <% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication'].include? @journal_destroyed.jour_type)%> - <% if @bid && @jours_count %> - $('#jours_count').html("<%= @jours_count %>"); - <% elsif @course && @jours_count%> - $('#course_jour_count').html("(<%= @jours_count %>)"); - <% elsif @user && @jours_count%> - $('#jour_count').html("<%= @jours_count %>"); + <% if @is_user%> + var destroyedItem = $('#<%=@journal_destroyed.id%>'); + destroyedItem.fadeOut(600,function(){ + destroyedItem.remove(); + }); + <% else %> + <% if @bid && @jours_count %> + $('#jours_count').html("<%= @jours_count %>"); + <% elsif @course && @jours_count%> + $('#course_jour_count').html("(<%= @jours_count %>)"); + <% elsif @user && @jours_count%> + $('#jour_count').html("<%= @jours_count %>"); + <% end %> + var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>') + destroyedItem.fadeOut(600,function(){ + destroyedItem.remove(); + }); + <% end %> - var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>') - destroyedItem.fadeOut(600,function(){ - destroyedItem.remove(); - }); <% 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(""); <% end %> + diff --git a/config/environments/development.rb b/config/environments/development.rb index 2aca152cb..a3e7dff99 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -7,6 +7,7 @@ RedmineApp::Application.configure do # Log error messages when you accidentally call methods on nil. config.whiny_nils = true + config.log_level =:debug config.logger = Logger.new('log/development.log', 'daily') # daily, weekly or monthly # Show full error reports and disable caching config.consider_all_requests_local = true diff --git a/config/locales/account/zh.yml b/config/locales/account/zh.yml index 69edc7aa3..c7c76707d 100644 --- a/config/locales/account/zh.yml +++ b/config/locales/account/zh.yml @@ -37,7 +37,7 @@ zh: label_password_lost: "忘记密码?" button_login: 登录 # account_controller中判断用户名或密码输入有误的提示信息 - notice_account_invalid_creditentials: "无效的用户名或密码" + notice_account_invalid_creditentials: "无效的用户名或密码,注意登录名区分大小写,谢谢!" # account_controller中判断未激活的提示信息 notice_account_invalid_creditentials_new: "您还未到邮箱激活。如果您丢失帐户,电子邮件验证帮助我们的支持团队验证帐户的所有权,并允许您接收所有您要求的通知。" diff --git a/config/locales/my/zh.yml b/config/locales/my/zh.yml index 35fd4e48a..25a949df4 100644 --- a/config/locales/my/zh.yml +++ b/config/locales/my/zh.yml @@ -31,9 +31,10 @@ zh: label_account_identity_developer: 开发者 label_account_identity_enterprise: 组织 label_account_identity_studentID: 请输入学号 - + + field_brief_introduction_my: 个人签名 field_is_required: 必填 - field_firstname: 名字 + field_firstname: 名字或组织名 firstname_empty: 名字不能为空 field_firstname_eg: '(例:张三丰,请填写[三丰])' field_lastname: 姓氏 diff --git a/config/locales/projects/en.yml b/config/locales/projects/en.yml index b142c6ca8..703e0878e 100644 --- a/config/locales/projects/en.yml +++ b/config/locales/projects/en.yml @@ -42,10 +42,10 @@ en: label_member: "Members" project_module_attachments: "Resources" - label_project_mail_attachments: Project Resources - label_project_mail_upload: had uploaded project resources + label_project_mail_attachments: "Project Resources" + label_project_mail_upload: "had uploaded project resources" - label_invite: Invitation + label_invite: "Invitation" label_invite_new_user: "Send email to invite new user" label_invite_trustie_user: "Invite the Trustie registered user" diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml index 92e3cdc28..fe26aee1d 100644 --- a/config/locales/projects/zh.yml +++ b/config/locales/projects/zh.yml @@ -67,6 +67,13 @@ zh: label_project_mail_upload: 上传了资源 label_invite: 邀请 + + # 项目消息通知 + label_forge_message: 消息 + label_issue_message: 问题 + label_course_message: 课程消息 + label_project_message: 项目消息 + label_issue_tracking: 问题跟踪 label_release_issue: 发布问题 @@ -90,6 +97,14 @@ zh: label_project_tool_response: 用户反馈 label_project_news: 项目新闻 + label_project_dts_new: DTS缺陷测试 + label_project_dts_statics: DTS缺陷报告 + label_project_dts_yun: 云化部署工具 + label_project_soft_knowledge: 软件知识库 + label_project_soft_file: 软件资源库 + label_project_online_dev: 在线开发平台 + label_project_soft_service: 软工服务平台 + label_project_overview: "项目简介" label_expend_information: 展开更多信息 label_project_create: "新建了项目" @@ -342,7 +357,7 @@ zh: label_input_email: 请输入邮箱地址 label_invite_trustie_user: "邀请Trustie注册用户" - label_invite_trustie_user_tips: "输入姓名、邮箱、昵称" + label_invite_trustie_user_tips: "支持姓名、邮箱、昵称搜索!" label_user_role_null: 用户和角色不能留空! label_invite_project: 邀请您加入项目 label_mail_invite_success: 您已成功加入项目! @@ -355,7 +370,6 @@ zh: # label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。' field_name: 名称 - field_description: 描述 field_identifier: 标识 field_enterprise_name: 组织名称 label_organization_choose: --请选择组织-- diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 2dd5bcf9a..c2c558cf5 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -7,8 +7,29 @@ zh: direction: ltr jquery: locale: "zh-CN" + date: + formats: + # Use the strftime parameters for formats. + # When no format has been given, it uses default. + # You can provide other formats here if you like! + default: "%Y-%m-%d" + short: "%b%d日" + long: "%Y年%b%d日" + + day_names: [星期天, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六] + abbr_day_names: [日, 一, 二, 三, 四, 五, 六] + + # Don't forget the nil at the beginning; there's no such thing as a 0th month + month_names: [~, 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, 九月, 十月, 十一月, 十二月] + abbr_month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月] + # Used in date_select and datime_select. + order: + - :year + - :month + - :day notice_account_updated: 帐号更新成功 + notice_account_old_wrong_password: 原始密码错误 notice_account_wrong_password: 密码错误 name_can_be_empty: 可以不填写真实姓名[保密所需] notice_successful_create: 创建成功 @@ -265,9 +286,9 @@ zh: permission_view_gantt: 查看甘特图 permission_view_calendar: 查看日历 permission_view_issue_watchers: 查看跟踪者列表 - - - + + + permission_add_issue_watchers: 添加跟踪者 permission_delete_issue_watchers: 删除跟踪者 permission_log_time: 登记工时 @@ -360,6 +381,7 @@ zh: label_organization_choose: --请选择组织-- label_organization_name: 组织名称 label_organization_list: 组织列表 + label_school_plural: 学校列表 label_organization_new: 新建组织 label_organization_edit: 修改组织 label_project_plural: 项目列表 @@ -530,6 +552,7 @@ zh: label_registered_on: 注册于 label_overall_activity: 活动概览 label_new: 新建 + label_latest_login_user_list: 最近登录用户列表 label_logged_as: 登录为 label_environment: 环境 @@ -636,7 +659,7 @@ zh: label_comment_add: 添加评论 label_comment_added: 评论已添加 label_comment_delete: 删除评论 - + @@ -648,6 +671,8 @@ zh: label_tag: 标签 label_revision: 修订 label_revision_plural: 修订 + lable_revision_code_count: 代码量 + label_revision_commit_count: 提交次数 label_revision_id: 修订 %{value} label_associated_revisions: 相关修订版本 label_added: 已添加 @@ -666,7 +691,7 @@ zh: label_sort_lowest: 置底 label_roadmap_due_in: "截止日期到 %{value}" label_roadmap_overdue: "%{value} 延期" - label_roadmap_no_issues: 该版本没有问题 + label_roadmap_no_issues: 该版本还没有对应的缺陷,可以在“发布问题”的“目标版本”中指定版本! label_user_search_type: 搜索类型 label_search_by_login: 登录名 label_search_by_name: 名字 @@ -694,6 +719,11 @@ zh: label_commits_per_month: 每月提交次数 label_commits_per_author: 每用户提交次数 + label_author_commits_per_month: 用户最近一月的提交次数 + label_author_commits_six_month: 用户最近六个月提交次数 + label_author_commits_year: 最近一年的提交次数 + label_author_code_six_month: 用户最近六个月代码量 + label_author_code_year: 用户最近一年代码量 label_view_diff: 查看差别 label_diff_inline: 直列 label_diff_side_by_side: 并排 @@ -1200,9 +1230,9 @@ zh: label_post_on: 发表了 label_post_on_issue: 发表了问题 - - + + label_updated_time_on: " 更新于 %{value} " label_call_list: 需求列表 @@ -1223,6 +1253,7 @@ zh: label_leave_message_to: 给用户 %{name}留言 label_leave_message: 留言内容 label_message: 留言板 + label_leave_message_list: 留言列表 field_add: 添加于 %{time} 之前 label_student_response: 作业答疑 # modified by bai @@ -1513,9 +1544,9 @@ zh: label_news_number: 新闻的数量 label_wiki_number: wiki的数量 label_wiki_mail_notification: 发布了wiki - - - + + + # redmine活跃度评分 label_message_number: 留言的数量 # delete label_activity_number: 个人动态数量 # delete @@ -1525,14 +1556,14 @@ zh: label_wiki_number: wiki的数量 # delete - + label_activities: 个人动态 label_issue_message_number: 对issue的留言数量 label_code_submit_number: 代码提交次数 label_topic_number: 讨论区发言数量 - + label_join_contest: 加入竞赛 label_exit_contest: 退出竞赛 label_participator: 参与者 @@ -1627,7 +1658,7 @@ zh: label_bid_contest_show_course_name: 课程名称 label_bid_contest_show_teacher_name: 教师 label_contest_list: 竞赛列表 - + label_bids_task_list: 作业列表 @@ -1719,6 +1750,7 @@ zh: cancel_apply: 取消申请 apply_master: 申请成为版主 you_are_master: 您是该项目的版主 + label_notification_list: 通知 #add by linchun (竞赛相关) label_upload_softwarepackage: 上传软件包 @@ -1814,6 +1846,7 @@ zh: excel_t_score: 教师评分 excel_ta_score: 教辅评分 excel_n_score: 匿名评分 + excel_s_score: 系统评分 excel_f_score: 成绩 excel_commit_time: 提交时间 excel_homework_score: 作业积分 @@ -1958,9 +1991,9 @@ zh: label_poll_republish_success: 取消成功 label_answer_total: 总计: label_join_project: 加入项目 - - - + + + # # # 项目企业模块 @@ -2028,5 +2061,22 @@ zh: lable_unset: 未设置 label_chose_group: 请选择分班 +# label_hosted_organization: 主办单位 +# label_hosted_by: 国防科学技术大学并行与分布处理国家重点实验室 +# label_sponsor: 计算机科学与技术系 +# label_partners: 合作单位 +# label_co_organizer_NUDT: 国防科学技术大学计算机学院 +# label_co_organizer_EECS: 北京大学 +# label_co_organizer_BHU: 北京航空航天大学 +# label_co_organizer_CAS: 中国科学院软件研究所 +# label_co_organizer_InforS: 中创软件 +# label_rights_reserved: Copyright 2007~2015, All Rights Riserved +# label_about_us: 关于我们 +# label_contact_us: 联系我们 +# label_recruitment_information: 招聘信息 +# label_surpport_group: 帮助中心 +# label_forums: 论坛反馈 +# label_language: 语言 +# label_license: 湘ICP备09019772 diff --git a/config/routes.rb b/config/routes.rb index 0d47d2f57..7c0c381bc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -39,6 +39,17 @@ RedmineApp::Application.routes.draw do end + resources :school do + collection do + + end + + member do + get 'upload_logo' + post 'upload' + end + end + resources :homework_attach do collection do get 'get_homework_member_list' @@ -71,10 +82,14 @@ RedmineApp::Application.routes.draw do get 'poll_result' get 'close_poll' get 'export_poll' + get 'import_poll' + end collection do delete 'delete_poll_question' post 'update_poll_question' + get 'other_poll' + post 'import_other_poll' end end @@ -86,6 +101,7 @@ RedmineApp::Application.routes.draw do end collection do post 'next_step' + post 'programing_test' end end @@ -293,13 +309,20 @@ RedmineApp::Application.routes.draw do match 'user_projects_index', :to => 'users#user_projects_index', :via => :get match 'user_projects', :to => 'users#user_projects', :via => :get match 'user_activities', :to => 'users#user_activities', :via => :get, :as => "user_activities" - match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback" + # match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback" match 'info', :to => 'users#info', :via => [:get , :post], :as => 'user_info' 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 match 'show_score', :to => 'users#show_score', :via => :get match 'topic_score_index', :to => 'users#topic_score_index', :via => [:get, :post] @@ -327,6 +350,7 @@ RedmineApp::Application.routes.draw do end match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback" match 'users/:id/user_projects', :to => 'users#user_projects', :via => :get + match 'users/:id/user_messages', :to => 'users#user_messages', :via => :get #end match 'my/account', :via => [:get, :post] @@ -341,6 +365,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" @@ -377,10 +403,12 @@ RedmineApp::Application.routes.draw do get 'feedback', :action => 'feedback', :as => 'project_feedback' get 'watcherlist', :action=> 'watcherlist' + get 'invite_members', :action=> 'invite_members' get 'invite_members_by_mail', :action=> 'invite_members_by_mail' + # get 'dts_repos', :aciton => 'dts_repos' get 'send_mail_to_member', :action => 'send_mail_to_member' - match 'user_watcherlist', :to => 'projects#watcherlist', :via => :get, :as => "watcherlist" #add by huang + match 'user_watcherlist', :to => 'projects#watcherlist', :via => :get, :as => "watcherlist" #end post 'modules' post 'archive' @@ -652,6 +680,14 @@ RedmineApp::Application.routes.draw do match 'admin/test_email', :via => :get match 'admin/default_configuration', :via => :post get 'admin/organization' + get 'admin/schools' + get 'admin/leave_messages' + match 'admin/messages_list', as: :messages_list + match 'admin/project_messages', as: :project_messages + match'admin/course_messages', as: :course_messages + get 'admin/notices' + get 'admin/latest_login_users' + get 'admin/homework' resources :auth_sources do member do @@ -761,6 +797,7 @@ RedmineApp::Application.routes.draw do match 'words/:id/leave_project_message', :to => 'words#leave_project_message' match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback' match 'project/:id/share', :to => 'projects#share', :as => 'share_show' #share + post 'words/:id/leave_user_message', :to => 'words#leave_user_message', :as => "leave_user_message" post 'join_in/join', :to => 'courses#join', :as => 'join' delete 'join_in/join', :to => 'courses#unjoin' @@ -790,9 +827,6 @@ RedmineApp::Application.routes.draw do post 'school/search_school/', :to => 'school#search_school' get 'school/search_school/', :to => 'school#search_school' - post 'school/upload', :to => 'school#upload' - get 'school/upload_logo', :to => 'school#upload_logo' - ######added by nie match 'tags/show_projects_tags' ########### added by liuping 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/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/migrate/20150719092427_create_dts.rb b/db/migrate/20150719092427_create_dts.rb new file mode 100644 index 000000000..36ff24756 --- /dev/null +++ b/db/migrate/20150719092427_create_dts.rb @@ -0,0 +1,22 @@ +class CreateDts < ActiveRecord::Migration + def change + create_table :dts do |t| + t.string :IPLineCode + t.string :Description + t.string :Num + t.string :Variable + t.string :TraceInfo + t.string :Method + t.string :File + t.string :IPLine + t.string :Review + t.string :Category + t.string :Defect + t.string :PreConditions + t.string :StartLine + t.integer :project_id + + t.timestamps + end + end +end diff --git a/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb b/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb new file mode 100644 index 000000000..dc973e142 --- /dev/null +++ b/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb @@ -0,0 +1,9 @@ +class AddErrormsgToStudenWorkTest < ActiveRecord::Migration + def up + add_column :student_work_tests,:error_msg,:text + end + + def down + remove_column :student_work_tests,:error_msg + end +end diff --git a/db/migrate/20150730093403_add_result_to_test.rb b/db/migrate/20150730093403_add_result_to_test.rb new file mode 100644 index 000000000..8494fbbf5 --- /dev/null +++ b/db/migrate/20150730093403_add_result_to_test.rb @@ -0,0 +1,9 @@ +class AddResultToTest < ActiveRecord::Migration + def up + add_column :homework_tests, :result, :integer,default: 0 + end + + def down + remove_column :homework_tests,:result + end +end diff --git a/db/migrate/20150730130816_add_errormsg_to_test.rb b/db/migrate/20150730130816_add_errormsg_to_test.rb new file mode 100644 index 000000000..31b1b2246 --- /dev/null +++ b/db/migrate/20150730130816_add_errormsg_to_test.rb @@ -0,0 +1,9 @@ +class AddErrormsgToTest < ActiveRecord::Migration + def up + add_column :homework_tests,:error_msg,:text + end + + def down + remove_column :homework_tests,:error_msg + end +end diff --git a/db/migrate/20150801034945_change_result_default.rb b/db/migrate/20150801034945_change_result_default.rb new file mode 100644 index 000000000..1f629aa45 --- /dev/null +++ b/db/migrate/20150801034945_change_result_default.rb @@ -0,0 +1,9 @@ +class ChangeResultDefault < ActiveRecord::Migration + def up + change_column :homework_tests,:result,:integer,:default => nil + end + + def down + change_column :homework_tests,:result,:integer,:default => 0 + end +end diff --git a/db/migrate/20150810064247_add_created_at_to_activities.rb b/db/migrate/20150810064247_add_created_at_to_activities.rb new file mode 100644 index 000000000..864ed82d6 --- /dev/null +++ b/db/migrate/20150810064247_add_created_at_to_activities.rb @@ -0,0 +1,8 @@ +class AddCreatedAtToActivities < ActiveRecord::Migration + def up + add_column :activities, :created_at, :timestamp + end + def end + remove_column :activities, :created_at + end +end diff --git a/db/migrate/20150811010817_update_activities_data.rb b/db/migrate/20150811010817_update_activities_data.rb new file mode 100644 index 000000000..7ed19a607 --- /dev/null +++ b/db/migrate/20150811010817_update_activities_data.rb @@ -0,0 +1,21 @@ +class UpdateActivitiesData < ActiveRecord::Migration + def up + count = Activity.all.count / 20 + 1 + transaction do + for i in 1 ... count do i + Activity.page(i).per(20).each do |activity| + type = activity.act_type + if type=='Contest' || type=='Message' || type=='News'|| type=='Journal'|| type=='Issue'|| type=='Principal'||type=='JournalsForMessage' + activity.created_at = activity.act.created_on if activity.act + elsif type=='Contestnotification' || type=='HomeworkCommon' || type=='Poll' + activity.created_at = activity.act.created_at if activity.act + end + activity.save + end + end + end + end + + def down + end +end diff --git a/db/migrate/20150811065543_add_course_activities.rb b/db/migrate/20150811065543_add_course_activities.rb new file mode 100644 index 000000000..03ec7e354 --- /dev/null +++ b/db/migrate/20150811065543_add_course_activities.rb @@ -0,0 +1,15 @@ +class AddCourseActivities < ActiveRecord::Migration + def up + create_table :course_activities do |t| + t.integer :user_id + t.integer :course_id + t.integer :course_act_id + t.string :course_act_type + t.timestamps + end + end + + def down + drop_table :course_activities + end +end diff --git a/db/migrate/20150811080754_course_activities.rb b/db/migrate/20150811080754_course_activities.rb new file mode 100644 index 000000000..a4cae915d --- /dev/null +++ b/db/migrate/20150811080754_course_activities.rb @@ -0,0 +1,40 @@ +#encoding=UTF-8 +class CourseActivities < ActiveRecord::Migration + def up + Course.all.each do |course| + transaction do + course.course_acts << CourseActivity.new(:user_id => course.tea_id,:course_id => course.id) + #作业 + course.homework_commons.each do |homework_common| + homework_common.course_acts << CourseActivity.new(:user_id => homework_common.user_id,:course_id => course.id) + end + #通知 + course.news.each do |new| + new.course_acts << CourseActivity.new(:user_id => new.author_id,:course_id => course.id) + end + #资源 + course.attachments.each do |attachment| + attachment.course_acts << CourseActivity.new(:user_id => attachment.author_id,:course_id => course.id) + end + #讨论区 + if course.boards.first + course.boards.first.messages.each do |message| + message.course_acts << CourseActivity.new(:user_id => message.author_id,:course_id => course.id) + end + end + #留言 + course.journals_for_messages.each do |jour| + jour.course_acts << CourseActivity.new(:user_id => jour.user_id,:course_id => course.id) + end + #问卷 + Poll.where("polls_type = 'Course' and polls_group_id = #{course.id}").each do |poll| + poll.course_acts << CourseActivity.new(:user_id => poll.user_id,:course_id => course.id) + end + end + end + end + + def down + CourseActivity.destroy_all + end +end diff --git a/db/migrate/20150811083322_create_forge_messages.rb b/db/migrate/20150811083322_create_forge_messages.rb new file mode 100644 index 000000000..f81b68712 --- /dev/null +++ b/db/migrate/20150811083322_create_forge_messages.rb @@ -0,0 +1,13 @@ +class CreateForgeMessages < ActiveRecord::Migration + def change + create_table :forge_messages do |t| + t.integer :user_id + t.integer :project_id + t.integer :forge_message_id + t.string :forge_message_type + t.integer :viewed + + t.timestamps + end + end +end diff --git a/db/migrate/20150814011838_create_course_messages.rb b/db/migrate/20150814011838_create_course_messages.rb new file mode 100644 index 000000000..266f2b075 --- /dev/null +++ b/db/migrate/20150814011838_create_course_messages.rb @@ -0,0 +1,13 @@ +class CreateCourseMessages < ActiveRecord::Migration + def change + create_table :course_messages do |t| + t.integer :user_id + t.integer :course_id + t.integer :course_message_id + t.string :course_message_type + t.integer :viewed + + t.timestamps + end + end +end diff --git a/db/migrate/20150814024425_change_attachment_time.rb b/db/migrate/20150814024425_change_attachment_time.rb new file mode 100644 index 000000000..fd1ffb7a7 --- /dev/null +++ b/db/migrate/20150814024425_change_attachment_time.rb @@ -0,0 +1,13 @@ +class ChangeAttachmentTime < ActiveRecord::Migration + def up + Attachment.where("container_type = 'Course'").each do |attachment| + if attachment.container && attachment.container.created_at.to_i > attachment.created_on.to_i + attachment.created_on = attachment.container.created_at + 3600 * 24 + attachment.save + end + end + end + + def down + end +end diff --git a/db/migrate/20150814031258_update_course_activity_time.rb b/db/migrate/20150814031258_update_course_activity_time.rb new file mode 100644 index 000000000..155e212a3 --- /dev/null +++ b/db/migrate/20150814031258_update_course_activity_time.rb @@ -0,0 +1,22 @@ +class UpdateCourseActivityTime < ActiveRecord::Migration + def up + count = CourseActivity.all.count / 10 + 1 + transaction do + for i in 1 ... count do i + CourseActivity.page(i).per(10).each do |activity| + if activity.course_act + if activity.course_act.respond_to?("created_at") + activity.created_at = activity.course_act.created_at + elsif activity.course_act.respond_to?("created_on") + activity.created_at = activity.course_act.created_on + end + activity.save + end + end + end + end + end + + def down + end +end diff --git a/db/migrate/20150815030833_add_system_score_to_student_work.rb b/db/migrate/20150815030833_add_system_score_to_student_work.rb new file mode 100644 index 000000000..1f2df648e --- /dev/null +++ b/db/migrate/20150815030833_add_system_score_to_student_work.rb @@ -0,0 +1,9 @@ +class AddSystemScoreToStudentWork < ActiveRecord::Migration + def up + add_column :student_works,:system_score,:integer + end + + def down + remove_column :student_works,:system_score + end +end diff --git a/db/schema.rb b/db/schema.rb index 383545cf6..8d78a9ca0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,12 +11,15 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150715070534) do +ActiveRecord::Schema.define(:version => 20150815030833) do create_table "activities", :force => true do |t| - t.integer "act_id", :null => false - t.string "act_type", :null => false - t.integer "user_id", :null => false + t.integer "act_id", :null => false + t.string "act_type", :null => false + t.integer "user_id", :null => false + t.integer "activity_container_id" + t.string "activity_container_type", :default => "" + t.datetime "created_at" end add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" @@ -322,6 +325,15 @@ ActiveRecord::Schema.define(:version => 20150715070534) do t.datetime "updated_on", :null => false end + create_table "course_activities", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_act_id" + t.string "course_act_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "course_attachments", :force => true do |t| t.string "filename" t.string "disk_filename" @@ -354,6 +366,16 @@ ActiveRecord::Schema.define(:version => 20150715070534) do t.datetime "updated_at", :null => false end + create_table "course_messages", :force => true do |t| + t.integer "user_id" + t.integer "course_id" + t.integer "course_message_id" + t.string "course_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "course_statuses", :force => true do |t| t.integer "changesets_count" t.integer "watchers_count" @@ -473,6 +495,25 @@ ActiveRecord::Schema.define(:version => 20150715070534) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" + create_table "dts", :force => true do |t| + t.string "IPLineCode" + t.string "Description" + t.string "Num" + t.string "Variable" + t.string "TraceInfo" + t.string "Method" + t.string "File" + t.string "IPLine" + t.string "Review" + t.string "Category" + t.string "Defect" + t.string "PreConditions" + t.string "StartLine" + t.integer "project_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "enabled_modules", :force => true do |t| t.integer "project_id" t.string "name", :null => false @@ -521,6 +562,16 @@ ActiveRecord::Schema.define(:version => 20150715070534) do add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" + create_table "forge_messages", :force => true do |t| + t.integer "user_id" + t.integer "project_id" + t.integer "forge_message_id" + t.string "forge_message_type" + t.integer "viewed" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "forums", :force => true do |t| t.string "name", :null => false t.text "description" @@ -613,6 +664,8 @@ ActiveRecord::Schema.define(:version => 20150715070534) do t.integer "homework_common_id" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "result" + t.text "error_msg" end create_table "homework_users", :force => true do |t| @@ -1227,6 +1280,7 @@ ActiveRecord::Schema.define(:version => 20150715070534) do t.integer "result" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.text "error_msg" end create_table "student_works", :force => true do |t| @@ -1243,6 +1297,7 @@ ActiveRecord::Schema.define(:version => 20150715070534) do t.datetime "updated_at", :null => false t.integer "late_penalty", :default => 0 t.integer "absence_penalty", :default => 0 + t.integer "system_score" end create_table "student_works_evaluation_distributions", :force => true do |t| @@ -1340,7 +1395,7 @@ ActiveRecord::Schema.define(:version => 20150715070534) do end create_table "user_extensions", :force => true do |t| - t.integer "user_id", :null => false + t.integer "user_id", :null => false t.date "birthday" t.string "brief_introduction" t.integer "gender" @@ -1348,8 +1403,8 @@ ActiveRecord::Schema.define(:version => 20150715070534) do t.string "occupation" t.integer "work_experience" t.integer "zip_code" - 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.string "technical_title" t.integer "identity" t.string "student_id" @@ -1357,6 +1412,7 @@ ActiveRecord::Schema.define(:version => 20150715070534) do t.string "student_realname" t.string "location_city" t.integer "school_id" + t.string "description", :default => "" end create_table "user_grades", :force => true do |t| @@ -1462,6 +1518,17 @@ ActiveRecord::Schema.define(:version => 20150715070534) do add_index "versions", ["project_id"], :name => "versions_project_id" add_index "versions", ["sharing"], :name => "index_versions_on_sharing" + create_table "visitors", :force => true do |t| + t.integer "user_id" + t.integer "master_id" + t.datetime "updated_on" + t.datetime "created_on" + end + + add_index "visitors", ["master_id"], :name => "index_visitors_master_id" + add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on" + add_index "visitors", ["user_id"], :name => "index_visitors_user_id" + create_table "watchers", :force => true do |t| t.string "watchable_type", :default => "", :null => false t.integer "watchable_id", :default => 0, :null => false diff --git a/lib/redmine.rb b/lib/redmine.rb index 3043cfe5d..99b7ea22f 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -369,6 +369,7 @@ Redmine::MenuManager.map :admin_menu do |menu| menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural menu.push :courses, {:controller => 'admin', :action => 'courses'}, :caption => :label_course_all menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural + menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural @@ -385,6 +386,11 @@ Redmine::MenuManager.map :admin_menu do |menu| :html => {:class => 'server_authentication'} menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :last => true + menu.push :leave_messages, {:controller => 'admin', :action => 'leave_messages'}, :caption => :label_leave_message_list + menu.push :messages_list, {:controller => 'admin', :action => 'messages_list'}, :caption => :label_message_plural + menu.push :notices, {:controller => 'admin', :action => 'notices'}, :caption => :label_notification_list + menu.push :latest_login_users, {:controller => 'admin', :action => 'latest_login_users'}, :caption => :label_latest_login_user_list + menu.push :homework, {:controller => 'admin', :action => 'homework'}, :caption => :label_user_homework end #Modified by young diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index 1876190d9..927018b34 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.rb @@ -380,6 +380,36 @@ module Redmine nil end + def parse_commit(commits) + sum = {file: 0, insertion: 0, deletion: 0} + commits.split("\n").each do |commit| + if /(\d+)\s+?file/ =~ commit + sum[:file] += $1 .to_i + end + if /(\d+)\s+?insertion/ =~ commit + sum[:insertion] += $1.to_i + end + if /(\d+)\s+?deletion/ =~ commit + sum[:deletion] += $1.to_i + end + end + sum[:insertion] + sum[:deletion] + end + + def commits(authors, start_date, end_date, branch='master') + rs = [] + authors.each do |author| + cmd_args = %W|log #{branch} --pretty=tformat: --shortstat --author=#{author} --since=#{start_date} --until=#{end_date}| + commits = '' + git_cmd(cmd_args) do |io| + commits = io.read + end + logger.info "git log output for #{author} #{commits}" + rs << {author: author, num: parse_commit(commits)} + end + rs + end + class Revision < Redmine::Scm::Adapters::Revision # Returns the readable identifier def format_identifier diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js index a9633861e..270618522 100644 --- a/public/assets/kindeditor/kindeditor.js +++ b/public/assets/kindeditor/kindeditor.js @@ -5104,8 +5104,8 @@ KEditor.prototype = { } } }); - statusbar.removeClass('statusbar').addClass('ke-statusbar') - .append(''); + //statusbar.removeClass('statusbar').addClass('ke-statusbar') + // .append(''); if (self._fullscreenResizeHandler) { K(window).unbind('resize', self._fullscreenResizeHandler); self._fullscreenResizeHandler = null; diff --git a/public/images/nav_icon.png b/public/images/nav_icon.png new file mode 100644 index 000000000..2c824efaf Binary files /dev/null and b/public/images/nav_icon.png differ diff --git a/public/images/news_icon_small.png b/public/images/news_icon_small.png new file mode 100644 index 000000000..4a835556e Binary files /dev/null and b/public/images/news_icon_small.png differ 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 db1f761f2..be29fdc30 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -412,6 +412,24 @@ function regex_homework_name() } } +//处理迟交扣分 +function check_late_penalty() +{ + var obj = $("input[name='late_penalty']"); + var regex = /^\d+$/; + if(regex.test(obj.val())) + { + if(obj.val() > 50) + { + obj.val("50"); + } + } + else + { + obj.val("0"); + } +} + //验证匿评数量 function regex_evaluation_num() { @@ -506,14 +524,53 @@ function submit_homework(id) } } +function regexHomeworkCommonName() +{ + var name = $.trim($("#homework_attach_name").val()); + + if(name=="") + { + $("#homework_attach_name_span").text("作品名称不能为空"); + $("#homework_attach_name_span").css('color','#ff0000'); + return false; + } + else + { + $("#homework_attach_name_span").text("填写正确"); + $("#homework_attach_name_span").css('color','#008000'); + return true; + } +} +function regexHomeworkCommonDescription() +{ + var name = $.trim($("#homework_attach_description").val()); + + if(name=="") + { + $("#homework_attach_description_span").text("作品描述不能为空"); + $("#homework_attach_description_span").css('color','#ff0000'); + return false; + } + else + { + $("#homework_attach_description_span").text("填写正确"); + $("#homework_attach_description_span").css('color','#008000'); + return true; + } +} + +function submit_homework_form(){if(regexHomeworkCommonName()&®exHomeworkCommonDescription()){$('#new_homework_attach').submit();}} + //增加测试结果 function add_programing_test(obj) { var now = new Date().getTime(); - obj.after("
  • " + - "
  • " + + obj.after("
  • " + + "
  • " + "
  • " + "" + - "测试
  • "); + "测试" + + "" + + "
    "); } //删除测试结果 function remove_programing_test(obj) { @@ -861,14 +918,19 @@ function clickOK(path) }); } //查询 -function SearchByName(name,group,url,event) +function SearchByName(url,event) { var keycode = (event.keyCode ? event.keyCode : event.which); if(keycode == '13'){ - location.href = url + "&name=" + name + "&group=" + group; + location.href = url + "&name=" + $("#course_student_name").val() + "&group=" + $("#late_penalty").val(); } } -function SearchByName_1(name,group,url) +function SearchByName_1(url) { - location.href = url + "&name=" + name + "&group=" + group; + if($("#late_penalty").val() == null){ + location.href = url + "&name=" + $("#course_student_name").val() + } + else{ + location.href = url + "&name=" + $("#course_student_name").val() + "&group=" + $("#late_penalty").val(); + } } diff --git a/public/javascripts/header.js b/public/javascripts/header.js index 06748d726..d33b80e3d 100644 --- a/public/javascripts/header.js +++ b/public/javascripts/header.js @@ -46,6 +46,54 @@ $(document).ready(function () { addCourseSlipMenu(); }); +//消息提醒 +function MessageAddSlipMenu () { + var loggedas = $('#current_message_li a:first'); + var sub_menu = $('#message_sub_menu'); + loggedas.mouseenter(function() { + sub_menu.show(); + $('#my_projects_message_ul').hide(); + $('#my_courses_message_ul').hide(); + }); + sub_menu.mouseleave(function() { + sub_menu.hide(); + $('#my_projects_message_ul').hide(); + $('#my_courses_message_ul').hide(); + }); +} + +function MessageAddProjectSlipMenu () { + var loggedas = $('#my_projects_message_li'); + var project_sub_menu = $('#my_projects_message_ul'); + var course_sub_menu = $('#my_courses_message_ul'); + loggedas.mouseenter(function() { + course_sub_menu.hide(); + project_sub_menu.show(); + }); + loggedas.mouseleave(function() { + project_sub_menu.hide(); + course_sub_menu.hide(); + }); +} +function MessageAddCourseSlipMenu () { + var loggedas = $('#my_courses_message_li'); + var project_sub_menu = $('#my_projects_message_ul'); + var course_sub_menu = $('#my_courses_message_ul'); + loggedas.mouseenter(function() { + project_sub_menu.hide(); + course_sub_menu.show(); + }); + loggedas.mouseleave(function() { + course_sub_menu.hide(); + project_sub_menu.hide(); + }); +} + +$(document).ready(function () { + MessageAddSlipMenu(); + MessageAddProjectSlipMenu (); + MessageAddCourseSlipMenu(); +}); //将右侧的最小高度设置成左侧高度,美化界面 $(document).ready(function () { $("#RSide").css("min-height",$("#LSide").height()-30); diff --git a/public/javascripts/project.js b/public/javascripts/project.js index 98c148372..c7a615ba3 100644 --- a/public/javascripts/project.js +++ b/public/javascripts/project.js @@ -491,3 +491,8 @@ function judgeprojectname(){ } }); } + +//用户反馈 +function submitProjectFeedback() { + $("#project_feedback_form").submit(); +} \ No newline at end of file diff --git a/public/javascripts/user.js b/public/javascripts/user.js new file mode 100644 index 000000000..c7690a015 --- /dev/null +++ b/public/javascripts/user.js @@ -0,0 +1,261 @@ +//个人动态 +$(function(){ + function init_editor(params){ + var editor = params.kindutil.create(params.textarea, { + resizeType : 1,minWidth:"1px",width:"100%",height:"80px", + items:['emoticons'], + afterChange:function(){//按键事件 + nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); + }, + afterCreate:function(){ + var toolbar = $("div[class='ke-toolbar']",params.div_form); + $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情'); + params.toolbar_container.append(toolbar); + } + }).loadPlugin('paste'); + return editor; + } + + function nh_check_field(params){ + var result=true; + if(params.content!=undefined){ + if(params.content.isEmpty()){ + result=false; + } + if(params.content.html()!=params.textarea.html() || params.issubmit==true){ + params.textarea.html(params.content.html()); + params.content.sync(); + if(params.content.isEmpty()){ + params.contentmsg.html('内容不能为空'); + params.contentmsg.css({color:'#ff0000'}); + }else{ + params.contentmsg.html('填写正确'); + params.contentmsg.css({color:'#008000'}); + } + params.contentmsg.show(); + } + } + return result; + } + function init_form(params){ + params.form.submit(function(){ + var flag = false; + if(params.form.attr('data-remote') != undefined ){ + flag = true + } + var is_checked = nh_check_field({ + issubmit:true, + content:params.editor, + contentmsg:params.contentmsg, + textarea:params.textarea + }); + if(is_checked){ + if(flag){ + return true; + }else{ + $(this)[0].submit(); + return false; + } + } + return false; + }); + } + function nh_reset_form(params){ + params.form[0].reset(); + params.textarea.empty(); + if(params.editor != undefined){ + params.editor.html(params.textarea.html()); + } + params.contentmsg.hide(); + } + + KindEditor.ready(function(K){ + $("a[nhname='reply_btn']").live('click',function(){ + var params = {}; + params.kindutil = K; + params.container = $(this).parent().parent('div'); + params.div_form = $("div[nhname='div_form']",params.container); + params.form = $("form",params.div_form); + params.textarea = $("textarea[name='user_notes']",params.div_form); + params.textarea.prev('div').css("height","60px"); + params.contentmsg = $("p[nhname='contentmsg']",params.div_form); + params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); + params.cancel_btn = $("a[nhname='cancel_btn']",params.div_form); + params.submit_btn = $("a[nhname='submit_btn']",params.div_form); + if(params.textarea.data('init') == undefined){ + params.editor = init_editor(params); + init_form(params); + params.cancel_btn.click(function(){ + nh_reset_form(params); + toggleAndSettingWordsVal(params.div_form, params.textarea); + }); + params.submit_btn.click(function(){ + params.form.submit(); + }); + params.textarea.data('init',1); + } + params.cancel_btn.click(); + setTimeout(function(){ + if(!params.div_form.is(':hidden')){ + params.textarea.show(); + params.textarea.focus(); + params.textarea.hide(); + } + },300); + }); + + $("a[nhname='sub_reply_btn']").live('click',function(){ + var params = {}; + params.kindutil = K; + params.container = $(this).parent().parent('div'); + params.div_form = $("div[nhname='sub_div_form']",params.container); + params.form = $("form",params.div_form); + params.textarea = $("textarea[name='user_notes']",params.div_form); + params.textarea.prev('div').css("height","60px"); + params.contentmsg = $("p[nhname='sub_contentmsg']",params.div_form); + params.toolbar_container = $("div[nhname='sub_toolbar_container']",params.div_form); + params.cancel_btn = $("a[nhname='sub_cancel_btn']",params.div_form); + params.submit_btn = $("a[nhname='sub_submit_btn']",params.div_form); + if(params.textarea.data('init') == undefined){ + params.editor = init_editor(params); + init_form(params); + params.cancel_btn.click(function(){ + nh_reset_form(params); + toggleAndSettingWordsVal(params.div_form, params.textarea); + }); + params.submit_btn.click(function(){ + params.form.submit(); + }); + params.textarea.data('init',1); + } + params.cancel_btn.click(); + setTimeout(function(){ + if(!params.div_form.is(':hidden')){ + params.textarea.show(); + params.textarea.focus(); + params.textarea.hide(); + } + },300); + }); + + $("div[nhname='new_message']").each(function(){ + var params = {}; + params.kindutil = K; + params.div_form = $(this); + params.form = $("form",params.div_form); + if(params.form==undefined || params.form.length==0){ + return; + } + params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form); + params.contentmsg = $("p[nhname='contentmsg']",params.div_form); + params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form); + params.cancel_btn = $("#new_message_cancel_btn"); + params.submit_btn = $("#new_message_submit_btn"); + + if(params.textarea.data('init') == undefined){ + params.editor = init_editor(params); + init_form(params); + params.cancel_btn.click(function(){ + nh_reset_form(params); + }); + params.submit_btn.click(function(){ + params.form.submit(); + }); + params.textarea.data('init',1); + $(this).show(); + } + }); + }); +}); +function init_list_more_div(params){ + var p=params; + p.exbtn.click(function(){ + var isclose = p.container.data('isclose'); + var hasmore = p.container.data('hasmore'); + if(isclose == '1'){ + $("div[nhname='rec']",p.container).show(); + p.container.data('isclose','0'); + change_status_4_list_more_div(params); + return; + } + if(hasmore == '0'){ + change_status_4_list_more_div(params,'get'); + return; + } + var url = p.container.data('url'); + if($("div[nhname='rec']",p.container).length > 0){ + var lastid = $("div[nhname='rec']",p.container).filter(':last').data('id'); + url += "?lastid="+lastid; + var lasttime = $("div[nhname='rec']",p.container).filter(':last').data('time'); + if(lasttime != undefined){ + url += "&lasttime="+lasttime; + } + } + $.ajax( {url:url,dataType:'text',success:function(data){ + var html = $("
    "+data+"
    "); + var lens = $("div[nhname='rec']",html).length; + if(lens < p.size){ + p.container.data('hasmore','0'); + } + if(lens>0){ + var currpage = parseInt(p.container.data('currpage'))+1; + p.container.data('currpage',currpage); + p.container.append(html.html()) + } + change_status_4_list_more_div(params,'get'); + p.div.show(); + }} ); + }); + p.clbtn.click(function(){ + var i=0; + $("div[nhname='rec']",p.container).each(function(){ + i++; + if(i> p.size){ + $(this).hide(); + } + }); + p.container.data('isclose','1'); + change_status_4_list_more_div(params); + }); + p.exbtn.click(); +} +function change_status_4_list_more_div(params,opt){ + var p=params; + if($("div[nhname='rec']",p.container).length == 0 && opt != 'get'){ + p.exbtn.click(); + return; + } + var show_lens = $("div[nhname='rec']",p.container).length - $("div[nhname='rec']",p.container).filter(':hidden').length; + if( show_lens > p.size ){ + p.clbtn.show(); + }else{ + p.clbtn.hide(); + } + if($("div[nhname='rec']",p.container).length == 0){ + p.exbtn.html(p.nodatamsg); + }else if( p.container.data('hasmore') == '1' || p.container.data('isclose')=='1' ){ + p.exbtn.html('点击展开更多'); + }else{ + p.exbtn.html('没有更多了'); + } +} +function init_list_more_div_params(div){ + var params = {}; + params.div = div; + params.container = $("div[nhname='container']",div); + params.exbtn = $("a[nhname='expand']",div); + params.clbtn = $("a[nhname='close']",div); + params.size = params.container.data('pagesize'); + params.nodatamsg = params.container.data('nodatamsg'); + if( params.size == undefined ){ + params.size = 13; + } + return params; +} +$(function(){ + $("div[nhname='list_more_div']").each(function(){ + var params = init_list_more_div_params($(this)); + init_list_more_div(params) + }); +}); +//个人动态 end \ No newline at end of file diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index d4d309181..3e01d68ff 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2796,4 +2796,15 @@ div.repos_explain{ .upload_img img{max-width: 100%;} #activity .upload_img img{max-width: 580px;} -img,embed{max-width: 100%;} \ No newline at end of file +img,embed{max-width: 100%;} + +img.school_avatar { + background: rgb(245, 245, 245); + padding: 4px; + border: 1px solid #e5dfc7; + float: left; + display: block; + width: 100px; + height: 100px; + max-width: none; +} \ No newline at end of file diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css index abeec52d3..1393431d7 100644 --- a/public/stylesheets/courses.css +++ b/public/stylesheets/courses.css @@ -55,7 +55,7 @@ a:hover.problem_pic{border:1px solid #64bdd9;} .problem_txt{ width:610px; margin-left:10px; color:#777777;word-break: break-all;word-wrap: break-word;} a.problem_name{ color:#ff5722;max-width:60px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} a:hover.problem_name{ color:#d33503;} -a.problem_tit{ color:#0781b4; max-width:410px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} +a.problem_tit{ color:#0781b4; max-width:410px; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;vertical-align: top;} a.pro_mes_w{ height:20px; float:right;display:block; color:#999999;} a:hover.problem_tit{ color:#09658c; } .problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;} @@ -88,8 +88,6 @@ a:hover.talk_edit{ color:#ff5722;} .talk_text{ border:1px solid #64bdd9; height:100px;width:550px; background:#fff; margin-left:5px; padding:5px; margin-bottom:10px;} .talk_new ul li{ } .sb{width:70px; height:26px; color:#606060; cursor:pointer;} -a.blue_btn{ background:#64bdd9; display:block; font-size:14px;color:#fff; font-weight:normal; text-align:center; margin-left:10px; margin-bottom:10px; padding:2px 10px;} -a:hover.blue_btn{ background:#329cbd;} a.grey_btn{ background:#d9d9d9; color:#656565;font-size:14px; font-weight:normal; text-align:center; margin-left:10px; margin-bottom:10px; padding:2px 10px;} a:hover.grey_btn{ background:#717171; color:#fff;} /****资源库***/ @@ -228,6 +226,7 @@ a:hover.ping_sub{ background:#14a8b9;} .w430{ width:470px;} .w557{ width:557px;} .w350{ width:350px;} +.h400{height: 400px !important;} .w620{ width:480px; height:160px; border:1px solid #CCC;} .bo{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:470px; } .bo02{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:480px; margin-left:2px; color: #999; } @@ -609,6 +608,8 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} .w547{ width:544px;} .w196{ width:196px;} .w186{ width:186px;} +.w190{width: 190px;} +.w200{width: 200px;} .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;} @@ -664,7 +665,6 @@ a:hover.ping_pic{border:1px solid #64bdd9;} .ping_back_tit{ float:left; width:523px; margin-left:10px; } 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;} @@ -684,12 +684,21 @@ 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;} +.td_tit{width:170px; text-align:center;} +.td_50{width:60px; text-align:center;} +a.work_list_tit{width:580px; display:block; overflow:hidden; font-size:14px; font-weight:bold; white-space: nowrap; text-overflow:ellipsis;} +.work_list_pro{ width:670px;} +.border_l{border-left:1px solid #e4e4e4;} +.border_t{ border-top:1px solid #e4e4e4;} +.td_end{border-top:1px solid #e4e4e4; height:auto; padding:5px; } +.wl{text-align: left;} +.vt{vertical-align: top;} +.td_board_left{border-right: 1px solid #e4e4e4;} +.c_w{ color:#fff;} .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;} @@ -704,6 +713,9 @@ a:hover.about_me{ color:#0781b4;} .mb5 li{width:200px;word-wrap: break-word; word-break: normal; } +#homework_work_test_show{margin-left: 35px;width: 94%;} + + diff --git a/public/stylesheets/images/resource_icon_list.png b/public/stylesheets/images/resource_icon_list.png new file mode 100644 index 000000000..1b5bc6f58 Binary files /dev/null and b/public/stylesheets/images/resource_icon_list.png differ diff --git a/public/stylesheets/leftside.css b/public/stylesheets/leftside.css index 50b47fff4..990c02d54 100644 --- a/public/stylesheets/leftside.css +++ b/public/stylesheets/leftside.css @@ -15,6 +15,7 @@ a.pr_join_a{ color:#fff; display:block; padding:0 5px 0 3px; padding-top:2px; h .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_delete{ display:block; background:url(../images/leftside.png) -1px -157px no-repeat; width:11px; height:11px; margin-top:3px; float:left; } .pr_info_name{ color:#3e4040; font-size:14px; line-height:1.5;} a:hover.pr_info_name{ color:#3ca5c6;} .pr_info_score{ font-size:14px; color:#3e4040; } diff --git a/public/stylesheets/leftside_new.css b/public/stylesheets/leftside_new.css new file mode 100644 index 000000000..2f31a1f65 --- /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:auto;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/polls.css b/public/stylesheets/polls.css index 353ec3937..9f7b2d021 100644 --- a/public/stylesheets/polls.css +++ b/public/stylesheets/polls.css @@ -28,7 +28,7 @@ a:hover.pollsbtn{ background:#64bdd9; color:#fff; text-decoration:none;} #polls div{word-break: break-all;word-wrap: break-word;} .ur_prefix_content{ color:#656565; text-indent:30px; margin-top:10px; } .ur_card{border-top:1px solid #dcdcdc;margin-top:20px; color:#3a3a3a;} -.ur_title{ padding:20px 0px ; float:left; width:604px; } +.ur_title{ padding:20px 0px ; float:left; width:564px; } .ur_required{ font-weight: bold; color:red;} .ur_inputs{ color:#666;} .ur_table{border-top:1px solid #dcdcdc; background:#fff;} @@ -101,10 +101,13 @@ a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;} .ur_editor02{width:648px; border:1px solid #cbcbcb; padding:10px; margin-bottom:10px;} a.ur_button_submit{ display:block; width:106px; height:31px; margin:0 auto; background:#15bccf; color:#fff; font-size:16px; text-align:center; padding-top:4px; margin-bottom:10px; } a:hover.ur_button_submit{ background:#0fa9bb; text-decoration:none;} + a.ur_icon_de{ background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px;} a:hover.ur_icon_de{ background:url(images/icons.png) -20px -338px no-repeat;} .ur_icon_edit{ background:url(images/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;} a:hover.ur_icon_edit{ background:url(images/icons.png) -21px -272px no-repeat;} +.ur_icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;} +a:hover.ur_icon_add{background:url(images/icons.png) -20px -310px no-repeat;} /***弹框***/ .popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} @@ -127,7 +130,7 @@ a:hover.btn_de{ background:#ff5d31;} a.btn_pu{ border:1px solid #3cb761; color:#3cb761; } a:hover.btn_pu{ background:#3cb761;} .pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:19px; padding-top:3px; } -.polls_title_w { width:300px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} +.polls_title_w { max-width:280px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} .polls_title_st { max-width:530px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;} .polls_de_grey{ color:#b1b1b1; margin-top:3px;} .ml5{ margin-left:5px;} diff --git a/public/stylesheets/project.css b/public/stylesheets/project.css index 673b1f59c..8d86a6873 100644 --- a/public/stylesheets/project.css +++ b/public/stylesheets/project.css @@ -12,6 +12,7 @@ a:hover.lg-foot{ color:#787b7e;} /*右侧内容--动态*/ .project_r_h{ width:670px; height:40px; background:#eaeaea; margin-bottom:10px;} .project_h2{ background:#64bdd9; color:#fff; height:33px; width:90px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;} +.project_h22{ background:#64bdd9; color:#fff; height:33px; width:124px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;} .project_r_box{ border:1px solid #e2e1e1; width:670px; margin-top:10px;} .project_h3 { color:#646464; font-size:14px; padding:0 10px; border-bottom:1px solid #e2e1e1;} a.more{ float:right; font-size:12px; font-weight:normal; color:#a9a9a9; margin-top:3px;} @@ -73,7 +74,11 @@ a:hover.problem_pic{border:1px solid #64bdd9;} .issues_icon{ background:url(../images/public_icon.png) 0 -342px no-repeat; width:16px; height:21px;} .problem_txt{ width:600px; margin-left:10px; color:#777777; } .pro_txt_w{width:610px;} -a.problem_name{ color:#ff5722; } +a.problem_name{ color:#ff5722;max-width: 80px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} a:hover.problem_name{ color:#d33503;} a.problem_tit{ color:#0781b4; max-width:430px; font-weight:bold; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;} a.problem_tit02{ color:#0781b4; font-weight:bold;max-width:400px;} @@ -550,7 +555,24 @@ p.percent { font-size: 12px; } .repositorytitle select{ width: 110px; height: 21px; } - +.riviseRed { + width:15px; + height:15px; + margin-right: 3px; + background-color:#FF0000; + filter:alpha(opacity=50); /* ie 有效*/ + -moz-opacity:0.5; /* Firefox 有效*/ + opacity: 0.5; /* 通用,其他浏览器 有效*/ +} +.changeBlue { + width:15px; + height:15px; + margin-right: 3px; + background-color:#0000FF; + filter:alpha(opacity=50); /* ie 有效*/ + -moz-opacity:0.5; /* Firefox 有效*/ + opacity: 0.5; /* 通用,其他浏览器 有效*/ +} /*导出*/ @@ -672,9 +694,10 @@ table.list thead th tr.changeset { height: 20px } tr.changeset ul, ol { margin-top: 0px; margin-bottom: 0px; } -tr.changeset td.revision_graph { width: 15%; background-color: #fffffb; } +tr.changeset td.revision_graph { width: 1%; background-color: #fffffb; } tr.changeset td.author { text-align: center; width: 15%; white-space:nowrap;} tr.changeset td.committed_on { text-align: center; width: 15%; white-space:nowrap;} +tr.changeset td.comments { text-align: center; word-break:break-all; word-wrap: break-word;;} div.changeset { padding: 4px;} div.changeset { border-bottom: 1px solid #ddd; } @@ -752,3 +775,6 @@ a:hover.Reply_pic{border:1px solid #64bdd9;} #about_newtalk{ display:none;} +/*version*/ +.time_tracter{color: #64BDD9;padding: 5px;} + diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 8e16c9436..82b3f17aa 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -73,12 +73,16 @@ h4{ font-size:14px; color:#3b3b3b;} .ml320{ margin-left:320px;} .mr5{ margin-right:5px;} .mr10{ margin-right:10px;} +.mr15 {margin-right: 15px;} .mr20{ margin-right:20px;} .mr30{ margin-right:30px;} .mr40{ margin-right:40px;} +.mr45{margin-right: 45px;} .mr50{margin-right: 50px;} .mr55{margin-right: 55px;} .mr70{margin-right: 70px;} +.mw15{margin:0 15px;} +.mw20{margin:0 20px;} .mt1{margin-top: 1px;} .mt3{ margin-top:3px;} .mt5{ margin-top:5px;} @@ -86,6 +90,7 @@ h4{ font-size:14px; color:#3b3b3b;} .mt10{ margin-top:10px;} .mt30{ margin-top: 30px;} .mb5{ margin-bottom:5px;} +.mb8{ margin-bottom:8px;} .mb10{ margin-bottom:10px;} .mb20{ margin-bottom:20px;} .pl15{ padding-left:15px;} @@ -96,6 +101,7 @@ h4{ font-size:14px; color:#3b3b3b;} .w60{ width:60px;} .w70{ width:70px;} .w90{ width:90px;} +.w100{width: 100px;} .w210{ width:210px;} .w150{ width:150px;} .w280{ width:280px;} @@ -163,11 +169,13 @@ a.c_green{ color:#28be6c;} .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;} -.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;} +.green_btn{ background:#28be6c; color:#fff; font-size:14px; font-weight:normal;padding:2px 8px; text-align:center;} +a.green_btn{background:#28be6c;color:#fff;font-size:14px; font-weight:normal; padding:2px 8px; text-align:center;cursor: pointer;} 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;} +.blue_btn{ background:#64bdd9; color:#fff; font-size:14px; font-weight:normal;padding:2px 8px; text-align:center;} +a.blue_btn{background:#64bdd9;color:#fff;font-size:14px; font-weight:normal; padding:2px 8px; text-align:center;cursor: pointer;} +.red_btn{ background:red; color:#fff; font-size:14px; font-weight:normal;padding:2px 8px; text-align:center;} +a.red_btn{background:red; color:#fff;font-size:14px; font-weight:normal; padding:2px 8px; text-align:center;cursor: pointer;} 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; } @@ -449,3 +457,13 @@ img,embed{max-width: 100%;} .is_public_checkbox{margin-left: 15px;margin-right: 10px;} .author_name{color: #3ca5c6 !important;} .ke-container-default{max-width: 100%;} + +/*底部*/ +/*#Footer{background-color:#ffffff; margin-bottom:10px; padding-bottom:15px; color:#666666;}*/ +/*.footerAboutContainer {width:auto; border-bottom:1px solid #efefef;}*/ +/*.footerAbout{ width:585px; margin:0 auto;height:35px; line-height:35px; border-bottom:1px solid #efefef; }*/ +/*.languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;}*/ +/*.departments{ width:890px; margin:5px auto 0 auto;height:30px;line-height:30px;}*/ +/*.copyright{ width:390px; margin:0 auto;height:20px;line-height:20px;}*/ +/*a.f_grey {color:#666666;}*/ +/*a.f_grey:hover {color:#000000;}*/ diff --git a/public/stylesheets/public_new.css b/public/stylesheets/public_new.css new file mode 100644 index 000000000..83e8189b3 --- /dev/null +++ b/public/stylesheets/public_new.css @@ -0,0 +1,651 @@ +/* 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:#15bccf;} +/*img{max-width: 100%;}*/ + +/*常用*/ +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;} +.mr45{margin-right: 45px;} +.mw15{margin:0 15px;} +.mw20{margin:0 20px;} +.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;} + +/*底部*/ +/*#Footer{background-color:#ffffff; margin-bottom:10px; padding-bottom:15px; color:#666666;}*/ +/*.footerAboutContainer {width:auto; border-bottom:1px solid #efefef;}*/ +/*.footerAbout{ width:585px; margin:0 auto;height:35px; line-height:35px; border-bottom:1px solid #efefef; }*/ +/*.languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;}*/ +/*.departments{ width:890px; margin:5px auto 0 auto;height:30px;line-height:30px;}*/ +/*.copyright{ width:390px; margin:0 auto;height:20px;line-height:20px;}*/ +/*a.f_grey {color:#666666;}*/ +/*a.f_grey:hover {color:#000000;}*/ + + +/*主类容左右分栏*/ +#LSide{ width:240px; } +#RSide{ width:730px; margin-left:10px; background:#fff; padding:10px; margin-bottom:10px;} + + +/*资源库*/ +.resources {width:730px; background-color:#ffffff;} +.resourcesBanner {width:730px; height:40px; background-color:#eaeaea; margin-bottom:10px;} +.bannerName {background:#64bdd9; color:#ffffff; height:40px; line-height:40px; width:90px; text-align:center; font-weight:normal; vertical-align:middle; font-size: 16px; float:left;} +.resourcesSelect {width:40px; height:40px; float:right; position:relative;} +.resourcesSelected {width:25px; height:20px;} +.resourcesIcon {margin-top:15px; display:block; position:relative; background:url(images/resource_icon_list.png) 0px 0px no-repeat; width:25px; height:20px;} +.resourcesIcon:hover { background:url(images/resource_icon_list.png) 0px -25px no-repeat;} +.resourcesType {width:50px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:35px; padding:5px 10px; left:-30px; font-size:12px; color:#888888; display:none;} +a.resourcesGrey {font-size:12px; color:#888888;} +a.resourcesGrey:hover {font-size:12px; color:#15bccf;} +.resourcesBanner ul li:hover ul.resourcesType {display:block;} +ul li:hover ul {display:block;} +.resourcesUploadBox {float:right; width:103px; height:34px; background-color:#64bdd9; line-height:34px; vertical-align:middle; text-align:center; margin-left:12px;} +.uploadIcon {background:url(images/resource_icon_list.png) -35px 10px no-repeat; float:left; display:block; width:30px; height:30px; margin-left:-3px;} +a.uploadText {color:#ffffff; font-size:14px;} +.resourcesSearchloadBox {border:1px solid #e6e6e6; width:225px; float:right; background-color:#ffffff;} +.searchResource {border:none; outline:none; background-color:#ffffff; width:184px; height:32px; padding-left:10px; display:block; float:left;} +.searchIcon{width:31px; height:32px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -15px no-repeat; display:block; float:left;} +.resourcesSearchBanner {height:34px; margin-bottom:10px;} +.resourcesListTab {width:730px; height:40px; background-color:#f6f6f6; border-bottom:1px solid #eaeaea; font-size:14px; color:#7a7a7a;} +.resourcesListCheckbox {width:40px; height:40px; line-height:40px; text-align:center; vertical-align:middle;} +.resourcesCheckbox {padding:0px; margin:0px; margin-top:14px; width:12px; height:12px;} +.resourcesListName {width:135px; height:40px; line-height:40px; text-align:left;} +.resourcesListSize {width:110px; height:40px; line-height:40px; text-align:center;} +.resourcesListType {width:150px; height:40px; line-height:40px; text-align:center;} +.resourcesListUploader {width:130px; height:40px; line-height:40px; text-align:center;} +.resourcesListTime {width:165px; height:40px; line-height:40px; text-align:center;} +.resourcesList {width:730px; height:39px; background-color:#ffffff; border-bottom:1px dashed #eaeaea; color:#9a9a9a; font-size:12px;} +a.resourcesBlack {font-size:12px; color:#4c4c4c;} +a.resourcesBlack:hover {font-size:12px; color:#000000;} +.dropdown-menu { + position: absolute; + top: 100%; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 80px; + padding: 5px 0; + margin: 2px 0 0; + font-size: 12px; + text-align: left; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #ccc; + border-radius: 4px; + -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175); + box-shadow: 0 6px 12px rgba(0, 0, 0, .175); +} +.dropdown-menu > li > a { + display: block; + padding: 3px 20px; + clear: both; + font-weight: normal; + line-height: 1.5; + color:#616060; + white-space: nowrap; +} +.dropdown-menu > li > a:hover{ + color: #ffffff; + text-decoration: none; + background-color: #64bdd9; + outline:none; +} + +/*发送资源弹窗*/ +/*.resourceShareContainer {width:100%; height:100%; background:#666; filter:alpha(opacity=50); opacity:0.5; -moz-opacity:0.5; position:absolute; left:0; top:0; z-index:-999;}*/ +.resourceSharePopup {width:300px; height:auto; border:3px solid #15bccf; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;} +.sendText {font-size:16px; color:#15bccf; line-height:16px; padding-top:20px; width:140px; display:inline-block;} +.resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;} +.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block;} +.resourcesSearchBox {border:1px solid #e6e6e6; width:225px; height:25px; background-color:#ffffff; margin-top:12px; margin-bottom:15px;} +.searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;} +.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -18px no-repeat; display:inline-block; float:left;} +.courseSend {width:260px; height:15px; line-height:15px; margin-bottom:10px;} +.courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;} +.sendCourseName {font-size:12px; color:#5f6060;} +.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#64bdd9; margin-right:25px; float:left;} +.courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left} +a.sendSourceText {font-size:14px; color:#ffffff;} + +/*上传资源弹窗*/ +.resourceUploadPopup {width:400px; height:auto; border:3px solid #15bccf; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;} +.uploadText {font-size:16px; color:#15bccf; line-height:16px; padding-top:20px; width:140px; display:inline-block;} +.uploadBoxContainer {height:33px; line-height:33px; margin-top:10px; position:relative;} +.uploadBox {width:100px; height:33px; line-height:33px; text-align:center; vertical-align:middle; background-color:#64bdd9; border-radius:3px; float:left; margin-right:12px;} +a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat; width:100px; height:33px;} +.chooseFile {color:#ffffff; display:block; margin-left:32px;} +.uploadResourceIntr {width:250px; height:33px; float:left; line-height:33px; font-size:12px;} +.uploadResourceName {width:250px; display:inline-block; line-height:15px; font-size:12px; color:#444444; margin-bottom:2px;} +.uploadResourceIntr2 {width:250px; display:inline-block; line-height:15px; font-size:12px; color:#444444;} +.uploadType {margin:10px 0; border:1px solid #e6e6e6; width:100px; height:30px; outline:none; font-size:12px; color:#888888;} +.uploadKeyword {margin-bottom:10px; outline:none; border:1px solid #e6e6e6; height:30px; width:280px;} + + +/*新个人主页框架css*/ +.navContainer {width:100%; margin:0 auto; background-color:#15bccf;} +.homepageContentContainer {width:100%; margin:0 auto; background-color:#eaebed;} +.homepageContent {width:1000px; background-color:#eaebed; margin:0 auto;} +.navHomepage {width:1000px; height:54px; background-color:#15bccf; margin:0 auto;} +.navHomepageLogo {width:60px; height:54px; line-height:54px; vertical-align:middle; margin-left:2px; margin-right:40px;} +.navHomepageMenu {margin-right:40px;display:inline-block;height:54px; line-height:54px; vertical-align:middle;} +.navHomepageSearchBox {width:380px; border:none; outline:none; height:32px; margin-top:11px; background-color:#ffffff;} +.navHomepageSearchInput {width:345px; height:32px; outline:none; border:none; float:left; padding-left:5px;; margin:0;} +.homepageSearchIcon {width:30px; height:32px; background:url(../images/nav_icon.png) -8px 3px no-repeat; float:left;} +a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no-repeat;} +.navHomepageNews {width:30px; display:block; float:right; margin-top:12px; position:relative;} +.homepageNewsIcon {background:url(../images/nav_icon.png) -5px -85px no-repeat; width:30px; height:29px; display:block;} +.newsActive {width:10px; height:10px; border-radius:50%; border:2px solid #ffffff; background-color:#ff0000; position:absolute; left:17px; top:5px;} +.navHomepageProfile {width:65px; display:block; float:right; margin-top:8px; margin-left:33px;} +.homepageProfileMenuIcon {background:url(../images/nav_icon.png) -8px -175px no-repeat; width:20px; height:25px; float:left; margin-top:15px;} +a.homepageProfileMenuIcon:hover {background:url(../images/nav_icon.png) -8px -175px no-repeat; width:12px; height:12px; float:left;} +.homepageLeft {width:240px; float:left; margin-right:10px;} +.homepageRight {width:750px; float:left;} +.homepagePortraitContainer {width:238px; height:348px; border:1px solid #dddddd; background-color:#ffffff; margin-top:15px;} +.homepagePortraitImage {width:208px; height:208px; margin:15px 16px 14px 16px;} +.homepageFollow {} +.homepageEditProfile {} +.homepageImageName {font-size:16px; color:#484848; margin-left:15px; display:inline-block; margin-right:8px;} +.homepageImageSex {float:left; top:116px; left:5px; width:14px; height:14px; display:inline-block;} +.homepageSignature {font-size:12px; color:#888888; margin-left:15px; margin-top:5px; margin-bottom:15px;} +.homepageImageBlock {margin:0 26px; float:left; text-align:center; display:inline-block;} +.homepageImageNumber {font-size:12px; color:#484848;} +.homepageImageText {width:26px; font-size:12px; color:#888888;} +.homepageVerDiv {height:28px; vertical-align:middle; width:1px; float:left; display:inline-block; background-color:#d1d1d1; margin-top:3px;} +.homepageLeftMenuContainer {width:238px; border:1px solid #dddddd; border-bottom:none; background-color:#ffffff; margin-top:10px;} +.homepageLeftMenuBlock {border-bottom:1px solid #dddddd; height:50px; line-height:50px; vertical-align:middle;} +a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;} +.homepageLeftLabelContainer {width:238px; border:1px solid #dddddd; background-color:#ffffff; margin-top:10px;} +.homepageRightBanner {} +.newsType {width:60px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:35px; padding:5px 10px; left:-40px; font-size:12px; color:#888888; display:none; line-height:2;} +.homepageRightBlock {} +.homepageNewsList {width:710px; height:39px; line-height:39px; vertical-align:middle; border-bottom:1px dashed #eaeaea; margin:0 auto;} +.homepageNewsPortrait {width:40px; display:block; margin-top:7px;} +.homepageNewsPublisher {width:95px; font-size:12px; color:#15bccf; display:block;} +.homepageNewsType {width:95px; font-size:12px; color:#888888; display:block;} +.homepageNewsContent {width:405px; font-size:12px; color:#4b4b4b; display:block;} +.homepageNewsTime {width:75px; font-size:12px; color:#888888; display:block; text-align:right;} +a.homepageWhite {color:#ffffff;} +a.homepageWhite:hover {color:#a1ebff} +a.newsGrey {color:#4b4b4b;} +a.newsGrey:hover {color:#000000;} +a.newsBlue {color:#15bccf;} +a.newsBlue:hover {color:#0781b4;} +a.resourcesGrey {font-size:12px; color:#888888;} +a.resourcesGrey:hover {font-size:12px; color:#15bccf;} + + +/***** 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 ****/ + +/*消息铃铛样式*/ +.navHomepageNews {width:30px; display:block; float:right; margin-top:4px; position:relative; margin-right: 8px;} +.newsActive {width:6px; height:6px; border-radius:50%; border:2px solid #ffffff; background-color:#ff0000; position:absolute; left:20px; top:8px;z-index:999} diff --git a/public/stylesheets/users.css b/public/stylesheets/users.css new file mode 100644 index 000000000..9a809b7ce --- /dev/null +++ b/public/stylesheets/users.css @@ -0,0 +1,147 @@ +#RSide{ min-height:1px;} +/* 左侧信息*/ +.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{ 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;margin-top: 10px;} +.users_pic{ width:46px; height:46px; border:1px solid #e3e3e3;} +.users_pic:hover{ border:1px solid #a5a5a5;} +.users_pic_sub{width:32px; height:32px; border:1px solid #e3e3e3;} +.users_pic_sub: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; margin-bottom:10px;color: #5f5f5f;} +.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:nor;}*/ +.w450{ width:450px;} +.w210{ width:200px;} +.w70{ width:70px;} +.h200{ height:200px;} +/* 个人主页*/ +a.edit_btn{display:block; background:url(../images/leftside.png) -1px 0 no-repeat; width:33px; height:18px; border:1px solid #cdcdcd; color:#333333; padding:0px 0 0 18px;} +a:hover.edit_btn{ color:#ff5722;} +a.gz_btn{display:block; background:url(../images/pic_uersall.png) -318px -25px no-repeat; width:53px; 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:53px; 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;} +.mr15{ margin-right:15px;} +.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;} +/* 留言新增*/ +.mes_box{ width:580px;} +.mes_box02{ margin-left:50px; border-top:1px dashed #c9c9c9; padding-top:10px;margin-bottom: 10px;} +.mes_box02_info{ width:540px; margin-left:5px;} +.users_r_top{ width:730px; height:40px; background:#eaeaea; margin-bottom:10px;} +.users_r_h2{background:#64bdd9; color:#fff; height:33px; width:90px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;} + + +a.hidepic>img{display:none;} + +div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;} +span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;} +span.ke-toolbar-icon-url{background-image:url( ../images/public_icon.png )} +div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;} +span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;} +span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;} +div.ke-toolbar .ke-outline{border:none;} +.cr{clear: right;} \ No newline at end of file diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css index 4a23e59c5..1b32d4659 100644 --- a/public/themes/redpenny-master/stylesheets/application.css +++ b/public/themes/redpenny-master/stylesheets/application.css @@ -443,7 +443,6 @@ color: #000000; width:auto; /*float:center;*/ min-height:800px; - border: 1px solid #ffffff; } /*by huang*/ @@ -1122,6 +1121,11 @@ a.root { line-height: 1; } +.courses{ + margin:0px; + padding-left: 0em; +} + .project-table { margin-left: auto; margin-right: auto; diff --git a/spec/factories/course_messages.rb b/spec/factories/course_messages.rb new file mode 100644 index 000000000..7b2523adc --- /dev/null +++ b/spec/factories/course_messages.rb @@ -0,0 +1,10 @@ +FactoryGirl.define do + factory :course_message do + user_id 1 +course_id 1 +course_message_id 1 +course_message_type "MyString" +viewed 1 + end + +end diff --git a/spec/factories/dts.rb b/spec/factories/dts.rb new file mode 100644 index 000000000..05e6148c2 --- /dev/null +++ b/spec/factories/dts.rb @@ -0,0 +1,19 @@ +FactoryGirl.define do + factory :dt, :class => 'Dts' do + IPLineCode "MyString" +Description "MyString" +Num "MyString" +Variable "MyString" +TraceInfo "MyString" +Method "MyString" +File "MyString" +IPLine "MyString" +Review "MyString" +Category "MyString" +Defect "MyString" +PreConditions "MyString" +StartLine "MyString" +project_id 1 + end + +end diff --git a/spec/factories/forge_messages.rb b/spec/factories/forge_messages.rb new file mode 100644 index 000000000..05bc84cc1 --- /dev/null +++ b/spec/factories/forge_messages.rb @@ -0,0 +1,10 @@ +FactoryGirl.define do + factory :forge_message do + user_id 1 +project_id 1 +forge_message_id 1 +forge_message_type "MyString" +viewed 1 + end + +end diff --git a/spec/models/course_message_spec.rb b/spec/models/course_message_spec.rb new file mode 100644 index 000000000..cddcdc0a1 --- /dev/null +++ b/spec/models/course_message_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe CourseMessage, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/dts_spec.rb b/spec/models/dts_spec.rb new file mode 100644 index 000000000..5c274cba4 --- /dev/null +++ b/spec/models/dts_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Dts, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/forge_message_spec.rb b/spec/models/forge_message_spec.rb new file mode 100644 index 000000000..ce6cd7e26 --- /dev/null +++ b/spec/models/forge_message_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe ForgeMessage, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end