Merge branch 'szzh' into develop
This commit is contained in:
commit
01fed2eab9
5
Gemfile
5
Gemfile
|
@ -4,10 +4,11 @@ source 'http://ruby.taobao.org'
|
|||
unless RUBY_PLATFORM =~ /w32/
|
||||
# unix-like only
|
||||
gem 'iconv'
|
||||
gem 'rubyzip'
|
||||
gem 'zip-zip'
|
||||
end
|
||||
|
||||
gem 'rubyzip'
|
||||
gem 'delayed_job_active_record'#, :group => :production
|
||||
gem 'daemons'
|
||||
gem 'grape', '~> 0.9.0'
|
||||
gem 'grape-entity'
|
||||
gem 'seems_rateable', '~> 1.0.13'
|
||||
|
|
|
@ -41,7 +41,7 @@ module Mobile
|
|||
mount Apis::Comments
|
||||
|
||||
#add_swagger_documentation ({api_version: 'v1', base_path: 'http://u06.shellinfo.cn/trustie/api'})
|
||||
#add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development?
|
||||
add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development?
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -88,9 +88,7 @@ class AccountController < ApplicationController
|
|||
# create a new token for password recovery
|
||||
token = Token.new(:user => user, :action => "recovery")
|
||||
if token.save
|
||||
Thread.new do
|
||||
Mailer.lost_password(token).deliver
|
||||
end
|
||||
Mailer.run.lost_password(token)
|
||||
flash[:notice] = l(:notice_account_lost_email_sent)
|
||||
redirect_to signin_url
|
||||
return
|
||||
|
@ -228,7 +226,7 @@ class AccountController < ApplicationController
|
|||
user = User.find(params[:user]) if params[:user]
|
||||
token = Token.new(:user => user, :action => "register")
|
||||
if token.save
|
||||
Mailer.register(token).deliver
|
||||
Mailer.run.register(token)
|
||||
|
||||
else
|
||||
yield if block_given?
|
||||
|
@ -366,7 +364,7 @@ class AccountController < ApplicationController
|
|||
token = Token.new(:user => user, :action => "register")
|
||||
if user.save and token.save
|
||||
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
||||
Mailer.register(token).deliver
|
||||
Mailer.run.register(token)
|
||||
|
||||
|
||||
flash[:notice] = l(:notice_account_register_done)
|
||||
|
@ -401,7 +399,7 @@ class AccountController < ApplicationController
|
|||
if user.save
|
||||
UserStatus.create(:user_id => user.id ,:changsets_count => 0, :watchers_count => 0)
|
||||
# Sends an email to the administrators
|
||||
Mailer.account_activation_request(user).deliver
|
||||
Mailer.run.account_activation_request(user)
|
||||
account_pending
|
||||
else
|
||||
yield if block_given?
|
||||
|
|
|
@ -13,7 +13,7 @@ class AppliedProjectController < ApplicationController
|
|||
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
|
||||
if @applieds.count == 0
|
||||
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
||||
Mailer.applied_project(appliedproject).deliver
|
||||
Mailer.run.applied_project(appliedproject)
|
||||
@status = 2
|
||||
else
|
||||
@status = 1
|
||||
|
@ -31,7 +31,7 @@ class AppliedProjectController < ApplicationController
|
|||
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
|
||||
if @applieds.count == 0
|
||||
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
||||
Mailer.applied_project(appliedproject).deliver
|
||||
Mailer.run.applied_project(appliedproject)
|
||||
end
|
||||
|
||||
#redirect_to project_path(params[:project_id])
|
||||
|
|
|
@ -27,7 +27,7 @@ class AttachmentsController < ApplicationController
|
|||
accept_api_auth :show, :download, :upload
|
||||
require 'iconv'
|
||||
include AttachmentsHelper
|
||||
|
||||
include ApplicationHelper
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
|
@ -65,36 +65,7 @@ class AttachmentsController < ApplicationController
|
|||
def download
|
||||
# modify by nwb
|
||||
# 下载添加权限设置
|
||||
candown = false
|
||||
if @attachment.container.class.to_s != "HomeworkAttach" && (@attachment.container.has_attribute?(:project) || @attachment.container.has_attribute?(:project_id)) && @attachment.container.project
|
||||
project = @attachment.container.project
|
||||
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
|
||||
elsif @attachment.container.is_a?(Project)
|
||||
project = @attachment.container
|
||||
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
|
||||
elsif (@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) && @attachment.container.board &&
|
||||
@attachment.container.board.project
|
||||
project = @attachment.container.board.project
|
||||
candown = User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
|
||||
elsif (@attachment.container.has_attribute?(:course) ||@attachment.container.has_attribute?(:course_id) ) && @attachment.container.course
|
||||
course = @attachment.container.course
|
||||
candown = User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
|
||||
elsif @attachment.container.is_a?(Course)
|
||||
course = @attachment.container
|
||||
candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
|
||||
elsif (@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) && @attachment.container.board &&
|
||||
@attachment.container.board.course
|
||||
course = @attachment.container.board.course
|
||||
candown= User.current.member_of_course?(course) || (course.is_public==1 && @attachment.is_public == 1)
|
||||
elsif @attachment.container.class.to_s=="HomeworkAttach" && @attachment.container.bid.reward_type == 3
|
||||
candown = true
|
||||
elsif @attachment.container_type == "Bid" && @attachment.container && @attachment.container.courses.first
|
||||
course = @attachment.container.courses.first
|
||||
candown = User.current.member_of_course?(course) || (course.is_public == 1 && @attachment.is_public == 1)
|
||||
else
|
||||
|
||||
candown = @attachment.is_public == 1
|
||||
end
|
||||
candown = attachment_candown @attachment
|
||||
if candown || User.current.admin? || User.current.id == @attachment.author_id
|
||||
@attachment.increment_download
|
||||
if stale?(:etag => @attachment.digest)
|
||||
|
@ -349,6 +320,46 @@ class AttachmentsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def add_exist_file_to_projects
|
||||
file = Attachment.find(params[:file_id])
|
||||
projects = params[:projects][:project]
|
||||
@message = ""
|
||||
projects.each do |project|
|
||||
c = Project.find(project);
|
||||
if project_contains_attachment?(c,file)
|
||||
if @message && @message == ""
|
||||
@message += l(:label_project_prompt) + c.name + l(:label_contain_resource) + file.filename + l(:label_quote_resource_failed)
|
||||
next
|
||||
else
|
||||
@message += "<br/>" + l(:label_project_prompt) + c.name + l(:label_contain_resource) + file.filename + l(:label_quote_resource_failed)
|
||||
next
|
||||
end
|
||||
end
|
||||
attach_copied_obj = file.copy
|
||||
attach_copied_obj.tag_list.add(file.tag_list) # tag关联
|
||||
attach_copied_obj.container = c
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
attach_copied_obj.copy_from = file.copy_from.nil? ? file.id : file.copy_from
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 4
|
||||
end
|
||||
@obj = c
|
||||
@save_flag = attach_copied_obj.save
|
||||
@save_message = attach_copied_obj.errors.full_messages
|
||||
update_quotes attach_copied_obj
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
rescue NoMethodError
|
||||
@save_flag = false
|
||||
@save_message = [] << l(:label_course_empty_select)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def add_exist_file_to_courses
|
||||
file = Attachment.find(params[:file_id])
|
||||
courses = params[:courses][:course]
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
class CommentsController < ApplicationController
|
||||
default_search_scope :news
|
||||
include ApplicationHelper
|
||||
model_object News
|
||||
before_filter :find_model_object
|
||||
before_filter :find_project_from_association
|
||||
|
@ -26,9 +27,11 @@ class CommentsController < ApplicationController
|
|||
raise Unauthorized unless @news.commentable?
|
||||
|
||||
@comment = Comment.new
|
||||
@comment.safe_attributes = params[:comment]
|
||||
@comment.comments = params[:comment]
|
||||
@comment.author = User.current
|
||||
if @news.comments << @comment
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@comment.id,OwnerTypeHelper::COMMENT
|
||||
flash[:notice] = l(:label_comment_added)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class CoursesController < ApplicationController
|
||||
layout 'base_courses'
|
||||
include CoursesHelper
|
||||
include ActivitiesHelper
|
||||
helper :activities
|
||||
helper :members
|
||||
helper :words
|
||||
|
@ -680,26 +681,49 @@ class CoursesController < ApplicationController
|
|||
"show_course_files" => true,
|
||||
"show_course_news" => true,
|
||||
"show_course_messages" => true,
|
||||
"show_bids" => true,
|
||||
"show_course_journals_for_messages" => true,
|
||||
"show_bids" => true,
|
||||
"show_homeworks" => true
|
||||
}
|
||||
@date_to ||= Date.today + 1
|
||||
@date_from = (@date_to - @days) > @course.created_at.to_date ? (@date_to - @days) : @course.created_at.to_date
|
||||
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
|
||||
@author ||= @course.teacher
|
||||
# 决定显示所用用户或单个用户活动
|
||||
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
|
||||
:with_subprojects => false,
|
||||
:author => @author)
|
||||
@activity.scope_select {|t| has["show_#{t}"]}
|
||||
# modify by nwb
|
||||
# 添加私密性判断
|
||||
if User.current.member_of_course?(@course)|| User.current.admin?
|
||||
events = @activity.events(@days, @course.created_at)
|
||||
if @author.nil?
|
||||
# 显示老师和助教的活动
|
||||
# @authors = searchTeacherAndAssistant(@course)
|
||||
@authors = course_all_member(@course)
|
||||
events = []
|
||||
@authors.each do |author|
|
||||
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
|
||||
:with_subprojects => false,
|
||||
:author => author.user)
|
||||
|
||||
@activity.scope_select {|t| has["show_#{t}"]}
|
||||
# modify by nwb
|
||||
# 添加私密性判断
|
||||
if User.current.member_of_course?(@course)|| User.current.admin?
|
||||
events += @activity.events(@days, @course.created_at)
|
||||
else
|
||||
events += @activity.events(@days, @course.created_at, :is_public => 1)
|
||||
end
|
||||
|
||||
end
|
||||
else
|
||||
events = @activity.events(@days, @course.created_at, :is_public => 1)
|
||||
# @author = @course.teacher
|
||||
@activity = Redmine::Activity::Fetcher.new(User.current, :course => @course,
|
||||
:with_subprojects => false,
|
||||
:author => @author)
|
||||
|
||||
@activity.scope_select {|t| has["show_#{t}"]}
|
||||
# modify by nwb
|
||||
# 添加私密性判断
|
||||
if User.current.member_of_course?(@course)|| User.current.admin?
|
||||
events = @activity.events(@days, @course.created_at)
|
||||
else
|
||||
events = @activity.events(@days, @course.created_at, :is_public => 1)
|
||||
end
|
||||
end
|
||||
|
||||
# 无新动态时,显示老动态
|
||||
if events.count == 0
|
||||
if User.current.member_of_course?(@course)|| User.current.admin?
|
||||
|
@ -708,13 +732,17 @@ class CoursesController < ApplicationController
|
|||
events = @activity.events(:is_public => 1)
|
||||
end
|
||||
end
|
||||
events = paginateHelper events,10
|
||||
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
|
||||
# documents
|
||||
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
|
||||
if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id)))
|
||||
@user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id)
|
||||
end
|
||||
|
||||
sorted_events = sort_activity_events_course(events);
|
||||
events = paginateHelper sorted_events,10
|
||||
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
|
||||
# documents
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
format.api
|
||||
|
|
|
@ -110,7 +110,7 @@ class DocumentsController < ApplicationController
|
|||
render_attachment_warning_if_needed(@document)
|
||||
|
||||
if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
|
||||
Mailer.attachments_added(attachments[:files]).deliver
|
||||
Mailer.run.attachments_added(attachments[:files])
|
||||
end
|
||||
redirect_to document_url(@document)
|
||||
end
|
||||
|
|
|
@ -23,13 +23,14 @@ class FilesController < ApplicationController
|
|||
before_filter :auth_login1, :only => [:index]
|
||||
before_filter :logged_user_by_apptoken,:only => [:index]
|
||||
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
||||
before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search]
|
||||
before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search,:search_project,:quote_resource_show_project]
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
include FilesHelper
|
||||
helper :project_score
|
||||
include CoursesHelper
|
||||
include ApplicationHelper
|
||||
|
||||
def show_attachments obj
|
||||
@attachments = []
|
||||
|
@ -41,8 +42,8 @@ class FilesController < ApplicationController
|
|||
@feedback_count = @all_attachments.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
@curse_attachments_all = @all_attachments[@offset, @limit]
|
||||
@curse_attachments = paginateHelper @all_attachments,10
|
||||
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
||||
@obj_attachments = paginateHelper @all_attachments,10
|
||||
end
|
||||
|
||||
def search
|
||||
|
@ -78,6 +79,39 @@ class FilesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def search_project
|
||||
sort = ""
|
||||
@sort = ""
|
||||
@order = ""
|
||||
@is_remote = true
|
||||
if params[:sort]
|
||||
order_by = params[:sort].split(":")
|
||||
@sort = order_by[0]
|
||||
if order_by.count > 1
|
||||
@order = order_by[1]
|
||||
end
|
||||
sort = "#{@sort} #{@order}"
|
||||
end
|
||||
|
||||
begin
|
||||
q = "%#{params[:name].strip}%"
|
||||
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
|
||||
if params[:insite]
|
||||
@result = find_public_attache q,sort
|
||||
@result = visable_attachemnts_insite @result,@project
|
||||
@searched_attach = paginateHelper @result,10
|
||||
else
|
||||
@result = find_project_attache q,@project,sort
|
||||
@result = visable_attachemnts @result
|
||||
@searched_attach = paginateHelper @result,10
|
||||
end
|
||||
|
||||
#rescue Exception => e
|
||||
# #render 'stores'
|
||||
# redirect_to search_course_files_url
|
||||
end
|
||||
end
|
||||
|
||||
def find_course_attache keywords,course,sort = ""
|
||||
if sort == ""
|
||||
sort = "created_on DESC"
|
||||
|
@ -87,6 +121,26 @@ class FilesController < ApplicationController
|
|||
#resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC")
|
||||
end
|
||||
|
||||
def find_project_attache keywords,project,sort = ""
|
||||
if sort == ""
|
||||
sort = "created_on DESC"
|
||||
end
|
||||
ids = ""
|
||||
len = 0
|
||||
count = project.versions.count
|
||||
project.versions.each do |version|
|
||||
len = len + 1
|
||||
if len != count
|
||||
ids += version.id.to_s + ','
|
||||
else
|
||||
ids += version.id.to_s
|
||||
end
|
||||
end
|
||||
resultSet = Attachment.where("((attachments.container_type = 'Project' And attachments.container_id = '#{project.id}') OR (container_type = 'Version' AND container_id IN (#{ids}))) AND filename LIKE :like ", like: "%#{keywords}%").
|
||||
reorder(sort)
|
||||
#resultSet = Attachment.find_by_sql("SELECT `attachments`.* FROM `attachments` LEFT OUTER JOIN `homework_attaches` ON `attachments`.container_type = 'HomeworkAttach' AND `attachments`.container_id = `homework_attaches`.id LEFT OUTER JOIN `homework_for_courses` ON `homework_attaches`.bid_id = `homework_for_courses`.bid_id LEFT OUTER JOIN `homework_for_courses` AS H_C ON `attachments`.container_type = 'Bid' AND `attachments`.container_id = H_C.bid_id WHERE (`homework_for_courses`.course_id = 117 OR H_C.course_id = 117 OR (`attachments`.container_type = 'Course' AND `attachments`.container_id = 117)) AND `attachments`.filename LIKE '%#{keywords}%'").reorder("created_on DESC")
|
||||
end
|
||||
|
||||
def find_public_attache keywords,sort = ""
|
||||
# StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map
|
||||
# 此时内容不多速度还可,但文件增长,每条判断多则进行3-4次表连接。
|
||||
|
@ -132,17 +186,27 @@ class FilesController < ApplicationController
|
|||
attribute = "downloads"
|
||||
when "created_on"
|
||||
attribute = "created_on"
|
||||
when "quotes"
|
||||
attribute = "quotes"
|
||||
else
|
||||
attribute = "created_on"
|
||||
end
|
||||
|
||||
if order_by.count == 1
|
||||
sort += "#{Attachment.table_name}.#{attribute} asc " if attribute
|
||||
elsif order_by.count == 2
|
||||
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} " if attribute && order_by[1]
|
||||
end
|
||||
if sort_type != params[:sort].split(",").last
|
||||
sort += ","
|
||||
@sort = order_by[0]
|
||||
@order = order_by[1]
|
||||
if order_by.count == 1 && attribute
|
||||
sort += "#{Attachment.table_name}.#{attribute} asc "
|
||||
if sort_type != params[:sort].split(",").last
|
||||
sort += ","
|
||||
end
|
||||
elsif order_by.count == 2 && order_by[1]
|
||||
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
|
||||
if sort_type != params[:sort].split(",").last
|
||||
sort += ","
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
sort = "#{Attachment.table_name}.created_on desc"
|
||||
end
|
||||
|
||||
@containers = [ Project.includes(:attachments).find(@project.id)]
|
||||
|
@ -184,6 +248,8 @@ class FilesController < ApplicationController
|
|||
attribute = "created_on"
|
||||
when "quotes"
|
||||
attribute = "quotes"
|
||||
else
|
||||
attribute = "created_on"
|
||||
end
|
||||
@sort = order_by[0]
|
||||
@order = order_by[1]
|
||||
|
@ -199,6 +265,8 @@ class FilesController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
sort = "#{Attachment.table_name}.created_on desc"
|
||||
end
|
||||
|
||||
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
|
||||
|
@ -215,6 +283,11 @@ class FilesController < ApplicationController
|
|||
@can_quote = attachment_candown @file
|
||||
end
|
||||
|
||||
def quote_resource_show_project
|
||||
@file = Attachment.find(params[:id])
|
||||
@can_quote = attachment_candown @file
|
||||
end
|
||||
|
||||
def new
|
||||
@versions = @project.versions.sort
|
||||
@course_tag = @project.project_type
|
||||
|
@ -241,7 +314,7 @@ class FilesController < ApplicationController
|
|||
render_attachment_warning_if_needed(container)
|
||||
|
||||
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||
Mailer.attachments_added(attachments[:files]).deliver
|
||||
Mailer.run.attachments_added(attachments[:files])
|
||||
end
|
||||
|
||||
# TODO: 临时用 nyan
|
||||
|
@ -270,7 +343,7 @@ class FilesController < ApplicationController
|
|||
attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type])
|
||||
|
||||
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||
Mailer.attachments_added(attachments[:files]).deliver
|
||||
Mailer.run.attachments_added(attachments[:files])
|
||||
end
|
||||
|
||||
# TODO: 临时用 nyan
|
||||
|
|
|
@ -64,7 +64,7 @@ class ForumsController < ApplicationController
|
|||
respond_to do |format|
|
||||
if @memo.save
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids ,@memo.id,1
|
||||
update_kindeditor_assets_owner ids ,@memo.id,OwnerTypeHelper::MEMO
|
||||
#end
|
||||
format.html { redirect_to (forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id))), notice: "#{l :label_memo_create_succ}" }
|
||||
format.json { render json: @memo, status: :created, location: @memo }
|
||||
|
@ -171,7 +171,7 @@ class ForumsController < ApplicationController
|
|||
# Description after save后需要进行资源记录的更新
|
||||
# owner_type = 2 对应的是 forum
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids ,@forum.id,2
|
||||
update_kindeditor_assets_owner ids ,@forum.id,OwnerTypeHelper::FORUM
|
||||
#end
|
||||
respond_to do |format|
|
||||
|
||||
|
|
|
@ -86,6 +86,10 @@ class MessagesController < ApplicationController
|
|||
if request.post?
|
||||
@message.save_attachments(params[:attachments])
|
||||
if @message.save
|
||||
# 更新kindeditor上传的图片资源所有者
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE
|
||||
|
||||
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
|
||||
render_attachment_warning_if_needed(@message)
|
||||
redirect_to board_message_url(@board, @message)
|
||||
|
@ -117,6 +121,8 @@ class MessagesController < ApplicationController
|
|||
@topic.children << @reply
|
||||
#@topic.update_attribute(:updated_on, Time.now)
|
||||
if !@reply.new_record?
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@reply.id,OwnerTypeHelper::MESSAGE
|
||||
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
|
||||
attachments = Attachment.attach_files(@reply, params[:attachments])
|
||||
render_attachment_warning_if_needed(@reply)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
class NewsController < ApplicationController
|
||||
layout 'base_projects'# by young
|
||||
include ApplicationHelper
|
||||
before_filter :authorize1, :only => [:show]
|
||||
default_search_scope :news
|
||||
model_object News
|
||||
|
@ -136,6 +137,8 @@ class NewsController < ApplicationController
|
|||
@news.safe_attributes = params[:news]
|
||||
@news.save_attachments(params[:attachments])
|
||||
if @news.save
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS
|
||||
render_attachment_warning_if_needed(@news)
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to course_news_index_url(@course)
|
||||
|
|
|
@ -336,7 +336,7 @@ class ProjectsController < ApplicationController
|
|||
def send_mail_to_member
|
||||
if !params[:mail].blank? && User.find_by_mail(params[:mail].to_s).nil?
|
||||
email = params[:mail]
|
||||
Mailer.send_invite_in_project(email, @project, User.current).deliver
|
||||
Mailer.run.send_invite_in_project(email, @project, User.current)
|
||||
@is_zhuce =false
|
||||
flash[:notice] = l(:notice_email_sent, :value => email)
|
||||
else
|
||||
|
|
|
@ -131,7 +131,7 @@ update
|
|||
@project_path=@root_path+"htdocs/"+@repository_name
|
||||
@repository_tag=params[:repository][:upassword] || params[:repository][:password]
|
||||
@repo_name=User.current.login.to_s+"_"+params[:repository][:identifier]
|
||||
logger.info "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+": "+@repository_tag
|
||||
logger.info "htpasswd -mb "+@root_path+"htdocs/user.passwd "+@repo_name+": "+@repository_tag
|
||||
logger.info "the value of create repository"+@root_path+": "+@repository_name+": "+@project_path+": "+@repo_name
|
||||
attrs = pickup_extra_info
|
||||
if((@repository_tag!="")&¶ms[:repository_scm]=="Git")
|
||||
|
@ -147,9 +147,9 @@ update
|
|||
@repository.project = @project
|
||||
if request.post? && @repository.save
|
||||
if(params[:repository_scm]=="Git")
|
||||
system "htpasswd -mb "+@root_path+"user.passwd "+@repo_name+" "+@repository_tag
|
||||
system "htpasswd -mb "+@root_path+"htdocs/user.passwd "+@repo_name+" "+@repository_tag
|
||||
system "echo -e '"+@repo_name+"-write:"+
|
||||
" "+@repo_name+"' >> "+@root_path+"group.passwd"
|
||||
" "+@repo_name+"' >> "+@root_path+"htdocs/group.passwd"
|
||||
system "mkdir "+@root_path+"htdocs/"+User.current.login.to_s
|
||||
system "git init --bare "+@project_path
|
||||
system "mv "+@project_path+"/hooks/post-update{.sample,}"
|
||||
|
@ -243,8 +243,8 @@ update
|
|||
if(@repository.type=="Repository::Git")
|
||||
logger.info "destory the repository value"+"root path"+@root_path+"repo_name"+@repo_name+
|
||||
"repository_name"+@repository_name+"user group"+@middle
|
||||
system "sed -i /"+@repo_name+"/{d} "+@root_path+"user.passwd"
|
||||
system "sed -i /"+@middle+"/{d} "+@root_path+"group.passwd"
|
||||
system "sed -i /"+@repo_name+"/{d} "+@root_path+"htdocs/user.passwd"
|
||||
system "sed -i /"+@middle+"/{d} "+@root_path+"htdocs/group.passwd"
|
||||
system "rm -r "+@root_path+"htdocs/"+@repository_name
|
||||
# if(@sed_user&&@sed_group&&@remove)
|
||||
# else
|
||||
|
|
|
@ -553,7 +553,7 @@ class UsersController < ApplicationController
|
|||
@user.pref.save
|
||||
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
|
||||
|
||||
Mailer.account_information(@user, params[:user][:password]).deliver if params[:send_information]
|
||||
Mailer.run.account_information(@user, params[:user][:password]) if params[:send_information]
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
|
@ -620,9 +620,9 @@ class UsersController < ApplicationController
|
|||
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
|
||||
|
||||
if was_activated
|
||||
Mailer.account_activated(@user).deliver
|
||||
Mailer.run.account_activated(@user)
|
||||
elsif @user.active? && params[:send_information] && !params[:user][:password].blank? && @user.auth_source_id.nil?
|
||||
Mailer.account_information(@user, params[:user][:password]).deliver
|
||||
Mailer.run.account_information(@user, params[:user][:password])
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# encoding: utf-8
|
||||
#####leave message fq
|
||||
class WordsController < ApplicationController
|
||||
|
||||
include ApplicationHelper
|
||||
before_filter :find_user, :only => [:new, :create, :destroy, :more, :back]
|
||||
def create
|
||||
if params[:new_form][:user_message].size>0
|
||||
|
@ -209,6 +209,8 @@ class WordsController < ApplicationController
|
|||
message = params[:new_form][:course_message]
|
||||
feedback = Course.add_new_jour(user, message, params[:id])
|
||||
if(feedback.errors.empty?)
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
|
||||
redirect_to course_feedback_url(params[:id]), notice: l(:label_feedback_success)
|
||||
else
|
||||
flash[:error] = feedback.errors.full_messages[0]
|
||||
|
|
|
@ -5,7 +5,7 @@ class ZipdownController < ApplicationController
|
|||
#检查权限
|
||||
#勿删 before_filter :authorize, :only => [:assort,:download_user_homework]
|
||||
SAVE_FOLDER = "#{Rails.root}/files"
|
||||
OUTPUT_FOLDER = "#{Rails.root}/tmp/archiveZip"
|
||||
OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip"
|
||||
|
||||
#统一下载功能
|
||||
def download
|
||||
|
@ -16,9 +16,11 @@ class ZipdownController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#一个作业下所有文件打包下载,只有admin和课程老师有权限
|
||||
def assort
|
||||
if params[:obj_class] == "Bid"
|
||||
bid = Bid.find params[:obj_id]
|
||||
render_403 if User.current.allowed_to?(:as_teacher,bid.courses.first)
|
||||
file_count = 0
|
||||
bid.homeworks.map { |homework| file_count += homework.attachments.count}
|
||||
if file_count > 0
|
||||
|
@ -56,9 +58,9 @@ class ZipdownController < ApplicationController
|
|||
if homework != nil
|
||||
unless homework.attachments.empty?
|
||||
zipfile = zip_homework_by_user homework
|
||||
send_file zipfile, :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.name + ".zip", :type => detect_content_type(zipfile) if(zipfile)
|
||||
"_" + homework.name + ".zip", :type => detect_content_type(zipfile.file_path) if(zipfile)
|
||||
else
|
||||
render file: 'public/no_file_found.html'
|
||||
end
|
||||
|
@ -88,85 +90,116 @@ class ZipdownController < ApplicationController
|
|||
def zip_bid(bid)
|
||||
# Todo: User Access Controll
|
||||
bid_homework_path = []
|
||||
digests = []
|
||||
bid.homeworks.each do |homeattach|
|
||||
unless homeattach.attachments.empty?
|
||||
bid_homework_path << zip_homework_by_user(homeattach)
|
||||
out_file = zip_homework_by_user(homeattach)
|
||||
bid_homework_path << out_file.file_path
|
||||
digests << out_file.file_digest
|
||||
end
|
||||
end
|
||||
|
||||
zips = split_pack_files(bid_homework_path, Setting.pack_attachment_max_size.to_i*1024)
|
||||
x = 0
|
||||
homework_id = bid.id
|
||||
user_id = bid.author_id
|
||||
|
||||
|
||||
zips.each { |o|
|
||||
x += 1
|
||||
file = zipping "#{Time.now.to_i}_#{bid.name}_#{x}.zip", o[:files], OUTPUT_FOLDER
|
||||
o[:real_file] = file
|
||||
o[:file] = File.basename(file)
|
||||
o[:size] = (File.size(file) / 1024.0 / 1024.0).round(2)
|
||||
out_file = find_or_pack(homework_id, user_id, digests.sort){
|
||||
zipping("#{Time.now.to_i}_#{bid.name}.zip",
|
||||
bid_homework_path, OUTPUT_FOLDER)
|
||||
}
|
||||
|
||||
|
||||
# zips = split_pack_files(bid_homework_path, Setting.pack_attachment_max_size.to_i*1024)
|
||||
# x = 0
|
||||
#
|
||||
#
|
||||
# zips.each { |o|
|
||||
# x += 1
|
||||
# file = zipping "#{Time.now.to_i}_#{bid.name}_#{x}.zip", o[:files], OUTPUT_FOLDER
|
||||
# o[:real_file] = file
|
||||
# o[:file] = File.basename(file)
|
||||
# o[:size] = (File.size(file) / 1024.0 / 1024.0).round(2)
|
||||
# }
|
||||
|
||||
[{files:[out_file.file_path], count: 1, index: 1,
|
||||
real_file: out_file.file_path, file: File.basename(out_file.file_path),
|
||||
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
|
||||
}]
|
||||
end
|
||||
|
||||
def zip_homework_by_user(homework_attach)
|
||||
homeworks_attach_path = []
|
||||
not_exist_file = []
|
||||
# 需要将所有homework.attachments遍历加入zip
|
||||
|
||||
|
||||
digests = []
|
||||
homework_attach.attachments.each do |attach|
|
||||
if File.exist?(attach.diskfile)
|
||||
homeworks_attach_path << attach.diskfile
|
||||
digests << attach.digest
|
||||
else
|
||||
not_exist_file << attach.filename
|
||||
digests << 'not_exist_file'
|
||||
end
|
||||
end
|
||||
|
||||
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",
|
||||
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
def zip_homework_by_user(homeattach)
|
||||
homeworks_attach_path = []
|
||||
not_exist_file = []
|
||||
# 需要将所有homework.attachments遍历加入zip
|
||||
# 并且返回zip路径
|
||||
homeattach.attachments.each do |attach|
|
||||
if File.exist?(attach.diskfile)
|
||||
homeworks_attach_path << attach.diskfile
|
||||
else
|
||||
not_exist_file << attach.filename
|
||||
end
|
||||
|
||||
def find_or_pack(homework_id, user_id, digests)
|
||||
raise "please given a pack block" unless block_given?
|
||||
|
||||
out_file = ZipPack.packed?(homework_id, user_id, digests.sort)
|
||||
|
||||
unless out_file && out_file.file_valid?
|
||||
file = yield
|
||||
|
||||
ZipPack.where(homework_id: homework_id,
|
||||
user_id: user_id).delete_all
|
||||
|
||||
out_file = ZipPack.create(homework_id: homework_id,
|
||||
user_id: user_id,
|
||||
file_digest: Trustie::Utils.digest(file),
|
||||
file_path: file,
|
||||
pack_size: File.size(file),
|
||||
file_digests: digests.join(',')
|
||||
)
|
||||
else
|
||||
out_file.pack_times = out_file.pack_times + 1
|
||||
out_file.save
|
||||
end
|
||||
zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{((homeattach.user.user_extensions.nil? || homeattach.user.user_extensions.student_id.nil?) ? "" : homeattach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
|
||||
|
||||
out_file
|
||||
end
|
||||
|
||||
|
||||
def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[])
|
||||
# 输入待打包的文件列表,已经打包文件定位到ouput_path
|
||||
ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE')
|
||||
|
||||
rename_zipfile = zip_name_refer ||= "#{Time.now.to_i.to_s}.zip"
|
||||
zipfile_name = "#{output_path}/#{rename_zipfile}"
|
||||
|
||||
Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
|
||||
|
||||
unless is_attachment
|
||||
#都是zip合并,没必要再费力压缩了
|
||||
Zip.default_compression = Zlib::NO_COMPRESSION
|
||||
else
|
||||
Zip.default_compression = Zlib::DEFAULT_COMPRESSION
|
||||
end
|
||||
|
||||
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
|
||||
files_paths.each do |filename|
|
||||
flag = true
|
||||
index = 1
|
||||
rename_file = ic.iconv( (File.basename(filename)) ).to_s
|
||||
rename_file = ic.iconv( filename_to_real( File.basename(filename))).to_s if is_attachment
|
||||
|
||||
rename_file = File.basename(filename)
|
||||
rename_file = filename_to_real( File.basename(filename)) if is_attachment
|
||||
begin
|
||||
zipfile.add(rename_file, filename)
|
||||
flag = false
|
||||
rescue Exception => e
|
||||
zipfile.get_output_stream('FILE_NOTICE.txt') do |os|
|
||||
os.write l(:label_file_exist)
|
||||
end
|
||||
zipfile.get_output_stream('FILE_NOTICE.txt'){|os| os.write l(:label_file_exist)}
|
||||
next
|
||||
end
|
||||
end
|
||||
unless not_exist_file.empty?
|
||||
zipfile.get_output_stream('FILE_LOST.txt') do |os|
|
||||
os.write l(:label_file_lost) + not_exist_file.join(',').to_s
|
||||
end
|
||||
zipfile.get_output_stream('FILE_LOST.txt'){|os| os.write l(:label_file_lost) + not_exist_file.join(',').to_s}
|
||||
end
|
||||
end
|
||||
zipfile_name
|
||||
#rescue Errno => e
|
||||
# logger.error "[zipdown#zipping] ===> #{e}"
|
||||
# @error = e
|
||||
end
|
||||
|
||||
# 合理分配文件打包
|
||||
|
|
|
@ -23,7 +23,7 @@ module AccountHelper
|
|||
token = Token.new(:user => user, :action => "register")
|
||||
if user.save and token.save
|
||||
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
|
||||
Mailer.register(token).deliver
|
||||
Mailer.run.register(token)
|
||||
#flash[:notice] = l(:notice_account_register_done)
|
||||
#render action: 'email_valid', locals: {:mail => user.mail}
|
||||
else
|
||||
|
@ -51,7 +51,7 @@ module AccountHelper
|
|||
if user.save
|
||||
UserStatus.create(:user_id => user.id ,:changsets_count => 0, :watchers_count => 0)
|
||||
# Sends an email to the administrators
|
||||
Mailer.account_activation_request(user).deliver
|
||||
Mailer.run.account_activation_request(user)
|
||||
#account_pending
|
||||
else
|
||||
yield if block_given?
|
||||
|
|
|
@ -30,4 +30,16 @@ module ActivitiesHelper
|
|||
end
|
||||
sorted_events
|
||||
end
|
||||
def sort_activity_events_course(events)
|
||||
events_by_group = events.group_by(&:event_group)
|
||||
sorted_events = []
|
||||
events.sort {|x, y| y.event_datetime <=> x.event_datetime}.each do |event|
|
||||
if group_events = events_by_group.delete(event.event_group)
|
||||
group_events.sort {|x, y| y.event_datetime <=> x.event_datetime}.each_with_index do |e, i|
|
||||
sorted_events << e unless e.event_description.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
sorted_events
|
||||
end
|
||||
end
|
||||
|
|
|
@ -53,6 +53,10 @@ module ApplicationHelper
|
|||
# Author lizanle
|
||||
# Description after save后需要进行资源记录的更新
|
||||
# owner_type = 1 对应的是 memo
|
||||
# owner_type = 2 对应的是forum
|
||||
# owner_type = 3 对应的是message
|
||||
# owner_type = 4 对应的是news
|
||||
# owner_type = 5 对应的是comment
|
||||
def update_kindeditor_assets_owner ids,owner_id,owner_type
|
||||
ids.each do |id|
|
||||
asset = Kindeditor::Asset.find(id.to_i)
|
||||
|
@ -1676,6 +1680,42 @@ module ApplicationHelper
|
|||
courses_doing
|
||||
end
|
||||
|
||||
|
||||
def attachment_candown attachment
|
||||
candown = false
|
||||
if attachment.container
|
||||
if attachment.container.class.to_s != "HomeworkAttach" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project
|
||||
project = attachment.container.project
|
||||
candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
|
||||
elsif attachment.container.is_a?(Project)
|
||||
project = attachment.container
|
||||
candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
|
||||
elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board &&
|
||||
attachment.container.board.project
|
||||
project = attachment.container.board.project
|
||||
candown = User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
|
||||
elsif (attachment.container.has_attribute?(:course) ||attachment.container.has_attribute?(:course_id) ) && attachment.container.course
|
||||
course = attachment.container.course
|
||||
candown = User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
|
||||
elsif attachment.container.is_a?(Course)
|
||||
course = attachment.container
|
||||
candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
|
||||
elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board &&
|
||||
attachment.container.board.course
|
||||
course = attachment.container.board.course
|
||||
candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
|
||||
elsif attachment.container.class.to_s=="HomeworkAttach" && attachment.container.bid.reward_type == 3
|
||||
candown = true
|
||||
elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses
|
||||
course = attachment.container.courses.first
|
||||
candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1)
|
||||
else
|
||||
candown = (attachment.is_public == 1 || attachment.is_public == true)
|
||||
end
|
||||
end
|
||||
candown
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def wiki_helper
|
||||
|
|
|
@ -77,6 +77,7 @@ module AttachmentsHelper
|
|||
end
|
||||
end
|
||||
|
||||
#判断课程course中是否包含课件attachment,course中引用了attachment也算作包含
|
||||
def course_contains_attachment? course,attachment
|
||||
course.attachments.each do |att|
|
||||
if att.id == attachment.id || (!att.copy_from.nil? && !attachment.copy_from.nil? && att.copy_from == attachment.copy_from) || att.copy_from == attachment.id || att.id == attachment.copy_from
|
||||
|
@ -85,6 +86,15 @@ module AttachmentsHelper
|
|||
end
|
||||
false
|
||||
end
|
||||
#判断项目project中是否包含课件attachment,project中引用了attachment也算作包含
|
||||
def project_contains_attachment? project,attachment
|
||||
project.attachments.each do |att|
|
||||
if att.id == attachment.id || (!att.copy_from.nil? && !attachment.copy_from.nil? && att.copy_from == attachment.copy_from) || att.copy_from == attachment.id || att.id == attachment.copy_from
|
||||
return true
|
||||
end
|
||||
end
|
||||
false
|
||||
end
|
||||
|
||||
def get_qute_number attachment
|
||||
if attachment.copy_from
|
||||
|
|
|
@ -632,7 +632,7 @@ module CoursesHelper
|
|||
#获取课程动态
|
||||
def get_course_activity courses, activities
|
||||
@course_ids=activities.keys()
|
||||
|
||||
@bid_ids = []
|
||||
days = Setting.activity_days_default.to_i
|
||||
date_to ||= Date.today + 1
|
||||
date_from = date_to - days-1.years
|
||||
|
@ -653,8 +653,27 @@ module CoursesHelper
|
|||
activities[news.course_id]+=1
|
||||
end
|
||||
|
||||
#feedbackc_count
|
||||
JournalsForMessage.where(jour_id: @course_ids, jour_type: Course).each do |jourformess|
|
||||
activities[jourformess.jour_id]+=1
|
||||
end
|
||||
|
||||
#homework_count
|
||||
#HomeworkForCourse.where(course_id: @course_ids).each do |homework|
|
||||
# @bid_ids<<homework.bid_id
|
||||
# activities[homework.bid_id]+=Bid.where(id: @bid_ids).where("created_on>?",date_from).count
|
||||
|
||||
#end
|
||||
|
||||
#@bid_ids.each do |bid_id|
|
||||
# activities[] +=Bid.where(id: bid_id ).where("created_on>?",date_from).count
|
||||
|
||||
#end
|
||||
|
||||
|
||||
|
||||
# 动态数 + 1 ( 某某创建了该课程 )
|
||||
activities.each_pair { |key, value| activities[key] = value + 1 }
|
||||
# activities.each_pair { |key, value| activities[key] = value + 1 }
|
||||
return activities
|
||||
end
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ module FilesHelper
|
|||
File.new(zipfile_name,'w+')
|
||||
end
|
||||
|
||||
#带勾选框的课程列表
|
||||
def courses_check_box_tags(name,courses,current_course,attachment)
|
||||
s = ''
|
||||
courses.each do |course|
|
||||
|
@ -55,6 +56,17 @@ module FilesHelper
|
|||
s.html_safe
|
||||
end
|
||||
|
||||
#带勾选框的项目列表
|
||||
def projects_check_box_tags(name,projects,current_project,attachment)
|
||||
s = ''
|
||||
projects.each do |project|
|
||||
if !project_contains_attachment?(project,attachment) && User.current.allowed_to?(:manage_files, project)
|
||||
s << "<label>#{ check_box_tag name, project.id, false, :id => nil } #{h project.name}</label>"
|
||||
end
|
||||
end
|
||||
s.html_safe
|
||||
end
|
||||
|
||||
#判断用户是否拥有不包含当前资源的课程,需用户在该课程中角色为教师且该课程属于当前学期或下一学期
|
||||
def has_course? user,file
|
||||
result = false
|
||||
|
@ -66,6 +78,17 @@ module FilesHelper
|
|||
result
|
||||
end
|
||||
|
||||
#判断用户是否拥有不包含当前资源的项目,需用户在该项目中有资源管理相关资源
|
||||
def has_project? user,file
|
||||
result = false
|
||||
user.projects.each do |project|
|
||||
if !project_contains_attachment?(project,file) && User.current.allowed_to?(:manage_files, project)
|
||||
return true
|
||||
end
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
# 判断指定的资源时候符合类型
|
||||
def isTypeOk(attachment, type, contentType)
|
||||
result = false
|
||||
|
@ -97,49 +120,23 @@ module FilesHelper
|
|||
result
|
||||
end
|
||||
|
||||
def visable_attachemnts_insite attachments,course
|
||||
def visable_attachemnts_insite attachments,obj
|
||||
result = []
|
||||
attachments.each do |attachment|
|
||||
if attachment.is_public? || (attachment.container_type == "Course" && attachment.container_id == course.id && User.current.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id
|
||||
result << attachment
|
||||
if obj.is_a?(Course)
|
||||
attachments.each do |attachment|
|
||||
if attachment.is_public? || (attachment.container_type == "Course" && attachment.container_id == obj.id && User.current.member_of_course?(Course.find(attachment.container_id)))|| attachment.author_id == User.current.id
|
||||
result << attachment
|
||||
end
|
||||
end
|
||||
else if obj.is_a?(Project)
|
||||
attachments.each do |attachment|
|
||||
if attachment.is_public? || (attachment.container_type == "Project" && attachment.container_id == obj.id && User.current.member_of_course?(Project.find(attachment.container_id)))|| attachment.author_id == User.current.id
|
||||
result << attachment
|
||||
end
|
||||
end
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
def attachment_candown attachment
|
||||
candown = false
|
||||
if attachment.container
|
||||
if attachment.container.class.to_s != "HomeworkAttach" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project
|
||||
project = attachment.container.project
|
||||
candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
|
||||
elsif attachment.container.is_a?(Project)
|
||||
project = attachment.container
|
||||
candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
|
||||
elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board &&
|
||||
attachment.container.board.project
|
||||
project = attachment.container.board.project
|
||||
candown = User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
|
||||
elsif (attachment.container.has_attribute?(:course) ||attachment.container.has_attribute?(:course_id) ) && attachment.container.course
|
||||
course = attachment.container.course
|
||||
candown = User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
|
||||
elsif attachment.container.is_a?(Course)
|
||||
course = attachment.container
|
||||
candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
|
||||
elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board &&
|
||||
attachment.container.board.course
|
||||
course = attachment.container.board.course
|
||||
candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
|
||||
elsif attachment.container.class.to_s=="HomeworkAttach" && attachment.container.bid.reward_type == 3
|
||||
candown = true
|
||||
elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses
|
||||
course = attachment.container.courses.first
|
||||
candown = User.current.member_of_course?(attachment.container.courses.first) || (course.is_public == 1 && attachment.is_public == 1)
|
||||
else
|
||||
candown = (attachment.is_public == 1 || attachment.is_public == true)
|
||||
end
|
||||
end
|
||||
candown
|
||||
result
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
module OwnerTypeHelper
|
||||
MEMO = 1
|
||||
FORUM = 2
|
||||
MESSAGE = 3
|
||||
NEWS = 4
|
||||
COMMENT = 5
|
||||
BID = 6
|
||||
JOURNALSFORMESSAGE = 7
|
||||
end
|
|
@ -17,7 +17,8 @@ class Bid < ActiveRecord::Base
|
|||
HomeworkProject = 2
|
||||
attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type, :password
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
include ApplicationHelper
|
||||
has_many_kindeditor_assets :assets, :dependent => :destroy
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => :author_id
|
||||
belongs_to :course
|
||||
has_many :biding_projects, :dependent => :destroy
|
||||
|
@ -47,7 +48,7 @@ class Bid < ActiveRecord::Base
|
|||
validate :validate_user
|
||||
validate :validate_reward_type
|
||||
after_create :act_as_activity
|
||||
|
||||
after_destroy :delete_kindeditor_assets
|
||||
scope :visible, lambda {|*args|
|
||||
nil
|
||||
}
|
||||
|
@ -157,5 +158,10 @@ class Bid < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
# Time 2015-04-01 14:19:06
|
||||
# Author lizanle
|
||||
# Description 删除对应课程通知的图片资源
|
||||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::BID
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,8 +17,25 @@
|
|||
|
||||
class Comment < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
include ApplicationHelper
|
||||
has_many_kindeditor_assets :assets, :dependent => :destroy
|
||||
belongs_to :commented, :polymorphic => true, :counter_cache => true
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
validates_presence_of :commented, :author, :comments
|
||||
safe_attributes 'comments'
|
||||
after_create :send_mail
|
||||
|
||||
def send_mail
|
||||
if self.commented.is_a?(News) && Setting.notified_events.include?('news_comment_added')
|
||||
Mailer.run.news_comment_added(self)
|
||||
end
|
||||
end
|
||||
after_destroy :delete_kindeditor_assets
|
||||
|
||||
# Time 2015-03-31 09:15:06
|
||||
# Author lizanle
|
||||
# Description 删除对应评论的图片资源
|
||||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::COMMENT
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class CommentObserver < ActiveRecord::Observer
|
||||
def after_create(comment)
|
||||
if comment.commented.is_a?(News) && Setting.notified_events.include?('news_comment_added')
|
||||
##by senluo
|
||||
thread3=Thread.new do
|
||||
Mailer.news_comment_added(comment).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -24,6 +24,7 @@ class Document < ActiveRecord::Base
|
|||
after_save :be_user_score # user_score
|
||||
after_destroy :down_user_score
|
||||
acts_as_attachable :delete_permission => :delete_documents
|
||||
after_create :send_mail
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# end
|
||||
|
@ -87,4 +88,8 @@ class Document < ActiveRecord::Base
|
|||
:project_id => self.project_id)
|
||||
end
|
||||
|
||||
def send_mail
|
||||
Mailer.run.document_added(self) if Setting.notified_events.include?('document_added')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class DocumentObserver < ActiveRecord::Observer
|
||||
def after_create(document)
|
||||
##by senluo
|
||||
thread2=Thread.new do
|
||||
Mailer.document_added(document).deliver if Setting.notified_events.include?('document_added')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -20,7 +20,7 @@ class Forum < ActiveRecord::Base
|
|||
after_destroy :delete_kindeditor_assets
|
||||
acts_as_taggable
|
||||
scope :by_join_date, order("created_at DESC")
|
||||
#after_create :send_email
|
||||
after_create :send_mail
|
||||
def reset_counters!
|
||||
self.class.reset_counters!(id)
|
||||
end
|
||||
|
@ -35,10 +35,9 @@ class Forum < ActiveRecord::Base
|
|||
self.creator == user || user.admin?
|
||||
end
|
||||
|
||||
def send_email
|
||||
Thread.start do
|
||||
Mailer.forum_add(self).deliver if Setting.notified_events.include?('forum_add')
|
||||
end
|
||||
def send_mail
|
||||
logger.debug "send mail for forum add."
|
||||
Mailer.run.forum_add(self) if Setting.notified_events.include?('forum_add')
|
||||
end
|
||||
# Updates topic_count, memo_count and last_memo_id attributes for +board_id+
|
||||
def self.reset_counters!(forum_id)
|
||||
|
@ -53,7 +52,7 @@ class Forum < ActiveRecord::Base
|
|||
# Author lizanle
|
||||
# Description 删除论坛后删除对应的资源
|
||||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,2
|
||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::FORUM
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
class ForumObserver < ActiveRecord::Observer
|
||||
# def after_create(forum)
|
||||
# Thread.start do
|
||||
# Mailer.forum_add(forum).deliver if Setting.notified_events.include?('forum_add')
|
||||
# end
|
||||
#
|
||||
# end
|
||||
end
|
|
@ -18,13 +18,11 @@
|
|||
class IssueObserver < ActiveRecord::Observer
|
||||
|
||||
def after_create(issue)
|
||||
Thread.start do
|
||||
# 将跟踪者与本项目的其他成员都设为收件方,并去重,不在进行抄送,
|
||||
recipients = issue.recipients - issue.watcher_recipients + issue.watcher_recipients
|
||||
recipients.each do |rec|
|
||||
Mailer.issue_add(issue,rec).deliver if Setting.notified_events.include?('issue_added')
|
||||
Mailer.run.issue_add(issue,rec) if Setting.notified_events.include?('issue_added')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,14 +23,12 @@ class JournalObserver < ActiveRecord::Observer
|
|||
(Setting.notified_events.include?('issue_status_updated') && journal.new_status.present?) ||
|
||||
(Setting.notified_events.include?('issue_priority_updated') && journal.new_value_for('priority_id').present?)
|
||||
)
|
||||
Thread.start do
|
||||
# 将跟踪者与本项目的其他成员都设为收件方,并去重,不在进行抄送,
|
||||
recipients = journal.recipients - journal.watcher_recipients + journal.watcher_recipients
|
||||
recipients.each do |rec|
|
||||
|
||||
Mailer.issue_edit(journal,rec).deliver
|
||||
Mailer.run.issue_edit(journal,rec)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
class JournalsForMessage < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
include UserScoreHelper
|
||||
include ApplicationHelper
|
||||
has_many_kindeditor_assets :assets, :dependent => :destroy
|
||||
safe_attributes "jour_type", # 留言所属类型
|
||||
"jour_id", # 留言所属类型的id
|
||||
"notes", # 留言内容
|
||||
|
@ -16,7 +18,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
"m_reply_id" # 回复某留言的留言id(a留言回复了b留言,这是b留言的id)
|
||||
"is_comprehensive_evaluation" # 1 教师评论、2 匿评、3 留言
|
||||
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
|
||||
|
||||
after_destroy :delete_kindeditor_assets
|
||||
belongs_to :project,
|
||||
:foreign_key => 'jour_id',
|
||||
:conditions => "#{self.table_name}.jour_type = 'Project' "
|
||||
|
@ -163,5 +165,10 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
# Time 2015-04-01 14:15:06
|
||||
# Author lizanle
|
||||
# Description 删除对应课程留言的图片资源
|
||||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,7
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
# Added by young
|
||||
class JournalsForMessageObserver < ActiveRecord::Observer
|
||||
def after_create(journals_for_message)
|
||||
thread1 = Thread.start do
|
||||
Mailer.journals_for_message_add(User.current, journals_for_message).deliver
|
||||
end
|
||||
Mailer.run.journals_for_message_add(User.current, journals_for_message)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class MailHandler < ActionMailer::Base
|
|||
end
|
||||
add_user_to_group(@@handler_options[:default_group])
|
||||
unless @@handler_options[:no_account_notice]
|
||||
Mailer.account_information(@user, @user.password).deliver
|
||||
Mailer.run.account_information(@user, @user.password)
|
||||
end
|
||||
else
|
||||
if logger && logger.error
|
||||
|
|
|
@ -27,6 +27,24 @@ class Mailer < ActionMailer::Base
|
|||
{ :host => Setting.host_name, :protocol => Setting.protocol }
|
||||
end
|
||||
|
||||
|
||||
class MailerProxy
|
||||
def initialize(cls)
|
||||
@target = cls
|
||||
end
|
||||
def method_missing(name, *args, &block)
|
||||
if Setting.delayjob_enabled && Object.const_defined?('Delayed')
|
||||
@target.delay.send(name, *args, &block)
|
||||
else
|
||||
@target.send(name, *args, &block).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.run
|
||||
MailerProxy.new(self)
|
||||
end
|
||||
|
||||
# author: alan
|
||||
# 发送邀请未注册用户加入项目邮件
|
||||
# 功能: 在加入项目的同时自动注册用户
|
||||
|
@ -45,6 +63,12 @@ class Mailer < ActionMailer::Base
|
|||
def send_for_user_activities(user, date_to, days)
|
||||
date_from = date_to - days.days
|
||||
|
||||
subject = "[ #{user.show_name} : #{l(:label_day_mail)}]"
|
||||
@subject = " #{user.show_name} : #{date_to} #{l(:label_day_mail)}"
|
||||
|
||||
date_from = "#{date_from} 23:59:59"
|
||||
date_to = "#{date_to} 23:59:59"
|
||||
|
||||
# 生成token用于直接点击登录
|
||||
@user = user
|
||||
token = Token.new(:user =>user , :action => 'autologin')
|
||||
|
@ -59,10 +83,11 @@ class Mailer < ActionMailer::Base
|
|||
course_ids = courses.map {|course| course.id}.join(",")
|
||||
|
||||
# 查询user的缺陷,包括发布的,跟踪的以及被指派的缺陷
|
||||
@issues = Issue.find_by_sql("select DISTINCT i.* from issues i, watchers w
|
||||
sql = "select DISTINCT i.* from issues i, watchers w
|
||||
where (i.assigned_to_id = #{user.id} or i.author_id = #{user.id}
|
||||
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")
|
||||
and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
|
||||
@issues = Issue.find_by_sql(sql)
|
||||
|
||||
# @bids 查询课程作业,包括老师发布的作业,以及user提交作业
|
||||
# @attachments查询课程课件更新
|
||||
|
@ -114,15 +139,15 @@ class Mailer < ActionMailer::Base
|
|||
@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}))
|
||||
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
|
||||
if days == 1
|
||||
subject = "[ #{user.show_name} : #{l(:label_day_mail)}]"
|
||||
@subject = " #{user.show_name} : #{date_to - 1.days} #{l(:label_day_mail)}"
|
||||
else
|
||||
subject = "[ #{user.show_name} : #{l(:label_week_mail)}]"
|
||||
@subject = "#{user.show_name} : #{l(:label_week_mail)}"
|
||||
end
|
||||
mail :to => user.mail,:subject => subject
|
||||
|
||||
|
||||
has_content = [@issues,@homeworks,@course_messages,@project_messages,@course_news,@project_news,
|
||||
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o|
|
||||
!o.empty?
|
||||
}
|
||||
binding.pry if Rails.env.development?
|
||||
#有内容才发,没有不发
|
||||
mail :to => user.mail,:subject => subject if has_content
|
||||
end
|
||||
|
||||
# 公共讨论区发帖、回帖添加邮件发送信息
|
||||
|
@ -135,17 +160,15 @@ class Mailer < ActionMailer::Base
|
|||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
recipients ||= []
|
||||
#将帖子创建者邮箱地址加入数组
|
||||
if @forum.creator.mail_notification != 'day' && @forum.creator.mail_notification != 'week'
|
||||
recipients << @forum.creator.mail
|
||||
end
|
||||
recipients << @forum.creator.mail
|
||||
#回复人邮箱地址加入数组
|
||||
if @author.mail_notification != 'day' && @author.mail_notification != 'week'
|
||||
recipients << @author.mail
|
||||
end
|
||||
recipients << @author.mail
|
||||
# cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
|
||||
@memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)))
|
||||
mail :to => recipients,:subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]"
|
||||
mail :to => recipients,
|
||||
:subject => "[ #{l(:label_message_plural)} : #{memo.subject} #{l(:label_memo_create_succ)}]",
|
||||
:filter => true
|
||||
end
|
||||
# Builds a Mail::Message object used to email recipients of the added journals for message.
|
||||
|
||||
|
@ -180,12 +203,8 @@ class Mailer < ActionMailer::Base
|
|||
# 验证用户的收取邮件的方式
|
||||
recipients ||= []
|
||||
recipients1 ||= []
|
||||
if @mail.mail_notification != 'week' && @mail.mail_notification != 'day'
|
||||
recipients1 = @mail.mail
|
||||
end
|
||||
if journals_for_message.jour.author.mail_notification != 'week' && journals_for_message.jour.author.mail_notification != 'day'
|
||||
recipients = journals_for_message.jour.author.mail
|
||||
end
|
||||
recipients1 = @mail.mail
|
||||
recipients = journals_for_message.jour.author.mail
|
||||
|
||||
# modify by nwb
|
||||
#如果是直接留言并且留言对象是课程
|
||||
|
@ -197,25 +216,24 @@ class Mailer < ActionMailer::Base
|
|||
#收件人邮箱
|
||||
@recipients ||= []
|
||||
@members.each do |teacher|
|
||||
if teacher.user.mail_notification != 'week' && teacher.user.mail_notification != 'day'
|
||||
@recipients << teacher.user.mail
|
||||
end
|
||||
@recipients << teacher.user.mail
|
||||
end
|
||||
mail :to => @recipients,
|
||||
:subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} "
|
||||
:subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ",
|
||||
:filter => true
|
||||
elsif journals_for_message.jour.class.to_s.to_sym == :Bid
|
||||
if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||
return -1
|
||||
end
|
||||
|
||||
mail :to => recipients, :subject => @title
|
||||
mail :to => recipients, :subject => @title,:filter => true
|
||||
elsif journals_for_message.jour.class.to_s.to_sym == :Contest
|
||||
if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||
return -1
|
||||
end
|
||||
mail :to => recipients, :subject => @title
|
||||
mail :to => recipients, :subject => @title,:filter => true
|
||||
else
|
||||
mail :to => recipients1, :subject => @title
|
||||
mail :to => recipients1, :subject => @title,:filter => true
|
||||
end
|
||||
|
||||
|
||||
|
@ -250,9 +268,9 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
|
||||
subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
|
||||
mail(:to => recipients,
|
||||
|
||||
:subject => subject)
|
||||
mail :to => recipients,
|
||||
:subject => subject,
|
||||
:filter => true
|
||||
end
|
||||
# issue.attachments.each do |attach|
|
||||
# attachments["#{attach.filename}"] = File.read("#{attach.disk_filename}")
|
||||
|
@ -298,9 +316,9 @@ class Mailer < ActionMailer::Base
|
|||
@issue = issue
|
||||
@journal = journal
|
||||
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}")
|
||||
mail(:to => recipients,
|
||||
|
||||
:subject => s)
|
||||
mail :to => recipients,
|
||||
:subject => s,
|
||||
:filter => true
|
||||
end
|
||||
|
||||
def self.deliver_mailer(to,cc, subject)
|
||||
|
@ -386,7 +404,8 @@ class Mailer < ActionMailer::Base
|
|||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
@document_url = url_for(:controller => 'documents', :action => 'show', :id => document)
|
||||
mail :to => document.recipients,
|
||||
:subject => "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}"
|
||||
:subject => "[#{document.project.name}] #{l(:label_document_new)}: #{document.title}",
|
||||
:filter => true
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email recipients of a project when an attachements are added.
|
||||
|
@ -424,21 +443,24 @@ class Mailer < ActionMailer::Base
|
|||
@added_to = added_to
|
||||
@added_to_url = added_to_url
|
||||
mail :to => recipients,
|
||||
:subject => "[#{container.name}] #{l(:label_attachment_new)}"
|
||||
:subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
||||
:filter => true
|
||||
elsif container.class.name == 'Project'
|
||||
redmine_headers 'Project' => container.id
|
||||
@attachments = attachments
|
||||
@added_to = added_to
|
||||
@added_to_url = added_to_url
|
||||
mail :to => recipients,
|
||||
:subject => "[#{container.name}] #{l(:label_attachment_new)}"
|
||||
:subject => "[#{container.name}] #{l(:label_attachment_new)}",
|
||||
:filter => true
|
||||
else
|
||||
redmine_headers 'Project' => container.project.identifier
|
||||
@attachments = attachments
|
||||
@added_to = added_to
|
||||
@added_to_url = added_to_url
|
||||
mail :to => recipients,
|
||||
:subject => "[#{container.project.name}] #{l(:label_attachment_new)}"
|
||||
:subject => "[#{container.project.name}] #{l(:label_attachment_new)}",
|
||||
:filter => true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -457,7 +479,8 @@ class Mailer < ActionMailer::Base
|
|||
@news = news
|
||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
mail :to => news.recipients,
|
||||
:subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}"
|
||||
:subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
:filter => true
|
||||
elsif news.course
|
||||
redmine_headers 'Course' => news.course.id
|
||||
@author = news.author
|
||||
|
@ -467,7 +490,8 @@ class Mailer < ActionMailer::Base
|
|||
recipients = news.course.notified_users.select { |user| user.allowed_to?(:view_files, news.course) }.collect { |u| u.mail }
|
||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
mail :to => recipients,
|
||||
:subject => "[#{news.course.name}] #{l(:label_news)}: #{news.title}"
|
||||
:subject => "[#{news.course.name}] #{l(:label_news)}: #{news.title}",
|
||||
:filter => true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -488,7 +512,8 @@ class Mailer < ActionMailer::Base
|
|||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
mail :to => news.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
|
||||
elsif news.course
|
||||
redmine_headers 'Course' => news.course.id
|
||||
@author = comment.author
|
||||
|
@ -500,7 +525,8 @@ class Mailer < ActionMailer::Base
|
|||
recipients = news.course.notified_users.select { |user| user.allowed_to?(:view_files, news.course) }.collect { |u| u.mail }
|
||||
|
||||
mail :to => recipients,
|
||||
:subject => "[#{news.course.name}] #{l(:label_news)}: #{news.title}"
|
||||
:subject => "[#{news.course.name}] #{l(:label_news)}: #{news.title}",
|
||||
:filter => true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -523,7 +549,8 @@ class Mailer < ActionMailer::Base
|
|||
@message_url = url_for(message.event_url)
|
||||
mail :to => recipients,
|
||||
: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
|
||||
elsif message.course
|
||||
redmine_headers 'Course' => message.course.id,
|
||||
'Topic-Id' => (message.parent_id || message.id)
|
||||
|
@ -537,7 +564,8 @@ class Mailer < ActionMailer::Base
|
|||
@message_url = url_for(message.event_url)
|
||||
mail :to => recipients,
|
||||
:cc => cc,
|
||||
:subject => "[#{message.board.course.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}"
|
||||
:subject => "[#{message.board.course.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
||||
:filter => true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -559,7 +587,8 @@ class Mailer < ActionMailer::Base
|
|||
:id => wiki_content.page.title)
|
||||
mail :to => recipients,
|
||||
: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
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was updated.
|
||||
|
@ -583,7 +612,8 @@ class Mailer < ActionMailer::Base
|
|||
:version => wiki_content.version)
|
||||
mail :to => recipients,
|
||||
: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
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email the specified user their account information.
|
||||
|
@ -734,6 +764,25 @@ class Mailer < ActionMailer::Base
|
|||
ActionMailer::Base.delivery_method = saved_method
|
||||
end
|
||||
|
||||
#过滤掉不是不合规则的收件人
|
||||
def filter(reps)
|
||||
r_reps = []
|
||||
if reps.is_a? Array
|
||||
reps.each do |r|
|
||||
u = User.find_by_mail(r)
|
||||
if u && u.mail_notification == 'all'
|
||||
r_reps << r
|
||||
end
|
||||
end
|
||||
elsif reps.is_a? String
|
||||
u = User.find_by_mail(r)
|
||||
if u && u.mail_notification == 'all'
|
||||
r_reps << r
|
||||
end
|
||||
end
|
||||
r_reps
|
||||
end
|
||||
|
||||
def mail(headers={})
|
||||
headers.merge! 'X-Mailer' => 'Redmine',
|
||||
'X-Redmine-Host' => Setting.host_name,
|
||||
|
@ -750,6 +799,11 @@ class Mailer < ActionMailer::Base
|
|||
headers[:cc].delete(@author.mail) if headers[:cc].is_a?(Array)
|
||||
end
|
||||
|
||||
if headers[:filter]
|
||||
headers[:to] = filter(headers[:to])
|
||||
headers[:cc] = filter(headers[:cc])
|
||||
end
|
||||
|
||||
if @author && @author.logged?
|
||||
redmine_headers 'Sender' => @author.login
|
||||
end
|
||||
|
|
|
@ -44,7 +44,7 @@ class Memo < ActiveRecord::Base
|
|||
"parent_id",
|
||||
"replies_count"
|
||||
|
||||
after_create :add_author_as_watcher, :reset_counters!, :sendmail
|
||||
after_create :add_author_as_watcher, :reset_counters!, :send_mail
|
||||
# after_update :update_memos_forum
|
||||
after_destroy :reset_counters!,:delete_kindeditor_assets#,:down_user_score -- 公共区发帖暂不计入得分
|
||||
# after_create :send_notification
|
||||
|
@ -55,10 +55,8 @@ class Memo < ActiveRecord::Base
|
|||
# includes(:forum => ).where()
|
||||
# }
|
||||
|
||||
def sendmail
|
||||
thread1=Thread.new do
|
||||
Mailer.forum_message_added(self).deliver if Setting.notified_events.include?('forum_message_added')
|
||||
end
|
||||
def send_mail
|
||||
Mailer.run.forum_message_added(self) if Setting.notified_events.include?('forum_message_added')
|
||||
end
|
||||
|
||||
def cannot_reply_to_locked_topic
|
||||
|
@ -115,7 +113,7 @@ class Memo < ActiveRecord::Base
|
|||
|
||||
def send_notification
|
||||
if Setting.notified_events.include?('message_posted')
|
||||
Mailer.message_posted(self).deliver
|
||||
Mailer.run.message_posted(self)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -176,6 +174,6 @@ class Memo < ActiveRecord::Base
|
|||
# Author lizanle
|
||||
# Description 从硬盘上删除资源
|
||||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,1
|
||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MEMO
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
class MemoObserver < ActiveRecord::Observer
|
||||
def after_create(memo)
|
||||
|
||||
thread1=Thread.new do
|
||||
Mailer.forum_message_added(memo).deliver if Setting.notified_events.include?('forum_message_added')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -18,6 +18,8 @@
|
|||
class Message < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
include UserScoreHelper
|
||||
include ApplicationHelper
|
||||
has_many_kindeditor_assets :assets, :dependent => :destroy
|
||||
belongs_to :board
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
|
||||
|
@ -62,12 +64,10 @@ class Message < ActiveRecord::Base
|
|||
|
||||
after_create :add_author_as_watcher, :reset_counters!
|
||||
after_update :update_messages_board
|
||||
after_destroy :reset_counters!,:down_user_score
|
||||
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets
|
||||
|
||||
# fq
|
||||
after_create :act_as_activity,:be_user_score,:act_as_forge_activity
|
||||
after_create :act_as_activity,:be_user_score,:act_as_forge_activity, :send_mail
|
||||
#before_save :be_user_score
|
||||
# end
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
includes(:board => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_messages, *args))
|
||||
|
@ -208,5 +208,14 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def send_mail
|
||||
Mailer.run.message_posted(self) if Setting.notified_events.include?('message_posted')
|
||||
end
|
||||
|
||||
# Time 2015-03-31 09:15:06
|
||||
# Author lizanle
|
||||
# Description 删除对应消息的图片资源
|
||||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class MessageObserver < ActiveRecord::Observer
|
||||
def after_create(message)
|
||||
##by senluo
|
||||
thread5=Thread.new do
|
||||
Mailer.message_posted(message).deliver if Setting.notified_events.include?('message_posted')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -18,6 +18,8 @@
|
|||
class News < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :project
|
||||
include ApplicationHelper
|
||||
has_many_kindeditor_assets :assets, :dependent => :destroy
|
||||
#added by nwb
|
||||
belongs_to :course
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
|
@ -45,11 +47,10 @@ class News < ActiveRecord::Base
|
|||
:author_key => :author_id
|
||||
acts_as_watchable
|
||||
|
||||
after_create :add_author_as_watcher
|
||||
# fq
|
||||
after_create :act_as_activity,:act_as_forge_activity
|
||||
# end
|
||||
|
||||
after_create :act_as_activity,:act_as_forge_activity,:add_author_as_watcher, :send_mail
|
||||
|
||||
after_destroy :delete_kindeditor_assets
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args))
|
||||
}
|
||||
|
@ -105,4 +106,15 @@ class News < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# Time 2015-03-31 13:50:54
|
||||
# Author lizanle
|
||||
# Description 删除news后删除对应的资源
|
||||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::NEWS
|
||||
end
|
||||
|
||||
def send_mail
|
||||
Mailer.run.news_added(self) if Setting.notified_events.include?('news_added')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class NewsObserver < ActiveRecord::Observer
|
||||
def after_create(news)
|
||||
##by senluo
|
||||
thread6=Thread.new do
|
||||
Mailer.news_added(news).deliver if Setting.notified_events.include?('news_added')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -159,7 +159,7 @@ class RelativeMemo < ActiveRecord::Base
|
|||
|
||||
def send_notification
|
||||
if Setting.notified_events.include?('message_posted')
|
||||
Mailer.message_posted(self).deliver
|
||||
Mailer.run.message_posted(self)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -64,9 +64,10 @@ class User < Principal
|
|||
},
|
||||
}
|
||||
|
||||
#每日一报、一事一报、不报
|
||||
MAIL_NOTIFICATION_OPTIONS = [
|
||||
['all', :label_user_mail_option_all],
|
||||
['week', :label_user_mail_option_week],
|
||||
#['week', :label_user_mail_option_week],
|
||||
['day', :label_user_mail_option_day],
|
||||
['none', :label_user_mail_option_none]
|
||||
]
|
||||
|
|
|
@ -17,18 +17,12 @@
|
|||
|
||||
class WikiContentObserver < ActiveRecord::Observer
|
||||
def after_create(wiki_content)
|
||||
##by senluo
|
||||
thread7=Thread.new do
|
||||
Mailer.wiki_content_added(wiki_content).deliver if Setting.notified_events.include?('wiki_content_added')
|
||||
end
|
||||
Mailer.run.wiki_content_added(wiki_content) if Setting.notified_events.include?('wiki_content_added')
|
||||
end
|
||||
|
||||
def after_update(wiki_content)
|
||||
if wiki_content.text_changed?
|
||||
##by senluo
|
||||
thread8=Thread.new do
|
||||
Mailer.wiki_content_updated(wiki_content).deliver if Setting.notified_events.include?('wiki_content_updated')
|
||||
end
|
||||
Mailer.run.wiki_content_updated(wiki_content) if Setting.notified_events.include?('wiki_content_updated')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
class ZipPack < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
|
||||
def self.packed?(bid_id, user_id, digests)
|
||||
zip_pack = ZipPack.where(homework_id: bid_id, user_id: user_id).first
|
||||
return false unless zip_pack && zip_pack.digests == digests
|
||||
zip_pack
|
||||
end
|
||||
|
||||
def file_valid?
|
||||
return false unless File.exist?(self.file_path)
|
||||
Trustie::Utils.digest(self.file_path) == self.file_digest
|
||||
end
|
||||
|
||||
def digests
|
||||
self.file_digests.split(',').sort
|
||||
end
|
||||
end
|
|
@ -194,6 +194,8 @@ class CoursesService
|
|||
@course.setup_time = params[:setup_time]
|
||||
@course.endup_time = params[:endup_time]
|
||||
@course.class_period = params[:class_period]
|
||||
params[:course][:is_public] ? @course.is_public = 1 : @course.is_public = 0
|
||||
params[:course][:open_student] ? @course.open_student = 1 : @course.open_student = 0
|
||||
end
|
||||
|
||||
@issue_custom_fields = IssueCustomField.sorted.all
|
||||
|
|
|
@ -20,7 +20,7 @@ class HomeworkService
|
|||
many_times = course.homeworks.index(@bid) + 1
|
||||
name = @bid.name
|
||||
homework_count = @bid.homeworks.count #已提交的作业数量
|
||||
student_questions_count = @bid.commit.nil? ? 0 : @bid.commit
|
||||
student_questions_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
description = @bid.description
|
||||
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
||||
state = @bid.comment_status
|
||||
|
@ -282,7 +282,7 @@ class HomeworkService
|
|||
many_times = course.homeworks.index(@bid) + 1
|
||||
name = @bid.name
|
||||
homework_count = @bid.homeworks.count #已提交的作业数量
|
||||
student_questions_count = @bid.commit.nil? ? 0 : @bid.commit
|
||||
student_questions_count = @bid.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
description = @bid.description
|
||||
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
||||
state = @bid.comment_status
|
||||
|
|
|
@ -95,9 +95,7 @@ class UsersService
|
|||
# create a new token for password recovery
|
||||
token = Token.new(:user => user, :action => "recovery")
|
||||
if token.save
|
||||
Thread.new do
|
||||
Mailer.lost_password(token).deliver
|
||||
end
|
||||
Mailer.run.lost_password(token)
|
||||
return l(:notice_account_lost_email_sent,:locale => user.language)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<% if !@save_flag && @save_message %>
|
||||
$("#error_show").html("<%= @save_message.join(', ') %>");
|
||||
<% elsif @message && @message != "" %>
|
||||
$("#error_show").html("<%= @message.html_safe %>");
|
||||
<% else %>
|
||||
closeModal();
|
||||
<% end %>
|
|
@ -22,8 +22,8 @@
|
|||
<%= link_to "留言", get_homework_jours_homework_attach_index_path(:bid_id => @bid.id), {:remote => true}%>
|
||||
(<span id="jours_count" class="c_red f_12"><%= @jours_count %></span>)
|
||||
</li>
|
||||
<li>
|
||||
<%#= link_to "作品打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), class: "tb_all" unless @bid.homeworks.empty? %>
|
||||
<li><%= link_to "作品打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid, format: :json),
|
||||
remote: true, class: "tb_all" unless @bid.homeworks.empty? %>
|
||||
</li>
|
||||
</ul>
|
||||
<% else %>
|
||||
|
|
|
@ -13,7 +13,13 @@
|
|||
</li>
|
||||
<li class="ml45">
|
||||
<label class="fl" > <%= l(:field_quote)%> :</label>
|
||||
<textarea name="bid[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl"><%= bid.description%></textarea>
|
||||
<!--<textarea name="bid[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl"></textarea>-->
|
||||
<% if edit_mode %>
|
||||
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:owner_id => bid.id,:owner_type =>OwnerTypeHelper::BID %>
|
||||
<% else %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml21">
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= labelled_form_for @bid do |f| %>
|
||||
<%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}"} %>
|
||||
<%= render :partial => 'new_homework_form', :locals => { :bid => @bid, :bid_id => "edit_bid_#{@bid.id}",:f=>f,:edit_mode => true} %>
|
||||
<% end %>
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
<% if @project %>
|
||||
<%= render :partial => 'project_show', locals: {project: @project} %>
|
||||
<% elsif @course %>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<div class="msg_box" id='leave-message'>
|
||||
<%# reply_allow = JournalsForMessage.create_by_user? User.current %>
|
||||
<h4><%= l(:label_leave_message) %></h4>
|
||||
|
@ -11,11 +11,12 @@
|
|||
</div>
|
||||
<% else %>
|
||||
<%= form_for('new_form', :method => :post,
|
||||
:url => {:controller => 'words', :action => 'leave_course_message'}) do |f|%>
|
||||
<%= f.text_area 'course_message',:id => "leave_meassge",:style => "resize: none;",
|
||||
:placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250%>
|
||||
:url => {:controller => 'words', :action => 'leave_course_message'},:html => {:id=>'leave_message_form'}) do |f|%>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<%= f.kindeditor 'course_message',:editor_id => 'leave_message_editor',:input_html=>{:id => "leave_meassge",:style => "resize: none;",
|
||||
:placeholder => "#{l(:label_welcome_my_respond)}",:maxlength => 250}%>
|
||||
<a href="#" class="grey_btn fr ml10">取 消</a>
|
||||
<a href="#" onclick='$("#leave_meassge").parent().submit();' class="blue_btn fr"> <%= l(:button_leave_meassge)%></a>
|
||||
<a href="#" onclick='leave_message_editor.sync();$("#leave_message_form").submit();' class="blue_btn fr"> <%= l(:button_leave_meassge)%></a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</script>
|
||||
<div id="bid_description_<%= bid.id%>" class="news_description mt5">
|
||||
<div id="bid_description_<%= bid.id%>_content">
|
||||
<%= textilizable bid, :description %>
|
||||
<%= textAreailizable bid, :description %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="news_foot c_red" id="bid_show_more_des_button<%= bid.id%>" onclick="bid_show_more_des(<%= bid.id%>);" style="cursor:pointer;display: none;">
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
<script src="/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="/javascripts/iPass.packed.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
// to enable iPass plugin
|
||||
$("input[type=password]").iPass();
|
||||
|
||||
// for the demo
|
||||
$("#psw_btn").click(function() {
|
||||
alert("密码: "+$("#course_course_password").val());
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<div class="project_r_h02">
|
||||
<h2 class="project_h2"><%= l(:permission_new_course)%></h2>
|
||||
</div>
|
||||
|
@ -24,7 +37,8 @@
|
|||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_new_course_password)%> :</label>
|
||||
<input type="text" name="course[password]" id="course_course_password" class="hwork_input02" >
|
||||
<input type="password" name="course[password]" id="course_course_password" class="hwork_input02" >
|
||||
<a id="psw_btn" class="">显示明码</a>
|
||||
<div class="cl"></div>
|
||||
<span class=" ml80 c_orange">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
|
||||
</li>
|
||||
|
@ -35,7 +49,7 @@
|
|||
</li>
|
||||
<li class=" mb5 ml80">
|
||||
<label >公开 :</label>
|
||||
<input checked="checked" id="course_is_public" name="course[is_public]" type="checkbox" value="1">
|
||||
<input id="course_is_public" name="course[is_public]" type="checkbox" value="1">
|
||||
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅课程成员可见该课程。)</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= labelled_form_for @homework, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
|
||||
<%= render :partial => 'bids/new_homework_form', :locals => { :bid => @homework,:bid_id => "new_bid" } %>
|
||||
<%= render :partial => 'bids/new_homework_form', :locals => { :bid => @homework,:bid_id => "new_bid",:f => f,:edit_mode => false } %>
|
||||
<% end %>
|
|
@ -12,12 +12,13 @@
|
|||
<div class="problem_txt fl mt5">
|
||||
<%= link_to_user_header(e.event_author,false,:class => 'problem_name c_orange fl') if e.respond_to?(:event_author) %>
|
||||
<%= link_to_user_header("(#{e.event_author})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName && e.respond_to?(:event_author) %>
|
||||
<span class="fl"> </span>
|
||||
<span class="fl"> <%= l(:label_new_activity) %>:</span>
|
||||
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url,:class => "problem_tit c_dblue fl fb"%>
|
||||
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) : e.event_url,:class => "problem_tit c_dblue fl fb"%>
|
||||
<br />
|
||||
<p class="mt5 break_word"><%= e.event_description %>
|
||||
<br />
|
||||
<%= l :label_activity_time %> : <%= format_activity_day(day) %><%= format_time(e.event_datetime, false) %>
|
||||
<%= l :label_activity_time %> : <%= format_activity_day(day) %> <%= format_time(e.event_datetime, false) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -25,7 +26,7 @@
|
|||
<% end%>
|
||||
<% end%>
|
||||
<% end%>
|
||||
|
||||
<% if @obj_pages.next_page.nil? %>
|
||||
<div class="problem_main">
|
||||
<a class="problem_pic fl">
|
||||
<%= image_tag(url_to_avatar(@user), :width => "42", :height => "42") %>
|
||||
|
@ -43,7 +44,7 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--课程动态 end-->
|
||||
|
||||
<% end%>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<div class="cl"></div>
|
||||
|
||||
<div class="re_con" id="course_list">
|
||||
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@curse_attachments} %>
|
||||
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
|
||||
</div><!---re_con end-->
|
||||
|
||||
</div>
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="for_img_thumbnails">
|
||||
<% curse_attachments.each do |file| %>
|
||||
<% curse_attachments.sort.reverse.each do |file| %>
|
||||
<% if file.is_public? || User.current.member_of_course?(course) %>
|
||||
<div class="re_con_box">
|
||||
<div class="">
|
||||
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
|
||||
|
@ -50,6 +51,9 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!---re_con_box end-->
|
||||
<% else %>
|
||||
<div class="re_con_box"><span class='fr mr10 pr_join_span '><%= file.filename %>是私有资源</span></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<ul class="wlist">
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
|
||||
<div class="re_con_top">
|
||||
<p class="f_l c_blue f_b f_14">共有 <%= all_attachments.count%> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
<% if order == "asc" %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
<% else %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="for_img_thumbnails">
|
||||
<% project_attachments.each do |file| %>
|
||||
<div class="re_con_box">
|
||||
<div class="">
|
||||
<%= link_to_attachment file, :download => true,:text => truncate(file.filename,length: 35, omission: '...'), :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "c_dblue f_14 f_b f_l" %>
|
||||
<% if User.current.logged? %>
|
||||
<% if (manage_allowed || file.author_id == User.current.id) && project_contains_attachment?(project,file) %>
|
||||
<%= link_to(l(:label_slected_to_other_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
|
||||
|
||||
<% if manage_allowed && file.container_id == project.id && file.container_type == "Project" %>
|
||||
<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",:method => :post %>
|
||||
</span>
|
||||
<% else %>
|
||||
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
|
||||
<% end %>
|
||||
<% 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) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="">
|
||||
<p class="f_l c_grey02 font">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<%= 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"%>
|
||||
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "10"} %>
|
||||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "10"} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!---re_con_box end-->
|
||||
<% end %>
|
||||
</div>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
|
@ -0,0 +1,65 @@
|
|||
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:lable_file_sharingarea) %></h2>
|
||||
</div>
|
||||
|
||||
<!--<%#= stylesheet_link_tag 'resource', :media => 'all' %> -->
|
||||
<script>
|
||||
function show_upload()
|
||||
{
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => project}) %>');
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#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').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
||||
function closeModal()
|
||||
{
|
||||
hideModal($("#popbox_upload"));
|
||||
}
|
||||
|
||||
function presscss(id)
|
||||
{
|
||||
if(id == "incourse")
|
||||
{
|
||||
$('#incourse').attr("class", "re_schbtn b_dblue");
|
||||
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#incourse').attr("class", "re_schbtn b_lblue");
|
||||
$('#insite').attr("class", "re_schbtn b_dblue");
|
||||
}
|
||||
}
|
||||
function buttoncss()
|
||||
{
|
||||
$('#incourse').attr("class", "re_schbtn b_lblue");
|
||||
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
<div class="resource"><!--资源库内容开始--->
|
||||
<div class="re_top">
|
||||
<%= form_tag( search_project_project_files_path(@project), method: 'get',:class => "re_search f_l",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "课内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %>
|
||||
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||
<% end %>
|
||||
<% manage_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
||||
<% if manage_allowed %> <!-- show_window('light','fade','20%','35%')-->
|
||||
<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>
|
||||
<% end %>
|
||||
</div><!---re_top end-->
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="re_con" id="course_list">
|
||||
<%= render :partial => 'project_file_list',:locals => {project: @project,all_attachments: @all_attachments,sort:@sort,order:@order,project_attachments:@obj_attachments,:manage_allowed => manage_allowed} %>
|
||||
</div><!---re_con end-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<% html_title(l(:label_attachment_plural)) -%>
|
|
@ -24,8 +24,8 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @curse_attachments != nil %>
|
||||
<% @curse_attachments.each do |file| %>
|
||||
<% if @obj_attachments != nil %>
|
||||
<% @obj_attachments.each do |file| %>
|
||||
<%if file.is_public == 0 && !User.current.member_of?(@project)%>
|
||||
<%next%>
|
||||
<%end%>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<div id="popbox_upload" style="margin-top: -30px;margin-left: -20px;margin-right: -10px;">
|
||||
<div class="upload_con">
|
||||
<h2>将此课件引入我的资源库</h2>
|
||||
<% if error == '403' %>
|
||||
<div class="upload_box">
|
||||
<div style="color: red;">您没有权限引用此资源</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="upload_box">
|
||||
<div id="error_show" style="color: red;"></div>
|
||||
<%= form_tag attach_relations_path,
|
||||
method: :post,
|
||||
remote: true,
|
||||
id: "relation_file_form" do %>
|
||||
<%= hidden_field_tag(:file_id, file.id) %>
|
||||
<%= content_tag('div', projects_check_box_tags('projects[project][]', User.current.projects,project,file), :id => 'projects')%>
|
||||
<a id="submit_quote" href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_quote();">引 用</a><a href="javascript:void(0)" class="blue_btn grey_btn fl c_white" onclick="closeModal();">取 消</a>
|
||||
<% end -%>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function submit_quote()
|
||||
{
|
||||
$('#submit_quote').parent().submit();
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
<div id="popbox_upload" class="box_h3 mb10" style="margin-top: -30px">
|
||||
<div class="upload_con">
|
||||
<h2><%= l(:label_upload_files)%></h2>
|
||||
<div class="upload_box">
|
||||
<%= error_messages_for 'attachment' %>
|
||||
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
|
||||
|
||||
<%= form_tag(project_files_path(project), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
|
||||
<!-- <label style="margin-top:3px;"><#%= l(:label_file_upload)%></label> -->
|
||||
<%= render :partial => 'attachement_list',:locals => {:project => project} %>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%= l(:button_cancel)%></a>
|
||||
<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<% content_for :header_tags do %>
|
||||
<%= javascript_include_tag 'attachments' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function submit_resource()
|
||||
{
|
||||
$('#submit_resource').parent().submit();
|
||||
}
|
||||
</script>
|
|
@ -1,35 +1,33 @@
|
|||
<%if @addTag%>
|
||||
<% if @obj_flag == '3'%>
|
||||
|
||||
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
<% if @addTag%>
|
||||
<% if @obj_flag == '3'%>
|
||||
$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||
//$('#put-tag-form-issue').hide();
|
||||
$('#name-issue').val("");
|
||||
<% elsif @obj_flag == '6'%>
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
//$('#put-tag-form-issue').hide();
|
||||
$('#name-issue').val("");
|
||||
<% elsif @obj_flag == '6'%>
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty();
|
||||
$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||
$("#put-tag-form- <%=@obj.class%>- <%=@obj.id%>").hide();
|
||||
$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val("");
|
||||
$("#put-tag-form- <%=@obj.class%>- <%=@obj.id%>").hide();
|
||||
$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val("");
|
||||
<% else %>
|
||||
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||
$('#tags_show').html('<%=render_attachments_tag_save(@project, nil)%>');
|
||||
$('#put-tag-form #name').val("");
|
||||
//$('#put-tag-form').hide();
|
||||
<% end %>
|
||||
<% else %>
|
||||
|
||||
$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name',
|
||||
:locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>');
|
||||
$('#tags_show').html('<%=render_attachments_tag_save(@project, nil)%>');
|
||||
$('#put-tag-form #name').val("");
|
||||
//$('#put-tag-form').hide();
|
||||
<% end %>
|
||||
<%else%>
|
||||
$("#attachments_fields").children().remove();
|
||||
$("#upload_file_count").text("未上传文件");
|
||||
$('#upload_file_div').slideToggle('slow');
|
||||
<%if @project%>
|
||||
$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
|
||||
<%elsif @course%>
|
||||
$("#all_browse_div").html('<%= j(render partial: "course_show_all_attachment")%>');
|
||||
closeModal();
|
||||
$("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
|
||||
<%end%>
|
||||
<% if @project%>
|
||||
closeModal();
|
||||
$("#resource_list").html('<%= j(render partial: "project_file_new" ,locals: {project: @project}) %>');
|
||||
<%elsif @course%>
|
||||
closeModal();
|
||||
$("#resource_list").html('<%= j(render partial: "course_file" ,locals: {course: @course}) %>');
|
||||
<% end %>
|
||||
<% end %>
|
||||
$(document).ready(img_thumbnails);
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<% if @can_quote %>
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_project',:locals => {:project => @project,:file => @file,:error => ''}) %>');
|
||||
<% else %>
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_project',:locals => {:project => @project,:file => @file,:error => '403'}) %>');
|
||||
<% end %>
|
||||
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#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').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
|
@ -0,0 +1 @@
|
|||
$("#course_list").html("<%= escape_javascript(render :partial => 'project_file_list',:locals => {project: @project,all_attachments: @result,sort:@sort,order:@order,project_attachments:@searched_attach,:manage_allowed => User.current.allowed_to?(:manage_files, @project)})%>");
|
|
@ -26,7 +26,7 @@
|
|||
</span>
|
||||
</li>
|
||||
<li class="wdown">
|
||||
<%#= link_to "(#{homework.attachments.count.to_s}个附件)", "javascript:"%>
|
||||
<%= link_to "(#{homework.attachments.count.to_s}个附件)", zipdown_download_user_homework_path(:homework => homework)%>
|
||||
</li>
|
||||
<li class="wscore">
|
||||
<% unless is_student_batch_homework %>
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
</div>
|
||||
<div class="search fl">
|
||||
<%= form_tag({:controller => 'courses', :action => 'search'},:id => "course_search_form", :method => :get, :class => "search_form") do %>
|
||||
<%= text_field_tag 'name', params[:name], :placeholder => "课程名称", :class => "search_text fl", :onkeyup => "regexName('#{l(:label_search_conditions_not_null)}');" %>
|
||||
<%= text_field_tag 'name', params[:name], :placeholder => l(:label_course_name), :class => "search_text fl", :onkeyup => "regexName('#{l(:label_search_conditions_not_null)}');" %>
|
||||
<a href="#" onclick="submitSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" >
|
||||
<%= l(:label_search)%>
|
||||
</a>
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
: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_on) %></span>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(homework.created_at) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,3 +1,34 @@
|
|||
<script type="text/javascript">
|
||||
// var flag = false;
|
||||
// jQuery(document).ready(function($) {
|
||||
// transpotUrl('#content');
|
||||
// });
|
||||
// function submit_message_replay()
|
||||
// {
|
||||
// regexContent();//onkeyup传给kindeditor用不上了,所以只能放在这里
|
||||
// if(flag)
|
||||
// {
|
||||
// message_content_editor.sync();//提交内容之前要sync,不然服务器端取不到值
|
||||
// $("#message_form").submit();
|
||||
// }
|
||||
// }
|
||||
// function regexContent()
|
||||
// {
|
||||
// var content = message_content_editor.html();//$.trim($("#message_content").val());
|
||||
// if(content.length ==0)
|
||||
// {
|
||||
// $("#message_content_span").text("<%= l(:label_reply_empty) %>");
|
||||
// $("#message_content_span").css('color','#ff0000');
|
||||
// flag = false;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $("#message_content_span").text("<%= l(:label_field_correct) %>");
|
||||
// $("#message_content_span").css('color','#008000');
|
||||
// flag = true;
|
||||
// }
|
||||
// }
|
||||
</script>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_board) %></h2>
|
||||
</div>
|
||||
|
@ -24,7 +55,7 @@
|
|||
:class => 'talk_edit fr'
|
||||
) if @message.course_destroyable_by?(User.current) %>
|
||||
<div class="cl"></div>
|
||||
<div class="talk_info mb10"><%= textilizable(@topic, :content) %></div>
|
||||
<div class="talk_info mb10"><%= textAreailizable(@topic, :content) %></div>
|
||||
<div class="talk_info mb10"><%= link_to_attachments_course @topic, :author => false %></div>
|
||||
<!-- <a href="#" class=" link_file ml60">附件:爱覅俄方if.zip(27.5kB)</a>-->
|
||||
<div class="cl"></div>
|
||||
|
@ -52,7 +83,7 @@
|
|||
<%= link_to_user_header message.author,false,:class => 'c_blue fb fl mb10 ' %>
|
||||
<span class="c_grey fr"><%= format_time(message.created_on) %></span>
|
||||
<div class="cl"></div>
|
||||
<p><%= textilizable message,:content,:attachments => message.attachments %></p>
|
||||
<p><%= textAreailizable message,:content,:attachments => message.attachments %></p>
|
||||
<%= link_to_attachments_course message, :author => false %>
|
||||
</div>
|
||||
<div class="ping_disfoot">
|
||||
|
@ -87,7 +118,7 @@
|
|||
<div id="reply" style="display:none;">
|
||||
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
|
||||
<%= render :partial => 'form_course', :locals => {:f => f, :replying => true} %>
|
||||
<a href="#" onclick="submit_message_replay();"class="blue_btn fl c_white" style="margin-left: 50px;"><%= l(:button_submit)%></a>
|
||||
<%= link_to l(:button_submit),"#",:onclick => 'course_board_submit_message_replay();' ,:class => "blue_btn fl c_white" ,:style=>"margin-left: 50px;"%>
|
||||
<% end %>
|
||||
<div id="preview" class="wiki"></div>
|
||||
</div>
|
||||
|
@ -97,32 +128,3 @@
|
|||
</ul>
|
||||
<% html_title @topic.subject %>
|
||||
|
||||
<script type="text/javascript">
|
||||
var flag = false;
|
||||
jQuery(document).ready(function($) {
|
||||
transpotUrl('#content');
|
||||
});
|
||||
function submit_message_replay()
|
||||
{
|
||||
if(flag)
|
||||
{
|
||||
$("#message_form").submit();
|
||||
}
|
||||
}
|
||||
function regexContent()
|
||||
{
|
||||
var content = $.trim($("#message_content").val());
|
||||
if(content.length ==0)
|
||||
{
|
||||
$("#message_content_span").text("<%= l(:label_reply_empty) %>");
|
||||
$("#message_content_span").css('color','#ff0000');
|
||||
flag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#message_content_span").text("<%= l(:label_field_correct) %>");
|
||||
$("#message_content_span").css('color','#008000');
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,3 +1,4 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= error_messages_for 'message' %>
|
||||
<% replying ||= false %>
|
||||
<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %>
|
||||
|
@ -28,7 +29,25 @@
|
|||
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
|
||||
<label class="fl" ><span class="c_red">*</span> <%= l(:field_description) %> :</label>
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
<%= f.text_area :content, :class => 'talk_text fl', :id => 'message_content', :onkeyup => "regexContent();", :maxlength => 5000,:placeholder => "最多3000个汉字(或6000个英文字符)" %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<% if replying %>
|
||||
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
|
||||
:width => '89%',
|
||||
:height => 300,
|
||||
:input_html => { :id => 'message_content',
|
||||
:class => 'talk_text fl',
|
||||
:maxlength => 5000 }%>
|
||||
<% else %>
|
||||
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
|
||||
:owner_id => @message.nil? ? 0: @message.id,
|
||||
:owner_type => OwnerTypeHelper::MESSAGE,
|
||||
:width => '91%',
|
||||
:height => 300,
|
||||
:class => 'talk_text fl',
|
||||
:input_html => { :id => 'message_content',
|
||||
:class => 'talk_text fl',
|
||||
:maxlength => 5000 }%>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<p id="message_content_span" class="ml55"></p>
|
||||
</li>
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:field_title) %> :</label>
|
||||
<input type="text" name="news[title]" class="hwork_input" id="news_title" size="60" onkeyup="regexTitle();" maxlength="60" placeholder="60个字符以内" value="<%= is_new ? '' : @news.title %>">
|
||||
<p id="title_notice_span" class="ml55"></p>
|
||||
</li>
|
||||
<li class="ml45">
|
||||
<label class="fl" ><span class="c_red">*</span> <%= l(:field_description) %> :</label>
|
||||
<textarea id="news_description" name="news[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl" onkeyup="regexDescription();" maxlength="6000"><%= is_new ? '' : @news.description %></textarea>
|
||||
<p id="description_notice_span" class="ml55"></p>
|
||||
<% if is_new %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<label class="fl" ><span class="c_red">*</span> <%= l(:field_description) %> :</label>
|
||||
<%= f.kindeditor :description,:width=>'91%',:editor_id=>'news_description_editor' %>
|
||||
<p id="description_notice_span" class="ml55"></p>
|
||||
<% else %>
|
||||
<label class="fl" ><span class="c_red">*</span> <%= l(:field_description) %> :</label>
|
||||
<%= f.kindeditor :description,:width=>'91%',:editor_id=>'news_description_editor',:owner_id => @news.id,:owner_type => OwnerTypeHelper::NEWS %>
|
||||
<p id="description_notice_span" class="ml55"></p>
|
||||
<% end %>
|
||||
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45">
|
||||
|
@ -19,7 +28,7 @@
|
|||
<%= link_to l(:button_create), "#", :onclick => 'submitNews();', :onmouseover => 'submitFocus(this);', :class => 'blue_btn fl c_white' %>
|
||||
<%= link_to l(:button_cancel), course_news_index_path(@course), :onclick => '$("#add-news").hide()', :class => 'blue_btn grey_btn fl c_white' %>
|
||||
<% else %>
|
||||
<%= link_to l(:button_save), "#", :onclick => 'submitNews();',:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %>
|
||||
<%= link_to l(:button_save), "#", :onclick => "submitNews();",:onmouseover => 'this.focus()',:class => 'blue_btn fl c_white' %>
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-news").hide(); return false;',:class => 'blue_btn grey_btn fl c_white' %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<%= link_to_user_header(news.author,false,{:class=> 'problem_name c_orange fl'}) if news.respond_to?(:author) %>
|
||||
<span class="fl"> <%= l(:label_release_news) %>:</span><%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %><br />
|
||||
<div class="cl mb5"></div>
|
||||
<p id="news_description_<%= news.id %>" class="news_description mt5"><%= news.description %><br /> <%= l(:label_create_time) %> :<%= format_time(news.created_on) %></p>
|
||||
<p id="news_description_<%= news.id %>" class="news_description mt5"><%= textAreailizable news.description %><br /> <%= l(:label_create_time) %> :<%= format_time(news.created_on) %></p>
|
||||
<div class="news_foot" style="display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>"><%= l(:label_expend_information) %> <span class="g-arr-down"><img src="/images/jiantou.jpg" width="12" height="6" /></span></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
function submitNews()
|
||||
{
|
||||
news_description_editor.sync();
|
||||
if(regexTitle() && regexDescription())
|
||||
{
|
||||
$("#news-form").submit();
|
||||
|
@ -51,6 +52,7 @@
|
|||
}
|
||||
function submitComment()
|
||||
{
|
||||
comment_editor.sync();
|
||||
$("#add_comment_form").submit();
|
||||
}
|
||||
function clearMessage()
|
||||
|
@ -58,7 +60,7 @@
|
|||
$("#comment_comments").val("");
|
||||
}
|
||||
</script>
|
||||
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_course_news) %></h2>
|
||||
</div>
|
||||
|
@ -84,7 +86,7 @@
|
|||
:onclick => '$("#edit-news").show(); return false;') if User.current.allowed_to?(:manage_news, @course) %>
|
||||
<%= delete_link(news_path(@news),:class => 'talk_edit fr') if User.current.allowed_to?(:manage_news, @course) %>
|
||||
<div class="cl"></div>
|
||||
<div class="mb5"><%= textilizable(@news, :description) %><br /> <%= l(:label_create_time) %> : <%= format_time(@news.created_on) %></div>
|
||||
<div class="mb5"><%= textAreailizable(@news, :description) %><br /> <%= l(:label_create_time) %> : <%= format_time(@news.created_on) %></div>
|
||||
<%= link_to_attachments_course @news %>
|
||||
<!--<a href="#" class=" link_file">附件:爱覅俄方if.zip(27.5kB)</a> -->
|
||||
</div>
|
||||
|
@ -95,8 +97,9 @@
|
|||
<div class="msg_box">
|
||||
<h4><%= l(:label_comment_add) %></h4>
|
||||
<%= form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form") do %>
|
||||
<div class="box">
|
||||
<%= text_area 'comment', 'comments', :placeholder=>"最多250个字"%>
|
||||
<div class="box" >
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<%= kindeditor_tag :comment, '',:height=>'100',:editor_id =>'comment_editor', :placeholder=>"最多250个字"%>
|
||||
</div>
|
||||
<p>
|
||||
<a href="#" class="grey_btn fr ml10" onclick="clearMessage();"><%= l(:label_cancel_with_space) %></a>
|
||||
|
@ -106,6 +109,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% comments = @comments.reverse %>
|
||||
<% comments.each do |comment| %>
|
||||
<% next if comment.new_record? %>
|
||||
|
@ -115,7 +119,7 @@
|
|||
<div class="ping_distop">
|
||||
<%= link_to_user_header(comment.author,false,:class => 'c_blue fb fl mb10 ') if comment.respond_to?(:author) %><span class="c_grey fr"><%= format_time(comment.created_on) %></span>
|
||||
<div class="cl"></div>
|
||||
<p><%= textilizable(comment.comments) %></p>
|
||||
<p><%= textAreailizable(comment.comments) %></p>
|
||||
</div>
|
||||
<div class="ping_disfoot"><%= link_to_if_authorized_course image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %>
|
||||
|
|
|
@ -37,8 +37,7 @@ module RedmineApp
|
|||
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
||||
|
||||
# Activate observers that should always be running.
|
||||
config.active_record.observers = :journals_for_message_observer, :message_observer, :issue_observer, :journal_observer, :news_observer,
|
||||
:document_observer, :wiki_content_observer, :comment_observer, :forum_observer, :memo_observer
|
||||
config.active_record.observers = :journals_for_message_observer, :issue_observer, :journal_observer, :wiki_content_observer
|
||||
|
||||
config.active_record.store_full_sti_class = true
|
||||
config.active_record.default_timezone = :local
|
||||
|
|
|
@ -84,9 +84,6 @@ default:
|
|||
email_delivery:
|
||||
delivery_method: :smtp
|
||||
smtp_settings:
|
||||
|
||||
|
||||
|
||||
address: smtp.126.com
|
||||
port: 25
|
||||
domain: smtp.126.com
|
||||
|
|
|
@ -2,6 +2,7 @@ I18n.default_locale = 'en'
|
|||
I18n.backend = Redmine::I18n::Backend.new
|
||||
|
||||
require 'redmine'
|
||||
require 'trustie'
|
||||
|
||||
# Load the secret token from the Redmine configuration file
|
||||
secret = Redmine::Configuration['secret_token']
|
||||
|
|
|
@ -1,27 +1,15 @@
|
|||
#!/usr/bin/env ruby
|
||||
#coding=utf-8
|
||||
|
||||
require 'rubygems'
|
||||
require 'rufus-scheduler'
|
||||
|
||||
#users = User.where("mail_notification = 'week' or mail_notification = 'day'")
|
||||
|
||||
scheduler = Rufus::Scheduler.new
|
||||
scheduler.cron('0 0 * * 1') do
|
||||
users = User.where("mail_notification = 'week'")
|
||||
users.each do |user|
|
||||
#Rails.logger.info "send mail to #{user.show_name}(#{user.mail}) at #{Time.now}"
|
||||
Thread.start do
|
||||
Mailer.send_for_user_activities(user, Date.today, 7).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
scheduler.cron('0 0 * * *') do
|
||||
users = User.where("mail_notification = 'day'")
|
||||
users.each do |user|
|
||||
#Rails.logger.info "send mail to #{user.show_name}(#{user.mail}) at #{Time.now}"
|
||||
Thread.start do
|
||||
Mailer.send_for_user_activities(user, Date.today, 1).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
## 移入crontab
|
||||
|
||||
# scheduler = Rufus::Scheduler.new
|
||||
#
|
||||
# #每天18:00发送当天的邮件汇总
|
||||
# scheduler.cron('0 18 * * *') do
|
||||
# users = User.where(mail_notification: 'day')
|
||||
# users.each do |user|
|
||||
# mailer = Mailer.send_for_user_activities(user, Date.today, 1)
|
||||
# mailer.deliver if mailer
|
||||
# end
|
||||
# end
|
||||
|
|
|
@ -184,6 +184,11 @@ en:
|
|||
label_anonymous: Anonymous #作业和留言 模块
|
||||
|
||||
text_are_you_sure: Are you sure? #js 提示
|
||||
text_are_you_sure_out: 你确定要退出该课程吗?
|
||||
text_are_you_sure_out_group: 你确定要退出该分班吗?
|
||||
|
||||
|
||||
|
||||
|
||||
label_no_data: No data to display
|
||||
# 项目、课程、用户公用
|
||||
|
|
|
@ -187,7 +187,8 @@ zh:
|
|||
|
||||
|
||||
text_are_you_sure: 您确定要删除吗? #js 提示
|
||||
|
||||
text_are_you_sure_out: 你确定要退出该课程吗?
|
||||
text_are_you_sure_out_group: 你确定要退出该分班吗?
|
||||
|
||||
|
||||
label_no_data: 没有任何数据可供显示
|
||||
|
|
|
@ -4,7 +4,7 @@ en:
|
|||
|
||||
|
||||
# 托管平台主页 > 底部承办单位
|
||||
label_hosted_by: Organizer
|
||||
label_hosted_organization: Organizer
|
||||
label_hosted_by: National Key Laboratory for Parallel and Distributed Processing, NUDT
|
||||
label_sponsor: Department of Computer Science and Technology, NUDT
|
||||
label_co_organizer_NUDT: College of Computer, NUDT
|
||||
|
|
|
@ -6,10 +6,13 @@ en:
|
|||
#
|
||||
# 课程公共标签
|
||||
#
|
||||
label_course_join_student: 加入课程
|
||||
label_course_new: 新建课程
|
||||
|
||||
label_homework: 课程作业
|
||||
label_course_join_student: Join a course
|
||||
label_course_exit_student: Exit a course
|
||||
label_course_new: New course
|
||||
label_course_name: Course name
|
||||
|
||||
|
||||
label_homework: Task
|
||||
label_course_news: 课程通知
|
||||
label_main_teacher: 主讲教师
|
||||
label_course_term: 开课学期
|
||||
|
|
|
@ -13,6 +13,7 @@ zh:
|
|||
label_course_join_student: 加入课程
|
||||
label_course_exit_student: 退出课程
|
||||
label_course_new: 新建课程
|
||||
label_course_name: 课程名称
|
||||
|
||||
label_homework: 课程作业
|
||||
label_course_news: 课程通知
|
||||
|
|
|
@ -331,7 +331,7 @@ en:
|
|||
|
||||
# edit by meng
|
||||
lable_hot_course: Hot Courses
|
||||
label_course_join_student: Join a course
|
||||
|
||||
label_contest_modify_settings: Configuration
|
||||
bale_news_notice: Add a notification
|
||||
label_field_correct: correct input
|
||||
|
@ -1259,11 +1259,11 @@ en:
|
|||
|
||||
#end
|
||||
label_course: Course
|
||||
label_course_new: New course
|
||||
|
||||
label_public_info: "If you don't choose public, only the project's members can see the project."
|
||||
label_course_public_info: "If you don't choose public, only the course's members can see the course."
|
||||
label_course_student: Student
|
||||
label_homework: Task
|
||||
|
||||
label_course_new_homework: New homework
|
||||
label_course_homework_list: Homework List
|
||||
label_course_homework_new: new homework
|
||||
|
|
|
@ -15,7 +15,7 @@ en:
|
|||
# top_menu 个人相关
|
||||
label_my_course: My Course
|
||||
label_my_message: Msgs
|
||||
label_my_projects: My projects
|
||||
label_my_projects: My projectsed
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -106,7 +106,8 @@ zh:
|
|||
lable_file_sharingarea: 资源共享区
|
||||
|
||||
label_upload_files: 上传文件
|
||||
|
||||
label_slected_to_other_project: 选入我的其他项目
|
||||
label_slected_to_project: 选入我的项目
|
||||
|
||||
# 资源库(附件)公用 > 关联资源
|
||||
label_relation_files: 关联已有资源
|
||||
|
|
|
@ -80,7 +80,7 @@ zh:
|
|||
field_enterprise_name: 组织
|
||||
|
||||
label_week_mail: 一周动态
|
||||
label_day_mail: 一日动态
|
||||
label_day_mail: 今日动态
|
||||
#added by huang
|
||||
field_tea_name: 教师
|
||||
field_couurse_time: 学时
|
||||
|
@ -932,9 +932,7 @@ zh:
|
|||
text_project_destroy_confirmation: 您确信要删除这个项目以及所有相关的数据吗?
|
||||
text_subprojects_destroy_warning: "以下子项目也将被同时删除:%{value}"
|
||||
text_workflow_edit: 选择角色和跟踪标签来编辑工作流程
|
||||
text_are_you_sure: 您确定要删除吗?
|
||||
text_are_you_sure_out: 你确定要退出该课程吗?
|
||||
text_are_you_sure_out_group: 你确定要退出该分班吗?
|
||||
|
||||
text_journal_changed: "%{label} 从 %{old} 变更为 %{new}"
|
||||
text_journal_set_to: "%{label} 被设置为 %{value}"
|
||||
text_journal_deleted: "%{label} 已删除 (%{old})"
|
||||
|
@ -1966,6 +1964,7 @@ zh:
|
|||
field_open_anonymous_evaluation: 是否使用匿评
|
||||
label_course_empty_select: 尚未选择课程!
|
||||
label_course_prompt: 课程:
|
||||
label_project_prompt: 项目:
|
||||
label_contain_resource: 已包含资源:
|
||||
label_quote_resource_failed: ",此资源引用失败! "
|
||||
label_file_lost: 以下无法成功下载,请联系相关人员重新上传:
|
||||
|
@ -2031,5 +2030,5 @@ zh:
|
|||
label_name_not_null: 名称不能为空
|
||||
modal_valid_unpassing: 该分班已经存在
|
||||
|
||||
|
||||
mail_footer: 点击修改邮件发送设置
|
||||
|
||||
|
|
|
@ -102,11 +102,11 @@ RedmineApp::Application.routes.draw do
|
|||
|
||||
mount SeemsRateable::Engine => '/rateable', :as => :rateable
|
||||
|
||||
# namespace :zipdown do
|
||||
# match 'assort'
|
||||
# match 'download_user_homework', :as => :download_user_homework
|
||||
# match 'download'
|
||||
# end
|
||||
namespace :zipdown do
|
||||
match 'assort'
|
||||
match 'download_user_homework', :as => :download_user_homework
|
||||
match 'download'
|
||||
end
|
||||
namespace :test do
|
||||
match 'courselist'
|
||||
match 'zip'
|
||||
|
@ -431,8 +431,12 @@ RedmineApp::Application.routes.draw do
|
|||
match 'issues/update_form', :to => 'issues#update_form', :via => [:put, :post], :as => 'issue_form'
|
||||
|
||||
resources :files, :only => [:index, :new, :create] do
|
||||
member do
|
||||
match "quote_resource_show_project",:via => [:get]
|
||||
end
|
||||
collection do
|
||||
match "getattachtype" , :via => [:get, :post]
|
||||
match "search_project",:via => [:post,:get]
|
||||
#match 'getattachtype/:attachtype', :to => 'files#getattachtype', :via => [:get, :post]
|
||||
end
|
||||
end
|
||||
|
@ -590,6 +594,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'attachments/autocomplete'
|
||||
match 'attachments/autocomplete', :to => 'attachments#autocomplete', :via => [:post]
|
||||
post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation'
|
||||
post 'attachments/relationfiles', to: 'attachments#add_exist_file_to_projects', as: 'attach_relations'
|
||||
post 'attachments/courserelationfile', to: 'attachments#add_exist_file_to_course', as: 'course_attach_relation'
|
||||
post 'attachments/courserelationfiles', to: 'attachments#add_exist_file_to_courses', as: 'course_attach_relations'
|
||||
get 'attachments/renderTag/:attchmentId', :to => 'attachments#renderTag', :attchmentId => /\d+/
|
||||
|
|
|
@ -60,6 +60,11 @@ per_page_options:
|
|||
default: '25,50,100'
|
||||
mail_from:
|
||||
default: trustieforge@gmail.com
|
||||
|
||||
### delayjob for send email.
|
||||
delayjob_enabled:
|
||||
default: 1
|
||||
|
||||
bcc_recipients:
|
||||
default: 1
|
||||
plain_text_mail:
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
class ChnageMailNotificationWeekToDay < ActiveRecord::Migration
|
||||
def up
|
||||
User.where(mail_notification: 'week').update_all(mail_notification: 'day')
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
class CreateDelayedJobs < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :delayed_jobs, force: true do |table|
|
||||
table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue
|
||||
table.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually.
|
||||
table.text :handler, null: false # YAML-encoded string of the object that will do work
|
||||
table.text :last_error # reason for last failure (See Note below)
|
||||
table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
|
||||
table.datetime :locked_at # Set when a client is working on this object
|
||||
table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
|
||||
table.string :locked_by # Who is working on this object (if locked)
|
||||
table.string :queue # The name of the queue this job is in
|
||||
table.timestamps null: true
|
||||
end
|
||||
|
||||
add_index :delayed_jobs, [:priority, :run_at], name: "delayed_jobs_priority"
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :delayed_jobs
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddDelayjobEnabledToSettings < ActiveRecord::Migration
|
||||
def change
|
||||
Setting.create(name: 'delayjob_enabled', value: 1 )
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
class CreateZipPacks < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :zip_packs do |t|
|
||||
t.integer :user_id
|
||||
t.integer :homework_id
|
||||
t.string :file_digest
|
||||
t.string :file_path
|
||||
t.integer :pack_times, default: 1
|
||||
t.integer :pack_size, default: 0
|
||||
t.string :file_digests
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
2914
db/schema.rb
2914
db/schema.rb
File diff suppressed because it is too large
Load Diff
|
@ -3,9 +3,17 @@ if defined?(ActiveRecord)
|
|||
def self.has_many_kindeditor_assets(*args)
|
||||
options = args.extract_options!
|
||||
asset_name = args[0] ? args[0].to_s : 'assets'
|
||||
has_many asset_name.to_sym, :class_name => 'Kindeditor::Asset', :foreign_key => 'owner_id', :dependent => options[:dependent]
|
||||
|
||||
class_name = self.name
|
||||
# Time 2015-04-01 14:20:32
|
||||
# Author lizanle
|
||||
# Description 对象类型对应的数值,kindeditor_assets表里owner_type的值
|
||||
|
||||
has_many asset_name.to_sym,
|
||||
:class_name => 'Kindeditor::Asset',
|
||||
:conditions => "owner_type = #{('OwnerTypeHelper::'+class_name.upcase).constantize}",
|
||||
:foreign_key => 'owner_id', :dependent => options[:dependent]
|
||||
|
||||
|
||||
Kindeditor::Asset.class_eval do
|
||||
belongs_to :owner, :class_name => class_name, :foreign_key => 'owner_id'
|
||||
end
|
||||
|
|
|
@ -20,7 +20,11 @@ module RailsKindeditor
|
|||
def kindeditor_upload_json_path(*args)
|
||||
options = args.extract_options!
|
||||
owner_id_query_string = options[:owner_id] ? "?owner_id=#{options[:owner_id]}" : ''
|
||||
owner_type_query_string = options[:owner_type] ? owner_id_query_string + "&owner_type=#{options[:owner_type]}" : owner_id_query_string
|
||||
if owner_id_query_string.blank?
|
||||
owner_type_query_string = options[:owner_type] ? "?owner_type=#{options[:owner_type]}" : ""
|
||||
else
|
||||
owner_type_query_string = options[:owner_type] ? owner_id_query_string + "&owner_type=#{options[:owner_type]}" : owner_id_query_string
|
||||
end
|
||||
"#{main_app_root_url}kindeditor/upload#{owner_type_query_string}"
|
||||
end
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue