Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
parent
84e8a40174
commit
66aa72d210
|
@ -1,282 +1,282 @@
|
||||||
# Redmine - project management software
|
# Redmine - project management software
|
||||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#+
|
#+
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
class MyController < ApplicationController
|
class MyController < ApplicationController
|
||||||
layout "users_base"
|
layout "users_base"
|
||||||
before_filter :require_login
|
before_filter :require_login
|
||||||
|
|
||||||
helper :issues
|
helper :issues
|
||||||
helper :users
|
helper :users
|
||||||
helper :custom_fields
|
helper :custom_fields
|
||||||
|
|
||||||
BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
|
BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
|
||||||
'issuesreportedbyme' => :label_reported_issues,
|
'issuesreportedbyme' => :label_reported_issues,
|
||||||
'issueswatched' => :label_watched_issues,
|
'issueswatched' => :label_watched_issues,
|
||||||
'news' => :label_news_latest,
|
'news' => :label_news_latest,
|
||||||
'calendar' => :label_calendar,
|
'calendar' => :label_calendar,
|
||||||
'documents' => :label_document_plural,
|
'documents' => :label_document_plural,
|
||||||
'timelog' => :label_spent_time
|
'timelog' => :label_spent_time
|
||||||
}.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze
|
}.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze
|
||||||
|
|
||||||
DEFAULT_LAYOUT = { 'left' => ['issuesassignedtome'],
|
DEFAULT_LAYOUT = { 'left' => ['issuesassignedtome'],
|
||||||
'right' => ['issuesreportedbyme']
|
'right' => ['issuesreportedbyme']
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
||||||
page
|
page
|
||||||
render :action => 'page'
|
render :action => 'page'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Show user's page
|
# Show user's page
|
||||||
def page
|
def page
|
||||||
@user = User.current
|
@user = User.current
|
||||||
@Issues= Issue.visible.open.
|
@Issues= Issue.visible.open.
|
||||||
where(:assigned_to_id => ([User.current.id] + User.current.group_ids))
|
where(:assigned_to_id => ([User.current.id] + User.current.group_ids))
|
||||||
@limit = 10
|
@limit = 10
|
||||||
@feedback_count = @Issues.count
|
@feedback_count = @Issues.count
|
||||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||||
@offset ||= @feedback_pages.offset
|
@offset ||= @feedback_pages.offset
|
||||||
@curse_attachments = @Issues[@offset, @limit]
|
@curse_attachments = @Issues[@offset, @limit]
|
||||||
|
|
||||||
@blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT
|
@blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT
|
||||||
end
|
end
|
||||||
|
|
||||||
def page2
|
def page2
|
||||||
@limit = 10
|
@limit = 10
|
||||||
@user = User.current
|
@user = User.current
|
||||||
@Issues= Issue.visible.open.
|
@Issues= Issue.visible.open.
|
||||||
where(:assigned_to_id => ([User.current.id] + User.current.group_ids))
|
where(:assigned_to_id => ([User.current.id] + User.current.group_ids))
|
||||||
@feedback_count = @Issues.count
|
@feedback_count = @Issues.count
|
||||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||||
@offset ||= @feedback_pages.offset
|
@offset ||= @feedback_pages.offset
|
||||||
@curse_attachments = @Issues[@offset, @limit]
|
@curse_attachments = @Issues[@offset, @limit]
|
||||||
@state = false
|
@state = false
|
||||||
@blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT
|
@blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Edit user's account
|
# Edit user's account
|
||||||
def account
|
def account
|
||||||
@user = User.current
|
@user = User.current
|
||||||
lg=@user.login
|
lg=@user.login
|
||||||
@pref = @user.pref
|
@pref = @user.pref
|
||||||
diskfile = disk_filename('User', @user.id)
|
diskfile = disk_filename('User', @user.id)
|
||||||
diskfile1 = diskfile + 'temp'
|
diskfile1 = diskfile + 'temp'
|
||||||
if request.post?
|
if request.post?
|
||||||
@user.safe_attributes = params[:user]
|
@user.safe_attributes = params[:user]
|
||||||
@user.pref.attributes = params[:pref]
|
@user.pref.attributes = params[:pref]
|
||||||
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
|
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
|
||||||
@user.login = params[:login]
|
@user.login = params[:login]
|
||||||
unless @user.user_extensions.nil?
|
unless @user.user_extensions.nil?
|
||||||
if @user.user_extensions.identity == 2
|
if @user.user_extensions.identity == 2
|
||||||
@user.firstname = params[:enterprise_name]
|
@user.firstname = params[:enterprise_name]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@se = @user.extensions
|
@se = @user.extensions
|
||||||
@se.school_id = params[:occupation] if params[:occupation]
|
@se.school_id = params[:occupation] if params[:occupation]
|
||||||
@se.gender = params[:gender]
|
@se.gender = params[:gender]
|
||||||
@se.location = params[:province] if params[:province]
|
@se.location = params[:province] if params[:province]
|
||||||
@se.location_city = params[:city] if params[:city]
|
@se.location_city = params[:city] if params[:city]
|
||||||
@se.identity = params[:identity].to_i if params[:identity]
|
@se.identity = params[:identity].to_i if params[:identity]
|
||||||
@se.technical_title = params[:technical_title] if params[:technical_title]
|
@se.technical_title = params[:technical_title] if params[:technical_title]
|
||||||
@se.student_id = params[:no] if params[:no]
|
@se.student_id = params[:no] if params[:no]
|
||||||
|
|
||||||
if @user.save && @se.save
|
if @user.save && @se.save
|
||||||
# 头像保存
|
# 头像保存
|
||||||
if File.exist?(diskfile1)
|
if File.exist?(diskfile1)
|
||||||
if File.exist?(diskfile)
|
if File.exist?(diskfile)
|
||||||
File.delete(diskfile)
|
File.delete(diskfile)
|
||||||
end
|
end
|
||||||
File.open(diskfile1, "rb") do |f|
|
File.open(diskfile1, "rb") do |f|
|
||||||
buffer = f.read(10)
|
buffer = f.read(10)
|
||||||
if buffer != "DELETE"
|
if buffer != "DELETE"
|
||||||
File.open(diskfile1, "rb") do |f1|
|
File.open(diskfile1, "rb") do |f1|
|
||||||
File.open(diskfile, "wb") do |f|
|
File.open(diskfile, "wb") do |f|
|
||||||
buffer = ""
|
buffer = ""
|
||||||
while (buffer = f1.read(8192))
|
while (buffer = f1.read(8192))
|
||||||
f.write(buffer)
|
f.write(buffer)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# File.rename(diskfile + 'temp',diskfile);
|
# File.rename(diskfile + 'temp',diskfile);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# 确保文件被删除
|
# 确保文件被删除
|
||||||
if File.exist?(diskfile1)
|
if File.exist?(diskfile1)
|
||||||
File.delete(diskfile1)
|
File.delete(diskfile1)
|
||||||
end
|
end
|
||||||
|
|
||||||
@user.pref.save
|
@user.pref.save
|
||||||
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
|
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
|
||||||
set_language_if_valid @user.language
|
set_language_if_valid @user.language
|
||||||
flash[:notice] = l(:notice_account_updated)
|
flash[:notice] = l(:notice_account_updated)
|
||||||
redirect_to user_url(@user)
|
redirect_to user_url(@user)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
# 确保文件被删除
|
# 确保文件被删除
|
||||||
if File.exist?(diskfile1)
|
if File.exist?(diskfile1)
|
||||||
File.delete(diskfile1)
|
File.delete(diskfile1)
|
||||||
end
|
end
|
||||||
@user.login = lg
|
@user.login = lg
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# 确保文件被删除
|
# 确保文件被删除
|
||||||
if File.exist?(diskfile1)
|
if File.exist?(diskfile1)
|
||||||
File.delete(diskfile1)
|
File.delete(diskfile1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Destroys user's account
|
# Destroys user's account
|
||||||
def destroy
|
def destroy
|
||||||
@user = User.current
|
@user = User.current
|
||||||
unless @user.own_account_deletable?
|
unless @user.own_account_deletable?
|
||||||
redirect_to my_account_url
|
redirect_to my_account_url
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if request.post? && params[:confirm]
|
if request.post? && params[:confirm]
|
||||||
@user.destroy
|
@user.destroy
|
||||||
if @user.destroyed?
|
if @user.destroyed?
|
||||||
logout_user
|
logout_user
|
||||||
flash.now[:notice] = l(:notice_account_deleted)
|
flash.now[:notice] = l(:notice_account_deleted)
|
||||||
end
|
end
|
||||||
redirect_to home_url
|
redirect_to home_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Manage user's password
|
# Manage user's password
|
||||||
def password
|
def password
|
||||||
@user = User.current
|
@user = User.current
|
||||||
unless @user.change_password_allowed?
|
unless @user.change_password_allowed?
|
||||||
flash.now[:error] = l(:notice_can_t_change_password)
|
flash.now[:error] = l(:notice_can_t_change_password)
|
||||||
redirect_to my_account_url
|
redirect_to my_account_url
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if request.post?
|
if request.post?
|
||||||
if @user.check_password?(params[:password])
|
if @user.check_password?(params[:password])
|
||||||
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
@user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
||||||
|
|
||||||
if @user.save
|
if @user.save
|
||||||
flash.now[:notice] = l(:notice_account_password_updated)
|
flash.now[:notice] = l(:notice_account_password_updated)
|
||||||
redirect_to my_account_url
|
redirect_to my_account_url
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
flash.now[:error] = l(:notice_account_wrong_password)
|
flash.now[:error] = l(:notice_account_wrong_password)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Create a new feeds key
|
# Create a new feeds key
|
||||||
def reset_rss_key
|
def reset_rss_key
|
||||||
if request.post?
|
if request.post?
|
||||||
if User.current.rss_token
|
if User.current.rss_token
|
||||||
User.current.rss_token.destroy
|
User.current.rss_token.destroy
|
||||||
User.current.reload
|
User.current.reload
|
||||||
end
|
end
|
||||||
User.current.rss_key
|
User.current.rss_key
|
||||||
flash[:notice] = l(:notice_feeds_access_key_reseted)
|
flash[:notice] = l(:notice_feeds_access_key_reseted)
|
||||||
end
|
end
|
||||||
redirect_to my_account_url
|
redirect_to my_account_url
|
||||||
end
|
end
|
||||||
|
|
||||||
# Create a new API key
|
# Create a new API key
|
||||||
def reset_api_key
|
def reset_api_key
|
||||||
if request.post?
|
if request.post?
|
||||||
if User.current.api_token
|
if User.current.api_token
|
||||||
User.current.api_token.destroy
|
User.current.api_token.destroy
|
||||||
User.current.reload
|
User.current.reload
|
||||||
end
|
end
|
||||||
User.current.api_key
|
User.current.api_key
|
||||||
flash[:notice] = l(:notice_api_access_key_reseted)
|
flash[:notice] = l(:notice_api_access_key_reseted)
|
||||||
end
|
end
|
||||||
redirect_to my_account_url
|
redirect_to my_account_url
|
||||||
end
|
end
|
||||||
|
|
||||||
# User's page layout configuration
|
# User's page layout configuration
|
||||||
def page_layout
|
def page_layout
|
||||||
@user = User.current
|
@user = User.current
|
||||||
@blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup
|
@blocks = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup
|
||||||
@block_options = []
|
@block_options = []
|
||||||
BLOCKS.each do |k, v|
|
BLOCKS.each do |k, v|
|
||||||
unless %w(top left right).detect {|f| (@blocks[f] ||= []).include?(k)}
|
unless %w(top left right).detect {|f| (@blocks[f] ||= []).include?(k)}
|
||||||
@block_options << [l("my.blocks.#{v}", :default => [v, v.to_s.humanize]), k.dasherize]
|
@block_options << [l("my.blocks.#{v}", :default => [v, v.to_s.humanize]), k.dasherize]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add a block to user's page
|
# Add a block to user's page
|
||||||
# The block is added on top of the page
|
# The block is added on top of the page
|
||||||
# params[:block] : id of the block to add
|
# params[:block] : id of the block to add
|
||||||
def add_block
|
def add_block
|
||||||
block = params[:block].to_s.underscore
|
block = params[:block].to_s.underscore
|
||||||
if block.present? && BLOCKS.key?(block)
|
if block.present? && BLOCKS.key?(block)
|
||||||
@user = User.current
|
@user = User.current
|
||||||
layout = @user.pref[:my_page_layout] || {}
|
layout = @user.pref[:my_page_layout] || {}
|
||||||
# remove if already present in a group
|
# remove if already present in a group
|
||||||
%w(top left right).each {|f| (layout[f] ||= []).delete block }
|
%w(top left right).each {|f| (layout[f] ||= []).delete block }
|
||||||
# add it on top
|
# add it on top
|
||||||
layout['top'].unshift block
|
layout['top'].unshift block
|
||||||
@user.pref[:my_page_layout] = layout
|
@user.pref[:my_page_layout] = layout
|
||||||
@user.pref.save
|
@user.pref.save
|
||||||
end
|
end
|
||||||
redirect_to my_page_layout_url
|
redirect_to my_page_layout_url
|
||||||
end
|
end
|
||||||
|
|
||||||
# Remove a block to user's page
|
# Remove a block to user's page
|
||||||
# params[:block] : id of the block to remove
|
# params[:block] : id of the block to remove
|
||||||
def remove_block
|
def remove_block
|
||||||
block = params[:block].to_s.underscore
|
block = params[:block].to_s.underscore
|
||||||
@user = User.current
|
@user = User.current
|
||||||
# remove block in all groups
|
# remove block in all groups
|
||||||
layout = @user.pref[:my_page_layout] || {}
|
layout = @user.pref[:my_page_layout] || {}
|
||||||
%w(top left right).each {|f| (layout[f] ||= []).delete block }
|
%w(top left right).each {|f| (layout[f] ||= []).delete block }
|
||||||
@user.pref[:my_page_layout] = layout
|
@user.pref[:my_page_layout] = layout
|
||||||
@user.pref.save
|
@user.pref.save
|
||||||
redirect_to my_page_layout_url
|
redirect_to my_page_layout_url
|
||||||
end
|
end
|
||||||
|
|
||||||
# Change blocks order on user's page
|
# Change blocks order on user's page
|
||||||
# params[:group] : group to order (top, left or right)
|
# params[:group] : group to order (top, left or right)
|
||||||
# params[:list-(top|left|right)] : array of block ids of the group
|
# params[:list-(top|left|right)] : array of block ids of the group
|
||||||
def order_blocks
|
def order_blocks
|
||||||
group = params[:group]
|
group = params[:group]
|
||||||
@user = User.current
|
@user = User.current
|
||||||
if group.is_a?(String)
|
if group.is_a?(String)
|
||||||
group_items = (params["blocks"] || []).collect(&:underscore)
|
group_items = (params["blocks"] || []).collect(&:underscore)
|
||||||
group_items.each {|s| s.sub!(/^block_/, '')}
|
group_items.each {|s| s.sub!(/^block_/, '')}
|
||||||
if group_items and group_items.is_a? Array
|
if group_items and group_items.is_a? Array
|
||||||
layout = @user.pref[:my_page_layout] || {}
|
layout = @user.pref[:my_page_layout] || {}
|
||||||
# remove group blocks if they are presents in other groups
|
# remove group blocks if they are presents in other groups
|
||||||
%w(top left right).each {|f|
|
%w(top left right).each {|f|
|
||||||
layout[f] = (layout[f] || []) - group_items
|
layout[f] = (layout[f] || []) - group_items
|
||||||
}
|
}
|
||||||
layout[group] = group_items
|
layout[group] = group_items
|
||||||
@user.pref[:my_page_layout] = layout
|
@user.pref[:my_page_layout] = layout
|
||||||
@user.pref.save
|
@user.pref.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
render :nothing => true
|
render :nothing => true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,101 +1,101 @@
|
||||||
<h3><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h3>
|
<h3><%= @author.nil? ? l(:label_activity) : l(:label_user_activity, link_to_user(@author)).html_safe %></h3>
|
||||||
<p class="subtitle">
|
<p class="subtitle">
|
||||||
<%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %>
|
<%= l(:label_date_from_to, :start => format_date(@date_to - @days), :end => format_date(@date_to-1)) %>
|
||||||
</p>
|
</p>
|
||||||
<div id="activity">
|
<div id="activity">
|
||||||
<% @events_by_day.keys.sort.reverse.each do |day| %>
|
<% @events_by_day.keys.sort.reverse.each do |day| %>
|
||||||
<h3></h3>
|
<h3></h3>
|
||||||
<div>
|
<div>
|
||||||
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
|
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
|
||||||
<div class="issue-note">
|
<div class="issue-note">
|
||||||
<table width="660px" border="0" align="center">
|
<table width="660px" border="0" align="center">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top" width="50" >
|
<td colspan="2" valign="top" width="50" >
|
||||||
<!--img src="/images/new/user.jpg" width="40" height="40"/-->
|
<!--img src="/images/new/user.jpg" width="40" height="40"/-->
|
||||||
<%= image_tag(url_to_avatar(e.event_author), :class => "avatar") %>
|
<%= image_tag(url_to_avatar(e.event_author), :class => "avatar") %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<table width="580px" border="0">
|
<table width="580px" border="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top">
|
<td colspan="2" valign="top">
|
||||||
<strong>
|
<strong>
|
||||||
<%= h(e.project) if @project.nil? || @project != e.project %>
|
<%= h(e.project) if @project.nil? || @project != e.project %>
|
||||||
</strong>
|
</strong>
|
||||||
<span class="font_lighter">
|
<span class="font_lighter">
|
||||||
<%= l(:label_new_activity) %>
|
<%= l(:label_new_activity) %>
|
||||||
</span>
|
</span>
|
||||||
<%= link_to format_activity_title(e.event_title), e.event_url %>
|
<%= link_to format_activity_title(e.event_title), e.event_url %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" width="580px" >
|
<td colspan="2" width="580px" >
|
||||||
<p class="font_description">
|
<p class="font_description">
|
||||||
<%= format_activity_description(e.event_description) %>
|
<%= format_activity_description(e.event_description) %>
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left">
|
<td align="left">
|
||||||
<a class="font_lighter">
|
<a class="font_lighter">
|
||||||
<%= format_activity_day(day) %>
|
<%= format_activity_day(day) %>
|
||||||
<%= format_time(e.event_datetime, false) %>
|
<%= format_time(e.event_datetime, false) %>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td width="200" align="center" class="a">
|
<td width="200" align="center" class="a">
|
||||||
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>
|
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</div>
|
</div>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</div>
|
</div>
|
||||||
<!--end-->
|
<!--end-->
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<ul>
|
<ul>
|
||||||
<%= pagination_links_full @activity_pages%>
|
<%= pagination_links_full @activity_pages%>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %>
|
<%= content_tag('p', l(:label_no_data), :class => 'nodata') if @events_by_day.empty? %>
|
||||||
|
|
||||||
<% other_formats_links do |f| %>
|
<% other_formats_links do |f| %>
|
||||||
<%= f.link_to 'Atom', :url => params.merge(:from => nil, :key => User.current.rss_key) %>
|
<%= f.link_to 'Atom', :url => params.merge(:from => nil, :key => User.current.rss_key) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %>
|
<%= auto_discovery_link_tag(:atom, params.merge(:format => 'atom', :from => nil, :key => User.current.rss_key)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% content_for :sidebar do %>
|
<% content_for :sidebar do %>
|
||||||
<%= form_tag({}, :method => :get) do %>
|
<%= form_tag({}, :method => :get) do %>
|
||||||
<h3><%= l(:label_activity) %></h3>
|
<h3><%= l(:label_activity) %></h3>
|
||||||
<p>
|
<p>
|
||||||
<% @activity.event_types.each do |t| %>
|
<% @activity.event_types.each do |t| %>
|
||||||
<%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %>
|
<%= check_box_tag "show_#{t}", 1, @activity.scope.include?(t) %>
|
||||||
<label for="show_<%= t%>">
|
<label for="show_<%= t%>">
|
||||||
<%= link_to(l("label_#{t.singularize}_plural"), {"show_#{t}" => 1, :user_id => params[:user_id], :from => params[:from]})%>
|
<%= link_to(l("label_#{t.singularize}_plural"), {"show_#{t}" => 1, :user_id => params[:user_id], :from => params[:from]})%>
|
||||||
</label>
|
</label>
|
||||||
<br />
|
<br />
|
||||||
<% end %>
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
<% if @project && @project.descendants.active.any? %>
|
<% if @project && @project.descendants.active.any? %>
|
||||||
<%= hidden_field_tag 'with_subprojects', 0 %>
|
<%= hidden_field_tag 'with_subprojects', 0 %>
|
||||||
<p>
|
<p>
|
||||||
<label>
|
<label>
|
||||||
<%= check_box_tag 'with_subprojects', 1, @with_subprojects %>
|
<%= check_box_tag 'with_subprojects', 1, @with_subprojects %>
|
||||||
<%= l(:label_subproject_plural)%>
|
<%= l(:label_subproject_plural)%>
|
||||||
</label>
|
</label>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= hidden_field_tag('user_id', params[:user_id]) unless params[:user_id].blank? %>
|
<%= hidden_field_tag('user_id', params[:user_id]) unless params[:user_id].blank? %>
|
||||||
<p>
|
<p>
|
||||||
<%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %>
|
<%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% html_title(l(:label_activity), @author) -%>
|
<% html_title(l(:label_activity), @author) -%>
|
||||||
|
|
|
@ -1,151 +1,151 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function submitContestNews()
|
function submitContestNews()
|
||||||
{
|
{
|
||||||
if(regexTitle() && regexDescription())
|
if(regexTitle() && regexDescription())
|
||||||
{
|
{
|
||||||
$("#contestnotifications-form").submit();
|
$("#contestnotifications-form").submit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<span style="font-size: 16px; border-bottom:1px solid #f0f0f0; margin-right: 15px;">
|
<span style="font-size: 16px; border-bottom:1px solid #f0f0f0; margin-right: 15px;">
|
||||||
<%= l(:label_notification) %>
|
<%= l(:label_notification) %>
|
||||||
</span>
|
</span>
|
||||||
<% if User.current.logged? && (User.current.admin? ||User.current == @contest.author) %>
|
<% if User.current.logged? && (User.current.admin? ||User.current == @contest.author) %>
|
||||||
<%= link_to(l(:bale_news_notice),
|
<%= link_to(l(:bale_news_notice),
|
||||||
new_contest_contestnotification_path(@contest),
|
new_contest_contestnotification_path(@contest),
|
||||||
:class => 'icon icon-add',
|
:class => 'icon icon-add',
|
||||||
:onclick => 'showAndScrollTo("add-contestnotifications", "contestnotifications_title"); return false;') %>
|
:onclick => 'showAndScrollTo("add-contestnotifications", "contestnotifications_title"); return false;') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @contest %>
|
<% if @contest %>
|
||||||
<div id="add-contestnotifications" class="add_frame" style="display:none;">
|
<div id="add-contestnotifications" class="add_frame" style="display:none;">
|
||||||
<%= labelled_form_for @contestnotification, :url => contest_contestnotifications_path(@contest),
|
<%= labelled_form_for @contestnotification, :url => contest_contestnotifications_path(@contest),
|
||||||
:html => {:id => 'contestnotifications-form', :multipart => true} do |f| %>
|
:html => {:id => 'contestnotifications-form', :multipart => true} do |f| %>
|
||||||
<%= render :partial => 'contestnotifications/form', :locals => {:f => f} %>
|
<%= render :partial => 'contestnotifications/form', :locals => {:f => f} %>
|
||||||
<input type="button" onclick="submitContestNews();" class="enterprise" value="<%= l(:button_create)%>"/>
|
<input type="button" onclick="submitContestNews();" class="enterprise" value="<%= l(:button_create)%>"/>
|
||||||
|
|
|
|
||||||
<input type="button" onclick="$('#add-contestnotifications').hide(); return false;" class="enterprise" value="<%= l(:button_cancel)%>"/>
|
<input type="button" onclick="$('#add-contestnotifications').hide(); return false;" class="enterprise" value="<%= l(:button_cancel)%>"/>
|
||||||
<% end if @contest %>
|
<% end if @contest %>
|
||||||
<div id="preview" class="wiki"></div>
|
<div id="preview" class="wiki"></div>
|
||||||
</div>
|
</div>
|
||||||
<br/>
|
<br/>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<div style="margin-left: 20px;">
|
<div style="margin-left: 20px;">
|
||||||
<span class="portrait">
|
<span class="portrait">
|
||||||
<%= image_tag(url_to_avatar(@contest.author), :class => "avatar")%>
|
<%= image_tag(url_to_avatar(@contest.author), :class => "avatar")%>
|
||||||
</span>
|
</span>
|
||||||
<span class="body">
|
<span class="body">
|
||||||
<span id="praise_tread" style="float: right">
|
<span id="praise_tread" style="float: right">
|
||||||
<%= render :partial => "/praise_tread/praise_tread",
|
<%= render :partial => "/praise_tread/praise_tread",
|
||||||
:locals => {:obj => @contest,
|
:locals => {:obj => @contest,
|
||||||
:show_flag => true,
|
:show_flag => true,
|
||||||
:user_id =>User.current.id,
|
:user_id =>User.current.id,
|
||||||
:horizontal => false}
|
:horizontal => false}
|
||||||
%>
|
%>
|
||||||
</span>
|
</span>
|
||||||
<h3>
|
<h3>
|
||||||
<%= link_to(@contest.author.lastname+@contest.author.firstname,
|
<%= link_to(@contest.author.lastname+@contest.author.firstname,
|
||||||
user_path(@contest.author))%>
|
user_path(@contest.author))%>
|
||||||
:<%= @contest.name %>
|
:<%= @contest.name %>
|
||||||
</h3>
|
</h3>
|
||||||
<p>
|
<p>
|
||||||
<strong>
|
<strong>
|
||||||
<%= l(:label_bids_reward_method) %>
|
<%= l(:label_bids_reward_method) %>
|
||||||
<span class="bonus">
|
<span class="bonus">
|
||||||
<%= @contest.budget%>
|
<%= @contest.budget%>
|
||||||
</span>
|
</span>
|
||||||
</strong>
|
</strong>
|
||||||
</p>
|
</p>
|
||||||
<div class="bid_description" style="width: 100%;word-break:break-all;word-wrap: break-word;">
|
<div class="bid_description" style="width: 100%;word-break:break-all;word-wrap: break-word;">
|
||||||
<%= @contest.description %>
|
<%= @contest.description %>
|
||||||
</div>
|
</div>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
|
|
||||||
<br><br>
|
<br><br>
|
||||||
<% @contestnotificationss.each do |contestnotifications| %>
|
<% @contestnotificationss.each do |contestnotifications| %>
|
||||||
<table class="content-text-list">
|
<table class="content-text-list">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top" width="50">
|
<td colspan="2" valign="top" width="50">
|
||||||
<%= link_to image_tag(url_to_avatar(contestnotifications.author), :class => "avatar"), user_path(contestnotifications.author) %>
|
<%= link_to image_tag(url_to_avatar(contestnotifications.author), :class => "avatar"), user_path(contestnotifications.author) %>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<table width="580px" border="0">
|
<table width="580px" border="0">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top">
|
<td colspan="2" valign="top">
|
||||||
<strong>
|
<strong>
|
||||||
<%= link_to_user(contestnotifications.author) if contestnotifications.respond_to?(:author) %>
|
<%= link_to_user(contestnotifications.author) if contestnotifications.respond_to?(:author) %>
|
||||||
</strong>
|
</strong>
|
||||||
<span style="margin-left: 4px;" class="font_lighter">
|
<span style="margin-left: 4px;" class="font_lighter">
|
||||||
<%= l(:label_project_notice) %>
|
<%= l(:label_project_notice) %>
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
<%= link_to h(contestnotifications.title), contest_contestnotification_path(@contest, contestnotifications) %>
|
<%= link_to h(contestnotifications.title), contest_contestnotification_path(@contest, contestnotifications) %>
|
||||||
</span>
|
</span>
|
||||||
<span style="float: right">
|
<span style="float: right">
|
||||||
<%= link_to l(:button_edit), edit_contest_contestnotification_path(@contest, contestnotifications) if (User.current.admin? && User.current.logged? )||(User.current == @contest.author && User.current.logged?) %>
|
<%= link_to l(:button_edit), edit_contest_contestnotification_path(@contest, contestnotifications) if (User.current.admin? && User.current.logged? )||(User.current == @contest.author && User.current.logged?) %>
|
||||||
<%= delete_link contest_contestnotification_path(@contest, contestnotifications) if (User.current.admin? && User.current.logged? )||(User.current == @contest.author && User.current.logged?) %>
|
<%= delete_link contest_contestnotification_path(@contest, contestnotifications) if (User.current.admin? && User.current.logged? )||(User.current == @contest.author && User.current.logged?) %>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" width="580px">
|
<td colspan="2" width="580px">
|
||||||
<span class="font_description">
|
<span class="font_description">
|
||||||
<%= textilizable(contestnotifications, :description) %>
|
<%= textilizable(contestnotifications, :description) %>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td align="left"><span class="font_lighter">
|
<td align="left"><span class="font_lighter">
|
||||||
<%= l :label_update_time %>
|
<%= l :label_update_time %>
|
||||||
|
|
||||||
<%= format_time(contestnotifications.created_at) %>
|
<%= format_time(contestnotifications.created_at) %>
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td width="350" align="right" class="a">
|
<td width="350" align="right" class="a">
|
||||||
<%= link_to l(:label_check_comment), contest_contestnotification_path(@contest, contestnotifications) %>
|
<%= link_to l(:label_check_comment), contest_contestnotification_path(@contest, contestnotifications) %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!--end-->
|
<!--end-->
|
||||||
<div style="padding-right: 10px">
|
<div style="padding-right: 10px">
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<ul>
|
<ul>
|
||||||
<%= pagination_links_full @contestnotifications_pages %>
|
<%= pagination_links_full @contestnotifications_pages %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
|
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
|
||||||
<%= stylesheet_link_tag 'scm' %>
|
<%= stylesheet_link_tag 'scm' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% html_title(l(:label_contest_notification)) -%>
|
<% html_title(l(:label_contest_notification)) -%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
$(document).ready(function ($) {
|
$(document).ready(function ($) {
|
||||||
$('.content-text-list').each(function () {
|
$('.content-text-list').each(function () {
|
||||||
$(this).find('.delete_icon').hide();
|
$(this).find('.delete_icon').hide();
|
||||||
$(this).mouseenter(function (event) {
|
$(this).mouseenter(function (event) {
|
||||||
$(this).find('.delete_icon').show();
|
$(this).find('.delete_icon').show();
|
||||||
});
|
});
|
||||||
$(this).mouseleave(function (event) {
|
$(this).mouseleave(function (event) {
|
||||||
$(this).find('.delete_icon').hide();
|
$(this).find('.delete_icon').hide();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!--end-->
|
<!--end-->
|
|
@ -1,53 +1,53 @@
|
||||||
<div class="top-content">
|
<div class="top-content">
|
||||||
<%= form_tag({:controller => 'contests', :action => 'index'}, :method => :get) do %>
|
<%= form_tag({:controller => 'contests', :action => 'index'}, :method => :get) do %>
|
||||||
<table width="940px">
|
<table width="940px">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="info_font" style="width: 220px; color: #15bccf"><%= l(:label_contest_innovate) %></td>
|
<td class="info_font" style="width: 220px; color: #15bccf"><%= l(:label_contest_innovate) %></td>
|
||||||
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
||||||
<td rowspan="2">
|
<td rowspan="2">
|
||||||
<% if User.current.logged? %>
|
<% if User.current.logged? %>
|
||||||
<% unless User.current.user_extensions.identity == 1 %>
|
<% unless User.current.user_extensions.identity == 1 %>
|
||||||
<%= link_to(l(:label_newtype_contest), new_contest_contests_path, :class => 'icon icon-add', :target => "_blank") %>
|
<%= link_to(l(:label_newtype_contest), new_contest_contests_path, :class => 'icon icon-add', :target => "_blank") %>
|
||||||
<!-- end longjun -->
|
<!-- end longjun -->
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td rowspan="2" >
|
<td rowspan="2" >
|
||||||
<div class="project-search" style="float: right">
|
<div class="project-search" style="float: right">
|
||||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
|
<%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-left: 8px">
|
<td style="padding-left: 8px">
|
||||||
<a>
|
<a>
|
||||||
<%= link_to request.host()+"/contests", contests_path %>
|
<%= link_to request.host()+"/contests", contests_path %>
|
||||||
<!-- end longjun -->
|
<!-- end longjun -->
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td >
|
<td >
|
||||||
<%=link_to l(:field_homepage), home_path %> >
|
<%=link_to l(:field_homepage), home_path %> >
|
||||||
<%=link_to l(:label_contest_innovate), :controller => 'contests', :action => 'index' %>
|
<%=link_to l(:label_contest_innovate), :controller => 'contests', :action => 'index' %>
|
||||||
<!-- end longjun -->
|
<!-- end longjun -->
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% if @contests.size > 0%>
|
<% if @contests.size > 0%>
|
||||||
<%= sort_contest(@s_state)%>
|
<%= sort_contest(@s_state)%>
|
||||||
<div id="bid-show" class="projects-index">
|
<div id="bid-show" class="projects-index">
|
||||||
<%= render :partial => 'contest_list', :locals => {:contests => @contests, :contest_pages => @contest_pages} %>
|
<%= render :partial => 'contest_list', :locals => {:contests => @contests, :contest_pages => @contest_pages} %>
|
||||||
</div>
|
</div>
|
||||||
<% elsif @is_search%>
|
<% elsif @is_search%>
|
||||||
<%= render :partial => "layouts/no_content"%>
|
<%= render :partial => "layouts/no_content"%>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= sort_contest(@s_state)%>
|
<%= sort_contest(@s_state)%>
|
||||||
<div id="bid-show" class="projects-index">
|
<div id="bid-show" class="projects-index">
|
||||||
<%= render :partial => 'contest_list', :locals => {:contests => @contests, :contest_pages => @contest_pages} %>
|
<%= render :partial => 'contest_list', :locals => {:contests => @contests, :contest_pages => @contest_pages} %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% html_title l(:label_contest_list)%>
|
<% html_title l(:label_contest_list)%>
|
||||||
|
|
|
@ -1,75 +1,75 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<title>快速进入课程通道</title>
|
<title>快速进入课程通道</title>
|
||||||
<style>
|
<style>
|
||||||
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
|
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
|
||||||
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
|
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
|
||||||
div,img,tr,td{ border:0;}
|
div,img,tr,td{ border:0;}
|
||||||
table,tr,td{border:0; cellspacing:0; cellpadding:0;}
|
table,tr,td{border:0; cellspacing:0; cellpadding:0;}
|
||||||
ul,li{ list-style-type:none}
|
ul,li{ list-style-type:none}
|
||||||
.cl{ clear:both; overflow:hidden; }
|
.cl{ clear:both; overflow:hidden; }
|
||||||
a{ text-decoration:none; }
|
a{ text-decoration:none; }
|
||||||
a:hover{ }
|
a:hover{ }
|
||||||
|
|
||||||
|
|
||||||
#popbox{width:488px;height:308px;}
|
#popbox{width:488px;height:308px;}
|
||||||
.alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; }
|
.alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; }
|
||||||
.C_top{ margin-top:20px; width:368px; height:100px; background:#e9e9e9; padding:0px 60px; }
|
.C_top{ margin-top:20px; width:368px; height:100px; background:#e9e9e9; padding:0px 60px; }
|
||||||
.C_top h2{ color:#1c1d1d; font-size:24px; font-style:normal; font-weight:normal;}
|
.C_top h2{ color:#1c1d1d; font-size:24px; font-style:normal; font-weight:normal;}
|
||||||
.C_top p{ color:#a9aaaa; line-height:22px;}
|
.C_top p{ color:#a9aaaa; line-height:22px;}
|
||||||
.C_form{ margin:20px 0 0 60px;}
|
.C_form{ margin:20px 0 0 60px;}
|
||||||
.C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; }
|
.C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; }
|
||||||
.C_form ul li input{ margin-left:30px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; }
|
.C_form ul li input{ margin-left:30px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; }
|
||||||
.C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:90px;}
|
.C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:90px;}
|
||||||
.width190{ width:190px; height:26px; border-color:#e1e1e1;}
|
.width190{ width:190px; height:26px; border-color:#e1e1e1;}
|
||||||
.C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;}
|
.C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;}
|
||||||
.C_form a:hover{ text-decoration:underline;}
|
.C_form a:hover{ text-decoration:underline;}
|
||||||
.C_form a.btn{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#15bccf; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
|
.C_form a.btn{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#15bccf; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
|
||||||
.C_form a.btn:hover{ background:#ff821d;}
|
.C_form a.btn:hover{ background:#ff821d;}
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function submit_form(obj)
|
function submit_form(obj)
|
||||||
{
|
{
|
||||||
hideModal(obj);
|
hideModal(obj);
|
||||||
$("#new-watcher-form").submit();
|
$("#new-watcher-form").submit();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="popbox">
|
<div id="popbox">
|
||||||
<div class="C" >
|
<div class="C" >
|
||||||
<div class="C_top">
|
<div class="C_top">
|
||||||
<h2>快速进入课程通道</h2>
|
<h2>快速进入课程通道</h2>
|
||||||
<p>只要持有课程ID和密码,就可快速加入所在课程。课程页面搜索不到的私有课程只能从此通道进入哦!</p>
|
<p>只要持有课程ID和密码,就可快速加入所在课程。课程页面搜索不到的私有课程只能从此通道进入哦!</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="C_form">
|
<div class="C_form">
|
||||||
<%= form_tag({:controller => 'courses',
|
<%= form_tag({:controller => 'courses',
|
||||||
:action => 'join'},
|
:action => 'join'},
|
||||||
:remote => true,
|
:remote => true,
|
||||||
:method => :post,
|
:method => :post,
|
||||||
:id => 'new-watcher-form') do %>
|
:id => 'new-watcher-form') do %>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<span class="tips">课 程 ID:</span>
|
<span class="tips">课 程 ID:</span>
|
||||||
<input class=" width190" name="object_id" id="object_id" type="text" value="" >
|
<input class=" width190" name="object_id" id="object_id" type="text" value="" >
|
||||||
</li>
|
</li>
|
||||||
<li class="mB5">课程ID是所在课程网址中显示的序号</li>
|
<li class="mB5">课程ID是所在课程网址中显示的序号</li>
|
||||||
<li>
|
<li>
|
||||||
<span class="tips">密 码:</span>
|
<span class="tips">密 码:</span>
|
||||||
<input class=" width190" type="password" name="course_password" id="course_password" value="" >
|
<input class=" width190" type="password" name="course_password" id="course_password" value="" >
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="#" class="btn" onclick="submit_form(this);"><%= l(:label_new_join) %></a>
|
<a href="#" class="btn" onclick="submit_form(this);"><%= l(:label_new_join) %></a>
|
||||||
<a href="#" onclick="hideModal(this);"><%= l(:button_cancel)%></a>
|
<a href="#" onclick="hideModal(this);"><%= l(:button_cancel)%></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<% end%>
|
<% end%>
|
||||||
</div>
|
</div>
|
||||||
</div><!---- C end---->
|
</div><!---- C end---->
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
<%= form_tag({:action => 'edit', :tab => 'projects'}) do %>
|
<%= form_tag({:action => 'edit', :tab => 'projects'}) do %>
|
||||||
<div class="box tabular settings">
|
<div class="box tabular settings">
|
||||||
<p>
|
<p>
|
||||||
<%= setting_check_box :default_projects_public %>
|
<%= setting_check_box :default_projects_public %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<%= setting_multiselect(:default_projects_modules,
|
<%= setting_multiselect(:default_projects_modules,
|
||||||
Redmine::AccessControl.available_project_modules.collect {|m| [l_or_humanize(m, :prefix => "project_module_"), m.to_s]}) %>
|
Redmine::AccessControl.available_project_modules.collect {|m| [l_or_humanize(m, :prefix => "project_module_"), m.to_s]}) %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<%= setting_multiselect(:default_projects_tracker_ids, Tracker.sorted.all.collect {|t| [t.name, t.id.to_s]}) %>
|
<%= setting_multiselect(:default_projects_tracker_ids, Tracker.sorted.all.collect {|t| [t.name, t.id.to_s]}) %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<%= setting_check_box :sequential_project_identifiers %>
|
<%= setting_check_box :sequential_project_identifiers %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p style="display: none;"><%= setting_select :new_project_user_role_id, Role.find_all_givable.collect {|r| [r.name, r.id.to_s]},
|
<p style="display: none;"><%= setting_select :new_project_user_role_id, Role.find_all_givable.collect {|r| [r.name, r.id.to_s]},
|
||||||
:blank => "--- #{l(:actionview_instancetag_blank_option)} ---" %>
|
:blank => "--- #{l(:actionview_instancetag_blank_option)} ---" %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= submit_tag l(:button_save) %>
|
<%= submit_tag l(:button_save) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,301 +1,301 @@
|
||||||
<%
|
<%
|
||||||
@nav_dispaly_contest_label = 1
|
@nav_dispaly_contest_label = 1
|
||||||
@nav_dispaly_store_all_label = 1
|
@nav_dispaly_store_all_label = 1
|
||||||
%>
|
%>
|
||||||
<%= stylesheet_link_tag 'welcome' %>
|
<%= stylesheet_link_tag 'welcome' %>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#up_zzjs{height:100px;overflow:hidden;}
|
#up_zzjs{height:100px;overflow:hidden;}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript" language="javascript">
|
<script type="text/javascript" language="javascript">
|
||||||
function clearInfo(id, content) {
|
function clearInfo(id, content) {
|
||||||
var text = $('#' + id);
|
var text = $('#' + id);
|
||||||
if (text.val() == content) {
|
if (text.val() == content) {
|
||||||
$('#' + id).val('');
|
$('#' + id).val('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
$("#main").find("a").attr("target", "_blank");
|
$("#main").find("a").attr("target", "_blank");
|
||||||
setCss();
|
setCss();
|
||||||
});
|
});
|
||||||
|
|
||||||
//设置div居中
|
//设置div居中
|
||||||
function setCss()
|
function setCss()
|
||||||
{
|
{
|
||||||
var mainBar = $('#main-content-bar')[0];
|
var mainBar = $('#main-content-bar')[0];
|
||||||
var topHeight = mainBar.offsetHeight;
|
var topHeight = mainBar.offsetHeight;
|
||||||
var welcomeLeft = $('#welcome_left')[0];
|
var welcomeLeft = $('#welcome_left')[0];
|
||||||
var leftHeight = welcomeLeft.offsetHeight;
|
var leftHeight = welcomeLeft.offsetHeight;
|
||||||
var searchbar = $('#J_Slide')[0];
|
var searchbar = $('#J_Slide')[0];
|
||||||
var searchHeight = searchbar.offsetHeight;
|
var searchHeight = searchbar.offsetHeight;
|
||||||
welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px";
|
welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px";
|
||||||
searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px";
|
searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px";
|
||||||
//alert((topHeight - leftHeight)/2 );
|
//alert((topHeight - leftHeight)/2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
function showInfo(id, content) {
|
function showInfo(id, content) {
|
||||||
var text = $('#' + id);
|
var text = $('#' + id);
|
||||||
if (text.val() == '') {
|
if (text.val() == '') {
|
||||||
$('#' + id).val(content);
|
$('#' + id).val(content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 给主页用户弹新页面
|
// 给主页用户弹新页面
|
||||||
$(document).ready(function($) {
|
$(document).ready(function($) {
|
||||||
$("#loggedas").find("a").attr("target", "_blank");
|
$("#loggedas").find("a").attr("target", "_blank");
|
||||||
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
|
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
(function (){
|
(function (){
|
||||||
window.onload = function(){
|
window.onload = function(){
|
||||||
function fixedBar(id, options){
|
function fixedBar(id, options){
|
||||||
var ele = document.getElementById(id);
|
var ele = document.getElementById(id);
|
||||||
if(!ele) return;
|
if(!ele) return;
|
||||||
if(/msie (\d+\.\d+)/i.test(navigator.userAgent)){
|
if(/msie (\d+\.\d+)/i.test(navigator.userAgent)){
|
||||||
var pageHeight=window.innerHeight;
|
var pageHeight=window.innerHeight;
|
||||||
var d=document;
|
var d=document;
|
||||||
if(typeof pageHeight!="number"){
|
if(typeof pageHeight!="number"){
|
||||||
if(document.compatMode=="CSS1Compat"){
|
if(document.compatMode=="CSS1Compat"){
|
||||||
pageHeight=document.documentElement.clientHeight;
|
pageHeight=document.documentElement.clientHeight;
|
||||||
}else{
|
}else{
|
||||||
pageHeight=document.body.clientHeight;
|
pageHeight=document.body.clientHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var ieScrollTop=window.pageYOffset || d.documentElement.scrollTop || d.body.scrollTop;
|
var ieScrollTop=window.pageYOffset || d.documentElement.scrollTop || d.body.scrollTop;
|
||||||
if(options.addclass) ele.className = options.addclass;
|
if(options.addclass) ele.className = options.addclass;
|
||||||
ele.style.position= 'absolute';
|
ele.style.position= 'absolute';
|
||||||
|
|
||||||
if(options.show){
|
if(options.show){
|
||||||
ele.style.top = 0 + "px";
|
ele.style.top = 0 + "px";
|
||||||
ele.style.display= 'block';
|
ele.style.display= 'block';
|
||||||
}
|
}
|
||||||
|
|
||||||
window.attachEvent('onscroll' , function (){
|
window.attachEvent('onscroll' , function (){
|
||||||
|
|
||||||
var ieScrollTop=window.pageYOffset || d.documentElement.scrollTop || d.body.scrollTop;
|
var ieScrollTop=window.pageYOffset || d.documentElement.scrollTop || d.body.scrollTop;
|
||||||
|
|
||||||
ele.style.top = 0 + "px";
|
ele.style.top = 0 + "px";
|
||||||
if(options.autoHidden){
|
if(options.autoHidden){
|
||||||
if(ieScrollTop==0){
|
if(ieScrollTop==0){
|
||||||
ele.style.display="none";
|
ele.style.display="none";
|
||||||
}else{
|
}else{
|
||||||
ele.style.display="block";
|
ele.style.display="block";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
var ele = document.getElementById(id);
|
var ele = document.getElementById(id);
|
||||||
if(typeof pageHeight!="number"){
|
if(typeof pageHeight!="number"){
|
||||||
if(document.compatMode=="CSS1Compat"){
|
if(document.compatMode=="CSS1Compat"){
|
||||||
pageHeight=document.documentElement.clientHeight;
|
pageHeight=document.documentElement.clientHeight;
|
||||||
}else{
|
}else{
|
||||||
pageHeight=document.body.clientHeight;
|
pageHeight=document.body.clientHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(options.show) ele.style.display= 'block';
|
if(options.show) ele.style.display= 'block';
|
||||||
ele.style.top = 0 +'px';
|
ele.style.top = 0 +'px';
|
||||||
window.addEventListener('scroll',function (){
|
window.addEventListener('scroll',function (){
|
||||||
if(options.autoHidden){
|
if(options.autoHidden){
|
||||||
if(baidu.page.getScrollTop()==0){
|
if(baidu.page.getScrollTop()==0){
|
||||||
ele.style.display="none";
|
ele.style.display="none";
|
||||||
}else{
|
}else{
|
||||||
ele.style.display="block";
|
ele.style.display="block";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},false);
|
},false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedBar('backTopBtn' , {autoHidden: true, top : 186});
|
fixedBar('backTopBtn' , {autoHidden: true, top : 186});
|
||||||
fixedBar('identifier-pannel' , {autoHidden: false , top : 956 , show : true});
|
fixedBar('identifier-pannel' , {autoHidden: false , top : 956 , show : true});
|
||||||
//修改微信扫码样式布局后添加微信扫码跟随滚动处理
|
//修改微信扫码样式布局后添加微信扫码跟随滚动处理
|
||||||
$(window).scroll(function(){
|
$(window).scroll(function(){
|
||||||
var vtop=$(document).scrollTop();
|
var vtop=$(document).scrollTop();
|
||||||
$("#identifier-pannel").css('top',vtop+"px");
|
$("#identifier-pannel").css('top',vtop+"px");
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<div class='top_bar'>
|
<div class='top_bar'>
|
||||||
<%#= render partial: 'wei_xin' %>
|
<%#= render partial: 'wei_xin' %>
|
||||||
<div class="main-content-bar" id="main-content-bar">
|
<div class="main-content-bar" id="main-content-bar">
|
||||||
<!--文字-->
|
<!--文字-->
|
||||||
<div style="float: left;padding-left:15px;">
|
<div style="float: left;padding-left:15px;">
|
||||||
<% if get_avatar?(@contest_page) %>
|
<% if get_avatar?(@contest_page) %>
|
||||||
<%= image_tag(url_to_avatar(@contest_page), width:@contest_page.image_width,height: @contest_page.image_height) %>
|
<%= image_tag(url_to_avatar(@contest_page), width:@contest_page.image_width,height: @contest_page.image_height) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= image_tag '/images/transparent.png', width:@contest_page.image_width,height: @contest_page.image_height %>
|
<%= image_tag '/images/transparent.png', width:@contest_page.image_width,height: @contest_page.image_height %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="welcome_left" id="welcome_left">
|
<div class="welcome_left" id="welcome_left">
|
||||||
<% unless @contest_page.nil? %>
|
<% unless @contest_page.nil? %>
|
||||||
<span class="font_welcome_trustie"><%= @contest_page.title %></span> <span class="font_welcome_tdescription">, <%= @contest_page.description %></span>
|
<span class="font_welcome_trustie"><%= @contest_page.title %></span> <span class="font_welcome_tdescription">, <%= @contest_page.description %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--搜索框-->
|
<!--搜索框-->
|
||||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
|
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
|
||||||
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
|
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
|
||||||
<%= text_field_tag 'name', params[:name], :placeholder => l(:label_search_intimation), name: "name", :class => 'blueinputbar', :style => 'width:240px; padding-right:50px;'%>
|
<%= text_field_tag 'name', params[:name], :placeholder => l(:label_search_intimation), name: "name", :class => 'blueinputbar', :style => 'width:240px; padding-right:50px;'%>
|
||||||
|
|
||||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
|
<%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<!-- <div class='font_lighter' style="display: inline-block; margin-top:3px;">竞赛相关内容搜索,如竞赛题目,参赛题目,参赛人名等。</div> -->
|
<!-- <div class='font_lighter' style="display: inline-block; margin-top:3px;">竞赛相关内容搜索,如竞赛题目,参赛题目,参赛人名等。</div> -->
|
||||||
</div>
|
</div>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="clear:both"></div>
|
<div style="clear:both"></div>
|
||||||
|
|
||||||
<div id="J_Slide" class="d-p-index-box d-p-index-left" >
|
<div id="J_Slide" class="d-p-index-box d-p-index-left" >
|
||||||
<h3 style="margin-left: 5px; color: #e8770d;"><strong><%=l(:label_current_hot_contest)%></strong></h3>
|
<h3 style="margin-left: 5px; color: #e8770d;"><strong><%=l(:label_current_hot_contest)%></strong></h3>
|
||||||
<span style="margin-top: -20px;float: right; display: block;">
|
<span style="margin-top: -20px;float: right; display: block;">
|
||||||
<% if User.current.logged? %>
|
<% if User.current.logged? %>
|
||||||
<% unless User.current.user_extensions.identity == 1 %>
|
<% unless User.current.user_extensions.identity == 1 %>
|
||||||
<%= link_to(l(:label_newtype_contest), new_contest_contests_path, :class => 'icon icon-add') %>
|
<%= link_to(l(:label_newtype_contest), new_contest_contests_path, :class => 'icon icon-add') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= link_to l(:label_more), {:controller => 'contests', :action => 'index'}, :target => "_blank" %>
|
<%= link_to l(:label_more), {:controller => 'contests', :action => 'index'}, :target => "_blank" %>
|
||||||
</span>
|
</span>
|
||||||
<div class="d-p-projectlist-box">
|
<div class="d-p-projectlist-box">
|
||||||
<div class="d-p-projectlist">
|
<div class="d-p-projectlist">
|
||||||
<% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
|
<% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
|
||||||
<li style="overflow:auto;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'>
|
<li style="overflow:auto;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'>
|
||||||
<div class="avatar-4" style="float: left; margin-top: 7px">
|
<div class="avatar-4" style="float: left; margin-top: 7px">
|
||||||
<%= image_tag('/images/contest1.png')%>
|
<%= image_tag('/images/contest1.png')%>
|
||||||
</div>
|
</div>
|
||||||
<div style="float: left; margin-left: 12px; margin-top: 10px; margin-bottom: -4px; width: 380px;">
|
<div style="float: left; margin-left: 12px; margin-top: 10px; margin-bottom: -4px; width: 380px;">
|
||||||
<%= link_to(contest.name.truncate(50, omission: '...'), contest_contestnotifications_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %>
|
<%= link_to(contest.name.truncate(50, omission: '...'), contest_contestnotifications_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %>
|
||||||
<% if contest.id == 2 or contest.id == 3 or contest.id == 6 %>
|
<% if contest.id == 2 or contest.id == 3 or contest.id == 6 %>
|
||||||
<span class="font_lighter">(<span style="font-size: 13px"><%= link_to("#{contest.projects.where('is_public=1').count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %></span>)</span>
|
<span class="font_lighter">(<span style="font-size: 13px"><%= link_to("#{contest.projects.where('is_public=1').count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %></span>)</span>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span class="font_lighter">(<span style="font-size: 13px"><%= link_to("#{contest.contesting_softapplications.count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %></span>)</span>
|
<span class="font_lighter">(<span style="font-size: 13px"><%= link_to("#{contest.contesting_softapplications.count}"+l(:label_work_quantity), show_attendingcontest_contest_path(contest), :target => "_blank") %></span>)</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;" class="text_nowrap">
|
<div style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;" class="text_nowrap">
|
||||||
<span class='font_lighter' title ='<%=contest.description%>'><%=contest.description.truncate(100, omission: '...')%></span>
|
<span class='font_lighter' title ='<%=contest.description%>'><%=contest.description.truncate(100, omission: '...')%></span>
|
||||||
</div><br />
|
</div><br />
|
||||||
|
|
||||||
<div style="padding-left: 57px; clear: left;">
|
<div style="padding-left: 57px; clear: left;">
|
||||||
<span class="font_lighter"><%=l(:label_release_time)%>: <%=format_time contest.created_on %></span>
|
<span class="font_lighter"><%=l(:label_release_time)%>: <%=format_time contest.created_on %></span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<% end; reset_cycle %>
|
<% end; reset_cycle %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="J_Slide" class="d-p-index-box d-p-index-Dynamic">
|
<div id="J_Slide" class="d-p-index-box d-p-index-Dynamic">
|
||||||
<h3 style="margin-left: 5px; color: #e8770d;">
|
<h3 style="margin-left: 5px; color: #e8770d;">
|
||||||
<strong><%=l(:label_notification)%></strong>
|
<strong><%=l(:label_notification)%></strong>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<ul class="contest-notification-list">
|
<ul class="contest-notification-list">
|
||||||
<% @contest_notifications.each do |notification| %>
|
<% @contest_notifications.each do |notification| %>
|
||||||
<li>
|
<li>
|
||||||
<div class="inner-right" style="float: left; margin-top: 7px ">
|
<div class="inner-right" style="float: left; margin-top: 7px ">
|
||||||
<%= link_to image_tag(url_to_avatar(notification.author), :class => "avatar"), user_path(notification.author) %>
|
<%= link_to image_tag(url_to_avatar(notification.author), :class => "avatar"), user_path(notification.author) %>
|
||||||
</div>
|
</div>
|
||||||
<div class="font_lighter" style="padding-top: 7px;padding-left: 55px;" title="<%= notification.title%>">
|
<div class="font_lighter" style="padding-top: 7px;padding-left: 55px;" title="<%= notification.title%>">
|
||||||
<span>
|
<span>
|
||||||
<strong><%= link_to_user(notification.author) %></strong>
|
<strong><%= link_to_user(notification.author) %></strong>
|
||||||
<%= l(:label_project_notice) %>
|
<%= l(:label_project_notice) %>
|
||||||
<%= link_to notification.title.truncate(35, omission: '...'), contest_contestnotifications_path(notification.contest_id) %>
|
<%= link_to notification.title.truncate(35, omission: '...'), contest_contestnotifications_path(notification.contest_id) %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="font_lighter" style="padding-left: 55px;" title="<%= notification.description%>"><%= notification.description.truncate(30, omission: '...') %></div>
|
<div class="font_lighter" style="padding-left: 55px;" title="<%= notification.description%>"><%= notification.description.truncate(30, omission: '...') %></div>
|
||||||
<div class="font_lighter" style="padding-left: 55px;"><%=l(:label_release_time)%>: <%=format_time notification.created_at %></div>
|
<div class="font_lighter" style="padding-left: 55px;"><%=l(:label_release_time)%>: <%=format_time notification.created_at %></div>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="J_Slide" class="d-p-index-box d-p-index-Dynamic">
|
<div id="J_Slide" class="d-p-index-box d-p-index-Dynamic">
|
||||||
<h3 style="margin-left: 5px; color: #e8770d;">
|
<h3 style="margin-left: 5px; color: #e8770d;">
|
||||||
<strong><%=l(:label_issue_feedback_activities)%></strong>
|
<strong><%=l(:label_issue_feedback_activities)%></strong>
|
||||||
<%= link_to l(:label_my_question), newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
|
<%= link_to l(:label_my_question), newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
|
||||||
<%= link_to l(:label_my_feedback), suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
|
<%= link_to l(:label_my_feedback), suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
|
||||||
</h3>
|
</h3>
|
||||||
<span style="margin-top: -20px;float: right; display: block;"><%= link_to l(:label_more_information), forums_path %></span>
|
<span style="margin-top: -20px;float: right; display: block;"><%= link_to l(:label_more_information), forums_path %></span>
|
||||||
<div class="d-p-projectlist-box">
|
<div class="d-p-projectlist-box">
|
||||||
<ul class="d-p-projectlist">
|
<ul class="d-p-projectlist">
|
||||||
<% find_new_forum_topics(9 - @contest_notifications.count).each do |topic|%>
|
<% find_new_forum_topics(9 - @contest_notifications.count).each do |topic|%>
|
||||||
<li class="message-brief-intro" style="height: auto; line-height:2em; padding-bottom: 1px ">
|
<li class="message-brief-intro" style="height: auto; line-height:2em; padding-bottom: 1px ">
|
||||||
<div style="display: inline-block; width: 100%;">
|
<div style="display: inline-block; width: 100%;">
|
||||||
<span class="memo_activity text_nowrap" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">
|
<span class="memo_activity text_nowrap" style="color:gray; display: inline-block; margin-bottom:6px; background: url('/images/list-icon.png') no-repeat scroll ;background-position: left center;">
|
||||||
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %>
|
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %>
|
||||||
</span>
|
</span>
|
||||||
<div class='memo_activity memo_attr'>
|
<div class='memo_activity memo_attr'>
|
||||||
<span class='memo_timestamp'>
|
<span class='memo_timestamp'>
|
||||||
<%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
|
<%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
|
||||||
</span>
|
</span>
|
||||||
<span class="memo_author">
|
<span class="memo_author">
|
||||||
<%=l(:label_question_sponsor)%>: <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %>
|
<%=l(:label_question_sponsor)%>: <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %>
|
||||||
</span>
|
</span>
|
||||||
<span class="memo_last_person">
|
<span class="memo_last_person">
|
||||||
<%=l(:label_final_reply)%>: <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %><%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%><% end %>
|
<%=l(:label_final_reply)%>: <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %><%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%><% end %>
|
||||||
</span>
|
</span>
|
||||||
<span class="memo_reply">
|
<span class="memo_reply">
|
||||||
<%=l(:label_reply)%>(<%= link_to topic.try(:replies_count), topic.event_url %>)
|
<%=l(:label_reply)%>(<%= link_to topic.try(:replies_count), topic.event_url %>)
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="J_Slide" class="d-p-index-box d-p-index-left">
|
<div id="J_Slide" class="d-p-index-box d-p-index-left">
|
||||||
<h3 style="margin-left: 5px; color: #e8770d;"><strong><%=l(:label_current_attendingcontest_work)%></strong></h3>
|
<h3 style="margin-left: 5px; color: #e8770d;"><strong><%=l(:label_current_attendingcontest_work)%></strong></h3>
|
||||||
<span style="margin-top: -20px;float: right; display: block;"><%= link_to l(:label_more_information), {:controller => 'softapplications', :action => 'index'}, :target => "_blank" %></span>
|
<span style="margin-top: -20px;float: right; display: block;"><%= link_to l(:label_more_information), {:controller => 'softapplications', :action => 'index'}, :target => "_blank" %></span>
|
||||||
<div class="d-p-projectlist-box">
|
<div class="d-p-projectlist-box">
|
||||||
<% if Softapplication.count > 0%>
|
<% if Softapplication.count > 0%>
|
||||||
<div class="d-p-projectlist">
|
<div class="d-p-projectlist">
|
||||||
<% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %>
|
<% find_all_hot_softapplication.map do |softapplication| break if(softapplication == find_all_hot_softapplication[5]) %>
|
||||||
|
|
||||||
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
|
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
|
||||||
<div class="avatar-4" style="float: left; margin-top: 7px">
|
<div class="avatar-4" style="float: left; margin-top: 7px">
|
||||||
<%= image_tag('/images/app1.png')%>
|
<%= image_tag('/images/app1.png')%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="float: left; margin-left: 10px; margin-top: 7px;margin-bottom: -2px; width: 380px;">
|
<div style="float: left; margin-left: 10px; margin-top: 7px;margin-bottom: -2px; width: 380px;">
|
||||||
<%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %>
|
<%= link_to(softapplication.name, softapplication_path(softapplication.id), :class => "d-g-blue d-p-project-name", :title => "#{softapplication.name}", :target => "_blank") %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 10px; margin-bottom:1px; width: 380px;">
|
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 10px; margin-bottom:1px; width: 380px;">
|
||||||
<span class='font_lighter' title =<%=softapplication.description.to_s%>><%=softapplication.description.to_s.truncate(50, omission: '...')%></span>
|
<span class='font_lighter' title =<%=softapplication.description.to_s%>><%=softapplication.description.to_s.truncate(50, omission: '...')%></span>
|
||||||
</div><br />
|
</div><br />
|
||||||
|
|
||||||
<div style="padding-left: 55px; clear: left;">
|
<div style="padding-left: 55px; clear: left;">
|
||||||
<span class="font_lighter"><%=l(:label_release_time)%>: <%=format_time softapplication.created_at %></span>
|
<span class="font_lighter"><%=l(:label_release_time)%>: <%=format_time softapplication.created_at %></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<% end; reset_cycle %>
|
<% end; reset_cycle %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p class="font_lighter"><%= l(:label_no_ftapplication) %></p>
|
<p class="font_lighter"><%= l(:label_no_ftapplication) %></p>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
<%= render partial: 'link_to_another' %>
|
<%= render partial: 'link_to_another' %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,193 +1,193 @@
|
||||||
<% @nav_dispaly_project_label = 1
|
<% @nav_dispaly_project_label = 1
|
||||||
@nav_dispaly_forum_label = 1 %>
|
@nav_dispaly_forum_label = 1 %>
|
||||||
<%= stylesheet_link_tag 'welcome' %>
|
<%= stylesheet_link_tag 'welcome' %>
|
||||||
<%= javascript_include_tag 'welcome' %>
|
<%= javascript_include_tag 'welcome' %>
|
||||||
<script type="text/javascript" language="javascript">
|
<script type="text/javascript" language="javascript">
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
$("#main").find("a").attr("target", "_blank");
|
$("#main").find("a").attr("target", "_blank");
|
||||||
setCss();
|
setCss();
|
||||||
});
|
});
|
||||||
//设置div居中
|
//设置div居中
|
||||||
function setCss()
|
function setCss()
|
||||||
{
|
{
|
||||||
var mainBar = $('#main-content-bar')[0];
|
var mainBar = $('#main-content-bar')[0];
|
||||||
var topHeight = mainBar.offsetHeight;
|
var topHeight = mainBar.offsetHeight;
|
||||||
var welcomeLeft = $('#welcome_left')[0];
|
var welcomeLeft = $('#welcome_left')[0];
|
||||||
var leftHeight = welcomeLeft.offsetHeight;
|
var leftHeight = welcomeLeft.offsetHeight;
|
||||||
var searchbar = $('#search-bar')[0];
|
var searchbar = $('#search-bar')[0];
|
||||||
var searchHeight = searchbar.offsetHeight;
|
var searchHeight = searchbar.offsetHeight;
|
||||||
welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px";
|
welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px";
|
||||||
searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px";
|
searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px";
|
||||||
//alert((topHeight - leftHeight)/2 );
|
//alert((topHeight - leftHeight)/2 );
|
||||||
}
|
}
|
||||||
// 给主页用户弹新页面
|
// 给主页用户弹新页面
|
||||||
$(document).ready(function($) {
|
$(document).ready(function($) {
|
||||||
$("#loggedas").find("a").attr("target", "_blank");
|
$("#loggedas").find("a").attr("target", "_blank");
|
||||||
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
|
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class='top_bar'>
|
<div class='top_bar'>
|
||||||
<%#= render partial: 'wei_xin' %>
|
<%#= render partial: 'wei_xin' %>
|
||||||
<div class="main-content-bar" id="main-content-bar">
|
<div class="main-content-bar" id="main-content-bar">
|
||||||
<div style="float: left;padding-left:15px ">
|
<div style="float: left;padding-left:15px ">
|
||||||
<!-- <#%= image_tag(get_project_avatar(@first_page), size: "75x75") %> -->
|
<!-- <#%= image_tag(get_project_avatar(@first_page), size: "75x75") %> -->
|
||||||
<% if get_avatar?(@first_page) %>
|
<% if get_avatar?(@first_page) %>
|
||||||
<%= image_tag(url_to_avatar(@first_page), width:@first_page.image_width,height: @first_page.image_height) %>
|
<%= image_tag(url_to_avatar(@first_page), width:@first_page.image_width,height: @first_page.image_height) %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= image_tag '/images/transparent.png', width:@first_page.image_width,height: @first_page.image_height %>
|
<%= image_tag '/images/transparent.png', width:@first_page.image_width,height: @first_page.image_height %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="welcome_left" id="welcome_left">
|
<div class="welcome_left" id="welcome_left">
|
||||||
<% unless @first_page.nil? %>
|
<% unless @first_page.nil? %>
|
||||||
<%= @first_page.description.html_safe %>
|
<%= @first_page.description.html_safe %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-bar" id="search-bar">
|
<div class="search-bar" id="search-bar">
|
||||||
<%= render :partial => "search_project", :locals => {:project_type => 0}%>
|
<%= render :partial => "search_project", :locals => {:project_type => 0}%>
|
||||||
</div>
|
</div>
|
||||||
<div style="clear: both;"></div>
|
<div style="clear: both;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="clear:both"></div>
|
<div style="clear:both"></div>
|
||||||
|
|
||||||
<div id="J_Slide" class="d-p-index-box d-p-index-hot">
|
<div id="J_Slide" class="d-p-index-box d-p-index-hot">
|
||||||
<h3 style="margin-left: 5px; color: #e8770d;">
|
<h3 style="margin-left: 5px; color: #e8770d;">
|
||||||
<strong><%= l(:lable_hot_projects)%></strong>
|
<strong><%= l(:lable_hot_projects)%></strong>
|
||||||
</h3>
|
</h3>
|
||||||
<span style="margin-top: -20px;float: right; display: block;">
|
<span style="margin-top: -20px;float: right; display: block;">
|
||||||
<% if User.current.logged? %>
|
<% if User.current.logged? %>
|
||||||
<%= link_to(l(:label_project_new), {:controller => 'projects',
|
<%= link_to(l(:label_project_new), {:controller => 'projects',
|
||||||
:action => 'new',
|
:action => 'new',
|
||||||
:course => 0,
|
:course => 0,
|
||||||
:project_type =>( @project_type||=0)},
|
:project_type =>( @project_type||=0)},
|
||||||
:class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
|
:class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= link_to l(:label_more), { :controller => 'projects',
|
<%= link_to l(:label_more), { :controller => 'projects',
|
||||||
:action => 'index',
|
:action => 'index',
|
||||||
:project_type => 0,
|
:project_type => 0,
|
||||||
:host => Setting.project_domain},
|
:host => Setting.project_domain},
|
||||||
:target => "_blank" %>
|
:target => "_blank" %>
|
||||||
</span>
|
</span>
|
||||||
<div class="d-p-projectlist-box">
|
<div class="d-p-projectlist-box">
|
||||||
<ul class="d-p-projectlist">
|
<ul class="d-p-projectlist">
|
||||||
<% @projects.map do |project| %>
|
<% @projects.map do |project| %>
|
||||||
<li style="overflow:auto;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'>
|
<li style="overflow:auto;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'>
|
||||||
<div style="float: left;">
|
<div style="float: left;">
|
||||||
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
|
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
|
||||||
</div>
|
</div>
|
||||||
<!-- 上左下右 -->
|
<!-- 上左下右 -->
|
||||||
<div style="float: left; margin-left: 10px; width: 380px;">
|
<div style="float: left; margin-left: 10px; width: 380px;">
|
||||||
<% unless project.is_public %>
|
<% unless project.is_public %>
|
||||||
<span class="private_project"><%= l(:label_private) %></span>
|
<span class="private_project"><%= l(:label_private) %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
|
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
|
||||||
(<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>)
|
(<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>)
|
||||||
</div>
|
</div>
|
||||||
<div style=" float: left;margin:5px; margin-left: 10px; width: 380px;">
|
<div style=" float: left;margin:5px; margin-left: 10px; width: 380px;">
|
||||||
<span class='font_lighter' title ='<%=project.short_description%>'>
|
<span class='font_lighter' title ='<%=project.short_description%>'>
|
||||||
<%=project.description.truncate(100, omission: '...')%>
|
<%=project.description.truncate(100, omission: '...')%>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div >
|
<div >
|
||||||
<%= content_tag "span", l(:label_project_score)+ ":" + red_project_scores(project).to_i.to_s,
|
<%= content_tag "span", l(:label_project_score)+ ":" + red_project_scores(project).to_i.to_s,
|
||||||
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;",
|
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;",
|
||||||
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
|
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
|
||||||
:class => "tooltip",
|
:class => "tooltip",
|
||||||
:id => "tooltip-#{project.id}" %>
|
:id => "tooltip-#{project.id}" %>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<!--<%#end %> -->
|
<!--<%#end %> -->
|
||||||
<% end; reset_cycle %>
|
<% end; reset_cycle %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="J_Slide" class="d-p-index-box d-p-index-Dynamic">
|
<div id="J_Slide" class="d-p-index-box d-p-index-Dynamic">
|
||||||
<ul class="user-welcome-message-list">
|
<ul class="user-welcome-message-list">
|
||||||
<h3 style="color: rgb(21, 188, 207)"><strong><%= l(:lable_user_active)%></strong></h3>
|
<h3 style="color: rgb(21, 188, 207)"><strong><%= l(:lable_user_active)%></strong></h3>
|
||||||
<span style="margin-top: -20px;float: right; display: block;"><%= link_to l(:label_more), { :controller => 'users', :action => 'index'}, :target => "_blank" %></span>
|
<span style="margin-top: -20px;float: right; display: block;"><%= link_to l(:label_more), { :controller => 'users', :action => 'index'}, :target => "_blank" %></span>
|
||||||
<div class="user-message-box-list" style="margin-top: 10px;">
|
<div class="user-message-box-list" style="margin-top: 10px;">
|
||||||
<%activities = find_all_activities%>
|
<%activities = find_all_activities%>
|
||||||
<% activities.each do |event| %>
|
<% activities.each do |event| %>
|
||||||
<!--<%# cache cache_key_for_event(event) do %> -->
|
<!--<%# cache cache_key_for_event(event) do %> -->
|
||||||
<li style="display: block;height:60px; padding-bottom: 4px;">
|
<li style="display: block;height:60px; padding-bottom: 4px;">
|
||||||
<div class="inner-right" style="float: left; height: 100%; ">
|
<div class="inner-right" style="float: left; height: 100%; ">
|
||||||
<%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
|
<%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="inner-right" style="float: right; width:86%; height: 100%; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" >
|
<div class="inner-right" style="float: right; width:86%; height: 100%; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" >
|
||||||
<span style="color: green;">
|
<span style="color: green;">
|
||||||
<%= link_to event.event_author, (user_path(event.event_author) if event.event_author),
|
<%= link_to event.event_author, (user_path(event.event_author) if event.event_author),
|
||||||
:style => "color:green;", :target => "_blank" %>
|
:style => "color:green;", :target => "_blank" %>
|
||||||
</span>
|
</span>
|
||||||
<%= show_user_content event %>
|
<%= show_user_content event %>
|
||||||
<p style="margin-top: 4px;">
|
<p style="margin-top: 4px;">
|
||||||
<span style="color: rgb(172, 174, 177)">
|
<span style="color: rgb(172, 174, 177)">
|
||||||
<%= l(:field_updated_on) %>
|
<%= l(:field_updated_on) %>
|
||||||
<%= time_tag_welcome event.event_datetime %>前
|
<%= time_tag_welcome event.event_datetime %>前
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span style="float: right; color: rgb(172, 174, 177);">
|
<span style="float: right; color: rgb(172, 174, 177);">
|
||||||
<%= show_event_reply event %>
|
<%= show_event_reply event %>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="right" style="float: right; width: 48%; ">
|
<div class="right" style="float: right; width: 48%; ">
|
||||||
<ul class="welcome-message-list">
|
<ul class="welcome-message-list">
|
||||||
<!--<%# cache 'forum_links' do %> -->
|
<!--<%# cache 'forum_links' do %> -->
|
||||||
<div class="forum-topic" style="height: 25px; width: 98%; margin-left: 2px;">
|
<div class="forum-topic" style="height: 25px; width: 98%; margin-left: 2px;">
|
||||||
<h3 style="color: rgb(21, 188, 207);">
|
<h3 style="color: rgb(21, 188, 207);">
|
||||||
<strong><%= l(:lable_bar_active)%></strong>
|
<strong><%= l(:lable_bar_active)%></strong>
|
||||||
<%= link_to l(:label_my_question) , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
|
<%= link_to l(:label_my_question) , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
|
||||||
<%= link_to l(:label_my_feedback) , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
|
<%= link_to l(:label_my_feedback) , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
|
||||||
</h3>
|
</h3>
|
||||||
<span style="margin-top: -30px;float: right; display: block;"><%= link_to l(:label_more), forums_path %></span>
|
<span style="margin-top: -30px;float: right; display: block;"><%= link_to l(:label_more), forums_path %></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="welcome-box-list-new memo_activity">
|
<div class="welcome-box-list-new memo_activity">
|
||||||
<% topics = find_new_forum_topics(7) %>
|
<% topics = find_new_forum_topics(7) %>
|
||||||
<% topics.includes(:forum, :last_reply, :author).each do |topic|%>
|
<% topics.includes(:forum, :last_reply, :author).each do |topic|%>
|
||||||
<!--<%# cache cache_key_for_topic(topic) do %> -->
|
<!--<%# cache cache_key_for_topic(topic) do %> -->
|
||||||
<li class="message-brief-intro">
|
<li class="message-brief-intro">
|
||||||
<div class='memo_title text_nowrap'>
|
<div class='memo_title text_nowrap'>
|
||||||
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %>
|
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %>
|
||||||
<%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url,title: topic.subject %>
|
<%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url,title: topic.subject %>
|
||||||
</div>
|
</div>
|
||||||
<div class='memo_attr'>
|
<div class='memo_attr'>
|
||||||
<span class='memo_timestamp'>
|
<span class='memo_timestamp'>
|
||||||
<%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
|
<%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
|
||||||
</span>
|
</span>
|
||||||
<span class="memo_author">
|
<span class="memo_author">
|
||||||
<%= l(:label_question_sponsor)%>:
|
<%= l(:label_question_sponsor)%>:
|
||||||
<%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %>
|
<%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %>
|
||||||
</span>
|
</span>
|
||||||
<span class="memo_last_person">
|
<span class="memo_last_person">
|
||||||
<%= l(:label_final_reply)%>:
|
<%= l(:label_final_reply)%>:
|
||||||
<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %>
|
<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %>
|
||||||
<%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%>
|
<%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
<span class="memo_reply">
|
<span class="memo_reply">
|
||||||
<%= l(:label_reply)%>
|
<%= l(:label_reply)%>
|
||||||
(<%= link_to topic.try(:replies_count), topic.event_url %>)
|
(<%= link_to topic.try(:replies_count), topic.event_url %>)
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<!--<%#end %> --> <!-- cache -->
|
<!--<%#end %> --> <!-- cache -->
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
<%= render partial: 'link_to_another' %>
|
<%= render partial: 'link_to_another' %>
|
|
@ -1,33 +1,33 @@
|
||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<%= link_to(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %>
|
<%= link_to(l(:label_history), {:action => 'history', :id => @page.title}, :class => 'icon icon-history') %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= wiki_page_breadcrumb(@page) %>
|
<%= wiki_page_breadcrumb(@page) %>
|
||||||
|
|
||||||
<h3>
|
<h3>
|
||||||
<%= h(@page.pretty_title) %>
|
<%= h(@page.pretty_title) %>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<%= l(:label_version) %>
|
<%= l(:label_version) %>
|
||||||
<%= link_to @diff.content_from.version, :action => 'show', :id => @page.title, :project_id => @page.project, :version => @diff.content_from.version %>
|
<%= link_to @diff.content_from.version, :action => 'show', :id => @page.title, :project_id => @page.project, :version => @diff.content_from.version %>
|
||||||
<em>
|
<em>
|
||||||
(<%= @diff.content_from.author ? @diff.content_from.author.name : l(:label_user_anonymous)%>,
|
(<%= @diff.content_from.author ? @diff.content_from.author.name : l(:label_user_anonymous)%>,
|
||||||
<%= format_time(@diff.content_from.updated_on) %>)
|
<%= format_time(@diff.content_from.updated_on) %>)
|
||||||
</em>
|
</em>
|
||||||
→
|
→
|
||||||
<%= l(:label_version) %>
|
<%= l(:label_version) %>
|
||||||
<%= link_to @diff.content_to.version, :action => 'show',
|
<%= link_to @diff.content_to.version, :action => 'show',
|
||||||
:id => @page.title, :project_id => @page.project,
|
:id => @page.title, :project_id => @page.project,
|
||||||
:version => @diff.content_to.version %>
|
:version => @diff.content_to.version %>
|
||||||
/
|
/
|
||||||
<%= @page.content.version %>
|
<%= @page.content.version %>
|
||||||
<em>
|
<em>
|
||||||
(<%= @diff.content_to.author ? link_to_user(@diff.content_to.author.name) : l(:label_user_anonymous)%>,
|
(<%= @diff.content_to.author ? link_to_user(@diff.content_to.author.name) : l(:label_user_anonymous)%>,
|
||||||
<%= format_time(@diff.content_to.updated_on) %>)
|
<%= format_time(@diff.content_to.updated_on) %>)
|
||||||
</em>
|
</em>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="text-diff" style=" width: 100%;word-break: break-all;word-wrap: break-word;">
|
<div class="text-diff" style=" width: 100%;word-break: break-all;word-wrap: break-word;">
|
||||||
<%= simple_format_without_paragraph @diff.to_html %>
|
<%= simple_format_without_paragraph @diff.to_html %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,62 +1,62 @@
|
||||||
<%= wiki_page_breadcrumb(@page) %>
|
<%= wiki_page_breadcrumb(@page) %>
|
||||||
|
|
||||||
<script src="http://<%= Setting.host_name%>/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
|
<script src="http://<%= Setting.host_name%>/javascripts/ckeditor/ckeditor.js?1404953555" type="text/javascript"></script>
|
||||||
<h3 style="word-break: break-all;word-wrap: break-word;">
|
<h3 style="word-break: break-all;word-wrap: break-word;">
|
||||||
<%= h @page.pretty_title %>
|
<%= h @page.pretty_title %>
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<%= form_for @content, :as => :content,
|
<%= form_for @content, :as => :content,
|
||||||
:url => {:action => 'update', :id => @page.title},
|
:url => {:action => 'update', :id => @page.title},
|
||||||
:html => {:method => :put, :multipart => true, :id => 'wiki_form'} do |f| %>
|
:html => {:method => :put, :multipart => true, :id => 'wiki_form'} do |f| %>
|
||||||
<%= f.hidden_field :version %>
|
<%= f.hidden_field :version %>
|
||||||
<% if @section %>
|
<% if @section %>
|
||||||
<%= hidden_field_tag 'section', @section %>
|
<%= hidden_field_tag 'section', @section %>
|
||||||
<%= hidden_field_tag 'section_hash', @section_hash %>
|
<%= hidden_field_tag 'section_hash', @section_hash %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= error_messages_for 'content' %>
|
<%= error_messages_for 'content' %>
|
||||||
|
|
||||||
<div class="actions" style="max-width:680px">
|
<div class="actions" style="max-width:680px">
|
||||||
<p style="max-width:680px;">
|
<p style="max-width:680px;">
|
||||||
<%=text_area_tag 'content[text]', @text, :required => true, :id => 'editor02', :cols => 100, :rows => 25 %>
|
<%=text_area_tag 'content[text]', @text, :required => true, :id => 'editor02', :cols => 100, :rows => 25 %>
|
||||||
</p>
|
</p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var ckeditor=CKEDITOR.replace('editor02',{height: '300'});
|
var ckeditor=CKEDITOR.replace('editor02',{height: '300'});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="box tabular">
|
<div class="box tabular">
|
||||||
<% if @page.safe_attribute_names.include?('parent_id') && @wiki.pages.any? %>
|
<% if @page.safe_attribute_names.include?('parent_id') && @wiki.pages.any? %>
|
||||||
<%= fields_for @page do |fp| %>
|
<%= fields_for @page do |fp| %>
|
||||||
<p>
|
<p>
|
||||||
<label>
|
<label>
|
||||||
<%= l(:field_parent_title) %>
|
<%= l(:field_parent_title) %>
|
||||||
</label>
|
</label>
|
||||||
<%= fp.select :parent_id,content_tag('option', '', :value => '') + wiki_page_options_for_select(@wiki.pages.all(:include => :parent) - @page.self_and_descendants, @page.parent) %>
|
<%= fp.select :parent_id,content_tag('option', '', :value => '') + wiki_page_options_for_select(@wiki.pages.all(:include => :parent) - @page.self_and_descendants, @page.parent) %>
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<p style="width: 100%;">
|
<p style="width: 100%;">
|
||||||
<label>
|
<label>
|
||||||
<%= l(:field_comments) %>
|
<%= l(:field_comments) %>
|
||||||
</label>
|
</label>
|
||||||
<%= f.text_field :comments, :style => "width:75%;" %>
|
<%= f.text_field :comments, :style => "width:75%;" %>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label>
|
<label>
|
||||||
<%=l(:label_attachment_plural)%>
|
<%=l(:label_attachment_plural)%>
|
||||||
</label>
|
</label>
|
||||||
<%= render :partial => 'attachments/form' %>
|
<%= render :partial => 'attachments/form' %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<%= submit_tag l(:button_save) %>
|
<%= submit_tag l(:button_save) %>
|
||||||
</p>
|
</p>
|
||||||
<%= wikitoolbar_for 'content_text' %>
|
<%= wikitoolbar_for 'content_text' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div id="preview" class="wiki"></div>
|
<div id="preview" class="wiki"></div>
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
<%= robot_exclusion_tag %>
|
<%= robot_exclusion_tag %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% html_title @page.pretty_title %>
|
<% html_title @page.pretty_title %>
|
||||||
|
|
|
@ -1,170 +1,170 @@
|
||||||
# Redmine - project management software
|
# Redmine - project management software
|
||||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
module Redmine
|
module Redmine
|
||||||
module Acts
|
module Acts
|
||||||
module Attachable
|
module Attachable
|
||||||
def self.included(base)
|
def self.included(base)
|
||||||
base.extend ClassMethods
|
base.extend ClassMethods
|
||||||
end
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
def acts_as_attachable(options = {})
|
def acts_as_attachable(options = {})
|
||||||
cattr_accessor :attachable_options
|
cattr_accessor :attachable_options
|
||||||
self.attachable_options = {}
|
self.attachable_options = {}
|
||||||
attachable_options[:view_permission] = options.delete(:view_permission) || "view_#{self.name.pluralize.underscore}".to_sym
|
attachable_options[:view_permission] = options.delete(:view_permission) || "view_#{self.name.pluralize.underscore}".to_sym
|
||||||
attachable_options[:delete_permission] = options.delete(:delete_permission) || "edit_#{self.name.pluralize.underscore}".to_sym
|
attachable_options[:delete_permission] = options.delete(:delete_permission) || "edit_#{self.name.pluralize.underscore}".to_sym
|
||||||
|
|
||||||
has_many :attachments, options.merge(:as => :container,
|
has_many :attachments, options.merge(:as => :container,
|
||||||
:order => "#{Attachment.table_name}.created_on ASC, #{Attachment.table_name}.id ASC",
|
:order => "#{Attachment.table_name}.created_on ASC, #{Attachment.table_name}.id ASC",
|
||||||
:dependent => :destroy)
|
:dependent => :destroy)
|
||||||
send :include, Redmine::Acts::Attachable::InstanceMethods
|
send :include, Redmine::Acts::Attachable::InstanceMethods
|
||||||
before_save :attach_saved_attachments
|
before_save :attach_saved_attachments
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module InstanceMethods
|
module InstanceMethods
|
||||||
def self.included(base)
|
def self.included(base)
|
||||||
base.extend ClassMethods
|
base.extend ClassMethods
|
||||||
end
|
end
|
||||||
|
|
||||||
def attachments_visible?(user=User.current)
|
def attachments_visible?(user=User.current)
|
||||||
if self.respond_to?(:project)
|
if self.respond_to?(:project)
|
||||||
(respond_to?(:visible?) ? visible?(user) : true) &&
|
(respond_to?(:visible?) ? visible?(user) : true) &&
|
||||||
user.allowed_to?(self.class.attachable_options[:view_permission], self.project)
|
user.allowed_to?(self.class.attachable_options[:view_permission], self.project)
|
||||||
else
|
else
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def attachments_deletable?(user=User.current)
|
def attachments_deletable?(user=User.current)
|
||||||
if (self.has_attribute?(:course) ||self.has_attribute?(:course_id)) && self.course
|
if (self.has_attribute?(:course) ||self.has_attribute?(:course_id)) && self.course
|
||||||
#默认给予删除自己上传的附件的权限
|
#默认给予删除自己上传的附件的权限
|
||||||
(respond_to?(:visible?) ? visible?(user) : true) &&
|
(respond_to?(:visible?) ? visible?(user) : true) &&
|
||||||
(user.allowed_to?(self.class.attachable_options[:delete_permission], self.course) || (self.has_attribute?(:author_id) && self.author == user))
|
(user.allowed_to?(self.class.attachable_options[:delete_permission], self.course) || (self.has_attribute?(:author_id) && self.author == user))
|
||||||
else
|
else
|
||||||
#默认给予删除自己上传的附件的权限
|
#默认给予删除自己上传的附件的权限
|
||||||
(respond_to?(:visible?) ? visible?(user) : true) &&
|
(respond_to?(:visible?) ? visible?(user) : true) &&
|
||||||
(user.allowed_to?(self.class.attachable_options[:delete_permission], self.project) || (self.has_attribute?(:author_id) && self.author == user))
|
(user.allowed_to?(self.class.attachable_options[:delete_permission], self.project) || (self.has_attribute?(:author_id) && self.author == user))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def saved_attachments
|
def saved_attachments
|
||||||
@saved_attachments ||= []
|
@saved_attachments ||= []
|
||||||
end
|
end
|
||||||
|
|
||||||
def unsaved_attachments
|
def unsaved_attachments
|
||||||
@unsaved_attachments ||= []
|
@unsaved_attachments ||= []
|
||||||
end
|
end
|
||||||
|
|
||||||
# 设置资源文件的公开属性
|
# 设置资源文件的公开属性
|
||||||
# add by nwb
|
# add by nwb
|
||||||
def set_attachment_public(res)
|
def set_attachment_public(res)
|
||||||
# 公开的资源判断他的父级的公开属性
|
# 公开的资源判断他的父级的公开属性
|
||||||
if res.is_public
|
if res.is_public
|
||||||
if( (self.class.to_s=="Project" && self.is_public == false) ||
|
if( (self.class.to_s=="Project" && self.is_public == false) ||
|
||||||
(self.has_attribute?(:project) && self.project && self.project.is_public == false) ||
|
(self.has_attribute?(:project) && self.project && self.project.is_public == false) ||
|
||||||
(self.has_attribute?(:board) && self.board.project && self.board.project.is_public == false) ||
|
(self.has_attribute?(:board) && self.board.project && self.board.project.is_public == false) ||
|
||||||
(self.class.to_s=="HomeworkAttach" && self.bid.reward_type == 3) ||
|
(self.class.to_s=="HomeworkAttach" && self.bid.reward_type == 3) ||
|
||||||
(self.class.to_s=="Course" && self.is_public == false) ||
|
(self.class.to_s=="Course" && self.is_public == false) ||
|
||||||
(self.has_attribute?(:course) && self.course && self.course.is_public == false) ||
|
(self.has_attribute?(:course) && self.course && self.course.is_public == false) ||
|
||||||
(self.has_attribute?(:board) && self.board.course && self.board.course.is_public == false)
|
(self.has_attribute?(:board) && self.board.course && self.board.course.is_public == false)
|
||||||
)
|
)
|
||||||
res.is_public = false
|
res.is_public = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_attachmentsex(attachments, author=User.current,attachment_type)
|
def save_attachmentsex(attachments, author=User.current,attachment_type)
|
||||||
@curattachment_type = attachment_type
|
@curattachment_type = attachment_type
|
||||||
result = save_attachments(attachments,author)
|
result = save_attachments(attachments,author)
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_attachments(attachments, author=User.current)
|
def save_attachments(attachments, author=User.current)
|
||||||
# 清除临时文件
|
# 清除临时文件
|
||||||
if attachments
|
if attachments
|
||||||
tempAttach = attachments[:dummy]
|
tempAttach = attachments[:dummy]
|
||||||
if tempAttach && tempAttach[:file]
|
if tempAttach && tempAttach[:file]
|
||||||
attachments.delete(:dummy)
|
attachments.delete(:dummy)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if attachments.is_a?(Hash)
|
if attachments.is_a?(Hash)
|
||||||
attachments = attachments.stringify_keys
|
attachments = attachments.stringify_keys
|
||||||
attachments = attachments.to_a.sort {|a, b|
|
attachments = attachments.to_a.sort {|a, b|
|
||||||
if a.first.to_i > 0 && b.first.to_i > 0
|
if a.first.to_i > 0 && b.first.to_i > 0
|
||||||
a.first.to_i <=> b.first.to_i
|
a.first.to_i <=> b.first.to_i
|
||||||
elsif a.first.to_i > 0
|
elsif a.first.to_i > 0
|
||||||
1
|
1
|
||||||
elsif b.first.to_i > 0
|
elsif b.first.to_i > 0
|
||||||
-1
|
-1
|
||||||
else
|
else
|
||||||
a.first <=> b.first
|
a.first <=> b.first
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
attachments = attachments.map(&:last)
|
attachments = attachments.map(&:last)
|
||||||
end
|
end
|
||||||
if attachments.is_a?(Array)
|
if attachments.is_a?(Array)
|
||||||
attachments.each do |attachment|
|
attachments.each do |attachment|
|
||||||
if attachment.is_a?(Hash)
|
if attachment.is_a?(Hash)
|
||||||
a = nil
|
a = nil
|
||||||
file = attachment['file']
|
file = attachment['file']
|
||||||
token = attachment['token']
|
token = attachment['token']
|
||||||
t = file && file.size > 0
|
t = file && file.size > 0
|
||||||
if file && file.size > 0
|
if file && file.size > 0
|
||||||
a = Attachment.create(:file => file, :author => author)
|
a = Attachment.create(:file => file, :author => author)
|
||||||
elsif token
|
elsif token
|
||||||
a = Attachment.find_by_token_only(token)
|
a = Attachment.find_by_token_only(token)
|
||||||
if a
|
if a
|
||||||
a.filename = attachment['filename'] unless attachment['filename'].blank?
|
a.filename = attachment['filename'] unless attachment['filename'].blank?
|
||||||
a.content_type = attachment['content_type']
|
a.content_type = attachment['content_type']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if a && !attachment['is_public_checkbox']
|
if a && !attachment['is_public_checkbox']
|
||||||
a.is_public = false
|
a.is_public = false
|
||||||
elsif a && attachment['is_public_checkbox']
|
elsif a && attachment['is_public_checkbox']
|
||||||
a.is_public = true
|
a.is_public = true
|
||||||
end
|
end
|
||||||
set_attachment_public(a) if a
|
set_attachment_public(a) if a
|
||||||
next unless a
|
next unless a
|
||||||
a.description = attachment['description'].to_s.strip
|
a.description = attachment['description'].to_s.strip
|
||||||
a.attachtype = @curattachment_type
|
a.attachtype = @curattachment_type
|
||||||
if a.new_record?
|
if a.new_record?
|
||||||
unsaved_attachments << a
|
unsaved_attachments << a
|
||||||
else
|
else
|
||||||
saved_attachments << a
|
saved_attachments << a
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
{:files => saved_attachments, :unsaved => unsaved_attachments}
|
{:files => saved_attachments, :unsaved => unsaved_attachments}
|
||||||
end
|
end
|
||||||
|
|
||||||
def attach_saved_attachments
|
def attach_saved_attachments
|
||||||
saved_attachments.each do |attachment|
|
saved_attachments.each do |attachment|
|
||||||
self.attachments << attachment
|
self.attachments << attachment
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,233 +1,233 @@
|
||||||
/* Redmine - project management software
|
/* Redmine - project management software
|
||||||
Copyright (C) 2006-2013 Jean-Philippe Lang */
|
Copyright (C) 2006-2013 Jean-Philippe Lang */
|
||||||
|
|
||||||
function postUpMsg(attachmentId)
|
function postUpMsg(attachmentId)
|
||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/attachments/renderTag',
|
url: '/attachments/renderTag',
|
||||||
type: "GET",
|
type: "GET",
|
||||||
data: {
|
data: {
|
||||||
attachmentId: attachmentId
|
attachmentId: attachmentId
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function addFile(inputEl, file, eagerUpload) {
|
function addFile(inputEl, file, eagerUpload) {
|
||||||
|
|
||||||
if ($('#attachments_fields').children().length < 10) {
|
if ($('#attachments_fields').children().length < 10) {
|
||||||
|
|
||||||
var attachmentId = addFile.nextAttachmentId++;
|
var attachmentId = addFile.nextAttachmentId++;
|
||||||
|
|
||||||
var fileSpan = $('<span>', { 'id': 'attachments_' + attachmentId, 'class':'attachment' });
|
var fileSpan = $('<span>', { 'id': 'attachments_' + attachmentId, 'class':'attachment' });
|
||||||
|
|
||||||
fileSpan.append(
|
fileSpan.append(
|
||||||
$('<input>', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name),
|
$('<input>', { 'type': 'text', 'class': 'filename readonly', 'name': 'attachments[' + attachmentId + '][filename]', 'readonly': 'readonly'} ).val(file.name),
|
||||||
$('<input>', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 254, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload),
|
$('<input>', { 'type': 'text', 'class': 'description', 'name': 'attachments[' + attachmentId + '][description]', 'maxlength': 254, 'placeholder': $(inputEl).data('description-placeholder') } ).toggle(!eagerUpload),
|
||||||
$('<span >公开:</span>').attr({ 'class': 'ispublic-label' }) ,
|
$('<span >公开:</span>').attr({ 'class': 'ispublic-label' }) ,
|
||||||
$('<input>', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public_checkbox]', checked:'checked' } ).toggle(!eagerUpload),
|
$('<input>', { 'type': 'checkbox', 'class': 'is_public_checkbox','value':1, 'name': 'attachments[' + attachmentId + '][is_public_checkbox]', checked:'checked' } ).toggle(!eagerUpload),
|
||||||
$('<a> </a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload),
|
$('<a> </a>').attr({ 'href': "#", 'class': 'remove-upload', 'data-confirm' : "您确定要删除吗?" }).click(removeFile).toggle(!eagerUpload),
|
||||||
$('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )
|
$('<div>', { 'class': 'div_attachments', 'name': 'div_'+'attachments_' + attachmentId} )
|
||||||
).appendTo('#attachments_fields');
|
).appendTo('#attachments_fields');
|
||||||
|
|
||||||
if(eagerUpload) {
|
if(eagerUpload) {
|
||||||
ajaxUpload(file, attachmentId, fileSpan, inputEl);
|
ajaxUpload(file, attachmentId, fileSpan, inputEl);
|
||||||
|
|
||||||
}
|
}
|
||||||
return attachmentId;
|
return attachmentId;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
addFile.nextAttachmentId = 1;
|
addFile.nextAttachmentId = 1;
|
||||||
|
|
||||||
function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
|
function ajaxUpload(file, attachmentId, fileSpan, inputEl) {
|
||||||
|
|
||||||
function onLoadstart(e) {
|
function onLoadstart(e) {
|
||||||
fileSpan.removeClass('ajax-waiting');
|
fileSpan.removeClass('ajax-waiting');
|
||||||
fileSpan.addClass('ajax-loading');
|
fileSpan.addClass('ajax-loading');
|
||||||
$('input:submit', $(this).parents('form')).attr('disabled', 'disabled');
|
$('input:submit', $(this).parents('form')).attr('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onProgress(e) {
|
function onProgress(e) {
|
||||||
if(e.lengthComputable) {
|
if(e.lengthComputable) {
|
||||||
this.progressbar( 'value', e.loaded * 100 / e.total );
|
this.progressbar( 'value', e.loaded * 100 / e.total );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function actualUpload(file, attachmentId, fileSpan, inputEl) {
|
function actualUpload(file, attachmentId, fileSpan, inputEl) {
|
||||||
|
|
||||||
ajaxUpload.uploading++;
|
ajaxUpload.uploading++;
|
||||||
|
|
||||||
uploadBlob(file, $(inputEl).data('upload-path'), attachmentId, {
|
uploadBlob(file, $(inputEl).data('upload-path'), attachmentId, {
|
||||||
loadstartEventHandler: onLoadstart.bind(progressSpan),
|
loadstartEventHandler: onLoadstart.bind(progressSpan),
|
||||||
progressEventHandler: onProgress.bind(progressSpan)
|
progressEventHandler: onProgress.bind(progressSpan)
|
||||||
})
|
})
|
||||||
.done(function(result) {
|
.done(function(result) {
|
||||||
progressSpan.progressbar( 'value', 100 ).remove();
|
progressSpan.progressbar( 'value', 100 ).remove();
|
||||||
fileSpan.find('input.description, a').css('display', 'inline-block');
|
fileSpan.find('input.description, a').css('display', 'inline-block');
|
||||||
fileSpan.find('input.is_public_checkbox, a').css('display', 'inline-block');
|
fileSpan.find('input.is_public_checkbox, a').css('display', 'inline-block');
|
||||||
})
|
})
|
||||||
.fail(function(result) {
|
.fail(function(result) {
|
||||||
progressSpan.text(result.statusText);
|
progressSpan.text(result.statusText);
|
||||||
if($("#network_issue"))
|
if($("#network_issue"))
|
||||||
{
|
{
|
||||||
$("#network_issue").show();
|
$("#network_issue").show();
|
||||||
}
|
}
|
||||||
}).always(function() {
|
}).always(function() {
|
||||||
ajaxUpload.uploading--;
|
ajaxUpload.uploading--;
|
||||||
fileSpan.removeClass('ajax-loading');
|
fileSpan.removeClass('ajax-loading');
|
||||||
var form = fileSpan.parents('form');
|
var form = fileSpan.parents('form');
|
||||||
if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) {
|
if (form.queue('upload').length == 0 && ajaxUpload.uploading == 0) {
|
||||||
$('input:submit', form).removeAttr('disabled');
|
$('input:submit', form).removeAttr('disabled');
|
||||||
}
|
}
|
||||||
form.dequeue('upload');
|
form.dequeue('upload');
|
||||||
});
|
});
|
||||||
|
|
||||||
//gcm files count and add delete_all link
|
//gcm files count and add delete_all link
|
||||||
|
|
||||||
var count=$('#attachments_fields>span').length;
|
var count=$('#attachments_fields>span').length;
|
||||||
$('#upload_file_count').html("已上传"+"<span id=\"count\">"+count+"</span>"+"个文件");
|
$('#upload_file_count').html("已上传"+"<span id=\"count\">"+count+"</span>"+"个文件");
|
||||||
|
|
||||||
if(count>=1){
|
if(count>=1){
|
||||||
var add_attachs=$('.add_attachment');
|
var add_attachs=$('.add_attachment');
|
||||||
var delete_all=$('.remove_all');
|
var delete_all=$('.remove_all');
|
||||||
if(delete_all.length<1){
|
if(delete_all.length<1){
|
||||||
add_attachs.append($("<a> </a>").attr({"href":"javascript:void(0)", 'class': 'remove_all',"onclick": "removeAll()"}));
|
add_attachs.append($("<a> </a>").attr({"href":"javascript:void(0)", 'class': 'remove_all',"onclick": "removeAll()"}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//gcm
|
//gcm
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var progressSpan = $('<div>').insertAfter(fileSpan.find('input.filename'));
|
var progressSpan = $('<div>').insertAfter(fileSpan.find('input.filename'));
|
||||||
progressSpan.progressbar();
|
progressSpan.progressbar();
|
||||||
fileSpan.addClass('ajax-waiting');
|
fileSpan.addClass('ajax-waiting');
|
||||||
|
|
||||||
var maxSyncUpload = $(inputEl).data('max-concurrent-uploads');
|
var maxSyncUpload = $(inputEl).data('max-concurrent-uploads');
|
||||||
|
|
||||||
if(maxSyncUpload == null || maxSyncUpload <= 0 || ajaxUpload.uploading < maxSyncUpload)
|
if(maxSyncUpload == null || maxSyncUpload <= 0 || ajaxUpload.uploading < maxSyncUpload)
|
||||||
actualUpload(file, attachmentId, fileSpan, inputEl);
|
actualUpload(file, attachmentId, fileSpan, inputEl);
|
||||||
else
|
else
|
||||||
$(inputEl).parents('form').queue('upload', actualUpload.bind(this, file, attachmentId, fileSpan, inputEl));
|
$(inputEl).parents('form').queue('upload', actualUpload.bind(this, file, attachmentId, fileSpan, inputEl));
|
||||||
}
|
}
|
||||||
|
|
||||||
ajaxUpload.uploading = 0;
|
ajaxUpload.uploading = 0;
|
||||||
|
|
||||||
function removeFile() {
|
function removeFile() {
|
||||||
$(this).parent('span').remove();
|
$(this).parent('span').remove();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//gcm delete all file
|
//gcm delete all file
|
||||||
function removeAll(){
|
function removeAll(){
|
||||||
if(confirm("您确定要删除所有文件吗?")){
|
if(confirm("您确定要删除所有文件吗?")){
|
||||||
$(".remove-upload").removeAttr("data-confirm");
|
$(".remove-upload").removeAttr("data-confirm");
|
||||||
$(".remove-upload").click();
|
$(".remove-upload").click();
|
||||||
}
|
}
|
||||||
// return false;
|
// return false;
|
||||||
}
|
}
|
||||||
//gcm
|
//gcm
|
||||||
|
|
||||||
function uploadBlob(blob, uploadUrl, attachmentId, options) {
|
function uploadBlob(blob, uploadUrl, attachmentId, options) {
|
||||||
|
|
||||||
var actualOptions = $.extend({
|
var actualOptions = $.extend({
|
||||||
loadstartEventHandler: $.noop,
|
loadstartEventHandler: $.noop,
|
||||||
progressEventHandler: $.noop
|
progressEventHandler: $.noop
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
uploadUrl = uploadUrl + '?attachment_id=' + attachmentId;
|
uploadUrl = uploadUrl + '?attachment_id=' + attachmentId;
|
||||||
if (blob instanceof window.File) {
|
if (blob instanceof window.File) {
|
||||||
uploadUrl += '&filename=' + encodeURIComponent(blob.name);
|
uploadUrl += '&filename=' + encodeURIComponent(blob.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $.ajax(uploadUrl, {
|
return $.ajax(uploadUrl, {
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
contentType: 'application/octet-stream',
|
contentType: 'application/octet-stream',
|
||||||
beforeSend: function(jqXhr) {
|
beforeSend: function(jqXhr) {
|
||||||
jqXhr.setRequestHeader('Accept', 'application/js');
|
jqXhr.setRequestHeader('Accept', 'application/js');
|
||||||
},
|
},
|
||||||
xhr: function() {
|
xhr: function() {
|
||||||
var xhr = $.ajaxSettings.xhr();
|
var xhr = $.ajaxSettings.xhr();
|
||||||
xhr.upload.onloadstart = actualOptions.loadstartEventHandler;
|
xhr.upload.onloadstart = actualOptions.loadstartEventHandler;
|
||||||
xhr.upload.onprogress = actualOptions.progressEventHandler;
|
xhr.upload.onprogress = actualOptions.progressEventHandler;
|
||||||
return xhr;
|
return xhr;
|
||||||
},
|
},
|
||||||
data: blob,
|
data: blob,
|
||||||
cache: false,
|
cache: false,
|
||||||
processData: false
|
processData: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function addInputFiles(inputEl) {
|
function addInputFiles(inputEl) {
|
||||||
// var clearedFileInput = $(inputEl).clone().val('');
|
// var clearedFileInput = $(inputEl).clone().val('');
|
||||||
|
|
||||||
if (inputEl.files) {
|
if (inputEl.files) {
|
||||||
// upload files using ajax
|
// upload files using ajax
|
||||||
uploadAndAttachFiles(inputEl.files, inputEl);
|
uploadAndAttachFiles(inputEl.files, inputEl);
|
||||||
// $(inputEl).remove();
|
// $(inputEl).remove();
|
||||||
} else {
|
} else {
|
||||||
// browser not supporting the file API, upload on form submission
|
// browser not supporting the file API, upload on form submission
|
||||||
var attachmentId;
|
var attachmentId;
|
||||||
var aFilename = inputEl.value.split(/\/|\\/);
|
var aFilename = inputEl.value.split(/\/|\\/);
|
||||||
attachmentId = addFile(inputEl, { name: aFilename[ aFilename.length - 1 ] }, false);
|
attachmentId = addFile(inputEl, { name: aFilename[ aFilename.length - 1 ] }, false);
|
||||||
if (attachmentId) {
|
if (attachmentId) {
|
||||||
$(inputEl).attr({ name: 'attachments[' + attachmentId + '][file]', style: 'display:none;' }).appendTo('#attachments_' + attachmentId);
|
$(inputEl).attr({ name: 'attachments[' + attachmentId + '][file]', style: 'display:none;' }).appendTo('#attachments_' + attachmentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//clearedFileInput.insertAfter('#attachments_fields');
|
//clearedFileInput.insertAfter('#attachments_fields');
|
||||||
}
|
}
|
||||||
|
|
||||||
function uploadAndAttachFiles(files, inputEl) {
|
function uploadAndAttachFiles(files, inputEl) {
|
||||||
|
|
||||||
var maxFileSize = $(inputEl).data('max-file-size');
|
var maxFileSize = $(inputEl).data('max-file-size');
|
||||||
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
|
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
|
||||||
|
|
||||||
var sizeExceeded = false;
|
var sizeExceeded = false;
|
||||||
$.each(files, function() {
|
$.each(files, function() {
|
||||||
if (this.size && maxFileSize != null && this.size > parseInt(maxFileSize)) {sizeExceeded=true;}
|
if (this.size && maxFileSize != null && this.size > parseInt(maxFileSize)) {sizeExceeded=true;}
|
||||||
});
|
});
|
||||||
if (sizeExceeded) {
|
if (sizeExceeded) {
|
||||||
window.alert(maxFileSizeExceeded);
|
window.alert(maxFileSizeExceeded);
|
||||||
} else {
|
} else {
|
||||||
$.each(files, function() {addFile(inputEl, this, true);});
|
$.each(files, function() {addFile(inputEl, this, true);});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleFileDropEvent(e) {
|
function handleFileDropEvent(e) {
|
||||||
|
|
||||||
$(this).removeClass('fileover');
|
$(this).removeClass('fileover');
|
||||||
blockEventPropagation(e);
|
blockEventPropagation(e);
|
||||||
|
|
||||||
if ($.inArray('Files', e.dataTransfer.types) > -1) {
|
if ($.inArray('Files', e.dataTransfer.types) > -1) {
|
||||||
uploadAndAttachFiles(e.dataTransfer.files, $('input:file.file_selector'));
|
uploadAndAttachFiles(e.dataTransfer.files, $('input:file.file_selector'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function dragOverHandler(e) {
|
function dragOverHandler(e) {
|
||||||
$(this).addClass('fileover');
|
$(this).addClass('fileover');
|
||||||
blockEventPropagation(e);
|
blockEventPropagation(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
function dragOutHandler(e) {
|
function dragOutHandler(e) {
|
||||||
$(this).removeClass('fileover');
|
$(this).removeClass('fileover');
|
||||||
blockEventPropagation(e);
|
blockEventPropagation(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupFileDrop() {
|
function setupFileDrop() {
|
||||||
if (window.File && window.FileList && window.ProgressEvent && window.FormData) {
|
if (window.File && window.FileList && window.ProgressEvent && window.FormData) {
|
||||||
|
|
||||||
$.event.fixHooks.drop = { props: [ 'dataTransfer' ] };
|
$.event.fixHooks.drop = { props: [ 'dataTransfer' ] };
|
||||||
|
|
||||||
$('form div.box').has('input:file').each(function() {
|
$('form div.box').has('input:file').each(function() {
|
||||||
$(this).on({
|
$(this).on({
|
||||||
dragover: dragOverHandler,
|
dragover: dragOverHandler,
|
||||||
dragleave: dragOutHandler,
|
dragleave: dragOutHandler,
|
||||||
drop: handleFileDropEvent
|
drop: handleFileDropEvent
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(setupFileDrop);
|
$(document).ready(setupFileDrop);
|
||||||
|
|
Loading…
Reference in New Issue