Conflicts:
	app/views/welcome/index.html.erb
	config/locales/zh.yml
	config/routes.rb
This commit is contained in:
huang 2015-01-30 14:27:56 +08:00
commit 29df528af1
79 changed files with 1911 additions and 341 deletions

3
.gitignore vendored
View File

@ -7,8 +7,11 @@
/config/configuration.yml /config/configuration.yml
/files/* /files/*
/log/* /log/*
/public/tmp/*
/tmp/* /tmp/*
/public/cache/*
.gitignore .gitignore
/config/newrelic.yml
/public/images/avatars/* /public/images/avatars/*
/Gemfile /Gemfile
/Gemfile.lock /Gemfile.lock

View File

@ -0,0 +1,3 @@
#safe table
#Mon Jan 05 10:27:54 CST 2015
connections=connections.15

View File

@ -0,0 +1,4 @@
#safe table
#Mon Jan 05 10:27:54 CST 2015
defaultConnection=defaultConnection.15
sites=sites.15

View File

@ -0,0 +1,3 @@
#safe table
#Mon Jan 05 10:27:28 CST 2015
webservers=webservers.12

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<session version="1.0">&#x0A;<refactoring comment="Delete resource &apos;trustie2&apos;" deleteContents="false" description="Delete resource &apos;trustie2&apos;" element1="/trustie2" flags="7" id="org.eclipse.ltk.core.refactoring.delete.resources" resources="1" stamp="1420424676858"/>&#x0A;<refactoring comment="Delete resource &apos;trustie2&apos;" deleteContents="false" description="Delete resource &apos;trustie2&apos;" element1="/trustie2" flags="7" id="org.eclipse.ltk.core.refactoring.delete.resources" resources="1" stamp="1420424775104"/>
</session>

View File

@ -0,0 +1,2 @@
1420424676858 Delete resource 'trustie2'
1420424775104 Delete resource 'trustie2'

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<section name="RefactoringWizard.preview">
<item value="400" key="height"/>
<item value="600" key="width"/>
</section>
</section>

View File

@ -11,4 +11,16 @@
<item value="org.eclipse.rcp:3.7.2.v20120120-1424-9DB5FmnFq5JCf1UA38R-kz0S0272"/> <item value="org.eclipse.rcp:3.7.2.v20120120-1424-9DB5FmnFq5JCf1UA38R-kz0S0272"/>
<item value="org.radrails.rails:3.4.2.201308081726-7n-7Z7oKfjkqlemv"/> <item value="org.radrails.rails:3.4.2.201308081726-7n-7Z7oKfjkqlemv"/>
</list> </list>
<section name="ChooseWorkspaceDialogSettings">
<item value="316" key="DIALOG_Y_ORIGIN"/>
<item value="656" key="DIALOG_X_ORIGIN"/>
</section>
<section name="WORKBENCH_SETTINGS">
<list key="ENABLED_TRANSFERS">
</list>
</section>
<section name="ExternalProjectImportWizard">
<item value="false" key="WizardProjectsImportPage.STORE_ARCHIVE_SELECTED"/>
<item value="false" key="WizardProjectsImportPage.STORE_COPY_PROJECT_ID"/>
</section>
</section> </section>

View File

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench"> <section name="Workbench">
<section name="NewWizardAction">
</section>
<section name="ImportExportAction"> <section name="ImportExportAction">
<item value="com.aptana.projects.internal.wizards.PromoteToProjectWizard" key="ImportExportPage.STORE_SELECTED_IMPORT_WIZARD_ID"/> <item value="org.eclipse.ui.wizards.import.ExternalProject" key="ImportExportPage.STORE_SELECTED_IMPORT_WIZARD_ID"/>
<list key="ImportExportPage.STORE_EXPANDED_IMPORT_CATEGORIES"> <list key="ImportExportPage.STORE_EXPANDED_IMPORT_CATEGORIES">
<item value="org.eclipse.ui.Basic"/> <item value="org.eclipse.ui.Basic"/>
<item value="com.aptana.git.ui.clone.category"/> <item value="com.aptana.git.ui.clone.category"/>

12
Gemfile
View File

@ -3,13 +3,13 @@ source 'http://rubygems.org'
unless RUBY_PLATFORM =~ /w32/ unless RUBY_PLATFORM =~ /w32/
# unix-like only # unix-like only
gem 'iconv' gem 'iconv'
gem 'rubyzip' gem 'rubyzip'
gem 'zip-zip' gem 'zip-zip'
end end
gem 'grape', '~> 0.9.0' gem 'grape', '~> 0.9.0'
gem 'grape-entity' gem 'grape-entity'
gem 'seems_rateable', path: 'lib/seems_rateable' gem 'seems_rateable', path: 'lib/seems_rateable'
gem "rails", "3.2.13" gem "rails", "3.2.13"
gem "jquery-rails", "~> 2.0.2" gem "jquery-rails", "~> 2.0.2"
@ -23,9 +23,9 @@ gem 'ruby-ole'
#gem 'email_verifier' #gem 'email_verifier'
group :development do group :development do
gem 'grape-swagger' gem 'grape-swagger'
gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git' gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
#gem 'puma' #gem 'puma'
gem 'better_errors', path: 'lib/better_errors' gem 'better_errors', path: 'lib/better_errors'
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler' gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
end end

View File

@ -39,7 +39,7 @@ module Mobile
mount Apis::Homeworks mount Apis::Homeworks
#add_swagger_documentation ({api_version: 'v1', base_path: 'http://u06.shellinfo.cn/trustie/api'}) #add_swagger_documentation ({api_version: 'v1', base_path: 'http://u06.shellinfo.cn/trustie/api'})
add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development? #add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development?
end end
end end

View File

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/

View File

@ -0,0 +1,3 @@
// Place all the styles related to the system_log controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@ -828,6 +828,7 @@ class CoursesController < ApplicationController
end end
def show def show
# try to redirect to the requested menu item # try to redirect to the requested menu item
if params[:jump] && redirect_to_course_menu_item(@course, params[:jump]) if params[:jump] && redirect_to_course_menu_item(@course, params[:jump])
return return
@ -866,6 +867,7 @@ class CoursesController < ApplicationController
@activity.scope_select {|t| has["show_#{t}"]} @activity.scope_select {|t| has["show_#{t}"]}
# modify by nwb # modify by nwb
# 添加私密性判断 # 添加私密性判断
if User.current.member_of_course?(@course)|| User.current.admin? if User.current.member_of_course?(@course)|| User.current.admin?
events = @activity.events(@days, @course.created_at) events = @activity.events(@days, @course.created_at)
else else
@ -890,14 +892,13 @@ class CoursesController < ApplicationController
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)} @events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
# documents # documents
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category' @sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
# # 这写变量发现没有用而且拖慢速度
@teachers= searchTeacherAndAssistant(@course) #@teachers= searchTeacherAndAssistant(@course)
@canShowRealName = isCourseTeacher(User.current.id,@course) #@canShowRealName = isCourseTeacher(User.current.id,@course)
if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id))) if(User.find_by_id(CourseInfos.find_by_course_id(@course.id).try(:user_id)))
@user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id) @user = User.find_by_id(CourseInfos.find_by_course_id(@course.id).user_id)
end end
respond_to do |format| respond_to do |format|
format.html{render :layout => 'base_courses'} format.html{render :layout => 'base_courses'}
format.api format.api

View File

@ -83,6 +83,12 @@ class PollController < ApplicationController
def destroy def destroy
if @poll && @poll.destroy if @poll && @poll.destroy
if @is_teacher
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}")
else
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2")
end
@polls = paginateHelper polls,20 #分页
respond_to do |format| respond_to do |format|
format.js format.js
end end

View File

@ -31,16 +31,14 @@ class ProjectsController < ApplicationController
menu_item :feedback, :only => :feedback menu_item :feedback, :only => :feedback
menu_item l(:label_course_file), :only => :index menu_item l(:label_course_file), :only => :index
menu_item l(:label_course_news), :only => :index menu_item l(:label_course_news), :only => :index
# edit
before_filter :authorize1, :only => [:show]
#
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project] before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project]
# before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file, # before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file,
# :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share, # :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share,
# :show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index] # :show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index]
#此条勿删 课程相关权限 ,:new_homework,:homework,:feedback,,:member #此条勿删 课程相关权限 ,:new_homework,:homework,:feedback,,:member
before_filter :authorize, :only => [:settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course] before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close, :reopen,:view_homework_attaches,:course]
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches] before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar] before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
before_filter :file, :statistics, :watcherlist before_filter :file, :statistics, :watcherlist
@ -118,8 +116,8 @@ class ProjectsController < ApplicationController
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").joins("LEFT JOIN #{ProjectScore.table_name} ON #{Project.table_name}.id = #{ProjectScore.table_name}.project_id"). joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").joins("LEFT JOIN #{ProjectScore.table_name} ON #{Project.table_name}.id = #{ProjectScore.table_name}.project_id").
where("#{Project.table_name}.project_type = ? ", Project::ProjectType_project) where("#{Project.table_name}.project_type = ? ", Project::ProjectType_project)
@poll_questions_count = @projects_all.count @project_count = @projects_all.count
@poll_questions_pages = Paginator.new @project_count, per_page_option, params['page'] @project_pages = Paginator.new @project_count, per_page_option, params['page']
#gcm activity count #gcm activity count
@ -558,11 +556,6 @@ class ProjectsController < ApplicationController
# Show @project # Show @project
def show def show
if(@project && !@project.is_public && !User.current.member_of?(@project))
render_403
return
end
@project_type = params[:project_type] @project_type = params[:project_type]
# try to redirect to the requested menu item # try to redirect to the requested menu item
@ -594,7 +587,7 @@ class ProjectsController < ApplicationController
end end
has = { has = {
"show_issues" => true, "show_issues" => true ,
"show_files" => true, "show_files" => true,
"show_documents" => true, "show_documents" => true,
"show_messages" => true, "show_messages" => true,
@ -604,8 +597,8 @@ class ProjectsController < ApplicationController
"show_wiki_edits"=>true, "show_wiki_edits"=>true,
"show_journals_for_messages" => true "show_journals_for_messages" => true
} }
@date_to ||= Date.today + 1
@date_from = @date_to - @days#-1.years #modified by lizanle 去掉這個1年的時間跨度
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') @with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
@author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id])) @author = (params[:user_id].blank? ? nil : User.active.find(params[:user_id]))
# 决定显示所用用户或单个用户活动 # 决定显示所用用户或单个用户活动
@ -619,9 +612,9 @@ class ProjectsController < ApplicationController
# modify by nwb # modify by nwb
# 添加私密性判断 # 添加私密性判断
if User.current.member_of?(@project)|| User.current.admin? if User.current.member_of?(@project)|| User.current.admin?
events = @activity.events(@days) events = @activity.events(@date_from, @date_to)
else else
events = @activity.events(@days,nil, :is_public => 1) events = @activity.events(@date_from, @date_to, :is_public => 1)
end end
@offset, @limit = api_offset_and_limit({:limit => 10}) @offset, @limit = api_offset_and_limit({:limit => 10})

View File

@ -0,0 +1,59 @@
# Time 2015-01-26 17:12:23
# Author lizanle
# Description 显示和清理系统日志
class SystemLogController < ApplicationController
before_filter :require_admin
# 默认每页显示20条记录
PER_PAGE = 20
layout "base"
include SystemLogHelper
# Time 2015-01-26 17:12:46
# Author lizanle
# Description 查看所有日志
def index
@logs = SystemLog.logo_data(params[:page]||1, params[:per]||PER_PAGE, params[:search], params[:day])
end
# Time 2015-01-26 14:42:38
# Author lizanle
# Description 清除日志
def clear
SystemLog.clear params[:day]
redirect_to :action => :index
end
# Time 2015-01-26 17:24:25
# Author lizanle
# Description 访问分析
def access_analysis
#解析日志,然后逆序
@log_result = SystemLog.analysis(params[:day]).reverse[1...-1]
@access_module = Hash.new
#日誌可能為空
if @log_result && !@log_result.empty?
#将数组中的模块访问统计出来放到hash中 每条记录的第四个值是Controller#action的形式
@log_result.collect! { |r| @access_module[r[3]].nil? ?
@access_module[r[3]] = 1 : @access_module[r[3]] +=1 }
# 去掉key可能为空记录 排序,然后取逆序
@access_module = @access_module.delete_if { |k, v| k.nil? }.sort_by { |key, val| val }.reverse
else
@access_module
end
end
# Time 2015-01-26 17:24:36
# Author lizanle
# Description 耗时分析
def time_analysis
#解析日志
@log_result = SystemLog.analysis(params[:day]).reverse[1...-1]
if @log_result && !@log_result.empty?
#分页
@log_result = Kaminari.paginate_array(@log_result).page(params[:page]||1).per(params[:per]||PER_PAGE)
else
@log_result = []
end
end
end

View File

@ -1844,7 +1844,7 @@ module ApplicationHelper
users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain} users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain}
# contest_link = link_to l(:label_contest_innovate), {:controller => 'contests', :action => 'index'} # contest_link = link_to l(:label_contest_innovate), {:controller => 'contests', :action => 'index'}
bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'} bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'}
forum_link = link_to l(:label_project_module_forums), {:controller => "forums", :action => "index"} forum_link = link_to l(:label_forum_all), {:controller => "forums", :action => "index"}
stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'} stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'}
school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'} school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'}
@ -1963,6 +1963,15 @@ module ApplicationHelper
end end
def get_technical_title user def get_technical_title user
#user.user_extensions.technical_title if user.user_extensions.technical_title == "Professor" || user.user_extensions.technical_title == "教授"
technical_title = l(:label_technicl_title_professor)
elsif user.user_extensions.technical_title == "Associate professor" || user.user_extensions.technical_title == "副教授"
technical_title = l(:label_technicl_title_associate_professor)
elsif user.user_extensions.technical_title == "Lecturer" || user.user_extensions.technical_title == "讲师"
technical_title = l(:label_technicl_title_lecturer)
elsif user.user_extensions.technical_title == "Teaching assistant" || user.user_extensions.technical_title == "助教"
technical_title = l(:label_technicl_title_teaching_assistant)
end
technical_title
end end
end end

View File

@ -0,0 +1,16 @@
module ExpireHelper
#index.html 中 “projects”塊 緩存過期
def expire_project_cache
ActionController::Base.new.expire_fragment('projects')
end
#index.html 中 “activities”塊 緩存過期
def expire_activitie_cache
ActionController::Base.new.expire_fragment('activities')
end
#welcome/index.html 中 “forums”塊 緩存過期
def expire_forum_cache
ActionController::Base.new.expire_fragment('forums')
end
end

View File

@ -0,0 +1,180 @@
# Time 2015-01-26 17:30:16
# Author lizanle
# Description 日志帮助类
module SystemLogHelper
class SystemLog
class << self
# Time 2015-01-26 17:29:17
# Author lizanle
# Description 分页(支持多关键字查询)
def logo_data(page, per, search, day)
logs = find_all_logs day
if logs.empty? #如果返回的是空數組,就說明日誌文件不存在
return logs
end
# 根据search参数来决定是否需要查询
keywords = search
if keywords && !keywords.strip.blank?
# 把keywords转化成正则表达式数组
keywords = keywords.strip.split(/\s+/).collect! { |w| Regexp.new(w, 'i') }
# 一条记录应该匹配每个关键字 log =~ r 是对log记录进行判断是否符合r的正则表达式
logs = logs.find_all do |log|
keywords.all? { |r| log =~ r }
end
#用Kaminari分页
logs = Kaminari.paginate_array(logs).page(page).per(per).collect! { |log| parse(log) }
#将分页后的记录的搜索结果添加样式,样式中的\0是给给r占位置的。
logs.collect! do |log|
keywords.each { |r| log.gsub!(r, '<span class="search_results">\0</span>') }
log
end
else
logs = Kaminari.paginate_array(logs).page(page).per(per).collect! { |log| parse(log) }
end
logs
end
# Time 2015-01-26 17:28:57
# Author lizanle
# Description 清除日誌
def clear day
if File::exists?(logfile_path day)
File.open(logfile_path(day), 'w') do |f|
f.print ''
end
else
end
end
# Time 2015-01-26 17:28:49
# Author lizanle
# Description 讀取日誌
private
def find_all_logs day
if File::exists?(logfile_path day)
File.open(logfile_path day) do |f|
#打开文件并按照正则表达式切分逆序最新一个记录可以扔掉因为最新的记录永远都是访问System_log)
f.read.split("Processing").reverse[1..-1]
end
else
[]
end
end
# Time 2015-01-26 17:28:34
# Author lizanle
# Description 日志文件的路径一般在Rails.root/log下根据环境配置
# 依次记录到product.log development.log test.log中
def logfile_path day
#将日期处理成2015-01-01的形式
unless day.nil?
dayArr = day.split('-')
if dayArr[1].length == 1
dayArr[1] = "0" + dayArr[1]
end
if dayArr[2].length == 1
dayArr[2] = "0" + dayArr[2]
end
day = dayArr.join('-')
end
#如果不是當天,則需要加後綴
if !day.nil? && !day.strip.blank? && day != Time.now.strftime("%Y-%m-%d")
File.join(Rails.root, "log", "#{Rails.env}.log.#{day.gsub('-', '')}")
else
File.join(Rails.root, "log", "#{Rails.env}.log")
end
end
# Time 2015-01-26 17:28:22
# Author lizanle
# Description 替換換行符
def parse(log)
ERB::Util.html_escape(log.gsub(/\e\[[\d;m]+/, '')).gsub("\n", "<br/>")
end
# Time 2015-01-26 17:28:07
# Author lizanle
# Description 定义响应正则表达式 2015-01-20 11:31:13 INFO -- Completed 200 OK in 125ms (Views: 81.0ms | ActiveRecord: 2.0ms)
def response_regex
'Completed \d+ \w+ in (\d+)ms \(Views: (\d+\.\d+)?ms \| ActiveRecord: (\d+\.\d+)?ms\)'
end
# Time 2015-01-26 17:27:51
# Author lizanle
# Description 将一条记录中的地址主机等都分析出来
def get_status(paragraph)
request_regex = 'Started GET \"(\/.*)\" for ([\d]+\.[\d]+\.[\d]+\.[\d]+) at [\d]*-([\d]*-[\d]* [\d]*:[\d]*:[\d]*)'
controller_regex = 'Processing by ([\w]+#[\w]+)'
page_time_regex = 'Views: \d+(\.\d+)?ms'
activeRecord_time_regex = 'ActiveRecord: \d+(\.\d+)?ms'
#解析请求中的正则,主机,时间
if paragraph.match(request_regex) != nil
request_url = paragraph.match(request_regex)[1] #正则表达式中的括号能够截取成数组
request_host = paragraph.match(request_regex)[2]
request_at = paragraph.match(request_regex)[3]
end
#解析控制器
if paragraph.match(controller_regex) != nil
controller_name = paragraph.match(controller_regex)[1]
end
#解析响应时间以及计算百分比
if paragraph.match(response_regex) != nil
#print(paragraph.match(response_regex))
total_time = paragraph.match(response_regex)[1]
page_time = paragraph.match(response_regex)[2]
activeRecord_time = paragraph.match(response_regex)[3]
page_time_percent = page_time.to_f/(total_time.to_f)
activeRecord_time_percent = activeRecord_time.to_f/(total_time.to_f)
else
end
#将解析结果当做一条记录数组返回
request_status = [request_url, request_host, request_at,
controller_name, total_time, page_time, page_time_percent, activeRecord_time, activeRecord_time_percent]
request_status
end
# Time 2015-01-26 16:41:51
# Author lizanle
# Description 分析日志
public
def analysis day
csv = Array.new
#如果文件不存在,则直接返回空数组
if File::exists?(logfile_path day)
File.open(logfile_path(day), "r:utf-8") do |file|
paragraph = ""
begin_flag = false
# 对每一行进行判断
file.each do |line|
# 以"Started GET "开头为一个paragraph
#print(line.match('[\d]*-([\d]*-[\d]* [\d]*:[\d]*:[\d]*) INFO -- Started GET ') == nil)
if (line.match('[\d]*-([\d]*-[\d]* [\d]*:[\d]*:[\d]*) \w+ -- Started GET ') != nil)
if !begin_flag
begin_flag = true
paragraph.concat(line)
else
# 另一个paragraph的开头
if (paragraph.match(response_regex) != nil)
csv << get_status(paragraph)
end
begin_flag = true
paragraph = line
end
else
if begin_flag
paragraph.concat(line)
else
end
end
end
end
end
csv
end
end
end
end

View File

@ -314,38 +314,38 @@ module WelcomeHelper
str = '&nbsp;'.html_safe str = '&nbsp;'.html_safe
case event.event_type case event.event_type
when 'news' when 'news'
str << content_tag("span", "发表了") << str << content_tag("span", l(:field_user_active_published)) <<
content_tag("span", find_all_event_type(event)) << content_tag("span", find_all_event_type(event)) <<
':&nbsp;'.html_safe << ':&nbsp;'.html_safe <<
link_to(strip_tags(event.event_description).gsub(/&nbsp;/,''), event.event_url, {:title => event.event_description}) link_to(strip_tags(event.event_description).gsub(/&nbsp;/,''), event.event_url, {:title => event.event_description})
when 'issue', 'message' , 'bid' , 'wiki-page' , 'document' when 'issue', 'message' , 'bid' , 'wiki-page' , 'document'
str << content_tag("span", "发表了") << str << content_tag("span", l(:field_user_active_published)) <<
content_tag("span", find_all_event_type(event)) << content_tag("span", find_all_event_type(event)) <<
':&nbsp;'.html_safe << ':&nbsp;'.html_safe <<
link_to(event.event_title, event.event_url, {:title => event.event_title}) link_to(event.event_title, event.event_url, {:title => event.event_title})
when 'reply' ,'Reply', 'Memo' when 'reply' ,'Reply', 'Memo'
str << content_tag("span", "发表了") << str << content_tag("span", l(:field_user_active_published)) <<
content_tag("span", find_all_event_type(event)) << content_tag("span", find_all_event_type(event)) <<
':&nbsp;'.html_safe << ':&nbsp;'.html_safe <<
link_to(strip_tags(event.event_description).gsub(/&nbsp;/,''), event.event_url, {:title => event.event_description}) link_to(strip_tags(event.event_description).gsub(/&nbsp;/,''), event.event_url, {:title => event.event_description})
when 'attachment' when 'attachment'
str << content_tag('span', '上传了') << str << content_tag('span', l(:field_user_active_uploaded)) <<
content_tag('span', find_all_event_type(event)) << content_tag('span', find_all_event_type(event)) <<
':&nbsp;'.html_safe << ':&nbsp;'.html_safe <<
link_to(event.event_title, event.event_url, {:title => event.event_title}) << link_to(event.event_title, event.event_url, {:title => event.event_title}) <<
link_to(('&nbsp;['.html_safe+l(:label_downloads_list).to_s << ']'), project_files_path(event.container.project), :class => "attachments_list_color") link_to(('&nbsp;['.html_safe+l(:label_downloads_list).to_s << ']'), project_files_path(event.container.project), :class => "attachments_list_color")
else else
str << content_tag("span", "更新了") << str << content_tag("span", l(:field_user_active_updated)) <<
content_tag("span", find_all_event_type(event)) << content_tag("span", find_all_event_type(event)) <<
':&nbsp;'.html_safe << link_to(event.event_title, event.event_url, {:title => event.event_title}) ':&nbsp;'.html_safe << link_to(event.event_title, event.event_url, {:title => event.event_title})
end end
str str
rescue Exception => e rescue Exception => e
str << content_tag("span", '未知内容') str << content_tag("span", l(:field_user_active_unknow))
end end
def show_event_reply event def show_event_reply event
str = "回复(" str = l(:field_active_reply)
case event.event_type case event.event_type
when 'news' when 'news'
str << link_to( event.comments.count, news_path(event)) << ")" str << link_to( event.comments.count, news_path(event)) << ")"
@ -463,25 +463,25 @@ module WelcomeHelper
def find_all_event_type event def find_all_event_type event
case event.event_type case event.event_type
when 'news' when 'news'
'新闻' l(:field_user_active_news)
when 'issue' when 'issue'
'缺陷' l(:field_user_active_issue)
when 'attachment' when 'attachment'
'附件' l(:field_user_active_attachment)
when 'message' when 'message'
'主题' l(:field_user_active_message)
when 'Reply','reply' when 'Reply','reply'
'回复' l(:field_user_active_reply)
when 'bid' when 'bid'
'作业' l(:field_user_active_bid)
when 'Memo' when 'Memo'
'主题' l(:field_user_active_memo)
when 'document' when 'document'
'文件' l(:field_user_active_document)
when 'changeset' when 'changeset'
'版本库' l(:field_user_active_changeset)
when 'issue-note' when 'issue-note'
'问题说明' l(:field_user_active_issue_note)
else else
event.event_type event.event_type
end end

View File

@ -17,6 +17,7 @@ class Bid < ActiveRecord::Base
HomeworkProject = 2 HomeworkProject = 2
attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type, :password attr_accessible :author_id, :budget, :deadline, :name, :description, :homework_type, :password
include Redmine::SafeAttributes include Redmine::SafeAttributes
include ExpireHelper
belongs_to :author, :class_name => 'User', :foreign_key => :author_id belongs_to :author, :class_name => 'User', :foreign_key => :author_id
belongs_to :course belongs_to :course
@ -32,7 +33,11 @@ class Bid < ActiveRecord::Base
has_many :join_in_contests, :dependent => :destroy has_many :join_in_contests, :dependent => :destroy
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
# has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}" # has_many :fork_homework, :class_name => 'Bid', :conditions => "#{Bid.table_name}.parent_id = #{id}"
after_create :expire_activitie_cache
after_update :expire_activitie_cache
before_destroy :expire_activitie_cache
acts_as_attachable acts_as_attachable
@ -149,4 +154,6 @@ class Bid < ActiveRecord::Base
end end
end end
end end
end end

View File

@ -16,6 +16,7 @@
# 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 Changeset < ActiveRecord::Base class Changeset < ActiveRecord::Base
include ExpireHelper
belongs_to :repository belongs_to :repository
belongs_to :user belongs_to :user
include UserScoreHelper include UserScoreHelper
@ -64,8 +65,9 @@ class Changeset < ActiveRecord::Base
includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args)) includes(:repository => :project).where(Project.allowed_to_condition(args.shift || User.current, :view_changesets, *args))
} }
after_create :scan_for_issues,:refresh_changests#:be_user_score # user_score after_create :scan_for_issues,:refresh_changests,:expire_activitie_cache#:be_user_score # user_score
after_update :be_user_score after_update :be_user_score,:expire_activitie_cache
before_destroy :expire_activitie_cache
after_destroy :down_user_score after_destroy :down_user_score
before_create :before_create_cs before_create :before_create_cs

View File

@ -1,4 +1,10 @@
class ContestNotification < ActiveRecord::Base class ContestNotification < ActiveRecord::Base
include ExpireHelper
attr_accessible :content, :title attr_accessible :content, :title
validates :title, length: {maximum: 30} validates :title, length: {maximum: 30}
after_create :expire_forum_cache
after_update :expire_forum_cache
before_destroy :expire_forum_cache
end end

View File

@ -17,18 +17,22 @@
class Document < ActiveRecord::Base class Document < ActiveRecord::Base
include Redmine::SafeAttributes include Redmine::SafeAttributes
include ExpireHelper
belongs_to :project belongs_to :project
belongs_to :user belongs_to :user
belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id" belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id"
include UserScoreHelper include UserScoreHelper
after_save :be_user_score # user_score after_save :be_user_score # user_score
after_destroy :down_user_score after_destroy :down_user_score
after_create :expire_activitie_cache
after_update :expire_activitie_cache
before_destroy :expire_activitie_cache
acts_as_attachable :delete_permission => :delete_documents acts_as_attachable :delete_permission => :delete_documents
acts_as_searchable :columns => ['title', "#{table_name}.description"], :include => :project acts_as_searchable :columns => ['title', "#{table_name}.description"], :include => :project
acts_as_event :title => Proc.new {|o| "#{l(:label_document)}: #{o.title}"}, acts_as_event :title => Proc.new {|o| "#{l(:label_document)}: #{o.title}"},
:author => Proc.new {|o| o.attachments.reorder("#{Attachment.table_name}.created_on ASC").first.try(:author) }, #:author => Proc.new {|o| o.attachments.reorder("#{Attachment.table_name}.created_on ASC").first.try(:author) },
:author => Proc.new {|o| User.find(o.user_id)},
:url => Proc.new {|o| {:controller => 'documents', :action => 'show', :id => o.id}} :url => Proc.new {|o| {:controller => 'documents', :action => 'show', :id => o.id}}
acts_as_activity_provider :find_options => {:include => :project}, acts_as_activity_provider :find_options => {:include => :project},
:is_public => 'documents.is_public' :is_public => 'documents.is_public'
@ -76,4 +80,6 @@ class Document < ActiveRecord::Base
update_document(self.user,1) update_document(self.user,1)
update_document(self.user,2,self.project) update_document(self.user,2,self.project)
end end
end end

View File

@ -1,8 +1,13 @@
class Forum < ActiveRecord::Base class Forum < ActiveRecord::Base
include Redmine::SafeAttributes include Redmine::SafeAttributes
include ExpireHelper
has_many :topics, :class_name => 'Memo', :conditions => "#{Memo.table_name}.parent_id IS NULL", :order => "#{Memo.table_name}.created_at DESC", :dependent => :destroy has_many :topics, :class_name => 'Memo', :conditions => "#{Memo.table_name}.parent_id IS NULL", :order => "#{Memo.table_name}.created_at DESC", :dependent => :destroy
has_many :memos, :dependent => :destroy, conditions: "parent_id IS NULL" has_many :memos, :dependent => :destroy, conditions: "parent_id IS NULL"
belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id' belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id'
after_create :expire_forum_cache
after_update :expire_forum_cache
before_destroy :expire_forum_cache
safe_attributes 'name', safe_attributes 'name',
'description', 'description',
'topic_count', 'topic_count',
@ -45,5 +50,7 @@ class Forum < ActiveRecord::Base
" memo_count = (SELECT COUNT(*) FROM #{Memo.table_name} WHERE forum_id=#{forum_id} AND parent_id IS NOT NULL)," + " memo_count = (SELECT COUNT(*) FROM #{Memo.table_name} WHERE forum_id=#{forum_id} AND parent_id IS NOT NULL)," +
" last_memo_id = (SELECT MAX(id) FROM #{Memo.table_name} WHERE forum_id=#{forum_id})", " last_memo_id = (SELECT MAX(id) FROM #{Memo.table_name} WHERE forum_id=#{forum_id})",
["id = ?", forum_id]) ["id = ?", forum_id])
end end
end end

View File

@ -19,7 +19,7 @@ class Issue < ActiveRecord::Base
include Redmine::SafeAttributes include Redmine::SafeAttributes
include Redmine::Utils::DateCalculation include Redmine::Utils::DateCalculation
include UserScoreHelper include UserScoreHelper
include ExpireHelper
belongs_to :project belongs_to :project
belongs_to :tracker belongs_to :tracker
belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id' belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'
@ -80,6 +80,9 @@ class Issue < ActiveRecord::Base
after_create :act_as_activity,:be_user_score_new_issue after_create :act_as_activity,:be_user_score_new_issue
after_update :be_user_score after_update :be_user_score
after_destroy :down_user_score after_destroy :down_user_score
after_create :expire_activitie_cache
after_update :expire_activitie_cache
before_destroy :expire_activitie_cache
# after_create :be_user_score # after_create :be_user_score
# end # end
@ -1553,4 +1556,5 @@ class Issue < ActiveRecord::Base
end end
end end

View File

@ -4,6 +4,7 @@
class JournalsForMessage < ActiveRecord::Base class JournalsForMessage < ActiveRecord::Base
include Redmine::SafeAttributes include Redmine::SafeAttributes
include UserScoreHelper include UserScoreHelper
include ExpireHelper
safe_attributes "jour_type", # 留言所属类型 safe_attributes "jour_type", # 留言所属类型
"jour_id", # 留言所属类型的id "jour_id", # 留言所属类型的id
"notes", # 留言内容 "notes", # 留言内容
@ -54,7 +55,9 @@ class JournalsForMessage < ActiveRecord::Base
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
validates :notes, presence: true validates :notes, presence: true
after_create :act_as_activity #huang after_create :act_as_activity ,:expire_activitie_cache#huang
after_update :expire_activitie_cache
before_destroy :expire_activitie_cache
after_create :reset_counters! after_create :reset_counters!
after_destroy :reset_counters! after_destroy :reset_counters!
after_save :be_user_score after_save :be_user_score
@ -162,4 +165,6 @@ class JournalsForMessage < ActiveRecord::Base
end end
end end
end end
end end

View File

@ -1,9 +1,13 @@
class Memo < ActiveRecord::Base class Memo < ActiveRecord::Base
include Redmine::SafeAttributes include Redmine::SafeAttributes
include UserScoreHelper include UserScoreHelper
include ExpireHelper
belongs_to :forum belongs_to :forum
belongs_to :author, :class_name => "User", :foreign_key => 'author_id' belongs_to :author, :class_name => "User", :foreign_key => 'author_id'
after_create :expire_cache
after_update :expire_cache
before_destroy :expire_cache
validates_presence_of :author_id, :forum_id, :subject,:content validates_presence_of :author_id, :forum_id, :subject,:content
# 若是主题帖,则内容可以是空 # 若是主题帖,则内容可以是空
#validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? } #validates :content, presence: true, if: Proc.new{|o| !o.parent_id.nil? }
@ -170,5 +174,8 @@ class Memo < ActiveRecord::Base
update_memo_number(User.current,1) update_memo_number(User.current,1)
update_replay_for_memo(User.current,1) update_replay_for_memo(User.current,1)
end end
def expire_cache
expire_forum_cache
expire_activitie_cache
end
end end

View File

@ -18,7 +18,7 @@
class Message < ActiveRecord::Base class Message < ActiveRecord::Base
include Redmine::SafeAttributes include Redmine::SafeAttributes
include UserScoreHelper include UserScoreHelper
include ExpireHelper
belongs_to :board belongs_to :board
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id' belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
@ -59,8 +59,9 @@ class Message < ActiveRecord::Base
validates_length_of :subject, :maximum => 255 validates_length_of :subject, :maximum => 255
validate :cannot_reply_to_locked_topic, :on => :create validate :cannot_reply_to_locked_topic, :on => :create
after_create :add_author_as_watcher, :reset_counters! after_create :add_author_as_watcher, :reset_counters!,:expire_activitie_cache
after_update :update_messages_board after_update :update_messages_board,:expire_activitie_cache
before_destroy :expire_activitie_cache
after_destroy :reset_counters!,:down_user_score after_destroy :reset_counters!,:down_user_score
# fq # fq
@ -195,4 +196,6 @@ class Message < ActiveRecord::Base
end end
end end
end end
end end

View File

@ -17,6 +17,7 @@
class News < ActiveRecord::Base class News < ActiveRecord::Base
include Redmine::SafeAttributes include Redmine::SafeAttributes
include ExpireHelper
belongs_to :project belongs_to :project
#added by nwb #added by nwb
belongs_to :course belongs_to :course
@ -47,6 +48,9 @@ class News < ActiveRecord::Base
# fq # fq
after_create :act_as_activity after_create :act_as_activity
# end # end
after_create :expire_activitie_cache
after_update :expire_activitie_cache
before_destroy :expire_activitie_cache
scope :visible, lambda {|*args| scope :visible, lambda {|*args|
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args)) includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args))
@ -91,4 +95,6 @@ class News < ActiveRecord::Base
def act_as_activity def act_as_activity
self.acts << Activity.new(:user_id => self.author_id) self.acts << Activity.new(:user_id => self.author_id)
end end
end end

View File

@ -17,6 +17,7 @@
class Project < ActiveRecord::Base class Project < ActiveRecord::Base
include Redmine::SafeAttributes include Redmine::SafeAttributes
include ExpireHelper
ProjectType_project = 0 ProjectType_project = 0
ProjectType_course = 1 ProjectType_course = 1
@ -126,10 +127,12 @@ class Project < ActiveRecord::Base
#此代码功能为原redmine中项目的树形结构按名称首字母排序本系统项目非树形结构且项目排序方式无按首字母排序另该代码执行会使空数据库时创建项目时出异常故注释掉 #此代码功能为原redmine中项目的树形结构按名称首字母排序本系统项目非树形结构且项目排序方式无按首字母排序另该代码执行会使空数据库时创建项目时出异常故注释掉
#after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?} #after_save :update_position_under_parent, :if => Proc.new {|project| project.name_changed?}
#ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?} after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
# 创建project之后默认创建一个board之后的board去掉了board的概念 # 创建project之后默认创建一个board之后的board去掉了board的概念
after_create :create_board_sync after_create :create_board_sync,:expire_project_cache
before_destroy :delete_all_members after_update :expire_project_cache
before_destroy :delete_all_members,:expire_project_cache
def remove_references_before_destroy def remove_references_before_destroy
return if self.id.nil? return if self.id.nil?
Watcher.delete_all ['watchable_id = ?', id] Watcher.delete_all ['watchable_id = ?', id]
@ -1150,7 +1153,7 @@ class Project < ActiveRecord::Base
logger.error "[Project Model] ===> Auto create board when Project saved, because #{@board.full_messages}" logger.error "[Project Model] ===> Auto create board when Project saved, because #{@board.full_messages}"
end end
end end
end end

View File

@ -63,7 +63,7 @@ a:hover.opnionButton{ text-decoration:underline;}
(function($){ (function($){
$.fn.fix = function(options){ $.fn.fix = function(options){
var defaults = { var defaults = {
float : 'left', float : 'right',
minStatue : false, minStatue : false,
skin : 'blue', skin : 'blue',
durationTime : 1000 durationTime : 1000
@ -81,7 +81,7 @@ a:hover.opnionButton{ text-decoration:underline;}
var defaultTop = thisBox.offset().top; //????????top var defaultTop = thisBox.offset().top; //????????top
thisBox.css(options.float, 0); thisBox.css(options.float, 0);
if(options.minStatue){ if(options.minStatue == "true"){
$(".show_btn").css("float", options.float); $(".show_btn").css("float", options.float);
sideContent.css('width', 0); sideContent.css('width', 0);
show_btn.css('width', 25); show_btn.css('width', 25);
@ -106,15 +106,18 @@ a:hover.opnionButton{ text-decoration:underline;}
closeBtn.bind("click",function(){ closeBtn.bind("click",function(){
sideContent.animate({width: '0px'},"fast"); sideContent.animate({width: '0px'},"fast");
show_btn.stop(true, true).delay(300).animate({ width: '25px'},"fast"); show_btn.stop(true, true).delay(300).animate({ width: '25px'},"fast");
cookiesave('minStatue','true','','','');
}); });
//show??? //show???
show_btn.click(function() { show_btn.bind("click",function() {
$(this).animate({width: '0px'},"fast"); $(this).animate({width: '0px'},"fast");
sideContent.stop(true, true).delay(200).animate({ width: '154px'},"fast"); sideContent.stop(true, true).delay(200).animate({ width: '154px'},"fast");
cookiesave('minStatue','false','','','');
}); });
}); //end this.each
}); //end this.each
}; };
})(jQuery); })(jQuery);
@ -130,6 +133,38 @@ function f_submit()
{ {
$("#new_memo").submit(); $("#new_memo").submit();
} }
function cookiesave(n, v, mins, dn, path)
{
if(n)
{
if(!mins) mins = 365 * 24 * 60;
if(!path) path = "/";
var date = new Date();
date.setTime(date.getTime() + (mins * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
if(dn) dn = "domain=" + dn + "; ";
document.cookie = n + "=" + v + expires + "; " + dn + "path=" + path;
}
}
function cookieget(n)
{
var name = n + "=";
var ca = document.cookie.split(';');
for(var i=0;i<ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(name) == 0){
return c.substring(name.length,c.length);}
}
return false;
}
</script> </script>
@ -138,9 +173,9 @@ function f_submit()
<title>意见反馈</title> <title>意见反馈</title>
</head> </head>
<body style="height:auto"> <body style="height:auto" >
<!-- ?ú?? ???? --> <!-- ?ú?? ???? -->
<div class="scrollsidebar" id="scrollsidebar"> <div class="scrollsidebar" id="scrollsidebar" style="float: right">
<div class="side_content"> <div class="side_content">
<div class="side_list"> <div class="side_list">
<div class="side_title"><a title="意见反馈" class="close_btn"><span><%= l(:label_feedback) %></span></a></div> <div class="side_title"><a title="意见反馈" class="close_btn"><span><%= l(:label_feedback) %></span></a></div>
@ -171,7 +206,7 @@ function f_submit()
$(function() { $(function() {
$("#scrollsidebar").fix({ $("#scrollsidebar").fix({
float : 'right', //default.left or right float : 'right', //default.left or right
//minStatue : true, minStatue : cookieget('minStatue'),
skin : 'green', //default.gray or blue skin : 'green', //default.gray or blue
durationTime : 600 durationTime : 600
}); });

View File

@ -9,12 +9,12 @@
<p> <p>
<% if @organizer.nil? %> <% if @organizer.nil? %>
<p> <p>
<span>主办单位</span> <span><%= l(:label_hosted_organization) %></span>
<span class="footer_text_link"><a target="_blank" href="http://www.nudt.edu.cn/ArticleShow.asp?ID=47">国防科学技术大学并行与分布处理国家重点实验室</a></span> <span class="footer_text_link"><a target="_blank" href="http://www.nudt.edu.cn/ArticleShow.asp?ID=47"><%= l(:label_hosted_by) %></a></span>
<span class="footer_text_link"><a target="_blank" href="http://www.nudt.edu.cn/ArticleShow.asp?ID=41">计算机科学与技术系</a></span> <span class="footer_text_link"><a target="_blank" href="http://www.nudt.edu.cn/ArticleShow.asp?ID=41"><%= l(:label_sponsor) %></a></span>
<span id="copyright">版权©2007~2014</span> <span id="copyright"><%= l(:label_rights_reserved)%></span>
<span class="footer_text_link" id="contact_us"><a target="_blank" href="http://forge.trustie.net/projects/2/member">联系我们</a></span> <span class="footer_text_link" id="contact_us"><a target="_blank" href="http://forge.trustie.net/projects/2/member"><%= l(:label_contact_us) %></a></span>
<span class="footer_text_link" id="record"><a target="_blank" href="http://www.miibeian.gov.cn/">湘ICP备09019772</a></span> <span class="footer_text_link" id="record"><a target="_blank" href="http://www.miibeian.gov.cn/"><%= l(:label_license) %></a></span>
</p> </p>
<% else %> <% else %>
<%= @organizer.description.html_safe %> <%= @organizer.description.html_safe %>
@ -22,11 +22,11 @@
</p> </p>
<div id="logo_link"> <div id="logo_link">
<% if @companies.nil? || @companies.count == 0 %> <% if @companies.nil? || @companies.count == 0 %>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/nudt.png',:size=>'100x30',:alt=>"国防科学技术大学计算机学院"),"http://www.nudt.edu.cn/special.asp?classid=12", :target => "_blank" %></span> <span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/nudt.png',:size=>'100x30',:alt=>l(:label_co_organizer_NUDT)),"http://www.nudt.edu.cn/special.asp?classid=12", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/peking_eecs.png',:size=>'100x30',:alt=>"北京大学信息科学技术学院软件研究所"), "http://eecs.pku.edu.cn", :target => "_blank" %></span> <span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/peking_eecs.png',:size=>'100x30',:alt=>l(:label_co_organizer_EECS)), "http://eecs.pku.edu.cn", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/buaa_scse.png',:size=>'100x30',:alt=>"北京航空航天大学计算机学院"), "http://scse.buaa.edu.cn/", :target => "_blank" %></span> <span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/buaa_scse.png',:size=>'100x30',:alt=>l(:label_co_organizer_BHU)), "http://scse.buaa.edu.cn/", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/iscas.png',:size=>'100x30',:alt=>"中国科学院软件研究所"), "http://www.iscas.ac.cn", :target => "_blank" %></span> <span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/iscas.png',:size=>'100x30',:alt=>l(:label_co_organizer_CAS)), "http://www.iscas.ac.cn", :target => "_blank" %></span>
<span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/inforbus.png',:size=>'100x30',:alt=>"山东中创软件商用中间件股份有限公司"), "http://www.inforbus.com", :target => "_blank" %></span> <span class="footer_logo_link"><%= link_to image_tag('/images/footer_logo/inforbus.png',:size=>'100x30',:alt=>l(:label_co_organizer_InforS)), "http://www.inforbus.com", :target => "_blank" %></span>
<% else %> <% else %>
<% @companies && @companies.each do |company| %> <% @companies && @companies.each do |company| %>
<span class="footer_logo_link"><%= link_to image_tag(url_to_avatar(company),:size=>"100x30",:alt=>company.name),company.url, :target => "_blank" %></span> <span class="footer_logo_link"><%= link_to image_tag(url_to_avatar(company),:size=>"100x30",:alt=>company.name),company.url, :target => "_blank" %></span>

View File

@ -2,14 +2,14 @@
<div id="footer" class="muted "> <div id="footer" class="muted ">
<div style="border-top:solid 1px #C6E9F1;"></div> <div style="border-top:solid 1px #C6E9F1;"></div>
<div class="desc center block-inline"> <div class="desc center block-inline">
主办单位: <%= l(:label_hosted_organization)%>
<%= link_to "国防科学技术大学并行与分布处理国家重点实验室","http://www.nudt.edu.cn/ArticleShow.asp?ID=47"%> <%= link_to l(:label_hosted_by),"http://www.nudt.edu.cn/ArticleShow.asp?ID=47"%>
<%= link_to "计算机科学与技术系", "http://www.nudt.edu.cn/ArticleShow.asp?ID=41"%> <%= link_to l(:label_sponsor), "http://www.nudt.edu.cn/ArticleShow.asp?ID=41"%>
<%= link_to "联系我们","http://" + Setting.host_name + "/projects/2/member"%> <%= link_to l(:label_contact_us),"http://" + Setting.host_name + "/projects/2/member"%>
<%= link_to "湘ICP备09019772","http://www.miibeian.gov.cn/"%> <%= link_to l(:label_license),"http://www.miibeian.gov.cn/"%>
</div> </div>
<div class="center"> <div class="center">
2007~2014 <%= l(:label_rights_reserved)%>
</div> </div>
<%= footer_logo("center ul-style-none", "float-left") %> <%= footer_logo("center ul-style-none", "float-left") %>

View File

@ -31,6 +31,7 @@
text-align: center; text-align: center;
padding-left: 5px !important; padding-left: 5px !important;
padding-right: 5px !important; padding-right: 5px !important;
line-height: 1.9;
} }
.span_wping a:hover{ background-color:#03a1b3;} .span_wping a:hover{ background-color:#03a1b3;}
</style> </style>

View File

@ -36,13 +36,41 @@
<td class="info_font" style="width: 240px; color: #15bccf">软件项目托管社区</td> <td class="info_font" style="width: 240px; color: #15bccf">软件项目托管社区</td>
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td> <td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
<td rowspan="2" width="250px"> <td rowspan="2" width="250px">
<div class="top-content-search" style="display:none"> <div class="top-content-search">
<%= form_tag(projects_search_path, :method => :get) do %> <script type="text/javascript">
<%= text_field_tag 'name', params[:name], :size => 20 %> function regexName()
<%= hidden_field_tag 'project_type', params[:project_type] %> {
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %> var name = $.trim($("#name").val());
<% end %> if(name.length == 0)
</div> {
$("#project_name_span").text("<%= l(:label_search_conditions_not_null) %>");
$("#project_name_span").css('color','#ff0000');
$("#project_name_span").focus();
return false;
}
else
{
$("#project_name_span").text("");
return true;
}
}
function submitSerch()
{
if(regexName()){$("#project_search_form").submit();}
}
</script>
<%= form_tag(projects_search_path, :method => :get, :id => "project_search_form") do %>
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();", :style => "float:left" %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
<%= l(:label_search)%>
</a>
<br />
<span id="project_name_span" style="float: left"></span>
<% end %>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -21,8 +21,6 @@
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
<% title1 = @user.user_extensions.technical_title %>
<% language1 = @user.language %>
<script type="text/javascript"> <script type="text/javascript">
function startXMLHttp() function startXMLHttp()
@ -39,59 +37,11 @@
{ {
setInterval("startXMLHttp()",5000); setInterval("startXMLHttp()",5000);
} }
function init_title() {
var title = "<%= "#{title1}" %>"
var language = "<%= "#{language1}" %>"
if(language == 'zh') {
switch (title) {
case 'Professor' :
title1 = '教授';
break;
case 'Associate professor' :
title1 = '副教授';
break;
case 'Lecturer' :
title1 = '讲师';
break;
case 'Teaching assistant' :
title1 = '助教';
break;
default :
title1 = title;
break;
}
}
else {
switch (title) {
case '教授' :
title1 = 'Professor';
break;
case '副教授' :
title1 = 'Associate professor';
break;
case '讲师' :
title1 = 'Lecturer';
break;
case '助教' :
title1 = 'Teaching assistant';
break;
default :
title1 = title;
break;
}
}
var obj = document.getElementById('td_tech_title');
if(!(obj == "undefined" || obj == null))
{
obj.innerHTML = title1;
}
}
</script> </script>
</head> </head>
<!--加上 onload="Javascript:t()" 开始定时刷新分数 --> <!--加上 onload="Javascript:t()" 开始定时刷新分数 -->
<body class="<%= h body_css_classes %>" onload="init_title()" > <body class="<%= h body_css_classes %>">
<div id="wrapper"> <div id="wrapper">
<div id="wrapper2"> <div id="wrapper2">
<div id="wrapper3"> <div id="wrapper3">
@ -283,10 +233,14 @@
<tr> <tr>
<% if @user.user_extensions.identity == 0 %> <% if @user.user_extensions.identity == 0 %>
<td style=" float: right" width="70px" > <td style=" float: right" width="70px" >
<span style="float: right"> <%= l(:label_technical_title) %></span> <span style="float: right">
<%= l(:label_technical_title) %>
</span>
</td> </td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px"> <td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<span id = "td_tech_title"></span> <span id = "td_tech_title">
<%= get_technical_title @user %>
</span>
</td> </td>
<% end %> <% end %>
</tr> </tr>

View File

@ -0,0 +1,54 @@
<%#
# To change this template, choose Tools | Templates
# and open the template in the editor.
%>
<!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">
<head>
<title>System Log</title>
<style type="text/css">
/*body {*/
/*font-size:90%;*/
/*}*/
body {
color: #333333;
font-family: lucida grande, Lucida Sans Unicode, Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 20px;
}
.search_results {
color: red;
}
/*=======分页样式========*/
.pagination ul li a, .pagination ul li span{
background-color: #FFFFFF;
border-color: #DDDDDD;
border-image: none;
border-style: solid;
border-width: 1px 1px 1px 1px;
float: left;
line-height: 20px;
padding: 4px 12px;
text-decoration: none;
}
.pagination ul a {
color: #9B9B9B;
}
.pagination ul li a:hover, .pagination ul li a:focus, .pagination ul .active a, .pagination ul .active span{
background-color: #ffc02f;
border: 1px solid #ffc02f;
}
.pagination ul li{
float: left;
margin-right: 3px;
list-style: none outside none;
}
</style>
</head>
<body onload="document.getElementById('search').focus();">
<%= yield %>
</body>
</html>

View File

@ -3,12 +3,25 @@
<%= @project ? l(:label_news_new) : l(:bale_news_notice) %> <%= @project ? l(:label_news_new) : l(:bale_news_notice) %>
</div> </div>
<div class="box tabular"> <div class="box tabular">
<p><%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;", :onkeyup => "regexTitle();" %></p> <p>
<P><span id="title_notice_span">(60个字符以内)</span></P> <%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;", :onkeyup => "regexTitle();" %>
</p>
<P>
<span id="title_notice_span">(60个字符以内)</span>
</P>
<!-- <p style="margin-left:-10px;"><%#= f.text_area :summary, :cols => 60, :rows => 2, :style => "width:490px;margin-left:10px;" %></p> --> <!-- <p style="margin-left:-10px;"><%#= f.text_area :summary, :cols => 60, :rows => 2, :style => "width:490px;margin-left:10px;" %></p> -->
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;", :onkeyup => "regexDescription();" %></p> <p>
<P><span id="description_notice_span"></span></P> <%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;", :onkeyup => "regexDescription();" %>
<p id="attachments_form" style="margin-left:-10px;"><label style="padding-right: 15px;"><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @news} %></p> </p>
<P>
<span id="description_notice_span"></span>
</P>
<p id="attachments_form" style="margin-left:-10px;">
<label style="padding-right: 15px;">
<%= l(:label_attachment_plural) %>
</label>
<%= render :partial => 'attachments/form', :locals => {:container => @news} %>
</p>
</div> </div>
<%= wikitoolbar_for 'news_description' %> <%= wikitoolbar_for 'news_description' %>

View File

@ -83,7 +83,7 @@
<%= render :partial => 'news/form', :locals => {:f => f} %> <%= render :partial => 'news/form', :locals => {:f => f} %>
<%#= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %><!-- button-submit --> <%#= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %><!-- button-submit -->
<%= link_to l(:button_create), "#", :onclick => 'submitNews();',:onmouseover => 'submitFocus(this);', :class => 'ButtonColor m3p10' %> <%= link_to l(:button_create), "#", :onclick => 'submitNews();',:onmouseover => 'submitFocus(this);', :class => 'ButtonColor m3p10' %>
|
<%#= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %> <%#= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'ButtonColor m3p10' %> <%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'ButtonColor m3p10' %>

View File

@ -39,7 +39,7 @@
</ul> </ul>
</div> </div>
<div class="ur_editor_footer"> <div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();"> <a class="btn btn_dark btn_submit" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%> <%= l(:label_button_ok)%>
</a> </a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);"> <a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">

View File

@ -36,7 +36,7 @@
</ul> </ul>
</div> </div>
<div class="ur_editor_footer"> <div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();"> <a class="btn btn_dark btn_submit" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%> <%= l(:label_button_ok)%>
</a> </a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);"> <a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">

View File

@ -20,7 +20,7 @@
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>--> <!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
</div> </div>
<div class="ur_editor_footer"> <div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();"> <a class="btn_submit" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%> <%= l(:label_button_ok)%>
</a> </a>
<a class="btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);"> <a class="btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">

View File

@ -16,7 +16,7 @@
<label for="ur_question_require">必答</label> <label for="ur_question_require">必答</label>
</div> </div>
<div class="ur_editor_footer"> <div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();"> <a class="btn_submit" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%> <%= l(:label_button_ok)%>
</a> </a>
<a class="btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);"> <a class="btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">

View File

@ -34,7 +34,7 @@
</ul> </ul>
</div> </div>
<div class="ur_editor_footer"> <div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();"> <a class="btn btn_dark btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%> <%= l(:label_button_ok)%>
</a> </a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> <a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -33,7 +33,7 @@
</ul> </ul>
</div> </div>
<div class="ur_editor_footer"> <div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();"> <a class="btn btn_dark btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%> <%= l(:label_button_ok)%>
</a> </a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> <a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -13,7 +13,7 @@
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>--> <!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
</div> </div>
<div class="ur_editor_footer"> <div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();"> <a class="btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%> <%= l(:label_button_ok)%>
</a> </a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> <a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -8,7 +8,7 @@
<label for="ur_question_require">必答</label> <label for="ur_question_require">必答</label>
</div> </div>
<div class="ur_editor_footer"> <div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();"> <a class="btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%> <%= l(:label_button_ok)%>
</a> </a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> <a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -23,6 +23,20 @@
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>"); $("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
$("#poll_questions_title").focus(); $("#poll_questions_title").focus();
} }
//添加标题时确定按钮
function add_poll_question(doc)
{
var title = $.trim($("#poll_questions_title").val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
}
//修改标题时确定按钮
function edit_poll_question(doc,id)
{
var title = $.trim($("#poll_questions_title_" + id).val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
}
//问卷头 //问卷头
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();} function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
function pollsSubmit(doc){ function pollsSubmit(doc){

View File

@ -0,0 +1,22 @@
<div class="polls_head">
<h2>所有问卷
<span><%= @obj_count%></span>
</h2>
<% if @is_teacher%>
<%= link_to l(:label_new_poll), new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => "newbtn" %>
<% end%>
</div>
<div class="cl"></div>
<div class="polls_list">
<% @polls.each do |poll|%>
<ul id="polls_<%= poll.id %>">
<%= render :partial => 'poll', :locals => {:poll => poll} %>
</ul>
<div class="cl"></div>
<% end%>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
</div><!--列表end-->

View File

@ -1,4 +1 @@
<% if @poll%> $("#polls").html("<%= escape_javascript(render :partial => 'poll_list') %>");
$("#polls_<%= @poll.id%>").remove();
<%else%>
<% end %>

View File

@ -82,27 +82,5 @@
} }
</script> </script>
<div class="polls_content" id="polls" style="width:677px;"> <div class="polls_content" id="polls" style="width:677px;">
<div class="polls_head"> <%= render :partial => 'poll_list'%>
<h2>所有问卷
<span><%= @obj_count%></span>
</h2>
<% if @is_teacher%>
<%= link_to l(:label_new_poll), new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => "newbtn" %>
<% end%>
</div>
<div class="cl"></div>
<div class="polls_list">
<% @polls.each do |poll|%>
<ul id="polls_<%= poll.id %>">
<%= render :partial => 'poll', :locals => {:poll => poll} %>
</ul>
<div class="cl"></div>
<% end%>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
</div><!--列表end-->
</div><!--问卷内容end--> </div><!--问卷内容end-->

View File

@ -4,7 +4,7 @@
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %> <%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
<% end %> <% end %>
<div class="top-content"> <div class="top-content">
<%= form_tag(projects_search_path, :method => :get) do %> <%= form_tag(projects_search_path, :method => :get, :id => "project_search_form") do %>
<% if params[:project_type] == "1" %> <% if params[:project_type] == "1" %>
<table width="940px"> <table width="940px">
<tr> <tr>
@ -33,24 +33,63 @@
<% else %> <% else %>
<table width="940px"> <table width="940px">
<tr> <tr>
<td class="info_font" style="width: 220px; color: #15bccf"><%= l(:label_project_deposit) %></td> <td class="info_font" style="width: 220px; color: #15bccf">
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td> <%= l(:label_project_deposit) %>
</td>
<td class="location-list">
<strong><%= l(:label_user_location) %> :</strong>
</td>
<td rowspan="2" valign="bottom"> <td rowspan="2" valign="bottom">
<% if User.current.logged? %> <% if User.current.logged? %>
<%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %> <%= link_to(l(:label_project_new), {:controller => 'projects', :action => 'new', :course => 0, :project_type => @project_type}, :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
<% end %> <% end %>
</td> </td>
<td rowspan="2" > <td rowspan="2" >
<div class="project-search" style="float: right"> <script type="text/javascript">
<%= text_field_tag 'name', params[:name], :size => 30 %> function regexName()
<%= hidden_field_tag 'project_type', params[:project_type] %> {
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %> var name = $.trim($("#name").val());
</div> if(name.length == 0)
{
$("#project_name_span").text("<%= l(:label_search_conditions_not_null) %>");
$("#project_name_span").css('color','#ff0000');
$("#project_name_span").focus();
return false;
}
else
{
$("#project_name_span").text("");
return true;
}
}
function submitSerch()
{
if(regexName()){$("#project_search_form").submit();}
}
</script>
<div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 20, :onkeyup => "regexName();", :style => "float:left" %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
<a href="#" onclick="submitSerch();" class="ButtonColor m3p10" style="float:left;padding-top: 3px; margin: 0px;padding-bottom:0px;" >
<%= l(:label_search)%>
</a>
<br />
<span id="project_name_span" style="float: left"></span>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="padding-left: 8px"><a><%= link_to request.host()+"/projects", :controller => 'projects', :action => 'index', :project_type => 0 %> </a></td> <td style="padding-left: 8px">
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_project_deposit), :controller => 'projects', :action => 'index', :project_type => 0 %></td> <a>
<%= link_to request.host()+"/projects", :controller => 'projects', :action => 'index', :project_type => 0 %>
</a>
</td>
<td >
<%=link_to l(:field_homepage), home_path %> >
<%=link_to l(:label_project_deposit), :controller => 'projects', :action => 'index', :project_type => 0 %>
</td>
</tr> </tr>
</table> </table>
<% end %> <% end %>

View File

@ -0,0 +1,36 @@
<% @nav_dispaly_home_path_label = 1
@nav_dispaly_main_course_label = 1
@nav_dispaly_main_project_label = 1
@nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_label = 1%>
<div id='tool'>
<p>
<form action="/system_log/access_analysis" style="float:right" >
<input name="day" type="text" size="36" value="<%= params[:day].nil? ? Time.now.strftime("%Y-%m-%d") : params[:day] %>" maxlength="100" readonly="true" onclick="HS_setDate(this)"/>
<input type="submit" value="<%=l(:label_search_member)%>" size="30" id="search"/>
</form>
</p>
<div id='tool-bar'>
<%=link_to l(:label_log_detail), system_log_path %> |
<%=link_to l(:label_log_delete_log), system_log_clear_path, {:confirm => l(:label_log_delete_confirm),:day=>params[:day].nil? ? Time.now.strftime("%Y-%m-%d") : params[:day]}%> |
<%=link_to l(:label_log_access_analysis), system_log_access_analysis_path %> |
<%=link_to l(:label_log_time_analysis), system_log_time_analysis_path %> |
<%=link_to_function l(:label_log_refresh), 'redo()' %>
</div>
</div>
<div>&nbsp;&nbsp;</div>
<table border="2" width="100%">
<caption font-size="30px"><%= l(:label_log_access_analysis)%></caption>
<tr><td><%= l(:label_log_access_controller_action)%></td>
<td><%= l(:label_log_access_count)%></td></tr>
<% unless @access_module.nil? %>
<% @access_module.each do |k, v| %>
<% unless k.blank? %>
<tr><td><%= raw k %></td>
<td><%= raw v %></td></tr>
<% end %>
<%end %>
<%end %>
</table>

View File

@ -0,0 +1,45 @@
<% @nav_dispaly_home_path_label = 1
@nav_dispaly_main_course_label = 1
@nav_dispaly_main_project_label = 1
@nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_label = 1%>
<div id='tool'>
<div id='tool-bar' style="float: left">
<%=link_to l(:label_log_detail), system_log_path %> |
<%=link_to l(:label_log_delete_log), system_log_clear_path, {:confirm => l(:label_log_delete_confirm),:day=>params[:day].nil? ? Time.now.strftime("%Y-%m-%d") : params[:day]}%> |
<%=link_to l(:label_log_access_analysis), system_log_access_analysis_path %> |
<%=link_to l(:label_log_time_analysis), system_log_time_analysis_path %> |
<%=link_to_function l(:label_log_refresh), 'redo()' %>
</div>
<div id="search-bar" style="float: right">
<form action="/system_log" style="float:right" >
<p>
<%= l(:label_log_key) %><input type="text" name="search" size="36" value="<%= params[:search] %>" maxlength="100" style="margin-right: 12px" />
</p>
<p>
&nbsp;&nbsp;&nbsp;<%=l(:label_log_time)%><input name="day" type="text" id="day" size="36" value="<%= params[:day].nil? ? Time.now.strftime("%Y-%m-%d") : params[:day] %>" maxlength="100" readonly="true" onclick="HS_setDate(this)"/>
<input type="submit" value="<%=l(:label_search_member)%>" size="30" id="search"/>
</p>
</form>
</div>
</div>
<div style="clear: both">&nbsp;&nbsp;</div>
<div>
<%= paginate @logs unless @logs.empty? %><br/>
<% unless @logs.empty? %>
<table border="2" >
<caption font-size="30px"><%=l(:label_log_detail)%></caption>
<% @logs.each do |log| %>
<% unless log.blank? %>
<tr><td><%= raw log %></td></tr>
<% end %>
<%end %>
</table>
<%end %>
<%= paginate @logs unless @logs.empty? %>
</div>

View File

@ -0,0 +1,51 @@
<% @nav_dispaly_home_path_label = 1
@nav_dispaly_main_course_label = 1
@nav_dispaly_main_project_label = 1
@nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_label = 1%>
<div id='tool'>
<p>
<form action="/system_log/time_analysis" style="float:right" >
<input name="day" type="text" size="36" value="<%= params[:day].nil? ? Time.now.strftime("%Y-%m-%d") : params[:day] %>" maxlength="100" readonly="true" onclick="HS_setDate(this)"/>
<input type="submit" value="<%=l(:label_search_member)%>" size="30" id="search"/>
</form>
</p>
<div id='tool-bar'>
<%=link_to l(:label_log_detail), system_log_path %> |
<%=link_to l(:label_log_delete_log), system_log_clear_path, {:confirm => l(:label_log_delete_confirm),:day=>params[:day].nil? ? Time.now.strftime("%Y-%m-%d") : params[:day]}%> |
<%=link_to l(:label_log_access_analysis), system_log_access_analysis_path %> |
<%=link_to l(:label_log_time_analysis), system_log_time_analysis_path %> |
<%=link_to_function l(:label_log_refresh), 'redo()' %>
</div>
</div>
<div>&nbsp;&nbsp;</div>
<%= paginate @log_result unless @log_result.empty? %><br/>
<table border="2" >
<caption font-size="30px"><%= l(:label_log_time_analysis) %></caption>
<tr><td width="10%"><%= l(:label_log_url) %></td>
<td width="10%"><%= l(:label_log_ip) %></td>
<td width="10%"><%= l(:label_log_access_time) %></td>
<td width="10%"><%= l(:label_log_access_controller_action) %></td>
<td width="10%"><%= l(:label_log_response_time) %></td>
<td width="10%"><%= l(:label_log_views_time) %></td>
<td width="10%"><%= l(:label_log_views_time_percent) %></td>
<td width="10%"><%= l(:label_log_active_record_time) %></td>
<td width="10%"><%= l(:label_log_active_record_time_percent) %></td></tr>
<% unless @log_result.nil? %>
<% @log_result.each do |r| %>
<% unless r.blank? %>
<!-- #如果请求地址不为空且长度大于50那么我们就截取长度20 %-->
<tr><td width="10%"><%= raw r[0].length>50?r[0].truncate(20) : r[0] unless r[0].nil? %></td>
<td width="10%"><%= raw r[1] %></td>
<td width="10%"><%= raw r[2] %></td>
<td width="10%"><%= raw r[3] %></td>
<td width="10%"><%= raw r[4] %></td>
<td width="10%"><%= raw r[5] %></td>
<td width="10%"><%= raw r[6] %></td>
<td width="10%"><%= raw r[7] %></td>
<td width="10%"><%= raw r[8] %></td></tr>
<% end %>
<%end %>
<%end %>
</table>
<%= paginate @log_result unless @log_result.empty? %><br/>

View File

@ -1,8 +1,8 @@
<% <%
select_option = [] select_option = []
(select_option << ['项目', 'projects']) if project_type == Project::ProjectType_project (select_option << [l(:label_select_project), 'projects']) if project_type == Project::ProjectType_project
(select_option << ['课程', 'courses']) if project_type == Project::ProjectType_course (select_option << [l(:label_select_course), 'courses']) if project_type == Project::ProjectType_course
select_option << ['用户', 'users'] select_option << [l(:label_select_user), 'users']
#select_option << ['教师', 'users_teacher'], #select_option << ['教师', 'users_teacher'],
#select_option << ['学生', 'users_student'] #select_option << ['学生', 'users_student']
%> %>
@ -49,7 +49,7 @@ form #search_type{
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %> <%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
<div class="project-search" style="float: right"> <div class="project-search" style="float: right">
<div class='search_widget'> <div class='search_widget'>
<%= text_field_tag :q, nil, placeholder:'请输入要搜索的关键字', :size => 27, style: "float:left" %> <%= text_field_tag :q, nil, :placeholder => l(:label_search_information), :size => 27, style: "float:left" %>
<%= select_tag(:search_type, options_for_select(select_option), :style => "float:right" ) %> <%= select_tag(:search_type, options_for_select(select_option), :style => "float:right" ) %>
</div> </div>
<%#= hidden_field_tag 'project_type', project_type %> <%#= hidden_field_tag 'project_type', project_type %>

View File

@ -1,8 +1,8 @@
<% <%
select_option = [] select_option = []
(select_option << ['项目', 'projects']) if project_type == Project::ProjectType_project (select_option << [l(:label_select_project), 'projects']) if project_type == Project::ProjectType_project
(select_option << ['课程', 'courses']) if project_type == Project::ProjectType_course (select_option << [l(:label_select_course), 'courses']) if project_type == Project::ProjectType_course
select_option << ['用户', 'users'] select_option << [l(:label_select_user), 'users']
%> %>
<style type="text/css"> <style type="text/css">
form #q, form #search_type{ form #q, form #search_type{
@ -89,10 +89,10 @@ form #search_by
<div class="project-search" style="float: right"> <div class="project-search" style="float: right">
<div class='search_widget' > <div class='search_widget' >
<%= text_field_tag :q, nil, placeholder:'请输入要搜索的关键字', style:"float:left" %> <%= text_field_tag :q, nil, :placeholder => l(:label_search_information), style:"float:left;" %>
<input type="text" name="search_by_input" style="display: none" id="search_by_input" value="0"> <input type="text" name="search_by_input" style="display: none" id="search_by_input" value="0">
<%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();", :style => "float:right" ) %> <%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();", :style => "float:right" ) %>
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]]), :onchange => "searchByChange();",:style => "float:right" ) %> <%= select_tag(:search_by,options_for_select([[l(:label_select_user_nickname),"0"],[l(:label_select_user_showname),"1"],[l(:label_select_user_email),"2"]]), :onchange => "searchByChange();",:style => "float:right" ) %>
</div> </div>
<%#= hidden_field_tag 'project_type', project_type %> <%#= hidden_field_tag 'project_type', project_type %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil,:style =>"float: right; margin-left:3px;margin-top:2px" %> <%= submit_tag l(:label_search), :class => "enterprise", :name => nil,:style =>"float: right; margin-left:3px;margin-top:2px" %>

View File

@ -140,7 +140,7 @@
<!--搜索框--> <!--搜索框-->
<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_information), name: "name", :class => 'blueinputbar', :style => 'width:240px; padding-right:50px;'%>
&nbsp; &nbsp;
<%= 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" %>

View File

@ -102,36 +102,52 @@
<% end %> <% end %>
<% end; reset_cycle %> <% end; reset_cycle %>
<% end; reset_cycle %> <% end; reset_cycle %>
<% end %>
</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)">
<div class="user-message-box-list" style="margin-top: 10px;"> <strong>
<% activities = find_all_activities%> <%= l(:lable_user_active)%>
<% activities.each do |event| %> </strong>
<li style="display: block;height:60px; padding-bottom: 4px;"> </h3>
<div class="inner-right" style="float: left; height: 100%; "> <div class="user-message-box-list" style="margin-top: 10px;">
<%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %> <% cache("activities") do %>
</div> <%activities = find_all_activities%>
<div class="inner-right" style="float: right; width:86%; height: 100%; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" > <% activities.each do |event| %>
<span style="color: green;"> <%= link_to event.event_author, (user_path(event.event_author) if event.event_author), <% cache event do %>
:style => "color:green;", :target => "_blank" %> </span> <li style="display: block;height:60px; padding-bottom: 4px;">
<%= show_user_content event %> <div class="inner-right" style="float: left; height: 100%; ">
<p style="margin-top: 4px;"> <%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
<span style="color: rgb(172, 174, 177)"> <%= l(:field_updated_on) %> </div>
<%= time_tag_welcome event.event_datetime %>前 </span> <div class="inner-right" style="float: right; width:86%; height: 100%; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" >
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color: green;">
<span style="float: right; color: rgb(172, 174, 177);"> <%= show_event_reply event %> </span> <%= link_to event.event_author, (user_path(event.event_author) if event.event_author),
</p> :style => "color:green;", :target => "_blank" %>
</div> </span>
</li> <%= show_user_content event %>
<% end %> <p style="margin-top: 4px;">
</div> <span style="color: rgb(172, 174, 177)">
</ul> <%= l(:field_updated_on) %>
</div> <%= format_time event.event_datetime %>
<%= l(:field_time_ago) %>
</span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="float: right; color: rgb(172, 174, 177);">
<%= show_event_reply event %>
</span>
</p>
</div>
</li>
<% end %>
<% end %>
<% end %>
</div>
</ul>
</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">
@ -142,29 +158,40 @@
<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">
<% cache("forums") do %>
<% topics = find_new_forum_topics(6) %> <% topics = find_new_forum_topics(6) %>
<% 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 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'> <%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %> </span> <span class='memo_timestamp'>
<span class="memo_author"> <%= l(:label_question_sponsor)%> <%#= "#{l(:field_updated_on, value: format_time(topic_last_time topic))}" %>
<%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> </span> <%= l(:field_updated_on) %>
<span class="memo_last_person"> <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %> <%= format_time topic_last_time topic %>
<%= l(:label_final_reply)%> </span>
<%= link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%> <span class="memo_author">
<% end %> </span> <%= l(:label_question_sponsor)%>
<span class="memo_reply"> <%= l(:label_reply)%> <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %>
(<%= link_to topic.try(:replies_count), topic.event_url %>) </span> </span>
</div> <span class="memo_last_person">
</li> <% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %>
<!--<%#end %> --> <%= l(:label_final_reply)%>
<!-- cache --> <%=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 class="memo_reply">
<%= l(:label_reply)%>
(<%= link_to topic.try(:replies_count), topic.event_url %>)
</span>
</div>
</li>
<%end %>
<% end %>
<% end %>
</div> </div>
</ul> </ul>
</div> </div>

View File

@ -7,11 +7,11 @@ RedmineApp::Application.configure do
# Log error messages when you accidentally call methods on nil. # Log error messages when you accidentally call methods on nil.
config.whiny_nils = true config.whiny_nils = true
config.logger = Logger.new('log/development.log', 'daily') # daily, weekly or monthly
# Show full error reports and disable caching # Show full error reports and disable caching
config.consider_all_requests_local = true config.consider_all_requests_local = true
config.action_controller.perform_caching = false config.action_controller.perform_caching = false
config.cache_store = :file_store, "#{Rails.root }/public/tmp/"
# Don't care if the mailer can't send # Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = true config.action_mailer.raise_delivery_errors = true

View File

@ -17,8 +17,9 @@ RedmineApp::Application.configure do
# config.logger.level = Logger::INFO # config.logger.level = Logger::INFO
# Full error reports are disabled and caching is turned on # Full error reports are disabled and caching is turned on
config.logger = Logger.new('log/production.log', 'daily',1048576) # daily, weekly or monthly
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
config.cache_store = :file_store, "#{Rails.root }/public/tmp/"
# Enable serving of images, stylesheets, and javascripts from an asset server # Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com" # config.action_controller.asset_host = "http://assets.example.com"

View File

@ -0,0 +1,229 @@
# logger.rb - simple logging utility
# Copyright (C) 2000-2003, 2005, 2008, 2011 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
#
# Documentation:: NAKAMURA, Hiroshi and Gavin Sinclair
# License::
# You can redistribute it and/or modify it under the same terms of Ruby's
# license; either the dual license version in 2003, or any later version.
# Revision:: $Id: logger.rb 31641 2011-05-19 00:07:25Z nobu $
#
# A simple system for logging messages. See Logger for more documentation.
require 'monitor'
require 'fileutils'
# == Description
#
# The Logger class provides a simple but sophisticated logging utility that
# you can use to output messages.
#
# The messages have associated levels, such as +INFO+ or +ERROR+ that indicate
# their importance. You can then give the Logger a level, and only messages
# at that level of higher will be printed.
#
# The levels are:
#
# +FATAL+:: an unhandleable error that results in a program crash
# +ERROR+:: a handleable error condition
# +WARN+:: a warning
# +INFO+:: generic (useful) information about system operation
# +DEBUG+:: low-level information for developers
#
# For instance, in a production system, you may have your Logger set to
# +INFO+ or even +WARN+
# When you are developing the system, however, you probably
# want to know about the program's internal state, and would set the Logger to
# +DEBUG+.
#
# *Note*: Logger does not escape or sanitize any messages passed to it.
# Developers should be aware of when potentially malicious data (user-input)
# is passed to Logger, and manually escape the untrusted data:
#
# logger.info("User-input: #{input.dump}")
# logger.info("User-input: %p" % input)
#
# You can use #formatter= for escaping all data.
#
# original_formatter = Logger::Formatter.new
# logger.formatter = proc { |severity, datetime, progname, msg|
# original_formatter.call(severity, datetime, progname, msg.dump)
# }
# logger.info(input)
#
# === Example
#
# This creates a logger to the standard output stream, with a level of +WARN+
#
# log = Logger.new(STDOUT)
# log.level = Logger::WARN
#
# log.debug("Created logger")
# log.info("Program started")
# log.warn("Nothing to do!")
#
# begin
# File.each_line(path) do |line|
# unless line =~ /^(\w+) = (.*)$/
# log.error("Line in wrong format: #{line}")
# end
# end
# rescue => err
# log.fatal("Caught exception; exiting")
# log.fatal(err)
# end
#
# Because the Logger's level is set to +WARN+, only the warning, error, and
# fatal messages are recorded. The debug and info messages are silently
# discarded.
#
# === Features
#
# There are several interesting features that Logger provides, like
# auto-rolling of log files, setting the format of log messages, and
# specifying a program name in conjunction with the message. The next section
# shows you how to achieve these things.
#
#
# == HOWTOs
#
# === How to create a logger
#
# The options below give you various choices, in more or less increasing
# complexity.
#
# 1. Create a logger which logs messages to STDERR/STDOUT.
#
# logger = Logger.new(STDERR)
# logger = Logger.new(STDOUT)
#
# 2. Create a logger for the file which has the specified name.
#
# logger = Logger.new('logfile.log')
#
# 3. Create a logger for the specified file.
#
# file = File.open('foo.log', File::WRONLY | File::APPEND)
# # To create new (and to remove old) logfile, add File::CREAT like;
# # file = open('foo.log', File::WRONLY | File::APPEND | File::CREAT)
# logger = Logger.new(file)
#
# 4. Create a logger which ages logfile once it reaches a certain size. Leave
# 10 "old log files" and each file is about 1,024,000 bytes.
#
# logger = Logger.new('foo.log', 10, 1024000)
#
# 5. Create a logger which ages logfile daily/weekly/monthly.
#
# logger = Logger.new('foo.log', 'daily')
# logger = Logger.new('foo.log', 'weekly')
# logger = Logger.new('foo.log', 'monthly')
#
# === How to log a message
#
# Notice the different methods (+fatal+, +error+, +info+) being used to log
# messages of various levels? Other methods in this family are +warn+ and
# +debug+. +add+ is used below to log a message of an arbitrary (perhaps
# dynamic) level.
#
# 1. Message in block.
#
# logger.fatal { "Argument 'foo' not given." }
#
# 2. Message as a string.
#
# logger.error "Argument #{ @foo } mismatch."
#
# 3. With progname.
#
# logger.info('initialize') { "Initializing..." }
#
# 4. With severity.
#
# logger.add(Logger::FATAL) { 'Fatal error!' }
#
# The block form allows you to create potentially complex log messages,
# but to delay their evaluation until and unless the message is
# logged. For example, if we have the following:
#
# logger.debug { "This is a " + potentially + " expensive operation" }
#
# If the logger's level is +INFO+ or higher, no debug messages will be logged,
# and the entire block will not even be evaluated. Compare to this:
#
# logger.debug("This is a " + potentially + " expensive operation")
#
# Here, the string concatenation is done every time, even if the log
# level is not set to show the debug message.
#
# === How to close a logger
#
# logger.close
#
# === Setting severity threshold
#
# 1. Original interface.
#
# logger.sev_threshold = Logger::WARN
#
# 2. Log4r (somewhat) compatible interface.
#
# logger.level = Logger::INFO
#
# DEBUG < INFO < WARN < ERROR < FATAL < UNKNOWN
#
#
# == Format
#
# Log messages are rendered in the output stream in a certain format by
# default. The default format and a sample are shown below:
#
# Log format:
# SeverityID, [Date Time mSec #pid] SeverityLabel -- ProgName: message
#
# Log sample:
# I, [Wed Mar 03 02:34:24 JST 1999 895701 #19074] INFO -- Main: info.
#
# You may change the date and time format via #datetime_format=
#
# logger.datetime_format = "%Y-%m-%d %H:%M:%S"
# # e.g. "2004-01-03 00:54:26"
#
# Or, you may change the overall format with #formatter= method.
#
# logger.formatter = proc do |severity, datetime, progname, msg|
# "#{datetime}: #{msg}\n"
# end
# # e.g. "Thu Sep 22 08:51:08 GMT+9:00 2005: hello world"
#
class Logger
#具体内容请看https://bugs.ruby-lang.org/issues/7303
# Device used for logging messages.
class LogDevice
def shift_log_period(period_end)
postfix = period_end.strftime("%Y%m%d") # YYYYMMDD
age_file = "#{@filename}.#{postfix}"
if FileTest.exist?(age_file)
# try to avoid filename crash caused by Timestamp change.
idx = 0
# .99 can be overridden; avoid too much file search with 'loop do'
while idx < 100
idx += 1
age_file = "#{@filename}.#{postfix}.#{idx}"
break unless FileTest.exist?(age_file)
end
end
# @dev.close rescue nil
# File.rename("#{@filename}", age_file)
# @dev = create_logfile(@filename)
#覆盖原来lib库的方法将上边三行删除增加下边两行
FileUtils.cp(@filename, age_file)
reset_logfile(@dev) # see below for this new method return true
return true
end
#打开原来lib库新增一个方法
def reset_logfile(logdev)
logdev.truncate( 0 )
logdev.sync = true
add_log_header(logdev)
end
end
end

View File

@ -273,7 +273,6 @@ en:
field_downloads: Downloads field_downloads: Downloads
field_author: Author field_author: Author
field_created_on: Created field_created_on: Created
field_updated_on: Updated
field_closed_on: Closed field_closed_on: Closed
field_field_format: Format field_field_format: Format
field_is_for_all: For all projects field_is_for_all: For all projects
@ -547,13 +546,9 @@ en:
project_module_gantt: Gantt project_module_gantt: Gantt
# edit by meng # edit by meng
lable_hot_course: Hot projects lable_hot_course: Hot Courses
lable_hot_projects: Active courses lable_user_active: User Movements
lable_user_active: User movements
lable_bar_active: Bar posts
label_project_score: Score
label_course_join_student: Join a course label_course_join_student: Join a course
label_join_project: Join a project
label_contest_modify_settings: Configuration label_contest_modify_settings: Configuration
bale_news_notice: Add a notification bale_news_notice: Add a notification
label_field_correct: correct input label_field_correct: correct input
@ -609,7 +604,7 @@ en:
label_user_anonymous: Anonymous label_user_anonymous: Anonymous
label_project: Project label_project: Project
label_activity_project: 'Project: ' #added by bai label_activity_project: 'Project: ' #added by bai
label_project_new: New project
label_project_plural: Projects label_project_plural: Projects
label_project_deposit: Projects label_project_deposit: Projects
label_first_page_made: Homepage customization label_first_page_made: Homepage customization
@ -953,7 +948,6 @@ en:
label_module_plural: Modules label_module_plural: Modules
label_added_time_by: "Added by %{author} %{age} ago" label_added_time_by: "Added by %{author} %{age} ago"
label_updated_time_by: "Updated by %{author} %{age} ago" label_updated_time_by: "Updated by %{author} %{age} ago"
label_updated_time: "Updated %{value} ago"
label_jump_to_a_project: Jump to a project... label_jump_to_a_project: Jump to a project...
label_file_plural: Files label_file_plural: Files
label_changeset_plural: Changesets label_changeset_plural: Changesets
@ -978,7 +972,6 @@ en:
label_age: Age label_age: Age
label_change_properties: Change properties label_change_properties: Change properties
label_general: General label_general: General
label_more: More
label_scm: SCM label_scm: SCM
label_plugins: Plugins label_plugins: Plugins
label_ldap_authentication: LDAP authentication label_ldap_authentication: LDAP authentication
@ -1782,18 +1775,140 @@ en:
label_current_attendingcontest_work: Latest Competition Work label_current_attendingcontest_work: Latest Competition Work
label_issue_feedback_activities: Question&Feedback label_issue_feedback_activities: Question&Feedback
label_more_information: More... label_more_information: More...
label_my_question: My-question
label_my_feedback: My-feedback
label_release_time: Release-time label_release_time: Release-time
label_question_sponsor: Sponsor label_question_sponsor: Sponsor
label_final_reply: Final-reply label_final_reply: Final-reply
label_reply: Reply label_reply: Reply
label_weixin: WeiXin label_weixin: WeiXin
label_search_intimation: please input the keywords
label_work_quantity: work
# 托管平台主页
# edit by meng
# 托管平台主页> 顶部菜单
field_homepage: Homepage
label_project_deposit: Projects
label_course_practice: Courses
label_forum_all: Forums
label_school_all: Schools
label_contest_innovate: Competition community
label_software_user: Users
label_requirement_enterprise: Requirements
label_stores_index: Resource search
# 托管平台主页 > 搜索提示信息
label_search_information: Please input the keywords!
# 托管平台主页 > 下拉列表
label_select_project: project
label_select_course: course
label_select_user: user
label_select_user_nickname: nickname
label_select_user_showname: name
label_select_user_email: email
# 托管平台主页 > 下方托管平台链接
label_projects_management_platform: Projects-platform label_projects_management_platform: Projects-platform
label_courses_management_platform: Courses-platform label_courses_management_platform: Courses-platform
label_contests_management_platform: Competitions-platform label_contests_management_platform: Competitions-platform
# 托管平台主页 > 底部承办单位
label_hosted_by: Organizer
label_hosted_by: National Key Laboratory for Parallel and Distributed Processing, NUDT
label_sponsor: Department of Computer Science and Technology, NUDT
label_co_organizer_NUDT: College of Computer, NUDT
label_co_organizer_EECS: Institute of Software, EECS
label_co_organizer_BHU: Beihang University School of Computer Science & Engineering
label_co_organizer_CAS: Institute of Software, CAS
label_co_organizer_InforS: InforSuite
label_rights_reserved: ©2007~2014
label_contact_us: Contact
# 英文版不需要显示国内许可证 ,需要页面做判断
#label_license: 湘ICP备09019772
# 项目托管平台
# 项目托管平台主页 >主旨
label_project_trustie:
label_project_trustie_theme:
# 项目托管平台主页 >热门项目栏
lable_hot_projects: Hot Projects
label_project_new: New project
label_join_project: Join a project
label_private: private
label_project_member_amount: "%{count} members"
label_project_score_tips: "Considering all activities of the project, project's score reflects the activity level of project"
label_project_score: Score
# 项目托管平台主页 >用户动态栏
lable_user_active: User Movements
field_user_active_published: released
field_user_active_uploaded: uploaded
field_user_active_updated: updated
field_user_active_unknow: Unknown content
field_user_active_news: ' news'
field_user_active_issue: ' issue'
field_user_active_attachment: ' attachment'
field_user_active_message: ' message'
field_user_active_reply: ' reply'
field_user_active_bid: ' work'
field_user_active_memo: ' memo'
field_user_active_document: ' document'
field_user_active_changeset: ' repository'
field_user_active_issue_note: ' issue-note'
field_updated_on: Updated
field_time_ago: ago
field_active_reply: "Reply("
# 用户动态中event.title和event.description
# 通过act_as_event方法的option配置
# "#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}"
# "缺陷 #1869 (已解决):subject"
# tracker.name和status在数据库中以中文字段形式存储
# 项目托管平台主页 >用户动态栏
lable_bar_active: Bar Posts
label_my_question: My-question
label_my_feedback: My-feedback
label_more: More
label_updated_time: "Updated %{value} ago"
# 课程托管平台主页
# 课程托管平台主页 >主旨
label_course_trustie:
label_course_trustie_theme:
# 课程托管平台主页 >
# 竞赛托管平台主页
# 竞赛托管平台主页 >主旨
label_contest_trustie:
label_contest_trustie_theme:
# 竞赛托管平台主页 >
label_work_quantity: work
label_contest_work: Competition work label_contest_work: Competition work
label_contests_reward_method: Reward method label_contests_reward_method: Reward method
label_attendingcontestwork_developers: Developers label_attendingcontestwork_developers: Developers
@ -1892,7 +2007,7 @@ en:
label_borad_project: Project-borad label_borad_project: Project-borad
label_search_intimation: please input the searching keywords!
label_update_time: Update time label_update_time: Update time
label_project_notice: release the notice label_project_notice: release the notice
label_no_file_uploaded: No file uploaded label_no_file_uploaded: No file uploaded
@ -1905,13 +2020,17 @@ en:
label_course_term: Semester label_course_term: Semester
label_comment_time: Comment time label_comment_time: Comment time
label_bidding_user_studentcode: Student ID label_bidding_user_studentcode: Student ID
label_bidding_user_studentname: name
# label_organizers: Organizer
# label_organizers_information: National Key Laboratory of Parallel and Distributed Processing, NUDT
# label_organizers_information_institute: Department of Computer Sciencer and Technology
# label_copyright: Copyright
# label_contact_us: Contact us
# label_record: 湘ICP备09019772
label_organizers: Organizer
label_organizers_information: National Key Laboratory of Parallel and Distributed Processing, NUDT
label_organizers_information_institute: Department of Computer Sciencer and Technology
label_copyright: Copyright
label_contact_us: Contact us
label_record: 湘ICP备09019772
label_check_comment: Check comment label_check_comment: Check comment
label_notification: Notification label_notification: Notification
label_must_answer: Will answer label_must_answer: Will answer
@ -1935,7 +2054,6 @@ en:
label_unknow_type: Unknow type label_unknow_type: Unknow type
label_score_less_than_zero: Score less than 0, revised to 0 label_score_less_than_zero: Score less than 0, revised to 0
review_assignments: Review assignments review_assignments: Review assignments
label_private: private
label_my_school: My school label_my_school: My school
label_all_schol: All school label_all_schol: All school
label_select_province: Please select the provinces label_select_province: Please select the provinces

View File

@ -569,10 +569,9 @@ zh:
label_user_anonymous: 匿名用户 label_user_anonymous: 匿名用户
label_project: 项目 label_project: 项目
label_activity_project: '项目: ' #added by bai label_activity_project: '项目: ' #added by bai
label_project_new: 新建项目
label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。' label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。'
label_project_plural: 项目列表 label_project_plural: 项目列表
label_project_score: 项目评分
label_first_page_made: 首页定制 label_first_page_made: 首页定制
label_project_first_page: 项目托管平台首页 label_project_first_page: 项目托管平台首页
label_course_first_page: 课程实践平台首页 label_course_first_page: 课程实践平台首页
@ -663,13 +662,8 @@ zh:
#by young #by young
label_requirement: 需求 label_requirement: 需求
label_new_course: 课程列表 label_new_course: 课程列表
label_course_practice: 课程实践
label_course_all: 课程列表 label_course_all: 课程列表
label_teacher_all: 所有教师 label_teacher_all: 所有教师
label_project_deposit: 项目托管
label_software_user: 软件创客
label_contest_innovate: 创新竞赛
label_requirement_enterprise: 软件众包
label_requirement_enterprise_list: 众包列表 label_requirement_enterprise_list: 众包列表
label_new_homework: 作业 label_new_homework: 作业
label_new_contest: 竞赛 label_new_contest: 竞赛
@ -997,7 +991,6 @@ zh:
label_module_plural: 模块 label_module_plural: 模块
label_added_time_by: "由 %{author} 在 %{age} 之前添加" label_added_time_by: "由 %{author} 在 %{age} 之前添加"
label_added_time: "在 %{age} 之前添加" label_added_time: "在 %{age} 之前添加"
label_updated_time: " 更新于 %{value} 之前"
label_updated_time_by: "由 %{author} 更新于 %{age} 之前" label_updated_time_by: "由 %{author} 更新于 %{age} 之前"
label_jump_to_a_project: 选择一个项目... label_jump_to_a_project: 选择一个项目...
label_file_plural: 文件 label_file_plural: 文件
@ -1064,7 +1057,6 @@ zh:
label_age: 提交时间 label_age: 提交时间
label_change_properties: 修改属性 label_change_properties: 修改属性
label_general: 一般 label_general: 一般
label_more: 更多>>
label_scm: 管理系统 label_scm: 管理系统
label_plugins: 插件 label_plugins: 插件
label_ldap_authentication: LDAP 认证 label_ldap_authentication: LDAP 认证
@ -1874,7 +1866,6 @@ zh:
label_course_view_student: 查看其他课程 label_course_view_student: 查看其他课程
label_course_student: 学生 label_course_student: 学生
label_course_file: 资源库 #资料共享 label_course_file: 资源库 #资料共享
label_stores_index: 资源搜索
label_course_new_homework: 新建作业 label_course_new_homework: 新建作业
label_course_homework_list: 作业列表 label_course_homework_list: 作业列表
label_course_homework_new: 发布作业 label_course_homework_new: 发布作业
@ -1981,7 +1972,6 @@ zh:
label_student: 学生 label_student: 学生
#added by Wen #added by Wen
label_school_all: 中国高校
label_school_not_fount: 没有符合的高校信息 label_school_not_fount: 没有符合的高校信息
@ -2203,18 +2193,140 @@ zh:
label_final_reply: 最后回复 label_final_reply: 最后回复
label_reply: 回复 label_reply: 回复
label_weixin: 微信扫码 label_weixin: 微信扫码
label_search_intimation: 请输入要搜索的关键字
label_work_quantity: 个作品
# 托管平台主页公共组件
# edit by meng
# 托管平台主页> 顶部菜单
field_homepage: 主页
label_project_deposit: 项目托管
label_course_practice: 课程实践
label_forum_all: 公共贴吧
label_school_all: 中国高校
label_contest_innovate: 创新竞赛
label_software_user: 软件创客
label_requirement_enterprise: 软件众包
label_stores_index: 资源搜索
# 托管平台主页 > 搜索提示信息
label_search_information: 请输入要搜索的关键字
# 托管平台主页 > 下拉列表
label_select_project: 项目
label_select_course: 课程
label_select_user: 用户
label_select_user_nickname: 昵称
label_select_user_showname: 姓名
label_select_user_email: 邮箱
# 托管平台主页 > 下方托管平台链接
label_projects_management_platform: 项目托管平台 label_projects_management_platform: 项目托管平台
label_courses_management_platform: 课程实践平台 label_courses_management_platform: 课程实践平台
label_contests_management_platform: 竞赛托管平台 label_contests_management_platform: 竞赛托管平台
label_organizers: 主办单位
label_organizers_information: 国防科学技术大学并行与分布处理国家重点实验室 # 托管平台主页 > 底部承办单位等信息
label_organizers_information_institute: 计算机科学与技术系 label_hosted_organization: 主办单位
label_copyright: 版权 label_hosted_by: 国防科学技术大学并行与分布处理国家重点实验室
label_sponsor: 计算机科学与技术系
label_co_organizer_NUDT: 国防科学技术大学计算机学院
label_co_organizer_EECS: 北京大学信息科学技术学院软件研究所
label_co_organizer_BHU: 北京航空航天大学计算机学院
label_co_organizer_CAS: 中国科学院软件研究所
label_co_organizer_InforS: 山东中创软件商用中间件股份有限公司
label_rights_reserved: 版权©2007~2014
label_contact_us: 联系我们 label_contact_us: 联系我们
label_record: 湘ICP备09019772 # 英文版不需要显示国内许可证
label_license: 湘ICP备09019772
# 项目托管平台主页
# 项目托管平台主页 >主旨
label_project_trustie: Trustie在线项目托管平台
label_project_trustie_theme: ", 面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
# 项目托管平台主页 >热门项目栏
lable_hot_projects: 热门项目
label_project_new: 新建项目
label_join_project: 加入项目
label_private: 私有
label_project_member_amount: "%{count}人"
label_project_score_tips: 项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度
label_project_score: 项目评分
# 项目托管平台主页 >用户动态栏
lable_user_active: 用户动态
field_user_active_published: 发表了
field_user_active_uploaded: 上传了
field_user_active_updated: 更新了
field_user_active_unknow: 未知内容
field_user_active_news: 新闻
field_user_active_issue: 问题
field_user_active_attachment: 附件
field_user_active_message: 主题
field_user_active_reply: 回复
field_user_active_bid: 作业
field_user_active_memo: 主题
field_user_active_document: 文件
field_user_active_changeset: 版本库
field_user_active_issue_note: 问题说明
field_updated_on: 更新于
field_time_ago:
field_active_reply: "回复("
# 用户动态中event.title和event.description
# 通过act_as_event方法的option配置
# "#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}"
# "缺陷 #1869 (已解决):subject"
# tracker.name和status在数据库中以中文字段形式存储
# 项目托管平台主页 >用户动态栏
lable_bar_active: 贴吧动态
label_my_question: 我要提问
label_my_feedback: 我要反馈
label_more: 更多>>
label_updated_time: " 更新于 %{value} 之前"
# 课程托管平台主页
# 课程托管平台主页 >主旨
label_course_trustie: Trustie在线课程实践平台
label_course_trustie_theme: ", 面向中国高校教师与大学生,提供社交化的课程管理、资源共享、合作实验、协同研究。"
# 课程托管平台主页 >
# 竞赛托管平台主页
# 竞赛托管平台主页 >主旨
label_contest_trustie: Trustie在线竞赛实战平台
label_contest_trustie_theme: ", 面向中国大学生与编程爱好者,提供社交化的竞赛管理、应用管理、代码托管、合作交流。"
# 竞赛托管平台主页 >
label_work_quantity: 个作品
# label_organizers: 主办单位
# label_organizers_information: 国防科学技术大学并行与分布处理国家重点实验室
# label_organizers_information_institute: 计算机科学与技术系
# label_copyright: 版权
# label_contact_us: 联系我们
# label_record: 湘ICP备09019772
label_check_comment: 查看通知评论 label_check_comment: 查看通知评论
label_notification: 通知公告 label_notification: 通知公告
label_course_ad_description: 课程模块正在优化中,使用过程中如有问题请您与我们联系,感谢大家的支持! label_course_ad_description: 课程模块正在优化中,使用过程中如有问题请您与我们联系,感谢大家的支持!
@ -2240,16 +2352,12 @@ zh:
label_unknow_type: 未知类型 label_unknow_type: 未知类型
label_score_less_than_zero: 得分小于0修正为0 label_score_less_than_zero: 得分小于0修正为0
review_assignments: 评审任务 review_assignments: 评审任务
label_private: 私有
label_my_school: 我的学校 label_my_school: 我的学校
label_all_schol: 全部学校 label_all_schol: 全部学校
label_select_province: 请选择省份 label_select_province: 请选择省份
label_search_conditions_not_null: 搜索条件不能为空 label_search_conditions_not_null: 搜索条件不能为空
lable_hot_course: 活跃课程 lable_hot_course: 活跃课程
lable_hot_projects: 热门项目
lable_user_active: 用户动态
lable_bar_active: 贴吧动态
lable_student_list_visable: 学生列表是否公开 lable_student_list_visable: 学生列表是否公开
lable_sure_exit_project: 是否确认退出该项目 lable_sure_exit_project: 是否确认退出该项目
lable_input_class: 在此输入课时 lable_input_class: 在此输入课时
@ -2311,15 +2419,31 @@ zh:
label_poll_answer_valid_result: 以上为有效问答题答案! label_poll_answer_valid_result: 以上为有效问答题答案!
label_answer_total: 总计: label_answer_total: 总计:
label_join_project: 加入项目 label_join_project: 加入项目
label_technical_support: 技术支持: label_technical_support: 技术支持:
label_feedback: 意见反馈 label_feedback: 意见反馈
label_log_detail: "日志详情"
# 项目企业模块 label_log_delete_log: "删除日志"
label_all_enterprises: 所有企业 label_log_access_analysis: "访问统计"
label_my_enterprise: 我的企业 label_log_time_analysis: "耗时分析"
label_enterprise_tips: 暂时还没有该企业对应的项目,系统的其它项目您可能会感兴趣! label_log_refresh: "刷新"
label_part_enterprise_tips: 系统的其它项目您可能也会感兴趣! label_log_key: "关键字:"
label_enterprise_nil: 改模块为最新上线模块,目前还未有项目关联到企业! label_log_time: "时间:"
label_enterprises: 名企 label_log_delete_confirm: "确认清除该天日志内容?"
label_log_access_count: "访问次数"
label_log_url: "URL路径"
label_log_ip: "访问IP"
label_log_access_time: "访问时间"
label_log_access_controller_action: "模块路径"
label_log_response_time: "响应时间"
label_log_views_time: "页面渲染时间"
label_log_views_time_percent: "页面渲染时间百分比"
label_log_active_record_time: "AR响应时间"
label_log_active_record_time_percent: "AR响应时间百分比"
views:
pagination:
first: "&laquo; 首页"
last: "末页 &raquo;"
previous: "&laquo; 上一页"
next: "下一页 &raquo;"
truncate: "..."

224
config/newrelic.yml Normal file
View File

@ -0,0 +1,224 @@
#
# This file configures the New Relic Agent. New Relic monitors Ruby, Java,
# .NET, PHP, Python and Node applications with deep visibility and low
# overhead. For more information, visit www.newrelic.com.
#
# Generated January 23, 2015
#
# This configuration file is custom generated for Trustie
# Here are the settings that are common to all environments
common: &default_settings
# ============================== LICENSE KEY ===============================
# You must specify the license key associated with your New Relic
# account. This key binds your Agent's data to your account in the
# New Relic service.
license_key: '9b481f5c9ec07de722dcaaa17b38d0d1efff32c0'
# Agent Enabled (Ruby/Rails Only)
# Use this setting to force the agent to run or not run.
# Default is 'auto' which means the agent will install and run only
# if a valid dispatcher such as Mongrel is running. This prevents
# it from running with Rake or the console. Set to false to
# completely turn the agent off regardless of the other settings.
# Valid values are true, false and auto.
#
# agent_enabled: auto
# Application Name Set this to be the name of your application as
# you'd like it show up in New Relic. The service will then auto-map
# instances of your application into an "application" on your
# dashboard page. If you want to map this instance into multiple
# apps, like "AJAX Requests" and "All UI" then specify a semicolon
# separated list of up to three distinct names, or a yaml list.
# Defaults to the capitalized RAILS_ENV or RACK_ENV (i.e.,
# Production, Staging, etc)
#
# Example:
#
# app_name:
# - Ajax Service
# - All Services
#
# Caution: If you change this name, a new application will appear in the New
# Relic user interface with the new name, and data will stop reporting to the
# app with the old name.
#
# See https://newrelic.com/docs/site/renaming-applications for more details
# on renaming your New Relic applications.
#
app_name: My Application
# When "true", the agent collects performance data about your
# application and reports this data to the New Relic service at
# newrelic.com. This global switch is normally overridden for each
# environment below. (formerly called 'enabled')
monitor_mode: true
# Developer mode should be off in every environment but
# development as it has very high overhead in memory.
developer_mode: false
# The newrelic agent generates its own log file to keep its logging
# information separate from that of your application. Specify its
# log level here.
log_level: info
# Optionally set the path to the log file This is expanded from the
# root directory (may be relative or absolute, e.g. 'log/' or
# '/var/log/') The agent will attempt to create this directory if it
# does not exist.
# log_file_path: 'log'
# Optionally set the name of the log file, defaults to 'newrelic_agent.log'
# log_file_name: 'newrelic_agent.log'
# The newrelic agent communicates with the service via https by default. This
# prevents eavesdropping on the performance metrics transmitted by the agent.
# The encryption required by SSL introduces a nominal amount of CPU overhead,
# which is performed asynchronously in a background thread. If you'd prefer
# to send your metrics over http uncomment the following line.
# ssl: false
#============================== Browser Monitoring ===============================
# New Relic Real User Monitoring gives you insight into the performance real users are
# experiencing with your website. This is accomplished by measuring the time it takes for
# your users' browsers to download and render your web pages by injecting a small amount
# of JavaScript code into the header and footer of each page.
browser_monitoring:
# By default the agent automatically injects the monitoring JavaScript
# into web pages. Set this attribute to false to turn off this behavior.
auto_instrument: true
# Proxy settings for connecting to the New Relic server.
#
# If a proxy is used, the host setting is required. Other settings
# are optional. Default port is 8080.
#
# proxy_host: hostname
# proxy_port: 8080
# proxy_user:
# proxy_pass:
# The agent can optionally log all data it sends to New Relic servers to a
# separate log file for human inspection and auditing purposes. To enable this
# feature, change 'enabled' below to true.
# See: https://newrelic.com/docs/ruby/audit-log
audit_log:
enabled: false
# Tells transaction tracer and error collector (when enabled)
# whether or not to capture HTTP params. When true, frameworks can
# exclude HTTP parameters from being captured.
# Rails: the RoR filter_parameter_logging excludes parameters
# Java: create a config setting called "ignored_params" and set it to
# a comma separated list of HTTP parameter names.
# ex: ignored_params: credit_card, ssn, password
capture_params: false
# Transaction tracer captures deep information about slow
# transactions and sends this to the New Relic service once a
# minute. Included in the transaction is the exact call sequence of
# the transactions including any SQL statements issued.
transaction_tracer:
# Transaction tracer is enabled by default. Set this to false to
# turn it off. This feature is only available at the Professional
# and above product levels.
enabled: true
# Threshold in seconds for when to collect a transaction
# trace. When the response time of a controller action exceeds
# this threshold, a transaction trace will be recorded and sent to
# New Relic. Valid values are any float value, or (default) "apdex_f",
# which will use the threshold for an dissatisfying Apdex
# controller action - four times the Apdex T value.
transaction_threshold: apdex_f
# When transaction tracer is on, SQL statements can optionally be
# recorded. The recorder has three modes, "off" which sends no
# SQL, "raw" which sends the SQL statement in its original form,
# and "obfuscated", which strips out numeric and string literals.
record_sql: obfuscated
# Threshold in seconds for when to collect stack trace for a SQL
# call. In other words, when SQL statements exceed this threshold,
# then capture and send to New Relic the current stack trace. This is
# helpful for pinpointing where long SQL calls originate from.
stack_trace_threshold: 0.500
# Determines whether the agent will capture query plans for slow
# SQL queries. Only supported in mysql and postgres. Should be
# set to false when using other adapters.
# explain_enabled: true
# Threshold for query execution time below which query plans will
# not be captured. Relevant only when `explain_enabled` is true.
# explain_threshold: 0.5
# Error collector captures information about uncaught exceptions and
# sends them to New Relic for viewing
error_collector:
# Error collector is enabled by default. Set this to false to turn
# it off. This feature is only available at the Professional and above
# product levels.
enabled: true
# To stop specific errors from reporting to New Relic, set this property
# to comma-separated values. Default is to ignore routing errors,
# which are how 404's get triggered.
ignore_errors: "ActionController::RoutingError,Sinatra::NotFound"
# If you're interested in capturing memcache keys as though they
# were SQL uncomment this flag. Note that this does increase
# overhead slightly on every memcached call, and can have security
# implications if your memcached keys are sensitive
# capture_memcache_keys: true
# Application Environments
# ------------------------------------------
# Environment-specific settings are in this section.
# For Rails applications, RAILS_ENV is used to determine the environment.
# For Java applications, pass -Dnewrelic.environment <environment> to set
# the environment.
# NOTE if your application has other named environments, you should
# provide newrelic configuration settings for these environments here.
development:
<<: *default_settings
# Turn on communication to New Relic service in development mode
monitor_mode: true
app_name: My Application (Development)
# Rails Only - when running in Developer Mode, the New Relic Agent will
# present performance information on the last 100 transactions you have
# executed since starting the mongrel.
# NOTE: There is substantial overhead when running in developer mode.
# Do not use for production or load testing.
developer_mode: true
test:
<<: *default_settings
# It almost never makes sense to turn on the agent when running
# unit, functional or integration tests or the like.
monitor_mode: false
# Turn on the agent in production for 24x7 monitoring. NewRelic
# testing shows an average performance impact of < 5 ms per
# transaction, you can leave this on all the time without
# incurring any user-visible performance degradation.
production:
<<: *default_settings
monitor_mode: true
# Many applications have a staging environment which behaves
# identically to production. Support for that environment is provided
# here. By default, the staging environment has the agent turned on.
staging:
<<: *default_settings
monitor_mode: true
app_name: My Application (Staging)

View File

@ -26,8 +26,8 @@
# Example: :via => :get ====> :via => :get # Example: :via => :get ====> :via => :get
RedmineApp::Application.routes.draw do RedmineApp::Application.routes.draw do
get "enterprises/index" get "enterprises/index"
#match '/contests/:id/contestnotifications', :controller => 'contestnotifications', :action => 'index' #match '/contests/:id/contestnotifications', :controller => 'contestnotifications', :action => 'index'
mount Mobile::API => '/api' mount Mobile::API => '/api'
@ -844,6 +844,14 @@ RedmineApp::Application.routes.draw do
match 'words/add_brief_introdution' match 'words/add_brief_introdution'
##added by lizanle 日志查看路由
match 'system_log/index'
match 'system_log/access_analysis'
match 'system_log/time_analysis'
match "/system_log" ,:to => 'system_log#index'
match 'system_log/clear'
##ended by lizanle
Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
file = File.join(plugin_dir, "config/routes.rb") file = File.join(plugin_dir, "config/routes.rb")

View File

@ -49,8 +49,11 @@ module Redmine
end end
module ClassMethods module ClassMethods
# Time 2015-01-27 16:30:47
# Author lizanle
# Description 用原来的写法from,to更加容易懂
# Returns events of type event_type visible by user that occured between from and to # Returns events of type event_type visible by user that occured between from and to
def find_events(event_type, user, days, created_time, options) def find_events(event_type, user, from, to, options)
provider_options = activity_provider_options[event_type] provider_options = activity_provider_options[event_type]
raise "#{self.name} can not provide #{event_type} events." if provider_options.nil? raise "#{self.name} can not provide #{event_type} events." if provider_options.nil?
@ -91,23 +94,17 @@ module Redmine
ActiveSupport::Deprecation.warn "acts_as_activity_provider with implicit :permission option is deprecated. Add a visible scope to the #{self.name} model or use explicit :permission option." ActiveSupport::Deprecation.warn "acts_as_activity_provider with implicit :permission option is deprecated. Add a visible scope to the #{self.name} model or use explicit :permission option."
scope = scope.scoped(:conditions => Project.allowed_to_condition(user, "view_#{self.name.underscore.pluralize}".to_sym, options)) scope = scope.scoped(:conditions => Project.allowed_to_condition(user, "view_#{self.name.underscore.pluralize}".to_sym, options))
end end
unless scope.all(provider_options[:find_options].dup).first.nil? # Time 2015-01-27 15:18:33
if provider_options[:timestamp].include? "updated_on" # Author lizanle
to = scope.scoped(:order => "#{provider_options[:timestamp]} desc").all(provider_options[:find_options].dup).first.updated_on # Description 删除 unless scope.all因为这个执行查询并且没有加入时间限制与下边 scope.all(provider_options[:find_options].dup)重复
else if options[:course]
to = scope.scoped(:order => "#{provider_options[:timestamp]} desc").all(provider_options[:find_options].dup).first.created_on scope.all(provider_options[:find_options].dup)
end else
if options[:course] if from && to
from = (to - days.days) > created_time ? (to - days.days) : created_time.to_date scope = scope.scoped(:conditions => ["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to])
else scope.all(provider_options[:find_options].dup)
from = to - days.days - 1.years
end end
end end
if from && to
scope = scope.scoped(:conditions => ["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to])
end
scope.all(provider_options[:find_options].dup)
end end
# 为了首页获取数据基本复制了上面的方法,改变了用户查看权限,增加了对讨论区的识别。 # 为了首页获取数据基本复制了上面的方法,改变了用户查看权限,增加了对讨论区的识别。

View File

@ -43,6 +43,7 @@ module Redmine
base.extend ClassMethods base.extend ClassMethods
end end
%w(datetime title description author type).each do |attr| %w(datetime title description author type).each do |attr|
src = <<-END_SRC src = <<-END_SRC
def event_#{attr} def event_#{attr}

View File

@ -77,9 +77,12 @@ module Redmine
@scope = Redmine::Activity.default_event_types @scope = Redmine::Activity.default_event_types
end end
# Time 2015-01-27 16:31:58
# Author lizanle
# Description 用from to 更加浅显易懂
# Returns an array of events for the given date range # Returns an array of events for the given date range
# sorted in reverse chronological order # sorted in reverse chronological order
def events(days = nil, created_time = nil, options={}) def events(from = nil, to = nil, options={})
e = [] e = []
@options[:limit] = options[:limit] @options[:limit] = options[:limit]
# modify by nwb # modify by nwb
@ -87,7 +90,7 @@ module Redmine
@scope.each do |event_type| @scope.each do |event_type|
constantized_providers(event_type).each do |provider| constantized_providers(event_type).each do |provider|
e += provider.find_events(event_type, @user, days, created_time, @options) e += provider.find_events(event_type, @user, from, to, @options)
end end
end end

View File

@ -685,3 +685,165 @@ function PrecentChange(obj){
$("select[id='issue_status_id']").find("option[value='2']").attr("selected","selected"); $("select[id='issue_status_id']").find("option[value='2']").attr("selected","selected");
} }
} }
//added by lizanle 日期選擇js
function HS_DateAdd(interval,number,date){
number = parseInt(number);
if (typeof(date)=="string"){var date = new Date(date.split("-")[0],date.split("-")[1],date.split("-")[2])}
if (typeof(date)=="object"){var date = date}
switch(interval){
case "y":return new Date(date.getFullYear()+number,date.getMonth(),date.getDate()); break;
case "m":return new Date(date.getFullYear(),date.getMonth()+number,checkDate(date.getFullYear(),date.getMonth()+number,date.getDate())); break;
case "d":return new Date(date.getFullYear(),date.getMonth(),date.getDate()+number); break;
case "w":return new Date(date.getFullYear(),date.getMonth(),7*number+date.getDate()); break;
}
}
function checkDate(year,month,date){
var enddate = ["31","28","31","30","31","30","31","31","30","31","30","31"];
var returnDate = "";
if (year%4==0){enddate[1]="29"}
if (date>enddate[month]){returnDate = enddate[month]}else{returnDate = date}
return returnDate;
}
function WeekDay(date){
var theDate;
if (typeof(date)=="string"){theDate = new Date(date.split("-")[0],date.split("-")[1],date.split("-")[2]);}
if (typeof(date)=="object"){theDate = date}
return theDate.getDay();
}
function HS_calender(){
var lis = "";
var style = "";
/*可以把下面的css剪切出去独立一个css文件*/
style +="<style type='text/css'>";
style +=".calender { width:170px; height:auto; font-size:12px; margin-right:14px; background:url(calenderbg.gif) no-repeat right center #fff; border:1px solid #397EAE; padding:1px}";
style +=".calender ul {list-style-type:none; margin:0; padding:0;}";
style +=".calender .day { background-color:#EDF5FF; height:20px;}";
style +=".calender li { list-style-type: none; float: left; margin: 0 0px; padding: 0 !important; background: #ffffff; background-image: none !important;}";
style +=".calender .day li,.calender .date li{ float:left; width:14%; height:20px; line-height:20px; text-align:center}";
style +=".calender li a { text-decoration:none; font-family:Tahoma; font-size:11px; color:#333}";
style +=".calender li a:hover { color:#f30; text-decoration:underline}";
style +=".calender li a.hasArticle {font-weight:bold; color:#f60 !important}";
style +=".lastMonthDate, .nextMonthDate {color:#bbb;font-size:11px}";
style +=".selectThisYear a, .selectThisMonth a{text-decoration:none; margin:0 2px; color:#000; font-weight:bold}";
style +=".calender .LastMonth, .calender .NextMonth{ text-decoration:none; color:#000; font-size:18px; font-weight:bold; line-height:16px;}";
style +=".calender .LastMonth { float:left;}";
style +=".calender .NextMonth { float:right;}";
style +=".calenderBody {clear:both}";
style +=".calenderTitle {text-align:center;height:20px; line-height:20px; clear:both}";
style +=".today { background-color:#ffffaa;border:1px solid #f60; padding:2px}";
style +=".today a { color:#f30; }";
style +=".calenderBottom {clear:both; border-top:1px solid #ddd; padding: 3px 0; text-align:left}";
style +=".calenderBottom a {text-decoration:none; margin:2px !important; font-weight:bold; color:#000}";
style +=".calenderBottom a.closeCalender{float:right}";
style +=".closeCalenderBox {float:right; border:1px solid #000; background:#fff; font-size:9px; width:11px; height:11px; line-height:11px; text-align:center;overflow:hidden; font-weight:normal !important}";
style +="</style>";
var now;
if (typeof(arguments[0])=="string"){
selectDate = arguments[0].split("-");
var year = selectDate[0];
var month = parseInt(selectDate[1])-1+"";
var date = selectDate[2];
now = new Date(year,month,date);
}else if (typeof(arguments[0])=="object"){
now = arguments[0];
}
var lastMonthEndDate = HS_DateAdd("d","-1",now.getFullYear()+"-"+now.getMonth()+"-01").getDate();
var lastMonthDate = WeekDay(now.getFullYear()+"-"+now.getMonth()+"-01");
var thisMonthLastDate = HS_DateAdd("d","-1",now.getFullYear()+"-"+(parseInt(now.getMonth())+1).toString()+"-01");
var thisMonthEndDate = thisMonthLastDate.getDate();
var thisMonthEndDay = thisMonthLastDate.getDay();
var todayObj = new Date();
today = todayObj.getFullYear()+"-"+todayObj.getMonth()+"-"+todayObj.getDate();
for (i=0; i<lastMonthDate; i++){ // Last Month's Date
lis = "<li class='lastMonthDate'>"+lastMonthEndDate+"</li>" + lis;
lastMonthEndDate--;
}
for (i=1; i<=thisMonthEndDate; i++){ // Current Month's Date
if(today == now.getFullYear()+"-"+now.getMonth()+"-"+i){
var todayString = now.getFullYear()+"-"+(parseInt(now.getMonth())+1).toString()+"-"+i;
lis += "<li><a href=javascript:void(0) class='today' onclick='_selectThisDay(this)' title='"+now.getFullYear()+"-"+(parseInt(now.getMonth())+1)+"-"+i+"'>"+i+"</a></li>";
}else{
lis += "<li><a href=javascript:void(0) onclick='_selectThisDay(this)' title='"+now.getFullYear()+"-"+(parseInt(now.getMonth())+1)+"-"+i+"'>"+i+"</a></li>";
}
}
var j=1;
for (i=thisMonthEndDay; i<6; i++){ // Next Month's Date
lis += "<li class='nextMonthDate'>"+j+"</li>";
j++;
}
lis += style;
var CalenderTitle = "<a href='javascript:void(0)' class='NextMonth' onclick=HS_calender(HS_DateAdd('m',1,'"+now.getFullYear()+"-"+now.getMonth()+"-"+now.getDate()+"'),this) title='Next Month'>&raquo;</a>";
CalenderTitle += "<a href='javascript:void(0)' class='LastMonth' onclick=HS_calender(HS_DateAdd('m',-1,'"+now.getFullYear()+"-"+now.getMonth()+"-"+now.getDate()+"'),this) title='Previous Month'>&laquo;</a>";
CalenderTitle += "<span class='selectThisYear'><a href='javascript:void(0)' onclick='CalenderselectYear(this)' title='Click here to select other year' >"+now.getFullYear()+"</a></span>年<span class='selectThisMonth'><a href='javascript:void(0)' onclick='CalenderselectMonth(this)' title='Click here to select other month'>"+(parseInt(now.getMonth())+1).toString()+"</a></span>月";
if (arguments.length>1){
arguments[1].parentNode.parentNode.getElementsByTagName("ul")[1].innerHTML = lis;
arguments[1].parentNode.innerHTML = CalenderTitle;
}else{
var CalenderBox = style+"<div class='calender'><div class='calenderTitle'>"+CalenderTitle+"</div><div class='calenderBody'><ul class='day'><li>日</li><li>一</li><li>二</li><li>三</li><li>四</li><li>五</li><li>六</li></ul><ul class='date' id='thisMonthDate'>"+lis+"</ul></div><div class='calenderBottom'><a href='javascript:void(0)' class='closeCalender' onclick='closeCalender(this)'>&times;</a><span><span><a href=javascript:void(0) onclick='_selectThisDay(this)' title='"+todayString+"'>Today</a></span></span></div></div>";
return CalenderBox;
}
}
function _selectThisDay(d){
var boxObj = d.parentNode.parentNode.parentNode.parentNode.parentNode;
boxObj.targetObj.value = d.title;
boxObj.parentNode.removeChild(boxObj);
}
function closeCalender(d){
var boxObj = d.parentNode.parentNode.parentNode;
boxObj.parentNode.removeChild(boxObj);
}
function CalenderselectYear(obj){
var opt = "";
var thisYear = obj.innerHTML;
for (i=1970; i<=2020; i++){
if (i==thisYear){
opt += "<option value="+i+" selected>"+i+"</option>";
}else{
opt += "<option value="+i+">"+i+"</option>";
}
}
opt = "<select onblur='selectThisYear(this)' onchange='selectThisYear(this)' style='font-size:11px'>"+opt+"</select>";
obj.parentNode.innerHTML = opt;
}
function selectThisYear(obj){
HS_calender(obj.value+"-"+obj.parentNode.parentNode.getElementsByTagName("span")[1].getElementsByTagName("a")[0].innerHTML+"-1",obj.parentNode);
}
function CalenderselectMonth(obj){
var opt = "";
var thisMonth = obj.innerHTML;
for (i=1; i<=12; i++){
if (i==thisMonth){
opt += "<option value="+i+" selected>"+i+"</option>";
}else{
opt += "<option value="+i+">"+i+"</option>";
}
}
opt = "<select onblur='selectThisMonth(this)' onchange='selectThisMonth(this)' style='font-size:11px'>"+opt+"</select>";
obj.parentNode.innerHTML = opt;
}
function selectThisMonth(obj){
HS_calender(obj.parentNode.parentNode.getElementsByTagName("span")[0].getElementsByTagName("a")[0].innerHTML+"-"+obj.value+"-1",obj.parentNode);
}
function HS_setDate(inputObj){
var calenderObj = document.createElement("span");
calenderObj.innerHTML = HS_calender(new Date());
calenderObj.style.position = "absolute";
calenderObj.targetObj = inputObj;
inputObj.parentNode.insertBefore(calenderObj,inputObj.nextSibling);
}
//lizanle 刷新函数
function redo() {
window.location.reload()
}

View File

@ -2920,4 +2920,34 @@ input[class~='m3p10'], .m3p10 {
display: inline-block; display: inline-block;
color: #ffffff; color: #ffffff;
cursor:pointer; cursor:pointer;
}
/*lizanle 日誌搜索結果樣式*/
.search_results {
color: red;
}
/*lizanle 分页样式*/
.pagination ul li a, .pagination ul li span{
background-color: #FFFFFF;
border-color: #DDDDDD;
border-image: none;
border-style: solid;
border-width: 1px 1px 1px 1px;
float: left;
line-height: 20px;
padding: 4px 12px;
text-decoration: none;
}
.pagination ul a {
color: #9B9B9B;
}
.pagination ul li a:hover, .pagination ul li a:focus, .pagination ul .active a, .pagination ul .active span{
background-color: #ffc02f;
border: 1px solid #ffc02f;
}
.pagination ul li{
float: left;
margin-right: 3px;
list-style: none outside none;
} }

View File

@ -1,5 +1,5 @@
/* CSS Document */ /* CSS Document */
body{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;} #content{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; 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,textarea{ margin:0; padding:0;} div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea{ margin:0; padding:0;}
div,img,tr,td,textarea{ border:0;} div,img,tr,td,textarea{ border:0;}
table,tr,td{border:0; cellspacing:0; cellpadding:0;} table,tr,td{border:0; cellspacing:0; cellpadding:0;}

View File

@ -0,0 +1,7 @@
require 'test_helper'
class SystemLogControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,4 @@
require 'test_helper'
class ExpireHelperTest < ActionView::TestCase
end

View File

@ -0,0 +1,4 @@
require 'test_helper'
class SystemLogHelperTest < ActionView::TestCase
end

View File

@ -1 +0,0 @@
Put your Redmine plugins here.