Merge commit '6688ba61dd67ce7bea195d6f5a7a4458b86956d7' into develop
Conflicts: app/views/layouts/_base_footer.html.erb
This commit is contained in:
commit
bdaf59513b
|
@ -6,7 +6,8 @@ class AppliedProjectController < ApplicationController
|
||||||
@project = Project.find(params[:project_id])
|
@project = Project.find(params[:project_id])
|
||||||
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
|
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
|
||||||
if @applieds.count == 0
|
if @applieds.count == 0
|
||||||
AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
|
||||||
|
Mailer.applied_project(appliedproject).deliver
|
||||||
end
|
end
|
||||||
|
|
||||||
#redirect_to project_path(params[:project_id])
|
#redirect_to project_path(params[:project_id])
|
||||||
|
|
|
@ -23,6 +23,7 @@ class AttachmentsController < ApplicationController
|
||||||
|
|
||||||
before_filter :login_without_softapplication, only: [:download]
|
before_filter :login_without_softapplication, only: [:download]
|
||||||
accept_api_auth :show, :download, :upload
|
accept_api_auth :show, :download, :upload
|
||||||
|
require 'iconv'
|
||||||
|
|
||||||
def show
|
def show
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -75,6 +76,25 @@ class AttachmentsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 更新文件密级
|
||||||
|
def updateFileDense
|
||||||
|
@attachment = Attachment.find(params[:attachmentid])
|
||||||
|
if @attachment != nil
|
||||||
|
filedense = params[:newtype].to_s
|
||||||
|
# d = Iconv.conv("unicodebig","utf-8",filedense)
|
||||||
|
if filedense == "%E5%85%AC%E5%BC%80" #l(:field_is_public)
|
||||||
|
@attachment.is_public = 1
|
||||||
|
else
|
||||||
|
@attachment.is_public = 0
|
||||||
|
end
|
||||||
|
@attachment.save
|
||||||
|
@newfiledense = filedense
|
||||||
|
end
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def thumbnail
|
def thumbnail
|
||||||
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
|
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
|
||||||
if stale?(:etag => thumbnail)
|
if stale?(:etag => thumbnail)
|
||||||
|
@ -89,6 +109,7 @@ class AttachmentsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def upload
|
def upload
|
||||||
# Make sure that API users get used to set this content type
|
# Make sure that API users get used to set this content type
|
||||||
# as it won't trigger Rails' automatic parsing of the request body for parameters
|
# as it won't trigger Rails' automatic parsing of the request body for parameters
|
||||||
|
|
|
@ -375,11 +375,14 @@ class BidsController < ApplicationController
|
||||||
@option = []
|
@option = []
|
||||||
@membership.each do |membership|
|
@membership.each do |membership|
|
||||||
unless(membership.project.project_type==1)
|
unless(membership.project.project_type==1)
|
||||||
membership.member_roles.each{|role|
|
if membership.user.allowed_to?(:quote_project,membership.project)
|
||||||
if(role.role_id == 3)
|
@option << membership.project
|
||||||
@option << membership.project
|
end
|
||||||
end
|
#membership.member_roles.each{|role|
|
||||||
}
|
# if(role.role_id == 3)
|
||||||
|
# @option << membership.project
|
||||||
|
# end
|
||||||
|
#}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -454,14 +457,14 @@ class BidsController < ApplicationController
|
||||||
if (User.current.logged? && User.current.member_of_course?(@bid.courses.first))
|
if (User.current.logged? && User.current.member_of_course?(@bid.courses.first))
|
||||||
# flash[:notice] = ""
|
# flash[:notice] = ""
|
||||||
@membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current))
|
@membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current))
|
||||||
@option = []
|
#@option = []
|
||||||
@membership.each do |membership|
|
#@membership.each do |membership|
|
||||||
membership.member_roles.each{|role|
|
# membership.member_roles.each{|role|
|
||||||
if(role.role_id == 3)
|
# if(role.role_id == 3)
|
||||||
@option << membership.course
|
# @option << membership.course
|
||||||
end
|
# end
|
||||||
}
|
# }
|
||||||
end
|
#end
|
||||||
|
|
||||||
@user = @bid.author
|
@user = @bid.author
|
||||||
@bidding_project = @bid.biding_projects.all
|
@bidding_project = @bid.biding_projects.all
|
||||||
|
@ -990,7 +993,7 @@ class BidsController < ApplicationController
|
||||||
return true if current_user.admin?
|
return true if current_user.admin?
|
||||||
#return 0 if @bid.courses.first.project_type == Project::ProjectType_project
|
#return 0 if @bid.courses.first.project_type == Project::ProjectType_project
|
||||||
currentUser = User.current
|
currentUser = User.current
|
||||||
render_403 unless currentUser.member_of_cousrse?(@bid.courses.first)
|
render_403 unless currentUser.member_of_course?(@bid.courses.first)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -734,7 +734,7 @@ class ProjectsController < ApplicationController
|
||||||
#Added by young
|
#Added by young
|
||||||
# @course_tag = params[:course]
|
# @course_tag = params[:course]
|
||||||
# if @course_tag == '1'
|
# if @course_tag == '1'
|
||||||
@course = Course.find_by_extra(@project.identifier)
|
#@course = Course.find_by_extra(@project.identifier)
|
||||||
# if @project.project_type == 1
|
# if @project.project_type == 1
|
||||||
# render :layout => 'base_courses'
|
# render :layout => 'base_courses'
|
||||||
# else
|
# else
|
||||||
|
|
|
@ -239,7 +239,7 @@ class RepositoriesController < ApplicationController
|
||||||
@repositories = @project.repositories
|
@repositories = @project.repositories
|
||||||
@course_tag = params[:course]
|
@course_tag = params[:course]
|
||||||
project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
|
project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
|
||||||
ip = RepositoriesHelper::REPO_IP_ADDRESS
|
ip = RepositoriesHelper::REPO_IP_ADDRESS
|
||||||
@repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip+
|
@repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip+
|
||||||
@repository.url.slice(project_path_cut, @repository.url.length).to_s
|
@repository.url.slice(project_path_cut, @repository.url.length).to_s
|
||||||
if @course_tag == 1
|
if @course_tag == 1
|
||||||
|
|
|
@ -20,25 +20,27 @@ class StoresController < ApplicationController
|
||||||
resultSet = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{keywords}%").
|
resultSet = Attachment.where("attachments.container_type IS NOT NULL AND filename LIKE :like ", like: "%#{keywords}%").
|
||||||
reorder("created_on DESC")
|
reorder("created_on DESC")
|
||||||
|
|
||||||
result = resultSet.to_a.dup
|
# result = resultSet.to_a.dup
|
||||||
|
|
||||||
resultSet.to_a.map { |res|
|
# resultSet.to_a.map { |res|
|
||||||
if(res.container.nil? ||
|
# if(res.container.nil? ||
|
||||||
(res.container.class.to_s=="Project" && res.container.is_public == false) ||
|
# (res.container.class.to_s=="Project" && res.container.is_public == false) ||
|
||||||
(res.container.has_attribute?(:project) && res.container.project.is_public == false) ||
|
# (res.container.has_attribute?(:project) && res.container.project.is_public == false) ||
|
||||||
(res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
|
# (res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
|
||||||
false
|
# false
|
||||||
)
|
# )
|
||||||
result.delete(res)
|
# result.delete(res)
|
||||||
end
|
# end
|
||||||
}
|
# }
|
||||||
result
|
# result
|
||||||
end
|
end
|
||||||
|
|
||||||
LIMIT = 12 unless const_defined?(:LIMIT)
|
LIMIT = 12 unless const_defined?(:LIMIT)
|
||||||
def index
|
def index
|
||||||
@projects_attach = project_classification(0).take(LIMIT)
|
@projects_attach = project_classification(0).take(LIMIT)
|
||||||
@courses_attach = project_classification(1).take(LIMIT)
|
@courses_attach = Attachment.includes(:course).where("courses.is_public = ?", 1).
|
||||||
|
where(container_type: 'Course').
|
||||||
|
limit(LIMIT)
|
||||||
# @projects_attach = Attachment.includes(:project).where("projects.project_type=? AND projects.is_public = ?", 0, 1).
|
# @projects_attach = Attachment.includes(:project).where("projects.project_type=? AND projects.is_public = ?", 0, 1).
|
||||||
# reorder("#{Attachment.table_name}.downloads DESC").
|
# reorder("#{Attachment.table_name}.downloads DESC").
|
||||||
# limit(LIMIT)
|
# limit(LIMIT)
|
||||||
|
|
|
@ -116,13 +116,13 @@ class WelcomeController < ApplicationController
|
||||||
|
|
||||||
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
|
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
|
||||||
def entry_select_course
|
def entry_select_course
|
||||||
if request.original_url.match(/course\.trustie\.net/)
|
if request.original_url.match(/.*course\.trustie\.net/)
|
||||||
(course() and render :course and return 0)
|
(course() and render :course and return 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def entry_select_contest
|
def entry_select_contest
|
||||||
if request.original_url.match(/contest\.trustie\.net/)
|
if request.original_url.match(/.*contest\.trustie\.net/)
|
||||||
contest
|
contest
|
||||||
render :contest
|
render :contest
|
||||||
return 0
|
return 0
|
||||||
|
@ -130,7 +130,7 @@ class WelcomeController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def entry_select_user
|
def entry_select_user
|
||||||
if request.original_url.match(/user\.trustie\.net$/)
|
if request.original_url.match(/.*user\.trustie\.net$/)
|
||||||
redirect_to(:controller => "users", :action => "index")
|
redirect_to(:controller => "users", :action => "index")
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -109,8 +109,8 @@ module AttachmentsHelper
|
||||||
domain = project.nil? ? attachAll : nobelong_attach
|
domain = project.nil? ? attachAll : nobelong_attach
|
||||||
|
|
||||||
# 搜索到的资源
|
# 搜索到的资源
|
||||||
searched_attach = domain.where("filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc')
|
searched_attach = domain.where("is_public=1 and filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc')
|
||||||
searched_attach = private_filter searched_attach
|
#searched_attach = private_filter searched_attach
|
||||||
searched_attach = paginateHelper(searched_attach, 10)
|
searched_attach = paginateHelper(searched_attach, 10)
|
||||||
|
|
||||||
s = content_tag('div', attachments_check_box_tags('attachment[attach][]', searched_attach), :id => 'attachments')
|
s = content_tag('div', attachments_check_box_tags('attachment[attach][]', searched_attach), :id => 'attachments')
|
||||||
|
@ -148,8 +148,8 @@ module AttachmentsHelper
|
||||||
domain = course.nil? ? attachAll : nobelong_attach
|
domain = course.nil? ? attachAll : nobelong_attach
|
||||||
|
|
||||||
# 搜索到的资源
|
# 搜索到的资源
|
||||||
searched_attach = domain.where("filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc')
|
searched_attach = domain.where("is_public=1 and filename LIKE :like ", like:"%#{filename_condition}%").limit(limit).order('created_on desc')
|
||||||
searched_attach = private_filter searched_attach
|
#searched_attach = private_filter searched_attach
|
||||||
searched_attach = paginateHelper(searched_attach, 10)
|
searched_attach = paginateHelper(searched_attach, 10)
|
||||||
|
|
||||||
#testattach = Attachment.public_attachments
|
#testattach = Attachment.public_attachments
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
module RepositoriesHelper
|
module RepositoriesHelper
|
||||||
ROOT_PATH="/home/pdl/redmine-2.3.2-0/apache2/"
|
ROOT_PATH="/home/pdl/redmine-2.3.2-0/apache2/"
|
||||||
PROJECT_PATH_CUT = 40
|
PROJECT_PATH_CUT = 40
|
||||||
REPO_IP_ADDRESS = "repository.trustie.net"
|
REPO_IP_ADDRESS = Setting.repository_domain
|
||||||
|
|
||||||
def format_revision(revision)
|
def format_revision(revision)
|
||||||
if revision.respond_to? :format_identifier
|
if revision.respond_to? :format_identifier
|
||||||
|
|
|
@ -37,15 +37,24 @@ module StoresHelper
|
||||||
|
|
||||||
WORD_LIMIT = 100
|
WORD_LIMIT = 100
|
||||||
def come_from_local attachment
|
def come_from_local attachment
|
||||||
|
|
||||||
container = attachment.container
|
container = attachment.container
|
||||||
case container.class.to_s
|
case container.class.to_s
|
||||||
when 'Message'
|
when 'Message'
|
||||||
|
# binding.pry
|
||||||
# '项目 > zzz > 论坛 > 帖子xxx'
|
# '项目 > zzz > 论坛 > 帖子xxx'
|
||||||
# topic_str = container.project.project_type == 0 ? l(:label_board) : l(:label_new_course)
|
# topic_str = container.project.project_type == 0 ? l(:label_board) : l(:label_new_course)
|
||||||
topic_list = link_to l(:label_board), project_boards_path(container.project)
|
|
||||||
topic_item = link_to container.subject.truncate(WORD_LIMIT, omission: '...'), board_message_path(container.board, container), title: container.subject
|
course = container.course
|
||||||
project_link(container.project).push(topic_list, topic_item)
|
project = container.project
|
||||||
|
if course.nil? # container is belongs to Project
|
||||||
|
topic_list = link_to l(:label_board), project_boards_path(container.project)
|
||||||
|
topic_item = link_to container.subject.truncate(WORD_LIMIT, omission: '...'), board_message_path(container.board, container), title: container.subject
|
||||||
|
project_link(container.project).push(topic_list, topic_item)
|
||||||
|
else # container is belongs to Course
|
||||||
|
topic_list = link_to l(:label_course_news), course_boards_path(course)
|
||||||
|
topic_item = link_to container.try(:subject).to_s.truncate(WORD_LIMIT, omission: '...'), board_message_path(container.board, container), title: container.subject
|
||||||
|
project_link(course).push(topic_list, topic_item)
|
||||||
|
end
|
||||||
when 'Issue'
|
when 'Issue'
|
||||||
# '项目 > zzz > 缺陷 > 问题xxx'
|
# '项目 > zzz > 缺陷 > 问题xxx'
|
||||||
issue_list = link_to l(:label_project_issues), project_issues_path(container.project)
|
issue_list = link_to l(:label_project_issues), project_issues_path(container.project)
|
||||||
|
@ -58,15 +67,26 @@ module StoresHelper
|
||||||
project_link(container.project).push(doc_list, doc_item)
|
project_link(container.project).push(doc_list, doc_item)
|
||||||
when 'News'
|
when 'News'
|
||||||
# '课程 > zzz > 新闻 > 新闻xxx'
|
# '课程 > zzz > 新闻 > 新闻xxx'
|
||||||
news_str = container.project.project_type == 0 ? l(:label_news) : l(:label_course_news)
|
course = container.course
|
||||||
news_list = link_to news_str, project_news_index_path(container.project)
|
project = container.project
|
||||||
news_item = link_to container.title.truncate(WORD_LIMIT, omission: '...'), news_path(container), title: container.title
|
if course.nil? # container is belongs to Project
|
||||||
project_link(container.project).push(news_list, news_item)
|
news_list = link_to l(:label_news), project_news_index_path(container.project)
|
||||||
|
news_item = link_to container.title.truncate(WORD_LIMIT, omission: '...'), news_path(container), title: container.title
|
||||||
|
project_link(container.project).push(news_list, news_item)
|
||||||
|
else # container is belongs to Course
|
||||||
|
news_list = link_to l(:label_course_news), course_news_index_path(course)
|
||||||
|
news_item = link_to container.title.truncate(WORD_LIMIT, omission: '...'), news_path(container), title: container.title
|
||||||
|
project_link(course).push(news_list, news_item)
|
||||||
|
end
|
||||||
|
|
||||||
when 'Project'
|
when 'Project'
|
||||||
# '项目 > zzz '
|
# '项目 > zzz '
|
||||||
file_str = container.project.project_type == 0 ? l(:project_module_files) : l(:label_course_file)
|
file_str = container.project.project_type == 0 ? l(:project_module_files) : l(:label_course_file)
|
||||||
files_list = link_to file_str, project_files_path(container.project)
|
files_list = link_to file_str, project_files_path(container.project)
|
||||||
project_link(container).push(files_list)
|
project_link(container).push(files_list)
|
||||||
|
when 'Course'
|
||||||
|
files_list = link_to l(:label_course_file), course_files_path(container)
|
||||||
|
project_link(container).push(files_list)
|
||||||
when 'Version'
|
when 'Version'
|
||||||
# '项目 > zzz > 里程碑 > xxx'
|
# '项目 > zzz > 里程碑 > xxx'
|
||||||
ver_list = link_to l(:label_roadmap), project_roadmap_path(container.project)
|
ver_list = link_to l(:label_roadmap), project_roadmap_path(container.project)
|
||||||
|
@ -91,7 +111,8 @@ module StoresHelper
|
||||||
# '竞赛 > xxx '
|
# '竞赛 > xxx '
|
||||||
bid_link(container)
|
bid_link(container)
|
||||||
else
|
else
|
||||||
Rails.logger.error "ERROR: attachment type unkown"
|
Rails.logger.error "ERROR: attachment type unkown. file:#{__FILE__}, line:#{__LINE__}"
|
||||||
|
Rails.logger.error "#{container.class.to_s}"
|
||||||
[link_to('unkown', '')]
|
[link_to('unkown', '')]
|
||||||
end
|
end
|
||||||
rescue ActionController::RoutingError => e
|
rescue ActionController::RoutingError => e
|
||||||
|
@ -99,20 +120,6 @@ module StoresHelper
|
||||||
[link_to('unkown', '')]
|
[link_to('unkown', '')]
|
||||||
end
|
end
|
||||||
|
|
||||||
def project_link project
|
|
||||||
if project.nil?
|
|
||||||
Rails.logger.error "ERROR: attachment type unkown #project_link project.nil?"
|
|
||||||
return [link_to('unkown', '')]
|
|
||||||
end
|
|
||||||
project_list = nil
|
|
||||||
if project.project_type == 0
|
|
||||||
project_list = link_to l(:label_project_plural), projects_path
|
|
||||||
else
|
|
||||||
project_list = link_to l(:label_new_course), course_path
|
|
||||||
end
|
|
||||||
project_item = link_to project.to_s, project_path(project)
|
|
||||||
[project_list, project_item]
|
|
||||||
end
|
|
||||||
|
|
||||||
def bid_link bid
|
def bid_link bid
|
||||||
bid_list = nil
|
bid_list = nil
|
||||||
|
@ -129,7 +136,7 @@ module StoresHelper
|
||||||
Rails.logger.error "ERROR: attachment type unkown #bid_link/when 3"
|
Rails.logger.error "ERROR: attachment type unkown #bid_link/when 3"
|
||||||
return [link_to('unkown', '#')]
|
return [link_to('unkown', '#')]
|
||||||
end
|
end
|
||||||
bid_list = link_to l(:label_homework), project_homework_path(bid.courses.first)
|
bid_list = link_to l(:label_homework), homework_course_path(bid.courses.first)
|
||||||
bid_item = link_to bid.name, respond_path(bid)
|
bid_item = link_to bid.name, respond_path(bid)
|
||||||
return project_link(bid.courses.first).push(bid_list, bid_item)
|
return project_link(bid.courses.first).push(bid_list, bid_item)
|
||||||
else
|
else
|
||||||
|
@ -137,4 +144,28 @@ module StoresHelper
|
||||||
end
|
end
|
||||||
[bid_list, bid_item]
|
[bid_list, bid_item]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def project_link project
|
||||||
|
if project.nil?
|
||||||
|
Rails.logger.error "ERROR: attachment type unkown #project_link project.nil? file: #{__FILE__}, line: #{__LINE__}"
|
||||||
|
return [link_to('unkown', '')]
|
||||||
|
end
|
||||||
|
project_list = nil
|
||||||
|
klass = project.class.to_s
|
||||||
|
case klass
|
||||||
|
when "Project"
|
||||||
|
project_list = link_to l(:label_project_plural), projects_path
|
||||||
|
project_item = link_to project.to_s, project_path(project)
|
||||||
|
[project_list, project_item]
|
||||||
|
when "Course"
|
||||||
|
course_list = link_to l(:label_new_course), courses_path
|
||||||
|
course_item = link_to project.name, course_path(project)
|
||||||
|
[course_list, course_item]
|
||||||
|
else
|
||||||
|
Rails.logger.error "[StoresHelper]: #{klass} ======================================="
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -196,6 +196,21 @@ class Attachment < ActiveRecord::Base
|
||||||
suffix
|
suffix
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 文件密级的字符描述
|
||||||
|
def file_dense_str
|
||||||
|
if self.is_public == 1
|
||||||
|
dense = l(:field_is_public)
|
||||||
|
else
|
||||||
|
dense = l(:field_is_private)
|
||||||
|
end
|
||||||
|
dense
|
||||||
|
end
|
||||||
|
|
||||||
|
# 文件可设置的密级列表
|
||||||
|
def file_dense_list
|
||||||
|
denselist = [l(:field_is_public),l(:field_is_private)]
|
||||||
|
end
|
||||||
|
|
||||||
def suffixArr
|
def suffixArr
|
||||||
@@SuffixArr
|
@@SuffixArr
|
||||||
end
|
end
|
||||||
|
|
|
@ -90,6 +90,18 @@ class Course < ActiveRecord::Base
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns the mail adresses of users that should be always notified on project events
|
||||||
|
def recipients
|
||||||
|
notified_users.collect {|user| user.mail}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns the users that should be notified on project events
|
||||||
|
def notified_users
|
||||||
|
# TODO: User part should be extracted to User#notify_about?
|
||||||
|
members.select {|m| m.principal.present? && (m.mail_notification? || m.principal.mail_notification == 'all')}.collect {|m| m.principal}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
# 课程的短描述信息
|
# 课程的短描述信息
|
||||||
def short_description(length = 255)
|
def short_description(length = 255)
|
||||||
description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
||||||
|
@ -112,6 +124,7 @@ class Course < ActiveRecord::Base
|
||||||
@attachmenttypes = Attachmentstype.find(:all, :conditions => ["#{Attachmentstype.table_name}.typeId= ?",self.attachmenttype ])
|
@attachmenttypes = Attachmentstype.find(:all, :conditions => ["#{Attachmentstype.table_name}.typeId= ?",self.attachmenttype ])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# 获取资源后缀名列表
|
# 获取资源后缀名列表
|
||||||
def contenttypes
|
def contenttypes
|
||||||
attachmenttypes
|
attachmenttypes
|
||||||
|
|
|
@ -141,6 +141,19 @@ class Mailer < ActionMailer::Base
|
||||||
:subject => s
|
:subject => s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 用户申请加入项目邮件通知
|
||||||
|
def applied_project(applied)
|
||||||
|
@project =applied.project
|
||||||
|
redmine_headers 'Project' => @project,
|
||||||
|
'User' => applied.user
|
||||||
|
@user = applied.user
|
||||||
|
recipients = @project.manager_recipients
|
||||||
|
s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
|
||||||
|
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members')
|
||||||
|
mail :to => recipients,
|
||||||
|
:subject => s
|
||||||
|
end
|
||||||
|
|
||||||
def reminder(user, issues, days)
|
def reminder(user, issues, days)
|
||||||
set_language_if_valid user.language
|
set_language_if_valid user.language
|
||||||
@issues = issues
|
@issues = issues
|
||||||
|
@ -177,25 +190,45 @@ class Mailer < ActionMailer::Base
|
||||||
added_to_url = ''
|
added_to_url = ''
|
||||||
@author = attachments.first.author
|
@author = attachments.first.author
|
||||||
case container.class.name
|
case container.class.name
|
||||||
when 'Project'
|
when 'Project'
|
||||||
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
|
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
|
||||||
added_to = "#{l(:label_project)}: #{container}"
|
added_to = "#{l(:label_project)}: #{container}"
|
||||||
recipients = container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect {|u| u.mail}
|
recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||||
when 'Version'
|
when 'Course'
|
||||||
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project)
|
added_to_url = url_for(:controller => 'files', :action => 'index', :course_id => container)
|
||||||
added_to = "#{l(:label_version)}: #{container.name}"
|
added_to = "#{l(:label_course)}: #{container}"
|
||||||
recipients = container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect {|u| u.mail}
|
recipients = container.notified_users.select { |user| user.allowed_to?(:view_files, container) }.collect { |u| u.mail }
|
||||||
when 'Document'
|
when 'Version'
|
||||||
added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
|
added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project)
|
||||||
added_to = "#{l(:label_document)}: #{container.title}"
|
added_to = "#{l(:label_version)}: #{container.name}"
|
||||||
recipients = container.recipients
|
recipients = container.project.notified_users.select { |user| user.allowed_to?(:view_files, container.project) }.collect { |u| u.mail }
|
||||||
|
when 'Document'
|
||||||
|
added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
|
||||||
|
added_to = "#{l(:label_document)}: #{container.title}"
|
||||||
|
recipients = container.recipients
|
||||||
|
end
|
||||||
|
if container.class.name == 'Course'
|
||||||
|
redmine_headers 'Course' => container.id
|
||||||
|
@attachments = attachments
|
||||||
|
@added_to = added_to
|
||||||
|
@added_to_url = added_to_url
|
||||||
|
mail :to => recipients,
|
||||||
|
:subject => "[#{container.name}] #{l(:label_attachment_new)}"
|
||||||
|
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)}"
|
||||||
|
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)}"
|
||||||
end
|
end
|
||||||
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)}"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Builds a Mail::Message object used to email recipients of a news' project when a news item is added.
|
# Builds a Mail::Message object used to email recipients of a news' project when a news item is added.
|
||||||
|
|
|
@ -207,6 +207,12 @@ class Project < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
# 管理员的邮件列表
|
||||||
|
def manager_recipients
|
||||||
|
notified = project.project_infos.collect(&:user)
|
||||||
|
notified.collect(&:mail)
|
||||||
|
end
|
||||||
|
|
||||||
def initialize(attributes=nil, *args)
|
def initialize(attributes=nil, *args)
|
||||||
super
|
super
|
||||||
|
|
||||||
|
|
|
@ -209,10 +209,6 @@ class User < Principal
|
||||||
|
|
||||||
|
|
||||||
# ======================================================================
|
# ======================================================================
|
||||||
# 集中处理 User 扩展表为空的问题
|
|
||||||
# 合并 user_score 属性
|
|
||||||
validate :valid_user_extensions
|
|
||||||
after_save :save_user_extensions
|
|
||||||
|
|
||||||
def extensions
|
def extensions
|
||||||
self.user_extensions ||= UserExtensions.new
|
self.user_extensions ||= UserExtensions.new
|
||||||
|
@ -222,49 +218,6 @@ class User < Principal
|
||||||
self.user_score ||= UserScore.new
|
self.user_score ||= UserScore.new
|
||||||
end
|
end
|
||||||
|
|
||||||
alias_method :ori_respond_to?, :respond_to?
|
|
||||||
def respond_to?(m, include_private = false)
|
|
||||||
flag = false
|
|
||||||
flag = ori_respond_to? m.to_sym unless flag
|
|
||||||
flag = UserExtensions.new.respond_to? m.to_sym unless flag
|
|
||||||
flag = UserScore.new.respond_to? m.to_sym unless flag
|
|
||||||
|
|
||||||
flag
|
|
||||||
end
|
|
||||||
|
|
||||||
def method_missing m, *args, &block
|
|
||||||
if extensions.respond_to? m.to_sym
|
|
||||||
self.class.send(:define_method, "_meta_#{m}".to_sym) do |*args, &block|
|
|
||||||
self.extensions.__send__ m.to_sym, *args
|
|
||||||
end
|
|
||||||
__send__ "_meta_#{m}".to_sym, *args, &block
|
|
||||||
|
|
||||||
elsif user_score_attr.respond_to? m.to_sym
|
|
||||||
self.class.send(:define_method, "_meta_#{m}".to_sym) do |*args, &block|
|
|
||||||
self.user_score_attr.__send__ m.to_sym, *args
|
|
||||||
end
|
|
||||||
__send__ "_meta_#{m}".to_sym, *args, &block
|
|
||||||
|
|
||||||
else
|
|
||||||
super
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def valid_user_extensions
|
|
||||||
if !self.extensions.valid?
|
|
||||||
self.extensions.errors.messages.each do |key, values|
|
|
||||||
values.each do |value|
|
|
||||||
self.errors.add key, value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def save_user_extensions
|
|
||||||
self.extensions.save
|
|
||||||
self.user_score_attr.save
|
|
||||||
end
|
|
||||||
# 集中处理 User 扩展表为空的问题 < end
|
|
||||||
# ======================================================================
|
# ======================================================================
|
||||||
|
|
||||||
#选择项目成员时显示的用户信息文字
|
#选择项目成员时显示的用户信息文字
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
<% container.attachments.each_with_index do |attachment, i| %>
|
<% container.attachments.each_with_index do |attachment, i| %>
|
||||||
<span id="attachments_p<%= i %>" class="attachment">
|
<span id="attachments_p<%= i %>" class="attachment">
|
||||||
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
|
<%= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename readonly', :readonly=>'readonly')%>
|
||||||
|
|
||||||
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") +
|
<%= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") +
|
||||||
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
|
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') %>
|
||||||
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
<%#= render :partial => 'tags/tag', :locals => {:obj => attachment, :object_flag => "6"} %>
|
||||||
|
<%= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public, :class => 'is_public')%>
|
||||||
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
<%= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
$('#edit-file-dense-form-<%= @attachment.id.to_s%>').hide();
|
||||||
|
$('#field_file_dense_id_label<%= @attachment.id.to_s%>').show();
|
||||||
|
$('#edit_box_dense<%= @attachment.id.to_s%>').show();
|
||||||
|
<%if @attachment.is_public == 1%>
|
||||||
|
$('#field_file_dense_id_label<%= @attachment.id.to_s%>').html('公开');
|
||||||
|
<%else%>
|
||||||
|
$('#field_file_dense_id_label<%= @attachment.id.to_s%>').html('私有');
|
||||||
|
<%end%>
|
||||||
|
// 下面2种写法都没起作用,暂时使用上面的非本地化模式
|
||||||
|
// <%if @attachment.is_public == 1%>
|
||||||
|
// $('#field_file_dense_id_label<%= @attachment.id.to_s%>').html('<%l(:field_is_public)%>');
|
||||||
|
// <%else%>
|
||||||
|
// $('#field_file_dense_id_label<%= @attachment.id.to_s%>').html('<%l(:field_is_private)%>');
|
||||||
|
// <%end%>
|
||||||
|
// $('#field_file_dense_id_label<%= @attachment.id.to_s%>').html(<%=@newfiledense%>);
|
|
@ -0,0 +1,13 @@
|
||||||
|
<% edit_allowed = User.current.allowed_to?(:manage_files, @course) %>
|
||||||
|
<% if file_dense_list.any? %>
|
||||||
|
<div id="edit-file-dense-form-<%=attachment.id%>" class="hidden">
|
||||||
|
<%= select_tag "file_dense",
|
||||||
|
options_for_select(file_dense_list,attachment.file_dense_str), :onchange=>"file_dense_edit("+attachment.id.to_s + ",this.value)"%>
|
||||||
|
</div>
|
||||||
|
<%= link_to(image_tag('edit/edit.png'), 'javascript:void(0);',:style=>"white-space:nowrap;", :id=>"edit_box_dense"+attachment.id.to_s ,
|
||||||
|
:onclick =>"$('#edit-file-dense-form-" +attachment.id.to_s+ "').show();
|
||||||
|
$('#field_file_dense_id_label" +attachment.id.to_s+ "').hide();
|
||||||
|
$('#edit_box_dense" +attachment.id.to_s+ "').hide();") if edit_allowed %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
|
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
|
||||||
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
|
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
|
||||||
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %>
|
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %>
|
||||||
|
<%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense") %>
|
||||||
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
|
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
|
||||||
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
|
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
|
||||||
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
|
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
|
||||||
|
@ -34,6 +35,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% container.attachments.each do |file| %>
|
<% container.attachments.each do |file| %>
|
||||||
|
<%if file.is_public == 0 && !User.current.member_of?(@project)%>
|
||||||
|
<%next%>
|
||||||
|
<%end%>
|
||||||
<tr class="file <%= cycle("odd", "odd") %>">
|
<tr class="file <%= cycle("odd", "odd") %>">
|
||||||
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
||||||
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
||||||
|
@ -45,6 +49,14 @@
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="content_type"><%= file.show_suffix_type %></td>
|
<td class="content_type"><%= file.show_suffix_type %></td>
|
||||||
|
<td class="field_file_dense">
|
||||||
|
<span id="field_file_dense_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.file_dense_str %></span>
|
||||||
|
|
||||||
|
<span id="field_file_dense_id_edit<%= file.id %>" style="white-space:nowrap;">
|
||||||
|
<%= render :partial => 'course_file_dense_edit', :locals => {:file_dense_list => file.file_dense_list,
|
||||||
|
:attachment => file} %>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
<td class="downloads"><%= file.downloads %></td>
|
<td class="downloads"><%= file.downloads %></td>
|
||||||
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
||||||
<td align="center">
|
<td align="center">
|
||||||
|
|
|
@ -5,66 +5,78 @@
|
||||||
<% edit_allowed = User.current.allowed_to?(:manage_files, @course) %>
|
<% edit_allowed = User.current.allowed_to?(:manage_files, @course) %>
|
||||||
<table class="list files" id="ver-zebra">
|
<table class="list files" id="ver-zebra">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col class="vzebra-odd"/>
|
<col class="vzebra-odd"/>
|
||||||
<col class="vzebra-even"/>
|
<col class="vzebra-even"/>
|
||||||
<col class="vzebra-odd"/>
|
<col class="vzebra-odd"/>
|
||||||
<col class="vzebra-even"/>
|
<col class="vzebra-even"/>
|
||||||
<!-- <col class="vzebra-odd"/> -->
|
<!-- <col class="vzebra-odd"/> -->
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %>
|
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %>
|
||||||
<%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %>
|
<%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %>
|
||||||
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
|
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
|
||||||
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
|
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
|
||||||
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%>
|
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %>
|
||||||
|
<%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense") %>
|
||||||
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
|
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
|
||||||
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
|
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
|
||||||
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
|
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @containers.each do |container| %>
|
<% @containers.each do |container| %>
|
||||||
<% next if container.attachments.empty? -%>
|
<% next if container.attachments.empty? -%>
|
||||||
<% container.attachments.each do |file| %>
|
<% container.attachments.each do |file| %>
|
||||||
<% if isTypeOk(file,selAttachType,selContentType) %>
|
<% if file.is_public == 0 && !User.current.member_of?(@project) %>
|
||||||
<tr class="file <%= cycle("odd", "odd") %>">
|
<% next %>
|
||||||
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
<% end %>
|
||||||
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
<% if isTypeOk(file, selAttachType, selContentType) %>
|
||||||
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
|
<tr class="file <%= cycle("odd", "odd") %>">
|
||||||
<td class="attach_type">
|
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
||||||
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
|
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
||||||
|
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
|
||||||
|
<td class="attach_type">
|
||||||
|
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
|
||||||
|
|
||||||
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
|
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
|
||||||
<%= render :partial => 'attachments/course_type_edit', :locals => {:attachmenttypes => attachmenttypes,
|
<%= render :partial => 'attachments/course_type_edit', :locals => {:attachmenttypes => attachmenttypes,
|
||||||
:attachment => file,:contentype=>selContentType} %>
|
:attachment => file, :contentype => selContentType} %>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="content_type"><%= file.show_suffix_type %></td>
|
<td class="content_type"><%= file.show_suffix_type %></td>
|
||||||
<td class="downloads"><%= file.downloads %></td>
|
<td class="field_file_dense">
|
||||||
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
<span id="field_file_dense_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.file_dense_str %></span>
|
||||||
<td align="center">
|
|
||||||
<%= link_to(image_tag('delete.png'), attachment_path(file),
|
<span id="field_file_dense_id_edit<%= file.id %>" style="white-space:nowrap;">
|
||||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
|
<%= render :partial => 'course_file_dense_edit', :locals => {:file_dense_list => file.file_dense_list,
|
||||||
</td>
|
:attachment => file} %>
|
||||||
</tr>
|
</span>
|
||||||
<tr>
|
</td>
|
||||||
<td class='description' colspan="6">
|
<td class="downloads"><%= file.downloads %></td>
|
||||||
<div class="tags_area">
|
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
||||||
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
|
<td align="center">
|
||||||
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
|
<%= link_to(image_tag('delete.png'), attachment_path(file),
|
||||||
<div class="tags_gradint"></div>
|
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
|
||||||
</div>
|
</td>
|
||||||
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a>
|
</tr>
|
||||||
</div>
|
<tr>
|
||||||
</td>
|
<td class='description' colspan="6">
|
||||||
</tr>
|
<div class="tags_area">
|
||||||
<% end -%>
|
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
|
||||||
<% end -%>
|
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
|
||||||
<% reset_cycle %>
|
<div class="tags_gradint"></div>
|
||||||
<% end -%>
|
</div>
|
||||||
<!-- %= h downloadAll(@containers) % -->
|
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a>
|
||||||
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end -%>
|
||||||
|
<% end -%>
|
||||||
|
<% reset_cycle %>
|
||||||
|
<% end -%>
|
||||||
|
<!-- %= h downloadAll(@containers) % -->
|
||||||
|
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
||||||
|
<% if file_dense_list.any? %>
|
||||||
|
<div id="edit-file-dense-form-<%=attachment.id%>" class="hidden">
|
||||||
|
<%= select_tag "file_dense",
|
||||||
|
options_for_select(file_dense_list,attachment.file_dense_str), :onchange=>"file_dense_edit("+attachment.id.to_s + ",this.value)"%>
|
||||||
|
</div>
|
||||||
|
<%= link_to(image_tag('edit/edit.png'), 'javascript:void(0);',:style=>"white-space:nowrap;", :id=>"edit_box_dense"+attachment.id.to_s ,
|
||||||
|
:onclick =>"$('#edit-file-dense-form-" +attachment.id.to_s+ "').show();
|
||||||
|
$('#field_file_dense_id_label" +attachment.id.to_s+ "').hide();
|
||||||
|
$('#edit_box_dense" +attachment.id.to_s+ "').hide();") if edit_allowed %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
|
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
|
||||||
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
|
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
|
||||||
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %>
|
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %>
|
||||||
|
<%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense") %>
|
||||||
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
|
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
|
||||||
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
|
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
|
||||||
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
|
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
|
||||||
|
@ -34,6 +35,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% container.attachments.each do |file| %>
|
<% container.attachments.each do |file| %>
|
||||||
|
<%if file.is_public == 0 && !User.current.member_of?(@project)%>
|
||||||
|
<%next%>
|
||||||
|
<%end%>
|
||||||
<tr class="file <%= cycle("odd", "odd") %>">
|
<tr class="file <%= cycle("odd", "odd") %>">
|
||||||
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
||||||
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
||||||
|
@ -45,6 +49,14 @@
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="content_type"><%= file.show_suffix_type %></td>
|
<td class="content_type"><%= file.show_suffix_type %></td>
|
||||||
|
<td class="field_file_dense">
|
||||||
|
<span id="field_file_dense_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.file_dense_str %></span>
|
||||||
|
|
||||||
|
<span id="field_file_dense_id_edit<%= file.id %>" style="white-space:nowrap;">
|
||||||
|
<%= render :partial => 'project_file_dense_edit', :locals => {:file_dense_list => file.file_dense_list,
|
||||||
|
:attachment => file} %>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
<td class="downloads"><%= file.downloads %></td>
|
<td class="downloads"><%= file.downloads %></td>
|
||||||
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
||||||
<td align="center">
|
<td align="center">
|
||||||
|
|
|
@ -5,66 +5,78 @@
|
||||||
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
||||||
<table class="list files" id="ver-zebra">
|
<table class="list files" id="ver-zebra">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col class="vzebra-odd"/>
|
<col class="vzebra-odd"/>
|
||||||
<col class="vzebra-even"/>
|
<col class="vzebra-even"/>
|
||||||
<col class="vzebra-odd"/>
|
<col class="vzebra-odd"/>
|
||||||
<col class="vzebra-even"/>
|
<col class="vzebra-even"/>
|
||||||
<!-- <col class="vzebra-odd"/> -->
|
<!-- <col class="vzebra-odd"/> -->
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %>
|
<%= sort_header_tag('filename', :caption => l(:field_filename), :scope => "col", :id => "vzebra-adventure") %>
|
||||||
<%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %>
|
<%#= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc', :scope => "col", :id => "vzebra-comedy") %>
|
||||||
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
|
<%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc', :scope => "col", :id => "vzebra-children") %>
|
||||||
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
|
<%= sort_header_tag('attach_type', :caption => l(:attachment_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-attachmenttype") %>
|
||||||
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope =>"col", :id=> "vzebra-contenttype")%>
|
<%= sort_header_tag('content_type', :caption => l(:attachment_sufix_browse), :default_order => 'desc', :scope => "col", :id => "vzebra-contenttype") %>
|
||||||
|
<%= sort_header_tag('field_file_dense', :caption => l(:field_file_dense), :default_order => 'desc', :scope => "col", :id => "vzebra-field_file_dense") %>
|
||||||
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
|
<%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc', :scope => "col", :id => "vzebra-action") %>
|
||||||
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
|
<%= sort_header_tag('operation', :caption => "", :scope => "col", :id => "vzebra-children") %>
|
||||||
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
|
<!-- <%= sort_header_tag('description', :caption => l(:field_description)) %> -->
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @containers.each do |container| %>
|
<% @containers.each do |container| %>
|
||||||
<% next if container.attachments.empty? -%>
|
<% next if container.attachments.empty? -%>
|
||||||
<% container.attachments.each do |file| %>
|
<% container.attachments.each do |file| %>
|
||||||
<% if isTypeOk(file,selAttachType,selContentType) %>
|
<% if file.is_public == 0 && !User.current.member_of?(@project) %>
|
||||||
<tr class="file <%= cycle("odd", "odd") %>">
|
<% next %>
|
||||||
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
<% end %>
|
||||||
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
<% if isTypeOk(file, selAttachType, selContentType) %>
|
||||||
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
|
<tr class="file <%= cycle("odd", "odd") %>">
|
||||||
<td class="attach_type">
|
<td class="filename" style="font-size: 13px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
||||||
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
|
<!-- <td class="created_on"><%#= format_time(file.created_on) %></td> -->
|
||||||
|
<td class="filesize"><%= number_to_human_size(file.filesize) %></td>
|
||||||
|
<td class="attach_type">
|
||||||
|
<span id="attach_type_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.attachmentstype.typeName %></span>
|
||||||
|
|
||||||
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
|
<span id="attach_type_id_edit<%= file.id %>" style="white-space:nowrap;">
|
||||||
<%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes,
|
<%= render :partial => 'attachments/type_edit', :locals => {:attachmenttypes => attachmenttypes,
|
||||||
:attachment => file,:contentype=>selContentType} %>
|
:attachment => file, :contentype => selContentType} %>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="content_type"><%= file.show_suffix_type %></td>
|
<td class="content_type"><%= file.show_suffix_type %></td>
|
||||||
<td class="downloads"><%= file.downloads %></td>
|
<td class="field_file_dense">
|
||||||
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
<span id="field_file_dense_id_label<%= file.id %>" style="white-space:nowrap;"><%= file.file_dense_str %></span>
|
||||||
<td align="center">
|
|
||||||
<%= link_to(image_tag('delete.png'), attachment_path(file),
|
<span id="field_file_dense_id_edit<%= file.id %>" style="white-space:nowrap;">
|
||||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
|
<%= render :partial => 'project_file_dense_edit', :locals => {:file_dense_list => file.file_dense_list,
|
||||||
</td>
|
:attachment => file} %>
|
||||||
</tr>
|
</span>
|
||||||
<tr>
|
</td>
|
||||||
<td class='description' colspan="6">
|
<td class="downloads"><%= file.downloads %></td>
|
||||||
<div class="tags_area">
|
<!-- <td class="digest" width="300px"><%= file.description %></td> -->
|
||||||
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
|
<td align="center">
|
||||||
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
|
<%= link_to(image_tag('delete.png'), attachment_path(file),
|
||||||
<div class="tags_gradint"></div>
|
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if delete_allowed %>
|
||||||
</div>
|
</td>
|
||||||
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a>
|
</tr>
|
||||||
</div>
|
<tr>
|
||||||
</td>
|
<td class='description' colspan="6">
|
||||||
</tr>
|
<div class="tags_area">
|
||||||
<% end -%>
|
<%# @preTags = %w|预设A 预设B 预设C 预设D 预设E 预设Z | %>
|
||||||
<% end -%>
|
<%= render :partial => 'tags/tag', :locals => {:obj => file, :object_flag => "6"} %>
|
||||||
<% reset_cycle %>
|
<div class="tags_gradint"></div>
|
||||||
<% end -%>
|
</div>
|
||||||
<!-- %= h downloadAll(@containers) % -->
|
<div class="read-more hidden"><a href="javascript:void(0);" onclick="readmore(this);"> 更多 </a>
|
||||||
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end -%>
|
||||||
|
<% end -%>
|
||||||
|
<% reset_cycle %>
|
||||||
|
<% end -%>
|
||||||
|
<!-- %= h downloadAll(@containers) % -->
|
||||||
|
<!-- %= link_to "download all file", (downloadAll(@containers)) % -->
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -207,6 +207,23 @@
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 编辑文件密级
|
||||||
|
function file_dense_edit(id, type) {
|
||||||
|
$.ajax({
|
||||||
|
url: '<%=updateFileDense_attachments_path%>',
|
||||||
|
type: "POST",
|
||||||
|
remote:"true",
|
||||||
|
data: {
|
||||||
|
attachmentid: encodeURIComponent(id),
|
||||||
|
newtype: encodeURIComponent(type)
|
||||||
|
}
|
||||||
|
|
||||||
|
}).complete(function (xhr, textStatus) {
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="debug hidden">
|
<div class="debug">
|
||||||
<%= debug(params) if Rails.env.development? %>
|
<%= debug(params) if Rails.env.development? %>
|
||||||
</div>
|
</div>
|
||||||
<div class="hidden">
|
<div class="hidden">
|
||||||
|
@ -37,15 +37,16 @@
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||||
|
|
||||||
ga('create', 'UA-46523987-1', 'trustie.net');
|
ga('create', 'UA-46523987-1', 'trustie.net');
|
||||||
ga('send', 'pageview');
|
ga('send', 'pageview');
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
<%
|
<%
|
||||||
request.headers['REQUEST_URI'] = "" if request.headers['REQUEST_URI'].nil?
|
request.headers['REQUEST_URI'] = "" if request.headers['REQUEST_URI'].nil?
|
||||||
realUrl = request.original_url
|
realUrl = request.original_url
|
||||||
if (realUrl.match(/forge\.trustie\.net\/*/))
|
if (realUrl.match(/.*forge\.trustie\.net\/*/))
|
||||||
@nav_dispaly_project_label = 1
|
@nav_dispaly_project_label = 1
|
||||||
@nav_dispaly_forum_label = 1
|
@nav_dispaly_forum_label = 1
|
||||||
elsif (realUrl.match(/course\.trustie\.net\/*/))
|
elsif (realUrl.match(/.*course\.trustie\.net\/*/))
|
||||||
@nav_dispaly_course_all_label = 1
|
@nav_dispaly_course_all_label = 1
|
||||||
@nav_dispaly_forum_label = 1
|
@nav_dispaly_forum_label = 1
|
||||||
@nav_dispaly_course_label = nil
|
@nav_dispaly_course_label = nil
|
||||||
@nav_dispaly_store_all_label = 1
|
@nav_dispaly_store_all_label = 1
|
||||||
elsif (realUrl.match(/user\.trustie\.net\/*/))
|
elsif (realUrl.match(/.*user\.trustie\.net\/*/))
|
||||||
@nav_dispaly_home_path_label = 1
|
@nav_dispaly_home_path_label = 1
|
||||||
@nav_dispaly_main_course_label = 1
|
@nav_dispaly_main_course_label = 1
|
||||||
@nav_dispaly_main_project_label = 1
|
@nav_dispaly_main_project_label = 1
|
||||||
@nav_dispaly_main_contest_label = 1
|
@nav_dispaly_main_contest_label = 1
|
||||||
elsif (realUrl.match(/contest\.trustie\.net\/*/))
|
elsif (realUrl.match(/.*contest\.trustie\.net\/*/))
|
||||||
@nav_dispaly_contest_label = 1
|
@nav_dispaly_contest_label = 1
|
||||||
@nav_dispaly_store_all_label = 1
|
@nav_dispaly_store_all_label = 1
|
||||||
else
|
else
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<%= l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) %>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<h1><%= link_to(h(@project.name), @applied_url) %></h1>
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
<%= l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name) %>
|
||||||
|
|
||||||
|
<h1><%= link_to(h(@project.name), @applied_url) %></h1>
|
||||||
|
|
|
@ -233,6 +233,7 @@ en:
|
||||||
field_mail: Email
|
field_mail: Email
|
||||||
field_job_category: Job category # added by bai
|
field_job_category: Job category # added by bai
|
||||||
field_filename: File
|
field_filename: File
|
||||||
|
field_file_dense: File Dense
|
||||||
field_filesize: Size
|
field_filesize: Size
|
||||||
field_downloads: Downloads
|
field_downloads: Downloads
|
||||||
field_author: Author
|
field_author: Author
|
||||||
|
@ -1079,6 +1080,7 @@ en:
|
||||||
text_session_expiration_settings: "Warning: changing these settings may expire the current sessions including yours."
|
text_session_expiration_settings: "Warning: changing these settings may expire the current sessions including yours."
|
||||||
text_project_closed: This project is closed and read-only.
|
text_project_closed: This project is closed and read-only.
|
||||||
text_turning_multiple_off: "If you disable multiple values, multiple values will be removed in order to preserve only one value per item."
|
text_turning_multiple_off: "If you disable multiple values, multiple values will be removed in order to preserve only one value per item."
|
||||||
|
text_applied_project: "User %{id} Apply Join Project %{project}"
|
||||||
|
|
||||||
default_role_manager: Manager
|
default_role_manager: Manager
|
||||||
default_role_developer: Developer
|
default_role_developer: Developer
|
||||||
|
|
|
@ -251,6 +251,7 @@ zh:
|
||||||
field_lastname_eg: '(例:张三丰,请填写[张])'
|
field_lastname_eg: '(例:张三丰,请填写[张])'
|
||||||
field_mail: 邮件地址
|
field_mail: 邮件地址
|
||||||
field_filename: 文件
|
field_filename: 文件
|
||||||
|
field_file_dense: 文件密级
|
||||||
field_filesize: 大小
|
field_filesize: 大小
|
||||||
field_downloads: 下载次数
|
field_downloads: 下载次数
|
||||||
field_author: 作者
|
field_author: 作者
|
||||||
|
@ -1105,6 +1106,7 @@ zh:
|
||||||
text_own_membership_delete_confirmation: 你正在删除你现有的某些或全部权限,如果这样做了你可能将会再也无法编辑该项目了。你确定要继续吗?
|
text_own_membership_delete_confirmation: 你正在删除你现有的某些或全部权限,如果这样做了你可能将会再也无法编辑该项目了。你确定要继续吗?
|
||||||
text_zoom_in: 放大
|
text_zoom_in: 放大
|
||||||
text_zoom_out: 缩小
|
text_zoom_out: 缩小
|
||||||
|
text_applied_project: "用户 %{id} 申请加入项目 %{project}"
|
||||||
|
|
||||||
default_role_manager: 管理人员
|
default_role_manager: 管理人员
|
||||||
default_role_developer: 开发人员
|
default_role_developer: 开发人员
|
||||||
|
|
|
@ -515,6 +515,7 @@ RedmineApp::Application.routes.draw do
|
||||||
resources :attachments, :only => [:show, :destroy] do
|
resources :attachments, :only => [:show, :destroy] do
|
||||||
collection do
|
collection do
|
||||||
match "updateType" , via: [:get, :post]
|
match "updateType" , via: [:get, :post]
|
||||||
|
match "updateFileDense" , via: [:get, :post]
|
||||||
match "renderTag" , via: [:get, :post]
|
match "renderTag" , via: [:get, :post]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -249,3 +249,5 @@ contest_domain:
|
||||||
default: contest.trustie.net
|
default: contest.trustie.net
|
||||||
course_domain:
|
course_domain:
|
||||||
default: course.trustie.net
|
default: course.trustie.net
|
||||||
|
repository_domain:
|
||||||
|
default: repository.trustie.net
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
class AddQuateProjectPermission < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
# 添加课程权限
|
||||||
|
Role.all.each do |role|
|
||||||
|
if role.name == 'Manager'
|
||||||
|
role.permissions.append(:quote_project)
|
||||||
|
role.save(:validate => false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,5 @@
|
||||||
|
class AddIsPublicToAttachment < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :attachments, :is_public, :integer,:default => 1
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,22 @@
|
||||||
|
class UpdateAttachmentPublicAttr < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
# 更新资源文件的is_public属性
|
||||||
|
Attachment.all.each do |res|
|
||||||
|
if res.is_public
|
||||||
|
if(res.container.nil? ||
|
||||||
|
(res.container.class.to_s=="Project" && res.container.is_public == false) ||
|
||||||
|
(res.container.has_attribute?(:project) && res.container.project && res.container.project.is_public == false) ||
|
||||||
|
(res.container.class.to_s=="HomeworkAttach" && res.container.bid.reward_type == 3) ||
|
||||||
|
(res.container.class.to_s=="Course" && res.container.is_public == false) ||
|
||||||
|
(res.container.has_attribute?(:course) && res.container.course && res.container.course.is_public == false)
|
||||||
|
)
|
||||||
|
res.is_public = false
|
||||||
|
res.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20140704034832) do
|
ActiveRecord::Schema.define(:version => 20140710030426) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -51,6 +51,7 @@ ActiveRecord::Schema.define(:version => 20140704034832) do
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.string "disk_directory"
|
t.string "disk_directory"
|
||||||
t.integer "attachtype", :default => 1
|
t.integer "attachtype", :default => 1
|
||||||
|
t.integer "is_public", :default => 1
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
|
add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
|
||||||
|
|
|
@ -60,11 +60,28 @@ module Redmine
|
||||||
@unsaved_attachments ||= []
|
@unsaved_attachments ||= []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 设置资源文件的公开属性
|
||||||
|
# add by nwb
|
||||||
|
def set_attachment_public(res)
|
||||||
|
# 公开的资源判断他的父级的公开属性
|
||||||
|
if res.is_public
|
||||||
|
if( (self.class.to_s=="Project" && self.is_public == false) ||
|
||||||
|
(self.has_attribute?(:project) && self.project && self.project.is_public == false) ||
|
||||||
|
(self.class.to_s=="HomeworkAttach" && self.bid.reward_type == 3) ||
|
||||||
|
(self.class.to_s=="Course" && self.is_public == false) ||
|
||||||
|
(self.has_attribute?(:course) && self.course && self.course.is_public == false)
|
||||||
|
)
|
||||||
|
res.is_public = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def save_attachmentsex(attachments, author=User.current,attachment_type)
|
def save_attachmentsex(attachments, author=User.current,attachment_type)
|
||||||
@curattachment_type = attachment_type
|
@curattachment_type = attachment_type
|
||||||
result = save_attachments(attachments,author)
|
result = save_attachments(attachments,author)
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_attachments(attachments, author=User.current)
|
def save_attachments(attachments, author=User.current)
|
||||||
if attachments.is_a?(Hash)
|
if attachments.is_a?(Hash)
|
||||||
attachments = attachments.stringify_keys
|
attachments = attachments.stringify_keys
|
||||||
|
@ -94,6 +111,10 @@ module Redmine
|
||||||
a.filename = attachment['filename'] unless attachment['filename'].blank?
|
a.filename = attachment['filename'] unless attachment['filename'].blank?
|
||||||
a.content_type = attachment['content_type']
|
a.content_type = attachment['content_type']
|
||||||
end
|
end
|
||||||
|
if !attachment[:is_public]
|
||||||
|
a.is_public = false
|
||||||
|
end
|
||||||
|
set_attachment_public(a)
|
||||||
next unless a
|
next unless a
|
||||||
a.description = attachment['description'].to_s.strip
|
a.description = attachment['description'].to_s.strip
|
||||||
a.attachtype = @curattachment_type;
|
a.attachtype = @curattachment_type;
|
||||||
|
|
|
@ -98,6 +98,7 @@ Redmine::AccessControl.map do |map|
|
||||||
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member
|
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member
|
||||||
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member
|
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member
|
||||||
map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true
|
map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true
|
||||||
|
map.permission :quote_project, {},:require => :member
|
||||||
|
|
||||||
#课程权限模块
|
#课程权限模块
|
||||||
#added by nwb
|
#added by nwb
|
||||||
|
|
|
@ -23,7 +23,9 @@ function addFile(inputEl, file, eagerUpload) {
|
||||||
fileSpan.append(
|
fileSpan.append(
|
||||||
$('<input>', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name),
|
$('<input>', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name),
|
||||||
$('<input>', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 255, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload),
|
$('<input>', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 255, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload),
|
||||||
$('<a> </a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload),
|
$('<span >公开:</span>').attr({ 'class': 'ispublic-label' }) ,
|
||||||
|
$('<input>', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public]', checked:'checked' } ).toggle(!eagerUpload),
|
||||||
|
$('<a> </a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload),
|
||||||
$('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )
|
$('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )
|
||||||
).appendTo('#attachments_fields');
|
).appendTo('#attachments_fields');
|
||||||
|
|
||||||
|
@ -63,6 +65,7 @@ function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
|
||||||
.done(function(result) {
|
.done(function(result) {
|
||||||
progressSpan.progressbar( 'value', 100 ).remove();
|
progressSpan.progressbar( 'value', 100 ).remove();
|
||||||
fileSpan.find('input.description, a').css('display', 'inline-block');
|
fileSpan.find('input.description, a').css('display', 'inline-block');
|
||||||
|
fileSpan.find('input.is_public_checkbox, a').css('display', 'inline-block');
|
||||||
})
|
})
|
||||||
.fail(function(result) {
|
.fail(function(result) {
|
||||||
progressSpan.text(result.statusText);
|
progressSpan.text(result.statusText);
|
||||||
|
|
|
@ -1850,6 +1850,8 @@ span.required {color: #bb0000;}
|
||||||
#attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; }
|
#attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; }
|
||||||
a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%; width:1px; display:inline-block; padding-left:16px;}
|
a.remove-upload {background: url(../images/delete.png) no-repeat 1px 50%; width:1px; display:inline-block; padding-left:16px;}
|
||||||
a.remove-upload:hover {text-decoration:none !important;}
|
a.remove-upload:hover {text-decoration:none !important;}
|
||||||
|
#attachments_fields input.is_public_checkbox {width:20px;}
|
||||||
|
#attachments_fields span.ispublic-label {width:50px;margin-left:10px; }
|
||||||
|
|
||||||
/*gcm upload file count and deleteall*/
|
/*gcm upload file count and deleteall*/
|
||||||
#upload_file_count #count {color:red; font-size:1.5em;}
|
#upload_file_count #count {color:red; font-size:1.5em;}
|
||||||
|
|
|
@ -1081,6 +1081,11 @@ div.tags_area {
|
||||||
border-bottom: 1px solid #c8d4fd;
|
border-bottom: 1px solid #c8d4fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ver-zebra #vzebra-field_file_dense, #ver-zebra #vzebra-children {
|
||||||
|
background: #ffffff;
|
||||||
|
border-bottom: 1px solid #c8d4fd;
|
||||||
|
}
|
||||||
|
|
||||||
#ver-zebra #vzebra-comedy, #ver-zebra #vzebra-action {
|
#ver-zebra #vzebra-comedy, #ver-zebra #vzebra-action {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-bottom: 1px solid #d6dfff;
|
border-bottom: 1px solid #d6dfff;
|
||||||
|
|
Loading…
Reference in New Issue