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
|
||||
if User.current.logged?
|
||||
course = Project.find(params[:object_id])
|
||||
if ( !course_endTime_timeout?(course) )
|
||||
course_prefs = Course.find_by_extra(course.identifier)
|
||||
if params[:course_password] == course_prefs.password
|
||||
course_prefs = Course.find_by_extra(course.identifier)
|
||||
if params[:course_password] == course_prefs.password
|
||||
members = []
|
||||
members << Member.new(:role_ids => [10], :user_id => User.current.id)
|
||||
course.members << members
|
||||
|
||||
|
||||
StudentsForCourse.create(:student_id => User.current.id, :course_id => params[:object_id])
|
||||
@state = 0
|
||||
else
|
||||
@state = 1
|
||||
end
|
||||
else
|
||||
@state = 2
|
||||
@state = 1
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
|
@ -49,7 +45,18 @@ class CoursesController < ApplicationController
|
|||
private
|
||||
|
||||
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
|
|
@ -374,7 +374,7 @@ class ProjectsController < ApplicationController
|
|||
|
||||
@course_tag = params[:project][:project_type]
|
||||
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.extra='course' + DateTime.parse(Time.now.to_s).strftime('%Y-%m-%d_%H-%M-%S').to_s
|
||||
@course.safe_attributes = params[:project][:course]
|
||||
|
@ -534,7 +534,7 @@ class ProjectsController < ApplicationController
|
|||
@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).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)
|
||||
end
|
||||
cond = @project.project_condition(Setting.display_subprojects_issues?)
|
||||
|
@ -805,6 +805,8 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
# end
|
||||
|
||||
# TODO:#finishcourse and #restartcourse 没有设置权限,也就是说,任何人的调用都会关闭or重启课程。
|
||||
# 最好通过用户与项目的权限解决这种事情。还没写
|
||||
def finishcourse
|
||||
course_prefs = Course.find_by_extra(@project.identifier)
|
||||
# setup_time = Time.parse(course_prefs.setup_time)
|
||||
|
|
|
@ -15,21 +15,23 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
"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"
|
||||
|
||||
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 :user
|
||||
belongs_to :at_user, :class_name => "User", :foreign_key => 'reply_id'
|
||||
|
||||
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 },
|
||||
:description => Proc.new{|o| o.notes },
|
||||
:type => Proc.new {|o| o.jour_type }#,
|
||||
#:url => Proc.new {|o| ''}#{:controller => 'documents', :action => 'show', :id => o.id}}
|
||||
acts_as_activity_provider :author_key => :author_id,
|
||||
:func => 'memos',
|
||||
:timestamp => 'updated_on',
|
||||
:find_options => {}#:include => :project}
|
||||
acts_as_activity_provider :author_key => :user_id,
|
||||
:timestamp => "#{self.table_name}.updated_on",
|
||||
:find_options => {:include => :project }
|
||||
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
id = "finish_course_tag"
|
||||
%>
|
||||
|
||||
<% if course_endTime_timeout?(@project) #如果课程已结束%>
|
||||
<%= link_to '重启课程', restartcourse_project_path, :remote => true, :method => :post, :id => id, :confirm => ('确定要重启课程?') %>
|
||||
<% if course_endTime_timeout?(project) #如果课程已结束%>
|
||||
<%= link_to '重启课程', restartcourse_project_path(project), :remote => true, :method => :post, :id => id, :confirm => ('确定要重启课程?') %>
|
||||
<% 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 %>
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<%if User.current.logged? %>
|
||||
<% if @course.teacher.id == User.current.id %>
|
||||
<%= 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 %>
|
||||
|
||||
<%= join_in_course(@project, User.current) %></div>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<% if Rails.env.development? %>
|
||||
console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@project.identifier).try(:endup_time)%>');
|
||||
<% 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 %>
|
||||
alert('设置失败,请在论坛提交问题,等待管理员处理。');
|
||||
<% end %>
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
<td colspan="2">
|
||||
<table width="580">
|
||||
<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>
|
||||
<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_export_wiki_pages: 导出 wiki 页面
|
||||
permission_manage_subtasks: 管理子任务
|
||||
permission_view_journals_for_messages: 查看留言
|
||||
|
||||
project_module_issue_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_versions, {:projects => :settings, :versions => [:new, :create, :edit, :update, :close_completed, :destroy]}, :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|
|
||||
# Issue categories
|
||||
|
@ -194,6 +195,11 @@ Redmine::AccessControl.map do |map|
|
|||
map.project_module :gantt do |map|
|
||||
map.permission :view_gantt, {:gantts => [:show, :update]}, :read => true
|
||||
end
|
||||
|
||||
# map.project_module :journals do |map|
|
||||
# map.permission :view_journals_for_messages, {:gantts => [:show, :update]}, :read => true
|
||||
# end
|
||||
|
||||
end
|
||||
#by young
|
||||
Redmine::MenuManager.map :top_menu do |menu|
|
||||
|
|
Loading…
Reference in New Issue