|
|
|
@ -118,11 +118,11 @@ module ApplicationHelper
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
#if user.active? || (User.current.admin? && user.logged?)
|
|
|
|
|
# link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => user.css_classes
|
|
|
|
|
# link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => user.css_classes
|
|
|
|
|
#else
|
|
|
|
|
# name
|
|
|
|
|
#end
|
|
|
|
|
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => user.css_classes
|
|
|
|
|
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => user.css_classes
|
|
|
|
|
else
|
|
|
|
|
h(user.to_s)
|
|
|
|
|
end
|
|
|
|
@ -131,7 +131,7 @@ module ApplicationHelper
|
|
|
|
|
def link_to_isuue_user(user, options={})
|
|
|
|
|
if user.is_a?(User)
|
|
|
|
|
name = h(user.name(options[:format]))
|
|
|
|
|
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => "pro_info_p"
|
|
|
|
|
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => "pro_info_p"
|
|
|
|
|
else
|
|
|
|
|
h(user.to_s)
|
|
|
|
|
end
|
|
|
|
@ -140,7 +140,7 @@ module ApplicationHelper
|
|
|
|
|
def link_to_settings_user(user, options={})
|
|
|
|
|
if user.is_a?(User)
|
|
|
|
|
name = h(user.name(options[:format]))
|
|
|
|
|
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => "w90 c_orange fl"
|
|
|
|
|
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => "w90 c_orange fl"
|
|
|
|
|
else
|
|
|
|
|
h(user.to_s)
|
|
|
|
|
end
|
|
|
|
@ -155,7 +155,7 @@ module ApplicationHelper
|
|
|
|
|
else
|
|
|
|
|
name = user.login
|
|
|
|
|
end
|
|
|
|
|
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.user_domain}, :class => options[:class]
|
|
|
|
|
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => options[:class]
|
|
|
|
|
else
|
|
|
|
|
h(user.to_s)
|
|
|
|
|
end
|
|
|
|
@ -594,12 +594,22 @@ module ApplicationHelper
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 判断当前用户是否为项目管理员
|
|
|
|
|
def is_project_manager?(user_id,project_id)
|
|
|
|
|
def is_project_manager?(user_id, project_id)
|
|
|
|
|
@result = false
|
|
|
|
|
mem = Member.where("user_id = ? and project_id = ?",user_id, project_id)
|
|
|
|
|
unless mem.blank?
|
|
|
|
|
mem.first.roles.to_s.include?("Manager")
|
|
|
|
|
@result = false
|
|
|
|
|
@result = true
|
|
|
|
|
end
|
|
|
|
|
return @result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 私有项目资源不能引用,不能设置公开私有
|
|
|
|
|
# 公开项目资源可以应用,管理员和资源上传者拥有设置公开私有权限
|
|
|
|
|
def authority_pubilic_for_files(project, file)
|
|
|
|
|
@result = false
|
|
|
|
|
if (is_project_manager?(User.current.id, @project.id) || file.author_id == User.current.id) && project_contains_attachment?(project,file) && file.container_id == project.id && file.container_type == "Project"
|
|
|
|
|
@result = true
|
|
|
|
|
end
|
|
|
|
|
return @result
|
|
|
|
|
end
|
|
|
|
@ -2076,21 +2086,21 @@ module ApplicationHelper
|
|
|
|
|
hidden_non_project = Setting.find_by_name("hidden_non_project")
|
|
|
|
|
visiable = !(hidden_non_project && hidden_non_project.value == "0")
|
|
|
|
|
|
|
|
|
|
main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.course_domain}
|
|
|
|
|
main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.project_domain}
|
|
|
|
|
main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.contest_domain}
|
|
|
|
|
main_course_link = link_to l(:label_course_practice), {:controller => 'welcome', :action => 'index', :host => Setting.host_course}
|
|
|
|
|
main_project_link = link_to l(:label_project_deposit), {:controller => 'welcome', :action => 'index', :host => Setting.host_name}
|
|
|
|
|
main_contest_link = link_to l(:label_contest_innovate), {:controller => 'welcome', :action => 'index', :host => Setting.host_contest}
|
|
|
|
|
|
|
|
|
|
# course_all_course_link = link_to l(:label_course_all), {:controller => 'courses', :action => 'index'}
|
|
|
|
|
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.course_domain}
|
|
|
|
|
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :host => Setting.host_course}
|
|
|
|
|
# courses_link = link_to l(:label_course_practice), {:controller => 'courses', :action => 'index'}
|
|
|
|
|
#users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.user_domain}
|
|
|
|
|
#users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.host_user}
|
|
|
|
|
# contest_link = link_to l(:label_contest_innovate), {:controller => 'contests', :action => 'index'}
|
|
|
|
|
bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'}
|
|
|
|
|
forum_link = link_to l(:label_forum_all), {:controller => "forums", :action => "index"}
|
|
|
|
|
stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'}
|
|
|
|
|
school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'}
|
|
|
|
|
project_new_link = link_to l(:label_project_new), {:controller => 'projects', :action => 'new', :host => Setting.project_domain}
|
|
|
|
|
# project_mine_link = link_to l(:label_my_project), {:controller => 'users', :action => 'user_projects', :host => Setting.project_domain}
|
|
|
|
|
project_new_link = link_to l(:label_project_new), {:controller => 'projects', :action => 'new', :host => Setting.host_name}
|
|
|
|
|
# project_mine_link = link_to l(:label_my_project), {:controller => 'users', :action => 'user_projects', :host => Setting.host_name}
|
|
|
|
|
|
|
|
|
|
#@nav_dispaly_project_label
|
|
|
|
|
nav_list = Array.new
|
|
|
|
|