Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts: config/locales/zh.yml
This commit is contained in:
commit
57237c76d8
15
Gemfile
15
Gemfile
|
@ -3,13 +3,13 @@ source 'http://rubygems.org'
|
|||
|
||||
unless RUBY_PLATFORM =~ /w32/
|
||||
# unix-like only
|
||||
gem 'iconv'
|
||||
gem 'iconv'
|
||||
gem 'rubyzip'
|
||||
gem 'zip-zip'
|
||||
end
|
||||
|
||||
gem 'grape', '~> 0.9.0'
|
||||
gem 'grape-entity'
|
||||
gem 'grape', '~> 0.9.0'
|
||||
gem 'grape-entity'
|
||||
gem 'seems_rateable', path: 'lib/seems_rateable'
|
||||
gem "rails", "3.2.13"
|
||||
gem "jquery-rails", "~> 2.0.2"
|
||||
|
@ -20,13 +20,12 @@ gem "builder", "3.0.0"
|
|||
gem 'acts-as-taggable-on', '2.4.1'
|
||||
gem 'spreadsheet'
|
||||
gem 'ruby-ole'
|
||||
gem 'email_verifier'
|
||||
gem 'newrelic_rpm'
|
||||
#gem 'email_verifier', path: 'lib/email_verifier'
|
||||
|
||||
group :development do
|
||||
gem 'grape-swagger'
|
||||
gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
|
||||
#gem 'puma'
|
||||
gem 'grape-swagger'
|
||||
gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
|
||||
#gem 'puma'
|
||||
gem 'better_errors', path: 'lib/better_errors'
|
||||
gem 'rack-mini-profiler', path: 'lib/rack-mini-profiler'
|
||||
end
|
||||
|
|
|
@ -91,6 +91,10 @@ GEM
|
|||
descendants_tracker (0.0.4)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
diff-lcs (1.2.5)
|
||||
dnsruby (1.57.0)
|
||||
email_verifier (0.0.7)
|
||||
dnsruby (>= 1.5)
|
||||
rails (>= 3.0.0)
|
||||
equalizer (0.0.9)
|
||||
erubis (2.7.0)
|
||||
execjs (2.2.1)
|
||||
|
@ -166,6 +170,7 @@ GEM
|
|||
mysql2 (0.3.11-x86-mingw32)
|
||||
nenv (0.2.0)
|
||||
net-ldap (0.3.1)
|
||||
newrelic_rpm (3.9.9.275)
|
||||
nokogiri (1.6.3)
|
||||
mini_portile (= 0.6.0)
|
||||
nokogiri (1.6.3-x86-mingw32)
|
||||
|
@ -315,6 +320,7 @@ DEPENDENCIES
|
|||
capybara (~> 2.4.1)
|
||||
coderay (~> 1.0.6)
|
||||
coffee-rails (~> 3.2.1)
|
||||
email_verifier
|
||||
factory_girl (~> 4.4.0)
|
||||
faker
|
||||
fastercsv (~> 1.5.0)
|
||||
|
@ -330,6 +336,7 @@ DEPENDENCIES
|
|||
mocha (~> 1.1.0)
|
||||
mysql2 (= 0.3.11)
|
||||
net-ldap (~> 0.3.1)
|
||||
newrelic_rpm
|
||||
nokogiri (~> 1.6.3)
|
||||
paperclip (~> 3.5.4)
|
||||
rack-mini-profiler!
|
||||
|
|
|
@ -35,6 +35,11 @@ module Mobile
|
|||
#作业状态 0:新建,1:已开启匿评,2:已关闭匿评
|
||||
#只有作业启用了匿评功能且当前用户是课程老师且已提交的作品数量大于或等于2才能开启匿评
|
||||
homework_expose :homework_state
|
||||
|
||||
expose :homework_for_anonymous_comments,using: Mobile::Entities::HomeworkAttach do |f, opt|
|
||||
f[:homework_for_anonymous_comments] if f.is_a?(Hash) && f.key?(:homework_for_anonymous_comments)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -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/
|
|
@ -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/
|
|
@ -6,13 +6,18 @@ class AppliedProjectController < ApplicationController
|
|||
@project = Project.find_by_id(params[:project_id])
|
||||
if params[:project_join]
|
||||
if @project
|
||||
@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
|
||||
user = User.find @user_id
|
||||
if user.member_of?(@project)
|
||||
@status = 3
|
||||
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
|
||||
else
|
||||
@status = 0
|
||||
|
|
|
@ -828,6 +828,7 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
|
||||
# try to redirect to the requested menu item
|
||||
if params[:jump] && redirect_to_course_menu_item(@course, params[:jump])
|
||||
return
|
||||
|
@ -866,6 +867,7 @@ class CoursesController < ApplicationController
|
|||
@activity.scope_select {|t| has["show_#{t}"]}
|
||||
# modify by nwb
|
||||
# 添加私密性判断
|
||||
|
||||
if User.current.member_of_course?(@course)|| User.current.admin?
|
||||
events = @activity.events(@days, @course.created_at)
|
||||
else
|
||||
|
@ -890,14 +892,13 @@ class CoursesController < ApplicationController
|
|||
@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'
|
||||
#
|
||||
@teachers= searchTeacherAndAssistant(@course)
|
||||
@canShowRealName = isCourseTeacher(User.current.id,@course)
|
||||
# 这写变量发现没有用而且拖慢速度
|
||||
#@teachers= searchTeacherAndAssistant(@course)
|
||||
#@canShowRealName = isCourseTeacher(User.current.id,@course)
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
format.api
|
||||
|
|
|
@ -101,13 +101,7 @@ class HomeworkAttachController < ApplicationController
|
|||
#获取学生匿评列表
|
||||
def get_student_batch_homework
|
||||
@is_student_batch_homework = true
|
||||
all_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
||||
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score,
|
||||
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id} AND is_teacher_score = 0) AS m_score
|
||||
FROM homework_attaches
|
||||
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
WHERE homework_attaches.bid_id = #{@bid.id} AND homework_evaluations.user_id = #{User.current.id} ORDER BY m_score DESC")
|
||||
all_homework_list = get_student_batch_homework_list @bid,User.current
|
||||
@cur_page = params[:page] || 1
|
||||
@cur_type = 4
|
||||
@homework_list = paginateHelper all_homework_list,10
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
class OriginizationsController < ApplicationController
|
||||
layout 'project_base'
|
||||
def index
|
||||
@enterprises = Project.find_by_sql("select distinct(enterprise_name) from projects")
|
||||
end
|
||||
end
|
|
@ -14,25 +14,22 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
# Time 2015-01-28 16:34:21
|
||||
# Author lizanle
|
||||
# Description 封装代码,简化代码,格式化代码,
|
||||
class ProjectsController < ApplicationController
|
||||
layout :select_project_layout
|
||||
|
||||
menu_item :overview
|
||||
menu_item :roadmap, :only => :roadmap
|
||||
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 :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 :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,
|
||||
# :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share,
|
||||
|
@ -42,11 +39,10 @@ class ProjectsController < ApplicationController
|
|||
before_filter :authorize_global, :only => [:new, :create,:view_homework_attaches]
|
||||
before_filter :require_admin, :only => [ :copy, :archive, :unarchive, :destroy, :calendar]
|
||||
before_filter :file, :statistics, :watcherlist
|
||||
#before_filter :find_project_repository, :only => [:show]
|
||||
# 除非项目内人员,不可查看成员, TODO: 完了写报表里去
|
||||
before_filter :memberAccess, only: :member
|
||||
|
||||
accept_rss_auth :index
|
||||
# accept_rss_auth :index
|
||||
accept_api_auth :index, :show, :create, :update, :destroy
|
||||
|
||||
after_filter :only => [:create, :edit, :update, :archive, :unarchive, :destroy] do |controller|
|
||||
|
@ -80,369 +76,66 @@ class ProjectsController < ApplicationController
|
|||
### added by william
|
||||
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
|
||||
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
|
||||
|
||||
def course
|
||||
@project_type = params[:project_type]
|
||||
@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
|
||||
render_404
|
||||
end
|
||||
|
||||
#gcm
|
||||
# Time 2015-01-29 11:19:11
|
||||
# Author lizanle
|
||||
# Description 项目搜索方法
|
||||
def search
|
||||
#modified by nie
|
||||
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?
|
||||
# 如果有名字,就按名字搜索,如果没有,就展示所有,用Karminari分页
|
||||
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
|
||||
@projects_all = @projects;
|
||||
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
@projects = @project_pages.order("created_on desc")
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base'
|
||||
scope = Project
|
||||
unless params[:closed]
|
||||
scope = scope.active
|
||||
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
|
||||
}
|
||||
# 需要到处atom使用的格式 (redmine自带)
|
||||
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
|
||||
#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
|
||||
@page = params[:page]
|
||||
@page = @page.to_i
|
||||
@page = params[:page].to_i
|
||||
# Find the page of the requested reply
|
||||
@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])
|
||||
page = 1 + offset / @limit
|
||||
page = 1 + offset / limit
|
||||
if params[:r] && @page.nil?
|
||||
@page = page
|
||||
@page = @page < 0 ? 1 : @page
|
||||
end
|
||||
|
||||
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
|
||||
@page = @page > page ? page : @page
|
||||
@jour = paginateHelper @jours,10
|
||||
@state = false
|
||||
@base_courses_tag = @project.project_type
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses' if @base_courses_tag==1}
|
||||
format.html
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
||||
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 = Project.find_by_id(project_id)
|
||||
parent_id = params[:reference_id]
|
||||
author_id = User.current.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)
|
||||
@save_succ = @jfm.errors.empty?
|
||||
|
||||
# flash[:notice]=l(:label_projects_feedback_respond_success)
|
||||
|
||||
respond_to do |format|
|
||||
# format.html { redirect_to :back }
|
||||
format.js
|
||||
#format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -554,38 +243,16 @@ class ProjectsController < ApplicationController
|
|||
render_404
|
||||
end
|
||||
|
||||
# Show @project
|
||||
# Time 2015-01-29 10:42:00
|
||||
# Author lizanle
|
||||
# Description 项目动态展示方法,删除了不必要的代码
|
||||
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])
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
@users_by_role = @project.users_by_role
|
||||
@subprojects = @project.children.visible.all
|
||||
@news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").all
|
||||
@trackers = @project.rolled_up_trackers
|
||||
if(User.find_by_id(ProjectInfo.find_by_project_id(@project.id).try(:user_id)))
|
||||
@user = User.find_by_id(ProjectInfo.find_by_project_id(@project.id).user_id)
|
||||
end
|
||||
cond = @project.project_condition(Setting.display_subprojects_issues?)
|
||||
@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 = {
|
||||
"show_issues" => true ,
|
||||
"show_files" => true,
|
||||
|
@ -597,59 +264,40 @@ class ProjectsController < ApplicationController
|
|||
"show_wiki_edits"=>true,
|
||||
"show_journals_for_messages" => true
|
||||
}
|
||||
# 读取项目默认展示的动态时间天数
|
||||
@days = Setting.activity_days_default.to_i
|
||||
@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')
|
||||
@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,
|
||||
:with_subprojects => @with_subprojects,
|
||||
:author => @author)
|
||||
@activity = Redmine::Activity::Fetcher.new(User.current,
|
||||
:project => @project,
|
||||
:with_subprojects => @with_subprojects,
|
||||
:author => @author)
|
||||
@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)
|
||||
else
|
||||
events = @activity.events(@date_from, @date_to, :is_public => 1)
|
||||
end
|
||||
|
||||
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@events_count = events.count
|
||||
@events_pages = Paginator.new @events_count, @limit, params['page']
|
||||
@offset ||= @events_pages.offset
|
||||
# 总的数据中取出某一页
|
||||
events = events.slice(@offset,@limit)
|
||||
#Ended by young
|
||||
# 按天分组
|
||||
@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|
|
||||
format.html{render :layout => 'base_courses' if @base_courses_tag==1}
|
||||
format.html
|
||||
format.api
|
||||
end
|
||||
end
|
||||
|
@ -660,23 +308,13 @@ class ProjectsController < ApplicationController
|
|||
@member ||= @project.members.new
|
||||
@trackers = Tracker.sorted.all
|
||||
@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
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
#by young
|
||||
include CoursesHelper
|
||||
# by young
|
||||
# include CoursesHelper
|
||||
def member
|
||||
## 有角色参数的才是课程,没有的就是项目
|
||||
@render_file = 'member_list'
|
||||
|
@ -695,11 +333,10 @@ class ProjectsController < ApplicationController
|
|||
@subPage_title = ''
|
||||
@members = @project.member_principals.includes(:roles, :principal).all.sort
|
||||
end
|
||||
else # @project.project_type == Project::ProjectType_project
|
||||
else
|
||||
roles = Role.find_all_givable
|
||||
@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 = sort_project_members(@project, @members)
|
||||
@applied_members = appied_project_members(@project, @members)
|
||||
end
|
||||
@members = paginateHelper @members
|
||||
|
@ -964,91 +601,6 @@ class ProjectsController < ApplicationController
|
|||
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
|
||||
def desc_sort_course_by_avtivity(activity_count,projects)
|
||||
return projects if activity_count.size<2
|
||||
|
|
|
@ -25,6 +25,17 @@ class WelcomeController < ApplicationController
|
|||
before_filter :entry_select, :only => [:index]
|
||||
|
||||
def index
|
||||
unless params[:originization].nil?
|
||||
@originization = params[:originization]
|
||||
@originization_projects = Project.find_by_sql(["select * from projects where enterprise_name =? ", @originization])
|
||||
@e_count = @originization_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?
|
||||
@projects = find_miracle_project(10, 3,"score desc")
|
||||
else
|
||||
|
|
|
@ -119,4 +119,15 @@ module HomeworkAttachHelper
|
|||
#end
|
||||
ary
|
||||
end
|
||||
|
||||
def get_student_batch_homework_list bid,user
|
||||
student_batch_homework_list = HomeworkAttach.eager_load(:attachments,:user,:rate_averages).find_by_sql("SELECT homework_attaches.*,
|
||||
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1 AND stars IS NOT NULL ORDER BY updated_at DESC limit 0,1) AS t_score,
|
||||
(SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score,
|
||||
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{User.current.id} AND is_teacher_score = 0) AS m_score
|
||||
FROM homework_attaches
|
||||
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
|
||||
WHERE homework_attaches.bid_id = #{bid.id} AND homework_evaluations.user_id = #{user.id} ORDER BY m_score DESC")
|
||||
student_batch_homework_list
|
||||
end
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module EnterprisesHelper
|
||||
end
|
|
@ -36,67 +36,8 @@ module ProjectsHelper
|
|||
{:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities}
|
||||
]
|
||||
tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
|
||||
|
||||
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)
|
||||
content = ''.html_safe
|
||||
case state
|
||||
|
@ -118,30 +59,7 @@ module ProjectsHelper
|
|||
content = content_tag('ul', content)
|
||||
content_tag('div', content, :class => "tabs")
|
||||
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
|
||||
def course_settings_tabs
|
||||
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'},
|
||||
|
@ -153,9 +71,6 @@ module ProjectsHelper
|
|||
end
|
||||
# Ended by young
|
||||
|
||||
|
||||
|
||||
|
||||
def parent_project_select_tag(project)
|
||||
selected = project.parent
|
||||
# retrieve the requested parent project
|
||||
|
@ -375,4 +290,85 @@ module ProjectsHelper
|
|||
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
|
||||
|
|
|
@ -19,17 +19,23 @@ module SystemLogHelper
|
|||
keywords = keywords.strip.split(/\s+/).collect! { |w| Regexp.new(w, 'i') }
|
||||
# 一条记录应该匹配每个关键字 log =~ r 是对log记录进行判断是否符合r的正则表达式
|
||||
logs = logs.find_all do |log|
|
||||
keywords.all? { |r| log =~ r }
|
||||
keywords.all? { |r| log =~ r && !(log =~ Regexp.new("SystemLogController#",'i')) }
|
||||
end
|
||||
#用Kaminari分页
|
||||
logs = Kaminari.paginate_array(logs).page(page).per(per).collect! { |log| parse(log) }
|
||||
#将分页后的记录的搜索结果添加样式,样式中的\0是给给r占位置的。
|
||||
logs.collect! do |log|
|
||||
keywords.each { |r| log.gsub!(r, '<span class="search_results">\0</span>') }
|
||||
keywords.each { |r| log.gsub!(r, '<span class="search_results">\0</span>') }
|
||||
log
|
||||
end
|
||||
|
||||
else
|
||||
logs = Kaminari.paginate_array(logs).page(page).per(per).collect! { |log| parse(log) }
|
||||
# 过滤掉日志中日志分析请求
|
||||
logs.collect! do |log|
|
||||
log = "" if log =~ Regexp.new("SystemLogController",'i')
|
||||
log
|
||||
end
|
||||
end
|
||||
logs
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ class Course < ActiveRecord::Base
|
|||
STATUS_CLOSED = 5
|
||||
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 :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表
|
||||
|
|
|
@ -12,8 +12,7 @@ class CourseGroup < ActiveRecord::Base
|
|||
before_destroy :set_member_nil
|
||||
|
||||
attr_accessible :name
|
||||
validates :name, :presence => true, :length => {:maximum => 20}
|
||||
validate :unique_name_and_course
|
||||
validates :name, :presence => true, :length => {:maximum => 20}, :uniqueness => { :scope => :course_id}
|
||||
|
||||
|
||||
|
||||
|
@ -22,10 +21,5 @@ class CourseGroup < ActiveRecord::Base
|
|||
self.members.update_all("course_group_id = 0")
|
||||
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
|
||||
|
|
|
@ -114,9 +114,10 @@ class Project < ActiveRecord::Base
|
|||
validates_presence_of :name, :identifier
|
||||
validates_uniqueness_of :identifier
|
||||
validates_uniqueness_of :name
|
||||
validates_associated :repository, :wiki
|
||||
# validates_length_of :description, :maximum => 255
|
||||
validates_associated :wiki#, :repository
|
||||
# validates_length_of :description, :maximum => 255
|
||||
validates_length_of :name, :maximum => 255
|
||||
validates_length_of :enterprise_name, :maximum => 255
|
||||
validates_length_of :homepage, :maximum => 255
|
||||
validates_length_of :identifier, :in => 1..IDENTIFIER_MAX_LENGTH
|
||||
# donwcase letters, digits, dashes but not digits only
|
||||
|
@ -763,7 +764,8 @@ class Project < ActiveRecord::Base
|
|||
'issue_custom_field_ids',
|
||||
'project_type',
|
||||
'dts_test',
|
||||
'attachmenttype'
|
||||
'attachmenttype',
|
||||
'enterprise_name'
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class CoursesService
|
||||
include ApplicationHelper
|
||||
include CoursesHelper
|
||||
include HomeworkAttachHelper
|
||||
#TODO:尚未整合权限系统
|
||||
#参数school_id为0或不传时返回所有课程,否则返回对应学校的课程
|
||||
#参数per_page_count分页功能,每页显示的课程数
|
||||
|
@ -306,10 +307,8 @@ class CoursesService
|
|||
bids = course.homeworks.order('deadline DESC')
|
||||
bids = bids.like(params[:name]) if params[:name].present?
|
||||
homeworks = []
|
||||
if is_course_teacher(current_user,course)
|
||||
bids.each do |bid|
|
||||
homeworks << show_homework_info(course,bid)
|
||||
end
|
||||
bids.each do |bid|
|
||||
homeworks << show_homework_info(course,bid,current_user,is_course_teacher(current_user,course))
|
||||
end
|
||||
homeworks
|
||||
else
|
||||
|
@ -318,7 +317,7 @@ class CoursesService
|
|||
end
|
||||
|
||||
private
|
||||
def show_homework_info course,bid
|
||||
def show_homework_info course,bid,current_user,is_course_teacher
|
||||
author = bid.author.lastname + bid.author.firstname
|
||||
many_times = course.homeworks.index(bid) + 1
|
||||
name = bid.name
|
||||
|
@ -327,8 +326,27 @@ class CoursesService
|
|||
description = bid.description
|
||||
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
||||
state = bid.comment_status
|
||||
unless is_course_teacher
|
||||
homework_for_anonymous_comments = get_student_batch_homework_list bid,current_user
|
||||
end
|
||||
#end
|
||||
open_anonymous_evaluation = bid.open_anonymous_evaluation
|
||||
{:course_name => course.name,:id => bid.id, :course_teacher => author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count,
|
||||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation,:homework_for_anonymous_comments => homework_for_anonymous_comments}
|
||||
end
|
||||
|
||||
#显示作业列表的同时显示分配给当前学生匿评的作业
|
||||
def show_homework_info_with_batch course,bid
|
||||
author = bid.author.lastname + bid.author.firstname
|
||||
many_times = course.homeworks.index(bid) + 1
|
||||
name = bid.name
|
||||
homework_count = bid.homeworks.count #已提交的作业数量
|
||||
student_questions_count = bid.commit.nil? ? 0 : bid.commit
|
||||
description = bid.description
|
||||
#if is_course_teacher(User.current, course) && @bid.open_anonymous_evaluation == 1 && @bid.homeworks.count >= 2
|
||||
state = bid.comment_status
|
||||
#end
|
||||
open_anonymous_evaluation = bid.open_anonymous_evaluation
|
||||
{:course_name => course.name,:id => bid.id, :course_teacher => author, :homework_times => many_times, :homework_name => name, :homework_count => homework_count,:student_questions_count => student_questions_count,
|
||||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation}
|
||||
end
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
alert("请勿重复申请加入该项目");
|
||||
<% elsif @status == 2%>
|
||||
alert("申请成功");
|
||||
<% elsif @status == 3%>
|
||||
alert("您已加入该项目");
|
||||
<%else%>
|
||||
alert("申请失败");
|
||||
<%end%>
|
|
@ -90,7 +90,7 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font_lighter" style="float: right">
|
||||
<td class="font_lighter" >
|
||||
<%= l :label_create_time %>:
|
||||
<%= format_time(@course.created_at) %>
|
||||
</table>
|
||||
|
|
|
@ -36,13 +36,41 @@
|
|||
<td class="info_font" style="width: 240px; color: #15bccf">软件项目托管社区</td>
|
||||
<td style="width: 430px; color: #15bccf"><strong><%= l(:label_user_location) %> : </strong></td>
|
||||
<td rowspan="2" width="250px">
|
||||
<div class="top-content-search" style="display:none">
|
||||
<%= form_tag(projects_search_path, :method => :get) do %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 20 %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="top-content-search">
|
||||
<script type="text/javascript">
|
||||
function regexName()
|
||||
{
|
||||
var name = $.trim($("#name").val());
|
||||
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>
|
||||
<%= 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>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -12,7 +12,11 @@ hideOnLoad();
|
|||
$("#member-<%= member.id %>").effect("highlight");
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% errors = @members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ') %>
|
||||
alert('<%= raw(escape_javascript(l(:notice_failed_to_save_members, :errors => errors))) %>');
|
||||
<% if @members %>
|
||||
<% 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 %>
|
||||
|
|
|
@ -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(:originization => enterprise.enterprise_name) %>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<div style="clear: both"></div>
|
||||
<div class="school-index">
|
||||
<ul id="schoollist" style="line-height: 25px"></ul>
|
||||
</div>
|
||||
<% html_title(l(:label_enterprise_all)) -%>
|
|
@ -22,9 +22,9 @@
|
|||
<% end %>
|
||||
|
||||
<%if @is_teacher%>
|
||||
<% if poll.polls_status == 1 || poll.polls_status == 3 %>
|
||||
<% if poll.polls_status == 1%>
|
||||
<li class="pollsbtn fl ml10 pollsbtn_grey">统计结果</li>
|
||||
<% elsif poll.polls_status == 2%>
|
||||
<% elsif poll.polls_status == 2 || poll.polls_status == 3 %>
|
||||
<li>
|
||||
<%= link_to l(:label_statistical_results), statistics_result_poll_path(poll.id), :class => "pollsbtn fl ml10"%>
|
||||
</li>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<p style="padding-right: 20px;">
|
||||
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</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,
|
||||
value:"#{User.current.id.to_s + '_' +Time.now.to_s.gsub(' ','_').gsub(':','').gsub('+','')}" %>
|
||||
<% unless @project.identifier_frozen? %>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<%= auto_discovery_link_tag(:atom, {:action => 'index', :format => 'atom', :key => User.current.rss_key}) %>
|
||||
<% end %>
|
||||
<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" %>
|
||||
<table width="940px">
|
||||
<tr>
|
||||
|
@ -33,24 +33,63 @@
|
|||
<% else %>
|
||||
<table width="940px">
|
||||
<tr>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf"><%= l(:label_project_deposit) %></td>
|
||||
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
|
||||
<td class="info_font" style="width: 220px; color: #15bccf">
|
||||
<%= l(:label_project_deposit) %>
|
||||
</td>
|
||||
<td class="location-list">
|
||||
<strong><%= l(:label_user_location) %> :</strong>
|
||||
</td>
|
||||
<td rowspan="2" valign="bottom">
|
||||
<% 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) %>
|
||||
<% end %>
|
||||
<% 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) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td rowspan="2" >
|
||||
<div class="project-search" style="float: right">
|
||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||
<%= hidden_field_tag 'project_type', params[:project_type] %>
|
||||
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
</div>
|
||||
<td rowspan="2" >
|
||||
<script type="text/javascript">
|
||||
function regexName()
|
||||
{
|
||||
var name = $.trim($("#name").val());
|
||||
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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><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>
|
||||
<td style="padding-left: 8px">
|
||||
<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>
|
||||
</table>
|
||||
<% end %>
|
||||
|
@ -67,7 +106,7 @@
|
|||
|
||||
<div class="pagination">
|
||||
<ul>
|
||||
<%= pagination_links_full @project_pages %>
|
||||
<%= paginate @project_pages %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -14,8 +14,12 @@
|
|||
<table class="list members">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= l(:label_user) %></th>
|
||||
<th><%= l(:label_role_plural) %></th>
|
||||
<th>
|
||||
<%= l(:label_user) %>
|
||||
</th>
|
||||
<th>
|
||||
<%= l(:label_role_plural) %>
|
||||
</th>
|
||||
<th style="width:15%"></th>
|
||||
<%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
|
||||
</tr>
|
||||
|
@ -24,26 +28,30 @@
|
|||
<% members.each do |member| %>
|
||||
<% next if member.new_record? %>
|
||||
<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
|
||||
<td class="<%= member.principal.class.name.downcase %>"><%= link_to_user member.principal %></td>
|
||||
<td class="<%= member.principal.class.name.downcase %>">
|
||||
<%= link_to_user member.principal %>
|
||||
</td>
|
||||
<td class="roles">
|
||||
<span id="member-<%= member.id %>-roles">
|
||||
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
|
||||
</span>
|
||||
<span id="member-<%= member.id %>-roles">
|
||||
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
|
||||
</span>
|
||||
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
|
||||
:method => :put,
|
||||
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
|
||||
) do |f| %>
|
||||
|
||||
<p>
|
||||
<% roles.each do |role| %>
|
||||
<label><%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
|
||||
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %> <%= h role %></label><br/>
|
||||
<% end %></p>
|
||||
<% end %>
|
||||
</p>
|
||||
<%= 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),
|
||||
"$('#member-#{member.id}-roles').show(); $('#member-#{member.id}-roles-form').hide(); return false;"
|
||||
%></p>
|
||||
%>
|
||||
</p>
|
||||
<% end %>
|
||||
</td>
|
||||
<!--modified by huang for: if the user'roles is Manager that he will can't modified himself-->
|
||||
|
@ -77,7 +85,9 @@
|
|||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<p class="nodata">
|
||||
<%= l(:label_no_data) %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
@ -87,20 +97,25 @@
|
|||
<div id="applied_project_block">
|
||||
<%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_apply_project) %></legend>
|
||||
|
||||
<legend>
|
||||
<%= l(:label_apply_project) %>
|
||||
</legend>
|
||||
<div id="principals_for_applied_member">
|
||||
<%= render_principals_for_applied_members(@project) %>
|
||||
</div>
|
||||
<br/>
|
||||
<!--show the roles which will select-->
|
||||
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
|
||||
<p style="padding-top: 5px">
|
||||
<%= l(:label_role_plural) %>:
|
||||
<% roles.each do |role| %>
|
||||
|
||||
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%= h role %></label>
|
||||
<% end %></p>
|
||||
|
||||
<p><%= submit_tag l(:label_approve), :id => 'member-add-submit' %>
|
||||
<label>
|
||||
<%= check_box_tag 'membership[role_ids][]', role.id %>
|
||||
<%= h role %>
|
||||
</label>
|
||||
<% end %>
|
||||
</p>
|
||||
<p>
|
||||
<%= submit_tag l(:label_approve), :id => 'member-add-submit' %>
|
||||
<%= submit_tag l(:label_refusal), :name => "refusal_button", :id => 'member-refusal-submit' %>
|
||||
</p>
|
||||
</fieldset>
|
||||
|
@ -110,9 +125,13 @@
|
|||
|
||||
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
||||
<fieldset>
|
||||
<legend><%= l(:label_member_new) %></legend>
|
||||
|
||||
<p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p>
|
||||
<legend>
|
||||
<%= l(:label_member_new) %>
|
||||
</legend>
|
||||
<p>
|
||||
<%= label_tag "principal_search", l(:label_principal_search) %>
|
||||
<%= text_field_tag 'principal_search', nil %>
|
||||
</p>
|
||||
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
|
||||
|
||||
<div id="principals_for_new_member">
|
||||
|
@ -120,13 +139,18 @@
|
|||
</div>
|
||||
<br />
|
||||
<!--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| %>
|
||||
|
||||
<label><%= check_box_tag 'membership[role_ids][]', role.id %> <%= h role %></label>
|
||||
<% end %></p>
|
||||
|
||||
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
|
||||
<label>
|
||||
<%= check_box_tag 'membership[role_ids][]', role.id %>
|
||||
<%= h role %>
|
||||
</label>
|
||||
<% end %>
|
||||
</p>
|
||||
<p>
|
||||
<%= submit_tag l(:button_add), :id => 'member-add-submit' %>
|
||||
</p>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -4,7 +4,20 @@
|
|||
@nav_dispaly_main_contest_label = 1 %>
|
||||
<% @nav_dispaly_forum_label = 1%>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
color: #333333;
|
||||
font-family: lucida grande, Lucida Sans Unicode, Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
}
|
||||
table {border:2px solid !important;
|
||||
}
|
||||
tr {border:2px solid !important;
|
||||
}
|
||||
td {border:2px solid !important;
|
||||
}
|
||||
</style>
|
||||
<div id='tool'>
|
||||
<p>
|
||||
<form action="/system_log/access_analysis" style="float:right" >
|
||||
|
|
|
@ -3,7 +3,20 @@
|
|||
@nav_dispaly_main_project_label = 1
|
||||
@nav_dispaly_main_contest_label = 1 %>
|
||||
<% @nav_dispaly_forum_label = 1%>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
color: #333333;
|
||||
font-family: lucida grande, Lucida Sans Unicode, Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
}
|
||||
table {border:2px solid !important;
|
||||
}
|
||||
tr {border:2px solid !important;
|
||||
}
|
||||
td {border:2px solid !important;
|
||||
}
|
||||
</style>
|
||||
<div id='tool'>
|
||||
|
||||
<div id='tool-bar' style="float: left">
|
||||
|
@ -32,7 +45,7 @@
|
|||
<%= paginate @logs unless @logs.empty? %><br/>
|
||||
|
||||
<% unless @logs.empty? %>
|
||||
<table border="2" >
|
||||
<table >
|
||||
<caption font-size="30px"><%=l(:label_log_detail)%></caption>
|
||||
<% @logs.each do |log| %>
|
||||
<% unless log.blank? %>
|
||||
|
|
|
@ -3,6 +3,18 @@
|
|||
@nav_dispaly_main_project_label = 1
|
||||
@nav_dispaly_main_contest_label = 1 %>
|
||||
<% @nav_dispaly_forum_label = 1%>
|
||||
<style type="text/css">
|
||||
body {
|
||||
color: #333333;
|
||||
font-family: lucida grande, Lucida Sans Unicode, Arial, Helvetica, sans-serif;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
}
|
||||
table {border:1px solid !important;
|
||||
}
|
||||
td {border:1px solid !important;
|
||||
}
|
||||
</style>
|
||||
<div id='tool'>
|
||||
<p>
|
||||
<form action="/system_log/time_analysis" style="float:right" >
|
||||
|
|
|
@ -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>
|
|
@ -1,5 +1,5 @@
|
|||
<h1></h1>
|
||||
<p id="errorExplanation">
|
||||
<%= course_title%>
|
||||
<%= course_title %>
|
||||
</p>
|
||||
<h1></h1>
|
|
@ -2,110 +2,106 @@
|
|||
<%= stylesheet_link_tag 'welcome' %>
|
||||
<%= javascript_include_tag 'welcome' %>
|
||||
<script type="text/javascript" language="javascript">
|
||||
|
||||
$(function(){
|
||||
$("#main").find("a").attr("target", "_blank");
|
||||
setCss();
|
||||
});
|
||||
//设置div居中
|
||||
function setCss()
|
||||
{
|
||||
var mainBar = $('#main-content-bar')[0];
|
||||
var topHeight = mainBar.offsetHeight;
|
||||
var welcomeLeft = $('#welcome_left')[0];
|
||||
var leftHeight = welcomeLeft.offsetHeight;
|
||||
var searchbar = $('#search-bar')[0];
|
||||
var searchHeight = searchbar.offsetHeight;
|
||||
welcomeLeft.style.marginTop = (topHeight - leftHeight)/2 + "px";
|
||||
searchbar.style.marginTop = (topHeight - searchHeight)/2 + "px";
|
||||
//alert((topHeight - leftHeight)/2 );
|
||||
}
|
||||
$(function() {
|
||||
$("#main").find("a").attr("target", "_blank");
|
||||
setCss();
|
||||
});
|
||||
//设置div居中
|
||||
function setCss() {
|
||||
var mainBar = $('#main-content-bar')[0];
|
||||
var topHeight = mainBar.offsetHeight;
|
||||
var welcomeLeft = $('#welcome_left')[0];
|
||||
var leftHeight = welcomeLeft.offsetHeight;
|
||||
var searchbar = $('#search-bar')[0];
|
||||
var searchHeight = searchbar.offsetHeight;
|
||||
welcomeLeft.style.marginTop = (topHeight - leftHeight) / 2 + "px";
|
||||
searchbar.style.marginTop = (topHeight - searchHeight) / 2 + "px";
|
||||
//alert((topHeight - leftHeight)/2 );
|
||||
}
|
||||
|
||||
// 给主页用户弹新页面
|
||||
$(document).ready(function($) {
|
||||
$("#loggedas").find("a").attr("target", "_blank");
|
||||
//$("#content .tabs_new~ .pagination").find("a").removeAttr("target");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class='top_bar'>
|
||||
<%#= render partial: 'wei_xin' %>
|
||||
<%#= render partial: 'wei_xin' %>
|
||||
<div class="main-content-bar" id="main-content-bar">
|
||||
<div style="float: left;padding-left:15px ">
|
||||
<!-- <#%= image_tag(get_project_avatar(@first_page), size: "75x75") %> -->
|
||||
<% if get_avatar?(@first_page) %>
|
||||
<%= image_tag(url_to_avatar(@first_page), width:@first_page.image_width,height: @first_page.image_height) %>
|
||||
<% else %>
|
||||
<%= image_tag '/images/transparent.png', width:@first_page.image_width,height: @first_page.image_height %>
|
||||
<% end %>
|
||||
|
||||
<!-- <#%= image_tag(get_project_avatar(@first_page), size: "75x75") %> -->
|
||||
<% if @enterprise.nil? %>
|
||||
<% if get_avatar?(@first_page) %>
|
||||
<%= image_tag(url_to_avatar(@first_page), width:@first_page.image_width,height: @first_page.image_height) %>
|
||||
<% else %>
|
||||
<%= 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 class="welcome_left" id="welcome_left">
|
||||
<% unless @first_page.nil? %>
|
||||
<%= @first_page.description.html_safe %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="search-bar" id="search-bar">
|
||||
<%= render :partial => "search_project", :locals => {:project_type => 0}%>
|
||||
</div>
|
||||
<div style="clear: both;"></div>
|
||||
<div class="welcome_left" id="welcome_left">
|
||||
<% if @enterprise.nil? %>
|
||||
<% unless @first_page.nil? %>
|
||||
<%= @first_page.description.html_safe %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
|
||||
<span class="font_welcome_school" style="color: #E8770D"> <%= link_to @enterprise, options={:action => 'index', :enterprise => @enterprise}, html_options={ :method => 'get', :style => "color: #E8770D"} %> </span>
|
||||
<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 style="clear:both"></div>
|
||||
<div style="clear:both"></div>
|
||||
|
||||
<div id="J_Slide" class="d-p-index-box d-p-index-hot">
|
||||
<h3 style="margin-left: 5px; color: #e8770d;">
|
||||
<strong>
|
||||
<%= l(:lable_hot_projects)%>
|
||||
</strong>
|
||||
</h3>
|
||||
<span style="margin-top: -20px;float: right; display: block;">
|
||||
<% if User.current.logged? %>
|
||||
<%= link_to(l(:label_project_new), {:controller => 'projects',
|
||||
:action => 'new',
|
||||
:course => 0,
|
||||
:project_type =>( @project_type||=0)},
|
||||
:class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
|
||||
|
||||
<%= link_to l(:label_join_project), join_project_projects_path ,:remote => true, :class => 'icon icon-add' %>
|
||||
|
||||
<% end %>
|
||||
</span>
|
||||
<h3 style="margin-left: 5px; color: #e8770d;"><strong> <%= l(:lable_hot_projects)%> </strong></h3>
|
||||
<span style="margin-top: -20px;float: right; display: block;"> <% if User.current.logged? %>
|
||||
<%= link_to(l(:label_project_new), {:controller => 'projects',
|
||||
:action => 'new',
|
||||
:course => 0,
|
||||
:project_type =>( @project_type||=0)},
|
||||
:class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
|
||||
|
||||
<%= link_to l(:label_join_project), join_project_projects_path ,:remote => true, :class => 'icon icon-add' %>
|
||||
|
||||
<% end %> </span>
|
||||
<div class="d-p-projectlist-box">
|
||||
<ul class="d-p-projectlist">
|
||||
<% cache("projects") do %>
|
||||
<% @projects.map do |project| %>
|
||||
<% cache project do %>
|
||||
<li style="overflow:auto;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 l(:label_project_member_amount, :count=>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 => l(:label_project_score_tips),
|
||||
:class => "tooltip",
|
||||
:id => "tooltip-#{project.id}" %>
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end; reset_cycle %>
|
||||
<% end %>
|
||||
<!-- 如果企业版参数正确,这进入企业版页面 -->
|
||||
<% if @originization.nil? %>
|
||||
<% @projects.map do |project| %>
|
||||
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
||||
<% end; reset_cycle %>
|
||||
<!-- 企业版项目 -->
|
||||
<% else %>
|
||||
<% if @e_count == 0 %>
|
||||
<p id="errorExplanation"><%= l(:label_enterprise_tips) %></p>
|
||||
<% @projects.map do |project| %>
|
||||
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
||||
<% end %>
|
||||
<% elsif @e_count < 10 %>
|
||||
<% @originization_projects.map do |project| %>
|
||||
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
||||
<% end %>
|
||||
<p id="errorExplanation"><%= l(:label_part_enterprise_tips) %></p>
|
||||
<% @part_projects.map do |project| %>
|
||||
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% @part_projects.map do |project| %>
|
||||
<%= render :partial => 'hot_projects_list', :locals => {:project => project} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -152,20 +148,13 @@
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="right" style="float: right; width: 48%; ">
|
||||
<div class="right" style="float: right; width: 48%; ">
|
||||
<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;">
|
||||
<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" }%>
|
||||
<%= 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>
|
||||
<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" }%>
|
||||
<%= 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 class="welcome-box-list-new memo_activity">
|
||||
<% cache("forums") do %>
|
||||
|
@ -202,9 +191,10 @@
|
|||
<%end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
<%= render partial: 'link_to_another' %>
|
|
@ -16,7 +16,7 @@ module RedmineApp
|
|||
# Application configuration should go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded.
|
||||
|
||||
# verifier if email is real
|
||||
#verifier if email is real
|
||||
# EmailVerifier.config do |config|
|
||||
# config.verifier_email = "lizanle521@126.com"
|
||||
# end
|
||||
|
@ -74,5 +74,6 @@ module RedmineApp
|
|||
if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
|
||||
instance_eval File.read(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -246,6 +246,8 @@ zh:
|
|||
label_course_reload: 重开
|
||||
label_course_closed_tips: "确定要%{desc}课程?"
|
||||
# end
|
||||
field_name: 名称
|
||||
field_enterprise_name: 企业名
|
||||
#added by huang
|
||||
field_tea_name: 教师
|
||||
field_couurse_time: 学时
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
# Example: :via => :get ====> :via => :get
|
||||
|
||||
RedmineApp::Application.routes.draw do
|
||||
|
||||
get "originizations/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 '/investor', :controller => 'projects', :action => 'investor', :as => 'investor', :via => :get
|
||||
match '/homework', :to => 'projects#homework', :as => 'homework', :via => :get
|
||||
|
||||
match 'originizations', :to => 'originizations#index', :as => 'index', :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 '/', :controller => 'projects', :action => 'show', :as => 'project_show', :via => :get
|
||||
|
@ -730,7 +731,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'delete_avatar', :to => 'avatar#delete_image',:via => :post
|
||||
# Endof Tao's code
|
||||
get 'robots.txt', :to => 'welcome#robots'
|
||||
match 'welcome/course', :to => 'welcome#course'
|
||||
#match 'welcome/course', :to => 'welcome#course'
|
||||
##############测试留言功能 fq
|
||||
post 'words/new', :to => 'words#new'
|
||||
post 'words/create', :to => 'words#create'
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddEnterpriseNameToProjects < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :enterprise_name, :string
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# 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|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -925,6 +925,7 @@ ActiveRecord::Schema.define(:version => 20150123020615) do
|
|||
t.integer "attachmenttype", :default => 1
|
||||
t.integer "user_id"
|
||||
t.integer "dts_test", :default => 0
|
||||
t.string "enterprise_name"
|
||||
end
|
||||
|
||||
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 3cabcc643f36939939685e6f55273dfbf89da545
|
|
@ -98,20 +98,13 @@ module Redmine
|
|||
# Author lizanle
|
||||
# Description 删除 unless scope.all,因为这个执行查询,并且没有加入时间限制,与下边 scope.all(provider_options[:find_options].dup)重复
|
||||
if options[:course]
|
||||
if provider_options[:timestamp].include? "updated_on"
|
||||
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
|
||||
scope.all(provider_options[:find_options].dup)
|
||||
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
|
||||
|
||||
if from && to
|
||||
scope = scope.scoped(:conditions => ["#{provider_options[:timestamp]} BETWEEN ? AND ?", from, to])
|
||||
end
|
||||
scope.all(provider_options[:find_options].dup)
|
||||
end
|
||||
|
||||
# 为了首页获取数据基本复制了上面的方法,改变了用户查看权限,增加了对讨论区的识别。
|
||||
|
|
|
@ -9,6 +9,9 @@ h4, .wiki h3 {font-size: 13px;}
|
|||
h4 {border-bottom: 1px dotted #bbb;}
|
||||
/*huang*/
|
||||
/*current position*/
|
||||
.enterprise_all{
|
||||
padding-left: 20px;
|
||||
}
|
||||
.course_ad{
|
||||
position:absolute;
|
||||
visibility:visible;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/* CSS Document */
|
||||
#content{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;}
|
||||
#popbox{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;}
|
||||
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea{ margin:0; padding:0;}
|
||||
div,img,tr,td,textarea{ border:0;}
|
||||
table,tr,td{border:0; cellspacing:0; cellpadding:0;}
|
||||
|
@ -79,7 +80,7 @@ a.wzan_visited{background:url(images/pic_zan.png) 0 0 no-repeat;}
|
|||
.ping_con h2{ font-size:14px; color:#444443; margin-bottom:10px; }
|
||||
.ping_con p{ color:#777777; font-size:12px; border-bottom:1px dashed #CCC; padding-bottom:5px;}
|
||||
.ping_con p span a{ color:#777777;}
|
||||
.ping_star{ width:160px; color:#333; font-weight:bold; margin-bottom:5px;}
|
||||
.ping_star{ width:165px; color:#333; font-weight:bold; margin-bottom:5px;}
|
||||
.ping_star span a{ float:right; width:20px; height:20px; background:url(images/star.png);background-repeat: no-repeat; margin-right:3px;}
|
||||
.ping_con textarea{ height:76px; border:1px solid #15bccf; margin-bottom:5px; color:#666; font-size:12px;}
|
||||
a.ping_sub{ float:right; height:22px; width:60px; margin-right:20px; background:#15bccf; color:#fff; text-align:center;}
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue