Conflicts:
	app/views/welcome/index.html.erb
This commit is contained in:
linhk 2014-09-16 08:59:26 +08:00
commit 3ef05e64b8
83 changed files with 13978 additions and 13529 deletions

View File

@ -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/
end
def renderTag
@attachmentNew = Attachment.find(params[:attchmentId])
respond_to do |format|
format.js
end
end
end

View File

@ -2,33 +2,44 @@
# class BidsController < ApplicationController
class ContestsController < ApplicationController
layout "contest_base"
menu_item :respond
menu_item :project, :only => :show_project
menu_item :application, :only => :show_softapplication
menu_item :attendingcontests, :only => :show_attendingcontest
menu_item :contestnotifications, :only => :index
before_filter :can_show_contest,except: []
before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :index, :set_reward_project, :set_reward_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward,
:show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
before_filter :can_show_contest, :except => [] # modified by alan
# modified by longjun
before_filter :find_contest, :only => [
:show_contest, :show_project, :show_softapplication,
:show_attendingcontest, :index, :set_reward_project,
:set_reward_softapplication, :create, :destroy, :more,
:back, :add, :add_softapplication, :new,:show_results,
:set_reward, :show_contest_project, :show_contest_user,
:join_in_contest, :unjoin_in_contest, :new_join, :show_participator, :settings
]
# end longjun
# added by fq
before_filter :require_login, :only => [:join_in_contest, :unjoin_in_contest]
# end
before_filter :require_login,:only => [:set_reward, :destroy, :add, :new, ]
before_filter :require_login,:only => [:set_reward, :destroy, :add, :new ]
helper :watchers
helper :attachments
include AttachmentsHelper
include ApplicationHelper
helper :projects
helper :words
include AttachmentsHelper
include ApplicationHelper
def index
# @contests = Contest.visible
# @contests ||= []
@offset, @limit = api_offset_and_limit({:limit => 10})
@offset, @limit = api_offset_and_limit(:limit => 10)
#@contests = Contest.visible
#@contests = @contests.like(params[:name]) if params[:name].present?
@contests = Contest.visible.where("name like '%#{params[:name]}%'")
@ -41,43 +52,55 @@ class ContestsController < ApplicationController
@offset ||= @contest_pages.reverse_offset
if params[:contest_sort_type].present?
case params[:contest_sort_type]
when '0'
unless @offset == 0
@contests = @contests.reorder('contests.commit').offset(@offset).limit(@limit).all.reverse
else
limit = @contest_count % @limit
limit = @limit if limit == 0
@contests = @contests.reorder('contests.commit').offset(@offset).limit(limit).all.reverse
end
@s_state = 0
when '1'
unless @offset == 0
@contests = @contests.reorder('contests.created_on').offset(@offset).limit(@limit).all.reverse
else
limit = @contest_count % @limit
limit = @limit if limit == 0
@contests = @contests.reorder('contests.created_on').offset(@offset).limit(limit).all.reverse
end
@s_state = 1
when '2'
unless @offset == 0
@contests = @contests.offset(@offset).limit(@limit).all.reverse
else
limit = @contest_count % @limit
limit = @limit if limit == 0
@contests = @contests.offset(@offset).limit(@limit).all.reverse
end
@s_state = 0
end
when '0'
# modified by longjun
# never use unless and else
# unless @offset == 0
if @offset != 0
@contests = @contests.reorder('contests.commit').offset(@offset).limit(@limit).all.reverse
else
unless @offset == 0
@contests = @contests.reorder('contests.created_on').offset(@offset).limit(@limit).all.reverse
else
limit = @contest_count % @limit
limit = @limit if limit == 0
@contests = @contests.reorder('contests.created_on').offset(@offset).limit(limit).all.reverse
end
@s_state = 1
limit = @contest_count % @limit
limit = @limit if limit == 0
@contests = @contests.reorder('contests.commit').offset(@offset).limit(limit).all.reverse
end
@s_state = 0
when '1'
# modified by longjun
# never use unless and else
# unless @offset == 0
if @offset != 0
@contests = @contests.reorder('contests.created_on').offset(@offset).limit(@limit).all.reverse
else
limit = @contest_count % @limit
limit = @limit if limit == 0
@contests = @contests.reorder('contests.created_on').offset(@offset).limit(limit).all.reverse
end
@s_state = 1
when '2'
# modified by longjun
# never use unless and else
# unless @offset == 0
if @offset != 0
@contests = @contests.offset(@offset).limit(@limit).all.reverse
else
limit = @contest_count % @limit
limit = @limit if limit == 0
@contests = @contests.offset(@offset).limit(@limit).all.reverse
end
@s_state = 0
end
else
# modified by longjun
# never use unless and else
# unless @offset == 0
if @offset != 0
@contests = @contests.reorder('contests.created_on').offset(@offset).limit(@limit).all.reverse
else
limit = @contest_count % @limit
limit = @limit if limit == 0
@contests = @contests.reorder('contests.created_on').offset(@offset).limit(limit).all.reverse
end
@s_state = 1
end
end
@ -93,7 +116,10 @@ class ContestsController < ApplicationController
@bid_pages = Paginator.new @bid_count, @limit, params['page']
@offset ||= @bid_pages.reverse_offset
unless @offset == 0
# modified by longjun
# never use unless and else
# unless @offset == 0
if @offset != 0
@bids = @bids.offset(@offset).limit(@limit).all.reverse
else
limit = @bid_count % @limit
@ -149,10 +175,7 @@ class ContestsController < ApplicationController
end
end
def new_join
end
def show_participator
render :layout => 'base_newcontest'
@ -186,26 +209,43 @@ class ContestsController < ApplicationController
def show_contest_project
contests = Contest.where('parent_id = ?', @contest.id)
@projects = []
for contest in contests
@projects += contest.contesting_projects
end
# Modified by longjun
# 用 arr.each 替换 for [ according to the style guide ]
# for contest in contests
# @projects += contest.contesting_projects
# end
contests.each do |contest|
@projects += contest.contesting_projects
end
# end
respond_to do |format|
format.html {
render :layout => 'base_newcontest'
}
format.api
end
end
def show_contest_softapplication
contests = Contest.where('parent_id = ?', @contest.id)
@softapplications = []
for contest in contests
@softapplications += contest.contesting_softapplications
end
# Modified by Longjun
# for contest in contests
# @softapplications += contest.contesting_softapplications
contests.each do |contest|
@softapplications += contest.contesting_softapplications
end
# end
respond_to do |format|
format.html {
render :layout => 'base_newcontest'
@ -218,12 +258,21 @@ class ContestsController < ApplicationController
def show_contest_user
contests = Contest.find(:all)
@users = []
for contest in contests
for project in contest.projects
@users += project.users
end
# Modified by Longjun
# for contest in contests
# for project in contest.projects
# @users += project.users
# end
contests.each do |contest|
contest.projects.each do |project|
@uers += project.users
end
end
# end
respond_to do |format|
format.html {
render :layout => 'base_newcontest'
@ -239,11 +288,20 @@ class ContestsController < ApplicationController
# @contesting_project_count = @contesting_project_all.count
# @contesting_project_pages = Paginator.new @contesting_project_count, per_page_option, params['page']
@membership.each do |membership|
unless(membership.project.project_type==1)
if User.current.allowed_to?(:quote_project, membership.project)
# Modified by Longjun
# 将两个判断语句合并
# unless membership.project.project_type==1
# if User.current.allowed_to?(:quote_project, membership.project)
# @option << membership.project
# end
# end
if membership.project.project_type != 1 && User.current.allowed_to?(:quote_project, membership.project)
@option << membership.project
end
end
# end
end
@user = @contest.author
@contesting_project = @contest.contesting_projects.all
@ -262,16 +320,19 @@ class ContestsController < ApplicationController
@temp = []
@contesting_project.each do |pro|
if pro.project && pro.project.project_status
@temp << pro
end
# modified by longjun
# if pro.project && pro.project.project_status
# @temp << pro
# end
@temp << pro if pro.project && pro.project.project_status
# end longjun
@temp
end
if @temp.size > 0
@contesting_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade}
end
end
@contesting_project = paginateHelper @contesting_project
@contesting_project = paginateHelper(@contesting_project)
respond_to do |format|
format.html {
render :layout => 'base_newcontest'
@ -290,7 +351,7 @@ class ContestsController < ApplicationController
@softapplication = Softapplication.all
@contesting_softapplication = @contest.contesting_softapplications
@contesting_softapplication = paginateHelper @contesting_softapplication, 10
@contesting_softapplication = paginateHelper(@contesting_softapplication, 10)
# @temp = []
# @softapplicationt.each do |pro|
@ -328,7 +389,7 @@ class ContestsController < ApplicationController
# @contesting_project_count = @contesting_project_all.count
# @contesting_project_pages = Paginator.new @contesting_project_count, per_page_option, params['page']
@membership.each do |membership|
unless(membership.project.project_type==1)
unless membership.project.project_type==1
#拥有编辑项目权限的可将该项目参赛
if User.current.allowed_to?(:quote_project, membership.project)
@option << membership.project
@ -352,27 +413,31 @@ class ContestsController < ApplicationController
@temp = []
@contesting_project.each do |pro|
if pro.project && pro.project.project_status
@temp << pro
end
# modified by longjun
# if pro.project && pro.project.project_status
# @temp << pro
# end
@temp << pro if pro.project && pro.project.project_status
# end longjun
@temp
end
if @temp.size > 0
@contesting_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade}
end
end
##取出参赛应用 --应用列表
# 取出参赛应用 --应用列表
@softapplication = Softapplication.all
@contesting_softapplication = @contest.contesting_softapplications.
joins("LEFT JOIN softapplications ON contesting_softapplications.softapplication_id=softapplications.id").
joins("LEFT JOIN (
SELECT * FROM seems_rateable_cached_ratings WHERE cacheable_type='Softapplication' AND DIMENSION = 'quality') AS cached
ON cached.cacheable_id=softapplications.id").
SELECT * FROM seems_rateable_cached_ratings
WHERE cacheable_type='Softapplication' AND DIMENSION = 'quality') AS cached
ON cached.cacheable_id=softapplications.id").
order("cached.avg").reverse_order
@contesting_softapplication = paginateHelper @contesting_softapplication, 10
##引用base_newcontest整体样式
#引用base_newcontest整体样式
@contest = Contest.find_by_id(params[:id])
respond_to do |format|
format.html {
@ -384,15 +449,15 @@ class ContestsController < ApplicationController
###end
def show_notification
@contest = Contest.find_by_id(params[:id])
respond_to do |format|
format.html {
render :layout => 'base_newcontest'
}
format.api
end
end
def show_notification
@contest = Contest.find_by_id(params[:id])
respond_to do |format|
format.html {
render :layout => 'base_newcontest'
}
format.api
end
end
def set_reward_project
@ -437,7 +502,11 @@ end
project = Project.find(params[:contest])
contest_message = params[:contest_for_save][:contest_message]
if ContestingProject.where("project_id = ? and contest_id = ?", project.id, @contest.id).size == 0
if ContestingProject.cerate_contesting(@contest.id, project.id, contest_message)
# modified by longjun, create 写错了
# if ContestingProject.cerate_contesting(@contest.id, project.id, contest_message)
if ContestingProject.create_contesting(@contest.id, project.id, contest_message)
# end longjun
flash.now[:notice] = l(:label_bidding_contest_succeed)
end
else
@ -633,9 +702,7 @@ end
end
def manage
end
private

View File

@ -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/> &nbsp; "
#@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/> &nbsp; "
#@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

View File

@ -468,8 +468,8 @@ class ProjectsController < ApplicationController
def new
@issue_custom_fields = IssueCustomField.sorted.all
@trackers = Tracker.sorted.all
@project = Project.new
@trackers = Tracker.sorted.all
@project = Project.new
@project.safe_attributes = params[:project]
render :layout => 'base'
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -1,170 +1,175 @@
class ZipdownController < ApplicationController
#查找项目(课程)
before_filter :find_project_by_bid_id, :only => [:assort]
#检查权限
#勿删 before_filter :authorize, :only => [:assort,:download_user_homework]
SAVE_FOLDER = "#{Rails.root}/files"
OUTPUT_FOLDER = "#{Rails.root}/tmp/archiveZip"
#通过作业Id找到项目课程
def find_project_by_bid_id
obj_class = params[:obj_class]
obj_id = params[:obj_id]
obj = obj_class.constantize.find(obj_id)
case obj.class.to_s.to_sym
when :Bid
@project = obj.courses[0]
end
end
def assort
obj_class = params[:obj_class]
obj_id = params[:obj_id]
obj = obj_class.constantize.find(obj_id)
zipfile = nil
case obj.class.to_s.to_sym
when :Bid
zipfile = zip_bid obj
else
logger.error "[ZipDown#assort] ===> #{obj.class.to_s.to_sym} unKown !!"
end
send_file zipfile, :filename => obj.name+".zip", :type => detect_content_type(zipfile) if zipfile
#rescue NameError, ActiveRecord::RecordNotFound => e
#logger.error "[ZipDown] ===> #{e}"
#@error = e
end
#下载某一学生的作业的所有文件
def download_user_homework
homework = HomeworkAttach.find params[:homework]
if User.current.admin? || User.current.member_of_course?(homework.bid.courses.first)
if homework != nil
if homework.attachments.count > 0
zipfile = zip_homework_by_user homework
send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if(zipfile)
else
render_403 :message => :no_file_dowmload ,:layout => "course_base"
end
else
render_403 :message =>:notice_file_not_found ,:layout => "course_base"
end
else
render_403 :message => :notice_not_authorized ,:layout => "course_base"
end
rescue => e
render file: 'public/file_not_found.html' , :layout => 'course_base'
end
private
def zip_user_bid(bid,user_id)
# Todo: User Access Controll
homeattaches = bid.homeworks.where("user_id = ?",user_id)
# 得到每一个人所有文件打包的zip文件
# 并将每一个人的zip打包为一个并返回路径
user_zip_paths = homeattaches.map do |homeattach|
zip_homework_by_user homeattach
end
#zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER
user_zip_paths
end
def zip_bid(bid)
# Todo: User Access Controll
homeattaches = bid.homeworks
# 得到每一个人所有文件打包的zip文件
# 并将每一个人的zip打包为一个并返回路径
user_zip_paths = homeattaches.map do |homeattach|
if homeattach.attachments.count > 0
zip_homework_by_user homeattach
end
end
zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER
#@paths = homeworks_attach_path
#zipfile = ziping homeworks_attach_path
#send_file zipfile, :filename => bid.name,
# :type => detect_content_type(zipfile)
#rescue Errno::ENOENT => e
# logger.error "[Errno::ENOENT] ===> #{e}"
# @error = e
end
def zip_homework_by_user(homeattach)
#if homeattach.attachments.count > 0
homeworks_attach_path = []
# 需要将所有homework.attachments遍历加入zip
# 并且返回zip路径
user_attaches_paths = homeattach.attachments.each do |attach|
#length = attach.storage_path.length
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
end
zipping("#{homeattach.user.name.to_s}_#{Time.now.to_i}.zip", homeworks_attach_path, OUTPUT_FOLDER, true)
#user_attaches_paths
#end
end
def zipping(zip_name_refer, files_paths, output_path, is_attachment=false)
# 输入待打包的文件列表已经打包文件定位到ouput_path
ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE')
input_filename = files_paths
rename_zipfile = zip_name_refer ||= "archive_#{Time.now.to_i}.zip"
zipfile_name = "#{output_path}/#{rename_zipfile}"
Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
input_filename.each do |filename|
rename_file = Time.now.to_i.to_s+ ic.iconv( (File.basename(filename)) ).to_s
rename_file = ic.iconv( filename_to_real( File.basename(filename))).to_s if is_attachment
zipfile.add(rename_file, filename)
end
zipfile.get_output_stream('ReadMe') do |os|
os.write 'Homeworks'
end
end
zipfile_name
rescue Errno => e
logger.error "[zipdown#zipping] ===> #{e}"
@error = e
end
#def ziping files_path
# ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE')
# folder = SaveFolder
# input_filename = files_path
# zipfile_name = "#{OutputFolder}/archive_#{Time.now.to_i}.zip"
#
# Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
# Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
# input_filename.each do |filename|
# zipfile.add(ic.iconv(filename_to_real(File.basename(filename))), folder + '/' + filename)
# end
# zipfile.get_output_stream("ReadMe") { |os|
# os.write "Homeworks"
# }
# end
# zipfile_name
#rescue Errno => e
# logger.error "[zipdown#zipping] ===> #{e}"
# @error = e
#end
def detect_content_type(name)
content_type = Redmine::MimeType.of(name)
content_type.to_s
end
def filename_to_real(name)
attach = Attachment.find_by_disk_filename(name)
attach.filename
end
end
require 'zip'
class ZipdownController < ApplicationController
#查找项目(课程)
before_filter :find_project_by_bid_id, :only => [:assort]
#检查权限
#勿删 before_filter :authorize, :only => [:assort,:download_user_homework]
SAVE_FOLDER = "#{Rails.root}/files"
OUTPUT_FOLDER = "#{Rails.root}/tmp/archiveZip"
#通过作业Id找到项目课程
def find_project_by_bid_id
obj_class = params[:obj_class]
obj_id = params[:obj_id]
obj = obj_class.constantize.find(obj_id)
case obj.class.to_s.to_sym
when :Bid
@project = obj.courses[0]
end
end
def assort
obj_class = params[:obj_class]
obj_id = params[:obj_id]
obj = obj_class.constantize.find(obj_id)
zipfile = nil
case obj.class.to_s.to_sym
when :Bid
zipfile = zip_bid obj
else
logger.error "[ZipDown#assort] ===> #{obj.class.to_s.to_sym} unKown !!"
end
send_file zipfile, :filename => obj.name+".zip", :type => detect_content_type(zipfile) if zipfile
#rescue NameError, ActiveRecord::RecordNotFound => e
#logger.error "[ZipDown] ===> #{e}"
#@error = e
end
#下载某一学生的作业的所有文件
def download_user_homework
homework = HomeworkAttach.find params[:homework]
if User.current.admin? || User.current.member_of_course?(homework.bid.courses.first)
if homework != nil
if homework.attachments.count > 0
zipfile = zip_homework_by_user homework
send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if(zipfile)
else
render file: 'public/no_file_found.html' , :layout => 'course_base'
end
else
render file: 'public/file_not_found.html' , :layout => 'course_base'
end
else
render_403 :message => :notice_not_authorized ,:layout => "course_base"
end
rescue => e
render file: 'public/file_not_found.html' , :layout => 'course_base'
end
private
def zip_user_bid(bid,user_id)
# Todo: User Access Controll
homeattaches = bid.homeworks.where("user_id = ?",user_id)
# 得到每一个人所有文件打包的zip文件
# 并将每一个人的zip打包为一个并返回路径
user_zip_paths = homeattaches.map do |homeattach|
zip_homework_by_user homeattach
end
#zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER
user_zip_paths
end
def zip_bid(bid)
# Todo: User Access Controll
homeattaches = bid.homeworks
#记录所有作业是不是有附件有一个附件就改为true
has_file = false
# 得到每一个人所有文件打包的zip文件
# 并将每一个人的zip打包为一个并返回路径
user_zip_paths = homeattaches.map do |homeattach|
if homeattach.attachments.count > 0
zip_homework_by_user homeattach
has_file = true unless has_file
end
end
unless has_file
render file: 'public/no_file_fond.html' , :layout => 'course_base'
end
zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER
#@paths = homeworks_attach_path
#zipfile = ziping homeworks_attach_path
#send_file zipfile, :filename => bid.name,
# :type => detect_content_type(zipfile)
#rescue Errno::ENOENT => e
# logger.error "[Errno::ENOENT] ===> #{e}"
# @error = e
end
def zip_homework_by_user(homeattach)
#if homeattach.attachments.count > 0
homeworks_attach_path = []
# 需要将所有homework.attachments遍历加入zip
# 并且返回zip路径
user_attaches_paths = homeattach.attachments.each do |attach|
#length = attach.storage_path.length
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
end
zipping("#{homeattach.user.name.to_s}_#{Time.now.to_i}.zip", homeworks_attach_path, OUTPUT_FOLDER, true)
#user_attaches_paths
#end
end
def zipping(zip_name_refer, files_paths, output_path, is_attachment=false)
# 输入待打包的文件列表已经打包文件定位到ouput_path
ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE')
input_filename = files_paths
rename_zipfile = zip_name_refer ||= "archive_#{Time.now.to_i}.zip"
zipfile_name = "#{output_path}/#{rename_zipfile}"
Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
input_filename.each do |filename|
rename_file = Time.now.to_i.to_s+ ic.iconv( (File.basename(filename)) ).to_s
rename_file = ic.iconv( filename_to_real( File.basename(filename))).to_s if is_attachment
zipfile.add(rename_file, filename)
end
zipfile.get_output_stream('ReadMe') do |os|
os.write 'Homeworks'
end
end
zipfile_name
rescue Errno => e
logger.error "[zipdown#zipping] ===> #{e}"
@error = e
end
#def ziping files_path
# ic = Iconv.new('GBK//IGNORE', 'UTF-8//IGNORE')
# folder = SaveFolder
# input_filename = files_path
# zipfile_name = "#{OutputFolder}/archive_#{Time.now.to_i}.zip"
#
# Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
# Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
# input_filename.each do |filename|
# zipfile.add(ic.iconv(filename_to_real(File.basename(filename))), folder + '/' + filename)
# end
# zipfile.get_output_stream("ReadMe") { |os|
# os.write "Homeworks"
# }
# end
# zipfile_name
#rescue Errno => e
# logger.error "[zipdown#zipping] ===> #{e}"
# @error = e
#end
def detect_content_type(name)
content_type = Redmine::MimeType.of(name)
content_type.to_s
end
def filename_to_real(name)
attach = Attachment.find_by_disk_filename(name)
attach.filename
end
end

View File

@ -33,8 +33,8 @@ module ApplicationHelper
extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
#Added by young
#Define the course menu's link class
# Added by young
# Define the course menu's link class
# 不是数组的转化成数组然后判断当前menu_item是否在给定的列表
# REVIEW: 目测menu的机制貌似不是很需要转换再说
def link_class(label)
@ -679,15 +679,15 @@ module ApplicationHelper
def textilizable(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
case args.size
when 1
obj = options[:object]
text = args.shift
when 2
obj = args.shift
attr = args.shift
text = obj.send(attr).to_s
else
raise ArgumentError, 'invalid arguments to textilizable'
when 1
obj = options[:object]
text = args.shift
when 2
obj = args.shift
attr = args.shift
text = obj.send(attr).to_s
else
raise ArgumentError, 'invalid arguments to textilizable'
end
return '' if text.blank?
project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)

View File

@ -22,6 +22,9 @@ module AttachmentsHelper
# Options:
# :author -- author names are not displayed if set to false
# :thumbails -- display thumbnails if enabled in settings
include Redmine::Pagination
def link_to_attachments(container, options = {})
options.assert_valid_keys(:author, :thumbnails)
@ -171,7 +174,9 @@ module AttachmentsHelper
s.html_safe
end
def private_filter resultSet
# Modified by Longjun
# 有参数的方法要加()
def private_filter(resultSet)
result = resultSet.to_a.dup
# modify by nwb
@ -190,8 +195,12 @@ module AttachmentsHelper
result
end
include Redmine::Pagination
def paginateHelper obj, pre_size=10
# Modified by Longjun
# include 应放在class/model 的开始处
# include Redmine::Pagination
# end
def paginateHelper (obj, pre_size=10)
@obj_count = obj.count
@obj_pages = Paginator.new @obj_count, pre_size, params['page']
if obj.kind_of? ActiveRecord::Base or obj.kind_of? ActiveRecord::Relation

View File

@ -43,16 +43,16 @@ module ContestsHelper
def sort_contest_enterprise(state, project_type)
content = ''.html_safe
case state
when 0
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:contest_sort_type => '1', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:contest_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
when 1
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:contest_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:contest_sort_type => '0', :project_type => project_type)))
end
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs_enterprise")
when 0
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:contest_sort_type => '1', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:contest_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
when 1
content << content_tag('li', link_to(l(:label_sort_by_active), calls_path(:contest_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_time), calls_path(:contest_sort_type => '0', :project_type => project_type)))
end
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs_enterprise")
end
#end
@ -100,7 +100,10 @@ module ContestsHelper
def count_contest_project
contests = Contest.find(:id)
@projects = []
for contest in contests
# Modified by longjun
# for contest in contests
contests.each do |contest|
# end longjun
@projects += contest.contesting_projects
end
@projects.count
@ -109,7 +112,10 @@ module ContestsHelper
def count_contest_softapplication
contests = Contest.find(:id)
@softapplications = []
for contest in contests
# Modified by alan
# for contest in contests
contests.each do |contest|
# end alan
@softapplications += contest.contesting_softapplications
end
@projects.count
@ -119,19 +125,29 @@ module ContestsHelper
def count_contest_user
contests = Contest.find(:id)
@users = []
for contest in contests
for project in contest.projects
# Modified by alan
# for contest in contests
contests.each do |contest|
contest.projects.each do |project|
@users += project.users
end
end
# end alan
@users.count
end
def count_contest_softapplication_user
contests = Contest.find(:id)
@users = []
for contest in contests
for project in contest.softapplications
# Modified by alan
# for contest in contests
contests.each do |contest|
contest.projects.each do |softapplications|
# for project in contest.softapplications
@users += softapplication.users
end
end

View File

@ -44,7 +44,7 @@ module ProjectsHelper
content = ''.html_safe
case state
when 0
content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
@ -70,19 +70,19 @@ module ProjectsHelper
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
when 1
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id), :class=>"selected"), :class=>"selected")
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
when 2
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
#gcm
when 3
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
@ -101,7 +101,7 @@ module ProjectsHelper
content = ''.html_safe
case state
when 0
content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
@ -142,7 +142,7 @@ module ProjectsHelper
# end
#Added by young
# Added by young
def course_settings_tabs
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'},
#{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural, :project_type => 1},
@ -151,7 +151,7 @@ module ProjectsHelper
]
tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
end
#Ended by young
# Ended by young
@ -173,14 +173,42 @@ module ProjectsHelper
# Renders the projects index
def render_project_hierarchy(projects)
render_project_nested_lists(projects) do |project|
if (project.try(:project_type) == Project::ProjectType_course )
s = project.is_public == 1 ? "".html_safe : "<span class='private_project'>#{l(:label_private)}</span>".html_safe
s += link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}").html_safe
else
s = project.is_public ? "".html_safe : "<span class='private_project'>#{l(:label_private)}</span>".html_safe
s += link_to_project(project, {}, :class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
end
#Modified by young
if project.try(:project_type) == Project::ProjectType_course
# modified by longjun
# never use unless and else
# unless project.is_public == 1
if project.is_public != 1
s = "<span class='private_project'>#{l(:lable_private)}</span>".html_safe
else
s = "".html_safe
end
# end longjun
# modified by Longjun
s += link_to_project(project, {},
:class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}").html_safe
# end longjun
else
# modified by longjun
# unless project.is_public
if !project.is_public
# end longjun
s = "<span class='private_project'>#{l(:lable_private)}</span>".html_safe
else
s = "".html_safe
end
# modified by longjun
s += link_to_project(project, {},
:class => "#{project.css_classes} #{User.current.member_of?(project) ? 'my-project' : nil}")
# end longjun
end
#Ended by young
if project.description.present?
#Delete by nie.
# s << content_tag('td', textilizable(project.short_description, :project => project), :class => 'wiki description')
end
s
@ -243,9 +271,14 @@ module ProjectsHelper
def is_manager?(user_id,project_id)
@result = false
@user_id = ProjectInfo.find_by_project_id(project_id)
if @user_id == user.id
@result = true
end
# modified by longjun
# if @user_id == user.id
# @result = true
# end
@result = true if @user_id = user.id
# end longjun
return @result
end
@ -330,9 +363,9 @@ module ProjectsHelper
return true if (project.nil? && project.course_extra.nil?)
courses_year = project.course_extra.time
current_year = Time.now.year
if(courses_year >= current_year)
if courses_year >= current_year
return false
elsif( (courses_year < current_year) && (Time.now.month < 3) )
elsif (courses_year < current_year) && (Time.now.month < 3)
return false
else
return true

View File

@ -72,11 +72,14 @@ class Contest < ActiveRecord::Base
end
end
def self.creat_contests(budget, deadline, name, description=nil)
self.create(:author_id => User.current.id, :budget => budget,
:deadline => deadline, :name => name, :description => description, :commit => 0)
end
# modified by longjun
# 这个函数没有用到
# def self.creat_contests(budget, deadline, name, description=nil)
# self.create(:author_id => User.current.id, :budget => budget,
# :deadline => deadline, :name => name, :description => description, :commit => 0)
# end
# end longjun
def update_contests(budget, deadline, name, description=nil)
if(User.current.id == self.author_id)
self.name = name

View File

@ -14,7 +14,7 @@ class ContestingProject < ActiveRecord::Base
validate :validate_project
validates_uniqueness_of :contest_id, :scope => :project_id
def self.cerate_contesting(contest_id, project_id, description = nil)
def self.create_contesting(contest_id, project_id, description = nil)
self.create(:user_id => User.current.id, :contest_id => contest_id,
:project_id => project_id, :description => description)
end

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -12,9 +12,9 @@
</p>
<p>
<label for="new_password_confirmation"><%=l(:field_password_confirmation)%> <span class="required">*</span></label>
<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %>
</p>
<label for="new_password_confirmation"><%= l(:field_password_confirmation)%> <span class="required">*</span></label>
<%= password_field_tag 'new_password_confirmation', nil, :size => 25 %>
</p>
</div>
<p><%= submit_tag l(:button_save) %></p>
<% end %>

View File

@ -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('&nbsp;'.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('&nbsp;'.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 %>

View File

@ -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>&nbsp&nbsp&nbsp
<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>
&nbsp;
<%= 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>&nbsp&nbsp&nbsp
<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>
&nbsp;
<%= render :partial => 'common/file', :locals => {:content => @content, :filename => @attachment.filename} %>
<% html_title @attachment.filename %>
<% content_for :header_tags do -%>
<%= stylesheet_link_tag "scm" -%>
<% end -%>

View File

@ -67,12 +67,15 @@
<% @topics.each do |topic| %>
<table class="content-text-list">
<tr>
<td colspan="2" valign="top" width="50"><%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %></td>
<td colspan="2" valign="top" width="50">
<%= link_to image_tag(url_to_avatar(topic.author), :class => "avatar"), user_path(topic.author) %>
</td>
<td>
<table width="640px" border="0">
<tr>
<td valign="top" width="500px" class=" <%= topic.sticky? ? 'sticky' : '' %>
<%= topic.locked? ? 'locked' : '' %>"><%= link_to h(topic.subject.truncate(40,ommision:'...')), board_message_path(@board, topic),title:topic.subject.to_s %>
<%= topic.locked? ? 'locked' : '' %>">
<%= link_to h(topic.subject.truncate(40,ommision:'...')), board_message_path(@board, topic),title:topic.subject.to_s %>
</td>
<td align="right" rowspan="3">
<table class="borad-count">

View File

@ -9,8 +9,12 @@
</td>
</tr>
<tr>
<td style="padding-left: 8px"><a href="http://contest.trustie.net/">contest.trustie.net</td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_contest_innovate), :controller => 'welcome', :action => 'contest' %> > 详情</td>
<td style="padding-left: 8px">
<a href="http://contest.trustie.net/">contest.trustie.net</a>
</td>
<td >
<%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:label_contest_innovate), welcome_contest_path %> > 详情</td>
</tr>
</table>
</div>

View File

@ -3,8 +3,23 @@
<%= l(:bale_news_notice) %>
</div>
<div class="box tabular">
<p><%= f.text_field :title, :required => true, :size => 60,:maxlength => 60, :style => "width:488px;" %></p>
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;" %></p>
<p>
<%= f.text_field :title,
:required => true,
:size => 60,
:maxlength => 60,
:style => "width:488px;"
%>
</p>
<p>
<%= f.text_area :description,
:required => true,
:cols => 60,
:rows => 11,
:class => 'wiki-edit',
:style => "width:490px;"
%>
</p>
</div>

View File

@ -2,24 +2,47 @@
<table><tr><td><img src="/images/new/news.png" width="40" height="40"/></td><td><%#= link_to h(news.title), news_path(news) %>
<%#= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %>
<%# unless news.summary.blank? %></td><td><span class="fontligher"><%#=h news.summary %></span><% end %></td>
<%# unless news.summary.blank? %></td><td><span class="fontligher"><%#=h news.summary %></span></td>
<td><span class="author"><%#= authoring news.created_on, news.author %></span></td></tr></table></p>-->
<table width="660px" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50" ><img src="/images/new/news.png" width="40" height="40"/></td>
<td colspan="2" valign="top" width="50" >
<img src="/images/new/news.png" width="40" height="40"/>
</td>
<td><table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><strong> <%=link_to contestnotifications.author,contest_contestnotification_path(contestnotifications)%></strong>
<a class="font_lighter"><%= l(:label_project_newshare) %></a> <%= link_to h(contestnotifications.title), contest_contestnotification_path(contestnotifications) %>
<td colspan="2" valign="top">
<strong>
<%=link_to contestnotifications.author,
contest_contestnotification_path(contestnotifications)
%>
</strong>
<a class="font_lighter">
<%= l(:label_project_newshare) %>
</a>
<%= link_to h(contestnotifications.title),
contest_contestnotification_path(contestnotifications)
%>
</td>
</tr>
<tr>
<td colspan="2" width="580px" ><p class="font_description"><%=h contestnotifications.description%></p></td>
<td colspan="2" width="580px" >
<p class="font_description">
<%=h contestnotifications.description%>
</p>
</td>
</tr>
<tr>
<td align="left"><a class="font_lighter"> <%= contestnotifications.created_at %></a></td>
<td width="200" align="right" class="a"><%= link_to l(:label_project_newother),contest_contestnotification_path(contestnotifications)%>
<td align="left">
<a class="font_lighter">
<%= contestnotifications.created_at %>
</a>
</td>
<td width="200" align="right" class="a">
<%= link_to l(:label_project_newother),
contest_contestnotification_path(contestnotifications)
%>
<%= "(#{l(:label_x_comments, :count => contestnotifications.notificationcomments_count)})" if contestnotifications.notificationcomments_count > 0 %>
</td>
</tr>

View File

@ -1,9 +1,15 @@
<h3><%=l(:label_news)%></h3>
<%= labelled_form_for @contestnotification, url: contest_contestnotification_path, :html => { :id => 'contestnotifications-form', :multipart => true, :method => :put } do |f| %>
<%= labelled_form_for @contestnotification,
:url => contest_contestnotification_path,
:html => { :id => 'contestnotifications-form',
:multipart => true,
:method => :put } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<%= submit_tag l(:button_save) %>
<%= preview_link preview_contestnotifications_path(id: @contestnotification), 'contestnotifications-form' %>
<%= preview_link preview_contestnotifications_path(id: @contestnotification),
'contestnotifications-form'
%>
<% end %>
<div id="preview" class="wiki"></div>

View File

@ -1,5 +1,7 @@
<%= labelled_form_for @contestnotification, :url => contest_contestnotifications_path(@contest), :html => { :id => 'contestnotifications-form', :multipart => true } do |f| %>
<%= labelled_form_for @contestnotification,
:url => contest_contestnotifications_path(@contest),
:html => { :id => 'contestnotifications-form', :multipart => true } do |f| %>
<%= render :partial => 'contestnotifications/form', :locals => { :f => f } %>
<%= submit_tag l(:button_create), :class => "whiteButton m3p10 h30" %>
<%= submit_tag l(:button_cancel), :class => "whiteButton m3p10 h30",:onclick => "cancel();" %>

View File

@ -1,21 +1,26 @@
<div class="contextual">
<%= link_to(l(:button_edit),
edit_contest_contestnotification_path(@contest, @contestnotification),
:class => 'icon icon-edit',
:accesskey => accesskey(:edit),
:onclick => '$("#edit-contestnotifications").show(); return true;') if (User.current.admin? && User.current.logged? )||(User.current == @contest.author && User.current.logged?)%>
edit_contest_contestnotification_path(@contest, @contestnotification),
:class => 'icon icon-edit',
:accesskey => accesskey(:edit),
:onclick => '$("#edit-contestnotifications").show(); return true;') if (User.current.admin? && User.current.logged? )||(User.current == @contest.author && User.current.logged?)%>
<%= delete_link contest_contestnotification_path(@contest, @contestnotification) if (User.current.admin? && User.current.logged? )||(User.current == @contest.author && User.current.logged?) %>
</div>
<h3><strong><%=h @contestnotification.title %></strong></h3>
<div id="edit-contestnotifications" style="display:none;">
<%= labelled_form_for @contestnotification, :url => contest_contestnotification_path(@contest),
:html => { :id => 'contestnotifications-form', :multipart => true, :method => :put } do |f| %>
<%= labelled_form_for @contestnotification,
:url => contest_contestnotification_path(@contest),
:html => { :id => 'contestnotifications-form',
:multipart => true,
:method => :put } do |f| %>
<%= render :partial => 'form', :locals => { :f => f } %>
<%= submit_tag l(:button_save) %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#edit-contestnotifications").hide(); return false;' %>
<%= link_to l(:button_cancel),
"#",
:onclick => '$("#edit-contestnotifications").hide(); return false;' %>
<% end %>
<div id="preview" class="wiki"></div>
</div>
@ -23,7 +28,9 @@
<div id="notificationcomments" style="margin-bottom:16px;">
<div style="margin:15px">
<span class="font_description"> <%= textilizable(@contestnotification, :description) %> </span>
<span class="font_description">
<%= textilizable(@contestnotification, :description) %>
</span>
<br/>
<%#= link_to_attachments @contestnotification %>
<br/>
@ -31,16 +38,26 @@
<% if User.current.logged? %>
<p>
<%= toggle_link l(:label_comment_add), "add_notificationcomment_form", :focus => "notificationcomment_notificationcomments" %>
<%= toggle_link l(:label_comment_add),
"add_notificationcomment_form",
:focus => "notificationcomment_notificationcomments"
%>
</p>
<% else %>
<%= l(:label_user_login_notificationcomment) %>
<%= link_to l(:label_user_login_new), signin_path %>
<% end %>
<%= form_tag( contest_contestnotification_notificationcomments_path(@contest, @contestnotification) , :id => "add_notificationcomment_form", :style => "display:none;") do %>
<%= form_tag( contest_contestnotification_notificationcomments_path(@contest, @contestnotification) ,
:id => "add_notificationcomment_form",
:style => "display:none;") do %>
<div class="box">
<%= text_area 'notificationcomment', 'notificationcomments', :cols => 80, :rows => 15, :class => 'wiki-edit' %>
<%= text_area 'notificationcomment',
'notificationcomments',
:cols => 80,
:rows => 15,
:class => 'wiki-edit'
%>
<%= wikitoolbar_for 'notificationcomment_notificationcomments' %>
</div>
<p>
@ -65,7 +82,9 @@
<% next if notificationcomment.new_record? %>
<table width="660px" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(notificationcomment.author), :class => "avatar")%></td>
<td colspan="2" valign="top" width="50" >
<%= image_tag(url_to_avatar(notificationcomment.author), :class => "avatar")%>
</td>
<td>
<table width="580px" border="0">
<tr>
@ -80,8 +99,9 @@
</td>
<td>
<% if notificationcomment.author==User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete), contest_contestnotification_notificationcomment_path(@contest, @contestnotification,notificationcomment),
:method => :delete,:confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
<%= link_to(l(:label_bid_respond_delete),
contest_contestnotification_notificationcomment_path(@contest, @contestnotification,notificationcomment),
:method => :delete,:confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
<% end %>
</td>
</tr>
@ -92,7 +112,11 @@
</p></td>
</tr>
<tr>
<td align="left"><span class="font_lighter"> <%= format_time(notificationcomment.created_at) %></span></td>
<td align="left">
<span class="font_lighter">
<%= format_time(notificationcomment.created_at) %>
</span>
</td>
<td width="200" align="right" class="a"><%#= link_to_if_authorized_contest image_tag('delete.png'), {:controller => 'notificationcomments', :action => 'destroy', :id => @contestnotifications, :notificationcomment_id => notificationcomment},
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete, :title => l(:button_delete) %></td>
</tr>

View File

@ -4,7 +4,10 @@
<tr>
<td colspan="2" valign="top" width="50" >
<% unless contest.author.nil? %>
<%= link_to(image_tag(url_to_avatar(contest.author), :class => 'avatar'), user_path(contest.author), :class => "avatar") %>
<%= link_to(image_tag(url_to_avatar(contest.author), :class => 'avatar'),
user_path(contest.author),
:class => "avatar")
%>
<% end %>
</td>
<td>
@ -12,33 +15,85 @@
<tr>
<td colspan="2" valign="top"><strong>
<% unless contest.author.nil? %>
<%= link_to(contest.author, user_path(contest.author), :class => 'bid_user') %>:
<%= link_to(contest.author,
user_path(contest.author),
:class => 'bid_user')
%>:
<% end %>
&nbsp;<%= link_to(contest.name, contest_contestnotifications_path(contest), :class => 'bid_path', :target => "_blank") %></strong></td>
&nbsp;<%= link_to(contest.name,
contest_contestnotifications_path(contest),
:class => 'bid_path',
:target => "_blank") %></strong></td>
</tr>
<tr>
<td width="500">
<table border="0">
<tr>
<td>
<strong><%= l(:label_contests_reward_method) %>:&nbsp;&nbsp;<span style="word-break: break-all; color: #15bccf;font-family: 14px; font-family: 微软雅黑"><%= contest.budget%></span></strong>
<strong><%= l(:label_contests_reward_method) %>:&nbsp;&nbsp;
<span style="word-break: break-all; color: #15bccf; font-family: 14px; font-family: '微软雅黑'">
<%= contest.budget%>
</span>
</strong>
</td>
</tr>
<tr>
<td class="font_lighter">
<!-- <span class="font_lighter"><%= l(:label_contest_project, :count => contest.contesting_projects.count) %>(<strong><span style="font-size: 17px"><%= link_to(contest.contesting_projects.count, show_project_contest_path(contest), :target => "_blank") %></span></strong>)</span>
<span class="font_lighter"><%= l(:label_contest_softapplication, :count => contest.contesting_softapplications.count) %>(<strong><span style="font-size: 17px"><%= link_to(contest.contesting_softapplications.count, show_softapplication_contest_path(contest), :target => "_blank") %></span></strong>)</span> -->
<% if contest.id == 2 or contest.id == 3 or contest.id == 6 %>
<%= l(:label_contest_work, :count => contest.contesting_projects.count) %>(<strong><span style="font-size: 17px"><%= link_to(contest.projects.where('is_public=1').count, show_attendingcontest_contest_path(contest), :target => "_blank") %></span></strong>)
<!-- <span class="font_lighter">
<%= l(:label_contest_project,
:count => contest.contesting_projects.count)
%>
(<strong><span style="font-size: 17px">
<%= link_to(contest.contesting_projects.count,
show_project_contest_path(contest),
:target => "_blank")
%></span></strong>)</span>
<span class="font_lighter">
<%= l(:label_contest_softapplication,
:count => contest.contesting_softapplications.count)
%>
(<strong><span style="font-size: 17px">
<%= link_to(contest.contesting_softapplications.count,
show_softapplication_contest_path(contest),
:target => "_blank")
%>
</span></strong>)</span> -->
<!-- modified by longjun
将 or 改成 || -->
<% if contest.id == 2 || contest.id == 3 || contest.id == 6 %>
<%= l(:label_contest_work,
:count => contest.contesting_projects.count)
%>
(<strong>
<span style="font-size: 17px">
<%= link_to(contest.projects.where('is_public=1').count,
show_attendingcontest_contest_path(contest),
:target => "_blank")
%>
</span>
</strong>)
<% else %>
<%= l(:label_contest_work, :count => contest.contesting_softapplications.count) %>(<strong><span style="font-size: 17px"><%= link_to(contest.contesting_softapplications.count, show_attendingcontest_contest_path(contest), :target => "_blank") %></span></strong>)
<%= l(:label_contest_work,
:count => contest.contesting_softapplications.count)
%>
(<strong>
<span style="font-size: 17px">
<%= link_to(contest.contesting_softapplications.count,
show_attendingcontest_contest_path(contest),
:target => "_blank") %>
</span>
</strong>)
<% end %>
</td>
</tr>
</table></td>
<td width="200" align="right" class="a"><span class="font_lighter"> <%= l :label_create_time %>: <%= format_time contest.created_on %></span></td>
<td width="200" align="right" class="a">
<span class="font_lighter">
<%= l :label_create_time %>: <%= format_time contest.created_on %>
</span>
</td>
</tr>
<tr>
<td>
@ -58,6 +113,6 @@
<div class="pagination">
<ul>
<ul>
</ul>
</div>

View File

@ -20,17 +20,55 @@
</script>
<%= error_messages_for 'contest' %>
<!--[form:project]-->
<p style="width:500px;"><%= l(:label_bids_form_contest_new_description) %></p>
<p><%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;", :maxlength => Contest::NAME_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_name)}" %></p>
<p style="width:500px;">
<%= l(:label_bids_form_contest_new_description) %>
</p>
<p>
<%= f.text_field :name,
:required => true,
:size => 60,
:style => "width:490px;",
:maxlength => Contest::NAME_LENGTH_LIMIT,
:placeholder => "#{l(:label_contest_name)}"
%>
</p>
<p style="margin-left:-10px;padding-right: 20px;"><%= f.text_area :description, :rows => 5, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;", :maxlength => Contest::DESCRIPTION_LENGTH_LIMIT, :placeholder => "#{l(:label_contest_description)}" %></p>
<p style="margin-left:-10px;padding-right: 20px;">
<%= f.text_area :description,
:rows => 5,
:class => 'wiki-edit',
:style => "font-size:small;width:490px;margin-left:10px;",
:maxlength => Contest::DESCRIPTION_LENGTH_LIMIT,
:placeholder => "#{l(:label_contest_description)}"
%>
</p>
<p style="margin-left:-10px;"><%= f.text_field :password, :size => 60, :style => "width:488px;margin-left: 10px;" %></p>
<p style="margin-left:-10px;">
<%= f.text_field :password,
:size => 60,
:style => "width:488px;margin-left: 10px;"
%>
</p>
<p>
<%= f.text_area :budget, :required => true, :size => 60,:rows => 4,:maxlength => Contest::DESCRIPTION_LENGTH_LIMIT, :style => "width:490px;", :placeholder => l(:label_bids_reward_what) %>
<%= f.text_area :budget,
:required => true,
:size => 60,
:rows => 4,
:maxlength => Contest::DESCRIPTION_LENGTH_LIMIT,
:style => "width:490px;",
:placeholder => l(:label_bids_reward_what)
%>
<!-- 设置奖项设置的打开 关闭开关-->
</p>
<!-- <em class="info" style="margin-left:95px;"><%= l(:text_contest_reward) %></em> -->
<p><%= f.text_field :deadline, :required => true, :size => 60, :style => "width:150px;", :placeholder => "#{l(:label_deadline)}" %><%= calendar_for('contest_deadline')%></p>
<p>
<%= f.text_field :deadline,
:required => true,
:size => 60,
:style => "width:150px;",
:placeholder => "#{l(:label_deadline)}"
%>
<%= calendar_for('contest_deadline')%>
</p>

View File

@ -11,36 +11,66 @@
<ul class="message-for-user">
<% for journal in journals%>
<li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
<span class="body">
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
<span class="font_lighter"><% label = l(:label_contest_requirement) %></span>
<div> <%= textilizable journal.notes%> </div>
<span class="font_lighter"><%= l(:label_bids_published) %>&nbsp;<%= time_tag(journal.created_on).html_safe %>&nbsp;<%= l(:label_bids_published_ago) %></span>
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<span>
<% if reply_allow %>
<%#= link_to(l(:button_quote), {:controller => 'contests', :action => 'new', :id => contest, :journal_id => journal}, :remote => true, :method => 'post', :title => l(:button_quote))%>
<%= link_to(l(:button_quote), contests_path(:id => contest, :journal_id => journal), :remote => true, :method => 'post', :title => l(:button_quote))%>
<%= link_to l(:label_bid_respond_quote),'',
{:focus => 'project_respond', :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.show_name}: '); $('##{ids} textarea') ;return false;"}%>
<% end %>
<% if @user==User.current|| User.current.admin? %>
<%#= link_to(l(:label_bid_respond_delete), {:controller => 'bids', :action => 'destroy', :object_id => journal, :id => bid},:confirm => l(:label_delete_confirm),
:remote => true, :method => 'delete', :class => "delete", :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
<%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user}, :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
<% end %>
</span>
</span>
<span class="portrait">
<%= image_tag(url_to_avatar(journal.user), :class => "avatar") %>
</span>
<span class="body">
<span class="user">
<%= link_to journal.user, user_path(journal.user)%>
</span>
<span class="font_lighter">
<% label = l(:label_contest_requirement) %>
</span>
<div> <%= textilizable journal.notes%> </div>
<span class="font_lighter">
<%= l(:label_bids_published) %>&nbsp;
<%= time_tag(journal.created_on).html_safe %>&nbsp;
<%= l(:label_bids_published_ago) %>
</span>
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<span>
<% if reply_allow %>
<%#= link_to(l(:button_quote), {:controller => 'contests', :action => 'new', :id => contest, :journal_id => journal}, :remote => true, :method => 'post', :title => l(:button_quote))%>
<%= link_to(l(:button_quote),
contests_path(:id => contest,
:journal_id => journal),
:remote => true,
:method => 'post',
:title => l(:button_quote))
%>
<%= link_to l(:label_bid_respond_quote),
'',
{:focus => 'project_respond',
:onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea'), '#{l(:label_reply_plural)} #{journal.user.show_name}: '); $('##{ids} textarea') ;return false;"
}
%>
<% end %>
<% if @user==User.current|| User.current.admin? %>
<%#= link_to(l(:label_bid_respond_delete), {:controller => 'bids', :action => 'destroy', :object_id => journal, :id => bid},:confirm => l(:label_delete_confirm),
:remote => true, :method => 'delete', :class => "delete", :confirm => l(:text_are_you_sure), :title => l(:button_delete)) %>
<!-- modified by longjun -->
<%= link_to(l(:label_bid_respond_delete),
words_destroy_path(:user_id => @user, :object_id => journal),
:remote => true,
:confirm => l(:text_are_you_sure),
:method => 'delete',
:class => "delete",
:title => l(:button_delete)) %>
<% end %>
</span>
</span>
<div style="clear: both;"></div>
<% ids = 'project_respond_form_'+ journal.id.to_s%>
<% if reply_allow %>
<div id='<%= ids %>' class="respond-form">
<%= render :partial => 'words/new_respond', :locals => {:journal => journal, :m_reply_id => journal} %>
<%= render :partial => 'words/new_respond',
:locals => {:journal => journal, :m_reply_id => journal}
%>
</div>
<% end %>
<div style="clear: both;"></div>

View File

@ -26,8 +26,9 @@
<td style="color: #ec6300;" align="right" valign="0.1em" width="16%">
<strong>
<span id="reward_result_<%=c_project.id%>"> <!-- 调用js进行刷新 -->
<%= l(:label_system_grade) %>:<%= (c_project.project.project_status.nil? ? 0.0 : c_project.project.project_status.grade) unless (c_project.project.project_status.nil? && c_project.project.nil?) %>
<% if get_prize(c_project).nil? or get_prize(c_project) == "" %>
<%= l(:label_system_grade) %>:
<%= (c_project.project.project_status.nil? ? 0.0 : c_project.project.project_status.grade) unless (c_project.project.project_status.nil? && c_project.project.nil?) %>
<% if get_prize(c_project).nil? || get_prize(c_project) == "" %>
<% if @contest.deadline < Date.today %>
<%= l(:label_noawards)%>
<% end %>

View File

@ -6,7 +6,10 @@
<tr>
<td><strong><%=l(:label_softapplication)%>:</strong></td>
<td>
<%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication), :target => '_blank') %>
<%= link_to(c_softapplication.softapplication.name,
softapplication_path(c_softapplication.softapplication),
:target => '_blank')
%>
</td>
</tr></br>
</div>
@ -31,5 +34,7 @@
<% end %>
<div class="underline-contests_three"></div>
<% end %>
<div class="pagination"><%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %></div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>

View File

@ -30,7 +30,18 @@
<% if User.current.logged? %>
<table border="0" width="525px" align="center" >
<tr>
<td><%= f.text_area 'message', :rows => 3, :cols => 65, :placeholder => l(:label_my_respond), :style => "resize: none;", :class => 'noline'%></td>
<!-- modified by longjun 修改格式 -->
<td>
<%= f.text_area 'message',
:rows => 3,
:cols => 65,
:placeholder => l(:label_my_respond),
:style => "resize: none;",
:class => 'noline'
%>
</td>
<!-- end longjun -->
</tr>
</table>
@ -39,8 +50,23 @@
<!-- modified by bai -->
<table border="0" width="525px" align="center">
<tr>
<td align="right"> <%= submit_tag l(:button_leave_meassge), :name => nil , :class => "contest_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
<%= submit_tag l(:button_clear_meassge), :name => nil, :onclick => "clearMessage('contest_message_message');", :type => 'button', :class => "bid_btn", :onmouseout => "this.style.backgroundPosition = 'left top'", :onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
<!-- modified by longjun 修改格式 -->
<td align="right">
<%= submit_tag l(:button_leave_meassge),
:name => nil ,
:class => "contest_btn",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'"
%>
<%= submit_tag l(:button_clear_meassge),
:name => nil,
:onclick => "clearMessage('contest_message_message');",
:type => 'button', :class => "bid_btn",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -31px'"
%>
</td>
<!-- end longjun -->
</tr>
</table>
<!-- end -->

View File

@ -50,8 +50,17 @@
<%= text_field_tag 'contest_password', nil, :size => 45 %>
<p class="buttons" style="padding-top: 10px; padding-bottom: 1px; margin-bottom: 1px">
<%= submit_tag l(:label_new_join), :name => nil, :class => "contest_btn", :onclick => "hideModal(this);" %>
<%= submit_tag l(:button_cancel), :name => nil, :class => "contest_btn", :onclick => "hideModal(this);", :type => 'button' %>
<%= submit_tag l(:label_new_join),
:name => nil, :class => "contest_btn",
:onclick => "hideModal(this);"
%>
<%= submit_tag l(:button_cancel),
:name => nil,
:class => "contest_btn",
:onclick => "hideModal(this);",
:type => 'button'
%>
</p>
</td>
</tr></table>
<% end %>

View File

@ -1,184 +1,232 @@
<%#= error_messages_for 'softapplication' %>
<script type="text/javascript">
//验证作品名称
function regexName()
{
var name = $("#softapplication_name").val();
if(name.length ==0)
{
$("#spane_name_notice").text("作品名称不能为空");
$("#spane_name_notice").css('color','#ff0000');
$("#spane_name_notice").focus();
return false;
}
else if(name.length <= 25)
{
$("#spane_name_notice").text("填写正确");
$("#spane_name_notice").css('color','#008000');
return true;
}
else
{
$("#spane_name_notice").text("作品名称超过25个汉字");
$("#spane_name_notice").css('color','#ff0000');
$("#spane_name_notice").focus();
return false;
}
}
//验证运行平台
function regexWorkdescription()
{
var workDescription = $("#softapplication_android_min_version_available").val();
if(workDescription.length ==0)
{
$("#spane_workdescription_notice").text("运行平台不能为空");
$("#spane_workdescription_notice").css('color','#ff0000');
return false;
}
if(workDescription.length <= 125)
{
$("#spane_workdescription_notice").text("填写正确");
$("#spane_workdescription_notice").css('color','#008000');
return true;
}
else
{
$("#spane_workdescription_notice").text("运行平台超过125个汉字");
$("#spane_workdescription_notice").css('color','#ff0000');
return false;
}
}
//验证开发人员
function regexDevelopers()
{
var workDescription = $("#softapplication_application_developers").val();
if(workDescription.length ==0)
{
$("#span_softapplication_application_developers").text("开发人员不能为空");
$("#span_softapplication_application_developers").css('color','#ff0000');
return false;
}
if(workDescription.length <= 125)
{
$("#span_softapplication_application_developers").text("填写正确");
$("#span_softapplication_application_developers").css('color','#008000');
return true;
}
else
{
$("#span_softapplication_application_developers").text("开发人员超过125个汉字");
$("#span_softapplication_application_developers").css('color','#ff0000');
return false;
}
}
//提交验证
function submit_new_softapplication()
{
if(regexName() && regexWorkdescription() && regexDevelopers())
{
$("#new_softapplication").submit();
}
}
</script>
<%= form_for Softapplication.new, :url => softapplications_path do |f| %>
<fieldset class="contes-new-box" style="padding-left: 36px; line-height: 8px; margin-left: 1px" >
<%= hidden_field_tag 'contest_id', @contest.id %>
<tr style="width:700px; margin-left: -10px;">
<span><%= l(:label_work_name) %></span>
<span class="contest-star"> * </span>:
<td><%= f.text_field :name, :required => true, :size => 60, :style => "width:320px;", :onblur => "regexName();" %></td>
<span style="font-size: 10px;" id="spane_name_notice">(<%= l(:label_workname_lengthlimit) %>)</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_running_platform) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:320px;", :onblur=>"regexWorkdescription();"%>
</td>
<span style="font-size: 10px" id="spane_workdescription_notice">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_work_type) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<span>
<%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %>
</span>
<%= f.select :app_type_name,work_type_opttion, {},{:style => "width:328px;",:onchange => "selectChange(this)"} %>
<%#= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %>
</td>
<span style="font-size: 10px;display: none" id="other_span">
<%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %>
<input type="text" style="width: 120px;" id="other_input" name = "other_input"/>
</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_work_description) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:320px;" %></td>
<!--span style="font-size: 10px">(<%#= l(:label_workdescription_lengthlimit) %>)</span-->
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_softapplication_developers) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:320px;", :onblur => 'regexDevelopers();' %></td>
<span style="font-size: 10px" id="span_softapplication_application_developers">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_work_deposit_project) %></span>
<span style="padding-left: 4px"><%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2',:style => "width:328px;" %></span>
<span><%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0,host: Setting.project_domain}, :target => '_blank' %></span><!-- new_project_path(course: 0, project_type: 0) -->
</tr>
<br/>
<br/>
<br/>
<fieldset style="width: 500px; padding-top: 10px">
<legend>
<%= l(:label_upload_softworkpacket_photo) %>
</legend>
<%#= render_flash_messages %>
<p id="put-bid-form-partial">
<%= render :partial => 'attachments/form' %>
</p>
<p style="font-size: 11px;line-height:normal;">
1、<%= l(:label_upload_softapplication_packets_mustpacketed) %> <br/>
<br>
2、<%= l(:label_upload_softapplication_photo_condition) %>
</p>
</fieldset>
</fieldset></br>
<div class="align-center" style="padding-top: -3px; padding-bottom: 8px">
<input type="button" class="enterprise" value="<%=l(:button_create) %>" onclick="submit_new_softapplication();" >
<%#= submit_tag l(:button_create) %>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
</div>
<%#= error_messages_for 'softapplication' %>
<script type="text/javascript">
//验证作品名称
function regexName()
{
var name = $("#softapplication_name").val();
if(name.length ==0)
{
$("#spane_name_notice").text("作品名称不能为空");
$("#spane_name_notice").css('color','#ff0000');
$("#spane_name_notice").focus();
return false;
}
else if(name.length <= 25)
{
$("#spane_name_notice").text("填写正确");
$("#spane_name_notice").css('color','#008000');
return true;
}
else
{
$("#spane_name_notice").text("作品名称超过25个汉字");
$("#spane_name_notice").css('color','#ff0000');
$("#spane_name_notice").focus();
return false;
}
}
//验证运行平台
function regexWorkdescription()
{
var workDescription = $("#softapplication_android_min_version_available").val();
if(workDescription.length ==0)
{
$("#spane_workdescription_notice").text("运行平台不能为空");
$("#spane_workdescription_notice").css('color','#ff0000');
return false;
}
if(workDescription.length <= 125)
{
$("#spane_workdescription_notice").text("填写正确");
$("#spane_workdescription_notice").css('color','#008000');
return true;
}
else
{
$("#spane_workdescription_notice").text("运行平台超过125个汉字");
$("#spane_workdescription_notice").css('color','#ff0000');
return false;
}
}
//验证开发人员
function regexDevelopers()
{
var workDescription = $("#softapplication_application_developers").val();
if(workDescription.length ==0)
{
$("#span_softapplication_application_developers").text("开发人员不能为空");
$("#span_softapplication_application_developers").css('color','#ff0000');
return false;
}
if(workDescription.length <= 125)
{
$("#span_softapplication_application_developers").text("填写正确");
$("#span_softapplication_application_developers").css('color','#008000');
return true;
}
else
{
$("#span_softapplication_application_developers").text("开发人员超过125个汉字");
$("#span_softapplication_application_developers").css('color','#ff0000');
return false;
}
}
//提交验证
function submit_new_softapplication()
{
if(regexName() && regexWorkdescription() && regexDevelopers())
{
$("#new_softapplication").submit();
}
}
</script>
<%= form_for Softapplication.new, :url => softapplications_path do |f| %>
<fieldset class="contes-new-box" style="padding-left: 36px; line-height: 8px; margin-left: 1px" >
<%= hidden_field_tag 'contest_id', @contest.id %>
<tr style="width:700px; margin-left: -10px;">
<span><%= l(:label_work_name) %></span>
<span class="contest-star"> * </span>:
<td>
<%= f.text_field :name,
:required => true,
:size => 60,
:style => "width:320px;",
:onblur => "regexName();"
%>
</td>
<span style="font-size: 10px;" id="spane_name_notice">(<%= l(:label_workname_lengthlimit) %>)</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_running_platform) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<%= f.text_field :android_min_version_available,
:required => true,
:size => 60,
:style => "width:320px;",
:onblur=>"regexWorkdescription();"
%>
</td>
<span style="font-size: 10px" id="spane_workdescription_notice">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_work_type) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<span>
<%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %>
</span>
<%= f.select :app_type_name,work_type_opttion,
{},
{:style => "width:328px;",:onchange => "selectChange(this)"} %>
<%#= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %>
</td>
<span style="font-size: 10px;display: none" id="other_span">
<%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %>
<input type="text" style="width: 120px;" id="other_input" name = "other_input"/>
</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_work_description) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<%= f.text_field :description,
:required => true,
:size => 60,
:style => "width:320px;"
%>
</td>
<!--span style="font-size: 10px">(<%#= l(:label_workdescription_lengthlimit) %>)</span-->
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_softapplication_developers) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<%= f.text_field :application_developers,
:required => true,
:size => 60,
:style => "width:320px;",
:onblur => 'regexDevelopers();'
%>
</td>
<span style="font-size: 10px" id="span_softapplication_application_developers">
(<%= l(:label_workdescription_lengthlimit) %>)
</span>
</tr>
<br/>
<br/>
<br/>
<tr style="width:800px;">
<span><%= l(:label_work_deposit_project) %></span>
<span style="padding-left: 4px">
<%= select_tag 'project',
options_for_select(select_option_helper(@option)),
:name => 'project',
:class => 'grayline2',
:style => "width:328px;"
%>
</span>
<span>
<!-- modified by longjun -->
<%= link_to l(:label_create_new_projects),
new_project_path(:course => 0, :project_type => 0, :host => Setting.project_domain),
:target => '_blank'
%>
<!-- end longjun -->
</span><!-- new_project_path(course: 0, project_type: 0) -->
</tr>
<br/>
<br/>
<br/>
<fieldset style="width: 500px; padding-top: 10px">
<legend>
<%= l(:label_upload_softworkpacket_photo) %>
</legend>
<%#= render_flash_messages %>
<p id="put-bid-form-partial">
<%= render :partial => 'attachments/form' %>
</p>
<p style="font-size: 11px;line-height:normal;">
1、<%= l(:label_upload_softapplication_packets_mustpacketed) %> <br/>
<br>
2、<%= l(:label_upload_softapplication_photo_condition) %>
</p>
</fieldset>
</fieldset></br>
<div class="align-center" style="padding-top: -3px; padding-bottom: 8px">
<input type="button" class="enterprise" value="<%=l(:button_create) %>" onclick="submit_new_softapplication();" >
<%#= submit_tag l(:button_create) %>
<%= submit_tag l(:button_cancel),
:name => nil,
:onclick => "cancel();",
:type => 'button',
:class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
</div>
<% end %>

View File

@ -5,7 +5,12 @@
<td> <%= textilizable content %></td>
</tr>
<tr>
<td><%= hidden_field_tag 'reference_content', params[:reference_content], :value => content%></td>
<td>
<%= hidden_field_tag 'reference_content',
params[:reference_content],
:value => content
%>
</td>
</tr>
</table>
<% end %>

View File

@ -2,7 +2,9 @@
<%= render_flash_messages %>
<table width="100%" border="0" style="padding-left: 15px">
<td width="15%" class="font_lighter" style="font-size: 15px;"><%= l(:label_bidding_project) %>(<%= contesting_project.count%>)</td> <!--标注参与项目及数量-->
<td width="15%" class="font_lighter" style="font-size: 15px;">
<%= l(:label_bidding_project) %>(<%= contesting_project.count%>)
</td> <!--标注参与项目及数量-->
<% if User.current.logged? %>
<td width="85%">
<div class='icon icon-add'> <!--标注我要参加及添加图标-->
@ -12,4 +14,6 @@
<% end %>
</table>
<%= render :partial=> "list_projects",:locals => {:contesting_project => contesting_project,:contest => @contest }%>
<%= render :partial=> "list_projects",
:locals => {:contesting_project => contesting_project,:contest => @contest }
%>

View File

@ -2,14 +2,23 @@
<%= render_flash_messages %>
<table width="100%" border="0" style="padding-left: 15px">
<td width="15%" class="font_lighter" style="font-size: 15px;"><%= l(:label_contest_softapplication) %>(<%= @contest.contesting_softapplications.count%>)</td> <!--标注参赛应用及数量-->
<td width="15%" class="font_lighter" style="font-size: 15px;">
<%= l(:label_contest_softapplication) %>
(<%= @contest.contesting_softapplications.count%>)
</td> <!--标注参赛应用及数量-->
<% if User.current.logged? %>
<td width="85%">
<div class='icon icon-add'> <!--标注我要参加及添加图标-->
<%= link_to l(:button_contesting_as_application), "javascript:void(0);", onclick: "$('#put-bid-form').toggle();" %>
<%= link_to l(:button_contesting_as_application),
"javascript:void(0);",
onclick: "$('#put-bid-form').toggle();"
%>
</div>
</td>
<% end %>
</table>
<%= render :partial=> "list_softapplications",:locals => {:contesting_softapplication => contesting_softapplication,:contest => @contest }%>
<%= render :partial=> "list_softapplications",
:locals => {:contesting_softapplication => contesting_softapplication,
:contest => @contest }
%>

View File

@ -6,22 +6,44 @@
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
<td rowspan="2">
<% if User.current.logged? %>
<% unless User.current.user_extensions.identity == 1 %>
<%= link_to(l(:label_newtype_contest), {:controller => 'contests', :action => 'new_contest'}, :class => 'icon icon-add', :target => "_blank") %>
<% end %>
<% unless User.current.user_extensions.identity == 1 %>
<!--
modified by longjun
<%=link_to l(:label_newtype_contest), :controller => 'contests', :action => 'new_contest' %>
-->
<%= link_to(l(:label_newtype_contest), contest_new_contest_path, :class => 'icon icon-add', :target => "_blank") %>
<!-- end longjun -->
<% end %>
<% end %>
</td>
<td rowspan="2" >
<div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><a><%= link_to request.host()+"/contests", :controller => 'contests', :action => 'index' %> </a></td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_contest_innovate), :controller => 'contests', :action => 'index' %></td>
<td style="padding-left: 8px">
<a>
<!--
modified by longjun
<%=link_to request.host()+"/contests", :controller => 'contests', :action => 'index' %>
-->
<%= link_to request.host()+"/contests", contests_path %>
<!-- end longjun -->
</a>
</td>
<td >
<%=link_to l(:field_homepage), home_path %> >
<!--
modified by longjun
<%=link_to l(:label_contest_innovate), :controller => 'contests', :action => 'index' %>
-->
<%=link_to l(:label_contest_innovate), :controller => 'contests', :action => 'index' %>
<!-- end longjun -->
</td>
</tr>
</table>
<% end %>

View File

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

View File

@ -1,26 +1,27 @@
<!-- modified by longjun 将or 改成 || -->
$('#reward_result_<%= @contesting_project_id %>').html('<%= j(
if get_prize(@c_p).nil? or get_prize(@c_p) == ""
if get_prize(@c_p).nil? || get_prize(@c_p) == ""
if @contest.deadline < Date.today
puts '未评奖'
end
else
case get_prize(@c_p)
when '-1'
image_tag("/images/bid/special_reward.png")
when '0'
image_tag("/images/bid/first_reward.png")
when '1'
image_tag("/images/bid/second_reward.png")
when '2'
image_tag("/images/bid/third_reward.png")
when '3'
image_tag("/images/bid/forth_reward.png")
when '4'
image_tag("/images/bid/fifth_reward.png")
when '5'
image_tag("/images/bid/qualified.png")
when '-1'
image_tag("/images/bid/special_reward.png")
when '0'
image_tag("/images/bid/first_reward.png")
when '1'
image_tag("/images/bid/second_reward.png")
when '2'
image_tag("/images/bid/third_reward.png")
when '3'
image_tag("/images/bid/forth_reward.png")
when '4'
image_tag("/images/bid/fifth_reward.png")
when '5'
image_tag("/images/bid/qualified.png")
end
end

View File

@ -1,26 +1,28 @@
<!-- modified by longjun 将or 改成 || -->
$('#reward_result_<%= @contesting_softapplication_id %>').html('<%= j(
if get_prize(@c_sa).nil? or get_prize(@c_sa) == ""
if get_prize(@c_sa).nil? || get_prize(@c_sa) == ""
if @contest.deadline < Date.today
puts '未评奖'
end
else
case get_prize(@c_sa)
when '-1'
image_tag("/images/bid/special_reward.png")
when '0'
image_tag("/images/bid/first_reward.png")
when '1'
image_tag("/images/bid/second_reward.png")
when '2'
image_tag("/images/bid/third_reward.png")
when '3'
image_tag("/images/bid/forth_reward.png")
when '4'
image_tag("/images/bid/fifth_reward.png")
when '5'
image_tag("/images/bid/qualified.png")
when '-1'
image_tag("/images/bid/special_reward.png")
when '0'
image_tag("/images/bid/first_reward.png")
when '1'
image_tag("/images/bid/second_reward.png")
when '2'
image_tag("/images/bid/third_reward.png")
when '3'
image_tag("/images/bid/forth_reward.png")
when '4'
image_tag("/images/bid/fifth_reward.png")
when '5'
image_tag("/images/bid/qualified.png")
end
end

View File

@ -1,6 +1,7 @@
<!-- added by bai -->
<p>
<td><%=l(:label_contest_settings)%></td>&nbsp;&nbsp;&nbsp;
<td><%=l(:label_contest_settings)%></td>
&nbsp;&nbsp;&nbsp;
</p>

View File

@ -79,18 +79,35 @@
<%= render_flash_messages %>
<!--参赛步骤-->
<div style="padding-left: 23px; padding-bottom: 10px; color: grey; font-size: 12px">
<div><%= l(:label_wellmeaning_intimation_contentone) %></div>
<div style="margin-left: 59px; padding-top: 2px">1) <%= l(:label_wellmeaning_intimation_contenttwo) %></div>
<div style="margin-left: 59px; padding-top: 2px">2) <%= l(:label_wellmeaning_intimation_contentthree) %></div>
<div>
<%= l(:label_wellmeaning_intimation_contentone) %>
</div>
<div style="margin-left: 59px; padding-top: 2px">
1) <%= l(:label_wellmeaning_intimation_contenttwo) %>
</div>
<div style="margin-left: 59px; padding-top: 2px">
2) <%= l(:label_wellmeaning_intimation_contentthree) %>
</div>
</div>
<% if User.current.logged? %>
<div style="padding-bottom: 10px; line-height: 15px">
<div style="padding-left: 82px; font-size: 14px">
<span><strong><%= l(:label_attending_contest) %></strong></span>
<span><%= link_to l(:label_new_attendingcontest_work), "javascript:void(0);", onclick: "$('#put-project-form').slideToggle();" %></span>
<span>
<%= link_to l(:label_new_attendingcontest_work),
"javascript:void(0);",
onclick: "$('#put-project-form').slideToggle();"
%>
</span>
</div>
</div>
<!-- modified by longjun, 登录之后才能参赛 -->
<div id="put-project-form" style=" padding-left: 83px; width: 88%">
<%= render "new_softapplication" %>
</div>
<!-- end longjun -->
<% else %>
<div style="font-size: 14px;margin:10px;padding-left: 73px">
<%= l(:label_user_login_attending_contest) %>
@ -98,10 +115,7 @@
</div>
<% end %>
<!--点击新建参赛作品弹出框新建参赛作品并关联到竞赛中-->
<div id="put-project-form" style=" padding-left: 83px; width: 88%">
<%= render "new_softapplication" %>
</div>

View File

@ -2,9 +2,18 @@
<div style="margin-left: 20px;">
<span class="portrait"><%= image_tag(url_to_avatar(@contest.author), :class => "avatar")%></span>
<span class="body">
<h3><%= link_to(@contest.author.lastname+@contest.author.firstname, user_path(@contest.author))%><%= @contest.name %></h3>
<h3>
<%= link_to(@contest.author.lastname+@contest.author.firstname,
user_path(@contest.author))
%>
<%= @contest.name %></h3>
<p>
<strong><%= l(:label_bids_reward_method) %><span class="bonus"><%= @contest.budget%></span></strong>
<strong>
<%= l(:label_bids_reward_method) %>
<span class="bonus">
<%= @contest.budget%>
</span>
</strong>
</p>
<div class="bid_description" style="width: 100%;word-break:break-all;word-wrap: break-word;">
<%= @contest.description %>
@ -15,7 +24,11 @@
</div>
<span id="praise_tread" style="float: right">
<%= render :partial => "/praise_tread/praise_tread",
:locals => {:obj => @contest,:show_flag => true,:user_id =>User.current.id,:horizontal => false}%>
:locals => {:obj => @contest,
:show_flag => true,
:user_id =>User.current.id,
:horizontal => false}
%>
</span>
</span>
</div>
@ -23,7 +36,9 @@
<div style="clear: both;"></div>
<div id="history">
<%= render :partial => 'history', :locals => { :contest => @contest, :journals => @jour, :state => false} %>
<%= render :partial => 'history',
:locals => { :contest => @contest, :journals => @jour, :state => false}
%>
</div>
<div class="pagination" style="float:left;">

View File

@ -6,9 +6,12 @@
<td colspan="2" valign="top" width="50" ><%= image_tag(url_to_avatar(user), :class => "avatar") %></td>
<td><table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><strong><%= content_tag "div", link_to_user(user), :class => "project_avatar_name" %>
<td colspan="2" valign="top">
<strong>
<%= content_tag "div", link_to_user(user), :class => "project_avatar_name" %>
</strong>
</td>
</tr>
</tr>
<tr>
<td colspan="2" width="580px" ><p class="font_description">
<% unless user.memberships.empty? %>

View File

@ -1,5 +1,9 @@
<!--add by bai-->
<h3><%=link_to l(:label_x_join_in_contest, :count => @contest.join_in_contests.count)+"("+@contest.join_in_contests(@user.id).count.to_s+")", :controller=>"contests", :action=>"show_participator"%></h3>
<h3>
<%=link_to l(:label_x_join_in_contest, :count => @contest.join_in_contests.count)+"("+@contest.join_in_contests(@user.id).count.to_s+")",
show_participator_contest_path
%>
</h3>
<div class="inf_user_image">
<% for temp in @contest.join_in_contests %>
<% user = temp.user %>

View File

@ -60,15 +60,28 @@
<!--我要竞标弹出框-->
<div id = 'flash' style="float:left; width: 100%; display: none" ></div>
<div id="put-bid-form" style="display: none">
<%= form_for "contest_for_save", :remote=>true, :url => {:controller => 'contests', :action => 'add'}, :update => "contesting_project_list", :complete => '$("#put-bid-form").hide();' do |f| %>
<%= form_for "contest_for_save", :remote=>true,
:url => {:controller => 'contests', :action => 'add'},
:update => "contesting_project_list",
:complete => '$("#put-bid-form").hide();' do |f|
%>
<table id="contesting_table" border="0" width="100%" style="margin-left: 40px;"> <!--该table为点击我要参加后弹出的-->
<tr>
<td><%= select_tag 'contest', options_for_select(select_option_helper(@option)), :name => 'contest', :class => 'grayline' %></td>
<td>
<%= select_tag 'contest',
options_for_select(select_option_helper(@option)),
:name => 'contest',
:class => 'grayline'
%>
</td>
<div id="prompt_create_pro">
<td>
<p>
<div class="font_lighter" style="font-size: 13px;">
<%= link_to l(:label_create_new_projects), new_project_path(course: 0, project_type: 0), :target=>'_blank'%> <!--跳转到project的new.html.erb-->
<%= link_to l(:label_create_new_projects),
new_project_path(course: 0, project_type: 0),
:target=>'_blank'
%> <!--跳转到project的new.html.erb-->
</div>
</p>
</td>
@ -81,12 +94,20 @@
<tr>
<td align="right">
<%= submit_tag l(:button_add), :name => nil , :class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'"%>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
<%= submit_tag l(:button_add),
:name => nil ,
:class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'"
%>
<%= submit_tag l(:button_cancel),
:name => nil,
:onclick => "cancel();",
:type => 'button',
:class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'"
%>
</td>
</tr>
</table>
@ -94,7 +115,9 @@
</div>
<% end %>
<div id='contesting_project_list'>
<%= render :partial => 'project_list', :locals => {:contesting_project => @contesting_project,:contest => @contest} %>
<%= render :partial => 'project_list',
:locals => {:contesting_project => @contesting_project,:contest => @contest}
%>
</div>

View File

@ -60,15 +60,29 @@
<!--我要以发布应用的形式参加竞赛-弹出框-->
<div id = 'flash' style="float:left; width: 100%; display: nonea" ></div>
<div id="put-bid-form" style="display: none">
<%= form_for "contest_for_save", :remote=>true, :url => {:controller => 'contests', :action => 'add_softapplication'}, :update => "contesting_softapplication_list", :complete => '$("#put-bid-form").hide();' do |f| %>
<%= form_for "contest_for_save",
:remote=>true,
:url => {:controller => 'contests', :action => 'add_softapplication'},
:update => "contesting_softapplication_list",
:complete => '$("#put-bid-form").hide();' do |f|
%>
<table id="contesting_table" border="0" width="100%" style="margin-left: 40px;"> <!--该table为点击我要参加后弹出的-->
<tr>
<td><%= select_tag 'contest', options_for_select(select_option_app_helper(@softapplication)), :name => 'contest', :class => 'grayline' %></td>
<td>
<%= select_tag 'contest',
options_for_select(select_option_app_helper(@softapplication)),
:name => 'contest',
:class => 'grayline'
%>
</td>
<div id="prompt_create_pro">
<td>
<p>
<div class="font_lighter" style="font-size: 13px;">
<%= link_to l(:label_release_softapplication), new_softapplication_path(:target=>'_blank'), :target=>'_blank' %>
<%= link_to l(:label_release_softapplication),
new_softapplication_path(:target=>'_blank'),
:target=>'_blank'
%>
</div>
</p>
</td>
@ -81,12 +95,20 @@
<tr>
<td align="right">
<%= submit_tag l(:button_add), :name => nil , :class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'"%>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
:type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
<%= submit_tag l(:button_add),
:name => nil ,
:class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'"
%>
<%= submit_tag l(:button_cancel),
:name => nil,
:onclick => "cancel();",
:type => 'button',
:class => "enterprise",
:onmouseout => "this.style.backgroundPosition = 'left top'",
:onmouseover => "this.style.backgroundPosition = 'left -30px'"
%>
</td>
</tr>
</table>

View File

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

View File

@ -10,7 +10,7 @@
</div>
<div class="forums-index-content">
<p ><%= link_to h(forum.name), forum_path(forum) %></p>
<p ><%= forum.description%></p>
<p ><%= textAreailizable forum.description%></p>
<p ><%= authoring forum.created_at, forum.creator %></p></div>
<div class="forums-index-count">
<table class="forums-count-color"><tr class="forums-count-color" align="center"><td><%= link_to (forum.memo_count), forum_path(forum) %></td><td><%= link_to (forum.topic_count), forum_path(forum) %></td></tr>

View File

@ -1,56 +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| %>
<!--<#% if @memo.errors.any? %>
<div id="error_explanation">
<h2><#%= pluralize(@memo.errors.count, "error") %> prohibited this memo from being saved:</h2>
<ul>
<#% @memo.errors.full_messages.each do |msg| %>
<li><#%= msg %></li>
<#% end %>
</ul>
</div>
<#% end %> -->
<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} %>

View File

@ -1,235 +1,235 @@
<%
@nav_dispaly_contest_label = 1
@nav_dispaly_store_all_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', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= 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="">
<!-- added by bai -->
<div class="top-content">
<table>
<tr>
<td class="info_font" style="width: 240px; color: #15bccf"><%=l(:label_contest_innovate_community)%></td>
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="250px">
<div class="project-search">
<%= form_tag(:controller => 'bids', :action => 'contest', :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<%= hidden_field_tag 'reward_type', @bid.reward_type %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><%=link_to request.host()+"/contest", :controller => 'bids', :action => 'contest' %></td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_contest_innovate), :controller => 'bids', :action => 'contest' %> >
<span><%= link_to @bid.name, bid_path %></span></td>
</tr>
</table>
</div>
<!-- end -->
<div id="sidebar">
<div class="main_context">
<div class="spaceleft">
<div class="inf_user_image">
<table>
<tr>
<td align="left" width="100px">
<%= image_tag(url_to_avatar(@user), :class => "avatar2") %>
</td>
<td>
<table>
<tr>
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= h @bid.name %></td>
</tr>
<% if User.current.login? %> <!--added by linchun-->
<tr colspan='3'>
<td valign="middle">
<span style="display:block; margin-left:20px;"><%= join_in_contest(@bid, User.current)%></span>
<span style="display:block; margin-left:20px;"><span class="icon-fav icon"></span><%= watcher_link(@bid, User.current) %></span>
</td>
</tr>
<% end %>
</table>
<!-- added by bai 增加了竞赛的配置 -->
<% if User.current.logged? %>
<% if @bid.author.id == User.current.id %>
<%= link_to l(:label_contest_modify_settings), {:controller => 'bids', :action => 'settings', :id => @bid} %>
<% end %>
<% end %>
</td>
</table>
</div>
<!-- added by bai 增加参与人和参与项目的数量显示 -->
<div class="user_fans">
<table width="240" border="0">
<tr align="center" width="80px">
<td class="font_index"><%=link_to "#{@bid.join_in_contests.count}",:controller => "bids",
:action => "show_participator" %></td>
<td class="font_index"><%=link_to "#{@bid.projects.where('is_public=1').count}", :controller => 'bids',
:action => 'show_project' %></td>
<tr class="font_aram">
<td align="center" width="70px"> <%= l(:label_participator) %></td>
<td align="center" width="70px"> <%= l(:label_bidding_project) %></td>
</tr>
</table>
<div class="user_underline"></div>
</div>
<!-- end -->
<div class="inf_user_image">
<table>
<tr>
<td><%= l(:lable_contest_user) %><%= link_to(@user.name, user_path(@user))%></td>
</tr>
<!-- end -->
<tr>
<td><%= l(:label_bids_reward_method) %><%= @bid.budget%></td>
</tr>
<tr>
<td><%= l(:label_limit_time) %> : <%= @bid.deadline%></td>
</tr>
</table>
</div>
<div class="user_underline"></div>
<!--description-->
<div class="inf_user_context">
<div class="font_title_left">
<%= l(:label_project_overview) %>
</div>
<div style="padding-bottom: 8px">
<% if @bid.description.size>0 %>
<div class="font_lighter_sidebar">
<%= textilizable @bid.description %>
</div>
<% else %>
<div class="font_lighter_sidebar">
<%= l(:label_course_description_no) %>
</div>
<% end %>
<div class="created_on_project">
<strong style="color: #068d9c"><%= l(:label_create_time) %></strong><%= format_time(@bid.created_on) %>
</div>
</div>
<div class="user_underline"></div>
</div>
<!--tags-->
<div class="user_fans">
<div class="user_underline"></div>
<table style="font-family:微软雅黑">
<tr>
<td><!-- added by william -for tag -->
<%= render :partial => 'tags/tag', :locals => {:obj => @bid, :object_flag => "4"}%>
</td>
</tr>
</table>
</div>
<div class="user_fans">
<div class="user_underline"></div>
<div class="font_title_left">
<strong><%= l(:label_x_followers, :count => @bid.watcher_users.count) %></strong>
<% if show_more_fans?(@bid) %>
<span style="display:inline-block; font-size: 12px; float:right; margin-bottom: -4px;"><%= link_to l(:label_more), :controller => 'bids', :action => 'show_bid_user'%></span>
<% end %>
</div>
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px">
<%= show_bid_fans_picture(@bid)%>
</td>
</tr>
</table>
</div>
</div>
<!-- participate -->
<div class="user_fans">
<div class="user_underline"></div>
<div class="font_title_left">
<strong><%= l(:label_bidding_project) %></strong>
<% if show_more_bid_project?(@bid) %>
<span style="display:inline-block; font-size: 12px; float:right; margin-bottom: -4px;"><%= link_to l(:label_more), :controller => 'bids', :action => 'show_project'%></span>
<% end %>
</div>
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px">
<%= show_bid_project(@bid) %>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<!-- end -->
<div class="user_underline"></div>
<!--fans fq-->
<div class="user_fans">
<div class="font_title_left">
<strong><%= l(:label_x_join_in_contest, :count => @bid.join_in_contests.count) %></strong>
<% if show_more_participate?(@bid) %>
<span style="font-size: 12px; display: inline; float: right;" >
<%= link_to l(:label_more), :controller => "bids", :action => "show_participator"%>
</span>
<% end %>
</div>
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px"> <%= show_participate_picture(@bid) %> </td>
</tr>
</table>
</div>
</div>
</div>
<div id="content">
<% if display_main_menu?(@bid) %>
<div class="tabs_new">
<%= render_menu :bid_menu %>
</div>
<% end %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
</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>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>
<%
@nav_dispaly_contest_label = 1
@nav_dispaly_store_all_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', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= 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="">
<!-- added by bai -->
<div class="top-content">
<table>
<tr>
<td class="info_font" style="width: 240px; color: #15bccf"><%=l(:label_contest_innovate_community)%></td>
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="250px">
<div class="project-search">
<%= form_tag(:controller => 'bids', :action => 'contest', :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<%= hidden_field_tag 'reward_type', @bid.reward_type %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><%=link_to request.host()+"/contest", :controller => 'bids', :action => 'contest' %></td>
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_contest_innovate), :controller => 'bids', :action => 'contest' %> >
<span><%= link_to @bid.name, bid_path %></span></td>
</tr>
</table>
</div>
<!-- end -->
<div id="sidebar">
<div class="main_context">
<div class="spaceleft">
<div class="inf_user_image">
<table>
<tr>
<td align="left" width="100px">
<%= image_tag(url_to_avatar(@user), :class => "avatar2") %>
</td>
<td>
<table>
<tr>
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= h @bid.name %></td>
</tr>
<% if User.current.login? %> <!--added by linchun-->
<tr colspan='3'>
<td valign="middle">
<span style="display:block; margin-left:20px;"><%= join_in_contest(@bid, User.current)%></span>
<span style="display:block; margin-left:20px;"><span class="icon-fav icon"></span><%= watcher_link(@bid, User.current) %></span>
</td>
</tr>
<% end %>
</table>
<!-- added by bai 增加了竞赛的配置 -->
<% if User.current.logged? %>
<% if @bid.author.id == User.current.id %>
<%= link_to l(:label_contest_modify_settings), {:controller => 'bids', :action => 'settings', :id => @bid} %>
<% end %>
<% end %>
</td>
</table>
</div>
<!-- added by bai 增加参与人和参与项目的数量显示 -->
<div class="user_fans">
<table width="240" border="0">
<tr align="center" width="80px">
<td class="font_index"><%=link_to "#{@bid.join_in_contests.count}",:controller => "bids",
:action => "show_participator" %></td>
<td class="font_index"><%=link_to "#{@bid.projects.where('is_public=1').count}", :controller => 'bids',
:action => 'show_project' %></td>
<tr class="font_aram">
<td align="center" width="70px"> <%= l(:label_participator) %></td>
<td align="center" width="70px"> <%= l(:label_bidding_project) %></td>
</tr>
</table>
<div class="user_underline"></div>
</div>
<!-- end -->
<div class="inf_user_image">
<table>
<tr>
<td><%= l(:lable_contest_user) %><%= link_to(@user.name, user_path(@user))%></td>
</tr>
<!-- end -->
<tr>
<td><%= l(:label_bids_reward_method) %><%= @bid.budget%></td>
</tr>
<tr>
<td><%= l(:label_limit_time) %> : <%= @bid.deadline%></td>
</tr>
</table>
</div>
<div class="user_underline"></div>
<!--description-->
<div class="inf_user_context">
<div class="font_title_left">
<%= l(:label_project_overview) %>
</div>
<div style="padding-bottom: 8px">
<% if @bid.description.size>0 %>
<div class="font_lighter_sidebar">
<%= textilizable @bid.description %>
</div>
<% else %>
<div class="font_lighter_sidebar">
<%= l(:label_course_description_no) %>
</div>
<% end %>
<div class="created_on_project">
<strong style="color: #068d9c"><%= l(:label_create_time) %></strong><%= format_time(@bid.created_on) %>
</div>
</div>
<div class="user_underline"></div>
</div>
<!--tags-->
<div class="user_fans">
<div class="user_underline"></div>
<table style="font-family:'微软雅黑'">
<tr>
<td><!-- added by william -for tag -->
<%= render :partial => 'tags/tag', :locals => {:obj => @bid, :object_flag => "4"}%>
</td>
</tr>
</table>
</div>
<div class="user_fans">
<div class="user_underline"></div>
<div class="font_title_left">
<strong><%= l(:label_x_followers, :count => @bid.watcher_users.count) %></strong>
<% if show_more_fans?(@bid) %>
<span style="display:inline-block; font-size: 12px; float:right; margin-bottom: -4px;"><%= link_to l(:label_more), :controller => 'bids', :action => 'show_bid_user'%></span>
<% end %>
</div>
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px">
<%= show_bid_fans_picture(@bid)%>
</td>
</tr>
</table>
</div>
</div>
<!-- participate -->
<div class="user_fans">
<div class="user_underline"></div>
<div class="font_title_left">
<strong><%= l(:label_bidding_project) %></strong>
<% if show_more_bid_project?(@bid) %>
<span style="display:inline-block; font-size: 12px; float:right; margin-bottom: -4px;"><%= link_to l(:label_more), :controller => 'bids', :action => 'show_project'%></span>
<% end %>
</div>
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px">
<%= show_bid_project(@bid) %>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<!-- end -->
<div class="user_underline"></div>
<!--fans fq-->
<div class="user_fans">
<div class="font_title_left">
<strong><%= l(:label_x_join_in_contest, :count => @bid.join_in_contests.count) %></strong>
<% if show_more_participate?(@bid) %>
<span style="font-size: 12px; display: inline; float: right;" >
<%= link_to l(:label_more), :controller => "bids", :action => "show_participator"%>
</span>
<% end %>
</div>
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px"> <%= show_participate_picture(@bid) %> </td>
</tr>
</table>
</div>
</div>
</div>
<div id="content">
<% if display_main_menu?(@bid) %>
<div class="tabs_new">
<%= render_menu :bid_menu %>
</div>
<% end %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
</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>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -1,97 +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"><%= textilizable @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">
<%=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>
</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>

View File

@ -63,11 +63,16 @@
<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"><%=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></span>
</div>
<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>
</span>
<% end %>
</div>
</div>
<!--tags-->
<% if User.current.logged? || User.current.admin? %>

View File

@ -1,245 +1,240 @@
<%
@nav_dispaly_contest_label = 1
@nav_dispaly_store_all_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', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= 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" class="">
<div class="top-content">
<table>
<tr>
<td class="info_font" style="width: 240px; color: #15bccf"><%=l(:label_contest_innovate_community)%></td>
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="250px">
<div class="project-search">
<%= form_tag({controller: 'contests', action: 'index'}, method: :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><%=link_to request.host()+"/contests", :controller=>'contests', :action=>'index' %></td>
<td ><%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:label_contest_innovate), :controller=>'contests', :action=>'index' %> >
<span><%= link_to @contest.name, show_contest_contest_path(@contest) %></span>
</td>
</tr>
</table>
</div>
<div id="sidebar">
<div class="main_context">
<div class="spaceleft">
<div class="inf_user_image">
<table>
<tr>
<td align="left" width="100px">
<%= image_tag(url_to_avatar(@user), :class => "avatar2") %>
</td>
<td>
<table>
<tr>
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= link_to @contest.name, show_contest_contest_path(@contest) %></td>
</tr>
<% if User.current.login? %>
<tr colspan='3'>
<td valign="middle">
<!-- <span style="display:block; margin-left:20px; margin-bottom: 5px"><%= join_in_competition(@contest, User.current)%></span> -->
<span style="display:block; margin-left:20px;"><%= new_watcher_link(@contest, User.current) %></span>
</td>
</tr>
<% end %>
<!-- 竞赛的配置 -->
<% if User.current.logged? %>
<% if (@contest.author.id == User.current.id) || User.current.admin? %>
<tr colspan='3'>
<td valign="middle">
<span style="display:block; margin-left:20px;"><%= link_to l(:label_contest_modify_settings), {:controller => 'contests', :action => 'settings', :id => @contest} %></span>
</td>
</tr>
<tr colspan='3'>
<td valign="middle">
<span style="display:block; margin-left:20px;"><%= link_to l(:label_contest_delete), {:controller => 'contests', :action => 'destroy_contest', :id => @contest}, data: { confirm: '你确定要删除该竞赛吗?' }, method: :delete %></span>
</td>
</tr>
<% end %>
<% end %>
</table>
</td>
</tr>
</table>
</div>
<!-- 参与人和参与项目的数量显示 -->
<div class="user_fans">
<table width="240" border="0">
<tr align="center" width="80px">
<!--关注人数-->
<td class="font_index">
<%=link_to "#{@contest.watcher_users.count}",show_project_contest_path(@contest) %>
</td>
<!--参赛作品数量-->
<td class="font_index">
<% if @contest.id == 2 or @contest.id == 3 or @contest.id == 6 %>
<%=link_to "#{@contest.projects.where('is_public=1').count}" %>
<% else %>
<%=link_to "#{@contest.contesting_softapplications.count}",show_attendingcontest_contest_path(@contest) %>
<% end %>
</td>
</tr>
<tr class="font_aram">
<!-- <td align="center" width="70px"> <%= l(:label_participate) %></td> -->
<td align="center" width="70px"> <%= l(:label_contest_watchers) %></td>
<td align="center" width="70px"> <%= l(:label_contest_work) %></td>
</tr>
</table>
<div class="user_underline"></div>
</div>
<div class="inf_user_image">
<table>
<tr>
<td><%= l(:lable_contest_user) %>:&nbsp;<%= link_to(@user.name, user_path(@user))%></td>
</tr>
<tr>
<td><%= l(:label_bids_reward_method) %><%= @contest.budget%></td>
</tr>
<tr>
<td><%= l(:label_limit_time) %> : <%= @contest.deadline%></td>
</tr>
</table>
</div>
<div class="user_underline"></div>
<div class="inf_user_context">
<div class="font_title_left">
<%= l(:label_project_overview) %>
</div>
<div style="padding-bottom: 8px">
<% if @contest.description.size>0 %>
<div class="font_lighter_sidebar">
<%= textilizable @contest.description %>
</div>
<% else %>
<div class="font_lighter_sidebar">
<%= l(:label_contest_description_no) %>
</div>
<% end %>
<div class="created_on_project">
<strong style="color: #068d9c"><%= l(:label_create_time) %></strong><%= format_time(@contest.created_on) %>
</div>
<!-- <% if User.current.logged? %>
<% if @contest.author.id == User.current.id %>
<div>
<%= link_to '删除', {:controller => 'contests', :action => 'destroy_contest', :id => @contest}, data: { confirm: '你确定要删除该竞赛吗?' } %>
</div>
<% end %>
<% end %> -->
</div>
<div class="user_underline"></div>
</div>
<!--标签-->
<div class="user_fans">
<div class="user_underline"></div>
<table style="font-family:微软雅黑">
<tr>
<td>
<%= render :partial => 'tags/tag', :locals => {:obj => @contest, :object_flag => "7"}%>
</td>
</tr>
</table>
</div>
<!--关注-->
<div class="user_fans">
<div class="user_underline"></div>
<div class="font_title_left">
<strong><%= l(:label_x_followers, :count => @contest.watcher_users.count) %></strong>
<!-- <% if show_more_fans?(@contest) %>
<span style="display:inline-block; font-size: 12px; float:right; margin-bottom: -4px;"><%= link_to l(:label_more), :controller => 'contests', :action => 'show_contest_user'%></span>
<% end %> -->
</div>
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px">
<%= show_contest_fans_picture(@contest)%>
</td>
</tr>
</table>
</div>
</div>
<!-- 参赛项目 -->
<!-- 参赛应用-->
</div>
</div>
<div class="user_underline"></div>
<div class="user_underline"></div>
</div>
<div id="content">
<% if display_main_menu?(@contest) %>
<div class="tabs_new">
<ul>
<li><%= link_to l(:label_contest_notification), contest_contestnotifications_path(@contest), :class => link_class(:contestnotifications) %></li>
<li><%= link_to l(:label_contest_joincontest), show_attendingcontest_contest_path(@contest), :class => link_class(:attendingcontests) %></li>
<li><%= link_to l(:label_contest_userresponse), show_contest_contest_path(@contest), :class => link_class(:respond) %></li>
</ul>
</div>
<% end %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
</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>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>
<%
@nav_dispaly_contest_label = 1
@nav_dispaly_store_all_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', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= heads_for_theme %>
<%= 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" class="">
<div class="top-content">
<table>
<tr>
<td class="info_font" style="width: 240px; color: #15bccf"><%=l(:label_contest_innovate_community)%></td>
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="250px">
<div class="project-search">
<%= form_tag({controller: 'contests', action: 'index'}, method: :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><%=link_to request.host()+"/contests", :controller=>'contests', :action=>'index' %></td>
<td><%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:label_contest_innovate), :controller=>'contests', :action=>'index' %> >
<span title="<%= @contest.name%>"><%= link_to h(truncate(@contest.name, length: 20, omission: '...')), show_contest_contest_path(@contest) %></span>
</td>
</tr>
</table>
</div>
<div id="sidebar">
<div class="main_context">
<div class="spaceleft">
<div class="inf_user_image">
<table>
<tr>
<td align="left" width="100px">
<%= image_tag(url_to_avatar(@user), :class => "avatar2") %>
</td>
<td>
<table>
<tr>
<td class="info_font" title="<%= @contest.name%>"><%= link_to h(truncate(@contest.name, length: 13, omission: '...')), show_contest_contest_path(@contest) %></td>
</tr>
<% if User.current.login? %>
<tr colspan='3'>
<td valign="middle">
<!-- <span style="display:block; margin-left:20px; margin-bottom: 5px"><%= join_in_competition(@contest, User.current)%></span> -->
<span style="display:block; margin-left:20px;"><%= new_watcher_link(@contest, User.current) %></span>
</td>
</tr>
<% end %>
<!-- 竞赛的配置 -->
<% if User.current.logged? %>
<% if (@contest.author.id == User.current.id) || User.current.admin? %>
<tr colspan='3'>
<td valign="middle">
<span style="display:block; margin-left:20px;"><%= link_to l(:label_contest_modify_settings), {:controller => 'contests', :action => 'settings', :id => @contest} %></span>
</td>
</tr>
<tr colspan='3'>
<td valign="middle">
<span style="display:block; margin-left:20px;"><%= link_to l(:label_contest_delete), {:controller => 'contests', :action => 'destroy_contest', :id => @contest}, data: { confirm: '你确定要删除该竞赛吗?' }, method: :delete %></span>
</td>
</tr>
<% end %>
<% end %>
</table>
</td>
</tr>
</table>
</div>
<!-- 参与人和参与项目的数量显示 -->
<div class="user_fans">
<table width="240" border="0">
<tr align="center" width="80px">
<!--关注人数-->
<td class="font_index">
<span id="watcher_count_span">
<%=link_to "#{@contest.watcher_users.count}",show_project_contest_path(@contest) %>
</span>
</td>
<!--参赛作品数量-->
<td class="font_index">
<% if @contest.id == 2 or @contest.id == 3 or @contest.id == 6 %>
<%=link_to "#{@contest.projects.where('is_public=1').count}" %>
<% else %>
<%=link_to "#{@contest.contesting_softapplications.count}",show_attendingcontest_contest_path(@contest) %>
<% end %>
</td>
</tr>
<tr class="font_aram">
<!-- <td align="center" width="70px"> <%= l(:label_participate) %></td> -->
<td align="center" width="70px"> <%= l(:label_contest_watchers) %></td>
<td align="center" width="70px"> <%= l(:label_contest_work) %></td>
</tr>
</table>
<div class="user_underline"></div>
</div>
<div class="inf_user_image">
<table>
<tr>
<td><%= l(:lable_contest_user) %>:&nbsp;<%= link_to(@user.name, user_path(@user))%></td>
</tr>
<tr>
<td><%= l(:label_bids_reward_method) %><%= @contest.budget%></td>
</tr>
<tr>
<td><%= l(:label_limit_time) %> : <%= @contest.deadline%></td>
</tr>
</table>
</div>
<div class="user_underline"></div>
<div class="inf_user_context">
<div class="font_title_left">
<%= l(:label_project_overview) %>
</div>
<div style="padding-bottom: 8px">
<% if @contest.description.size>0 %>
<div class="font_lighter_sidebar">
<%= textilizable @contest.description %>
</div>
<% else %>
<div class="font_lighter_sidebar">
<%= l(:label_contest_description_no) %>
</div>
<% end %>
<div class="created_on_project">
<strong style="color: #068d9c"><%= l(:label_create_time) %></strong><%= format_time(@contest.created_on) %>
</div>
</div>
<div class="user_underline"></div>
</div>
<!--标签-->
<div class="user_fans">
<div class="user_underline"></div>
<table style="font-family:'微软雅黑'">
<tr>
<td>
<%= render :partial => 'tags/tag', :locals => {:obj => @contest, :object_flag => "7"}%>
</td>
</tr>
</table>
</div>
<!--关注-->
<div class="user_fans">
<div class="user_underline"></div>
<div class="font_title_left">
<strong><%= l(:label_x_followers, :count => @contest.watcher_users.count) %></strong>
<!-- <% if show_more_fans?(@contest) %>
<span style="display:inline-block; font-size: 12px; float:right; margin-bottom: -4px;"><%= link_to l(:label_more), :controller => 'contests', :action => 'show_contest_user'%></span>
<% end %> -->
</div>
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px">
<%= show_contest_fans_picture(@contest)%>
</td>
</tr>
</table>
</div>
</div>
<!-- 参赛项目 -->
<!-- 参赛应用-->
</div>
</div>
<div class="user_underline"></div>
<div class="user_underline"></div>
</div>
<div id="content">
<% if display_main_menu?(@contest) %>
<div class="tabs_new">
<ul>
<li><%= link_to l(:label_contest_notification), contest_contestnotifications_path(@contest), :class => link_class(:contestnotifications) %></li>
<li><%= link_to l(:label_contest_joincontest), show_attendingcontest_contest_path(@contest), :class => link_class(:attendingcontests) %></li>
<li><%= link_to l(:label_contest_userresponse), show_contest_contest_path(@contest), :class => link_class(:respond) %></li>
</ul>
</div>
<% end %>
<%= yield %>
<%= call_hook :view_layouts_base_content %>
<div style="clear:both;"></div>
</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>
<%= call_hook :view_layouts_base_body_bottom %>
</body>
</html>

View File

@ -1,165 +1,156 @@
<% @nav_dispaly_project_label = 1
@nav_dispaly_forum_label = 1 %>
<% #@nav_dispaly_project_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 %>
<%= hubspot_head %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>
<!--add by huang-->
<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(projects_search_path, :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><%= link_to request.host()+"/projects", :controller => 'projects', :action => 'index', :project_type => 0 %></td>
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to l(:label_project_deposit),:controller => 'projects', :action => 'index', :project_type => 0 %> > <%=link_to @project, project_path(@project) %></p></td>
</tr>
</table>
</div>
<div id="sidebar">
<div class="spaceleft">
<div class="inf_user_image">
<% @project = Project.find_by_id(@project.id)%>
<table>
<tr>
<td><%= image_tag(url_to_avatar(@project), :class => 'avatar2') %></td>
<td>
<div class="info-course">
<%= link_to @project.name, project_path(@project)%>
</div>
<div>
<% if @project.project_type == 0 %>
<%= l(:label_project_grade)%> :
<%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects',
:action => 'show_projects_score',
:remote => true,
:id => @project.id
}, :style => "color: #EC6300;")%>
<% end %>
<!-- end -->
</div>
<div id="join_exit_project_div">
<%= render 'layouts/join_exit_project' %>
</div>
</td>
</tr>
</table>
</div>
<div class="user_fans">
<table width="240" border="0">
<tr align="center" width="80px">
<% files_count = @project.attachments.count %>
<% @project.versions.each do |version| %>
<% files_count += version.attachments.count %>
<% end %>
<td class="font_index"><%=link_to "#{@project.members.count}", project_member_path(@project) %></td>
<td class="font_index"><%=link_to @project.watcher_users.count, :controller=>"projects", :action=>"watcherlist", :id => @project %></td>
<td class="font_index"><%=link_to "#{@project.issues.count}", project_issues_path(@project) %></td>
<!-- <td class="font_index"><%=link_to files_count, project_files_path(@project) %></td> -->
</tr>
<tr class="font_aram">
<td align="center" width="70px"> <%= l(:label_member) %></td>
<td align="center" width="100px"><%= l(:label_user_watchered) %></td>
<td align="center" width="70px"> <%= l(:label_project_issues) %></td>
<!-- <td align="center" width="58px"><%= l(:label_attachment) %></td> -->
</tr>
</table>
<div class="user_underline"></div>
</div>
<div class="inf_user_context">
<div class="font_title_left">
<%= l(:label_project_overview) %>
</div>
<div style="padding-bottom: 8px">
<div class="font_lighter_sidebar" style="word-break:break-all;word-wrap: break-word;">
<%= textilizable @project.description %>
</div>
<div class="created_on_project">
<strong style="color: #15bccf"><%= l(:label_create_time) %></strong><%= format_time(@project.created_on) %>
</div>
</div>
<div class="user_underline"></div>
</div>
<!--tags-->
<div class="user_fans">
<!-- added by william -for tag -->
<div class="user_tags">
<div id="tags">
<%= render :partial => 'tags/tag', :locals => {:obj => @project,:object_flag => "2"}%>
</div>
</div>
</div>
<!--tool-->
<div class="user_underline"></div>
<div class="tool">
<%= render 'projects/tools_expand' %>
</div>
<div class="user_underline"></div>
</div>
</div>
<div id="content">
<div class="tabs_new">
<%= render_main_menu(@project) %>
</div>
<%= 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>
<%= call_hook :view_layouts_base_body_bottom %>
</div>
</body>
</html>
<% @nav_dispaly_project_label = 1
@nav_dispaly_forum_label = 1 %>
<%#@nav_dispaly_project_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 %>
<%= hubspot_head %>
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
</head>
<!--add by huang-->
<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(projects_search_path, :method => :get) do %>
<%= text_field_tag 'name', params[:name], :size => 20 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<% end %>
</div>
</td>
</tr>
<tr>
<td style="padding-left: 8px"><%= link_to request.host()+"/projects", :controller => 'projects', :action => 'index', :project_type => 0 %></td>
<td><p class="top-content-list"><%=link_to l(:label_home),home_path %> > <%=link_to l(:label_project_deposit),:controller => 'projects', :action => 'index', :project_type => 0 %> > <%=link_to @project, project_path(@project) %></p></td>
</tr>
</table>
</div>
<div id="sidebar">
<div class="spaceleft">
<div class="inf_user_image">
<% @project = Project.find_by_id(@project.id)%>
<table>
<tr>
<td><%= image_tag(url_to_avatar(@project), :class => 'avatar2') %></td>
<td>
<div class="info-course">
<%= link_to @project.name, project_path(@project)%>
</div>
<div>
<% if @project.project_type == 0 %>
<%= l(:label_project_grade)%> :
<%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects',
:action => 'show_projects_score',
:remote => true,
:id => @project.id
}, :style => "color: #EC6300;")%>
<% end %>
<!-- end -->
</div>
<div id="join_exit_project_div">
<%= render 'layouts/join_exit_project' %>
</div>
</td>
</tr>
</table>
</div>
<div class="user_fans">
<table width="240" border="0">
<tr align="center" width="80px">
<% files_count = @project.attachments.count %>
<% @project.versions.each do |version| %>
<% files_count += version.attachments.count %>
<% end %>
<td class="font_index"><%=link_to "#{@project.members.count}", project_member_path(@project) %></td>
<td class="font_index"><%=link_to @project.watcher_users.count, :controller=>"projects", :action=>"watcherlist", :id => @project %></td>
<td class="font_index"><%=link_to "#{@project.issues.count}", project_issues_path(@project) %></td>
<!-- <td class="font_index"><%=link_to files_count, project_files_path(@project) %></td> -->
</tr>
<tr class="font_aram">
<td align="center" width="70px"> <%= l(:label_member) %></td>
<td align="center" width="100px"><%= l(:label_user_watchered) %></td>
<td align="center" width="70px"> <%= l(:label_project_issues) %></td>
<!-- <td align="center" width="58px"><%= l(:label_attachment) %></td> -->
</tr>
</table>
<div class="user_underline"></div>
</div>
<div class="inf_user_context">
<div class="font_title_left">
<%= l(:label_project_overview) %>
</div>
<div style="padding-bottom: 8px">
<div class="font_lighter_sidebar" style="word-break:break-all;word-wrap: break-word;">
<%= textilizable @project.description %>
</div>
<div class="created_on_project">
<strong style="color: #15bccf"><%= l(:label_create_time) %></strong><%= format_time(@project.created_on) %>
</div>
</div>
<div class="user_underline"></div>
</div>
<!--tags-->
<div class="user_fans">
<!-- added by william -for tag -->
<div class="user_tags">
<div id="tags">
<%= render :partial => 'tags/tag', :locals => {:obj => @project,:object_flag => "2"}%>
</div>
</div>
</div>
<!--tool-->
<div class="user_underline"></div>
<div class="tool">
<%= render 'projects/tools_expand' %>
</div>
<div class="user_underline"></div>
</div>
</div>
<div id="content">
<div class="tabs_new">
<%= render_main_menu(@project) %>
</div>
<%= 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>
<%= call_hook :view_layouts_base_body_bottom %>
</div>
</body>
</html>

View File

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

View File

@ -1,51 +1,40 @@
<%= 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"> *&nbsp;&nbsp;</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"> *&nbsp;&nbsp;</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>
<% if !replying && !@message.new_record? && @message.safe_attribute?('board_id') %>
<p><label><%= l(:label_board) %></label><br />
<%# modify by nwb%>
<% if @message.project %>
<%= f.select :board_id, boards_options_for_select(@message.project.boards) %>
<% elsif @message.course %>
<%= f.select :board_id, boards_options_for_select(@message.course.boards) %>
<% end %>
</p>
<% end %>
<p><label for="message_subject"><%= l(:field_description) %><span class="required"> *&nbsp;&nbsp;</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>
<%= 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"> *&nbsp;&nbsp;</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"> *&nbsp;&nbsp;</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"> *&nbsp;&nbsp;</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' %>

View File

@ -1,157 +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 %>

View File

@ -1,154 +1,154 @@
<!--Added by nie-->
<div class="project-block">
<div class="img-tag">
<% if(@project.project_type==1)%>
<% if get_avatar?(project)%>
<%= image_tag(url_to_avatar(project), :class => "avatar2") %>
<% else %>
<%= image_tag('../images/avatars/Project/course.jpg', :class => "avatar2") %>
<% end %>
<% else %>
<%= image_tag(url_to_avatar(project), :class => "avatar2") %>
</div>
<div class="wiki-description">
<p>
<%= textilizable(project.short_description.strip, :project => project) %>
</p>
</div>
<div class="information">
<p class="stats">
<table style="width: 280px;">
<tr>
<td style="width: 40%;text-align: right;font-size: 17px;">
<strong><%= link_to @project.watcher_users.count, project_watcherlist_path(project)%></strong>
</td>
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_x_follow_people,:count =>@project.watcher_users.count)) %>
</td>
</tr>
<tr>
<td style="width: 40%;text-align: right;font-size: 17px;">
<strong><%= link_to "#{@project.members.count}", project_member_path(@project)%></strong>
</td>
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_x_current_contributors, :count => @project.users.count)) %>
</td>
</tr>
<tr>
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
<strong><%= content_tag('span', "#{(@project.repository.nil? || @project.repository.changesets[0].nil?) ? '0' : distance_of_time_in_words(Time.now, @project.repository.changesets[0].committed_on)}", :class => "info") %></strong>
</td>
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_since_last_commits)) %>
</td>
</tr>
<tr>
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
<!-- @project.repository.nil? || @project.project_status.nil? ? '0' : @project.project_status.changesets_count -->
<strong><%= content_tag('span', "#{get_project_score(@project).nil? ? 0:get_project_score(@project).changeset_num}", :class => "info") %></strong>
</td>
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_commit_on)) %>
</td>
</tr>
</table>
</p>
</div>
<% end %>
<% if(@project.project_type==1)%>
</div>
<div class="wiki-description">
<p>
<%= textilizable(project.short_description, :project => project) %>
</p>
</div>
<div class="information">
<!-- p class="stats">
<%#= content_tag('span', @project.watcher_users.count, :class => "info") %>
<%#= content_tag('span', l(:label_x_follow_people,:count =>@project.watcher_users.count)) %>
</p -->
<p class="stats">
<%= content_tag('span', link_to("#{@project.homeworks.count}", homework_project_path(@project)), :class => "info") %><%= content_tag('span', l(:label_x_task, :count => @project.homeworks.count)) %>
</p>
<p class="stats">
<%= content_tag('span', link_to("#{@project.members.count}", member_project_path(@project)), :class => "info") %><%= content_tag('span', l(:label_x_member, :count => @project.members.count)) %>
</p>
<p class="stats">
<% files_count = @project.attachments.count %>
<% @project.versions.each do |version| %>
<% files_count += version.attachments.count %>
<% end %>
<%= content_tag('span', link_to(files_count, file_project_path(@project)), :class => "info") %><%= content_tag('span', l(:label_x_data,:count => files_count)) %>
</p>
</div>
<% end %>
</div>
<div class="add-info-project">
<div class="main-language">
<!-- added by huang -->
<% if(@project.project_type==1)%>
<%= content_tag('span', "#{l(:field_tea_name)}: ") %>
<% else %>
<%= content_tag('span', "#{l(:default_role_manager)}: ") %>
<% end %>
<% @admin = @project.project_infos%>
<% if @admin.size > Setting.show_tags_length.to_i then %>
<% i = 0 %>
<% until i>Setting.show_tags_length.to_i do %>
<%= link_to @admin[i].user.name, user_path(@admin[i].user_id) %>
<% i += 1 %>
<% end %>
<%= link_to l(:label_more_tags), member_project_path(@project) %>
<% else %>
<%= content_tag('a', @admin.collect{|u| link_to(u.user.name, user_path(u.user_id))}.join(", ").html_safe) %>
<% end %>
<%# if @admin.size > 0 %>
<%#= content_tag('a', @admin.collect{|u| link_to(u.user.name, user_path(u.user_id))}.join(", ").html_safe) %>
<%# end %>
<% if(@project.project_type==1)%>
&nbsp;&nbsp;&nbsp;<%= l(:label_course_college) %>
<%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%>
<%= @admin.first.user.user_extensions.occupation %>
<% end %>
<% end %>
</div>
<div class="licences">
<%= content_tag('span', "#{l(:label_create_time)}: ") %><%= content_tag('span', format_time(@project.created_on)) %>
</div>
<!-- added by bai -->
<div class="grade">
<% if @project.project_type !=1 %>
<%= l(:label_project_grade)%>:
<span >
<%= link_to(format("%.2f" , red_project_scores(@project) ).to_i,
{:controller => 'projects',
:action => 'show_projects_score',
:remote => true, :id => @project.id}, :style=>"color: #EC6300;") %>
</span>
<% end %>
</div>
<!-- end -->
<!-- added by liuping -->
</span>
</div>
<div class="tags">
<!-- added by william -for tag -->
<div id="tags">
<%= image_tag( "/images/sidebar/tags.png") %>
<%= render :partial => 'tags/tag_name', :locals => {:obj => @project,:object_flag => "2",:non_list_all => true }%>
</div>
</div>
<!--Added by nie-->
<div class="project-block">
<div class="img-tag">
<% if(@project.project_type==1)%>
<% if get_avatar?(project)%>
<%= image_tag(url_to_avatar(project), :class => "avatar2") %>
<% else %>
<%= image_tag('../images/avatars/Project/course.jpg', :class => "avatar2") %>
<% end %>
<% else %>
<%= image_tag(url_to_avatar(project), :class => "avatar2") %>
</div>
<div class="wiki-description">
<p>
<%= textilizable(project.short_description.strip, :project => project) %>
</p>
</div>
<div class="information">
<p class="stats">
<table style="width: 280px;">
<tr>
<td style="width: 40%;text-align: right;font-size: 17px;">
<strong><%= link_to @project.watcher_users.count, project_watcherlist_path(project)%></strong>
</td>
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_x_follow_people,:count =>@project.watcher_users.count)) %>
</td>
</tr>
<tr>
<td style="width: 40%;text-align: right;font-size: 17px;">
<strong><%= link_to "#{@project.members.count}", project_member_path(@project)%></strong>
</td>
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_x_current_contributors, :count => @project.users.count)) %>
</td>
</tr>
<tr>
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
<strong><%= content_tag('span', "#{(@project.repository.nil? || @project.repository.changesets[0].nil?) ? '0' : distance_of_time_in_words(Time.now, @project.repository.changesets[0].committed_on)}", :class => "info") %></strong>
</td>
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_since_last_commits)) %>
</td>
</tr>
<tr>
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
<!-- @project.repository.nil? || @project.project_status.nil? ? '0' : @project.project_status.changesets_count -->
<strong><%= content_tag('span', "#{get_project_score(@project).nil? ? 0:get_project_score(@project).changeset_num}", :class => "info") %></strong>
</td>
<td style="width: 60%;text-align: left">
<%= content_tag('span', l(:label_commit_on)) %>
</td>
</tr>
</table>
</p>
</div>
<% end %>
<% if(@project.project_type==1)%>
</div>
<div class="wiki-description">
<p>
<%= textilizable(project.short_description, :project => project) %>
</p>
</div>
<div class="information">
<!-- p class="stats">
<%#= content_tag('span', @project.watcher_users.count, :class => "info") %>
<%#= content_tag('span', l(:label_x_follow_people,:count =>@project.watcher_users.count)) %>
</p -->
<p class="stats">
<%= content_tag('span', link_to("#{@project.homeworks.count}", homework_project_path(@project)), :class => "info") %><%= content_tag('span', l(:label_x_task, :count => @project.homeworks.count)) %>
</p>
<p class="stats">
<%= content_tag('span', link_to("#{@project.members.count}", member_project_path(@project)), :class => "info") %><%= content_tag('span', l(:label_x_member, :count => @project.members.count)) %>
</p>
<p class="stats">
<% files_count = @project.attachments.count %>
<% @project.versions.each do |version| %>
<% files_count += version.attachments.count %>
<% end %>
<%= content_tag('span', link_to(files_count, file_project_path(@project)), :class => "info") %><%= content_tag('span', l(:label_x_data,:count => files_count)) %>
</p>
</div>
<% end %>
</div>
<div class="add-info-project">
<div class="main-language">
<!-- added by huang -->
<% if(@project.project_type==1)%>
<%= content_tag('span', "#{l(:field_tea_name)}: ") %>
<% else %>
<%= content_tag('span', "#{l(:default_role_manager)}: ") %>
<% end %>
<% @admin = @project.project_infos%>
<% if @admin.size > Setting.show_tags_length.to_i then %>
<% i = 0 %>
<% until i>Setting.show_tags_length.to_i do %>
<%= link_to @admin[i].user.name, user_path(@admin[i].user_id) %>
<% i += 1 %>
<% end %>
<%= link_to l(:label_more_tags), member_project_path(@project) %>
<% else %>
<%= content_tag('a', @admin.collect{|u| link_to(u.user.name, user_path(u.user_id))}.join(", ").html_safe) %>
<% end %>
<%# if @admin.size > 0 %>
<%#= content_tag('a', @admin.collect{|u| link_to(u.user.name, user_path(u.user_id))}.join(", ").html_safe) %>
<%# end %>
<% if(@project.project_type==1)%>
&nbsp;&nbsp;&nbsp;<%= l(:label_course_college) %>
<%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%>
<%= @admin.first.user.user_extensions.occupation %>
<% end %>
<% end %>
</div>
<div class="licences">
<%= content_tag('span', "#{l(:label_create_time)}: ") %><%= content_tag('span', format_time(@project.created_on)) %>
</div>
<!-- added by bai -->
<div class="grade">
<% if @project.project_type !=1 %>
<%= l(:label_project_grade)%>:
<span >
<%= link_to(format("%.2f" , red_project_scores(@project) ).to_i,
{:controller => 'projects',
:action => 'show_projects_score',
:remote => true, :id => @project.id}, :style=>"color: #EC6300;") %>
</span>
<% end %>
</div>
<!-- end -->
<!-- added by liuping -->
</span>
</div>
<div class="tags">
<!-- added by william -for tag -->
<div id="tags">
<%= image_tag( "/images/sidebar/tags.png") %>
<%= render :partial => 'tags/tag_name', :locals => {:obj => @project,:object_flag => "2",:non_list_all => true }%>
</div>
</div>

View File

@ -1,146 +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>
<!--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>

View File

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

View File

@ -1,97 +1,97 @@
<div class="contextual" style="padding-right: 10px;">
&#171;
<% 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 -%>
&#187;&nbsp;
<%= 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;">
&#171;
<% 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 -%>
&#187;&nbsp;
<%= 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)}") -%>

View File

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

View File

@ -3,10 +3,6 @@
<script type="text/javascript">
$(document).ready(function() {
$("#province").html("<option value='0' selected = true style='display: none;'></option>");
$.ajax({
type :"POST",
url :'/school/get_province',
@ -43,7 +39,7 @@
<script type="text/javascript">
function test(id){
location.href = encodeURI('http://course.trustie.net/?school_id='+id);
location.href = encodeURI('http://<%= Setting.host_course %>/?school_id='+id);
}
</script>
@ -55,7 +51,7 @@
//alert(value);
if(value == "")
{
alert("搜索条件不能为空");
alert("<%= l(:label_search_conditions_not_null) %>");
return;
}
//alert(province);
@ -82,17 +78,17 @@
<div>
<p>
<%= link_to "全部学校",school_index_path %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to l(:label_all_schol),school_index_path %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% if User.current.logged? %>
<a href="http://course.trustie.net">我的学校</a>
<a href="http://<%= Setting.host_course %>"><%= l(:label_my_school) %></a>
<% end %>
</p>
<ul>
<li style="width: 40%; float: left">请选择省份:
<li style="width: 40%; float: left"><%= l(:label_select_province) %>:
<select id="province" name="province" onchange="get_school(this.value)"></select>
</li>
<li style="width: 50%; float: left"><input type="text" id="key_word" name="key_word" onkeydown="word_keydown(event);"/>
<input type="button" class="enterprise" value="搜索" onclick="ssearch()"></li>
<input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="ssearch()"></li>
</ul>
</div>

View File

@ -1,122 +1,122 @@
<script type="text/javascript" language="javascript">
function selectChange(obj)
{
if(obj.value=="其他")
{
//document.getElementById("a").style.display = ""
$("#other_span").show();
}
else
{
$("#other_span").hide();
$("#other_input").val("");
//document.getElementById("a").style.display = "none"
}
}
</script>
<%= form_for(softapplication) do |f| %>
<% if softapplication.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(softapplication.errors.count, "error") %> prohibited this softapplication from being saved:</h2>
<ul>
<% softapplication.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<fieldset class="contes-new-box">
<tr style="width:700px; margin-left: -10px">
<span><%= l(:label_work_name) %></span>
<span class="contest-star"> * </span>: <td ><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td>
<span style="font-size: 10px">(<%= l(:label_workname_lengthlimit) %>)</span>
</tr><br/>
<br />
<br />
<tr style="width:800px;">
<span><%= l(:label_running_platform) %></span>
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %></td>
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr>
<br/>
<br />
<br />
<tr style="width:800px;">
<span><%= l(:label_work_type) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<%#= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %>
<% if work_type_opttion.include?([@softapplication.app_type_name,@softapplication.app_type_name]) %>
<%= f.select :app_type_name,options_for_select(work_type_opttion,@softapplication.app_type_name), {},{:style => "width:410px;",:onchange => "selectChange(this)"} %>
<span style="font-size: 10px;display: none" id="other_span">
<%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %>
<input type="text" style="width: 100px;" id="other_input" name = "other_input"/>
</span>
<% else %>
<%= f.select :app_type_name,options_for_select(work_type_opttion,"其他"), {},{:style => "width:410px;",:onchange => "selectChange(this)"} %>
<span style="font-size: 10px;" id="other_span">
<%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %>
<input type="text" style="width: 100px;" id="other_input" name = "other_input" value="<%= @softapplication.app_type_name%>"/>
</span>
<% end %>
</td>
</tr>
<br/>
<br />
<br />
<tr style="width:800px;">
<span><%= l(:label_work_description) %></span>
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %></td>
<!--<span><%#= l(:label_softapplication_description_condition)%></span>-->
</tr>
<br/>
<br />
<br />
<tr style="width:800px;">
<span><%= l(:label_softapplication_developers) %></span>
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %></td>
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr>
<br/>
<br />
<br />
<tr style="width:800px;">
<span><%= l(:label_work_deposit_project) %></span>
<span style="padding-left: 4px"><%= select_tag 'project', options_for_select(select_option_helper(@option),@softapplication.project_id), :name => 'project', :class => 'grayline3' %></span>
<span><%#= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target=>'_blank'%></span>
</tr>
<br/>
<br />
<br />
<fieldset style="width: 500px">
<p style="padding-left: 60px">
<% options = {:author => true, :deletable => true} %>
<span id="soft_attachments_links">
<%= render :partial => 'attachments/links',
:locals => {:attachments => @softapplication.attachments, :options => options} %>
</span>
</p>
<legend><%=l(:label_upload_softworkpacket_photo)%></legend>
<%= render_flash_messages %>
<p id="put-bid-form-partial">
<%= render :partial => 'attachments/form' %>
</p>
<p style="font-size: 10px;">1、<%=l(:label_upload_softapplication_packets_mustpacketed)%><br>2、<%=l(:label_upload_softapplication_photo_condition)%></p>
<!-- p style="font-size: 10px; color: red"><%#=l(:label_updated_caution)%></p-->
</fieldset>
</fieldset></br>
<div class="align-center"><%= submit_tag l(:button_create), :onclick => "return true" %></div>
<% end %>
<script type="text/javascript" language="javascript">
function selectChange(obj)
{
if(obj.value=="其他")
{
//document.getElementById("a").style.display = ""
$("#other_span").show();
}
else
{
$("#other_span").hide();
$("#other_input").val("");
//document.getElementById("a").style.display = "none"
}
}
</script>
<%= form_for(softapplication) do |f| %>
<% if softapplication.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(softapplication.errors.count, "error") %> prohibited this softapplication from being saved:</h2>
<ul>
<% softapplication.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<fieldset class="contes-new-box">
<tr style="width:700px; margin-left: -10px">
<span><%= l(:label_work_name) %></span>
<span class="contest-star"> * </span>: <td ><%= f.text_field :name, :required => true, :size => 60, :style => "width:400px;" %></td>
<span style="font-size: 10px">(<%= l(:label_workname_lengthlimit) %>)</span>
</tr><br/>
<br />
<br />
<tr style="width:800px;">
<span><%= l(:label_running_platform) %></span>
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:400px;" %></td>
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr>
<br/>
<br />
<br />
<tr style="width:800px;">
<span><%= l(:label_work_type) %></span>
<span class="contest-star"> * </span>:
<td style="width: 100px">
<%#= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %>
<% if work_type_opttion.include?([@softapplication.app_type_name,@softapplication.app_type_name]) %>
<%= f.select :app_type_name,options_for_select(work_type_opttion,@softapplication.app_type_name), {},{:style => "width:410px;",:onchange => "selectChange(this)"} %>
<span style="font-size: 10px;display: none" id="other_span">
<%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %>
<input type="text" style="width: 100px;" id="other_input" name = "other_input"/>
</span>
<% else %>
<%= f.select :app_type_name,options_for_select(work_type_opttion,"其他"), {},{:style => "width:410px;",:onchange => "selectChange(this)"} %>
<span style="font-size: 10px;" id="other_span">
<%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %>
<input type="text" style="width: 100px;" id="other_input" name = "other_input" value="<%= @softapplication.app_type_name%>"/>
</span>
<% end %>
</td>
</tr>
<br/>
<br />
<br />
<tr style="width:800px;">
<span><%= l(:label_work_description) %></span>
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:400px;" %></td>
<!--<span><%#= l(:label_softapplication_description_condition)%></span>-->
</tr>
<br/>
<br />
<br />
<tr style="width:800px;">
<span><%= l(:label_softapplication_developers) %></span>
<span class="contest-star"> * </span>: <td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:400px;" %></td>
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span>
</tr>
<br/>
<br />
<br />
<tr style="width:800px;">
<span><%= l(:label_work_deposit_project) %></span>
<span style="padding-left: 4px"><%= select_tag 'project', options_for_select(select_option_helper(@option),@softapplication.project_id), :name => 'project', :class => 'grayline3' %></span>
<span><%#= link_to '创建项目', new_project_path(course: 0, project_type: 0), :target=>'_blank'%></span>
</tr>
<br/>
<br />
<br />
<fieldset style="width: 500px">
<p style="padding-left: 60px">
<% options = {:author => true, :deletable => true} %>
<span id="soft_attachments_links">
<%= render :partial => 'attachments/links',
:locals => {:attachments => @softapplication.attachments, :options => options} %>
</span>
</p>
<legend><%=l(:label_upload_softworkpacket_photo)%></legend>
<%= render_flash_messages %>
<p id="put-bid-form-partial">
<%= render :partial => 'attachments/form' %>
</p>
<p style="font-size: 10px;">1、<%=l(:label_upload_softapplication_packets_mustpacketed)%><br>2、<%=l(:label_upload_softapplication_photo_condition)%></p>
<!-- p style="font-size: 10px; color: red"><%#=l(:label_updated_caution)%></p-->
</fieldset>
</fieldset></br>
<div class="align-center"><%= submit_tag l(:button_create), :onclick => "return true" %></div>
<% end %>

View File

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

View File

@ -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>&nbsp;&nbsp;&nbsp;+ <%#= 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>&nbsp;&nbsp;&nbsp;+ <%#= 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 %>

View File

@ -1,424 +1,336 @@
<% 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>
<%#= show_activity @state%>
<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' %>
<% if User.current.login == e.user.try(:login) %>
<%# if e.user_id == act.jour.id %>
<tr>
<td colspan="2" valign="top">
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<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>
<%# else %>
<!-- <tr><td colspan="2" valign="top" class="font_lighter"><strong><%#= link_to("#{e.user.name}", user_path(e.user_id)) %> 给 <%#= link_to("#{act.at_user.name if act.at_user}", user_path(act.jour.id)) %> 留言了</strong>&nbsp;</td></tr> -->
<%# end %>
<% else %>
<tr>
<td colspan="2" valign="top">
<strong><%= link_to("#{e.user.name}", user_path(e.user_id)) %></strong>&nbsp;<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>
<% end %>
<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>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp; <%= 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>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp; <%= 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>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= 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>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= 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>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= 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>
<% else %>
<td colspan="2" valign="top">
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= 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>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= 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>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= 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>&nbsp;<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>&nbsp;<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>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= 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>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= 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>&nbsp;
<span class="font_lighter">
<%= l(:label_i_new_activity) %>
</span>&nbsp;
<%= 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>&nbsp;
<span class="font_lighter">
<%= l(:label_new_activity) %>
</span>&nbsp;
<%= 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">
<!--
<div class="issue-list-description">
<div class="wiki">
</div>
</div>
-->
<%= textAreailizable act, :description %>
<!-- <p class="font_description"> <%#= textilizable(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 => '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>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= 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>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= 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 %>
<%# 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)) %>&nbsp;<%= l(:label_quote_my_words) %>
<% elsif e.jour_type == 'User' %>
<%= l(:label_in_users) %><%= link_to(e.jour.firstname, feedback_path(e.jour)) %>&nbsp;<%= l(:label_quote_my_words) %>
<% elsif e.jour_type == 'Project' %>
<%= '在'<<l(:field_project) %><%= link_to(e.jour.name, feedback_path(e.jour)) %>&nbsp;<%= l(:label_reply_plural) %>
<% end %>
<% else %>
<%= l(:label_about_requirement) %><%= link_to(e.jour.name, respond_path(e.jour_id)) %>&nbsp;<%= 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">
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<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>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= 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>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= 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>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= 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>&nbsp;<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>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= 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>&nbsp;
<span class="font_lighter">
<%= l(:label_i_new_activity) %>
</span>&nbsp;
<%= 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>&nbsp;<span class="font_lighter"><%= l(:label_i_new_activity) %></span>&nbsp;<%= 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)) %>&nbsp;<%= l(:label_quote_my_words) %>
<% elsif e.jour_type == 'User' %>
<%= l(:label_in_users) %><%= link_to(e.jour.firstname, feedback_path(e.jour)) %>&nbsp;<%= l(:label_quote_my_words) %>
<% elsif e.jour_type == 'Project' %>
<%= '在'<<l(:field_project) %><%= link_to(e.jour.name, feedback_path(e.jour)) %>&nbsp;<%= l(:label_reply_plural) %>
<% end %>
<% else %>
<%= l(:label_about_requirement) %><%= link_to(e.jour.name, respond_path(e.jour_id)) %>&nbsp;<%= 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>

View File

@ -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) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% 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) %>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% 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 %>

View File

@ -0,0 +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 %>
&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => school_id} %>

View File

@ -196,7 +196,7 @@
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
<h3 style="margin-left: 5px; color: #e8770d;">
<h3 style="margin-left: 5px; color: rgb(21, 188, 207);">
<strong><%=l(:label_notification)%></strong>
</h3>

View File

@ -85,7 +85,7 @@
<%school_course=[]%>
<% end %>
<% if (school_course.count == 0) %>
<span><%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => nil} %></span>
<span><%= render :partial => 'more_course', :locals => {:school_id => nil}%></span>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">
@ -103,11 +103,11 @@
<% else %>
<% if school_course.count < 10 %>
<span>
<%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => nil} %>
<%= render :partial => 'more_course', :locals => {:school_id => nil}%>
</span>
<% else %>
<span>
<%= link_to "更多>>", {:controller => 'courses', :action => 'index', :school_id => @school_id} %>
<%= render :partial => 'more_course', :locals => {:school_id => @school_id}%>
</span>
<% end %>
<div class="d-p-projectlist-box">

View File

@ -29,8 +29,7 @@
</script>
<div class='top_bar'>
<div id="identifier-pannel" style="display:none;">
<div id="identifier-pannel" style="display:none">
<%= link_to image_tag('/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" ), home_path %>
<div class="weixin-content">微信扫码</div>
</div>

View File

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

View File

@ -15,6 +15,16 @@
# along with this program; if not, write tobthe Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# modified by longjun
# 统一route风格
# match 'path', :to => 'controller#action'
# 如果 path = controller#action 则 match 'path'
# Example:
# match 'welcome/course', :to => 'welcome#course' 变成
# match 'welcome/cource'
# 所有的 act: :act 变成 :act => :act
# Example: :via => :get ====> :via => :get
RedmineApp::Application.routes.draw do
@ -31,14 +41,14 @@ RedmineApp::Application.routes.draw do
resources :homework_attach do
collection do
get 'get_homework_member_list'
match 'addjours', via: [:get, :post]
match 'add_jour_reply', via: [:get,:post]
match 'destroy_jour', via: [:get,:post]
match 'comprehensive_evaluation_jour', via: [:get,:post]
match 'addjours', :via => [:get, :post]
match 'add_jour_reply', :via => [:get,:post]
match 'destroy_jour', :via => [:get,:post]
match 'comprehensive_evaluation_jour', :via => [:get,:post]
end
member do
match 'add_homework_users', via:[:get,:post]
match 'destory_homework_users',via:[:get,:post]
match 'add_homework_users', :via => [:get,:post]
match 'destory_homework_users', :via => [:get,:post]
end
end
@ -46,17 +56,17 @@ RedmineApp::Application.routes.draw do
resources :open_source_projects do
collection do
match 'search', via: [:get, :post]
match 'remove_condition', via: [:get, :post]
match 'allbug', via: [:get, :post]
match 'search', :via => [:get, :post]
match 'remove_condition', :via => [:get, :post]
match 'allbug', :via => [:get, :post]
end
resources :relative_memos
member do
match 'master_apply', via: [:get, :post]
match 'accept_master_apply', via: [:get, :post]
match 'refuse_master_apply', via: [:get, :post]
match 'showmemo', via: [:get, :post]
match 'showbug', via: [:get, :post]
match 'master_apply', :via => [:get, :post]
match 'accept_master_apply', :via => [:get, :post]
match 'refuse_master_apply', :via => [:get, :post]
match 'showmemo', :via => [:get, :post]
match 'showbug', :via => [:get, :post]
end
end
@ -75,11 +85,11 @@ RedmineApp::Application.routes.draw do
resources :softapplications do
collection do
match 'new_message', via: :get
match 'search', via: [:get, :post]
match 'new_message', :via => :get
match 'search', :via => [:get, :post]
end
member do
match 'create_message' , via: :post
match 'create_message' , :via => :post
end
end
@ -90,46 +100,44 @@ RedmineApp::Application.routes.draw do
#resources :contestnotifications, :only => [:index, :show, :edit, :update, :destroy]
# match '/contestnotifications/:id/notificationcomments', :to => 'notificationcomments#create', :via => :post
# match '/contestnotifications/:id/notificationcomments/:notificationcomment_id', :to => 'notificationcomments#destroy', :via => :delete
match '/contestnotifications/preview', :controller => 'previews', :action => 'contestnotification', :as => 'preview_contestnotifications', :via => [:get, :post, :put]
match '/contestnotifications/preview', :to => 'previews#contestnotification', :as => 'preview_contestnotifications', :via => [:get, :post, :put]
## new added by linchun #新竞赛相关
resources :contests, only: [:index] do
resources :contestnotifications do
# get 'preview', on: :collection
resources :notificationcomments do
end
resources :notificationcomments
end
collection do
match 'new_contest' , via: :get
match 'join_in_contest' , via: :post
match 'unjoin_in_contest' , via: :delete
match 'create_contest' , via: :post
match 'new_join' , via: :post
match 'new' , via: :post
match 'new_contest' , :via => :get
match 'join_in_contest' , :via => :post
match 'unjoin_in_contest' , :via => :delete
match 'create_contest' , :via => :post
match 'new_join' , :via => :post
match 'new' , :via => :post
end
member do
delete 'destroy_contest'
match 'add_softapplication'
match 'update_contest' , via: [:put]
match 'show_contest' , via: [:get, :post]
match 'show_project' , via: :get
match 'show_softapplication' , via: :get
match 'show_attendingcontest' , via: :get
#match 'show_notification' , via: :get
match 'show_participator' , via: :get
match 'set_reward_project' , via: [:get, :post]
match 'set_reward_softapplication' , via: [:get, :post]
match 'add' , via: [:get, :post]
match 'add_softapplication' , via: [:get, :post]
match 'create' , via: :post
match 'settings' , via: [:get, :post]
match 'update_contest' , :via => [:put]
match 'show_contest' , :via => [:get, :post]
match 'show_project' , :via => :get
match 'show_softapplication' , :via => :get
match 'show_attendingcontest' , :via => :get
#match 'show_notification' , :via => :get
match 'show_participator' , :via => :get
match 'set_reward_project' , :via => [:get, :post]
match 'set_reward_softapplication' , :via => [:get, :post]
match 'add' , :via => [:get, :post]
match 'add_softapplication' , :via => [:get, :post]
match 'create' , :via => :post
match 'settings' , :via => [:get, :post]
end
end
resources :stores do
collection do
match 'search', via: [:get, :post]
match 'search', :via => [:get, :post]
end
end
@ -161,22 +169,25 @@ RedmineApp::Application.routes.draw do
#end
root :to => 'welcome#index', :as => 'home'
# added by longjun
match 'welcome/contest', :via => :get
# end longjun
#added by baiyu
match 'git_usage/ch_usage', :controller => 'git_usage', :action => 'ch_usage', :via => :get, :as => 'ch_usage'
match 'git_usage/en_usage', :controller => 'git_usage', :action => 'en_usage', :via => :get, :as => 'en_usage'
match 'git_usage/ch_usage', :via => :get, :as => 'ch_usage'
match 'git_usage/en_usage', :via => :get, :as => 'en_usage'
#added by nie
match '/projects/search', :controller => 'projects', :action => 'search', :via => [:get, :post]
match '/users/search', :controller => 'users', :action => 'search', :via => [:get, :post]
match '/projects/search', :via => [:get, :post]
match '/users/search', :via => [:get, :post]
#end
match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post]
match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post]
match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register'
match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password'
match 'account/activate', :to => 'account#activate', :via => :get
match 'account/valid_ajax', :to => 'account#valid_ajax', :via => :get
match 'account/register', :via => [:get, :post], :as => 'register'
match 'account/lost_password', :via => [:get, :post], :as => 'lost_password'
match 'account/activate', :via => :get
match 'account/valid_ajax', :via => :get
match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put]
match '/news/preview', :to => 'previews#news', :as => 'preview_news', :via => [:get, :post, :put]
match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put]
match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put]
match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put]
@ -220,13 +231,13 @@ RedmineApp::Application.routes.draw do
#added by young
resources :users do
collection do
match "tag_saveEx" , via: [:get, :post]
match "tag_saveEx" , :via => [:get, :post]
end
member do
match 'user_projects', :to => 'users#user_projects', :via => :get
match 'user_activities', :to => 'users#user_activities', :via => :get, :as => "user_activities"
match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback"
match 'watch_calls', :controller => 'users', :action => 'watch_bids', :via => [:get , :post]
match 'watch_calls', :to => 'users#watch_bids', :via => [:get , :post]
match 'info', :to => 'users#info', :via => [:get , :post], :as => 'user_info'
match 'user_watchlist', :to => 'users#user_watchlist', :via => :get, :as => "user_watchlist" #add by huang
match 'user_fanslist', :to => 'users#user_fanslist', :via => :get, :as => "user_fanslist" #add by huang
@ -235,14 +246,14 @@ RedmineApp::Application.routes.draw do
match 'watch_projects', :to => 'users#watch_projects', :via => :get
# added by bai
match 'show_score', :to => 'users#show_score', :via => :get
match 'topic_score_index', :controller => 'users', :action => 'topic_score_index', :via => [:get, :post]
match 'topic_score_index', :to => 'users#topic_score_index', :via => [:get, :post]
match 'project_score_index', :to => 'users#project_score_index', :via => :get
match 'activity_score_index', :to => 'users#activity_score_index', :via => :get
match 'influence_score_index', :to => 'users#influence_score_index', :via => :get
match 'score_index', :to => 'users#score_index', :via => :get
match 'show_new_score', :to => 'users#show_new_score', :via => :get
match 'topic_new_score_index', :controller => 'users', :action => 'topic_new_score_index', :via => [:get, :post]
match 'topic_new_score_index', :to => 'users#topic_new_score_index', :via => [:get, :post]
match 'project_new_score_index', :to => 'users#project_new_score_index', :via => :get
match 'activity_new_score_index', :to => 'users#activity_new_score_index', :via => :get
match 'influence_new_score_index', :to => 'users#influence_new_score_index', :via => :get
@ -259,21 +270,21 @@ RedmineApp::Application.routes.draw do
end
end
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"
match 'users/:id/user_projects', :controller => 'users', :action => 'user_projects', :via => :get
match 'users/:id/user_projects', :to => 'users#user_projects', :via => :get
#match 'user/:id/watch_calls', :controller => 'users', :action => 'watch_bids', :via => [:get , :post]
#end
match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post]
match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post]
match 'my/page', :controller => 'my', :action => 'page', :via => :get
match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page
match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post
match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post
match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post]
match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get
match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post
match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post
match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post
match 'my/account', :via => [:get, :post]
match 'my/account/destroy', :to => 'my#destroy', :via => [:get, :post]
match 'my/page', :via => :get
match 'my', :to => 'my#index', :via => :get # Redirects to my/page
match 'my/reset_rss_key', :via => :post
match 'my/reset_api_key', :via => :post
match 'my/password', :via => [:get, :post]
match 'my/page_layout', :via => :get
match 'my/add_block', :via => :post
match 'my/remove_block', :via => :post
match 'my/order_blocks', :via => :post
get 'my/page2', :to => 'my#page2', :as => "my_page2"
@ -282,8 +293,8 @@ RedmineApp::Application.routes.draw do
match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete
match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships'
################# added by william
match 'users/tag_save', :to => 'users#tag_save', :via => :post, :as => 'tag'
match 'users/tag_saveEx', :to => 'users#tag_saveEx', :via => [:get, :post]
match 'users/tag_save', :via => :post, :as => 'tag'
match 'users/tag_saveEx', :via => [:get, :post]
post 'watchers/watch', :to => 'watchers#watch', :as => 'watch'
delete 'watchers/watch', :to => 'watchers#unwatch'
@ -308,9 +319,10 @@ RedmineApp::Application.routes.draw do
member do
get 'settings(/:tab)', :action => 'settings', :as => 'settings'
#by young
get 'member', :controller => 'projects', :action => 'member', :as => 'member'
get 'member', :to => 'projects#member', :as => 'member'
get 'file', :action => 'file', :as => 'file'
get 'statistics', :action => 'statistics', :as => 'statistics'
get 'feedback', :action => 'feedback', :as => 'project_feedback'
get 'watcherlist', :action=> 'watcherlist'
match 'user_watcherlist', :to => 'projects#watcherlist', :via => :get, :as => "watcherlist" #add by huang
@ -327,11 +339,11 @@ RedmineApp::Application.routes.draw do
end
#by young
match '/member', :controller => 'projects', :action => 'member', :as => 'member', :via => :get
match '/file', :controller => 'projects', :action => 'file', :as => 'file', :via => :get
match '/statistics', :controller => 'projects', :action => 'statistics', :as => 'statistics', :via => :get
match '/member', :to => 'projects#member', :as => 'member', :via => :get
match '/file', :to => 'projects#file', :as => 'file', :via => :get
match '/statistics', :to => 'projects#statistics', :as => 'statistics', :via => :get
# match '/investor', :controller => 'projects', :action => 'investor', :as => 'investor', :via => :get
match '/homework', :controller => 'projects', :action => 'homework', :as => 'homework', :via => :get
match '/homework', :to => 'projects#homework', :as => 'homework', :via => :get
# match '/activity', :controller => 'activities', :action => 'index', :as => 'activity', :via => :get
# match '/repository', :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :as => 'repository', :via => :get
@ -340,7 +352,7 @@ RedmineApp::Application.routes.draw do
# get 'projects/:project_id/repository', :to => 'repositories#show', :as => 'project_repository'
# match '/show', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get
match '/watcherlist', :controller=>'projects', :action=> 'watcherlist', :as => 'watcherlist', :via => :get #add by huang
match '/watcherlist', :to=>'projects#watcherlist', :as => 'watcherlist', :via => :get #add by huang
# matche '/news', :controller => 'news', :action => 'index', :as => 'news', :via => :get
#end
@ -362,12 +374,12 @@ RedmineApp::Application.routes.draw do
end
end
# issue form update
match 'issues/update_form', :controller => 'issues', :action => 'update_form', :via => [:put, :post], :as => 'issue_form'
match 'issues/update_form', :to => 'issues#update_form', :via => [:put, :post], :as => 'issue_form'
resources :files, :only => [:index, :new, :create] do
collection do
match "getattachtype" , via: [:get, :post]
#match 'getattachtype/:attachtype', :to => 'files#getattachtype', via: [:get, :post]
match "getattachtype" , :via => [:get, :post]
#match 'getattachtype/:attachtype', :to => 'files#getattachtype', :via => [:get, :post]
end
end
@ -399,7 +411,7 @@ RedmineApp::Application.routes.draw do
# get 'create', :via=>[:get, :post]
end
end
match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
match 'wiki/index', :via => :get
resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do
member do
get 'rename'
@ -415,7 +427,7 @@ RedmineApp::Application.routes.draw do
get 'date_index'
end
end
match 'wiki', :controller => 'wiki', :action => 'show', :via => :get
match 'wiki', :to => 'wiki#show', :via => :get
get 'wiki/:id/:version', :to => 'wiki#show', :constraints => {:version => /\d+/}
delete 'wiki/:id/:version', :to => 'wiki#destroy_version'
get 'wiki/:id/:version/annotate', :to => 'wiki#annotate'
@ -434,7 +446,7 @@ RedmineApp::Application.routes.draw do
end
resources :relations, :shallow => true, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy]
end
match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete
match '/issues', :to => 'issues#destroy', :via => :delete
resources :queries, :except => [:show]
@ -520,16 +532,16 @@ RedmineApp::Application.routes.draw do
get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/
get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail'
get 'attachments/autocomplete'
match 'attachments/autocomplete', :to => 'attachments#autocomplete', via: [:post]
match 'attachments/autocomplete', :to => 'attachments#autocomplete', :via => [:post]
post 'attachments/relationfile', to: 'attachments#add_exist_file_to_project', as: 'attach_relation'
post 'attachments/courserelationfile', to: 'attachments#add_exist_file_to_course', as: 'course_attach_relation'
get 'attachments/renderTag/:attchmentId', :to => 'attachments#renderTag', :attchmentId => /\d+/
resources :attachments, :only => [:show, :destroy] do
collection do
match "updateType" , via: [:get, :post]
match "updateFileDense" , via: [:get, :post]
match "renderTag" , via: [:get, :post]
match 'delete_softapplications', via: [:get, :post]
match "updateType" , :via => [:get, :post]
match "updateFileDense" , :via => [:get, :post]
match "renderTag" , :via => [:get, :post]
match 'delete_softapplications', :via => [:get, :post]
end
end
@ -539,10 +551,10 @@ RedmineApp::Application.routes.draw do
end
end
match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users'
match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user'
match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post
match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post
match 'groups/:id/users', :to => 'groups#add_users', :id => /\d+/, :via => :post, :as => 'group_users'
match 'groups/:id/users/:user_id', :to => 'groups#remove_user', :id => /\d+/, :via => :delete, :as => 'group_user'
match 'groups/destroy_membership/:id', :to => 'groups#destroy_membership', :id => /\d+/, :via => :post
match 'groups/edit_membership/:id', :to => 'groups#edit_membership', :id => /\d+/, :via => :post
resources :trackers, :except => :show do
collection do
@ -566,20 +578,20 @@ RedmineApp::Application.routes.draw do
get 'projects/:id/search', :controller => 'search', :action => 'index'
get 'search', :controller => 'search', :action => 'index'
match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post
match 'mail_handler/cancel/:id', :controller => 'mail_handler', :action => 'cancel_mail_notify',:via => :get
match 'mail_handler', :to => 'mail_handler#index', :via => :post
match 'mail_handler/cancel/:id', :to => 'mail_handler#cancel_mail_notify',:via => :get
match 'admin', :controller => 'admin', :action => 'index', :via => :get
match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
match 'admin/users', :controller => 'admin', :action => 'users', :via => :get
match 'admin/first_page_made',:controller => 'admin',:action => 'first_page_made',:via => [:get,:post]
match 'admin/course_page_made',:controller => 'admin',:action => 'course_page_made',:via => [:get,:post]
match 'admin/contest_page_made',:controller => 'admin',:action => 'contest_page_made',:via => [:get,:post]
match 'admin/search', :controller => 'admin', :action => 'search', :via => [:get, :post]
match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
match 'admin/info', :controller => 'admin', :action => 'info', :via => :get
match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get
match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post
match 'admin', :to => 'admin#index', :via => :get
match 'admin/projects', :via => :get
match 'admin/users', :via => :get
match 'admin/first_page_made', :via => [:get,:post]
match 'admin/course_page_made', :via => [:get,:post]
match 'admin/contest_page_made', :via => [:get,:post]
match 'admin/search', :via => [:get, :post]
match 'admin/plugins', :via => :get
match 'admin/info', :via => :get
match 'admin/test_email', :via => :get
match 'admin/default_configuration', :via => :post
resources :auth_sources do
member do
@ -590,8 +602,8 @@ RedmineApp::Application.routes.draw do
end
end
match 'courses/search', :to => 'courses#search'
match '/contests/search', :controller => 'contests', :action => 'search', :via => [:get, :post]
match 'courses/search'
match '/contests/search', :via => [:get, :post]
# add by nwb
# 课程路由设置
resources :courses do
@ -605,11 +617,11 @@ RedmineApp::Application.routes.draw do
post 'finishcourse'
post 'restartcourse'
end
match '/member', :controller => 'courses', :action => 'member', :as => 'member', :via => :get
match '/member', :to => 'courses#member', :as => 'member', :via => :get
resources :boards
resources :files, :only => [:index, :new, :create] do
collection do
match "getattachtype", via: [:get, :post]
match "getattachtype", :via => [:get, :post]
end
end
resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
@ -620,24 +632,24 @@ RedmineApp::Application.routes.draw do
end
resources :news, :except => [:show, :edit, :update, :destroy]
resources :boards
match '/homework', :controller => 'courses', :action => 'homework', :as => 'homework', :via => :get
match '/homework', :to => 'courses#homework', :as => 'homework', :via => :get
end # end of resources :courses
match 'courses/:id/feedback', :to => 'courses#feedback', :via => :get, :as => 'course_feedback'
match '/courses/search', :controller => 'courses', :action => 'search', :via => [:get, :post]
match 'words/:id/leave_course_message', :controller => 'words', :action => 'leave_course_message'
match '/courses/search', :via => [:get, :post]
match 'words/:id/leave_course_message', :to => 'words#leave_course_message'
match 'workflows', :controller => 'workflows', :action => 'index', :via => :get
match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post]
match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post]
match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post]
match 'workflows', :to => 'workflows#index', :via => :get
match 'workflows/edit', :via => [:get, :post]
match 'workflows/permissions', :via => [:get, :post]
match 'workflows/copy', :via => [:get, :post]
match 'settings', :controller => 'settings', :action => 'index', :via => :get
match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post]
match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post], :as => 'plugin_settings'
match 'settings/edit', :via => [:get, :post]
match 'settings/plugin/:id', :to => 'settings#plugin', :via => [:get, :post], :as => 'plugin_settings'
match 'sys/projects', :to => 'sys#projects', :via => :get
match 'sys/projects', :via => :get
match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post
match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get
match 'sys/fetch_changesets', :via => :get
match 'uploads', :to => 'attachments#upload', :via => :post
# Added by Tao
@ -659,20 +671,20 @@ RedmineApp::Application.routes.draw do
############## fq
post 'calls/create', :to => 'bids#create'
delete 'calls/destroy', :to => 'bids#destroy'
match 'calls/new', :controller => 'bids', :action => 'new', :via => [:get , :post]
match 'calls/new', :to => 'bids#new', :via => [:get , :post]
get 'calls/more', :to => 'bids#more'
get 'calls/back', :to=> 'bids#back'
match 'calls/new_bid', :controller => 'bids', :action => 'new_bid'
match 'contest/new_contest', :controller => 'bids', :action => 'new_contest' #huang
match 'calls/:id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid'
match 'calls/:id/show_course', :controller => 'bids', :action => 'show_courseEx', :as => 'course_for_bid' # nwb added
match 'calls/:id/new_exercise_book', :controller => 'homework_attach', :action => 'new', :as => 'new_homework_attach'
match 'calls/:id/add', :controller => 'bids', :action => 'add'
match 'calls/:id/delete', :controller => 'bids', :action => 'delete'
match 'calls/:id/add_homework', :controller => 'bids', :action => 'add_homework', via: :post
match 'calls/:id/new_submit_homework', to: 'bids#new_submit_homework', via: :get, as: 'new_submit_homework'
match 'words/add_project_respond', :controller => 'words', :action => 'add_project_respond'
match 'words/:id/leave_project_message', :controller => 'words', :action => 'leave_project_message'
match 'calls/new_bid', :to => 'bids#new_bid'
match 'contest/new_contest', :to => 'bids#new_contest' #huang
match 'calls/:id/show_project', :to => 'bids#show_project', :as => 'project_for_bid'
match 'calls/:id/show_course', :to => 'bids#show_courseEx', :as => 'course_for_bid' # nwb added
match 'calls/:id/new_exercise_book', :to => 'homework_attach#new', :as => 'new_homework_attach'
match 'calls/:id/add', :to => 'bids#add'
match 'calls/:id/delete', :to => 'bids#delete'
match 'calls/:id/add_homework', :to => 'bids#add_homework', :via => :post
match 'calls/:id/new_submit_homework', :to => 'bids#new_submit_homework', :via => :get, :as => 'new_submit_homework'
match 'words/add_project_respond', :to => 'words#add_project_respond'
match 'words/:id/leave_project_message', :to => 'words#leave_project_message'
match 'projects/:id/feedback', :to => 'projects#feedback', :via => :get, :as => 'project_feedback'
match 'calls/create_bid', :to => 'bids#create_bid'
@ -693,9 +705,9 @@ RedmineApp::Application.routes.draw do
delete 'join_in/join', :to => 'courses#unjoin'
post 'calls/:id/join_in_contest', :to => 'bids#join_in_contest', :as => 'join_in_contest'
delete 'calls/:id/join_in_contest', :to => 'bids#unjoin_in_contest'
match 'calls/:id/show_participator', :to => 'bids#show_participator' #bai
match 'calls/:id/update_contest', :to => 'bids#update_contest' #bai
match 'calls/:id/settings', :to => 'bids#settings' #bai
match 'calls/:id/show_participator', :to => 'bids#show_participator' # bai
match 'calls/:id/update_contest', :to => 'bids#update_contest' # bai
match 'calls/:id/settings', :to => 'bids#settings' # bai
delete 'attachment/:id', :to => 'attachments#delete_homework'
match 'new_join', :to => 'courses#new_join', :as => 'try_join'
@ -707,13 +719,16 @@ RedmineApp::Application.routes.draw do
#added by william
# match 'calls/:id/set_results',:controller => 'bids', :action => 'set_results',:via => [:get,:post],:as => 'set_results'
# match 'calls/:id/set_prizes',:controller => 'bids',:action => 'set_prizes',:as => 'set_prizes'
match 'calls/:id/set_reward',:controller => 'bids',:action => 'set_reward',:as => 'set_reward'
match 'calls/:id/set_reward',:to => 'bids#set_reward',:as => 'set_reward'
# added by young
match 'calls', :controller => 'bids', :action => 'index'
match 'calls', :to => 'bids#index'
match 'calls/:id', :controller => 'bids', :action => 'show', :as => 'respond'
match 'contest', :controller => 'bids', :action => 'contests', :as => 'contest' #modified @20140403
match 'calls/:id', :to => 'bid#show', :as => 'respond'
# modified by longjun
# bids#contests is not exist
# match 'contest', :to => 'bids#contests', :as => 'contest' #modified @20140403
# end longjun
########################
##added by wen##########
@ -738,17 +753,17 @@ RedmineApp::Application.routes.draw do
get 'school/upload_logo', :to => 'school#upload_logo'
######added by nie
match 'tags/show_projects_tags',:to => 'tags#show_projects_tags'
match 'tags/show_projects_tags'
########### added by liuping
match 'tags/add_tag',:to => 'tags#add_tag',:as=>"add_tag"
match 'tags/delete_tag',:to => 'tags#delete_tag',:as=>"add_tag"
match 'tags/show_all',:to => 'tags#show_all'
match 'parise_tread/praise_plus',:to => 'parise_tread#praise_plus',:as=>"praise"
match 'parise_tread/tread_plus',:to => 'parise_tread#tread_plus',:as=>"tread"
match 'tags/delete',:to=>'tags#delete'
match 'tags/remove_tag',:to=>'tags#remove_tag',:as=>"remove_tag"
match 'tags/add_tag', :as=>"add_tag"
match 'tags/delete_tag', :as=>"add_tag"
match 'tags/show_all'
match 'parise_tread/praise_plus', :as=>"praise"
match 'parise_tread/tread_plus', :as=>"tread"
match 'tags/delete'
match 'tags/remove_tag', :as=>"remove_tag"
match 'words/add_brief_introdution', :controller => 'words', :action => 'add_brief_introdution'
match 'words/add_brief_introdution'
Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|

View File

@ -878,18 +878,18 @@ ActiveRecord::Schema.define(:version => 20140826072838) do
create_table "relative_memos", :force => true do |t|
t.integer "osp_id"
t.integer "parent_id"
t.string "subject", :null => false
t.text "content", :limit => 16777215, :null => false
t.string "subject", :null => false
t.text "content", :null => false
t.integer "author_id"
t.integer "replies_count", :default => 0
t.integer "replies_count", :default => 0
t.integer "last_reply_id"
t.boolean "lock", :default => false
t.boolean "sticky", :default => false
t.boolean "is_quote", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "viewed_count_crawl", :default => 0
t.integer "viewed_count_local", :default => 0
t.boolean "lock", :default => false
t.boolean "sticky", :default => false
t.boolean "is_quote", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "viewed_count_crawl", :default => 0
t.integer "viewed_count_local", :default => 0
t.string "url"
t.string "username"
t.string "userhomeurl"
@ -976,11 +976,10 @@ ActiveRecord::Schema.define(:version => 20140826072838) do
t.string "url"
t.string "title"
t.integer "share_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "project_id"
t.integer "user_id"
t.string "description"
end
create_table "softapplications", :force => true do |t|
@ -1086,8 +1085,8 @@ ActiveRecord::Schema.define(:version => 20140826072838) do
t.integer "zip_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "technical_title"
t.integer "identity"
t.string "technical_title"
t.string "student_id"
t.string "teacher_realname"
t.string "student_realname"
@ -1145,6 +1144,9 @@ ActiveRecord::Schema.define(:version => 20140826072838) do
t.integer "active"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "level"
t.integer "file"
t.integer "issue"
end
create_table "user_statuses", :force => true do |t|

View File

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

42
public/no_file_found.html Normal file
View File

@ -0,0 +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>

File diff suppressed because it is too large Load Diff