Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
daiao 2016-09-05 13:29:06 +08:00
commit 4601cbb8eb
219 changed files with 3632 additions and 2369 deletions

View File

@ -540,6 +540,7 @@ module Mobile
present :status, 0 present :status, 0
else else
present :status, -1 present :status, -1
present :message, "该用户已不在班级中"
end end
end end
@ -568,17 +569,26 @@ module Mobile
roles_id << 10 roles_id << 10
end end
c = Course.find("#{params[:id]}") c = Course.find("#{params[:id]}")
#7教辅 9教师 10学生 my_member = c.member_principals.where("users.id=#{current_user.id}").first
if c.tea_id == params[:user_id] || c.tea_id != current_user.id || roles_id.length <= 0
present :status, -1
else
rolesids = []
my_member.roles.each do |role|
rolesids << role.id
end
#7教辅 9教师 10学生
if c.tea_id == params[:user_id] || roles_id.length <= 0
present :status, -1
present :message,"修改失败"
elsif rolesids.include?(3) || rolesids.include?(7) || rolesids.include?(9)
cs = CoursesService.new cs = CoursesService.new
status = cs.modify_user_course_role params,roles_id status = cs.modify_user_course_role params,roles_id
present :status, status present :status, status
else
present :status, -1
present :message,"修改失败"
end end
end end
@ -661,6 +671,85 @@ module Mobile
end end
desc "删除班级成员"
params do
requires :id, type: Integer
requires :token, type: String
requires :user_id, type: Integer
end
post ':id/deletemember' do
authenticate!
status = -1
if(current_user.id != params[:user_id].to_i)
#权限
c = Course.find("#{params[:id]}")
if c.tea_id != params[:user_id].to_i
my_member = c.member_principals.where("users.id=#{current_user.id}").first
roles_ids = []
my_member.roles.each do |role|
roles_ids << role.id
end
if my_member && (roles_ids.include?(3) || roles_ids.include?(7) || roles_ids.include?(9) )
#删除该成员
cs = CoursesService.new
status = cs.delete_course_member(c,params[:user_id].to_i,current_user)
else
status = -2
end
else
status = -3
end
else
status = -4
end
out = {status: status}
message = case status
when 0; "删除成功"
when -1; "您还未登录"
when -2; "对不起您没有权限"
when -3; "不能删除班级管理员"
when -4; "不能删除自己"
when 1; "该用户不在该班级中"
else; "未知错误,请稍后再试"
end
out.merge(message: message)
end
desc "退出班级"
params do
requires :id, type: Integer
requires :token, type: String
end
post ':id/quit' do
authenticate!
#管理员不能退
cs = CoursesService.new
c = Course.find("#{params[:id]}")
user = current_user
if c.tea_id != user.id
status = cs.exit_course({:object_id => params[:id]}, user)
else
status = 3
end
out = {status: status}
message = case status
when 0; "退出班级成功"
when 1; "您不是该班级成员"
when 2; "您还未登录"
when 3; "管理员不能退出班级"
else; "未知错误,请稍后再试"
end
out.merge(message: message)
end
end end
end end
end end

View File

@ -127,6 +127,7 @@ module Mobile
present :status, 0 present :status, 0
else else
present :status, -1 present :status, -1
present :message, "该用户已不在项目中"
end end
end end
@ -268,6 +269,81 @@ module Mobile
present :status, 0 present :status, 0
end end
desc "删除项目成员"
params do
requires :id, type: Integer
requires :token, type: String
requires :user_id, type: Integer
end
post ':id/deletemember' do
authenticate!
status = -1
if(current_user.id != params[:user_id].to_i)
#权限
project = Project.find("#{params[:id]}")
if project.user_id != params[:user_id].to_i
my_member = project.member_principals.where("users.id=#{current_user.id}").first
roles_ids = []
my_member.roles.each do |role|
roles_ids << role.id
end
if my_member && roles_ids.include?(3)
#删除该成员
ps = ProjectsService.new
status = ps.project_delete_member(project,params[:user_id].to_i,current_user)
else
status = -2
end
else
status = -3
end
else
status = -4
end
out = {status: status}
message = case status
when 0; "删除成功"
when 1; "该用户不在该项目中"
when -1; "您还未登录"
when -2; "您没有权限"
when -3; "不能删除项目创建者"
when -4; "不能删除自己"
else; "未知错误,请稍后再试"
end
out.merge(message: message)
end
desc "退出项目"
params do
requires :id, type: Integer
requires :token, type: String
end
post ':id/quit' do
authenticate!
project = Project.find("#{params[:id]}")
ps = ProjectsService.new
status = ps.exit_project(project,current_user)
out = {status: status}
message = case status
when 0; "退出项目成功"
when -3; "您不是该项目成员"
when -1; "您还未登录"
when -2; "项目创建者不能退出项目"
else; "未知错误,请稍后再试"
end
out.merge(message: message)
end
end end
end end
end end

View File

@ -73,19 +73,25 @@ module Mobile
elsif ac.container_type == "Blog" elsif ac.container_type == "Blog"
"发表博客" "发表博客"
end end
when :course_project_id
if ac.container_type == "Course"
ac.container_id
elsif ac.container_type == "Project"
ac.container_id
end
when :activity_type_name when :activity_type_name
if ac.container_type == "Course" if ac.container_type == "Course"
case ac.act_type case ac.act_type
when "HomeworkCommon" when "HomeworkCommon"
"课程作业" "班级作业"
when "News" when "News"
"课程通知" "班级通知"
when "Message" when "Message"
"课程问答" "班级讨论"
when "Poll" when "Poll"
"课程问卷" "班级问卷"
when "Course" when "Course"
"课程" "班级"
end end
elsif ac.container_type == "Project" elsif ac.container_type == "Project"
case ac.act_type case ac.act_type
@ -137,6 +143,7 @@ module Mobile
act_expose :subject #标题 act_expose :subject #标题
act_expose :description #描述 act_expose :description #描述
act_expose :latest_update #最新更新时间 act_expose :latest_update #最新更新时间
act_expose :course_project_id #课程/项目ID
act_expose :course_project_name #课程/项目名字 act_expose :course_project_name #课程/项目名字
act_expose :activity_type_name #课程问答区/项目缺陷等 act_expose :activity_type_name #课程问答区/项目缺陷等
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options| expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|

View File

@ -52,6 +52,10 @@ module Mobile
time_from_now issue.created_on time_from_now issue.created_on
when :act_id when :act_id
issue.id issue.id
when :act_type
'Journal'
when :praise_count
get_activity_praise_num(issue)
end end
end end
end end

View File

@ -36,6 +36,10 @@ module Mobile
time_from_now f.created_on time_from_now f.created_on
when :act_id when :act_id
f.id f.id
when :praise_count
get_activity_praise_num(f)
when :act_type
'Comment'
end end
elsif f.is_a?(Hash) && !f.key?(field) elsif f.is_a?(Hash) && !f.key?(field)

View File

@ -3,6 +3,7 @@ module Mobile
class Project < Grape::Entity class Project < Grape::Entity
expose :name expose :name
expose :id expose :id
expose :is_public
expose :user_id expose :user_id
expose :invite_code expose :invite_code
expose :qrcode expose :qrcode

View File

@ -30,7 +30,7 @@ class AccountController < ApplicationController
user = UserExtensions.where(:user_id => User.current.id).first user = UserExtensions.where(:user_id => User.current.id).first
if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil? if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil?
redirect_to my_account_path(:tip => 1) redirect_to my_account_path(:tip => 1)
elsif user.identity == 3 && user.occupation.nil? elsif user.identity == 3 && user.school_id.nil?
redirect_to my_account_path(:tip => 1) redirect_to my_account_path(:tip => 1)
else else
redirect_to user_path(User.current) redirect_to user_path(User.current)
@ -359,7 +359,7 @@ class AccountController < ApplicationController
user = UserExtensions.where(:user_id => User.current.id).first user = UserExtensions.where(:user_id => User.current.id).first
if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil? if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil?
redirect_to my_account_path(:tip => 1) redirect_to my_account_path(:tip => 1)
elsif user.identity == 3 && user.occupation.nil? elsif user.identity == 3 && user.school_id.nil?
redirect_to my_account_path(:tip => 1) redirect_to my_account_path(:tip => 1)
else else
redirect_back_or_default User.current redirect_back_or_default User.current

View File

@ -599,8 +599,19 @@ class AdminController < ApplicationController
#学校列表 #学校列表
def schools def schools
@order = ""
@sort = ""
@schools = School.find_by_sql("SELECT * FROM schools ORDER BY created_at DESC") @schools = School.find_by_sql("SELECT * FROM schools ORDER BY created_at DESC")
if params[:sort] && (params[:order] == 'num')
@order = params[:order]
@sort = params[:sort]
@schools.each do |school|
count = UserExtensions.where("school_id = #{school.id} or occupation = '#{school.name}'").count
school[:infocount] = count.to_i
end
@sort == 'asc' ? (@schools = @schools.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@schools = @schools.sort{|x,y| y[:infocount] <=> x[:infocount]})
end
@school_count = @schools.count @school_count = @schools.count
@school_pages = Paginator.new @school_count, 30, params['page'] || 1 @school_pages = Paginator.new @school_count, 30, params['page'] || 1
@ -777,8 +788,15 @@ class AdminController < ApplicationController
#留言列表 #留言列表
def leave_messages def leave_messages
notes1, notes2, notes3 = '', '', ''
begin
notes1 = Message.find(19292).content
notes2 = Message.find(19291).content
notes3 = Message.find(19504).content
rescue => e
end
@jour = JournalsForMessage.find_by_sql("SELECT * FROM journals_for_messages AS j1 @jour = JournalsForMessage.find_by_sql("SELECT * FROM journals_for_messages AS j1
WHERE j1.jour_type IN ('Course','Principal') AND (j1.m_parent_id IS NULL OR (j1.m_parent_id IN (SELECT id FROM journals_for_messages WHERE jour_type IN ('Course','Principal')))) order by created_on desc") WHERE j1.jour_type IN ('Course','Principal') AND (j1.m_parent_id IS NULL OR (j1.m_parent_id IN (SELECT id FROM journals_for_messages WHERE jour_type IN ('Course','Principal')))) AND j1.notes !='#{notes1}' AND j1.notes !='#{notes2}' AND j1.notes !='#{notes3}' order by created_on desc")
@jour = paginateHelper @jour,30 @jour = paginateHelper @jour,30
@page = (params['page'] || 1).to_i - 1 @page = (params['page'] || 1).to_i - 1
respond_to do |format| respond_to do |format|

View File

@ -1,3 +1,4 @@
#encoding: utf-8
# Redmine - project management software # Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2006-2013 Jean-Philippe Lang
# #
@ -203,11 +204,51 @@ class AttachmentsController < ApplicationController
@attachment.save @attachment.save
@newfiledense = filedense @newfiledense = filedense
end end
if @attachment.container_type == "Project" || @attachment.container_type == "Course"
tip_attachment_update
end
respond_to do |format| respond_to do |format|
format.js format.js
end end
end end
def tip_attachment_update
if params[:course_id]
@tip_all_attachments = Attachment.where(:container_type => "Course", :container_id => params[:course_id])
@tip_all_public_attachments = Attachment.where(:container_type => "Course", :container_id => params[:course_id], :is_public => 1)
@tip_all_private_attachments = Attachment.where(:container_type => "Course", :container_id => params[:course_id], :is_public => 0)
@course = Course.find(params[:course_id])
elsif params[:project_id]
@tip_all_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id])
@tip_all_public_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id], :is_public => 1)
@tip_all_private_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id], :is_public => 0)
@project = Project.find(params[:project_id])
end
@tag_name = params[:tag_name]
@other = params[:other]
unless @tag_name.blank?
if @other
if @project
@tip_all_attachments = @tip_all_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') }
@tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') }
@tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') }
elsif @course
@tip_all_attachments = @tip_all_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') }
@tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') }
@tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') }
end
else
@tip_all_attachments = @tip_all_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)}
@tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)}
@tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)}
end
end
@tip_all_attachments = @tip_all_attachments.count
@tip_all_public_attachments = @tip_all_public_attachments.count
@tip_all_private_attachments = @tip_all_private_attachments.count
end
def thumbnail def thumbnail
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size]) if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
if stale?(:etag => thumbnail) if stale?(:etag => thumbnail)
@ -276,6 +317,7 @@ class AttachmentsController < ApplicationController
@attachment.delete @attachment.delete
@flag = true @flag = true
end end
# tip_attachment_update
respond_to do |format| respond_to do |format|
format.js format.js

View File

@ -12,11 +12,13 @@ class AvatarController < ApplicationController
@source_id = params[:source_id] @source_id = params[:source_id]
@temp_file = params[:avatar][:image] @temp_file = params[:avatar][:image]
@image_file = @temp_file.original_filename @image_file = @temp_file.original_filename
@is_direct = params[:is_direct]
else else
unless request.raw_post.nil? unless request.raw_post.nil?
@source_type = params[:source_type] @source_type = params[:source_type]
@source_id = params[:source_id] @source_id = params[:source_id]
@temp_file = request.raw_post @temp_file = request.raw_post
@is_direct = params[:is_direct]
if @temp_file.size > 0 if @temp_file.size > 0
if @temp_file.respond_to?(:original_filename) if @temp_file.respond_to?(:original_filename)
@image_file = @temp_file.original_filename @image_file = @temp_file.original_filename
@ -38,7 +40,7 @@ class AvatarController < ApplicationController
@urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file)) @urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
# 用户头像上传时进行特别处理 # 用户头像上传时进行特别处理
if @source_type == 'User' if @is_direct == '1' && (@source_type == 'User' || @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization')
diskfile += "temp" diskfile += "temp"
@urlfile += "temp" @urlfile += "temp"
end end
@ -105,7 +107,7 @@ class AvatarController < ApplicationController
path = File.dirname(diskfile) path = File.dirname(diskfile)
if File.directory?(path) && File.exist?(diskfile) if File.directory?(path) && File.exist?(diskfile)
# 用户头像进行特别处理 # 用户头像进行特别处理
if @source_type == 'User' if @source_type == 'User' || @source_type == 'Course' || @source_type == 'Project'
diskfile1 = diskfile + 'temp' diskfile1 = diskfile + 'temp'
File.open(diskfile1, "wb") do |f| File.open(diskfile1, "wb") do |f|
buffer = "DELETE" buffer = "DELETE"

View File

@ -331,7 +331,7 @@ class CoursesController < ApplicationController
@all_members = searchTeacherAndAssistant(@course) @all_members = searchTeacherAndAssistant(@course)
@members = @all_members @members = @all_members
when '2' when '2'
if @course.open_student == 1 || User.current.member_of_course?(@course) if @course.open_student == 1 || User.current.member_of_course?(@course) || User.current.admin?
@subPage_title = l :label_student_list @subPage_title = l :label_student_list
page = params[:page].nil? ? 0 : (params['page'].to_i - 1) page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
@all_members = student_homework_score(0,page, 10,@score_sort_by,@sort_type) @all_members = student_homework_score(0,page, 10,@score_sort_by,@sort_type)

View File

@ -86,19 +86,20 @@ class FilesController < ApplicationController
else else
@result = find_course_attache q,@course,sort @result = find_course_attache q,@course,sort
@result = visable_attachemnts @result @result = visable_attachemnts @result
# @searched_attach = paginateHelper @result,10 # @searched_attach = paginateHelper @result,10
@tag_list = get_course_tag_list @course @tag_list = get_course_tag_list @course
end end
@all_attachments = @result @all_attachments = @result
get_attachment_for_tip(@all_attachments)
@limit = 10 @limit = 10
@feedback_count = @all_attachments.count @feedback_count = @all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] @feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset @offset ||= @feedback_pages.offset
#@curse_attachments_all = @all_attachments[@offset, @limit] #@curse_attachments_all = @all_attachments[@offset, @limit]
@obj_attachments = paginateHelper @all_attachments,10 @obj_attachments = paginateHelper @all_attachments,10
#rescue Exception => e #rescue Exception => e
# #render 'stores' # #render 'stores'
# redirect_to search_course_files_url # redirect_to search_course_files_url
end end
end end
@ -164,6 +165,7 @@ class FilesController < ApplicationController
end end
@all_attachments = @project_attachment_result @all_attachments = @project_attachment_result
get_attachment_for_tip(@all_attachments)
@limit = 10 @limit = 10
@feedback_count = @all_attachments.count @feedback_count = @all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] @feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@ -176,52 +178,52 @@ class FilesController < ApplicationController
end end
end end
def search_files_in_subfield def search_files_in_subfield
sort = "" sort = ""
@sort = "" @sort = ""
@order = "" @order = ""
@is_remote = true @is_remote = true
@q = params[:name].strip @q = params[:name].strip
if params[:sort] if params[:sort]
order_by = params[:sort].split(":") order_by = params[:sort].split(":")
@sort = order_by[0] @sort = order_by[0]
if order_by.count > 1 if order_by.count > 1
@order = order_by[1] @order = order_by[1]
end
sort = "#{@sort} #{@order}"
end end
# show_attachments [@course] sort = "#{@sort} #{@order}"
begin
q = "%#{params[:name].strip}%"
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
if params[:insite]
if q == "%%"
@result = []
@searched_attach = paginateHelper @result,10
else
@result = find_public_attache q,sort
@result = visable_attachemnts_insite @result,@org_subfield
@searched_attach = paginateHelper @result,10
end
else
@result = find_org_subfield_attache q,@org_subfield,sort
@result = visable_attachemnts @result
@searched_attach = paginateHelper @result,10
@tag_list = attachment_tag_list @result
end
#rescue Exception => e
# #render 'stores'
# redirect_to search_course_files_url
end
@page = params[:page] || 1
end end
# show_attachments [@course]
begin
q = "%#{params[:name].strip}%"
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
if params[:insite]
if q == "%%"
@result = []
@searched_attach = paginateHelper @result,10
else
@result = find_public_attache q,sort
@result = visable_attachemnts_insite @result,@org_subfield
@searched_attach = paginateHelper @result,10
end
else
@result = find_org_subfield_attache q,@org_subfield,sort
@result = visable_attachemnts @result
@searched_attach = paginateHelper @result,10
@tag_list = attachment_tag_list @result
end
#rescue Exception => e
# #render 'stores'
# redirect_to search_course_files_url
end
@page = params[:page] || 1
end
def find_course_attache keywords,course,sort = "" def find_course_attache keywords,course,sort = ""
if sort == "" if sort == ""
sort = "created_on DESC" sort = "created_on DESC"
end end
if keywords != "%%" if keywords != "%%"
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").reorder(sort) resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").reorder(sort)
else else
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' "). reorder(sort) resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' "). reorder(sort)
end end
@ -250,7 +252,7 @@ class FilesController < ApplicationController
else else
resultSet = Attachment.where("attachments.container_type = 'Project' And attachments.container_id = '#{project.id}' "). reorder(sort) resultSet = Attachment.where("attachments.container_type = 'Project' And attachments.container_id = '#{project.id}' "). reorder(sort)
end end
end end
def find_public_attache keywords,sort = "" def find_public_attache keywords,sort = ""
# StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map # StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map
@ -260,7 +262,7 @@ class FilesController < ApplicationController
sort = "created_on DESC" sort = "created_on DESC"
end end
resultSet = Attachment.where("attachments.container_type IS NOT NULL AND attachments.copy_from IS NULL AND filename LIKE :like ", like: "%#{keywords}%"). resultSet = Attachment.where("attachments.container_type IS NOT NULL AND attachments.copy_from IS NULL AND filename LIKE :like ", like: "%#{keywords}%").
reorder(sort) reorder(sort)
end end
def index def index
@ -325,6 +327,7 @@ class FilesController < ApplicationController
@containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)] @containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)]
show_attachments @containers show_attachments @containers
get_attachment_for_tip(@all_attachments)
@tag_list = attachment_tag_list @all_attachments @tag_list = attachment_tag_list @all_attachments
@ -354,7 +357,7 @@ class FilesController < ApplicationController
when "quotes" when "quotes"
attribute = "quotes" attribute = "quotes"
else else
attribute = "created_on" attribute = "created_on"
end end
@sort = order_by[0] @sort = order_by[0]
@order = order_by[1] @order = order_by[1]
@ -377,6 +380,7 @@ class FilesController < ApplicationController
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
show_attachments @containers show_attachments @containers
get_attachment_for_tip(@all_attachments)
@tag_list = attachment_tag_list @all_attachments @tag_list = attachment_tag_list @all_attachments
@ -440,6 +444,39 @@ class FilesController < ApplicationController
end end
# 获取提示中私有、公开总数信息
def get_attachment_for_tip all_attachment
@tip_all_public_attachments = all_attachment.select{|attach| attach.is_public == 1}.count
if params[:project_id]
if User.current.member_of?(@project) || User.current.admin?
@tip_all_attachments = all_attachment.count
@tip_all_private_attachments = all_attachment.select{|attach| attach.is_public == 0}.count
else
if params[:tag_name]
@tip_all_attachments = all_attachment.count
@tip_all_private_attachments = 0
else
@tip_all_attachments = Attachment.where(:container_id => params[:project_id], :container_type => "Project").count
@tip_all_private_attachments = Attachment.where(:container_id => params[:project_id], :container_type => "Project", :is_public => 0).count
end
end
elsif params[:course_id]
if User.current.member_of_course?(@course) || User.current.admin?
@tip_all_attachments = all_attachment.count
@tip_all_private_attachments = all_attachment.select{|attach| attach.is_public == 0}.count
else
if params[:tag_name]
@tip_all_attachments = all_attachment.count
@tip_all_private_attachments = 0
else
@tip_all_attachments = Attachment.where(:container_id => params[:course_id], :container_type => "Course").count
@tip_all_private_attachments = Attachment.where(:container_id => params[:course_id], :container_type => "Course", :is_public => 0).count
end
end
end
end
def quote_resource_show def quote_resource_show
@file = Attachment.find(params[:id]) @file = Attachment.find(params[:id])
@can_quote = attachment_candown @file @can_quote = attachment_candown @file
@ -466,228 +503,228 @@ class FilesController < ApplicationController
end end
def create def create
if params[:add_tag] if params[:add_tag]
@addTag=true @addTag=true
#render :back #render :back
tag_saveEx tag_saveEx
#render :text =>"success" #render :text =>"success"
respond_to do |format| respond_to do |format|
format.js format.js
end end
else else
#modify by nwb #modify by nwb
if @project if @project
@addTag=false @addTag=false
if params[:in_project_toolbar] if params[:in_project_toolbar]
@in_project_toolbar = params[:in_project_toolbar] @in_project_toolbar = params[:in_project_toolbar]
end end
attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type]) attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type])
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
# 发送邮件 # 发送邮件
Mailer.run.attachments_added(attachments[:files]) Mailer.run.attachments_added(attachments[:files])
# 生成动态 # 生成动态
attachments[:files].each do |file| attachments[:files].each do |file|
ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment") ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment")
end end
# 更新资源总数, 根据上传的附件数累加 # 更新资源总数, 根据上传的附件数累加
@project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count) unless @project.project_score.nil? @project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count) unless @project.project_score.nil?
end end
# end # end
if params[:project_attachment_type] && params[:project_attachment_type].is_a?(Array) if params[:project_attachment_type] && params[:project_attachment_type].is_a?(Array)
params[:project_attachment_type].each do |type| params[:project_attachment_type].each do |type|
tag_name = get_project_tag_name_by_type_nmuber type tag_name = get_project_tag_name_by_type_nmuber type
if !attachments.empty? && attachments[:files] && tag_name != "" if !attachments.empty? && attachments[:files] && tag_name != ""
attachments[:files].each do |attachment| attachments[:files].each do |attachment|
attachment.tag_list.add(tag_name) attachment.tag_list.add(tag_name)
attachment.description = params[:description] attachment.description = params[:description]
attachment.save attachment.save
end end
end end
end end
else else
if params[:project_attachment_type] && params[:project_attachment_type] != "6" if params[:project_attachment_type] && params[:project_attachment_type] != "6"
tag_name = get_project_tag_name_by_type_nmuber params[:project_attachment_type] tag_name = get_project_tag_name_by_type_nmuber params[:project_attachment_type]
if !attachments.empty? && attachments[:files] && tag_name != "" if !attachments.empty? && attachments[:files] && tag_name != ""
attachments[:files].each do |attachment| attachments[:files].each do |attachment|
attachment.tag_list.add(tag_name) attachment.tag_list.add(tag_name)
attachment.description = params[:description] attachment.description = params[:description]
attachment.save attachment.save
end end
end end
end end
end end
# TODO: 临时用 nyan # TODO: 临时用 nyan
sort_init 'created_on', 'desc' sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on", sort_update 'created_on' => "#{Attachment.table_name}.created_on",
'filename' => "#{Attachment.table_name}.filename", 'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize", 'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads" 'downloads' => "#{Attachment.table_name}.downloads"
@containers = [Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] @containers = [Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
show_attachments @containers show_attachments @containers
@tag_list = attachment_tag_list @all_attachments @tag_list = attachment_tag_list @all_attachments
@attachtype = 0 @attachtype = 0
@contenttype = 0 @contenttype = 0
respond_to do |format| respond_to do |format|
format.js format.js
format.html { format.html {
redirect_to project_files_url(@project) redirect_to project_files_url(@project)
} }
end end
elsif @course elsif @course
@addTag=false @addTag=false
if params[:in_course_toolbar] if params[:in_course_toolbar]
@in_course_toolbar = params[:in_course_toolbar] @in_course_toolbar = params[:in_course_toolbar]
end end
attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type]) attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type])
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
Mailer.run.attachments_added(attachments[:files]) Mailer.run.attachments_added(attachments[:files])
end end
if !attachments.empty? && attachments[:files] if !attachments.empty? && attachments[:files]
attachments[:files].each do |attachment| attachments[:files].each do |attachment|
if params[:publish_time] if params[:publish_time]
if params[:publish_time] == "" if params[:publish_time] == ""
attachment.publish_time = Date.today attachment.publish_time = Date.today
else else
attachment.publish_time = params[:publish_time] attachment.publish_time = params[:publish_time]
end end
else else
attachment.publish_time = Date.today attachment.publish_time = Date.today
end end
if attachment.publish_time > Date.today if attachment.publish_time > Date.today
attachment.is_publish = 0 attachment.is_publish = 0
end end
attachment.description = params[:description] attachment.description = params[:description]
attachment.save attachment.save
end end
end end
if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array) if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array)
params[:course_attachment_type].each do |type| params[:course_attachment_type].each do |type|
tag_name = get_tag_name_by_type_number type tag_name = get_tag_name_by_type_number type
if !attachments.empty? && attachments[:files] && tag_name != "" if !attachments.empty? && attachments[:files] && tag_name != ""
attachments[:files].each do |attachment| attachments[:files].each do |attachment|
attachment.tag_list.add(tag_name) attachment.tag_list.add(tag_name)
attachment.save attachment.save
end end
end end
end end
else else
if params[:course_attachment_type] && params[:course_attachment_type] != "5" if params[:course_attachment_type] && params[:course_attachment_type] != "5"
tag_name = get_tag_name_by_type_number params[:course_attachment_type] tag_name = get_tag_name_by_type_number params[:course_attachment_type]
if !attachments.empty? && attachments[:files] && tag_name != "" if !attachments.empty? && attachments[:files] && tag_name != ""
attachments[:files].each do |attachment| attachments[:files].each do |attachment|
attachment.tag_list.add(tag_name) attachment.tag_list.add(tag_name)
attachment.save attachment.save
end end
end end
end end
end end
# 更新课程英雄榜得分 # 更新课程英雄榜得分
course_member_score(@course.id, attachments[:files].first.author_id, "Attachment") course_member_score(@course.id, attachments[:files].first.author_id, "Attachment")
# end # end
# end # end
# TODO: 临时用 nyan # TODO: 临时用 nyan
sort_init 'created_on', 'desc' sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on", sort_update 'created_on' => "#{Attachment.table_name}.created_on",
'filename' => "#{Attachment.table_name}.filename", 'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize", 'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads" 'downloads' => "#{Attachment.table_name}.downloads"
@containers = [Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)] @containers = [Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
show_attachments @containers show_attachments @containers
@tag_list = attachment_tag_list @all_attachments @tag_list = attachment_tag_list @all_attachments
@attachtype = 0 @attachtype = 0
@contenttype = 0 @contenttype = 0
respond_to do |format| respond_to do |format|
format.js format.js
format.html { format.html {
redirect_to course_files_url(@course) redirect_to course_files_url(@course)
} }
end end
elsif @org_subfield elsif @org_subfield
@addTag=false @addTag=false
attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type]) attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type])
if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type].is_a?(Array) if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type].is_a?(Array)
params[:org_subfield_attachment_type].each do |type| params[:org_subfield_attachment_type].each do |type|
tag_name = get_tag_name_by_type_number type tag_name = get_tag_name_by_type_number type
if !attachments.empty? && attachments[:files] && tag_name != "" if !attachments.empty? && attachments[:files] && tag_name != ""
attachments[:files].each do |attachment| attachments[:files].each do |attachment|
attachment.tag_list.add(tag_name) attachment.tag_list.add(tag_name)
attachment.description = params[:description] attachment.description = params[:description]
attachment.save attachment.save
end end
end end
end end
else else
if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type] != "5" if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type] != "5"
tag_name = get_tag_name_by_type_number params[:org_subfield_attachment_type] tag_name = get_tag_name_by_type_number params[:org_subfield_attachment_type]
if !attachments.empty? && attachments[:files] && tag_name != "" if !attachments.empty? && attachments[:files] && tag_name != ""
attachments[:files].each do |attachment| attachments[:files].each do |attachment|
attachment.tag_list.add(tag_name) attachment.tag_list.add(tag_name)
attachment.description = params[:description] attachment.description = params[:description]
attachment.save attachment.save
end end
end end
end end
end end
# TODO: 临时用 nyan # TODO: 临时用 nyan
sort_init 'created_on', 'desc' sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on", sort_update 'created_on' => "#{Attachment.table_name}.created_on",
'filename' => "#{Attachment.table_name}.filename", 'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize", 'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads" 'downloads' => "#{Attachment.table_name}.downloads"
@containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)] @containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)]
show_attachments @containers show_attachments @containers
@tag_list = attachment_tag_list @all_attachments @tag_list = attachment_tag_list @all_attachments
@attachtype = 0 @attachtype = 0
@contenttype = 0 @contenttype = 0
respond_to do |format| respond_to do |format|
format.js format.js
# format.html { # format.html {
# redirect_to org_subfield_files_url(@org_subfield) # redirect_to org_subfield_files_url(@org_subfield)
# } # }
end end
# 组织添加附件,为了修改图片 # 组织添加附件,为了修改图片
elsif params[:organization_id] elsif params[:organization_id]
@organization = Organization.find(params[:organization_id]) @organization = Organization.find(params[:organization_id])
@addTag=false @addTag=false
# atttchment_type = 0为logo 1为banner # atttchment_type = 0为logo 1为banner
if params[:logo] if params[:logo]
attachments = Attachment.attach_filesex(@organization, params[:attachments], false) attachments = Attachment.attach_filesex(@organization, params[:attachments], false)
else else
attachments = Attachment.attach_filesex(@organization, params[:attachments], true) attachments = Attachment.attach_filesex(@organization, params[:attachments], true)
end end
# TODO: 临时用 nyan # TODO: 临时用 nyan
sort_init 'created_on', 'desc' sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on", sort_update 'created_on' => "#{Attachment.table_name}.created_on",
'filename' => "#{Attachment.table_name}.filename", 'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize", 'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads" 'downloads' => "#{Attachment.table_name}.downloads"
@containers = [Organization.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@organization.id)] @containers = [Organization.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@organization.id)]
show_attachments @containers show_attachments @containers
@tag_list = attachment_tag_list @all_attachments @tag_list = attachment_tag_list @all_attachments
@attachtype = 0 @attachtype = 0
@contenttype = 0 @contenttype = 0
respond_to do |format| respond_to do |format|
format.js format.js
# format.html { # format.html {
# redirect_to org_subfield_files_url(@org_subfield) # redirect_to org_subfield_files_url(@org_subfield)
# } # }
end end
end end
end end
end end
def get_project_tag_name_by_type_nmuber type def get_project_tag_name_by_type_nmuber type
@ -763,7 +800,7 @@ class FilesController < ApplicationController
else else
#捕获异常 #捕获异常
end end
end end
# 返回指定资源类型的资源列表 # 返回指定资源类型的资源列表
# added by nwb # added by nwb
@ -807,27 +844,27 @@ class FilesController < ApplicationController
end end
end end
if @project if @project
@isproject = true @isproject = true
@containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)] @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
@containers += @project.versions.includes(:attachments).reorder(sort).all @containers += @project.versions.includes(:attachments).reorder(sort).all
show_attachments @containers show_attachments @containers
@attachtype = params[:type].to_i @attachtype = params[:type].to_i
@contenttype = params[:contentType].to_s @contenttype = params[:contentType].to_s
respond_to do |format| respond_to do |format|
format.js format.js
format.html { format.html {
render :layout => 'base_projects' render :layout => 'base_projects'
} }
end end
elsif @course elsif @course
@isproject = false @isproject = false
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)] @containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
show_attachments @containers show_attachments @containers
@attachtype = params[:type].to_i @attachtype = params[:type].to_i
@contenttype = params[:contentType].to_s @contenttype = params[:contentType].to_s
# render layout: 'base_courses' # render layout: 'base_courses'
@left_nav_type = 5 @left_nav_type = 5
respond_to do |format| respond_to do |format|
format.js format.js
@ -835,19 +872,19 @@ class FilesController < ApplicationController
render :layout => 'base_courses' render :layout => 'base_courses'
} }
end end
else else
show_attachments @containers show_attachments @containers
@attachtype = params[:type].to_i @attachtype = params[:type].to_i
@contenttype = params[:contentType].to_s @contenttype = params[:contentType].to_s
respond_to do |format| respond_to do |format|
format.js format.js
format.html format.html
end end
end end
end end
#查找指定TAG的按条件过滤的资源列表只有课程内搜索有此功能 #查找指定TAG的按条件过滤的资源列表只有课程内搜索有此功能
def search_tag_attachment def search_tag_attachment
@q,@tag_name,@order = params[:q],params[:tag_name] @q,@tag_name,@order = params[:q],params[:tag_name]
@is_remote = true @is_remote = true
@ -883,6 +920,7 @@ class FilesController < ApplicationController
end end
@all_attachments = @result @all_attachments = @result
get_attachment_for_tip(@all_attachments)
@limit = 10 @limit = 10
@feedback_count = @all_attachments.count @feedback_count = @all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page'] @feedback_pages = Paginator.new @feedback_count, @limit, params['page']

View File

@ -94,8 +94,10 @@ class HomeworkCommonController < ApplicationController
end end
end end
status = false
if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0 if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
homework_detail_manual.comment_status = 1 homework_detail_manual.comment_status = 1
status = true
end end
eval_start = homework_detail_manual.evaluation_start eval_start = homework_detail_manual.evaluation_start
if eval_start.nil? || (eval_start <= @homework.end_time && homework_detail_manual.comment_status <= 1) if eval_start.nil? || (eval_start <= @homework.end_time && homework_detail_manual.comment_status <= 1)
@ -145,6 +147,10 @@ class HomeworkCommonController < ApplicationController
@homework_detail_programing.save if @homework_detail_programing @homework_detail_programing.save if @homework_detail_programing
@homework_detail_group.save if @homework_detail_group @homework_detail_group.save if @homework_detail_group
if @homework.homework_type != 3 && homework_detail_manual.comment_status == 1 && status
create_works_list @homework
end
if params[:is_manage] == "1" if params[:is_manage] == "1"
redirect_to manage_or_receive_homeworks_user_path(User.current.id) redirect_to manage_or_receive_homeworks_user_path(User.current.id)
elsif params[:is_manage] == "2" elsif params[:is_manage] == "2"

View File

@ -196,8 +196,9 @@ class IssuesController < ApplicationController
priority_id = params[:issue][:priority_id] priority_id = params[:issue][:priority_id]
ps = ProjectsService.new ps = ProjectsService.new
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id if senduser.id != User.current.id
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
end
call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue}) call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
respond_to do |format| respond_to do |format|
format.html { format.html {
@ -521,10 +522,10 @@ class IssuesController < ApplicationController
def delete_journal def delete_journal
@issue = Issue.find(params[:id]) @issue = Issue.find(params[:id])
begin begin
forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id]).first forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id])
forge_acts.destroy unless forge_acts.nil? forge_acts.destroy_all unless forge_acts.empty?
at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id]).first at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id])
at_message.destroy unless at_message.nil? at_message.destroy_all unless at_message.empty?
Journal.delete(params[:journal_id]) Journal.delete(params[:journal_id])
rescue Exception => e rescue Exception => e
puts e puts e
@ -589,19 +590,19 @@ class IssuesController < ApplicationController
return false return false
end end
end end
@issue.safe_attributes = issue_attributes
senduser = User.find(params[:issue][:assigned_to_id]) senduser = User.find(params[:issue][:assigned_to_id])
if senduser.id != User.current.id if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id].to_i
issue_id = @issue.id issue_id = @issue.id
issue_title = params[:issue][:subject] issue_title = params[:issue][:subject]
priority_id = params[:issue][:priority_id] priority_id = params[:issue][:priority_id]
ps = ProjectsService.new ps = ProjectsService.new
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
end end
@issue.safe_attributes = issue_attributes
@priorities = IssuePriority.active @priorities = IssuePriority.active
@allowed_statuses = @issue.new_statuses_allowed_to(User.current) @allowed_statuses = @issue.new_statuses_allowed_to(User.current)
true true

View File

@ -229,7 +229,7 @@ class MembersController < ApplicationController
user_ids.each do |user_id| user_ids.each do |user_id|
member = Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id) member = Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
role_ids = attrs.delete(:role_ids) role_ids = params[:membership][:role_ids]
#role = Role.find(params[:membership][:role_ids]) #role = Role.find(params[:membership][:role_ids])
# 这里的判断只能通过角色名,可以弄成常量 # 这里的判断只能通过角色名,可以弄成常量
if role_ids && role_ids.include?("10") if role_ids && role_ids.include?("10")

View File

@ -90,14 +90,40 @@ class MyController < ApplicationController
end end
def clear_user_avatar_temp def clear_user_avatar_temp
@user = User.current if params[:course]
diskfile = disk_filename('User', @user.id) @course = Course.find params[:course]
diskfile = disk_filename('Course', @course.id)
elsif params[:project]
@project = Project.find params[:project]
diskfile = disk_filename('Project', @project.id)
elsif params[:organization]
@organization = Organization.find params[:organization]
diskfile = disk_filename('Organization', @organization.id)
else
@user = User.current
diskfile = disk_filename('User', @user.id)
end
diskfile1 = diskfile + 'temp' diskfile1 = diskfile + 'temp'
File.delete(diskfile1) if File.exist?(diskfile1) File.delete(diskfile1) if File.exist?(diskfile1)
end end
def save_user_avatar def save_user_avatar
@user = User.current if params[:source_id] && params[:source_type]
diskfile = disk_filename('User', @user.id) case params[:source_type]
when 'User'
@user = User.current
diskfile = disk_filename('User', @user.id)
when 'Course'
@course = Course.find params[:source_id]
diskfile = disk_filename('Course', @course.id)
when 'Project'
@project = Project.find params[:source_id]
diskfile = disk_filename('Project', @project.id)
when 'Organization'
@organization = Organization.find params[:source_id]
diskfile = disk_filename('Organization', @organization.id)
end
end
diskfile1 = diskfile + 'temp' diskfile1 = diskfile + 'temp'
begin begin
FileUtils.mv diskfile1, diskfile, force: true if File.exist? diskfile1 FileUtils.mv diskfile1, diskfile, force: true if File.exist? diskfile1

View File

@ -1,8 +1,10 @@
class PullRequestsController < ApplicationController class PullRequestsController < ApplicationController
before_filter :authorize_logged
before_filter :find_project_and_repository before_filter :find_project_and_repository
before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new, before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new,
:update_pull_request, :pull_request_comments, :create_pull_request_comment] :update_pull_request, :pull_request_comments, :create_pull_request_comment]
layout "base_projects" layout "base_projects"
include PullRequestsHelper include PullRequestsHelper
include ApplicationHelper include ApplicationHelper
@ -235,6 +237,13 @@ class PullRequestsController < ApplicationController
end end
private private
def authorize_logged
if !User.current.logged?
redirect_to signin_path
return
end
end
def connect_gitlab def connect_gitlab
@g = Gitlab.client @g = Gitlab.client
end end

View File

@ -16,8 +16,8 @@ class QualityAnalysisController < ApplicationController
end end
# params 说明:{identifier版本库名} # params 说明:{identifier版本库名}
# type: 1 新的分析 2 重新分析
def create def create
logger.info("11111111111111111111111111111")
begin begin
user_name = User.find(params[:user_id]).try(:login) user_name = User.find(params[:user_id]).try(:login)
identifier = params[:identifier] identifier = params[:identifier]
@ -30,98 +30,98 @@ class QualityAnalysisController < ApplicationController
# 考虑到历史数据有些用户创建类job但是build失败,即sonar没有结果这个时候需要把job删除,并且删掉quality_analyses表数据 # 考虑到历史数据有些用户创建类job但是build失败,即sonar没有结果这个时候需要把job删除,并且删掉quality_analyses表数据
# 如果不要这句则需要迁移数据 # 如果不要这句则需要迁移数据
@sonar_address = Redmine::Configuration['sonar_address'] @sonar_address = Redmine::Configuration['sonar_address']
projects_date = open(@sonar_address + "/api/projects/index").read # projects_date = open(@sonar_address + "/api/projects/index").read
arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] # arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
quality_an = QualityAnalysis.where(:sonar_name => sonar_name).first quality_an = QualityAnalysis.where(:sonar_name => sonar_name)
if @client_jenkins.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank? # if @client_jenkins.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank?
aa = @client_jenkins.job.delete("#{job_name}") # aa = @client_jenkins.job.delete("#{job_name}")
quality_an.delete unless quality_an.blank? # quality_an.delete unless quality_an.blank?
end # end
# type 1的时候之所以判断job是否存在为了防止特殊情况正常情况是不会出现的
# 重新分析的时候需要删除以前的分析结果
@client_jenkins.job.delete("#{job_name}") if @client_jenkins.job.exists?(job_name)
quality_an.delete_all unless quality_an.blank?
# Checks if the given job exists in Jenkins. # Checks if the given job exists in Jenkins.
unless @client_jenkins.job.exists?(job_name) @g = Gitlab.client
@g = Gitlab.client branch = params[:branch]
branch = params[:branch] language = swith_language_type(params[:language])
language = swith_language_type(params[:language]) path = params[:path].blank? ? "./" : params[:path]
path = params[:path].blank? ? "./" : params[:path] # qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
# qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first version = 1
version = quality_an.nil? ? 1 : quality_an.sonar_version + 1 properties = "sonar.projectKey=#{sonar_name}
properties = "sonar.projectKey=#{sonar_name}
sonar.projectName=#{sonar_name} sonar.projectName=#{sonar_name}
sonar.projectVersion=#{version} sonar.projectVersion=#{version}
sonar.sources=#{path} sonar.sources=#{path}
sonar.language=#{language.downcase} sonar.language=#{language.downcase}
sonar.sourceEncoding=utf-8" sonar.sourceEncoding=utf-8"
git_url = @gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git" git_url = @gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git"
# 替换配置文件 # 替换配置文件
@doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml'))) @doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml')))
@doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url @doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url
@doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}" @doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}"
@doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties # sonar-properties @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties # sonar-properties
# jenkins job创建 # jenkins job创建
jenkins_job = @client_jenkins.job.create("#{job_name}", @doc.to_xml) jenkins_job = @client_jenkins.job.create("#{job_name}", @doc.to_xml)
logger.info("Jenkins status of create ==> #{jenkins_job}")
# 将地址作为hook值添加到gitlab # 将地址作为hook值添加到gitlab
@g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{job_name}") # @g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{job_name}")
# job创建完成后自动运行job,如果运行成功则返回200 # job创建完成后自动运行job,如果运行成功则返回200
code = @client_jenkins.job.build("#{job_name}") code = @client_jenkins.job.build("#{job_name}")
logger.error("build result ==> #{code}")
# 判断调用sonar分析是否成功 # 判断调用sonar分析是否成功
# 等待启动时间处理, 最长时间为30分钟 # 等待启动时间处理, 最长时间为30分钟
for i in 0..360 do for i in 0..360 do
sleep(5) sleep(5)
@current_build_status = @client_jenkins.job.get_current_build_status("#{job_name}") @current_build_status = @client_jenkins.job.get_current_build_status("#{job_name}")
if (@current_build_status == "success" || @current_build_status == "failure") if (@current_build_status == "success" || @current_build_status == "failure")
break
if i == 360
@build_console_result = false
break break
if i == 360
@build_console_result = false
break
end
end
end
# sonar 缓冲sonar生成数据
sleep(10)
# 获取sonar output结果
console_build = @client_jenkins.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"]
logger.info("@current_build_status is ==> #{@current_build_status}")
# 两种情况需要删除job
# 1/创建成功但是build失败则删除job
# 2/creat和build成功调用sonar启动失败则删除job
# 错误信息存储需存到Trustie数据库否则一旦job删除则无法获取这些信息
if jenkins_job == '200' && code != '201'
@client_jenkins.job.delete("#{job_name}")
else
if @current_build_status == "failure"
reg_console = /Exception:.*?\r/.match(console_build)
output = reg_console[0].gsub("\r", "") unless reg_console.nil?
se = SonarError.where(:jenkins_job_name => job_name).first
se.nil? ? SonarError.create(:project_id => @project.id, :jenkins_job_name => job_name, :output => output) : se.update_column(:output, output)
@client_jenkins.job.delete("#{job_name}")
elsif @current_build_status == "success"
if quality_an.blank?
QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier,
:sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}")
else
qa.update_attribute(:sonar_version, version)
end
end
end
respond_to do |format|
if @current_build_status == "success"
format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch, :current_build_status => @current_build_status, :job_name => job_name)}
elsif @current_build_status == "failure"
format.html{redirect_to error_list_project_quality_analysi_path(:project_id => @project.id, :job_name => job_name)}
end end
end end
end end
# sonar 缓冲sonar生成数据
sleep(10)
# 获取sonar output结果
console_build = @client_jenkins.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"]
logger.info("@current_build_status is ==> #{@current_build_status}")
# 两种情况需要删除job
# 1/创建成功但是build失败则删除job
# 2/creat和build成功调用sonar启动失败则删除job
# 错误信息存储需存到Trustie数据库否则一旦job删除则无法获取这些信息
if jenkins_job == '200' && code != '201'
@client_jenkins.job.delete("#{job_name}")
else
if @current_build_status == "failure"
reg_console = /Exception:.*?\r/.match(console_build)
output = reg_console[0].gsub("\r", "") unless reg_console.nil?
se = SonarError.where(:jenkins_job_name => job_name).first
se.nil? ? SonarError.create(:project_id => @project.id, :jenkins_job_name => job_name, :output => output) : se.update_column(:output, output)
@client_jenkins.job.delete("#{job_name}")
elsif @current_build_status == "success"
if quality_an.blank?
QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier,
:sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}")
end
end
end
respond_to do |format|
if @current_build_status == "success"
format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch, :current_build_status => @current_build_status, :job_name => job_name)}
elsif @current_build_status == "failure"
format.html{redirect_to error_list_project_quality_analysi_path(:project_id => @project.id, :job_name => job_name)}
end
end
rescue => e rescue => e
@message = e.message @message = e.message
logger.error("######################====>#{e.message}") logger.error("######################====>#{e.message}")
@ -241,6 +241,21 @@ class QualityAnalysisController < ApplicationController
complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read
@complexity =JSON.parse(complexity_date).first @complexity =JSON.parse(complexity_date).first
# 获取排名结果
@g = Gitlab.client
@author_infos = @g.rep_user_stats(@project.gpid, :rev => @branch)
@user_quality_infos = []
@author_infos.each do |author_info|
email = author_info.email
changes = author_info.changes.to_i
unresolved_issues = open(@sonar_address + "/api/issues/search?projectKeys=#{@resource_id}&authors=#{email}&resolved=false").read
unresolved_issue_count = JSON.parse(unresolved_issues)["total"].to_i
all_issues = open(@sonar_address + "/api/issues/search?projectKeys=#{@resource_id}&authors=#{email}").read
all_issue_count = JSON.parse(all_issues)["total"].to_i
ratio = (changes == 0 ? 0 : format("%0.4f",unresolved_issue_count.to_f/changes.to_f))
@user_quality_infos << {:email => email, :changes => changes, :unresolved_issue_count => unresolved_issue_count, :ratio => ratio, :all_issue_count => all_issue_count}
end
# 按名称转换成hash键值对 # 按名称转换成hash键值对
@ha = {} @ha = {}
@complexity["msr"].each do |com| @complexity["msr"].each do |com|
@ -287,10 +302,8 @@ class QualityAnalysisController < ApplicationController
@jenkins_address = Redmine::Configuration['jenkins_address'] @jenkins_address = Redmine::Configuration['jenkins_address']
jenkins_username = Redmine::Configuration['jenkins_username'] jenkins_username = Redmine::Configuration['jenkins_username']
jenkins_password = Redmine::Configuration['jenkins_password'] jenkins_password = Redmine::Configuration['jenkins_password']
logger.info("22222222222222222222222222222222")
# connect jenkins # connect jenkins
@client_jenkins = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => jenkins_username, :password => jenkins_password) @client_jenkins = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => jenkins_username, :password => jenkins_password)
logger.info("333333333333333333333333333333")
rescue => e rescue => e
logger.error("failed to connect Jenkins ==> #{e}") logger.error("failed to connect Jenkins ==> #{e}")
end end

View File

@ -734,24 +734,33 @@ class StudentWorkController < ApplicationController
end end
def destroy def destroy
if @work.destroy if @homework.homework_type == 3
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 if @work.destroy
pros = @work.student_work_projects.where("is_leader = 0") if @homework.homework_detail_group.base_on_project == 1
pros.each do |pro| pros = @work.student_work_projects.where("is_leader = 0")
pro.destroy pros.each do |pro|
end pro.destroy
project = @work.student_work_projects.where("is_leader = 1").first end
project.update_attributes(:student_work_id => nil) project = @work.student_work_projects.where("is_leader = 1").first
elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 project.update_attributes(:student_work_id => nil)
@work.student_work_projects.each do |pro2| elsif @homework.homework_detail_group.base_on_project == 0
pro2.destroy @work.student_work_projects.each do |pro2|
pro2.destroy
end
end end
end end
respond_to do |format| else
format.html { @work.attachments.destroy_all
redirect_to student_work_index_url(:homework => @homework.id) @work.student_works_scores.destroy_all
} @work.course_messages.destroy_all
end @work.student_work_tests.destroy_all
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil)
@work.update_column("work_score",nil)
end
respond_to do |format|
format.html {
redirect_to student_work_index_url(:homework => @homework.id)
}
end end
end end
@ -793,6 +802,8 @@ class StudentWorkController < ApplicationController
end end
elsif @homework.homework_type == 1 elsif @homework.homework_type == 1
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil) @work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil)
@work.attachments.destroy_all
@work.course_messages.destroy_all
end end
@student_work = StudentWork.new @student_work = StudentWork.new
respond_to do |format| respond_to do |format|
@ -1391,7 +1402,7 @@ class StudentWorkController < ApplicationController
end end
def find_or_save_student_work(is_test) def find_or_save_student_work(is_test)
student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: is_test).first
if student_work.nil? if student_work.nil?
@homework.student_works.build( @homework.student_works.build(
name: params[:title], name: params[:title],
@ -1402,7 +1413,7 @@ class StudentWorkController < ApplicationController
unless @homework.save unless @homework.save
logger.debug @homework.errors.full_messages logger.debug @homework.errors.full_messages
else else
student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: is_test).first
end end
end end
student_work student_work

View File

@ -42,7 +42,7 @@ class UsersController < ApplicationController
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource, :activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction, :user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
:user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list, :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages,:choose_user_course,:user_courselist,:user_projectlist,:sort_syllabus_list,
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks] :sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses]
before_filter :auth_user_extension, only: :show before_filter :auth_user_extension, only: :show
#before_filter :rest_user_score, only: :show #before_filter :rest_user_score, only: :show
#before_filter :select_entry, only: :user_projects #before_filter :select_entry, only: :user_projects
@ -983,7 +983,7 @@ class UsersController < ApplicationController
@user = User.current @user = User.current
@homework = HomeworkCommon.find(params[:homework_id]) @homework = HomeworkCommon.find(params[:homework_id])
@is_test = params[:is_test] == 'true' @is_test = params[:is_test] == 'true'
@student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first @student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: @is_test).first
if @student_work.nil? if @student_work.nil?
@student_work = StudentWork.new @student_work = StudentWork.new
end end
@ -1115,23 +1115,8 @@ class UsersController < ApplicationController
homework_detail_programing.save if homework_detail_programing homework_detail_programing.save if homework_detail_programing
homework_detail_group.save if homework_detail_group homework_detail_group.save if homework_detail_group
if homework.homework_type != 3 if homework.homework_type != 3 && homework_detail_manual.comment_status == 1
students = homework.course.student create_works_list homework
if !homework.course.nil? && !students.empty?
name = homework.name
name_str = name + "的作品提交"
str = ""
students.each do |student|
if str != ""
str += ","
end
str += "('#{name_str}',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}')"
end
#('#{name}的作品提交',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}')
sql = "insert into student_works (name, homework_common_id,user_id, created_at, updated_at) values" + str
#StudentWork.create(:name => "#{name}的作品提交", :homework_common_id => homework.id, :user_id => student.student_id)
ActiveRecord::Base.connection.execute sql
end
end end
if params[:quotes] && !params[:quotes].blank? if params[:quotes] && !params[:quotes].blank?
@ -1474,15 +1459,15 @@ class UsersController < ApplicationController
#显示更多用户课程 #显示更多用户课程
def user_courses4show def user_courses4show
@page = params[:page].to_i + 1 @page = params[:page].to_i + 1
@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10).offset(@page * 10) @courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10).offset(@page * 10)
@all_count = @user.courses.visible.where("is_delete =?", 0).count @all_count = @user.favorite_courses.visible.where("is_delete =?", 0).count
end end
#显示更多用户项目 #显示更多用户项目
def user_projects4show def user_projects4show
@page = params[:page].to_i + 1 @page = params[:page].to_i + 1
@projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10).offset(@page * 10) @projects = @user.favorite_projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10).offset(@page * 10)
@all_count = @user.projects.visible.count @all_count = @user.favorite_projects.visible.count
end end
def user_course_activities def user_course_activities
@ -1675,55 +1660,117 @@ class UsersController < ApplicationController
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')" course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
project_types = "('Message','Issue','Project')" project_types = "('Message','Issue','Project')"
principal_types = "JournalsForMessage" principal_types = "JournalsForMessage"
container_type = ''
act_type = ''
if params[:type].present? if params[:type].present?
case params[:type] case params[:type]
when "course_homework" when "course_homework"
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('updated_at desc').limit(10).offset(@page * 10) container_type = 'Course'
act_type = 'HomeworkCommon'
when "course_news" when "course_news"
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'News'").order('updated_at desc').limit(10).offset(@page * 10) container_type = 'Course'
act_type = 'News'
when "course_message" when "course_message"
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) container_type = 'Course'
act_type = 'Message'
when "course_poll" when "course_poll"
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10) container_type = 'Course'
act_type = 'Poll'
when "course_journals" when "course_journals"
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'JournalsForMessage'").order('updated_at desc').limit(10).offset(@page * 10) container_type = 'Course'
act_type = 'JournalsForMessage'
when "project_issue" when "project_issue"
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('updated_at desc').limit(10).offset(@page * 10) container_type = 'Project'
act_type = 'Issue'
when "project_message" when "project_message"
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10) container_type = 'Course'
act_type = 'Message'
when "user_journals" when "user_journals"
@user_activities = UserActivity.where("container_type = 'Principal' and act_type= 'JournalsForMessage' and container_id = #{@user.id}").order('updated_at desc').limit(10).offset(@page * 10) container_type = 'Principal'
act_type = 'JournalsForMessage'
when "current_user" when "current_user"
@user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10) container_type = 'Principal'
else act_type = 'Principal'
if @user == User.current end
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" end
else if container_type != '' && act_type != ''
blog_ids = "("+@user.blog.id.to_s+")" if container_type == 'Course'
end sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" + elsif container_type == 'Project'
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+ sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " + elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10) sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
elsif container_type == 'Principal' && act_type == 'Principal'
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
end
if User.current != @user
sql += " and user_id = #{@user.id}"
end end
else else
# @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10) if User.current != @user
# blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")" blog_ids = "("+@user.blog.id.to_s+")"
# 减少数据库交互 sql = "user_id = #{@user.id} and((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
if @user == User.current "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(',')) "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
user_ids = "(" + @user.id.to_s + watched_user_ids + ")" "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids}))"
else else
user_ids = "(" + @user.id.to_s + ")" blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
end end
watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}")
blog_ids = watched_user_blog_ids.empty? ? "(-1)" : "(" + watched_user_blog_ids.map { |blog| blog.id}.join(",") + ")"
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
end end
@user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
# if params[:type].present?
# case params[:type]
# when "course_homework"
# @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('updated_at desc').limit(10).offset(@page * 10)
# when "course_news"
# @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'News'").order('updated_at desc').limit(10).offset(@page * 10)
# when "course_message"
# @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10)
# when "course_poll"
# @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10)
# when "course_journals"
# @user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'JournalsForMessage'").order('updated_at desc').limit(10).offset(@page * 10)
# when "project_issue"
# @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('updated_at desc').limit(10).offset(@page * 10)
# when "project_message"
# @user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10)
# when "user_journals"
# @user_activities = UserActivity.where("container_type = 'Principal' and act_type= 'JournalsForMessage' and container_id = #{@user.id}").order('updated_at desc').limit(10).offset(@page * 10)
# when "current_user"
# @user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10)
# else
# if @user == User.current
# blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
# else
# blog_ids = "("+@user.blog.id.to_s+")"
# end
# @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
# "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
# "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
# "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
# end
# else
# # @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)
# # blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
# # 减少数据库交互
# if @user == User.current
# watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(','))
# user_ids = "(" + @user.id.to_s + watched_user_ids + ")"
# else
# user_ids = "(" + @user.id.to_s + ")"
# end
# watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}")
# blog_ids = watched_user_blog_ids.empty? ? "(-1)" : "(" + watched_user_blog_ids.map { |blog| blog.id}.join(",") + ")"
#
# @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
# "or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
# "or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
# "or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
# end
# @user_activities = paginateHelper @user_activities,500 # @user_activities = paginateHelper @user_activities,500
@type = params[:type] @type = params[:type]
respond_to do |format| respond_to do |format|
@ -2167,6 +2214,7 @@ class UsersController < ApplicationController
#这里仅仅是传递需要发送的资源id #这里仅仅是传递需要发送的资源id
@send_id = params[:send_id] @send_id = params[:send_id]
@send_ids = params[:checkbox1] || params[:send_ids] @send_ids = params[:checkbox1] || params[:send_ids]
@hidden_unproject = hidden_unproject_infos
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -2186,6 +2234,7 @@ class UsersController < ApplicationController
#这里仅仅是传递需要发送的资源id #这里仅仅是传递需要发送的资源id
@send_id = params[:send_id] @send_id = params[:send_id]
@send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids @send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids
@hidden_unproject = hidden_unproject_infos
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -3349,6 +3398,7 @@ class UsersController < ApplicationController
#这里仅仅是传递需要发送的资源id #这里仅仅是传递需要发送的资源id
@send_id = params[:send_id] @send_id = params[:send_id]
@send_ids = params[:checkbox1] || params[:send_ids] @send_ids = params[:checkbox1] || params[:send_ids]
@hidden_unproject = hidden_unproject_infos
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -3439,6 +3489,28 @@ class UsersController < ApplicationController
end end
end end
#收藏班级/项目
def cancel_or_collect
if params[:project]
@project = Project.find params[:project]
member = Member.where("user_id = #{@user.id} and project_id = #{@project.id}")
elsif params[:course]
@course = Course.find params[:course]
member = Member.where("user_id = #{@user.id} and course_id = #{@course.id}")
end
unless member.empty?
member.first.update_attribute(:is_collect, member.first.is_collect == 0 ? 1 : 0)
end
if @project
@projects = @user.favorite_projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)
elsif @course
@courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10)
end
respond_to do |format|
format.js
end
end
def user_projectlist def user_projectlist
@order, @c_sort, @type, @list_type = 1, 2, 1, 1 @order, @c_sort, @type, @list_type = 1, 2, 1, 1
#limit = 5 #limit = 5

View File

@ -37,6 +37,13 @@ module ApplicationHelper
# super # super
# end # end
# 隐藏项目以外的信息
# return: true 显示false 不显示
def hidden_unproject_infos
hidden_info = Setting.find_by_name("hidden_non_project")
(hidden_info && hidden_info.value == "1") ? true : false
end
# 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换 # 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换
def get_user_by_mail mail def get_user_by_mail mail
user = User.find_by_mail(mail) user = User.find_by_mail(mail)
@ -820,16 +827,17 @@ module ApplicationHelper
return @result return @result
end end
def show_attachment_tip container_id, container_type
atts = Attachment.where(:container_id => container_id, :container_type => container_type, :is_public => 0)
atts.count > 0 ? true :false
end
# 必须是项目成,项目必须提交过代码 # 必须是项目成,项目必须提交过代码
def allow_pull_request project def allow_pull_request project
return false if project.gpid.nil? return false if project.gpid.nil?
g = Gitlab.client g = Gitlab.client
count = g.user_static(project.gpid, :rev => "master").count count = g.user_static(project.gpid, :rev => "master").count
if User.current.member_of?(project) && count > 0 count
true
else
false
end
end end
# 判断版本库是否初始为gitlab # 判断版本库是否初始为gitlab
@ -2519,7 +2527,7 @@ module ApplicationHelper
def footer_logo(ul_class=nil, li_class=nil) def footer_logo(ul_class=nil, li_class=nil)
logos = [] logos = []
logos.push(link_to image_tag('/images/footer_logo/nudt.png',:alt=>"nudt"),"http://www.nudt.edu.cn/special.asp?classid=12" ) logos.push(link_to image_tag('/images/footer_logo/nudt.png',:alt=>"nudt"),"http://www.nudt.edu.cn/special.asp?classid=12" )
logos.push(link_to image_tag('/images/footer_logo/peking_eecs.png', :alt=>"peking_eecs"), "http://eecs.pku.edu.cn" ) logos.push(link_to image_tag('/images/footer_logo/peking_eecs.png', :alt=>"peking_eecs"), "http://www.sei.pku.edu.cn/" )
logos.push(link_to image_tag('/images/footer_logo/buaa_scse.png', :alt=>"buaa_scse"), "http://scse.buaa.edu.cn/" ) logos.push(link_to image_tag('/images/footer_logo/buaa_scse.png', :alt=>"buaa_scse"), "http://scse.buaa.edu.cn/" )
logos.push(link_to image_tag('/images/footer_logo/iscas.png', :alt=>"iscas"), "http://www.iscas.ac.cn" ) logos.push(link_to image_tag('/images/footer_logo/iscas.png', :alt=>"iscas"), "http://www.iscas.ac.cn" )
logos.push(link_to image_tag('/images/footer_logo/inforbus.png', :alt=>"inforbus"), "http://www.inforbus.com" ) logos.push(link_to image_tag('/images/footer_logo/inforbus.png', :alt=>"inforbus"), "http://www.inforbus.com" )
@ -3236,6 +3244,16 @@ def get_all_children result, jour
result result
end end
#获取该节点所在的帖子
def get_root_parent comment
while comment.parent
comment = comment.parent
end
comment
end
#将有置顶属性的提到数组前面 #将有置顶属性的提到数组前面
def sort_by_sticky topics def sort_by_sticky topics
tmpTopics = [] tmpTopics = []
@ -3437,8 +3455,26 @@ def course_syllabus_option user = User.current
type type
end end
def create_works_list homework
students = homework.course.student
if !homework.course.nil? && !students.empty?
name = homework.name
name_str = name + "的作品提交"
str = ""
students.each do |student|
if str != ""
str += ","
end
str += "('#{name_str}',#{homework.id},#{student.student_id}, '#{format_time(Time.now)}', '#{format_time(Time.now)}')"
end
sql = "insert into student_works (name, homework_common_id,user_id, created_at, updated_at) values" + str
ActiveRecord::Base.connection.execute sql
end
end
# 获取项目动态更新时间 # 获取项目动态更新时间
def get_forge_act_message(act, type) def get_forge_act_message(act, type)
forge_act = ForgeActivity.where(:forge_act_id => act.id, :forge_act_type => type).first forge_act = ForgeActivity.where(:forge_act_id => act.id, :forge_act_type => type).first
format_time(forge_act.nil? ? act.created_on : forge_act.try(:updated_at)) format_time(forge_act.nil? ? act.created_on : forge_act.try(:updated_at))
end end

View File

@ -7,7 +7,7 @@ module OrgMemberHelper
scope = [] scope = []
end end
principals = paginateHelper scope,10 principals = paginateHelper scope,10
s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :class => 'mb5', :id => 'principals') s = content_tag('ul', project_member_check_box_tags_ex('membership[user_ids][]', principals), :id => 'principals')
links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options| links = pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){|text, parameters, options|
link_to text, host_with_protocol + "/org_member/org_member_autocomplete?" + parameters.merge(:q => params[:q],:flag => true,:org=> org, :format => 'js').to_query, :remote => true link_to text, host_with_protocol + "/org_member/org_member_autocomplete?" + parameters.merge(:q => params[:q],:flag => true,:org=> org, :format => 'js').to_query, :remote => true
} }

View File

@ -1,6 +1,6 @@
module SchoolHelper module SchoolHelper
def schoolMember_num school def schoolMember_num school
count = student_num(school) + teacher_num(school) count = UserExtensions.where("school_id = #{school.id} or occupation = '#{school.name}'").count
count.to_s count.to_s
end end

View File

@ -22,8 +22,12 @@ module StudentWorkHelper
end end
#获取指定用户对某一作业的评分结果 #获取指定用户对某一作业的评分结果
def student_work_score work,user def student_work_score work,user,reviewer_role=0
StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).last if reviewer_role != 0
StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id,:reviewer_role => reviewer_role).last
else
StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).last
end
end end
#获取指定评分的角色 #获取指定评分的角色

View File

@ -1,6 +1,7 @@
#coding=utf-8 #coding=utf-8
class AtMessage < ActiveRecord::Base class AtMessage < ActiveRecord::Base
include ApplicationHelper
belongs_to :user belongs_to :user
belongs_to :sender, class_name: "User", foreign_key: "sender_id" belongs_to :sender, class_name: "User", foreign_key: "sender_id"
attr_accessible :at_message, :container, :viewed, :user_id, :sender_id attr_accessible :at_message, :container, :viewed, :user_id, :sender_id
@ -10,7 +11,7 @@ class AtMessage < ActiveRecord::Base
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
validates :user_id, :sender_id, :at_message_id, :at_message_type, presence: true validates :user_id, :sender_id, :at_message_id, :at_message_type, presence: true
after_create :add_user_message after_create :add_user_message, :send_wechat_message
scope :unviewed, ->(type, id){ scope :unviewed, ->(type, id){
where(at_message_type: type, at_message_id:id, viewed: false) where(at_message_type: type, at_message_id:id, viewed: false)
@ -34,6 +35,91 @@ class AtMessage < ActiveRecord::Base
end end
end end
#@的时候发微信模版消息通知被@的人
def send_wechat_message
shield_type = ""
container_id = 0
status = 0
type = ""
detail_id = 0
detail_title = ""
if defined? at_message.notes
detail_content = strip_html at_message.notes,30
elsif defined? at_message.content
detail_content = strip_html at_message.content,30
elsif defined? at_message.description
detail_content = strip_html at_message.description,30
end
user = self.user
topic = get_root_parent at_message
case at_message_type
when "Issue"
#新建issue
shield_type = "Project"
container_id = at_message.project.id
type = "issues"
detail_id = topic.id
detail_title = at_message.subject
when "Journal"
#issue回复
topic = get_root_parent at_message.journalized
shield_type = "Project"
container_id = at_message.journalized.project.id
type = "issues"
detail_id = topic.id
detail_title = at_message.journalized.subject
when 'Message'
if at_message.course
shield_type = "Course"
container_id = at_message.course.id
type = "course_discussion"
detail_id = topic.id
detail_title = at_message.subject
elsif at_message.project
shield_type = "Project"
container_id = at_message.project.id
type = "project_discussion"
detail_id = topic.id
detail_title = at_message.subject
else
status = -1
end
when 'JournalsForMessage'
if at_message.jour && at_message.jour.course
#作业回复
shield_type = "Course"
container_id = at_message.jour.course.id
type = "homework"
detail_id = at_message.jour.id
detail_title = at_message.jour.name
else
type = "journal_for_message"
detail_id = topic.id
detail_title = at_message.subject
end
else
status = -1
end
count = 0
detail_title = detail_title.gsub(/RE: /, '')
if container_id != 0
count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='#{shield_type}' and shield_id=#{container_id}").count
end
if count == 0 && status == 0
message_title = self.sender.show_name+"@了您"
ws = WechatService.new
ws.at_notice user.id, type, detail_id, message_title, detail_title, format_time(Time.now), detail_content, "点击查看详情。",0
end
end
def subject def subject
case at_message_type case at_message_type
when "Issue" when "Issue"
@ -98,8 +184,10 @@ class AtMessage < ActiveRecord::Base
when 'JournalsForMessage' when 'JournalsForMessage'
if at_message.jour_type == 'Principal' if at_message.jour_type == 'Principal'
{controller: :users, action: :user_messages, id: at_message.at_user} {controller: :users, action: :user_messages, id: at_message.at_user}
else elsif at_message.jour_type == 'HomeworkCommon'
{controller: :homework_common, action: :index, course: at_message.jour.course_id} {controller: :homework_common, action: :index, course: at_message.jour.course_id}
elsif at_message.jour_type == 'Course'
{controller: :courses, action: :feedback, id: at_message.jour_id}
end end
else else

View File

@ -52,6 +52,9 @@ class Member < ActiveRecord::Base
ids += member_roles.select {|mr| !mr.inherited_from.nil?}.collect(&:role_id) ids += member_roles.select {|mr| !mr.inherited_from.nil?}.collect(&:role_id)
new_role_ids = ids - role_ids new_role_ids = ids - role_ids
if (new_role_ids.include?(7) || new_role_ids.include?(9)) && role_ids.include?(10)
member_roles.where("role_id = 10").first.update_column('is_current', 0)
end
# Add new roles # Add new roles
if new_role_ids.include?(7) && new_role_ids.include?(10) if new_role_ids.include?(7) && new_role_ids.include?(10)
member_roles << MemberRole.new(:role_id => 7) member_roles << MemberRole.new(:role_id => 7)

View File

@ -131,6 +131,22 @@ class Principal < ActiveRecord::Base
columns.uniq.map {|field| "#{table}.#{field}"} columns.uniq.map {|field| "#{table}.#{field}"}
end end
#收藏的课程
def favorite_courses
members = Member.where("user_id = #{self.id} and course_id != -1 and is_collect = 1")
course_ids = members.empty? ? "(-1)" : "(" + members.map{|member| member.course_id}.join(",") + ")"
courses = Course.where("id in #{course_ids}")
return courses
end
#收藏的项目
def favorite_projects
members = Member.where("user_id = #{self.id} and project_id != -1 and project_id != 0 and is_collect = 1")
project_ids = members.empty? ? "(-1)" : "(" + members.map{|member| member.project_id}.join(",") + ")"
projects = Project.where("id in #{project_ids}")
return projects
end
protected protected
# Make sure we don't try to insert NULL values (see #4632) # Make sure we don't try to insert NULL values (see #4632)

View File

@ -1,6 +1,6 @@
#学生提交作品表 #学生提交作品表
class StudentWork < ActiveRecord::Base class StudentWork < ActiveRecord::Base
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time
belongs_to :homework_common belongs_to :homework_common
belongs_to :user belongs_to :user

View File

@ -34,7 +34,7 @@ class Tracker < ActiveRecord::Base
end end
has_and_belongs_to_many :projects has_and_belongs_to_many :projects
has_and_belongs_to_many :courses # has_and_belongs_to_many :courses
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :association_foreign_key => 'custom_field_id' has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :association_foreign_key => 'custom_field_id'
acts_as_list acts_as_list

View File

@ -1162,18 +1162,20 @@ class User < Principal
#为新注册用户发送留言 #为新注册用户发送留言
def add_new_jour def add_new_jour
if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any? if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0"
lead_message1 = Message.find(19292) if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
notes1 = lead_message1.content lead_message1 = Message.find(19292)
lead_message2 = Message.find(19291) notes1 = lead_message1.content
notes2 = lead_message2.content lead_message2 = Message.find(19291)
lead_message3 = Message.find(19504) notes2 = lead_message2.content
notes3 = lead_message3.content lead_message3 = Message.find(19504)
#user_id 默认为课程使者创建 notes3 = lead_message3.content
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0) #user_id 默认为课程使者创建
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0) self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0) self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
end self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
end
end
end end
# 更新邮箱的同事更新invite_lists表中的邮箱信息 # 更新邮箱的同事更新invite_lists表中的邮箱信息

View File

@ -79,7 +79,8 @@ class CoursesService
else else
c = Course.find(course) c = Course.find(course)
end end
if current_user.nil? || !(current_user.admin? || c.is_public == 1 || (c.is_public == 0 && current_user.member_of_course?(c))) # if current_user.nil? || !(current_user.admin? || c.is_public == 1 || (c.is_public == 0 && current_user.member_of_course?(c)))
if current_user.nil?
raise '403' raise '403'
end end
#@canShowCode = isCourseTeacher(User.current.id,course) && params[:role] != '1' #@canShowCode = isCourseTeacher(User.current.id,course) && params[:role] != '1'
@ -458,8 +459,8 @@ class CoursesService
joined = StudentsForCourse.where('student_id = ? and course_id = ?', user.id, params[:object_id]) joined = StudentsForCourse.where('student_id = ? and course_id = ?', user.id, params[:object_id])
joined.each do |join| joined.each do |join|
join.delete join.delete
@state = 0
end end
@state = 0
@state @state
end end
@ -1284,5 +1285,35 @@ class CoursesService
status status
end end
#删除班级成员
def delete_course_member course,user_id,current_user
if current_user.nil?
state = -1
return state
end
member = course.members.where("user_id=?",user_id).first
if member != nil
member.destroy
user_admin = CourseInfos.where("user_id = ? and course_id = ?", member.user_id, course.id)
if user_admin.size > 0
user_admin.each do |user|
user.destroy
end
end
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id)
joined.each do |join|
join.delete
end
roles = Role.givable.all[3..5]
#移出课程发送消息
CourseMessage.create(:user_id => member.user_id, :course_id => course.id, :course_message_type => "RemoveFromCourse", :viewed => false, :course_message_id => current_user.id)
return 0
else
return 1
end
end
end end

View File

@ -355,4 +355,67 @@ class ProjectsService
end end
end end
#删除项目成员
def project_delete_member project,user_id,current_user
if current_user.nil?
state = -1
return state
end
member = project.members.where("user_id=?",user_id).first
if member != nil
member.destroy
# end
user_admin = ProjectInfo.where("user_id = ? and project_id = ?", member.user_id, project.id)
if user_admin.size > 0
user_admin.each do |user|
user.destroy
end
end
user_grade = UserGrade.where("user_id = ? and project_id = ?", member.user_id, project.id)
if user_grade.size > 0
user_grade.each do |grade|
grade.destroy
end
end
# 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
applied_projects = AppliedProject.where(:project_id => project.id, :user_id => member.user_id).first
unless applied_projects.nil?
applied_projects.delete
end
#移出项目发送消息
ForgeMessage.create(:user_id => member.user_id, :project_id => project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => current_user.id)
return 0
else
return 1
end
end
def exit_project project,user
if user.nil?
state = -1
return state
end
if project.user_id == user.id
state = -2
return state
end
members = Member.where(:user_id => user.id, :project_id=>project.id).first
if members != nil
members.destroy
# 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
applied_projects = AppliedProject.where(:project_id => project.id, :user_id => members.user_id).first
unless applied_projects.nil?
applied_projects.delete
end
state = 0
else
state = -3
end
return state
end
end end

View File

@ -432,4 +432,17 @@ class WechatService
end end
end end
def at_notice(user_id, type, id, first, key1, key2,key3,remark="",uid=0)
uw = UserWechat.where(user_id: user_id).first
unless uw.nil?
data = three_keys_template uw.openid,Wechat.config.at_notice, type, id, first, key1, key2, key3, remark,uid
begin
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
rescue Exception => e
Rails.logger.error "[at_notice] ===> #{e}"
end
Rails.logger.info "send over. #{req}"
end
end
end end

View File

@ -20,8 +20,8 @@
<th style="width: 100px;"> <th style="width: 100px;">
学校名称 学校名称
</th> </th>
<th style="width: 35px;"> <th style="width: 35px;" class = "<%= @order == 'num' ? (@sort == 'desc' ? 'st_up' : (@sort == 'asc' ? 'st_down' : '')) : '' %>">
用户数 <%= link_to '用户数', admin_schools_path(:sort=> @sort == "desc" ? 'asc' : 'desc', :order => 'num') %>
</th> </th>
<th style="width: 90px;"> <th style="width: 90px;">
创建时间 创建时间

View File

@ -1,16 +1,18 @@
<% if @attachment.container_type == 'Course' %> <% if @attachment.container_type == 'Course' %>
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id, :course_id => @attachment.container_id, :tag_name => @tag_name, :other => @other,:newtype=>(@attachment.is_public? ? 0:1)),
:remote=>true,:class=>"postOptionLink",:method => :post) %>"); :remote=>true,:class=>"postOptionLink",:method => :post) %>");
$("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>");
<% elsif @attachment.container_type == 'Project' %> <% elsif @attachment.container_type == 'Project' %>
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => @attachment.id, :newtype => (@attachment.is_public? ? 0:1)), $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => @attachment.id, :project_id => @attachment.container_id, :tag_name => @tag_name, :other => @other ,:newtype => (@attachment.is_public? ? 0:1)),
:remote => true, :class => "postOptionLink", :method => :post) %>"); :remote => true, :class => "postOptionLink", :method => :post) %>");
$("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>");
<% else %> <% else %>
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)), $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
:remote=>true,:class=>"postOptionLink",:method => :post) %>"); :remote=>true,:class=>"postOptionLink",:method => :post) %>");
<% end %> <% end %>
<% if @attachment.is_public? %> <% if @attachment.is_public? %>
$("#image_private_<%= @attachment.id%>").html('') $("#image_private_<%= @attachment.id%>").html('')
<%else%> <%else%>
$("#image_private_<%= @attachment.id%>").html('<span class="img_private ml5">私有</span>') $("#image_private_<%= @attachment.id%>").html('<span class="img_private ml5">私有</span>')
<% end %> <% end %>

View File

@ -17,7 +17,8 @@
:upload_path => upload_avatar_path(:format => 'js'), :upload_path => upload_avatar_path(:format => 'js'),
:description_placeholder => nil ,# l(:label_optional_description) :description_placeholder => nil ,# l(:label_optional_description)
:source_type => source.class.to_s, :source_type => source.class.to_s,
:source_id => source.id.to_s :source_id => source.id.to_s,
:is_direct => 0
} %> } %>
<!--</span>--> <!--</span>-->
<% content_for :header_tags do %> <% content_for :header_tags do %>

View File

@ -1,4 +1,4 @@
<% if @source_type=='User' %> <% if @is_direct == '1' && (@source_type=='User'|| @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization') %>
var imgSpan = $("img[nhname='avatar_image']"); var imgSpan = $("img[nhname='avatar_image']");
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'}); imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
<% else %> <% else %>

View File

@ -134,7 +134,7 @@
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %> <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div> </div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id%>').show();" onmouseout="$('#delete_reply_<%=comment.id%>').hide();">
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%> <%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
<% if !comment.content_detail.blank? %> <% if !comment.content_detail.blank? %>
@ -161,7 +161,8 @@
l(:button_delete), l(:button_delete),
{:controller => 'blog_comments', :action => 'destroy', :id => comment.id}, {:controller => 'blog_comments', :action => 'destroy', :id => comment.id},
:method => :delete, :method => :delete,
:class => 'fr mr20', :id => "delete_reply_#{comment.id}",
:class => 'fr mr20 undis',
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete) :title => l(:button_delete)
) %> ) %>

View File

@ -126,7 +126,7 @@
<div id="new_course_topic"> <div id="new_course_topic">
<div class="homepagePostBrief c_grey"> <div class="homepagePostBrief c_grey">
<div> <div>
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" > <input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="128" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<p id="subjectmsg"></p> <p id="subjectmsg"></p>
</div> </div>
<div id="topic_editor" style="display: none;"> <div id="topic_editor" style="display: none;">

View File

@ -22,7 +22,7 @@
<div class="homepageRight mt0 ml10"> <div class="homepageRight mt0 ml10">
<div class="homepageRightBanner"> <div class="homepageRightBanner">
<div class="NewsBannerName"> <div class="NewsBannerName">
班级问答 班级讨论
</div> </div>
</div> </div>
<div nhname="topic_form"> <div nhname="topic_form">

View File

@ -7,7 +7,7 @@
<div id="new_course_topic"> <div id="new_course_topic">
<div class="homepagePostBrief c_grey"> <div class="homepagePostBrief c_grey">
<div> <div>
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" > <input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="128" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<p id="subjectmsg"></p> <p id="subjectmsg"></p>
</div> </div>
<div id="topic_editor" style="display: none;"> <div id="topic_editor" style="display: none;">

View File

@ -7,7 +7,7 @@
<div id="new_course_topic"> <div id="new_course_topic">
<div class="homepagePostBrief c_grey"> <div class="homepagePostBrief c_grey">
<div> <div>
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" > <input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="128" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<p id="subjectmsg"></p> <p id="subjectmsg"></p>
</div> </div>
<div id="topic_editor" style="display: none;"> <div id="topic_editor" style="display: none;">

View File

@ -7,7 +7,7 @@
<div id="new_course_topic"> <div id="new_course_topic">
<div class="homepagePostBrief c_grey"> <div class="homepagePostBrief c_grey">
<div> <div>
<input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="255" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" > <input type="text" name="message[subject]" id="message_subject" class="InputBox w713" maxlength="128" onfocus="$('#topic_editor').show()" onkeyup="regexTopicSubject();" placeholder="发布帖子,请先输入帖子标题" value="<%= topic.subject%>" >
<p id="subjectmsg"></p> <p id="subjectmsg"></p>
</div> </div>
<div id="topic_editor" style="display: none;"> <div id="topic_editor" style="display: none;">

View File

@ -11,27 +11,27 @@
$("#relateProject,.relatePInfo").mouseout(function(){ $("#relateProject,.relatePInfo").mouseout(function(){
$(".relatePInfo").css("display","none"); $(".relatePInfo").css("display","none");
}) })
$(".homepagePostPortrait").mouseover(function(){ // $(".homepagePostPortrait").mouseover(function(){
onImage = true; // onImage = true;
$(this).children(".userCard").css("display","block"); // $(this).children(".userCard").css("display","block");
}) // })
$(".homepagePostPortrait").mouseout(function(){ // $(".homepagePostPortrait").mouseout(function(){
var cur = $(this); // var cur = $(this);
onImage = false; // onImage = false;
setTimeout(function(){ // setTimeout(function(){
if (onUserCard == false && onImage == false){ // if (onUserCard == false && onImage == false){
$(cur).children(".userCard").css("display", "none"); // $(cur).children(".userCard").css("display", "none");
} // }
}, 500); // }, 500);
}) // })
$(".userCard").mouseover(function(){ // $(".userCard").mouseover(function(){
onUserCard = true; // onUserCard = true;
$(this).css("display","block"); // $(this).css("display","block");
}) // })
$(".userCard").mouseout(function(){ // $(".userCard").mouseout(function(){
onUserCard = false; // onUserCard = false;
$(this).css("display","none"); // $(this).css("display","none");
}) // });
$(".coursesLineGrey").mouseover(function(){ $(".coursesLineGrey").mouseover(function(){
$(this).css("color","#ffffff"); $(this).css("color","#ffffff");
}) })

View File

@ -5,7 +5,7 @@
<div class="ping_dispic"> <div class="ping_dispic">
<%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %> <%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %>
</div> </div>
<div class="ping_discon upload_img" style="width: 610px;"> <div class="ping_discon upload_img" style="width: 610px;" onmouseover="$('#delete_reply_<%=journal.id %>').show();" onmouseout="$('#delete_reply_<%=journal.id %>').hide();">
<div class="ping_distop f14"> <div class="ping_distop f14">
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> --> <!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
<span> <span>
@ -28,17 +28,17 @@
<span id="reply_praise_count_<%=journal.id %>"> <span id="reply_praise_count_<%=journal.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>journal, :user_activity_id=>journal.id,:type=>"reply"}%> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>journal, :user_activity_id=>journal.id,:type=>"reply"}%>
</span> </span>
<% if journal.user == User.current|| User.current.admin? || (@course && User.current.allowed_to?(:as_teacher,@course)) %>
<%= link_to(l(:label_bid_respond_delete),
{:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete',
:class => "delete", :title => l(:button_delete)) %>
<% end %>
<% if reply_allow %> <% if reply_allow %>
<%#= link_to l(:label_bid_respond_quote),'', <%#= link_to l(:label_bid_respond_quote),'',
{:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %> {:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %>
<%= link_to l(:label_bid_respond_quote),'javascript:;',{:nhname=>"reply_btn"} %> <%= link_to l(:label_bid_respond_quote),'javascript:;',{:nhname=>"reply_btn"} %>
<% end %> <% end %>
<% if journal.user == User.current|| User.current.admin? || (@course && User.current.allowed_to?(:as_teacher,@course)) %>
<%= link_to(l(:label_bid_respond_delete),
{:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :id => "delete_reply_#{journal.id}",
:class => "delete undis", :title => l(:button_delete)) %>
<% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% ids = 'project_respond_form_'+ journal.id.to_s%> <% ids = 'project_respond_form_'+ journal.id.to_s%>

View File

@ -54,11 +54,11 @@
</a> </a>
<ul> <ul>
<li> <li>
<%= link_to("#{l(:label_bidding_user_studentname)}<span >#{member.user.show_name}</span>".html_safe,user_path(member.user)) %> <%= link_to("#{l(:label_bidding_user_studentname)}<span class='hidden st_info_block'>#{member.user.show_name}</span>".html_safe,user_path(member.user)) %>
</li> </li>
<br/> <br/>
<% unless member.user.user_extensions.student_id == ''%> <% unless member.user.user_extensions.student_id == ''%>
<li><%= link_to("#{l(:label_bidding_user_studentcode)}<span >#{member.user.user_extensions.student_id}</span>".html_safe,user_path(member.user)) %></li> <li><%= link_to("#{l(:label_bidding_user_studentcode)}<span class='hidden st_info_block'>#{member.user.user_extensions.student_id}</span>".html_safe,user_path(member.user)) %></li>
<% end%> <% end%>
</ul> </ul>
<% unless @course.course_groups.empty? %> <% unless @course.course_groups.empty? %>

View File

@ -2,7 +2,7 @@
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %> <% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
<li> <li>
<a href="<%=course_boards_path(@course) %>">问答区</a> <a href="<%=course_boards_path(@course) %>">讨论区</a>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %> <%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %>
</li> </li>
<% end %> <% end %>

View File

@ -17,7 +17,7 @@
<div class="cl"></div> <div class="cl"></div>
<li class="ml45"> <li class="ml45">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label> <label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_course_name)%>&nbsp;&nbsp;</label>
<input type="text" name="course[name]" id="new_course_name" class="courses_input" maxlength="100" placeholder="例如计算机系A班" onkeyup="regex_course_name('new');"> <input type="text" name="course[name]" id="new_course_name" class="courses_input" maxlength="100" placeholder="例如:软件工程计算机系A班" onkeyup="regex_course_name('new');">
<span class="c_red" id="new_course_name_notice" style="display: none;">班级名称不能为空且至少有两个字符</span> <span class="c_red" id="new_course_name_notice" style="display: none;">班级名称不能为空且至少有两个字符</span>
</li> </li>
<div class="cl"></div> <div class="cl"></div>

View File

@ -7,6 +7,9 @@
$("#course_is_public").attr("checked",true); $("#course_is_public").attr("checked",true);
<% end %> <% end %>
} }
if(document.getElementById("course_list")) {
window.location.href = "<%=course_files_path(@course) %>";
}
<% else %> <% else %>
<% if @course.is_public? %> <% if @course.is_public? %>
$("#show_course_<%= @course.id %>").attr("title","公开班级:<%= @course.name %><%= @course.time.to_s+ @course.term %>"); $("#show_course_<%= @course.id %>").attr("title","公开班级:<%= @course.name %><%= @course.time.to_s+ @course.term %>");

View File

@ -27,9 +27,8 @@
<div class="hwork_dis" id="tbc_01" style="padding-top: 10px;"> <div class="hwork_dis" id="tbc_01" style="padding-top: 10px;">
<ul> <ul>
<%= labelled_form_for @course do |f| %> <%= labelled_form_for @course do |f| %>
<li class="ml45 mb10"> <li class="ml45 mb10" id="course_avatar_form">
<%= render :partial => "avatar/new_avatar_form", :locals => {source: @course} %> <%= render :partial => "avatar/new_avatar_form", :locals => {source: @course} %>
<div class="cl"></div>
</li> </li>
<li class="ml45 mb10"> <li class="ml45 mb10">
<label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</label> <label><span class="c_red">*</span>&nbsp;<%= l(:label_tags_syllabus_name)%>&nbsp;&nbsp;</label>

View File

@ -218,8 +218,12 @@
<% end %> <% end %>
</div> </div>
<div class="ur_buttons"> <div class="ur_buttons">
<%= link_to "保存",commit_exercise_exercise_path(exercise,:save => 1),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:format => 'js',:remote=>true %> <% if exercise.time == -1 %>
<%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:20px;",:format => 'js',:remote=>true %> <%= link_to "保存",commit_exercise_exercise_path(exercise,:save => 1),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:format => 'js',:remote=>true %>
<%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:20px;",:format => 'js',:remote=>true %>
<% else %>
<%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:84px;",:format => 'js',:remote=>true %>
<% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<!--contentbox end--> <!--contentbox end-->

View File

@ -1,9 +1,9 @@
<script> <script>
$(function(){ $(function(){
$("#RSide").removeAttr("id") $("#RSide").removeAttr("id")
$("#container").css('width',"1000px") $("#container").css('width',"1000px")
}); });
function searchone4reload(fileid){ function searchone4reload(fileid){
var url = "<%= searchone4reload_course_files_path(@course)%>"; var url = "<%= searchone4reload_course_files_path(@course)%>";
var data = {};data.fileid=fileid; var data = {};data.fileid=fileid;
@ -94,7 +94,7 @@
</p> </p>
</div> </div>
<% end %> <% end %>
<div class="resources mt10" style="padding-bottom:5px;"> <div class="resources mt10 pr" style="padding-bottom:5px;">
<div class="reTop mb5"> <div class="reTop mb5">
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search",:remote=>true) do %> <%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%> <%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%>
@ -115,16 +115,26 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="re_con_top"> <div class="re_con_top">
<p class="f_l fontBlue f_b f_14">共有&nbsp;<span id="attachment_count"><%= @all_attachments.count%></span>&nbsp;个资源</p> <p class="f_l fontBlue f_b f_14" id="tip_attachment_count">
<p class="f_r" style="color: #808080" id="course_filter_order"> <%= render :partial => "files/tip_attachment_count" %>
<%= render :partial => 'course_file_filter_order', :locals => {:remote => @is_remote, :sort => @sort, :order => @order} %> </p>
</p> <p class="f_r" style="color: #808080" id="course_filter_order">
<%= render :partial => 'course_file_filter_order', :locals => {:remote => @is_remote, :sort => @sort, :order => @order} %>
</p>
</div> </div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% if !User.current.member_of_course?(@course) && show_attachment_tip(@course.id, "Course") %>
<div class="resource_tip_box fontGrey2">
<em></em>
<span></span>
<p class="mb5">私有资源:<br/>仅对本班级成员可见</p>
<p>公共资源:<br/>对所有用户可见</p>
</div>
<% end %>
</div> </div>
<div id="course_list"> <div id="course_list">
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %> <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
</div> </div>
</div> </div>
<%# html_title(l(:label_attachment_plural)) -%> <%# html_title(l(:label_attachment_plural)) -%>

View File

@ -63,7 +63,11 @@
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %> <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
<ul class="homepagePostSettiongText"> <ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li> <% if hidden_unproject_infos %>
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
<% else %>
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %></li>
<% end %>
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li> <li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
<% if file.container.try(:organization).try(:is_public?) %> <% if file.container.try(:organization).try(:is_public?) %>
<li> <li>

View File

@ -65,7 +65,7 @@
</p> </p>
</div> </div>
<% end %> <% end %>
<div class="resources mt10" style="padding-bottom:5px;"> <div class="resources mt10 pr" style="padding-bottom:5px;">
<div class="reTop mb5"> <div class="reTop mb5">
<%= form_tag( search_project_project_files_path(@project), method: 'get',:class => "re_search",:remote=>true) do %> <%= form_tag( search_project_project_files_path(@project), method: 'get',:class => "re_search",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%> <%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
@ -85,7 +85,9 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="re_con_top"> <div class="re_con_top">
<p class="f_l fontBlue f_b f_14">共有&nbsp;<span id="attachment_count"><%= @all_attachments.count%></span>&nbsp;个资源</p> <p class="f_l fontBlue f_b f_14" id="tip_attachment_count">
<%= render :partial => "files/tip_attachment_count" %>
</p>
<p class="f_r" style="color: #808080"> <p class="f_r" style="color: #808080">
<% if @order == "asc" %> <% if @order == "asc" %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %>&nbsp;/&nbsp; 按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %>&nbsp;/&nbsp;
@ -100,6 +102,14 @@
</div> </div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% if !User.current.member_of?(@project) && show_attachment_tip(@project.id, "Project") %>
<div class="resource_tip_box fontGrey2">
<em></em>
<span></span>
<p class="mb5">私有资源:<br/>仅对本项目成员可见</p>
<p>公共资源:<br/>对所有用户可见</p>
</div>
<% end %>
</div> </div>
<div id="course_list"> <div id="course_list">
<%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %> <%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %>

View File

@ -70,7 +70,11 @@
<% if @course.is_public? %> <% if @course.is_public? %>
<li> <li>
<span id="is_public_<%= file.id %>"> <span id="is_public_<%= file.id %>">
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %> <% if params[:tag_name].blank? %>
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => file.id, :newtype=>(file.is_public? ? 0:1), :course_id => @course.id), :remote=>true,:class=>"postOptionLink",:method => :post %>
<% else %>
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => file.id, :newtype=>(file.is_public? ? 0:1), :tag_name => params[:tag_name].force_encoding("UTF-8"), :course_id => @course.id, :other => params[:other]), :remote=>true,:class=>"postOptionLink",:method => :post %>
<% end %>
</span> </span>
</li> </li>
<%end%> <%end%>

View File

@ -0,0 +1,18 @@
共有&nbsp;<span id="attachment_count"><%= @tip_all_attachments %></span>&nbsp;个资源
<% if @tip_all_private_attachments != 0 %>
<span id="attachment_count_public" class="fontGrey2 ml10" style="font-weight: normal;">公共资源:<%= @tip_all_public_attachments %>个</span>
<% if @project %>
<% if !User.current.member_of?(@project) && params[:tag_name] %>
<span id="attachment_count_private" class="fontGrey2 ml10" style="font-weight: normal;">私有资源0个</span>
<% else %>
<span id="attachment_count_private" class="fontGrey2 ml10" style="font-weight: normal;">私有资源:<%= @tip_all_private_attachments %>个</span>
<% end %>
<% elsif @course %>
<% if !User.current.member_of_course?(@course) && params[:tag_name] %>
<span id="attachment_count_private" class="fontGrey2 ml10" style="font-weight: normal;">私有资源0个</span>
<% else %>
<span id="attachment_count_private" class="fontGrey2 ml10" style="font-weight: normal;">私有资源:<%= @tip_all_private_attachments %>个</span>
<% end %>
<% end %>
<% end %>

View File

@ -4,12 +4,25 @@
<% if User.current.admin? || ((is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) %> <% if User.current.admin? || ((is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) %>
<% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project") %> <% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project") %>
<ul class="homepagePostSettiongText"> <ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li> <% if hidden_unproject_infos %>
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li> <li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
<% else %>
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %></li>
<% end %>
<% if params[:tag_name].blank? %>
<li><%= link_to '更新版本',attachments_versions_path(file, :project_id => project.id), :class => "postOptionLink", :remote => true %></li>
<% else %>
<li><%= link_to '更新版本',attachments_versions_path(file, :tag_name => params[:tag_name].force_encoding("UTF-8"), :project_id => project.id, :other => params[:other]),:class => "postOptionLink",:remote=>true %></li>
<% end %>
<% if project.is_public? %> <% if project.is_public? %>
<li> <li>
<span id="is_public_<%= file.id %>"> <span id="is_public_<%= file.id %>">
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => file.id, :newtype=>(file.is_public? ? 0:1)), :remote=>true,:class=>"postOptionLink",:method => :post %> <% if params[:tag_name].blank? %>
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => file.id, :newtype=>(file.is_public? ? 0:1), :project_id => project.id), :remote=>true,:class=>"postOptionLink",:method => :post %>
<% else %>
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => file.id, :newtype=>(file.is_public? ? 0:1), :tag_name => params[:tag_name].force_encoding("UTF-8"), :project_id => project.id, :other => params[:other]), :remote=>true,:class=>"postOptionLink",:method => :post %>
<% end %>
</span> </span>
</li> </li>
<% end %> <% end %>
@ -20,7 +33,11 @@
<% end %> <% end %>
<% else %> <% else %>
<ul class="resourceSendO"> <ul class="resourceSendO">
<li><%= link_to("发&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li> <% if hidden_unproject_infos %>
<li><%= link_to("发&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
<% else %>
<li><%= link_to("发&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %></li>
<% end %>
</ul> </ul>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -1,3 +1,4 @@
$("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>"); $("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>");
$("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
$("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>");

View File

@ -1,7 +1,8 @@
<% if @course %> <% if @course %>
$("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>"); $("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>");
$("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); $("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
<% else %> <% else %>
$("#resource_list").html("<%= escape_javascript( render :partial => 'files/project_file',:locals => {project:@project, all_attachments:@all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments}) %>"); $("#resource_list").html("<%= escape_javascript( render :partial => 'files/project_file',:locals => {project:@project, all_attachments:@all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments}) %>");
$("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>'); $("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>");
$("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
<% end %> <% end %>

View File

@ -10,7 +10,7 @@
<div class="homepagePostReplyPortrait" > <div class="homepagePostReplyPortrait" >
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %>
</div> </div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=comment.id %>').hide();">
<%= render :partial => 'users/news_contents', :locals => {:comment => comment}%> <%= render :partial => 'users/news_contents', :locals => {:comment => comment}%>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>"> <div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
@ -40,7 +40,8 @@
l(:button_delete), l(:button_delete),
{:controller => 'issues',:action => 'delete_journal', :id => issue.id,:journal_id=>comment.id}, {:controller => 'issues',:action => 'delete_journal', :id => issue.id,:journal_id=>comment.id},
:method => :get, :method => :get,
:class => 'fr mr20', :id => "delete_reply_#{comment.id}",
:class => 'fr mr20 undis',
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete) :title => l(:button_delete)
) if comment.user_id == User.current.id %> ) if comment.user_id == User.current.id %>

View File

@ -0,0 +1,5 @@
<% count = @issue.journals.count %>
回复<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=@issue.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@issue, :user_activity_id=>@issue.id,:type=>"activity"}%>
</span>

View File

@ -17,5 +17,5 @@ issue_desc_editor = KindEditor.create('#issue_description',
"uploadJson":"/kindeditor/upload", "uploadJson":"/kindeditor/upload",
"fileManagerJson":"/kindeditor/filemanager"}); "fileManagerJson":"/kindeditor/filemanager"});
// $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>"); // $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>'); $(".homepagePostReplyBannerCount").html('<%= escape_javascript(render :partial => 'issues/issue_reply_banner') %>');
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%= @issue.class.name %>"); sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%= @issue.class.name %>");

View File

@ -36,7 +36,9 @@
<div class="homepagePostReply"> <div class="homepagePostReply">
<div class="topBorder" style="display: <%= @issue.journals.count>0 ? 'none': '' %>"></div> <div class="topBorder" style="display: <%= @issue.journals.count>0 ? 'none': '' %>"></div>
<div class="homepagePostReplyBanner" > <div class="homepagePostReplyBanner" >
<div class="homepagePostReplyBannerCount" >回复(<%= @issue.journals.count %></div> <div class="homepagePostReplyBannerCount">
<%=render :partial => 'issue_reply_banner' %>
</div>
<div class="homepagePostReplyBannerTime"></div> <div class="homepagePostReplyBannerTime"></div>
</div> </div>
<div class="" id="reply_div_<%= @issue.id %>" > <div class="" id="reply_div_<%= @issue.id %>" >

View File

@ -6,7 +6,7 @@ $("#issue_detail").show();
$("#issue_edit").hide(); $("#issue_edit").hide();
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>"); $("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>"); sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)') $(".homepagePostReplyBannerCount").html('<%= escape_javascript(render :partial => 'issues/issue_reply_banner') %>');
//edit里的编辑器貌似显示不出来所以手动js生成。 //edit里的编辑器貌似显示不出来所以手动js生成。
issue_desc_editor = KindEditor.create('#issue_description', issue_desc_editor = KindEditor.create('#issue_description',
{"width":"85%", {"width":"85%",

View File

@ -26,7 +26,7 @@
<%= link_to image_tag('/images/footer_logo/nudt.png',:size=>'100x30',:alt=>l(:label_co_organizer_NUDT)),"http://www.nudt.edu.cn/special.asp?classid=12", :target => "_blank" %> <%= link_to image_tag('/images/footer_logo/nudt.png',:size=>'100x30',:alt=>l(:label_co_organizer_NUDT)),"http://www.nudt.edu.cn/special.asp?classid=12", :target => "_blank" %>
</span> </span>
<span class="footer_logo_link"> <span class="footer_logo_link">
<%= link_to image_tag('/images/footer_logo/peking_eecs.png',:size=>'100x30',:alt=>l(:label_co_organizer_EECS)), "http://eecs.pku.edu.cn", :target => "_blank" %> <%= link_to image_tag('/images/footer_logo/peking_eecs.png',:size=>'100x30',:alt=>l(:label_co_organizer_EECS)), "http://www.sei.pku.edu.cn/", :target => "_blank" %>
</span> </span>
<span class="footer_logo_link"> <span class="footer_logo_link">
<%= link_to image_tag('/images/footer_logo/buaa_scse.png',:size=>'100x30',:alt=>l(:label_co_organizer_BHU)), "http://scse.buaa.edu.cn/", :target => "_blank" %> <%= link_to image_tag('/images/footer_logo/buaa_scse.png',:size=>'100x30',:alt=>l(:label_co_organizer_BHU)), "http://scse.buaa.edu.cn/", :target => "_blank" %>

View File

@ -24,7 +24,7 @@
<a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=41" class="mr45 f_grey" target="_blank"><%= l(:label_sponsor)%></a> <a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=41" class="mr45 f_grey" target="_blank"><%= l(:label_sponsor)%></a>
</li> </li>
<li class="fl mr10"> <li class="fl mr10">
<strong><%= l(:label_partners)%></strong><a href="http://eecs.pku.edu.cn" class="ml10 f_grey" target="_blank"><%= l(:label_co_organizer_EECS)%></a> <strong><%= l(:label_partners)%></strong><a href="http://www.sei.pku.edu.cn/" class="ml10 f_grey" target="_blank"><%= l(:label_co_organizer_EECS)%></a>
</li> </li>
<li class="fl"> <li class="fl">
<a href="http://scse.buaa.edu.cn/" class="mr10 f_grey" target="_blank"><%= l(:label_co_organizer_BHU)%></a> <a href="http://scse.buaa.edu.cn/" class="mr10 f_grey" target="_blank"><%= l(:label_co_organizer_BHU)%></a>

View File

@ -2,7 +2,7 @@
<% teacher_num = TeacherAndAssistantCount(@course) %> <% teacher_num = TeacherAndAssistantCount(@course) %>
<% student_num = studentCount(@course) %> <% student_num = studentCount(@course) %>
<% course_file_num = visable_attachemnts_incourse(@course).count %> <% course_file_num = visable_attachemnts_incourse(@course).count %>
<p class="sy_cgrey mb10"> <p class="sy_cgrey mb10 mr20">
<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cgrey') %> <%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cgrey') %>
&nbsp;&gt;&nbsp; &nbsp;&gt;&nbsp;
<% if @course.syllabus %> <% if @course.syllabus %>
@ -30,7 +30,16 @@
<div class="cl"></div> <div class="cl"></div>
<div class="sy_class_logo fl"> <div class="sy_class_logo fl">
<%= image_tag(url_to_avatar(@course), :width => "110", :height => "110", :alt => "班级logo") %> <div class="pr" style="width: 96px; height:96px;">
<% if is_teacher%>
<%=link_to image_tag(url_to_avatar(@course),width:"96", height: "96", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path(:course => @course.id), :remote => true%>
<div class="homepageEditProfile undis">
<%=link_to '', my_clear_user_avatar_temp_path(:course => @course.id), :class => 'homepageEditProfileIcon', :title => '点击编辑头像', :remote => true %>
</div>
<% else %>
<%= image_tag(url_to_avatar(@course), :width => "96", :height => "96", :alt => "班级logo") %>
<% end %>
</div>
</div> </div>
<div class="sy_class_id fl"> <div class="sy_class_id fl">
<p>邀 请 码<br /> <p>邀 请 码<br />
@ -54,7 +63,7 @@
</p> </p>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<p class="sy_cgrey mb10"> <p class="sy_cgrey mb5">
<span class=" mr15">主讲老师:<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cblue') %></span> <span class=" mr15">主讲老师:<%= link_to(@course.teacher.show_name, user_path(@course.teacher), :class => 'sy_cblue') %></span>
<span class=" mr15">学时:<span class="sy_cblack"><%= @course.class_period %>学时</span></span> <span class=" mr15">学时:<span class="sy_cblack"><%= @course.class_period %>学时</span></span>
<span class=" mr15">学期:<span class="sy_cblack"><%= current_time_and_term @course %></span></span> <span class=" mr15">学期:<span class="sy_cblack"><%= current_time_and_term @course %></span></span>

View File

@ -4,7 +4,9 @@
<li class="fl"><a href="<%= about_us_path %>" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li> <li class="fl"><a href="<%= about_us_path %>" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
<li class="fl"><a href="<%= agreement_path %>" class="f_grey mw20" target="_blank">服务协议</a>|</li> <li class="fl"><a href="<%= agreement_path %>" class="f_grey mw20" target="_blank">服务协议</a>|</li>
<li class="fl" style="display: none"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li> <li class="fl" style="display: none"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li>
<li class="fl"><%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|</li> <% if hidden_unproject_infos %>
<li class="fl"><%= link_to l(:label_surpport_group), "#{Setting.protocol}://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|</li>
<% end %>
<li class="fl"><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="f_grey mw20" target="_blank" ><%= l(:label_forums)%></a></li> <li class="fl"><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="f_grey mw20" target="_blank" ><%= l(:label_forums)%></a></li>
</ul> </ul>
@ -22,7 +24,7 @@
<strong><%= l(:label_partners)%></strong> <strong><%= l(:label_partners)%></strong>
</li> </li>
<li class="fl mr20"> <li class="fl mr20">
<a href="http://eecs.pku.edu.cn" class="f_grey" target="_blank"><%#= l(:label_co_organizer_EECS)%><img src="/images/footer_logo/PekingUniversity.png" width="121" height="40" style="display: inline-block;" alt="北京大学" /></a> <a href="http://www.sei.pku.edu.cn/" class="f_grey" target="_blank"><%#= l(:label_co_organizer_EECS)%><img src="/images/footer_logo/PekingUniversity.png" width="121" height="40" style="display: inline-block;" alt="北京大学" /></a>
</li> </li>
<li class="fl mr20"> <li class="fl mr20">
<a href="http://scse.buaa.edu.cn/" class="f_grey" target="_blank"><%#= l(:label_co_organizer_BHU)%><img src="/images/footer_logo/BeiHang_university.png" width="173" height="40" style="display: inline-block;" alt="北京航空航天大学" /></a> <a href="http://scse.buaa.edu.cn/" class="f_grey" target="_blank"><%#= l(:label_co_organizer_BHU)%><img src="/images/footer_logo/BeiHang_university.png" width="173" height="40" style="display: inline-block;" alt="北京航空航天大学" /></a>

View File

@ -4,7 +4,9 @@
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li> <li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank">服务协议</a>|</li> <li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank">服务协议</a>|</li>
<li class="fl" style="display: none"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li> <li class="fl" style="display: none"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li>
<li class="fl"><%= link_to l(:label_surpport_group), "javascript:void(0);", :class => "f_grey mw20", :target=>"_blank" %>|</li> <% if hidden_unproject_infos %>
<li class="fl"><%= link_to l(:label_surpport_group), "javascript:void(0);", :class => "f_grey mw20", :target=>"_blank" %>|</li>
<% end %>
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a></li> <li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a></li>
</ul> </ul>
@ -22,7 +24,7 @@
<strong><%= l(:label_partners)%></strong> <strong><%= l(:label_partners)%></strong>
</li> </li>
<li class="fl mr20"> <li class="fl mr20">
<a href="http://eecs.pku.edu.cn" class="f_grey" target="_blank"><%#= l(:label_co_organizer_EECS)%><img src="/images/footer_logo/PekingUniversity.png" width="121" height="40" style="display: inline-block;" alt="北京大学" /></a> <a href="http://www.sei.pku.edu.cn/" class="f_grey" target="_blank"><%#= l(:label_co_organizer_EECS)%><img src="/images/footer_logo/PekingUniversity.png" width="121" height="40" style="display: inline-block;" alt="北京大学" /></a>
</li> </li>
<li class="fl mr20"> <li class="fl mr20">
<a href="http://scse.buaa.edu.cn/" class="f_grey" target="_blank"><%#= l(:label_co_organizer_BHU)%><img src="/images/footer_logo/BeiHang_university.png" width="173" height="40" style="display: inline-block;" alt="北京航空航天大学" /></a> <a href="http://scse.buaa.edu.cn/" class="f_grey" target="_blank"><%#= l(:label_co_organizer_BHU)%><img src="/images/footer_logo/BeiHang_university.png" width="173" height="40" style="display: inline-block;" alt="北京航空航天大学" /></a>

View File

@ -0,0 +1,17 @@
<% all_count = @user.favorite_courses.visible.where("is_delete =?", 0).count%>
<div id="homepageLeftMenuCourses">
<ul class="user_sub_menu" id="user_courses_li">
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user,:all_count => all_count,:page => 0} %>
</ul>
</div>
<% if !courses.empty? %>
<a class="user_navmorebox" href="javascript:void(0);" id="user_hide_course" onclick="leftCourseslistChange();">
<span id="hide_show_courseicon" class="user_icons_closeclass"></span>
</a>
<% end %>
<script>
$(function() {
$('#user_hide_course').hide();
})
</script>

View File

@ -0,0 +1,17 @@
<% all_count = @user.favorite_projects.visible.count%>
<div id="homepageLeftMenuForge">
<ul class="user_sub_menu" id="user_projects_li">
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :all_count => all_count, :page => 0} %>
</ul>
</div>
<% if !projects.empty? %>
<a class="user_navmorebox" href="javascript:void(0);" id="user_hide_project" onclick="leftProjectslistChange();">
<span id="hide_show_projecticon" class="user_icons_closeclass"></span>
</a>
<% end %>
<script>
$(function() {
$('#user_hide_project').hide();
})
</script>

View File

@ -10,12 +10,17 @@
<li class="navHomepageMenu fl"> <li class="navHomepageMenu fl">
<%= link_to "资源库", user_resource_user_path(User.current, :type => 6), :class => "c_white f16 db p10" %> <%= link_to "资源库", user_resource_user_path(User.current, :type => 6), :class => "c_white f16 db p10" %>
</li> </li>
<li class="navHomepageMenu fl"> <% if hidden_unproject_infos %>
<li class="navHomepageMenu fl">
<%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%> <%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
</li> </li>
<li class="navHomepageMenu fl mr30"> <!--<li class="navHomepageMenu fl mr30">-->
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %> <!--<%#= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>-->
</li> <!--</li>-->
<li class="navHomepageMenu fl mr40">
<a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="c_white f16 db p10" > 贴吧交流</a>
</li>
<% end %>
</ul> </ul>
</div> </div>
<script> <script>

View File

@ -10,12 +10,14 @@
<li class="navHomepageMenu fl"> <li class="navHomepageMenu fl">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">资源库</a> <a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">资源库</a>
</li> </li>
<li class="navHomepageMenu fl"> <% if hidden_unproject_infos %>
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">题库</a> <li class="navHomepageMenu fl">
</li> <a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">题库</a>
<li class="navHomepageMenu fl mr30"> </li>
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">帮助中心</a> <li class="navHomepageMenu fl mr30">
</li> <a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">帮助中心</a>
</li>
<% end %>
</ul> </ul>
</div> </div>
<div class="fl" id="navHomepageSearch"> <div class="fl" id="navHomepageSearch">

View File

@ -3,6 +3,7 @@
<div class="scrollsidebar" id="scrollsidebar"> <div class="scrollsidebar" id="scrollsidebar">
<div class="side_content"> <div class="side_content">
<div class="side_list"> <div class="side_list">
<div class="qr-code-border borderBottomNone"><img src="/images/wechat/trustie_QR.jpg" width="150" style="display:block;" /> </div>
<div class="side_title"> <div class="side_title">
<a title="<%= l(:button_hide) %>" class="close_btn"> <a title="<%= l(:button_hide) %>" class="close_btn">
<span> <span>
@ -27,7 +28,7 @@
<!--白&nbsp;&nbsp;&nbsp;羽</a> http://shang.qq.com/wpa/qunwpa?idkey=4fe2d63a4527cddce038f04f0b1d728a62082074fb4a74870a5444ee1a6910ad--> <!--白&nbsp;&nbsp;&nbsp;羽</a> http://shang.qq.com/wpa/qunwpa?idkey=4fe2d63a4527cddce038f04f0b1d728a62082074fb4a74870a5444ee1a6910ad-->
<!--<p style="text-align: center"> 请加入师姐师兄答疑群</p> <p style="text-align: center"></p>--> <!--<p style="text-align: center"> 请加入师姐师兄答疑群</p> <p style="text-align: center"></p>-->
<!--<a href="mqqapi://card/show_pslcard?src_type=internal&version=1&uin=173184401&card_type=group&source=qrcode">QQ群号173184401</a>--> <!--<a href="mqqapi://card/show_pslcard?src_type=internal&version=1&uin=173184401&card_type=group&source=qrcode">QQ群号173184401</a>-->
<a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=fb938b1f6f991fc100f3d32b6ef38b7888dd4097c71d0eb8b239eaa8749a6afd"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="Trustie师姐师兄答疑群" title="Trustie师姐师兄答疑群"></a> <a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=fb938b1f6f991fc100f3d32b6ef38b7888dd4097c71d0eb8b239eaa8749a6afd"><img border="0" src="https://pub.idqqimg.com/wpa/images/group.png" alt="Trustie师姐师兄答疑群" title="Trustie师姐师兄答疑群"></a>
</div> </div>
</div> </div>
<div class="side_bottom"></div> <div class="side_bottom"></div>

View File

@ -13,7 +13,7 @@
<%= link_to image_tag('/images/footer_logo/nudt.png',:style => "width:90px;height:30px;",:alt=>l(:label_co_organizer_NUDT)),"http://www.nudt.edu.cn/special.asp?classid=12", :target => "_blank"%> <%= link_to image_tag('/images/footer_logo/nudt.png',:style => "width:90px;height:30px;",:alt=>l(:label_co_organizer_NUDT)),"http://www.nudt.edu.cn/special.asp?classid=12", :target => "_blank"%>
</li> </li>
<li class="fl mr20"> <li class="fl mr20">
<%= link_to image_tag('/images/footer_logo/peking_eecs.png',:style => "width:90px;height:30px;",:alt=>l(:label_co_organizer_EECS)), "http://eecs.pku.edu.cn", :target => "_blank"%> <%= link_to image_tag('/images/footer_logo/peking_eecs.png',:style => "width:90px;height:30px;",:alt=>l(:label_co_organizer_EECS)), "http://www.sei.pku.edu.cn/", :target => "_blank"%>
</li> </li>
<li class="fl mr20"> <li class="fl mr20">
<%= link_to image_tag('/images/footer_logo/buaa_scse.png',:style => "width:90px;height:30px;",:alt=>l(:label_co_organizer_BHU)), "http://scse.buaa.edu.cn/", :target => "_blank"%> <%= link_to image_tag('/images/footer_logo/buaa_scse.png',:style => "width:90px;height:30px;",:alt=>l(:label_co_organizer_BHU)), "http://scse.buaa.edu.cn/", :target => "_blank"%>

View File

@ -128,7 +128,7 @@
<li><a href="<%=issue_path(:id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!</a></li> <li><a href="<%=issue_path(:id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!</a></li>
<% elsif ma.forge_message_type == "Issue" && ma.status != 1 %> <% elsif ma.forge_message_type == "Issue" && ma.status != 1 %>
<li><a href="<%=issue_path(:id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%></a></li> <li><a href="<%=issue_path(:id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%></a></li>
<% elsif ma.forge_message_type == "Journal" %> <% elsif ma.forge_message_type == "Journal" && ma.forge_message %>
<li><a href="<%=issue_path(:id => ma.forge_message.journalized_id) %>" target="_blank" title="<%=ma.forge_message.user.show_name %> 更新了问题状态:<%= ma.forge_message.journalized.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.user.show_name %> </span>更新了问题状态:<%= ma.forge_message.journalized.subject%></a></li> <li><a href="<%=issue_path(:id => ma.forge_message.journalized_id) %>" target="_blank" title="<%=ma.forge_message.user.show_name %> 更新了问题状态:<%= ma.forge_message.journalized.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.user.show_name %> </span>更新了问题状态:<%= ma.forge_message.journalized.subject%></a></li>
<% elsif ma.forge_message_type == "Message" %> <% elsif ma.forge_message_type == "Message" %>
<li><a href="<%=board_message_path(ma.forge_message.board_id, ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%></a></li> <li><a href="<%=board_message_path(ma.forge_message.board_id, ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%></a></li>

View File

@ -1,9 +1,9 @@
<p style="position:relative; display:inline;"><% if syllabus.eng_name && !syllabus.eng_name.empty? %> <p style="position:relative; display:inline;"><% if syllabus.eng_name && !syllabus.eng_name.empty? %>
<span><%=syllabus.eng_name %></span> <span><%=syllabus.eng_name %></span>
<% else%> <% else%>
<span style="color: #888">课程英文名称</span> <span style="color: #888"></span>
<% end %> <% end %>
<% if User.current == syllabus.user || User.current.admin? %> <% if User.current == syllabus.user || User.current.admin? %>
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_ng_name_png", :style => "width:15px; position:absolute; right: -20px; top: 5px;", :class => "none", :onclick => "show_edit_eng_name('#{syllabus.eng_name}');"%> <%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_ng_name_png", :style => "width:15px; position:absolute; right: -20px; top: 5px;", :class => "none", :onclick => "show_edit_eng_name('#{syllabus.eng_name}');", :title => '编辑课程英文名称'%>
<% end %> <% end %>
</p> </p>

View File

@ -8,7 +8,7 @@
<li > <li >
<%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sy_teachers_img fl mr15"), user_path(teacher), :target => "_blank", :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sy_teachers_img fl mr15"), user_path(teacher), :target => "_blank", :alt => "用户头像" %>
<div class="sy_teachers_txt fl"> <div class="sy_teachers_txt fl">
<%= link_to teacher.show_name, user_path(teacher), :class => "sy_teachers_name", :target => "_blank" %> <%= link_to teacher.show_name, user_path(teacher), :class => "sy_teachers_name hidden", :target => "_blank", :title => teacher.show_name %>
<span class="sy_teachers_span"> <span class="sy_teachers_span">
<% if teacher.user_extensions && teacher.user_extensions.identity %> <% if teacher.user_extensions && teacher.user_extensions.identity %>
<%= get_user_roll teacher %> <%= get_user_roll teacher %>

View File

@ -1,5 +1,6 @@
<h2 style="position:relative; display:inline;">课程名称:<%=syllabus.title %> <h2 style="position:relative; display:inline;">
<%=syllabus.title %>
<% if User.current == syllabus.user || User.current.admin? %> <% if User.current == syllabus.user || User.current.admin? %>
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_title_png", :class => "none", :style => "width:15px; position:absolute; right: -20px; top: 15px;", :onclick => "show_edit_title('#{syllabus.title}');"%> <%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_title_png", :class => "none", :style => "width:15px; position:absolute; right: -20px; top: 15px;", :onclick => "show_edit_title('#{syllabus.title}');", :title => '编辑课程名称'%>
<% end %> <% end %>
</h2> </h2>

View File

@ -4,8 +4,11 @@
</div> </div>
<div class="fl"> <div class="fl">
<ul> <ul>
<!--<li class="navHomepageMenu fl mr40">-->
<!--<%#= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>-->
<!--</li>-->
<li class="navHomepageMenu fl mr40"> <li class="navHomepageMenu fl mr40">
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %> <a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="c_white f16 db p10" > 贴吧交流</a>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -0,0 +1,44 @@
<div>
<div><a href="javascript:hideModal();" class="box_close"></a></div>
<div class="cl"></div>
<div class="pro_new">
<h3 class="box_h3 mb10">头像设置</h3>
<div class="uppicBox">
<input type="button" class="uppic_btn" onclick="$('#upload_avatar').click();" value="浏览.."/>
<%= file_field_tag 'avatar[image]',
:id => "upload_avatar",
:style => 'display:none;',#added by young
:size => "1",
:multiple => false,
:onchange => 'addInputAvatar(this);',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:file_type => Redmine::Configuration['pic_types'].to_s,
:type_support_message => l(:error_pic_type),
:upload_path => upload_avatar_path(:format => 'js'),
:description_placeholder => nil ,# l(:label_optional_description)
:source_type => source.class.to_s,
:source_id => source.id.to_s,
:is_direct => 1
} %>
<!--<br/>-->
<!--<span>只支持jpg,png,gif,大小不超过5M</span>-->
</div>
<div class="showpicBox">
<p>预览</p>
<%= image_tag(url_to_avatar(source), :style=>"width:96px;height:96px;",:class=>"mb5 mt10",:nhname=>'avatar_image') %>
<br/>
<span >96px*96px</span> <br />
<div class="mb20"></div>
<%= image_tag(url_to_avatar(source), :style=>"width:48px;height:48px;",:class=>"mb5",:nhname=>'avatar_image') %>
<br />
<span>48px*48px</span> <br />
</div>
<div class="cl mb10"></div>
<a href="javascript:hideModal();" class=" fr grey_btn mr15 f14"> 取&nbsp;&nbsp;消</a>
<a href="<%= url_for(:controller => 'my', :action => 'save_user_avatar', :source_id => source.id, :source_type => source.class.to_s) %>" data-remote="true" class="blue_btn fr mr10 f14">确&nbsp;&nbsp;定</a>
</div><!--talknew end-->
<div class="cl"></div>
</div><!--floatbox end-->

View File

@ -52,6 +52,10 @@
</li> </li>
<% end %> <% end %>
<% if User.current == user %> <% if User.current == user %>
<li>
<%= link_to "取消收藏", cancel_or_collect_user_path(user, :course => course.id), :class => 'user_navmore_li',:target => '_blank', :remote => true %>
<div class="cl"></div>
</li>
<li> <li>
<% if count == 0 %> <% if count == 0 %>
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :course_id => course.id), :method => 'post', :class => 'user_navmore_li',:remote => true %> <%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :course_id => course.id), :method => 'post', :class => 'user_navmore_li',:remote => true %>

View File

@ -27,6 +27,10 @@
</li> </li>
<% end %> <% end %>
<% if User.current == @user %> <% if User.current == @user %>
<li>
<%= link_to "取消收藏", cancel_or_collect_user_path(user, :project => project.id), :class => 'user_navmore_li',:target => '_blank', :remote => true %>
<div class="cl"></div>
</li>
<li> <li>
<% if ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %> <% if ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count == 0 %>
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :project_id => project.id), :method => 'post',:remote => true,:class => "user_navmore_li" %> <%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :project_id => project.id), :method => 'post',:remote => true,:class => "user_navmore_li" %>

View File

@ -1,5 +1,6 @@
<%# course_model %> <%# course_model %>
<% course_file_num = visable_attachemnts_incourse(@course).count%> <%# course_file_num = visable_attachemnts_incourse(@course).count%>
<% course_file_num = Attachment.where(:container_type => "Course", :container_id => @course.id).count %>
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %> <% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% homework_num = visable_course_homework @course %> <% homework_num = visable_course_homework @course %>
@ -18,7 +19,7 @@
<%= heads_for_theme %> <%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus'%> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus'%>
<%= javascript_include_tag "course","header","attachments",'prettify' %> <%= javascript_include_tag "course","avatars","header","attachments",'prettify' %>
<!-- page specific tags --> <!-- page specific tags -->
<%= yield :header_tags -%> <%= yield :header_tags -%>
<!-- MathJax的配置 --> <!-- MathJax的配置 -->
@ -65,7 +66,7 @@
<% unless show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %> <% unless show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
<li id="sy_02" class="sy_icons_boards"> <li id="sy_02" class="sy_icons_boards">
<% count = @course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0 %> <% count = @course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0 %>
<a href="<%=course_boards_path(@course) %>">问答区<span><%=count %></span></a> <a href="<%=course_boards_path(@course) %>">讨论区<span><%=count %></span></a>
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %> <%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'sy_class_add', :title =>"#{l(:label_message_new)}") %>
</li> </li>
<% end %> <% end %>
@ -130,10 +131,13 @@
<%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %> <%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %>
<%# 课程英雄榜 %> <%# 课程英雄榜 %>
<%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %> <%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
<div class="sy_class_leftbox mb15" > <div class="sy_class_leftbox" >
<h3 class="fontGrey7">班级推荐</h3> <h3 class="fontGrey7">班级推荐</h3>
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %> <%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
</div> </div>
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @course %>
<div class="fontGrey5 mt10 ml20">访问计数 <%= @course.visits.to_i %> 自2016年5月</div>
</div><!--sy_class_l end--> </div><!--sy_class_l end-->
<div class="fl"> <div class="fl">
<%= yield %> <%= yield %>
@ -151,6 +155,9 @@
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>
</div> </div>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @course} %>
</div>
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>
</body> </body>
<script> <script>

View File

@ -13,7 +13,7 @@
<%= javascript_heads %> <%= javascript_heads %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= stylesheet_link_tag 'prettify','jquery/jquery-ui-1.9.2','css/common','css/structure','css/public','repository','css/courses','css/org','css/project', 'css/popup' %> <%= stylesheet_link_tag 'prettify','jquery/jquery-ui-1.9.2','css/common','css/structure','css/public','repository','css/courses','css/org','css/project', 'css/popup' %>
<%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%> <%= javascript_include_tag 'cookie','project',"avatars", 'organization','header','prettify','select_list_move','org'%>
<%= javascript_include_tag 'attachments' %> <%= javascript_include_tag 'attachments' %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
@ -77,17 +77,15 @@
<!--<div class="pr_info_logo fl mr10 mb5">--> <!--<div class="pr_info_logo fl mr10 mb5">-->
<!--<%#= image_tag(url_to_avatar(@organization), :width=>"60", :height=>"60", :alt=>"组织logo") %>--> <!--<%#= image_tag(url_to_avatar(@organization), :width=>"60", :height=>"60", :alt=>"组织logo") %>-->
<!--</div>--> <!--</div>-->
<div class="pr_info_logo fl fl mr10 mb5" id="homepage_portrait_image"> <div class="pr_info_logo fl fl mr10 mb5 pr" id="homepage_portrait_image">
<%= image_tag(url_to_avatar(@organization),width:"60", height: "60", :id=>'nh_user_tx') %> <% if User.current.logged? && User.current.admin_of_org?(@organization)%>
<% if User.current.logged?%> <%=link_to image_tag(url_to_avatar(@organization),width:"60", height: "60", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path(:organization => @organization.id), :remote => true%>
<% if User.current.id == @organization.creator_id%> <div class="homepageEditProfile undis">
<div id="edit_org_file_btn" class="none"> <%=link_to '', my_clear_user_avatar_temp_path(:organization => @organization.id), :remote => true, :class => 'homepageEditProfileIcon', :title => '点击编辑Logo' %>
<div class="homepageEditProfile"> </div>
<a href="<%= clear_org_avatar_temp_organization_path(@organization) %>" data-remote="true" class="homepageEditProfileIcon"></a> <% else %>
</div> <%= image_tag(url_to_avatar(@organization), :width => "60", :height => "60", :alt => "组织logo") %>
</div> <% end %>
<% end %>
<% end%>
</div> </div>
<!--<div class="orgName fl mb5 f14">组织id<%#= @organization.id %></div>--> <!--<div class="orgName fl mb5 f14">组织id<%#= @organization.id %></div>-->
<div class="orgName fl mb5 f14" title="<%= @organization.name %>"> <div class="orgName fl mb5 f14" title="<%= @organization.name %>">
@ -172,6 +170,10 @@
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>
</div> </div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @organization} %>
</div>
<script type="text/javascript"> <script type="text/javascript">
$("#courseMenu").mouseenter(function(){ $("#courseMenu").mouseenter(function(){
$("#topnav_course_menu").show(); $("#topnav_course_menu").show();

View File

@ -34,9 +34,12 @@
<%# 弹框 %> <%# 弹框 %>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div> <div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @organization} %>
</div>
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>
<%# JS提前加载 %> <%# JS提前加载 %>
<%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%> <%= javascript_include_tag 'cookie','project',"avatars", 'organization','header','prettify','select_list_move','org'%>
<%= javascript_include_tag 'attachments' %> <%= javascript_include_tag 'attachments' %>
</body> </body>
</html> </html>

View File

@ -13,7 +13,7 @@
<%= javascript_heads %> <%= javascript_heads %>
<%= heads_for_theme %> <%= heads_for_theme %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','prettify','repository' %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/structure','scm','css/public', 'css/project','css/popup','prettify','repository' %>
<%= javascript_include_tag 'cookie','project', 'header','prettify','select_list_move','attachments' %> <%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %>
<%= call_hook :view_layouts_base_html_head %> <%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags --> <!-- page specific tags -->
@ -50,7 +50,16 @@
<div id="LSide" class="fl"> <div id="LSide" class="fl">
<div class="project_info"> <div class="project_info">
<div class="pr_info_logo fl mr10 mb5"> <div class="pr_info_logo fl mr10 mb5">
<%= image_tag(url_to_avatar(@project), :width => "60", :height => "60") %> <div class="pr" style="width: 64px; height:64px;">
<% if User.current.logged? && (User.current.allowed_to?({:controller => 'projects', :action => 'settings'}, @project) || User.current.admin?)%>
<%=link_to image_tag(url_to_avatar(@project),width:"60", height: "60", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path(:project => @project.id), :remote => true%>
<div class="homepageEditProfile undis">
<%=link_to '', my_clear_user_avatar_temp_path(:project => @project.id), :remote => true, :class => 'homepageEditProfileIcon', :title => '点击编辑Logo' %>
</div>
<% else %>
<%= image_tag(url_to_avatar(@project), :width => "60", :height => "60", :alt => "项目logo") %>
<% end %>
</div>
</div> </div>
<div class="pr_info_id fl mb5 f14"> <div class="pr_info_id fl mb5 f14">
<%= l(:label_project_ivite_code)%> <%= l(:label_project_ivite_code)%>
@ -242,13 +251,17 @@
}); });
</script> </script>
</div> </div>
<% if hidden_unproject_infos %>
<%= render :partial => 'layouts/new_feedback' %>
<% end %>
<div id="fade" class="black_overlay">123</div>
<%= render :partial => 'layouts/new_feedback' %>
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>
</div> </div>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @project} %>
</div>
<%= call_hook :view_layouts_base_body_bottom %> <%= call_hook :view_layouts_base_body_bottom %>
</body> </body>
</html> </html>

View File

@ -38,7 +38,16 @@
<% end%> <% end%>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div style="width:1000px; margin: 5px auto;">
<p class="sy_cgrey">
位置:&nbsp;&nbsp;
<%= link_to User.current, user_path(User.current.id), :class => 'sy_cgrey', :target => '_blank' %>
&nbsp;&gt;&nbsp;
<%= link_to '课程', user_courselist_user_path(User.current.id), :class => "sy_cgrey", :target => '_blank' %>
&nbsp;&gt;&nbsp;
<%= link_to @syllabus.title, syllabus_path(@syllabus.id), :class => "sy_cgrey" %>
</p>
</div>
<div class="sy_contanier"> <div class="sy_contanier">
<div class="sy_top"> <div class="sy_top">
<div class="sy_top_con" onmouseover="$('#syllabus_edit_title_png').show();$('#syllabus_edit_ng_name_png').show();" onmouseout="$('#syllabus_edit_title_png').hide();$('#syllabus_edit_ng_name_png').hide();"> <!-- onmouseover="$('#syllabus_edit_title_png').show();$('#syllabus_edit_ng_name_png').show();" onmouseout="$('#syllabus_edit_title_png').hide();$('#syllabus_edit_ng_name_png').hide();" --> <div class="sy_top_con" onmouseover="$('#syllabus_edit_title_png').show();$('#syllabus_edit_ng_name_png').show();" onmouseout="$('#syllabus_edit_title_png').hide();$('#syllabus_edit_ng_name_png').hide();"> <!-- onmouseover="$('#syllabus_edit_title_png').show();$('#syllabus_edit_ng_name_png').show();" onmouseout="$('#syllabus_edit_title_png').hide();$('#syllabus_edit_ng_name_png').hide();" -->
@ -50,7 +59,7 @@
<div class="sy_con_l fl mb15"> <div class="sy_con_l fl mb15">
<%= yield %> <%= yield %>
</div><!--sy_con_l end--> </div><!--sy_con_l end-->
<div class="sy_con_r fr "> <div class="sy_con_r fr mb10">
<div class="sy_right_box" id="syllabus_base_info"> <div class="sy_right_box" id="syllabus_base_info">
<%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %> <%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %>
</div> </div>

View File

@ -298,6 +298,7 @@
<div class="cl"></div> <div class="cl"></div>
</div><!--Container end--> </div><!--Container end-->
<%= render :partial => 'layouts/new_feedback' %> <%= render :partial => 'layouts/new_feedback' %>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>

View File

@ -59,7 +59,9 @@
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/footer' %> <%= render :partial => 'layouts/footer' %>
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/new_feedback' %> <% if hidden_unproject_infos %>
<%= render :partial => 'layouts/new_feedback' %>
<% end %>
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>
</div> </div>

View File

@ -33,31 +33,31 @@
$(document).ready(function(){ $(document).ready(function(){
$("#relateProject,.relatePInfo").mouseover(function(){ $("#relateProject,.relatePInfo").mouseover(function(){
$(".relatePInfo").css("display","block"); $(".relatePInfo").css("display","block");
}) });
$("#relateProject,.relatePInfo").mouseout(function(){ $("#relateProject,.relatePInfo").mouseout(function(){
$(".relatePInfo").css("display","none"); $(".relatePInfo").css("display","none");
}) });
$(".homepagePostPortrait").mouseover(function(){ // $(".homepagePostPortrait").mouseover(function(){
onImage = true; // onImage = true;
$(this).children(".userCard").css("display","block"); // $(this).children(".userCard").css("display","block");
}) // });
$(".homepagePostPortrait").mouseout(function(){ // $(".homepagePostPortrait").mouseout(function(){
var cur = $(this); // var cur = $(this);
onImage = false; // onImage = false;
setTimeout(function(){ // setTimeout(function(){
if (onUserCard == false && onImage == false) { // if (onUserCard == false && onImage == false) {
$(cur).children(".userCard").css("display","none"); // $(cur).children(".userCard").css("display","none");
} // }
},500); // },500);
}) // });
$(".userCard").mouseover(function(){ // $(".userCard").mouseover(function(){
onUserCard = true; // onUserCard = true;
$(this).css("display","block"); // $(this).css("display","block");
}) // });
$(".userCard").mouseout(function(){ // $(".userCard").mouseout(function(){
onUserCard = false; // onUserCard = false;
$(this).css("display","none"); // $(this).css("display","none");
}) // });
$(".coursesLineGrey").mouseover(function(){ $(".coursesLineGrey").mouseover(function(){
$(this).css("color","#ffffff"); $(this).css("color","#ffffff");
}) })
@ -103,12 +103,17 @@
<div class="homepageLeft mt10" id="LSide"> <div class="homepageLeft mt10" id="LSide">
<div class="user_leftinfo mb10"> <div class="user_leftinfo mb10">
<% if User.current.logged? && User.current == @user%> <% if User.current.logged? && User.current == @user%>
<%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_user_tx'), my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true%> <div class="pr" style="width: 80px; margin:0 auto;">
<% elsif User.current.logged? %> <%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true%>
<a href="javascript:void(0)" style="cursor: default;" class="user_leftinfo_img"><%=image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_user_tx') %></a> <div class="homepageEditProfile undis">
<%=link_to '', my_clear_user_avatar_temp_path, :class => 'homepageEditProfileIcon', :remote => true, :title => '点击编辑Logo' %>
</div>
</div>
<% else %> <% else %>
<img src="images/user/male.jpg" width="74" height="74" /> <a href="javascript:void(0)" class="user_leftinfo_img" style="cursor: default">
<% end %> <%=image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_source_tx') %>
</a>
<% end %>
<% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %> <% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %>
<span class="<%= @user.user_extensions.gender == 1 ? 'user_leftinfo_female' : 'user_leftinfo_male' %> "></span> <span class="<%= @user.user_extensions.gender == 1 ? 'user_leftinfo_female' : 'user_leftinfo_male' %> "></span>
<% end %> <% end %>
@ -154,25 +159,13 @@
</div> </div>
<div class="user_leftnav "> <div class="user_leftnav ">
<% hidden_courses = Setting.find_by_name("hidden_courses") %> <% if hidden_unproject_infos %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<ul class="users_accordion mb10"> <ul class="users_accordion mb10">
<li id="user_01" class="user_icons_course"> <li id="user_01" class="user_icons_course">
<%= link_to '课程',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %> <%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %>
<% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %> <% courses = @user.favorite_courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
<% all_count = @user.courses.visible.where("is_delete =?", 0).count%> <div class="<%= courses.empty? ? 'none' : ''%>" id="homepage_left_course_list">
<div class="<%= courses.empty? ? 'none' : ''%>" > <%=render :partial => 'layouts/homepage_left_course_list', :locals => {:courses => courses} %>
<div id="homepageLeftMenuCourses">
<ul class="user_sub_menu" id="user_courses_li">
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user,:all_count => all_count,:page => 0} %>
</ul>
</div>
<% if !courses.empty? %>
<a class="user_navmorebox" href="javascript:void(0);" id="user_hide_course" onclick="leftCourseslistChange();">
<span id="hide_show_courseicon" class="user_icons_closeclass"></span>
</a>
<% end %>
</div> </div>
</li> </li>
<% if is_current_user %> <% if is_current_user %>
@ -197,19 +190,9 @@
<ul class="users_accordion mb10"> <ul class="users_accordion mb10">
<li id="user_06" class="user_icons_project"> <li id="user_06" class="user_icons_project">
<%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :id => 'user_project_list'%> <%= link_to '项目',{:controller => "users", :action => "user_projectlist", :id => @user.id}, :id => 'user_project_list'%>
<% all_count = @user.projects.visible.count%> <% projects = @user.favorite_projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%>
<% projects = @user.projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%> <div class="<%= projects.empty? ? 'none' : ''%>" id="homepage_left_project_list">
<div class="<%= projects.empty? ? 'none' : ''%>" > <%=render :partial => 'layouts/homepage_left_project_list', :locals => {:projects => projects} %>
<div id="homepageLeftMenuForge">
<ul class="user_sub_menu" id="user_projects_li">
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :all_count => all_count, :page => 0} %>
</ul>
</div>
<% if !projects.empty? %>
<a class="user_navmorebox" href="javascript:void(0);" id="user_hide_project" onclick="leftProjectslistChange();">
<span id="hide_show_projecticon" class="user_icons_closeclass"></span>
</a>
<% end %>
</div> </div>
</li> </li>
<% if is_current_user %> <% if is_current_user %>
@ -231,13 +214,17 @@
</ul> </ul>
</div><!--sy_class_leftnav end--> </div><!--sy_class_leftnav end-->
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @user %>
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> 自2016年5月</div> <div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> 自2016年5月</div>
</div> </div>
<div class="homepageRight"> <div class="homepageRight">
<%= yield %> <%= yield %>
</div> </div>
</div> </div>
<%= render :partial => 'layouts/new_feedback' %> <% if hidden_unproject_infos %>
<%= render :partial => 'layouts/new_feedback' %>
<% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/footer' %> <%= render :partial => 'layouts/footer' %>
@ -248,53 +235,10 @@
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>
</div> </div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;"> <div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<div> <%=render :partial => 'layouts/upload_avatar', :locals => {:source => @user} %>
<div><a href="javascript:hideModal();" class="box_close"></a></div>
<div class="cl"></div>
<div class="pro_new">
<h3 class="box_h3 mb10">头像设置</h3>
<div class="uppicBox">
<input type="button" class="uppic_btn" onclick="$('#upload_user_image').click();" value="浏览.."/>
<%= file_field_tag 'avatar[image]',
:id => "upload_user_image",
:style => 'display:none;',#added by young
:size => "1",
:multiple => false,
:onchange => 'addInputAvatar(this);',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:file_type => Redmine::Configuration['pic_types'].to_s,
:type_support_message => l(:error_pic_type),
:upload_path => upload_avatar_path(:format => 'js'),
:description_placeholder => nil ,# l(:label_optional_description)
:source_type => @user.class.to_s,
:source_id => @user.id.to_s
} %>
<!--<br/>-->
<!--<span>只支持jpg,png,gif,大小不超过5M</span>-->
</div>
<div class="showpicBox">
<p>预览</p>
<%= image_tag(url_to_avatar(@user), :style=>"width:96px;height:96px;",:class=>"mb5 mt10",:nhname=>'avatar_image') %>
<br/>
<span >96px*96px</span> <br />
<div class="mb20"></div>
<%= image_tag(url_to_avatar(@user), :style=>"width:48px;height:48px;",:class=>"mb5",:nhname=>'avatar_image') %>
<br />
<span>48px*48px</span> <br />
</div>
<div class="cl mb10"></div>
<a href="javascript:hideModal();" class=" fr grey_btn mr15 f14"> 取&nbsp;&nbsp;消</a>
<a href="<%= url_for(:controller => 'my', :action => 'save_user_avatar') %>" data-remote="true" class="blue_btn fr mr10 f14">确&nbsp;&nbsp;定</a>
</div><!--talknew end-->
<div class="cl"></div>
</div><!--floatbox end-->
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$('#user_hide_course').hide();
$('#user_hide_project').hide(); $('#user_hide_project').hide();
autoUrl("user_brief_introduction_show"); autoUrl("user_brief_introduction_show");
if(<%= @is_course == 1 %>) { if(<%= @is_course == 1 %>) {

View File

@ -33,34 +33,34 @@
$(document).ready(function(){ $(document).ready(function(){
$("#relateProject,.relatePInfo").mouseover(function(){ $("#relateProject,.relatePInfo").mouseover(function(){
$(".relatePInfo").css("display","block"); $(".relatePInfo").css("display","block");
}) });
$("#relateProject,.relatePInfo").mouseout(function(){ $("#relateProject,.relatePInfo").mouseout(function(){
$(".relatePInfo").css("display","none"); $(".relatePInfo").css("display","none");
}) });
$(".homepagePostPortrait").mouseover(function(){ // $(".homepagePostPortrait").mouseover(function(){
onImage = true; // onImage = true;
$(this).children(".userCard").css("display","block"); // $(this).children(".userCard").css("display","block");
}) // });
$(".homepagePostPortrait").mouseout(function(){ // $(".homepagePostPortrait").mouseout(function(){
var cur = $(this); // var cur = $(this);
onImage = false; // onImage = false;
setTimeout(function(){ // setTimeout(function(){
if (onUserCard == false && onImage == false) { // if (onUserCard == false && onImage == false) {
$(cur).children(".userCard").css("display","none"); // $(cur).children(".userCard").css("display","none");
} // }
},500); // },500);
}) // });
$(".userCard").mouseover(function(){ // $(".userCard").mouseover(function(){
onUserCard = true; // onUserCard = true;
$(this).css("display","block"); // $(this).css("display","block");
}) // });
$(".userCard").mouseout(function(){ // $(".userCard").mouseout(function(){
onUserCard = false; // onUserCard = false;
$(this).css("display","none"); // $(this).css("display","none");
}) // });
$(".coursesLineGrey").mouseover(function(){ $(".coursesLineGrey").mouseover(function(){
$(this).css("color","#ffffff"); $(this).css("color","#ffffff");
}) });
$(".coursesLineGrey").mouseout(function(){ $(".coursesLineGrey").mouseout(function(){
$(this).css("color","#808080"); $(this).css("color","#808080");
}); });
@ -152,9 +152,7 @@
</div> </div>
<div class="user_leftnav "> <div class="user_leftnav ">
<% hidden_courses = Setting.find_by_name("hidden_courses") %> <% if hidden_unproject_infos %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<ul class="users_accordion mb10"> <ul class="users_accordion mb10">
<li id="user_01" class="user_icons_course"> <li id="user_01" class="user_icons_course">
<a href ="javascript:void(0);" disabled="true">课程</a> <a href ="javascript:void(0);" disabled="true">课程</a>
@ -233,7 +231,9 @@
<%= yield %> <%= yield %>
</div> </div>
</div> </div>
<%= render :partial => 'layouts/forbidden_new_feedback' %> <% if hidden_unproject_infos %>
<%= render :partial => 'layouts/forbidden_new_feedback' %>
<% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<%= render :partial => 'layouts/footer_show' %> <%= render :partial => 'layouts/footer_show' %>

View File

@ -42,7 +42,6 @@
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText"> <ul class="homepagePostSettiongText">
<% if @topic.author.id == User.current.id %>
<li> <li>
<%= link_to( <%= link_to(
l(:button_edit), l(:button_edit),
@ -59,7 +58,6 @@
:class => 'postOptionLink' :class => 'postOptionLink'
) if @message.course_destroyable_by?(User.current) %> ) if @message.course_destroyable_by?(User.current) %>
</li> </li>
<% end %>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %></li> <li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %></li>
</ul> </ul>
</li> </li>
@ -109,7 +107,7 @@
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div> </div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=reply.id %>').show();" onmouseout="$('#delete_reply_<%=reply.id %>').hide();">
<%= render :partial => 'users/message_contents', :locals => {:comment => reply}%> <%= render :partial => 'users/message_contents', :locals => {:comment => reply}%>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>"> <div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
@ -134,7 +132,8 @@
l(:button_delete), l(:button_delete),
{:action => 'destroy', :id => reply}, {:action => 'destroy', :id => reply},
:method => :post, :method => :post,
:class => 'fr mr20', :id => "delete_reply_#{reply.id}",
:class => 'fr mr20 undis',
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete) :title => l(:button_delete)
) if reply.course_destroyable_by?(User.current) %> ) if reply.course_destroyable_by?(User.current) %>

View File

@ -104,19 +104,20 @@
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText"> <ul class="homepagePostSettiongText">
<li>
<li> <%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'postOptionLink') if @message.editable_by?(User.current) %>
<%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'postOptionLink') if @message.editable_by?(User.current) %> </li>
</li> <li>
<% if @topic.author.id == User.current.id %> <%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic},:method => :post,
<li> :data => {:confirm => l(:text_are_you_sure)},
<%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic},:method => :post, :class => 'postOptionLink'
:data => {:confirm => l(:text_are_you_sure)}, ) if @message.destroyable_by?(User.current) %>
:class => 'postOptionLink' </li>
) if @message.destroyable_by?(User.current) %> <% if hidden_unproject_infos %>
</li> <li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %></li>
<% else %>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send_hidden(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %></li>
<% end %> <% end %>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -170,7 +171,7 @@
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %> <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div> </div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=reply.id %>').show();" onmouseout="$('#delete_reply_<%=reply.id %>').hide();">
<%= render :partial => 'users/message_contents', :locals => {:comment => reply}%> <%= render :partial => 'users/message_contents', :locals => {:comment => reply}%>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>"> <div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
@ -195,10 +196,11 @@
l(:button_delete), l(:button_delete),
{:action => 'destroy', :id => reply}, {:action => 'destroy', :id => reply},
:method => :post, :method => :post,
:class => 'fr mr20', :id => "delete_reply_#{reply.id}",
:class => 'fr mr20 undis',
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete) :title => l(:button_delete)
) if reply.course_destroyable_by?(User.current) %> ) if reply.destroyable_by?(User.current) %>
</span> </span>
<div class="cl"></div> <div class="cl"></div>

View File

@ -1,4 +1,4 @@
$("img[nhname='avatar_image']").attr('src',$("#nh_user_tx").attr('src')); $("img[nhname='avatar_image']").attr('src',$("#nh_source_tx").attr('src'));
$('#ajax-modal').html($("#nh_tx_dialog_html").html()); $('#ajax-modal').html($("#nh_tx_dialog_html").html());
showModal('ajax-modal','460px'); showModal('ajax-modal','460px');
$('#ajax-modal').siblings().hide(); $('#ajax-modal').siblings().hide();

View File

@ -1,3 +1,24 @@
$("#nh_user_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_tx',:style=>"width:78px;height:78px;overflow:hidden",:alt=>"头像") %>'); <% if @user %>
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_source_tx',:style=>"width:78px;height:78px;overflow:hidden",:alt=>"头像") %>');
$("#nh_user_logo").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_logo',:width =>"40",:height => "40",:alt=>"头像") %>'); $("#nh_user_logo").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_logo',:width =>"40",:height => "40",:alt=>"头像") %>');
<% elsif @course %>
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@course), :id=>'nh_source_tx',:style=>"width:96px;height:96px;overflow:hidden",:alt=>"班级logo") %>');
if($("#course_avatar_form").length > 0) {
window.location.href = "<%=settings_course_path(@course) %>";
}
<% elsif @project %>
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@project), :id=>'nh_source_tx',:style=>"width:60px;height:60px;overflow:hidden",:alt=>"项目logo") %>');
if($("#project_avatar_form").length > 0) {
window.location.href = "<%=settings_project_path(@project) %>";
}
<% elsif @organization %>
<% if @organization.show_mode == 1 %>
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@organization), :id=>'nh_source_tx',:style=>"width:51px;height:51px;overflow:hidden",:alt=>"组织logo") %>');
<% else %>
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@organization), :id=>'nh_source_tx',:style=>"width:60px;height:60px;overflow:hidden",:alt=>"组织logo") %>');
<% end %>
if($("#org_avatar_form").length > 0) {
window.location.href = "<%=setting_organization_path(@organization) %>";
}
<% end %>
hideModal(); hideModal();

View File

@ -82,7 +82,7 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="homepagePostReply"> <div class="homepagePostReply">
<%= render :partial => 'news/news_all_replies' %> <%= render :partial => 'news/news_all_replies', :locals => {:object => @course} %>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -19,7 +19,7 @@
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %> <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div> </div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=comment.id %>').hide();">
<%= render :partial => 'users/news_contents', :locals => {:comment => comment}%> <%= render :partial => 'users/news_contents', :locals => {:comment => comment}%>
<% if !comment.content_detail.blank? %> <% if !comment.content_detail.blank? %>
@ -47,10 +47,11 @@
:action => 'destroy', :id => @news, :action => 'destroy', :id => @news,
:comment_id => comment}, :comment_id => comment},
:method => :delete, :method => :delete,
:class => 'fr mr20', :id => "delete_reply_#{comment.id}",
:class => 'fr mr20 undis',
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete) :title => l(:button_delete)
) if @news.author == User.current %> ) if User.current.allowed_to?(:manage_news, object) %>
</span> </span>
<div class="cl"></div> <div class="cl"></div>
</div> </div>

View File

@ -26,7 +26,11 @@
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText"> <ul class="homepagePostSettiongText">
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{@news.id}','#{User.current.id}','news')") %></li> <% if hidden_unproject_infos %>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{@news.id}','#{User.current.id}','news')") %></li>
<% else %>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{@news.id}','#{User.current.id}','news')") %></li>
<% end %>
<li> <li>
<%= link_to( <%= link_to(
l(:button_edit), l(:button_edit),
@ -82,7 +86,7 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="homepagePostReply"> <div class="homepagePostReply">
<%= render :partial => 'news/news_all_replies' %> <%= render :partial => 'news/news_all_replies', :locals => {:object => @project} %>
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -102,7 +102,7 @@
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %> <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div> </div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id%>').show();" onmouseout="$('#delete_reply_<%=comment.id%>').hide();">
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%> <%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
<% if !comment.content_detail.blank? %> <% if !comment.content_detail.blank? %>
@ -129,7 +129,8 @@
l(:button_delete), l(:button_delete),
{:controller => 'org_document_comments',:action => 'delete_reply', :id => comment.id}, {:controller => 'org_document_comments',:action => 'delete_reply', :id => comment.id},
:method => :delete, :method => :delete,
:class => 'fr mr20', :id => "delete_reply_#{comment.id}",
:class => 'fr mr20 undis',
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)) %> :title => l(:button_delete)) %>
<% end %> <% end %>

Some files were not shown because too many files have changed in this diff Show More