Conflicts:
	app/views/users/_course_message.html.erb
	app/views/users/_course_news.html.erb
	app/views/users/_project_issue.html.erb
	app/views/users/_project_message.html.erb
	app/views/users/_user_activities.html.erb
	public/stylesheets/new_user.css
This commit is contained in:
Tim 2015-09-16 16:13:40 +08:00
commit 3d5f93b938
130 changed files with 1199 additions and 793 deletions

View File

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

View File

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

View File

@ -79,6 +79,11 @@ class AdminController < ApplicationController
end
end
# 系统消息
def messages
@admin_messages = SystemMessage.new
end
def plugins
@plugins = Redmine::Plugin.all
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2304,20 +2304,19 @@ module ApplicationHelper
# else
# link = "<span class='fr mr10 pr_join_span ' title='未开启匿评作业不可以启动匿评'>启动匿评</span>".html_safe
# end
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
link = "<span class='fr mr10 pr_join_span ' title='作业截止日期之前不可以启动匿评'>启动匿评</span>".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 = "<span class='fr pr_join_span mr10' title='匿评结束'>匿评结束</span>".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 = "<span class='fr mr10 pr_join_span ' title='学生提交作业数大于2时才可以启动匿评'>启动匿评</span>".html_safe
link = link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "学生提交作业数大于2时才可以启动匿评"
end
link
end

View File

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

View File

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

View File

@ -0,0 +1,2 @@
module SystemMessagesHelper
end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -0,0 +1,5 @@
class OnclickTime < ActiveRecord::Base
attr_accessible :onclick_time, :user_id
belongs_to :user
end

View File

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

View File

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

View File

@ -0,0 +1,47 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<h3 style="float: left">
<%=l(:label_system_message)%>
</h3><br/>
<div style="padding-top: 20px; padding-left: 5px;">
<%= form_for(@admin_messages, :html => {:id =>'system_message-form'}) do |f| %>
<div class="field">
<%= f.kindeditor :content,:width=>'87%',:editor_id=>'system_message_editor' %>
<p id="content_notice_span" class="ml55"></p>
</div>
<div>
<p id="content_notice_span" class="ml55"></p>
</div>
<div class="actions">
<%= link_to l(:label_submit), "javascript:void(0)", :class => "btn_message_free", :onclick => "system_message_editor.sync();submit_message();" %>
</div>
<% end %>
</div>
<script>
function system_message_length() {
var obj = system_message_editor.html();
if (obj.length == 0) {
$("#content_notice_span").text("内容不能为空");
$("#content_notice_span").css('color', '#ff0000');
$("#content_notice_span").focus();
return false;
}
else if (obj.length > 255) {
$("#content_notice_span").text("内容过长超过255个字符");
$("#content_notice_span").css('color', '#ff0000');
$("#content_notice_span").focus();
return false;
}
else {
$("#content_notice_span").text("填写正确");
$("#content_notice_span").css('color', '#008000');
return true;
}
}
function submit_message() {
if (system_message_length()) {
$("#system_message-form").submit();
}
}
</script>

View File

@ -57,6 +57,8 @@
:id => 'new-watcher-form') do %>
<ul>
<li>
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<span class="tips">课&nbsp;程&nbsp;ID</span>
<input class=" width190" name="object_id" id="object_id" type="text" value="" >
<input type="text" style="display: none"/>

View File

@ -5,6 +5,8 @@
<ul>
<%= labelled_form_for @course do |f| %>
<li class="ml45">
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();">
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>

View File

@ -20,6 +20,8 @@
<div class="cl"></div>
</li>
<li class="ml45">
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="course_name" class="courses_input" maxlength="100" onkeyup="regex_course_name();" value="<%= @course.name%>">
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>

View File

@ -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('<input name="" id="renameTagName" style="width: 100px;" value="'+name+'"/>');
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);
}
}
}
});
</script>

View File

@ -3,5 +3,4 @@ showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
$('#ajax-modal').parent().css("top","30%").css("left","30%");

View File

@ -25,8 +25,8 @@
( <%= link_to homework.student_works.count, student_work_index_path(:homework => homework.id), :class => 'c_red'%> )
</p>
<% 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 %>

View File

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

View File

@ -33,36 +33,6 @@
</div>
<div class="cl"></div>
<div id="Container">
<div id="TopBar">
<div class="topbar_info02 fl">
<h2>
<a href="http://<%= Setting.host_course%>" target="_blank" class="c_blue">
<%= l(:label_courses_community)%>
</a>
</h2>
<p class="hiddent">
<%= l(:label_user_location) %> :
<%= link_to l(:field_homepage), home_path %>
>
<a href="http://<%= Setting.host_course%>">
<%=l(:label_courses_management_platform)%>
</a>
>
<%= link_to @course.name, course_path(@course) %>
</p>
</div>
<!--<div class="search fl">-->
<!--<%#= form_tag({:controller => 'courses', :action => 'search'},:id => "course_search_form", :method => :get, :class => "search_form") do %>-->
<!--<input class="search_text fl" id="name" name="name" onkeyup="regexName('搜索条件不能为空');" placeholder="课程名称" type="text">-->
<!--<a href="javascript:void(0)" onclick="submitSerch('<%#= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" >-->
<!--<%#= l(:label_search)%>-->
<!--</a>-->
<!--<div class="cl"></div>-->
<!--<span id="project_name_span" style="float: left"></span>-->
<!--<%# end %>-->
<!--</div>-->
</div><!--TopBar end-->
<div class="cl"></div>
<div id="content">
<div id="LSide" class="fl">
<div class="project_info">
@ -77,7 +47,7 @@
<% if is_teacher%>
<%= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %>
<%= set_course_time @course%>
<%= link_to "<span class='pr_copy'></span>#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %>
<%#= link_to "<span class='pr_copy'></span>#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %>
<% else%>
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
<% end%>
@ -87,12 +57,12 @@
<div >
<a class="pr_info_name fl c_dark fb break_word" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank">
<%= @course.name %>
<% if @course.is_public == 0%>
</a>
<% if @course.is_public == 0%>
<span class="img_private ">
<%= l(:field_is_private)%>
</span>
<% end %>
</a>
<% end %>
</div>
<div class="cl"></div>
<div class="pr_info_foot ">
@ -123,7 +93,7 @@
<div class="subNav">
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%>
<%= link_to "(#{@course.homework_commons.count})", homework_common_index_path(:course => @course.id), :class => "subnav_num c_orange"%>
<%#= link_to( "+#{l(:label_course_homework_new)}", new_homework_common_path(:course => @course.id), :class => 'subnav_green c_white') if is_teacher %>
<%= link_to( "+#{l(:label_course_homework_new)}", "javascript:void(0)", :class => 'subnav_green c_white', :onclick => "new_homework_alert();") if is_teacher %>
</div>
<div class="subNav">
<%= link_to l(:label_course_news), course_news_index_path(@course), :class => "f14 c_blue02" %>

View File

@ -49,16 +49,6 @@
<%= link_to l(:field_homepage), home_path %> > <a href="http://<%= Setting.host_name %>"><%=l(:label_project_hosting_platform) %> </a>><%= link_to @project.name, project_path(@project.id) %>
</p>
</div>
<!--<div class="search fl">-->
<!--<%#= form_tag(projects_search_path, :method => :get, :id => "project_search_form", :class => "search_form") do %>-->
<!--<%#= text_field_tag 'name', params[:name], :placeholder => "项目名称", :class => "search_text fl", :onkeyup => "regexName('#{l(:label_search_conditions_not_null)}');" %>-->
<!--<a href="#" onclick="submitSerch('<%#= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" >-->
<!--<%#= l(:label_search)%>-->
<!--</a>-->
<!--<div class="cl"></div>-->
<!--<span id="project_name_span" class="fl"></span>-->
<!--<%# end %>-->
<!--</div>-->
</div><!--TopBar end-->
<div id="content">

View File

@ -109,9 +109,9 @@
<% end%>
<% end%>
</div>
<div class="homepageLeftMenuCourses" id="homepageLeftMenuCourses">
<% courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5)%>
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" id="homepageLeftMenuCourses">
<ul>
<% courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5)%>
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>
</ul>
</div>
@ -122,9 +122,9 @@
<%=link_to "", new_project_path, :class => "homepageMenuSetting fr", :title => "新建项目"%>
<% end%>
</div>
<div class="homepageLeftMenuCourses" id="homepageLeftMenuForge">
<% projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
<div class="homepageLeftMenuCourses <%= projects.empty? ? 'none' : ''%>" id="homepageLeftMenuForge">
<ul>
<% projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :page => 0} %>
</ul>
</div>

View File

@ -1,3 +1,3 @@
$("#nh_user_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:90px;height:90px;overflow:hidden",:alt=>"头像") %>');
$("#nh_user_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:78px;height:78px;overflow:hidden",:alt=>"头像") %>');
$("#nh_user_logo").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_logo',:width =>"40",:height => "40",:alt=>"头像") %>');
hideModal();

View File

@ -32,7 +32,8 @@
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%>
</div>
<p class="mt10">
<p id="add_reply_news"></p>
<p class="mt10">
<a href="javascript:void(0)" class="grey_btn fr ml10" onclick="KindEditor.instances[0].html('');">
<%= l(:label_cancel_with_space) %>
</a>
@ -48,7 +49,7 @@
<% comments.each do |comment| %>
<% next if comment.new_record? %>
<div class="ping_C mb10">
<div class="ping_dispic"><%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author)%></div>
<div><%= link_to image_tag(url_to_avatar(comment.author),:width => 42,:height => 42), user_path(comment.author), :class => "problem_pic fl"%></div>
<div class="ping_discon">
<div class="ping_distop upload_img break_word">
<%= 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 -%>

View File

@ -1,7 +1,7 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<li>
<label><span class="c_red">*</span>&nbsp;<%= l(:field_title) %>&nbsp;&nbsp;</label>
<input type="text" name="news[title]" class="hwork_input_news" id="news_title" width="576px" onkeyup="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>">
<input type="text" name="news[title]" class="hwork_input_news" id="news_title" width="576px" onblur="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>">
<p id="title_notice_span" class="ml55"></p>
</li>
<li class="mb10">

View File

@ -12,14 +12,6 @@
<p style="padding-right: 20px;">
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:0px;" %>
</p><!--by young-->
<p>
<%#= f.text_field :enterprise_name, :size => 60, :style => "width:490px;" %>
<label for="project_description">
<%= l(:field_enterprise_name)%>
<span class="required">&nbsp;&nbsp;</span>
</label>
<%= select_tag :organization_id,options_for_select(project_organizations_id_option,@project.organization_id),{} %>
</p>
<p style="display: none" >
<%= 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('+','')}" %>

View File

@ -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("创建成功");

View File

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

View File

@ -19,11 +19,6 @@
<textarea class="w543" id="project_description" name="project[description]" rows="8" placeholder="最多3000个汉字(或6000个英文字符)"><%= @project.description%></textarea>
<div class="cl"></div>
</li>
<li >
<label class="label02">&nbsp;组织&nbsp;&nbsp;</label>
<%= select_tag :organization_id,options_for_select(project_organizations_id_option,@project.organization_id),{} %>
</li>
<div class="cl"></div>
<li >
<label class="label02">公开&nbsp;&nbsp;</label>
<input id="project_is_public" name="project[is_public]" type="checkbox" <%= @project.is_public ? "checked" : ""%>>

View File

@ -59,7 +59,7 @@
</a>
<div class="cl"></div>
<%= 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| %>
<div id="pro_st_edit_ku" class="pro_st_edit_ku">
<ul>
<li >
@ -79,6 +79,8 @@
</li>
<% end %>
<li >
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label class="label02"><span class="c_red">*</span><%=l(:label_repository_name)%></label>
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>"", :no_label => true %>
<% unless @repository.identifier_frozen? %>
@ -87,7 +89,7 @@
</li>
<li >
<label class="label02"><span class="c_red">*</span><%=l(:label_password)%></label>
<%= f.password_field :upassword, :label=> "", :no_label => true %>
<%= f.password_field :upassword, :label=> "", :no_label => true%>
<span class="c_grey"><%= l(:label_upassword_info)%></span>
</li>
<div class="cl"></div>

View File

@ -0,0 +1,31 @@
<div class="BluePopupBox" id="popbox02">
<%= labelled_form_for(Project.new,:remote => "true") do |f| %>
<h2 class="BluePopuph2 fl">新建项目</h2>
<div class="cl"></div>
<div class="">
<div class="mt10 mb10">
<input type="text" class="none" />
<input class="InputBox W700" placeholder="项目名称" name="project[name]" id="project_name" onkeyup="regex_project_name();" />
<p id="project_name_error_msg" class="c_red"></p>
</div>
<div class="mb10">
<textarea class="InputBox W700" placeholder="项目描述" id="project_description" name="project[description]" onkeyup="regex_project_desc();"></textarea>
<p id="project_desc_error_msg" class="c_red"></p>
<script>
var text = document.getElementById("project_description");
autoTextarea(text);// 调用
</script>
</div>
<div class="fl">
<input type="checkbox" name="project[is_public]" class="mt5" checked value="1" /><label class=" ml5 ">公开</label>
</div>
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_project();">确定</a>
<span class="fr mr10 mt3">或</span>
<a href="javascript:void(0);" class=" fr mr10 mt3" onclick="clickCanel();">取消</a>
<div class="cl"></div>
</div>
<% end%>
<div class="cl"></div>
</div><!----BluePopupBox end-->

View File

@ -25,40 +25,44 @@
</li>
<% if @is_teacher%>
<li ><span class="tit_fb ">测试结果:</span>
<table class="border_ce" cellpadding="0" cellspacing="0">
<tbody>
<tr class=" b_lblue fb c_w">
<td class="td_tit ">输入</td>
<td class="td_tit border_l ">输出</td>
<td class="td_50 border_l ">测试结果</td>
</tr>
<%@homework.homework_tests.each do |test|%>
<tr class="<%= cycle("", "b_grey") %>">
<td class="td_tit hidden">
<%= test.input%>
</td>
<td class="td_tit border_l hidden">
<%= test.output%>
</td>
<% student_work_test = StudentWorkTest.where(:homework_test_id => test.id,:student_work_id => @work.id).first%>
<td class="td_50 c_red border_l"><%= student_work_test.nil? ? "正在编译" : student_work_test.status_to_s%></td>
<input type="hidden" value="<%= student_work_test.result if student_work_test%>">
</tr>
<% end%>
<% student_work_test = @work.student_work_test.first%>
<% if student_work_test && student_work_test.error_msg && !student_work_test.error_msg.empty?%>
<tr class="border_t" >
<td colspan="3" class="td_end" >
<%= student_work_test.error_msg%>
</td>
</tr>
<% end%>
</tbody>
</table>
<div class="cl"></div>
<li>
<span class="tit_fb ">
测试结果:
</span>
<div class="show_hwork_p break_word">
<% @work.student_work_tests.each_with_index do |test, index| %>
<div class="ProResultTop">
<p class="c_blue fl">第<%= @work.student_work_tests.count - index%>次测试</p><span class="fr c_grey"><%= test.created_at.to_s(:db) %></span>
<div class="cl"></div>
</div>
<% if test.status.to_i == -2 %>
<div class="ProResultCon "><%= test.results.first %></div>
<% else %>
<div class="ProResultTable " >
<ul class="ProResultUl " >
<% test.results.each_with_index do |x, i| %>
<li >
<span class="w60 T_C">测试<%=i+1%></span>
<% if x["status"].to_i != 0 %>
<span class="w150 c_red">测试错误!</span>
<span class="w60">您的输出:</span>
<span class="W200"><%=x["result"]%></span>
<span class="w60">正确输出:</span>
<span class="W200"><%=x["output"]%></span>
<div class="cl"></div>
<% else %>
<span class="w150 c_green">测试正确!</span>
<div class="cl"></div>
<% end %>
</li>
<% end %>
</ul>
</div>
<% end %>
<% end %>
</div>
</li>
<!-- 编程作业老师才可以评分 -->
<div id="add_student_score_<%= @work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>

View File

@ -123,7 +123,7 @@
<%= @homework.name%>
</h4>
<% if @is_teacher%>
<%= homework_anonymous_comment(@homework)%>
<%#= homework_anonymous_comment(@homework)%>
<% else%>
<%= student_anonymous_comment @homework %>
<%= student_new_homework @homework %>

View File

@ -9,12 +9,18 @@
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#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("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","30%").css("left","20%").css("position","fixed");
}
</script>
<div class="homepageRightBanner mb10">
@ -75,6 +81,18 @@
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false} %>
</div>
<div class="mt5 fl">
<a href="javascript:void(0);" class="RalationIcon fl mt3" onclick="show_project();">关联项目</a>
</div>
<div class="cl"></div>
<div class="mt10 none" id="about_project">
<%= 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 => "快速创建"%>
<a class=" ml5 mt5 SetUpIcon fl" href="javascript:void(0)" title="快速创建" onclick="new_project();"></a>
<div class="cl"></div>
</div>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="new_student_work();">确定</a>
<span class="fr mr10 mt3">或</span>
@ -83,4 +101,4 @@
<div class="cl"></div>
<% end%>
</div><!----HomeWorkCon end-->
</div>
</div>

View File

@ -0,0 +1,3 @@
<% @system_messages.each do |sm| %>
<ul><li><%= sm.content %></li></ul>
<% end %>

View File

@ -2,7 +2,8 @@
<% if @tags.size > 0 %>
<% @tags.each do |tag| %>
<span class="re_tag f_l"> <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
<span class="re_tag f_l"> <%#= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
<a ondblclick="rename_tag($(this),'<%= tag %>',<%= obj.id%>,<%= object_flag%>);"><%= tag %></a>
<!-- 对用户主页 是本人 ,对项目,需求,问题是管理员 -->
<% case object_flag %>
<% when '10' %>

View File

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

View File

@ -48,7 +48,7 @@
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<% count=0 %>
<div class="homepagePostReplyBannerCount">回复(
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
@ -75,7 +75,7 @@
<% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>2 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= 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 => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">

View File

@ -27,7 +27,7 @@
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<% count=activity.comments.count %>
<div class="homepagePostReplyBannerCount">
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">
回复(<%= count %>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
@ -48,7 +48,7 @@
<% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 2 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= 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 => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">

View File

@ -1,177 +0,0 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
<% if @news.commentable? %>
<div class="msg_box fl">
<h4><%= l(:label_comment_add) %></h4>
<%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %>
<div class="box" id="news_comment">
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%>
</div>
<p class="mt10">
<a href="javascript:void(0)" class="grey_btn fr ml10" onclick="KindEditor.instances[0].html('');">
<%= l(:label_cancel_with_space) %>
</a>
<a href="javascript:void(0)" class="blue_btn fr" onclick="submitComment();">
<%= l(:label_comment_with_space) %>
</a>
</p>
<% end %>
</div>
<% end %>
<div class="homepagePostReplyInputContainer" id='leave-message' nhname="new_message">
<%= 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' %>
<textarea class="homepagePostReplyInput" nhname="new_message_textarea" name="new_form[course_message]" placeholder="请输入回复"></textarea>
<p nhname="contentmsg"></p>
<% end %>
<div class="cl"></div>
<div>
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
<a href="javascript:void(0)" class="grey_btn fr ml10 mt10" nhname="cancel_btn">取&nbsp;&nbsp;消</a>
<a href="javascript:void(0)" onclick='$("#leave_message_form").submit();' class="blue_btn fr mt10">
发送
</a>
</div>
</div>
<div class="cl"></div>
<script type="text/javascript">
$(function(){
function init_editor(params){
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",height:"45px",
items:['emoticons'],
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
},
afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.div_form);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar);
}
}).loadPlugin('paste');
return editor;
}
function nh_check_field(params){
var result=true;
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync();
if(params.content.isEmpty()){
params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'});
}else{
params.contentmsg.html('填写正确');
params.contentmsg.css({color:'#008000'});
}
params.contentmsg.show();
}
}
return result;
}
function init_form(params){
params.form.submit(function(){
var flag = false;
if(params.form.attr('data-remote') != undefined ){
flag = true
}
var is_checked = nh_check_field({
issubmit:true,
content:params.editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
if(flag){
return true;
}else{
$(this)[0].submit();
return false;
}
}
return false;
});
}
function nh_reset_form(params){
params.form[0].reset();
params.textarea.empty();
if(params.editor != undefined){
params.editor.html(params.textarea.html());
}
params.contentmsg.hide();
}
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent('div').parent('div');
params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
});
}
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
}
},300);
params.textarea.data('init',1);
});
$("div[nhname='new_message']").each(function(){
var params = {};
params.kindutil = K;
params.div_form = $(this);
params.form = $("form",params.div_form);
if(params.form==undefined || params.form.length==0){
return;
}
params.textarea = $("textarea[nhname='new_message_textarea']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
$("a[nhname='cancel_btn']",params.div_form).click(function(){
nh_reset_form(params);
});
params.textarea.data('init',1);
}
});
});
});
</script>
<!--
<textarea class="homepagePostReplyInput" placeholder="请输入回复"></textarea>
<div class="homepagePostReplyEmotion"><a href="javascript:void(0);" class="replyGrey">表情</a></div>
<div class="homepagePostReplyCancel"><a href="javascript:void(0);" class="postReplyCancel">取消</a>
</div>
<div class="homepagePostReplySubmit"><a href="javascript:void(0);" class="postReplySubmit">发送</a>
</div>-->

View File

@ -67,7 +67,7 @@
<div class="homepagePostReplyBanner">
<% count = activity.journals.count %>
<div class="homepagePostReplyBannerCount">回复(<%= count %></div>
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(<%= count %></div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<% if count > 2 %>
<div class="homepagePostReplyBannerMore">
@ -86,7 +86,7 @@
<% replies_all_i=replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>2 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= 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 => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
@ -97,17 +97,14 @@
<% end %>
<%= format_time(reply.created_on) %>
</div>
<% if reply.details.any? %>
<% details_to_strings(reply.details).each do |string| %>
<div class="homepagePostReplyContent break_word">
<%= string %>
</div>
<% end %>
<% else %>
<div class="homepagePostReplyContent break_word">
<%= reply.notes.html_safe %>
</div>
<% end %>
<div class="homepagePostReplyContent break_word">
<% if reply.details.any? %>
<% details_to_strings(reply.details).each do |string| %>
<p><%= string %></p>
<% end %>
<% end %>
<P><%= reply.notes.html_safe %></P>
</div>
</div>
<div class="cl"></div>
</li>

View File

@ -39,7 +39,7 @@
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<% count = 0 %>
<div class="homepagePostReplyBannerCount">回复(
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
@ -62,7 +62,7 @@
<% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>2 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= 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 => "用户头像" %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">

View File

@ -59,8 +59,8 @@
</ul>
</div>
<div>
<div class="courseSendSubmit"><a href="javascript:void(0);" onclick="$(this).parent().parent().parent().submit();" class="sendSourceText">确定</a></div>
<div class="courseSendCancel"><a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a></div>
<a href="javascript:void(0);" onclick="$(this).parent().parent().submit();" class="db courseSendSubmit sendSourceText">确定</a>
<a href="javascript:void(0);" onclick="hideModal();" class="db courseSendCancel sendSourceText">取消</a>
</div>
<div class="cl"></div>
<% end %>

View File

@ -11,6 +11,7 @@
.ke-inline-block{display: none;}
div.ke-container{float:left;}
</style>
<% first_user_activity = user_activities.first.id %>
<% user_activities.each do |user_activity|
if user_activities %>
<script>
@ -30,6 +31,10 @@
}
}
function expand_reply_input(id) {
$(id).toggle();
}
$(function() {
init_KindEditor_data(<%= user_activity.id%>,"30px","85%");
});
@ -40,22 +45,22 @@
<% if act %>
<% case user_activity.act_type.to_s %>
<% when 'HomeworkCommon' %>
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
<% when 'News' %>
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
<% when 'Message'%>
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
<% when 'Poll' %>
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
<% end %>
<% end %>
<% when 'Project' %>
<% if act %>
<% case user_activity.act_type.to_s %>
<% when 'Issue' %>
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
<% when 'Message' %>
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:first_user_activity =>first_user_activity,:page => page} %>
<% end %>
<% end %>
<% end %>

View File

@ -48,10 +48,10 @@
<div class="mt5 fl">
<!-- , user_import_resource_user_path(User.current.id,:homework_id=>container.id) -->
<a href="javascript:void(0);" class="AnnexBtn fl mt3" onclick="$('#_file').click();">上传附件</a>
<%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mr15 mt3",:remote => true%>
<%= link_to "资源库",{:controller => 'users',:action=>'user_import_resource',:id=>User.current.id,:homework_id=>container.id},:class => "FilesBtn fl mt3",:remote => true%>
<% if defined?(has_program) && has_program %>
<a href="javascript:void(0);" class="ProBtn fl mt3">编程</a>
<span class="fl C_lgrey mt3 program_detail_info"></span>
<a href="javascript:void(0);" class="ProBtn fl mt3">编程</a>
<span class="fl C_lgrey mt3 program_detail_info"></span>
<% end %>
</div>

View File

@ -1,11 +1,16 @@
<% content_for :header_tags do %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg'%>
<%= javascript_include_tag 'homework','baiduTemplate' %>
<script type="text/javascript">
$(function(){
$("#BluePopupBox a.BlueCirBtn").click();
});
</script>
<% end %>
<div class="HomeWorkCon">
<div>
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox w701" maxlength="255" onfocus="$('#homework_editor').show()" onkeyup="regex_homework_name();" placeholder="请输入作业标题" value="<%= homework.name%>" >
<input type="text" name="homework_common[name]" id="homework_name" class="InputBox w701" maxlength="255" onfocus="$('#homework_editor').show()" onkeyup="regex_homework_name();" placeholder="发布作业,输入作业标题" value="<%= homework.name%>" >
<p id="homework_name_span" class="c_red mt5"></p>
</div>
<div class="cl"></div>
@ -57,7 +62,7 @@
<div class="cl"></div>
</div>
<input type="hidden" name="homework_type" value="1">
<input type="hidden" name="homework_type" value="<%= edit_mode ? homework.homework_type : 1 %>">
</div>
</div>
@ -83,28 +88,6 @@
</script>
<div class="BluePopupBox" id="BluePopupBox" style="display:none">
<a href="javascript:void(0);" class="CloseBtn" title="关闭弹框"></a>
<h2 class="BluePopuph2 fl">编程作业的测试集设置</h2>
<div class="cl"></div>
<div class="HomeWorkCon">
<div class="mt15">
<select class="InputBox W120 language_type" >
<option value="1" selected>C语言</option>
<option value="2">C++</option>
</select>
</div>
<div class="mt10">
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" id="textarea_input_test"></textarea><textarea class="InputBox W320 fl mr5" placeholder="测试输出"></textarea>
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
<div class="cl"></div>
</div>
<div class="mt10">
<a href="javascript:void(0);" class="BlueCirBtn fr">确&nbsp;&nbsp;定</a>
<div class="cl"></div>
</div>
</div><!----HomeWorkCon end-->
</div><!----BluePopupBox end-->
<div class="BluePopupBox" id="BluePopupBox" style="display:none">
<%= render :partial => 'users/user_programing_attr', :locals => {:edit_mode => edit_mode, :homework=>homework} %>
</div><!----BluePopupBox end-->

View File

@ -47,6 +47,9 @@
<li>
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework_common),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
</li>
<li>
<%= homework_anonymous_comment homework_common %>
</li>
</ul>
</li>
</ul>

View File

@ -0,0 +1,36 @@
<a href="javascript:void(0);" class="CloseBtn" title="关闭弹框"></a>
<h2 class="BluePopuph2 fl">编程作业的测试集设置</h2>
<div class="cl"></div>
<div class="HomeWorkCon">
<div class="mt15">
<select class="InputBox W120 language_type" >
<%= options_for_select({"C语言"=>1, "C++"=>2}, (edit_mode && homework.is_program_homework?) ? homework.language : 1) %>
</select>
</div>
<% if edit_mode && homework.is_program_homework? %>
<% homework.homework_tests.each_with_index do |test, index| %>
<div class="mt10">
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" id="textarea_input_test"><%= test.input %></textarea>
<textarea class="InputBox W320 fl mr5" placeholder="测试输出"><%= test.output %></textarea>
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class=" fl icon_remove" title="删除测试组"></a>
<% end %>
<div class="cl"></div>
</div>
<% end %>
<% else %>
<div class="mt10">
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" id="textarea_input_test"></textarea>
<textarea class="InputBox W320 fl mr5" placeholder="测试输出"></textarea>
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
<div class="cl"></div>
</div>
<% end %>
<div class="mt10">
<a href="javascript:void(0);" class="BlueCirBtn fr">确&nbsp;&nbsp;定</a>
<div class="cl"></div>
</div>
</div><!----HomeWorkCon end-->

View File

@ -70,11 +70,15 @@
<div class="mt15">
<span>请使用 <%= @homework.language_name %> 语言编写</span>
</div>
<div class="mt10">
<div class="mt10">
<%= f.text_area :name, id: 'program-title', class:"InputBox W700", placeholder:"请概括你的代码的功能" %>
</div>
<div class="mt10">
<%= f.text_area :description, id: 'program-src', class:"InputBox W700 H150", placeholder:"请贴入你的代码", rows: 10 %>
<script>
var text = document.getElementById("program-src");
autoTextarea(text);// 调用
</script>
</div>
<div class="mt10">
<a href="javascript:void(0);" class="BlueCirBtn fl" data-homework-id="<%=@homework.id%>" data-student-work-id="<%=@student_work.id%>" id="test-program-btn">测试代码</a>

View File

@ -1,279 +0,0 @@
<div class="resources">
<div class="homepageRightBanner">
<div class="NewsBannerName">最新动态</div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="homepagePostType">
<li>
<ul class="homepagePostTypeHomework fl">
<li class="f14">课程动态</li>
<li><a href="javascript:void(0);" class="homepagePostTypeAssignment postTypeGrey">作业动态</a></li>
<li><a href="javascript:void(0);" class="homepagePostTypeNotice postTypeGrey">通知动态</a></li>
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>
<!--<li><a href="javascript:void(0);" class="homepagePostTypeQuiz postTypeGrey">问卷动态</a></li>-->
</ul>
</li>
<li>
<ul class="homepagePostTypeProject fl">
<li class="f14">项目动态</li>
<li><a href="javascript:void(0);" class="homepagePostTypeQuestion postTypeGrey">问题动态</a></li>
<li><a href="javascript:void(0);" class="homepagePostTypeForum postTypeGrey">论坛动态</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="homepagePostBrief" onmouseover="$('.homepagePostSetting').css('visibility','visible')" onmouseout="$('.homepagePostSetting').css('visibility','hidden')">
<div class="homepagePostPortrait">
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="50" height="50" alt="用户头像"/></a></div>
<div class="homepagePostDes">
<div class="homepagePostTo"><a href="javascript:void(0);" class="newsBlue mr15">尹教授</a> TO
<a href="javascript:void(0);" class="newsBlue ml15">分布式计算环境(课程名称)</a></div>
<div class="homepagePostTitle">
<a href="javascript:void(0);" class="postGrey">ckeditor值设置的默认在光标聚焦控件后应自动消失的处理作业名称</a></div>
<div class="homepagePostSubmitContainer">
<div class="homepagePostSubmit"><a href="javascript:void(0);" class="c_blue">提交10</a></div>
<div class="homepagePostDeadline">截止时间2015-08-20</div>
</div>
<div class="homepagePostIntro">作业描述系统中有多个ckeditor且每个ckeditor的id未知怎么样做到当光标聚焦某个ckeditor的文本框中该编辑器的默认值应自动消失的处理网络拓扑图开发</div>
<div class="homepagePostSetting" style="visibility: hidden">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li><a href="javascript:void(0);" class="postOptionLink">编辑</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">复制</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="cl"></div>
</div>
</div>
<div class="resources mt15">
<div class="homepagePostBrief" onmouseover="$('.homepagePostSetting').css('visibility','visible')" onmouseout="$('.homepagePostSetting').css('visibility','hidden')">
<div class="homepagePostPortrait">
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="50" height="50" alt="用户头像"/></a></div>
<div class="homepagePostDes">
<div class="homepagePostTo"><a href="javascript:void(0);" class="newsBlue mr15">尹教授</a> TO
<a href="javascript:void(0);" class="newsBlue ml15">分布式计算环境(课程名称)</a></div>
<div class="homepagePostTitle">
<a href="javascript:void(0);" class="postGrey">ckeditor值设置的默认在光标聚焦控件后应自动消失的处理作业名称</a></div>
<div class="homepagePostSubmitContainer">
<div class="homepagePostSubmit"><a href="javascript:void(0);" class="c_blue">提交10</a></div>
<div class="homepagePostDeadline">截止时间2015-08-20</div>
</div>
<div class="homepagePostIntro">作业描述系统中有多个ckeditor且每个ckeditor的id未知怎么样做到当光标聚焦某个ckeditor的文本框中该编辑器的默认值应自动消失的处理网络拓扑图开发</div>
<div class="homepagePostSetting" style="visibility: hidden">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li><a href="javascript:void(0);" class="postOptionLink">编辑</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">复制</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="cl"></div>
</div>
</div>
<!-- <div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复5</div>
<div class="homepagePostReplyBannerTime">2015-07-28</div>
<div class="homepagePostReplyBannerMore"><a href="javascript:void(0);" class="replyGrey">点击展开更多回复</a></div>
</div>
<div class="homepagePostReplyInputContainer">
<textarea class="homepagePostReplyInput" placeholder="请输入回复"></textarea>
</div>
<div class="homepagePostReplyInputContainer">
<div class="homepagePostReplyEmotion"><a href="javascript:void(0);" class="replyGrey">表情</a></div>
<div class="homepagePostReplyCancel"><a href="javascript:void(0);" class="postReplyCancel">取消</a></div>
<div class="homepagePostReplySubmit"><a href="javascript:void(0);" class="postReplySubmit">发送</a></div>
<div class="cl"></div>
</div>
<div class="homepagePostReplyContainer">
<div class="homepagePostReplyPortrait"><a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="45" height="45" alt="用户头像" /></a></div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"><a href="javascript:void(0);" class="newsBlue mr10 f14">尹教授</a> 2015-08-01<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a><a href="javascript:void(0);" class="newsBlue fr">回复</a></div>
<div class="homepagePostReplyContent">请大家说下软件工程是什么!</div>
</div>
<div class="cl"></div>
</div>
<div class="homepagePostReplyContainer">
<div class="homepagePostReplyPortrait"><a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="45" height="45" alt="用户头像" /></a></div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"><a href="javascript:void(0);" class="newsBlue mr10 f14">Tang 学生</a> 2015-08-02<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a><a href="javascript:void(0);" class="newsBlue fr">回复</a></div>
<div class="homepagePostReplyContent">软件工程是一门研究用工程化方法构建和维护有效的、实用的和高质量的软件的学科。它涉及程序设计语言、数据库、软件开发工具、系统平台、标准、设计模式等方面。</div>
<div class="homepagePostReplyInputContainer2">
<textarea class="homepagePostReplyInput2" placeholder="请输入回复"></textarea>
</div>
<div class="homepagePostReplyInputContainer2 mb10">
<div class="homepagePostReplyEmotion"><a href="javascript:void(0);" class="replyGrey">表情</a></div>
<div class="homepagePostReplyCancel"><a href="javascript:void(0);" class="postReplyCancel">取消</a></div>
<div class="homepagePostReplySubmit"><a href="javascript:void(0);" class="postReplySubmit">发送</a></div>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>
</div>
<div class="homepagePostReplyContainer borderBottomNone">
<div class="homepagePostReplyPortrait"><a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="45" height="45" alt="用户头像" /></a></div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"><a href="javascript:void(0);" class="newsBlue mr15 f14">尹教授</a><span class="f14">回复</span><a href="javascript:void(0);" class="newsBlue mr10 ml15 f14">Tang学生</a>刚刚<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a><a href="javascript:void(0);" class="newsBlue fr">回复</a></div>
<div class="homepagePostReplyContent">回答非常好!</div>
</div>
<div class="cl"></div>
</div>
</div>-->
<div class="resources mt15">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="50" height="50" alt="用户头像"/></a></div>
<div class="homepagePostDes">
<div class="homepagePostTo"><a href="javascript:void(0);" class="newsBlue mr15">尹教授</a> TO
<a href="javascript:void(0);" class="newsBlue ml15 mr5">黄井泉</a><span class="c_blue"></span><a href="javascript:void(0);" class="newsBlue ml5">陈正东</a>
</div>
<div class="homepagePostTitle"><a href="javascript:void(0);" class="postGrey">假期开心吗?(讨论区内容)</a></div>
<div class="homepagePostDate">
时间2015-07-31
</div>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li><a href="javascript:void(0);" class="postOptionLink">编辑</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">复制</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="cl"></div>
</div>
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复5</div>
<div class="homepagePostReplyBannerTime">2015-07-31</div>
<div class="homepagePostReplyBannerMore"><a href="javascript:void(0);" class="replyGrey">点击展开更多回复</a></div>
</div>
<div class="homepagePostReplyInputContainer">
<textarea class="homepagePostReplyInput" placeholder="请输入回复"></textarea>
</div>
<div class="homepagePostReplyInputContainer">
<div class="homepagePostReplyEmotion"><a href="javascript:void(0);" class="replyGrey">表情</a></div>
<div class="homepagePostReplyCancel"><a href="javascript:void(0);" class="postReplyCancel">取消</a></div>
<div class="homepagePostReplySubmit"><a href="javascript:void(0);" class="postReplySubmit">发送</a></div>
<div class="cl"></div>
</div>
<div class="homepagePostReplyContainer">
<div class="homepagePostReplyPortrait">
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="45" height="45" alt="用户头像"/></a>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"><a href="javascript:void(0);" class="newsBlue mr10 f14">黄井泉 学生</a>
2015-08-01<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a><!--<a href="javascript:void(0);" class="newsBlue fr">回复</a>-->
</div>
<div class="homepagePostReplyContent">很开心!</div>
</div>
<div class="cl"></div>
</div>
<div class="homepagePostReplyContainer borderBottomNone">
<div class="homepagePostReplyPortrait">
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="45" height="45" alt="用户头像"/></a>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"><a href="javascript:void(0);" class="newsBlue mr10 f14">陈正东 学生</a>
2015-08-02<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a><!--<a href="javascript:void(0);" class="newsBlue fr">回复</a>-->
</div>
<div class="homepagePostReplyContent">假期好热,没出去。</div>
</div>
<div class="cl"></div>
</div>
</div>
</div>
<div class="resources mt15">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="50" height="50" alt="用户头像"/></a></div>
<div class="homepagePostDes">
<div class="homepagePostTo"><a href="javascript:void(0);" class="newsBlue mr15">尹教授</a> TO
<a href="javascript:void(0);" class="newsBlue ml15">Trustie Forge项目名称</a></div>
<div class="homepagePostTitle">
<a href="javascript:void(0);" class="postGrey">上传资源未显示在项目动态中(缺陷标题)</a><span class="homepagePostProjectState">正常</span>
</div>
<div class="homepagePostSubmitContainer">
<div class="homepagePostAssignTo">指派给&nbsp;&nbsp;<a href="javascript:void(0);" class="newsBlue mr15">苏稳</a>
</div>
<div class="homepagePostDeadline">时间2015-08-20</div>
</div>
<div class="homepagePostIntro">缺陷描述系统中有多个ckeditor且每个ckeditor的id未知怎么样做到当光标聚焦某个ckeditor的文本框中该编辑器的默认值应自动消失的处理网络拓扑图开发</div>
<div class="mt10">
<a href="javascript:void(0);" class="homepagePostFileAtt newsBlue">文件附件.zip</a><span class="postAttSize">(123KB)</span>
</div>
<div>
<a href="javascript:void(0);" class="homepagePostImageAtt newsBlue">图片附件.png</a><span class="postAttSize">(123KB)</span>
</div>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li><a href="javascript:void(0);" class="postOptionLink">编辑</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">复制</a></li>
<li><a href="javascript:void(0);" class="postOptionLink">删除</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="cl"></div>
</div>
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复5</div>
<div class="homepagePostReplyBannerTime">2015-07-26</div>
<div class="homepagePostReplyBannerMore"><a href="javascript:void(0);" class="replyGrey">点击展开更多回复</a></div>
</div>
<div class="homepagePostReplyInputContainer">
<textarea class="homepagePostReplyInput" placeholder="请输入回复"></textarea>
</div>
<div class="homepagePostReplyInputContainer">
<div class="homepagePostReplyEmotion"><a href="javascript:void(0);" class="replyGrey">表情</a></div>
<div class="homepagePostReplyCancel"><a href="javascript:void(0);" class="postReplyCancel">取消</a></div>
<div class="homepagePostReplySubmit"><a href="javascript:void(0);" class="postReplySubmit">发送</a></div>
<div class="cl"></div>
</div>
<div class="homepagePostReplyContainer">
<div class="homepagePostReplyPortrait">
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="45" height="45" alt="用户头像"/></a>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"><a href="javascript:void(0);" class="newsBlue mr10 f14">尹教授</a>
2015-08-01<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a><!--<a href="javascript:void(0);" class="newsBlue fr">回复</a>-->
</div>
<div class="homepagePostReplyContent">请大家说下软件工程是什么!</div>
</div>
<div class="cl"></div>
</div>
<div class="homepagePostReplyContainer">
<div class="homepagePostReplyPortrait">
<a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="45" height="45" alt="用户头像"/></a>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"><a href="javascript:void(0);" class="newsBlue mr10 f14">Tang 学生</a>
2015-08-01<a href="javascript:void(0);" class="replyGrey fr ml10">删除</a><!--<a href="javascript:void(0);" class="newsBlue fr">回复</a>-->
</div>
<div class="homepagePostReplyContent">软件工程是一门研究用工程化方法构建和维护有效的、实用的和高质量的软件的学科。它涉及程序设计语言、数据库、软件开发工具、系统平台、标准、设计模式等方面。</div>
</div>
<div class="cl"></div>
</div>
</div>
</div>

View File

@ -1,9 +1,11 @@
<div class="homepageRightBanner">
<div class="NewsBannerName">消息</div>
<div class="NewsBannerName"><%= title_for_message(params[:type]) %></div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="newsType">
<li><%= link_to "全部",user_message_path(User.current), :class => "resourcesGrey" %></li>
<li><%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "resourcesGrey" %></li>
<li><%= link_to "用户申请", user_message_path(User.current, :type => 'apply'), :class => "resourcesGrey" %></li>
<%# 课程相关消息 %>
<li><%= link_to "作业消息", user_message_path(User.current, :type => 'homework'), :class => "resourcesGrey" %></li>
<li><%= link_to "课程讨论",user_message_path(User.current, :type => 'course_message'), :class => "resourcesGrey" %></li>
@ -22,19 +24,51 @@
<li><%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "resourcesGrey" %></li>
<%# 系统贴吧 %>
<li><%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %></li>
<%# 系统消息 %>
<li><%= link_to "系统消息", user_message_path(User.current, :type => 'system_messages'), :class => "resourcesGrey" %></li>
</ul>
</li>
</ul>
</div>
<div class="resources mt10" id="users_setting">
<div>
<% if params[:type].nil? %>
<div class="newsReadSetting">
有&nbsp;<span class="c_red"><%= User.current.count_new_message %></span>&nbsp;条未读<a href="javascript:void(0);" class="ml15"><%= link_to "全部设为已读", user_message_path(User.current, :viewed => 'all') %></a>
</div>
<% end %>
<% if @message_alls.count >0 %>
<% if params[:type].nil? || params[:type] == "unviewed" %>
<div class="newsReadSetting">
有&nbsp;<span class="c_red"><%= unviewed_message(@user) %></span>&nbsp;条未读
<% unless (unviewed_message(@user) == 0 || User.current != @user) %>
<a href="javascript:void(0);" class="ml15"><%= link_to "全部设为已读", user_message_path(User.current, :viewed => 'all') %></a>
<% end %>
</div>
<% end %>
<%# 系统消息 %>
<% if params[:type] != 'system_messages' %>
<% @user_system_messages.each do |usm| %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);">
<div class="navHomepageLogo fl">
<%= image_tag("/images/logo.png", width: "30px", height: "30px", class: "mt3") %>
</div>
</a>
</li>
<li class="homepageNewsPubType fl">
<span class="newsBlue homepageNewsPublisher">Trustie平台</span><span class="homepageNewsType fl">发布新消息:</span>
</li>
<li class="homepageNewsContent fl">
<%= 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));"
%>
</li>
<div style="display:none;" class="message_title_red">
<%= usm.content.html_safe %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(usm.created_at).html_safe %> </li>
</ul>
<% end %>
<% end %>
<%# 课程消息 %>
<% unless @message_alls.nil? %>
<% @message_alls.each do |ma| %>
@ -65,7 +99,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "HomeworkCommon" %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status != 1 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了作业:</span></li>
@ -74,6 +108,23 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布的作业:</span></li>
<% if ma.viewed == 0 %>
<li class="homepageHomeworkContent fl">
<%= 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}" %>
</li>
<li class="homepageHomeworkContentWarn fl"> &nbsp;&nbsp; 截止时间快到了!</li>
<% else %>
<li class="homepageNewsContent fl">
<%= 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}" %>
</li>
<% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "Poll" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %></a></li>
@ -131,6 +182,21 @@
<% end %>
<!--项目消息-->
<% if ma.class == ForgeMessage %>
<% if ma.forge_message_type == "AppliedProject" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.user), :width => "30", :height => "30"), user_path(ma.forge_message.user) %></a>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.forge_message.user, user_path(ma.forge_message.user), :class => "newsBlue homepageNewsPublisher" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">申请加入项目:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.project, settings_project_path(:id => ma.project, :tab => "members"), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",:title => "#{ma.project}" %></a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.forge_message_type == "Issue" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
@ -272,6 +338,30 @@
</ul>
<% end %>
<% end %>
<%# 系统消息 %>
<% if ma.class == SystemMessage %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);">
<div class="navHomepageLogo fl">
<%=image_tag("/images/logo.png",width:"30px", height: "30px",class: "mt3")%>
</div>
</a>
</li>
<li class="homepageNewsPubType fl"><span class="newsBlue homepageNewsPublisher" >Trustie平台</span><span class="homepageNewsType fl">发布新消息:</span></li>
<li class="homepageNewsContent fl">
<%= 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));"
%>
</li>
<div style="display:none;" class="message_title_red">
<%= ma.content.html_safe%>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% end %>
<ul class="wlist" style=" border:none; padding-top: 15px;">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>

View File

@ -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();

View File

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

View File

@ -14,3 +14,7 @@ zh:
label_registration_manual_activation: 手动激活帐号
label_registration_automatic_activation: 自动激活帐号
label_system_message: 系统消息
label_admin_message_fail: 消息内容过长!
label_content_blank_fail: 消息内容不能为空!

View File

@ -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存取键已被重置。

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 859 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 859 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 760 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Some files were not shown because too many files have changed in this diff Show More