Merge branch 'develop' of 10.0.47.245:/home/trustie2 into develop
This commit is contained in:
commit
0b016e7c11
|
@ -7,20 +7,16 @@ class CoursesController < ApplicationController
|
||||||
def join
|
def join
|
||||||
if User.current.logged?
|
if User.current.logged?
|
||||||
course = Project.find(params[:object_id])
|
course = Project.find(params[:object_id])
|
||||||
if ( !course_endTime_timeout?(course) )
|
course_prefs = Course.find_by_extra(course.identifier)
|
||||||
course_prefs = Course.find_by_extra(course.identifier)
|
if params[:course_password] == course_prefs.password
|
||||||
if params[:course_password] == course_prefs.password
|
|
||||||
members = []
|
members = []
|
||||||
members << Member.new(:role_ids => [10], :user_id => User.current.id)
|
members << Member.new(:role_ids => [10], :user_id => User.current.id)
|
||||||
course.members << members
|
course.members << members
|
||||||
|
|
||||||
StudentsForCourse.create(:student_id => User.current.id, :course_id => params[:object_id])
|
StudentsForCourse.create(:student_id => User.current.id, :course_id => params[:object_id])
|
||||||
@state = 0
|
@state = 0
|
||||||
else
|
|
||||||
@state = 1
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
@state = 2
|
@state = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -49,7 +45,18 @@ class CoursesController < ApplicationController
|
||||||
private
|
private
|
||||||
|
|
||||||
def allow_join
|
def allow_join
|
||||||
course_endTime_timeout? Project.find(params[:object_id])
|
if course_endTime_timeout? Project.find(params[:object_id])
|
||||||
|
respond_to do |format|
|
||||||
|
format.js{
|
||||||
|
@state = 2
|
||||||
|
render :partial => 'set_join',
|
||||||
|
:locals => {:user => User.current,
|
||||||
|
:course => Project.find(params[:object_id]),
|
||||||
|
:object_id => params[:object_id]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -374,7 +374,7 @@ class ProjectsController < ApplicationController
|
||||||
|
|
||||||
@course_tag = params[:project][:project_type]
|
@course_tag = params[:project][:project_type]
|
||||||
if(@course_tag=="1")
|
if(@course_tag=="1")
|
||||||
if User.current.user_extensions.identity == 0
|
if User.current.user_extensions.identity#.include?(UserExtensions::TEACHER,UserExtensions::DEVELOPER)
|
||||||
@course = Course.new
|
@course = Course.new
|
||||||
@course.extra='course' + DateTime.parse(Time.now.to_s).strftime('%Y-%m-%d_%H-%M-%S').to_s
|
@course.extra='course' + DateTime.parse(Time.now.to_s).strftime('%Y-%m-%d_%H-%M-%S').to_s
|
||||||
@course.safe_attributes = params[:project][:course]
|
@course.safe_attributes = params[:project][:course]
|
||||||
|
@ -534,7 +534,7 @@ class ProjectsController < ApplicationController
|
||||||
@subprojects = @project.children.visible.all
|
@subprojects = @project.children.visible.all
|
||||||
@news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").all
|
@news = @project.news.limit(5).includes(:author, :project).reorder("#{News.table_name}.created_on DESC").all
|
||||||
@trackers = @project.rolled_up_trackers
|
@trackers = @project.rolled_up_trackers
|
||||||
if(User.find_by_id(ProjectInfo.find_by_project_id(@project.id).user_id))
|
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)
|
@user = User.find_by_id(ProjectInfo.find_by_project_id(@project.id).user_id)
|
||||||
end
|
end
|
||||||
cond = @project.project_condition(Setting.display_subprojects_issues?)
|
cond = @project.project_condition(Setting.display_subprojects_issues?)
|
||||||
|
@ -805,6 +805,8 @@ class ProjectsController < ApplicationController
|
||||||
end
|
end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
# TODO:#finishcourse and #restartcourse 没有设置权限,也就是说,任何人的调用都会关闭or重启课程。
|
||||||
|
# 最好通过用户与项目的权限解决这种事情。还没写
|
||||||
def finishcourse
|
def finishcourse
|
||||||
course_prefs = Course.find_by_extra(@project.identifier)
|
course_prefs = Course.find_by_extra(@project.identifier)
|
||||||
# setup_time = Time.parse(course_prefs.setup_time)
|
# setup_time = Time.parse(course_prefs.setup_time)
|
||||||
|
|
|
@ -15,21 +15,23 @@ class JournalsForMessage < ActiveRecord::Base
|
||||||
"m_reply_id" # 回复某留言的留言id(a留言回复了b留言,这是b留言的id)
|
"m_reply_id" # 回复某留言的留言id(a留言回复了b留言,这是b留言的id)
|
||||||
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
|
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
|
||||||
|
|
||||||
belongs_to :project, :foreign_type => 'jour_type', :foreign_key => 'jour_id', :polymorphic => true
|
belongs_to :project,
|
||||||
|
:foreign_key => 'jour_id',
|
||||||
|
:conditions => "#{self.table_name}.jour_type = 'Project' "
|
||||||
|
|
||||||
belongs_to :jour, :polymorphic => true
|
belongs_to :jour, :polymorphic => true
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :at_user, :class_name => "User", :foreign_key => 'reply_id'
|
belongs_to :at_user, :class_name => "User", :foreign_key => 'reply_id'
|
||||||
|
|
||||||
acts_as_event :title => Proc.new {|o| "#{l(:label_my_message)}"},
|
acts_as_event :title => Proc.new {|o| "#{l(:label_my_message)}"},
|
||||||
:datetime => :updated_on,
|
:datetime => Proc.new {|o| o.updated_on },
|
||||||
:author => Proc.new {|o| o.user },
|
:author => Proc.new {|o| o.user },
|
||||||
:description => Proc.new{|o| o.notes },
|
:description => Proc.new{|o| o.notes },
|
||||||
:type => Proc.new {|o| o.jour_type }#,
|
:type => Proc.new {|o| o.jour_type }#,
|
||||||
#:url => Proc.new {|o| ''}#{:controller => 'documents', :action => 'show', :id => o.id}}
|
#:url => Proc.new {|o| ''}#{:controller => 'documents', :action => 'show', :id => o.id}}
|
||||||
acts_as_activity_provider :author_key => :author_id,
|
acts_as_activity_provider :author_key => :user_id,
|
||||||
:func => 'memos',
|
:timestamp => "#{self.table_name}.updated_on",
|
||||||
:timestamp => 'updated_on',
|
:find_options => {:include => :project }
|
||||||
:find_options => {}#:include => :project}
|
|
||||||
|
|
||||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
id = "finish_course_tag"
|
id = "finish_course_tag"
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<% if course_endTime_timeout?(@project) #如果课程已结束%>
|
<% if course_endTime_timeout?(project) #如果课程已结束%>
|
||||||
<%= link_to '重启课程', restartcourse_project_path, :remote => true, :method => :post, :id => id, :confirm => ('确定要重启课程?') %>
|
<%= link_to '重启课程', restartcourse_project_path(project), :remote => true, :method => :post, :id => id, :confirm => ('确定要重启课程?') %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to '关闭课程', finishcourse_project_path, :remote => true, :method => :post, :id => id, :confirm => ('确定要关闭课程?') %>
|
<%= link_to '关闭课程', finishcourse_project_path(project), :remote => true, :method => :post, :id => id, :confirm => ('确定要关闭课程?') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
<%if User.current.logged? %>
|
<%if User.current.logged? %>
|
||||||
<% if @course.teacher.id == User.current.id %>
|
<% if @course.teacher.id == User.current.id %>
|
||||||
<%= link_to l(:label_course_modify_settings), {:controller => 'projects', :action => 'settings', :id => @project} %>
|
<%= link_to l(:label_course_modify_settings), {:controller => 'projects', :action => 'settings', :id => @project} %>
|
||||||
<%= render :partial => 'courses/set_course_time'%>
|
<%= render :partial => 'courses/set_course_time', :locals => {:project => @project}%>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
||||||
<%= join_in_course(@project, User.current) %></div>
|
<%= join_in_course(@project, User.current) %></div>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<% if Rails.env.development? %>
|
<% if Rails.env.development? %>
|
||||||
console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@project.identifier).try(:endup_time)%>');
|
console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@project.identifier).try(:endup_time)%>');
|
||||||
<% end %>
|
<% end %>
|
||||||
$('#finish_course_tag').replaceWith("<%= j(render partial: 'courses/set_course_time' )%>")
|
$('#finish_course_tag').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:project => @project} )%>")
|
||||||
<% else %>
|
<% else %>
|
||||||
alert('设置失败,请在论坛提交问题,等待管理员处理。');
|
alert('设置失败,请在论坛提交问题,等待管理员处理。');
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<table width="580">
|
<table width="580">
|
||||||
<tr>
|
<tr>
|
||||||
<td > <%= link_to (h @user.lastname+@user.firstname), user_path(@user) %> <%= l(:label_user_create_project) %> <%= link_to @project.name %><strong> !</strong></td>
|
<td > <%= link_to (h @user.try(:name)), user_path(@user) if @user %> <%= l(:label_user_create_project) %> <%= link_to @project.name %><strong> !</strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="font_lighter" style="float: right"><%= l :label_update_time %>: <%= format_time(@project.created_on) %>
|
<td class="font_lighter" style="float: right"><%= l :label_update_time %>: <%= format_time(@project.created_on) %>
|
||||||
|
|
|
@ -442,6 +442,7 @@ zh:
|
||||||
permission_delete_own_messages: 删除自己的帖子
|
permission_delete_own_messages: 删除自己的帖子
|
||||||
permission_export_wiki_pages: 导出 wiki 页面
|
permission_export_wiki_pages: 导出 wiki 页面
|
||||||
permission_manage_subtasks: 管理子任务
|
permission_manage_subtasks: 管理子任务
|
||||||
|
permission_view_journals_for_messages: 查看留言
|
||||||
|
|
||||||
project_module_issue_tracking: 问题跟踪
|
project_module_issue_tracking: 问题跟踪
|
||||||
project_module_time_tracking: 时间跟踪
|
project_module_time_tracking: 时间跟踪
|
||||||
|
|
|
@ -96,6 +96,7 @@ Redmine::AccessControl.map do |map|
|
||||||
map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :create, :update, :destroy, :autocomplete]}, :require => :member
|
map.permission :manage_members, {:projects => :settings, :members => [:index, :show, :create, :update, :destroy, :autocomplete]}, :require => :member
|
||||||
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member
|
map.permission :manage_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :require => :member
|
||||||
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member
|
map.permission :add_subprojects, {:projects => [:new, :create]}, :require => :member
|
||||||
|
map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true
|
||||||
|
|
||||||
map.project_module :issue_tracking do |map|
|
map.project_module :issue_tracking do |map|
|
||||||
# Issue categories
|
# Issue categories
|
||||||
|
@ -194,6 +195,11 @@ Redmine::AccessControl.map do |map|
|
||||||
map.project_module :gantt do |map|
|
map.project_module :gantt do |map|
|
||||||
map.permission :view_gantt, {:gantts => [:show, :update]}, :read => true
|
map.permission :view_gantt, {:gantts => [:show, :update]}, :read => true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# map.project_module :journals do |map|
|
||||||
|
# map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true
|
||||||
|
# end
|
||||||
|
|
||||||
end
|
end
|
||||||
#by young
|
#by young
|
||||||
Redmine::MenuManager.map :top_menu do |menu|
|
Redmine::MenuManager.map :top_menu do |menu|
|
||||||
|
|
Loading…
Reference in New Issue