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

Conflicts:
	public/stylesheets/css/common.css
This commit is contained in:
cxt 2017-01-06 15:06:22 +08:00
commit cc4d46c3ee
47 changed files with 1644 additions and 466 deletions

View File

@ -75,15 +75,9 @@ module Mobile
authenticate!
subscribe = 0 #默认未关注
#-------------------获取用户是否关注此公众号-----------------------------
openid = session[:wechat_openid]
raise "无法获取到openid,请在微信中打开本页面" unless openid
user_info = Wechat.api.user(openid)
Rails.logger.info "user_info!!!!!!!!!"
Rails.logger.info user_info
subscribe = user_info["subscribe"]
## 能进来的就是已关注
## 因为取消订阅的记录被删除了
subscribe = 1 #默认未关注
status = 0
tip = 0 #0班级1项目

View File

@ -35,11 +35,11 @@ class UsersController < ApplicationController
#
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list,
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :unsolved_issues_list, :unfinished_homework_list, :user_manage_homeworks,
:unfinished_poll_list, :user_homeworks,:student_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
:anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
:anonymous_evaluation_list,:unfinished_test_list, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :user_receive_homeworks,
:unapproval_applied_list, :activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,:user_contestlist,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,:user_contestlist, :user_manage_issues, :user_receive_issues,
:user_courses4show,:user_projects4show,:user_contests4show,: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,
:sort_project_list,:my_homeworks,:manage_or_receive_homeworks,:search_m_r_homeworks, :cancel_or_collect,:expand_courses,:homepage, :user_issues, :course_community, :project_community, :contest_community]
@ -150,6 +150,98 @@ class UsersController < ApplicationController
end
end
# 我发布的issue
def user_manage_issues
@manage_issues = "我发布的Issue"
# 排序(默认以更新时间降序)
order = "updated_on desc"
if params[:reorder_release_time]
order = "created_on #{params[:reorder_release_time]}"
elsif params[:reorder_turnover_time]
order = "updated_on #{params[:reorder_turnover_time]}"
end
@subject = params[:subject]
params[:assigned_to_id].to_i == 0 ? @assigned_to = nil : @assigned_to = params[:assigned_to_id].to_i
params[:author_id].to_i == 0 ? author_id = nil : author_id = params[:author_id].to_i
params[:project_id].to_i == 0 ? @project_id = nil : @project_id = params[:project_id]
if @project_id.nil?
@issues = Issue.where("author_id =? and subject like ?",
@user.id, "%#{@subject}%").order(order)
else
@issues = Issue.where("author_id =? and project_id=? and subject like ?",
@user.id, @project_id, "%#{@subject}%").order(order)
end
@issues_filter = Issue.where("author_id =?", @user.id).order('updated_on desc')
@issue_open_count = Issue.where(:author_id => @user.id, :status_id => [1, 2, 3, 4, 6]).count
@issue_close_count = Issue.where(:author_id => @user.id, :status_id => 5).count
# 导出excel的issues
@excel_issues = @issues
@issue_count = @issues.count
@limit = 10
@is_remote = true
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
@offset ||= @issue_pages.offset
@issues = paginateHelper @issues, @limit
# @issues.limit(@issue_pages.per_page).offset(@issue_pages.offset).reorder(order).all
respond_to do |format|
format.html{render :layout => 'static_base'}
format.xls{
filename = "我发布的_#{l(:label_issue_list_xls)}.xls"
send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
format.api
format.js
end
end
# 我收到的issue
def user_receive_issues
@receive_issues = "我收到的Issue"
# 排序(默认以更新时间降序)
order = "updated_on desc"
if params[:reorder_release_time]
order = "created_on #{params[:reorder_release_time]}"
elsif params[:reorder_turnover_time]
order = "updated_on #{params[:reorder_turnover_time]}"
end
@subject = params[:subject]
params[:assigned_to_id].to_i == 0 ? @assigned_to = nil : @assigned_to = params[:assigned_to_id].to_i
params[:author_id].to_i == 0 ? author_id = nil : author_id = params[:author_id].to_i
params[:project_id].to_i == 0 ? @project_id = nil : @project_id = params[:project_id]
if @project_id.nil?
@issues = Issue.where("assigned_to_id =? and subject like ?",
@user.id, "%#{@subject}%").order(order)
else
@issues = Issue.where("assigned_to_id =? and project_id=? and subject like ?",
@user.id, @project_id, "%#{@subject}%").order(order)
end
@issues_filter = Issue.where("assigned_to_id =?", @user.id).order('updated_on desc')
@issue_open_count = Issue.where(:assigned_to_id => @user.id, :status_id => [1, 2, 3, 4, 6]).count
@issue_close_count = Issue.where(:assigned_to_id => @user.id, :status_id => 5).count
# 导出excel的issues
@excel_issues = @issues
@issue_count = @issues.count
@limit = 10
@is_remote = true
@issue_pages = Paginator.new @issue_count, @limit, params['page'] || 1
@offset ||= @issue_pages.offset
@issues = paginateHelper @issues, @limit
# @issues.limit(@issue_pages.per_page).offset(@issue_pages.offset).reorder(order).all
respond_to do |format|
format.html{render :layout => 'static_base'}
format.xls{
filename = "我发布的_#{l(:label_issue_list_xls)}.xls"
send_data(issue_list_xls(@excel_issues), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
format.api
format.js
end
end
#展开所有回复
def show_all_replies
case params[:type]
@ -1738,6 +1830,72 @@ class UsersController < ApplicationController
end
end
# 用户发布的作业
def user_manage_homeworks
@manage_homeworks = "我发布的作业"
@order,@b_sort,@type = params[:order] || "created_at",params[:sort] || "desc", 1
@r_sort = @b_sort == "desc" ? "asc" : "desc"
@type = @type.to_i
tea_courses = @user.courses.visible.not_deleted.select{|course| @user.has_teacher_role(course)}
tea_course_ids = tea_courses.empty? ? "(-1)" : "(" + tea_courses.map{|course| course.id}.join(',') + ")"
@homeworks = HomeworkCommon.where("course_id in #{tea_course_ids}").order("#{@order} #{@b_sort}")
if params[:property]
all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
if params[:property] == "1"
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1")
elsif params[:property] == "2"
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2")
elsif params[:property] == "3"
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3")
end
end
@limit = 10
@is_remote = true
@hw_count = @homeworks.count
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
@offset ||= @hw_pages.offset
@homeworks = paginateHelper @homeworks,@limit
@search = ""
@property = params[:property]
respond_to do |format|
format.js
format.html {render :layout => 'static_base'}
end
end
# 用户收到的作业
def user_receive_homeworks
@receive_homeworks = "我收到的作业"
@order,@b_sort,@type = params[:order] || "created_at",params[:sort] || "desc", 2
@r_sort = @b_sort == "desc" ? "asc" : "desc"
@type = @type.to_i
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
@homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
if params[:property]
all_homework_ids = @homeworks.empty? ? "(-1)" : "(" + @homeworks.map{|h| h.id}.join(",") + ")"
if params[:property] == "1"
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 1")
elsif params[:property] == "2"
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 2")
elsif params[:property] == "3"
@homeworks = HomeworkCommon.find_by_sql("select * from homework_commons where id in #{all_homework_ids} and homework_type = 3")
end
end
@limit = 10
@is_remote = true
@hw_count = @homeworks.count
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
@offset ||= @hw_pages.offset
@homeworks = paginateHelper @homeworks,@limit
@search = ""
@property = params[:property]
respond_to do |format|
format.js
format.html {render :layout => 'static_base'}
end
end
#我管理/收到的作业
def manage_or_receive_homeworks
@order,@b_sort,@type = params[:order] || "created_at",params[:sort] || "desc",params[:type] || 1

View File

@ -515,8 +515,8 @@ class WechatsController < ActionController::Base
private
def get_openid_from_code(code)
if code =='only-for-test'
openid = 'o3ss_wHOOnHkz1khBJxH8RF4SfPY'
if code =='test'
openid = 'orgVLv8TlS6e7FDiI6xdTGHRaaRo'
session[:wechat_openid] = openid
return openid
end
@ -545,6 +545,8 @@ class WechatsController < ActionController::Base
return openid
end
## 能进来的就是已关注
## 因为取消订阅的记录被删除了
def user_binded?(openid)
uw = UserWechat.where(openid: openid).first
if uw && uw.bindtype == 0

View File

@ -1,16 +1,14 @@
#coding=utf-8
require "base64"
require 'zip'
class ZipdownController < ApplicationController
#查找项目(课程)
before_filter :find_project_by_bid_id, :only => [:assort]
#检查权限
#勿删 before_filter :authorize, :only => [:assort,:download_user_homework]
SAVE_FOLDER = "#{Rails.root}/files"
OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip"
MAX_PATH = 50
## 200M
MAX_DOWN_SIZE = 200 * 1024 * 1024
include ZipService
#统一下载功能
def download
@ -35,34 +33,21 @@ class ZipdownController < ApplicationController
if params[:obj_class] == "Bid"
bid = Bid.find params[:obj_id]
render_403 if User.current.allowed_to?(:as_teacher,bid.courses.first)
file_count = 0
bid.homeworks.map { |homework| file_count += homework.attachments.count}
if file_count > 0
zipfile = zip_bid bid
else
zipfile = {:message => "no file"}
end
zipfile = checkfileSize(bid.homeworks) {
zip_bid bid
}
elsif params[:obj_class] == "HomeworkCommon"
homework = HomeworkCommon.find params[:obj_id]
render_403 if User.current.allowed_to?(:as_teacher,homework.course)
file_count = 0
homework.student_works.map { |work| file_count += work.attachments.count}
if file_count > 0
zipfile = zip_homework_common homework
else
zipfile = {:message => "no file"}
end
zipfile = checkfileSize(homework.student_works) {
zip_homework_common homework
}
elsif params[:obj_class] == "Work"
homework = Work.find params[:obj_id]
render_403 if User.current.admin_of_contest?(homework.contest)
file_count = 0
homework.contestant_works.map { |work| file_count += work.attachments.count}
if file_count > 0
zipfile = zip_homework_common homework
else
zipfile = {:message => "no file"}
end
zipfile = checkfileSize(homework.contestant_works) {
zip_homework_common homework
}
else
logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!"
end
@ -98,7 +83,6 @@ class ZipdownController < ApplicationController
end
private
#通过作业Id找到项目课程
def find_project_by_bid_id
obj_class = params[:obj_class]
@ -110,275 +94,23 @@ class ZipdownController < ApplicationController
end
end
def zip_bid(bid)
# Todo: User Access Controll
bid_homework_path = []
digests = []
bid.homeworks.each do |homeattach|
unless homeattach.attachments.empty?
out_file = zip_homework_by_user(homeattach)
bid_homework_path << out_file.file_path
digests << out_file.file_digest
end
end
homework_id = bid.id
user_id = bid.author_id
out_file = find_or_pack(homework_id, user_id, digests.sort){
zipping("#{Time.now.to_i}_#{bid.name}.zip",
bid_homework_path, OUTPUT_FOLDER)
}
[{files:[out_file.file_path], count: 1, index: 1,
real_file: out_file.file_path,
file: File.basename(out_file.file_path),
base64file: encode64(File.basename(out_file.file_path)),
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
}]
end
def encode64(str)
Base64.urlsafe_encode64(str)
end
def decode64(str)
Base64.urlsafe_decode64(str)
end
def zip_homework_common homework_common
bid_homework_path = []
digests = []
homework_common.student_works.each do |work|
unless work.attachments.empty?
out_file = zip_student_work_by_user(work)
bid_homework_path << out_file.file_path
digests << out_file.file_digest
end
end
homework_id = homework_common.id
user_id = homework_common.user_id
out_file = find_or_pack(homework_id, user_id, digests.sort){
zipping("#{Time.now.to_i}_#{homework_common.name}.zip",
bid_homework_path, OUTPUT_FOLDER)
}
[{files:[out_file.file_path], count: 1, index: 1,
real_file: out_file.file_path,
file: File.basename(out_file.file_path),
base64file: encode64(File.basename(out_file.file_path)),
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
}]
end
def zip_contest_work homework_common
bid_homework_path = []
digests = []
homework_common.contestant_works.each do |work|
unless work.attachments.empty?
out_file = zip_student_work_by_user(work)
bid_homework_path << out_file.file_path
digests << out_file.file_digest
end
end
homework_id = homework_common.id
user_id = homework_common.user_id
out_file = find_or_pack(homework_id, user_id, digests.sort){
zipping("#{Time.now.to_i}_#{homework_common.name}.zip",
bid_homework_path, OUTPUT_FOLDER)
}
[{files:[out_file.file_path], count: 1, index: 1,
real_file: out_file.file_path,
file: File.basename(out_file.file_path),
base64file: encode64(File.basename(out_file.file_path)),
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
}]
end
def zip_homework_by_user(homework_attach)
homeworks_attach_path = []
not_exist_file = []
# 需要将所有homework.attachments遍历加入zip
digests = []
homework_attach.attachments.each do |attach|
if File.exist?(attach.diskfile)
homeworks_attach_path << attach.diskfile
digests << attach.digest
else
not_exist_file << attach.filename
digests << 'not_exist_file'
end
end
out_file = find_or_pack(homework_attach.bid_id, homework_attach.user_id, digests.sort){
zipping("#{homework_attach.user.show_name}_#{((homework_attach.user.user_extensions.nil? || homework_attach.user.user_extensions.student_id.nil?) ? "" : homework_attach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
}
end
def make_zip_name(work)
"#{work.user.show_name}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}"
end
def zip_student_work_by_user(work)
homeworks_attach_path = []
not_exist_file = []
# 需要将所有homework.attachments遍历加入zip
digests = []
def checkfileSize(works)
file_count = 0
file_size = 0
works.each do |work|
file_count += work.attachments.count
work.attachments.each do |attach|
if File.exist?(attach.diskfile)
homeworks_attach_path << attach.diskfile
digests << attach.digest
file_size += attach.filesize
end
end
if file_size > MAX_DOWN_SIZE
{err: -1, message: 'file size to large'}
elsif file_count > 0
yield if block_given?
else
not_exist_file << attach.filename
digests << 'not_exist_file'
{err: -2, :message => "no file"}
end
end
#单个文件的话,不需要压缩,只改名
out_file = nil
if homeworks_attach_path.size == 1
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work)}_#{File.basename(homeworks_attach_path.first)}"
FileUtils.cp homeworks_attach_path.first, des_path
des_path
}
else
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
zipping("#{make_zip_name(work)}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
}
end
out_file
end
def zip_student_work_by_user(work)
homeworks_attach_path = []
not_exist_file = []
# 需要将所有homework.attachments遍历加入zip
digests = []
work.attachments.each do |attach|
if File.exist?(attach.diskfile)
homeworks_attach_path << attach.diskfile
digests << attach.digest
else
not_exist_file << attach.filename
digests << 'not_exist_file'
end
end
#单个文件的话,不需要压缩,只改名
out_file = nil
if homeworks_attach_path.size == 1
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work)}_#{File.basename(homeworks_attach_path.first)}"
FileUtils.cp homeworks_attach_path.first, des_path
des_path
}
else
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
zipping("#{make_zip_name(work)}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
}
end
out_file
end
def find_or_pack(homework_id, user_id, digests)
raise "please given a pack block" unless block_given?
out_file = ZipPack.packed?(homework_id, user_id, digests.sort)
unless out_file && out_file.file_valid?
file = yield
ZipPack.where(homework_id: homework_id,
user_id: user_id).delete_all
out_file = ZipPack.create(homework_id: homework_id,
user_id: user_id,
file_digest: Trustie::Utils.digest(file),
file_path: file,
pack_size: File.size(file),
file_digests: digests.join(',')
)
else
out_file.pack_times = out_file.pack_times + 1
out_file.save
end
out_file
end
def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[])
rename_zipfile = zip_name_refer ||= "#{Time.now.to_i.to_s}.zip"
# 文件名过长
if rename_zipfile.size > MAX_PATH
rename_zipfile = rename_zipfile[0,rename_zipfile.size-4][0,MAX_PATH-4] + rename_zipfile[-4,4]
end
zipfile_name = "#{output_path}/#{rename_zipfile}"
Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
files_paths.each do |filename|
rename_file = File.basename(filename)
rename_file = filename_to_real( File.basename(filename)) if is_attachment
begin
zipfile.add(rename_file, filename)
rescue Exception => e
zipfile.get_output_stream('FILE_NOTICE.txt'){|os| os.write l(:label_file_exist)}
next
end
end
unless not_exist_file.empty?
zipfile.get_output_stream('FILE_LOST.txt'){|os| os.write l(:label_file_lost) + not_exist_file.join(',').to_s}
end
end
zipfile_name
end
# 合理分配文件打包
# 如果小于 pack_attachment_max_size, 则返回单个文件
# 反之则切分为多个文件组返回
def split_pack_files(files, pack_attachment_max_size)
max_size = 0
last_files = []
ret_files = []
files.each_with_index do |f,i|
if (max_size += File.size(f)) > pack_attachment_max_size
max_size = 0
if last_files.empty? #如果单个文件超过大小,也将此文件作为一组
ret_files << {files: [f], count: 1, index: ret_files.count+1}
last_files.clear
else
ret_files << {files:last_files, count: last_files.count, index: ret_files.count+1}
last_files.clear
redo
end
else
last_files << f
end
end
ret_files << {files:last_files, count: last_files.count, index: ret_files.count+1} unless last_files.empty?
ret_files
end
def detect_content_type(name)
content_type = Redmine::MimeType.of(name)
content_type.to_s
end
def filename_to_real(name)
attach = Attachment.find_by_disk_filename(name)
attach.filename
end
end

View File

@ -1348,6 +1348,14 @@ module ApplicationHelper
title << @course_community
elsif !@contest_community.blank?
title << @contest_community
elsif !@manage_issues.blank?
title << @manage_issues
elsif !@receive_issues.blank?
title << @receive_issues
elsif !@manage_homeworks.blank?
title << @manage_homeworks
elsif !@receive_homeworks.blank?
title << @receive_homeworks
else
title << @user.try(:realname)
end
@ -2920,6 +2928,20 @@ module ApplicationHelper
@user_course_total = @my_joined_course_count + @my_course_count
end
# 用户发布的作业数
def user_manage_homework_count
tea_courses = @user.courses.visible.not_deleted.select{|course| @user.has_teacher_role(course)}
tea_course_ids = tea_courses.map{|course| course.id}
@manage_homeworks = HomeworkCommon.where(:course_id => tea_course_ids).count
end
# 用户收到的作业数
def user_receive_homework_count
stu_courses = @user.courses.visible.not_deleted.select{|course| @user.has_student_role(course)}
stu_course_ids = stu_courses.empty? ? "(-1)" : "(" + stu_courses.map{|course| course.id}.join(',') + ")"
@homeworks = HomeworkCommon.where("course_id in #{stu_course_ids} and publish_time <= '#{Date.today}'").count
end
# 用户发布的issue数
def issues_author_is_self_count
@issues = Issue.where( :author_id => @user.id )

View File

@ -130,7 +130,7 @@ module IssuesHelper
end
def options_for_version_isuue_list(project)
versions = Version.where(:project_id => project, :status => "open").map{|version| [version.name, version.id]}.unshift(["里程碑", 0])
versions = Version.where(:project_id => project, :status => "open").order("created_on desc").map{|version| [version.name, version.id]}.unshift(["里程碑", 0])
end
def render_issue_subject_with_tree(issue)

View File

@ -203,7 +203,7 @@ class Memo < ActiveRecord::Base
end
def destroyable_by? user
(user && self.author == user) || user.admin?
(user && self.author == user) || user.admin? || self.forum.creator == user
#self.author == user || user.admin?
end

View File

@ -235,6 +235,8 @@ class News < ActiveRecord::Base
vs << {course_message_type:'News',course_message_id:self.id, :user_id => m.user_id,
:course_id => self.course_id, :viewed => false}
#delayed_job卡住的原因是一次执行的条数太多导致超时。
#现在把每次只执行不超过30条就不会超了。
if vs.size >= 30
self.delay.contain_news_message(vs)
vs.clear

281
app/services/zip_service.rb Normal file
View File

@ -0,0 +1,281 @@
require "base64"
require 'zip'
module ZipService
SAVE_FOLDER = "#{Rails.root}/files"
OUTPUT_FOLDER = "#{Rails.root}/files/archiveZip"
MAX_PATH = 50
def zip_bid(bid)
# Todo: User Access Controll
bid_homework_path = []
digests = []
bid.homeworks.each do |homeattach|
unless homeattach.attachments.empty?
out_file = zip_homework_by_user(homeattach)
bid_homework_path << out_file.file_path
digests << out_file.file_digest
end
end
homework_id = bid.id
user_id = bid.author_id
out_file = find_or_pack(homework_id, user_id, digests.sort){
zipping("#{Time.now.to_i}_#{bid.name}.zip",
bid_homework_path, OUTPUT_FOLDER)
}
[{files:[out_file.file_path], count: 1, index: 1,
real_file: out_file.file_path,
file: File.basename(out_file.file_path),
base64file: encode64(File.basename(out_file.file_path)),
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
}]
end
def encode64(str)
Base64.urlsafe_encode64(str)
end
def decode64(str)
Base64.urlsafe_decode64(str)
end
def zip_homework_common homework_common
bid_homework_path = []
digests = []
homework_common.student_works.each do |work|
unless work.attachments.empty?
out_file = zip_student_work_by_user(work)
bid_homework_path << out_file.file_path
digests << out_file.file_digest
end
end
homework_id = homework_common.id
user_id = homework_common.user_id
out_file = find_or_pack(homework_id, user_id, digests.sort){
zipping("#{Time.now.to_i}_#{homework_common.name}.zip",
bid_homework_path, OUTPUT_FOLDER)
}
[{files:[out_file.file_path], count: 1, index: 1,
real_file: out_file.file_path,
file: File.basename(out_file.file_path),
base64file: encode64(File.basename(out_file.file_path)),
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
}]
end
def zip_contest_work homework_common
bid_homework_path = []
digests = []
homework_common.contestant_works.each do |work|
unless work.attachments.empty?
out_file = zip_student_work_by_user(work)
bid_homework_path << out_file.file_path
digests << out_file.file_digest
end
end
homework_id = homework_common.id
user_id = homework_common.user_id
out_file = find_or_pack(homework_id, user_id, digests.sort){
zipping("#{Time.now.to_i}_#{homework_common.name}.zip",
bid_homework_path, OUTPUT_FOLDER)
}
[{files:[out_file.file_path], count: 1, index: 1,
real_file: out_file.file_path,
file: File.basename(out_file.file_path),
base64file: encode64(File.basename(out_file.file_path)),
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
}]
end
def zip_homework_by_user(homework_attach)
homeworks_attach_path = []
not_exist_file = []
# 需要将所有homework.attachments遍历加入zip
digests = []
homework_attach.attachments.each do |attach|
if File.exist?(attach.diskfile)
homeworks_attach_path << attach.diskfile
digests << attach.digest
else
not_exist_file << attach.filename
digests << 'not_exist_file'
end
end
out_file = find_or_pack(homework_attach.bid_id, homework_attach.user_id, digests.sort){
zipping("#{homework_attach.user.show_name}_#{((homework_attach.user.user_extensions.nil? || homework_attach.user.user_extensions.student_id.nil?) ? "" : homework_attach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
}
end
def make_zip_name(work)
"#{work.user.show_name}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}"
end
def zip_student_work_by_user(work)
homeworks_attach_path = []
not_exist_file = []
# 需要将所有homework.attachments遍历加入zip
digests = []
work.attachments.each do |attach|
if File.exist?(attach.diskfile)
homeworks_attach_path << attach.diskfile
digests << attach.digest
else
not_exist_file << attach.filename
digests << 'not_exist_file'
end
end
#单个文件的话,不需要压缩,只改名
out_file = nil
if homeworks_attach_path.size == 1
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work)}_#{File.basename(homeworks_attach_path.first)}"
FileUtils.cp homeworks_attach_path.first, des_path
des_path
}
else
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
zipping("#{make_zip_name(work)}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
}
end
out_file
end
def zip_student_work_by_user(work)
homeworks_attach_path = []
not_exist_file = []
# 需要将所有homework.attachments遍历加入zip
digests = []
work.attachments.each do |attach|
if File.exist?(attach.diskfile)
homeworks_attach_path << attach.diskfile
digests << attach.digest
else
not_exist_file << attach.filename
digests << 'not_exist_file'
end
end
#单个文件的话,不需要压缩,只改名
out_file = nil
if homeworks_attach_path.size == 1
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work)}_#{File.basename(homeworks_attach_path.first)}"
FileUtils.cp homeworks_attach_path.first, des_path
des_path
}
else
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
zipping("#{make_zip_name(work)}.zip",
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
}
end
out_file
end
def find_or_pack(homework_id, user_id, digests)
raise "please given a pack block" unless block_given?
out_file = ZipPack.packed?(homework_id, user_id, digests.sort)
unless out_file && out_file.file_valid?
file = yield
ZipPack.where(homework_id: homework_id,
user_id: user_id).delete_all
out_file = ZipPack.create(homework_id: homework_id,
user_id: user_id,
file_digest: Trustie::Utils.digest(file),
file_path: file,
pack_size: File.size(file),
file_digests: digests.join(',')
)
else
out_file.pack_times = out_file.pack_times + 1
out_file.save
end
out_file
end
def zipping(zip_name_refer, files_paths, output_path, is_attachment=false, not_exist_file=[])
rename_zipfile = zip_name_refer ||= "#{Time.now.to_i.to_s}.zip"
# 文件名过长
if rename_zipfile.size > MAX_PATH
rename_zipfile = rename_zipfile[0,rename_zipfile.size-4][0,MAX_PATH-4] + rename_zipfile[-4,4]
end
zipfile_name = "#{output_path}/#{rename_zipfile}"
Dir.mkdir(File.dirname(zipfile_name)) unless File.exist?(File.dirname(zipfile_name))
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
files_paths.each do |filename|
rename_file = File.basename(filename)
rename_file = filename_to_real( File.basename(filename)) if is_attachment
begin
zipfile.add(rename_file, filename)
rescue Exception => e
zipfile.get_output_stream('FILE_NOTICE.txt'){|os| os.write l(:label_file_exist)}
next
end
end
unless not_exist_file.empty?
zipfile.get_output_stream('FILE_LOST.txt'){|os| os.write l(:label_file_lost) + not_exist_file.join(',').to_s}
end
end
zipfile_name
end
# 合理分配文件打包
# 如果小于 pack_attachment_max_size, 则返回单个文件
# 反之则切分为多个文件组返回
def split_pack_files(files, pack_attachment_max_size)
max_size = 0
last_files = []
ret_files = []
files.each_with_index do |f,i|
if (max_size += File.size(f)) > pack_attachment_max_size
max_size = 0
if last_files.empty? #如果单个文件超过大小,也将此文件作为一组
ret_files << {files: [f], count: 1, index: ret_files.count+1}
last_files.clear
else
ret_files << {files:last_files, count: last_files.count, index: ret_files.count+1}
last_files.clear
redo
end
else
last_files << f
end
end
ret_files << {files:last_files, count: last_files.count, index: ret_files.count+1} unless last_files.empty?
ret_files
end
def detect_content_type(name)
content_type = Redmine::MimeType.of(name)
content_type.to_s
end
def filename_to_real(name)
attach = Attachment.find_by_disk_filename(name)
attach.filename
end
end

View File

@ -194,6 +194,10 @@
<li><a href="<%=news_path(ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 发布了新闻:<%= ma.forge_message.title.html_safe%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>发布了新闻:<%= ma.forge_message.title.html_safe%></a></li>
<% elsif ma.forge_message_type == "Comment" %>
<li><a href="<%=news_path(ma.forge_message.commented.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 评论了新闻:<%= ma.forge_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>评论了新闻:<%= ma.forge_message.commented.title%></a></li>
<%# elsif ma.forge_message_type == "PullRequest" && PullRequest.where(:pull_request_id => ma.forge_message_id).count != 0%>
<%# send_message_user = PullRequest.where(:pull_request_id => ma.forge_message_id) %>
<%# author = User.find(ma.operate_user_id.nil? ? 2 : ma.operate_user_id) %>
<!-- <li><a href="<%#= project_pull_requests_path(ma.project_id) %>" target="_blank" title="<%#= User.find(author.id).show_name %> <%#= pull_request_message_status(ma) %> <%#= send_message_user[0].title %>"><span class="shadowbox_news_user"><%#= User.find(author.id).show_name %> </span><%#= pull_request_message_status(ma) %> <%#= send_message_user[0].title %></a></li>-->
<% end %>
<% elsif ma.class == MemoMessage %>
<% if ma.memo_type == "Memo" && !ma.memo.nil? && !ma.memo.author.nil? %>
@ -223,8 +227,8 @@
<% end %>
<% end %>
</ul>
<a onclick = "show_more();" id = "show_more_messages" style="display: none; cursor: pointer;" class = "shadowbox_news_all">展开更多</a>
<%= link_to '查看全部', user_message_path(User.current),:id =>'show_all_messages', :class => "shadowbox_news_all", :style => "display:none", :target =>"_Blank" %>
<!--<a onclick = "show_more();" id = "show_more_messages" style="display: none; cursor: pointer;" class = "shadowbox_news_all">展开更多</a>-->
<%= link_to '查看全部', user_message_path(User.current),:id =>'show_all_messages', :class => "shadowbox_news_all", :target =>"_Blank" %>
</div>
<script type="text/javascript">

View File

@ -5,14 +5,14 @@
<li><%= link_to '个人主页', homepage_user_path(@user), :class => "user_editinfo", :target => '_blank' %></li>
<li class="cl"></li>
<% else%>
<!-- <li style="width: 119px; float: left; border-right: 1px solid #ddd;">
<%# if target.base_homepage.nil? %>
<a href="javascript:void(0)" class ="user_editinfo" style="color: #cccccc" title="该用户暂未设置主页">主页</a>
<%# else %>
<%#=link_to "主页", homepage_user_path(@user.login), :class => 'user_editinfo', :target => '_blank' %>
<%# end %>
</li>-->
<li>
<li style="width: 119px; float: left; border-right: 1px solid #ddd;">
<% if target.base_homepage.nil? %>
<a href="javascript:void(0)" class ="user_editinfo" style="color: #cccccc" title="该用户暂未设置主页">TA的主页</a>
<% else %>
<%=link_to "TA的主页", homepage_user_path(@user.login), :class => 'user_editinfo', :target => '_blank' %>
<% end %>
</li>
<li style="width: 118px; float: left;">
<%if(target.watched_by?(User.current))%>
<%= link_to "取消关注",watch_path(:object_type=> 'user',:object_id=>target.id,:target_id=>target.id),:class => "user_editinfo", :method => "delete",:remote => "true", :title => "取消关注"%>
<% else %>

View File

@ -71,7 +71,10 @@
<ul class="users_accordion mb10">
<% if @user == User.current %>
<li id="user_05" class="user_icons_myhw">
<%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
<%=link_to '我发布的作业', user_manage_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_05" class="user_icons_myhw">
<%=link_to '我收到的作业', user_receive_homeworks_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_06" class="icons-doc clear">
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :style => "font-size:14px;" %>

View File

@ -62,7 +62,10 @@
<%= link_to "加入项目", applied_join_project_path, :remote => true, :method => "post", :style => "font-size:14px;" %>
</li>
<li id="user_09" class="user_icons_myissues">
<%= link_to "我的Issue", user_issues_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
<%= link_to "我发布的issue", user_manage_issues_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
</li>
<li id="user_10" class="user_icons_myissues">
<%= link_to "我收到的issue", user_receive_issues_user_path(@user), :target => "_blank", :style => "font-size:14px;" %>
</li>
<% end %>
</ul>

View File

@ -159,7 +159,7 @@
</div>
</div>
<% if is_current_user %>
<% if hidden_unproject_infos %>
<% if hidden_unproject_infos && user_course_count > 0 %>
<div class="home-user-leftnav">
<h3 >
<%= link_to "课程社区", user_course_community_path(User.current), :class => "fl" , :target => "_blank", :style => "color:#666" %>
@ -170,9 +170,18 @@
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;font-size: 11px;background-color:#f5f2f2;color:#666;'>#{user_course_count}</span>".html_safe : "课程",
user_course_community_path(User.current), :id => "user_course_list", :target => "_blank" %>
</li>
<% if user_manage_homework_count > 0 %>
<li class="home-user-leftnav-li icons-homework clear">
<%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :class => "fl", :style => "color:#666" %>
<%= link_to user_manage_homework_count > 0 ? "我发布的作业<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{user_manage_homework_count}</span>".html_safe : "我发布的作业",
user_manage_homeworks_user_path(@user), :target => "_blank" %>
</li>
<% end %>
<% if user_receive_homework_count > 0 %>
<li class="home-user-leftnav-li icons-homework clear">
<%= link_to "我收到的作业<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{user_receive_homework_count}</span>".html_safe,
user_receive_homeworks_user_path(@user), :target => "_blank" %>
</li>
<% end %>
<li class="home-user-leftnav-li icons-doc clear">
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :class => "fl", :style => "color:#666" %>
</li>
@ -183,6 +192,7 @@
<%# end %>
</div>
<% end %>
<% if user_project_count > 0%>
<div class="home-user-leftnav">
<h3 >
<%= link_to "项目社区", user_project_community_path(User.current), :class => "fl", :target => "_blank", :style => "color:#666" %>
@ -192,17 +202,22 @@
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{user_project_count}</span>".html_safe : "项目",
user_project_community_path(User.current), :id => 'user_project_list', :target => "_blank" %>
</li>
<% if issues_author_is_self_count > 0 %>
<li class="home-user-leftnav-li icons-issue clear">
<%= link_to issues_author_is_self_count > 0 ? "我发布的issue<span class='issues_nav_tag mr10 fr'style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:##666;'>#{issues_author_is_self_count}</span>".html_safe : "我发布的issue",
user_issues_user_path(@user, :type => "author" ), :target => "_blank" %>
user_manage_issues_user_path(@user), :target => "_blank" %>
</li>
<% end %>
<% if issues_assigned_is_self_count > 0 %>
<li class="home-user-leftnav-li icons-issue clear">
<%= link_to issues_assigned_is_self_count > 0 ? "我收到的issue<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{issues_assigned_is_self_count}</span>".html_safe : "我收到的issue",
user_issues_user_path(@user, :type => "assigned"), :target => "_blank" %>
user_receive_issues_user_path(@user), :target => "_blank" %>
</li>
<% end %>
</ul>
</div>
<% if hidden_unproject_infos %>
<% end %>
<% if hidden_unproject_infos && user_contest_count > 0 %>
<div class="home-user-leftnav">
<h3 >
<%= link_to "竞赛社区", user_contest_community_path(User.current), :class => "fl" , :target => "_blank"%>
@ -222,17 +237,19 @@
<span class="fr mr5" style="font-size:12px;color: #7f7f7f;"><%= time_tag(@user.created_on).html_safe %></span>
</h3>
<ul>
<% if hidden_unproject_infos %>
<% if hidden_unproject_infos && user_course_count > 0 %>
<li class="home-user-leftnav-li icons-class clear">
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag ml140'>#{user_course_count}</span>".html_safe : "课程",
user_course_community_path(@user), :id => "user_course_list", :class => "fl", :target => "_blank" %>
</li>
<% end %>
<% if user_project_count > 0 %>
<li class="home-user-leftnav-li icons-project clear">
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag ml140'>#{user_project_count}</span>".html_safe : "项目",
user_project_community_path(@user), :id => 'user_project_list', :class => "fl", :target => "_blank" %>
</li>
<% if hidden_unproject_infos %>
<% end %>
<% if hidden_unproject_infos && user_contest_count > 0 %>
<li class="home-user-leftnav-li icons-project clear">
<%= link_to user_contest_count > 0 ? "竞赛<span class='issues_nav_tag ml140'>#{user_contest_count}</span>".html_safe : "竞赛",
user_contest_community_path(@user), :id => 'user_contest_list', :class => "fl", :target => "_blank" %>

View File

@ -41,7 +41,7 @@
<img src="https://www.trustie.net/images/wechat/trustie_QR.jpg" width="120" height="120" >
<p style=" color:#666;">
扫一扫,关注 Trustie 微信公众号,更方便获任务通知,作业等提醒<br/>
想了解更多信息,请访问 <a href="www.trustie.net" style=" color:#3b94d6;"> www.trustie.net</a>
想了解更多信息,请访问 <a href="https://www.trustie.net/" style=" color:#3b94d6;"> www.trustie.net</a>
</p>
</div>
<div style="padding:20px; color:#333; line-height: 1.9;background: #eee;border:1px solid #ddd; border-top:none; width: 558px;">

View File

@ -56,7 +56,7 @@
:class => 'fr mr20 undis',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if @memo.author.id == User.current.id || User.current.admin? %>
) if @memo.author.id == User.current.id || User.current.admin? || User.current == @forum.creator %>
</span>
<div class="cl"></div>
</div>

View File

@ -7,14 +7,14 @@
<% if @is_valuate.size > 0 %> <!-- 评价过 1代表赞 0代表踩 -->
<% @flag = @is_valuate.first.praise_or_tread %>
<% if @flag == 1 %> <!-- 顶过 --><!-- modified by bai -->
<a href="javascript:void(0);" class="<%= obj.author.id == User.current.id ? 'linkGrey2 postLikeIcon mr30':'linkGrey2 postLikeIcon' %>" title="<%= l(:label_issue_praise_over)%>" > <%= get_praise_num(obj)%></a>
<a href="javascript:void(0);" class="<%= (obj.author.id == User.current.id || obj.forum.creator == User.current || User.current.admin?) ? 'linkGrey2 postLikeIcon mr30':'linkGrey2 postLikeIcon' %>" title="<%= l(:label_issue_praise_over)%>" > <%= get_praise_num(obj)%></a>
<% end %>
<% else %>
<% if user_id == obj.author_id %>
<!--<%#= image_tag "/images/praise_tread/praise_true.png" , weight:"22px", height:"22px",:title => l(:label_issue_not_praise_over) %>-->
<a href="javascript:void(0);" class="linkGrey2 postLikeIcon mr30" title="<%= l(:label_issue_not_praise_over)%>" > <%= get_praise_num(obj)%></a>
<% elsif user_id == obj.forum.creator_id || User.current.admin? %>
<a href="<%= praise_tread_praise_plus_path({:obj_id => obj.id,:obj_type => obj.class, :horizontal => horizontal })%>" data-remote="true" class="linkGrey2 postLikeIcon mr30" title="<%= l(:label_issue_praise)%>" > <%= get_praise_num(obj) %></a>
<% else %>
<!-- 积分少于2分不能踩帖 -->
<%# if OptionNumber.get_user_option_number(user_id).nil? || OptionNumber.get_user_option_number(user_id).total_score < 2 %>

View File

@ -26,12 +26,14 @@
<%= link_to image_tag(url_to_avatar(@memo.author),:width=>50,:height => 50,:alt=>'贴吧图像' ),user_path(@memo.author) %>
</div>
<div class="postThemeWrap">
<% if @memo.author.id == User.current.id || User.current.admin? %>
<% if @memo.author.id == User.current.id || User.current.admin? || User.current == @forum.creator %>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<% if @memo.author.id == User.current.id || User.current.admin? %>
<li><a href="<%= edit_forum_memo_path(@memo.forum,@memo)%>" class="postOptionLink">编辑</a></li>
<% end %>
<li><a href="javascript:void(0);" class="postOptionLink" onclick="del_confirm();">删除</a></li>
<li style="display: none"><a href="<%= forum_memo_path(@memo.forum, @memo) %>" data-method="delete" id="del_memo_link" ></a></li>
</ul>

View File

@ -16,7 +16,7 @@
<span class="c_red ml5 w690" id="project_name_notice" style="padding-left:100px;display: none;">项目名称不能为空!</span>
</li>
<li class="clear mb10">
<label class="label fl mr5">&nbsp;项目描述&nbsp;&nbsp;:&nbsp;</label>
<label class="label fl mr5">&nbsp;项目简介&nbsp;&nbsp;:&nbsp;</label>
<%= f.kindeditor :description, :editor_id => 'project_setting_editor',
:owner_id => @project.nil? ? 0: @project.id,
:owner_type => OwnerTypeHelper::PROJECT,

View File

@ -1,5 +1,5 @@
<% if @requests.blank? %>
<div class="no-merge-content">没有可显示的请求</div>
<%= render :partial => "projects/no_data" %>
<% else %>
<% @requests.each do |request| %>
<div class="clear new_roadmap_listbox">

View File

@ -5,34 +5,20 @@
<% else %>
<% homeworks.each do |homework| %>
<ul class="sy_classlist">
<span class="hw_icons_cir fl mt5 mr5"></span>
<span class="icons-user-homework homework-user-leftnav-li fl"></span>
<div class="fl ">
<h3 class="sy_classlist_title fl">
<%= link_to homework.name, student_work_index_path(:homework => homework.id), :class => 'sy_cblack', :target => '_blank' %>
<%= link_to homework.course.name+" / "+homework.name, student_work_index_path(:homework => homework.id), :class => 'sy_cblack', :target => '_blank' %>
</h3>
<div class="cl"></div>
<p class="sy_cgrey clear">
<span class="fl">来源:</span>
<span class="hw_classname mr15 fl">
<%= link_to homework.course.name, course_path(homework.course), :target => '_blank', :class => 'hw_cgrey' %>
</span>
<span class="mr15 fl">类别:<%=homework.homework_type_ch %></span>
<span class="fl">作品:</span>
<span class="sy_corange hw_w30 fl "><%=homework.student_works.has_committed.count %></span>
<span class="fl">/</span>
<span class="sy_cgrey hw_w30 fl mr15"><%= homework.homework_type == 3 ? '--' : homework.course.student.count %></span>
<span class="fl">待评阅:</span>
<span class="sy_corange hw_w30 fl"><%= homework.student_works.has_committed.where("teacher_score is null and teaching_asistant_score is null").count %></span>
<span class="fl">/</span>
<span class="sy_cgrey hw_w30 fl mr15"><%=homework.student_works.has_committed.count %></span>
<span class="mr15 fl">发布时间:
<% if homework.publish_time %>
<%= format_date(homework.publish_time) %>
<% else %>
<span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<% end %>
</span>
<span class="mr15 fl"><%= (cur_homework_end_time homework).html_safe %></span>
<span class="fl">未交:</span>
<span class="sy_cgrey hw_w30 fl mr15"><%= homework.homework_type == 3 ? '--' : (homework.course.student.count - homework.student_works.has_committed.count) %></span>
<span class="fl c_green">已评:</span>
<span class="sy_cgrey hw_w30 fl mr15"><%= homework.student_works.has_committed.count - homework.student_works.has_committed.where("teacher_score is null and teaching_asistant_score is null").count %></span>
<span class="fl c_red">未评:</span>
<span class="sy_cgrey hw_w30 fl mr15"><%= homework.student_works.has_committed.count %></span>
</p>
</div>
<% if homework.student_works.has_committed.count == 0 %>

View File

@ -0,0 +1,85 @@
<% unless activity.author.nil? %>
<div class="issues_list_box clear" id="user_activity_<%= user_activity_id%>">
<div class="issues_ciricons fl ">
<% if activity.status_id.to_i == 5 %>
<span class="issues_ciricons_02"></span>
<% else %>
<span class="issues_ciricons_01"></span>
<% end %>
</div>
<div class=" fl ml5">
<div class="issues_list_titlebox clear">
<a href="<%= issue_path(activity) %>" class="issues_list_title fl" style="width: 400px" target="_blank" title="<%= activity.subject.to_s %>"><%= activity.subject.to_s %></a>
<div class="cl"></div>
</div>
<div class="issues_list_small">
<p class="fl issues_list_name" ><span class="mr5"><%= format_time(activity.created_on) %> </span>发布</p>
<p class="fl ml10"> <span class="mr5"><%= format_time(activity.updated_on) %> </span>更新</p>
</div>
</div>
<ul class="issues_list_txt fr">
<li class=" c_grey issues_list_max mr5">
<%= Project.find(activity.project_id).name %>
</li>
<li class="issues_list_min c_grey">
<% case activity.tracker_id %>
<% when 1 %>
缺陷
<% when 2 %>
功能
<% when 3 %>
支持
<% when 4 %>
任务
<% when 5 %>
周报
<% end %>
</li>
<li class="c_grey">
<% if !activity.assigned_to_id.nil? && activity.assigned_to_id != 0 %>
<% if activity.try(:assigned_to).try(:realname).blank? %>
<%= link_to activity.assigned_to, user_path(activity.assigned_to_id)%>
<% else %>
<%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id)%>
<% end %>
<% end %></li>
<li class="issues_list_min c_grey">
<%= activity.priority.name %>
</li>
<li class="c_grey issues_list_max" title="<%= activity.fixed_version %>"><%= activity.fixed_version %></li>
<li class="issues_list_min c_grey mr5" ><%= activity.status.name %></li>
<li class="<%= (activity.done_ratio == 100 ? 'c_green issues_list_min mr5' : 'c_red issues_list_min mr5') %>"><%= activity.done_ratio %>%</li>
<li class="issues_list_min">
<% if activity.journals.count > 0 %>
<span class="issues_icons_mes fl mr5 mt12"></span>
<span class="fl mr5"><%= activity.journals.count %></span>
<% end %>
</li>
</ul>
</div>
<% end %>
<script>
$(".issues_list_box").mouseover(function(){
var iconOrder;
var iconSize = $(this).children().eq(2).children().eq(7).children().size();
if(iconSize > 1){
iconOrder = 2;
} else{
iconOrder = 0;
}
$(this).children().eq(2).children().eq(7).children().eq(iconOrder).show();
});
$(".issues_list_box").mouseout(function(){
var iconOrder;
var iconSize = $(this).children().eq(2).children().eq(7).children().size();
if(iconSize > 1){
iconOrder = 2;
} else{
iconOrder = 0;
}
$(this).children().eq(2).children().eq(7).children().eq(iconOrder).hide();
});
</script>

View File

@ -0,0 +1,84 @@
<% unless activity.author.nil? %>
<div class="issues_list_box clear" id="user_activity_<%= user_activity_id%>">
<div class="issues_ciricons fl ">
<% if activity.status_id.to_i == 5 %>
<span class="issues_ciricons_02"></span>
<% else %>
<span class="issues_ciricons_01"></span>
<% end %>
</div>
<div class=" fl ml5">
<div class="issues_list_titlebox clear">
<a href="<%= issue_path(activity) %>" class="issues_list_title fl" style="width: 400px" target="_blank" title="<%= activity.subject.to_s %>"><%= activity.subject.to_s %></a>
<div class="cl"></div>
</div>
<div class="issues_list_small">
<p class="fl issues_list_name" ><span class="mr5"><%= format_time(activity.created_on) %> </span>发布</p>
<p class="fl ml10"> <span class="mr5"><%= format_time(activity.updated_on) %> </span>更新</p>
</div>
</div>
<ul class="issues_list_txt fr">
<li class=" c_grey issues_list_max mr5">
<%= Project.find(activity.project_id).name %>
</li>
<li class="c_grey">
<% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id)%>
<% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id)%>
<% end %>
</li>
<li class="issues_list_min c_grey">
<% case activity.tracker_id %>
<% when 1 %>
缺陷
<% when 2 %>
功能
<% when 3 %>
支持
<% when 4 %>
任务
<% when 5 %>
周报
<% end %>
</li>
<li class="issues_list_min c_grey">
<%= activity.priority.name %>
</li>
<li class="c_grey issues_list_max" title="<%= activity.fixed_version %>"><%= activity.fixed_version %></li>
<li class="issues_list_min c_grey mr5" ><%= activity.status.name %></li>
<li class="<%= (activity.done_ratio == 100 ? 'c_green issues_list_min mr5' : 'c_red issues_list_min mr5') %>"><%= activity.done_ratio %>%</li>
<li class="issues_list_min">
<% if activity.journals.count > 0 %>
<span class="issues_icons_mes fl mr5 mt12"></span>
<span class="fl mr5"><%= activity.journals.count %></span>
<% end %>
</li>
</ul>
</div>
<% end %>
<script>
$(".issues_list_box").mouseover(function(){
var iconOrder;
var iconSize = $(this).children().eq(2).children().eq(7).children().size();
if(iconSize > 1){
iconOrder = 2;
} else{
iconOrder = 0;
}
$(this).children().eq(2).children().eq(7).children().eq(iconOrder).show();
});
$(".issues_list_box").mouseout(function(){
var iconOrder;
var iconSize = $(this).children().eq(2).children().eq(7).children().size();
if(iconSize > 1){
iconOrder = 2;
} else{
iconOrder = 0;
}
$(this).children().eq(2).children().eq(7).children().eq(iconOrder).hide();
});
</script>

View File

@ -5,29 +5,22 @@
<% else %>
<% homeworks.each do |homework| %>
<ul class="sy_classlist">
<span class="hw_icons_cir fl mt5 mr5"></span>
<span class="icons-user-homework homework-user-leftnav-li fl"></span>
<div class="fl ">
<h3 class="sy_classlist_title fl">
<%= link_to homework.name, student_work_index_path(:homework => homework.id), :class => 'sy_cblack', :target => '_blank' %>
<%= link_to homework.course.name + " / " +homework.name, student_work_index_path(:homework => homework.id), :class => 'sy_cblack', :target => '_blank' %>
</h3>
<div class="cl"></div>
<p class="sy_cgrey clear">
<span class=" fl">来源:</span>
<span class="hw_classname fl mr15">
<%= link_to homework.course.name, course_path(homework.course), :target => '_blank', :class => 'hw_cgrey' %>
</span>
<span class="mr15 fl">类别:<%=homework.homework_type_ch %></span>
<span class="mr15 fl"><%= cur_homework_end_time homework %></span>
<% my_work = homework.student_works.where("user_id = ? && work_status != 0",User.current).first %>
<span class="fl">状态:</span><span class="<%= my_work ? '' : 'hw_cir_nomal hw_cir_lorange' %> fl mr15"><%= my_work ? '已提交' : '未提交' %></span>
<span class="fl">作品:</span><span class="sy_corange hw_w20 fl mr15"><%=homework.student_works.has_committed.count %></span>
<span class="fl">成绩:</span>
<% if my_work && !my_work.work_score.nil? %>
<span class="sy_corange hw_w40 fl mr15"><%= format("%.1f",my_work.work_score.to_f) %></span>
<% else %>
<span class="sy_cgrey hw_w40 fl mr15">--</span>
<% end %>
<span class="mr15 fl">发布时间:<%= format_date homework.publish_time %></span>
<span class="mr15 fl"><%=cur_homework_end_time homework %></span>
</p>
</div>
<%= student_for_homework_common homework %>

View File

@ -0,0 +1,24 @@
<% issue_list(issues) do |issue| -%>
<script>
$(function () {
sd_create_editor_from_data(<%= issue.id %>, null, "100%", "<%= issue.class.name %>");
});
</script>
<%= render :partial => 'users/my_manage_issue_list', :locals => {:activity => issue, :user_activity_id => issue.id} %>
<% end %>
<div style="text-align:left;">
<div style="width:auto; display:inline-block;">
<ul>
<%= link_to "导出EXCEL", user_manage_issues_user_path(:format => 'xls'), :class => "hw_btn_blue ml10 mt10 mb10", :id => "sendexcel",
:onclick => "remote_function_export('#{User.current}')"%>
</ul>
</div>
<div class="pages fr" style="width:auto; display:inline-block;margin-top:10px">
<ul id="issue_list_pagination" class="fr">
<%= pagination_links_full @issue_pages, @issue_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>

View File

@ -704,34 +704,34 @@
<% end %>
<% if ma.course_message_type == "CourseRequestDealResult" %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<div class="shortMessageWidth">
<li class="homepageNewsPortrait fl">
<div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div>
<%= link_to image_tag(url_to_avatar(User.find(ma.user_id)), :width => "30", :height => "30"), user_path(User.find(ma.user_id)), :target => '_blank' %>
<!--<div class="navHomepageLogo fl"><%#= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div>-->
</li>
<li class="homepageNewsPubType fl">
<span class="newsBlue homepageNewsPublisher">系统提示</span>
<span class="newsBlue homepageNewsPublisher">
<%=link_to User.find(ma.user_id).show_name, user_path(User.find(ma.user_id)),
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
</span>
<span class="homepageNewsType fl">
班级申请进度反馈:</span>
申请以“<%= ma.content.include?('9') ? '教师' : '教辅' %>”身份加入:
</span>
</li>
<li class="messageInformationContents">
<%= link_to ma.status == 1 ?
'您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content.include?('9') ? '教师' : '教辅')+'申请已通过'
:
'您申请成为班级"'+Course.find(ma.course_id).name+'"的'+(ma.content.include?('9') ? '教师' : '教辅')+'的申请被拒绝', course_path(Course.find(ma.course_id)),
<%= link_to Course.find(ma.course_id).name, course_path(Course.find(ma.course_id)),
:class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</li>
</div>
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= User.current.lastname + User.current.firstname %>老师您好!您已成功加入班级<%= Course.find(ma.course_id).name%>。
</p>
<p>申请班级:<%= Course.find(ma.course_id).name%></p>
<div class="fl">班级描述:</div>
<div class="ml60"><%= Course.find(ma.course_id).description.nil? ? "" : Course.find(ma.course_id).description.html_safe %></div>
<p>申请职位:<%= ma.content == '9' ? "教师" : "教辅"%></p>
</div>
<li class="messageOperateContents fl">
<% if ma.status == 1 %>
<%= User.find(ma.course_message_id).show_name%>已通过
<% else %>
<%= User.find(ma.course_message_id).show_name%>已拒绝
<% end %>
</li>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>

View File

@ -0,0 +1,24 @@
<% issue_list(issues) do |issue| -%>
<script>
$(function () {
sd_create_editor_from_data(<%= issue.id %>, null, "100%", "<%= issue.class.name %>");
});
</script>
<%= render :partial => 'users/my_receive_issue_list', :locals => {:activity => issue, :user_activity_id => issue.id} %>
<% end %>
<div style="text-align:left;">
<div style="width:auto; display:inline-block;">
<ul>
<%= link_to "导出EXCEL", user_manage_issues_user_path(:format => 'xls'), :class => "hw_btn_blue ml10 mt10 mb10", :id => "sendexcel",
:onclick => "remote_function_export('#{User.current}')"%>
</ul>
</div>
<div class="pages fr" style="width:auto; display:inline-block;margin-top:10px">
<ul id="issue_list_pagination" class="fr">
<%= pagination_links_full @issue_pages, @issue_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>

View File

@ -224,9 +224,9 @@
</a>
</li>
<li id="issues_list_nav_3" onclick="HoverLi(3);">
<a href="javascript:void(0);" id="issues_type_3" onclick="createByMe(<%= User.current.id %>)">我的发布<span class="issues_nav_tag ml5">
<%= @issues_author_count %>
</span></a>
<a href="javascript:void(0);" id="issues_type_3" onclick="createByMe(<%= User.current.id %>)">我的发布
<span class="issues_nav_tag ml5"><%= @issues_author_count %></span>
</a>
</li>
<div class="cl"></div>
</ul>

View File

@ -0,0 +1,42 @@
<script type="text/javascript" language="javascript">
function HoverLi(url){
window.location.href = url;
}
</script>
<div class="mt10 mb10">
<div class="banner-big f16 fontGrey3" style="margin: 0 auto; position: relative;">
我发布的的作业
<div class="hw_more_box" >
<ul>
<li class="hw_more_icons fr">
<ul class="hw_more_txt">
<li> <a href="<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 0) %>" id="homework_type_all" class="hw_more_li" data-method="get" data-remote="true">全部作业</a> </li>
<li> <a href="<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 1) %>" id="homework_type_nor" class="hw_more_li" data-method="get" data-remote="true">普通作业</a> </li>
<li> <a href="<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 2) %>" id="homework_type_pro" class="hw_more_li" data-method="get" data-remote="true">编程作业</a> </li>
<li> <a href="<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 3) %>" id="homework_type_gro" class="hw_more_li" data-method="get" data-remote="true">分组作业</a> </li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="hw_content mb10" >
<div id="hw_tab_con_2">
<div class="sy_category" id="homework_search_input">
<%= render :partial=>'my_homeworks_search', :locals => {:type => @type,:property => nil, :order => @order, :search => ''} %>
</div>
<div class="sy_classbox" style="min-height:800px;" id="my_homework_list">
<%= render :partial => "manage_homework_list", :locals => {:homeworks => @homeworks, :is_manage => 1} %>
</div>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_list_ref_pages">
<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
</ul>
<div class="cl"></div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,7 @@
$("#my_homework_list").html('<%= escape_javascript(render :partial => "manage_homework_list", :locals => {:homeworks => @homeworks, :is_manage => 1})%>');
$("#homework_list_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');
$("#my_homework_sort").html('<%= escape_javascript( render :partial => 'users/my_homework_sort', :locals => {:type => @type,:property => @property,:order => @order,:search => @search})%>');
$("#homework_type_all").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 0) %>');
$("#homework_type_nor").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 1) %>');
$("#homework_type_pro").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 2) %>');
$("#homework_type_gro").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 3) %>');

View File

@ -0,0 +1,312 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true,init_activity: true) %>
<% end %>
<script xmlns="http://www.w3.org/1999/html">
function add_style(){
// $("#proeject_id").val("来源");
if($("select[id='tracker_id']").val() != 0){
$("#tracker_id").addClass('issues_filter_active');
}
if($("select[id='author_id']").val() != 0){
$("#author_id").addClass('issues_filter_active');
}
if($("select[id='assigned_to_id']").val() !=0){
$("#assigned_to_id").addClass('issues_filter_active');
}
if($("select[id='priority_id']").val() !=0){
$("#priority_id").addClass('issues_filter_active');
}
if($("select[id='fixed_version_id']").val() !=0){
$("#fixed_version_id").addClass('issues_filter_active');
}
if($("select[id='status_id']").val() != 0 ){
$("#status_id").addClass('issues_filter_active');
}
if($("select[id='done_ratio']").val() != -1){
$("#done_ratio").addClass('issues_filter_active');
}
if($("select[id='test']").val() != 0 ){
$("#test").addClass('issues_filter_active');
}
if($("select[id='tracker_id']").val() == 0){
$("#tracker_id").removeClass('issues_filter_active');
}
if($("select[id='author_id']").val() == 0){
$("#author_id").removeClass('issues_filter_active');
}
if($("select[id='assigned_to_id']").val() ==0){
$("#assigned_to_id").removeClass('issues_filter_active');
}
if($("select[id='priority_id']").val() ==0){
$("#priority_id").removeClass('issues_filter_active');
}
if($("select[id='fixed_version_id']").val() ==0){
$("#fixed_version_id").removeClass('issues_filter_active');
}
if($("select[id='status_id']").val() == 0 ){
$("#status_id").removeClass('issues_filter_active');
}
if($("select[id='done_ratio']").val() == -1){
$("#done_ratio").removeClass('issues_filter_active');
}
if($("select[id='test']").val() == 0 ){
$("#test").removeClass('issues_filter_active');
}
};
//issues列表
function g(o){
return document.getElementById(o);
}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=3;i++){
g('issues_list_nav_'+i).className='issues_nav_nomal';
g('issues_list_content_'+i).className='undis';
}
g('issues_list_content_'+n).className='dis';
g('issues_list_nav_'+n).className='issues_nav_hover';
}
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
$("input[nhname='date_show']").change(function(){
if($(this).val()=='创建日期起始' || $(this).val()=='创建日期结束')return;
$("input[nhname='date_val']",$(this).parent('div')).val($(this).val());
remote_function();
});
});
function remote_function() {
$("#issue_query_form").submit();
}
function remote_function_export(user) {
var project_id = $("#project_id").attr("value");
var tracker_id = $("#tracker_id").attr("value");
var subject = $("#v_subject").attr("value");
var assigned_to_id = $("#assigned_to_id").attr("value");
var fixed_version_id = $("#fixed_version_id").attr("value");
var status_id = $("#status_id").attr("value");
var done_ratio = $("#done_ratio").attr("value");
var test = $("#test").attr("value");
var author_id = $("#author_id").attr("value");
var priority_id = $("#priority_id").attr("value");
var issue_create_date_start = $("#issue_date_start_issue_export").attr("value");
var issue_create_date_end = $("#issue_date_end_issue_export").attr("value");
$("#sendexcel").attr("href","/users/"+user+"/user_manage_issues.xls?project_id="+project_id+"&tracker_id="+tracker_id+"&assigned_to_id="+assigned_to_id+"&fixed_version_id="+fixed_version_id+"&status_id="+status_id+"&done_ratio="+done_ratio+"&test="+test+"&author_id="+author_id+"&subject="+subject+"&issue_create_date_start="+issue_create_date_start+"&issue_create_date_end="+issue_create_date_end+"&priority_id="+priority_id);
///projects/1811/issues.xls?export=true&set_filter=1
}
function EnterPress(e){
var e = e || window.event;
if(e.keyCode == 13){
remote_function();
}
}
// 点击的时候让过滤条件选中assign_to
function switch_assign_to(assign) {
var assign = "option[value =" + assign + "]";
$("#issues_type_2").click(function(){
});
$("select[id='assigned_to_id']").find(assign).attr("selected", "selected");
$("select[id='author_id']").val('');
$("select[id='priority_id']").val('');
$("select[id='project_id']").val('');
$("select[id='tracker_id']").val('');
$("select[id='fixed_version_id']").val('');
$("select[id='status_id']").val('');
$("select[id='done_ratio']").val('');
$("select[id='test']").val('');
$("#tracker_id").removeClass('issues_filter_active');
$("#author_id").removeClass('issues_filter_active');
$("#assigned_to_id").addClass('issues_filter_active');
$("#priority_id").removeClass('issues_filter_active');
$("#fixed_version_id").removeClass('issues_filter_active');
$("#status_id").removeClass('issues_filter_active');
$("#done_ratio").removeClass('issues_filter_active');
$("#test").removeClass('issues_filter_active');
remote_function();
}
// 点击的时候让过滤条件选中user_id
function createByMe(user_id) {
var user = "option[value =" + user_id + "]";
$("#createByMe").click(function(){
});
$("select[id='author_id']").find(user).attr("selected", "selected");
$("select[id='assigned_to_id']").val('');
$("select[id='priority_id']").val('');
$("select[id='project_id']").val('');
$("select[id='tracker_id']").val('');
$("select[id='fixed_version_id']").val('');
$("select[id='status_id']").val('');
$("select[id='done_ratio']").val('');
$("select[id='test']").val('');
$("#tracker_id").removeClass('issues_filter_active');
$("#author_id").addClass('issues_filter_active');
$("#assigned_to_id").removeClass('issues_filter_active');
$("#priority_id").removeClass('issues_filter_active');
$("#fixed_version_id").removeClass('issues_filter_active');
$("#status_id").removeClass('issues_filter_active');
$("#done_ratio").removeClass('issues_filter_active');
$("#test").removeClass('issues_filter_active');
remote_function();
}
// 清楚表单所有选项
function all_reset_form() {
$("#issue_query_form")[0].reset();
$("select[id='author_id']").val('');
$("select[id='assigned_to_id']").val('');
$("input[nhname='date_val']").val('');
$("#tracker_id").removeClass('issues_filter_active');
$("#author_id").removeClass('issues_filter_active');
$("#assigned_to_id").removeClass('issues_filter_active');
$("#priority_id").removeClass('issues_filter_active');
$("#fixed_version_id").removeClass('issues_filter_active');
$("#status_id").removeClass('issues_filter_active');
$("#done_ratio").removeClass('issues_filter_active');
$("#test").removeClass('issues_filter_active');
$("#reorder_turnover_time").removeClass("sortArrowActiveU");
$("#reorder_turnover_time").addClass("sortArrowActiveD");
$("#reorder_release_time").removeClass("sortArrowActiveD");
$("#reorder_release_time").removeClass("sortArrowActiveU");
remote_function();
}
function add_class(id){
if($("#"+id).hasClass("sortArrowActiveD")){
$("#"+id).removeClass("sortArrowActiveD");
$("#"+id).addClass("sortArrowActiveU");
$.ajax({
type: 'GET',
url: '<%= user_manage_issues_user_path(@user) %>' + '.js?' + id + '=asc&page='+<%= @issue_pages.page %>,
data: $("#issue_query_form").serialize()
});
}else if($("#"+id).hasClass("sortArrowActiveU")){
$("#"+id).removeClass("sortArrowActiveU");
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
url: '<%= user_manage_issues_user_path(@user) %>' + '.js?' + id + '=desc&page='+<%= @issue_pages.page %>,
data: $("#issue_query_form").serialize()
});
}else{
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
url: '<%= user_manage_issues_user_path(@user) %>' + '.js?' + id + '=desc&page='+<%= @issue_pages.page%>,
data: $("#issue_query_form").serialize()
});
}
}
$(function() {
$("#release_time").click(function(){
$("#reorder_turnover_time").removeClass("sortArrowActiveU");
$("#reorder_turnover_time").removeClass("sortArrowActiveD");
add_class("reorder_release_time");
});
$("#turnover_time").click(function () {
$("#reorder_release_time").removeClass("sortArrowActiveD");
$("#reorder_release_time").removeClass("sortArrowActiveU");
add_class("reorder_turnover_time");
});
});
</script>
<!--缺陷列表开始-->
<div id="myissues_con" class="myissues_con mb10">
<div class="myissues_head mb5">
<h2 class="ml15">我发布的Issue</h2>
</div>
<div class="clear mb5">
<div class="issues_statistics fl">
<ul>
<li>所有<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issues_filter.count %></a></li>
<li>开启<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issue_open_count %></a></li>
<li>关闭<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issue_close_count %></a></li>
</ul>
</div><!--issues_statistics end-->
</div>
<%= form_tag( user_manage_issues_user_path(@user), :remote => 'xls', :method => "post", :id => "issue_query_form", :class => 'query_form') do %>
<div class="clear mb10">
<div class="hw_search_box fl ">
<input class="hw_search-input" placeholder="输入Issue名称进行搜索" type="text" id="v_subject" name="subject" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
<a href="javascript:void(0);" class="hw_btn_search" onclick="remote_function();" ></a>
</div>
<a href="javascript:void(0);" class="sy_btn_grey fl ml5" onclick="all_reset_form();">清除</a>
<div class="fr">
<a href="javascript:void(0);" class="linkGrey2 fl">排序:&nbsp;&nbsp;</a>
<div id="release_time" class="w65 fl"><a href="javascript:void(0);" class="linkGrey2 fl">发布时间</a><a href="javascript:void(0);" id="reorder_release_time" class=""></a></div>
<div id="turnover_time" class="w65 fl"><a href="javascript:void(0);" class="linkGrey2 fl">更新时间</a><a href="javascript:void(0);" id="reorder_turnover_time" class="sortArrowActiveD"></a></div>
</div>
</div>
<div class="issues_con_list" style="position: relative;">
<ul id="issues_list_nav" >
<li id="issues_list_nav_1" class="issues_nav_hover" onclick="HoverLi(1);all_reset_form();">
<a href="javascript:void(0);" id="issues_type_1" onclick="all_reset_form();" >搜索结果</a>
<span id="issue_filter_all"><%= render :partial => "users/my_issue_filter_all" %></span>
</li>
<div class="cl"></div>
</ul>
<div class="issues_filter">
<div class="issues_form_filter mt5 mr5">
<%= select( :project, :project_id, options_for_issue_project_list(@issues_filter),
{ :include_blank => false,:selected => @project_id ? @project_id : 0 },
{ :onchange => "remote_function();add_style();", :id => "project_id", :name => "project_id", :class => "fl", :style=>"width: 80px; margin-right:20px;"}
)%>
<select placeholder=" 类型" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px;width:35px; margin-right:10px;">
<option value="0" selected="selected">类型</option>
</select>
<select placeholder=" 指派给" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin-right: 15px;">
<option value="0" selected="selected">指派给</option>
</select>
<%= select( :issue, :user_id, [[@user.show_name, @user.id]].unshift(["指派给",0]),
{ :include_blank => false, :selected => @assigned_to ? @assigned_to : 0},
{:onchange=>"remote_function();add_style();",:id => "assigned_to_id",:name => "assigned_to_id", :class => "fl", :style => "visibility:hidden; width:0px;margin:0px;padding:0px;"} )
%>
<select placeholder=" 优先度" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px">
<option value="0" selected="selected">优先度</option>
</select>
<select placeholder=" 里程碑" class="fl my_issues_filter" disabled="disabled" style="padding:0px;margin-left: 20px; margin-right: 10px">
<option value="0" selected="selected">里程碑</option>
</select>
<select placeholder=" 状态" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin-right:10px;width:35px;">
<option value="0" selected="selected">状态</option>
</select>
<select placeholder=" 完成度" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px">
<option value="0" selected="selected">完成度</option>
</select>
<select placeholder=" 排序" class="fl my_issues_filter" disabled="disabled" style="width:50px;visibility:hidden;margin-left: 0px;margin-right: 0px;">
<option value="0" selected="selected">排序</option>
</select>
</div>
<div class="cl"></div>
</div>
<% end %>
<% if @issues.empty? %>
<p class="nodata mt10"><%= l(:label_no_data) %></p>
<% else %>
<div id="issue_list">
<%= render :partial => 'users/user_manage_issue_list', :locals => {:issues => @issues, :issue_pages => @issue_pages, :issue_count => @issue_count, :subject => @subject } %>
</div>
<% end %>
</div>
<div class="cl"></div>
</div><!--issues_filter end-->
<div id="issues_list_content_1">
</div><!--issues_list_content_1 end-->
<div id="issues_list_content_2" class="undis">
</div><!--issues_list_content_2 end-->
<div id="issues_list_content_3" class="undis">
</div><!--issues_list_content_3 end-->
<!--issues_con_list end-->
<!--缺陷列表结束-->
<!--缺陷列表结束-->

View File

@ -0,0 +1,3 @@
$("#issue_filter_all").html("<%= escape_javascript(render :partial => 'users/my_issue_filter_all') %>");
$("#issue_list").html("<%= escape_javascript(render :partial => 'users/user_manage_issue_list',:locals => {:issues => @issues, :issue_pages=> @issue_pages, :issue_count => @issue_count })%>");
$("#issue_list_pagination").html('<%= pagination_links_full @issue_pages, @issue_count, :issues => @issues, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');

View File

@ -14,6 +14,7 @@
<div class="cl"></div>
<div id="messageContent">
<% unless is_current_user %>
<div class="resources"><%= link_to image_tag(url_to_avatar(User.current),:class=>"fl mr10", :width => "50", :height => "50"), :alt => "用户头像" %>
<div class="fl" style="width:658px;">
<%= form_for('new_form',:url => leave_user_message_path(@user.id), :html =>{:id => "user_feedback_new"}, :method => "post") do |f|%>
@ -24,6 +25,7 @@
<% end %>
</div>
</div>
<% end %>
<%=render :partial => "users/user_jours_list", :locals => {:jours =>@jour, :page => 0, :type => @type, :count => @jour_count} %>
<div class="cl"></div>
</div><!--message_box end-->

View File

@ -0,0 +1,42 @@
<script type="text/javascript" language="javascript">
function HoverLi(url){
window.location.href = url;
}
</script>
<div class="mt10 mb10">
<div class="banner-big f16 fontGrey3" style="margin: 0 auto; position: relative;">
我收到的的作业
<div class="hw_more_box" >
<ul>
<li class="hw_more_icons fr">
<ul class="hw_more_txt">
<li> <a href="<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 0) %>" id="homework_type_all" class="hw_more_li" data-method="get" data-remote="true">全部作业</a> </li>
<li> <a href="<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 1) %>" id="homework_type_nor" class="hw_more_li" data-method="get" data-remote="true">普通作业</a> </li>
<li> <a href="<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 2) %>" id="homework_type_pro" class="hw_more_li" data-method="get" data-remote="true">编程作业</a> </li>
<li> <a href="<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 3) %>" id="homework_type_gro" class="hw_more_li" data-method="get" data-remote="true">分组作业</a> </li>
</ul>
</li>
</ul>
</div>
</div>
</div>
<div class="hw_content mb10" >
<div id="hw_tab_con_2">
<div class="sy_category" id="homework_search_input">
<%= render :partial=>'my_homeworks_search', :locals => {:type => @type,:property => nil, :order => @order, :search => ''} %>
</div>
<div class="sy_classbox" style="min-height:800px;" id="my_homework_list">
<%= render :partial => "receive_homework_list", :locals => {:homeworks => @homeworks} %>
</div>
<div style="text-align:center;">
<div class="pages" style="width:auto; display:inline-block;">
<ul id="homework_list_ref_pages">
<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
</ul>
<div class="cl"></div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,7 @@
$("#my_homework_list").html('<%= escape_javascript(render :partial => "receive_homework_list", :locals => {:homeworks => @homeworks})%>');
$("#homework_list_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');
$("#my_homework_sort").html('<%= escape_javascript( render :partial => 'users/my_homework_sort', :locals => {:type => @type,:property => @property,:order => @order,:search => @search})%>');
$("#homework_type_all").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 0) %>');
$("#homework_type_nor").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 1) %>');
$("#homework_type_pro").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 2) %>');
$("#homework_type_gro").attr('href','<%= manage_or_receive_homeworks_user_path(@user, :type => @type, :property => 3) %>');

View File

@ -0,0 +1,313 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true,init_activity: true) %>
<% end %>
<script xmlns="http://www.w3.org/1999/html">
function add_style(){
// $("#proeject_id").val("来源");
if($("select[id='tracker_id']").val() != 0){
$("#tracker_id").addClass('issues_filter_active');
}
if($("select[id='author_id']").val() != 0){
$("#author_id").addClass('issues_filter_active');
}
if($("select[id='assigned_to_id']").val() !=0){
$("#assigned_to_id").addClass('issues_filter_active');
}
if($("select[id='priority_id']").val() !=0){
$("#priority_id").addClass('issues_filter_active');
}
if($("select[id='fixed_version_id']").val() !=0){
$("#fixed_version_id").addClass('issues_filter_active');
}
if($("select[id='status_id']").val() != 0 ){
$("#status_id").addClass('issues_filter_active');
}
if($("select[id='done_ratio']").val() != -1){
$("#done_ratio").addClass('issues_filter_active');
}
if($("select[id='test']").val() != 0 ){
$("#test").addClass('issues_filter_active');
}
if($("select[id='tracker_id']").val() == 0){
$("#tracker_id").removeClass('issues_filter_active');
}
if($("select[id='author_id']").val() == 0){
$("#author_id").removeClass('issues_filter_active');
}
if($("select[id='assigned_to_id']").val() ==0){
$("#assigned_to_id").removeClass('issues_filter_active');
}
if($("select[id='priority_id']").val() ==0){
$("#priority_id").removeClass('issues_filter_active');
}
if($("select[id='fixed_version_id']").val() ==0){
$("#fixed_version_id").removeClass('issues_filter_active');
}
if($("select[id='status_id']").val() == 0 ){
$("#status_id").removeClass('issues_filter_active');
}
if($("select[id='done_ratio']").val() == -1){
$("#done_ratio").removeClass('issues_filter_active');
}
if($("select[id='test']").val() == 0 ){
$("#test").removeClass('issues_filter_active');
}
};
//issues列表
function g(o){
return document.getElementById(o);
}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=3;i++){
g('issues_list_nav_'+i).className='issues_nav_nomal';
g('issues_list_content_'+i).className='undis';
}
g('issues_list_content_'+n).className='dis';
g('issues_list_nav_'+n).className='issues_nav_hover';
}
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
$("input[nhname='date_show']").change(function(){
if($(this).val()=='创建日期起始' || $(this).val()=='创建日期结束')return;
$("input[nhname='date_val']",$(this).parent('div')).val($(this).val());
remote_function();
});
});
function remote_function() {
$("#issue_query_form").submit();
}
function remote_function_export(user) {
var project_id = $("#project_id").attr("value");
var tracker_id = $("#tracker_id").attr("value");
var subject = $("#v_subject").attr("value");
var assigned_to_id = $("#assigned_to_id").attr("value");
var fixed_version_id = $("#fixed_version_id").attr("value");
var status_id = $("#status_id").attr("value");
var done_ratio = $("#done_ratio").attr("value");
var test = $("#test").attr("value");
var author_id = $("#author_id").attr("value");
var priority_id = $("#priority_id").attr("value");
var issue_create_date_start = $("#issue_date_start_issue_export").attr("value");
var issue_create_date_end = $("#issue_date_end_issue_export").attr("value");
$("#sendexcel").attr("href","/users/"+user+"/user_receive_issues.xls?project_id="+project_id+"&tracker_id="+tracker_id+"&assigned_to_id="+assigned_to_id+"&fixed_version_id="+fixed_version_id+"&status_id="+status_id+"&done_ratio="+done_ratio+"&test="+test+"&author_id="+author_id+"&subject="+subject+"&issue_create_date_start="+issue_create_date_start+"&issue_create_date_end="+issue_create_date_end+"&priority_id="+priority_id);
///projects/1811/issues.xls?export=true&set_filter=1
}
function EnterPress(e){
var e = e || window.event;
if(e.keyCode == 13){
remote_function();
}
}
// 点击的时候让过滤条件选中assign_to
function switch_assign_to(assign) {
var assign = "option[value =" + assign + "]";
$("#issues_type_2").click(function(){
});
$("select[id='assigned_to_id']").find(assign).attr("selected", "selected");
$("select[id='author_id']").val('');
$("select[id='priority_id']").val('');
$("select[id='project_id']").val('');
$("select[id='tracker_id']").val('');
$("select[id='fixed_version_id']").val('');
$("select[id='status_id']").val('');
$("select[id='done_ratio']").val('');
$("select[id='test']").val('');
$("#tracker_id").removeClass('issues_filter_active');
$("#author_id").removeClass('issues_filter_active');
$("#assigned_to_id").addClass('issues_filter_active');
$("#priority_id").removeClass('issues_filter_active');
$("#fixed_version_id").removeClass('issues_filter_active');
$("#status_id").removeClass('issues_filter_active');
$("#done_ratio").removeClass('issues_filter_active');
$("#test").removeClass('issues_filter_active');
remote_function();
}
// 点击的时候让过滤条件选中user_id
function createByMe(user_id) {
var user = "option[value =" + user_id + "]";
$("#createByMe").click(function(){
});
$("select[id='author_id']").find(user).attr("selected", "selected");
$("select[id='assigned_to_id']").val('');
$("select[id='priority_id']").val('');
$("select[id='project_id']").val('');
$("select[id='tracker_id']").val('');
$("select[id='fixed_version_id']").val('');
$("select[id='status_id']").val('');
$("select[id='done_ratio']").val('');
$("select[id='test']").val('');
$("#tracker_id").removeClass('issues_filter_active');
$("#author_id").addClass('issues_filter_active');
$("#assigned_to_id").removeClass('issues_filter_active');
$("#priority_id").removeClass('issues_filter_active');
$("#fixed_version_id").removeClass('issues_filter_active');
$("#status_id").removeClass('issues_filter_active');
$("#done_ratio").removeClass('issues_filter_active');
$("#test").removeClass('issues_filter_active');
remote_function();
}
// 清楚表单所有选项
function all_reset_form() {
$("#issue_query_form")[0].reset();
$("select[id='author_id']").val('');
$("select[id='assigned_to_id']").val('');
$("input[nhname='date_val']").val('');
$("#tracker_id").removeClass('issues_filter_active');
$("#author_id").removeClass('issues_filter_active');
$("#assigned_to_id").removeClass('issues_filter_active');
$("#priority_id").removeClass('issues_filter_active');
$("#fixed_version_id").removeClass('issues_filter_active');
$("#status_id").removeClass('issues_filter_active');
$("#done_ratio").removeClass('issues_filter_active');
$("#test").removeClass('issues_filter_active');
$("#reorder_turnover_time").removeClass("sortArrowActiveU");
$("#reorder_turnover_time").addClass("sortArrowActiveD");
$("#reorder_release_time").removeClass("sortArrowActiveD");
$("#reorder_release_time").removeClass("sortArrowActiveU");
remote_function();
}
function add_class(id){
if($("#"+id).hasClass("sortArrowActiveD")){
$("#"+id).removeClass("sortArrowActiveD");
$("#"+id).addClass("sortArrowActiveU");
$.ajax({
type: 'GET',
url: '<%= user_receive_issues_user_path(@user) %>' + '.js?' + id + '=asc&page='+<%= @issue_pages.page %>,
data: $("#issue_query_form").serialize()
});
}else if($("#"+id).hasClass("sortArrowActiveU")){
$("#"+id).removeClass("sortArrowActiveU");
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
url: '<%= user_receive_issues_user_path(@user) %>' + '.js?' + id + '=desc&page='+<%= @issue_pages.page %>,
data: $("#issue_query_form").serialize()
});
}else{
$("#"+id).addClass("sortArrowActiveD");
$.ajax({
type: 'GET',
url: '<%= user_receive_issues_user_path(@user) %>' + '.js?' + id + '=desc&page='+<%= @issue_pages.page%>,
data: $("#issue_query_form").serialize()
});
}
}
$(function() {
$("#release_time").click(function(){
$("#reorder_turnover_time").removeClass("sortArrowActiveU");
$("#reorder_turnover_time").removeClass("sortArrowActiveD");
add_class("reorder_release_time");
});
$("#turnover_time").click(function () {
$("#reorder_release_time").removeClass("sortArrowActiveD");
$("#reorder_release_time").removeClass("sortArrowActiveU");
add_class("reorder_turnover_time");
});
});
</script>
<!--缺陷列表开始-->
<div id="myissues_con" class="myissues_con mb10">
<div class="myissues_head mb5">
<h2 class="ml15">我收到的Issue</h2>
</div>
<div class="clear mb5">
<div class="issues_statistics fl">
<ul>
<li>所有<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issues_filter.count %></a></li>
<li>开启<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issue_open_count %></a></li>
<li>关闭<a href="javascript:void(0);" class="issues_greycirbg_btn "><%= @issue_close_count %></a></li>
</ul>
</div><!--issues_statistics end-->
</div>
<%= form_tag( user_receive_issues_user_path(@user), :remote => 'xls', :method => "post", :id => "issue_query_form", :class => 'query_form') do %>
<div class="clear mb10">
<div class="hw_search_box fl ">
<input class="hw_search-input" placeholder="输入Issue名称进行搜索" type="text" id="v_subject" name="subject" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
<a href="javascript:void(0);" class="hw_btn_search" onclick="remote_function();" ></a>
</div>
<a href="javascript:void(0);" class="sy_btn_grey fl ml5" onclick="all_reset_form();">清除</a>
<div class="fr">
<a href="javascript:void(0);" class="linkGrey2 fl">排序:&nbsp;&nbsp;</a>
<div id="release_time" class="w65 fl"><a href="javascript:void(0);" class="linkGrey2 fl">发布时间</a><a href="javascript:void(0);" id="reorder_release_time" class=""></a></div>
<div id="turnover_time" class="w65 fl"><a href="javascript:void(0);" class="linkGrey2 fl">更新时间</a><a href="javascript:void(0);" id="reorder_turnover_time" class="sortArrowActiveD"></a></div>
</div>
</div>
<div class="issues_con_list" style="position: relative;">
<ul id="issues_list_nav" >
<li id="issues_list_nav_1" class="issues_nav_hover" onclick="HoverLi(1);all_reset_form();">
<a href="javascript:void(0);" id="issues_type_1" onclick="all_reset_form();" >搜索结果</a>
<span id="issue_filter_all"><%= render :partial => "users/my_issue_filter_all" %></span>
</li>
<div class="cl"></div>
</ul>
<div class="issues_filter">
<div class="issues_form_filter mt5 mr5">
<%= select( :project, :project_id, options_for_issue_project_list(@issues_filter),
{ :include_blank => false,:selected => @project_id ? @project_id : 0 },
{ :onchange => "remote_function();add_style();", :id => "project_id", :name => "project_id", :class => "fl", :style=>"width: 80px; margin-right:20px;"}
)%>
<select placeholder=" 发布人" class="fl my_issues_filter" disabled="disabled" style="padding:0px;width: 50px;margin-right: 15px;">
<option value="0" selected="selected">发布人</option>
</select>
<%= select( :issue, :user_id, [[@user.show_name, @user.id]].unshift(["发布人",0]),
{:include_blank => false,:selected => @author_id ? @author_id : 0},
{:onchange => "remote_function();add_style();",:id => "author_id", :name => "author_id", :class => "fl", :style => "visibility:hidden;width: 0px;margin:0px;padding:0px;"}
)
%>
<select placeholder=" 类型" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px;width:35px; margin-right:10px;">
<option value="0" selected="selected">类型</option>
</select>
<select placeholder=" 优先度" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px">
<option value="0" selected="selected">优先度</option>
</select>
<select placeholder=" 里程碑" class="fl my_issues_filter" disabled="disabled" style="padding:0px;margin-left: 20px; margin-right: 10px">
<option value="0" selected="selected">里程碑</option>
</select>
<select placeholder=" 状态" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin-right:10px;width:35px;">
<option value="0" selected="selected">状态</option>
</select>
<select placeholder=" 完成度" class="fl my_issues_filter" disabled="disabled" style="padding:0px; margin:0px">
<option value="0" selected="selected">完成度</option>
</select>
<select placeholder=" 排序" class="fl my_issues_filter" disabled="disabled" style="width:50px;visibility:hidden;margin-left: 0px;margin-right: 0px;">
<option value="0" selected="selected">排序</option>
</select>
</div>
<div class="cl"></div>
</div>
<% end %>
<% if @issues.empty? %>
<p class="nodata mt10"><%= l(:label_no_data) %></p>
<% else %>
<div id="issue_list">
<%= render :partial => 'users/user_receive_issues_list', :locals => {:issues => @issues, :issue_pages => @issue_pages, :issue_count => @issue_count, :subject => @subject } %>
</div>
<% end %>
</div>
<div class="cl"></div>
</div><!--issues_filter end-->
<div id="issues_list_content_1">
</div><!--issues_list_content_1 end-->
<div id="issues_list_content_2" class="undis">
</div><!--issues_list_content_2 end-->
<div id="issues_list_content_3" class="undis">
</div><!--issues_list_content_3 end-->
<!--issues_con_list end-->
<!--缺陷列表结束-->
<!--缺陷列表结束-->

View File

@ -0,0 +1,3 @@
$("#issue_filter_all").html("<%= escape_javascript(render :partial => 'users/my_issue_filter_all') %>");
$("#issue_list").html("<%= escape_javascript(render :partial => 'users/user_receive_issues_list',:locals => {:issues => @issues, :issue_pages=> @issue_pages, :issue_count => @issue_count })%>");
$("#issue_list_pagination").html('<%= pagination_links_full @issue_pages, @issue_count, :issues => @issues, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>');

View File

@ -291,7 +291,7 @@ zh:
label_tags_project_name: "项目名称:"
label_projects_new_name: "项目名称"
label_tags_project_description: "项目描述"
label_tags_project_description: "项目简介"
label_organization_name: "组织名称"
label_organization_description: "组织描述"

View File

@ -732,6 +732,10 @@ RedmineApp::Application.routes.draw do
get 'edit_brief_introduction'
get "user_resource"
match "user_issues", :to => 'users#user_issues', :via => [:get, :post], :as => "user_issues"
match "user_manage_issues", :to => 'users#user_manage_issues', :via => [:get, :post], :as => "user_manage_issues"
match "user_receive_issues", :to => 'users#user_receive_issues', :via => [:get, :post], :as => "user_receive_issues"
match "user_manage_homeworks", :to => 'users#user_manage_homeworks', :via => [:get, :post], :as => "user_manage_homeworks"
match "user_receive_homeworks", :to =>'users#user_receive_homeworks', :via => [:get, :post], :as => "user_receive_homeworks"
get "import_resources"
get "import_resources_search"
post "import_into_container"

View File

@ -11,8 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20161230061940) do
ActiveRecord::Schema.define(:version => 20161223083022) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
t.string "act_type", :null => false
@ -2434,16 +2433,6 @@ ActiveRecord::Schema.define(:version => 20161230061940) do
t.datetime "updated_at", :null => false
end
create_table "wechat_logs", :force => true do |t|
t.string "openid", :null => false
t.text "request_raw"
t.text "response_raw"
t.text "session_raw"
t.datetime "created_at", :null => false
end
add_index "wechat_logs", ["openid"], :name => "index_wechat_logs_on_openid"
create_table "wiki_content_versions", :force => true do |t|
t.integer "wiki_content_id", :null => false
t.integer "page_id", :null => false

18
lib/tasks/zip.rake Normal file
View File

@ -0,0 +1,18 @@
#coding=utf-8
namespace :zip do
desc "手工打包作品"
task :pack => :environment do
include ZipService
include Redmine::I18n
homework = Object.const_get(ENV['CLASS']).find ENV["ID"]
file_count = 0
homework.student_works.map { |work| file_count += work.attachments.count}
if file_count > 0
zipfile = zip_homework_common homework
else
zipfile = {:message => "no file"}
end
puts "out: #{zipfile}"
end
end

View File

@ -126,7 +126,7 @@
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-change="onPostChange(issue.comment, '{{issue.comment}}')" ng-model="issue.comment" placeholder="输入回复内容~" /></textarea>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-change="onPostChange(issue.comment, '{{issue.comment}}')" ng-model="issue.comment" placeholder="输入回复内容,您可以@别人啦~" /></textarea>
<button ng-click="addReply(issue,0)" ng-disabled="issue.disabled" ng-hide="issue.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="issue.disabled" ng-hide="!issue.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
@ -140,11 +140,17 @@
<div class="post-container wechat-at" ng-show="showAtDialog">
<div class="wechat-at-inner">
<div loading-spinner></div>
<div class="class-detail-name"><span class="course-name-width hidden inline-block">选择您要@的人</span>
<button ng-click="cancelAt()" class="cancel-btn-new fr border-radius">取消</button>
</div>
<ul class="weixin-users-all">
<li ng-repeat="person in at_persons track by $index" ng-click="selectAtPerson($index)"><p class="fl ">{{person.name}}</p><p class="fl ">{{person.login}}</p></li>
<li ng-repeat="person in at_persons track by $index" ng-click="selectAtPerson($index)"><p class="fl ">{{person.name}}</p><p class="fl ">{{person.login}}</p></li>
<li ng-repeat="person in at_persons track by $index" ng-click="selectAtPerson($index)"><p class="fl ">{{person.name}}</p><p class="fl ">{{person.login}}</p></li>
<li ng-repeat="person in at_persons track by $index" ng-click="selectAtPerson($index)"><p class="fl ">{{person.name}}</p><p class="fl ">{{person.login}}</p></li>
<li ng-repeat="person in at_persons track by $index" ng-click="selectAtPerson($index)"><p class="fl ">{{person.name}}</p><p class="fl ">{{person.login}}</p></li>
</ul>
</div>
</div>

View File

@ -942,6 +942,14 @@ $(function(){
$('a.tb_all').bind('ajax:complete', function (event, data, status, xhr) {
if(status == 'success'){
var res = JSON.parse(data.responseText);
if(res.err == -1){
var htmlvalue = '<div id="muban_popup_box" style="width:auto;"><div class="muban_popup_top"><h3 class="fl">温馨提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15 mr10 ml10"><p class="text_c f14">因附件资源太大请通过微信或者QQ联系Trustie管理员</br>辅助您完成下载</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 143px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue,380,166);
return;
}
if(res.length<1){
return;
}

View File

@ -248,6 +248,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
.w56 {width:56px;}
.w60{ width:60px;}
.w61{ width:61px;}
.w65{ width:65px;}
.w70{ width:70px;}
.w80{ width:80px;}
.w90{ width:90px;}
@ -878,6 +879,9 @@ input.btn-blue{background: #3b94d6; color: #fff; cursor:pointer;}
input:hover.btn-blue{background: #2788d0; color: #fff;}
input.btn-grey{background: #d9d9d9; color: #656565; cursor:default;}
input.btn-grey:hover{background: #717171; color: #fff; cursor:default;}
.icons-user-homework{background:url(/images/user/home-user-left.png) 0px -150px no-repeat; }
.homework-user-leftnav-li{ height: 25px; line-height: 40px; padding-left: 25px; color: #666;background:url(/images/user/home-user-left.png) 0px -149px no-repeat; font-size: 14px; position: relative; }
.homework-user-leftnav-li:hover{ height: 25px; line-height: 40px; padding-left: 25px; background:#f4f4f4; background:url(/images/user/home-user-left.png) 0px -186px no-repeat; font-size: 14px; position: relative; }
.separator_short{margin-top: 5px; margin-bottom: 5px; margin-left: 37px; width: 433px; display: block; border-bottom: 1px solid #d9d9d9;}
.separator_long{margin-top: 5px; margin-bottom: 5px; margin-left: 37px; width: 522px; display: block; border-bottom: 1px solid #d9d9d9;}

View File

@ -283,7 +283,9 @@ a.underline {text-decoration:underline;}
.weixin-users-all li:hover{ background:#f4f4f4;}
/*弹出@选择对话框 guange*/
.wechat-at {position: absolute; z-index: 999; top: 0; left:0; width: 100%; height: 100%; background-color: #ffffff;}
.wechat-at {position: fixed; z-index: 999; top: 0; left:0; width: 100%; height: 100%; background-color: #ffffff;}
.wechat-at-inner{overflow-y: scroll;
-webkit-overflow-scrolling: touch;
height: 100%;}
/*@页面的取消按钮*/
.cancel-btn-new {position: absolute; font-size: 13px; height: 24px; line-height: 24px; vertical-align: middle; padding: 0 7px; color: #888; background-color: #fff; outline: none; border: none; top: 11px; right: 10px;}
.cancel-btn-new {font-size: 13px; height: 24px; line-height: 24px; padding: 0 7px; color: #888; background-color: #fff; outline: none; border: none; margin-top: 11px; margin-right: 10px;}