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 %>
+
+
课 程 ID:
diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb
index 8c7a41ddc..d2c17917e 100644
--- a/app/views/courses/new.html.erb
+++ b/app/views/courses/new.html.erb
@@ -5,6 +5,8 @@
<%= labelled_form_for @course do |f| %>
+
+
* <%= l(:label_tags_course_name)%> :
课程名称不能为空
diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb
index 4ca8d3d43..a462db79d 100644
--- a/app/views/courses/settings.html.erb
+++ b/app/views/courses/settings.html.erb
@@ -20,6 +20,8 @@
+
+
* <%= l(:label_tags_course_name)%> :
课程名称不能为空
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb
index aefa1a5a9..fa15c1fc7 100644
--- a/app/views/files/index.html.erb
+++ b/app/views/files/index.html.erb
@@ -223,6 +223,54 @@
});
}
+ var tagNameHtml; //当前双击的链接的父节点的html
+ var tagName; //标签的值
+ var parentCssBorder; //当前双击的链接的父节点
+ var ele; //当前双击的链接
+ var tagId; //标签的id
+ var taggableType; //被标签的类型
+ function rename_tag(domEle,name,id,type){
+ if(domEle.children().get(0) != undefined ){ //已经是编辑框的情况下不要动
+ return;
+ }
+ tagNameHtml = domEle.parent().html()
+ tagName = name;
+ parentCssBorder = domEle.parent().css("border");
+ ele = domEle;
+ tagId = id;
+ taggableType = type;
+ domEle.html(' ');
+ domEle.parent().css("border","1px solid #ffffff");
+ $("#renameTagName").focus();
+ }
+ //监听所有的单击事件
+ $(document.body).click(function(e){
+ node = document.elementFromPoint(e.clientX, e.clientY);
+ if(node.tagName == "INPUT"){ //如果是输入框的聚焦,那么就不要进行下去了
+ return;
+ }
+ if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态
+ if($("#renameTagName").val().trim() == tagName){ //如果值一样,则恢复原来的状态
+ ele.parent().css("border","");
+ ele.parent().html(tagNameHtml);
+
+ }else{ //否则就要更新tag名称了
+ if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){
+ $.post(
+ '<%= update_tag_name_path %>',
+ {"taggableId":tagId,"taggableType":taggableType,"tagName":tagName,"renameName":$("#renameTagName").val().trim()}
+// function(data){
+// ele.parent().css("border","");
+// ele.parent().html(tagNameHtml);
+// }
+ )
+ }else{
+ ele.parent().css("border","");
+ ele.parent().html(tagNameHtml);
+ }
+ }
+ }
+ });
diff --git a/app/views/homework_common/alert_anonymous_comment.js.erb b/app/views/homework_common/alert_anonymous_comment.js.erb
index 2b3248dc2..375b333f1 100644
--- a/app/views/homework_common/alert_anonymous_comment.js.erb
+++ b/app/views/homework_common/alert_anonymous_comment.js.erb
@@ -3,5 +3,4 @@ showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("" +
" ");
-$('#ajax-modal').parent().css("top","").css("left","");
-$('#ajax-modal').parent().addClass("anonymos");
\ No newline at end of file
+$('#ajax-modal').parent().css("top","30%").css("left","30%");
\ No newline at end of file
diff --git a/app/views/homework_common/index.html.erb b/app/views/homework_common/index.html.erb
index 694069b44..a39f93671 100644
--- a/app/views/homework_common/index.html.erb
+++ b/app/views/homework_common/index.html.erb
@@ -25,8 +25,8 @@
( <%= link_to homework.student_works.count, student_work_index_path(:homework => homework.id), :class => 'c_red'%> )
<% if @is_teacher%>
- <%= homework_anonymous_comment(homework)%>
- <%= link_to(l(:label_bid_respond_delete), homework_common_path(homework),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %>
+ <%#= homework_anonymous_comment(homework)%>
+ <%#= link_to(l(:label_bid_respond_delete), homework_common_path(homework),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %>
<%#= link_to(l(:button_edit),edit_homework_common_path(homework), :class => "fr mr10 work_edit") %>
<% elsif @is_student%>
<%= student_anonymous_comment homework %>
diff --git a/app/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb
index 5f27a5b82..b0424bf7a 100644
--- a/app/views/homework_common/start_anonymous_comment.js.erb
+++ b/app/views/homework_common/start_anonymous_comment.js.erb
@@ -1,6 +1,6 @@
<% if @statue == 1%>
alert('启动成功');
-$("#<%= @homework.id %>_start_anonymous_comment").replaceWith('<%= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "fr mr10 work_edit")%>');
+$("#<%= @homework.id %>_start_anonymous_comment").replaceWith('<%= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>');
<% elsif @statue == 2 %>
alert('启动失败\n作业总数大于等于2份时才能启动匿评');
<% elsif @statue == 3%>
diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb
index 7841ead91..4830431a0 100644
--- a/app/views/layouts/base_courses.html.erb
+++ b/app/views/layouts/base_courses.html.erb
@@ -33,36 +33,6 @@
-
-
@@ -77,7 +47,7 @@
<% if is_teacher%>
<%= link_to "
#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %>
<%= set_course_time @course%>
- <%= link_to "
#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %>
+ <%#= link_to "
#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %>
<% else%>
<% end%>
@@ -87,12 +57,12 @@
diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb
index 8676c6fb1..7f8b4c69e 100644
--- a/app/views/layouts/new_base_user.html.erb
+++ b/app/views/layouts/new_base_user.html.erb
@@ -109,9 +109,9 @@
<% end%>
<% end%>
-
-
-
+
+
<%= l(:label_cancel_with_space) %>
@@ -48,7 +49,7 @@
<% comments.each do |comment| %>
<% next if comment.new_record? %>
-
<%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author)%>
+
<%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author), :class => "problem_pic fl"%>
<%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %>
@@ -76,4 +77,4 @@
<% end %>
-<% html_title @news.title -%>
+<% html_title @news.title -%>
\ No newline at end of file
diff --git a/app/views/news/_project_form.html.erb b/app/views/news/_project_form.html.erb
index dfe1fb937..269420bfe 100644
--- a/app/views/news/_project_form.html.erb
+++ b/app/views/news/_project_form.html.erb
@@ -1,7 +1,7 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
* <%= l(:field_title) %> :
-
+
diff --git a/app/views/projects/_form.html.erb b/app/views/projects/_form.html.erb
index 1e3f4b620..4df254fd0 100644
--- a/app/views/projects/_form.html.erb
+++ b/app/views/projects/_form.html.erb
@@ -12,14 +12,6 @@
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:0px;" %>
-
- <%#= f.text_field :enterprise_name, :size => 60, :style => "width:490px;" %>
-
- <%= l(:field_enterprise_name)%>
-
-
- <%= select_tag :organization_id,options_for_select(project_organizations_id_option,@project.organization_id),{} %>
-
<%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH,
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
diff --git a/app/views/projects/create.js.erb b/app/views/projects/create.js.erb
new file mode 100644
index 000000000..9bb447789
--- /dev/null
+++ b/app/views/projects/create.js.erb
@@ -0,0 +1,3 @@
+$("#project_id").replaceWith("<%= escape_javascript(select_tag :project_id, options_for_select(user_projects_option), {:class => "InputBox W680 fl"})%>");
+hideModal("#popbox02");
+alert("创建成功");
\ No newline at end of file
diff --git a/app/views/projects/settings.html.erb b/app/views/projects/settings.html.erb
index e70e20cef..3fc9a89d6 100644
--- a/app/views/projects/settings.html.erb
+++ b/app/views/projects/settings.html.erb
@@ -2,13 +2,15 @@
$(function(){
<%if @select_tab%>
<%if @select_tab == "modules"%>
- project_setting(2);
+ project_setting(2);
+ <% elsif @select_tab == "members"%>
+ project_setting(3);
<% elsif @select_tab == "versions"%>
- project_setting(4);
- $("#pro_st_edit_ban").toggle();
+ project_setting(4);
+ $("#pro_st_edit_ban").toggle();
<% elsif @select_tab == "repositories" %>
- project_setting(6);
- $("#pro_st_edit_ku").toggle();
+ project_setting(6);
+ $("#pro_st_edit_ku").toggle();
<%else%>
<% end%>
<% end%>
diff --git a/app/views/projects/settings/_new_edit.html.erb b/app/views/projects/settings/_new_edit.html.erb
index a8998ece5..8de9b8229 100644
--- a/app/views/projects/settings/_new_edit.html.erb
+++ b/app/views/projects/settings/_new_edit.html.erb
@@ -19,11 +19,6 @@
-
- 组织 :
- <%= select_tag :organization_id,options_for_select(project_organizations_id_option,@project.organization_id),{} %>
-
-
公开 :
>
diff --git a/app/views/projects/settings/_new_repositories.html.erb b/app/views/projects/settings/_new_repositories.html.erb
index be793a409..410bd8c32 100644
--- a/app/views/projects/settings/_new_repositories.html.erb
+++ b/app/views/projects/settings/_new_repositories.html.erb
@@ -59,7 +59,7 @@
-<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post"} do |f| %>
+<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post",:autocomplete=>'off'} do |f| %>
@@ -79,6 +79,8 @@
<% end %>
+
+
* <%=l(:label_repository_name)%>:
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>"", :no_label => true %>
<% unless @repository.identifier_frozen? %>
@@ -87,7 +89,7 @@
* <%=l(:label_password)%>
- <%= f.password_field :upassword, :label=> "", :no_label => true %>
+ <%= f.password_field :upassword, :label=> "", :no_label => true%>
<%= l(:label_upassword_info)%>
diff --git a/app/views/student_work/_new_project.html.erb b/app/views/student_work/_new_project.html.erb
new file mode 100644
index 000000000..3d9214c7d
--- /dev/null
+++ b/app/views/student_work/_new_project.html.erb
@@ -0,0 +1,31 @@
+
diff --git a/app/views/student_work/_programing_work_show.html.erb b/app/views/student_work/_programing_work_show.html.erb
index b259e20a5..10e1870ef 100644
--- a/app/views/student_work/_programing_work_show.html.erb
+++ b/app/views/student_work/_programing_work_show.html.erb
@@ -25,40 +25,44 @@
<% if @is_teacher%>
- 测试结果:
-
-
-
- 输入
- 输出
- 测试结果
-
- <%@homework.homework_tests.each do |test|%>
- ">
-
- <%= test.input%>
-
-
- <%= test.output%>
-
- <% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%>
- <%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%>
-
-
- <% end%>
- <% student_work_test = @work.student_work_test.first%>
- <% if student_work_test && student_work_test.error_msg && !student_work_test.error_msg.empty?%>
-
-
- <%= student_work_test.error_msg%>
-
-
- <% end%>
-
-
-
-
+
+
+ 测试结果:
+
+
+ <% @work.student_work_tests.each_with_index do |test, index| %>
+
+
第<%= @work.student_work_tests.count - index%>次测试
<%= test.created_at.to_s(:db) %>
+
+
+ <% if test.status.to_i == -2 %>
+
<%= test.results.first %>
+ <% else %>
+
+
+ <% test.results.each_with_index do |x, i| %>
+
+ 测试<%=i+1%>
+ <% if x["status"].to_i != 0 %>
+ 测试错误!
+ 您的输出:
+ <%=x["result"]%>
+ 正确输出:
+ <%=x["output"]%>
+
+ <% else %>
+ 测试正确!
+
+ <% end %>
+
+ <% end %>
+
+
+ <% end %>
+ <% end %>
+
+
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb
index e8fa33902..d128eab67 100644
--- a/app/views/student_work/index.html.erb
+++ b/app/views/student_work/index.html.erb
@@ -123,7 +123,7 @@
<%= @homework.name%>
<% if @is_teacher%>
- <%= homework_anonymous_comment(@homework)%>
+ <%#= homework_anonymous_comment(@homework)%>
<% else%>
<%= student_anonymous_comment @homework %>
<%= student_new_homework @homework %>
diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb
index 85c23f300..f9b242443 100644
--- a/app/views/student_work/new.html.erb
+++ b/app/views/student_work/new.html.erb
@@ -9,12 +9,18 @@
"
");
$('#ajax-modal').parent().css("top","30%").css("left","40%");
$('#ajax-modal').parent().addClass("anonymos_work");
-// alert("当前作业已开启匿评,您提交作品后将不会收到任何匿评作品,您的作品也不会被其他用户匿评,如需获得最终成绩,请您联系主讲老师对您的作品单独进行评分");
});
<% end%>
- //匿评弹框取消按钮
- function clickCanel(){hideModal("#popbox02");}
+ //快速创建项目的弹框
+ function new_project(){
+ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/new_project') %>');
+ showModal('ajax-modal', '800px');
+ $('#ajax-modal').siblings().remove();
+ $('#ajax-modal').before("
" +
+ " ");
+ $('#ajax-modal').parent().css("top","30%").css("left","20%").css("position","fixed");
+ }
+
+
+
+
+ <%= select_tag :project_id, options_for_select(user_projects_option, @student_work.project_id), {:class => "InputBox W680 fl"} %>
+ <%#=link_to "", new_project_path, :class => "ml5 mt5 SetUpIcon fl", :title => "快速创建"%>
+
+
+
+
确定
或
@@ -83,4 +101,4 @@
<% end%>
-
+
\ No newline at end of file
diff --git a/app/views/system_messages/index.html.erb b/app/views/system_messages/index.html.erb
new file mode 100644
index 000000000..4ed40757b
--- /dev/null
+++ b/app/views/system_messages/index.html.erb
@@ -0,0 +1,3 @@
+<% @system_messages.each do |sm| %>
+
+<% end %>
diff --git a/app/views/tags/_tag_list.html.erb b/app/views/tags/_tag_list.html.erb
index b512f1ef3..49c9b2351 100644
--- a/app/views/tags/_tag_list.html.erb
+++ b/app/views/tags/_tag_list.html.erb
@@ -2,7 +2,8 @@
<% if @tags.size > 0 %>
<% @tags.each do |tag| %>
- <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
+ <%#= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
+ <%= tag %>
<% case object_flag %>
<% when '10' %>
diff --git a/app/views/tags/update_tag_name.js.erb b/app/views/tags/update_tag_name.js.erb
new file mode 100644
index 000000000..b72b0c33f
--- /dev/null
+++ b/app/views/tags/update_tag_name.js.erb
@@ -0,0 +1,40 @@
+//本js使用的新的tag显示方法
+<% if @obj_flag == '3'%>
+$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
+ :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
+//$('#put-tag-form-issue').hide();
+$('#name-issue').val("");
+<% elsif @obj_flag == '1'%>
+$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_user_new_name',
+ :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
+$('#tags_name3').val("");
+<% elsif @obj_flag == '2'%>
+$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_project_new_name',
+ :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
+$('#tags_name2').val("");
+<% elsif @obj_flag == '6'%>
+<%if @course%>
+$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
+$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list',
+ :locals => {:obj => @obj,:object_flag => @obj_flag,:select_tag_name => @select_tag_name}) %>');
+$("#files_tag").html("<%= escape_javascript(render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @select_tag_name}) %>");
+<%else%>
+$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
+$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/course_attachment_tag_name',
+ :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
+<%end%>
+
+$("#tags_name_<%=@obj.id%>").val("");
+$("#add_tag_<%=@obj.id%>").hide();
+<% elsif @obj_flag == '9'%>
+$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/new_tag_name',
+ :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
+$('#tags_name').val("");
+<% elsif @obj_flag == '10'%>
+//$("#put-tag-form-<%#=@obj.class%>-<%#=@obj.id%>").hide();
+<% else%>
+$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
+ :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
+$('#tags_name').val("");
+//$('#put-tag-form').hide();
+<% end %>
\ No newline at end of file
diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb
index 5f820d923..0cc7739b1 100644
--- a/app/views/users/_course_message.html.erb
+++ b/app/views/users/_course_message.html.erb
@@ -48,7 +48,7 @@
<% count=0 %>
-
回复(
+
回复(
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
@@ -75,7 +75,7 @@
<% replies_all_i=replies_all_i+1 %>
- <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %>
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.author_id), :alt => "用户头像" %>
diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb
index f9745f59e..933b2b419 100644
--- a/app/views/users/_course_news.html.erb
+++ b/app/views/users/_course_news.html.erb
@@ -27,7 +27,7 @@
<% count=activity.comments.count %>
-
+
回复(<%= count %>)
<%#= format_date(activity.updated_on) %>
@@ -48,7 +48,7 @@
<% replies_all_i = replies_all_i + 1 %>
- <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
+ <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.author_id), :alt => "用户头像" %>
diff --git a/app/views/users/_course_news_reply.html.erb b/app/views/users/_course_news_reply.html.erb
deleted file mode 100644
index c3f8571be..000000000
--- a/app/views/users/_course_news_reply.html.erb
+++ /dev/null
@@ -1,177 +0,0 @@
-
-<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
-
-<% if @news.commentable? %>
-
-<% end %>
-
-
-
- <%= form_for('new_form', :method => :post,
- :url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%>
- <%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
-
-
- <% end %>
-
-
-
-
-
-
-
-
-
-
diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb
index e3ef7c41d..fe857198f 100644
--- a/app/views/users/_project_issue.html.erb
+++ b/app/views/users/_project_issue.html.erb
@@ -67,7 +67,7 @@
<% count = activity.journals.count %>
-
回复(<%= count %>)
+
回复(<%= count %>)
<%#= format_date(activity.updated_on) %>
<% if count > 2 %>
@@ -86,7 +86,7 @@
<% replies_all_i=replies_all_i + 1 %>
- <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
+ <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.user_id), :alt => "用户头像" %>
@@ -97,17 +97,14 @@
<% end %>
<%= format_time(reply.created_on) %>
- <% if reply.details.any? %>
- <% details_to_strings(reply.details).each do |string| %>
-
- <%= string %>
-
- <% end %>
- <% else %>
-
- <%= reply.notes.html_safe %>
-
- <% end %>
+
+ <% if reply.details.any? %>
+ <% details_to_strings(reply.details).each do |string| %>
+
<%= string %>
+ <% end %>
+ <% end %>
+
<%= reply.notes.html_safe %>
+
diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb
index f8b3f53c0..304ac1428 100644
--- a/app/views/users/_project_message.html.erb
+++ b/app/views/users/_project_message.html.erb
@@ -39,7 +39,7 @@
<% count = 0 %>
-
回复(
+
回复(
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
@@ -62,7 +62,7 @@
<% replies_all_i=replies_all_i+1 %>
- <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %>
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.author_id), :alt => "用户头像" %>
diff --git a/app/views/users/_show_user_resource.html.erb b/app/views/users/_show_user_resource.html.erb
index a3c82d995..24d81a787 100644
--- a/app/views/users/_show_user_resource.html.erb
+++ b/app/views/users/_show_user_resource.html.erb
@@ -59,8 +59,8 @@
<% end %>
diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb
index a8ccb9836..bbef67e6d 100644
--- a/app/views/users/_user_activities.html.erb
+++ b/app/views/users/_user_activities.html.erb
@@ -11,6 +11,7 @@
.ke-inline-block{display: none;}
div.ke-container{float:left;}
+<% first_user_activity = user_activities.first.id %>
<% user_activities.each do |user_activity|
if user_activities %>
<% end %>
-
+
@@ -83,28 +88,6 @@
-
+
diff --git a/app/views/users/_user_homework_list.html.erb b/app/views/users/_user_homework_list.html.erb
index 642373d58..6a9ffb727 100644
--- a/app/views/users/_user_homework_list.html.erb
+++ b/app/views/users/_user_homework_list.html.erb
@@ -47,6 +47,9 @@
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
+
+ <%= homework_anonymous_comment homework_common %>
+
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 @@
+
+
+
+
+
+
+ <%= options_for_select({"C语言"=>1, "C++"=>2}, (edit_mode && homework.is_program_homework?) ? homework.language : 1) %>
+
+
+ <% 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 @@
-
-
-
-
-
-
-
-
-
-
-
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
(作业描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 时间:2015-07-31
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
(缺陷描述)系统中有多个ckeditor,且每个ckeditor的id未知,怎么样做到当光标聚焦某个ckeditor的文本框中,该编辑器的默认值应自动消失的处理;网络拓扑图开发;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
软件工程是一门研究用工程化方法构建和维护有效的、实用的和高质量的软件的学科。它涉及程序设计语言、数据库、软件开发工具、系统平台、标准、设计模式等方面。
-
-
-
-
-
\ 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 @@
-<% if params[:type].nil? %>
-
-<% end %>
<% if @message_alls.count >0 %>
+ <% if params[:type].nil? || params[:type] == "unviewed" %>
+
+ <% end %>
+ <%# 系统消息 %>
+ <% if params[:type] != 'system_messages' %>
+ <% @user_system_messages.each do |usm| %>
+
+
+
+
+ <%= image_tag("/images/logo.png", width: "30px", height: "30px", class: "mt3") %>
+
+
+
+
+ Trustie平台 发布新消息:
+
+
+ <%= link_to usm.content.html_safe, user_message_path(User.current, :type => "system_messages"),
+ :class => "newsRed",
+ :onmouseover => "message_titile_show($(this),event);",
+ :onmouseout => "message_titile_hide($(this));"
+ %>
+
+
+ <%= usm.content.html_safe %>
+
+ <%= time_tag(usm.created_at).html_safe %>
+
+ <% 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 %>
<%=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" %>">发布了作业:
@@ -74,6 +108,23 @@
<%= time_tag(ma.created_at).html_safe %>
<% 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" %>
<% end %>
<% end %>
+ <%# 系统消息 %>
+ <% if ma.class == SystemMessage %>
+
+
+
+
+ <%=image_tag("/images/logo.png",width:"30px", height: "30px",class: "mt3")%>
+
+
+
+ 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));"
+ %>
+
+
+ <%= ma.content.html_safe%>
+
+ <%= 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