dev_repository_hjq
huang 10 years ago
commit 59de781b8c

@ -15,11 +15,10 @@ class ActivityNotifysController < ApplicationController
end end
if( query != nil ) if( query != nil )
logger.info('xxoo')
limit = 10; limit = 10;
@obj_count = query.count(); @obj_count = query.count();
@obj_pages = Paginator.new @obj_count,limit,params['page'] @obj_pages = Paginator.new @obj_count,limit,params['page']
list = query.order('id desc').limit(limit).offset(@obj_pages.offset).all(); list = query.order('is_read,id desc').limit(limit).offset(@obj_pages.offset).all();
events=[]; events=[];
for item in list for item in list
event = item.activity; event = item.activity;
@ -29,7 +28,6 @@ class ActivityNotifysController < ApplicationController
end end
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
@controller_name = 'ActivityNotifys' @controller_name = 'ActivityNotifys'
logger.info('aavv')
end end
respond_to do |format| respond_to do |format|
format.html {render :template => 'courses/show', :layout => 'base_courses'} format.html {render :template => 'courses/show', :layout => 'base_courses'}

@ -62,6 +62,16 @@ class AttachmentsController < ApplicationController
render :action => 'file' render :action => 'file'
end end
def pdf?(file)
file.downcase.end_with?(".pdf")
end
def direct_download
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
:type => detect_content_type(@attachment),
:disposition => 'attachment' #inline can open in browser
end
def download def download
# modify by nwb # modify by nwb
# 下载添加权限设置 # 下载添加权限设置
@ -69,20 +79,30 @@ class AttachmentsController < ApplicationController
if candown || User.current.admin? || User.current.id == @attachment.author_id if candown || User.current.admin? || User.current.id == @attachment.author_id
@attachment.increment_download @attachment.increment_download
if stale?(:etag => @attachment.digest) if stale?(:etag => @attachment.digest)
convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".html") if params[:force] == 'true'
if File.exist?(convered_file) direct_download
send_file convered_file, :type => 'text/html; charset=utf-8', :disposition => 'inline'
else else
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), convered_file = @attachment.diskfile
:type => detect_content_type(@attachment), #如果本身不是pdf文件则先寻找是不是已转换化如果没有则转化
:disposition => 'attachment' #inline can open in browser unless pdf?(convered_file)
convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf")
unless File.exist?(convered_file)
office = Trustie::Utils::Office.new(@attachment.diskfile)
office.conver(convered_file)
end
end
if File.exist?(convered_file) && pdf?(convered_file)
send_file convered_file, :type => 'application/pdf; charset=utf-8', :disposition => 'inline'
else
direct_download
end
end end
end end
else else
render_403 :message => :notice_not_authorized render_403 :message => :notice_not_authorized
end end
rescue => e rescue => e
redirect_to "http: //" + (Setting.host_name.to_s) +"/file_not_found.html" redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
end end
#更新资源文件类型 #更新资源文件类型
@ -196,13 +216,13 @@ class AttachmentsController < ApplicationController
if @attachment.container.is_a?(News) if @attachment.container.is_a?(News)
format.html { redirect_to_referer_or news_path(@attachment.container) } format.html { redirect_to_referer_or news_path(@attachment.container) }
elsif @attachment.container.is_a?(StudentWorksScore) elsif @attachment.container.is_a?(StudentWorksScore)
@is_destroy = true #根据ID删除页面对应的数据js刷新页面 @is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据js刷新页面
format.js format.js
elsif @attachment.container.is_a?(HomeworkCommon) elsif @attachment.container.is_a?(HomeworkCommon)
@is_destroy = true #根据ID删除页面对应的数据js刷新页面 @is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据js刷新页面
format.js format.js
elsif @attachment.container.is_a?(StudentWork) elsif @attachment.container.is_a?(StudentWork)
@is_destroy = true #根据ID删除页面对应的数据js刷新页面 @is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据js刷新页面
format.js format.js
elsif @attachment.container.is_a?(Message) elsif @attachment.container.is_a?(Message)
format.html { redirect_to_referer_or new_board_message_path(@attachment.container) } format.html { redirect_to_referer_or new_board_message_path(@attachment.container) }
@ -226,7 +246,7 @@ class AttachmentsController < ApplicationController
end end
format.js format.js
end end
end end
def delete_homework def delete_homework

File diff suppressed because it is too large Load Diff

@ -94,12 +94,12 @@ class MessagesController < ApplicationController
update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE
end end
# 与我相关动态的记录add start # 与我相关动态的记录add start
if(@board.course_id>0) #项目的先不管 if(@board && @board.course) #项目的先不管
teachers = searchTeacherAndAssistant(@board.course); teachers = searchTeacherAndAssistant(@board.course)
for teacher in teachers for teacher in teachers
if(teacher.user_id != User.current.id) if(teacher.user_id != User.current.id)
notify = ActivityNotify.new() notify = ActivityNotify.new()
if(@board.course_id>0) if(@board.course)
notify.activity_container_id = @board.course_id notify.activity_container_id = @board.course_id
notify.activity_container_type = 'Course' notify.activity_container_type = 'Course'
else else
@ -178,7 +178,7 @@ class MessagesController < ApplicationController
end end
# 与我相关动态的记录add start # 与我相关动态的记录add start
if(@board.course_id>0) #项目的先不管 if(@board && @board.course) #项目的先不管
notifyto_arr = {} notifyto_arr = {}
notifyto_arr[@topic.author_id] = @topic.author_id notifyto_arr[@topic.author_id] = @topic.author_id
if( params[:parent_topic] != nil && params[:parent_topic] != '') if( params[:parent_topic] != nil && params[:parent_topic] != '')
@ -188,7 +188,7 @@ class MessagesController < ApplicationController
notifyto_arr.each do |k,user_id| notifyto_arr.each do |k,user_id|
if(user_id != User.current.id) if(user_id != User.current.id)
notify = ActivityNotify.new() notify = ActivityNotify.new()
if(@board.course_id>0) if(@board.course)
notify.activity_container_id = @board.course_id notify.activity_container_id = @board.course_id
notify.activity_container_type = 'Course' notify.activity_container_type = 'Course'
else else

@ -363,7 +363,8 @@ class ProjectsController < ApplicationController
#发送邮件邀请新用户 #发送邮件邀请新用户
def invite_members_by_mail def invite_members_by_mail
if User.current.member_of?(@project) || User.current.admin? if User.current.member_of?(@project) || User.current.admin?
@inviter_lists = InviteList.where(project_id:@project.id).all
@is_zhuce = false @is_zhuce = false
respond_to do |format| respond_to do |format|
format.html format.html

@ -25,7 +25,7 @@ class UsersController < ApplicationController
menu_item :user_course, :only => :user_courses menu_item :user_course, :only => :user_courses
menu_item :user_homework, :only => :user_homeworks menu_item :user_homework, :only => :user_homeworks
menu_item :user_project, :only => [:user_projects, :watch_projects] menu_item :user_project, :only => [:user_projects, :watch_projects]
menu_item :requirement_focus, :only => :watch_bids # menu_item :requirement_focus, :only => :watch_bids
menu_item :requirement_focus, :only => :watch_contests menu_item :requirement_focus, :only => :watch_contests
menu_item :user_newfeedback, :only => :user_newfeedback menu_item :user_newfeedback, :only => :user_newfeedback
@ -36,14 +36,14 @@ class UsersController < ApplicationController
# #
before_filter :can_show_course, :only => [:user_courses,:user_homeworks] before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info, before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_contests, :info,
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index, :user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index] :activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index]
#edit has been deleted by huang, 2013-9-23 #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, 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, :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
:watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index] :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index]
before_filter :auth_user_extension, only: :show before_filter :auth_user_extension, only: :show
@ -141,25 +141,25 @@ class UsersController < ApplicationController
##added by fq ##added by fq
def watch_bids def watch_bids
cond = 'bids.reward_type <> 1' # cond = 'bids.reward_type <> 1'
@bids = Bid.watched_by(@user).where('reward_type = ?', 1) # added by huang # @bids = Bid.watched_by(@user).where('reward_type = ?', 1) # added by huang
@offset, @limit = api_offset_and_limit({:limit => 10}) # @offset, @limit = api_offset_and_limit({:limit => 10})
@bid_count = @bids.count # @bid_count = @bids.count
@bid_pages = Paginator.new @bid_count, @limit, params['page'] # @bid_pages = Paginator.new @bid_count, @limit, params['page']
@offset ||= @bid_pages.reverse_offset # @offset ||= @bid_pages.reverse_offset
unless @offset == 0 # unless @offset == 0
@bid = @bids.offset(@offset).limit(@limit).all.reverse # @bid = @bids.offset(@offset).limit(@limit).all.reverse
else # else
limit = @bid_count % @limit # limit = @bid_count % @limit
@bid = @bids.offset(@offset).limit(limit).all.reverse # @bid = @bids.offset(@offset).limit(limit).all.reverse
end # end
#
respond_to do |format| # respond_to do |format|
format.html { # format.html {
render :layout => 'base_users' # render :layout => 'base_users'
} # }
format.api # format.api
end # end
end end
#new add by linchun #new add by linchun
@ -215,24 +215,24 @@ class UsersController < ApplicationController
# added by huang # added by huang
def user_homeworks def user_homeworks
@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current)) # @membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
@memberships = [] # @memberships = []
@membership.each do |membership| # @membership.each do |membership|
if membership.project.project_type == 1 # if membership.project.project_type == 1
@memberships << membership # @memberships << membership
end # end
end # end
@bid = [] # @bid = []
@memberships.each do |membership| # @memberships.each do |membership|
@bid += membership.project.homeworks # @bid += membership.project.homeworks
end # end
@bid = @bid.group_by {|bid| bid.courses.first.id} # @bid = @bid.group_by {|bid| bid.courses.first.id}
unless User.current.admin? # unless User.current.admin?
if !@user.active? # if !@user.active?
render_404 # render_404
return # return
end # end
end # end
end end
@ -757,7 +757,7 @@ class UsersController < ApplicationController
when '3' then when '3' then
@obj = Issue.find_by_id(@obj_id) @obj = Issue.find_by_id(@obj_id)
when '4' then when '4' then
@obj = Bid.find_by_id(@obj_id) # @obj = Bid.find_by_id(@obj_id)
when '5' then when '5' then
@obj = Forum.find_by_id(@obj_id) @obj = Forum.find_by_id(@obj_id)
when '6' when '6'
@ -800,7 +800,7 @@ class UsersController < ApplicationController
when '3' then when '3' then
@obj = Issue.find_by_id(@obj_id) @obj = Issue.find_by_id(@obj_id)
when '4' then when '4' then
@obj = Bid.find_by_id(@obj_id) # @obj = Bid.find_by_id(@obj_id)
when '5' then when '5' then
@obj = Forum.find_by_id(@obj_id) @obj = Forum.find_by_id(@obj_id)
when '6' when '6'

@ -30,8 +30,7 @@ class ZipdownController < ApplicationController
if file_count > 0 if file_count > 0
zipfile = zip_bid bid zipfile = zip_bid bid
else else
render file: 'public/no_file_found.html' zipfile = {:message => "no file"}
return
end end
elsif params[:obj_class] == "HomeworkCommon" elsif params[:obj_class] == "HomeworkCommon"
homework = HomeworkCommon.find params[:obj_id] homework = HomeworkCommon.find params[:obj_id]
@ -41,8 +40,7 @@ class ZipdownController < ApplicationController
if file_count > 0 if file_count > 0
zipfile = zip_homework_common homework zipfile = zip_homework_common homework
else else
render file: 'public/no_file_found.html' zipfile = {:message => "no file"}
return
end end
else else
logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!" logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!"
@ -62,7 +60,7 @@ class ZipdownController < ApplicationController
unless homework.attachments.empty? unless homework.attachments.empty?
zipfile = zip_homework_by_user homework zipfile = zip_homework_by_user homework
send_file zipfile.file_path, :filename => ((homework.user.user_extensions.nil? || homework.user.user_extensions.student_id.nil?) ? "" : homework.user.user_extensions.student_id) + send_file zipfile.file_path, :filename => ((homework.user.user_extensions.nil? || homework.user.user_extensions.student_id.nil?) ? "" : homework.user.user_extensions.student_id) +
"_" + (homework.user.lastname.nil? ? "" : homework.user.lastname) + (homework.user.firstname.nil? ? "" : homework.user.firstname) + "_" + homework.user.show_name +
"_" + homework.name + ".zip", :type => detect_content_type(zipfile.file_path) if(zipfile) "_" + homework.name + ".zip", :type => detect_content_type(zipfile.file_path) if(zipfile)
else else
render file: 'public/no_file_found.html' render file: 'public/no_file_found.html'
@ -150,7 +148,7 @@ class ZipdownController < ApplicationController
end end
end end
out_file = find_or_pack(homework_attach.bid_id, homework_attach.user_id, digests.sort){ out_file = find_or_pack(homework_attach.bid_id, homework_attach.user_id, digests.sort){
zipping("#{homework_attach.user.lastname}#{homework_attach.user.firstname}_#{((homework_attach.user.user_extensions.nil? || homework_attach.user.user_extensions.student_id.nil?) ? "" : homework_attach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", zipping("#{homework_attach.user.show_name}_#{((homework_attach.user.user_extensions.nil? || homework_attach.user.user_extensions.student_id.nil?) ? "" : homework_attach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file) homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
} }
end end
@ -170,7 +168,7 @@ class ZipdownController < ApplicationController
end end
end end
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){ out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
zipping("#{work.user.lastname}#{work.user.firstname}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", zipping("#{work.user.show_name}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file) homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
} }
end end

@ -72,8 +72,8 @@ class Attachment < ActiveRecord::Base
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails") @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_save :files_to_final_location before_save :files_to_final_location
after_create :office_conver, :be_user_score ,:act_as_forge_activity# user_score after_create :office_conver, :be_user_score,:act_as_forge_activity# user_score
after_update :be_user_score after_update :office_conver, :be_user_score
after_destroy :delete_from_disk,:down_user_score after_destroy :delete_from_disk,:down_user_score
# add by nwb # add by nwb
@ -259,12 +259,14 @@ class Attachment < ActiveRecord::Base
end end
def office_conver def office_conver
saved_path = File.join(Rails.root, "files", "convered_office") # 不在这里做后台转换,换为点击时做转换
unless Dir.exist?(saved_path) # return unless %w(Project Course).include? (self.container_type)
Dir.mkdir(saved_path) # saved_path = File.join(Rails.root, "files", "convered_office")
end # unless Dir.exist?(saved_path)
convered_file = File.join(saved_path, self.disk_filename + ".html") # Dir.mkdir(saved_path)
OfficeConverTask.new.conver(self.diskfile, convered_file) # end
# convered_file = File.join(saved_path, self.disk_filename + ".pdf")
# OfficeConverTask.new.conver(self.diskfile, convered_file)
end end
# Copies the temporary file to its final location # Copies the temporary file to its final location

@ -1,5 +1,13 @@
class InviteList < ActiveRecord::Base class InviteList < ActiveRecord::Base
attr_accessible :project_id, :user_id attr_accessible :project_id, :user_id
# belongs_to :user belongs_to :user
# belongs_to :project belongs_to :project
# 用户拒绝邀请后,删除记录
def self.delete_inviter(userid, projectid)
@inviters = AppliedProject.where("user_id = ? and project_id = ?", userid, projectid)
@inviters.each do |inviter|
inviter.destroy
end
end
end end

@ -58,6 +58,7 @@ class Mailer < ActionMailer::Base
us = UsersService.new us = UsersService.new
# 自动激活用户 # 自动激活用户
user = us.register_auto(login, @email, @password) user = us.register_auto(login, @email, @password)
InviteList.create(:user_id => user.id, :project_id => project.id)
User.current = user unless User.current.nil? User.current = user unless User.current.nil?
@user = user @user = user
@ -73,6 +74,10 @@ class Mailer < ActionMailer::Base
@project_name = "#{project.name}" @project_name = "#{project.name}"
@user = user @user = user
@project = project @project = project
inviter_lists = InviteList.where(project_id:@project.id, user_id:@user.id).all
if inviter_lists.blank?
InviteList.create(:user_id => user.id, :project_id => project.id)
end
@token = Token.get_token_from_user(user, 'autologin') @token = Token.get_token_from_user(user, 'autologin')
@project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value) @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value)
mail :to => email, :subject => @subject mail :to => email, :subject => @subject
@ -83,13 +88,10 @@ class Mailer < ActionMailer::Base
# 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言 # 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言
def send_for_user_activities(user, date_to, days) def send_for_user_activities(user, date_to, days)
date_from = date_to - days.days date_from = date_to - days.days
subject = "[ #{user.show_name}#{l(:label_day_mail)}]" subject = "[ #{user.show_name}#{l(:label_day_mail)}]"
@subject = " #{user.show_name}#{l(:label_day_mail)}" @subject = " #{user.show_name}#{l(:label_day_mail)}"
date_from = "#{date_from} 17:59:59" date_from = "#{date_from} 17:59:59"
date_to = "#{date_to} 17:59:59" date_to = "#{date_to} 17:59:59"
# 生成token用于直接点击登录 # 生成token用于直接点击登录
@user = user @user = user
@token = Token.get_token_from_user(user, 'autologin') @token = Token.get_token_from_user(user, 'autologin')
@ -100,34 +102,32 @@ class Mailer < ActionMailer::Base
project_ids = projects.map{|project| project.id}.join(",") project_ids = projects.map{|project| project.id}.join(",")
course_ids = courses.map {|course| course.id}.join(",") course_ids = courses.map {|course| course.id}.join(",")
# 查询user的缺陷包括发布的跟踪的以及被指派的缺陷 # 查询user的缺陷项目中成员都能收到
sql = "select DISTINCT i.* from issues i, watchers w sql = "select * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
where (i.assigned_to_id = #{user.id} or i.author_id = #{user.id} and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
or (w.watchable_type = 'Issue' and w.watchable_id = i.id and w.user_id = #{user.id}))
and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
@issues = Issue.find_by_sql(sql) @issues = Issue.find_by_sql(sql)
# @bids 查询课程作业包括老师发布的作业以及user提交作业 # @bids 查询课程作业包括老师发布的作业以及user提交作业
# @attachments查询课程课件更新 # @attachments查询课程课件更新
@attachments ||= [] @attachments ||= []
@bids ||= [] # 老师发布的作业 @bids ||= [] # 老师发布的作业
unless courses.first.nil? unless courses.first.nil?
count = courses.count count = courses.count
count = count - 1 count = count - 1
for i in 0..count do for i in 0..count do
bids = courses[i].homeworks.where("bids.created_on between '#{date_from}' and '#{date_to}'").order("bids.created_on desc") bids = courses[i].homeworks.where("bids.created_on between '#{date_from}' and '#{date_to}'").order("bids.created_on desc")
attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC') attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC')
@bids += bids if bids.count > 0 @bids += bids if bids.count > 0
@attachments += attachments if attachments.count > 0 @attachments += attachments if attachments.count > 0
end end
end end
# user 提交的作业 # user 提交的作业
@homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc") @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
# 查询user在课程。项目中发布的讨论帖子 # 查询user在课程。项目中发布的讨论帖子
messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") messages = Message.find_by_sql("select me.* from messages me, boards b, members m where
b.id = me.board_id and b.project_id = m.project_id and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
# messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@course_messages ||= [] @course_messages ||= []
@project_messages ||= [] @project_messages ||= []
unless messages.first.nil? unless messages.first.nil?
@ -139,6 +139,7 @@ class Mailer < ActionMailer::Base
end end
end end
end end
# 查询user在课程中发布的通知项目中发的新闻 # 查询user在课程中发布的通知项目中发的新闻
@course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n
where n.course_id in (#{course_ids}) where n.course_id in (#{course_ids})
@ -151,18 +152,13 @@ class Mailer < ActionMailer::Base
jour_type='Course' and user_id = #{user.id} jour_type='Course' and user_id = #{user.id}
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@user_journal_messages = user.journals_for_messages.where("m_parent_id IS NULL and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC') @user_journal_messages = user.journals_for_messages.where("m_parent_id IS NULL and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC')
# 查询user新建贴吧或发布帖子 # 查询user新建贴吧或发布帖子
@forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc") @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc")
@memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id})) @memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id}))
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc") and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
has_content = [@issues,@homeworks,@course_messages,@project_messages,@course_news,@project_news, has_content = [@issues,@homeworks,@course_messages,@project_messages,@course_news,@project_news,
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| @course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?}
!o.empty?
}
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}" mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
#有内容才发,没有不发 #有内容才发,没有不发
mail :to => user.mail,:subject => subject if has_content mail :to => user.mail,:subject => subject if has_content
@ -277,11 +273,11 @@ class Mailer < ActionMailer::Base
@token = Token.get_token_from_user(user, 'autologin') @token = Token.get_token_from_user(user, 'autologin')
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :token => @token.value) @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :token => @token.value)
# edit # edit
@issue_author_url = url_for(user_activities_url(@author,:token => @token.value)) @issue_author_url = url_for(user_activities_url(@author,:token => @token.value))
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value) @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value)
@user_url = url_for(my_account_url(user,:token => @token.value)) @user_url = url_for(my_account_url(user,:token => @token.value))
subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}" subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
@ -289,13 +285,13 @@ class Mailer < ActionMailer::Base
:subject => subject, :subject => subject,
:filter => true :filter => true
end end
# issue.attachments.each do |attach| # issue.attachments.each do |attach|
# attachments["#{attach.filename}"] = File.read("#{attach.disk_filename}") # attachments["#{attach.filename}"] = File.read("#{attach.disk_filename}")
# end # end
# cc = issue.watcher_recipients - recipients # cc = issue.watcher_recipients - recipients
#mail.attachments['test'] = File.read("#{RAILS.root}/files/2015/01/150114094010_libegl.dll") #mail.attachments['test'] = File.read("#{RAILS.root}/files/2015/01/150114094010_libegl.dll")
# Builds a Mail::Message object used to email recipients of the edited issue. # Builds a Mail::Message object used to email recipients of the edited issue.
@ -324,13 +320,13 @@ class Mailer < ActionMailer::Base
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value) @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value)
@user_url = url_for(my_account_url(user,:token => @token.value)) @user_url = url_for(my_account_url(user,:token => @token.value))
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}", :token => @token.value) @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}", :token => @token.value)
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] " s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] "
s << "(#{issue.status.name}) " if journal.new_value_for('status_id') s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
s << issue.subject s << issue.subject
@issue = issue @issue = issue
@journal = journal @journal = journal
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}") # @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}")
mail :to => recipients, mail :to => recipients,
:subject => s, :subject => s,
:filter => true :filter => true
@ -360,10 +356,10 @@ class Mailer < ActionMailer::Base
@issues = issues @issues = issues
@days = days @days = days
@issues_url = url_for(:controller => 'issues', :action => 'index', @issues_url = url_for(:controller => 'issues', :action => 'index',
:set_filter => 1, :assigned_to_id => user.id, :set_filter => 1, :assigned_to_id => user.id,
:sort => 'due_date:asc') :sort => 'due_date:asc')
mail :to => user.mail, mail :to => user.mail,
:subject => l(:mail_subject_reminder, :count => issues.size, :days => days) :subject => l(:mail_subject_reminder, :count => issues.size, :days => days)
end end
#缺陷到期邮件通知 #缺陷到期邮件通知
@ -494,8 +490,8 @@ class Mailer < ActionMailer::Base
@news = news @news = news
@news_url = url_for(:controller => 'news', :action => 'show', :id => news) @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
mail :to => news.recipients, mail :to => news.recipients,
:subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}", :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
:filter => true :filter => true
elsif news.course elsif news.course
redmine_headers 'Course' => news.course.id redmine_headers 'Course' => news.course.id
@author = news.author @author = news.author
@ -526,9 +522,9 @@ class Mailer < ActionMailer::Base
@comment = comment @comment = comment
@news_url = url_for(:controller => 'news', :action => 'show', :id => news) @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
mail :to => news.recipients, mail :to => news.recipients,
:cc => news.watcher_recipients, :cc => news.watcher_recipients,
:subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}", :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
:filter => true :filter => true
elsif news.course elsif news.course
redmine_headers 'Course' => news.course.id redmine_headers 'Course' => news.course.id
@author = comment.author @author = comment.author
@ -563,9 +559,9 @@ class Mailer < ActionMailer::Base
@message = message @message = message
@message_url = url_for(message.event_url) @message_url = url_for(message.event_url)
mail :to => recipients, mail :to => recipients,
:cc => cc, :cc => cc,
:subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}", :subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
:filter => true :filter => true
elsif message.course elsif message.course
redmine_headers 'Course' => message.course.id, redmine_headers 'Course' => message.course.id,
'Topic-Id' => (message.parent_id || message.id) 'Topic-Id' => (message.parent_id || message.id)
@ -598,12 +594,12 @@ class Mailer < ActionMailer::Base
cc = wiki_content.page.wiki.watcher_recipients - recipients cc = wiki_content.page.wiki.watcher_recipients - recipients
@wiki_content = wiki_content @wiki_content = wiki_content
@wiki_content_url = url_for(:controller => 'wiki', :action => 'show', @wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
:project_id => wiki_content.project, :project_id => wiki_content.project,
:id => wiki_content.page.title) :id => wiki_content.page.title)
mail :to => recipients, mail :to => recipients,
:cc => cc, :cc => cc,
:subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}", :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}",
:filter => true :filter => true
end end
# Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was updated. # Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was updated.
@ -620,15 +616,15 @@ class Mailer < ActionMailer::Base
cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients
@wiki_content = wiki_content @wiki_content = wiki_content
@wiki_content_url = url_for(:controller => 'wiki', :action => 'show', @wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
:project_id => wiki_content.project, :project_id => wiki_content.project,
:id => wiki_content.page.title) :id => wiki_content.page.title)
@wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff', @wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff',
:project_id => wiki_content.project, :id => wiki_content.page.title, :project_id => wiki_content.project, :id => wiki_content.page.title,
:version => wiki_content.version) :version => wiki_content.version)
mail :to => recipients, mail :to => recipients,
:cc => cc, :cc => cc,
:subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}", :subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}",
:filter => true :filter => true
end end
# Builds a Mail::Message object used to email the specified user their account information. # Builds a Mail::Message object used to email the specified user their account information.
@ -642,7 +638,7 @@ class Mailer < ActionMailer::Base
@password = password @password = password
@login_url = url_for(:controller => 'account', :action => 'login') @login_url = url_for(:controller => 'account', :action => 'login')
mail :to => user.mail, mail :to => user.mail,
:subject => l(:mail_subject_register, Setting.app_title) :subject => l(:mail_subject_register, Setting.app_title)
end end
# Builds a Mail::Message object used to email all active administrators of an account activation request. # Builds a Mail::Message object used to email all active administrators of an account activation request.
@ -655,10 +651,10 @@ class Mailer < ActionMailer::Base
recipients = User.active.where(:admin => true).all.collect { |u| u.mail }.compact recipients = User.active.where(:admin => true).all.collect { |u| u.mail }.compact
@user = user @user = user
@url = url_for(:controller => 'users', :action => 'index', @url = url_for(:controller => 'users', :action => 'index',
:status => User::STATUS_REGISTERED, :status => User::STATUS_REGISTERED,
:sort_key => 'created_on', :sort_order => 'desc') :sort_key => 'created_on', :sort_order => 'desc')
mail :to => recipients, mail :to => recipients,
:subject => l(:mail_subject_account_activation_request, Setting.app_title) :subject => l(:mail_subject_account_activation_request, Setting.app_title)
end end
# Builds a Mail::Message object used to email the specified user that their account was activated by an administrator. # Builds a Mail::Message object used to email the specified user that their account was activated by an administrator.
@ -671,7 +667,7 @@ class Mailer < ActionMailer::Base
@user = user @user = user
@login_url = url_for(:controller => 'account', :action => 'login') @login_url = url_for(:controller => 'account', :action => 'login')
mail :to => user.mail, mail :to => user.mail,
:subject => l(:mail_subject_register, Setting.app_title) :subject => l(:mail_subject_register, Setting.app_title)
end end
def lost_password(token) def lost_password(token)
@ -679,7 +675,7 @@ class Mailer < ActionMailer::Base
@token = token @token = token
@url = url_for(:controller => 'account', :action => 'lost_password', :token => token.value) @url = url_for(:controller => 'account', :action => 'lost_password', :token => token.value)
mail :to => token.user.mail, mail :to => token.user.mail,
:subject => l(:mail_subject_lost_password, Setting.app_title) :subject => l(:mail_subject_lost_password, Setting.app_title)
end end
def register(token) def register(token)
@ -687,14 +683,14 @@ class Mailer < ActionMailer::Base
@token = token @token = token
@url = url_for(:controller => 'account', :action => 'activate', :token => token.value) @url = url_for(:controller => 'account', :action => 'activate', :token => token.value)
mail :to => token.user.mail, mail :to => token.user.mail,
:subject => l(:mail_subject_register, Setting.app_title) :subject => l(:mail_subject_register, Setting.app_title)
end end
def test_email(user) def test_email(user)
set_language_if_valid(user.language) set_language_if_valid(user.language)
@url = url_for(:controller => 'welcome') @url = url_for(:controller => 'welcome')
mail :to => user.mail, mail :to => user.mail,
:subject => 'forge test' :subject => 'forge test'
end end
# Overrides default deliver! method to prevent from sending an email # Overrides default deliver! method to prevent from sending an email
@ -702,8 +698,8 @@ class Mailer < ActionMailer::Base
def deliver!(mail = @mail) def deliver!(mail = @mail)
set_language_if_valid @initial_language set_language_if_valid @initial_language
return false if (recipients.nil? || recipients.empty?) && return false if (recipients.nil? || recipients.empty?) &&
(cc.nil? || cc.empty?) && (cc.nil? || cc.empty?) &&
(bcc.nil? || bcc.empty?) (bcc.nil? || bcc.empty?)
# Log errors when raise_delivery_errors is set to false, Rails does not # Log errors when raise_delivery_errors is set to false, Rails does not
@ -735,8 +731,8 @@ class Mailer < ActionMailer::Base
user_ids = options[:users] user_ids = options[:users]
scope = Issue.open.where("#{Issue.table_name}.assigned_to_id IS NOT NULL" + scope = Issue.open.where("#{Issue.table_name}.assigned_to_id IS NOT NULL" +
" AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" + " AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" +
" AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date " AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date
) )
scope = scope.where(:assigned_to_id => user_ids) if user_ids.present? scope = scope.where(:assigned_to_id => user_ids) if user_ids.present?
scope = scope.where(:project_id => project.id) if project scope = scope.where(:project_id => project.id) if project
@ -800,12 +796,12 @@ class Mailer < ActionMailer::Base
def mail(headers={}) def mail(headers={})
headers.merge! 'X-Mailer' => 'Redmine', headers.merge! 'X-Mailer' => 'Redmine',
'X-Redmine-Host' => Setting.host_name, 'X-Redmine-Host' => Setting.host_name,
'X-Redmine-Site' => Setting.app_title, 'X-Redmine-Site' => Setting.app_title,
'X-Auto-Response-Suppress' => 'OOF', 'X-Auto-Response-Suppress' => 'OOF',
'Auto-Submitted' => 'auto-generated', 'Auto-Submitted' => 'auto-generated',
'From' => Setting.mail_from, 'From' => Setting.mail_from,
'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>" 'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>"
# Removes the author from the recipients and cc # Removes the author from the recipients and cc
# if he doesn't want to receive notifications about what he does # if he doesn't want to receive notifications about what he does
@ -851,7 +847,7 @@ class Mailer < ActionMailer::Base
set_language_if_valid Setting.default_language set_language_if_valid Setting.default_language
super super
end end
def self.deliver_mail(mail) def self.deliver_mail(mail)
return false if mail.to.blank? && mail.cc.blank? && mail.bcc.blank? return false if mail.to.blank? && mail.cc.blank? && mail.bcc.blank?
Thread.new do Thread.new do
@ -898,7 +894,7 @@ class Mailer < ActionMailer::Base
end end
def mylogger def mylogger
if Setting.delayjob_enabled? if Setting.delayjob_enabled?
Delayed::Worker.logger Delayed::Worker.logger
else else
Rails.logger Rails.logger

@ -67,7 +67,7 @@ class Project < ActiveRecord::Base
has_many :student, :through => :students_for_courses, :source => :user has_many :student, :through => :students_for_courses, :source => :user
has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy
has_many :applied_projects has_many :applied_projects
# has_many :invite_lists has_many :invite_lists
# end # end
#ADDED BY NIE #ADDED BY NIE

@ -277,15 +277,18 @@ class User < Principal
end end
def show_name def show_name
name = ""
unless self.user_extensions.nil? unless self.user_extensions.nil?
if self.user_extensions.identity == 2 if self.user_extensions.identity == 2
firstname name = firstname
else else
lastname+firstname name = lastname+firstname
end end
else else
lastname+firstname name = lastname+firstname
end end
name = name.empty? || name.nil? ? login : name
name
end end
## end ## end

@ -255,7 +255,9 @@ class UsersService
watcher.push(params[:user_id]) watcher.push(params[:user_id])
scope = scope.where("id not in (?)",watcher) scope = scope.where("id not in (?)",watcher)
end end
scope = scope.like(params[:name],search_by) #scope = scope.like(params[:name],search_by)
scope = scope.where("( LOWER(login) LIKE ? or LOWER(concat(lastname, firstname)) LIKE ? or LOWER(mail) LIKE ? )",
"%#{params[:name]}%","%#{params[:name]}%","%#{params[:name]}%")
end end
#modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end #modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end
else else

@ -1,11 +1,11 @@
<style type="text/css"> <style type="text/css">
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;} /*div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;} span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )} span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;} div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;} span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;} span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;} div.ke-toolbar .ke-outline{border:none;}*/
.break_word {width:100%;} .break_word {width:100%;}
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
@ -33,7 +33,8 @@
else if (window.attachEvent) else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus) window.attachEvent("onload", buildsubmenus)
</script> </script>
<%= javascript_include_tag "/assets/kindeditor/kindeditor-min" %> <%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%#= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
<% if @project %> <% if @project %>
<%= render :partial => 'project_show', locals: {project: @project} %> <%= render :partial => 'project_show', locals: {project: @project} %>
@ -123,21 +124,20 @@ function nh_init_board(params){
if(params.textarea.data('init') == undefined){ if(params.textarea.data('init') == undefined){
//初始化编辑器 //初始化编辑器
var editor = params.kindutil.create(params.textarea, { var editor = params.kindutil.create(params.textarea, {
resizeType : 1, // allowPreviewEmoticons : false,
allowPreviewEmoticons : false, // allowImageUpload : false,
allowImageUpload : false, resizeType : 1,minWidth:"1px",width:"565px",height:"150px",
minWidth:"1px", allowFileManager:true,uploadJson:"/kindeditor/upload",
width:"565px", fileManagerJson:"/kindeditor/filemanager",
items : ['emoticons'],
afterChange:function(){//按键事件 afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea}); nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
}, },
afterCreate:function(){ afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.about_talk); // var toolbar = $("div[class='ke-toolbar']",params.about_talk);
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情'); // $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
params.toolbar_container.append(toolbar); // params.toolbar_container.append(toolbar);
} }
}); }).loadPlugin('paste');
//主题输入框按键事件 //主题输入框按键事件
params.inputsubject.keyup(function(){ params.inputsubject.keyup(function(){

@ -3,7 +3,9 @@
<a class="fl about_me" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a> <a class="fl about_me" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a>
<h2 class="fl project_h2">与我相关</h2> <h2 class="fl project_h2">与我相关</h2>
<div class="fr mt10 mr5 c_grey02"> <div class="fr mt10 mr5 c_grey02">
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label> <a class="c_dblue">
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label>
</a>
</div> </div>
<% else %> <% else %>
<h2 class="fl project_h2"><%= l(:label_activity)%></h2> <h2 class="fl project_h2"><%= l(:label_activity)%></h2>
@ -35,7 +37,7 @@
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type, :class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link", 'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%> 'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
<%if @controller_name=='ActivityNotifys' && !e.get_notify_is_read%> <%if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
<span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span> <span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span>
<%end%> <%end%>
<br /> <br />
@ -49,6 +51,8 @@
</div><!--课程动态 end--> </div><!--课程动态 end-->
<% end%> <% end%>
<% end%> <% end%>
<% elsif @controller_name=='ActivityNotifys' %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end%> <% end%>
<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %> <% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %>
<div class="problem_main"> <div class="problem_main">

@ -31,7 +31,7 @@
} }
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); $('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }

@ -31,15 +31,16 @@
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %> <% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
<span id="is_public_<%= file.id %>"> <span id="is_public_<%= file.id %>">
<%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %> <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %>
</span> </span>
<% else %> <% else %>
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> --> <!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
<% end %> <% end %>
<% else %> <% else %>
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %> <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
<% end %> <% end %>
<%= link_to '下载',download_named_attachment_path(file.id, file.filename, force: true),class: 'f_l re_open' %>
<% else %> <% else %>
<% end %> <% end %>
</div> </div>
@ -65,4 +66,4 @@
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>

@ -30,6 +30,7 @@
<% else %> <% else %>
<%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %> <%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
<% end %> <% end %>
<%= link_to '下载',download_named_attachment_path(file.id, file.filename, force: true),class: 'f_l re_open' %>
<% end %> <% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
@ -37,7 +38,7 @@
<p class="f_l c_grey02 font">文件大小:<%= number_to_human_size(file.filesize) %></p> <p class="f_l c_grey02 font">文件大小:<%= number_to_human_size(file.filesize) %></p>
<%= link_to( l(:button_delete), attachment_path(file), <%= link_to( l(:button_delete), attachment_path(file),
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if manage_allowed && file.container_id == project.id && file.container_type == "Project"%> :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if manage_allowed && file.container_id == project.id && file.container_type == "Project"%>
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&nbsp;&nbsp;|&nbsp;&nbsp;下载<%= file.downloads %>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= file.quotes.nil? ? 0:file.quotes %> </p> <p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %>&nbsp;&nbsp;|&nbsp;&nbsp;下载<%= file.downloads %>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="tag_h"> <div class="tag_h">
@ -51,4 +52,4 @@
<ul class="wlist"> <ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%> <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>

@ -5,7 +5,7 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => project}) %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => project}) %>');
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); $('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","40%").css("left","36%"); $('#ajax-modal').parent().css("top","40%").css("left","36%");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");
} }

@ -6,6 +6,6 @@
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); $('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","").css("left",""); $('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");

@ -6,6 +6,6 @@
showModal('ajax-modal', '513px'); showModal('ajax-modal', '513px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>"); $('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
$('#ajax-modal').parent().css("top","30%").css("left","35%"); $('#ajax-modal').parent().css("top","30%").css("left","35%");
$('#ajax-modal').parent().addClass("popbox_polls"); $('#ajax-modal').parent().addClass("popbox_polls");

@ -16,9 +16,9 @@
<div class="problem_main"> <div class="problem_main">
<%= link_to(image_tag(url_to_avatar(homework.user), :width => "42", :height => "42"), user_path(homework.user), :class => "problem_pic fl") %> <%= link_to(image_tag(url_to_avatar(homework.user), :width => "42", :height => "42"), user_path(homework.user), :class => "problem_pic fl") %>
<div class="problem_txt fl mt5"> <div class="problem_txt fl mt5">
<%= link_to(homework.user.lastname+homework.user.firstname, user_path(homework.user),:class => 'problem_name fl') %> <%= link_to(homework.user.lastname+homework.user.firstname, user_path(homework.user),:class => 'problem_name fl',:target => "_blank") %>
<span class="fl"> <%= l(:label_user_create_project_homework) %></span> <span class="fl"> <%= l(:label_user_create_project_homework) %></span>
<%= link_to(homework.name, student_work_index_path(:homework => homework.id), :class => 'problem_tit fl fb c_dblue') %> <%= link_to(homework.name, student_work_index_path(:homework => homework.id), :class => 'problem_tit fl fb c_dblue',:target => "_blank") %>
<div class="cl mb5"></div> <div class="cl mb5"></div>
<p class="fl "> <p class="fl ">
<%= l(:lebel_homework_commit)%> <%= l(:lebel_homework_commit)%>

@ -218,9 +218,8 @@
</td> </td>
</tr> </tr>
<% end %> <% end %>
<% unless @user.user_extensions.nil?&&@user.user_extensions.location.empty?%> <% if @user.user_extensions && @user.user_extensions.location && !@user.user_extensions.location.empty?%>
<tr> <tr>
<td style=" float: right" width="70px"> <td style=" float: right" width="70px">
<span style="float: right"> <%= l(:label_location) %></span> <span style="float: right"> <%= l(:label_location) %></span>
</td> </td>

@ -1,17 +1,15 @@
<p> <p>
<span class="c_blue" style="color:#1b55a7;"> <span class="c_blue" style="color:#1b55a7;">
<%= link_to(h("#{@news.author.login}(#{@news.author.show_name})"), @issue_author_url , :style=>'color:#1b55a7; font-weight:bold;') %>
<%= link_to(h("#{@news.author.login}(#{@news.author.show_name})"), @issue_author_url , :style=>'color:#1b55a7; font-weight:bold;') %> </span><%= l(:mail_issue_title_userin)%>
</span><%= l(:mail_issue_title_userin)%>
<span class="c_blue" style="color:#1b55a7;"> <span class="c_blue" style="color:#1b55a7;">
<% if @news.project %> <% if @news.project %>
<%=h @news.project.name %> : <%= link_to(h(@news.title), @news_url,:style=>'color:#1b55a7; font-weight:bold;') %> <%=h @news.project.name %> : <%= link_to(h(@news.title), @news_url,:style=>'color:#1b55a7; font-weight:bold;') %>
<% elsif @news.course %> <% elsif @news.course %>
<%=h @news.course.name %> : <%= link_to(h(@news.title), @news_url,:style=>'color:#1b55a7; font-weight:bold;') %> <%=h @news.course.name %> : <%= link_to(h(@news.title), @news_url,:style=>'color:#1b55a7; font-weight:bold;') %>
<% end %> <% end %>
</span><%= l(:mail_issue_title_active)%></p> </span><%= l(:mail_issue_title_active)%>
</p>
<div class="mail_box" style="border:1px solid #c8c8c8; width:570px; height: auto; padding:15px; margin-top:10px; margin-bottom:10px;"> <div class="mail_box" style="border:1px solid #c8c8c8; width:570px; height: auto; padding:15px; margin-top:10px; margin-bottom:10px;">
<ul style="list-style-type:none; margin:0; padding:0;"> <ul style="list-style-type:none; margin:0; padding:0;">
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_subject)%></strong></span> <li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_subject)%></strong></span>
@ -25,7 +23,7 @@
</li> </li>
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span> <li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
<span style="float: left; width: 526px"> <span style="float: left; width: 526px">
<%= @news.description %> <%= @news.description.html_safe %>
</span> </span>
</li> </li>

@ -1,341 +1,359 @@
<div class="content">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= @subject %>
</h4>
<% if @attachments.first || @course_news.first || @bids.first ||
@homeworks.first || @course_journal_messages.first|| @course_messages.first %>
<div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_course_overview)%></h2>
<% unless @course_news.first.nil? %>
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_course_news) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_news.count %>)</span>
</h4>
<% @course_news.each do |course_new|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_notice) %></span>
<%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_new.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!--课程通知 end-->
<% end %>
<!--课程作业-->
<% if !@bids.first.nil? || !@homeworks.first.nil? %>
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;"><%= l(:label_homework_overview) %><span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @bids.count %>)</span></h4>
<% unless @bids.first.nil?%>
<% @bids.each do |bid| %>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'), course_url(bid.courses.first, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to bid.author, user_activities_url(bid.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_homework) %></span>
<%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(:id => bid.id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(bid.created_on) %></span>
</li>
<% end %>
<% end %>
<% unless @homeworks.first.nil? %>
<% @homeworks.each do |homework| %>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to homework.user, user_activities_url(homework.user,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_submit_homework) %></span>
<%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(:id => homework.bid.id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(homework.created_at) %></span>
</li>
<% end %>
<% end %>
<div class="cl"></div>
</ul><!--作业动态 end-->
<% end %>
<div class="content"> <!-- 课程留言 -->
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <% unless @course_journal_messages.first.nil? %>
<%= @subject %> <ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
</h4> <h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<% if @attachments.first || @course_news.first || @bids.first || <%= l(:view_course_journals_for_messages) %>
@homeworks.first || @course_journal_messages.first|| @course_messages.first %> <span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span>
<div class="wmail_main" style="padding:20px 10px 0px;"> </h4>
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_course_overview)%></h2>
<% unless @course_news.first.nil? %> <% @course_journal_messages.each do |course_journal_message|%>
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= l(:label_course_news) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_news.count %>)</span> <%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value),
</h4> :class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<% @course_news.each do |course_new|%> <span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span> <%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value), :class => "wmail_name",
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span> :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_journals_for_messages) %></span>
<%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value),
:class=> "wmail_column", <%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value),
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :class => 'wmail_info',
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span> :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value), :class => "wmail_name", <span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_journal_message.created_on) %></span>
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> </li>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_notice) %></span> <% end %>
<div class="cl"></div>
<%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value), </ul><!--课程留言 end-->
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_new.created_on) %></span>
</li>
<% end %> <% end %>
<div class="cl"></div> <!-- 课程讨论区 -->
</ul><!--课程动态 end--> <% unless @course_messages.first.nil? %>
<% end %> <ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<% if !@bids.first.nil? || !@homeworks.first.nil? %> <h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <%= l(:view_borad_course) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span>
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;"><%= l(:label_homework_overview) %><span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @bids.count %>)</span></h4> </h4>
<% unless @bids.first.nil?%> <% @course_messages.each do |course_message|%>
<% @bids.each do |bid| %> <li style="clear: both; list-style: none;">
<li style="clear: both; list-style: none;"> <span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span> <span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span> <%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course.id, :token => @token.value),
:class=> "wmail_column",
<%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'), course_url(bid.courses.first, :token => @token.value), :style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
:class=> "wmail_column", <span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name",
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span> :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_messages) %></span>
<%= link_to bid.author, user_activities_url(bid.author,:token => @token.value), :class => "wmail_name", <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value),
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> :class => 'wmail_info',
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_homework) %></span> :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_message.created_on) %></span>
<%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(:id => bid.id,:token => @token.value), </li>
:class => 'wmail_info', <% end %>
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" <div class="cl"></div>
%> </ul><!-- 课程讨论区end -->
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(bid.created_on) %></span>
</li>
<% end %> <% end %>
<!-- 课件 -->
<% unless @attachments.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_course_attendingcontestwork_download) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @attachments.count %>)</span>
</h4>
<% @attachments.each do |attachment|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_file_upload) %></span>
<%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(attachment.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!--课件下载 end-->
<% end %> <% end %>
<% unless @homeworks.first.nil? %> </div>
<% @homeworks.each do |homework| %> <% end %>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<!--项目相关-->
<%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value), <% if @issues.first || @project_messages.first %>
:class=> "wmail_column", <div class="wmail_main" style="padding:20px 10px 0px;">
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> <h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_project_overview_new)%></h2>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span> <% unless @issues.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<%= link_to homework.user, user_activities_url(homework.user,:token => @token.value), :class => "wmail_name", <h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%> <%= l(:label_issue_tracking) %>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_submit_homework) %></span> <span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @issues.count %>)</span>
</h4>
<%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(:id => homework.bid.id,:token => @token.value), <% @issues.each do |issue|%>
:class => 'wmail_info', <li style="clear: both; list-style: none;">
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" <span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
%> <span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(homework.created_at) %></span> <%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value),
</li> :class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_issue) %></span>
<%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(issue.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!--问题跟踪 end-->
<% end %> <% end %>
<!-- 讨论区 -->
<% unless @project_messages.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:project_moule_boards_show) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @project_messages.count %>)</span>
</h4>
<% @project_messages.each do |project_message|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_messages) %></span>
<%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_message.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!--项目论坛 end-->
<% end %> <% end %>
<div class="cl"></div> <!--项目新闻-->
</ul><!--作业动态 end--> <% unless @project_news.first.nil? %>
<% end %> <ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<% unless @course_journal_messages.first.nil? %> <%= l(:label_course_news) %>
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @project_news.count %>)</span>
</h4>
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <% @project_news.each do |project_new|%>
<%= l(:view_course_journals_for_messages) %> <li style="clear: both; list-style: none;">
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span> <span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
</h4> <span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<% @course_journal_messages.each do |course_journal_message|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_journals_for_messages) %></span>
<%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_journal_message.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!--课程留言 end-->
<% end %>
<% unless @course_messages.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:view_borad_course) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span>
</h4>
<% @course_messages.each do |course_message|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course.id, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_messages) %></span>
<%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_message.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!--课程讨论 end-->
<% end %>
<% unless @attachments.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_course_attendingcontestwork_download) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @attachments.count %>)</span>
</h4>
<% @attachments.each do |attachment|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_file_upload) %></span>
<%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(attachment.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!--课件下载 end-->
<% end %>
</div><!--课程动态 end-->
<% end %>
<% if @issues.first || @project_messages.first %>
<div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_project_overview_new)%></h2>
<% unless @issues.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_issue_tracking) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @issues.count %>)</span>
</h4>
<% @issues.each do |issue|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_issue) %></span>
<%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(issue.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!--问题跟踪 end-->
<% end %>
<% unless @project_messages.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:project_moule_boards_show) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @project_messages.count %>)</span>
</h4>
<% @project_messages.each do |project_message|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_messages) %></span>
<%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_message.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!--项目论坛 end-->
<% end %>
</div><!--项目动态 end-->
<% end %>
<% unless @user_journal_messages.first.nil? %>
<div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_activities) %></h2>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_user_message) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @user_journal_messages.count %>)</span>
</h4>
<% @user_journal_messages.each do |user_journal_message|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value),
:class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_show_your_message) %></span>
<%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'),feedback_url(@user,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(user_journal_message.created_on) %></span></li>
<% end %> <%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value),
:class=> "wmail_column",
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_notice) %></span>
<div class="cl"></div> <%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value),
</ul><!--课程动态 end--> :class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_new.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!-- 项目新闻end -->
<% end %>
</div><!--个人动态 end--> </div>
<% end %> <% end %><!-- 项目动态end -->
<% if @forums.first || @memos.first %>
<!-- 用户留言 -->
<% unless @user_journal_messages.first.nil? %>
<div class="wmail_main" style="padding:20px 10px 0px;"> <div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:lable_bar_active) %></h2> <h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_activities) %></h2>
<% unless @forums.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" > <h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_user_forum) %> <%= l(:label_user_message) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @forums.count %>)</span> <span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @user_journal_messages.count %>)</span>
</h4> </h4>
<% @forums.each do |forum|%> <% @user_journal_messages.each do |user_journal_message|%>
<li style="clear: both; list-style: none;"> <li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span> <span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value), <%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value),
:class => "wmail_name", :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_forum_new) %></span> <span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_show_your_message) %></span>
<%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value), <%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'),feedback_url(@user,:token => @token.value),
:class => 'wmail_info', :class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(forum.created_at) %></span></li> <span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(user_journal_message.created_on) %></span></li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
</ul><!-- 新建贴吧 end--> </ul><!--用户留言 end-->
</div><!--个人动态 end-->
<% end %>
<% if @forums.first || @memos.first %>
<div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:lable_bar_active) %></h2>
<% unless @forums.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_user_forum) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @forums.count %>)</span>
</h4>
<% @forums.each do |forum|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value),
:class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_forum_new) %></span>
<%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(forum.created_at) %></span></li>
<% end %>
<div class="cl"></div>
</ul><!-- 新建贴吧 end-->
<% end %> <% end %>
<% unless @memos.first.nil? %> <% unless @memos.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;"> <ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
@ -366,14 +384,14 @@
<% end %> <% end %>
</div><!--贴吧动态 end--> </div><!--贴吧动态 end-->
<% end %> <% end %>
<div class="wmail_foot" style="margin-top:20px;color:#2775d2; margin-left:10px;"> <div class="wmail_foot" style="margin-top:20px;color:#2775d2; margin-left:10px;">
<% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %> <% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %>
<% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %> <% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %>
<label style="margin-top:20px;color:gray; margin-left:10px;"><%= l(mail_option) %></label> <label style="margin-top:20px;color:gray; margin-left:10px;"><%= l(mail_option) %></label>
<% else %> <% else %>
<%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %> <%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
</div> </div>

@ -131,9 +131,9 @@
<%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %> <%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %>
</td> </td>
<td class="comments" style="word-wrap: break-word;word-break: break-all;"> <td class="comments" style="word-wrap: break-word;word-break: break-all;">
<div class="reply_content" > <div class="reply_content" >
<%=h sanitize(reply.content.html_safe) %> <%=h sanitize(reply.content.html_safe) %>
</div> </div>
<p> <p>
<% if reply.attachments.any?%> <% if reply.attachments.any?%>
<% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %> <% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %>
@ -183,4 +183,4 @@
}); });
}; };
$("img").removeAttr("align"); $("img").removeAttr("align");
</script> </script>

@ -45,39 +45,55 @@
} }
// if (filter.test(email)&& !(email.value == null)) return true; // if (filter.test(email)&& !(email.value == null)) return true;
// else // else
// { // {
// document.getElementById('valid_email').innerHTML = "您所填写的电子邮件格式不正确"; // document.getElementById('valid_email').innerHTML = "您所填写的电子邮件格式不正确";
// document.getElementById('valid_email').style.color = "#FF0000"; // document.getElementById('valid_email').style.color = "#FF0000";
// return false; // return false;
// } // }
// //
// } // }
</script> </script>
<div class="project_r_h"> <div class="project_r_h">
<h2 class="project_h2"><%= l(:label_invite_join)%></h2> <h2 class="project_h2"><%= l(:label_invite_join)%></h2>
</div> </div>
<div class="box_main"> <div class="box_main">
<p class="box_p"> <p class="box_p">
<%= l(:label_invite_email_tips)%> <%= l(:label_invite_email_tips)%>
</p> </p>
<div id="is_registed"> <div id="is_registed">
<%= render :partial => 'regested', locals: { :isregisted => false} %> <%= render :partial => 'regested', locals: { :isregisted => false} %>
</div> </div>
<%= form_tag('send_mail_to_member', :controller => 'projects',:action => 'send_mail_to_member', method: 'get') do %> <%= form_tag('send_mail_to_member', :controller => 'projects',:action => 'send_mail_to_member', method: 'get') do %>
<span id="valid_email" style="color: #FF0000;"></span> <span id="valid_email" style="color: #FF0000;"></span>
<ul> <ul>
<li> <li>
<%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyAddress(this);" %> <%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyAddress(this);" %>
</li> </li>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>
<a href="#" class="btn_free" onclick="senderEmail($(this));"> <a href="#" class="btn_free" onclick="senderEmail($(this));">
<%= l(:label_send_email)%> <%= l(:label_send_email)%>
</a> </a>
<% end %>
<%# 邀请用户的状态 %>
<% unless @inviter_lists.blank? %>
<div>
<span class="status_inviter">已邀请的用户</span><br/>
<% @inviter_lists.each do |inviter_list| %>
<%= inviter_list.user.name %><br/>
<% end %>
</br>
<span class="status_inviter">等待加入项目的用户</span><br/>
<% @inviter_lists.each do |inviter_list| %>
<% unless inviter_list.user.member_of?(@project) %>
<%= inviter_list.user.name %><br/>
<% end %>
<% end %>
</div>
<% end %>
</div>
<% end %>
</div>
</div>

@ -36,7 +36,7 @@
</span> </span>
<% if @show_all%> <% if @show_all%>
<input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this),'<%= student_work_index_path(:homework => @homework.id)%>',event);"> <input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this),'<%= student_work_index_path(:homework => @homework.id)%>',event);">
<a class="student_work_search fl" onclick="SearchByName($(this).prev(),'<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)">搜索</a> <a class="student_work_search fl" onclick="SearchByName_1($(this).prev(),'<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)">搜索</a>
<% end%> <% end%>
<% if @is_teacher%> <% if @is_teacher%>
<div class="fr"> <div class="fr">

@ -30,8 +30,8 @@
<td rowspan="2" > <td rowspan="2" >
<div class="project-search" style="float: right"> <div class="project-search" style="float: right">
<!--label for="user_browse_label"><%#= l(:label_user_search_type) %></label--> <!--label for="user_browse_label"><%#= l(:label_user_search_type) %></label-->
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]],@search_by), :onchange => "searchByChange();" ) %> <%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]],@search_by), :onchange => "searchByChange();",:style=>'display:none;' ) %>
<%= text_field_tag 'name', params[:name], :size => 30 %> <%= text_field_tag 'name', params[:name], :size => 30, :placeholder=>'昵称/姓名/邮箱' %>
<input type="text" name="search_by_input" hidden="hidden;" id="search_by_input" value="0"> <input type="text" name="search_by_input" hidden="hidden;" id="search_by_input" value="0">
<input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="searchUser();"/> <input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="searchUser();"/>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %> <%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>

@ -73,11 +73,13 @@ form #search_by
{ {
if($("#search_type").val() == "users") if($("#search_type").val() == "users")
{ {
$("#search_by").show(); $("#q").attr('placeholder','昵称/姓名/邮箱');
// $("#search_by").show();
} }
else else
{ {
$("#search_by").hide(); $("#search_by").hide();
$("#q").attr('placeholder',"<%=l('welcome.search.information')%>");
} }
} }
@ -93,7 +95,7 @@ form #search_by
<%= text_field_tag :q, nil, :placeholder => l('welcome.search.information'), style:"float:left; width:185px;" %> <%= text_field_tag :q, nil, :placeholder => l('welcome.search.information'), style:"float:left; width:185px;" %>
<input type="text" name="search_by_input" style="display: none" id="search_by_input" value="0"> <input type="text" name="search_by_input" style="display: none" id="search_by_input" value="0">
<%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();", :style => "float:right" ) %> <%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();", :style => "float:right" ) %>
<%= select_tag(:search_by,options_for_select([[l('welcome.search.select.userinfo.nickname'),"0"],[l('welcome.search.select.userinfo.showname'),"1"],[l('welcome.search.select.userinfo.email'),"2"]]), :onchange => "searchByChange();",:style => "float:right" ) %> <%= select_tag(:search_by,options_for_select([[l('welcome.search.select.userinfo.nickname'),"0"],[l('welcome.search.select.userinfo.showname'),"1"],[l('welcome.search.select.userinfo.email'),"2"]]), :onchange => "searchByChange();",:style => "float:right;display:none;" ) %>
</div> </div>
<%#= hidden_field_tag 'project_type', project_type %> <%#= hidden_field_tag 'project_type', project_type %>
</div> </div>

@ -1,3 +0,0 @@
if Rails.env.production?
config.cache_store = :redis_store, 'redis://localhost:6379/0/cache', { expires_in: 90.minutes }
end

@ -67,6 +67,8 @@ module RedmineApp
# Do not include all helpers # Do not include all helpers
config.action_controller.include_all_helpers = false config.action_controller.include_all_helpers = false
config.action_view.sanitized_allowed_tags = 'div', 'p', 'span', 'img', 'embed'
if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb')) if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb')) instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
end end

@ -85,7 +85,8 @@ zh:
project_module_documents: 文档 project_module_documents: 文档
label_roadmap: 里程碑 #版本路线图 label_roadmap: 里程碑 #版本路线图
project_module_dts: DTS测试工具 project_module_dts: DTS测试工具
label_project_tool_response: 用户反馈 label_project_tool_response: 用户反馈
label_course_news: 项目新闻
label_project_overview: "项目简介" label_project_overview: "项目简介"
label_expend_information: 展开更多信息 label_expend_information: 展开更多信息

@ -257,7 +257,6 @@ RedmineApp::Application.routes.draw do
post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit'
post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy' post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy'
# boards end # boards end
# delete 'bids/homework', :to => 'bids#homework_destroy'
# Misc issue routes. TODO: move into resources # Misc issue routes. TODO: move into resources
match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues' match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues'
@ -764,7 +763,6 @@ RedmineApp::Application.routes.draw do
delete 'attachment/:id', :to => 'attachments#delete_homework' delete 'attachment/:id', :to => 'attachments#delete_homework'
match 'new_join', :to => 'courses#new_join', :as => 'try_join' match 'new_join', :to => 'courses#new_join', :as => 'try_join'
match 'new_join_group', :to => 'courses#new_join_group', :as => 'try_join_group' match 'new_join_group', :to => 'courses#new_join_group', :as => 'try_join_group'
# match 'new_join_in_contest', :to => 'bids#new_join', :as => 'try_join_in_contest'
match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post
######################## ########################

@ -451,7 +451,7 @@ Redmine::MenuManager.map :user_enterprise_menu do |menu|
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.host_name} menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.host_name}
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.host_user} # menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.host_user}
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.host_user} menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.host_user}
end end
@ -459,7 +459,7 @@ Redmine::MenuManager.map :user_menu_self do |menu|
menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.host_name } menu.push :activity, {:controller => 'users', :action => 'show', :host => Setting.host_name }
menu.push :user_information, {:controller => 'users', :action => 'info', :host => Setting.host_user} menu.push :user_information, {:controller => 'users', :action => 'info', :host => Setting.host_user}
menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.host_name} menu.push :user_project, {:controller => 'users', :action => 'user_projects', :host => Setting.host_name}
menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.host_user} # menu.push :requirement_focus, {:controller => 'users', :action => 'watch_bids', :host => Setting.host_user}
menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.host_user} menu.push :user_newfeedback, {:controller => 'users', :action => 'user_newfeedback', :host => Setting.host_user}
end end

@ -1,16 +1,18 @@
#coding=utf-8
namespace :office do namespace :office do
desc "conver any files to html" desc "conver any files to html"
task :conver => :environment do task :conver => :environment do
all_count = Attachment.count all_count = Attachment.where(["container_type IN (?)", %w(Project Course)]).count
i = 0 i = 0
Attachment.find_each do |a| Attachment.where(["container_type IN (?)", %w(Project Course)]).find_each do |a|
i += 1 i += 1
puts "process [#{i}/#{all_count}] => id #{a.id}" puts "process [#{i}/#{all_count}] => id #{a.id}"
saved_path = File.join(Rails.root, "files", "convered_office") saved_path = File.join(Rails.root, "files", "convered_office")
unless Dir.exist?(saved_path) unless Dir.exist?(saved_path)
Dir.mkdir(saved_path) Dir.mkdir(saved_path)
end end
convered_file = File.join(saved_path, a.disk_filename + ".html") convered_file = File.join(saved_path, a.disk_filename + ".pdf")
office = Trustie::Utils::Office.new(a.diskfile) office = Trustie::Utils::Office.new(a.diskfile)
if office.conver(convered_file) if office.conver(convered_file)
puts "process ok: #{convered_file} " puts "process ok: #{convered_file} "

@ -1,3 +1,5 @@
#coding=utf-8
module Trustie module Trustie
module Utils module Utils
class Office class Office
@ -7,7 +9,7 @@ module Trustie
end end
def office? def office?
%w(doc docx ppt pptx xls xlsx pdf).any?{|word| @file.downcase.end_with?(word)} %w(doc docx ppt pptx xls xlsx).any?{|word| @file.downcase.end_with?(word)}
end end
def conver(saved_file, force=false) def conver(saved_file, force=false)
@ -15,14 +17,18 @@ module Trustie
if File.exist? @file if File.exist? @file
if office? if office?
begin begin
resource = RestClient::Resource.new( # resource = RestClient::Resource.new(
'http://192.168.80.107/Any2HtmlHandler.ashx', # 'http://192.168.80.107/Any2HtmlHandler.ashx',
:timeout => -1, # :timeout => -1,
:open_timeout => -1 # :open_timeout => -1
) # )
req = resource.post :txtDes => File.new(@file, 'rb') # req = resource.post :txtDes => File.new(@file, 'rb')
File.open(saved_file, "wb+") do |f| req = RestClient.post 'http://192.168.80.107/Any2HtmlHandler.ashx',:txtDes => File.new(@file, 'rb')
f.write(req.body) File.delete(saved_file) if File.exist?(saved_file)
if req.body.length > 10 && !req.body.eql?('转换出错')
File.open(saved_file, "wb+") do |f|
f.write(req.body)
end
end end
return true return true
rescue =>e rescue =>e

@ -901,24 +901,30 @@ $(function(){
$('#download_homework_attachments').bind('ajax:complete', function (event, data, status, xhr) { $('#download_homework_attachments').bind('ajax:complete', function (event, data, status, xhr) {
if(status == 'success'){ if(status == 'success'){
var res = JSON.parse(data.responseText); var res = JSON.parse(data.responseText);
if(res.length<1){ if(res.length == null){
return; alert("该作业没有任何附件可下载");
} }
if(res.length==1){ else if(res.length<1){
location.href = '/zipdown/download?file='+res[0].file;return; return;
} }
document.getElementById('light').style.display='block'; else
$container = $('#light .upload_box_ul'); {
$container.empty(); if(res.length==1){
for(var i = 0; i <res.length; ++i){ location.href = '/zipdown/download?file='+res[0].file;return;
var des = '';
if(res.count > 1){
des = '第'+res[i].index+'-'+(res[i].count+res[i].index-1)+'个学生的作品下载';
} else {
des = '第'+res[i].index+'个学生的作品下载';
} }
$('<li><span class="upload_box_span" >'+(i+1)+'.</span> <a href="/zipdown/download?file='+res[i].file+'">'+des+'</a><span class="c_grey">&nbsp;&nbsp;(共'+res[i].size+'M</span> </li>').appendTo($container); document.getElementById('light').style.display='block';
$container = $('#light .upload_box_ul');
$container.empty();
for(var i = 0; i <res.length; ++i){
var des = '';
if(res.count > 1){
des = '第'+res[i].index+'-'+(res[i].count+res[i].index-1)+'个学生的作品下载';
} else {
des = '第'+res[i].index+'个学生的作品下载';
}
$('<li><span class="upload_box_span" >'+(i+1)+'.</span> <a href="/zipdown/download?file='+res[i].file+'">'+des+'</a><span class="c_grey">&nbsp;&nbsp;(共'+res[i].size+'M</span> </li>').appendTo($container);
}
} }
} }
}); });

@ -757,8 +757,8 @@ function goTopEx() {
} }
} }
//匿评评分提示
$(function(){ $(function(){
//匿评评分提示
$(".student_score_info").bind("mouseover",function(e){ $(".student_score_info").bind("mouseover",function(e){
//alert($(this).html()); //alert($(this).html());
$(this).find("div").show(); $(this).find("div").show();
@ -769,6 +769,8 @@ $(function(){
//alert($(this).html()); //alert($(this).html());
$(this).find("div").hide(); $(this).find("div").hide();
}); });
$("#about_project label").eq(1).remove();
}); });
//匿评弹框取消按钮 //匿评弹框取消按钮
@ -793,11 +795,7 @@ function SearchByName(obj,url,event)
location.href = url + "&name=" + obj.val(); location.href = url + "&name=" + obj.val();
} }
} }
function SearchByName(obj,url) function SearchByName_1(obj,url)
{ {
location.href = url + "&name=" + obj.val(); location.href = url + "&name=" + obj.val();
} }
$(function(){
$("#about_project label").eq(1).remove();
});

@ -380,8 +380,6 @@ span.add_attachment {font-size: 80%;line-height: 2.5em;}
.attachments_fields span .boldSpan{display:block; white-space:nowrap; font-family:'微软雅黑';} .attachments_fields span .boldSpan{display:block; white-space:nowrap; font-family:'微软雅黑';}
.attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; } .attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; }
a.remove-upload:hover {text-decoration:none !important;} a.remove-upload:hover {text-decoration:none !important;}
.attachments_fields input.is_public_checkbox {width:20px;}
.attachments_fields span.ispublic-label {display: inline-block;width: 30px;margin-left: 10px;} .attachments_fields span.ispublic-label {display: inline-block;width: 30px;margin-left: 10px;}
a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%;width: 1px;display: inline-block;padding-left: 16px;} a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%;width: 1px;display: inline-block;padding-left: 16px;}

@ -49,6 +49,7 @@ a.icon_removem{ background:url(../images/img_floatbox.png) -22px -33px no-repea
a:hover.icon_removem{background:url(../images/img_floatbox.png) -22px -61px no-repeat;} a:hover.icon_removem{background:url(../images/img_floatbox.png) -22px -61px no-repeat;}
a.btn_free{ background:#ff5722; display:block; text-align:center; color:#fff; padding:3px 0; width:80px; margin-bottom:10px;} a.btn_free{ background:#ff5722; display:block; text-align:center; color:#fff; padding:3px 0; width:80px; margin-bottom:10px;}
a:hover.btn_free{ background:#d63502;} a:hover.btn_free{ background:#d63502;}
.status_inviter{color: #3CA5C6;font-weight: bold; font-size: 14px }
/*成员邀请*/ /*成员邀请*/
.invi_search{ } .invi_search{ }
.invi_search_input{ border:1px solid #15bccf; width:180px; height:24px; color:#9b9b9b; padding-left:5px; margin-bottom:10px;} .invi_search_input{ border:1px solid #15bccf; width:180px; height:24px; color:#9b9b9b; padding-left:5px; margin-bottom:10px;}
@ -240,8 +241,6 @@ blockquote {background: #eeeeee;padding: 10px;margin-bottom: 10px;}
#attachments_fields span .boldSpan{display:block; white-space:nowrap; font-family:'微软雅黑';} #attachments_fields span .boldSpan{display:block; white-space:nowrap; font-family:'微软雅黑';}
#attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; } #attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; }
a.remove-upload:hover {text-decoration:none !important;} a.remove-upload:hover {text-decoration:none !important;}
#attachments_fields input.is_public_checkbox {width:20px;}
#attachments_fields span.ispublic-label {display: inline-block;width: 30px;margin-left: 10px;} #attachments_fields span.ispublic-label {display: inline-block;width: 30px;margin-left: 10px;}
a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%;width: 1px;display: inline-block;padding-left: 16px;} a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%;width: 1px;display: inline-block;padding-left: 16px;}

@ -438,3 +438,4 @@ a.box_close{background:url(../images/img_floatbox.png) -22px 0 no-repeat;}
.tl{text-align: left;} .tl{text-align: left;}
img{max-width: 100%;} img{max-width: 100%;}
.attachments {clear: both;} .attachments {clear: both;}
.is_public_checkbox{margin-left: 15px;margin-right: 10px;}

@ -2,16 +2,16 @@
# #
#:author_id, :budget, :deadline, :name, :description, :homework_type, :password #:author_id, :budget, :deadline, :name, :description, :homework_type, :password
FactoryGirl.define do # FactoryGirl.define do
factory :homework, class: Bid do # factory :homework, class: Bid do
name "test homework" # name "test homework"
budget 0 # budget 0
deadline {(Time.now+1.days).strftime('%Y-%m-%d')} # deadline {(Time.now+1.days).strftime('%Y-%m-%d')}
description "description" # description "description"
homework_type 3 # homework_type 3
reward_type 3 # reward_type 3
end # end
#
factory :homework_attach, class: HomeworkAttach do # factory :homework_attach, class: HomeworkAttach do
end # end
end # end

Loading…
Cancel
Save