Merge branch 'szzh' into develop

This commit is contained in:
cxt 2016-01-29 15:46:54 +08:00
commit d58d8f6fb4
76 changed files with 1293 additions and 586 deletions

View File

@ -34,6 +34,12 @@ class AtController < ApplicationController
find_homework(id) find_homework(id)
when 'Topic' when 'Topic'
find_topic(id) find_topic(id)
when 'JournalsForMessage'
find_journals_for_message(id)
when 'Principal'
find_principal(id)
when 'All'
nil
else else
nil nil
end end
@ -120,7 +126,11 @@ class AtController < ApplicationController
#JournalsForMessage #JournalsForMessage
def find_journals_for_message(id) def find_journals_for_message(id)
jounrnal = JournalsForMessage.find(id) jounrnal = JournalsForMessage.find(id)
find_at_users(jounrnal.jour_type, jounrnal.jour_id) if jounrnal.jour_type == 'Principal'
[jounrnal.user] + (JournalsForMessage.where(m_reply_id: id).map(&:user) || [])
else
find_at_users(jounrnal.jour_type, jounrnal.jour_id)
end
end end
#Poll #Poll
@ -129,8 +139,6 @@ class AtController < ApplicationController
#Journal #Journal
def find_journal(id) def find_journal(id)
journal = Journal.find(id)
find_at_users(journal.journalized_type, journal.journalized_id)
end end
#Document #Document
@ -145,7 +153,6 @@ class AtController < ApplicationController
#Principal #Principal
def find_principal(id) def find_principal(id)
end end
#BlogComment #BlogComment

View File

@ -55,8 +55,8 @@ class BlogCommentsController < ApplicationController
if params[:in_act] if params[:in_act]
redirect_to user_path(params[:user_id]) redirect_to user_path(params[:user_id])
else else
if params[:is_homepage] if @article.id.eql?(User.find(params[:user_id]).blog.homepage_id)
redirect_to user_blogs_path(params[:user_id]) redirect_to user_path(params[:user_id])
else else
redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id]) redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id])
end end

View File

@ -321,11 +321,12 @@ class CoursesController < ApplicationController
def export_course_member_excel def export_course_member_excel
@all_members = student_homework_score(0,0,0,"desc") @all_members = student_homework_score(0,0,0,"desc")
@homeworks = @course.homework_commons.order("created_at desc")
filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}"; filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}";
respond_to do |format| respond_to do |format|
format.xls { format.xls {
send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present", send_data(member_to_xls(@homeworks,@course,@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present",
:filename => filename_for_content_disposition("#{filename}.xls")) :filename => filename_for_content_disposition("#{filename}.xls"))
} }
end end
@ -441,7 +442,10 @@ class CoursesController < ApplicationController
@course = cs.create_course(params,User.current)[:course] @course = cs.create_course(params,User.current)[:course]
if params[:copy_course] if params[:copy_course]
copy_course = Course.find params[:copy_course].to_i copy_course = Course.find params[:copy_course].to_i
@course.update_attributes(:open_student => copy_course.open_student, :publish_resource => copy_course.publish_resource) @course.is_copy = 1
@course.open_student = copy_course.open_student
@course.publish_resource = copy_course.publish_resource
@course.save
if params[:checkAll] if params[:checkAll]
attachments = copy_course.attachments attachments = copy_course.attachments
attachments.each do |attachment| attachments.each do |attachment|
@ -903,6 +907,17 @@ class CoursesController < ApplicationController
return 404 return 404
end end
end end
#搜索作业
def homework_search
@search = "%#{params[:search].strip.downcase}%"
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
@page = params[:page] ? params[:page].to_i + 1 : 0
if @is_teacher
@homeworks = @course.homework_commons.where("name like '%#{@search}%'").order("created_at desc").limit(10).offset(@page * 10)
else
@homeworks = @course.homework_commons.where("name like '%#{@search}%' and publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
end
end
private private
def update_quotes attachment def update_quotes attachment
@ -960,7 +975,7 @@ class CoursesController < ApplicationController
sql_select = "" sql_select = ""
if groupid == 0 if groupid == 0
sql_select = "SELECT members.*,( sql_select = "SELECT members.*,(
SELECT SUM(student_works.final_score) SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))
FROM student_works,homework_commons FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = #{@course.id} AND homework_commons.course_id = #{@course.id}
@ -972,7 +987,7 @@ class CoursesController < ApplicationController
WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}" WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}"
else else
sql_select = "SELECT members.*,( sql_select = "SELECT members.*,(
SELECT SUM(student_works.final_score) SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))
FROM student_works,homework_commons FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = #{@course.id} AND homework_commons.course_id = #{@course.id}
@ -1006,16 +1021,54 @@ class CoursesController < ApplicationController
end end
def member_to_xls members,groups def member_to_xls homeworks, course, members,groups
xls_report = StringIO.new xls_report = StringIO.new
book = Spreadsheet::Workbook.new book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "student" sheet1 = book.create_worksheet :name => "student"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10 blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue #sheet1.row(0).default_format = blue
#sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)])
sheet1[0,0] = "课程编号"
sheet1[0,1] = course.id
sheet1[1,0] = "课程学期"
sheet1[1,1] = course.time.to_s+""+course.term
sheet1[2,0] = "课程名称"
sheet1[2,1] = course.name
sheet1[3,0] = "教师团队"
sheet1[3,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、')
sheet1[4,0] = "主讲教师"
sheet1[4,1] = course.teacher.show_name
sheet1[5,0] = "排名"
sheet1[5,1] = "学生姓名"
sheet1[5,2] = "昵称"
sheet1[5,3] = "学号"
for i in 0 ... homeworks.count
sheet1[5,i+4] = ""+(i+1).to_s+""
end
sheet1[5,homeworks.count+4] = "总成绩"
sheet1[5,0] = "排名"
sheet1[5,0] = "排名"
count_row = 6
members.each_with_index do |member, i|
sheet1[count_row,0]= i+1
sheet1[count_row,1] = member.user.lastname.to_s + member.user.firstname.to_s
sheet1[count_row,2] = member.user.login
sheet1[count_row,3] = member.user.user_extensions.student_id
homeworks.each_with_index do |homework, j|
student_works = homework.student_works.where("user_id = #{member.user.id}")
if student_works.empty?
sheet1[count_row,j+4] = format("%0.2f",0)
else
final_score = student_works.first.final_score.nil? ? 0 : student_works.first.final_score
score = final_score - student_works.first.absence_penalty - student_works.first.late_penalty
sheet1[count_row,j+4] = format("%0.2f",score <0 ? 0:score)
end
end
sheet1[count_row,homeworks.count+4] = format("%0.2f",member.score.nil? ? 0:member.score.to_s)
count_row += 1
end
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_score)]) =begin
count_row = 1
group0 = CourseGroup.new(); group0 = CourseGroup.new();
group0.id = 0; group0.id = 0;
group0.name = l(:excel_member_with_out_class) group0.name = l(:excel_member_with_out_class)
@ -1037,6 +1090,7 @@ class CoursesController < ApplicationController
end end
end end
end end
=end
book.write xls_report book.write xls_report
xls_report.string xls_report.string
end end

View File

@ -15,8 +15,12 @@ class HomeworkCommonController < ApplicationController
@new_homework.homework_detail_manual = HomeworkDetailManual.new @new_homework.homework_detail_manual = HomeworkDetailManual.new
@new_homework.course = @course @new_homework.course = @course
@page = params[:page] ? params[:page].to_i + 1 : 0 @page = params[:page] ? params[:page].to_i + 1 : 0
@homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10)
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
if @is_teacher
@homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10)
else
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
end
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher)) @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
@is_new = params[:is_new] @is_new = params[:is_new]

View File

@ -109,7 +109,8 @@ class OrgSubfieldsController < ApplicationController
if SubfieldSubdomainDir.find_by_sql(sql).count == 0 if SubfieldSubdomainDir.find_by_sql(sql).count == 0
if @org_subfield.subfield_subdomain_dir if @org_subfield.subfield_subdomain_dir
@sub_dir = @org_subfield.subfield_subdomain_dir @sub_dir = @org_subfield.subfield_subdomain_dir
@sub_dir.update_attribute(:name, params[:sub_dir_name]) @sub_dir = SubfieldSubdomainDir.update(@sub_dir.id, :name => params[:sub_dir_name])
#@sub_dir.update_attribute(:name, params[:sub_dir_name])
else else
@sub_dir = SubfieldSubdomainDir.create(:org_subfield_id => @org_subfield.id, :name => params[:sub_dir_name]) @sub_dir = SubfieldSubdomainDir.create(:org_subfield_id => @org_subfield.id, :name => params[:sub_dir_name])
end end

View File

@ -302,7 +302,7 @@ class OrganizationsController < ApplicationController
def org_resources_subfield def org_resources_subfield
@org = Organization.find(params[:id]) @org = Organization.find(params[:id])
if params[:send_type].present? and params[:send_type] == 'news' if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message')
@subfield = @org.org_subfields.where("field_type = 'Post'") @subfield = @org.org_subfields.where("field_type = 'Post'")
else else
@subfield = @org.org_subfields.where('field_type = "Resource" ') @subfield = @org.org_subfields.where('field_type = "Resource" ')

View File

@ -403,8 +403,47 @@ class UsersController < ApplicationController
#导入作业 #导入作业
def user_import_homeworks def user_import_homeworks
@user = User.current
@select_course = params[:select_course] ? 1 : 0 @select_course = params[:select_course] ? 1 : 0
@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") #@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc")
visible_course = Course.where("is_public = 1 && is_delete = 0")
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc")
@type = params[:type]
@limit = 15
@is_remote = true
@hw_count = @homeworks.count
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
@offset ||= @hw_pages.offset
@homeworks = paginateHelper @homeworks,15
respond_to do |format|
format.js
end
end
def user_homework_type
@user = User.current
if(params[:type].blank? || params[:type] == "1") #公共题库
visible_course = Course.where("is_public = 1 && is_delete = 0")
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc")
elsif params[:type] == "2" #我的题库
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc")
end
@type = params[:type]
@limit = 15
@is_remote = true
@hw_count = @homeworks.count
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
@offset ||= @hw_pages.offset
@homeworks = paginateHelper @homeworks,15
respond_to do |format|
format.js
end
end
def show_homework_detail
@homework = HomeworkCommon.find params[:homework].to_i
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -412,7 +451,22 @@ class UsersController < ApplicationController
#用户主页过滤作业 #用户主页过滤作业
def user_search_homeworks def user_search_homeworks
@user_homeworks = HomeworkCommon.where("user_id = '#{@user.id}' and lower(name) like '%#{params[:name].to_s.downcase}%'").order("created_at desc") @user = User.current
search = params[:name].to_s.strip.downcase
if(params[:type].blank? || params[:type] == "1") #全部
visible_course = Course.where("is_public = 1 && is_delete = 0")
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'} and (name like '%#{search}%')").order("created_at desc")
elsif params[:type] == "2" #课程资源
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc")
end
@type = params[:type]
@limit = 15
@is_remote = true
@hw_count = @homeworks.count
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
@offset ||= @hw_pages.offset
@homeworks = paginateHelper @homeworks,15
respond_to do |format| respond_to do |format|
format.js format.js
end end
@ -426,6 +480,7 @@ class UsersController < ApplicationController
@homework = HomeworkCommon.new @homework = HomeworkCommon.new
@select_course = params[:select_course] || 0 @select_course = params[:select_course] || 0
if homework if homework
@ref_homework = homework
@homework.name = homework.name @homework.name = homework.name
@homework.description = homework.description @homework.description = homework.description
@homework.end_time = homework.end_time @homework.end_time = homework.end_time
@ -583,13 +638,15 @@ class UsersController < ApplicationController
homework_detail_manual.save if homework_detail_manual homework_detail_manual.save if homework_detail_manual
homework_detail_programing.save if homework_detail_programing homework_detail_programing.save if homework_detail_programing
homework_detail_group.save if homework_detail_group homework_detail_group.save if homework_detail_group
if params[:quotes] && !params[:quotes].blank?
homework = HomeworkCommon.find params[:quotes].to_i
homework.update_attribute(:quotes, homework.quotes+1)
end
if params[:is_in_course] == "1" if params[:is_in_course] == "1"
redirect_to homework_common_index_path(:course => homework.course_id) redirect_to homework_common_index_path(:course => homework.course_id)
else else
redirect_to user_homeworks_user_path(User.current.id) redirect_to user_homeworks_user_path(User.current.id)
end end
end end
end end
else else
@ -755,23 +812,17 @@ class UsersController < ApplicationController
if params[:type].present? if params[:type].present?
case params[:type] case params[:type]
when "public" when "public"
jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('created_on DESC') jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('updated_on DESC')
@jour_count = jours.count
@jour = jours.limit(10).offset(@page * 10)
when "private" when "private"
jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('created_on DESC') jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('updated_on DESC')
@jour_count = jours.count
@jour = jours.limit(10).offset(@page * 10)
else else
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC')
@jour_count = jours.count
@jour = jours.limit(10).offset(@page * 10)
end end
else else
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC') jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC')
@jour_count = jours.count
@jour = jours.limit(10).offset(@page * 10)
end end
@jour_count = jours.count
@jour = jours.limit(10).offset(@page * 10)
@type = params[:type] @type = params[:type]
if User.current == @user if User.current == @user
jours.update_all(:is_readed => true, :status => false) jours.update_all(:is_readed => true, :status => false)
@ -1633,6 +1684,10 @@ class UsersController < ApplicationController
attach_copied_obj.attachtype = 1 attach_copied_obj.attachtype = 1
end end
attach_copied_obj.save attach_copied_obj.save
unless Project.find(project_id).project_score.nil?
Project.find(project_id).project_score.update_attribute(:attach_num,
Project.find(project_id).project_score.attach_num + 1)
end
end end
end end
elsif params[:send_ids].present? elsif params[:send_ids].present?
@ -1668,6 +1723,9 @@ class UsersController < ApplicationController
attach_copied_obj.attachtype = 1 attach_copied_obj.attachtype = 1
end end
attach_copied_obj.save attach_copied_obj.save
unless Project.find(project_id).project_score.nil?
Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1)
end
end end
end end
end end
@ -1796,16 +1854,6 @@ class UsersController < ApplicationController
def share_news_to_project def share_news_to_project
news = News.find(params[:send_id]) news = News.find(params[:send_id])
project_ids = params[:project_ids] project_ids = params[:project_ids]
# project_ids.each do |project_id|
# if Project.find(project_id).news.map(&:id).exclude?(news.id)
# project_news = News.create(:project_id => project_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now)
# news.attachments.each do |attach|
# project_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
# :downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
# :is_public => attach.is_public, :quotes => 0)
# end
# end
# end
project_ids.each do |project_id| project_ids.each do |project_id|
project = Project.find(project_id) project = Project.find(project_id)
if project.news.map(&:id).exclude?(news.id) if project.news.map(&:id).exclude?(news.id)
@ -1831,6 +1879,53 @@ class UsersController < ApplicationController
OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'News', :org_act_id => org_news.id, :user_id => User.current.id) OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'News', :org_act_id => org_news.id, :user_id => User.current.id)
end end
def share_message_to_course
@message = Message.find(params[:send_id])
course_ids = params[:course_ids]
course_ids.each do |course_id|
course = Course.find(course_id)
if course.news.map(&:id).exclude?(@message.id)
message = Message.create(:board_id => course.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id)
@message.attachments.each do |attach|
message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
:is_public => attach.is_public, :quotes => 0)
end
end
end
end
def share_message_to_project
@message = Message.find(params[:send_id])
project_ids = params[:project_ids]
project_ids.each do |project_id|
project = Project.find(project_id)
if project.news.map(&:id).exclude?(@message.id)
message = Message.create(:board_id => project.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id)
@message.attachments.each do |attach|
message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
:is_public => attach.is_public, :quotes => 0)
end
end
end
end
def share_message_to_org
field_id = params[:subfield]
@message = Message.find(params[:send_id])
@message.quotes = @message.quotes.nil? ? 1 : (@message.quotes + 1)
@message.save
board = OrgSubfield.find(field_id).boards.first
mes = Message.create(:board_id => board.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id)
@message.attachments.each do |attach|
mes.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
:is_public => attach.is_public, :quotes => 0)
end
OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'Message', :org_act_id => mes.id, :user_id => User.current.id)
end
def change_org_subfield def change_org_subfield
end end
@ -2072,9 +2167,9 @@ class UsersController < ApplicationController
end end
elsif params[:type] == "4" #附件 elsif params[:type] == "4" #附件
if User.current.id.to_i == params[:id].to_i if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") @attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
else else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc") @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
end end
elsif params[:type] == "5" #用户资源 elsif params[:type] == "5" #用户资源
if User.current.id.to_i == params[:id].to_i if User.current.id.to_i == params[:id].to_i
@ -2180,7 +2275,7 @@ class UsersController < ApplicationController
@user = User.current @user = User.current
if !params[:search].nil? #发送到有栏目类型为资源的组织中 if !params[:search].nil? #发送到有栏目类型为资源的组织中
search = "%#{params[:search].to_s.strip.downcase}%" search = "%#{params[:search].to_s.strip.downcase}%"
if params[:send_type].present? and params[:send_type] == 'news' if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message')
@orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Post'").count > 0} @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Post'").count > 0}
else else
@orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0} @orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}

View File

@ -62,6 +62,7 @@ class WordsController < ApplicationController
update_forge_activity('JournalsForMessage',parent_id) update_forge_activity('JournalsForMessage',parent_id)
update_org_activity('JournalsForMessage',parent_id) update_org_activity('JournalsForMessage',parent_id)
update_principal_activity('JournalsForMessage',parent_id) update_principal_activity('JournalsForMessage',parent_id)
(JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now)
end end
respond_to do |format| respond_to do |format|
# format.html { # format.html {
@ -73,7 +74,6 @@ class WordsController < ApplicationController
# render 'test/index' # render 'test/index'
# } # }
format.js { format.js {
@reply_type = params[:reply_type]
@user_activity_id = params[:user_activity_id] @user_activity_id = params[:user_activity_id]
@activity = JournalsForMessage.find(parent_id) @activity = JournalsForMessage.find(parent_id)
@is_activity = params[:is_activity] @is_activity = params[:is_activity]
@ -95,6 +95,9 @@ class WordsController < ApplicationController
@user = User.find(@journal_destroyed.jour_id) @user = User.find(@journal_destroyed.jour_id)
@jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count @jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count
@is_user = true @is_user = true
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@is_activity = params[:is_activity].to_i if params[:is_activity]
@activity = @journal_destroyed.parent if @journal_destroyed.parent
elsif @journal_destroyed.jour_type == 'HomeworkCommon' elsif @journal_destroyed.jour_type == 'HomeworkCommon'
@homework = HomeworkCommon.find @journal_destroyed.jour_id @homework = HomeworkCommon.find @journal_destroyed.jour_id
if params[:user_activity_id] if params[:user_activity_id]

View File

@ -697,17 +697,16 @@ module CoursesHelper
def join_in_course_header(course, user, options=[]) def join_in_course_header(course, user, options=[])
if user.logged? if user.logged?
joined = course.members.map{|member| member.user_id}.include? user.id joined = course.members.map{|member| member.user_id}.include? user.id
text = joined ? ("<em class='pr_arrow'></em>".html_safe + l(:label_course_exit_student)) : ("<em class='pr_add'></em>".html_safe + l(:label_course_join_student)) text = joined ? l(:label_course_exit_student) : l(:label_course_join_student)
url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
method = joined ? 'delete' : 'post' method = joined ? 'delete' : 'post'
if joined if joined
link = "<span class='pr_join_span mr5' ><em class='pr_add'></em>#{l(:label_course_join_student)}</span>" + link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) link = link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out))
else else
link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") + "<span class='pr_join_span mr5' ><em class='pr_arrow'></em>#{l(:label_course_exit_student)}</span>".html_safe link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a")
end end
else else
link = "<span class='pr_join_span mr5' ><em class='pr_add'></em>#{l(:label_course_join_student)}</span>" + link = "<span class='pr_join_span mr5' >#{l(:label_course_join_student)}</span>"
"<span class='pr_join_span mr5' ><em class='pr_arrow'></em>#{l(:label_course_exit_student)}</span>"
end end
link.html_safe link.html_safe
end end
@ -796,7 +795,7 @@ module CoursesHelper
# 学生按作业总分排序取前8个 # 学生按作业总分排序取前8个
def hero_homework_score(course, score_sort_by) def hero_homework_score(course, score_sort_by)
sql_select = "SELECT members.*,( sql_select = "SELECT members.*,(
SELECT SUM(student_works.final_score) SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))
FROM student_works,homework_commons FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = #{course.id} AND homework_commons.course_id = #{course.id}

View File

@ -47,7 +47,11 @@ class AtMessage < ActiveRecord::Base
"回复帖子: " "回复帖子: "
end + at_message.subject end + at_message.subject
when 'JournalsForMessage' when 'JournalsForMessage'
"作业: #{at_message.jour.name} 中留言" if at_message.jour_type == 'Principal'
"留言: 在#{at_message.at_user.show_name}主页中留言"
else
"作业: #{at_message.jour.name} 中留言"
end
else else
logger.error "error type: #{at_message_type}" logger.error "error type: #{at_message_type}"
end end
@ -92,7 +96,12 @@ class AtMessage < ActiveRecord::Base
when 'Message' when 'Message'
{controller: :boards, action: :show, project_id: at_message.board.project, id: at_message.board} {controller: :boards, action: :show, project_id: at_message.board.project, id: at_message.board}
when 'JournalsForMessage' when 'JournalsForMessage'
{controller: :homework_common, action: :index, course: at_message.jour.course_id} if at_message.jour_type == 'Principal'
{controller: :users, action: :user_messages, id: at_message.at_user}
else
{controller: :homework_common, action: :index, course: at_message.jour.course_id}
end
else else
logger.error "error type: #{at_message_type}" logger.error "error type: #{at_message_type}"
end end

View File

@ -70,7 +70,7 @@ class JournalsForMessage < ActiveRecord::Base
validates :notes, presence: true, if: :is_homework_jour? validates :notes, presence: true, if: :is_homework_jour?
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score
after_create :reset_counters! after_create :reset_counters!
after_update :update_ativity #after_update :update_activity
after_destroy :reset_counters! after_destroy :reset_counters!
after_save :be_user_score after_save :be_user_score
after_destroy :down_user_score after_destroy :down_user_score

View File

@ -1,4 +1,5 @@
class SubfieldSubdomainDir < ActiveRecord::Base class SubfieldSubdomainDir < ActiveRecord::Base
# attr_accessible :title, :body # attr_accessible :title, :body
belongs_to :org_subfield belongs_to :org_subfield
validates_exclusion_of :name, :in => %w(setting members org_document_comments)
end end

View File

@ -0,0 +1,46 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<style type="text/css">
/*回复框*/
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url("/images/public_icon.png")}
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-outline {border: none;}
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
.homepagePostReplyInputContainer .ke-container {float: left;}
</style>
<div id="user_homework_list">
<% homework_commons.each do |homework_common|%>
<script type="text/javascript">
$(function() {
init_activity_KindEditor_data(<%= homework_common.id%>, null, "87%", "<%=homework_common.class.to_s%>");
});
function expand_reply(container,btnid){
var target = $(container);
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('收起回复');
target.show();
}else{
btn.data('init',0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
</script>
<%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %>
<% end%>
<% if homework_commons.count == 10%>
<%= link_to "点击展开更多",homework_search_course_path(course_id,:page => page,:search=>search),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
<% end%>
</div>

View File

@ -0,0 +1,5 @@
<% if @page == 0 %>
$("#user_homework_list").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>");
<% else %>
$("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>");
<% end %>

View File

@ -185,20 +185,6 @@
} }
function org_id_click(){
var sendText = $("input[name='org_id']:checked").next().text();
var orgDirection = "目标地址:"
$(".orgDirection").text(orgDirection + sendText);
}
function subfield_click(){
var sendText = $("input[name='org_id']:checked").next().text();
var orgDirection = "目标地址:"
var sendColumn = $("input[name='subfield']:checked").next().text();
$(".orgDirection").text(orgDirection + sendText + " / " + sendColumn);
}
function course_attachmenttypes_change(id, type) { function course_attachmenttypes_change(id, type) {
<% if @course%> <% if @course%>
$.ajax({ $.ajax({

View File

@ -0,0 +1,6 @@
<%= form_tag( url_for(:controller => 'courses',:action => 'homework_search',:id=>course.id),
:remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %>
<input type="text" name="search" placeholder="输入作业关键词进行搜索" class="searchResource" />
<%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %>
<!--<a href="javascript:void(0);" onclick='this.parent.submit();return false;' class="searchIcon"></a>-->
<% end %>

View File

@ -36,6 +36,9 @@
<div class="homepageRight mt0 ml10"> <div class="homepageRight mt0 ml10">
<div class="homepageRightBanner mb10"> <div class="homepageRightBanner mb10">
<div class="NewsBannerName">作业</div> <div class="NewsBannerName">作业</div>
<div id="search_div" class="fr mr10">
<%= render :partial => 'homework_search_form',:locals => {:course=>@course} %>
</div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
@ -50,8 +53,8 @@
<% end%> <% end%>
</div><!----HomeWork end--> </div><!----HomeWork end-->
<% end%> <% end%>
<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homeworks,:page => 0,:is_in_course => 1,:course_id => @course.id} %> <%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homeworks,:page => 0,:is_in_course => 1,:course_id => @course.id} %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -5,7 +5,7 @@
<div class="fl"> <div class="fl">
<ul> <ul>
<li class="navHomepageMenu fl"> <li class="navHomepageMenu fl">
<%= link_to "首页",user_activities_path(User.current.id), :class => "c_white f16 db p10"%> <%= link_to "首页",user_activities_path(User.current.id), :class => "c_white f16 db p10", :title => "回到个人首页"%>
</li> </li>
<li class="navHomepageMenu fl"> <li class="navHomepageMenu fl">
<a href="<%=url_for(:controller => 'users', :action => 'user_resource',:id=>User.current.id,:type=>1)%>" class="c_white f16 db p10">资源库</a></li> <a href="<%=url_for(:controller => 'users', :action => 'user_resource',:id=>User.current.id,:type=>1)%>" class="c_white f16 db p10">资源库</a></li>
@ -102,7 +102,7 @@
</div> </div>
<div class="navHomepageNews"> <div class="navHomepageNews">
<%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon", :target =>"_Blank" %> <%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon", :target =>"_Blank", :title => "您的所有消息" %>
<% if User.current.count_new_message >0 %> <% if User.current.count_new_message >0 %>
<div ><%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target =>"_Blank" %></div> <div ><%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target =>"_Blank" %></div>
<% end %> <% end %>

View File

@ -9,13 +9,16 @@
<!--<a href="#"><img src="images/courses/pic_courses.jpg" width="60" height="60" alt="logo" /></a>--> <!--<a href="#"><img src="images/courses/pic_courses.jpg" width="60" height="60" alt="logo" /></a>-->
<%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %> <%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
</div> </div>
<div class="pr_info_id fl mb5 f14"><%= @course.is_public == 0 ? "私有课程" : "公开课程" %> <div class="pr_info_id fl mb5 f14">ID:<%= @course.id%><%= @course.is_public == 0 ? "(私有)" : "(公开)" %>
<% if is_excellent_course(@course) %> <% if is_excellent_course(@course) %>
<img src="/images/course/medal.png" alt="精品课程" style="vertical-align:bottom;" class="ml5" /> <img src="/images/course/medal.png" alt="精品课程" style="vertical-align:bottom;" class="ml5" />
<% end %> <% end %>
</div> </div>
<div class="pr_info_id fl f14"> <div class="pr_info_id fl f14">
ID:<%= @course.id%> <% unless is_teacher %>
<!--<a href="" class="pr_join_a f12">加入课程</a>-->
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
<% end %>
</div> </div>
<!--<div class="pr_info_id fl mb5 f14"> <!--<div class="pr_info_id fl mb5 f14">
ID:<%#= @course.id%> ID:<%#= @course.id%>

View File

@ -60,7 +60,7 @@
) if @message.course_destroyable_by?(User.current) %> ) if @message.course_destroyable_by?(User.current) %>
</li> </li>
<% end %> <% end %>
<li> <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %></li> <li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -175,4 +175,4 @@
postContent = postContent.replace(/&nbsp;/g," "); postContent = postContent.replace(/&nbsp;/g," ");
$("#message_description_<%= @topic.id %>").html(postContent); $("#message_description_<%= @topic.id %>").html(postContent);
}); });
</script> </script>

View File

@ -58,7 +58,7 @@
} }
$(function() { $(function() {
init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>"); init_activity_KindEditor_data(<%= @topic.id%>,null,"94%", "<%=@topic.class.to_s%>");
showNormalImage('message_description_<%= @topic.id %>'); showNormalImage('message_description_<%= @topic.id %>');
}); });
</script> </script>
@ -68,7 +68,7 @@
<%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %> <%= link_to image_tag(url_to_avatar(@topic.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@topic.author) %>
</div> </div>
<div class="postThemeWrap"> <div class="postThemeWrap">
<% if @message.org_subfield_editable_by?(User.current) %> <% if User.current.logged? %>
<div class="homepagePostSetting" id="message_setting_<%= @topic.id%>" style="display: none"> <div class="homepagePostSetting" id="message_setting_<%= @topic.id%>" style="display: none">
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">
@ -89,6 +89,7 @@
:class => 'postOptionLink' :class => 'postOptionLink'
) if @message.org_subfield_editable_by?(User.current) %> ) if @message.org_subfield_editable_by?(User.current) %>
</li> </li>
<li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id}, #{User.current.id}, 'message');",:class => 'postOptionLink'%></li>
<!--<li> <%#= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %></li>--> <!--<li> <%#= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %></li>-->
</ul> </ul>
</li> </li>
@ -204,4 +205,4 @@
postContent = postContent.replace(/&nbsp;/g," "); postContent = postContent.replace(/&nbsp;/g," ");
$("#message_description_<%= @topic.id %>").html(postContent); $("#message_description_<%= @topic.id %>").html(postContent);
}); });
</script> </script>

View File

@ -115,7 +115,7 @@
) if @message.destroyable_by?(User.current) %> ) if @message.destroyable_by?(User.current) %>
</li> </li>
<% end %> <% end %>
<li> <%= link_to "发送",messages_join_org_subfield_path(:message_id => @topic.id) , :remote=> true,:class => 'postOptionLink' %></li> <li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %></li>
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@ -178,20 +178,6 @@
} }
function org_id_click(){
var sendText = $("input[name='org_id']:checked").next().text();
var orgDirection = "目标地址:"
$(".orgDirection").text(orgDirection + sendText);
}
function subfield_click(){
var sendText = $("input[name='org_id']:checked").next().text();
var orgDirection = "目标地址:"
var sendColumn = $("input[name='subfield']:checked").next().text();
$(".orgDirection").text(orgDirection + sendText + " / " + sendColumn);
}
function course_attachmenttypes_change(id, type) { function course_attachmenttypes_change(id, type) {
<% if @course%> <% if @course%>
$.ajax({ $.ajax({

View File

@ -1,11 +1,6 @@
<% if @exist == false %> <% if @exist == false and @sub_dir.valid? %>
$('#sub_dir_show_<%= @org_subfield.id %>').html('<%= @sub_dir.name %>'); $('#sub_dir_show_<%= @org_subfield.id %>').html('<%= @sub_dir.name %>');
$('#sub_dir_edit_<%= @org_subfield.id %>').find('input').val('<%= @sub_dir.name %>'); $('#sub_dir_edit_<%= @org_subfield.id %>').find('input').val('<%= @sub_dir.name %>');
// $('#sub_dir_show_<%= @org_subfield.id %>').show();
// $('#sub_dir_edit_<%= @org_subfield.id %>').hide();
<% else %> <% else %>
$('#sub_dir_edit_<%= @org_subfield.id %>').find('input').val('<%= @org_subfield.subfield_subdomain_dir.nil? ? '': @org_subfield.subfield_subdomain_dir.name %>'); $('#sub_dir_edit_<%= @org_subfield.id %>').find('input').val('<%= @org_subfield.subfield_subdomain_dir.nil? ? '': @org_subfield.subfield_subdomain_dir.name %>');
// alert("该目录已存在,请重新输入");
// $('#sub_dir_edit_<%#= @org_subfield.id %>').find('input').val('<%#= @org_subfield.subfield_subdomain_dir.nil? ? "未设置":@org_subfield.subfield_subdomain_dir.name %>');
// $('#sub_dir_edit_<%#= @org_subfield.id %>').focus();
<% end %> <% end %>

View File

@ -13,7 +13,6 @@
<% end %> <% end %>
TO TO
<%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",organization_path(activity.board.org_subfield.organization, :org_subfield_id => activity.board.org_subfield.id), :class => "newsBlue ml15 mr5"%> <%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",organization_path(activity.board.org_subfield.organization, :org_subfield_id => activity.board.org_subfield.id), :class => "newsBlue ml15 mr5"%>
<!--<a href="javascript:void(0);" class="newsBlue ml15 mr5"><%= activity.board.org_subfield.name %>(项目讨论区)</a>-->
</div> </div>
<div class="homepagePostTitle break_word"> <div class="homepagePostTitle break_word">
<% if activity.parent_id.nil? %> <% if activity.parent_id.nil? %>
@ -44,6 +43,31 @@
<div class="mt10" style="font-weight:normal;"> <div class="mt10" style="font-weight:normal;">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %> <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
</div> </div>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'message')") %></li>
<li>
<%= link_to(
l(:button_edit),
{:controller => 'messages', :action => 'edit', :id => activity, :board_id => activity.board_id},
:class => 'postOptionLink'
) if activity.org_subfield_editable_by?(User.current) %>
</li>
<li>
<%= delete_link(
{:controller => 'messages', :action => 'destroy', :id => activity, :board_id => activity.board_id},
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if activity.org_subfield_editable_by?(User.current) %>
</li>
</ul>
<% end %>
</li>
</ul>
</div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>

View File

@ -30,14 +30,15 @@
</li> </li>
<li class=" mb5 ml80"> <li class=" mb5 ml80">
<label >公开&nbsp;&nbsp;</label> <label >公开&nbsp;&nbsp;</label>
<input id="organization_is_public" name="organization[is_public]" type="checkbox" value="1" checked="checked"> <input id="organization_is_public" name="organization[is_public]" onblur="disable_down($(this), $('#organization_alow_download'), $('#allow_down_hint'));" type="checkbox" value="1" checked="checked">
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)</span> <span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)</span>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li class=" mb5" style="margin-left:40px; "> <li class=" mb5" style="margin-left:40px; ">
<label >允许游客下载:</label> <label >允许游客下载:</label>
<input id="organization_alow_download" name="organization[allow_guest_download]" type="checkbox" value="1" checked="checked"> <input id="organization_alow_download" name="organization[allow_guest_download]" type="checkbox" value="1" checked="checked">
<span class="c_grey">(打钩为允许游客下载文件)</span> <span class="c_grey">(打钩为允许游客下载文件)</span>
<span class="c_green f12" id="allow_down_hint"></span>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li class=" ml125" > <li class=" ml125" >

View File

@ -63,11 +63,12 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开&nbsp;: </span> <div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开&nbsp;: </span>
<input type="checkbox" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" /> <input type="checkbox" id="is_public" onblur="disable_down($(this), $('#allow_download'),$('#allow_down_hint'));" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" />
</div> </div>
<div class="orgRow mb10 mt5"><span style="margin-left:10px;">下载支持&nbsp;: </span> <div class="orgRow mb10 mt5"><span style="margin-left:10px;">下载支持&nbsp;: </span>
<input type="checkbox" style="margin-top:5px;" name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" /> <input id="allow_download" type="checkbox" style="margin-top:5px;" <%= @organization.is_public? ? "":"DISABLED" %> name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" />
&nbsp;<span>允许游客下载</span> &nbsp;<span>允许游客下载</span>
<span class="c_green f12" id="allow_down_hint"><%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %></span>
</div> </div>
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org(<%=@organization.id %>);">保存</a> <a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org(<%=@organization.id %>);">保存</a>
<% end %> <% end %>
@ -187,4 +188,13 @@
$("#apply_hint").text("子域名命名不规范,只能包含字母、数字和下划线,请重新输入"); $("#apply_hint").text("子域名命名不规范,只能包含字母、数字和下划线,请重新输入");
} }
} }
// $(document).ready(function(){
// if ( $("#is_public").attr("checked") != true){
// alert($(this).attr("checked"));
// $("#allow_download").attr("checked", false);
// $("#allow_download").attr("disabled", true);
// $("#allow_down_hint").html("");
// }
// });
</script> </script>

View File

@ -1,139 +1,140 @@
<div class="show_hwork_arrow"></div> <div class="show_hwork_arrow"></div>
<div class="showHwork"> <div class="showHwork">
<ul> <ul>
<li class="fl" > <li class="fl" >
<span class="tit_fb">上交时间:</span> <span class="tit_fb">上交时间:</span>
<%=format_time work.created_at %> <%=format_time work.created_at %>
</li> </li>
<% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %> <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 --> <!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
<li class="fr" > <li class="fr" >
<%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %> <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %>
</li> </li>
<li class="fr" > <li class="fr" >
<%= link_to "",new_student_work_path(:homework => @homework.id),:class => "pic_edit"%> <%= link_to "",new_student_work_path(:homework => @homework.id),:class => "pic_edit"%>
</li> </li>
<% end%> <% end%>
<% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%> <% if @homework.homework_detail_manual.comment_status == 3 && work.user != User.current%>
<!-- 匿评结束阶段,显示点赞按钮 --> <!-- 匿评结束阶段,显示点赞按钮 -->
<li class="fr" id="student_work_praise_<%= work.id%>"> <li class="fr" id="student_work_praise_<%= work.id%>">
<%= render :partial => 'student_work_praise' %> <%= render :partial => 'student_work_praise' %>
</li> </li>
<% end%> <% end%>
<div class="cl"></div> <div class="cl"></div>
<li > <li >
<span class="tit_fb ">编程代码:</span> <span class="tit_fb ">编程代码:</span>
<div class="showHworkP break_word"><pre id="work-src" style="display: none;"><%= work.description if work.description%></pre><div class="fontGrey2 font_cus" id="work-code"> <div class="showHworkP break_word"><pre id="work-src" style="display: none;"><%= work.description if work.description%></pre><div class="fontGrey2 font_cus" id="work-code">
</div> </div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li class="mt10 fl"> <li class="mt10 fl">
<span class="tit_fb "> <span class="tit_fb ">
测试结果: 测试结果:
</span> </span>
<div class="show_hwork_p break_word"> <div class="show_hwork_p break_word">
<% work.student_work_tests.each_with_index do |test, index| %> <% work.student_work_tests.each_with_index do |test, index| %>
<div class="ProResultTop"> <div class="ProResultTop">
<p class="c_blue fl"> <p class="c_blue fl">
第<%= work.student_work_tests.count - index%>次测试 第<%= work.student_work_tests.count - index%>次测试
</p> </p>
<span class="fr c_grey"> <span class="fr c_grey">
<%= test.created_at.to_s(:db) %> <%= test.created_at.to_s(:db) %>
</span> </span>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<% if test.status.to_i == -2 %> <% if test.status.to_i == -2 %>
<div class="ProResultCon "> <div class="ProResultCon ">
<%= test.results.first %> <%= test.results.first %>
</div> </div>
<% else %> <% else %>
<div class="ProResultTable " > <div class="ProResultTable " >
<ul class="ProResultUl " > <ul class="ProResultUl " >
<% test.results.each_with_index do |x, i| %> <% test.results.each_with_index do |x, i| %>
<li > <li >
<span class="w60 T_C">测试<%=i+1%></span> <span class="w60 T_C">测试<%=i+1%></span>
<% if x["status"].to_i != 0 %> <% if x["status"].to_i != 0 %>
<span class="w150 c_red">测试错误!</span> <span class="w150 c_red">测试错误!</span>
<span class="w60">您的输出:</span> <span class="w60">您的输出:</span>
<span class="width150"><%=x["result"]%></span> <span class="width150"><pre><%=x["result"]%></pre></span>
<span class="w60">正确输出:</span> <span class="w60">正确输出:</span>
<span class="width150"><%=x["output"]%></span> <span class="width150"><pre><%=x["output"]%></pre></span>
<div class="cl"></div> <div class="cl"></div>
<% else %> <% else %>
<span class="w150 c_green">测试正确!</span> <span class="w150 c_green">测试正确!</span>
<div class="cl"></div> <div class="cl"></div>
<% end %> <% end %>
</li> </li>
<% end %> <% end %>
</ul> </ul>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
</li> </li>
<li > <li >
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%> <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && work.user != User.current )%>
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 --> <!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
<div id="add_student_score_<%= work.id%>" class="mt10 evaluation"> <div id="add_student_score_<%= work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
</div> </div>
<% end%> <% end%>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
</ul> </ul>
<div id="revise_attachment"> <div id="revise_attachment">
<%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= work.student_works_scores.empty? ? 'padding:0px;' : ''%>"> <div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
<%student_work_scores.each do |student_score|%> <%student_work_scores.each do |student_score|%>
<div id="work_score_<%= student_score.id%>"> <div id="work_score_<%= student_score.id%>">
<%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%>
</div> </div>
<% end%> <% end%>
</div> </div>
<!---ping_box end---> <div class="cl"></div>
<a href="javascript:void(0);" class="fr linkBlue mt5 mb5" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a> <!---ping_box end--->
<div class="cl"></div> <a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:auto; margin-right: auto; display:block; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
</div> <div class="cl"></div>
<script type="text/javascript"> </div>
function show_upload(){ <script type="text/javascript">
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>'); function show_upload(){
showModal('ajax-modal', '452px'); $("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>');
$('#ajax-modal').siblings().remove(); showModal('ajax-modal', '452px');
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal();' style='margin-left: 435px;' class='resourceClose'></a>"); $('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","40%").css("left","46%"); $('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal();' style='margin-left: 435px;' class='resourceClose'></a>");
$('#ajax-modal').parent().addClass("resourceUploadPopup"); $('#ajax-modal').parent().css("top","40%").css("left","46%");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); $('#ajax-modal').parent().addClass("resourceUploadPopup");
} $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
function regex_des() { }
if ($.trim($("#attachment_des").val()) == "") { function regex_des() {
$("#hint_message").text("附件描述不能为空"); if ($.trim($("#attachment_des").val()) == "") {
$("#hint_message").css('color','#ff0000'); $("#hint_message").text("附件描述不能为空");
return false; $("#hint_message").css('color','#ff0000');
} else { return false;
$("#hint_message").text(""); } else {
return true; $("#hint_message").text("");
} return true;
} }
function submit_revise_files(){ }
if (regex_des()) { function submit_revise_files(){
$("#upload_form").submit(); if (regex_des()) {
} $("#upload_form").submit();
} }
function closeModal(){ }
hideModal($(".uploadBoxContainer")); function closeModal(){
} hideModal($(".uploadBoxContainer"));
function disable_choose(){ }
if ($("#attachments_fields .attachment").size() >= 1) { function disable_choose(){
$("#choose_revise_attach").attr("onclick","return false;").addClass(disable_link); if ($("#attachments_fields .attachment").size() >= 1) {
} $("#choose_revise_attach").attr("onclick","return false;").addClass(disable_link);
} }
</script> }
</script>

View File

@ -1,139 +1,140 @@
<div class="show_hwork_arrow"></div> <div class="show_hwork_arrow"></div>
<div class="showHwork"> <div class="showHwork">
<% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %> <% is_teacher = User.current.allowed_to?(:as_teacher, @homework.course) || User.current.admin? %>
<% if @homework.homework_type != 3 %> <% if @homework.homework_type != 3 %>
<% is_my_work = work.user == User.current%> <% is_my_work = work.user == User.current%>
<% else %> <% else %>
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %> <% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
<% is_my_work = pro && pro.student_work_id == work.id%> <% is_my_work = pro && pro.student_work_id == work.id%>
<% end %> <% end %>
<ul> <ul>
<li class="fl" > <li class="fl" >
<span class="tit_fb">上交时间:</span> <span class="tit_fb">上交时间:</span>
<%=format_time work.created_at %> <%=format_time work.created_at %>
</li> </li>
<% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %> <% if work.user == User.current && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") %>
<!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 --> <!-- 我的作业 && 匿评作业 && 未开启匿评,显示编辑和删除按钮 -->
<li class="fr" > <li class="fr" >
<%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %> <%= link_to("", student_work_path(work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del",:title=>"删除") %>
</li> </li>
<li class="fr mr5" > <li class="fr mr5" >
<%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%> <%= link_to "",edit_student_work_path(work),:class => "pic_edit",:title => "修改"%>
</li> </li>
<% end%> <% end%>
<% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %> <% if @homework.homework_detail_manual.comment_status == 3 && !is_my_work %>
<!-- 匿评结束阶段,显示点赞按钮 --> <!-- 匿评结束阶段,显示点赞按钮 -->
<li class="fr" id="student_work_praise_<%= work.id%>"> <li class="fr" id="student_work_praise_<%= work.id%>">
<%= render :partial => 'student_work_praise' %> <%= render :partial => 'student_work_praise' %>
</li> </li>
<% end%> <% end%>
<div class="cl"></div> <div class="cl"></div>
<!--<li ><span class="tit_fb"> 参与人员:</span>程梦雯&nbsp;&nbsp;王强</li>--> <!--<li ><span class="tit_fb"> 参与人员:</span>程梦雯&nbsp;&nbsp;王强</li>-->
<% if @homework.homework_type == 3 && work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %> <% if @homework.homework_type == 3 && work.student_work_projects && (@homework.homework_detail_manual.comment_status != 2 || is_my_work || is_teacher ) %>
<div class="cl"></div> <div class="cl"></div>
<li> <li>
<span class="tit_fb"> 参与人员:</span> <span class="tit_fb"> 参与人员:</span>
<%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%> <%= link_to(work.user.show_name+"(组长)", user_path(work.user.id), :class => "linkBlue" )%>
<% members = work.student_work_projects.where("is_leader = 0") %> <% members = work.student_work_projects.where("is_leader = 0") %>
<% members.each do |member| if !members.empty? %> <% members.each do |member| if !members.empty? %>
、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %> 、<%=link_to((User.find member.user_id).show_name, user_path(member.user.id), :class => "linkBlue" ) %>
<% end %> <% end %>
<% end %> <% end %>
</li> </li>
<% if @homework.homework_detail_group.base_on_project == 1 %> <% if @homework.homework_detail_group.base_on_project == 1 %>
<li> <li>
<span class="tit_fb"> 关联项目:</span> <span class="tit_fb"> 关联项目:</span>
<% if work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %> <% if work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %>
<%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> <%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
<% else %> <% else %>
<span title ="该项目是私有的"><%=work.project.name %></span> <span title ="该项目是私有的"><%=work.project.name %></span>
<% end %> <% end %>
<%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%> <%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
<span class="ml5">(综合评分:<font class="c_red"><%=work.project.project_score.score.to_i %></font>)</span> <span class="ml5">(综合评分:<font class="c_red"><%=work.project.project_score.score.to_i %></font>)</span>
</li> </li>
<% end %> <% end %>
<% end%> <% end%>
<li > <li >
<span class="tit_fb ">内容:</span> <span class="tit_fb ">内容:</span>
<div class="showHworkP break_word"> <div class="showHworkP break_word">
<%= text_format(work.description) if work.description%> <%= text_format(work.description) if work.description%>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li > <li >
<span class="tit_fb"> 附件:</span> <span class="tit_fb"> 附件:</span>
<% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %> <% com_attachments = work.attachments.where("attachtype IS NULL OR attachtype <> 7") %>
<% if com_attachments.empty?%> <% if com_attachments.empty?%>
<span style="color: #999999">尚未提交附件</span> <span style="color: #999999">尚未提交附件</span>
<% else%> <% else%>
<div class="fl" style="width: 90%;"> <div class="fl" style="width: 90%;">
<%= render :partial => 'work_attachments_status', :locals => {:attachments => com_attachments, :status => @homework.homework_detail_manual.comment_status} %> <%= render :partial => 'work_attachments_status', :locals => {:attachments => com_attachments, :status => @homework.homework_detail_manual.comment_status} %>
</div> </div>
<% end%> <% end%>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<li > <li >
<% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%> <% if @is_teacher || (@homework.homework_detail_manual.comment_status == 2 && !is_my_work)%>
<!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 --> <!-- 老师 || 开启匿评状态 && 不是当前用户自己的作品 -->
<div id="add_student_score_<%= work.id%>" class="mt10 evaluation"> <div id="add_student_score_<%= work.id%>" class="mt10 evaluation">
<%= render :partial => 'add_score',:locals => {:work => work,:score => score}%> <%= render :partial => 'add_score',:locals => {:work => work,:score => score}%>
</div> </div>
<% end%> <% end%>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
</ul> </ul>
<div id="revise_attachment"> <div id="revise_attachment">
<%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %> <%= render :partial => 'student_work/revise_attachment', :locals => {:work => work} %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= work.student_works_scores.empty? ? 'padding:0px;' : ''%>"> <div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
<%student_work_scores.each do |student_score|%> <%student_work_scores.each do |student_score|%>
<div id="work_score_<%= student_score.id%>"> <div id="work_score_<%= student_score.id%>">
<%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%> <%= render :partial => 'student_work_score',:locals => {:score => student_score,:is_last => student_score == student_work_scores.last}%>
</div> </div>
<% end%> <% end%>
</div> </div>
<!---ping_box end---> <div class="cl"></div>
<a href="javascript:void(0);" class="fr linkBlue mt5 mb5" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a> <!---ping_box end--->
<div class="cl"></div> <a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:auto; margin-right: auto; display:block; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>
</div> <div class="cl"></div>
<script type="text/javascript"> </div>
function show_upload(){ <script type="text/javascript">
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>'); function show_upload(){
showModal('ajax-modal', '452px'); $("#ajax-modal").html('<%= escape_javascript( render :partial => 'student_work/upload_attachment' ,:locals => {:work=>work})%>');
$('#ajax-modal').siblings().remove(); showModal('ajax-modal', '452px');
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal();' style='margin-left: 435px;' class='resourceClose'></a>"); $('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","40%").css("left","46%"); $('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal();' style='margin-left: 435px;' class='resourceClose'></a>");
$('#ajax-modal').parent().addClass("resourceUploadPopup"); $('#ajax-modal').parent().css("top","40%").css("left","46%");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px"); $('#ajax-modal').parent().addClass("resourceUploadPopup");
} $('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
function regex_des() { }
if ($.trim($("#attachment_des").val()) == "") { function regex_des() {
$("#hint_message").text("附件描述不能为空"); if ($.trim($("#attachment_des").val()) == "") {
$("#hint_message").css('color','#ff0000'); $("#hint_message").text("附件描述不能为空");
return false; $("#hint_message").css('color','#ff0000');
} else { return false;
$("#hint_message").text(""); } else {
return true; $("#hint_message").text("");
} return true;
} }
function submit_revise_files(){ }
if (regex_des()) { function submit_revise_files(){
$("#upload_form").submit(); if (regex_des()) {
} $("#upload_form").submit();
} }
function closeModal(){ }
hideModal($(".uploadBoxContainer")); function closeModal(){
} hideModal($(".uploadBoxContainer"));
function disable_choose(){ }
if ($("#attachments_fields .attachment").size() >= 1) { function disable_choose(){
$("#choose_revise_attach").attr("onclick","return false;").addClass(disable_link); if ($("#attachments_fields .attachment").size() >= 1) {
} $("#choose_revise_attach").attr("onclick","return false;").addClass(disable_link);
} }
}
</script> </script>

View File

@ -1,7 +1,7 @@
<% attachments.each_with_index do |attachment,i| %> <% attachments.each_with_index do |attachment,i| %>
<div id="attachment_<%= attachment.id%>"> <div id="attachment_<%= attachment.id%>">
<span class="fl"> <span class="fl">
<span title="<%= attachment.filename %>"> <span title="点击可下载">
<%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw360', :download => true -%> <%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw360', :download => true -%>
</span> </span>
</span> </span>

View File

@ -3,7 +3,7 @@
<% if @tags.size > 0 %> <% if @tags.size > 0 %>
<% @tags.each do |tag| %> <% @tags.each do |tag| %>
<span class="re_tag f_l" style="cursor:pointer"> <%#= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %> <span class="re_tag f_l" style="cursor:pointer"> <%#= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id %>
<a title="<%= obj.container_type == 'Course' ? '双击可编辑' : '' %> " ondblclick="rename_tag($(this),'<%= tag %>',<%= obj.id%>,<%= object_flag%>);"><%= tag %></a> <a title="双击可编辑" ondblclick="rename_tag($(this),'<%= tag %>',<%= obj.id%>,<%= object_flag%>);"><%= tag %></a>
<!-- 对用户主页 是本人 ,对项目,需求,问题是管理员 --> <!-- 对用户主页 是本人 ,对项目,需求,问题是管理员 -->
<% case object_flag %> <% case object_flag %>
<% when '10' %> <% when '10' %>

View File

@ -79,9 +79,7 @@
) if activity.course_destroyable_by?(User.current) %> ) if activity.course_destroyable_by?(User.current) %>
</li> </li>
<% end %> <% end %>
<li> <li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %></li>
<%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %>
</li>
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@ -0,0 +1,31 @@
<div class="subjectInfo">题目信息</div>
<div class="subjectWrap">
<% if homework.nil? %>
<span class="c_red" id="homework_notice_span">请先在左侧选择作业</span>
<% else %>
<div class="subjectIntro mb15">标题:<%=homework.name %><br />
来源:<%=homework.course.name %><br />
<% if homework.homework_type == 2 && homework.homework_detail_programing %>
编程语言:<%=homework.language_name %><br/>
<% end %>
贡献者:<%=homework.user.show_name %>
<% if homework.user.user_extensions.occupation && homework.user.user_extensions.occupation!="" %>
<%=homework.user.user_extensions.occupation%>
<% end %>
<br />
描述如下:
</div>
<div class="subjectContent" id="homework_description">
<%=homework.description.html_safe %>
</div>
<% if homework.homework_type == 2 %>
<div class="subjectContent mt10">
测试集:<%=homework.homework_tests.count %>组
</div>
<% elsif homework.homework_type ==3 && homework.homework_detail_group %>
<div class="subjectContent mt10">
分组人数:<%=homework.homework_detail_group.min_num %> - <%=homework.homework_detail_group.max_num %>人
</div>
<% end %>
<% end %>
</div>

View File

@ -0,0 +1,29 @@
<input type="text" name="search" placeholder="输入关键词进行搜索" class="subjectSearch fr" />
<script type="text/javascript">
var lastSearchCondition = '';
var count = 0;
function search_hws(e){
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
{
return;
}
lastSearchCondition = $(e.target).val().trim();
$.ajax({
url: '<%= url_for(:controller => 'users', :action => 'user_search_homeworks') %>'+'?name='+ e.target.value+'&type=<%=type %>',
type:'get'
});
}
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
//查询项目
$("input[name='search']").on('input', function (e) {
throttle(search_hws,window,e);
});
</script>

View File

@ -12,7 +12,8 @@
:minHeight=>100, :minHeight=>100,
:input_html => { :id => 'jour_content', :input_html => { :id => 'jour_content',
:class => 'talk_text fl', :class => 'talk_text fl',
:maxlength => 5000 }%> :maxlength => 5000 }
%>
<div class="cl"></div> <div class="cl"></div>
<p id="jour_content_span"></p> <p id="jour_content_span"></p>
</li> </li>

View File

@ -52,7 +52,7 @@
</div> </div>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %> <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
<%# 局部刷新修改xissue属性 %> <%# 局部刷新修改xissue属性 %>
<% if is_project_manager?(User.current, activity.project) %> <% if User.current.member_of?(activity.project) %>
<% unless params[:action] == "index" %> <% unless params[:action] == "index" %>
<div id="div_user_issue_detail_<%=activity.id %>"> <div id="div_user_issue_detail_<%=activity.id %>">
<%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %> <%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %>

View File

@ -1,115 +1,115 @@
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
$(".pro_info_p,.proInfoP").mouseover(function(){ $(".pro_info_p,.proInfoP").mouseover(function(){
$(this).children(".pic_edit2").css("display","inline-block"); $(this).children(".pic_edit2").css("display","inline-block");
}); });
$(".pro_info_p,.proInfoP").mouseout(function(){ $(".pro_info_p,.proInfoP").mouseout(function(){
$(this).children(".pic_edit2").css("display","none"); $(this).children(".pic_edit2").css("display","none");
}); });
$(".pic_edit2").click(function(){ $(".pic_edit2").click(function(){
$(this).parent().hide(); $(this).parent().hide();
$(this).parent().next().show(); $(this).parent().next().show();
}); });
$(".issueEdit").blur(function(){ $(".issueEdit").blur(function(){
$(this).hide(); $(this).hide();
$(this).prev().show(); $(this).prev().show();
var editValue = $(this).children("option:selected").text(); var editValue = $(this).children("option:selected").text();
$(this).prev().children(":first").text(editValue); $(this).prev().children(":first").text(editValue);
}); });
function stopPropagation(e) { function stopPropagation(e) {
if (e.stopPropagation) if (e.stopPropagation)
e.stopPropagation(); e.stopPropagation();
else else
e.cancelBubble = true; e.cancelBubble = true;
}; };
$(document).bind('click',function(){ $(document).bind('click',function(){
$('.issueEdit').css('display','none'); $('.issueEdit').css('display','none');
$('.proInfoP,.pro_info_p').show(); $('.proInfoP,.pro_info_p').show();
}); });
$('.issueEdit,.pic_edit2').bind('click',function(e){ $('.issueEdit,.pic_edit2').bind('click',function(e){
stopPropagation(e); stopPropagation(e);
}); });
}); });
function remote_function(id) { function remote_function(id) {
$(id).submit(); $(id).submit();
} }
</script> </script>
<div class="cl"></div> <div class="cl"></div>
<div class="proInfoBox2 mb10 mt10"> <div class="proInfoBox2 mb10 mt10">
<ul class="fl"> <ul class="fl">
<%#= labelled_fields_for :issue, @issue do |f| %> <%#= labelled_fields_for :issue, @issue do |f| %>
<%#= f.select :status_id, ([["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0])), <%#= f.select :status_id, ([["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0])),
{:include_blank => false, :selected => @status_id ? @status_id : 0 }, {:include_blank => false, :selected => @status_id ? @status_id : 0 },
{:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %> {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} %>
<%# end %> <%# end %>
<%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %> <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "status"},:remote=>'true', :method => :put, :id=>"issue_query_form_#{activity.id}", :class => 'query_form') do %>
<li> <li>
<p class="label03">&nbsp;状态&nbsp;&nbsp;:&nbsp;</p> <p class="label03">&nbsp;状态&nbsp;&nbsp;:&nbsp;</p>
<p class="proInfoP"><span><%= activity.status.name %></span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a></p> <p class="proInfoP"><span><%= activity.status.name %></span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a></p>
<%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]), <%= select( :issue,:status, [["新增",1],["正在解决",2],["已解决",3],["反馈",4],["关闭",5],["拒绝",6]].unshift(["状态",0]),
{:include_blank => false, :selected => @status_id ? @status_id : 0 }, {:include_blank => false, :selected => @status_id ? @status_id : 0 },
{:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit"} {:onchange=>"remote_function('#issue_query_form_#{activity.id}');",:id=>"status_id",:name=>"status_id",:class=>"w70 undis issueEdit",:style=>"white-space:nowrap; overflow:hidden;"}
) )
%> %>
</li> </li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %> <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %>
<li> <li>
<p class="label03">&nbsp;指派&nbsp;&nbsp;:&nbsp;</p> <p class="label03">&nbsp;指派&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p"> <span class="pro_info_p" style="width:130px;">
<%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:50px; display:inline-block;" %> <%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "linkBlue hidden", :style => "max-width:100px; display:inline-block;" %>
<a href="javascript:void(0)" class="pic_edit2 ml5" style="vertical-align:top;"></a></span> <a href="javascript:void(0)" class="pic_edit2 ml5" style="vertical-align:top;"></a></span>
<%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project), <%= select( :issue, :user_id, principals_options_for_isuue_list(activity.project),
{ :include_blank => false,:selected => @assign_to_id ? @assign_to_id : 0}, { :include_blank => false,:selected => @assign_to_id ? @assign_to_id : 0},
{:onchange=>"remote_function('#issue_query_assign_form_#{activity.id}');", :id =>"assigned_to_id", :name => "assigned_to_id",:class=>"w70 undis issueEdit"}) %> {:onchange=>"remote_function('#issue_query_assign_form_#{activity.id}');", :id =>"assigned_to_id", :name => "assigned_to_id",:class=>"undis issueEdit", :style => "width:130px;"}) %>
</li> </li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
</ul> </ul>
<ul class="fl"> <ul class="fl">
<%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %> <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %>
<li> <li>
<p class="label03">&nbsp;优先级&nbsp;&nbsp;:&nbsp;</p> <p class="label03">&nbsp;优先级&nbsp;&nbsp;:&nbsp;</p>
<span class="proInfoP" style="width:70px;"><span><%= activity.priority.name %></span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a> </span> <span class="proInfoP" style="width:70px;"><span><%= activity.priority.name %></span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a> </span>
<%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]), <%= select( :issue,:prior, [["低",1],["正常",2],["高",3],["紧急",4],["立刻",5]].unshift(["优先级",0]),
{:include_blank => false,:selected=>@priority_id ? @priority_id : 0}, {:include_blank => false,:selected=>@priority_id ? @priority_id : 0},
{:onchange=>"remote_function('#issue_query_prior_form_#{activity.id}');",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"}) %> {:onchange=>"remote_function('#issue_query_prior_form_#{activity.id}');",:id=>"priority_id",:name=>"priority_id",:class=>"w70 undis issueEdit"}) %>
</li> </li>
<% end %> <% end %>
<div class="cl"></div> <div class="cl"></div>
<%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %> <%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "ratio"},:remote=>'true', :method => :put, :id=>"issue_query_done_form_#{activity.id}", :class => 'query_form') do %>
<li> <li>
<p class="label03">&nbsp;完成度&nbsp;&nbsp;:&nbsp;</p> <p class="label03">&nbsp;完成度&nbsp;&nbsp;:&nbsp;</p>
<span class="proInfoP" style="width:70px;"><span><%= activity.done_ratio %>%</span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a> </span> <span class="proInfoP" style="width:70px;"><span><%= activity.done_ratio %>%</span> <a href="javascript:void(0)" class="pic_edit2 ml5"></a> </span>
<%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }), <%= select( :issue,:done_ratio, ((0..10).to_a.collect { |r| ["#{r*10} %", r*10] }),
{:include_blank => false, :selected => @done_ratio ? @done_ratio : 0}, {:include_blank => false, :selected => @done_ratio ? @done_ratio : 0},
{:onchange=>"remote_function('#issue_query_done_form_#{activity.id}');",:id=>"done_ratio",:name=>"done_ratio",:class=>"w70 undis issueEdit"}) %> {:onchange=>"remote_function('#issue_query_done_form_#{activity.id}');",:id=>"done_ratio",:name=>"done_ratio",:class=>"w70 undis issueEdit"}) %>
<% end %> <% end %>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
</ul> </ul>
<ul class="fl "> <ul class="fl ">
<li> <li>
<p class="label03" style="width:50px;">&nbsp;开始&nbsp;&nbsp;:&nbsp;</p> <p class="label03" style="width:50px;">&nbsp;开始&nbsp;&nbsp;:&nbsp;</p>
<p class="proInfoP" style="width:100px;"><span><%= format_date(activity.start_date) %></span></p> <p class="proInfoP" style="width:70px;"><span><%= format_date(activity.start_date) %></span></p>
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li> <li>
<p class="label03" style="width:50px;">&nbsp;周期&nbsp;&nbsp;:&nbsp;</p> <p class="label03" style="width:50px;">&nbsp;周期&nbsp;&nbsp;:&nbsp;</p>
<span class="proInfoP" style="width:100px;"><%= l_hours(activity.estimated_hours) %></span> </li> <span class="proInfoP" style="width:70px;"><%= l_hours(activity.estimated_hours) %></span> </li>
<div class="cl"></div> <div class="cl"></div>
</ul> </ul>
<ul class="fl ml20"> <ul class="fl ml20">
<li> <li>
<p class="label03">&nbsp;计划完成&nbsp;&nbsp;:&nbsp;</p> <p class="label03">&nbsp;计划完成&nbsp;&nbsp;:&nbsp;</p>
<span class="proInfoP" style="width:120px;"><span><%= format_date(activity.due_date)? format_date(activity.due_date) : "--" %></span></span> </li> <span class="proInfoP" style="width:100px;"><span><%= format_date(activity.due_date)? format_date(activity.due_date) : "--" %></span></span> </li>
<div class="cl"></div> <div class="cl"></div>
<li> <li>
<p class="label03">&nbsp;目标版本&nbsp;&nbsp;:&nbsp;</p> <p class="label03">&nbsp;目标版本&nbsp;&nbsp;:&nbsp;</p>
<span class="proInfoP" style="width:120px;"><%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %> </span> </li> <span class="proInfoP" style="width:100px;"><%= (activity.fixed_version ? link_to_user_version(activity.fixed_version) : "--") %> </span> </li>
<div class="cl"></div> <div class="cl"></div>
</ul> </ul>
<!--pro_info_box end--> <!--pro_info_box end-->
</div> </div>

View File

@ -71,9 +71,7 @@
) if activity.destroyable_by?(User.current) %> ) if activity.destroyable_by?(User.current) %>
</li> </li>
<% end %> <% end %>
<li> <li><%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %></li>
<%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %>
</li>
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@ -0,0 +1,56 @@
<div class="boxContainer">
<div>
<div class="sendText fl mr10" style="width: auto">发送到</div>
<div class="resourcesSendTo">
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>','<%= User.current.id %>','message');">
<option value="1">课程</option>
<option value="2">项目</option>
<option value="3">组织</option>
</select>
</div>
<div class="cl"></div>
</div>
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
<div class="fl">
<%= form_tag search_user_course_user_path(user),:method => 'get',
:remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入课程ID或者名称搜索" class="searchResourcePopup" />
<script>
observeSearchfieldOnInput('search_course_input','<%= search_user_course_user_path(user)%>','<%= send_id %>','<%= send_ids%>','message')
</script>
<!--<a href="javascript:void(0);" class="searchIconPopup"></a>-->
<%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %>
<% end %>
</div>
<%= form_tag share_message_to_course_user_path(user),:remote=>true,:id=>'course_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !courses.empty? %>
<% courses.each do |course| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= truncate(course.name,:lendght=>25) + '['+course.time.to_s+course.term + ']'%></li>
</ul>
<% end %>
</div>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText mt10" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>
<% end %>
</div>

View File

@ -0,0 +1,59 @@
<div >
<div class="relateText fl mb10 mr5">发送到</div>
<div class="resourcesSendTo mr15">
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id%>','<%= send_ids%>','<%= User.current.id %>','message');">
<option value="1">课程</option>
<option value="2">项目</option>
<option value="3" selected>组织</option>
</select>
</div>
<%= form_tag search_user_org_user_path(user),:method => 'get',
:remote=>true,:id=>'search_user_org_form' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<input type="text" name="serach" id="search_org_input" value="<%=@search %>" placeholder="输入名称搜索" class="orgSendSearch mt15" />
<script>
observeSearchfieldOnInput('search_org_input','<%= search_user_org_user_path(user)%>','<%= send_id %>','<%= send_ids%>','message')
</script>
<% end %>
<div class="cl"></div>
</div>
<%= form_tag share_message_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="sectionWrap fl mr15">
<ul class="fontGrey3 sectionContent">
<% unless @orgs.empty? %>
<% @orgs.each do |org|%>
<li>
<label>
<input type="radio" name="org_id" value="<%= org.id%>" onchange="change_org_subfield('<%= org_resources_subfield_organization_path(:id=>org.id,:send_type => params[:send_type])%>')" class="mt3 fl mr5" />
<span><%= org.name%></span></label>
</li>
<%end%>
<%end%>
</ul>
</div>
<div class="columnWrap">
<ul class="columnContent">
<!--<span class="fontBlue pl10">请在左侧选择要转发的位置</span>-->
<!--<li style="background-color:#f1f1f1; color:#555555; padding-top:2px; padding-bottom:2px;">请选择栏目:</li>-->
<%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%>
<!--<li>-->
<!--<label>-->
<!--<input type="radio" name="sendColumn" class="mt3 fl mr5" />-->
<!--<span>动态</span></label>-->
<!--</li>-->
</ul>
</div>
<div class="cl"></div>
<div class="orgDirection mb10 break_word" style="white-space: nowrap;-o-text-overflow:ellipsis;text-overflow: ellipsis;overflow: hidden">目标地址:</div>
<div class="courseSendSubmit mr15">
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %>
</div>
<div class="courseSendCancel">
<a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a>
</div>
<div class="cl"></div>
<%end %>

View File

@ -0,0 +1,53 @@
<div class="boxContainer">
<div>
<div class="sendText fl mr10" style="width: auto">发送到</div>
<div class="resourcesSendTo">
<select class="resourcesSendType" onclick="chooseSendType('<%= send_id %>','<%= send_ids %>','<%= User.current.id %>','message');">
<option value="1">课程</option>
<option value="2" selected>项目</option>
<option value="3">组织</option>
</select>
</div>
<div class="cl"></div>
</div>
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
<div class="fl">
<%= form_tag search_user_project_user_path(user),:method => 'get',
:remote=>true,:id=>'search_user_project_form',:class=>'resourcesSearchBox' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<input type="text" id="search_project_input" value="<%= @search %>" name="search" placeholder="输入项目ID或者名称搜索" class="searchResourcePopup" />
<script>
observeSearchfieldOnInput('search_project_input','<%= search_user_project_user_path(user)%>','<%= send_id %>','<%= send_ids %>','message')
</script>
<!--<a href="javascript:void(0);" class="searchIconPopup"></a>-->
<%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %>
<% end %>
</div>
<%= form_tag share_message_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %>
<div>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<div class="courseReferContainer">
<% if !projects.empty? %>
<% projects.each do |project| %>
<ul class="courseSend">
<li class="" style="display:inline-block">
<input name="project_ids[]" type="checkbox" value="<%= project.id %>" class="courseSendCheckbox"/>
</li>
<li class="sendCourseName"><%= project.name%></li>
</ul>
<% end %>
</div>
</div>
<div>
<div class="courseSendSubmit">
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
</div>
<div class="cl"></div>
<% end %>
</div>

View File

@ -6,11 +6,16 @@
</div> </div>
<div class="fl"> <div class="fl">
<p class="homepageImageName mb5 hidden" style="max-width:88px;font-size:16px; color:#484848; margin-left:15px; margin-right:8px; height:21px; float:left;"><%= user %></p> <p class="homepageImageName mb5 hidden" style="max-width:88px;font-size:16px; color:#484848; margin-left:15px; margin-right:8px; height:21px; float:left;"><%= user %></p>
<span class="homepageImageSex"></span> <% if (user.user_extensions && (user.user_extensions.identity != 2) ) %>
<span class="<%= user.user_extensions.gender == 1 ? 'homepageImageSexWomen' : 'homepageImageSexMan' %> "></span>
<% end %>
<!--<span class="homepageImageSex"></span>-->
<div class="cl"></div> <div class="cl"></div>
<p class="mb8 c_dark f14"> <p class="mb8 c_dark f14">
<span class="mr15 hidden fl ml15" style="max-width:90px;"><%= user.show_name %></span> <span class="mr15 hidden fl ml15" style="max-width:90px;"><%= user.show_name %></span>
<%= user.user_extensions.technical_title %> <% if user.user_extensions && user.user_extensions.identity %>
<%= get_user_roll(user) %>
<% end %>
</p> </p>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -1,13 +1,35 @@
<% user_homeworks.each do |homework|%> <% homeworks.each do |homework| %>
<ul class="homeworkPublish"> <ul class="subjectRow">
<li class="fl"> <li class="subjectName fl hidden">
<input name="checkMenu" type="radio" class="courseSendCheckbox" value="<%= homework.id%>"/> <label onclick="show_homework_detail('<%=show_homework_detail_user_path(@user,:homework=>homework.id) %>')">
<input type="radio" name="checkMenu" class="mr5" style="vertical-align:middle;" value="<%= homework.id%>"/>
<span title="<%= homework.name%>"><%= homework.name%></span>
</label>
</li> </li>
<li class="sendCourseName fl hidden w450"> <li class="subjectType fl">
<%= homework.name%> <% case homework.homework_type %>
<% when 1 %>
普通
<% when 2 %>
编程
<% when 3 %>
分组
<% end %>
</li> </li>
<li class="subjectCount fl"><%= homework.quotes %></li>
<li class="subjectPublisher fl"><%= homework.user.show_name %></li>
<li class="fl subjectDate"><%=format_date homework.publish_time %></li>
</ul> </ul>
<div class="homeworkPublishTime"> <% end %>
创建时间:<%= format_date homework.created_at%> <script type="text/javascript">
</div> function show_homework_detail(url){
<% end%> $.get(
url,
{
},
function (data) {
}
);
}
</script>

View File

@ -1,27 +1,52 @@
<div class="coursesChoosePopup" id="coursesChoosePopup"> <div class="w985" style="padding:11px;"> <a href="javascript:void(0);" class="popupClose" onclick="hideModal()"></a>
<div> <div class="f16 fb fontBlue mb10">选用题库中的题目</div>
<div class="sendText">导入作业</div> <div class="subjectList fl mr10">
</div> <a href="<%= user_homework_type_user_path(@user) %>" id="public_homeworks_choose" class="subjectChoose chooseActive fl" data-remote="true">公共题库</a>
<a href="<%= user_homework_type_user_path(@user,:type=>'2') %>" id="user_homeworks_choose" class="subjectChoose fl" data-remote="true">我的题库</a>
<div > <div id="homework_search_input">
<%= form_tag user_search_homeworks_user_path(User.current.id), :multipart => true, :remote => true, :class => "coursesSearchBox" do%> <%=render :partial=>'homework_search_input', :locals=>{:type=>@type} %>
<input type="text" name="name" placeholder="输入作业名称进行搜索" class="searchCoursesPopup" id="search_homework_name"/> </div>
<a href="javascript:void(0);" class="searchIconPopup" onclick="$(this).parent().submit();"></a> <div class="cl"></div>
<% end%> <div>
</div> <ul class="subjectBanner mt10">
<%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %> <li class="subjectName fl hidden"><span style="padding-left:15px;">作业名称</span></li>
<input type="hidden" name="select_course" value="<%= @select_course%>"> <li class="subjectType fl">类型</li>
<div class="homeworkListForm mb10 " id="homework_list_form_show"> <li class="subjectCount fl">引用数</li>
<%= render :partial => 'users/show_user_homework_form', :locals => {:user_homeworks => @user_homeworks}%> <li class="subjectPublisher fl">贡献者</li>
</div> <li class="fl subjectDate">发布时间</li>
<div> </ul>
<div class="courseSendSubmit"> </div>
<a href="javascript:void(0);" class="sendSourceText" onclick="$('#select_homework_form').submit();">确定</a> <%= form_tag(user_select_homework_users_path, :multipart => true,:remote => true,:name=>"select_homework_form",:id=>'select_homework_form') do %>
<input type="hidden" name="select_course" value="<%= @select_course%>">
<div style="height:450px; min-height:450px; max-height:450px;" id="homework_list_form_show">
<%= render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks}%>
</div> </div>
<div class="courseSendCancel"> <% end %>
<a href="javascript:void(0);" class="sendSourceText" onclick="hideModal('#coursesChoosePopup')">取消</a> <div class="courseSendSubmit mr15">
</div> <a href="javascript:void(0);" class="sendSourceText" onclick="$('#select_homework_form').submit();hideModal()">选用</a>
</div> </div>
<% end%> <div class="courseSendCancel">
<a href="javascript:void(0);" class="sendSourceText" onclick="hideModal()">取消</a>
</div>
<div >
<ul class="wlist" id="homewrok_ref_pages" style="margin-top: 5px;margin-right: 20px">
<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>
</div>
<div class="cl"></div>
</div>
<div class="subjectDetail fl" id="homework_detail_information">
<%=render :partial=>'homework_detail_information', :locals=>{:homework=>nil} %>
</div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<script type="text/javascript">
$("#public_homeworks_choose").click(function(){
$(this).toggleClass("chooseActive");
$("#user_homeworks_choose").toggleClass("chooseActive");
});
$("#user_homeworks_choose").click(function(){
$(this).toggleClass("chooseActive");
$("#public_homeworks_choose").toggleClass("chooseActive");
});
</script>

View File

@ -33,7 +33,10 @@
<div class="cl"></div> <div class="cl"></div>
<div class=" mt10"> <div class=" mt10">
<%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业或者共享题库中的作业将于2016年春上线") unless edit_mode%> <%= link_to("导入作业", user_import_homeworks_user_path(User.current.id,:select_course => defined?(select_course)),:class => "BlueCirBtn fl mr10",:remote => true,:title=>"导入自己发布过的作业,或者共享题库中的作业") unless edit_mode%>
<% unless edit_mode %>
<input type="hidden" name="quotes" id="ref_homework_id" value=""/>
<% end %>
<% if edit_mode %> <% if edit_mode %>
<label class="fl c_grey f14" style="margin-top: 4px;">截止日期:</label> <label class="fl c_grey f14" style="margin-top: 4px;">截止日期:</label>
<% end %> <% end %>

View File

@ -14,6 +14,7 @@
.homepagePostReplyInputContainer .ke-inline-block {display: none;} .homepagePostReplyInputContainer .ke-inline-block {display: none;}
.homepagePostReplyInputContainer .ke-container {float: left;} .homepagePostReplyInputContainer .ke-container {float: left;}
</style> </style>
<div id="user_homework_list">
<% homework_commons.each do |homework_common|%> <% homework_commons.each do |homework_common|%>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
@ -47,4 +48,5 @@
<!-- 在个人主页 --> <!-- 在个人主页 -->
<%= link_to "点击展开更多",user_homeworks_user_path(User.current.id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%> <%= link_to "点击展开更多",user_homeworks_user_path(User.current.id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
<% end%> <% end%>
<% end%> <% end%>
</div>

View File

@ -39,6 +39,22 @@
更新时间:<%= format_time(PrincipalActivity.where("principal_act_type='#{activity.class}' and principal_act_id =#{activity.id}").first.updated_at) %> 更新时间:<%= format_time(PrincipalActivity.where("principal_act_type='#{activity.class}' and principal_act_id =#{activity.id}").first.updated_at) %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<% if activity.user == User.current || User.current.admin?%>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to(l(:label_bid_respond_delete),
{:controller => 'words', :action => 'destroy', :object_id => activity, :user_id => activity.user,:user_activity_id => user_activity_id,:is_activity=>is_activity},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete',
:class => "postOptionLink", :title => l(:button_delete)) %>
</li>
</ul>
</li>
</ul>
</div>
<% end%>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
@ -71,7 +87,7 @@
<ul> <ul>
<% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %> <% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %>
<% replies_all_i = replies_all_i + 1 %> <% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>"> <li class="homepagePostReplyContainer" nhname="reply_rec" onmouseover="$('#message_delete_<%= comment.id%>').show();" onmouseout="$('#message_delete_<%= comment.id%>').hide();" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
</div> </div>
@ -90,6 +106,14 @@
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %> <% end %>
</span> </span>
<div id="message_delete_<%=comment.id %>" style="display: none" class="mr10 fr">
<% if comment.user == User.current|| User.current.admin? %>
<%= link_to(l(:label_bid_respond_delete),
{:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:user_activity_id => user_activity_id,:is_activity=>is_activity},
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete',
:class => "delete", :title => l(:button_delete)) %>
<% end %>
</div>
</div> </div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= user_activity_id %>"> <div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= user_activity_id %>">
<%= comment.notes.html_safe %> <%= comment.notes.html_safe %>
@ -112,7 +136,6 @@
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %> <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %>
<%= hidden_field_tag 'show_name',params[:show_name],:value =>true %> <%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %> <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
<%= hidden_field_tag 'reply_type',params[:reply_type],:value =>'user' %>
<%= hidden_field_tag 'is_activity',params[:is_activity],:value =>is_activity %> <%= hidden_field_tag 'is_activity',params[:is_activity],:value =>is_activity %>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="user_notes"></textarea> <textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="user_notes"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div> <div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>

View File

@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %> <%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %> <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<%#= javascript_include_tag "init_KindEditor","user" %> <%#= javascript_include_tag "init_KindEditor","user" %>
<% end %> <% end %>
<style type="text/css"> <style type="text/css">

View File

@ -12,7 +12,7 @@
<%= ma.content %> <%= ma.content %>
</li> </li>
<li class="homepageHomeworkContentWarn fl"> <li class="homepageHomeworkContentWarn fl">
<%=link_to (ma.organization.domain.nil? || (ma.organization.domain && ma.organization.domain != ma.content)) ? "同意申请":"已同意申请", <%=link_to (ma.organization.domain.nil? || (ma.organization.domain && ma.organization.domain != ma.content)) ? "同意申请":"申请已批准",
agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id, :act_id => ma.id ), agree_apply_subdomain_organizations_path( :organization_id => ma.organization_id, :org_domain => ma.content, :user_id => ma.sender_id, :act_id => ma.id ),
:id => "agree_apply_subdomain_#{ma.id}", :id => "agree_apply_subdomain_#{ma.id}",
:method => 'post', :method => 'post',

View File

@ -7,7 +7,7 @@
<%= options_for_select({"C语言"=>1, "C++"=>2, "Python"=>3, "Java"=>4}, (edit_mode && homework.is_program_homework?) ? homework.language : 1) %> <%= options_for_select({"C语言"=>1, "C++"=>2, "Python"=>3, "Java"=>4}, (edit_mode && homework.is_program_homework?) ? homework.language : 1) %>
</select> </select>
</div> </div>
<div style="max-height: 320px; overflow-y:auto; width:730px;"> <div style="height: 320px; overflow-y:auto; width:730px;">
<% if edit_mode && homework.is_program_homework? %> <% if edit_mode && homework.is_program_homework? %>
<% homework.homework_tests.each_with_index do |test, index| %> <% homework.homework_tests.each_with_index do |test, index| %>
<div class="mt10"> <div class="mt10">

View File

@ -22,9 +22,9 @@
<! if(results[i]["status"]!=0){ !> <! if(results[i]["status"]!=0){ !>
<span class="w150 c_red">测试错误!</span> <span class="w150 c_red">测试错误!</span>
<span class="w60">您的输出:</span> <span class="w60">您的输出:</span>
<span class="W200"><!=results[i]["result"]!></span> <span class="W200"><pre><!=results[i]["result"]!></pre></span>
<span class="w60">正确输出:</span> <span class="w60">正确输出:</span>
<span class="W200"><!=results[i]["output"]!></span> <span class="W200"><pre><!=results[i]["output"]!></pre></span>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<!}else{!> <!}else{!>
@ -121,9 +121,9 @@
<% if x["status"].to_i != 0 %> <% if x["status"].to_i != 0 %>
<span class="w150 c_red">测试错误!</span> <span class="w150 c_red">测试错误!</span>
<span class="w60">您的输出:</span> <span class="w60">您的输出:</span>
<span class="W200"><%=x["result"]%></span> <span class="W200"><pre><%=x["result"]%></pre></span>
<span class="w60">正确输出:</span> <span class="w60">正确输出:</span>
<span class="W200"><%=x["output"]%></span> <span class="W200"><pre><%= x["output"] %></pre></span>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<% else %> <% else %>

View File

@ -11,8 +11,10 @@
//$("#upload_box").css('display','block'); //$("#upload_box").css('display','block');
<% if params[:send_type].present? && params[:send_type] == 'news' %> <% if params[:send_type].present? && params[:send_type] == 'news' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_course' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
<% else %> <% elsif params[:send_type] == 'file' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
<% elsif params[:send_type] == 'message' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_course' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
<% end %> <% end %>
showModal('ajax-modal', '452px'); showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();

View File

@ -1,7 +1,9 @@
<% if params[:send_type].present? && params[:send_type] == 'news' %> <% if params[:send_type].present? && params[:send_type] == 'news' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
<% else %> <% elsif params[:send_type] == 'file' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
<% elsif params[:send_type] == 'message' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_org' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
<% end %> <% end %>
showModal('ajax-modal', '452px'); showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();

View File

@ -1,7 +1,9 @@
<% if params[:send_type].present? && params[:send_type] == 'news' %> <% if params[:send_type].present? && params[:send_type] == 'news' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_news_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
<% else %> <% elsif params[:send_type] == 'file' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>'); $("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_project_popup', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
<% elsif params[:send_type] == 'message' %>
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/share_message_to_project', :locals => {:projects => @projects, :user => @user, :send_id => @send_id, :send_ids => @send_ids}) %>');
<% end %> <% end %>
showModal('ajax-modal', '452px'); showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();

View File

@ -0,0 +1,2 @@
hideModal();
alert("发送成功!");

View File

@ -0,0 +1,2 @@
hideModal();
alert("发送成功!");

View File

@ -0,0 +1,2 @@
hideModal();
alert("发送成功!");

View File

@ -0,0 +1 @@
$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>@homework}) %>")

View File

@ -17,9 +17,9 @@
<! if(results[i]["status"]!=0){ !> <! if(results[i]["status"]!=0){ !>
<span class="w150 c_red">测试错误!</span> <span class="w150 c_red">测试错误!</span>
<span class="w60">您的输出:</span> <span class="w60">您的输出:</span>
<span class="W200"><!=results[i]["result"]!></span> <span class="W200"><pre><!=results[i]["result"]!></pre></span>
<span class="w60">正确输出:</span> <span class="w60">正确输出:</span>
<span class="W200"><!=results[i]["output"]!></span> <span class="W200"><pre><!=results[i]["output"]!></pre></span>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<!}else{!> <!}else{!>
@ -95,9 +95,9 @@
<% if x["status"].to_i != 0 %> <% if x["status"].to_i != 0 %>
<span class="w150 c_red">测试错误!</span> <span class="w150 c_red">测试错误!</span>
<span class="w60">您的输出:</span> <span class="w60">您的输出:</span>
<span class="W200"><%=x["result"]%></span> <span class="W200"><pre><%=x["result"]%></pre></span>
<span class="w60">正确输出:</span> <span class="w60">正确输出:</span>
<span class="W200"><%=x["output"]%></span> <span class="W200"><pre><%=x["output"]%></pre></span>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<% else %> <% else %>

View File

@ -0,0 +1,4 @@
$("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks})%>');
$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");
$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_search_input', :locals=>{:type=>@type}) %>");

View File

@ -1,7 +1,4 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_homeworks') %>'); $('#ajax-modal').html('<%= escape_javascript(render :partial => 'users/show_user_homeworks') %>');
showModal('ajax-modal', '580px'); showModal('ajax-modal', '1040px');
$('#ajax-modal').css('height','300px').css("width","580px");
$('#ajax-modal').siblings().remove(); $('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" + $('#ajax-modal').parent().css("top","20%").css("left","25%").css("position","fixed").css("border","3px solid #269ac9");
"<a href='javascript:void(0)' onclick='hideModal();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","20%").css("left","25%").css("position","fixed").css("border","3px solid #269ac9");

View File

@ -1 +1,3 @@
$("#homework_list_form_show").html("<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:user_homeworks => @user_homeworks})%>"); $("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'users/show_user_homework_form', :locals => {:homeworks => @homeworks})%>');
$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");

View File

@ -5,6 +5,7 @@ $("#homework_end_time").val("<%= @homework.end_time%>");
<% if @select_course == "0"%> <% if @select_course == "0"%>
$("#course_id").val("<%= @homework.course_id%>"); $("#course_id").val("<%= @homework.course_id%>");
<% end%> <% end%>
$("#ref_homework_id").val("<%= @ref_homework.id%>");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true,:has_group => true,:show_member=>true})%>"); $("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true,:has_group => true,:show_member=>true})%>");
homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>"); homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>");
<% if @homework_detail_group %> <% if @homework_detail_group %>

View File

@ -1,10 +1,6 @@
<% if @save_succ %> <% if @save_succ %>
<% if @user_activity_id %> <% if @user_activity_id %>
<% if @reply_type == 'user' %> $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>");
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
<% end %>
init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity"); init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity");
<% else %> <% else %>
<% if !@jfm.nil? && @jfm.jour_type == 'Principal' %> <% if !@jfm.nil? && @jfm.jour_type == 'Principal' %>

View File

@ -2,13 +2,19 @@
alert('<%=l(:notice_failed_delete)%>'); alert('<%=l(:notice_failed_delete)%>');
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%> <% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%>
<% if @is_user%> <% if @is_user%>
var destroyedItem = $('#<%=@journal_destroyed.id%>'); <% if @activity %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id,:is_activity=>@is_activity}) %>");
init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity");
<% else %>
$("#user_activity_<%= @user_activity_id%>").hide();
<% end %>
/*var destroyedItem = $('#<%#=@journal_destroyed.id%>');
destroyedItem.fadeOut(600,function(){ destroyedItem.fadeOut(600,function(){
destroyedItem.remove(); destroyedItem.remove();
}); });
<% if @jours_count && @jours_count == 0 %> <%# if @jours_count && @jours_count == 0 %>
$("#user_jour_list").css("padding","0px"); $("#user_jour_list").css("padding","0px");
<% end %> <%# end %>*/
<% else %> <% else %>
<% if @bid && @jours_count %> <% if @bid && @jours_count %>
$('#jours_count').html("<%= @jours_count %>"); $('#jours_count').html("<%= @jours_count %>");

View File

@ -503,7 +503,7 @@ RedmineApp::Application.routes.draw do
match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
get 'user_import_homeworks' get 'user_import_homeworks'
post 'user_search_homeworks' get 'user_search_homeworks'
get 'user_import_resource' get 'user_import_resource'
match 'watch_projects', :to => 'users#watch_projects', :via => :get match 'watch_projects', :to => 'users#watch_projects', :via => :get
# #
@ -542,6 +542,9 @@ RedmineApp::Application.routes.draw do
post 'share_news_to_course' post 'share_news_to_course'
post 'share_news_to_project' post 'share_news_to_project'
post 'share_news_to_org' post 'share_news_to_org'
post 'share_message_to_course'
post 'share_message_to_project'
post 'share_message_to_org'
get 'resource_preview' get 'resource_preview'
get 'rename_resource' get 'rename_resource'
get 'search_user_project' get 'search_user_project'
@ -553,7 +556,9 @@ RedmineApp::Application.routes.draw do
get 'user_organizations' get 'user_organizations'
get 'search_user_orgs' get 'search_user_orgs'
get 'search_user_org' #for send resource get 'search_user_org' #for send resource
get 'user_homework_type'
get 'user_ref_homework_search'
get 'show_homework_detail'
# end # end
end end
#resources :blogs #resources :blogs
@ -990,6 +995,7 @@ RedmineApp::Application.routes.draw do
post 'set_course_outline' post 'set_course_outline'
get 'syllabus' get 'syllabus'
get 'search_public_orgs_not_in_course' get 'search_public_orgs_not_in_course'
get "homework_search"
end end
collection do collection do
match 'join_private_courses', :via => [:get, :post] match 'join_private_courses', :via => [:get, :post]
@ -1125,6 +1131,7 @@ RedmineApp::Application.routes.draw do
match "/system_log" ,:to => 'system_log#index' match "/system_log" ,:to => 'system_log#index'
match 'system_log/clear' match 'system_log/clear'
get 'upload_files_menu', :to => 'files#upload_files_menu' get 'upload_files_menu', :to => 'files#upload_files_menu'
get '/manual/feedback', to:redirect("http://forge.trustie.net/forums/1/memos/1168")
##ended by lizanle ##ended by lizanle
resources :git_callback do resources :git_callback do

View File

@ -0,0 +1,20 @@
class UpdateJournalForMessage < ActiveRecord::Migration
def up
journals = JournalsForMessage.where("m_parent_id is null and jour_type ='Principal' ")
count = journals.count / 30 + 2
transaction do
for i in 1 ... count do i
journals.page(i).per(30).each do |jour|
act = UserActivity.where("act_type='JournalsForMessage' and act_id = #{jour.id}").first
unless act.nil?
jour.updated_on = act.updated_at
jour.save
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,5 @@
class AddIsCopyToCourse < ActiveRecord::Migration
def change
add_column :courses, :is_copy, :integer, :default => 0
end
end

View File

@ -0,0 +1,5 @@
class AddQuotesToHomework < ActiveRecord::Migration
def change
add_column :homework_commons, :quotes, :integer, :default => 0
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160122143138) do ActiveRecord::Schema.define(:version => 20160128024452) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -501,6 +501,7 @@ ActiveRecord::Schema.define(:version => 20160122143138) do
t.string "end_term" t.string "end_term"
t.integer "is_excellent", :default => 0 t.integer "is_excellent", :default => 0
t.integer "excellent_option", :default => 0 t.integer "excellent_option", :default => 0
t.integer "is_copy", :default => 0
end end
create_table "custom_fields", :force => true do |t| create_table "custom_fields", :force => true do |t|
@ -782,6 +783,7 @@ ActiveRecord::Schema.define(:version => 20160122143138) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
t.integer "teacher_priority", :default => 1 t.integer "teacher_priority", :default => 1
t.integer "anonymous_comment", :default => 0 t.integer "anonymous_comment", :default => 0
t.integer "quotes", :default => 0
end end
add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id" add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
@ -1371,6 +1373,7 @@ ActiveRecord::Schema.define(:version => 20160122143138) do
t.integer "changeset_num", :default => 0 t.integer "changeset_num", :default => 0
t.integer "board_message_num", :default => 0 t.integer "board_message_num", :default => 0
t.integer "board_num", :default => 0 t.integer "board_num", :default => 0
t.integer "act_num", :default => 0
t.integer "attach_num", :default => 0 t.integer "attach_num", :default => 0
t.datetime "commit_time" t.datetime "commit_time"
end end
@ -1859,6 +1862,25 @@ ActiveRecord::Schema.define(:version => 20160122143138) do
add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade"
add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count"
create_table "user_wechats", :force => true do |t|
t.integer "subscribe"
t.string "openid"
t.string "nickname"
t.integer "sex"
t.string "language"
t.string "city"
t.string "province"
t.string "country"
t.string "headimgurl"
t.string "subscribe_time"
t.string "unionid"
t.string "remark"
t.integer "groupid"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "users", :force => true do |t| create_table "users", :force => true do |t|
t.string "login", :default => "", :null => false t.string "login", :default => "", :null => false
t.string "hashed_password", :limit => 40, :default => "", :null => false t.string "hashed_password", :limit => 40, :default => "", :null => false
@ -1934,6 +1956,14 @@ ActiveRecord::Schema.define(:version => 20160122143138) do
t.datetime "updated_at", :null => false t.datetime "updated_at", :null => false
end 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
create_table "wiki_content_versions", :force => true do |t| create_table "wiki_content_versions", :force => true do |t|
t.integer "wiki_content_id", :null => false t.integer "wiki_content_id", :null => false
t.integer "page_id", :null => false t.integer "page_id", :null => false

View File

@ -1,3 +1,4 @@
#coding=utf-8
# Redmine - project management software # Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang # Copyright (C) 2006-2013 Jean-Philippe Lang
# #
@ -180,8 +181,20 @@ module Redmine
end end
def render_single_menu_node(item, caption, url, selected) def render_single_menu_node(item, caption, url, selected)
title = h(caption)
link_to(h(caption), url, item.html_options(:selected => selected)) case title
when '作业'
title = h(caption) + "(#{HomeworkCommon.all.count})"
when '组织列表'
title = h(caption) + "(#{Organization.all.count})"
when '项目列表'
title = h(caption) + "(#{Project.all.count})"
when '课程列表'
title = h(caption) + "(#{Course.all.count})"
when '用户列表'
title = h(caption) + "(#{User.all.count})"
end
link_to(title, url, item.html_options(:selected => selected))
end end

View File

@ -1032,6 +1032,7 @@ function subfield_click(){
$(".orgDirection").text(orgDirection + sendText + " / " + sendColumn); $(".orgDirection").text(orgDirection + sendText + " / " + sendColumn);
} }
//send_type:发送的类型file对应文件message对应帖子news对应通知或新闻
function observeSearchfieldOnInput(fieldId, url,send_id,send_ids, send_type) { function observeSearchfieldOnInput(fieldId, url,send_id,send_ids, send_type) {
$('#'+fieldId).each(function() { $('#'+fieldId).each(function() {
var $this = $(this); var $this = $(this);
@ -1107,6 +1108,7 @@ function show_send(id, user_id, send_type){
//id 发送的id //id 发送的id
//发送的id数组 //发送的id数组
//send_type:发送的类型file对应文件message对应帖子news对应通知或新闻
function chooseSendType(res_id,res_ids, user_id, send_type){ function chooseSendType(res_id,res_ids, user_id, send_type){
sendType = $(".resourcesSendType").val(); sendType = $(".resourcesSendType").val();
@ -1135,3 +1137,17 @@ function chooseSendType(res_id,res_ids, user_id, send_type){
} }
lastSendType = sendType; lastSendType = sendType;
} }
//组织新建和配置中选择组织为私有后disbled掉允许游客下载选项
function disable_down(source, des, hint){
if (source.attr("checked")){
des.attr("disabled", false);
hint.html("");
}
else{
des.attr("checked", false);
des.attr("disabled", true);
hint.html("(私有组织不允许游客下载资源)");
}
}

View File

@ -10,16 +10,16 @@ function sd_create_editor(params){
resizeType : 1,minWidth:"1px",width:"94%", resizeType : 1,minWidth:"1px",width:"94%",
height:"33px",// == undefined ? "30px":paramsHeight+"px", height:"33px",// == undefined ? "30px":paramsHeight+"px",
minHeight:"33px",// == undefined ? "30px":paramsHeight+"px", minHeight:"33px",// == undefined ? "30px":paramsHeight+"px",
width:params.width,
items:['emoticons','fontname', items:['emoticons','fontname',
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|', 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
'formatblock', 'fontsize', '|','indent', 'outdent', 'formatblock', 'fontsize', '|','indent', 'outdent',
'|','imagedirectupload'], '|','imagedirectupload','more'],
afterChange:function(){//按键事件 afterChange:function(){//按键事件
var edit = this.edit; var edit = this.edit;
var body = edit.doc.body; var body = edit.doc.body;
edit.iframe.height(paramsHeight); edit.iframe.height(paramsHeight);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight)) , paramsHeight)); //this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : (params.kindutil.GECKO ? body.offsetHeight+26:body.offsetHeight)) , paramsHeight));
}, },
afterBlur:function(){ afterBlur:function(){
//params.toolbar_container.hide(); //params.toolbar_container.hide();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1432,4 +1432,27 @@ span.at a{color:#269ac9;text-decoration: none;}
.w80{ width:80px;} .w80{ width:80px;}
.label03{ width:70px; text-align:right; display:block; float:left;} .label03{ width:70px; text-align:right; display:block; float:left;}
.pro_info_p{color:#0781b4 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } .pro_info_p{color:#0781b4 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
.proInfoP{color:#000000 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; } .proInfoP{color:#000000 !important; float:left; width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; }
/*导入题库样式*/
.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;}
.subjectList {width:585px;}
.subjectDetail {width:385px;}
a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;}
a.chooseActive {background-color:#269ac9; color:#ffffff;}
.subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
.subjectBanner li {height:40px; line-height:40px; vertical-align:middle;}
.subjectName {width:270px; padding-left:10px; padding-right:10px;}
.subjectPublisher {width:80px; text-align:center;}
.subjectDate {width:80px; text-align:center;}
.subjectType {width:70px; text-align:center;}
.subjectCount {width:65px; text-align:center;}
.subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;}
.subjectRow li {height:30px; line-height:30px; vertical-align:middle;}
.subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;}
.subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:470px; overflow-y:auto;}
.subjectIntro {color:#585858; line-height:18px; font-size:12px;}
.subjectContent {color:#888888; line-height:18px; font-size:12px;}
.popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;}
.subjectContent p,.subjectContent div,.subjectContent em, .subjectContent span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important; color:#888888 !important; font-size:12px !important;}

View File

@ -1017,3 +1017,26 @@ a:hover.userCancel{border:1px solid #888888; }
.resourceCopy {padding:0px; margin:0px; width:12px; height:12px; display:inline-block;} .resourceCopy {padding:0px; margin:0px; width:12px; height:12px; display:inline-block;}
.relatePWrap{max-height: 210px;overflow:hidden;} .relatePWrap{max-height: 210px;overflow:hidden;}
/*导入题库样式*/
.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;}
.subjectList {width:585px;}
.subjectDetail {width:385px;}
a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;}
a.chooseActive {background-color:#269ac9; color:#ffffff;}
.subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
.subjectBanner li {height:40px; line-height:40px; vertical-align:middle;}
.subjectName {width:270px; padding-left:10px; padding-right:10px;}
.subjectPublisher {width:80px; text-align:center;}
.subjectDate {width:80px; text-align:center;}
.subjectType {width:70px; text-align:center;}
.subjectCount {width:65px; text-align:center;}
.subjectRow {width:585px; height:30px; color:#7a7a7a; font-size:12px;}
.subjectRow li {height:30px; line-height:30px; vertical-align:middle;}
.subjectSearch {border:1px solid #dddddd; height:32px; width:250px;outline: none;}
.subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:470px; overflow-y:auto;}
.subjectIntro {color:#585858; line-height:18px; font-size:12px;}
.subjectContent {color:#888888; line-height:18px; font-size:12px;}
.popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;}
.subjectContent p,.subjectContent div,.subjectContent em, .subjectContent span{text-align: justify; text-justify:inter-ideograph; word-break: normal !important; word-wrap: break-word !important; line-height: 18px !important; color:#888888 !important; font-size:12px !important;}