Merge branch 'szzh' into dev_zanle

Conflicts:
	app/controllers/users_controller.rb
This commit is contained in:
lizanle 2015-08-21 14:10:50 +08:00
commit 9138f46301
77 changed files with 1887 additions and 459 deletions

View File

@ -395,4 +395,78 @@ class AdminController < ApplicationController
end end
#留言列表
def leave_messages
@jour = JournalsForMessage.find_by_sql("SELECT * FROM journals_for_messages AS j1
WHERE j1.jour_type IN ('Course','Principal') AND (j1.m_parent_id IS NULL OR (j1.m_parent_id IN (SELECT id FROM journals_for_messages WHERE jour_type IN ('Course','Principal')))) order by created_on desc")
@jour = paginateHelper @jour,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
#帖子
def messages_list
@memo = Memo.reorder("created_at desc")
@memo = paginateHelper @memo,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
#课程讨论区的帖子
def course_messages
@course_ms=Message.joins("join boards on messages.board_id=boards.id where boards.course_id is not NULL").reorder('created_on desc')
@course_ms = paginateHelper @course_ms,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
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')
@project_ms = paginateHelper @project_ms,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
#通知
def notices
@news = News.where('course_id is not NULL').order('created_on desc')
@news = paginateHelper @news,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
#最近登录用户列表
def latest_login_users
scope = User.order('last_login_on desc')
scope = scope.where("last_login_on>= '#{params[:startdate]} 00:00:00'") if params[:startdate].present?
scope =scope.where("last_login_on <= '#{params[:enddate]} 23:59:59'") if params[:enddate].present?
@user = scope
@user = paginateHelper @user,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
#作业
def homework
@homework = HomeworkCommon.order('end_time desc')
@homework = paginateHelper @homework,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
end end

View File

@ -106,74 +106,17 @@ class CoursesController < ApplicationController
# 课程搜索 # 课程搜索
# add by nwb # add by nwb
def search def search
courses_all = Course.all_course if params[:name].empty?
name = params[:name] courses = Course.visible
if name.blank? @courses = paginateHelper courses,10
@courses = []
@courses_all = []
@course_count = 0
@course_pages = Paginator.new @course_count, per_page_option, params['page']
else else
@courses = courses_all.visible courses = Course.visible.where("LOWER(name) like '%#{params[:name].to_s.downcase}%'")
if params[:name].present? @courses = paginateHelper courses,10
@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
end end
respond_to do |format| respond_to do |format|
format.html { format.html {
render :layout => 'course_base' render :layout => 'course_base'
scope = Course
unless params[:closed]
scope = scope.active
end
} }
format.atom { format.atom {
courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
@ -663,92 +606,9 @@ class CoursesController < ApplicationController
end end
def show def show
if params[:jump] && redirect_to_course_menu_item(@course, params[:jump]) course_activities = @course.course_activities.order("created_at desc")
return @canShowRealName = User.current.member_of_course? @course
end @course_activities = paginateHelper course_activities,10
@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
respond_to do |format| respond_to do |format|
format.html{render :layout => 'base_courses'} format.html{render :layout => 'base_courses'}
format.api format.api

View File

@ -19,28 +19,28 @@ class HomeworkCommonController < ApplicationController
end end
def new def new
# @homework_type = "1" @homework_type = "1"
#
# @homework = HomeworkCommon.new @homework = HomeworkCommon.new
# @homework.safe_attributes = params[:homework_common] @homework.safe_attributes = params[:homework_common]
# @homework.late_penalty = 2 @homework.late_penalty = 2
# @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
# @homework.publish_time = Time.now.strftime('%Y-%m-%d') @homework.publish_time = Time.now.strftime('%Y-%m-%d')
#
# if @homework_type == "1" if @homework_type == "1"
# #匿评作业相关属性 #匿评作业相关属性
# @homework_detail_manual = HomeworkDetailManual.new @homework_detail_manual = HomeworkDetailManual.new
# @homework_detail_manual.ta_proportion = 0.6 @homework_detail_manual.ta_proportion = 0.6
# @homework_detail_manual.absence_penalty = 2 @homework_detail_manual.absence_penalty = 2
# @homework_detail_manual.evaluation_num = 3 @homework_detail_manual.evaluation_num = 3
# @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') @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_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
# @homework.homework_detail_manual = @homework_detail_manual @homework.homework_detail_manual = @homework_detail_manual
# elsif @homework_type == "2" elsif @homework_type == "2"
# #编程作业相关属性 #编程作业相关属性
# @homework_detail_programing = HomeworkDetailPrograming.new @homework_detail_programing = HomeworkDetailPrograming.new
# @homework.homework_detail_programing = @homework_detail_programing @homework.homework_detail_programing = @homework_detail_programing
# end end
respond_to do |format| respond_to do |format|
format.html format.html
end end

View File

@ -112,7 +112,19 @@ class IssuesController < ApplicationController
end end
def show 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 = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all
@journals.each_with_index {|j,i| j.indice = i+1} @journals.each_with_index {|j,i| j.indice = i+1}
@journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)

View File

@ -86,8 +86,14 @@ class ProjectsController < ApplicationController
@project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10) @project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10)
else else
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10) @project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
end end
@projects = @project_pages.order("created_on desc") @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| respond_to do |format|
format.html { format.html {
render :layout => 'base' render :layout => 'base'

View File

@ -30,6 +30,7 @@ class UsersController < ApplicationController
# menu_item :requirement_focus, :only => :watch_bids # 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_newfeedback, :only => :user_newfeedback
menu_item :user_messages, :only => :user_messages
#Ended by young #Ended by young
@ -51,7 +52,7 @@ class UsersController < ApplicationController
:watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :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_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,:user_resource, :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist] :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 :auth_user_extension, only: :show
#before_filter :rest_user_score, only: :show #before_filter :rest_user_score, only: :show
#before_filter :select_entry, only: :user_projects #before_filter :select_entry, only: :user_projects
@ -99,6 +100,41 @@ class UsersController < ApplicationController
end end
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 def user_projects_index
if User.current.admin? if User.current.admin?
memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}").first memberships = @user.memberships.all(conditions: "projects.project_type = #{Project::ProjectType_project}").first
@ -122,7 +158,7 @@ class UsersController < ApplicationController
return return
end end
end end
projects = @user.projects.visible.order("updated_on desc") 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') if(params[:status] == '1')
projects = projects.where("projects.user_id = ?",@user.id) projects = projects.where("projects.user_id = ?",@user.id)
elsif(params[:status] == '2') elsif(params[:status] == '2')
@ -252,7 +288,7 @@ class UsersController < ApplicationController
return return
end end
end end
courses = @user.courses.visible.order("created_at desc") 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') if(params[:status] == '1')
courses = courses.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now) courses = courses.where("endup_time >= ? or endup_time is null or endup_time=''",Time.now)
elsif(params[:status] == '2') elsif(params[:status] == '2')

View File

@ -1812,7 +1812,7 @@ module ApplicationHelper
#获取用户未过期的课程 #获取用户未过期的课程
def get_user_course user def get_user_course user
courses_doing = [] 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) if !course_endTime_timeout?(course)
courses_doing.push course courses_doing.push course
end end
@ -2380,17 +2380,18 @@ module ApplicationHelper
notice.html_safe notice.html_safe
end end
def stantard_code #老师C语言的标准代码
"// 这是一个C语言的样例程序 def c_stantard_code_teacher
// "// 老师您好这是一个C语言的样例程序
// //
// 123 //
// 347 // 123
// // 347
// ... ...
//
// // argv传入
// argv传入 //
//
#include <stdio.h> //引用必须头文件 #include <stdio.h> //引用必须头文件
int main(int argc, char** argv) { int main(int argc, char** argv) {
@ -2399,6 +2400,77 @@ int main(int argc, char** argv) {
printf(\"%d\",a+b); //输出a+b printf(\"%d\",a+b); //输出a+b
return 0; return 0;
}".html_safe
end
#老师C++语言的标准代码
def c_stantard_code_teacher_
"// 老师您好这是一个C++语言的样例程序
//
//
// 123
// 347
// ... ...
//
// argv传入
//
#include <iostream> //引用必须头文件
#include <cstdlib>
using namespace std;
int main(int argc, char** argv){
int a = atoi(argv[1]); //
int b = atoi(argv[2]); //
cout<<a+b; //a+b
return 0;
}".html_safe
end
#学生C语言的标准代码
def c_stantard_code_student
"// 同学好这是一个C语言的样例程序
//
//
// 123
// 347
// ... ...
//
// argv传入
//
#include <stdio.h> //引用必须头文件
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++语言的样例程序
//
//
// 123
// 347
// ... ...
//
// argv传入
//
#include <iostream> //引用必须头文件
#include <cstdlib>
using namespace std;
int main(int argc, char** argv){
int a = atoi(argv[1]); //
int b = atoi(argv[2]); //
cout<<a+b; //a+b
return 0;
}".html_safe }".html_safe
end end
end end

View File

@ -676,4 +676,61 @@ module CoursesHelper
end end
result result
end end
#生成课程相关动态的链接
def course_activity_link activity
# activity = CourseActivity.first
title = ""
url = ""
if activity.course_act
case activity.course_act_type
when "Course"
title = activity.course_act.name
url = course_path activity.course
when "HomeworkCommon"
title = "作业&nbsp;" + activity.course_act.name
url = student_work_index_path(:homework => activity.course_act.id)
when "News"
title = "通知公告&nbsp;" + activity.course_act.title
url = course_news_index_path(activity.course)
when "Attachment"
title = "课件&nbsp;" + activity.course_act.filename
url = course_files_path(activity.course)
when "Message"
title = "课程讨论区&nbsp;" + 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 = "留言&nbsp;" + activity.course_act.notes
url = course_feedback_path(activity.course)
when "Poll"
title = "问卷&nbsp;" + 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 end

View File

@ -27,6 +27,8 @@ class Attachment < ActiveRecord::Base
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id" belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
# 被ForgeActivity虚拟关联 # 被ForgeActivity虚拟关联
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy 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 # end
include UserScoreHelper include UserScoreHelper
@ -71,8 +73,8 @@ class Attachment < ActiveRecord::Base
cattr_accessor :thumbnails_storage_path cattr_accessor :thumbnails_storage_path
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_save :files_to_final_location before_save :files_to_final_location,:act_as_course_activity
after_create :office_conver, :be_user_score,:act_as_forge_activity# user_score after_create :office_conver, :be_user_score,:act_as_forge_activity
after_update :office_conver, :be_user_score after_update :office_conver, :be_user_score
after_destroy :delete_from_disk,:down_user_score after_destroy :delete_from_disk,:down_user_score
@ -552,4 +554,10 @@ class Attachment < ActiveRecord::Base
end end
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 end

View File

@ -33,6 +33,11 @@ class Course < ActiveRecord::Base
has_many :student_works, :through => :homework_commons, :dependent => :destroy has_many :student_works, :through => :homework_commons, :dependent => :destroy
has_many :course_groups, :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_taggable
acts_as_nested_set :order => 'name', :dependent => :destroy 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_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/
validates_length_of :description, :maximum => 10000 validates_length_of :description, :maximum => 10000
before_save :self_validate before_save :self_validate
after_create :create_board_sync after_create :create_board_sync, :act_as_course_activity
before_destroy :delete_all_members before_destroy :delete_all_members
safe_attributes 'extra', safe_attributes 'extra',
@ -310,6 +315,11 @@ class Course < ActiveRecord::Base
end end
end end
#课程动态公共表记录
def act_as_course_activity
self.course_acts << CourseActivity.new(:user_id => self.tea_id,:course_id => self.id)
end
#项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题 #项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题
#def name #def name
# read_attribute('name') || Project.find_by_identifier(self.extra).try(:name) # read_attribute('name') || Project.find_by_identifier(self.extra).try(:name)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -13,17 +13,40 @@ class HomeworkCommon < ActiveRecord::Base
has_many :student_works, :dependent => :destroy has_many :student_works, :dependent => :destroy
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表 has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动 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_attachable
acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" }, acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
:description => :description, :description => :description,
:author => :author, :author => :author,
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}} :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 after_destroy :delete_kindeditor_assets
def act_as_activity def act_as_activity
self.acts << Activity.new(:user_id => self.user_id) self.acts << Activity.new(:user_id => self.user_id)
end 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 def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON

View File

@ -49,6 +49,8 @@ class Issue < ActiveRecord::Base
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
# end # end
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy 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 acts_as_nested_set :scope => 'root_id', :dependent => :destroy
@ -80,7 +82,7 @@ class Issue < ActiveRecord::Base
attr_reader :current_journal attr_reader :current_journal
# fq # 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_update :be_user_score
after_destroy :down_user_score after_destroy :down_user_score
# after_create :be_user_score # after_create :be_user_score
@ -138,6 +140,16 @@ class Issue < ActiveRecord::Base
:project_id => self.project_id) :project_id => self.project_id)
end end
# 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 # Returns a SQL conditions string used to find all issues visible by the specified user

View File

@ -29,6 +29,8 @@ class Journal < ActiveRecord::Base
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
# 被ForgeActivity虚拟关联 # 被ForgeActivity虚拟关联
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy 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 # end
attr_accessor :indice attr_accessor :indice
@ -48,7 +50,7 @@ class Journal < ActiveRecord::Base
before_create :split_private_notes before_create :split_private_notes
# fq # 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 # end
#after_destroy :down_user_score #after_destroy :down_user_score
#before_save :be_user_score #before_save :be_user_score
@ -163,10 +165,17 @@ class Journal < ActiveRecord::Base
# Description 公共表中需要保存一份该记录 # Description 公共表中需要保存一份该记录
def act_as_forge_activity def act_as_forge_activity
self.forge_acts << ForgeActivity.new(:user_id => self.user_id, self.forge_acts << ForgeActivity.new(:user_id => self.user_id,
:project_id => self.issue.project.id) :project_id => self.issue.project.id)
end 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 # 更新用户分数 -by zjc
def be_user_score def be_user_score
#新建了缺陷留言且留言不为空,不为空白 #新建了缺陷留言且留言不为空,不为空白

View File

@ -56,9 +56,11 @@ class JournalsForMessage < ActiveRecord::Base
acts_as_attachable acts_as_attachable
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy 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? 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_create :reset_counters!
after_destroy :reset_counters! after_destroy :reset_counters!
after_save :be_user_score after_save :be_user_score
@ -177,4 +179,11 @@ class JournalsForMessage < ActiveRecord::Base
def delete_kindeditor_assets def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,7 delete_kindeditor_assets_from_disk self.id,7
end 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 end

View File

@ -32,7 +32,12 @@ class Message < ActiveRecord::Base
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
# 被ForgeActivity虚拟关联 # 被ForgeActivity虚拟关联
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy 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 # end
# 课程消息
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
#end
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
@ -68,7 +73,7 @@ class Message < ActiveRecord::Base
after_update :update_messages_board after_update :update_messages_board
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets 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 #before_save :be_user_score
scope :visible, lambda {|*args| scope :visible, lambda {|*args|
@ -185,6 +190,61 @@ class Message < ActiveRecord::Base
:project_id => self.board.project.id) :project_id => self.board.project.id)
end end
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 #更新用户分数 -by zjc
def be_user_score def be_user_score

View File

@ -28,7 +28,12 @@ class News < ActiveRecord::Base
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
# 被ForgeActivity虚拟关联 # 被ForgeActivity虚拟关联
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy 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 # end
# 课程消息
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
#end
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
@ -49,7 +54,7 @@ class News < ActiveRecord::Base
:author_key => :author_id :author_key => :author_id
acts_as_watchable 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 after_destroy :delete_kindeditor_assets
@ -121,6 +126,25 @@ class News < ActiveRecord::Base
end end
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 # Time 2015-03-31 13:50:54
# Author lizanle # Author lizanle
# Description 删除news后删除对应的资源 # Description 删除news后删除对应的资源
@ -132,4 +156,4 @@ class News < ActiveRecord::Base
Mailer.run.news_added(self) if Setting.notified_events.include?('news_added') Mailer.run.news_added(self) if Setting.notified_events.include?('news_added')
end end
end end

View File

@ -8,7 +8,12 @@ class Poll < ActiveRecord::Base
has_many :users, :through => :poll_users #该文件被哪些用户提交答案过 has_many :users, :through => :poll_users #该文件被哪些用户提交答案过
# 添加课程的poll动态 # 添加课程的poll动态
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy 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}" }, acts_as_event :title => Proc.new {|o| "#{l(:label_course_poll)}: #{o.polls_name}" },
:description => :polls_description, :description => :polls_description,
@ -27,4 +32,26 @@ class Poll < ActiveRecord::Base
self.acts << Activity.new(:user_id => self.user_id) self.acts << Activity.new(:user_id => self.user_id)
end 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 end

View File

@ -91,6 +91,8 @@ class Project < ActiveRecord::Base
has_many :tags, :through => :project_tags, :class_name => 'Tag' has_many :tags, :through => :project_tags, :class_name => 'Tag'
has_many :project_tags, :class_name => 'ProjectTags' has_many :project_tags, :class_name => 'ProjectTags'
# 关联虚拟表
has_many :forge_messages
belongs_to :organization belongs_to :organization

View File

@ -109,7 +109,6 @@ class User < Principal
has_many :contests, :foreign_key => 'author_id', :dependent => :destroy has_many :contests, :foreign_key => 'author_id', :dependent => :destroy
has_many :softapplications, :foreign_key => 'user_id', :dependent => :destroy has_many :softapplications, :foreign_key => 'user_id', :dependent => :destroy
has_many :journals_for_messages, :as => :jour, :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 :journal_replies, :dependent => :destroy
has_many :activities, :dependent => :destroy has_many :activities, :dependent => :destroy
has_many :students_for_courses has_many :students_for_courses
@ -128,8 +127,15 @@ class User < Principal
has_many :messages, :foreign_key => 'author_id' has_many :messages, :foreign_key => 'author_id'
has_one :user_score, :dependent => :destroy has_one :user_score, :dependent => :destroy
has_many :documents # 项目中关联的文档再次与人关联 has_many :documents # 项目中关联的文档再次与人关联
# 关联虚拟表
has_many :forge_messages
has_many :course_messages
# end # 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 # has_many :invite_lists
# end # end
@ -236,6 +242,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 def extensions
self.user_extensions ||= UserExtensions.new self.user_extensions ||= UserExtensions.new
end end
@ -265,7 +293,7 @@ class User < Principal
###添加留言 fq ###添加留言 fq
def add_jour(user, notes, reference_user_id = 0, options = {}) def add_jour(user, notes, reference_user_id = 0, options = {})
if options.count == 0 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 else
jfm = self.journals_for_messages.build(options) jfm = self.journals_for_messages.build(options)
jfm.save jfm.save
@ -299,11 +327,6 @@ class User < Principal
end end
## end ## end
# 查询用户未读过的记录
def count_new_jour
count = self.journals_for_messages.where("status=?", 1).count
end
#added by nie #added by nie
def count_new_journal_reply def count_new_journal_reply
count = self.journal_reply.count count = self.journal_reply.count

View File

@ -0,0 +1,8 @@
<div class="tabs">
<ul>
<li><%= link_to l(:label_forum), {:action => 'messages_list'}, class: "#{current_page?(messages_list_path)? 'selected' : nil }" %></li>
<li><%= link_to l(:label_borad_course), {:action => 'course_messages'}, class: "#{current_page?(course_messages_path)? 'selected' : nil }" %></li>
<li><%= link_to l(:label_borad_project), {:action => 'project_messages'}, class: "#{current_page?(project_messages_path)? 'selected' : nil }" %></li>
</ul>
</div>

View File

@ -0,0 +1,69 @@
<h3>
<%=l(:label_message_plural)%>
</h3>
<%= render 'tab_messages' %>
<h4><%=l(:label_borad_course) %></h4>
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
序号
</th>
<th style="width: 30px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(课程ID)">
来源(课程ID)
</th>
<th style="width: 50px;">
作者
</th>
<th style="width: 70px;">
时间
</th>
<th style="width: 120px;">
标题
</th>
<th style="width: 30px;">
回复数
</th>
</tr>
</thead>
<tbody>
<% @count=@page*30%>
<% for course in @course_ms -%>
<% @count=@count + 1 %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: center;">
<%= @count %>
</td>
<td align="center">
<%= Board.where('id=?',course.board_id).first.course_id %>
</td>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if course.try(:author).try(:realname) == ' '%><%= 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 %>
</td>
<td class="center">
<%= format_date(course.created_on) %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=course.subject %>'>
<%= link_to(course.subject, course_boards_path(Board.where('id=?',course.board_id).first.course_id)) %>
</td>
<td class="center">
<%= link_to(course.replies_count, course_boards_path(Board.where('id=?',course.board_id).first.course_id)) %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<% html_title(l(:label_message_plural)) -%>

View File

@ -0,0 +1,66 @@
<h3>
<%=l(:label_user_homework)%>
</h3>
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
序号
</th>
<th style="width: 120px;">
作业名称
</th>
<th style="width: 120px;">
课程名称
</th>
<th style="width: 50px;">
作者
</th>
<th style="width: 50px;">
提交作品数
</th>
<th style="width: 70px;">
提交截止日期
</th>
</tr>
</thead>
<tbody>
<%@count=@page*30 %>
<% for homework in @homework do %>
<% @count+=1 %>
<tr>
<td align="center">
<%=@count %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.name%>'>
<%=link_to(homework.name, student_work_index_path(:homework => homework.id))%>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=homework.course.name%>'>
<%= link_to(homework.course.name, course_path(homework.course.id)) %>
</td>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if homework.try(:user).try(:realname) == ' '%><%= 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 %>
</td>
<td align="center">
<%=link_to(StudentWork.where('homework_common_id=?',homework.id).count, student_work_index_path(:homework => homework.id))%>
</td>
<td align="center">
<%=format_date(homework.end_time) %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<% html_title(l(:label_user_homework)) -%>

View File

@ -0,0 +1,96 @@
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', :media => 'all' %>
<h3>
<%=l(:label_latest_login_user_list)%>
</h3>
<%= form_tag({}, :method => :get) do %>
<fieldset>
<legend>
<%= l(:label_filter_plural) %>
</legend>
<label style="float:left">开始日期:</label>
<%= text_field_tag 'startdate', params[:startdate], :size => 15, :onchange=>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
<%= calendar_for('startdate')%><span style="float: left ">&nbsp;&nbsp;&nbsp;</span>
<label style="float:left">结束日期:</label>
<%= text_field_tag 'enddate', params[:enddate], :size => 15, :onchange =>"$('#ui-datepicker-div').hide()", :style=>"float:left"%>
<%= calendar_for('enddate')%> &nbsp;
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'latest_login_users'}, :class => 'icon icon-reload' %>
</fieldset>
<% end %>
&nbsp;
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
序号
</th>
<th style="width: 70px;">
登录时间
</th>
<th style="width: 30px;">
用户id
</th>
<th style="width: 50px;">
用户姓名
</th>
<th style="width: 50px;">
用户昵称
</th>
<th style="width: 50px;">
用户身份
</th>
</tr>
</thead>
<tbody>
<% @count=@page * 30 %>
<% for user in @user do %>
<tr>
<% @count +=1 %>
<td align="center">
<%=@count %>
</td>
<td align="center">
<%=format_date(user.last_login_on) %>
</td>
<td align="center">
<%=user.id %>
</td>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if user.try(:realname) == ' '%><%= 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 %>
</td>
<td align="center">
<%=link_to(user.login, user_path(user)) %>
</td>
<td align="center">
<% case user.user_extensions.identity %>
<% when 0 %>
<%='老师' %>
<% when 1 %>
<%='学生' %>
<% when 2 %>
<%='企业' %>
<% when 3 %>
<%='开发者' %>
<% else %>
<%='未知身份' %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<% html_title(l(:label_latest_login_user_list)) -%>

View File

@ -0,0 +1,96 @@
<h3>
<%=l(:label_leave_message_list)%>
</h3>
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
序号
</th>
<th style="width: 50px;">
类型
</th>
<th style="width: 30px; white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(课程或用户ID)">
来源(课程或用户ID)
</th>
<th style="width: 50px;">
留言人
</th>
<th style="width: 70px;">
留言时间
</th>
<th style="width: 120px;">
留言内容
</th>
<th style="width: 30px;">
回复数
</th>
</tr>
</thead>
<tbody>
<% @count = @page * 30 %>
<% for journal in @jour -%>
<% @count=@count + 1 %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: center;">
<%= @count %>
</td>
<td align="center">
<%case journal.jour_type %>
<% when 'Principal' %>
<%='用户主页' %>
<% when 'Course' %>
<%='课程' %>
<% end %>
</td>
<td align="center">
<%= journal.jour_id %>
</td>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<% if journal.try(:user).try(:realname) == ' '%><%= journal.try(:user)%><% else %><%=journal.try(:user).try(:realname) %><% end %>'>
<% if journal.try(:user).try(:realname) == ' '%>
<%= link_to(journal.try(:user), user_path(journal.user)) %>
<% else %>
<%= link_to(journal.try(:user).try(:realname), user_path(journal.user)) %>
<% end %>
</td>
<td class="center">
<%= format_date(journal.created_on) %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=journal.notes %>'>
<%case journal.jour_type %>
<% when 'Principal' %>
<%= link_to(journal.notes.html_safe, feedback_path(journal.jour_id)) %>
<% when 'Course' %>
<%= link_to(journal.notes.html_safe, course_feedback_path(journal.jour_id)) %>
<% end %>
</td>
<td class="center">
<% if(journal.m_reply_count) %>
<%case journal.jour_type %>
<% when 'Principal' %>
<%= link_to(journal.m_reply_count, feedback_path(journal.jour_id)) %>
<% when 'Course' %>
<%= link_to(journal.m_reply_count, course_feedback_path(journal.jour_id)) %>
<% end %>
<% else %>
<%case journal.jour_type %>
<% when 'Principal' %>
<%= link_to(0, feedback_path(journal.jour_id)) %>
<% when 'Course' %>
<%= link_to(0, course_feedback_path(journal.jour_id)) %>
<% end %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<% html_title(l(:label_leave_message_list)) -%>

View File

@ -0,0 +1,71 @@
<h3>
<%=l(:label_message_plural)%>
</h3>
<%= render 'tab_messages' %>
<h4><%=l(:label_forum) %></h4>
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
序号
</th>
<th style="width: 30px; white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(贴吧ID)">
来源(贴吧ID)
</th>
<th style="width: 50px;">
作者
</th>
<th style="width: 70px;">
时间
</th>
<th style="width: 120px;">
标题
</th>
<th style="width: 30px;">
回复数
</th>
</tr>
</thead>
<tbody>
<% @count=@page * 30%>
<% for memo in @memo -%>
<% @count=@count + 1 %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: center;">
<%= @count %>
</td>
<td align="center">
<%= memo.forum_id %>
</td>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if memo.try(:author).try(:realname) == ' '%><%= 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 %>
</td>
<td class="center">
<%= format_date(memo.created_at) %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=memo.subject %>'>
<% if memo.parent_id.nil? || memo.subject.starts_with?('RE:')%>
<%= link_to(memo.subject, forum_memo_path(memo.forum, memo)) %>
<% else %>
<%= link_to("RE:"+memo.subject, forum_memo_path(memo.forum, memo)) %>
<% end %>
</td>
<td class="center">
<%= link_to(memo.replies_count, forum_memo_path(memo.forum, memo)) %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<% html_title(l(:label_message_plural)) -%>

View File

@ -0,0 +1,78 @@
<h3>
<%=l(:label_notification_list)%>
</h3>
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
序号
</th>
<th style="width: 30px;">
课程id
</th>
<th style="width: 120px;">
课程名称
</th>
<th style="width: 50px;">
主讲老师
</th>
<th style="width: 50px;">
作者
</th>
<th style="width: 70px;">
时间
</th>
<th style="width: 120px;">
标题
</th>
<th style="width: 30px;">
回复数
</th>
</tr>
</thead>
<tbody>
<% @count=@page * 30%>
<% for news in @news -%>
<% @count=@count + 1 %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: center;">
<%= @count %>
</td>
<td align="center">
<%=news.course_id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title="<%=news.course.name %>">
<%=link_to(news.course.name, course_path(news.course)) %>
</td>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title="<%=news.course.try(:teacher).try(:realname) %>">
<%=link_to(news.course.try(:teacher).try(:realname), user_path(news.course.teacher)) %>
</td>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if news.try(:author).try(:realname) == ' '%><%= 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 %>
</td>
<td class="center">
<%= format_date(news.created_on) %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=news.title %>'>
<%= link_to(news.title, news_path(news)) %>
</td>
<td class="center">
<%= link_to(news.comments_count, news_path(news)) %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<% html_title(l(:label_notification_list)) -%>

View File

@ -0,0 +1,70 @@
<h3>
<%=l(:label_message_plural)%>
</h3>
<%= render 'tab_messages' %>
<h4><%=l(:label_borad_project) %></h4>
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
序号
</th>
<th style="width: 30px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="来源(项目ID)">
来源(项目ID)
</th>
<th style="width: 50px;">
作者
</th>
<th style="width: 70px;">
时间
</th>
<th style="width: 120px;">
标题
</th>
<th style="width: 30px;">
回复数
</th>
</tr>
</thead>
<tbody>
<% @count=@page * 30 %>
<% for project in @project_ms -%>
<% @count=@count + 1 %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: center;">
<%= @count %>
</td>
<td align="center">
<%= Board.where('id=?',project.board_id).first.project_id %>
</td>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if project.try(:author).try(:realname) == ' '%><%= 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 %>
</td>
<td class="center">
<%= format_date(project.created_on) %>
</td>
<td title='<%=project.subject %>' style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name">
<%= link_to(project.subject, project_boards_path(Board.where('id=?',project.board_id).first.project_id)) %>
</td>
<td class="center">
<%= link_to(project.replies_count, project_boards_path(Board.where('id=?',project.board_id).first.project_id)) %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<% html_title(l(:label_message_plural)) -%>

View File

@ -1,7 +1,7 @@
<%= error_messages_for @board %> <%= error_messages_for @board %>
<div class="box tabular"> <div class="box tabular">
<p style="width:666;"> <p style="width:666px;">
<%= f.text_field :name, :required => true %> <%= f.text_field :name, :required => true %>
</p><!--by young--> </p><!--by young-->
<p> <p>

View File

@ -1,12 +1,5 @@
<style type="text/css"> <style type="text/css">
div.talk_new .ke-container{margin-left:2px;} div.talk_new .ke-container{margin-left:2px;}
/*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;}*/
.break_word {width:100%;} .break_word {width:100%;}
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
@ -16,14 +9,14 @@
for (var i=0; i<menuids.length; i++){ for (var i=0; i<menuids.length; i++){
var div = document.getElementById(menuids[i]); var div = document.getElementById(menuids[i]);
if(div == undefined)continue; if(div == undefined)continue;
var ultags=div.getElementsByTagName("ul") var ultags=div.getElementsByTagName("ul");
for (var t=0; t<ultags.length; t++){ for (var t=0; t<ultags.length; t++){
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle" ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle";
ultags[t].parentNode.onmouseover=function(){ ultags[t].parentNode.onmouseover=function(){
this.getElementsByTagName("ul")[0].style.display="block" this.getElementsByTagName("ul")[0].style.display="block";
} }
ultags[t].parentNode.onmouseout=function(){ ultags[t].parentNode.onmouseout=function(){
this.getElementsByTagName("ul")[0].style.display="none" this.getElementsByTagName("ul")[0].style.display="none";
} }
} }
} }
@ -46,46 +39,6 @@
<script type="text/javascript">//侧导航 <script type="text/javascript">//侧导航
//window.onload = function () {
// var topic_id = getParam('topic_id');
// document.getElementById(topic_id).focus();
//}
//
//var getParam = function(name){
// var search = document.location.search;
// var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g");
// var matcher = pattern.exec(search);
// var items = null;
// if(null != matcher){
// try{
// items = decodeURIComponent(decodeURIComponent(matcher[1]));
// }catch(e){
// try{
// items = decodeURIComponent(matcher[1]);
// }catch(e){
// items = matcher[1];
// }
// }
// }
// return items;
//};
//
//function show_newtalk()
//{
// $("#about_newtalk").toggle();
//
//
//
//}
//
//function show_newtalk1(id)
//{
// $(id).toggle();
// $(id).focus();
//
//
//}
function nh_check_field(params){ function nh_check_field(params){
var result=true; var result=true;
if(params.subject!=undefined){ if(params.subject!=undefined){

View File

@ -61,8 +61,8 @@
<!--gcm--> <!--gcm-->
<p class="stats"> <p class="stats">
<%= content_tag('span', link_to("#{course_activity_count @course}", course_path(@course)), :class => "info") %> <%= content_tag('span', link_to("#{@course.course_activities.count}", course_path(@course)), :class => "info") %>
<%= content_tag('span', l(:label_x_activity, :count => @course_activity_count[@course.id])) %> <%= content_tag('span', l(:label_x_activity, :count => @course.course_activities.count)) %>
</p> </p>
<!--gcm--> <!--gcm-->

View File

@ -39,17 +39,17 @@
<% end %> <% end %>
</div> </div>
<% if @courses.size == 0 %> <% if @courses && !@courses.empty? %>
<%= render :partial => 'layouts/no_content'%> <div id="courses-index">
<%= render_course_hierarchy(@courses)%>
</div>
<% else %> <% else %>
<div id="courses-index"> <%= render :partial => 'layouts/no_content'%>
<%= render_course_hierarchy(@courses)%>
</div>
<% end %> <% end %>
<div class="pagination"> <div class="pagination">
<ul> <ul>
<%= pagination_links_full @course_pages %> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</ul> </ul>
</div> </div>

View File

@ -1,83 +1,37 @@
<div class="project_r_h"> <div class="project_r_h">
<% if @controller_name=='ActivityNotifys' %>
<a class="fl about_me" style="width:80px;" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a>
<h2 class="fl project_h2" style="width:100px;">与我相关
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
</h2>
<div class="fr mt10 mr5 c_grey02">
<a class="c_dblue">
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label>
</a>
</div>
<% else %>
<h2 class="fl project_h2"><%= l(:label_activity)%></h2> <h2 class="fl project_h2"><%= l(:label_activity)%></h2>
<% if User.current.logged? %>
<a class="fl about_me" href="<%=course_activity_notifys_path(@course)%>">与我相关
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
</a>
<% end %>
<% end %>
</div> </div>
<% if @events_by_day != nil && @events_by_day.size >0 %> <%@course_activities.each do |activity|%>
<% @events_by_day.keys.sort.reverse.each do |day| %> <div class="problem_main" nhname="container">
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%> <a class="problem_pic fl">
<div class="problem_main" nhname="container"> <%= image_tag(url_to_avatar(activity.user), :width => "42", :height => "42") %>
<a class="problem_pic fl"> </a>
<%= image_tag(url_to_avatar(e.event_author), :width => "42", :height => "42") %> <div class="problem_txt fl mt5 upload_img">
</a> <%= link_to_user_header(activity.user,false,:class => 'problem_name c_orange fl') %>
<div class="problem_txt fl mt5 upload_img"> <span class="fl"> &nbsp;</span>
<%= link_to_user_header(e.event_author,false,:class => 'problem_name c_orange fl') if e.respond_to?(:event_author) %> <span class="fl"> <%= activity.course_act_type == "Course" ? "创建了课程" : l(:label_new_activity) %></span>
<%= link_to_user_header("(#{e.event_author})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName && e.respond_to?(:event_author) %> <%#= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link,
<span class="fl"> &nbsp;</span> :class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
<span class="fl"> <%= l(:label_new_activity) %></span> 'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
<% 'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
link = (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : <%#if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
(e.event_type.eql?("bid") ? homework_course_path(@course) : <!--span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span-->
(e.event_type.eql?("message") || e.event_type.eql?("reply") ? <%#end%>
course_boards_path(@course,:topic_id => e.id,:parent_id=>(e.parent_id ? e.parent_id : e.id)) : e.event_url)) <%= link_to course_activity_link activity%>
%> <div class="cl"></div>
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link, <p class="mt5 break_word">
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type, <%= course_activity_desc activity%>
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link", <br />
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%> <div class="cl"></div>
<%if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%> <%= activity.course_act_type == "Course" ? l(:label_create_time) : l(:label_activity_time) %> <%= format_time(activity.created_at) %>
<span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span> </p>
<%end%> <%= link_to_attachments_course(activity.course_act) if activity.course_act_type.to_s == "News" %>
<br /> </div>
<p class="mt5 break_word"><%= e.event_description.html_safe %> <div class="cl"></div>
<br /> </div><!--课程动态 end-->
<div class="cl"></div>
<%= l :label_activity_time %> <%= format_activity_day(day) %>&nbsp;<%= format_time(e.event_datetime, false) %>
</p>
<%= link_to_attachments_course(e) if e.class.to_s == "News" %>
</div>
<div class="cl"></div>
</div><!--课程动态 end-->
<% end%>
<% end%>
<% elsif @controller_name=='ActivityNotifys' %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end%>
<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %>
<div class="problem_main">
<a class="problem_pic fl">
<%= image_tag(url_to_avatar(@user), :width => "42", :height => "42") %>
</a>
<div class="problem_txt fl mt5">
<%= link_to_user_header(@user,false,:class => 'problem_name c_orange fl') %>
<%= link_to_user_header("(#{@user})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName %>
<span class="fl"> <%= l(:label_user_create_project) %></span>
<%= link_to @course.name,course_path(@course),:class => "problem_tit c_dblue fl fb"%>
<br />
<p class="mt5">
<br />
<%= l :label_create_time %> <%= format_time(@course.created_at) %>
</p>
</div>
<div class="cl"></div>
</div><!--课程动态 end-->
<% end%> <% end%>
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul> </ul>

View File

@ -48,11 +48,12 @@
<ul class="ml10"> <ul class="ml10">
<li> <li>
<label class="label02">迟交扣分:&nbsp;</label> <label class="label02">迟交扣分:&nbsp;</label>
<%= 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"} %>
<input type="number" value="<%= homework.late_penalty%>" min="0" max="50" class="fl mb10 h26 w70" name="late_penalty" onkeyup="check_late_penalty()">
<span class="fl mt5">&nbsp;分</span> <span class="fl mt5">&nbsp;分</span>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li > <li style="display: none;">
<label class="label02" >是否匿评:&nbsp;</label> <label class="label02" >是否匿评:&nbsp;</label>
<%= f.check_box :homework_type, :class => "mb10 mt5 fl" %> <%= f.check_box :homework_type, :class => "mb10 mt5 fl" %>
<div class="cl"></div> <div class="cl"></div>

View File

@ -43,7 +43,8 @@
<li> <li>
<label class="label02">迟交扣分:&nbsp;</label> <label class="label02">迟交扣分:&nbsp;</label>
<%= 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"} %>
<input type="number" value="<%= homework.late_penalty%>" min="0" max="50" class="fl mb10 h26 w70" name="late_penalty" onkeyup="check_late_penalty()">
<span class="fl mt5">&nbsp;分</span> <span class="fl mt5">&nbsp;分</span>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
@ -56,7 +57,7 @@
<ul> <ul>
<li > <li >
<label class="label02">&nbsp;开发语言:&nbsp;</label> <label class="label02">&nbsp;开发语言:&nbsp;</label>
<%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language.to_i), {:class => "fl mb10 h26 w70"} %> <%= 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));"} %>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
@ -78,7 +79,7 @@
<li > <li >
<label class="label02">&nbsp;标准代码:&nbsp;</label> <label class="label02">&nbsp;标准代码:&nbsp;</label>
<textarea name="standard_code" class=" w547 h350 mb10 fl" oninput="init_programing_test();" onpropertychange="init_programing_test()"><%= homework.homework_detail_programing.standard_code || stantard_code%></textarea> <textarea name="standard_code" class=" w547 h400 mb10 fl" oninput="init_programing_test();" onpropertychange="init_programing_test()"><%= homework.homework_detail_programing.standard_code || c_stantard_code_teacher%></textarea>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
@ -173,4 +174,20 @@
$(this).next("input").val(""); $(this).next("input").val("");
}); });
} }
function homework_language_change(obj)
{
if(obj.val() == "1")
{
// alert(1);
$("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher%>");
}
else if(obj.val() == "2")
{
// alert(2);
$("textarea[name='standard_code']").val("<%= escape_javascript c_stantard_code_teacher_%>");
}
}
</script> </script>

View File

@ -1,27 +1,17 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%= error_messages_for 'homework_common' %>
<div class="project_r_h"> <div class="project_r_h">
<h2 class="project_h2"> <h2 class="project_h2">
<%= l(:label_course_homework_new)%> <%= l(:label_course_homework_new)%>
</h2> </h2>
</div> </div>
<div class="hwork_new" id="hwork_new"> <div class="hwork_new">
<%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%> <%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
<input type="hidden" name="course" value="<%= @course.id%>"> <%= hidden_field_tag "course",@course.id%>
<h3 class="c_blue f16 mb10"> <%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
请选择将要发布的作业类型 <a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
</h3> <%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
<input type="radio" class="mb10 fl" name="homework_common_type" value="1" id="homework_detail_manual_radio" checked/> <%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
<span class="ml5 fl">
人工评分的作业(支持匿名互评、灵活设置评分比例)
</span>
<div class="cl"></div>
<input type="radio" class="mb20 fl" name="homework_common_type" value="2" id="homework_detail_programing_radio"/>
<span class="ml5 fl">
自动评测的编程作业支持C/C++程序的自动评分)
</span>
<div class="cl"></div>
<a href="javascript:void(0);" class=" orange_btn" onclick="$(this).parent().submit();">
下一步
</a>
<% end%> <% end%>
</div><!--hwork_new end--> </div><!--hwork_new end-->
<div class="cl"></div> <div class="cl"></div>

View File

@ -18,7 +18,7 @@
<ul class="sub_menu"> <ul class="sub_menu">
<% if @show_course == 1 && !visiable %> <% if @show_course == 1 && !visiable %>
<% hasCourse=false %> <% hasCourse=false %>
<% User.current.courses.each do |course| %> <% User.current.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) %> <% if !course_endTime_timeout?(course) %>
<% hasCourse=true %> <% hasCourse=true %>
<% break %> <% break %>
@ -37,6 +37,7 @@
{:controller=> 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.host_user}, {:controller=> 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.host_user},
{:class => 'my-message'} if User.current.logged?%> {:class => 'my-message'} if User.current.logged?%>
</li> </li>
</ul> </ul>
</div> </div>
<% end -%> <% end -%>

View File

@ -9,65 +9,60 @@
<div id="menu"> <div id="menu">
<ul class="menu"> <ul class="menu">
<% if User.current.logged? %> <% if User.current.logged? %>
<li> <li>
<%=link_to_user(User.current)%><!--<a href="javascript:void(0);" class="parent">用户名称</a>--> <%=link_to_user(User.current)%><!--<a href="javascript:void(0);" class="parent">用户名称</a>-->
<ul> <ul>
<% hidden_non_project = Setting.find_by_name("hidden_non_project") <% hidden_non_project = Setting.find_by_name("hidden_non_project")
visiable = hidden_non_project && hidden_non_project.value == "0"%> visiable = hidden_non_project && hidden_non_project.value == "0"%>
<% if @show_course == 1 && !visiable %> <% if @show_course == 1 && !visiable %>
<%# if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%> <%# if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
<% hasCourse=false %> <% hasCourse=false %>
<% User.current.courses.each do |course| %> <% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %> <% if !course_endTime_timeout?(course) %>
<% hasCourse=true %> <% hasCourse=true %>
<% end %>
<% end %> <% end %>
<% end %> <% if hasCourse %>
<% if hasCourse %> <li>
<a href="<%= url_for(:controller => 'users', :action => 'user_courses', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的课程</a>
<ul>
<% User.current.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) %>
<li title="<%=course.name%>"><a href="<%= url_for(:controller => 'courses', :action=>"show", :id=>course.id, :host=>Setting.host_course) %>"><%= course.name %></a>
<% end %>
<% end %>
</ul>
</li>
<% end %>
<%# end -%>
<% end %>
<% if User.current.projects.count>0 %>
<li> <li>
<a href="<%= url_for(:controller => 'users', :action => 'user_courses', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的课程</a> <a href="<%= url_for(:controller => 'users', :action => 'user_projects', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的项目</a>
<ul> <ul>
<% User.current.courses.each do |course| %> <% 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| %>
<% if !course_endTime_timeout?(course) %> <li title="<%=project.name%>">
<li title="<%=course.name%>"><a href="<%= url_for(:controller => 'courses', :action=>"show", :id=>course.id, :host=>Setting.host_course) %>"><%= course.name %></a> <a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>project.id, :host=>Setting.host_name) %>">
<% end %> <%=project.name%>
</a>
</li>
<% end %> <% end %>
</ul> </ul>
</li> </li>
<% end %> <% end %>
<%# end -%> <li><a href="<%= url_for(:controller => 'my', :action => 'account') %>">编辑资料</a></li>
</ul>
</li><!---level1 end--->
<!--消息提醒-->
<div class="navHomepageNews">
<%= link_to image_tag("/images/news_icon_small.png" , :width => "21", :height => "24"), {:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user} %>
<% if User.current.count_new_message >0 %>
<div class="newsActive"></div>
<% end %> <% end %>
</div>
<% if User.current.projects.count>0 %> <!--消息提醒end-->
<li> <!--<li ><a href="javascript:void(0);">退出</a></li>-->
<a href="<%= url_for(:controller => 'users', :action => 'user_projects', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的项目</a>
<ul>
<% User.current.projects.each do |project| %>
<li title="<%=project.name%>"><a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>project.id, :host=>Setting.host_name) %>"><%=project.name%></a></li>
<% end %>
</ul>
</li>
<% end %>
<li><a href="<%= url_for(:controller => 'my', :action => 'account') %>">编辑资料</a></li>
<!--<li><a href="javascript:void(0);" class="parent">我的课程</a>-->
<!--<ul>-->
<!--<li><a href="javascript:void(0);">新建课程</a></li>-->
<!--<li><a href="javascript:void(0);">我的课程0我的课程我的课程01我的课程011</a></li>-->
<!--<li><a href="javascript:void(0);">我的课程02</a></li>-->
<!--<li><a href="javascript:void(0);">我的课程02</a></li>-->
<!--</ul>&lt;!&ndash;-level3 end-&ndash;&gt;-->
<!--</li>&lt;!&ndash;-level2 end-&ndash;&gt;-->
<!--<li><a href="javascript:void(0);" class="parent">我的项目</a>-->
<!--<ul>-->
<!--<li><a href="javascript:void(0);">新建项目</a></li>-->
<!--<li><a href="javascript:void(0);">我的项目01</a></li>-->
<!--<li><a href="javascript:void(0);">我的项目0</a></li>-->
<!--<li><a href="javascript:void(0);">我的项目02</a></li>-->
<!--</ul>&lt;!&ndash;-level3 end-&ndash;&gt;-->
<!--</li>&lt;!&ndash;-level2 end-&ndash;&gt;-->
<!--<li><a href="javascript:void(0);">我的主页</a></li>-->
</ul>
</li><!---level1 end--->
<!--<li ><a href="javascript:void(0);">退出</a></li>-->
<% end %> <% end %>
</ul> </ul>
<%= render_menu :account_menu -%> <%= render_menu :account_menu -%>

View File

@ -26,7 +26,7 @@
<li id="my_courses_li"> <li id="my_courses_li">
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id},target:"_blank", :class => "parent" %> <%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id},target:"_blank", :class => "parent" %>
<ul id="my_courses_ul"> <ul id="my_courses_ul">
<% user_course.reverse.each do |course| %> <% user_course.each do |course| %>
<li title="<%=course.name%>"> <li title="<%=course.name%>">
<%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id},target:"_blank" %> <%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id},target:"_blank" %>
</li> </li>
@ -40,7 +40,7 @@
<li id="my_projects_li"> <li id="my_projects_li">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name},target:"_blank", :class => "parent" %> <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name},target:"_blank", :class => "parent" %>
<ul id="my_projects_ul" > <ul id="my_projects_ul" >
<% 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| %>
<li title="<%=project.name%>"> <li title="<%=project.name%>">
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name }, target:"_blank" %> <%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name }, target:"_blank" %>
</li> </li>
@ -53,6 +53,9 @@
</li> </li>
</ul> </ul>
</li> </li>
<% end -%> <% end -%>
<%= header_render_menu :account_menu -%> <%= header_render_menu :account_menu -%>
</ul> </ul>

View File

@ -4,7 +4,7 @@
<ul class="course_sub_menu"> <ul class="course_sub_menu">
<% course_index = 0 %> <% course_index = 0 %>
<% User.current.courses.reverse.each do |course| %> <% User.current.courses.each do |course| %>
<% if !course_endTime_timeout?(course) %> <% if !course_endTime_timeout?(course) %>
<%= render :partial => 'layouts/user_homework_list', :locals => {:course => course,:course_index => course_index} %> <%= render :partial => 'layouts/user_homework_list', :locals => {:course => course,:course_index => course_index} %>
<% course_index += 1 %> <% course_index += 1 %>

View File

@ -2,7 +2,7 @@
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"> <li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %> <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
<ul class="project_sub_menu" style="top:<%= hasCourse ? 35 : 0 %>px;"> <ul class="project_sub_menu" style="top:<%= hasCourse ? 35 : 0 %>px;">
<% 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| %>
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>"> <li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>">
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %> <%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
</li> </li>

View File

@ -113,7 +113,7 @@
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_activity), course_path(@course), :class => "f14 c_blue02" %> <%= link_to l(:label_activity), course_path(@course), :class => "f14 c_blue02" %>
<!--暂时不显示课程动态数,优化后在显示--> <!--暂时不显示课程动态数,优化后在显示-->
<%= link_to "(#{course_activity_count @course})", course_path(@course), :class => "subnav_num c_orange"%> <%= link_to "(#{@course.course_activities.count})", course_path(@course), :class => "subnav_num c_orange"%>
</div> </div>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%> <%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%>

View File

@ -2,11 +2,13 @@
<% poll_name = poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%> <% poll_name = poll.polls_name.empty? ? l(:label_poll_new) : poll.polls_name%>
<% if @is_teacher%> <% if @is_teacher%>
<li title="<%= poll.polls_name %>"> <li title="<%= poll.polls_name %>">
<% if has_commit %> <div style="width: 310px;float: left;">
<%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%> <% if has_commit %>
<% else %> <%= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
<%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %> <% else %>
<% end %> <%= link_to poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
<% end %>
</div>
</li> </li>
<% if poll.polls_status == 1%> <% if poll.polls_status == 1%>

View File

@ -104,9 +104,13 @@
</div> </div>
<% end %> <% end %>
<div class="pagination">
<ul>
<%= pagination_links_full @project_pages, @project_count %>
</ul>
</div>
<%#= paginate @project_pages %>
<%= paginate @project_pages %>

View File

@ -54,8 +54,8 @@
<%= @homework.homework_type == 2 ? "提交代码" : "作品描述"%> <%= @homework.homework_type == 2 ? "提交代码" : "作品描述"%>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
</label> </label>
<% if @homework.homework_type == 2%> <% if @homework.homework_type == 2 && @homework.homework_detail_programing%>
<%= f.text_area "description", :class => "w620 hwork_txt h350", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();", :value => stantard_code%> <%= 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 %> <% else %>
<%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%> <%= f.text_area "description", :class => "w620 hwork_txt", :placeholder => "作品描述不能为空", :onkeyup => "regexStudentWorkDescription();"%>
<% end%> <% end%>

View File

@ -23,8 +23,19 @@
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
<%= l(:label_x_has_fans,:count=>user.watcher_users.count)%> <%= l(:label_x_has_fans,:count=>user.watcher_users.count, :remote => true)%>
<%= l(:label_has_watchers,:count=>User.watched_by(user.id).count) %> <%= l(:label_has_watchers,:count=>User.watched_by(user.id).count, :remote => true) %>
<% if User.current.logged?%>
<% if User.current == user%>
<a href="<%= url_for(:controller => 'my', :action => 'account') %>" class="fr gz_btn mr10 ">编辑资料</a>
<%else%>
<%if(user.watched_by?(User.current))%>
<a id="user_watch_id" href="<%= watch_path(:object_type=> 'user',:object_id=>user.id,:target_id=>user.id) %>" class="fr qx_btn mr10" data-method="delete" data-remote="true" title="取消关注">取消关注</a>
<% else %>
<a id="user_watch_id" href="<%= watch_path(:object_type=>'user',:object_id=>user.id,:target_id=>user.id) %>" class="fr gz_btn mr10" data-method="post" data-remote="true" title="添加关注">添加关注</a>
<% end %>
<% end%>
<% end %>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -5,14 +5,14 @@
<% if @user.allowed_to?(:add_project, nil, :global => true) %> <% if @user.allowed_to?(:add_project, nil, :global => true) %>
<a href="<%= url_for(:controller => 'projects', :action => 'new',:host=>Setting.host_name) %>" class="bgreen_n_btn fr ml10 mt2" target="_blank">新建项目</a> <a href="<%= url_for(:controller => 'projects', :action => 'new',:host=>Setting.host_name) %>" class="bgreen_n_btn fr ml10 mt2" target="_blank">新建项目</a>
<% else %> <% else %>
<a href="<%= join_project_projects_path %>" data-remote ="true" class="green_n_btn fr mt2">加入项目</a> <a href="<%= join_project_projects_path %>" data-remote ="true" class="bgreen_n_btn fr mt2">加入项目</a>
<% end %> <% end %>
<% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %>
<a href="<%= url_for(:controller => 'courses', :action => 'new',:host=>Setting.host_course) %>" class="green_n_btn fr mt2" target="_blank">新建课程</a> <a href="<%= url_for(:controller => 'courses', :action => 'new',:host=>Setting.host_course) %>" class="bgreen_n_btn fr mt2" target="_blank">新建课程</a>
<% else %> <% else %>
<!--<a href="<%#= url_for(:controller => 'courses', :action => 'join_private_courses',:host=>Setting.host_course) %>" data-remote ="true" class="green_n_btn fr mt2">加入课程</a>--> <!--<a href="<%#= url_for(:controller => 'courses', :action => 'join_private_courses',:host=>Setting.host_course) %>" data-remote ="true" class="green_n_btn fr mt2">加入课程</a>-->
<a href="<%= join_private_courses_courses_path %>" data-remote ="true" class="green_n_btn fr mt2">加入课程</a> <a href="<%= join_private_courses_courses_path %>" data-remote ="true" class="bgreen_n_btn fr mt2">加入课程</a>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
</div> </div>

View File

@ -0,0 +1,79 @@
<div id="RSide" class="fl">
<div class="homepageRight">
<div class="resources">
<div class="resourcesBanner">
<div class="bannerName">消息</div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="newsType">
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "全部",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user} %></a></li>
<!--<li><a href="javascript:void(0);" class="resourcesGrey">@我</a></li>-->
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "作业消息",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'homework'} %></a></li>
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "讨论区",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'message'} %></a></li>
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "课程通知",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'news'} %></a></li>
<!--<li><a href="javascript:void(0);" class="resourcesGrey">指派给我</a></li>-->
<li><a href="javascript:void(0);" class="resourcesGrey"><%= link_to "问卷调查",{:controller=> 'users', :action => 'user_messages', id: User.current.id, host: Setting.host_user, :type => 'poll'} %></a></li>
</ul>
</li>
</ul>
</div>
<div>
<% if !@user_course_messages.blank? %>
<% @user_course_messages.each do |ucm| %>
<% if ucm.course_message_type == "News" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.author %></a></li>
<li class="homepageNewsType fl">发布通知</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to format_activity_title(" #{ucm.course_message.title}"), {:controller => 'news', :action => 'show', :id => ucm.course_message.id} %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "HomeworkCommon" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
<li class="homepageNewsType fl">发布作业</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ("#{ucm.course_message.name}"), student_work_index_path(:homework => ucm.course_message.id) %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "Poll" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.user), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.user %></a></li>
<li class="homepageNewsType fl">发布问卷</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to format_activity_title(" #{ucm.course_message.polls_name}"), poll_index_path(:polls_type => "Course", :polls_group_id => ucm.course_id) %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ucm.course_message_type == "Message" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= image_tag(url_to_avatar(ucm.course_message.author), :width => "30", :height => "30") %></a></li>
<li class="homepageNewsPublisher fl"><a href="javascript:void(0);" class="newsBlue"><%= ucm.course_message.author %></a></li>
<% if ucm.course_message.parent_id.nil? %>
<li class="homepageNewsType fl">发布帖子</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%=link_to ucm.course_message.subject, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id) %></a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
<% else %>
<li class="homepageNewsType fl">回复帖子</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%=link_to ucm.course_message.subject, course_boards_path(ucm.course_message.course,:parent_id => ucm.course_message.parent_id ? ucm.course_message.parent_id : ucm.course_message.id, :topic_id => ucm.course_message.id) %> </a></li>
<li class="homepageNewsTime fl"><%= time_tag(ucm.course_message.created_on).html_safe %> </li>
<% end %>
</ul>
<% end %>
<div class="cl"></div>
<% end %>
<% else %>
<div class="flash notice">暂无消息!</div>
<% end %>
</div>
</div>
</div>
</div>

View File

@ -33,7 +33,6 @@ zh:
label_account_identity_studentID: 请输入学号 label_account_identity_studentID: 请输入学号
field_brief_introduction_my: 个人签名 field_brief_introduction_my: 个人签名
field_description: 个人简介
field_is_required: 必填 field_is_required: 必填
field_firstname: 名字或组织名 field_firstname: 名字或组织名
firstname_empty: 名字不能为空 firstname_empty: 名字不能为空

View File

@ -42,10 +42,10 @@ en:
label_member: "Members" label_member: "Members"
project_module_attachments: "Resources" project_module_attachments: "Resources"
label_project_mail_attachments: Project Resources label_project_mail_attachments: "Project Resources"
label_project_mail_upload: had uploaded 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_new_user: "Send email to invite new user"
label_invite_trustie_user: "Invite the Trustie registered user" label_invite_trustie_user: "Invite the Trustie registered user"

View File

@ -67,6 +67,13 @@ zh:
label_project_mail_upload: 上传了资源 label_project_mail_upload: 上传了资源
label_invite: 邀请 label_invite: 邀请
# 项目消息通知
label_forge_message: 消息
label_issue_message: 问题
label_course_message: 课程消息
label_project_message: 项目消息
label_issue_tracking: 问题跟踪 label_issue_tracking: 问题跟踪
label_release_issue: 发布问题 label_release_issue: 发布问题
@ -363,7 +370,6 @@ zh:
# #
label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。' label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。'
field_name: 名称 field_name: 名称
field_description: 描述
field_identifier: 标识 field_identifier: 标识
field_enterprise_name: 组织名称 field_enterprise_name: 组织名称
label_organization_choose: --请选择组织-- label_organization_choose: --请选择组织--

View File

@ -552,6 +552,7 @@ zh:
label_registered_on: 注册于 label_registered_on: 注册于
label_overall_activity: 活动概览 label_overall_activity: 活动概览
label_new: 新建 label_new: 新建
label_latest_login_user_list: 最近登录用户列表
label_logged_as: 登录为 label_logged_as: 登录为
label_environment: 环境 label_environment: 环境
@ -690,7 +691,7 @@ zh:
label_sort_lowest: 置底 label_sort_lowest: 置底
label_roadmap_due_in: "截止日期到 %{value}" label_roadmap_due_in: "截止日期到 %{value}"
label_roadmap_overdue: "%{value} 延期" label_roadmap_overdue: "%{value} 延期"
label_roadmap_no_issues: 该版本还没有对应的缺陷,可以在“发布问题”的“目标版本”中设置 label_roadmap_no_issues: 该版本还没有对应的缺陷,可以在“发布问题”的“目标版本”中指定版本
label_user_search_type: 搜索类型 label_user_search_type: 搜索类型
label_search_by_login: 登录名 label_search_by_login: 登录名
label_search_by_name: 名字 label_search_by_name: 名字
@ -1252,6 +1253,7 @@ zh:
label_leave_message_to: 给用户 %{name}留言 label_leave_message_to: 给用户 %{name}留言
label_leave_message: 留言内容 label_leave_message: 留言内容
label_message: 留言板 label_message: 留言板
label_leave_message_list: 留言列表
field_add: 添加于 %{time} 之前 field_add: 添加于 %{time} 之前
label_student_response: 作业答疑 # modified by bai label_student_response: 作业答疑 # modified by bai
@ -1748,6 +1750,7 @@ zh:
cancel_apply: 取消申请 cancel_apply: 取消申请
apply_master: 申请成为版主 apply_master: 申请成为版主
you_are_master: 您是该项目的版主 you_are_master: 您是该项目的版主
label_notification_list: 通知
#add by linchun (竞赛相关) #add by linchun (竞赛相关)
label_upload_softwarepackage: 上传软件包 label_upload_softwarepackage: 上传软件包

View File

@ -322,6 +322,7 @@ RedmineApp::Application.routes.draw do
match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
match 'watch_projects', :to => 'users#watch_projects', :via => :get match 'watch_projects', :to => 'users#watch_projects', :via => :get
# added by bai # added by bai
match 'show_score', :to => 'users#show_score', :via => :get match 'show_score', :to => 'users#show_score', :via => :get
match 'topic_score_index', :to => 'users#topic_score_index', :via => [:get, :post] match 'topic_score_index', :to => 'users#topic_score_index', :via => [:get, :post]
@ -359,6 +360,7 @@ RedmineApp::Application.routes.draw do
end end
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback" 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_projects', :to => 'users#user_projects', :via => :get
match 'users/:id/user_messages', :to => 'users#user_messages', :via => :get
@ -691,6 +693,13 @@ RedmineApp::Application.routes.draw do
match 'admin/default_configuration', :via => :post match 'admin/default_configuration', :via => :post
get 'admin/organization' get 'admin/organization'
get 'admin/schools' 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 resources :auth_sources do
member do member do

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -11,14 +11,15 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150801034945) do ActiveRecord::Schema.define(:version => 20150815030833) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
t.string "act_type", :null => false t.string "act_type", :null => false
t.integer "user_id", :null => false t.integer "user_id", :null => false
t.integer "activity_container_id" t.integer "activity_container_id"
t.string "activity_container_type", :default => "" t.string "activity_container_type", :default => ""
t.datetime "created_at"
end end
add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type" add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type"
@ -324,6 +325,15 @@ ActiveRecord::Schema.define(:version => 20150801034945) do
t.datetime "updated_on", :null => false t.datetime "updated_on", :null => false
end 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| create_table "course_attachments", :force => true do |t|
t.string "filename" t.string "filename"
t.string "disk_filename" t.string "disk_filename"
@ -356,6 +366,16 @@ ActiveRecord::Schema.define(:version => 20150801034945) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end 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| create_table "course_statuses", :force => true do |t|
t.integer "changesets_count" t.integer "changesets_count"
t.integer "watchers_count" t.integer "watchers_count"
@ -454,13 +474,6 @@ ActiveRecord::Schema.define(:version => 20150801034945) do
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "discuss_demos", :force => true do |t|
t.string "title"
t.text "body"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "documents", :force => true do |t| create_table "documents", :force => true do |t|
t.integer "project_id", :default => 0, :null => false t.integer "project_id", :default => 0, :null => false
t.integer "category_id", :default => 0, :null => false t.integer "category_id", :default => 0, :null => false
@ -542,6 +555,16 @@ ActiveRecord::Schema.define(:version => 20150801034945) do
add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id" 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| create_table "forums", :force => true do |t|
t.string "name", :null => false t.string "name", :null => false
t.text "description" t.text "description"
@ -873,6 +896,7 @@ ActiveRecord::Schema.define(:version => 20150801034945) do
t.datetime "created_on" t.datetime "created_on"
t.integer "comments_count", :default => 0, :null => false t.integer "comments_count", :default => 0, :null => false
t.integer "course_id" t.integer "course_id"
t.datetime "updated_on"
end end
add_index "news", ["author_id"], :name => "index_news_on_author_id" add_index "news", ["author_id"], :name => "index_news_on_author_id"
@ -1277,6 +1301,7 @@ ActiveRecord::Schema.define(:version => 20150801034945) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "late_penalty", :default => 0 t.integer "late_penalty", :default => 0
t.integer "absence_penalty", :default => 0 t.integer "absence_penalty", :default => 0
t.integer "system_score"
end end
create_table "student_works_evaluation_distributions", :force => true do |t| create_table "student_works_evaluation_distributions", :force => true do |t|

View File

@ -386,6 +386,11 @@ Redmine::MenuManager.map :admin_menu do |menu|
:html => {:class => 'server_authentication'} :html => {:class => 'server_authentication'}
menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true menu.push :plugins, {:controller => 'admin', :action => 'plugins'}, :last => true
menu.push :info, {:controller => 'admin', :action => 'info'}, :caption => :label_information_plural, :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 end
#Modified by young #Modified by young

BIN
public/images/nav_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -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() function regex_evaluation_num()
{ {

View File

@ -46,6 +46,54 @@ $(document).ready(function () {
addCourseSlipMenu(); 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 () { $(document).ready(function () {
$("#RSide").css("min-height",$("#LSide").height()-30); $("#RSide").css("min-height",$("#LSide").height()-30);

View File

@ -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;} .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.problem_name{ color:#ff5722;max-width:60px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
a:hover.problem_name{ color:#d33503;} 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.pro_mes_w{ height:20px; float:right;display:block; color:#999999;}
a:hover.problem_tit{ color:#09658c; } a:hover.problem_tit{ color:#09658c; }
.problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;} .problem_main{ border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;}
@ -226,7 +226,7 @@ a:hover.ping_sub{ background:#14a8b9;}
.w430{ width:470px;} .w430{ width:470px;}
.w557{ width:557px;} .w557{ width:557px;}
.w350{ width:350px;} .w350{ width:350px;}
.h350{height: 350px !important;} .h400{height: 400px !important;}
.w620{ width:480px; height:160px; border:1px solid #CCC;} .w620{ width:480px; height:160px; border:1px solid #CCC;}
.bo{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:470px; } .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; } .bo02{height:26px; border:1px solid #CCC; padding-left:5px; background:#fff;width:480px; margin-left:2px; color: #999; }

View File

@ -130,7 +130,7 @@ a:hover.btn_de{ background:#ff5d31;}
a.btn_pu{ border:1px solid #3cb761; color:#3cb761; } a.btn_pu{ border:1px solid #3cb761; color:#3cb761; }
a:hover.btn_pu{ background:#3cb761;} a:hover.btn_pu{ background:#3cb761;}
.pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:19px; padding-top:3px; } .pollsbtn_grey{ border:1px solid #b1b1b1; color:#b1b1b1; padding:0px 9px; height:19px; padding-top:3px; }
.polls_title_w { width:280px; 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_title_st { max-width:530px; overflow: hidden;white-space: nowrap;text-overflow: ellipsis;}
.polls_de_grey{ color:#b1b1b1; margin-top:3px;} .polls_de_grey{ color:#b1b1b1; margin-top:3px;}
.ml5{ margin-left:5px;} .ml5{ margin-left:5px;}

View File

@ -6,8 +6,8 @@ div,img,tr,td,table{ border:0;}
table,tr,td{border:0;cellspacing:0; cellpadding:0;} table,tr,td{border:0;cellspacing:0; cellpadding:0;}
ol,ul,li{ list-style-type:none} ol,ul,li{ list-style-type:none}
a:link,a:visited{color:#7f7f7f;text-decoration:none;} a:link,a:visited{color:#7f7f7f;text-decoration:none;}
a:hover,a:active{color:#000;} a:hover,a:active{color:#15bccf;}
img{max-width: 100%;} /*img{max-width: 100%;}*/
/*常用*/ /*常用*/
select,input,textarea{ border:1px solid #64bdd9; background:#fff; color:#000; padding-left:5px; } select,input,textarea{ border:1px solid #64bdd9; background:#fff; color:#000; padding-left:5px; }
@ -581,3 +581,207 @@ input.sendSourceText {font-size:14px;color:#ffffff;background-color:#64bdd9;}
.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;} .resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;}
/*主类容左右分栏*/
#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}

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe CourseMessage, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ForgeMessage, :type => :model do
pending "add some examples to (or delete) #{__FILE__}"
end