This commit is contained in:
z9hang 2015-01-30 16:58:18 +08:00
commit d8571ac931
81 changed files with 2177 additions and 920 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"/>

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 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 Enterprises controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

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

@ -6,13 +6,18 @@ class AppliedProjectController < ApplicationController
@project = Project.find_by_id(params[:project_id]) @project = Project.find_by_id(params[:project_id])
if params[:project_join] if params[:project_join]
if @project if @project
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id]) user = User.find @user_id
if @applieds.count == 0 if user.member_of?(@project)
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id]) @status = 3
Mailer.applied_project(appliedproject).deliver
@status = 2
else else
@status = 1 @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
if @applieds.count == 0
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
Mailer.applied_project(appliedproject).deliver
@status = 2
else
@status = 1
end
end end
else else
@status = 0 @status = 0

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

@ -0,0 +1,6 @@
class EnterprisesController < ApplicationController
layout 'project_base'
def index
@enterprises = Project.find_by_sql("select enterprise_name from projects")
end
end

View File

@ -14,41 +14,35 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Time 2015-01-28 16:34:21
# Author lizanle
# Description 封装代码,简化代码,格式化代码,
class ProjectsController < ApplicationController class ProjectsController < ApplicationController
layout :select_project_layout layout :select_project_layout
menu_item :overview menu_item :overview
menu_item :roadmap, :only => :roadmap menu_item :roadmap, :only => :roadmap
menu_item :settings, :only => :settings menu_item :settings, :only => :settings
menu_item l(:label_sort_by_time), :only => :index
menu_item l(:label_sort_by_active), :only => :index
menu_item l(:label_sort_by_influence), :only => :index
# menu_item l(:label_homework), :only => :homework
# menu_item l(:label_course_feedback), :only => :feedback
menu_item :homework, :only => [:homework, :new_homework] menu_item :homework, :only => [:homework, :new_homework]
menu_item :feedback, :only => :feedback menu_item :feedback, :only => :feedback
menu_item l(:label_course_file), :only => :index
menu_item l(:label_course_news), :only => :index
# edit before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join,
before_filter :authorize1, :only => [:show] :course, :enterprise_course, :course_enterprise,:view_homework_attaches]
# before_filter :authorize, :only => [:show, :settings, :edit, :sort_project_members, :update, :modules, :close,
:reopen,:view_homework_attaches,:course]
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
#before_filter :find_project_repository, :only => [:show]
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去 # 除非项目内人员,不可查看成员, TODO: 完了写报表里去
before_filter :memberAccess, only: :member before_filter :memberAccess, only: :member
accept_rss_auth :index # accept_rss_auth :index
accept_api_auth :index, :show, :create, :update, :destroy accept_api_auth :index, :show, :create, :update, :destroy
after_filter :only => [:create, :edit, :update, :archive, :unarchive, :destroy] do |controller| after_filter :only => [:create, :edit, :update, :archive, :unarchive, :destroy] do |controller|
@ -82,369 +76,66 @@ class ProjectsController < ApplicationController
### added by william ### added by william
include ActsAsTaggableOn::TagsHelper include ActsAsTaggableOn::TagsHelper
def find_project_repository
unless @project.repositories.nil?
@project.repositories.each do |repository|
repository.fetch_changesets if Setting.autofetch_changesets?
end
end
end
def enterprise_course
session[:enterprise_college] = 2
respond_to do |format|
format.html { redirect_to :back }
#format.api { render_api_ok }
end
end
def course_enterprise
session[:enterprise_college] = 1
respond_to do |format|
format.html { redirect_to :back }
#format.api { render_api_ok }
end
end
def index def index
render_404 render_404
#调用存储过程更新提交次数
#ActiveRecord::Base.connection.execute("CALL sp_project_status_cursor();")
#Modified by nie
@project_type = params[:project_type].to_i
per_page_option = 10
@projects_all = Project.active.visible.
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)
@poll_questions_count = @projects_all.count
@poll_questions_pages = Paginator.new @project_count, per_page_option, params['page']
#gcm activity count
@project_activity_count=Hash.new
@projects_all.each do |project|
@project_activity_count[project.id]=0
end
@project_activity_count=get_project_activity @projects_all,@project_activity_count
#gcm end
case params[:project_sort_type]
when '0'
@projects = @projects_all.order("created_on desc")
@s_type = 0
when '1'
@projects = @projects_all.order("score desc")
@s_type = 1
when '2'
@projects = @projects_all.order("watchers_count desc")
@s_type = 2
#gcm
when '3'
#@projects=desc_sort_course_by_avtivity(@project_activity_count_array,@project_all_array)
@projects=handle_project @projects_all,@project_activity_count
@s_type = 3
@projects = @projects[@project_pages.offset, @project_pages.per_page]
else
@projects = @projects = @projects_all.order("score desc")
@s_type = 1
end
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
respond_to do |format|
format.html {
# render :layout => 'base'
# scope = Project
# unless params[:closed]
# scope = scope.active
# end
}
format.api {
# @offset, @limit = api_offset_and_limit
# @project_count = Project.visible.count
# @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
}
format.atom {
projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
}
end
end end
def course def course
@project_type = params[:project_type] render_404
@school_id = params[:school_id]
per_page_option = 10
if @school_id == "0" or @school_id.nil?
@projects_all = Project.active.visible.
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").
where("#{Project.table_name}.project_type = ? ", Project::ProjectType_course)
else
@projects_all = Project.active.visible.
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").
joins(:course_extra).
where("#{Project.table_name}.project_type = ? AND #{Course.table_name}.school_id = ?", Project::ProjectType_course, @school_id)
end
@project_count = @projects_all.count
@project_pages = Paginator.new @project_count, per_page_option, params['page']
#gcm activity count
@project_activity_count=Hash.new
#count initialize
@projects_all.each do |project|
@project_activity_count[project.id]=0
end
#@project_activity_count=get_project_activity @projects_all,@project_activity_count
#gcm end
case params[:project_sort_type]
when '0'
@projects = @projects_all.order("created_on desc")
@s_type = 0
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
#gcm
@project_activity_count=get_project_activity @projects,@project_activity_count
#gcmend
when '1'
@projects = @projects_all.order("course_ac_para desc")
@s_type = 1
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
#gcm
@project_activity_count=get_project_activity @projects,@project_activity_count
#gcmend
when '2'
@projects = @projects_all.order("watchers_count desc")
@s_type = 2
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
#gcm
@project_activity_count=get_project_activity @projects,@project_activity_count
#gcmend
#gcm
when '3'
#gcm
@project_activity_count=get_project_activity @projects_all,@project_activity_count
#gcmend
@projects=handle_project @projects_all,@project_activity_count
@s_type = 3
@projects = @projects[@project_pages.offset, @project_pages.per_page]
else
@s_type = 0
@projects = @projects_all.order("created_on desc")
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
#gcm
@project_activity_count=get_project_activity @projects,@project_activity_count
#gcmend
end
respond_to do |format|
format.html {
render :layout => 'base'
}
format.api {
# @offset, @limit = api_offset_and_limit
# @project_count = Project.visible.count
# @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
}
format.atom {
projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
}
end
end end
#gcm # Time 2015-01-29 11:19:11
# Author lizanle
# Description 项目搜索方法
def search def search
#modified by nie # 如果有名字,就按名字搜索,如果没有,就展示所有,用Karminari分页
project_type = params[:project_type].to_i
projects_all = (project_type.eql? Project::ProjectType_course) ? Project.course_entities : Project.project_entities
@projects = projects_all.visible
#@projects_all = @projects.visible.like(params[:name]) if params[:name].present?
if params[:name].present? if params[:name].present?
@projects_all = @projects.visible.like(params[:name]) @project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10)
else else
@projects_all = @projects; @project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
end end
@project_count = @projects_all.count @projects = @project_pages.order("created_on desc")
@project_pages = Paginator.new @project_count, per_page_option, params['page']
#gcm activity count
@project_activity_count=Hash.new
# count initialize
@projects_all.each do |project|
@project_activity_count[project.id]=0
end
#@project_activity_count=get_project_activity @projects_all,@project_activity_count
#gcm end
case params[:project_sort_type]
when '0'
@projects = @projects_all.order("created_on desc")
@s_type = 0
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
#gcm
@project_activity_count=get_project_activity @projects,@project_activity_count
#gcmend
when '1'
@projects = @projects_all.order("course_ac_para desc")
@s_type = 1
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
#gcm
@project_activity_count=get_project_activity @projects,@project_activity_count
#gcmend
when '2'
@projects = @projects_all.order("watchers_count desc")
@s_type = 2
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
#gcm
@project_activity_count=get_project_activity @projects,@project_activity_count
#gcmend
when '3'
#@projects=desc_sort_course_by_avtivity(@project_activity_count_array,@project_all_array)
@project_activity_count=get_project_activity @projects_all,@project_activity_count_array #gcm
@projects=handle_project @projects_all,@project_activity_count
@s_type = 3
@projects = @projects[@project_pages.offset, @project_pages.per_page]
else
@s_type = 0
@projects = @projects_all.order("created_on desc")
@projects = @projects.offset(@project_pages.offset).limit(@project_pages.per_page)
#gcm
@project_activity_count=get_project_activity @projects,@project_activity_count
#gcmend
end
respond_to do |format| respond_to do |format|
format.html { format.html {
render :layout => 'base' render :layout => 'base'
scope = Project scope = Project
unless params[:closed] unless params[:closed]
scope = scope.active scope = scope.active
end end
} }
format.api { # 需要到处atom使用的格式 redmine自带
# @offset, @limit = api_offset_and_limit
# @project_count = Project.visible.count
# @projects = Project.visible.offset(@offset).limit(@limit).order('lft').all
}
format.atom { format.atom {
projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all projects = Project.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}") render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
} }
end end
end end
#gcmend
#Added by young
def homework
@offset, @limit = api_offset_and_limit({:limit => 10})
@bids = @project.homeworks.order('deadline')
@bids = @bids.like(params[:name]) if params[:name].present?
@bids = paginateHelper @bids
render :layout => 'base_courses'
end
def new_homework
# Dear maintainer:
# once you are done trying to 'optimize' this Magic routine,
# well, it's on you, I'll leave it to you.
if (User.current.logged? &&
(User.current.admin? ||
(
!Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.nil? &&
(
Member.where('user_id = ? and project_id = ?', User.current.id, @project.id).first.roles &&
( Role.where(id: [3, 4, 7, 9]).size > 0 )
)
)
)
)
@homework = Bid.new
@homework.safe_attributes = params[:bid]
render :layout => 'base_courses'
else
render_404
end
end
#Ended by young
# Time 2015-01-29 16:13:20
# Author lizanle
# Description 项目首页中用户反馈 方法
def feedback def feedback
@page = params[:page] @page = params[:page].to_i
@page = @page.to_i
# Find the page of the requested reply # Find the page of the requested reply
@jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') @jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@limit = 10 limit = 10
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i]) offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
page = 1 + offset / @limit page = 1 + offset / limit
if params[:r] && @page.nil? if params[:r] && @page.nil?
@page = page @page = @page < 0 ? 1 : @page
end end
@page = @page > page ? page : @page
puts @page
if @page < 0
@page = 1
end
if @page > page
@page = page
end
#@feedback_count = @jours.count
#@feedback_pages = Paginator.new @feedback_count, @limit, @page
#@offset ||= @feedback_pages.offset
@jour = paginateHelper @jours,10 @jour = paginateHelper @jours,10
@state = false @state = false
@base_courses_tag = @project.project_type
respond_to do |format| respond_to do |format|
format.html{render :layout => 'base_courses' if @base_courses_tag==1} format.html
format.api format.api
end end
end end
def project_respond def project_respond
# will_reply = JournalsForMessage.find(params[:reference_id]) if params[:reference_id]
project_id = request.headers["Referer"].match((%r|/([0-9]{1,})/|))[1] project_id = request.headers["Referer"].match((%r|/([0-9]{1,})/|))[1]
# @project = Project.find_by_id(project_id)
parent_id = params[:reference_id] parent_id = params[:reference_id]
author_id = User.current.id author_id = User.current.id
reply_user_id = params[:reference_user_id] reply_user_id = params[:reference_user_id]
@ -460,12 +151,8 @@ class ProjectsController < ApplicationController
@jfm = Project.add_new_jour(nil, nil, project_id, options) @jfm = Project.add_new_jour(nil, nil, project_id, options)
@save_succ = @jfm.errors.empty? @save_succ = @jfm.errors.empty?
# flash[:notice]=l(:label_projects_feedback_respond_success)
respond_to do |format| respond_to do |format|
# format.html { redirect_to :back }
format.js format.js
#format.api { render_api_ok }
end end
end end
@ -556,45 +243,18 @@ class ProjectsController < ApplicationController
render_404 render_404
end end
# Show @project # Time 2015-01-29 10:42:00
# Author lizanle
# Description 项目动态展示方法,删除了不必要的代码
def show def show
if(@project && !@project.is_public && !User.current.member_of?(@project)) # 试图跳转到请求的按钮
render_403 if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return return
end end
@project_type = params[:project_type]
# try to redirect to the requested menu item
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return
end
@users_by_role = @project.users_by_role
@subprojects = @project.children.visible.all
@news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").all
@trackers = @project.rolled_up_trackers
if(User.find_by_id(ProjectInfo.find_by_project_id(@project.id).try(:user_id)))
@user = User.find_by_id(ProjectInfo.find_by_project_id(@project.id).user_id)
end
cond = @project.project_condition(Setting.display_subprojects_issues?) cond = @project.project_condition(Setting.display_subprojects_issues?)
@open_issues_by_tracker = Issue.visible.open.where(cond).count(:group => :tracker)
@total_issues_by_tracker = Issue.visible.where(cond).count(:group => :tracker)
if User.current.allowed_to?(:view_time_entries, @project)
@total_hours = TimeEntry.visible.sum(:hours, :include => :project, :conditions => cond).to_f
end
@key = User.current.rss_key
#新增内容
@days = Setting.activity_days_default.to_i
if params[:from]
begin; @date_to = params[:from].to_date + 1; rescue; 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,59 +264,40 @@ class ProjectsController < ApplicationController
"show_wiki_edits"=>true, "show_wiki_edits"=>true,
"show_journals_for_messages" => true "show_journals_for_messages" => true
} }
# 读取项目默认展示的动态时间天数
@days = Setting.activity_days_default.to_i
@date_to ||= Date.today + 1
# 时间跨度不能太大,不然很慢,所以删掉了-1.years
@date_from = @date_to - @days
@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])
# 决定显示所用用户或单个用户活动 # 决定显示所用用户或单个用户活动
@activity = Redmine::Activity::Fetcher.new(User.current, :project => @project, @activity = Redmine::Activity::Fetcher.new(User.current,
:with_subprojects => @with_subprojects, :project => @project,
:author => @author) :with_subprojects => @with_subprojects,
:author => @author)
@activity.scope_select {|t| !has["show_#{t}"].nil?} @activity.scope_select {|t| !has["show_#{t}"].nil?}
# logger.debug "=========================================#{@activity.scope}"
# @activity.scope = (@author.nil? ? :default : :all) if @activity.scope.empty?
# modify by nwb # 根据私密性,取出符合条件的所有数据
# 添加私密性判断 if User.current.member_of?(@project) || User.current.admin?
if User.current.member_of?(@project)|| User.current.admin? events = @activity.events(@date_from, @date_to)
events = @activity.events(@days)
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})
@events_count = events.count @events_count = events.count
@events_pages = Paginator.new @events_count, @limit, params['page'] @events_pages = Paginator.new @events_count, @limit, params['page']
@offset ||= @events_pages.offset @offset ||= @events_pages.offset
# 总的数据中取出某一页
events = events.slice(@offset,@limit) events = events.slice(@offset,@limit)
#Ended by young # 按天分组
@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
@sort_by = %w(category date title author).include?(params[:sort_by]) ? params[:sort_by] : 'category'
documents = @project.documents.includes(:attachments, :category).all
case @sort_by
when 'date'
@grouped = documents.group_by {|d| d.updated_on.to_date }
when 'title'
@grouped = documents.group_by {|d| d.title.first.upcase}
when 'author'
@grouped = documents.select{|d| d.attachments.any?}.group_by {|d| d.attachments.last.author}
else
@grouped = documents.group_by(&:category)
end
@document = @project.documents.build
#
@base_courses_tag = @project.project_type
#判断能否显示真名(当前用户为课程的教师时显示真名)
if @project.project_type == Project::ProjectType_course
@teachers= searchTeacherAndAssistant(@project)
@canShowRealName = isCourseTeacher(User.current.id)
end
# real_name action为虚拟的该方法并不存在用来辅助判断真名权限 # 根据对应的请求,返回对应的数据
# @canShowRealName = User.current.allowed_to?({:controller => "projects", :action => "real_name"}, @project || @projects, :global => false)
respond_to do |format| respond_to do |format|
format.html{render :layout => 'base_courses' if @base_courses_tag==1} format.html
format.api format.api
end end
end end
@ -667,23 +308,13 @@ class ProjectsController < ApplicationController
@member ||= @project.members.new @member ||= @project.members.new
@trackers = Tracker.sorted.all @trackers = Tracker.sorted.all
@wiki ||= @project.wiki @wiki ||= @project.wiki
#Added by young
# @course_tag = params[:course]
# if @course_tag == '1'
#@course = Course.find_by_extra(@project.identifier)
# if @project.project_type == 1
# render :layout => 'base_courses'
# else
# render :layout => 'base_projects'
# end
#Ended by young
end end
def edit def edit
end end
#by young # by young
include CoursesHelper # include CoursesHelper
def member def member
## 有角色参数的才是课程,没有的就是项目 ## 有角色参数的才是课程,没有的就是项目
@render_file = 'member_list' @render_file = 'member_list'
@ -702,11 +333,10 @@ class ProjectsController < ApplicationController
@subPage_title = '' @subPage_title = ''
@members = @project.member_principals.includes(:roles, :principal).all.sort @members = @project.member_principals.includes(:roles, :principal).all.sort
end end
else # @project.project_type == Project::ProjectType_project else
roles = Role.find_all_givable roles = Role.find_all_givable
@subPage_title = l :label_member_list @subPage_title = l :label_member_list
@members = @project.member_principals.includes(:roles, :principal).joins("LEFT JOIN #{OptionNumber.table_name} ON #{OptionNumber.table_name}.user_id = #{Member.table_name}.user_id and #{OptionNumber.table_name}.score_type = 2 AND #{Member.table_name}.project_id = #{OptionNumber.table_name}.project_id").order("#{OptionNumber.table_name}.total_score DESC").all @members = @project.member_principals.includes(:roles, :principal).joins("LEFT JOIN #{OptionNumber.table_name} ON #{OptionNumber.table_name}.user_id = #{Member.table_name}.user_id and #{OptionNumber.table_name}.score_type = 2 AND #{Member.table_name}.project_id = #{OptionNumber.table_name}.project_id").order("#{OptionNumber.table_name}.total_score DESC").all
#@members = sort_project_members(@project, @members)
@applied_members = appied_project_members(@project, @members) @applied_members = appied_project_members(@project, @members)
end end
@members = paginateHelper @members @members = paginateHelper @members
@ -971,91 +601,6 @@ class ProjectsController < ApplicationController
end end
end end
#gcm
def get_project_activity projects,activities
@project_ids=activities.keys()
days = Setting.activity_days_default.to_i
date_to ||= Date.today + 1
date_from = date_to - days-1.years
#issue_count
Issue.where(project_id: @project_ids).where("updated_on>?",date_from).each do |issue|
# activities[issue.project_id.to_s]+=1
activities[issue.project_id]+=issue.journals.where("created_on>?",date_from).count
end
#repository_count
Repository.where(project_id: @project_ids).each do |repository|
# activities[repository.project_id.to_s]+=1
activities[repository.project_id]+=repository.changesets.where("committed_on>?",date_from).count
end
#news_count
News.where(project_id: @project_ids).where("created_on>?",date_from).each do |news|
activities[news.project_id]+=1
end
#document_count
Document.where(project_id: @project_ids).where("created_on>?",date_from).each do |document|
activities[document.project_id]+=1
end
#file_count
Attachment.where(container_id: @project_ids, container_type: Project).where("created_on>?",date_from).each do |attachment|
activities[attachment.container_id]+=1
end
#message_count
Board.where(project_id: @project_ids).each do |board|
# activities[board.project_id]+=1
activities[board.project_id]+=board.messages.where("updated_on>?",date_from).count
end
#time_entry_count
TimeEntry.where(project_id: @project_ids).where("updated_on>?",date_from).each do |timeentry|
activities[timeentry.project_id]+=1
end
#feedbackc_count
JournalsForMessage.where(jour_id: @project_ids, jour_type: Project).each do |jourformess|
activities[jourformess.jour_id]+=1
end
#activities!=0
i=0;
projects.each do |project|
id=project.id
if activities[id]==0
activities[id]=1
end
end
return activities
end
#gcmend
#gcm
def handle_project projects,activities
project_activity_count_array=activities.values()
project_array=[]
i=0;
projects.each do |project|
project_array[i]=project
i=i+1
end
projects=desc_sort_course_by_avtivity(project_activity_count_array,project_array)
return projects
end
#gcmend
#gcm #gcm
def desc_sort_course_by_avtivity(activity_count,projects) def desc_sort_course_by_avtivity(activity_count,projects)
return projects if activity_count.size<2 return projects if activity_count.size<2

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

@ -25,6 +25,17 @@ class WelcomeController < ApplicationController
before_filter :entry_select, :only => [:index] before_filter :entry_select, :only => [:index]
def index def index
unless params[:enterprise].nil?
@enterprise = params[:enterprise]
@enterprise_projects = Project.find_by_sql(["select * from projects where enterprise_name =? ", @enterprise])
@e_count = @enterprise_projects.count
if @e_count < 10
part_count = 10 -@e_count
# @part_projects = find_all_hot_project part_count, order
@part_projects = find_miracle_project(part_count, 3,"score desc")
limit = 10 - @e_count
end
end
if @first_page.nil? || @first_page.sort_type.nil? if @first_page.nil? || @first_page.sort_type.nil?
@projects = find_miracle_project(10, 3,"score desc") @projects = find_miracle_project(10, 3,"score desc")
else else

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'}

View File

@ -0,0 +1,2 @@
module EnterprisesHelper
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

@ -36,67 +36,8 @@ module ProjectsHelper
{:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities} {:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities}
] ]
tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)} tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
end end
# added bu huang
def sort_project_enterprise(state, project_type)
content = ''.html_safe
case state
when 0
content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
when 1
content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0', :project_type => project_type)))
when 2
content << content_tag('li', link_to(l(:label_sort_by_active), projects_path(:project_sort_type => '1', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_influence), projects_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_time), projects_path(:project_sort_type => '0', :project_type => project_type)))
end
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs_enterprise")
end
def sort_course(state, project_type, school_id)
content = ''.html_safe
case state
when 0
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :school_id => school_id, :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
when 1
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id), :class=>"selected"), :class=>"selected")
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
when 2
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
#gcm
when 3
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id), :class=>"selected"), :class=>"selected")
end
#gcmend
content = content_tag('ul', content)
content_tag('div', content, :class => "tabs")
end
# end
def sort_project(state, project_type) def sort_project(state, project_type)
content = ''.html_safe content = ''.html_safe
case state case state
@ -119,29 +60,6 @@ module ProjectsHelper
content_tag('div', content, :class => "tabs") content_tag('div', content, :class => "tabs")
end end
# def sort_course(state, project_type)
# content = ''.html_safe
# case state
# when 0
#
# content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
# content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
# when 1
#
# content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
# content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
# when 2
# content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
# content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
# end
# content = content_tag('ul', content)
# content_tag('div', content, :class => "tabs")
# end
# Added by young # Added by young
def course_settings_tabs def course_settings_tabs
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'}, tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'},
@ -153,9 +71,6 @@ module ProjectsHelper
end end
# Ended by young # Ended by young
def parent_project_select_tag(project) def parent_project_select_tag(project)
selected = project.parent selected = project.parent
# retrieve the requested parent project # retrieve the requested parent project
@ -375,4 +290,85 @@ module ProjectsHelper
end end
end end
end end
# Time 2015-01-29 11:39:02
# Author lizanle
# Description 计算projects
def get_project_activity projects,activities
@project_ids=activities.keys()
days = Setting.activity_days_default.to_i
date_to ||= Date.today + 1
date_from = date_to - days-1.years
#issue_count
Issue.where(project_id: @project_ids).where("updated_on>?",date_from).each do |issue|
# activities[issue.project_id.to_s]+=1
activities[issue.project_id]+=issue.journals.where("created_on>?",date_from).count
end
#repository_count
Repository.where(project_id: @project_ids).each do |repository|
# activities[repository.project_id.to_s]+=1
activities[repository.project_id]+=repository.changesets.where("committed_on>?",date_from).count
end
#news_count
News.where(project_id: @project_ids).where("created_on>?",date_from).each do |news|
activities[news.project_id]+=1
end
#document_count
Document.where(project_id: @project_ids).where("created_on>?",date_from).each do |document|
activities[document.project_id]+=1
end
#file_count
Attachment.where(container_id: @project_ids, container_type: Project).where("created_on>?",date_from).each do |attachment|
activities[attachment.container_id]+=1
end
#message_count
Board.where(project_id: @project_ids).each do |board|
# activities[board.project_id]+=1
activities[board.project_id]+=board.messages.where("updated_on>?",date_from).count
end
#time_entry_count
TimeEntry.where(project_id: @project_ids).where("updated_on>?",date_from).each do |timeentry|
activities[timeentry.project_id]+=1
end
#feedbackc_count
JournalsForMessage.where(jour_id: @project_ids, jour_type: Project).each do |jourformess|
activities[jourformess.jour_id]+=1
end
#activities!=0
i=0;
projects.each do |project|
id=project.id
if activities[id]==0
activities[id]=1
end
end
return activities
end
def handle_project projects,activities
project_activity_count_array=activities.values()
project_array=[]
i=0;
projects.each do |project|
project_array[i]=project
i=i+1
end
projects=desc_sort_course_by_avtivity(project_activity_count_array,project_array)
return projects
end
end end

View File

@ -0,0 +1,186 @@
# 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 && !(log =~ Regexp.new("SystemLogController#",'i')) }
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) }
# 过滤掉日志中日志分析请求
logs.collect! do |log|
log = "" if log =~ Regexp.new("SystemLogController",'i')
log
end
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
@ -34,6 +35,10 @@ class Bid < ActiveRecord::Base
# 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
NAME_LENGTH_LIMIT = 60 NAME_LENGTH_LIMIT = 60
@ -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

@ -6,7 +6,7 @@ class Course < ActiveRecord::Base
STATUS_CLOSED = 5 STATUS_CLOSED = 5
STATUS_ARCHIVED = 9 STATUS_ARCHIVED = 9
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier #belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表 belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher该方法通过tea_id来调用User表
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表 belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school该方法通过school_id来调用School表

View File

@ -12,8 +12,7 @@ class CourseGroup < ActiveRecord::Base
before_destroy :set_member_nil before_destroy :set_member_nil
attr_accessible :name attr_accessible :name
validates :name, :presence => true, :length => {:maximum => 20} validates :name, :presence => true, :length => {:maximum => 20}, :uniqueness => { :scope => :course_id}
validate :unique_name_and_course
@ -22,10 +21,5 @@ class CourseGroup < ActiveRecord::Base
self.members.update_all("course_group_id = 0") self.members.update_all("course_group_id = 0")
end end
end end
private
def unique_name_and_course
if CourseGroup.where("name=? and course_id=?", name, course_id).first
errors.add(:name, :groupname_repeat)
end
end
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',
@ -46,4 +51,6 @@ class Forum < ActiveRecord::Base
" 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
@ -113,9 +114,10 @@ class Project < ActiveRecord::Base
validates_presence_of :name, :identifier validates_presence_of :name, :identifier
validates_uniqueness_of :identifier validates_uniqueness_of :identifier
validates_uniqueness_of :name validates_uniqueness_of :name
validates_associated :repository, :wiki validates_associated :wiki#, :repository
# validates_length_of :description, :maximum => 255 # validates_length_of :description, :maximum => 255
validates_length_of :name, :maximum => 255 validates_length_of :name, :maximum => 255
validates_length_of :enterprise_name, :maximum => 255
validates_length_of :homepage, :maximum => 255 validates_length_of :homepage, :maximum => 255
validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH
# donwcase letters, digits, dashes but not digits only # donwcase letters, digits, dashes but not digits only
@ -125,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]
@ -760,7 +764,8 @@ class Project < ActiveRecord::Base
'issue_custom_field_ids', 'issue_custom_field_ids',
'project_type', 'project_type',
'dts_test', 'dts_test',
'attachmenttype' 'attachmenttype',
'enterprise_name'

View File

@ -4,6 +4,8 @@
alert("请勿重复申请加入该项目"); alert("请勿重复申请加入该项目");
<% elsif @status == 2%> <% elsif @status == 2%>
alert("申请成功"); alert("申请成功");
<% elsif @status == 3%>
alert("您已加入该项目");
<%else%> <%else%>
alert("申请失败"); alert("申请失败");
<%end%> <%end%>

View File

@ -0,0 +1,25 @@
<div class="enterprise_all">
<p>
<%= link_to l(:label_all_enterprises) %>
<p>
<p>
<% if @enterprises.count == 0 %>
<h3><%= l(:label_enterprise_nil) %></h3>
<% else %>
<% @enterprises.each do |enterprise| %>
<% unless enterprise.enterprise_name.blank? %>
<ul>
<li>
<%= link_to enterprise.enterprise_name, home_path(:enterprise => enterprise.enterprise_name) %>
</li>
</ul>
<% end %>
<% end %>
<% end %>
</p>
</div>
<div style="clear: both"></div>
<div class="school-index">
<ul id="schoollist" style="line-height: 25px"></ul>
</div>
<% html_title(l(:label_enterprise_all)) -%>

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

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

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

@ -12,7 +12,11 @@ hideOnLoad();
$("#member-<%= member.id %>").effect("highlight"); $("#member-<%= member.id %>").effect("highlight");
<% end %> <% end %>
<% else %> <% else %>
<% errors = @members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ') %> <% if @members %>
alert('<%= raw(escape_javascript(l(:notice_failed_to_save_members, :errors => errors))) %>'); <% errors = @members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ')%>
alert('<%= raw(escape_javascript(l(:notice_failed_to_save_members, :errors => errors || ''))) %>');
<% else%>
// alert('');
<% end%>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -22,9 +22,9 @@
<% end %> <% end %>
<%if @is_teacher%> <%if @is_teacher%>
<% if poll.polls_status == 1 || poll.polls_status == 3 %> <% if poll.polls_status == 1%>
<li class="pollsbtn fl ml10 pollsbtn_grey">统计结果</li> <li class="pollsbtn fl ml10 pollsbtn_grey">统计结果</li>
<% elsif poll.polls_status == 2%> <% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
<li> <li>
<%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%> <%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%>
</li> </li>

View File

@ -25,13 +25,13 @@
} }
//添加标题时确定按钮 //添加标题时确定按钮
function add_poll_question(obj) function add_poll_question(doc)
{ {
var title = $.trim($("#poll_questions_title").val()); var title = $.trim($("#poll_questions_title").val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();} if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
} }
//修改标题时确定按钮 //修改标题时确定按钮
function edit_poll_question(obj,id) function edit_poll_question(doc,id)
{ {
var title = $.trim($("#poll_questions_title_" + id).val()); var title = $.trim($("#poll_questions_title_" + id).val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();} if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}

View File

@ -8,7 +8,7 @@
<p style="padding-right: 20px;"> <p style="padding-right: 20px;">
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %> <%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
</p><!--by young--> </p><!--by young-->
<p><%= f.text_field :enterprise_name, :size => 60, :style => "width:490px;" %></p>
<p style="display: none" ><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH, <p style="display: none" ><%= f.text_field :identifier, :required => true, :size => 60, :style => "width:488px;", :disabled => @project.identifier_frozen?, :maxlength => Project::IDENTIFIER_MAX_LENGTH,
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %> value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
<% unless @project.identifier_frozen? %> <% unless @project.identifier_frozen? %>

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 %>
@ -67,7 +106,7 @@
<div class="pagination"> <div class="pagination">
<ul> <ul>
<%= pagination_links_full @project_pages %> <%= paginate @project_pages %>
</ul> </ul>
</div> </div>

View File

@ -14,8 +14,12 @@
<table class="list members"> <table class="list members">
<thead> <thead>
<tr> <tr>
<th><%= l(:label_user) %></th> <th>
<th><%= l(:label_role_plural) %></th> <%= l(:label_user) %>
</th>
<th>
<%= l(:label_role_plural) %>
</th>
<th style="width:15%"></th> <th style="width:15%"></th>
<%= call_hook(:view_projects_settings_members_table_header, :project => @project) %> <%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
</tr> </tr>
@ -24,26 +28,30 @@
<% members.each do |member| %> <% members.each do |member| %>
<% next if member.new_record? %> <% next if member.new_record? %>
<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member"> <tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
<td class="<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %></td> <td class="<%= member.principal.class.name.downcase %>">
<%= link_to_user member.principal %>
</td>
<td class="roles"> <td class="roles">
<span id="member-<%= member.id %>-roles"> <span id="member-<%= member.id %>-roles">
<%= h member.roles.sort.collect(&:to_s).join(', ') %> <%= h member.roles.sort.collect(&:to_s).join(', ') %>
</span> </span>
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member), <%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
:method => :put, :method => :put,
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}} :html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
) do |f| %> ) do |f| %>
<p> <p>
<% roles.each do |role| %> <% roles.each do |role| %>
<label><%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role), <label><%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %> <%= h role %></label><br/> :disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %> <%= h role %></label><br/>
<% end %></p> <% end %>
</p>
<%= hidden_field_tag 'membership[role_ids][]', '' %> <%= hidden_field_tag 'membership[role_ids][]', '' %>
<p><%= submit_tag l(:button_change), :class => "small" %> <p>
<%= submit_tag l(:button_change), :class => "small" %>
<%= link_to_function l(:button_cancel), <%= link_to_function l(:button_cancel),
"$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;" "$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;"
%></p> %>
</p>
<% end %> <% end %>
</td> </td>
<!--modified by huang for: if the user'roles is Manager that he will can't modified himself--> <!--modified by huang for: if the user'roles is Manager that he will can't modified himself-->
@ -77,7 +85,9 @@
</tbody> </tbody>
</table> </table>
<% else %> <% else %>
<p class="nodata"><%= l(:label_no_data) %></p> <p class="nodata">
<%= l(:label_no_data) %>
</p>
<% end %> <% end %>
</div> </div>
@ -87,20 +97,25 @@
<div id="applied_project_block"> <div id="applied_project_block">
<%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> <%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
<fieldset> <fieldset>
<legend><%= l(:label_apply_project) %></legend> <legend>
<%= l(:label_apply_project) %>
</legend>
<div id="principals_for_applied_member"> <div id="principals_for_applied_member">
<%= render_principals_for_applied_members(@project) %> <%= render_principals_for_applied_members(@project) %>
</div> </div>
<br/> <br/>
<!--show the roles which will select--> <!--show the roles which will select-->
<p style="padding-top: 5px"><%= l(:label_role_plural) %>: <p style="padding-top: 5px">
<%= l(:label_role_plural) %>:
<% roles.each do |role| %> <% roles.each do |role| %>
<label>
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%= h role %></label> <%= check_box_tag 'membership[role_ids][]', role.id %>
<% end %></p> <%= h role %>
</label>
<p><%= submit_tag l(:label_approve), :id => 'member-add-submit' %> <% end %>
</p>
<p>
<%= submit_tag l(:label_approve), :id => 'member-add-submit' %>
<%= submit_tag l(:label_refusal), :name => "refusal_button", :id => 'member-refusal-submit' %> <%= submit_tag l(:label_refusal), :name => "refusal_button", :id => 'member-refusal-submit' %>
</p> </p>
</fieldset> </fieldset>
@ -110,9 +125,13 @@
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %> <%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
<fieldset> <fieldset>
<legend><%= l(:label_member_new) %></legend> <legend>
<%= l(:label_member_new) %>
<p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p> </legend>
<p>
<%= label_tag "principal_search", l(:label_principal_search) %>
<%= text_field_tag 'principal_search', nil %>
</p>
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %> <%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
<div id="principals_for_new_member"> <div id="principals_for_new_member">
@ -120,13 +139,18 @@
</div> </div>
<br /> <br />
<!--show the roles which will select--> <!--show the roles which will select-->
<p style="padding-top: 5px"><%= l(:label_role_plural) %>: <p style="padding-top: 5px">
<%= l(:label_role_plural) %>:
<% roles.each do |role| %> <% roles.each do |role| %>
<label>
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%= h role %></label> <%= check_box_tag 'membership[role_ids][]', role.id %>
<% end %></p> <%= h role %>
</label>
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p> <% end %>
</p>
<p>
<%= submit_tag l(:button_add), :id => 'member-add-submit' %>
</p>
</fieldset> </fieldset>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -0,0 +1,49 @@
<% @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%>
<style type="text/css">
body {
color: #333333;
font-family: lucida grande, Lucida Sans Unicode, Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 20px;
}
table {border:2px solid !important;
}
tr {border:2px solid !important;
}
td {border:2px solid !important;
}
</style>
<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,58 @@
<% @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%>
<style type="text/css">
body {
color: #333333;
font-family: lucida grande, Lucida Sans Unicode, Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 20px;
}
table {border:2px solid !important;
}
tr {border:2px solid !important;
}
td {border:2px solid !important;
}
</style>
<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 >
<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,63 @@
<% @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%>
<style type="text/css">
body {
color: #333333;
font-family: lucida grande, Lucida Sans Unicode, Arial, Helvetica, sans-serif;
font-size: 12px;
line-height: 20px;
}
table {border:1px solid !important;
}
td {border:1px solid !important;
}
</style>
<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

@ -0,0 +1,23 @@
<li style="overflow:hidden;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'>
<div style="float: left;">
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
</div>
<!-- 上左下右 -->
<div style="float: left; margin-left: 10px; width: 380px;">
<% unless project.is_public %>
<span class="private_project"> <%= l(:label_private) %> </span>
<% end %>
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
(<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>)
</div>
<div style=" float: left;margin:5px; margin-left: 10px; width: 380px;min-height: 42px;">
<span class='font_lighter' title ='<%= project.short_description%>'> <%=project.description.truncate(90, omission: '...')%> </span>
</div>
<div >
<%= content_tag "span", l(:label_project_score)+ ":" + red_project_scores(project).to_i.to_s,
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;",
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
:class => "tooltip",
:id => "tooltip-#{project.id}" %>
</div>
</li>

View File

@ -1,5 +1,5 @@
<h1></h1> <h1></h1>
<p id="errorExplanation"> <p id="errorExplanation">
<%= course_title%> <%= course_title %>
</p> </p>
<h1></h1> <h1></h1>

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

@ -2,24 +2,23 @@
<%= stylesheet_link_tag 'welcome' %> <%= stylesheet_link_tag 'welcome' %>
<%= javascript_include_tag 'welcome' %> <%= javascript_include_tag 'welcome' %>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
$(function() {
$("#main").find("a").attr("target", "_blank");
setCss();
});
//设置div居中
function setCss() {
var mainBar = $('#main-content-bar')[0];
var topHeight = mainBar.offsetHeight;
var welcomeLeft = $('#welcome_left')[0];
var leftHeight = welcomeLeft.offsetHeight;
var searchbar = $('#search-bar')[0];
var searchHeight = searchbar.offsetHeight;
welcomeLeft.style.marginTop = (topHeight - leftHeight) / 2 + "px";
searchbar.style.marginTop = (topHeight - searchHeight) / 2 + "px";
//alert((topHeight - leftHeight)/2 );
}
$(function(){
$("#main").find("a").attr("target", "_blank");
setCss();
});
//设置div居中
function setCss()
{
var mainBar = $('#main-content-bar')[0];
var topHeight = mainBar.offsetHeight;
var welcomeLeft = $('#welcome_left')[0];
var leftHeight = welcomeLeft.offsetHeight;
var searchbar = $('#search-bar')[0];
var searchHeight = searchbar.offsetHeight;
welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px";
searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px";
//alert((topHeight - leftHeight)/2 );
}
// 给主页用户弹新页面 // 给主页用户弹新页面
$(document).ready(function($) { $(document).ready(function($) {
$("#loggedas").find("a").attr("target", "_blank"); $("#loggedas").find("a").attr("target", "_blank");
@ -28,81 +27,81 @@
</script> </script>
<div class='top_bar'> <div class='top_bar'>
<%#= render partial: 'wei_xin' %> <%#= render partial: 'wei_xin' %>
<div class="main-content-bar" id="main-content-bar"> <div class="main-content-bar" id="main-content-bar">
<div style="float: left;padding-left:15px "> <div style="float: left;padding-left:15px ">
<!-- <#%= image_tag(get_project_avatar(@first_page), size: "75x75") %> --> <!-- <#%= image_tag(get_project_avatar(@first_page), size: "75x75") %> -->
<% if get_avatar?(@first_page) %> <% if @enterprise.nil? %>
<%= image_tag(url_to_avatar(@first_page), width:@first_page.image_width,height: @first_page.image_height) %> <% if get_avatar?(@first_page) %>
<% else %> <%= image_tag(url_to_avatar(@first_page), width:@first_page.image_width,height: @first_page.image_height) %>
<%= image_tag '/images/transparent.png', width:@first_page.image_width,height: @first_page.image_height %> <% else %>
<% end %> <%= image_tag '/images/transparent.png', width:@first_page.image_width,height: @first_page.image_height %>
<% end %>
<% else %>
<%= image_tag '/images/avatars/Project/0', width:@first_page.image_width,height: @first_page.image_height %>
<% end %>
</div> </div>
<div class="welcome_left" id="welcome_left"> <div class="welcome_left" id="welcome_left">
<% unless @first_page.nil? %> <% if @enterprise.nil? %>
<%= @first_page.description.html_safe %> <% unless @first_page.nil? %>
<% end %> <%= @first_page.description.html_safe %>
</div> <% end %>
<div class="search-bar" id="search-bar"> <% else %>
<%= render :partial => "search_project", :locals => {:project_type => 0}%>
</div> <span class="font_welcome_school" style="color: #E8770D"> <%= link_to @enterprise, options={:action => 'index', :enterprise => @enterprise}, html_options={ :method => 'get', :style => "color: #E8770D"} %> </span>
<div style="clear: both;"></div> <br/>
<span class="font_welcome_trustie"> <%= @first_page.title %> </span>
<% end %>
</div>
<div class="search-bar" id="search-bar">
<%= render :partial => "search_project", :locals => {:project_type => 0}%>
</div>
<div style="clear: both;"></div>
</div> </div>
</div> </div>
<div style="clear:both"></div> <div style="clear:both"></div>
<div id="J_Slide" class="d-p-index-box d-p-index-hot"> <div id="J_Slide" class="d-p-index-box d-p-index-hot">
<h3 style="margin-left: 5px; color: #e8770d;"> <h3 style="margin-left: 5px; color: #e8770d;"><strong> <%= l(:lable_hot_projects)%> </strong></h3>
<strong> <span style="margin-top: -20px;float: right; display: block;"> <% if User.current.logged? %>
<%= l(:lable_hot_projects)%> <%= link_to(l(:label_project_new), {:controller => 'projects',
</strong> :action => 'new',
</h3> :course => 0,
<span style="margin-top: -20px;float: right; display: block;"> :project_type =>( @project_type||=0)},
<% if User.current.logged? %> :class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
<%= link_to(l(:label_project_new), {:controller => 'projects', &nbsp;&nbsp;&nbsp;&nbsp;
:action => 'new', <%= link_to l(:label_join_project), join_project_projects_path ,:remote => true, :class => 'icon icon-add' %>
:course => 0, &nbsp;&nbsp;&nbsp;&nbsp;
:project_type =>( @project_type||=0)}, <% end %> </span>
:class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to l(:label_join_project), join_project_projects_path ,:remote => true, :class => 'icon icon-add' %>
&nbsp;&nbsp;&nbsp;&nbsp;
<% end %>
</span>
<div class="d-p-projectlist-box"> <div class="d-p-projectlist-box">
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<% @projects.map do |project| %> <!-- 如果企业版参数正确,这进入企业版页面 -->
<li style="overflow:hidden;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'> <% if @enterprise.nil? %>
<div style="float: left;"> <% @projects.map do |project| %>
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %> <%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
</div> <% end; reset_cycle %>
<!-- 上左下右 --> <!-- 企业版项目 -->
<div style="float: left; margin-left: 10px; width: 380px;"> <% else %>
<% unless project.is_public %> <% if @e_count == 0 %>
<span class="private_project"> <p id="errorExplanation"><%= l(:label_enterprise_tips) %></p>
<%= l(:label_private) %> <% @projects.map do |project| %>
</span> <%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<% end %> <% end; reset_cycle %>
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> <% elsif @e_count < 10 %>
(<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>) <% @enterprise_projects.map do |project| %>
</div> <%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<div style=" float: left;margin:5px; margin-left: 10px; width: 380px;min-height: 42px;"> <% end %>
<span class='font_lighter' title ='<%=project.short_description%>'> <p id="errorExplanation"><%= l(:label_part_enterprise_tips) %></p>
<%=project.description.truncate(90, omission: '...')%> <% @part_projects.map do |project| %>
</span> <%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
</div> <% end %>
<div > <% else %>
<%= content_tag "span", l(:label_project_score)+ ":" + red_project_scores(project).to_i.to_s, <% @part_projects.map do |project| %>
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;", <%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", <% end %>
:class => "tooltip", <% end; reset_cycle %>
:id => "tooltip-#{project.id}" %> <% end; reset_cycle %>
</div>
</li>
<!--<%#end %> -->
<% end; reset_cycle %>
</ul> </ul>
</div> </div>
</div> </div>
@ -115,8 +114,10 @@
</strong> </strong>
</h3> </h3>
<div class="user-message-box-list" style="margin-top: 10px;"> <div class="user-message-box-list" style="margin-top: 10px;">
<% cache("activities") do %>
<%activities = find_all_activities%> <%activities = find_all_activities%>
<% activities.each do |event| %> <% activities.each do |event| %>
<% cache event do %>
<li style="display: block;height:60px; padding-bottom: 4px;"> <li style="display: block;height:60px; padding-bottom: 4px;">
<div class="inner-right" style="float: left; height: 100%; "> <div class="inner-right" style="float: left; height: 100%; ">
<%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %> <%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
@ -130,7 +131,8 @@
<p style="margin-top: 4px;"> <p style="margin-top: 4px;">
<span style="color: rgb(172, 174, 177)"> <span style="color: rgb(172, 174, 177)">
<%= l(:field_updated_on) %> <%= l(:field_updated_on) %>
<%= time_tag_welcome event.event_datetime %>前 <%= format_time event.event_datetime %>
<%= l(:field_time_ago) %>
</span> </span>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style="float: right; color: rgb(172, 174, 177);"> <span style="float: right; color: rgb(172, 174, 177);">
@ -139,30 +141,26 @@
</p> </p>
</div> </div>
</li> </li>
<% end %>
<% end %> <% end %>
<% end %>
</div> </div>
</ul> </ul>
</div> </div>
<div class="right" style="float: right; width: 48%; "> <div class="right" style="float: right; width: 48%; ">
<ul class="welcome-message-list"> <ul class="welcome-message-list">
<!--<%# cache 'forum_links' do %> --> <!--<%# cache 'forum_links' do %> -->
<div class="forum-topic" style="height: 25px; width: 98%; margin-left: 2px;"> <div class="forum-topic" style="height: 25px; width: 98%; margin-left: 2px;">
<h3 style="color: rgb(21, 188, 207);"> <h3 style="color: rgb(21, 188, 207);"><strong> <%= l(:lable_bar_active)%> </strong> <%= link_to l(:label_my_question) , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
<strong> <%= link_to l(:label_my_feedback) , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%> </h3>
<%= l(:lable_bar_active)%> <span style="margin-top: -30px;float: right; display: block;"> <%= link_to l(:label_more), forums_path %> </span>
</strong>
<%= link_to l(:label_my_question) , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
<%= link_to l(:label_my_feedback) , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
</h3>
<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' %>
@ -170,7 +168,9 @@
</div> </div>
<div class='memo_attr'> <div class='memo_attr'>
<span class='memo_timestamp'> <span class='memo_timestamp'>
<%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %> <%#= "#{l(:field_updated_on, value: format_time(topic_last_time topic))}" %>
<%= l(:field_updated_on) %>
<%= format_time topic_last_time topic %>
</span> </span>
<span class="memo_author"> <span class="memo_author">
<%= l(:label_question_sponsor)%> <%= l(:label_question_sponsor)%>
@ -188,8 +188,10 @@
</span> </span>
</div> </div>
</li> </li>
<!--<%#end %> --> <!-- cache --> <%end %>
<% 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

@ -275,6 +275,7 @@ zh:
label_course_closed_tips: "确定要%{desc}课程?" label_course_closed_tips: "确定要%{desc}课程?"
# end # end
field_name: 名称 field_name: 名称
field_enterprise_name: 企业名
#added by huang #added by huang
field_tea_name: 教师 field_tea_name: 教师
field_couurse_time: 学时 field_couurse_time: 学时
@ -568,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: 课程实践平台首页
@ -662,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: 竞赛
@ -996,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: 文件
@ -1063,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 认证
@ -1873,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: 发布作业
@ -1980,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: 没有符合的高校信息
@ -2202,18 +2193,141 @@ 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_enterprise_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: 课程模块正在优化中,使用过程中如有问题请您与我们联系,感谢大家的支持!
@ -2239,16 +2353,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: 在此输入课时
@ -2310,6 +2420,40 @@ 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_log_access_analysis: "访问统计"
label_log_time_analysis: "耗时分析"
label_log_refresh: "刷新"
label_log_key: "关键字:"
label_log_time: "时间:"
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: "..."
# 项目企业模块
label_all_enterprises: 所有企业
label_my_enterprise: 我的企业
label_enterprise_tips: 暂时还没有该企业对应的项目,系统的其它项目您可能会感兴趣!
label_part_enterprise_tips: 系统的其它项目您可能也会感兴趣!
label_enterprise_nil: 改模块为最新上线模块,目前还未有项目关联到企业!
label_enterprises: 名企

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,6 +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"
#match '/contests/:id/contestnotifications', :controller => 'contestnotifications', :action => 'index' #match '/contests/:id/contestnotifications', :controller => 'contestnotifications', :action => 'index'
mount Mobile::API => '/api' mount Mobile::API => '/api'
@ -388,6 +390,7 @@ RedmineApp::Application.routes.draw do
match '/statistics', :to => 'projects#statistics', :as => 'statistics', :via => :get match '/statistics', :to => 'projects#statistics', :as => 'statistics', :via => :get
# match '/investor', :controller => 'projects', :action => 'investor', :as => 'investor', :via => :get # match '/investor', :controller => 'projects', :action => 'investor', :as => 'investor', :via => :get
match '/homework', :to => 'projects#homework', :as => 'homework', :via => :get match '/homework', :to => 'projects#homework', :as => 'homework', :via => :get
match 'enterprise', :to => 'enterprises#index', :as => 'index', :via => :get
# match '/activity', :controller => 'activities', :action => 'index', :as => 'activity', :via => :get # match '/activity', :controller => 'activities', :action => 'index', :as => 'activity', :via => :get
# match '/repository', :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :as => 'repository', :via => :get # match '/repository', :controller => 'repositories', :action => 'show', :repository_id => nil, :path => nil, :rev => nil, :as => 'repository', :via => :get
@ -728,7 +731,7 @@ RedmineApp::Application.routes.draw do
match 'delete_avatar', :to => 'avatar#delete_image',:via => :post match 'delete_avatar', :to => 'avatar#delete_image',:via => :post
# Endof Tao's code # Endof Tao's code
get 'robots.txt', :to => 'welcome#robots' get 'robots.txt', :to => 'welcome#robots'
match 'welcome/course', :to => 'welcome#course' #match 'welcome/course', :to => 'welcome#course'
##############测试留言功能 fq ##############测试留言功能 fq
post 'words/new', :to => 'words#new' post 'words/new', :to => 'words#new'
post 'words/create', :to => 'words#create' post 'words/create', :to => 'words#create'
@ -841,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

@ -0,0 +1,5 @@
class AddEnterpriseNameToProjects < ActiveRecord::Migration
def change
add_column :projects, :enterprise_name, :string
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150123020615) do ActiveRecord::Schema.define(:version => 20150128032421) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -925,6 +925,7 @@ ActiveRecord::Schema.define(:version => 20150123020615) do
t.integer "attachmenttype", :default => 1 t.integer "attachmenttype", :default => 1
t.integer "user_id" t.integer "user_id"
t.integer "dts_test", :default => 0 t.integer "dts_test", :default => 0
t.string "enterprise_name"
end end
add_index "projects", ["lft"], :name => "index_projects_on_lft" add_index "projects", ["lft"], :name => "index_projects_on_lft"

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

@ -9,6 +9,9 @@ h4, .wiki h3 {font-size: 13px;}
h4 {border-bottom: 1px dotted #bbb;} h4 {border-bottom: 1px dotted #bbb;}
/*huang*/ /*huang*/
/*current position*/ /*current position*/
.enterprise_all{
padding-left: 20px;
}
.course_ad{ .course_ad{
position:absolute; position:absolute;
visibility:visible; visibility:visible;
@ -2918,3 +2921,33 @@ input[class~='m3p10'], .m3p10 {
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,6 @@
/* CSS Document */ /* CSS Document */
#content{ 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;}
#popbox{ 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;}
@ -79,7 +80,7 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;}
.ping_con h2{ font-size:14px; color:#444443; margin-bottom:10px; } .ping_con h2{ font-size:14px; color:#444443; margin-bottom:10px; }
.ping_con p{ color:#777777; font-size:12px; border-bottom:1px dashed #CCC; padding-bottom:5px;} .ping_con p{ color:#777777; font-size:12px; border-bottom:1px dashed #CCC; padding-bottom:5px;}
.ping_con p span a{ color:#777777;} .ping_con p span a{ color:#777777;}
.ping_star{ width:160px; color:#333; font-weight:bold; margin-bottom:5px;} .ping_star{ width:165px; color:#333; font-weight:bold; margin-bottom:5px;}
.ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png);background-repeat: no-repeat; margin-right:3px;} .ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png);background-repeat: no-repeat; margin-right:3px;}
.ping_con textarea{ height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;} .ping_con textarea{ height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;}
a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;} a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;}

View File

@ -0,0 +1,12 @@
require 'spec_helper'
describe EnterprisesController do
describe "GET 'index'" do
it "returns http success" do
get 'index'
response.should be_success
end
end
end

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.