diff --git a/app/assets/javascripts/system_messages.js.coffee b/app/assets/javascripts/system_messages.js.coffee new file mode 100644 index 000000000..761567942 --- /dev/null +++ b/app/assets/javascripts/system_messages.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/system_messages.css.scss b/app/assets/stylesheets/system_messages.css.scss new file mode 100644 index 000000000..a9947d45a --- /dev/null +++ b/app/assets/stylesheets/system_messages.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the SystemMessages controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 1624008f2..5666934b6 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -79,6 +79,11 @@ class AdminController < ApplicationController end end + # 系统消息 + def messages + @admin_messages = SystemMessage.new + end + def plugins @plugins = Redmine::Plugin.all end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index db972941e..a7f1589a6 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -468,13 +468,17 @@ class CoursesController < ApplicationController end def new - @course_type = params[:course_type] ||= params[:course] - @issue_custom_fields = IssueCustomField.sorted.all - @trackers = Tracker.sorted.all - @course = Course.new - @course.safe_attributes = params[:course] - # month = Time.now.month - render :layout => 'new_base' + if User.current.login? + @course_type = params[:course_type] ||= params[:course] + @issue_custom_fields = IssueCustomField.sorted.all + @trackers = Tracker.sorted.all + @course = Course.new + @course.safe_attributes = params[:course] + # month = Time.now.month + render :layout => 'new_base' + else + redirect_to signin_url + end end def desc_sort_course_by_avtivity(activity_count, courses) diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb index d4c02860e..293346365 100644 --- a/app/controllers/homework_common_controller.rb +++ b/app/controllers/homework_common_controller.rb @@ -154,7 +154,21 @@ class HomeworkCommonController < ApplicationController #编程作业相关属性 if @homework.homework_type == 2 + @homework.homework_detail_programing ||= HomeworkDetailPrograming.new + @homework_detail_programing = @homework.homework_detail_programing + @homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6 + @homework_detail_programing.language = params[:language_type].to_i + @homework.homework_tests.delete_all + inputs = params[:program][:input] + if Array === inputs + inputs.each_with_index do |val, i| + @homework.homework_tests << HomeworkTest.new( + input: val, + output: params[:program][:output][i] + ) + end + end end if @homework.save @@ -176,11 +190,11 @@ class HomeworkCommonController < ApplicationController #开启匿评 #statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限 def start_anonymous_comment - @statue =4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course) + @statue = 4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course) @statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") if @homework_detail_manual.comment_status == 1 student_works = @homework.student_works - if student_works && student_works.size >=2 + if student_works && student_works.size >= 2 student_works.each_with_index do |work, index| user = work.user n = @homework_detail_manual.evaluation_num @@ -204,11 +218,11 @@ class HomeworkCommonController < ApplicationController #关闭匿评 def stop_anonymous_comment @homework_detail_manual.update_column('comment_status', 3) - + #计算缺评扣分---->计算缺评数量 work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")" @homework.student_works.each do |student_work| absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count - student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0 + student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count : 0 student_work.save end diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 6a0b351ba..47e425710 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -114,8 +114,10 @@ class IssuesController < ApplicationController def show # 当前用户查看指派给他的缺陷消息,则设置消息为已读 query = @issue.forge_messages - if User.current.id == @issue.assigned_to_id - query.update_all(:viewed => true) + query.each do |m| + if m.user_id == User.current.id + m.update_attribute(:viewed, true) + end end # 缺陷状态更新 query_journals = @issue.journals diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 77933666f..a58906c67 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -216,6 +216,7 @@ class ProjectsController < ApplicationController end } format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) } + format.js end else respond_to do |format| @@ -322,6 +323,12 @@ class ProjectsController < ApplicationController end def settings + # 修改查看消息状态 + applied_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =? and viewed =?", User.current.id, @project, "AppliedProject", 0) + applied_messages.each do |applied_message| + applied_message.update_attributes(:viewed => true) + end + # end @issue_custom_fields = IssueCustomField.sorted.all @issue_category ||= IssueCategory.new @member ||= @project.members.new @@ -342,7 +349,7 @@ class ProjectsController < ApplicationController if params[:repository] == "pswd_is_null" html << l(:label_password_not_null) end - flash[:error] = html if !html.to_s.blank? + flash.now[:error] = html if !html.to_s.blank? end scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first @repository = Repository.factory(scm) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 593d6bf53..474fb81bc 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -47,13 +47,23 @@ class StudentWorkController < ApplicationController end def index - # 消息状态更新 + # 作业消息状态更新 @homework.course_messages.each do |homework_message| - if User.current.id == homework_message.user_id - homework_message.update_attributes(:viewed => true) + if User.current.id == homework_message.user_id && homework_message.viewed == 0 + homework_message.update_attributes(:viewed => true) if homework_message.viewed == 0 end end - + # 作品打分消息状态更新 + studentworks_scores = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "StudentWorksScore", 0) + studentworks_scores.each do |studentworks_score| + studentworks_score.update_attributes(:viewed => true) if studentworks_score.viewed == 0 + end + # 作品评论消息状态更新 + journals_for_teacher = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "JournalsForMessage", 0) + journals_for_teacher.each do |journal_for_teacher| + journal_for_teacher.update_attributes(:viewed => true) + end + # 作品留言 # 消息end #设置作业对应的forge_messages表的viewed字段 query_student_work = @homework.course_messages @@ -170,15 +180,15 @@ class StudentWorkController < ApplicationController student_work.homework_common_id = @homework.id student_work.user_id = User.current.id student_work.save_attachments(params[:attachments]) + render_attachment_warning_if_needed(student_work) + #提交作品时,计算是否迟交 if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") - student_work.late_penalty = @homework.late_penalty - else + student_work.late_penalty = 1 + else student_work.late_penalty = 0 end - render_attachment_warning_if_needed(student_work) if student_work.save - respond_to do |format| format.html { flash[:notice] = l(:notice_successful_create) @@ -631,7 +641,7 @@ class StudentWorkController < ApplicationController unless @homework.save logger.debug @homework.errors.full_messages else - student_work = @homework.student_works.where(user_id: User.current.id).first + student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first end end student_work diff --git a/app/controllers/system_messages_controller.rb b/app/controllers/system_messages_controller.rb new file mode 100644 index 000000000..42291a407 --- /dev/null +++ b/app/controllers/system_messages_controller.rb @@ -0,0 +1,94 @@ +class SystemMessagesController < ApplicationController + # before_filter :message_author, :only => [:show] + # + # def message_author + # if(!User.current.logged? && !token.nil?) + # + # User.current =try_to_autologin1 + # end + # if @system_messages + # render_403 :message => :notice_not_authorized_message + # else + # deny_access + # end + # end + + def index + @system_messages = SystemMessage.all + end + + # def show + # @system_messages = SystemMessage.find(params[:id]) + # end + + # GET /products/new + # def new + # @product = Product.new + # end + + # GET /products/1/edit + # def edit + # end + + # POST /products + # POST /products.json + def create + unless User.current.admin? + render_403 + return + end + @system_messages = SystemMessage.new + @system_messages.content = params[:system_message][:content] + @system_messages.user_id = User.current.id + respond_to do |format| + if @system_messages.save + format.html {redirect_to user_message_path(User.current, :type => "system_messages")} + flash[:notice] = l(:notice_successful_message) + else + if params[:system_message][:content].empty? + flash[:error] = l(:label_content_blank_fail) + else + flash[:error] = l(:label_admin_message_fail) + end + format.html {redirect_to admin_messages_path} + end + end + end + + # PATCH/PUT /products/1 + # PATCH/PUT /products/1.json + # def update + # respond_to do |format| + # if @product.update(product_params) + # format.html { redirect_to @product, notice: 'Product was successfully updated.' } + # format.json { render :show, status: :ok, location: @product } + # else + # format.html { render :edit } + # format.json { render json: @product.errors, status: :unprocessable_entity } + # end + # end + # end + + # DELETE /products/1 + # DELETE /products/1.json + # def destroy + # @system_messages.destroy + # respond_to do |format| + # format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' } + # format.json { head :no_content } + # end + # end + + # private + # # Use callbacks to share common setup or constraints between actions. + # def set_product + # @product = Product.find(params[:id]) + # end + # + # # Never trust parameters from the scary internet, only allow the white list through. + # def message_params + # params.require(:admin_system_messages).permit(:content) + # end + + +end diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 253faa2b1..e0cb8af8e 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -230,6 +230,53 @@ class TagsController < ApplicationController end end + #更新某个tag名称 + def update_tag_name + @tag_name = params[:tagName] + @rename_tag_name = params[:renameName] + @taggable_id = params[:taggableId] + @taggable_type = numbers_to_object_type(params[:taggableType]) + + + @rename_tag = (ActsAsTaggableOn::Tag.find_by_name(@rename_tag_name)) #查找重命名后的tag + @tag_id = (ActsAsTaggableOn::Tag.find_by_name(@tag_name)).id #重命名前的tag_id + @taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type) + @obj = get_object(@taggable_id,params[:taggableType]) + if(@rename_tag.nil?) #这次命名的是新的tag + + # 是否还有其他记录 引用了 tag_id + @tagging = ActsAsTaggableOn::Tagging.where("tag_id = #{@tag_id}") + # 如果taggings表中记录为 1 ,那么改变@tag_id对应的tag的名字 + if @tagging.count == 1 + @tag = ActsAsTaggableOn::Tag.find_by_id(@tag_id) + @tag.update_attributes({:name=>@rename_tag_name}) + else #如果tagging表中的记录大于1,那么就要新增tag记录 + + unless @obj.nil? + @obj.tag_list.add(@rename_tag_name.split(",")) + @obj.save + end + #删除原来的对应的taggings的记录 + unless @taggings.nil? + @taggings.delete + end + end + else #这是已有的tag + # 更改taggings记录里的tag_id + unless @taggings.nil? + @taggings.update_attributes({:tag_id=>@rename_tag.id}) + end + end + @obj_flag = params[:taggableType] + if @obj && @obj_flag == '6' && @obj.container.kind_of?(Course) + @course = @obj.container + @tag_list = @tag_list = get_course_tag_list @course + end + respond_to do |format| + format.js + end + end + def tag_save @select_tag_name = params[:tag_for_save][:tag_name] @tags = params[:tag_for_save][:name] diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d332af793..4796d0c0c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -27,19 +27,13 @@ class UsersController < ApplicationController menu_item :user_course, :only => :user_courses menu_item :user_homework, :only => :user_homeworks menu_item :user_project, :only => [:user_projects, :watch_projects] - # menu_item :requirement_focus, :only => :watch_bids menu_item :requirement_focus, :only => :watch_contests menu_item :user_newfeedback, :only => :user_newfeedback menu_item :user_messages, :only => :user_messages - #Ended by young - - # edit - # before_filter :can_show_course, :only => [:user_courses,:user_homeworks] - #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, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, @@ -105,6 +99,19 @@ class UsersController < ApplicationController redirect_to signin_url return end + # 记录当前点击按钮的时间 + # 考虑到用户未退出刷新消息页面 + if OnclickTime.where("user_id =?", User.current).first.nil? + message_new_time = OnclickTime.new + message_new_time.user_id = User.current.id + message_new_time.onclick_time = Time.now + message_new_time.save + else + message_new_time = OnclickTime.where("user_id =?", User.current).first + message_last_time = message_new_time.onclick_time + message_new_time.update_attributes(:onclick_time => Time.now) + end + @user_system_messages = SystemMessage.where("created_at >?", message_last_time).order("created_at desc") # 当前用户查看消息,则设置消息为已读 if params[:viewed] == "all" course_querys = @user.course_messages @@ -122,10 +129,23 @@ class UsersController < ApplicationController case params[:type] when nil @message_alls = [] - messages = MessageAll.where("user_id =?",@user).order("created_at desc") + messages = MessageAll.where("user_id =?" ,@user).order("created_at desc") messages.each do |message_all| @message_alls << message_all.message end + when 'unviewed' + @message_alls = [] + messages = MessageAll.where("user_id =?", @user).order("created_at desc") + messages.each do |message_all| + # 在点击或者刷新消息列表后未读的消息存放在数组 + if message_all.message.viewed == 0 + @message_alls << message_all.message + end + end + when 'system_messages' + @message_alls = SystemMessage.order("created_at desc").all + when 'apply' + @message_alls = ForgeMessage.where("forge_message_type =? and user_id =?" , "AppliedProject", @user).order("created_at desc") when 'homework' @message_alls = CourseMessage.where("course_message_type =? and user_id =?", "HomeworkCommon", @user).order("created_at desc") when 'course_message' @@ -329,11 +349,13 @@ class UsersController < ApplicationController #导入作业,确定按钮 def user_select_homework homework = HomeworkCommon.find_by_id params[:checkMenu] + homework_detail_programing = homework.homework_detail_programing @homework = HomeworkCommon.new if homework @homework.name = homework.name @homework.description = homework.description @homework.end_time = homework.end_time + @homework.homework_type = homework.homework_type @homework.course_id = homework.course_id homework.attachments.each do |attachment| att = attachment.copy @@ -343,6 +365,19 @@ class UsersController < ApplicationController att.save @homework.attachments << att end + + if homework_detail_programing + @homework.homework_detail_programing = HomeworkDetailPrograming.new + @homework_detail_programing = @homework.homework_detail_programing + @homework_detail_programing.ta_proportion = homework_detail_programing.ta_proportion + @homework_detail_programing.language = homework_detail_programing.language + homework.homework_tests.each_with_index do |homework_test| + @homework.homework_tests << HomeworkTest.new( + input: homework_test.input, + output: homework_test.output + ) + end + end end respond_to do |format| format.js @@ -354,7 +389,7 @@ class UsersController < ApplicationController @user = User.current @homework = HomeworkCommon.find(params[:homework_id]) @is_test = params[:is_test] == 'true' - @student_work = @homework.student_works.where(user_id: User.current.id).first + @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first if @student_work.nil? @student_work = StudentWork.new end @@ -382,8 +417,16 @@ class UsersController < ApplicationController def user_commit_homework homework = HomeworkCommon.find(params[:homework]) - student_work = homework.student_works.where(user_id: User.current.id).first + student_work = StudentWork.where(homework_common_id: homework.id, user_id: User.current.id).first if student_work + + #提交作品时,计算是否迟交 + if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") + student_work.late_penalty = 1 + else + student_work.late_penalty = 0 + end + student_work.save flash[:notice] = l(:notice_successful_create) redirect_to student_work_index_url(:homework => params[:homework]) @@ -822,7 +865,7 @@ class UsersController < ApplicationController when "project_message" @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) when "current_user" - @user_activities = UserActivity.where("user_id = #{User.current.id} and ((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) + @user_activities = UserActivity.where("user_id = #{@user.id} and ((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) 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/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index f74fbb04d..da6d48b8d 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -264,7 +264,7 @@ class WikiController < ApplicationController end @page.destroy respond_to do |format| - format.html { redirect_to project_wiki_index_url(@project) } + format.html {redirect_to edit_project_wiki_page_url @project, @page.title} format.api { render_api_ok } end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a1663c76b..f085032c3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -2304,20 +2304,19 @@ module ApplicationHelper # else # link = "启动匿评".html_safe # end - if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") - link = "启动匿评".html_safe + link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评" elsif homework.student_works.count >= 2 #作业份数大于2 case homework.homework_detail_manual.comment_status - when 1 - link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit' - when 2 - link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'fr mr10 work_edit' - when 3 - link = "匿评结束".html_safe + when 1 + link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink' + when 2 + link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink' + when 3 + link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束" end else - link = "启动匿评".html_safe + link = link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于2时才可以启动匿评" end link end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 12925b0b1..c25035fdb 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -18,6 +18,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. include AvatarHelper +include StudentWorkHelper module ProjectsHelper def link_to_version(version, options = {}) return '' unless version && version.is_a?(Version) diff --git a/app/helpers/student_work_helper.rb b/app/helpers/student_work_helper.rb index bff997ba4..aa359e273 100644 --- a/app/helpers/student_work_helper.rb +++ b/app/helpers/student_work_helper.rb @@ -2,17 +2,16 @@ include UserScoreHelper module StudentWorkHelper + #获取当前用户的项目列表 def user_projects_option - cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1" - memberships = User.current.memberships.all(:conditions => cond) - projects = memberships.map(&:project) + projects = User.current.projects.visible not_have_project = [] - not_have_project << Setting.please_chose + not_have_project << "没有可选项目,请直接为本作品创建一个项目" not_have_project << 0 type = [] type << not_have_project projects.each do |project| - if project != nil + if project option = [] option << project.name option << project.id diff --git a/app/helpers/system_messages_helper.rb b/app/helpers/system_messages_helper.rb new file mode 100644 index 000000000..fef238676 --- /dev/null +++ b/app/helpers/system_messages_helper.rb @@ -0,0 +1,2 @@ +module SystemMessagesHelper +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 269630ec3..15eebc15e 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -52,6 +52,40 @@ module UsersHelper end end + def title_for_message type + case type + when nil + '消息' + when 'unviewed' + '未读消息' + when 'apply' + '用户申请' + when 'system_messages' + '系统消息' + when 'homework' + '作业消息' + when 'course_message' + '课程讨论' + when 'course_news' + '课程通知' + when 'issue' + '项目任务' + when 'forum' + '贴吧帖子' + when 'user_feedback' + '用户留言' + end + end + + # 统计未读消息数 + def unviewed_message(user) + course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count + forge_count = ForgeMessage.where("user_id =? and viewed =?", user, 0).count + user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count + user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count + end + def user_mail_notification_options(user) user.valid_notification_options.collect {|o| [l(o.last), o.first]} end diff --git a/app/models/applied_project.rb b/app/models/applied_project.rb index accbc90e2..fb8bf90af 100644 --- a/app/models/applied_project.rb +++ b/app/models/applied_project.rb @@ -1,8 +1,21 @@ class AppliedProject < ActiveRecord::Base attr_accessible :project_id, :user_id - belongs_to :user - belongs_to :project + belongs_to :user + belongs_to :project + has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy + + after_create :send_appliled_message + + def send_appliled_message + # if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil? + self.project.members.each do |m| + if m.roles.first.to_s.include?("Manager") + self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.project_id, :viewed => false) + end + end + # end + end #删除用户申请 def self.deleteappiled(userid, projectid) @@ -11,5 +24,4 @@ class AppliedProject < ActiveRecord::Base applied.destroy end end - end diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb index 103796a72..4e74142ad 100644 --- a/app/models/course_activity.rb +++ b/app/models/course_activity.rb @@ -14,13 +14,19 @@ class CourseActivity < ActiveRecord::Base if user_activity user_activity.save else - user_activity = UserActivity.new - user_activity.act_id = self.course_act_id - user_activity.act_type = self.course_act_type - user_activity.container_type = "Course" - user_activity.container_id = self.course_id - user_activity.user_id = self.user_id - user_activity.save + if self.course_act_type == 'Message' && !self.course_act.parent_id.nil? + user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.course_act.parent.id}").first + user_activity.created_at = self.created_at + user_activity.save + else + user_activity = UserActivity.new + user_activity.act_id = self.course_act_id + user_activity.act_type = self.course_act_type + user_activity.container_type = "Course" + user_activity.container_id = self.course_id + user_activity.user_id = self.user_id + user_activity.save + end end end diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb index 9bc10bebf..c4f13c6d0 100644 --- a/app/models/forge_activity.rb +++ b/app/models/forge_activity.rb @@ -29,12 +29,19 @@ class ForgeActivity < ActiveRecord::Base if user_activity user_activity.save else - user_activity = UserActivity.new - user_activity.act_id = self.forge_act_id - user_activity.act_type = self.forge_act_type - user_activity.container_type = "Project" - user_activity.container_id = self.project_id - user_activity.save + if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil? + user_activity = UserActivity.where("act_type = 'Message' and act_id = #{self.forge_act.parent.id}").first + user_activity.created_at = self.created_at + user_activity.save + else + user_activity = UserActivity.new + user_activity.act_id = self.forge_act_id + user_activity.act_type = self.forge_act_type + user_activity.container_type = "Project" + user_activity.container_id = self.project_id + user_activity.user_id = self.user_id + user_activity.save + end end end diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 0bff38558..c1e5666ac 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -60,6 +60,6 @@ class HomeworkCommon < ActiveRecord::Base self.homework_type == 2 && self.homework_detail_programing end - delegate :language_name, :to => :homework_detail_programing + delegate :language_name, :language, :to => :homework_detail_programing end diff --git a/app/models/issue.rb b/app/models/issue.rb index fa8cee988..f7f596e17 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -147,6 +147,13 @@ class Issue < ActiveRecord::Base 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 + if self.tracker_id == 5 + self.project.members.each do |m| + if m.roles.first.to_s.include?("Manager") && m.user_id != self.author_id && m.user_id != self.assigned_to_id + self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.project_id, :viewed => false) + end + end + end end # 更新缺陷 @@ -1009,7 +1016,7 @@ class Issue < ActiveRecord::Base if leaf.start_date # Only move subtask if it starts at the same date as the parent # or if it starts before the given date - if start_date == leaf.start_date || date > leaf.start_date + if start_date == leaf.start_date || date > leaf.start_date leaf.reschedule_on!(date) end else diff --git a/app/models/mailer.rb b/app/models/mailer.rb index a25aff6bb..4fe2478d2 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -34,8 +34,10 @@ class Mailer < ActionMailer::Base end def method_missing(name, *args, &block) if Setting.delayjob_enabled? && Object.const_defined?('Delayed') + # with delayed_job @target.delay.send(name, *args, &block) else + # without delayed_job @target.send(name, *args, &block).deliver end end diff --git a/app/models/onclick_time.rb b/app/models/onclick_time.rb new file mode 100644 index 000000000..c62a9274c --- /dev/null +++ b/app/models/onclick_time.rb @@ -0,0 +1,5 @@ +class OnclickTime < ActiveRecord::Base + attr_accessible :onclick_time, :user_id + + belongs_to :user +end diff --git a/app/models/system_message.rb b/app/models/system_message.rb new file mode 100644 index 000000000..92a989cb3 --- /dev/null +++ b/app/models/system_message.rb @@ -0,0 +1,7 @@ +class SystemMessage < ActiveRecord::Base + attr_accessible :content, :id, :user_id + belongs_to :user + + validates :content, presence: true + validates_length_of :content, maximum: 255 +end diff --git a/app/models/user.rb b/app/models/user.rb index b08b29981..63811cd58 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -132,6 +132,8 @@ class User < Principal has_many :course_messages has_many :memo_messages has_many :user_feedback_messages + has_one :onclick_time + has_many :system_messages # 虚拟转换 has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1" @@ -209,7 +211,7 @@ class User < Principal before_save :update_hashed_password before_destroy :remove_references_before_destroy # added by fq - after_create :act_as_activity + after_create :act_as_activity, :add_onclick_time # end scope :in_group, lambda {|group| @@ -257,11 +259,18 @@ class User < Principal # 新消息统计 def count_new_message - course_count = CourseMessage.where("user_id =? and viewed =?", User.current.id, 0).count - forge_count = ForgeMessage.where("user_id =? and viewed =?", User.current.id, 0).count - user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", User.current.id, 0).count - user_memo_count = MemoMessage.where("user_id =? and viewed =?", User.current.id, 0).count - messages_count = course_count + forge_count + user_feedback_count + user_memo_count + if OnclickTime.where("user_id =?", User.current).first.nil? + message_new_time = OnclickTime.new + message_new_time.user_id = User.current.id + message_new_time.onclick_time = User.current.last_login_on.nil? ? Time.now : User.current.last_login_on + message_new_time.save + end + course_count = CourseMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count + forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count + user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count + user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count + system_messages_count = SystemMessage.where("created_at >?", User.current.onclick_time.onclick_time).count + messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count end # 查询指派给我的缺陷记录 @@ -994,6 +1003,13 @@ class User < Principal self.acts << Activity.new(:user_id => self.id) end + # 注册用户的时候消息默认点击时间为用户创建时间 + def add_onclick_time + if OnclickTime.where("user_id =?" , self.id).first.nil? + OnclickTime.create(:user_id => self.id, :onclick_time => self.created_on) + end + end + # Removes references that are not handled by associations # Things that are not deleted are reassociated with the anonymous user def remove_references_before_destroy diff --git a/app/views/admin/messages.html.erb b/app/views/admin/messages.html.erb new file mode 100644 index 000000000..1d9f0cc10 --- /dev/null +++ b/app/views/admin/messages.html.erb @@ -0,0 +1,47 @@ +<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %> +

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


+
+ <%= form_for(@admin_messages, :html => {:id =>'system_message-form'}) do |f| %> +
+ <%= f.kindeditor :content,:width=>'87%',:editor_id=>'system_message_editor' %> +

+
+
+

+
+
+ <%= link_to l(:label_submit), "javascript:void(0)", :class => "btn_message_free", :onclick => "system_message_editor.sync();submit_message();" %> +
+ <% end %> +
+ + diff --git a/app/views/courses/_join_private_course.html.erb b/app/views/courses/_join_private_course.html.erb index 934a4eb33..4cc8b9fbf 100644 --- a/app/views/courses/_join_private_course.html.erb +++ b/app/views/courses/_join_private_course.html.erb @@ -57,6 +57,8 @@ :id => 'new-watcher-form') do %> diff --git a/app/views/users/_user_programing_attr.html.erb b/app/views/users/_user_programing_attr.html.erb new file mode 100644 index 000000000..6a3b4a773 --- /dev/null +++ b/app/views/users/_user_programing_attr.html.erb @@ -0,0 +1,36 @@ + +

编程作业的测试集设置

+
+
+
+ +
+ <% if edit_mode && homework.is_program_homework? %> + <% homework.homework_tests.each_with_index do |test, index| %> +
+ + + + <% if index != 0 %> + + <% end %> +
+
+ <% end %> + <% else %> +
+ + + +
+
+ <% end %> + +
+ 确  定 +
+
+ +
\ No newline at end of file diff --git a/app/views/users/new_user_commit_homework.html.erb b/app/views/users/new_user_commit_homework.html.erb index 8b02b4594..ab7cb5b59 100644 --- a/app/views/users/new_user_commit_homework.html.erb +++ b/app/views/users/new_user_commit_homework.html.erb @@ -70,11 +70,15 @@
请使用 <%= @homework.language_name %> 语言编写
-
+
<%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能" %>
<%= f.text_area :description, id: 'program-src', class:"InputBox W700 H150", placeholder:"请贴入你的代码", rows: 10 %> +
测试代码 diff --git a/app/views/users/show_chen.erb b/app/views/users/show_chen.erb deleted file mode 100644 index 3bd0014c6..000000000 --- a/app/views/users/show_chen.erb +++ /dev/null @@ -1,279 +0,0 @@ -
-
-
最新动态
- -
- -
-
- 用户头像
-
- - -
- -
截止时间:2015-08-20
-
-
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
- -
-
-
-
-
-
-
- 用户头像
-
- - -
- -
截止时间:2015-08-20
-
-
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
- -
-
-
-
- - - -
-
-
- 用户头像
-
- - -
- 时间:2015-07-31 -
-
- -
-
-
-
-
-
-
回复(5)
-
2015-07-31
- -
-
- -
-
- - - -
-
-
-
- 用户头像 -
-
-
黄井泉 学生 - 2015-08-01删除 -
-
很开心!
-
-
-
-
-
- 用户头像 -
-
-
陈正东 学生 - 2015-08-02删除 -
-
假期好热,没出去。
-
-
-
-
-
-
-
-
- 用户头像
-
- - -
-
指派给  苏稳 -
-
时间:2015-08-20
-
-
(缺陷描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
-
- 文件附件.zip(123KB) -
-
- 图片附件.png(123KB) -
-
- -
-
-
-
-
-
-
回复(5)
-
2015-07-26
- -
-
- -
-
- - - -
-
-
-
- 用户头像 -
-
-
尹教授 - 2015-08-01删除 -
-
请大家说下软件工程是什么!
-
-
-
-
-
- 用户头像 -
-
-
Tang 学生 - 2015-08-01删除 -
-
软件工程是一门研究用工程化方法构建和维护有效的、实用的和高质量的软件的学科。它涉及程序设计语言、数据库、软件开发工具、系统平台、标准、设计模式等方面。
-
-
-
-
-
\ No newline at end of file diff --git a/app/views/users/user_messages.html.erb b/app/views/users/user_messages.html.erb index c3c1a447b..a184a6d7e 100644 --- a/app/views/users/user_messages.html.erb +++ b/app/views/users/user_messages.html.erb @@ -1,9 +1,11 @@
-
消息
+
<%= title_for_message(params[:type]) %>
    • <%= link_to "全部",user_message_path(User.current), :class => "resourcesGrey" %>
    • +
    • <%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "resourcesGrey" %>
    • +
    • <%= link_to "用户申请", user_message_path(User.current, :type => 'apply'), :class => "resourcesGrey" %>
    • <%# 课程相关消息 %>
    • <%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "resourcesGrey" %>
    • <%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %>
    • @@ -22,19 +24,51 @@
    • <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %>
    • <%# 系统贴吧 %>
    • <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %>
    • - + <%# 系统消息 %> +
    • <%= link_to "系统消息", user_message_path(User.current, :type => 'system_messages'), :class => "resourcesGrey" %>
-<% if params[:type].nil? %> -
- 有 <%= User.current.count_new_message %> 条未读<%= link_to "全部设为已读", user_message_path(User.current, :viewed => 'all') %> -
-<% end %> <% if @message_alls.count >0 %> + <% if params[:type].nil? || params[:type] == "unviewed" %> +
+ 有 <%= unviewed_message(@user) %> 条未读 + <% unless (unviewed_message(@user) == 0 || User.current != @user) %> + <%= link_to "全部设为已读", user_message_path(User.current, :viewed => 'all') %> + <% end %> +
+ <% end %> + <%# 系统消息 %> + <% if params[:type] != 'system_messages' %> + <% @user_system_messages.each do |usm| %> + + <% end %> + <% end %> <%# 课程消息 %> <% unless @message_alls.nil? %> <% @message_alls.each do |ma| %> @@ -65,7 +99,7 @@
  • <%= time_tag(ma.created_at).html_safe %>
  • <% end %> - <% if ma.course_message_type == "HomeworkCommon" %> + <% if ma.course_message_type == "HomeworkCommon" && ma.status != 1 %> <% end %> + <% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %> +
      +
    • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
    • +
    • <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">发布的作业:
    • + <% if ma.viewed == 0 %> +
    • + <%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.course_message.name}" %> +
    • +
    •    截止时间快到了!
    • + <% else %> +
    • + <%= link_to ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :title => "#{ma.course_message.name}" %> +
    • + <% end %> +
    • <%= time_tag(ma.created_at).html_safe %>
    • +
    + <% end %> <% if ma.course_message_type == "Poll" %>
    • <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
    • @@ -131,6 +182,21 @@ <% end %> <% if ma.class == ForgeMessage %> + <% if ma.forge_message_type == "AppliedProject" %> + + <% end %> <% if ma.forge_message_type == "Issue" %>
      • @@ -272,6 +338,30 @@
      <% end %> <% end %> + <%# 系统消息 %> + <% if ma.class == SystemMessage %> +
        +
      • + + + +
      • +
      • Trustie平台发布新消息:
      • +
      • + <%= link_to ma.content.html_safe, user_message_path(User.current, :type => "system_messages"), + :class => "#{params[:type]=="unviewed" ? "newsBlack" : "newsRed"}", + :onmouseover =>"message_titile_show($(this),event);", + :onmouseout => "message_titile_hide($(this));" + %> +
      • + +
      • <%= time_tag(ma.created_at).html_safe %>
      • +
      + <% end %> <% end %>
        <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%> diff --git a/app/views/users/user_select_homework.js.erb b/app/views/users/user_select_homework.js.erb index acffd2506..308f74938 100644 --- a/app/views/users/user_select_homework.js.erb +++ b/app/views/users/user_select_homework.js.erb @@ -5,4 +5,7 @@ $("#homework_end_time").val("<%= @homework.end_time%>"); $("#course_id").val("<%= @homework.course_id%>"); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true })%>"); homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>"); +$("#BluePopupBox").html("<%=escape_javascript( render :partial => 'users/user_programing_attr', :locals => {:edit_mode => true, :homework => @homework})%>"); +//$("input[name='homework_type']").val("<%#= @homework.homework_type%>"); $("#homework_editor").show(); +$("#BluePopupBox a.BlueCirBtn").click(); diff --git a/config/locales/admins/en.yml b/config/locales/admins/en.yml index 479d2f0f0..ed23107cb 100644 --- a/config/locales/admins/en.yml +++ b/config/locales/admins/en.yml @@ -11,3 +11,5 @@ en: label_registration_activation_by_email: account activation by email label_registration_manual_activation: manual account activation label_registration_automatic_activation: automatic account activation + + label_system_message: system messages diff --git a/config/locales/admins/zh.yml b/config/locales/admins/zh.yml index 936b3109f..5d857efae 100644 --- a/config/locales/admins/zh.yml +++ b/config/locales/admins/zh.yml @@ -14,3 +14,7 @@ zh: label_registration_manual_activation: 手动激活帐号 label_registration_automatic_activation: 自动激活帐号 + label_system_message: 系统消息 + label_admin_message_fail: 消息内容过长! + label_content_blank_fail: 消息内容不能为空! + diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 4a6ddce4e..d2fa502b9 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -36,6 +36,7 @@ zh: notice_create_failed: 创建失败,请先完善个人信息 notice_failed_create: 创建失败 notice_successful_update: 更新成功 + notice_successful_message: 消息创建成功! notice_successful_edit: 修改成功 notice_failed_edit: 修改失败 notice_successful_delete: 删除成功 @@ -49,6 +50,7 @@ zh: notice_not_contest_setting_authorized: 对不起,您无权配置此竞赛。 notice_not_contest_delete_authorized: 对不起,您无权删除此竞赛。 notice_not_authorized_archived_project: 要访问的项目已经归档。 + notice_not_authorized_message: 您访问的消息不存在! notice_email_sent: "邮件已发送至 %{value}" notice_email_error: "发送邮件时发生错误 (%{value})" notice_feeds_access_key_reseted: 您的RSS存取键已被重置。 diff --git a/config/routes.rb b/config/routes.rb index 8454a1c47..1d2393764 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -260,6 +260,15 @@ RedmineApp::Application.routes.draw do match '/users/search', :via => [:get, :post] #end + # 消息相关路由 + resources :system_messages do + collection do + post 'create', :as => 'system_messages' + get 'index', :as => 'index' + end + end + # match 'system_messages/index', to: 'system_messages#index', :via => :get, :as => 'system_messages' + 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] @@ -702,6 +711,7 @@ RedmineApp::Application.routes.draw do match 'admin/projects', :via => :get get 'admin/courses' match 'admin/users', :via => :get + match 'admin/messages', :via => :get match 'admin/first_page_made', as: :first_page_made match 'admin/course_page_made', as: :course_page_made match 'admin/contest_page_made', as: :contest_page_made @@ -874,6 +884,7 @@ RedmineApp::Application.routes.draw do match 'tags/remove_tag', :as=>"remove_tag" match 'tags/remove_tag_new', :as=>"remove_tag_new" match 'tags/tag_save', :as => "save_tag" + match 'tags/update_tag_name',:as => "update_tag_name" match 'words/add_brief_introdution' diff --git a/db/migrate/20150906065702_create_onclick_times.rb b/db/migrate/20150906065702_create_onclick_times.rb new file mode 100644 index 000000000..3922b775e --- /dev/null +++ b/db/migrate/20150906065702_create_onclick_times.rb @@ -0,0 +1,10 @@ +class CreateOnclickTimes < ActiveRecord::Migration + def change + create_table :onclick_times do |t| + t.integer :user_id + t.datetime :onclick_time + + t.timestamps + end + end +end diff --git a/db/migrate/20150909062619_create_system_messages.rb b/db/migrate/20150909062619_create_system_messages.rb new file mode 100644 index 000000000..a51715ead --- /dev/null +++ b/db/migrate/20150909062619_create_system_messages.rb @@ -0,0 +1,11 @@ +class CreateSystemMessages < ActiveRecord::Migration + def change + create_table :system_messages do |t| + t.integer :id + t.integer :user_id + t.string :content + + t.timestamps + end + end +end diff --git a/db/migrate/20150911064528_alter_user_activities.rb b/db/migrate/20150911064528_alter_user_activities.rb new file mode 100644 index 000000000..b6ede5bdb --- /dev/null +++ b/db/migrate/20150911064528_alter_user_activities.rb @@ -0,0 +1,21 @@ +class AlterUserActivities < ActiveRecord::Migration + def up + UserActivity.all.each do |activity| + if activity.act_type == 'Message' + if activity.act + unless activity.act.parent_id.nil? + parent_act = UserActivity.where("act_id = #{activity.act.parent.id} and act_type='Message'").first + parent_act.created_at = activity.act.parent.children.maximum("created_on") + parent_act.save + activity.destroy + end + else + activity.destroy + end + end + end + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 008e13129..3daf4743e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -497,26 +497,23 @@ ActiveRecord::Schema.define(:version => 20150911031029) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" - create_table "dts", :primary_key => "Num", :force => true do |t| - t.string "Defect", :limit => 50 - t.string "Category", :limit => 50 - t.string "File" - t.string "Method" - t.string "Module", :limit => 20 - t.string "Variable", :limit => 50 - t.integer "StartLine" - t.integer "IPLine" - t.string "IPLineCode", :limit => 200 - t.string "Judge", :limit => 15 - t.integer "Review", :limit => 1 + create_table "dts", :force => true do |t| + t.string "IPLineCode" t.string "Description" - t.text "PreConditions", :limit => 2147483647 - t.text "TraceInfo", :limit => 2147483647 - t.text "Code", :limit => 2147483647 + t.string "Num" + t.string "Variable" + t.string "TraceInfo" + t.string "Method" + t.string "File" + t.string "IPLine" + t.string "Review" + t.string "Category" + t.string "Defect" + t.string "PreConditions" + t.string "StartLine" t.integer "project_id" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "enabled_modules", :force => true do |t| @@ -781,6 +778,16 @@ ActiveRecord::Schema.define(:version => 20150911031029) do add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_details_copy", :force => true do |t| + t.integer "journal_id", :default => 0, :null => false + t.string "property", :limit => 30, :default => "", :null => false + t.string "prop_key", :limit => 30, :default => "", :null => false + t.text "old_value" + t.text "value" + end + + add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id" + create_table "journal_replies", :id => false, :force => true do |t| t.integer "journal_id" t.integer "user_id" @@ -939,6 +946,13 @@ ActiveRecord::Schema.define(:version => 20150911031029) do t.datetime "updated_at", :null => false end + create_table "onclick_times", :force => true do |t| + t.integer "user_id" + t.datetime "onclick_time" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "open_id_authentication_associations", :force => true do |t| t.integer "issued" t.integer "lifetime" @@ -1351,6 +1365,13 @@ ActiveRecord::Schema.define(:version => 20150911031029) do add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id" add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id" + create_table "system_messages", :force => true do |t| + t.integer "user_id" + t.string "content" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "taggings", :force => true do |t| t.integer "tag_id" t.integer "taggable_id" diff --git a/lib/redmine.rb b/lib/redmine.rb index 99b7ea22f..8ebdacfa6 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -369,6 +369,7 @@ Redmine::MenuManager.map :admin_menu do |menu| menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural menu.push :courses, {:controller => 'admin', :action => 'courses'}, :caption => :label_course_all menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural + menu.push :messages, {:controller => 'admin', :action => 'messages'}, :caption => :label_system_message menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version diff --git a/lib/tasks/homework_endtime.rake b/lib/tasks/homework_endtime.rake new file mode 100644 index 000000000..9fef281a3 --- /dev/null +++ b/lib/tasks/homework_endtime.rake @@ -0,0 +1,18 @@ +#coding=utf-8 + +namespace :homework_endtime do + desc "send a message for Job deadline" + task :message => :environment do + current_day = Date.today.day + homework_commons = HomeworkCommon.where("end_time >=?",Date.today) + homework_commons.each do |homework_common| + if CourseMessage.where("course_message_type =? and course_message_id =? and status =?", "HomeworkCommon", homework_common.id, 1).first.nil? + if homework_common.end_time.day - Date.today.day < 2 && homework_common.end_time.year == Date.today.year + homework_common.course.student.each do |s| + homework_common.course_messages << CourseMessage.new(:user_id => s.student_id, :course_id => homework_common.course_id, :viewed => false, :status => true) + end + end + end + end + end +end diff --git a/public/images/avatars/AnonymousUser/0 b/public/images/avatars/AnonymousUser/0 deleted file mode 100644 index a4cc45467..000000000 Binary files a/public/images/avatars/AnonymousUser/0 and /dev/null differ diff --git a/public/images/avatars/Course/0 b/public/images/avatars/Course/0 deleted file mode 100644 index 8eb3d27d5..000000000 Binary files a/public/images/avatars/Course/0 and /dev/null differ diff --git a/public/images/avatars/Course/6314 b/public/images/avatars/Course/6314 deleted file mode 100644 index b58caabfa..000000000 Binary files a/public/images/avatars/Course/6314 and /dev/null differ diff --git a/public/images/avatars/Course/6315 b/public/images/avatars/Course/6315 deleted file mode 100644 index cce3b9ccf..000000000 Binary files a/public/images/avatars/Course/6315 and /dev/null differ diff --git a/public/images/avatars/Course/6316 b/public/images/avatars/Course/6316 deleted file mode 100644 index fa4fd4110..000000000 Binary files a/public/images/avatars/Course/6316 and /dev/null differ diff --git a/public/images/avatars/Course/6322 b/public/images/avatars/Course/6322 deleted file mode 100644 index 1f0332907..000000000 Binary files a/public/images/avatars/Course/6322 and /dev/null differ diff --git a/public/images/avatars/Course/6330 b/public/images/avatars/Course/6330 deleted file mode 100644 index 030ab8a68..000000000 Binary files a/public/images/avatars/Course/6330 and /dev/null differ diff --git a/public/images/avatars/Course/6356 b/public/images/avatars/Course/6356 deleted file mode 100644 index 757c2a628..000000000 Binary files a/public/images/avatars/Course/6356 and /dev/null differ diff --git a/public/images/avatars/Course/6358 b/public/images/avatars/Course/6358 deleted file mode 100644 index 030ab8a68..000000000 Binary files a/public/images/avatars/Course/6358 and /dev/null differ diff --git a/public/images/avatars/Course/6408 b/public/images/avatars/Course/6408 deleted file mode 100644 index bf740e537..000000000 Binary files a/public/images/avatars/Course/6408 and /dev/null differ diff --git a/public/images/avatars/Course/6446 b/public/images/avatars/Course/6446 deleted file mode 100644 index 90e0e8474..000000000 Binary files a/public/images/avatars/Course/6446 and /dev/null differ diff --git a/public/images/avatars/Course/course.jpg b/public/images/avatars/Course/course.jpg deleted file mode 100644 index 8eb3d27d5..000000000 Binary files a/public/images/avatars/Course/course.jpg and /dev/null differ diff --git a/public/images/avatars/Organization/0 b/public/images/avatars/Organization/0 deleted file mode 100644 index 2ae1d7494..000000000 Binary files a/public/images/avatars/Organization/0 and /dev/null differ diff --git a/public/images/avatars/Project/0 b/public/images/avatars/Project/0 deleted file mode 100644 index 19a3ac4c6..000000000 Binary files a/public/images/avatars/Project/0 and /dev/null differ diff --git a/public/images/avatars/Project/6314 b/public/images/avatars/Project/6314 deleted file mode 100644 index b58caabfa..000000000 Binary files a/public/images/avatars/Project/6314 and /dev/null differ diff --git a/public/images/avatars/Project/6315 b/public/images/avatars/Project/6315 deleted file mode 100644 index cce3b9ccf..000000000 Binary files a/public/images/avatars/Project/6315 and /dev/null differ diff --git a/public/images/avatars/Project/6316 b/public/images/avatars/Project/6316 deleted file mode 100644 index fa4fd4110..000000000 Binary files a/public/images/avatars/Project/6316 and /dev/null differ diff --git a/public/images/avatars/Project/6322 b/public/images/avatars/Project/6322 deleted file mode 100644 index 1f0332907..000000000 Binary files a/public/images/avatars/Project/6322 and /dev/null differ diff --git a/public/images/avatars/Project/6330 b/public/images/avatars/Project/6330 deleted file mode 100644 index 030ab8a68..000000000 Binary files a/public/images/avatars/Project/6330 and /dev/null differ diff --git a/public/images/avatars/Project/6356 b/public/images/avatars/Project/6356 deleted file mode 100644 index 757c2a628..000000000 Binary files a/public/images/avatars/Project/6356 and /dev/null differ diff --git a/public/images/avatars/Project/6358 b/public/images/avatars/Project/6358 deleted file mode 100644 index 030ab8a68..000000000 Binary files a/public/images/avatars/Project/6358 and /dev/null differ diff --git a/public/images/avatars/Project/6408 b/public/images/avatars/Project/6408 deleted file mode 100644 index bf740e537..000000000 Binary files a/public/images/avatars/Project/6408 and /dev/null differ diff --git a/public/images/avatars/Project/6446 b/public/images/avatars/Project/6446 deleted file mode 100644 index 90e0e8474..000000000 Binary files a/public/images/avatars/Project/6446 and /dev/null differ diff --git a/public/images/avatars/Project/course.jpg b/public/images/avatars/Project/course.jpg deleted file mode 100644 index 81b0e925c..000000000 Binary files a/public/images/avatars/Project/course.jpg and /dev/null differ diff --git a/public/images/avatars/User/0 b/public/images/avatars/User/0 deleted file mode 100644 index bd2597dd2..000000000 Binary files a/public/images/avatars/User/0 and /dev/null differ diff --git a/public/images/avatars/User/1 b/public/images/avatars/User/1 deleted file mode 100644 index 090de2290..000000000 Binary files a/public/images/avatars/User/1 and /dev/null differ diff --git a/public/images/avatars/User/4245 b/public/images/avatars/User/4245 deleted file mode 100644 index 8057fac14..000000000 Binary files a/public/images/avatars/User/4245 and /dev/null differ diff --git a/public/images/avatars/User/4246 b/public/images/avatars/User/4246 deleted file mode 100644 index 757c2a628..000000000 Binary files a/public/images/avatars/User/4246 and /dev/null differ diff --git a/public/images/avatars/User/4247 b/public/images/avatars/User/4247 deleted file mode 100644 index 3df1c4e68..000000000 Binary files a/public/images/avatars/User/4247 and /dev/null differ diff --git a/public/images/avatars/User/4249 b/public/images/avatars/User/4249 deleted file mode 100644 index 93600eb8f..000000000 Binary files a/public/images/avatars/User/4249 and /dev/null differ diff --git a/public/images/avatars/User/4275 b/public/images/avatars/User/4275 deleted file mode 100644 index 2659a14b7..000000000 Binary files a/public/images/avatars/User/4275 and /dev/null differ diff --git a/public/images/avatars/User/4288 b/public/images/avatars/User/4288 deleted file mode 100644 index ca17e5328..000000000 Binary files a/public/images/avatars/User/4288 and /dev/null differ diff --git a/public/images/avatars/User/4856 b/public/images/avatars/User/4856 deleted file mode 100644 index 96d1098fd..000000000 Binary files a/public/images/avatars/User/4856 and /dev/null differ diff --git a/public/images/avatars/User/4858 b/public/images/avatars/User/4858 deleted file mode 100644 index 8df8790ba..000000000 Binary files a/public/images/avatars/User/4858 and /dev/null differ diff --git a/public/images/avatars/User/4859 b/public/images/avatars/User/4859 deleted file mode 100644 index 78704a099..000000000 Binary files a/public/images/avatars/User/4859 and /dev/null differ diff --git a/public/images/avatars/User/4861 b/public/images/avatars/User/4861 deleted file mode 100644 index a587c9656..000000000 Binary files a/public/images/avatars/User/4861 and /dev/null differ diff --git a/public/images/avatars/User/4863 b/public/images/avatars/User/4863 deleted file mode 100644 index 26e7db3e7..000000000 Binary files a/public/images/avatars/User/4863 and /dev/null differ diff --git a/public/images/avatars/User/4869 b/public/images/avatars/User/4869 deleted file mode 100644 index 030ab8a68..000000000 Binary files a/public/images/avatars/User/4869 and /dev/null differ diff --git a/public/images/avatars/User/4874 b/public/images/avatars/User/4874 deleted file mode 100644 index 90e0e8474..000000000 Binary files a/public/images/avatars/User/4874 and /dev/null differ diff --git a/public/images/avatars/User/4896 b/public/images/avatars/User/4896 deleted file mode 100644 index 757c2a628..000000000 Binary files a/public/images/avatars/User/4896 and /dev/null differ diff --git a/public/images/homepage_icon.png b/public/images/homepage_icon.png index 127f12e92..a6f3223b6 100644 Binary files a/public/images/homepage_icon.png and b/public/images/homepage_icon.png differ diff --git a/public/javascripts/course.js b/public/javascripts/course.js index be29fdc30..fc52ef87a 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -260,8 +260,23 @@ function submitFocus(obj) function submitComment() { - comment_editor.sync(); - $("#add_comment_form").submit(); + if (newsReplyVerify()) { + comment_editor.sync(); + $("#add_comment_form").submit(); + } +} + +function newsReplyVerify() { + var content = comment_editor.html(); + if(content.length == 0) { + $("#add_reply_news").text("评论不能为空"); + $("#add_reply_news").css('color', '#ff0000'); + return false; + } else { + $("#add_reply_news").text("填写正确"); + $("#add_reply_news").css('color', '#008000'); + return true; + } } /////////////////////////////////////////////////课程讨论区 @@ -934,3 +949,8 @@ function SearchByName_1(url) location.href = url + "&name=" + $("#course_student_name").val() + "&group=" + $("#late_penalty").val(); } } + +//新建作业临时弹框 +function new_homework_alert(){ + alert("您好!课程内直接发布作业的功能正在改进中,请直接点击\n顶部导航栏的“作业”向本课程发送作业。谢谢!如有问\n题,可参见帮助中心。"); +} diff --git a/public/javascripts/homework.js b/public/javascripts/homework.js index 773a2c209..ca07093fe 100644 --- a/public/javascripts/homework.js +++ b/public/javascripts/homework.js @@ -58,10 +58,10 @@ $(function(){ ); }; - $('#test-program-btn').live('click', test_program); + $('#test-program-btn').on('click', test_program); - $('#commit-program-work-btn').live('click', function(){ + $('#commit-program-work-btn').on('click', function(){ if(!valid_form()){ return; } @@ -89,85 +89,88 @@ $(function(){ $(".HomeWorkCon form").submit(); }); - $('form.edit_student_work').live('keydown', '#program-src', function(){ + $('form.edit_student_work').on('keydown', '#program-src', function(){ tested = false; }); - //发布作业 - $('#program-src').focus(function(){ - $(this).css('height', '100px'); - }); + //$('#program-src').focus(function(){ + // $(this).css('height', '100px'); + //}); var datepickerOptions={dateFormat:'yy-mm-dd',firstDay:0,showWeek:true,showOtherMonths:true,selectOtherMonths:true}; $('input.date-input').datepicker(datepickerOptions); - $('a.pic_date').live('click', function(){ + $('a.pic_date').on('click', function(){ $(this).parent().prev().first().focus(); }) - $('a.ProBtn').live('click', function(){ - $("#BluePopupBox").dialog({ + $("#BluePopupBox").dialog({ modal: true, + autoOpen: false, dialogClass: 'BluePopupBox', minWidth: 753 - }); - $(".ui-dialog-titlebar").hide(); + }); - $("a.CloseBtn").live('click', function(){ + $('a.ProBtn').live('click', function(){ + $("#BluePopupBox").dialog("open"); + $(".ui-dialog-titlebar").hide(); + $("a.CloseBtn").on('click', function(){ $("#BluePopupBox" ).dialog("close"); }); $('#textarea_input_test').focus(); - - $("#BluePopupBox a.BlueCirBtn").live('click', function(){ - var test_numbers = 0; - var valid = true; - var input = null; - var output = null; - var input_groups = []; - $.each($('#BluePopupBox textarea.InputBox'), function(i, val){ - if ($(val).val().length<=0) { - $(val)[0].focus(); - valid =false; - return false; - } - if (test_numbers %2==0) { - input = $(val).val(); - } else { - output = $(val).val(); - input_groups.push({input: input, output: output}); - } - test_numbers += 1; - }); - - var language = $('select.language_type').val() == 1 ? 'C语言' : 'C++语言'; - - if (valid) { - $("input[name=homework_type]").val(2); - $('span.program_detail_info').text('('+language+','+test_numbers/2+'组测试)'); - //保存js值 - var data = { - language_type: $('select.language_type').val(), - input_groups: input_groups - }; - //构建到form中 - $('.program-input').remove(); - var html=bt('t:program-input-list',data); - $("input[name=homework_type]").after(html); - $("#BluePopupBox" ).dialog( "close" ); - } - }); }); - $("#BluePopupBox").live('click', 'a.icon_add', function(){ + $("#BluePopupBox a.BlueCirBtn").live('click', function(){ + var test_numbers = 0; + var valid = true; + var input = null; + var output = null; + var input_groups = []; + $.each($('#BluePopupBox textarea.InputBox'), function(i, val){ + if ($(val).val().length<=0) { + $(val)[0].focus(); + valid =false; + return false; + } + if (test_numbers %2==0) { + input = $(val).val(); + } else { + output = $(val).val(); + input_groups.push({input: input, output: output}); + } + test_numbers += 1; + }); + + var language = $('select.language_type').val() == 1 ? 'C语言' : 'C++语言'; + + if (valid) { + $("input[name=homework_type]").val(2); + $('span.program_detail_info').text('('+language+','+test_numbers/2+'组测试)'); + //保存js值 + var data = { + language_type: $('select.language_type').val(), + input_groups: input_groups + }; + //构建到form中 + $('.program-input').remove(); + var html=bt('t:program-input-list',data); + $("input[name=homework_type]").after(html); + if($( "#BluePopupBox" ).dialog( "isOpen" )){ + $("#BluePopupBox").dialog( "close" ); + } + } + }); + + $("#BluePopupBox").on('click', 'a.icon_add', function(){ var html = bt('t:test-answer-list', null); $(this).parent('.mt10').after(html); }); - $("#BluePopupBox").live('click', 'a.icon_remove', function(){ + $("#BluePopupBox").on('click', 'a.icon_remove', function(){ $(this).parent('.mt10').remove(); }); }); \ No newline at end of file diff --git a/public/javascripts/new_user.js b/public/javascripts/new_user.js index eb50c2762..4f2cbeeff 100644 --- a/public/javascripts/new_user.js +++ b/public/javascripts/new_user.js @@ -180,6 +180,12 @@ function regexStudentWorkDescription() } } +//学生作品 +function show_project() +{ + $("#about_project").slideToggle(); +} + //textarea自适应高度 纯js写的 有浏览器判断 /** * 文本框根据输入内容自适应高度 @@ -249,4 +255,63 @@ var autoTextarea = function (elem, extra, maxHeight) { addEvent('input', change); addEvent('focus', change); change(); -}; \ No newline at end of file +}; + +/////////////////////////////////////////////////////////////////////////////////////创建项目 +//验证项目名称是不是为空 +function regex_project_name(){ + var name = $.trim($("#project_name").val()); + if(name=="") + { + $("#project_name_error_msg").text("项目名称不能为空"); + return false; + } + else + { + $("#project_name_error_msg").text(""); + return true; + } +} + +//验证项目名称是否重复---项目名称可以重复。。。。 +function regex_project_name_same(){ + var name = $.trim($("#project_name").val()); + return true; +} + +//验证项目描述 +function regex_project_desc(){ + var desc = $.trim($("#project_description").val()); + if(desc == "") + { + $("#project_desc_error_msg").text("项目名称不能为空"); + return false; + } + else + { + $("#project_desc_error_msg").text(""); + return true; + } +} +//提交 +function submit_project(){ + if(regex_project_name()&®ex_project_desc()){ + $("#new_project").submit(); + } +} +/////////////////////////////////////////////////////////////////////////////////////创建项目 end +//匿评弹框取消按钮 +function clickCanel(){hideModal("#popbox02");} +//匿评弹框确定按钮 +function clickOK(path) +{ + clickCanel(); + $.ajax({ + type: "GET", + url: path, + data: 'text', + success: function (data) { + } + }); +} +///////////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 3e01d68ff..ac983479a 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1833,7 +1833,7 @@ input#time_entry_comments { width: 90%;} .tabular.settings p{ padding-left: 300px; } .tabular.settings label{ margin-left: -300px; width: 295px; } -.tabular.settings textarea { width: 99%; } +.tabular.settings textarea { width: 96%; } .settings.enabled_scm table {width:100%} .settings.enabled_scm td.scm_name{ font-weight: bold; } @@ -2807,4 +2807,7 @@ img.school_avatar { width: 100px; height: 100px; max-width: none; -} \ No newline at end of file +} + +.admin_message_warn{font-size: 12px;color: red;} +a.btn_message_free{ background:#15BCCF; display:block; text-align:center; color:#fff; padding:3px 0; width:60px; margin-bottom:10px;} \ No newline at end of file diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css index 2fb72c439..ac5d2d622 100644 --- a/public/stylesheets/new_user.css +++ b/public/stylesheets/new_user.css @@ -515,11 +515,16 @@ a.homepageMenuText {color:#484848; font-size:16px; margin-left:20px;} .homepageNewsType {width:110px; padding-left: 5px; font-size:12px; color:#888888; display:block;} .homepageNewsPubType {width:220px; font-size:12px; color:#888888; display: block;} .homepageNewsContent {width:365px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } +.homepageHomeworkContentWarn {width:110px; max-width:365px; margin-right:10px; font-size:12px; color:red; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;max-height: 49px; } +.homepageHomeworkContent {width:245px; max-width:365px; margin-right:10px; font-size:12px; color:#4b4b4b; display:block; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;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} a.newsGrey {color:#4b4b4b;} a.newsGrey:hover {color:#000000;} +a.newsRed {color:red;} +a.newsRed:hovor {color:#888888;} a.replyGrey {color:#888888; display:inline-block;} a.replyGrey:hover {color:#4b4b4b;} a.replyGrey1 {color:#888888;} @@ -583,7 +588,7 @@ a.postReplyCancel:hover {color:#ffffff;} a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;} a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;} .homepagePostReplyPortrait {float:left; width:33px;} -.homepagePostReplyDes {float:left; width:620px; margin-left:15px;} +.homepagePostReplyDes {float:left; width:632px; margin-left:15px;} .homepagePostReplyPublisher {font-size:12px; color:#888888; margin-bottom:5px;} .homepagePostReplyContent {font-size:12px; color:#484848; margin-bottom:12px;} .homepagePostProjectState {width:52px; height:20px; line-height:20px; border-radius:1px; background-color:#28be6c; color:#ffffff; text-align:center; vertical-align:middle; font-size:12px; display:inline-block; margin-left:5px;} @@ -677,6 +682,8 @@ a.referenceTypeBlock {color:#888888; display:inline-block; padding:0px 20px;} .Agreementh4{ color:#2980b9; font-weight:bold; font-size:14px; margin-top:30px;} .AgreementTxt{text-indent:2em; margin-bottom:15px;} .AgreementImg{ margin:0px auto; width:619px;} +.AgreementTxt{text-indent: 2em; margin-bottom: 15px;} +.AgreementImg{margin: 0px auto; width: 820px;} /*底部*/ #Footer{background-color:#ffffff; padding-bottom:15px; color:#666666;} /*margin-bottom:10px;*/ @@ -885,7 +892,7 @@ a.FilesBtn{ background: url(../images/homepage_icon.png) 0px -373px no-repeat; a:hover.FilesBtn{background: url(../images/homepage_icon.png) -89px -372px no-repeat; color:#3598db;} a.BlueCirBtnMini{ display:block;width:40px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;} a:hover.BlueCirBtnMini{ background:#3598db; color:#fff;} -a.ProBtn{background: url(../images/homepage_icon.png) -86px -396px no-repeat; width:35px; height:20px; display:block; padding-left:20px; color:#888888;} +a.ProBtn{background: url(../images/homepage_icon.png) -86px -396px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;} a:hover.ProBtn{background: url(../images/homepage_icon.png) -86px -426px no-repeat; color:#3598db;} a.DropBtn{background: url(../images/homepage_icon.png) -125px -339px no-repeat; width:85px; height:20px; display:block; color:#888888; font-size:14px;} @@ -933,7 +940,7 @@ a:hover.UsersApBtn{border:1px solid #888888; } .C_Blue{ color:#3598db;} a.C_Blue{ color:#3598db;} a:hover.C_Blue{ color:#297fb8;} -.BluePopupBox{ border:3px solid #3598db; padding:20px; background:#fff; width:707px;} +.BluePopupBox{ padding:20px; background:#fff; width:707px;} /*.BluePopupBox:hover{ border:3px solid #297fb8; }*/ a.CloseBtn{background:url(../images/CloseBtn.png) 0px 0px no-repeat; width:13px; height:13px; display:block; float:right;} a:hover.CloseBtn{background:url(../images/CloseBtn.png) 0px -24px no-repeat; } @@ -981,6 +988,8 @@ img.ui-datepicker-trigger { margin-bottom: 3px; } .message_title{border: 1px solid #D4D4D4;padding: 0.6em;margin-left: 1.4em;margin-right: 0.4em;border-radius: 4px;font-family: "Microsoft YaHei";background-size: 100% 100%;margin-bottom: 5px;background-color: #E8E8E8;} +.message_title_red{border: 1px solid #D4D4D4;padding: 0.6em;margin-left: 1.4em;margin-right: 0.4em;border-radius: 4px;font-family: "Microsoft YaHei";background-size: 100% 100%;margin-bottom: 5px;background-color: #E8E8E8;color: red} + .description{display: none !important;} .ispublic-label{display: none !important;} .is_public_checkbox{display: none !important;} @@ -1109,3 +1118,25 @@ a:hover.tijiao{ background:#0f99a9;} #cboxPrevious{position:absolute; bottom:0px; left:0; color:#444;} #cboxNext{position:absolute; bottom:0px; left:63px; color:#444;} #cboxClose{position:absolute; bottom:0; right:0; display:block; color:#444;} + +/*20150906关联项目LB*/ +a.RalationIcon{ background: url(../images/homepage_icon.png) -183px -396px no-repeat; width:70px; height:20px; display:block; padding-left:20px; color:#888888;} +a:hover.RalationIcon{background: url(../images/homepage_icon.png) -183px -428px no-repeat; color:#3598db;} +a.SetUpIcon{background: url(../images/homepage_icon.png) 0px -453px no-repeat; width:20px; height:20px; display:block; color:#888888;} +a:hover.SetUpIcon{background: url(../images/homepage_icon.png) 0px -486px no-repeat; color:#3598db;} +.W680{ width:680px;} +.W710{ width:708px;} + +/* 开启匿评弹框 */ +.anonymos{width:480px;height:180px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;} +.anonymos_work {position:fixed !important;left:60%;top:60%;margin:-215px 0 0 -300px; box-shadow:0px 0px 8px #194a81; overflow:auto;} +.ni_con { width:425px; margin:25px 30px;} +.ni_con h2{ display:block; height:40px; width:425px; text-align:center; color:#3a3a3a;} +.ni_con p{ color:#808181; } +.ni_con a:hover{ text-decoration:none;} +.ni_btn{ width:190px; margin:15px auto; line-height:1.9;} +a.tijiao{ height:28px; display:block; width:80px; color:#fff; background:#15bccf; text-align:center; padding-top:4px; float:left; margin-right:15px;} +a:hover.tijiao{ background:#0f99a9;} +.c_pink{ color:#e65d5e;} +.ni_con_work { width:300px; margin:25px 20px;} +.ni_con_work p{ color:#808181; } diff --git a/public/stylesheets/public.css b/public/stylesheets/public.css index 5ff90bb43..e291e503a 100644 --- a/public/stylesheets/public.css +++ b/public/stylesheets/public.css @@ -19,7 +19,7 @@ table{ background:#fff;} .line{border-bottom:1px dashed #d4d4d4; padding-bottom:10px; margin-bottom:10px;} .no_border{ border:none;} .min_search{ width:150px; height:20px; border:1px solid #d0d0d0; color:#666; background:url(../images/new_project/public_icon.png) 135px -193px no-repeat;} - +a.btn_message_free{ background:#ff5722; display:block; text-align:center; color:#fff; padding:3px 0; width:80px; margin-bottom:10px;} /* font & color */ h2{ font-size:18px; color:#15bccf;} h3{ font-size:14px; color:#e8770d;} @@ -536,5 +536,6 @@ a.resourcesBlack:hover {font-size:12px; color:#000000;} } .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; border: none;} .AgreementTxt{text-indent: 2em; margin-bottom: 15px;} .AgreementImg{margin: 0px auto; width: 820px;} diff --git a/public/stylesheets/public_new.css b/public/stylesheets/public_new.css index 555cef836..7cd0a461c 100644 --- a/public/stylesheets/public_new.css +++ b/public/stylesheets/public_new.css @@ -789,3 +789,9 @@ div.flash.warning, .conflict { /*消息铃铛样式*/ .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} + +/*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; border: none;} +.AgreementTxt{text-indent: 2em; margin-bottom: 15px;} +.AgreementImg{margin: 0px auto; width: 820px;} \ No newline at end of file diff --git a/spec/controllers/system_messages_controller_spec.rb b/spec/controllers/system_messages_controller_spec.rb new file mode 100644 index 000000000..c65f5b5e0 --- /dev/null +++ b/spec/controllers/system_messages_controller_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe SystemMessagesController, :type => :controller do + +end diff --git a/spec/factories/onclick_times.rb b/spec/factories/onclick_times.rb new file mode 100644 index 000000000..fcdda983d --- /dev/null +++ b/spec/factories/onclick_times.rb @@ -0,0 +1,7 @@ +FactoryGirl.define do + factory :onclick_time do + user_id 1 +onclick_time "2015-09-06 14:57:02" + end + +end diff --git a/spec/factories/system_messages.rb b/spec/factories/system_messages.rb new file mode 100644 index 000000000..7bcc27422 --- /dev/null +++ b/spec/factories/system_messages.rb @@ -0,0 +1,8 @@ +FactoryGirl.define do + factory :system_message do + id 1 +user_id 1 +content "MyString" + end + +end diff --git a/spec/models/onclick_time_spec.rb b/spec/models/onclick_time_spec.rb new file mode 100644 index 000000000..bc453f545 --- /dev/null +++ b/spec/models/onclick_time_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OnclickTime, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/system_message_spec.rb b/spec/models/system_message_spec.rb new file mode 100644 index 000000000..fd8df4e92 --- /dev/null +++ b/spec/models/system_message_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe SystemMessage, :type => :model do + pending "add some examples to (or delete) #{__FILE__}" +end