diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 40a9fab63..60f12fb38 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -36,6 +36,11 @@ class AccountController < ApplicationController end end + # 服务协议 + def agreement + render :layout => 'static_base' + end + # Log out current user and redirect to welcome page def logout if User.current.anonymous? diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 6ff4d2f97..72301754d 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -67,7 +67,29 @@ class BoardsController < ApplicationController end - def show + def show + #¶Ӧforge_messagesviewedֶ + if @project + query_forge_messages = @board.messages + query_forge_messages.each do |query_forge_message| + query = query_forge_message.forge_messages + query.each do |forge_message| + if User.current.id == forge_message.user_id + forge_message.update_attributes(:viewed => true) + end + end + end + elsif @course + query_course_messages = @board.messages + query_course_messages.each do |query_course_message| + query = query_course_message.course_messages + query.each do |course_message| + if User.current.id == course_message.user_id + course_message.update_attributes(:viewed => true) + end + end + end + end respond_to do |format| format.js format.html { diff --git a/app/controllers/memos_controller.rb b/app/controllers/memos_controller.rb index 68f6f6473..11d1d6e18 100644 --- a/app/controllers/memos_controller.rb +++ b/app/controllers/memos_controller.rb @@ -115,6 +115,8 @@ class MemosController < ApplicationController REPLIES_PER_PAGE = 20 unless const_defined?(:REPLIES_PER_PAGE) def show + #更新贴吧帖子留言对应的memo_messages的viewed字段 + query_memo_messages = @memo.memo_messages pre_count = REPLIES_PER_PAGE @memo = @memo.root # 取出楼主,防止输入帖子id让回复作为主贴显示 diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb index 1a8e75b54..d445fc77c 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -99,6 +99,31 @@ class NewsController < ApplicationController end def show + #更新news对应的forge_messages的viewed字段 + query_forge_news = @news.forge_messages + query_forge_news.each do |query| + if User.current.id == query.user_id + query.update_attributes(:viewed => true) + end + end + #更新news对应的course_messages的viewed字段 + query_course_news = @news.course_messages + query_course_news.each do |query| + if User.current.id == query.user_id + query.update_attributes(:viewed => true) + end + end + #更新项目新闻的评阅的viewed字段 + current_forge_comments = @news.comments + current_forge_comments.each do |current_forge_comment| + query_forge_comment = current_forge_comment.forge_messages + query_forge_comment.each do |query| + if User.current.id == query.user_id + query.update_attributes(:viewed => true) + end + end + end + cs = CoursesService.new result = cs.show_course_news params,User.current @news = result[:news] diff --git a/app/controllers/poll_controller.rb b/app/controllers/poll_controller.rb index edf8c2259..1bbcf9bb4 100644 --- a/app/controllers/poll_controller.rb +++ b/app/controllers/poll_controller.rb @@ -28,6 +28,12 @@ class PollController < ApplicationController render_403 return end + query_course_poll = @poll.course_messages + query_course_poll.each do |query| + if User.current.id == query.user_id + query.update_attributes(:viewed => true) + end + end #已提交问卷的用户不能再访问该界面 if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?) redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 01f858442..1af832b79 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -11,6 +11,13 @@ class StudentWorkController < ApplicationController protect_from_forgery :except => :set_program_score def index + #设置作业对应的forge_messages表的viewed字段 + query_student_work = @homework.course_messages + query_student_work.each do |query| + if User.current.id == query.user_id + query.update_attributes(:viewed => true) + end + end @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group] @is_teacher = User.current.allowed_to?(:as_teacher,@course) course_group = CourseGroup.find_by_id(@group) if @group diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index f5a5c75f2..e8d512a2e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -45,7 +45,7 @@ class UsersController < ApplicationController :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index, :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist, :user_resource,:user_resource_create,:user_resource_delete,:rename_resource,:search_user_course,:add_exist_file_to_course, - :search_user_project,:resource_preview,:resource_search,:add_exist_file_to_project,:user_messages,:edit_brief_introduction] + :search_user_project,:resource_preview,:resource_search,:add_exist_file_to_project,:user_messages, :edit_brief_introduction] #edit has been deleted by huang, 2013-9-23 before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, @@ -123,56 +123,75 @@ class UsersController < ApplicationController @new_message_count = @user.forge_messages.count + @user.memo_messages.count + @user.course_messages.count + @user.user_feedback_messages.count case params[:type] when nil - @user_course_messages = CourseMessage.where("user_id =?",@user).order("created_at desc") - @user_forge_messages = ForgeMessage.where("user_id =?",@user).order("created_at desc") - @user_memo_messages = MemoMessage.where("user_id =?",@user).order("created_at desc") - @user_feedback_messages = UserFeedbackMessage.where("user_id =?",@user).order("created_at desc") - @user_course_messages_count = @user_course_messages.count - @user_forge_messages_count = @user_forge_messages.count - @user_memo_messages_count = @user_memo_messages.count - @user_feedback_messages_count = @user_feedback_messages.count + @message_alls = [] + messages = MessageAll.where("user_id =?",@user).order("created_at desc") + messages.each do |message_all| + @message_alls << message_all.message + end + + # @user_course_messages = MessageAll.where("user_id =? and message_type=?",@user,"CourseMessage").order("created_at desc") + # @user_forge_messages = MessageAll.where("user_id =? and message_type=?",@user,"ForgeMessage").order("created_at desc") + # @user_memo_messages = MessageAll.where("user_id =? and message_type=?",@user,"MemoMessage").order("created_at desc") + # @user_feedback_messages = MessageAll.where("user_id =? and message_type=?",@user,"UserFeedbackMessage").order("created_at desc") + # @user_course_messages_count = @user_course_messages.count + # @user_forge_messages_count = @user_forge_messages.count + # @user_memo_messages_count = @user_memo_messages.count + # @user_feedback_messages_count = @user_feedback_messages.count when 'homework' - @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc") - @user_course_messages_count = @user_course_messages.count + @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc") + @message_alls_count = @message_alls.count + #@user_course_messages_count = @user_course_messages.count when 'course_message' - @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc") - @user_course_messages_count = @user_course_messages.count + @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc") + @message_alls_count = @message_alls.count + #@user_course_messages_count = @user_course_messages.count when 'forge_message' - @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc") - @user_forge_messages_count = @user_forge_messages.count + @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc") + @message_alls_count = @message_alls.count + #@user_forge_messages_count = @user_forge_messages.count when 'course_news' - @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc") - @user_course_messages_count = @user_course_messages.count + @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "News", @user).order("created_at desc") + @message_alls_count = @message_alls.count + #@user_course_messages_count = @user_course_messages.count when 'forge_news' - @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc") - @user_forge_messages_count = @user_forge_messages.count + @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "News", @user).order("created_at desc") + @message_alls_count = @message_alls.count + #@user_forge_messages_count = @user_forge_messages.count when 'course_news_reply' - @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc") - @user_course_messages_count = @user_course_messages.count + @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc") + #@user_course_messages_count = @user_course_messages.count when 'forge_news_reply' - @user_forge_messages = ForgeMessage.where("course_message_type =? and user_id =?", "Comment", @user).order("created_at desc") - @user_forge_messagess_count = @user_forge_messages.count + @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Comment", @user).order("created_at desc") + @message_alls_count = @message_alls.count + #@user_forge_messagess_count = @user_forge_messages.count when 'poll' - @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") - @user_course_messages_count = @user_course_messages.count + @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc") + @message_alls_count = @message_alls.count + #@user_course_messages_count = @user_course_messages.count when 'works_reviewers' - @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc") - @user_course_messages_count = @user_course_messages.count + @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "StudentWorksScore", @user).order("created_at desc") + @message_alls_count = @message_alls.count + #@user_course_messages_count = @user_course_messages.count when 'works_reply' - @user_course_messages = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") - @user_course_messages_count = @user_course_messages.count + @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") + @message_alls_count = @message_alls.count + #@user_course_messages_count = @user_course_messages.count when 'issue' - @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc") - @user_forge_messages_count = @user_forge_messages.count + @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Issue", @user).order("created_at desc") + @message_alls_count = @message_alls.count + #@user_forge_messages_count = @user_forge_messages.count when 'issue_update' # 缺陷状态更新、留言 - @user_forge_messages = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc") - @user_forge_messages_count = @user_forge_messages.count + @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Journal", @user).order("created_at desc") + @message_alls_count = @message_alls.count + #@user_forge_messages_count = @user_forge_messages.count when 'forum' - @user_memo_messages = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc") - @user_memo_messages_count = @user_memo_messages.count + @message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc") + @message_alls_count = @message_alls.count + #@user_memo_messages_count = @user_memo_messages.count when 'user_feedback' - @user_feedback_messages = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "Principal", @user).order("created_at desc") - @user_feedback_messages_count = @user_feedback_messages.count + @message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc") + @message_alls_count = @message_alls.count + #@user_feedback_messages_count = @user_feedback_messages.count else render_404 return @@ -311,7 +330,7 @@ class UsersController < ApplicationController respond_to do |format| format.js format.html {render :layout => 'new_base_user'} - end + end end @@ -346,7 +365,7 @@ class UsersController < ApplicationController end @jour = paginateHelper jours,10 @state = false - render :layout=>'base_users_new' + render :layout=>'new_base_user' end def user_comments @@ -469,13 +488,13 @@ class UsersController < ApplicationController def user_courses4show @page = params[:page].to_i + 1 @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").limit(5).offset(@page * 5) - end + end #显示更多用户项目 def user_projects4show @page = params[:page].to_i + 1 @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").limit(5).offset(@page * 5) - end + end def user_course_activities lastid = nil @@ -574,7 +593,7 @@ class UsersController < ApplicationController @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10) else @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10) - end + end else @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10) end diff --git a/app/models/course_message.rb b/app/models/course_message.rb index 59089829d..95ce3a56b 100644 --- a/app/models/course_message.rb +++ b/app/models/course_message.rb @@ -1,12 +1,19 @@ class CourseMessage < ActiveRecord::Base - attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed + attr_accessible :course_id, :course_message_id, :course_message_type, :user_id, :viewed, :content, :status # 多态 虚拟关联 belongs_to :course_message ,:polymorphic => true belongs_to :course belongs_to :user + has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy + validates :user_id,presence: true validates :course_id,presence: true validates :course_message_id,presence: true validates :course_message_type, presence: true + after_create :add_user_message + + def add_user_message + self.message_alls << MessageAll.new(:user_id => self.user_id) + end end diff --git a/app/models/forge_message.rb b/app/models/forge_message.rb index 1543fab58..2d05972ab 100644 --- a/app/models/forge_message.rb +++ b/app/models/forge_message.rb @@ -13,8 +13,15 @@ class ForgeMessage < ActiveRecord::Base belongs_to :forge_message ,:polymorphic => true belongs_to :project belongs_to :user + has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy + validates :user_id,presence: true validates :project_id,presence: true validates :forge_message_id,presence: true validates :forge_message_type, presence: true + after_create :add_user_message + + def add_user_message + self.message_alls << MessageAll.new(:user_id => self.user_id) + end end diff --git a/app/models/issue.rb b/app/models/issue.rb index 1724e3484..fa8cee988 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -83,7 +83,7 @@ class Issue < ActiveRecord::Base # fq after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message - after_update :be_user_score, :act_as_forge_message_update + after_update :be_user_score after_destroy :down_user_score # after_create :be_user_score # end @@ -145,20 +145,16 @@ class Issue < ActiveRecord::Base 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) + self.forge_messages << ForgeMessage.new(:user_id => self.assigned_to_id, :project_id => self.project_id, :viewed => false) end end # 更新缺陷 - def act_as_forge_message_update - 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 + #def act_as_forge_message_update + # 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 diff --git a/app/models/journal.rb b/app/models/journal.rb index a5bea92af..3a9f5a89d 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -172,9 +172,10 @@ class Journal < ActiveRecord::Base # 缺陷状态更改,消息提醒 def act_as_forge_message if self.user_id != self.issue.author_id - self.forge_messages << ForgeMessage.new(:user_id => self.issue.author_id, - :project_id => self.issue.project_id, - :viewed => false) + self.forge_messages << ForgeMessage.new(:user_id => self.issue.author_id, :project_id => self.issue.project_id, :viewed => false) + end + if self.user_id != self.issue.assigned_to_id # 指派人不是自己的话,则给指派人发送 + self.forge_messages << ForgeMessage.new(:user_id => self.issue.assigned_to_id, :project_id => self.issue.project_id, :viewed => false) end end diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 2c56dc035..1f5f2e1a6 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -209,14 +209,20 @@ class JournalsForMessage < ActiveRecord::Base end else # 留言回复 reply_to = User.find(self.reply_id) - if self.user_id != self.parent.user_id - receivers << reply_to - if self.reply_id != self.parent.user_id - receivers << self.parent.user - end - else + if self.user_id != self.reply_id # 添加我回复的那个人 receivers << reply_to end + if self.user_id != self.parent.jour_id # 给东家发信息 + receivers << self.parent.jour + end + # if self.user_id != self.parent.user_id + # receivers << reply_to + # if self.reply_id != self.parent.user_id + # receivers << self.parent.user + # end + # else + # receivers << reply_to + # end # 添加留言回复人 #reply_to = User.find(self.reply_id) diff --git a/app/models/memo.rb b/app/models/memo.rb index f1f9029c1..c30616558 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -79,7 +79,7 @@ class Memo < ActiveRecord::Base receivers << self.forum.creator end # 添加发帖人 - if self.forum.creator_id != self.parent.author_id + if self.author_id != self.parent.author_id receivers << self.parent.author end end diff --git a/app/models/memo_message.rb b/app/models/memo_message.rb index 051fac317..9be00ce14 100644 --- a/app/models/memo_message.rb +++ b/app/models/memo_message.rb @@ -3,9 +3,15 @@ class MemoMessage < ActiveRecord::Base belongs_to :memo belongs_to :user + has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy validates :user_id,presence: true validates :forum_id,presence: true validates :memo_id,presence: true validates :memo_type, presence: true + after_create :add_user_message + + def add_user_message + self.message_alls << MessageAll.new(:user_id => self.user_id) + end end diff --git a/app/models/message_all.rb b/app/models/message_all.rb new file mode 100644 index 000000000..6e0276875 --- /dev/null +++ b/app/models/message_all.rb @@ -0,0 +1,5 @@ +class MessageAll < ActiveRecord::Base + attr_accessible :message_id, :message_type, :user_id + # 虚拟关联---项目消息表/课程消息表/用户留言消息表/贴吧消息表 + belongs_to :message ,:polymorphic => true +end diff --git a/app/models/student_works_score.rb b/app/models/student_works_score.rb index 639722389..aa38c5dcd 100644 --- a/app/models/student_works_score.rb +++ b/app/models/student_works_score.rb @@ -1,3 +1,4 @@ +#encoding=UTF-8 class StudentWorksScore < ActiveRecord::Base #reviewer_role: 1:教师评分;2:教辅评分;3:学生匿评 attr_accessible :student_work_id, :user_id, :score, :comment, :reviewer_role @@ -9,13 +10,31 @@ class StudentWorksScore < ActiveRecord::Base acts_as_attachable - after_create :act_as_course_message + after_save :act_as_course_message # 评阅作品消息提示 def act_as_course_message - if self.student_work + if self.student_work && self.student_work.user && self.student_work.homework_common.course receiver = self.student_work.user - self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, :viewed => false) + # 判断是第一次评阅还是更新 status:0 新建;1 更新 + if self.created_at == self.updated_at + if self.comment.nil? + self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, + :viewed => false, :content => "作业评分:#{self.score}", :status=> false) + else + self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, + :viewed => false, :content => "作业评分:#{self.score}    评语:#{self.comment}", :status=> false) + end + else # 更新 + if self.comment.nil? + self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, + :viewed => false, :content => "作业评分:#{self.score}", :status=> true) + else + self.course_messages << CourseMessage.new(:user_id => receiver.id, :course_id => self.student_work.homework_common.course.id, + :viewed => false, :content => "作业评分:#{self.score}    评语:#{self.comment}", :status=> true) + end + end end end + end diff --git a/app/models/user_feedback_message.rb b/app/models/user_feedback_message.rb index 98b53e973..1dda157d6 100644 --- a/app/models/user_feedback_message.rb +++ b/app/models/user_feedback_message.rb @@ -3,8 +3,14 @@ class UserFeedbackMessage < ActiveRecord::Base belongs_to :journals_for_message belongs_to :user + has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy validates :user_id,presence: true validates :journals_for_message_id,presence: true validates :journals_for_message_type, presence: true + after_create :add_user_message + + def add_user_message + self.message_alls << MessageAll.new(:user_id => self.user_id) + end end diff --git a/app/views/account/agreement.html.erb b/app/views/account/agreement.html.erb new file mode 100644 index 000000000..f18731348 --- /dev/null +++ b/app/views/account/agreement.html.erb @@ -0,0 +1,51 @@ +<%= stylesheet_link_tag 'new_user'%> +
+
+

Trustie服务协议

+
+

尊敬的用户,您好!
+欢迎使用Trustie平台,在您使用Trustie平台前,请您认真阅读并遵守《Trustie服务协议》(以下简称"本协议"),请您务必审慎阅读、充分理解协议的各条款内容。
+当您在注册过程中点击查看"看过并同意本服务协议",按照注册流程成功注册为Trustie平台的用户即表示您已充分阅读、理解并完全接受本协议中的全部条款。您承诺接受并遵守本协议的约定,届时您不应以未阅读本协议的内容等理由,主张本协议无效或本协议中的某些条款无效,或要求撤销本协议。

+

一、Trustie平台权利和义务

+

1、尊重用户隐私:尊重用户隐私,保障用户隐私安全是Trustie平台的一项基本政策;
+2、管理平台用户:Trustie平台依据国家法律、地方法律和国际法律等的标准以及本行业的规则来管理平台注册用户;
+3、处理用户反馈:Trustie平台的相关人员会及时处理用户反馈的问题并给予及时回复。

+

二、用户权利和义务

+

用户在使用Trustie平台的过程中,必须遵守如下原则:
+1、遵守中国的有关法律和法规;
+2、使用网络服务不作非法用途;
+3、不干扰和混乱网络服务;
+4、遵守所有使用网络服务的网络协议、规定、程序和惯例;
+5、不传输任何非法的、骚扰性的、中伤他人的、辱骂性的、恐吓性的、伤害性的、庸俗的,淫秽等信息资料;
+6、不传输任何教唆他人构成犯罪行为的资料;
+7、用户不得故意或者过失损害Trustie平台合法权利和利益。及时回复。

+

三、关于责任

+

鉴于网络服务的特殊性,用户同意Trustie团队有权在事先通知的情况下,变更、中断、升级部分网络服务。Trustie团队不担保网络服务不会中断,但承诺在用户可承受的时间内快速恢复服务,同时确保用户数据的安全性和可靠性。

+

四、服务条款的修改

+

Trustie团队保留在必要时对本协议修改的权利,一旦发生变动,这些条款可由Trustie团队及时更新,且毋须另行通知,修改后的条款一旦在网页上公布即有效代替原来的服务条款。您可随时查阅最新版服务条款。

+

本协议最终解释权归Trustie团队所有。

+
+ + +
+
+ + diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index 85db7f695..68fb4b9ba 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -246,7 +246,7 @@
- 我已阅读并接受Trustie服务协议条款 + 我已阅读并接受Trustie服务协议条款
注册 diff --git a/app/views/account/lost_password.html.erb b/app/views/account/lost_password.html.erb index 3c6c57f52..46d3b2d7b 100644 --- a/app/views/account/lost_password.html.erb +++ b/app/views/account/lost_password.html.erb @@ -1,16 +1,36 @@ -<% @nav_dispaly_home_path_label = 1 - @nav_dispaly_main_course_label = 1 - @nav_dispaly_main_project_label = 1 - @nav_dispaly_main_contest_label = 1 %> -<% @nav_dispaly_forum_label = 1%> -

<%=l(:label_password_forget)%>

+<%= stylesheet_link_tag 'new_user'%> -<%= form_tag(lost_password_path) do %> -
-

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

-
-<% end %> +
+
+

忘记密码

+
+

通过注册邮箱链接重设密码

+ + + +
+ + +
+
+ + + diff --git a/app/views/layouts/_base_header_new.html.erb b/app/views/layouts/_base_header_new.html.erb index c224ee0ab..163f3a3ff 100644 --- a/app/views/layouts/_base_header_new.html.erb +++ b/app/views/layouts/_base_header_new.html.erb @@ -56,9 +56,9 @@ diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 2c987cbdd..5ba49cd5d 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -76,11 +76,10 @@
diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb index 315960a4c..febf08799 100644 --- a/app/views/layouts/new_base_user.html.erb +++ b/app/views/layouts/new_base_user.html.erb @@ -114,7 +114,8 @@
- 留言 + + <%= link_to '留言',feedback_path(@user),:class=>'homepageMenuText'%>
diff --git a/app/views/layouts/static_base.html.erb b/app/views/layouts/static_base.html.erb new file mode 100644 index 000000000..b81b0755d --- /dev/null +++ b/app/views/layouts/static_base.html.erb @@ -0,0 +1,41 @@ + + + + + <%=h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %> + <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> + <%= javascript_heads %> + <%= javascript_include_tag "jquery.leanModal.min" %> + <%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%> + <%= heads_for_theme %> + <%= call_hook :view_layouts_base_html_head %> + + <%= yield :header_tags -%> + <%= stylesheet_link_tag 'base','header', :media => 'all'%> + + +
+ +
+
+ <%= yield %> +
+
+
+<%= render :partial => 'layouts/footer' %> +
+ +<%= call_hook :view_layouts_base_body_bottom %> + + diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index 52cb8e0d8..97a159884 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -1,254 +1,260 @@ -
-
-
-
消息
-
+
+
+ <% if @new_message_count >0 %> + <%# 课程消息 %> + <% unless @message_alls.nil? %> + <% @message_alls.each do |ma| %> + <% if ma.class == CourseMessage %> + <% if ma.course_message_type == "News" %> + + <% end %> + <% if ma.course_message_type == "Comment" %> + + <% end %> + <% if ma.course_message_type == "HomeworkCommon" %> + + <% end %> + <% if ma.course_message_type == "Poll" %> + + <% end %> + <% if ma.course_message_type == "Message" %> + + <% end %> + <% if ma.course_message_type == "StudentWorksScore" %> + + <% end %> + <% if ma.course_message_type == "JournalsForMessage" %> + + <% end %> + <% end %> + + <% if ma.class == ForgeMessage %> + <% if ma.forge_message_type == "Issue" %> + + <% end %> + <% if ma.forge_message_type == "Journal" %> + + <% end %> + <% if ma.forge_message_type == "Message" %> + + <% end %> + <% if ma.forge_message_type == "News" %> + + <% end %> + <% if ma.forge_message_type == "Comment" %> + + <% end %> + <% end %> + + <% if ma.class == MemoMessage %> + <% if ma.memo_type == "Memo" %> + + <% end %> + <% end %> + + <% if ma.class == UserFeedbackMessage %> + <% if ma.journals_for_message_type == "JournalsForMessage" %> + + <% end %> + <% end %> <% end %> <% end %> + + <% else %> +
您目前还没有相关消息!
<% end %> - <%# 公共贴吧 %> - <% unless @user_memo_messages.nil? %> - <% @user_memo_messages.each do |urm| %> - <% if urm.memo_type == "Memo" %> - - <% end %> - <% end %> - <% end %> - <%# 用户留言消息 %> - <% unless @user_feedback_messages.nil? %> - <% @user_feedback_messages.each do |ufm| %> - <% if ufm.journals_for_message_type == "JournalsForMessage" %> - - <% end %> - <% end %> - <% end %> -<% else %> -
暂无消息!
-<% end %> -
-
+
+
+ + + + + + + + + + + + - diff --git a/app/views/users/user_newfeedback.html.erb b/app/views/users/user_newfeedback.html.erb index a8107ce5f..13b4524ba 100644 --- a/app/views/users/user_newfeedback.html.erb +++ b/app/views/users/user_newfeedback.html.erb @@ -1,16 +1,33 @@ -
- - <% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %> - 新建课程 - <% end %> -
-
+ + + + + + + + <%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"user" %> -
+ +
+
+
留言
+
<%= form_for('new_form',:url => leave_user_message_path(@user.id),:method => "post") do |f|%> diff --git a/config/routes.rb b/config/routes.rb index 2c75f9862..6679151e3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -262,6 +262,7 @@ RedmineApp::Application.routes.draw do match 'account/heartbeat', to: 'account#heartbeat', :via => :get match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post] match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post] + match 'agreement',:to => 'account#agreement',:as => 'agreement',:via=>[:get] match 'account/register', :via => [:get, :post], :as => 'register' match 'account/lost_password', :via => [:get, :post], :as => 'lost_password' match 'account/activate', :via => :get @@ -364,7 +365,9 @@ RedmineApp::Application.routes.draw do end match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback" match 'users/:id/user_projects', :to => 'users#user_projects', :via => :get - match 'users/:id/user_messages', :to => 'users#user_messages', :via => :get + #消息 + match 'users/:id/user_messages', :to => 'users#user_messages', :via => :get, :as => "user_message" + #match 'users/:id/user_messages/:homework', :to => 'users#user_messages_homework', :via => :get, :as => "user_message_homewrok" diff --git a/db/migrate/20150824133916_create_message_alls.rb b/db/migrate/20150824133916_create_message_alls.rb new file mode 100644 index 000000000..aa4a986a8 --- /dev/null +++ b/db/migrate/20150824133916_create_message_alls.rb @@ -0,0 +1,11 @@ +class CreateMessageAlls < ActiveRecord::Migration + def change + create_table :message_alls do |t| + t.integer :user_id + t.integer :message_id + t.string :message_type + + t.timestamps + end + end +end diff --git a/db/migrate/20150826020407_add_content_to_course_message.rb b/db/migrate/20150826020407_add_content_to_course_message.rb new file mode 100644 index 000000000..4aad9ab6a --- /dev/null +++ b/db/migrate/20150826020407_add_content_to_course_message.rb @@ -0,0 +1,5 @@ +class AddContentToCourseMessage < ActiveRecord::Migration + def change + add_column :course_messages, :content, :string + end +end diff --git a/db/migrate/20150826061843_add_status_to_course_message.rb b/db/migrate/20150826061843_add_status_to_course_message.rb new file mode 100644 index 000000000..4e8e04ce6 --- /dev/null +++ b/db/migrate/20150826061843_add_status_to_course_message.rb @@ -0,0 +1,5 @@ +class AddStatusToCourseMessage < ActiveRecord::Migration + def change + add_column :course_messages, :status, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index 4639c07ec..a77eceb9a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150820025358) do +ActiveRecord::Schema.define(:version => 20150826061843) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -374,6 +374,8 @@ ActiveRecord::Schema.define(:version => 20150820025358) do t.integer "viewed" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.string "content" + t.integer "status" end create_table "course_statuses", :force => true do |t| @@ -867,6 +869,14 @@ ActiveRecord::Schema.define(:version => 20150820025358) do t.integer "viewed_count", :default => 0 end + create_table "message_alls", :force => true do |t| + t.integer "user_id" + t.integer "message_id" + t.string "message_type" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "messages", :force => true do |t| t.integer "board_id", :null => false t.integer "parent_id" @@ -1301,7 +1311,6 @@ ActiveRecord::Schema.define(:version => 20150820025358) do t.datetime "updated_at", :null => false t.integer "late_penalty", :default => 0 t.integer "absence_penalty", :default => 0 - t.integer "system_score" end create_table "student_works_evaluation_distributions", :force => true do |t| @@ -1519,6 +1528,7 @@ ActiveRecord::Schema.define(:version => 20150820025358) do t.string "identity_url" t.string "mail_notification", :default => "", :null => false t.string "salt", :limit => 64 + t.integer "gid" end add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id" diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index df47c9e77..3dea90fba 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -512,7 +512,7 @@ a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;} .homepageNewsPortrait {width:40px; display:block; margin-top:7px;} .homepageNewsPublisher {width:80px; max-width:80px; margin-right:10px; font-size:12px; color:#15bccf; display:block; padding-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } .homepageNewsType {width:95px; font-size:12px; color:#888888; display:block;} -.homepageNewsContent {width:395px; max-width:395px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } +.homepageNewsContent {width:395px; max-width:395px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;height:49px; max-height:49px; } .homepageNewsTime {width:75px; font-size:12px; color:#888888; display:block; text-align:right;} a.homepageWhite {color:#ffffff;} a.homepageWhite:hover {color:#a1ebff} @@ -629,6 +629,22 @@ ul.list_watch{ border-bottom: 1px dashed rgb(204, 204, 204); } +/*留言*/ +.feedBack {width:728px; background-color:#ffffff; padding:10px; border:1px solid #dddddd;float: right} + + + +/*20150826忘记密码 LB*/ +.BgBox{ width:968px; border:1px solid #dddddd; background:#fff; padding:15px; padding-top:10px;} +.BgBox_h2{ font-size:16px; color:#484848; width:968px;border-bottom:1px solid #e3e3e3; padding-bottom:5px;} +.NomalInput{width:308px; height:38px; border:1px solid #98a1a6; outline:none; color:#888888; font-size:14px;} +.BgBoxCon{ width:310px; margin:80px auto;} +.BgBoxConP{ font-size:14px; color:#484848;} +.LoginButton {width:315px; height:40px; background-color:#269ac9; font-size:14px; text-align:center; line-height:40px; vertical-align:middle;} +.LoginButton:hover {background-color:#297fb8;} +/*20150826协议 LB*/ +.AgreementBox{ margin:20px 0; color:#666666; font-size:14px; line-height:1.9;} +.Agreementh4{ color:#2980b9; font-weight:bold; font-size:14px; margin-top:30px;} /*底部*/ #Footer{background-color:#ffffff; margin-bottom:10px; padding-bottom:15px; color:#666666;} @@ -853,7 +869,9 @@ img.ui-datepicker-trigger { height:15px; float:left; } - +/*消息*/ +.homepageNewsType {width:95px; font-size:12px; color:#888888; display:block;} +.homepageNewsTypeNotRead {width:95px; font-size:12px; color:#888888; display:block;} diff --git a/spec/factories/message_alls.rb b/spec/factories/message_alls.rb new file mode 100644 index 000000000..c14c153cf --- /dev/null +++ b/spec/factories/message_alls.rb @@ -0,0 +1,8 @@ +FactoryGirl.define do + factory :message_all do + user_id 1 +message_id 1 +message_type "MyString" + end + +end diff --git a/spec/models/message_all_spec.rb b/spec/models/message_all_spec.rb new file mode 100644 index 000000000..33ac896e2 --- /dev/null +++ b/spec/models/message_all_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe MessageAll, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end