commit
d3bd97acbf
@ -1,373 +1,373 @@
|
||||
# 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 AttachmentsController < ApplicationController
|
||||
layout "users_base"
|
||||
before_filter :find_project, :only => [:show, :download, :thumbnail, :destroy, :delete_homework]#, :except => [:upload, :autocomplete]
|
||||
before_filter :file_readable, :read_authorize, :only => [:show, :thumbnail]#Modified by young
|
||||
before_filter :delete_authorize, :only => :destroy
|
||||
before_filter :authorize_global, :only => :upload
|
||||
|
||||
before_filter :login_without_softapplication, only: [:download]
|
||||
accept_api_auth :show, :download, :upload
|
||||
require 'iconv'
|
||||
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if @attachment.is_diff?
|
||||
@diff = File.new(@attachment.diskfile, "rb").read
|
||||
@diff_type = params[:type] || User.current.pref[:diff_type] || 'inline'
|
||||
@diff_type = 'inline' unless %w(inline sbs).include?(@diff_type)
|
||||
# Save diff type as user preference
|
||||
if User.current.logged? && @diff_type != User.current.pref[:diff_type]
|
||||
User.current.pref[:diff_type] = @diff_type
|
||||
User.current.preference.save
|
||||
end
|
||||
render :action => 'diff'
|
||||
elsif @attachment.is_text? && @attachment.filesize <= Setting.file_max_size_displayed.to_i.kilobyte
|
||||
@content = File.new(@attachment.diskfile, "rb").read
|
||||
# 编码为非 UTF-8先进行间接转码
|
||||
# 部分unicode编码不直接支持转为 UTF-8
|
||||
# modify by nwb
|
||||
if @content.encoding.name != 'UTF-8'
|
||||
@content = @content.force_encoding('GBK')
|
||||
@content = @content.encode('UTF-8')
|
||||
end
|
||||
render :action => 'file'
|
||||
else
|
||||
download
|
||||
end
|
||||
}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def download
|
||||
# modify by nwb
|
||||
# 下载添加权限设置
|
||||
candown = false
|
||||
if (@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?(: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.class.to_s=="HomeworkAttach" && @attachment.container.bid.reward_type == 3
|
||||
candown = true
|
||||
else
|
||||
candown = @attachment.is_public == 1
|
||||
end
|
||||
if candown || User.current.admin? || User.current.id == @attachment.author_id
|
||||
@attachment.increment_download
|
||||
|
||||
if stale?(:etag => @attachment.digest)
|
||||
# images are sent inline
|
||||
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
|
||||
:type => detect_content_type(@attachment),
|
||||
:disposition => (@attachment.image? ? 'inline' : 'attachment')
|
||||
end
|
||||
|
||||
else
|
||||
render_403 :message => :notice_not_authorized
|
||||
end
|
||||
|
||||
rescue => e
|
||||
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
|
||||
end
|
||||
|
||||
#更新资源文件类型
|
||||
def updateType
|
||||
@attachment = Attachment.find(params[:attachmentid])
|
||||
if @attachment != nil
|
||||
@attachment.attachtype = params[:newtype]
|
||||
@attachment.save
|
||||
render :text =>'success'
|
||||
else
|
||||
render :text=>'error'
|
||||
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
|
||||
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
|
||||
if stale?(:etag => thumbnail)
|
||||
send_file thumbnail,
|
||||
:filename => filename_for_content_disposition(@attachment.filename),
|
||||
:type => detect_content_type(@attachment),
|
||||
:disposition => 'inline'
|
||||
end
|
||||
else
|
||||
# No thumbnail for the attachment or thumbnail could not be created
|
||||
render :nothing => true, :status => 404
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def upload
|
||||
# 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
|
||||
unless request.content_type == 'application/octet-stream'
|
||||
render :nothing => true, :status => 406
|
||||
return
|
||||
end
|
||||
|
||||
@attachment = Attachment.new(:file => request.raw_post)
|
||||
@attachment.author = User.current
|
||||
@attachment.filename = params[:filename].presence || Redmine::Utils.random_hex(16)
|
||||
saved = @attachment.save
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.api {
|
||||
if saved
|
||||
render :action => 'upload', :status => :created
|
||||
else
|
||||
render_validation_errors(@attachment)
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @attachment.container.respond_to?(:init_journal)
|
||||
@attachment.container.init_journal(User.current)
|
||||
end
|
||||
if @attachment.container
|
||||
# Make sure association callbacks are called
|
||||
@attachment.container.attachments.delete(@attachment)
|
||||
else
|
||||
@attachment.destroy
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if !@attachment.container.nil? &&
|
||||
(@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course_id) ) &&
|
||||
@attachment.container.course ) || ((@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) &&
|
||||
@attachment.container.board && @attachment.container.board.course ) )
|
||||
if @attachment.container.is_a?(News)
|
||||
format.html { redirect_to_referer_or news_path(@attachment.container) }
|
||||
elsif @attachment.container.is_a?(Message)
|
||||
format.html { redirect_to_referer_or new_board_message_path(@attachment.container) }
|
||||
elsif @course.nil?
|
||||
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
|
||||
else
|
||||
format.html { redirect_to_referer_or course_path(@course) }
|
||||
end
|
||||
else
|
||||
if @project.nil?
|
||||
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
|
||||
else
|
||||
format.html { redirect_to_referer_or project_path(@project) }
|
||||
end
|
||||
end
|
||||
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def delete_homework
|
||||
@bid = @attachment.container.bid
|
||||
# Make sure association callbacks are called
|
||||
container = @attachment.container
|
||||
@attachment.container.attachments.delete(@attachment)
|
||||
#if container.attachments.empty?
|
||||
#container.delete
|
||||
#end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or respond_path(@bid) }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#删除竞赛作品的附件
|
||||
def delete_softapplications
|
||||
@attachment = Attachment.find params[:id]
|
||||
@softapplication = @attachment.container if @attachment!=nil
|
||||
@attachment.container.attachments.delete(@attachment) if @attachment!=nil
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or edit_softapplication_path(@softapplication) }
|
||||
#format.js
|
||||
end
|
||||
end
|
||||
|
||||
def autocomplete
|
||||
# modify by nwb
|
||||
if params[:project_id]
|
||||
@project = Project.find_by_id(params[:project_id])
|
||||
elsif params[:course_id]
|
||||
@course = Course.find_by_id(params[:course_id])
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def add_exist_file_to_project
|
||||
classname = params[:class_name]
|
||||
class_id = params[:class_id]
|
||||
attachments = params[:attachment][:attach]
|
||||
|
||||
obj = Object.const_get(classname).find_by_id(class_id)
|
||||
attachments.collect do |attach_id|
|
||||
ori = Attachment.find_by_id(attach_id)
|
||||
next if ori.blank?
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = obj
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
@obj = obj
|
||||
@save_flag = attach_copied_obj.save
|
||||
@save_message = attach_copied_obj.errors.full_messages
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
rescue NoMethodError
|
||||
@save_flag = false
|
||||
@save_message = [] << l(:error_attachment_empty)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def add_exist_file_to_course
|
||||
class_id = params[:class_id]
|
||||
attachments = params[:attachment][:attach]
|
||||
|
||||
obj = Course.find_by_id(class_id)
|
||||
attachments.collect do |attach_id|
|
||||
ori = Attachment.find_by_id(attach_id)
|
||||
next if ori.blank?
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = obj
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 4
|
||||
end
|
||||
@obj = obj
|
||||
@save_flag = attach_copied_obj.save
|
||||
@save_message = attach_copied_obj.errors.full_messages
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
rescue NoMethodError
|
||||
@save_flag = false
|
||||
@save_message = [] << l(:error_attachment_empty)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def find_project
|
||||
@attachment = Attachment.find(params[:id])
|
||||
# Show 404 if the filename in the url is wrong
|
||||
# modify by nwb
|
||||
raise ActiveRecord::RecordNotFound if params[:filename] && params[:filename] != @attachment.filename
|
||||
if @attachment.container_type == 'Course'
|
||||
@course = @attachment.course
|
||||
elsif !@attachment.container.nil? && (@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course)) && @attachment.container.course
|
||||
@course = @attachment.container.course
|
||||
else
|
||||
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication'
|
||||
@project = @attachment.project
|
||||
end
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
# Checks that the file exists and is readable
|
||||
def file_readable
|
||||
if @attachment.readable?
|
||||
true
|
||||
else
|
||||
logger.error "Cannot send attachment, #{@attachment.diskfile} does not exist or is unreadable."
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
||||
def read_authorize
|
||||
if @attachment.container_type == "HomeworkAttach" || @attachment.container_type == 'Bid'
|
||||
true
|
||||
#User.current.allowed_to?(:view_homework_attaches, @attachment.project) ? true : deny_access
|
||||
else
|
||||
@attachment.visible? ? true : deny_access
|
||||
end
|
||||
end
|
||||
|
||||
def delete_authorize
|
||||
@attachment.deletable? ? true : deny_access
|
||||
end
|
||||
|
||||
def detect_content_type(attachment)
|
||||
content_type = attachment.content_type
|
||||
if content_type.blank?
|
||||
content_type = Redmine::MimeType.of(attachment.filename)
|
||||
end
|
||||
content_type.to_s
|
||||
end
|
||||
|
||||
def login_without_softapplication
|
||||
referer = request.headers['Referer']
|
||||
require_login unless referer =~ /softapplication/
|
||||
end
|
||||
|
||||
def renderTag
|
||||
@attachmentNew = Attachment.find(params[:attchmentId])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
# 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 AttachmentsController < ApplicationController
|
||||
layout "users_base"
|
||||
before_filter :find_project, :only => [:show, :download, :thumbnail, :destroy, :delete_homework]#, :except => [:upload, :autocomplete]
|
||||
before_filter :file_readable, :read_authorize, :only => [:show, :thumbnail]#Modified by young
|
||||
before_filter :delete_authorize, :only => :destroy
|
||||
before_filter :authorize_global, :only => :upload
|
||||
|
||||
before_filter :login_without_softapplication, only: [:download]
|
||||
accept_api_auth :show, :download, :upload
|
||||
require 'iconv'
|
||||
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if @attachment.is_diff?
|
||||
@diff = File.new(@attachment.diskfile, "rb").read
|
||||
@diff_type = params[:type] || User.current.pref[:diff_type] || 'inline'
|
||||
@diff_type = 'inline' unless %w(inline sbs).include?(@diff_type)
|
||||
# Save diff type as user preference
|
||||
if User.current.logged? && @diff_type != User.current.pref[:diff_type]
|
||||
User.current.pref[:diff_type] = @diff_type
|
||||
User.current.preference.save
|
||||
end
|
||||
render :action => 'diff'
|
||||
elsif @attachment.is_text? && @attachment.filesize <= Setting.file_max_size_displayed.to_i.kilobyte
|
||||
@content = File.new(@attachment.diskfile, "rb").read
|
||||
# 编码为非 UTF-8先进行间接转码
|
||||
# 部分unicode编码不直接支持转为 UTF-8
|
||||
# modify by nwb
|
||||
if @content.encoding.name != 'UTF-8'
|
||||
@content = @content.force_encoding('GBK')
|
||||
@content = @content.encode('UTF-8')
|
||||
end
|
||||
render :action => 'file'
|
||||
else
|
||||
download
|
||||
end
|
||||
}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def download
|
||||
# modify by nwb
|
||||
# 下载添加权限设置
|
||||
candown = false
|
||||
if (@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?(: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.class.to_s=="HomeworkAttach" && @attachment.container.bid.reward_type == 3
|
||||
candown = true
|
||||
else
|
||||
candown = @attachment.is_public == 1
|
||||
end
|
||||
if candown || User.current.admin? || User.current.id == @attachment.author_id
|
||||
@attachment.increment_download
|
||||
|
||||
if stale?(:etag => @attachment.digest)
|
||||
# images are sent inline
|
||||
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
|
||||
:type => detect_content_type(@attachment),
|
||||
:disposition => (@attachment.image? ? 'inline' : 'attachment')
|
||||
end
|
||||
|
||||
else
|
||||
render_403 :message => :notice_not_authorized
|
||||
end
|
||||
|
||||
rescue => e
|
||||
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
|
||||
end
|
||||
|
||||
#更新资源文件类型
|
||||
def updateType
|
||||
@attachment = Attachment.find(params[:attachmentid])
|
||||
if @attachment != nil
|
||||
@attachment.attachtype = params[:newtype]
|
||||
@attachment.save
|
||||
render :text =>'success'
|
||||
else
|
||||
render :text=>'error'
|
||||
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
|
||||
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
|
||||
if stale?(:etag => thumbnail)
|
||||
send_file thumbnail,
|
||||
:filename => filename_for_content_disposition(@attachment.filename),
|
||||
:type => detect_content_type(@attachment),
|
||||
:disposition => 'inline'
|
||||
end
|
||||
else
|
||||
# No thumbnail for the attachment or thumbnail could not be created
|
||||
render :nothing => true, :status => 404
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def upload
|
||||
# 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
|
||||
unless request.content_type == 'application/octet-stream'
|
||||
render :nothing => true, :status => 406
|
||||
return
|
||||
end
|
||||
|
||||
@attachment = Attachment.new(:file => request.raw_post)
|
||||
@attachment.author = User.current
|
||||
@attachment.filename = params[:filename].presence || Redmine::Utils.random_hex(16)
|
||||
saved = @attachment.save
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.api {
|
||||
if saved
|
||||
render :action => 'upload', :status => :created
|
||||
else
|
||||
render_validation_errors(@attachment)
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @attachment.container.respond_to?(:init_journal)
|
||||
@attachment.container.init_journal(User.current)
|
||||
end
|
||||
if @attachment.container
|
||||
# Make sure association callbacks are called
|
||||
@attachment.container.attachments.delete(@attachment)
|
||||
else
|
||||
@attachment.destroy
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
if !@attachment.container.nil? &&
|
||||
(@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course_id) ) &&
|
||||
@attachment.container.course ) || ((@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) &&
|
||||
@attachment.container.board && @attachment.container.board.course ) )
|
||||
if @attachment.container.is_a?(News)
|
||||
format.html { redirect_to_referer_or news_path(@attachment.container) }
|
||||
elsif @attachment.container.is_a?(Message)
|
||||
format.html { redirect_to_referer_or new_board_message_path(@attachment.container) }
|
||||
elsif @course.nil?
|
||||
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
|
||||
else
|
||||
format.html { redirect_to_referer_or course_path(@course) }
|
||||
end
|
||||
else
|
||||
if @project.nil?
|
||||
format.html { redirect_to_referer_or forum_memo_path(@attachment.container.forum, @attachment.container) }
|
||||
else
|
||||
format.html { redirect_to_referer_or project_path(@project) }
|
||||
end
|
||||
end
|
||||
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def delete_homework
|
||||
@bid = @attachment.container.bid
|
||||
# Make sure association callbacks are called
|
||||
container = @attachment.container
|
||||
@attachment.container.attachments.delete(@attachment)
|
||||
#if container.attachments.empty?
|
||||
#container.delete
|
||||
#end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or respond_path(@bid) }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#删除竞赛作品的附件
|
||||
def delete_softapplications
|
||||
@attachment = Attachment.find params[:id]
|
||||
@softapplication = @attachment.container if @attachment!=nil
|
||||
@attachment.container.attachments.delete(@attachment) if @attachment!=nil
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_referer_or edit_softapplication_path(@softapplication) }
|
||||
#format.js
|
||||
end
|
||||
end
|
||||
|
||||
def autocomplete
|
||||
# modify by nwb
|
||||
if params[:project_id]
|
||||
@project = Project.find_by_id(params[:project_id])
|
||||
elsif params[:course_id]
|
||||
@course = Course.find_by_id(params[:course_id])
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def add_exist_file_to_project
|
||||
classname = params[:class_name]
|
||||
class_id = params[:class_id]
|
||||
attachments = params[:attachment][:attach]
|
||||
|
||||
obj = Object.const_get(classname).find_by_id(class_id)
|
||||
attachments.collect do |attach_id|
|
||||
ori = Attachment.find_by_id(attach_id)
|
||||
next if ori.blank?
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = obj
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
@obj = obj
|
||||
@save_flag = attach_copied_obj.save
|
||||
@save_message = attach_copied_obj.errors.full_messages
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
rescue NoMethodError
|
||||
@save_flag = false
|
||||
@save_message = [] << l(:error_attachment_empty)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def add_exist_file_to_course
|
||||
class_id = params[:class_id]
|
||||
attachments = params[:attachment][:attach]
|
||||
|
||||
obj = Course.find_by_id(class_id)
|
||||
attachments.collect do |attach_id|
|
||||
ori = Attachment.find_by_id(attach_id)
|
||||
next if ori.blank?
|
||||
attach_copied_obj = ori.copy
|
||||
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
||||
attach_copied_obj.container = obj
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 4
|
||||
end
|
||||
@obj = obj
|
||||
@save_flag = attach_copied_obj.save
|
||||
@save_message = attach_copied_obj.errors.full_messages
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
rescue NoMethodError
|
||||
@save_flag = false
|
||||
@save_message = [] << l(:error_attachment_empty)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def find_project
|
||||
@attachment = Attachment.find(params[:id])
|
||||
# Show 404 if the filename in the url is wrong
|
||||
# modify by nwb
|
||||
raise ActiveRecord::RecordNotFound if params[:filename] && params[:filename] != @attachment.filename
|
||||
if @attachment.container_type == 'Course'
|
||||
@course = @attachment.course
|
||||
elsif !@attachment.container.nil? && (@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course)) && @attachment.container.course
|
||||
@course = @attachment.container.course
|
||||
else
|
||||
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication'
|
||||
@project = @attachment.project
|
||||
end
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
# Checks that the file exists and is readable
|
||||
def file_readable
|
||||
if @attachment.readable?
|
||||
true
|
||||
else
|
||||
logger.error "Cannot send attachment, #{@attachment.diskfile} does not exist or is unreadable."
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
||||
def read_authorize
|
||||
if @attachment.container_type == "HomeworkAttach" || @attachment.container_type == 'Bid'
|
||||
true
|
||||
#User.current.allowed_to?(:view_homework_attaches, @attachment.project) ? true : deny_access
|
||||
else
|
||||
@attachment.visible? ? true : deny_access
|
||||
end
|
||||
end
|
||||
|
||||
def delete_authorize
|
||||
@attachment.deletable? ? true : deny_access
|
||||
end
|
||||
|
||||
def detect_content_type(attachment)
|
||||
content_type = attachment.content_type
|
||||
if content_type.blank?
|
||||
content_type = Redmine::MimeType.of(attachment.filename)
|
||||
end
|
||||
content_type.to_s
|
||||
end
|
||||
|
||||
def login_without_softapplication
|
||||
referer = request.headers['Referer']
|
||||
require_login unless referer =~ /softapplication/ || referer =~ /memos/
|
||||
end
|
||||
|
||||
def renderTag
|
||||
@attachmentNew = Attachment.find(params[:attchmentId])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,202 +1,202 @@
|
||||
# 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 MessagesController < ApplicationController
|
||||
include ApplicationHelper
|
||||
menu_item :boards
|
||||
default_search_scope :messages
|
||||
before_filter :find_board, :only => [:new, :preview,:edit]
|
||||
before_filter :find_attachments, :only => [:preview]
|
||||
before_filter :find_message, :except => [:new, :preview]
|
||||
before_filter :authorize, :except => [:preview, :edit, :destroy, :new]
|
||||
|
||||
helper :boards
|
||||
helper :watchers
|
||||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
helper :project_score
|
||||
|
||||
REPLIES_PER_PAGE = 25 unless const_defined?(:REPLIES_PER_PAGE)
|
||||
|
||||
# Show a topic and its replies
|
||||
def show
|
||||
@isReply = true
|
||||
page = params[:page]
|
||||
# Find the page of the requested reply
|
||||
if params[:r] && page.nil?
|
||||
offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i])
|
||||
page = 1 + offset / REPLIES_PER_PAGE
|
||||
end
|
||||
|
||||
@reply_count = @topic.children.count
|
||||
@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
|
||||
@replies = @topic.children.
|
||||
includes(:author, :attachments, {:board => :project}).
|
||||
reorder("#{Message.table_name}.created_on DESC").
|
||||
limit(@reply_pages.per_page).
|
||||
offset(@reply_pages.offset).
|
||||
all
|
||||
|
||||
@reply = Message.new(:subject => "RE: #{@message.subject}")
|
||||
if @course
|
||||
render :action => "show", :layout => "base_courses"#by young
|
||||
else
|
||||
render :action => "show", :layout => "base_projects"#by young
|
||||
end
|
||||
end
|
||||
|
||||
# Create a new topic
|
||||
def new
|
||||
@message = Message.new
|
||||
@message.author = User.current
|
||||
@message.board = @board
|
||||
@message.safe_attributes = params[:message]
|
||||
if request.post?
|
||||
@message.save_attachments(params[:attachments])
|
||||
if @message.save
|
||||
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
|
||||
render_attachment_warning_if_needed(@message)
|
||||
redirect_to board_message_path(@board, @message)
|
||||
else
|
||||
layout_file = @project ? 'base_projects' : 'base_courses'
|
||||
render :action => 'new', :layout => layout_file
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Reply to a topic
|
||||
def reply
|
||||
if params[:reply][:content] == ""
|
||||
(redirect_to board_message_path(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
|
||||
end
|
||||
@quote = params[:quote][:quote]
|
||||
@reply = Message.new
|
||||
@reply.author = User.current
|
||||
@reply.board = @board
|
||||
@reply.safe_attributes = params[:reply]
|
||||
@reply.content = @quote + @reply.content
|
||||
@topic.children << @reply
|
||||
#@topic.update_attribute(:updated_on, Time.now)
|
||||
if !@reply.new_record?
|
||||
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
|
||||
attachments = Attachment.attach_files(@reply, params[:attachments])
|
||||
render_attachment_warning_if_needed(@reply)
|
||||
else
|
||||
#render file: 'messages#show', layout: 'base_courses'
|
||||
end
|
||||
redirect_to board_message_path(@board, @topic, :r => @reply)
|
||||
|
||||
end
|
||||
|
||||
# Edit a message
|
||||
def edit
|
||||
@isReply = false
|
||||
if @project
|
||||
(render_403; return false) unless @message.editable_by?(User.current)
|
||||
else
|
||||
(render_403; return false) unless @message.course_editable_by?(User.current)
|
||||
end
|
||||
@message.safe_attributes = params[:message]
|
||||
if request.post? && @message.save
|
||||
attachments = Attachment.attach_files(@message, params[:attachments])
|
||||
render_attachment_warning_if_needed(@message)
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
@message.reload
|
||||
redirect_to board_message_path(@message.board, @message.root, :r => (@message.parent_id && @message.id))
|
||||
elsif request.get?
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
layout_file = @project ? 'base_projects' : 'base_courses'
|
||||
render :layout => layout_file
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Delete a messages
|
||||
def destroy
|
||||
if @project
|
||||
(render_403; return false) unless @message.destroyable_by?(User.current)
|
||||
else
|
||||
(render_403; return false) unless @message.course_destroyable_by?(User.current)
|
||||
end
|
||||
r = @message.to_param
|
||||
@message.destroy
|
||||
# modify by nwb
|
||||
if @project
|
||||
if @message.parent
|
||||
redirect_to board_message_path(@board, @message.parent, :r => r)
|
||||
else
|
||||
redirect_to project_board_path(@project, @board)
|
||||
end
|
||||
elsif @course
|
||||
if @message.parent
|
||||
redirect_to board_message_path(@board, @message.parent, :r => r)
|
||||
else
|
||||
redirect_to course_board_path(@course, @board)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def quote
|
||||
@subject = @message.subject
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
|
||||
@temp = Message.new
|
||||
#@temp.content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}> "
|
||||
@content << @message.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
@content_html = textilizable(@content)
|
||||
@temp.content = @content_html
|
||||
#@content = "#{ll(Setting.default_language, :text_user_wrote, @message.author)} <br/> "
|
||||
#@content << @message.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
|
||||
#@content = "<blockquote>" << @content
|
||||
#@temp = Message.new
|
||||
#@temp.content = @content
|
||||
|
||||
end
|
||||
|
||||
def preview
|
||||
message = @board.messages.find_by_id(params[:id])
|
||||
@text = (params[:message] || params[:reply])[:content]
|
||||
@previewed = message
|
||||
render :partial => 'common/preview'
|
||||
end
|
||||
|
||||
private
|
||||
def find_message
|
||||
return unless find_board
|
||||
@message = @board.messages.find(params[:id], :include => :parent)
|
||||
@topic = @message.root
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_board
|
||||
#modify by nwb
|
||||
@board = Board.find(params[:board_id])
|
||||
if @board.project_id != -1 && @board.project_id != nil
|
||||
@project = @board.project
|
||||
elsif @board.course_id
|
||||
@course = @board.course
|
||||
end
|
||||
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
nil
|
||||
end
|
||||
end
|
||||
# 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 MessagesController < ApplicationController
|
||||
include ApplicationHelper
|
||||
menu_item :boards
|
||||
default_search_scope :messages
|
||||
before_filter :find_board, :only => [:new, :preview,:edit]
|
||||
before_filter :find_attachments, :only => [:preview]
|
||||
before_filter :find_message, :except => [:new, :preview]
|
||||
before_filter :authorize, :except => [:preview, :edit, :destroy, :new]
|
||||
|
||||
helper :boards
|
||||
helper :watchers
|
||||
helper :attachments
|
||||
include AttachmentsHelper
|
||||
helper :project_score
|
||||
|
||||
REPLIES_PER_PAGE = 25 unless const_defined?(:REPLIES_PER_PAGE)
|
||||
|
||||
# Show a topic and its replies
|
||||
def show
|
||||
@isReply = true
|
||||
page = params[:page]
|
||||
# Find the page of the requested reply
|
||||
if params[:r] && page.nil?
|
||||
offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i])
|
||||
page = 1 + offset / REPLIES_PER_PAGE
|
||||
end
|
||||
|
||||
@reply_count = @topic.children.count
|
||||
@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
|
||||
@replies = @topic.children.
|
||||
includes(:author, :attachments, {:board => :project}).
|
||||
reorder("#{Message.table_name}.created_on DESC").
|
||||
limit(@reply_pages.per_page).
|
||||
offset(@reply_pages.offset).
|
||||
all
|
||||
|
||||
@reply = Message.new(:subject => "RE: #{@message.subject}")
|
||||
if @course
|
||||
render :action => "show", :layout => "base_courses"#by young
|
||||
else
|
||||
render :action => "show", :layout => "base_projects"#by young
|
||||
end
|
||||
end
|
||||
|
||||
# Create a new topic
|
||||
def new
|
||||
@message = Message.new
|
||||
@message.author = User.current
|
||||
@message.board = @board
|
||||
@message.safe_attributes = params[:message]
|
||||
if request.post?
|
||||
@message.save_attachments(params[:attachments])
|
||||
if @message.save
|
||||
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
|
||||
render_attachment_warning_if_needed(@message)
|
||||
redirect_to board_message_path(@board, @message)
|
||||
else
|
||||
layout_file = @project ? 'base_projects' : 'base_courses'
|
||||
render :action => 'new', :layout => layout_file
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Reply to a topic
|
||||
def reply
|
||||
if params[:reply][:content] == ""
|
||||
(redirect_to board_message_path(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
|
||||
end
|
||||
@quote = params[:quote][:quote]
|
||||
@reply = Message.new
|
||||
@reply.author = User.current
|
||||
@reply.board = @board
|
||||
@reply.safe_attributes = params[:reply]
|
||||
@reply.content = @quote + @reply.content
|
||||
@topic.children << @reply
|
||||
#@topic.update_attribute(:updated_on, Time.now)
|
||||
if !@reply.new_record?
|
||||
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
|
||||
attachments = Attachment.attach_files(@reply, params[:attachments])
|
||||
render_attachment_warning_if_needed(@reply)
|
||||
else
|
||||
#render file: 'messages#show', layout: 'base_courses'
|
||||
end
|
||||
redirect_to board_message_path(@board, @topic, :r => @reply)
|
||||
|
||||
end
|
||||
|
||||
# Edit a message
|
||||
def edit
|
||||
@isReply = false
|
||||
if @project
|
||||
(render_403; return false) unless @message.editable_by?(User.current)
|
||||
else
|
||||
(render_403; return false) unless @message.course_editable_by?(User.current)
|
||||
end
|
||||
@message.safe_attributes = params[:message]
|
||||
if request.post? && @message.save
|
||||
attachments = Attachment.attach_files(@message, params[:attachments])
|
||||
render_attachment_warning_if_needed(@message)
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
@message.reload
|
||||
redirect_to board_message_path(@message.board, @message.root, :r => (@message.parent_id && @message.id))
|
||||
elsif request.get?
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
layout_file = @project ? 'base_projects' : 'base_courses'
|
||||
render :layout => layout_file
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Delete a messages
|
||||
def destroy
|
||||
if @project
|
||||
(render_403; return false) unless @message.destroyable_by?(User.current)
|
||||
else
|
||||
(render_403; return false) unless @message.course_destroyable_by?(User.current)
|
||||
end
|
||||
r = @message.to_param
|
||||
@message.destroy
|
||||
# modify by nwb
|
||||
if @project
|
||||
if @message.parent
|
||||
redirect_to board_message_path(@board, @message.parent, :r => r)
|
||||
else
|
||||
redirect_to project_board_path(@project, @board)
|
||||
end
|
||||
elsif @course
|
||||
if @message.parent
|
||||
redirect_to board_message_path(@board, @message.parent, :r => r)
|
||||
else
|
||||
redirect_to course_board_path(@course, @board)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def quote
|
||||
@subject = @message.subject
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
|
||||
@temp = Message.new
|
||||
#@temp.content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}> "
|
||||
@content << @message.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
|
||||
@content_html = textilizable(@content)
|
||||
@temp.content = @content_html
|
||||
#@content = "#{ll(Setting.default_language, :text_user_wrote, @message.author)} <br/> "
|
||||
#@content << @message.content.to_s.strip.gsub(%r{<pre>((.|\s)*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n") + "</blockquote>\n\n<br/>"
|
||||
#@content = "<blockquote>" << @content
|
||||
#@temp = Message.new
|
||||
#@temp.content = @content
|
||||
|
||||
end
|
||||
|
||||
def preview
|
||||
message = @board.messages.find_by_id(params[:id])
|
||||
@text = (params[:message] || params[:reply])[:content]
|
||||
@previewed = message
|
||||
render :partial => 'common/preview'
|
||||
end
|
||||
|
||||
private
|
||||
def find_message
|
||||
return unless find_board
|
||||
@message = @board.messages.find(params[:id], :include => :parent)
|
||||
@topic = @message.root
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_board
|
||||
#modify by nwb
|
||||
@board = Board.find(params[:board_id])
|
||||
if @board.project_id != -1 && @board.project_id != nil
|
||||
@project = @board.project
|
||||
elsif @board.course_id
|
||||
@course = @board.course
|
||||
end
|
||||
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
render_404
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,200 +1,200 @@
|
||||
# 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 VersionsController < ApplicationController
|
||||
layout "base_projects"
|
||||
menu_item :roadmap
|
||||
model_object Version
|
||||
before_filter :find_model_object, :except => [:index, :new, :create, :close_completed]
|
||||
#before_filter :find_model_object_contest, :except => [:index, :new, :create]
|
||||
before_filter :find_project_from_association, :except => [:index, :new, :create, :close_completed]
|
||||
before_filter :find_project_by_project_id, :only => [:index, :new, :create, :close_completed]
|
||||
before_filter :authorize
|
||||
|
||||
accept_api_auth :index, :show, :create, :update, :destroy
|
||||
|
||||
helper :custom_fields
|
||||
helper :projects
|
||||
helper :project_score
|
||||
|
||||
def index
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@trackers = @project.trackers.sorted.all
|
||||
retrieve_selected_tracker_ids(@trackers, @trackers.select {|t| t.is_in_roadmap?})
|
||||
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
|
||||
project_ids = @with_subprojects ? @project.self_and_descendants.collect(&:id) : [@project.id]
|
||||
|
||||
@versions = @project.shared_versions || []
|
||||
@versions += @project.rolled_up_versions.visible if @with_subprojects
|
||||
#added by young
|
||||
@versions = @versions.uniq.reverse#Modified by young
|
||||
unless params[:completed]
|
||||
@completed_versions = @versions.select {|version| version.closed? || version.completed? }
|
||||
@versions -= @completed_versions
|
||||
end
|
||||
@offset, @limit = api_offset_and_limit({:limit => 4})
|
||||
@versions_count = @versions.count
|
||||
@versions_pages = Paginator.new @versions_count, @limit, params['page']
|
||||
@offset ||= @versions_pages.offset
|
||||
@versions = @versions.slice(@offset, @limit)
|
||||
#end by young
|
||||
|
||||
|
||||
@issues_by_version = {}
|
||||
if @selected_tracker_ids.any? && @versions.any?
|
||||
issues = Issue.visible.all(
|
||||
:include => [:project, :status, :tracker, :priority, :fixed_version],
|
||||
:conditions => {:tracker_id => @selected_tracker_ids, :project_id => project_ids, :fixed_version_id => @versions.map(&:id)},
|
||||
:order => "#{Project.table_name}.lft, #{Tracker.table_name}.position, #{Issue.table_name}.id"
|
||||
)
|
||||
@issues_by_version = issues.group_by(&:fixed_version)
|
||||
end
|
||||
@versions.reject! {|version| !project_ids.include?(version.project_id) && @issues_by_version[version].blank?}
|
||||
}
|
||||
format.api {
|
||||
@versions = @project.shared_versions.all
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@issues = @version.fixed_issues.visible.
|
||||
includes(:status, :tracker, :priority).
|
||||
reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id").
|
||||
all
|
||||
}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@version = @project.versions.build
|
||||
@version.safe_attributes = params[:version]
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@version = @project.versions.build
|
||||
if params[:version]
|
||||
attributes = params[:version].dup
|
||||
attributes.delete('sharing') unless attributes.nil? || @version.allowed_sharings.include?(attributes['sharing'])
|
||||
@version.safe_attributes = attributes
|
||||
end
|
||||
|
||||
if request.post?
|
||||
if @version.save
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to settings_project_path(@project, :tab => 'versions')
|
||||
end
|
||||
format.js
|
||||
format.api do
|
||||
render :action => 'show', :status => :created, :location => version_url(@version)
|
||||
end
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new' }
|
||||
format.js { render :action => 'new' }
|
||||
format.api { render_validation_errors(@version) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if request.put? && params[:version]
|
||||
attributes = params[:version].dup
|
||||
attributes.delete('sharing') unless @version.allowed_sharings.include?(attributes['sharing'])
|
||||
@version.safe_attributes = attributes
|
||||
if @version.save
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_back_or_default settings_project_path(@project, :tab => 'versions')
|
||||
}
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'edit' }
|
||||
format.api { render_validation_errors(@version) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def close_completed
|
||||
if request.put?
|
||||
@project.close_completed_versions
|
||||
end
|
||||
redirect_to settings_project_path(@project, :tab => 'versions')
|
||||
end
|
||||
|
||||
def close_completed_contest
|
||||
if request.put?
|
||||
@contest.close_completed_versions
|
||||
end
|
||||
redirect_to settings_contest_path(@contest, :tab => 'versions')
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @version.fixed_issues.empty?
|
||||
@version.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_back_or_default settings_project_path(@project, :tab => 'versions') }
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:error] = l(:notice_unable_delete_version)
|
||||
redirect_to settings_project_path(@project, :tab => 'versions')
|
||||
}
|
||||
format.api { head :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def status_by
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'show' }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def retrieve_selected_tracker_ids(selectable_trackers, default_trackers=nil)
|
||||
if ids = params[:tracker_ids]
|
||||
@selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s }
|
||||
else
|
||||
@selected_tracker_ids = (selectable_trackers).collect {|t| t.id.to_s }
|
||||
end
|
||||
end
|
||||
end
|
||||
# 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 VersionsController < ApplicationController
|
||||
layout "base_projects"
|
||||
menu_item :roadmap
|
||||
model_object Version
|
||||
before_filter :find_model_object, :except => [:index, :new, :create, :close_completed]
|
||||
#before_filter :find_model_object_contest, :except => [:index, :new, :create]
|
||||
before_filter :find_project_from_association, :except => [:index, :new, :create, :close_completed]
|
||||
before_filter :find_project_by_project_id, :only => [:index, :new, :create, :close_completed]
|
||||
before_filter :authorize
|
||||
|
||||
accept_api_auth :index, :show, :create, :update, :destroy
|
||||
|
||||
helper :custom_fields
|
||||
helper :projects
|
||||
helper :project_score
|
||||
|
||||
def index
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@trackers = @project.trackers.sorted.all
|
||||
retrieve_selected_tracker_ids(@trackers, @trackers.select {|t| t.is_in_roadmap?})
|
||||
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
|
||||
project_ids = @with_subprojects ? @project.self_and_descendants.collect(&:id) : [@project.id]
|
||||
|
||||
@versions = @project.shared_versions || []
|
||||
@versions += @project.rolled_up_versions.visible if @with_subprojects
|
||||
#added by young
|
||||
@versions = @versions.uniq.reverse#Modified by young
|
||||
unless params[:completed]
|
||||
@completed_versions = @versions.select {|version| version.closed? || version.completed? }
|
||||
@versions -= @completed_versions
|
||||
end
|
||||
@offset, @limit = api_offset_and_limit({:limit => 4})
|
||||
@versions_count = @versions.count
|
||||
@versions_pages = Paginator.new @versions_count, @limit, params['page']
|
||||
@offset ||= @versions_pages.offset
|
||||
@versions = @versions.slice(@offset, @limit)
|
||||
#end by young
|
||||
|
||||
|
||||
@issues_by_version = {}
|
||||
if @selected_tracker_ids.any? && @versions.any?
|
||||
issues = Issue.visible.all(
|
||||
:include => [:project, :status, :tracker, :priority, :fixed_version],
|
||||
:conditions => {:tracker_id => @selected_tracker_ids, :project_id => project_ids, :fixed_version_id => @versions.map(&:id)},
|
||||
:order => "#{Project.table_name}.lft, #{Tracker.table_name}.position, #{Issue.table_name}.id"
|
||||
)
|
||||
@issues_by_version = issues.group_by(&:fixed_version)
|
||||
end
|
||||
@versions.reject! {|version| !project_ids.include?(version.project_id) && @issues_by_version[version].blank?}
|
||||
}
|
||||
format.api {
|
||||
@versions = @project.shared_versions.all
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@issues = @version.fixed_issues.visible.
|
||||
includes(:status, :tracker, :priority).
|
||||
reorder("#{Tracker.table_name}.position, #{Issue.table_name}.id").
|
||||
all
|
||||
}
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@version = @project.versions.build
|
||||
@version.safe_attributes = params[:version]
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@version = @project.versions.build
|
||||
if params[:version]
|
||||
attributes = params[:version].dup
|
||||
attributes.delete('sharing') unless attributes.nil? || @version.allowed_sharings.include?(attributes['sharing'])
|
||||
@version.safe_attributes = attributes
|
||||
end
|
||||
|
||||
if request.post?
|
||||
if @version.save
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to settings_project_path(@project, :tab => 'versions')
|
||||
end
|
||||
format.js
|
||||
format.api do
|
||||
render :action => 'show', :status => :created, :location => version_url(@version)
|
||||
end
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'new' }
|
||||
format.js { render :action => 'new' }
|
||||
format.api { render_validation_errors(@version) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if request.put? && params[:version]
|
||||
attributes = params[:version].dup
|
||||
attributes.delete('sharing') unless @version.allowed_sharings.include?(attributes['sharing'])
|
||||
@version.safe_attributes = attributes
|
||||
if @version.save
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_update)
|
||||
redirect_back_or_default settings_project_path(@project, :tab => 'versions')
|
||||
}
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'edit' }
|
||||
format.api { render_validation_errors(@version) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def close_completed
|
||||
if request.put?
|
||||
@project.close_completed_versions
|
||||
end
|
||||
redirect_to settings_project_path(@project, :tab => 'versions')
|
||||
end
|
||||
|
||||
def close_completed_contest
|
||||
if request.put?
|
||||
@contest.close_completed_versions
|
||||
end
|
||||
redirect_to settings_contest_path(@contest, :tab => 'versions')
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @version.fixed_issues.empty?
|
||||
@version.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_back_or_default settings_project_path(@project, :tab => 'versions') }
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:error] = l(:notice_unable_delete_version)
|
||||
redirect_to settings_project_path(@project, :tab => 'versions')
|
||||
}
|
||||
format.api { head :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def status_by
|
||||
respond_to do |format|
|
||||
format.html { render :action => 'show' }
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def retrieve_selected_tracker_ids(selectable_trackers, default_trackers=nil)
|
||||
if ids = params[:tracker_ids]
|
||||
@selected_tracker_ids = (ids.is_a? Array) ? ids.collect { |id| id.to_i.to_s } : ids.split('/').collect { |id| id.to_i.to_s }
|
||||
else
|
||||
@selected_tracker_ids = (selectable_trackers).collect {|t| t.id.to_s }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,200 +1,200 @@
|
||||
# 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 WelcomeController < ApplicationController
|
||||
include ApplicationHelper
|
||||
include WelcomeHelper
|
||||
helper :project_score
|
||||
caches_action :robots
|
||||
before_filter :find_first_page, :only => [:index]
|
||||
# before_filter :fake, :only => [:index, :course]
|
||||
before_filter :entry_select, :only => [:index]
|
||||
|
||||
def index
|
||||
#@first_page = FirstPage.where("page_type = 'project'").first
|
||||
#@show_course = @first_page.show_course
|
||||
if @first_page.nil? || @first_page.sort_type.nil?
|
||||
@projects = find_miracle_project(10, 3,"score desc")
|
||||
else
|
||||
case @first_page.sort_type
|
||||
when 0
|
||||
@projects = find_miracle_project(10, 3,"created_on desc")
|
||||
#@projects = @projects_all.order("created_on desc")
|
||||
when 1
|
||||
@projects = find_miracle_project(10, 3,"score desc")
|
||||
#@projects = @projects_all.order("grade desc")
|
||||
when 2
|
||||
@projects = find_miracle_project(10, 3,"watchers_count desc")
|
||||
#@projects = @projects_all.order("watchers_count desc")
|
||||
|
||||
#gcm
|
||||
#when '3'
|
||||
#@projects=desc_sort_course_by_avtivity(@project_activity_count_array,@project_all_array)
|
||||
# @projects=handle_project @projects_all,@project_activity_count
|
||||
# @s_type = 3
|
||||
# @projects = @projects[@project_pages.offset, @project_pages.per_page]
|
||||
|
||||
else
|
||||
@projects = @projects_all.order("score desc")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def robots
|
||||
@projects = Project.all_public.active
|
||||
render :layout => false, :content_type => 'text/plain'
|
||||
end
|
||||
|
||||
def course
|
||||
@course_page = FirstPage.where("page_type = 'course'").first
|
||||
if params[:school_id]
|
||||
@school_id = params[:school_id]
|
||||
elsif User.current.logged? && User.current.user_extensions.try(:school)
|
||||
@school_id = User.current.user_extensions.school.try(:id)
|
||||
end
|
||||
@logoLink ||= logolink()
|
||||
end
|
||||
|
||||
|
||||
|
||||
def logolink()
|
||||
@course_page = FirstPage.where("page_type = 'course'").first
|
||||
logo = get_avatar?(@course_page)
|
||||
id = params[:school_id]
|
||||
logo_link = ""
|
||||
if id.nil? && (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?)
|
||||
if logo
|
||||
logo_link = url_to_avatar(@course_page)
|
||||
else
|
||||
logo_link = '/images/transparent.png'
|
||||
end
|
||||
|
||||
else
|
||||
if id == "0"
|
||||
if logo
|
||||
logo_link = url_to_avatar(@course_page)
|
||||
else
|
||||
logo_link = '/images/transparent.png'
|
||||
end
|
||||
else
|
||||
if id.nil?
|
||||
if School.find(User.current.user_extensions.school.id).logo_link.nil?
|
||||
logo_link = '/images/transparent.png'
|
||||
else
|
||||
logo_link = School.find(User.current.user_extensions.school.id).logo_link
|
||||
end
|
||||
else
|
||||
logo_link = School.find(id).logo_link
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
return logo_link
|
||||
end
|
||||
|
||||
|
||||
def contest
|
||||
@contest_page = FirstPage.where("page_type = 'contest'").first
|
||||
@contest_notifications = ContestNotification.order("id desc")
|
||||
end
|
||||
|
||||
def search
|
||||
search_condition = params[:q]
|
||||
search_type = params[:search_type].to_sym unless search_condition.blank?
|
||||
|
||||
if search_type.nil? && params[:contests_search] && params[:name] != ""
|
||||
search_type = :contests
|
||||
search_condition = params[:name]
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
case search_type
|
||||
when :projects
|
||||
redirect_to projects_search_path(:name => search_condition,
|
||||
:project_type => Project::ProjectType_project)
|
||||
when :courses
|
||||
redirect_to courses_search_path(:name => search_condition)
|
||||
when :contests
|
||||
redirect_to contests_path(:name => search_condition)
|
||||
when :users
|
||||
redirect_to users_search_path(:name => search_condition)
|
||||
when :users_teacher
|
||||
redirect_to users_search_path(:name => search_condition, :role => :teacher)
|
||||
when :users_student
|
||||
redirect_to users_search_path(:name => search_condition, :role => :student)
|
||||
else
|
||||
#redirect_to home_path, :alert => l(:label_sumbit_empty)
|
||||
(redirect_to home_path, :notice => l(:label_sumbit_empty);return) #if params[:name].blank?
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
|
||||
def entry_select
|
||||
#@first_page = FirstPage.where("page_type = 'project'").first
|
||||
url = request.original_url.gsub('/','')
|
||||
if url.include?(Setting.host_course.gsub('/',''))
|
||||
if @first_page.show_course == 1
|
||||
course
|
||||
render :course
|
||||
else
|
||||
render_404
|
||||
end
|
||||
|
||||
return 0
|
||||
elsif url.include?(Setting.host_contest.gsub('/',''))
|
||||
if @first_page.show_contest == 1
|
||||
contest
|
||||
render :contest
|
||||
else
|
||||
render_404
|
||||
end
|
||||
|
||||
return 0
|
||||
elsif url.include?(Setting.host_user.gsub('/',''))
|
||||
redirect_to(:controller => "users", :action => "index")
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
# def render(*args)
|
||||
# _fake if @fake_filter
|
||||
# super
|
||||
# end
|
||||
|
||||
# private
|
||||
|
||||
# def fake
|
||||
# @fake_filter = true
|
||||
# end
|
||||
|
||||
# # 骗子方法
|
||||
# def _fake
|
||||
# instance_variables.map { |variable|
|
||||
# if variable.to_s =~ /Count$/
|
||||
# self.instance_variable_set(variable.to_sym,
|
||||
# ("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i)
|
||||
# end
|
||||
# }
|
||||
# end
|
||||
|
||||
end
|
||||
# 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 WelcomeController < ApplicationController
|
||||
include ApplicationHelper
|
||||
include WelcomeHelper
|
||||
helper :project_score
|
||||
caches_action :robots
|
||||
before_filter :find_first_page, :only => [:index]
|
||||
# before_filter :fake, :only => [:index, :course]
|
||||
before_filter :entry_select, :only => [:index]
|
||||
|
||||
def index
|
||||
#@first_page = FirstPage.where("page_type = 'project'").first
|
||||
#@show_course = @first_page.show_course
|
||||
if @first_page.nil? || @first_page.sort_type.nil?
|
||||
@projects = find_miracle_project(10, 3,"score desc")
|
||||
else
|
||||
case @first_page.sort_type
|
||||
when 0
|
||||
@projects = find_miracle_project(10, 3,"created_on desc")
|
||||
#@projects = @projects_all.order("created_on desc")
|
||||
when 1
|
||||
@projects = find_miracle_project(10, 3,"score desc")
|
||||
#@projects = @projects_all.order("grade desc")
|
||||
when 2
|
||||
@projects = find_miracle_project(10, 3,"watchers_count desc")
|
||||
#@projects = @projects_all.order("watchers_count desc")
|
||||
|
||||
#gcm
|
||||
#when '3'
|
||||
#@projects=desc_sort_course_by_avtivity(@project_activity_count_array,@project_all_array)
|
||||
# @projects=handle_project @projects_all,@project_activity_count
|
||||
# @s_type = 3
|
||||
# @projects = @projects[@project_pages.offset, @project_pages.per_page]
|
||||
|
||||
else
|
||||
@projects = @projects_all.order("score desc")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def robots
|
||||
@projects = Project.all_public.active
|
||||
render :layout => false, :content_type => 'text/plain'
|
||||
end
|
||||
|
||||
def course
|
||||
@course_page = FirstPage.where("page_type = 'course'").first
|
||||
if params[:school_id]
|
||||
@school_id = params[:school_id]
|
||||
elsif User.current.logged? && User.current.user_extensions.try(:school)
|
||||
@school_id = User.current.user_extensions.school.try(:id)
|
||||
end
|
||||
@logoLink ||= logolink()
|
||||
end
|
||||
|
||||
|
||||
|
||||
def logolink()
|
||||
@course_page = FirstPage.where("page_type = 'course'").first
|
||||
logo = get_avatar?(@course_page)
|
||||
id = params[:school_id]
|
||||
logo_link = ""
|
||||
if id.nil? && (User.current.user_extensions.nil? || User.current.user_extensions.school.nil?)
|
||||
if logo
|
||||
logo_link = url_to_avatar(@course_page)
|
||||
else
|
||||
logo_link = '/images/transparent.png'
|
||||
end
|
||||
|
||||
else
|
||||
if id == "0"
|
||||
if logo
|
||||
logo_link = url_to_avatar(@course_page)
|
||||
else
|
||||
logo_link = '/images/transparent.png'
|
||||
end
|
||||
else
|
||||
if id.nil?
|
||||
if School.find(User.current.user_extensions.school.id).logo_link.nil?
|
||||
logo_link = '/images/transparent.png'
|
||||
else
|
||||
logo_link = School.find(User.current.user_extensions.school.id).logo_link
|
||||
end
|
||||
else
|
||||
logo_link = School.find(id).logo_link
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
return logo_link
|
||||
end
|
||||
|
||||
|
||||
def contest
|
||||
@contest_page = FirstPage.where("page_type = 'contest'").first
|
||||
@contest_notifications = Contestnotification.order("created_at desc").limit(5)
|
||||
end
|
||||
|
||||
def search
|
||||
search_condition = params[:q]
|
||||
search_type = params[:search_type].to_sym unless search_condition.blank?
|
||||
|
||||
if search_type.nil? && params[:contests_search] && params[:name] != ""
|
||||
search_type = :contests
|
||||
search_condition = params[:name]
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
case search_type
|
||||
when :projects
|
||||
redirect_to projects_search_path(:name => search_condition,
|
||||
:project_type => Project::ProjectType_project)
|
||||
when :courses
|
||||
redirect_to courses_search_path(:name => search_condition)
|
||||
when :contests
|
||||
redirect_to contests_path(:name => search_condition)
|
||||
when :users
|
||||
redirect_to users_search_path(:name => search_condition)
|
||||
when :users_teacher
|
||||
redirect_to users_search_path(:name => search_condition, :role => :teacher)
|
||||
when :users_student
|
||||
redirect_to users_search_path(:name => search_condition, :role => :student)
|
||||
else
|
||||
#redirect_to home_path, :alert => l(:label_sumbit_empty)
|
||||
(redirect_to home_path, :notice => l(:label_sumbit_empty);return) #if params[:name].blank?
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
|
||||
def entry_select
|
||||
#@first_page = FirstPage.where("page_type = 'project'").first
|
||||
url = request.original_url.gsub('/','')
|
||||
if url.include?(Setting.host_course.gsub('/',''))
|
||||
if @first_page.show_course == 1
|
||||
course
|
||||
render :course
|
||||
else
|
||||
render_404
|
||||
end
|
||||
|
||||
return 0
|
||||
elsif url.include?(Setting.host_contest.gsub('/',''))
|
||||
if @first_page.show_contest == 1
|
||||
contest
|
||||
render :contest
|
||||
else
|
||||
render_404
|
||||
end
|
||||
|
||||
return 0
|
||||
elsif url.include?(Setting.host_user.gsub('/',''))
|
||||
redirect_to(:controller => "users", :action => "index")
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
# def render(*args)
|
||||
# _fake if @fake_filter
|
||||
# super
|
||||
# end
|
||||
|
||||
# private
|
||||
|
||||
# def fake
|
||||
# @fake_filter = true
|
||||
# end
|
||||
|
||||
# # 骗子方法
|
||||
# def _fake
|
||||
# instance_variables.map { |variable|
|
||||
# if variable.to_s =~ /Count$/
|
||||
# self.instance_variable_set(variable.to_sym,
|
||||
# ("1" + (self.instance_variable_get(variable.to_sym).to_s)).to_i)
|
||||
# end
|
||||
# }
|
||||
# end
|
||||
|
||||
end
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,21 +1,21 @@
|
||||
class ProjectStatus < ActiveRecord::Base
|
||||
attr_accessible :changesets_count, :watchers_count, :project_id, :project_type,:grade
|
||||
belongs_to :project
|
||||
belongs_to :watchers
|
||||
belongs_to :changesets
|
||||
validates_presence_of :project_id
|
||||
validates_uniqueness_of :project_id
|
||||
|
||||
scope :visible, lambda {|*args| nil }
|
||||
# 更新字段 watchers_count 加1 这里没有做用户是否存在的匹配
|
||||
# 负责这个表的聂同学 是在新建用户时就新建了该表的记录
|
||||
# 但是 如果超级用户删除其他用户的话会造成读取错误 这里是遗漏点
|
||||
# 删除用户时 此表创建人员未作相应删除动作
|
||||
def update_watchers_count(num)
|
||||
if self.watchers_count||0 >= 0
|
||||
self.update_attribute(:watchers_count, self.watchers_count.to_i + num)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
class ProjectStatus < ActiveRecord::Base
|
||||
attr_accessible :changesets_count, :watchers_count, :project_id, :project_type,:grade
|
||||
belongs_to :project
|
||||
belongs_to :watchers
|
||||
belongs_to :changesets
|
||||
validates_presence_of :project_id
|
||||
validates_uniqueness_of :project_id
|
||||
|
||||
scope :visible, lambda {|*args| nil }
|
||||
# 更新字段 watchers_count 加1 这里没有做用户是否存在的匹配
|
||||
# 负责这个表的聂同学 是在新建用户时就新建了该表的记录
|
||||
# 但是 如果超级用户删除其他用户的话会造成读取错误 这里是遗漏点
|
||||
# 删除用户时 此表创建人员未作相应删除动作
|
||||
def update_watchers_count(num)
|
||||
if self.watchers_count||0 >= 0
|
||||
self.update_attribute(:watchers_count, self.watchers_count.to_i + num)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
@ -1,52 +1,52 @@
|
||||
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
|
||||
<% if defined?(container) && container && container.saved_attachments %>
|
||||
<% container.attachments.each_with_index do |attachment, i| %>
|
||||
<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}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") +
|
||||
if attachment.id.nil?
|
||||
else
|
||||
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
|
||||
end
|
||||
%>
|
||||
<%#= 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}" %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<script type='text/javascript'>
|
||||
// function CompatibleSend()
|
||||
// {
|
||||
// var obj=document.getElementById("_file");
|
||||
// var file= $(obj).clone();
|
||||
// file.click();
|
||||
// }
|
||||
</script>
|
||||
<span class="add_attachment">
|
||||
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
|
||||
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
|
||||
<%= button_tag "浏览", :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()' %>
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => '_file',
|
||||
:class => 'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => 'addInputFiles(this);',
|
||||
:style => 'display:none',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||
:upload_path => uploads_path(:format => 'js'),
|
||||
:description_placeholder => l(:label_optional_description)
|
||||
} %>
|
||||
<span id="upload_file_count"><%= l(:label_no_file_uploaded)%></span>
|
||||
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
</span>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= javascript_include_tag 'attachments' %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
|
||||
<% if defined?(container) && container && container.saved_attachments %>
|
||||
<% container.attachments.each_with_index do |attachment, i| %>
|
||||
<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}][description]", attachment.description, :maxlength => 255, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") +
|
||||
if attachment.id.nil?
|
||||
else
|
||||
link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload')
|
||||
end
|
||||
%>
|
||||
<%#= 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}" %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</span>
|
||||
<script type='text/javascript'>
|
||||
// function CompatibleSend()
|
||||
// {
|
||||
// var obj=document.getElementById("_file");
|
||||
// var file= $(obj).clone();
|
||||
// file.click();
|
||||
// }
|
||||
</script>
|
||||
<span class="add_attachment">
|
||||
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
|
||||
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
|
||||
<%= button_tag "浏览", :type=>"button", :onclick=>"_file.click()",:onmouseover => 'this.focus()' %>
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => '_file',
|
||||
:class => 'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => 'addInputFiles(this);',
|
||||
:style => 'display:none',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||
:upload_path => uploads_path(:format => 'js'),
|
||||
:description_placeholder => l(:label_optional_description)
|
||||
} %>
|
||||
<span id="upload_file_count"><%= l(:label_no_file_uploaded)%></span>
|
||||
(<%= l(:label_max_size) %>: <%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
</span>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= javascript_include_tag 'attachments' %>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
@ -1,26 +1,26 @@
|
||||
<h3><%=h @attachment.filename %></h3>
|
||||
|
||||
<div class="attachments">
|
||||
<p><%= h("#{@attachment.description} - ") unless @attachment.description.blank? %>
|
||||
<span class="author"><%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %></span></p>
|
||||
<p><%= link_to_attachment @attachment, :text => l(:button_download), :download => true -%>
|
||||
<span class="size">(<%= number_to_human_size @attachment.filesize %>)</span>   
|
||||
<span class="size">
|
||||
<% if @attachment!=nil &&(@attachment.container_type == 'Document' || @attachment.container_type == 'WikiPage') &&
|
||||
User.current.allowed_to?({:controller => 'code_review', :action => 'update_diff_view'}, @attachment.project) %>
|
||||
<%= l(:review_assignments)+":" %><%= link = link_to(l(:button_add), {:controller => 'code_review',
|
||||
:action => 'assign', :action_type => 'attachment',
|
||||
:id=>@attachment.project,
|
||||
:change_id => '', :attachment_id => @attachment.id,
|
||||
}, :class => 'icon icon-add') %>
|
||||
<% end %>
|
||||
</span></p>
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'common/file', :locals => {:content => @content, :filename => @attachment.filename} %>
|
||||
|
||||
<% html_title @attachment.filename %>
|
||||
|
||||
<% content_for :header_tags do -%>
|
||||
<%= stylesheet_link_tag "scm" -%>
|
||||
<% end -%>
|
||||
<h3><%=h @attachment.filename %></h3>
|
||||
|
||||
<div class="attachments">
|
||||
<p><%= h("#{@attachment.description} - ") unless @attachment.description.blank? %>
|
||||
<span class="author"><%= link_to_user(@attachment.author) %>, <%= format_time(@attachment.created_on) %></span></p>
|
||||
<p><%= link_to_attachment @attachment, :text => l(:button_download), :download => true -%>
|
||||
<span class="size">(<%= number_to_human_size @attachment.filesize %>)</span>   
|
||||
<span class="size">
|
||||
<% if @attachment!=nil &&(@attachment.container_type == 'Document' || @attachment.container_type == 'WikiPage') &&
|
||||
User.current.allowed_to?({:controller => 'code_review', :action => 'update_diff_view'}, @attachment.project) %>
|
||||
<%= l(:review_assignments)+":" %><%= link = link_to(l(:button_add), {:controller => 'code_review',
|
||||
:action => 'assign', :action_type => 'attachment',
|
||||
:id=>@attachment.project,
|
||||
:change_id => '', :attachment_id => @attachment.id,
|
||||
}, :class => 'icon icon-add') %>
|
||||
<% end %>
|
||||
</span></p>
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'common/file', :locals => {:content => @content, :filename => @attachment.filename} %>
|
||||
|
||||
<% html_title @attachment.filename %>
|
||||
|
||||
<% content_for :header_tags do -%>
|
||||
<%= stylesheet_link_tag "scm" -%>
|
||||
<% end -%>
|
||||
|
@ -1,10 +1,12 @@
|
||||
<!-- huang -->
|
||||
<h3><%=l(:label_newtype_contest)%></h3>
|
||||
|
||||
<%= labelled_form_for @contest, :url => {:controller => 'contests', :action => 'create_contest'}, method: :post do |f| %>
|
||||
<%= labelled_form_for @contest,
|
||||
:url => {:controller => 'contests', :action => 'create_contest'},
|
||||
method: :post do |f| %>
|
||||
<div class="box tabular">
|
||||
<%= render :partial => 'form_contest', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= javascript_tag "$('#bid_name').focus();" %>
|
||||
<% end %>
|
||||
<%= render :partial => 'form_contest', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= javascript_tag "$('#bid_name').focus();" %>
|
||||
<% end %>
|
||||
</div>
|
@ -1,32 +1,32 @@
|
||||
<!-- added by fq -->
|
||||
<!-- %= form_for(@forum) do |f| % -->
|
||||
<div id="share_new" style = "width: 500px; margin:0 auto; " >
|
||||
<%= labelled_form_for(@forum) do |f| %>
|
||||
<% if @forum.errors.any? %>
|
||||
<!--<div id="error_explanation">
|
||||
<h2><#%= pluralize(@forum.errors.count, "error") %> prohibited this forum from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<#% @forum.errors.full_messages.each do |msg| %>
|
||||
<li><#%= msg %></li>
|
||||
<#% end %>
|
||||
</ul>
|
||||
</div> -->
|
||||
<% end %>
|
||||
<div style="width: 120%;">
|
||||
<div class="field">
|
||||
<%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share' %>
|
||||
</div>
|
||||
<div>
|
||||
<script src="/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
|
||||
<%= f.text_area :description, :required => true, :id => 'editor01' %>
|
||||
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01',{height:300});</script>
|
||||
<p style="color: #ff0000">(<%= l(:label_forums_max_length) %>)</p>
|
||||
</div>
|
||||
<div class="actions" style=" padding-top: 10px; float:right">
|
||||
<%= submit_tag l(:button_submit) %>
|
||||
<%= link_to l(:button_back), forums_path ,:style => 'font-size: 14px; padding: 0px 3px;' %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- added by fq -->
|
||||
<!-- %= form_for(@forum) do |f| % -->
|
||||
<div id="share_new" style = "width: 500px; margin:0 auto; " >
|
||||
<%= labelled_form_for(@forum) do |f| %>
|
||||
<% if @forum.errors.any? %>
|
||||
<!--<div id="error_explanation">
|
||||
<h2><#%= pluralize(@forum.errors.count, "error") %> prohibited this forum from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<#% @forum.errors.full_messages.each do |msg| %>
|
||||
<li><#%= msg %></li>
|
||||
<#% end %>
|
||||
</ul>
|
||||
</div> -->
|
||||
<% end %>
|
||||
<div style="width: 120%;">
|
||||
<div class="field">
|
||||
<%= f.text_field :name, :required => true, :style => 'width: 100%;', :class => 'create-share' %>
|
||||
</div>
|
||||
<div>
|
||||
<script src="/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
|
||||
<%= f.text_area :description, :required => true, :id => 'editor01' %>
|
||||
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01',{height:300});</script>
|
||||
<p style="color: #ff0000">(<%= l(:label_forums_max_length) %>)</p>
|
||||
</div>
|
||||
<div class="actions" style=" padding-top: 10px; float:right">
|
||||
<%= submit_tag l(:button_submit) %>
|
||||
<%= link_to l(:button_back), forums_path ,:style => 'font-size: 14px; padding: 0px 3px;' %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -1,44 +1,44 @@
|
||||
<!-- added by fq -->
|
||||
<div id="add-memo" class='lz' style="display: none; padding: 20px;">
|
||||
<h3><%=l(:label_memo_new)%></h3>
|
||||
<% if User.current.logged? %>
|
||||
<%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %>
|
||||
<div class="actions" style="max-width:680px">
|
||||
<p><%= f.text_field :subject, :required => true%></p>
|
||||
<p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor02' %></p>
|
||||
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script>
|
||||
<p style="color: #ff0000">(<%= l(:label_memos_max_length) %>)</p>
|
||||
<p>
|
||||
<%= l(:label_attachment_plural) %><br />
|
||||
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
|
||||
</p>
|
||||
<%= f.submit :value => l(:label_memo_create) %>
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-memo").hide(); return false;' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--modified by huang-->
|
||||
<% #= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %>
|
||||
<span class="contextual-borad">
|
||||
<%= link_to(
|
||||
image_tag('edit.png')+l(:label_forum_edit),
|
||||
{:action => 'edit', :id => @forum},
|
||||
:method => 'get',
|
||||
:title => l(:button_edit)
|
||||
) if @forum.editable_by?(User.current) %>
|
||||
<%= link_to(
|
||||
image_tag('delete.png')+'删除讨论区',
|
||||
{:action => 'destroy', :id => @forum},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if @forum.destroyable_by?(User.current) %>
|
||||
</span>
|
||||
<span>
|
||||
<%= link_to l(:label_memo_new_from_forum), new_forum_memo_path(@forum), :class => 'icon icon-add',
|
||||
:onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
|
||||
</span>
|
||||
|
||||
|
||||
<%= render :partial => 'forums/show_topics', :locals => {:memos => @memos} %>
|
||||
<!-- added by fq -->
|
||||
<div id="add-memo" class='lz' style="display: none; padding: 20px;">
|
||||
<h3><%=l(:label_memo_new)%></h3>
|
||||
<% if User.current.logged? %>
|
||||
<%= labelled_form_for(@memo, :url => create_memo_forum_path(@forum), :html => {:multipart => true} ) do |f| %>
|
||||
<div class="actions" style="max-width:680px">
|
||||
<p><%= f.text_field :subject, :required => true%></p>
|
||||
<p style="max-width:680px"><%= f.text_area :content, :required => true, :id => 'editor02' %></p>
|
||||
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor02');</script>
|
||||
<p style="color: #ff0000">(<%= l(:label_memos_max_length) %>)</p>
|
||||
<p>
|
||||
<%= l(:label_attachment_plural) %><br />
|
||||
<%= render :partial => 'attachments/form', :locals => {:container => @memo} %>
|
||||
</p>
|
||||
<%= f.submit :value => l(:label_memo_create) %>
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-memo").hide(); return false;' %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<!--modified by huang-->
|
||||
<% #= link_to '发布帖子', new_forum_memo_path(@forum), :class => 'icon icon-add' %>
|
||||
<span class="contextual-borad">
|
||||
<%= link_to(
|
||||
image_tag('edit.png')+l(:label_forum_edit),
|
||||
{:action => 'edit', :id => @forum},
|
||||
:method => 'get',
|
||||
:title => l(:button_edit)
|
||||
) if @forum.editable_by?(User.current) %>
|
||||
<%= link_to(
|
||||
image_tag('delete.png')+'删除讨论区',
|
||||
{:action => 'destroy', :id => @forum},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if @forum.destroyable_by?(User.current) %>
|
||||
</span>
|
||||
<span>
|
||||
<%= link_to l(:label_memo_new_from_forum), new_forum_memo_path(@forum), :class => 'icon icon-add',
|
||||
:onclick => 'showAndScrollTo("add-memo", "memo_subject"); return false;' if User.current.logged? %>
|
||||
</span>
|
||||
|
||||
|
||||
<%= render :partial => 'forums/show_topics', :locals => {:memos => @memos} %>
|
||||
|
@ -1,99 +1,99 @@
|
||||
<% @nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_main_course_label = 1
|
||||
@nav_dispaly_main_project_label = 1
|
||||
@nav_dispaly_main_contest_label = 1 %>
|
||||
<% @nav_dispaly_forum_label = 1%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= javascript_include_tag "ckeditor/ckeditor.js" %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<body class="<%= h body_css_classes %>">
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<%=render :partial => 'layouts/base_header'%>
|
||||
<div id="main">
|
||||
<div class="top-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" style="width: 240px; color: #15bccf">软件项目托管社区</td>
|
||||
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="top-content-search">
|
||||
<%= form_tag(:controller => 'forums', :action => "search_memo", :id => params[:id], :method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= hidden_field_tag 'forum_id', params[:id] %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><%= link_to request.host()+"/forums", forums_path %></td>
|
||||
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to '公共贴吧', :controller => 'forums', :action => 'index' %> > <%=link_to @forum.name, forum_path(@forum) %></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="sidebar">
|
||||
<!--informations-->
|
||||
<div class="sidebar-forums">
|
||||
<div class="forums-line">
|
||||
<div class="forums-title"><%= @forum.name %></div>
|
||||
<div class="forums-description"><%= textAreailizable @forum.description %></div>
|
||||
</div>
|
||||
<!--informations-->
|
||||
<div class="formus-first-title" >创建人信息</div>
|
||||
<div class="forums-info">
|
||||
<div style="padding-top: 20px" >
|
||||
<span class="forums-avatar-left"><%= image_tag(url_to_avatar(@forum.creator), :class =>'vatar-size') %></span>
|
||||
<span class="forums-avatar-right">
|
||||
<% unless @forum.creator.nil? %>
|
||||
<%=link_to @forum.creator.name, user_path(@forum.creator) %>
|
||||
<div>
|
||||
<%= link_to l(:label_user_watcher)+"("+User.watched_by(@forum.creator.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist", :id => @forum.creator.id %>
|
||||
<%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@forum.creator.watcher_users(@forum.creator.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist", :id => @forum.creator.id %>
|
||||
</div>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<!--tags-->
|
||||
<% if User.current.logged? || User.current.admin? %>
|
||||
<div class="forums-tags"><%= render :partial => 'tags/tag', :locals => {:obj => @forum,:object_flag => "5"}%></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
|
||||
</div>
|
||||
<%= render :partial => 'layouts/base_footer'%>
|
||||
</div>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<% @nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_main_course_label = 1
|
||||
@nav_dispaly_main_project_label = 1
|
||||
@nav_dispaly_main_contest_label = 1 %>
|
||||
<% @nav_dispaly_forum_label = 1%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= javascript_include_tag "ckeditor/ckeditor.js" %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<body class="<%= h body_css_classes %>">
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<%=render :partial => 'layouts/base_header'%>
|
||||
<div id="main">
|
||||
<div class="top-content">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="info_font" style="width: 240px; color: #15bccf">软件项目托管社区</td>
|
||||
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="top-content-search">
|
||||
<%= form_tag(:controller => 'forums', :action => "search_memo", :id => params[:id], :method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= hidden_field_tag 'forum_id', params[:id] %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><%= link_to request.host()+"/forums", forums_path %></td>
|
||||
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to '公共贴吧', :controller => 'forums', :action => 'index' %> > <%=link_to @forum.name, forum_path(@forum) %></p></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="sidebar">
|
||||
<!--informations-->
|
||||
<div class="sidebar-forums">
|
||||
<div class="forums-line">
|
||||
<div class="forums-title"><%= @forum.name %></div>
|
||||
<div class="forums-description"><%= textAreailizable @forum.description %></div>
|
||||
</div>
|
||||
<!--informations-->
|
||||
<div class="formus-first-title" >创建人信息</div>
|
||||
<div class="forums-info">
|
||||
<div style="padding-top: 20px" >
|
||||
<span class="forums-avatar-left"><%= image_tag(url_to_avatar(@forum.creator), :class =>'vatar-size') %></span>
|
||||
<span class="forums-avatar-right">
|
||||
<% unless @forum.creator.nil? %>
|
||||
<%=link_to @forum.creator.name, user_path(@forum.creator) %>
|
||||
<div>
|
||||
<%= link_to l(:label_user_watcher)+"("+User.watched_by(@forum.creator.id).count.to_s+")" ,:controller=>"users", :action=>"user_watchlist", :id => @forum.creator.id %>
|
||||
<%= link_to l(:label_x_user_fans, :count => User.current.watcher_users(User.current.id).count)+"("+@forum.creator.watcher_users(@forum.creator.id).count.to_s+")", :controller=>"users", :action=>"user_fanslist", :id => @forum.creator.id %>
|
||||
</div>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<!--tags-->
|
||||
<% if User.current.logged? || User.current.admin? %>
|
||||
<div class="forums-tags"><%= render :partial => 'tags/tag', :locals => {:obj => @forum,:object_flag => "5"}%></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div id="content">
|
||||
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
|
||||
</div>
|
||||
<%= render :partial => 'layouts/base_footer'%>
|
||||
</div>
|
||||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@ -1,50 +1,50 @@
|
||||
<% @nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_main_course_label = 1
|
||||
@nav_dispaly_main_project_label = 1
|
||||
@nav_dispaly_main_contest_label = 1 %>
|
||||
<% @nav_dispaly_forum_label = 1%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<%= current_language %>">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%=h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "jquery.leanModal.min" %>
|
||||
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<body class="<%=h body_css_classes %>">
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<%=render :partial => 'layouts/base_header'%>
|
||||
<div id="main" class="nosidebar">
|
||||
<div id="content_">
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
<%=render :partial => 'layouts/base_footer'%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--<#%= call_hook :view_layouts_base_body_bottom %>-->
|
||||
</body>
|
||||
</html>
|
||||
<% @nav_dispaly_home_path_label = 1
|
||||
@nav_dispaly_main_course_label = 1
|
||||
@nav_dispaly_main_project_label = 1
|
||||
@nav_dispaly_main_contest_label = 1 %>
|
||||
<% @nav_dispaly_forum_label = 1%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<%= current_language %>">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%=h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= javascript_include_tag "jquery.leanModal.min" %>
|
||||
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<body class="<%=h body_css_classes %>">
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<%=render :partial => 'layouts/base_header'%>
|
||||
<div id="main" class="nosidebar">
|
||||
<div id="content_">
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
<%=render :partial => 'layouts/base_footer'%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!--<#%= call_hook :view_layouts_base_body_bottom %>-->
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,40 +1,47 @@
|
||||
<%= error_messages_for 'message' %>
|
||||
<% replying ||= false %>
|
||||
|
||||
<div class="box ph10_5">
|
||||
<!--[form:message]-->
|
||||
<% unless replying %>
|
||||
<p><label for="message_subject"><%= l(:field_subject) %><span class="required"> * </span></label><br/>
|
||||
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject" %><!--by young-->
|
||||
</p>
|
||||
<% else %>
|
||||
<p><label for="message_subject"><%= l(:field_subject) %><span class="required"> * </span></label><br/>
|
||||
<%= f.text_field :subject, :size => 60, :style => "width: 99%;", :id => "message_subject", :readonly => true %>
|
||||
</p>
|
||||
<% end %>
|
||||
<p>
|
||||
<% unless replying %>
|
||||
<% if @message.safe_attribute? 'sticky' %>
|
||||
<%= f.check_box :sticky %> <%= label_tag 'message_sticky', l(:label_board_sticky) %>
|
||||
<% end %>
|
||||
<% if @message.safe_attribute? 'locked' %>
|
||||
<%= f.check_box :locked %> <%= label_tag 'message_locked', l(:label_board_locked) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
<p><label for="message_subject"><%= l(:field_description) %><span class="required"> * </span></label>
|
||||
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %>
|
||||
<%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content' %></p>
|
||||
|
||||
<!--[eoform:message]-->
|
||||
|
||||
<p><%= l(:label_attachment_plural) %><br />
|
||||
<%= render :partial => 'attachments/form_course', :locals => {:container => @message,:isReply => @isReply} %></p>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
|
||||
<%= error_messages_for 'message' %>
|
||||
<% replying ||= false %>
|
||||
|
||||
<div class="box ph10_5">
|
||||
<!--[form:message]-->
|
||||
<% unless replying %>
|
||||
<p>
|
||||
<%= f.text_field :subject, :size => 60, :style => "width: 99%;display:none;", :id => "message_subject" %><!--by young-->
|
||||
</p>
|
||||
<% else %>
|
||||
<p>
|
||||
<%= f.text_field :subject, :size => 60, :style => "width: 99%;display:none;", :id => "message_subject", :readonly => true %>
|
||||
</p>
|
||||
<% end %>
|
||||
<p>
|
||||
<% unless replying %>
|
||||
<% if @message.safe_attribute? 'sticky' %>
|
||||
<%= f.check_box :sticky %> <%= label_tag 'message_sticky', l(:label_board_sticky) %>
|
||||
<% end %>
|
||||
<% if @message.safe_attribute? 'locked' %>
|
||||
<%= f.check_box :locked %> <%= label_tag 'message_locked', l(:label_board_locked) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
<p>
|
||||
<label for="message_subject"><%= l(:button_projects_feedback_respond) %>
|
||||
<span class="required"> * </span></label>
|
||||
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
</p>
|
||||
<p>
|
||||
<%= label_tag "message_content", l(:description_message_content), :class => "hidden-for-sighted" %>
|
||||
<%= f.text_area :content, :cols => 80, :rows => 13, :class => 'wiki-edit', :id => 'message_content' %>
|
||||
</p>
|
||||
|
||||
<!--[eoform:message]-->
|
||||
|
||||
<p>
|
||||
<%= l(:label_attachment_plural) %>
|
||||
<br />
|
||||
<%= render :partial => 'attachments/form_course', :locals => {:container => @message,:isReply => @isReply} %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<%#= wikitoolbar_for 'message_content' %>
|
@ -1,156 +1,156 @@
|
||||
<!-- get_praise_num(obj,1)函数中 1代表返回顶得次数 0返回踩的次数 -->
|
||||
<% if User.current.logged? %>
|
||||
<% if horizontal %>
|
||||
<!-- 横排 -->
|
||||
<div id="praise_tread_<%= obj.id %>" style="float:right;">
|
||||
|
||||
<% @is_valuate = is_praise_or_tread(obj,user_id)%>
|
||||
<% if @is_valuate.size > 0 %> <!-- 评价过 1代表赞 0代表踩 -->
|
||||
<% @flag = @is_valuate.first.praise_or_tread %>
|
||||
<% if @flag == 1 %> <!-- 顶过 --><!-- modified by bai -->
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td ><%= image_tag "/images/praise_tread/praise_false.png" , weight:"22px", height:"22px",:title => l(:label_issue_praise_over) %></td>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
<td><%= image_tag "/images/praise_tread/tread_false.png",weight:"22px", height:"22px",:title => l(:label_issue_appraise_over) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<% elsif @flag == 0 %> <!-- 踩过 0-->
|
||||
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td > <%= image_tag "/images/praise_tread/praise_false.png",weight:"22px", height:"22px", :title => l(:label_issue_appraise_over) %></td>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
<td><%= image_tag "/images/praise_tread/tread_false.png",weight:"22px", height:"22px",:title => l(:label_issue_tread_over) %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
|
||||
<% if user_id == obj.author_id %>
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td ><%= image_tag "/images/praise_tread/praise_true.png" , weight:"22px", height:"22px",:title => l(:label_issue_not_praise_over) %></td>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_not_treed_over) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% else %>
|
||||
<!-- 积分少于2分不能踩帖 -->
|
||||
<% if OptionNumber.get_user_option_number(user_id).nil? || OptionNumber.get_user_option_number(user_id).total_score < 2 %>
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td ><%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),
|
||||
:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %></td>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issues_score_not_enough) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% else %>
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td > <%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),
|
||||
:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %> </td>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
<td> <%= link_to image_tag("/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_tread)),:controller=>"praise_tread",
|
||||
:action=>"tread_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<!-- end -->
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% else %>
|
||||
<!-- 竖排 -->
|
||||
<div id="praise_tread_<%= obj.id %>" style="float:right;">
|
||||
<% @is_valuate = is_praise_or_tread(obj,user_id)%>
|
||||
<% if @is_valuate.size > 0 %> <!-- 评价过 1代表赞 0代表踩 -->
|
||||
<% @flag = @is_valuate.first.praise_or_tread %>
|
||||
<% if @flag == 1 %> <!-- 顶过 --><!-- modified by bai -->
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td ><%= image_tag "/images/praise_tread/praise_false.png" , weight:"22px", height:"22px",:title => l(:label_issue_praise_over) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><%= image_tag "/images/praise_tread/tread_false.png",weight:"22px", height:"22px",:title => l(:label_issue_appraise_over) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<% elsif @flag == 0 %> <!-- 踩过 0-->
|
||||
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td > <%= image_tag "/images/praise_tread/praise_false.png",weight:"22px", height:"22px", :title => l(:label_issue_appraise_over) %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= image_tag "/images/praise_tread/tread_false.png",weight:"22px", height:"22px",:title => l(:label_issue_tread_over) %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
<% if user_id == obj.author_id %>
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td > <%= image_tag "/images/praise_tread/praise_true.png",weight:"22px", height:"22px", :title => l(:label_issue_not_praise_over) %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_not_treed_over) %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<% else %>
|
||||
<% if OptionNumber.get_user_option_number(user_id).nil? || OptionNumber.get_user_option_number(user_id).total_score < 2 %>
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td > <%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),
|
||||
:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class ,:horizontal => horizontal %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issues_score_not_enough) %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<% else %>
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td > <%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),
|
||||
:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class ,:horizontal => horizontal %> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <%= link_to image_tag("/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_tread)),:controller=>"praise_tread",
|
||||
:action=>"tread_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class ,:horizontal => horizontal %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<!-- end -->
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<!-- get_praise_num(obj,1)函数中 1代表返回顶得次数 0返回踩的次数 -->
|
||||
<% if User.current.logged? %>
|
||||
<% if horizontal %>
|
||||
<!-- 横排 -->
|
||||
<div id="praise_tread_<%= obj.id %>" style="float:right;">
|
||||
|
||||
<% @is_valuate = is_praise_or_tread(obj,user_id)%>
|
||||
<% if @is_valuate.size > 0 %> <!-- 评价过 1代表赞 0代表踩 -->
|
||||
<% @flag = @is_valuate.first.praise_or_tread %>
|
||||
<% if @flag == 1 %> <!-- 顶过 --><!-- modified by bai -->
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td ><%= image_tag "/images/praise_tread/praise_false.png" , weight:"22px", height:"22px",:title => l(:label_issue_praise_over) %></td>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
<td><%= image_tag "/images/praise_tread/tread_false.png",weight:"22px", height:"22px",:title => l(:label_issue_appraise_over) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<% elsif @flag == 0 %> <!-- 踩过 0-->
|
||||
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td > <%= image_tag "/images/praise_tread/praise_false.png",weight:"22px", height:"22px", :title => l(:label_issue_appraise_over) %></td>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
<td><%= image_tag "/images/praise_tread/tread_false.png",weight:"22px", height:"22px",:title => l(:label_issue_tread_over) %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
|
||||
<% if user_id == obj.author_id %>
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td ><%= image_tag "/images/praise_tread/praise_true.png" , weight:"22px", height:"22px",:title => l(:label_issue_not_praise_over) %></td>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_not_treed_over) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% else %>
|
||||
<!-- 积分少于2分不能踩帖 -->
|
||||
<% if OptionNumber.get_user_option_number(user_id).nil? || OptionNumber.get_user_option_number(user_id).total_score < 2 %>
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td ><%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),
|
||||
:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %></td>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issues_score_not_enough) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% else %>
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td > <%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),
|
||||
:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %> </td>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
<td> <%= link_to image_tag("/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_tread)),:controller=>"praise_tread",
|
||||
:action=>"tread_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class,:horizontal => horizontal %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<!-- end -->
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% else %>
|
||||
<!-- 竖排 -->
|
||||
<div id="praise_tread_<%= obj.id %>" style="float:right;">
|
||||
<% @is_valuate = is_praise_or_tread(obj,user_id)%>
|
||||
<% if @is_valuate.size > 0 %> <!-- 评价过 1代表赞 0代表踩 -->
|
||||
<% @flag = @is_valuate.first.praise_or_tread %>
|
||||
<% if @flag == 1 %> <!-- 顶过 --><!-- modified by bai -->
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td ><%= image_tag "/images/praise_tread/praise_false.png" , weight:"22px", height:"22px",:title => l(:label_issue_praise_over) %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><%= image_tag "/images/praise_tread/tread_false.png",weight:"22px", height:"22px",:title => l(:label_issue_appraise_over) %></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<% elsif @flag == 0 %> <!-- 踩过 0-->
|
||||
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td > <%= image_tag "/images/praise_tread/praise_false.png",weight:"22px", height:"22px", :title => l(:label_issue_appraise_over) %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= image_tag "/images/praise_tread/tread_false.png",weight:"22px", height:"22px",:title => l(:label_issue_tread_over) %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<% else %>
|
||||
<% if user_id == obj.author_id %>
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td > <%= image_tag "/images/praise_tread/praise_true.png",weight:"22px", height:"22px", :title => l(:label_issue_not_praise_over) %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_not_treed_over) %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<% else %>
|
||||
<% if OptionNumber.get_user_option_number(user_id).nil? || OptionNumber.get_user_option_number(user_id).total_score < 2 %>
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td > <%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),
|
||||
:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class ,:horizontal => horizontal %></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= image_tag "/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issues_score_not_enough) %> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<% else %>
|
||||
<table style="line-height: 1px">
|
||||
<tr>
|
||||
<td > <%= link_to image_tag("/images/praise_tread/praise_true.png",weight:"22px", height:"22px",:title => l(:label_issue_praise)),
|
||||
:controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class ,:horizontal => horizontal %> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><strong class="font_small_watch"><%= get_praise_num(obj)%></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <%= link_to image_tag("/images/praise_tread/tread_true.png",weight:"22px", height:"22px",:title => l(:label_issue_tread)),:controller=>"praise_tread",
|
||||
:action=>"tread_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class ,:horizontal => horizontal %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<!-- end -->
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -1,6 +1,4 @@
|
||||
<!-- added by bai -->
|
||||
<div><%= l(:label_issue_number) %> * 4 = <%= issue_num(@project) %> * 4 = <%= format("%.2f" , issue_num(@project) * 4).to_i %></div>
|
||||
<div><%= l(:label_issue_journal_number) %> * 1 = <%= issue_journal_num(@project) %> * 1 = <%= format("%.2f" , issue_journal_num(@project)).to_i %></div>
|
||||
<div><%= l(:label_issue_score) %> = <%= format("%.2f" , issue_num(@project) * 4).to_i %> + <%= format("%.2f" , issue_journal_num(@project)).to_i %>
|
||||
= <%= format("%.2f" , issue_score(@project)).to_i %></div>
|
||||
<!-- end -->
|
||||
<div><%= l(:label_issue_number) %> * 4 = <%= issue_num(project) %> * 4 = <%= format("%.2f" , issue_num(project) * 4).to_i %></div>
|
||||
<div><%= l(:label_issue_journal_number) %> * 1 = <%= issue_journal_num(project) %> * 1 = <%= format("%.2f" , issue_journal_num(project)).to_i %></div>
|
||||
<div><%= l(:label_issue_score) %> = <%= format("%.2f" , issue_num(project) * 4).to_i %> + <%= format("%.2f" , issue_journal_num(project)).to_i %>
|
||||
= <%= format("%.2f" , issue_score(project)).to_i %></div>
|
||||
|
@ -1,5 +1,2 @@
|
||||
<!-- added by bai -->
|
||||
|
||||
<div><%= l(:label_new_number) %> * 1 = <%= news_num(@project) %> * 1 = <%= format("%.2f" , news_score(@project)).to_i %></div>
|
||||
<div><%= l(:label_news_score) %> = <%= format("%.2f" , news_score(@project)).to_i %></div>
|
||||
<!-- end -->
|
||||
<div><%= l(:label_news_score) %> = <%= format("%.2f" , news_score(@project)).to_i %></div>
|
@ -1,147 +1,147 @@
|
||||
<%= error_messages_for 'member' %>
|
||||
<%
|
||||
roles = Role.givable.all
|
||||
if @project.project_type == Project::ProjectType_course
|
||||
roles = roles[3..5]
|
||||
else
|
||||
roles = roles[0..2]
|
||||
end
|
||||
members = @project.member_principals.includes(:roles, :principal).all.sort
|
||||
%>
|
||||
|
||||
<div class="splitcontentleft">
|
||||
<% if members.any? %>
|
||||
<table class="list members">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= l(:label_user) %></th>
|
||||
<th><%= l(:label_role_plural) %></th>
|
||||
<th style="width:15%"></th>
|
||||
<%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% members.each do |member| %>
|
||||
<% next if member.new_record? %>
|
||||
<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
|
||||
<td class="<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %></td>
|
||||
<td class="roles">
|
||||
<span id="member-<%= member.id %>-roles">
|
||||
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
|
||||
</span>
|
||||
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
|
||||
:method => :put,
|
||||
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
|
||||
) do |f| %>
|
||||
|
||||
<p>
|
||||
<% roles.each do |role| %>
|
||||
<label><%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
|
||||
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %> <%= h role %></label><br/>
|
||||
<% end %></p>
|
||||
<%= hidden_field_tag 'membership[role_ids][]', '' %>
|
||||
<p><%= submit_tag l(:button_change), :class => "small" %>
|
||||
<%= link_to_function l(:button_cancel),
|
||||
"$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;"
|
||||
%></p>
|
||||
<% end %>
|
||||
</td>
|
||||
<!--modified by huang for: if the user'roles is Manager that he will can't modified himself-->
|
||||
<% if @project.project_type == 1 %>
|
||||
<% if member.roles.first.to_s == "Manager" %>
|
||||
<td class="buttons"></td>
|
||||
<% else %>
|
||||
<td class="buttons">
|
||||
<%= link_to_function l(:button_edit),
|
||||
"$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;",
|
||||
:class => 'icon icon-edit' %>
|
||||
<%= delete_link membership_path(member),
|
||||
:remote => true,
|
||||
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<td class="buttons">
|
||||
<%= link_to_function l(:button_edit),
|
||||
"$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;",
|
||||
:class => 'icon icon-edit' %>
|
||||
<%= delete_link membership_path(member),
|
||||
:remote => true,
|
||||
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %>
|
||||
</td>
|
||||
<% end %>
|
||||
<!--end-->
|
||||
<%= call_hook(:view_projects_settings_members_table_row, {:project => @project, :member => member}) %>
|
||||
</tr>
|
||||
<% end; reset_cycle %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="splitcontentright">
|
||||
<% if roles.any? %>
|
||||
<% if @project.applied_projects.any? %>
|
||||
<div id="applied_project_block">
|
||||
<%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_apply_project) %></legend>
|
||||
|
||||
<div id="principals_for_applied_member">
|
||||
<%= render_principals_for_applied_members(@project) %>
|
||||
</div>
|
||||
<br/>
|
||||
<!--show the roles which will select-->
|
||||
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
|
||||
<% roles.each do |role| %>
|
||||
|
||||
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%= h role %></label>
|
||||
<% end %></p>
|
||||
|
||||
<p><%= submit_tag l(:label_approve), :id => 'member-add-submit' %>
|
||||
<%= submit_tag l(:label_refusal), :name => "refusal_button", :id => 'member-refusal-submit' %>
|
||||
</p>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_member_new) %></legend>
|
||||
|
||||
<p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p>
|
||||
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
|
||||
|
||||
<div id="principals_for_new_member">
|
||||
<%= render_principals_for_new_members(@project) %>
|
||||
</div>
|
||||
<br />
|
||||
<!--show the roles which will select-->
|
||||
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
|
||||
<% roles.each do |role| %>
|
||||
|
||||
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%= h role %></label>
|
||||
<% end %></p>
|
||||
|
||||
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
var collection=$("#principals_for_new_member").children("#principals").children("label");
|
||||
collection.css("text-overflow","ellipsis");
|
||||
collection.css("white-space","nowrap");
|
||||
collection.css("width","200px");
|
||||
collection.css("overflow","hidden");
|
||||
for(i=0;i<collection.length;i++){ //增加悬浮显示
|
||||
var label=collection[i];
|
||||
var text=$(label).text();
|
||||
$(label).attr("title",text);
|
||||
}
|
||||
});
|
||||
<%= error_messages_for 'member' %>
|
||||
<%
|
||||
roles = Role.givable.all
|
||||
if @project.project_type == Project::ProjectType_course
|
||||
roles = roles[3..5]
|
||||
else
|
||||
roles = roles[0..2]
|
||||
end
|
||||
members = @project.member_principals.includes(:roles, :principal).all.sort
|
||||
%>
|
||||
|
||||
<div class="splitcontentleft">
|
||||
<% if members.any? %>
|
||||
<table class="list members">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= l(:label_user) %></th>
|
||||
<th><%= l(:label_role_plural) %></th>
|
||||
<th style="width:15%"></th>
|
||||
<%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% members.each do |member| %>
|
||||
<% next if member.new_record? %>
|
||||
<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
|
||||
<td class="<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %></td>
|
||||
<td class="roles">
|
||||
<span id="member-<%= member.id %>-roles">
|
||||
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
|
||||
</span>
|
||||
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
|
||||
:method => :put,
|
||||
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
|
||||
) do |f| %>
|
||||
|
||||
<p>
|
||||
<% roles.each do |role| %>
|
||||
<label><%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
|
||||
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %> <%= h role %></label><br/>
|
||||
<% end %></p>
|
||||
<%= hidden_field_tag 'membership[role_ids][]', '' %>
|
||||
<p><%= submit_tag l(:button_change), :class => "small" %>
|
||||
<%= link_to_function l(:button_cancel),
|
||||
"$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;"
|
||||
%></p>
|
||||
<% end %>
|
||||
</td>
|
||||
<!--modified by huang for: if the user'roles is Manager that he will can't modified himself-->
|
||||
<% if @project.project_type == 1 %>
|
||||
<% if member.roles.first.to_s == "Manager" %>
|
||||
<td class="buttons"></td>
|
||||
<% else %>
|
||||
<td class="buttons">
|
||||
<%= link_to_function l(:button_edit),
|
||||
"$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;",
|
||||
:class => 'icon icon-edit' %>
|
||||
<%= delete_link membership_path(member),
|
||||
:remote => true,
|
||||
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<td class="buttons">
|
||||
<%= link_to_function l(:button_edit),
|
||||
"$('#member-#{member.id}-roles').hide(); $('#member-#{member.id}-roles-form').show(); return false;",
|
||||
:class => 'icon icon-edit' %>
|
||||
<%= delete_link membership_path(member),
|
||||
:remote => true,
|
||||
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {}) if member.deletable? %>
|
||||
</td>
|
||||
<% end %>
|
||||
<!--end-->
|
||||
<%= call_hook(:view_projects_settings_members_table_row, {:project => @project, :member => member}) %>
|
||||
</tr>
|
||||
<% end; reset_cycle %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="splitcontentright">
|
||||
<% if roles.any? %>
|
||||
<% if @project.applied_projects.any? %>
|
||||
<div id="applied_project_block">
|
||||
<%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_apply_project) %></legend>
|
||||
|
||||
<div id="principals_for_applied_member">
|
||||
<%= render_principals_for_applied_members(@project) %>
|
||||
</div>
|
||||
<br/>
|
||||
<!--show the roles which will select-->
|
||||
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
|
||||
<% roles.each do |role| %>
|
||||
|
||||
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%= h role %></label>
|
||||
<% end %></p>
|
||||
|
||||
<p><%= submit_tag l(:label_approve), :id => 'member-add-submit' %>
|
||||
<%= submit_tag l(:label_refusal), :name => "refusal_button", :id => 'member-refusal-submit' %>
|
||||
</p>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_member_new) %></legend>
|
||||
|
||||
<p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p>
|
||||
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
|
||||
|
||||
<div id="principals_for_new_member">
|
||||
<%= render_principals_for_new_members(@project) %>
|
||||
</div>
|
||||
<br />
|
||||
<!--show the roles which will select-->
|
||||
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
|
||||
<% roles.each do |role| %>
|
||||
|
||||
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%= h role %></label>
|
||||
<% end %></p>
|
||||
|
||||
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
var collection=$("#principals_for_new_member").children("#principals").children("label");
|
||||
collection.css("text-overflow","ellipsis");
|
||||
collection.css("white-space","nowrap");
|
||||
collection.css("width","200px");
|
||||
collection.css("overflow","hidden");
|
||||
for(i=0;i<collection.length;i++){ //增加悬浮显示
|
||||
var label=collection[i];
|
||||
var text=$(label).text();
|
||||
$(label).attr("title",text);
|
||||
}
|
||||
});
|
||||
</script>
|
@ -1,71 +1,71 @@
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= hubspot_head %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<% if @project %>
|
||||
<h3 class="title"><%= l(:label_projects_score) %></h3>
|
||||
<div class="inf_user_image">
|
||||
<table style="border-bottom: solid 1px #80a6d2;" width="100%">
|
||||
<tr>
|
||||
<td align="left" valign="middle" ><%= image_tag(url_to_avatar(@project), :class => 'avatar2') %></td>
|
||||
<td>
|
||||
<table>
|
||||
<tr class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><td><%= @project.name %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td width="35%">
|
||||
<table>
|
||||
<tr class="info_font"><td><%= l(:label_projects_score) %></td></tr>
|
||||
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , project_scores(@project) ).to_i %></span></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="tabs_new">
|
||||
<ul>
|
||||
<li>
|
||||
<%= link_to l(:label_projects_score), {:controller => 'projects', :action => 'show_projects_score', :remote => true}%> :
|
||||
<%= format("%.2f" , project_scores(@project) ).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_issue_score), {:controller => 'projects', :action => 'issue_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , issue_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_news_score), {:controller => 'projects', :action => 'news_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , news_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_file_score), {:controller => 'projects', :action => 'file_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , documents_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_code_submit_score), {:controller => 'projects', :action => 'code_submit_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , changesets_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_topic_score), {:controller => 'projects', :action => 'projects_topic_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , board_message_score(@project)).to_i %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="show_score_detail">
|
||||
<%= render :partial => 'projects/project_score_index', :locals => {:index => 0 } %>
|
||||
</div>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title><%= h html_title %></title>
|
||||
<meta name="description" content="<%= Redmine::Info.app_name %>" />
|
||||
<meta name="keywords" content="issue,bug,tracker" />
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= hubspot_head %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
<% if @project %>
|
||||
<h3 class="title"><%= l(:label_projects_score) %></h3>
|
||||
<div class="inf_user_image">
|
||||
<table style="border-bottom: solid 1px #80a6d2;" width="100%">
|
||||
<tr>
|
||||
<td align="left" valign="middle" ><%= image_tag(url_to_avatar(@project), :class => 'avatar2') %></td>
|
||||
<td>
|
||||
<table>
|
||||
<tr class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><td><%= @project.name %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td width="35%">
|
||||
<table>
|
||||
<tr class="info_font"><td><%= l(:label_projects_score) %></td></tr>
|
||||
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , project_scores(@project) ).to_i %></span></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="tabs_new">
|
||||
<ul>
|
||||
<li>
|
||||
<%= link_to l(:label_projects_score), {:controller => 'projects', :action => 'show_projects_score', :remote => true}%> :
|
||||
<%= format("%.2f" , project_scores(@project) ).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_issue_score), {:controller => 'projects', :action => 'issue_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , issue_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_news_score), {:controller => 'projects', :action => 'news_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , news_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_file_score), {:controller => 'projects', :action => 'file_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , documents_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_code_submit_score), {:controller => 'projects', :action => 'code_submit_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , changesets_score(@project)).to_i %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_topic_score), {:controller => 'projects', :action => 'projects_topic_score_index', :remote => true}%> :
|
||||
<%= format("%.2f" , board_message_score(@project)).to_i %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="show_score_detail">
|
||||
<%= render :partial => 'projects/project_score_index', :locals => {:index => 0 } %>
|
||||
</div>
|
||||
<% end %>
|
@ -1,5 +1,3 @@
|
||||
<!-- added by bai -->
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/show_projects_score') %>');
|
||||
showModal('ajax-modal', '400px');
|
||||
$('#ajax-modal').addClass('new-watcher');
|
||||
<!-- end -->
|
@ -1,97 +1,97 @@
|
||||
<div class="contextual" style="padding-right: 10px;">
|
||||
«
|
||||
<% unless @changeset.previous.nil? -%>
|
||||
<%= link_to_revision(@changeset.previous, @repository, :text => l(:label_previous)) %>
|
||||
<% else -%>
|
||||
<%= l(:label_previous) %>
|
||||
<% end -%>
|
||||
|
|
||||
<% unless @changeset.next.nil? -%>
|
||||
<%= link_to_revision(@changeset.next, @repository, :text => l(:label_next)) %>
|
||||
<% else -%>
|
||||
<%= l(:label_next) %>
|
||||
<% end -%>
|
||||
»
|
||||
|
||||
<%= form_tag({:controller => 'repositories',
|
||||
:action => 'revision',
|
||||
:id => @project,
|
||||
:repository_id => @repository.identifier_param,
|
||||
:rev => nil},
|
||||
:method => :get) do %>
|
||||
<%= text_field_tag 'rev', @rev, :size => 8 %>
|
||||
<%= submit_tag l(:label_button_ok), :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<h3 style="padding-top:40px;"><%= avatar(@changeset.user, :size => "24") %><%= l(:label_revision) %> <%= format_revision(@changeset) %></h3>
|
||||
|
||||
<% if @changeset.scmid.present? || @changeset.parents.present? || @changeset.children.present? %>
|
||||
<table class="revision-info">
|
||||
<% if @changeset.scmid.present? %>
|
||||
<tr>
|
||||
<td>ID</td><td><%= h(@changeset.scmid) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @changeset.parents.present? %>
|
||||
<tr>
|
||||
<td><%= l(:label_parent_revision) %></td>
|
||||
<td>
|
||||
<%= @changeset.parents.collect{
|
||||
|p| link_to_revision(p, @repository, :text => format_revision(p))
|
||||
}.join(", ").html_safe %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @changeset.children.present? %>
|
||||
<tr>
|
||||
<td><%= l(:label_child_revision) %></td>
|
||||
<td>
|
||||
<%= @changeset.children.collect{
|
||||
|p| link_to_revision(p, @repository, :text => format_revision(p))
|
||||
}.join(", ").html_safe %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<span class="author">
|
||||
<%= authoring(@changeset.committed_on, @changeset.author) %>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<%= textilizable @changeset.comments %>
|
||||
|
||||
<% if @changeset.issues.visible.any? || User.current.allowed_to?(:manage_related_issues, @repository.project) %>
|
||||
<%= render :partial => 'related_issues' %>
|
||||
<% end %>
|
||||
|
||||
<% if User.current.allowed_to?(:browse_repository, @project) %>
|
||||
<h3><%= l(:label_attachment_plural) %></h3>
|
||||
<ul id="changes-legend">
|
||||
<li class="change change-A"><%= l(:label_added) %></li>
|
||||
<li class="change change-M"><%= l(:label_modified) %></li>
|
||||
<li class="change change-C"><%= l(:label_copied) %></li>
|
||||
<li class="change change-R"><%= l(:label_renamed) %></li>
|
||||
<li class="change change-D"><%= l(:label_deleted) %></li>
|
||||
</ul>
|
||||
|
||||
<p><%= link_to(l(:label_view_diff),
|
||||
:action => 'diff',
|
||||
:id => @project,
|
||||
:repository_id => @repository.identifier_param,
|
||||
:path => "",
|
||||
:rev => @changeset.identifier) if @changeset.filechanges.any? %></p>
|
||||
|
||||
<div class="changeset-changes">
|
||||
<%= render_changeset_changes %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
<% end %>
|
||||
|
||||
<% html_title("#{l(:label_revision)} #{format_revision(@changeset)}") -%>
|
||||
<div class="contextual" style="padding-right: 10px;">
|
||||
«
|
||||
<% unless @changeset.previous.nil? -%>
|
||||
<%= link_to_revision(@changeset.previous, @repository, :text => l(:label_previous)) %>
|
||||
<% else -%>
|
||||
<%= l(:label_previous) %>
|
||||
<% end -%>
|
||||
|
|
||||
<% unless @changeset.next.nil? -%>
|
||||
<%= link_to_revision(@changeset.next, @repository, :text => l(:label_next)) %>
|
||||
<% else -%>
|
||||
<%= l(:label_next) %>
|
||||
<% end -%>
|
||||
»
|
||||
|
||||
<%= form_tag({:controller => 'repositories',
|
||||
:action => 'revision',
|
||||
:id => @project,
|
||||
:repository_id => @repository.identifier_param,
|
||||
:rev => nil},
|
||||
:method => :get) do %>
|
||||
<%= text_field_tag 'rev', @rev, :size => 8 %>
|
||||
<%= submit_tag l(:label_button_ok), :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<h3 style="padding-top:40px;"><%= avatar(@changeset.user, :size => "24") %><%= l(:label_revision) %> <%= format_revision(@changeset) %></h3>
|
||||
|
||||
<% if @changeset.scmid.present? || @changeset.parents.present? || @changeset.children.present? %>
|
||||
<table class="revision-info">
|
||||
<% if @changeset.scmid.present? %>
|
||||
<tr>
|
||||
<td>ID</td><td><%= h(@changeset.scmid) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @changeset.parents.present? %>
|
||||
<tr>
|
||||
<td><%= l(:label_parent_revision) %></td>
|
||||
<td>
|
||||
<%= @changeset.parents.collect{
|
||||
|p| link_to_revision(p, @repository, :text => format_revision(p))
|
||||
}.join(", ").html_safe %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @changeset.children.present? %>
|
||||
<tr>
|
||||
<td><%= l(:label_child_revision) %></td>
|
||||
<td>
|
||||
<%= @changeset.children.collect{
|
||||
|p| link_to_revision(p, @repository, :text => format_revision(p))
|
||||
}.join(", ").html_safe %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<span class="author">
|
||||
<%= authoring(@changeset.committed_on, @changeset.author) %>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<%= textilizable @changeset.comments %>
|
||||
|
||||
<% if @changeset.issues.visible.any? || User.current.allowed_to?(:manage_related_issues, @repository.project) %>
|
||||
<%= render :partial => 'related_issues' %>
|
||||
<% end %>
|
||||
|
||||
<% if User.current.allowed_to?(:browse_repository, @project) %>
|
||||
<h3><%= l(:label_attachment_plural) %></h3>
|
||||
<ul id="changes-legend">
|
||||
<li class="change change-A"><%= l(:label_added) %></li>
|
||||
<li class="change change-M"><%= l(:label_modified) %></li>
|
||||
<li class="change change-C"><%= l(:label_copied) %></li>
|
||||
<li class="change change-R"><%= l(:label_renamed) %></li>
|
||||
<li class="change change-D"><%= l(:label_deleted) %></li>
|
||||
</ul>
|
||||
|
||||
<p><%= link_to(l(:label_view_diff),
|
||||
:action => 'diff',
|
||||
:id => @project,
|
||||
:repository_id => @repository.identifier_param,
|
||||
:path => "",
|
||||
:rev => @changeset.identifier) if @changeset.filechanges.any? %></p>
|
||||
|
||||
<div class="changeset-changes">
|
||||
<%= render_changeset_changes %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
<% end %>
|
||||
|
||||
<% html_title("#{l(:label_revision)} #{format_revision(@changeset)}") -%>
|
||||
|
@ -1,34 +1,34 @@
|
||||
<div class="contextual">
|
||||
<%= form_tag(
|
||||
{:controller => 'repositories', :action => 'revision', :id => @project,
|
||||
:repository_id => @repository.identifier_param},
|
||||
:method => :get
|
||||
) do %>
|
||||
<%= l(:label_revision) %>: <%= text_field_tag 'rev', nil, :size => 8 %>
|
||||
<%= submit_tag l(:label_button_ok) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<h3><%= l(:label_revision_plural) %></h3>
|
||||
|
||||
<%= render :partial => 'revisions',
|
||||
:locals => {:project => @project,
|
||||
:path => '',
|
||||
:revisions => @changesets,
|
||||
:entry => nil } %>
|
||||
|
||||
<div class="pagination"><%= pagination_links_full @changeset_pages,@changeset_count %></div>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
<%= auto_discovery_link_tag(
|
||||
:atom,
|
||||
params.merge(
|
||||
{:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
|
||||
<% end %>
|
||||
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_revision_plural)) -%>
|
||||
<div class="contextual">
|
||||
<%= form_tag(
|
||||
{:controller => 'repositories', :action => 'revision', :id => @project,
|
||||
:repository_id => @repository.identifier_param},
|
||||
:method => :get
|
||||
) do %>
|
||||
<%= l(:label_revision) %>: <%= text_field_tag 'rev', nil, :size => 8 %>
|
||||
<%= submit_tag l(:label_button_ok) %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<h3><%= l(:label_revision_plural) %></h3>
|
||||
|
||||
<%= render :partial => 'revisions',
|
||||
:locals => {:project => @project,
|
||||
:path => '',
|
||||
:revisions => @changesets,
|
||||
:entry => nil } %>
|
||||
|
||||
<div class="pagination"><%= pagination_links_full @changeset_pages,@changeset_count %></div>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag "scm" %>
|
||||
<%= auto_discovery_link_tag(
|
||||
:atom,
|
||||
params.merge(
|
||||
{:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
|
||||
<% end %>
|
||||
|
||||
<% other_formats_links do |f| %>
|
||||
<%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||
<% end %>
|
||||
|
||||
<% html_title(l(:label_revision_plural)) -%>
|
||||
|
@ -1,15 +1,15 @@
|
||||
<div id="issues">
|
||||
<% if contests_results.try(:size).to_i > 0 %>
|
||||
<hr />
|
||||
<% contests_results.each do |contest| %>
|
||||
<p class="font_description2">
|
||||
<strong><%= l(:label_tags_contest) %>:<%= link_to "#{contest.name}",
|
||||
:controller => "contests",:action => "show_contest",:id => contest.id %></strong>
|
||||
<br />
|
||||
<strong><%= l(:label_tags_contest_description) %>:</strong><%= contest.description %>
|
||||
<%= contest.updated_on %>
|
||||
</p>
|
||||
<div class="line_under"></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div id="issues">
|
||||
<% if contests_results.try(:size).to_i > 0 %>
|
||||
<hr />
|
||||
<% contests_results.each do |contest| %>
|
||||
<p class="font_description2">
|
||||
<strong><%= l(:label_tags_contest) %>:<%= link_to "#{contest.name}",
|
||||
:controller => "contests",:action => "show_contest",:id => contest.id %></strong>
|
||||
<br />
|
||||
<strong><%= l(:label_tags_contest_description) %>:</strong><%= contest.description %>
|
||||
<%= contest.updated_on %>
|
||||
</p>
|
||||
<div class="line_under"></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -1,14 +1,14 @@
|
||||
|
||||
<% option_num = get_option_number(@user,1) %>
|
||||
<div><%= l(:label_user_score) %></div>
|
||||
<div> = <%= l(:label_user_score_of_collaboration) %> + <%= l(:label_user_score_of_influence) %> +
|
||||
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div>
|
||||
<!-- <div> + <%#= l(:label_user_score_of_influence) %></div> -->
|
||||
<div> = <%= format("%.2f" ,collaboration(option_num)).to_i %> + <%= format("%.2f" , influence(option_num) ).to_i %>
|
||||
+ <%= "(" if skill(option_num) < 0 %> <%= format("%.2f" , skill(option_num)).to_i %> <%= ")" if skill(option_num) < 0 %> + <%= format("%.2f" , active(option_num)).to_i %></div>
|
||||
<% if (format("%.2f" ,collaboration(option_num)).to_i + format("%.2f" , influence(option_num) ).to_i + format("%.2f" , skill(option_num)).to_i + format("%.2f" , active(option_num)).to_i) < 0 %>
|
||||
<div><%= l(:label_score_less_than_zero) %></div>
|
||||
<% else %>
|
||||
<div> = <%= format("%.2f" ,option_num.total_score).to_i %></div>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% option_num = get_option_number(@user,1) %>
|
||||
<div><%= l(:label_user_score) %></div>
|
||||
<div> = <%= l(:label_user_score_of_collaboration) %> + <%= l(:label_user_score_of_influence) %> +
|
||||
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div>
|
||||
<!-- <div> + <%#= l(:label_user_score_of_influence) %></div> -->
|
||||
<div> = <%= format("%.2f" ,collaboration(option_num)).to_i %> + <%= format("%.2f" , influence(option_num) ).to_i %>
|
||||
+ <%= "(" if skill(option_num) < 0 %> <%= format("%.2f" , skill(option_num)).to_i %> <%= ")" if skill(option_num) < 0 %> + <%= format("%.2f" , active(option_num)).to_i %></div>
|
||||
<% if (format("%.2f" ,collaboration(option_num)).to_i + format("%.2f" , influence(option_num) ).to_i + format("%.2f" , skill(option_num)).to_i + format("%.2f" , active(option_num)).to_i) < 0 %>
|
||||
<div><%= l(:label_score_less_than_zero) %></div>
|
||||
<% else %>
|
||||
<div> = <%= format("%.2f" ,option_num.total_score).to_i %></div>
|
||||
<% end %>
|
||||
|
||||
|
@ -1,336 +1,482 @@
|
||||
<% if User.current.id == @user.id %>
|
||||
<div class="menu-div">
|
||||
<div class="menu">
|
||||
<span style="color: #000; font-weight: bold;"><%= "#{@user.name}的动态" %></span>
|
||||
<ul><%#链接绑定在页面最下方的jQuery%>
|
||||
<li mode='all' class="<%= "on" if @state.eql?(0) %>"><%= l :label_user_all_activity %></li>
|
||||
<li mode='myself' class="<%= "on" if @state.eql?(1) %>"><%= l :label_user_activity_myself %></li>
|
||||
<li mode='respond' class="<%= "on" if @state.eql?(2) %>"><%= l :label_user_all_respond %></li>
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
</script>
|
||||
</div>
|
||||
<div style="height:20px"></div>
|
||||
<%= form_tag(:controller => 'users', :action => "show") do %>
|
||||
<div class="user-search-block hidden" style="float:right;margin-top:-55px">
|
||||
<table width="100%" valign="center">
|
||||
<tr>
|
||||
<td align="right">
|
||||
<div class="project-search">
|
||||
<%= text_field_tag 'user', params[:user], :size => 30 %>
|
||||
<%= submit_tag l(:label_search_by_user), :class => "small", :name => nil %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% unless @state == 2 %>
|
||||
<% unless @activity.empty? %>
|
||||
<div id="activity">
|
||||
<% @activity.each do |e| %>
|
||||
<%# 以下一行代码解决有未知的活动无法转换成Model报错%>
|
||||
<% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next;) if e.act_type.safe_constantize.nil? %>
|
||||
<% act = e.act %>
|
||||
<% unless act.nil? %>
|
||||
<% if e.act_type == 'JournalsForMessage' || e.act_type == 'Bid' || e.act_type == 'Journal'|| e.act_type == 'Changeset' || e.act_type == 'Message' || e.act_type == 'Principal' || e.act_type == 'News' || e.act_type == 'Issue' || e.act_type == 'Contest'%>
|
||||
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50"><%= image_tag(url_to_avatar(e.user), :class => "avatar") %></td>
|
||||
<td>
|
||||
<table width="580" border="0" class="info-break">
|
||||
<% case e.act_type %>
|
||||
<% when 'JournalsForMessage' %>
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_have_feedback) %>
|
||||
<%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580">
|
||||
<p class="font_description"> <%= textAreailizable act.notes %> </p>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||
<span><%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %></span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Bid' %>
|
||||
<tr>
|
||||
<% if act.reward_type == 3 && @show_course == 1%>
|
||||
<td colspan="2" valign="top">
|
||||
<strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong><span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580">
|
||||
<p class="font_description"> <%=textAreailizable act, :description %> </p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||
<span><%= link_to l(:label_find_all_comments), respond_path(e.act_id) %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.commit) %></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Journal' %>
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to(l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.id)) %> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<% if act.notes.nil? %>
|
||||
<% desStr = '' %>
|
||||
<% else %>
|
||||
<% desStr= textAreailizable(act, :notes) %>
|
||||
<% end %>
|
||||
<td colspan="2" width="580"><p class="font_description"> <%= desStr %> </p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Changeset' %>
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580">
|
||||
<p class="font_description"> <%= textAreailizable act,:long_comments %> </p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= format_time(e.act.committed_on) %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||
<span><%= link_to l(:label_find_all_comments), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.count) %></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Message' %>
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{act.board.name}: #{act.subject}"), {:controller => 'messages', :action => 'show', :board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580">
|
||||
<p class="font_description"> <%= textAreailizable(act,:content) %> </p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Principal' %>
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_user) %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580"><p class="font_description"></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'News' %>
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580">
|
||||
<p class="font_description"> <%= textAreailizable act,:description %> </p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||
<span><%= link_to l(:label_find_all_comments), {:controller => 'news', :action => 'show', :id => act.id} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.comments_count) %></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Issue' %>
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<strong>
|
||||
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
|
||||
</strong>
|
||||
<span class="font_lighter">
|
||||
<%= l(:label_i_new_activity) %>
|
||||
</span>
|
||||
<%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580" style="WORD-BREAK: break-all; WORD-WRAP: break-word">
|
||||
<%= textAreailizable act, :description %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||
<span><%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} %></span><a class="font_lighter"><%= l(:label_comments_count, :count => e.act.journals.count) %></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Contest' %>
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580"><p class="font_description"> <%= textAreailizable act, :description %> </p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
</tr>
|
||||
<% else %>
|
||||
<%# f=1 %>
|
||||
<% end %><!-- < % #case end %> -->
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<% end %>
|
||||
<% end %><!-- < % #unless act.nil? end %> -->
|
||||
|
||||
<% end %><!-- < % #@activity.each do |e| end%> -->
|
||||
</div>
|
||||
<div class="pagination" style="float:left;">
|
||||
<ul> <%= pagination_links_full @activity_pages %> </ul>
|
||||
</div>
|
||||
<% else %> <!-- < %# unless @activity.empty? %> -->
|
||||
<% if @user == User.current %>
|
||||
<%= l(:label_user_activities) %>
|
||||
<% else %>
|
||||
<p class="font_description">
|
||||
<%= l(:label_user_activities_other) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %><!-- < %# unless @activity.empty? end %> -->
|
||||
|
||||
<% else %>
|
||||
<% unless @message.empty? %>
|
||||
<div id="activity">
|
||||
<% @message.each do |e| -%>
|
||||
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50"><%= image_tag(url_to_avatar(e.user), :class => "avatar") %></td>
|
||||
<td>
|
||||
<table width="580" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<strong> <%= link_to(h(e.user), user_path(e.user)) %></strong><span class="font_lighter">
|
||||
<% if e.instance_of?(JournalsForMessage) %>
|
||||
<% if e.reply_id == User.current.id %>
|
||||
<% if e.jour_type == 'Bid' %>
|
||||
<%= l(:label_in_bids) %><%= link_to(e.jour.name, respond_path(e.jour)) %> <%= l(:label_quote_my_words) %>
|
||||
<% elsif e.jour_type == 'User' %>
|
||||
<%= l(:label_in_users) %><%= link_to(e.jour.firstname, feedback_path(e.jour)) %> <%= l(:label_quote_my_words) %>
|
||||
<% elsif e.jour_type == 'Project' %>
|
||||
<%= '在'<<l(:field_project) %><%= link_to(e.jour.name, feedback_path(e.jour)) %> <%= l(:label_reply_plural) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= l(:label_about_requirement) %><%= link_to(e.jour.name, respond_path(e.jour_id)) %> <%= l(:label_have_respond) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if e.journal_reply.nil? || e.journal_reply.reply_id != User.current.id %>
|
||||
<%= l(:label_about_issue) %><%= link_to(e.issue.subject, issue_path(e.journalized_id)) %><%= l(:label_have_respond) %>
|
||||
|
||||
<% else %>
|
||||
<%= l(:label_in_issues) %><%= link_to(e.issue.subject, issue_path(e.issue)) %><%= l(:label_quote_my_words) %>
|
||||
<% end %>
|
||||
<% end %> </span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580"><p class="font_description"> <%= textAreailizable e.notes %> </p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left"><a class="font_lighter"></a></td>
|
||||
<td width="200" align="right" class="a">
|
||||
<span class="font_lighter"><%= format_time e.created_on %></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="pagination" style="float:left;">
|
||||
<ul> <%= pagination_links_full @info_pages %> </ul>
|
||||
</div>
|
||||
|
||||
<% else %>
|
||||
<p class="font_description"><%= l(:label_no_user_respond_you) %></p>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% end %>
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function ($) {
|
||||
$("#content .menu-div:first~ div").first().find("a").attr("target", "_blank");
|
||||
$('[mode=all]').click(function (event) {
|
||||
window.location.href = '<%=user_url(@user)%>';
|
||||
});
|
||||
$('[mode=myself]').click(function (event) {
|
||||
window.location.href = '<%=user_url(@user, type: 1)%>';
|
||||
});
|
||||
$('[mode=respond]').click(function (event) {
|
||||
window.location.href = '<%=user_url(@user, type: 2)%>';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% if User.current.id == @user.id %>
|
||||
<div class="menu-div">
|
||||
<div class="menu">
|
||||
<span style="color: #000; font-weight: bold;"><%= "#{@user.name}的动态" %></span>
|
||||
<ul><%#链接绑定在页面最下方的jQuery%>
|
||||
<li mode='all' class="<%= "on" if @state.eql?(0) %>"><%= l :label_user_all_activity %></li>
|
||||
<li mode='myself' class="<%= "on" if @state.eql?(1) %>"><%= l :label_user_activity_myself %></li>
|
||||
<li mode='respond' class="<%= "on" if @state.eql?(2) %>"><%= l :label_user_all_respond %></li>
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
</div>
|
||||
<div style="height:20px"></div>
|
||||
<%= form_tag(:controller => 'users', :action => "show") do %>
|
||||
<div class="user-search-block hidden" style="float:right;margin-top:-55px">
|
||||
<table width="100%" valign="center">
|
||||
<tr>
|
||||
<td align="right">
|
||||
<div class="project-search">
|
||||
<%= text_field_tag 'user', params[:user], :size => 30 %>
|
||||
<%= submit_tag l(:label_search_by_user), :class => "small", :name => nil %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% unless @state == 2 %>
|
||||
<% unless @activity.empty? %>
|
||||
<div id="activity">
|
||||
<% @activity.each do |e| %>
|
||||
<%# 以下一行代码解决有未知的活动无法转换成Model报错%>
|
||||
<% (Rails.logger.error "[Error] =========================================================> NameError: uninitialized constant " + e.act_type.to_s; next;) if e.act_type.safe_constantize.nil? %>
|
||||
<% act = e.act %>
|
||||
<% unless act.nil? %>
|
||||
<% if e.act_type == 'JournalsForMessage' || e.act_type == 'Bid' || e.act_type == 'Journal'|| e.act_type == 'Changeset' || e.act_type == 'Message' || e.act_type == 'Principal' || e.act_type == 'News' || e.act_type == 'Issue' || e.act_type == 'Contest'%>
|
||||
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;font-size:14px;">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50"><%= image_tag(url_to_avatar(e.user), :class => "avatar") %></td>
|
||||
<td>
|
||||
<table width="580" border="0" class="info-break">
|
||||
<% case e.act_type %>
|
||||
<% when 'JournalsForMessage' %>
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<% if User.current.login == e.user.try(:login) %>
|
||||
<strong>
|
||||
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
|
||||
</strong>
|
||||
|
||||
<% else %>
|
||||
<strong><%= link_to("#{e.user.name}", user_path(e.user_id)) %></strong>
|
||||
<% end %>
|
||||
<span class="font_lighter">
|
||||
<%= l(:label_have_feedback) %>
|
||||
<%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580">
|
||||
<p class="font_description"> <%= textAreailizable act.notes %> </p>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||
<span>
|
||||
<%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Bid' %>
|
||||
<tr>
|
||||
<% if act.reward_type == 3 && @show_course == 1%>
|
||||
<% if e.user == User.current %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong>
|
||||
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
|
||||
</strong>
|
||||
<span class="font_lighter">
|
||||
<%= l(:label_i_new_activity) %>
|
||||
</span>
|
||||
<%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong>
|
||||
<%= link_to(h(e.user), user_path(e.user_id)) %>
|
||||
</strong>
|
||||
<span class="font_lighter">
|
||||
<%= l(:label_new_activity) %>
|
||||
</span>
|
||||
<%= link_to format_activity_title("#{l(:label_active_homework)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if e.user == User.current %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong> <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_i_new_activity) %></span>
|
||||
<%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_new_activity) %></span>
|
||||
<%= link_to format_activity_title("#{l(:label_active_call)}##{act.id}:#{act.name}"), respond_path(e.act_id) %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580">
|
||||
<p class="font_description"> <%=textAreailizable act, :description %> </p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||
<span><%= link_to l(:label_find_all_comments), respond_path(e.act_id) %></span>
|
||||
<a class="font_lighter"><%= l(:label_comments_count, :count => e.act.commit) %></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Journal' %>
|
||||
<tr>
|
||||
<% if e.user == User.current %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_i_new_activity) %></span>
|
||||
<%= link_to(l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.id)) %>
|
||||
<%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"),
|
||||
{:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_new_activity) %></span>
|
||||
<%= link_to(l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.identifier)) %>
|
||||
<%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"),
|
||||
{:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<% if act.notes.nil? %>
|
||||
<% desStr = '' %>
|
||||
<% else %>
|
||||
<% desStr= textAreailizable(act, :notes) %>
|
||||
<% end %>
|
||||
<td colspan="2" width="580"><p class="font_description"> <%= desStr %> </p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Changeset' %>
|
||||
<tr>
|
||||
<% if e.user == User.current %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_i_new_activity) %></span>
|
||||
<%= link_to format_activity_title(act.title),
|
||||
{:controller => 'repositories',
|
||||
:action => 'revision',
|
||||
:id => act.repository.project,
|
||||
:repository_id => act.repository.identifier_param,
|
||||
:rev => act.identifier} %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_new_activity) %></span>
|
||||
<%= link_to format_activity_title(act.title),
|
||||
{:controller => 'repositories',
|
||||
:action => 'revision',
|
||||
:id => act.repository.project,
|
||||
:repository_id => act.repository.identifier_param,
|
||||
:rev => act.identifier} %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580">
|
||||
<p class="font_description"> <%= textAreailizable act,:long_comments %> </p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= format_time(e.act.committed_on) %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||
<span><%= link_to l(:label_find_all_comments),
|
||||
{:controller => 'repositories',
|
||||
:action => 'revision',
|
||||
:id => act.repository.project,
|
||||
:repository_id => act.repository.identifier_param,
|
||||
:rev => act.identifier} %>
|
||||
</span>
|
||||
<a class="font_lighter"><%= l(:label_comments_count, :count => e.act.count) %></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Message' %>
|
||||
<tr>
|
||||
<% if e.user == User.current %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_i_new_activity) %></span>
|
||||
<%= link_to format_activity_title("#{act.board.name}: #{act.subject}"),
|
||||
{:controller => 'messages',
|
||||
:action => 'show',
|
||||
:board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_new_activity) %></span>
|
||||
<%= link_to format_activity_title("#{act.board.name}: #{act.subject}"),
|
||||
{:controller => 'messages',
|
||||
:action => 'show',
|
||||
:board_id => act.board_id}.merge(act.parent_id.nil? ? {:id => act.id} : {:id => act.parent_id, :r => act.id, :anchor => "message-#{act.id}"}) %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580">
|
||||
<p class="font_description"> <%= textAreailizable(act,:content) %> </p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Principal' %>
|
||||
<tr>
|
||||
<% if e.user == User.current %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_new_user) %></span>
|
||||
</td>
|
||||
<% else %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_new_user) %></span>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580"><p class="font_description"></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px"></div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'News' %>
|
||||
<tr>
|
||||
<% if e.user == User.current %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_i_new_activity) %></span>
|
||||
<%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_new_activity) %></span>
|
||||
<%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580">
|
||||
<p class="font_description"> <%= textAreailizable act,:description %> </p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||
<span>
|
||||
<%= link_to l(:label_find_all_comments), {:controller => 'news', :action => 'show', :id => act.id} %>
|
||||
</span>
|
||||
<a class="font_lighter">
|
||||
<%= l(:label_comments_count, :count => e.act.comments_count) %>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Issue' %>
|
||||
<tr>
|
||||
<% if e.user == User.current %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong>
|
||||
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
|
||||
</strong>
|
||||
<span class="font_lighter">
|
||||
<%= l(:label_i_new_activity) %>
|
||||
</span>
|
||||
<%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"),
|
||||
{:controller => 'issues',
|
||||
:action => 'show',
|
||||
:id => act.id} %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong>
|
||||
<%= link_to(h(e.user), user_path(e.user_id)) %>
|
||||
</strong>
|
||||
<span class="font_lighter">
|
||||
<%= l(:label_new_activity) %>
|
||||
</span>
|
||||
<%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"),
|
||||
{:controller => 'issues',
|
||||
:action => 'show',
|
||||
:id => act.id} %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580" style="WORD-BREAK: break-all; WORD-WRAP: break-word">
|
||||
<%= textAreailizable act, :description %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
<div style="display: inline-block; float: right; margin-top: 0px">
|
||||
<span><%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} %></span>
|
||||
<a class="font_lighter"><%= l(:label_comments_count, :count => e.act.journals.count) %></a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% when 'Contest' %>
|
||||
<tr>
|
||||
<% if e.user == User.current && @show_contest == 1%>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_i_new_activity) %></span>
|
||||
<%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>
|
||||
<span class="font_lighter"><%= l(:label_new_activity) %></span>
|
||||
<%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580"><p class="font_description"> <%= textAreailizable act, :description %> </p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
<span class="font_lighter"> <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %></span>
|
||||
</div>
|
||||
</tr>
|
||||
<% else %>
|
||||
<% end %><!-- < % #case end %> -->
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
<% end %><!-- < % #unless act.nil? end %> -->
|
||||
<% end %><!-- < % #@activity.each do |e| end%> -->
|
||||
</div>
|
||||
<div class="pagination" style="float:left;">
|
||||
<ul> <%= pagination_links_full @activity_pages %> </ul>
|
||||
</div>
|
||||
<% else %> <!-- < %# unless @activity.empty? %> -->
|
||||
<% if @user == User.current %>
|
||||
<%= l(:label_user_activities) %>
|
||||
<% else %>
|
||||
<p class="font_description">
|
||||
<%= l(:label_user_activities_other) %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %><!-- < %# unless @activity.empty? end %> -->
|
||||
|
||||
<% else %>
|
||||
<% unless @message.empty? %>
|
||||
<div id="activity">
|
||||
<% @message.each do |e| -%>
|
||||
<table width="660" border="0" align="left" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px;">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="50"><%= image_tag(url_to_avatar(e.user), :class => "avatar") %></td>
|
||||
<td>
|
||||
<table width="580" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top">
|
||||
<strong> <%= link_to(h(e.user), user_path(e.user)) %></strong><span class="font_lighter">
|
||||
<% if e.instance_of?(JournalsForMessage) %>
|
||||
<% if e.reply_id == User.current.id %>
|
||||
<% if e.jour_type == 'Bid' %>
|
||||
<%= l(:label_in_bids) %><%= link_to(e.jour.name, respond_path(e.jour)) %> <%= l(:label_quote_my_words) %>
|
||||
<% elsif e.jour_type == 'User' %>
|
||||
<%= l(:label_in_users) %><%= link_to(e.jour.firstname, feedback_path(e.jour)) %> <%= l(:label_quote_my_words) %>
|
||||
<% elsif e.jour_type == 'Project' %>
|
||||
<%= '在'<<l(:field_project) %><%= link_to(e.jour.name, feedback_path(e.jour)) %> <%= l(:label_reply_plural) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= l(:label_about_requirement) %><%= link_to(e.jour.name, respond_path(e.jour_id)) %> <%= l(:label_have_respond) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if e.journal_reply.nil? || e.journal_reply.reply_id != User.current.id %>
|
||||
<%= l(:label_about_issue) %><%= link_to(e.issue.subject, issue_path(e.journalized_id)) %><%= l(:label_have_respond) %>
|
||||
|
||||
<% else %>
|
||||
<%= l(:label_in_issues) %><%= link_to(e.issue.subject, issue_path(e.issue)) %><%= l(:label_quote_my_words) %>
|
||||
<% end %>
|
||||
<% end %> </span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580"><p class="font_description"> <%= textAreailizable e.notes %> </p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left"><a class="font_lighter"></a></td>
|
||||
<td width="200" align="right" class="a">
|
||||
<span class="font_lighter"><%= format_time e.created_on %></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="pagination" style="float:left;">
|
||||
<ul> <%= pagination_links_full @info_pages %> </ul>
|
||||
</div>
|
||||
|
||||
<% else %>
|
||||
<p class="font_description"><%= l(:label_no_user_respond_you) %></p>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% end %>
|
||||
<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function ($) {
|
||||
$("#content .menu-div:first~ div").first().find("a").attr("target", "_blank");
|
||||
$('[mode=all]').click(function (event) {
|
||||
window.location.href = '<%=user_url(@user)%>';
|
||||
});
|
||||
$('[mode=myself]').click(function (event) {
|
||||
window.location.href = '<%=user_url(@user, type: 1)%>';
|
||||
});
|
||||
$('[mode=respond]').click(function (event) {
|
||||
window.location.href = '<%=user_url(@user, type: 2)%>';
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -1,32 +1,32 @@
|
||||
<% course_list.map do |course| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>>
|
||||
<div class='avatar'>
|
||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||
</div>
|
||||
<!-- 上左下右 -->
|
||||
<div class='desc_item'>
|
||||
<span class=''>
|
||||
<% unless course.is_public == 1 %>
|
||||
<span class="private_project"><%= l(:label_private) %></span>
|
||||
<% end %>
|
||||
<%= link_to(course.name.truncate(30, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||
|
||||
</span>
|
||||
<span class='font_bolder'>
|
||||
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
|
||||
<%#=course.try(:teacher).try(:name)%>
|
||||
</span>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap'>
|
||||
[<%= get_course_term course %>]
|
||||
<% if (course.school == nil) %>
|
||||
|
||||
<% else %>
|
||||
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
|
||||
<% end %>
|
||||
(<%= course.members.count %>人)
|
||||
<%# files_count = course.attachments.count.to_s %>
|
||||
(<%= link_to "#{course.attachments.count.to_s}份", course_files_path(course) %>资料)
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% course_list.map do |course| %>
|
||||
<li class='<%= cycle("odd", "even") %>' title=<%= course.description.to_s.gsub(/<\/?.*?>/,"") %>>
|
||||
<div class='avatar'>
|
||||
<%= image_tag(get_course_avatar(course), :class => "avatar-4") %>
|
||||
</div>
|
||||
<!-- 上左下右 -->
|
||||
<div class='desc_item'>
|
||||
<span class=''>
|
||||
<% unless course.is_public == 1 %>
|
||||
<span class="private_project"><%= l(:label_private) %></span>
|
||||
<% end %>
|
||||
<%= link_to(course.name.truncate(30, omission: '...')+":", course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||
|
||||
</span>
|
||||
<span class='font_bolder'>
|
||||
<%= link_to(course.try(:teacher).try(:realname), user_path(course.teacher)) %>
|
||||
<%#=course.try(:teacher).try(:name)%>
|
||||
</span>
|
||||
</div>
|
||||
<div class='desc_item text_nowrap'>
|
||||
[<%= get_course_term course %>]
|
||||
<% if (course.school == nil) %>
|
||||
|
||||
<% else %>
|
||||
<%= link_to course.school.name.try(:gsub, /(.+)$/, '\1'), options={:action => 'course', :school_id => course.school.id}, html_options={:method => 'get'} %>
|
||||
<% end %>
|
||||
(<%= course.members.count %>人)
|
||||
<%# files_count = course.attachments.count.to_s %>
|
||||
(<%= link_to "#{course.attachments.count.to_s}份", course_files_path(course) %>资料)
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
|
@ -1,8 +1,8 @@
|
||||
<% if User.current.logged?%>
|
||||
<% if User.current.user_extensions.identity == 0 %>
|
||||
<%= link_to(l(:label_course_new), {:controller => 'courses', :action => 'new'},
|
||||
:class => 'icon icon-add') if User.current.allowed_to?(:add_course,nil, :global => true) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => school_id} %>
|
||||
<% if User.current.logged?%>
|
||||
<% if User.current.user_extensions.identity == 0 %>
|
||||
<%= link_to(l(:label_course_new), {:controller => 'courses', :action => 'new'},
|
||||
:class => 'icon icon-add') if User.current.allowed_to?(:add_course,nil, :global => true) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= link_to l(:label_more), {:controller => 'courses', :action => 'index', :school_id => school_id} %>
|
@ -0,0 +1,4 @@
|
||||
<div id="identifier-pannel" style="display:none">
|
||||
<%= image_tag '/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" %>
|
||||
<div class="weixin-content">微信扫码</div>
|
||||
</div>
|
@ -1,52 +0,0 @@
|
||||
# Default setup is given for MySQL with ruby1.9. If you're running Redmine
|
||||
# with MySQL and ruby1.8, replace the adapter name with `mysql`.
|
||||
# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
|
||||
# Line indentation must be 2 spaces (no tabs).
|
||||
|
||||
production:
|
||||
adapter: mysql2
|
||||
database: redmine
|
||||
host: localhost
|
||||
username: root
|
||||
password: ""
|
||||
encoding: utf8
|
||||
|
||||
development:
|
||||
adapter: mysql2
|
||||
database: redmine_development
|
||||
host: 10.107.17.20
|
||||
username: root
|
||||
password: "1234"
|
||||
encoding: utf8
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
# Do not set this db to the same as development or production.
|
||||
test:
|
||||
adapter: mysql2
|
||||
database: redmine_test
|
||||
host: 10.107.17.20
|
||||
username: root
|
||||
password: "1234"
|
||||
encoding: utf8
|
||||
|
||||
# PostgreSQL configuration example
|
||||
#production:
|
||||
# adapter: postgresql
|
||||
# database: redmine
|
||||
# host: localhost
|
||||
# username: postgres
|
||||
# password: "postgres"
|
||||
|
||||
# SQLite3 configuration example
|
||||
#production:
|
||||
# adapter: sqlite3
|
||||
# database: db/redmine.sqlite3
|
||||
|
||||
# SQL Server configuration example
|
||||
#production:
|
||||
# adapter: sqlserver
|
||||
# database: redmine
|
||||
# host: localhost
|
||||
# username: jenkins
|
||||
# password: jenkins
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,26 @@
|
||||
# -*coding:utf-8 -*-
|
||||
class UpdateWorksCategories < ActiveRecord::Migration
|
||||
def up
|
||||
WorksCategory.all.each do |wc|
|
||||
wc.destroy
|
||||
end
|
||||
|
||||
workscategory1 = WorksCategory.new
|
||||
workscategory1.category = "开源软件"
|
||||
workscategory1.save
|
||||
|
||||
workscategory2 = WorksCategory.new
|
||||
workscategory2.category = "移动APP"
|
||||
workscategory2.save
|
||||
|
||||
workscategory3 = WorksCategory.new
|
||||
workscategory3.category = "其他"
|
||||
workscategory3.save
|
||||
end
|
||||
|
||||
def down
|
||||
WorksCategory.all.each do |wc|
|
||||
wc.destroy
|
||||
end
|
||||
end
|
||||
end
|
@ -1,42 +1,42 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>File not found</title>
|
||||
<style>
|
||||
body{
|
||||
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
|
||||
color:#303030;
|
||||
}
|
||||
div.container{
|
||||
margin: 0 auto;
|
||||
width: 80%;
|
||||
}
|
||||
h1{
|
||||
font-size:1.5em;
|
||||
}
|
||||
p{
|
||||
font-size:0.8em;
|
||||
}
|
||||
.hidden{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" >
|
||||
<!--<h1>Sorry, this file can not be downloaded now. </h1>-->
|
||||
<h1><%= l(:label_file_not_found) %></h1>
|
||||
<h3> <%= link_to l(:label_goto_homepage),{:controller=>'welcome',:action=>'index',:host=>Setting.host_name} %> </h3>
|
||||
|
||||
<div class="container" style="">
|
||||
<div style="position: relative; right:0;text-align: right;">
|
||||
<h4><%= l(:label_trustie_team) %></h4>
|
||||
</div>
|
||||
</div>
|
||||
<p class="hidden" >
|
||||
<a href="javascript:history.back()">Back</a>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>File not found</title>
|
||||
<style>
|
||||
body{
|
||||
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
|
||||
color:#303030;
|
||||
}
|
||||
div.container{
|
||||
margin: 0 auto;
|
||||
width: 80%;
|
||||
}
|
||||
h1{
|
||||
font-size:1.5em;
|
||||
}
|
||||
p{
|
||||
font-size:0.8em;
|
||||
}
|
||||
.hidden{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" >
|
||||
<!--<h1>Sorry, this file can not be downloaded now. </h1>-->
|
||||
<h1><%= l(:label_file_not_found) %></h1>
|
||||
<h3> <%= link_to l(:label_goto_homepage),{:controller=>'welcome',:action=>'index',:host=>Setting.host_name} %> </h3>
|
||||
|
||||
<div class="container" style="">
|
||||
<div style="position: relative; right:0;text-align: right;">
|
||||
<h4><%= l(:label_trustie_team) %></h4>
|
||||
</div>
|
||||
</div>
|
||||
<p class="hidden" >
|
||||
<a href="javascript:history.back()">Back</a>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,42 +1,42 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>File not found</title>
|
||||
<style>
|
||||
body{
|
||||
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
|
||||
color:#303030;
|
||||
}
|
||||
div.container{
|
||||
margin: 0 auto;
|
||||
width: 80%;
|
||||
}
|
||||
h1{
|
||||
font-size:1.5em;
|
||||
}
|
||||
p{
|
||||
font-size:0.8em;
|
||||
}
|
||||
.hidden{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" >
|
||||
<!--<h1>Sorry, this file can not be downloaded now. </h1>-->
|
||||
<h1>该作业没有任何的附件可以下载</h1>
|
||||
<h3> <a href="http://forge.trustie.net" style="">返回主页</a> </h3>
|
||||
|
||||
<div class="container" style="">
|
||||
<div style="position: relative; right:0;text-align: right;">
|
||||
<h4>Trustie开发团队.</h4>
|
||||
</div>
|
||||
</div>
|
||||
<p class="hidden" >
|
||||
<a href="javascript:history.back()">Back</a>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>File not found</title>
|
||||
<style>
|
||||
body{
|
||||
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
|
||||
color:#303030;
|
||||
}
|
||||
div.container{
|
||||
margin: 0 auto;
|
||||
width: 80%;
|
||||
}
|
||||
h1{
|
||||
font-size:1.5em;
|
||||
}
|
||||
p{
|
||||
font-size:0.8em;
|
||||
}
|
||||
.hidden{
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container" >
|
||||
<!--<h1>Sorry, this file can not be downloaded now. </h1>-->
|
||||
<h1>该作业没有任何的附件可以下载</h1>
|
||||
<h3> <a href="http://forge.trustie.net" style="">返回主页</a> </h3>
|
||||
|
||||
<div class="container" style="">
|
||||
<div style="position: relative; right:0;text-align: right;">
|
||||
<h4>Trustie开发团队.</h4>
|
||||
</div>
|
||||
</div>
|
||||
<p class="hidden" >
|
||||
<a href="javascript:history.back()">Back</a>
|
||||
</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue