Merge branch 'szzh' into develop

This commit is contained in:
sw 2015-01-30 15:27:54 +08:00
commit 80c5ee44f1
43 changed files with 894 additions and 881 deletions

15
Gemfile
View File

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

View File

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

@ -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,26 +14,23 @@
# 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
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches] before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join,
: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 :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]
@ -42,11 +39,10 @@ class ProjectsController < ApplicationController
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|
@ -80,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)
@project_count = @projects_all.count
@project_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]
@ -458,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
@ -554,38 +243,16 @@ 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
@project_type = params[:project_type] # 试图跳转到请求的按钮
# try to redirect to the requested menu item
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return return
end 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,
@ -597,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 @date_to ||= Date.today + 1
@date_from = @date_to - @days#-1.years #modified by lizanle 去掉這個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(@date_from, @date_to)
else else
events = @activity.events(@date_from, @date_to, :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
@ -660,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'
@ -695,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
@ -910,6 +547,14 @@ class ProjectsController < ApplicationController
end end
end end
end end
#加入私有项目
def join_project
respond_to do |format|
format.js
end
end
private private
def memberAccess def memberAccess
@ -956,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

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

@ -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
@ -118,30 +59,7 @@ module ProjectsHelper
content = content_tag('ul', content) content = content_tag('ul', content)
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

@ -19,17 +19,23 @@ module SystemLogHelper
keywords = keywords.strip.split(/\s+/).collect! { |w| Regexp.new(w, 'i') } keywords = keywords.strip.split(/\s+/).collect! { |w| Regexp.new(w, 'i') }
# 一条记录应该匹配每个关键字 log =~ r 是对log记录进行判断是否符合r的正则表达式 # 一条记录应该匹配每个关键字 log =~ r 是对log记录进行判断是否符合r的正则表达式
logs = logs.find_all do |log| logs = logs.find_all do |log|
keywords.all? { |r| log =~ r } keywords.all? { |r| log =~ r && !(log =~ Regexp.new("SystemLogController#",'i')) }
end end
#用Kaminari分页 #用Kaminari分页
logs = Kaminari.paginate_array(logs).page(page).per(per).collect! { |log| parse(log) } logs = Kaminari.paginate_array(logs).page(page).per(per).collect! { |log| parse(log) }
#将分页后的记录的搜索结果添加样式,样式中的\0是给给r占位置的。 #将分页后的记录的搜索结果添加样式,样式中的\0是给给r占位置的。
logs.collect! do |log| logs.collect! do |log|
keywords.each { |r| log.gsub!(r, '<span class="search_results">\0</span>') } keywords.each { |r| log.gsub!(r, '<span class="search_results">\0</span>') }
log log
end end
else else
logs = Kaminari.paginate_array(logs).page(page).per(per).collect! { |log| parse(log) } 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 end
logs logs
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

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

@ -114,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
@ -763,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_school_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

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

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

@ -4,7 +4,20 @@
@nav_dispaly_main_contest_label = 1 %> @nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_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'>
<p> <p>
<form action="/system_log/access_analysis" style="float:right" > <form action="/system_log/access_analysis" style="float:right" >

View File

@ -3,7 +3,20 @@
@nav_dispaly_main_project_label = 1 @nav_dispaly_main_project_label = 1
@nav_dispaly_main_contest_label = 1 %> @nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_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'>
<div id='tool-bar' style="float: left"> <div id='tool-bar' style="float: left">
@ -32,7 +45,7 @@
<%= paginate @logs unless @logs.empty? %><br/> <%= paginate @logs unless @logs.empty? %><br/>
<% unless @logs.empty? %> <% unless @logs.empty? %>
<table border="2" > <table >
<caption font-size="30px"><%=l(:label_log_detail)%></caption> <caption font-size="30px"><%=l(:label_log_detail)%></caption>
<% @logs.each do |log| %> <% @logs.each do |log| %>
<% unless log.blank? %> <% unless log.blank? %>

View File

@ -3,6 +3,18 @@
@nav_dispaly_main_project_label = 1 @nav_dispaly_main_project_label = 1
@nav_dispaly_main_contest_label = 1 %> @nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_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'> <div id='tool'>
<p> <p>
<form action="/system_log/time_analysis" style="float:right" > <form action="/system_log/time_analysis" style="float:right" >

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,110 +2,106 @@
<%= stylesheet_link_tag 'welcome' %> <%= stylesheet_link_tag 'welcome' %>
<%= javascript_include_tag 'welcome' %> <%= javascript_include_tag 'welcome' %>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
$(function() {
$(function(){ $("#main").find("a").attr("target", "_blank");
$("#main").find("a").attr("target", "_blank"); setCss();
setCss(); });
}); //设置div居中
//设置div居中 function setCss() {
function setCss() var mainBar = $('#main-content-bar')[0];
{ var topHeight = mainBar.offsetHeight;
var mainBar = $('#main-content-bar')[0]; var welcomeLeft = $('#welcome_left')[0];
var topHeight = mainBar.offsetHeight; var leftHeight = welcomeLeft.offsetHeight;
var welcomeLeft = $('#welcome_left')[0]; var searchbar = $('#search-bar')[0];
var leftHeight = welcomeLeft.offsetHeight; var searchHeight = searchbar.offsetHeight;
var searchbar = $('#search-bar')[0]; welcomeLeft.style.marginTop = (topHeight - leftHeight) / 2 + "px";
var searchHeight = searchbar.offsetHeight; searchbar.style.marginTop = (topHeight - searchHeight) / 2 + "px";
welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px"; //alert((topHeight - leftHeight)/2 );
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");
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target"); //$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
}); });
</script> </script>
<div class='top_bar'> <div class='top_bar'>
<%#= render partial: 'wei_xin' %> <%#= render partial: 'wei_xin' %>
<div class="main-content-bar" id="main-content-bar"> <div class="main-content-bar" id="main-content-bar">
<div style="float: left;padding-left:15px "> <div style="float: left;padding-left:15px ">
<!-- <#%= image_tag(get_project_avatar(@first_page), size: "75x75") %> --> <!-- <#%= image_tag(get_project_avatar(@first_page), size: "75x75") %> -->
<% if get_avatar?(@first_page) %> <% if @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">
<% cache("projects") do %> <!-- 如果企业版参数正确,这进入企业版页面 -->
<% @projects.map do |project| %> <% if @enterprise.nil? %>
<% cache project do %> <% @projects.map do |project| %>
<li style="overflow:auto;word-break:break-all;height:100%;word-wrap: break-word;" class='<%= cycle("odd", "even") %>'> <%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<div style="float: left;"> <% end; reset_cycle %>
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %> <!-- 企业版项目 -->
</div> <% else %>
<!-- 上左下右 --> <% if @e_count == 0 %>
<div style="float: left; margin-left: 10px; width: 380px;"> <p id="errorExplanation"><%= l(:label_enterprise_tips) %></p>
<% unless project.is_public %> <% @projects.map do |project| %>
<span class="private_project"> <%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<%= l(:label_private) %> <% end; reset_cycle %>
</span> <% elsif @e_count < 10 %>
<% end %> <% @enterprise_projects.map do |project| %>
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%> <%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
(<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>) <% end %>
</div> <p id="errorExplanation"><%= l(:label_part_enterprise_tips) %></p>
<div style=" float: left;margin:5px; margin-left: 10px; width: 380px;min-height: 42px;"> <% @part_projects.map do |project| %>
<span class='font_lighter' title ='<%=project.short_description%>'> <%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<%=project.description.truncate(90, omission: '...')%> <% end %>
</span> <% else %>
</div> <% @part_projects.map do |project| %>
<div > <%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
<%= content_tag "span", l(:label_project_score)+ ":" + red_project_scores(project).to_i.to_s, <% end %>
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300;", <% end; reset_cycle %>
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", <% end; reset_cycle %>
:class => "tooltip",
:id => "tooltip-#{project.id}" %>
</div>
</li>
<% end %>
<% end; reset_cycle %>
<% end %>
</ul> </ul>
</div> </div>
</div> </div>
@ -136,6 +132,7 @@
<span style="color: rgb(172, 174, 177)"> <span style="color: rgb(172, 174, 177)">
<%= l(:field_updated_on) %> <%= l(:field_updated_on) %>
<%= format_time 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);">
@ -151,20 +148,13 @@
</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 %> <% cache("forums") do %>
@ -201,9 +191,10 @@
<%end %> <%end %>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
</ul> </ul>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
<%= render partial: 'link_to_another' %> <%= render partial: 'link_to_another' %>

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,140 @@ zh:
label_final_reply: 最后回复 label_final_reply: 最后回复
label_reply: 回复 label_reply: 回复
label_weixin: 微信扫码 label_weixin: 微信扫码
label_search_intimation: 请输入要搜索的关键字
label_work_quantity: 个作品
# 托管平台主页公共组件
# edit by meng
# 托管平台主页> 顶部菜单
field_homepage: 主页
label_project_deposit: 项目托管
label_course_practice: 课程实践
label_forum_all: 公共贴吧
label_school_all: 中国高校
label_contest_innovate: 创新竞赛
label_software_user: 软件创客
label_requirement_enterprise: 软件众包
label_stores_index: 资源搜索
# 托管平台主页 > 搜索提示信息
label_search_information: 请输入要搜索的关键字
# 托管平台主页 > 下拉列表
label_select_project: 项目
label_select_course: 课程
label_select_user: 用户
label_select_user_nickname: 昵称
label_select_user_showname: 姓名
label_select_user_email: 邮箱
# 托管平台主页 > 下方托管平台链接
label_projects_management_platform: 项目托管平台 label_projects_management_platform: 项目托管平台
label_courses_management_platform: 课程实践平台 label_courses_management_platform: 课程实践平台
label_contests_management_platform: 竞赛托管平台 label_contests_management_platform: 竞赛托管平台
label_organizers: 主办单位
label_organizers_information: 国防科学技术大学并行与分布处理国家重点实验室 # 托管平台主页 > 底部承办单位等信息
label_organizers_information_institute: 计算机科学与技术系 label_hosted_organization: 主办单位
label_copyright: 版权 label_hosted_by: 国防科学技术大学并行与分布处理国家重点实验室
label_sponsor: 计算机科学与技术系
label_co_organizer_NUDT: 国防科学技术大学计算机学院
label_co_organizer_EECS: 北京大学信息科学技术学院软件研究所
label_co_organizer_BHU: 北京航空航天大学计算机学院
label_co_organizer_CAS: 中国科学院软件研究所
label_co_organizer_InforS: 山东中创软件商用中间件股份有限公司
label_rights_reserved: 版权©2007~2014
label_contact_us: 联系我们 label_contact_us: 联系我们
label_record: 湘ICP备09019772 # 英文版不需要显示国内许可证
label_license: 湘ICP备09019772
# 项目托管平台主页
# 项目托管平台主页 >主旨
label_project_trustie: Trustie在线项目托管平台
label_project_trustie_theme: ", 面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
# 项目托管平台主页 >热门项目栏
lable_hot_projects: 热门项目
label_project_new: 新建项目
label_join_project: 加入项目
label_private: 私有
label_project_member_amount: "%{count}人"
label_project_score_tips: 项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度
label_project_score: 项目评分
# 项目托管平台主页 >用户动态栏
lable_user_active: 用户动态
field_user_active_published: 发表了
field_user_active_uploaded: 上传了
field_user_active_updated: 更新了
field_user_active_unknow: 未知内容
field_user_active_news: 新闻
field_user_active_issue: 问题
field_user_active_attachment: 附件
field_user_active_message: 主题
field_user_active_reply: 回复
field_user_active_bid: 作业
field_user_active_memo: 主题
field_user_active_document: 文件
field_user_active_changeset: 版本库
field_user_active_issue_note: 问题说明
field_updated_on: 更新于
field_time_ago:
field_active_reply: "回复("
# 用户动态中event.title和event.description
# 通过act_as_event方法的option配置
# "#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}"
# "缺陷 #1869 (已解决):subject"
# tracker.name和status在数据库中以中文字段形式存储
# 项目托管平台主页 >用户动态栏
lable_bar_active: 贴吧动态
label_my_question: 我要提问
label_my_feedback: 我要反馈
label_more: 更多>>
label_updated_time: " 更新于 %{value} 之前"
# 课程托管平台主页
# 课程托管平台主页 >主旨
label_course_trustie: Trustie在线课程实践平台
label_course_trustie_theme: ", 面向中国高校教师与大学生,提供社交化的课程管理、资源共享、合作实验、协同研究。"
# 课程托管平台主页 >
# 竞赛托管平台主页
# 竞赛托管平台主页 >主旨
label_contest_trustie: Trustie在线竞赛实战平台
label_contest_trustie_theme: ", 面向中国大学生与编程爱好者,提供社交化的竞赛管理、应用管理、代码托管、合作交流。"
# 竞赛托管平台主页 >
label_work_quantity: 个作品
# label_organizers: 主办单位
# label_organizers_information: 国防科学技术大学并行与分布处理国家重点实验室
# label_organizers_information_institute: 计算机科学与技术系
# label_copyright: 版权
# label_contact_us: 联系我们
# label_record: 湘ICP备09019772
label_check_comment: 查看通知评论 label_check_comment: 查看通知评论
label_notification: 通知公告 label_notification: 通知公告
label_course_ad_description: 课程模块正在优化中,使用过程中如有问题请您与我们联系,感谢大家的支持! label_course_ad_description: 课程模块正在优化中,使用过程中如有问题请您与我们联系,感谢大家的支持!
@ -2239,16 +2352,12 @@ zh:
label_unknow_type: 未知类型 label_unknow_type: 未知类型
label_score_less_than_zero: 得分小于0修正为0 label_score_less_than_zero: 得分小于0修正为0
review_assignments: 评审任务 review_assignments: 评审任务
label_private: 私有
label_my_school: 我的学校 label_my_school: 我的学校
label_all_schol: 全部学校 label_all_schol: 全部学校
label_select_province: 请选择省份 label_select_province: 请选择省份
label_search_conditions_not_null: 搜索条件不能为空 label_search_conditions_not_null: 搜索条件不能为空
lable_hot_course: 活跃课程 lable_hot_course: 活跃课程
lable_hot_projects: 热门项目
lable_user_active: 用户动态
lable_bar_active: 贴吧动态
lable_student_list_visable: 学生列表是否公开 lable_student_list_visable: 学生列表是否公开
lable_sure_exit_project: 是否确认退出该项目 lable_sure_exit_project: 是否确认退出该项目
lable_input_class: 在此输入课时 lable_input_class: 在此输入课时
@ -2338,3 +2447,12 @@ zh:
next: "下一页 &raquo;" next: "下一页 &raquo;"
truncate: "..." truncate: "..."
# 项目企业模块
label_all_enterprises: 所有企业
label_my_enterprise: 我的企业
label_enterprise_tips: 暂时还没有该企业对应的项目,系统的其它项目您可能会感兴趣!
label_part_enterprise_tips: 系统的其它项目您可能也会感兴趣!
label_enterprise_nil: 改模块为最新上线模块,目前还未有项目关联到企业!
label_enterprises: 名企

View File

@ -26,7 +26,7 @@
# 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'
@ -390,7 +390,8 @@ 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
# match '/', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get # match '/', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get

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

@ -98,20 +98,13 @@ module Redmine
# Author lizanle # Author lizanle
# Description 删除 unless scope.all因为这个执行查询并且没有加入时间限制与下边 scope.all(provider_options[:find_options].dup)重复 # Description 删除 unless scope.all因为这个执行查询并且没有加入时间限制与下边 scope.all(provider_options[:find_options].dup)重复
if options[:course] if options[:course]
if provider_options[:timestamp].include? "updated_on" scope.all(provider_options[:find_options].dup)
to = scope.scoped(:order => "#{provider_options[:timestamp]} desc").all(provider_options[:find_options].dup).first.updated_on
else
to = scope.scoped(:order => "#{provider_options[:timestamp]} desc").all(provider_options[:find_options].dup).first.created_on
end
from = (to - days.days) > created_time ? (to - days.days) : created_time.to_date
else else
#from = to - Setting.activity_days_default.to_i if from && to
scope = scope.scoped(:conditions => ["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to])
scope.all(provider_options[:find_options].dup)
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

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

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