Merge branch 'cxt_course' into szzh

This commit is contained in:
cxt 2016-01-29 15:43:22 +08:00
commit 6b40b90ba4
89 changed files with 1086 additions and 466 deletions

View File

@ -461,8 +461,8 @@ class AdminController < ApplicationController
scope = User.order('last_login_on desc')
scope = scope.where("last_login_on>= '#{params[:startdate]} 00:00:00'") if params[:startdate].present?
scope =scope.where("last_login_on <= '#{params[:enddate]} 23:59:59'") if params[:enddate].present?
@user = scope
@user = paginateHelper @user,30
@users = scope
@users = paginateHelper @users,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html

View File

@ -312,7 +312,8 @@ class ApplicationController < ActionController::Base
elsif @course
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @course || @courses, :global => global)
else
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global)
# allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global)
allowed = true
end
allowed
end

View File

@ -52,10 +52,14 @@ class BlogCommentsController < ApplicationController
render_attachment_warning_if_needed(@article)
else
end
if params[:is_homepage]
redirect_to user_blogs_path(params[:user_id])
if params[:in_act]
redirect_to user_path(params[:user_id])
else
redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id])
if params[:is_homepage]
redirect_to user_blogs_path(params[:user_id])
else
redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id])
end
end
end
def destroy
@ -123,6 +127,7 @@ class BlogCommentsController < ApplicationController
@blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title]
@article.children << @blogComment
@article.save
# @article.update_attribute(:updated_on, @blogComment.updated_on)
@user_activity_id = params[:user_activity_id]
user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first
if user_activity

View File

@ -2,7 +2,6 @@ class BlogsController < ApplicationController
before_filter :find_blog,:except => [:index,:create,:new,:set_homepage, :cancel_homepage]
before_filter :find_user
def index
@articls = @user.blog.articles
@article = BlogComment.new
respond_to do |format|
format.html {render :layout=>'new_base_user'}

View File

@ -321,11 +321,12 @@ class CoursesController < ApplicationController
def export_course_member_excel
@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)}";
respond_to do |format|
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"))
}
end
@ -441,7 +442,10 @@ class CoursesController < ApplicationController
@course = cs.create_course(params,User.current)[:course]
if params[:copy_course]
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]
attachments = copy_course.attachments
attachments.each do |attachment|
@ -903,6 +907,17 @@ class CoursesController < ApplicationController
return 404
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
def update_quotes attachment
@ -960,7 +975,7 @@ class CoursesController < ApplicationController
sql_select = ""
if groupid == 0
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
WHERE student_works.homework_common_id = homework_commons.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}"
else
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
WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = #{@course.id}
@ -1006,16 +1021,54 @@ class CoursesController < ApplicationController
end
def member_to_xls members,groups
def member_to_xls homeworks, course, members,groups
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "student"
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)])
count_row = 1
=begin
group0 = CourseGroup.new();
group0.id = 0;
group0.name = l(:excel_member_with_out_class)
@ -1037,6 +1090,7 @@ class CoursesController < ApplicationController
end
end
end
=end
book.write xls_report
xls_report.string
end

View File

@ -15,8 +15,12 @@ class HomeworkCommonController < ApplicationController
@new_homework.homework_detail_manual = HomeworkDetailManual.new
@new_homework.course = @course
@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))
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_new = params[:is_new]

View File

@ -81,7 +81,7 @@ class IssuesController < ApplicationController
@priority_id = params[:priority_id]
@status_id = params[:status_id]
@subject = params[:subject]
@done_ratio = parmas[:done_ratio]
@done_ratio = params[:done_ratio]
@issue_count = @query.issue_count
@issue_pages = Paginator.new @issue_count, @limit, params['page']
params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1
@ -222,7 +222,7 @@ class IssuesController < ApplicationController
def update
if params[:issue_detail]
issue = Issue.find(params[:issue_id])
issue = Issue.find(params[:id])
issue = update_user_issue_detail(issue, params)
@saved = update_user_issue_detail(issue, params)
return

View File

@ -55,6 +55,7 @@ class OrganizationsController < ApplicationController
@organization.name = params[:organization][:name]
@organization.description = params[:organization][:description]
@organization.is_public = params[:organization][:is_public]
@organization.allow_guest_download = params[:organization][:allow_guest_download] == '1' ? 1 : 0
@organization.creator_id = User.current.id
member = OrgMember.new(:user_id => User.current.id)

View File

@ -360,6 +360,9 @@ update
end
# end
@changesets_latest_coimmit = @changesets[0]
unless @changesets[0].blank?
update_commits_date(@project, @changesets_latest_coimmit)
end
@properties = @repository.properties(@path, @rev)
@repositories = @project.repositories
@course_tag = params[:course]
@ -589,6 +592,11 @@ update
project.project_score.update_attribute(:changeset_num, count)
end
# 更新项目提交次数时间
def update_commits_date project, date
project.project_score.update_attribute(:commit_time, date.created_at)
end
def find_repository
@repository = Repository.find(params[:id])
@project = @repository.project

View File

@ -403,8 +403,47 @@ class UsersController < ApplicationController
#导入作业
def user_import_homeworks
@user = User.current
@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|
format.js
end
@ -412,7 +451,22 @@ class UsersController < ApplicationController
#用户主页过滤作业
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|
format.js
end
@ -426,6 +480,7 @@ class UsersController < ApplicationController
@homework = HomeworkCommon.new
@select_course = params[:select_course] || 0
if homework
@ref_homework = homework
@homework.name = homework.name
@homework.description = homework.description
@homework.end_time = homework.end_time
@ -583,13 +638,15 @@ class UsersController < ApplicationController
homework_detail_manual.save if homework_detail_manual
homework_detail_programing.save if homework_detail_programing
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"
redirect_to homework_common_index_path(:course => homework.course_id)
else
redirect_to user_homeworks_user_path(User.current.id)
end
end
end
else
@ -755,23 +812,17 @@ class UsersController < ApplicationController
if params[:type].present?
case params[:type]
when "public"
jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('created_on DESC')
@jour_count = jours.count
@jour = jours.limit(10).offset(@page * 10)
jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('updated_on DESC')
when "private"
jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('created_on DESC')
@jour_count = jours.count
@jour = jours.limit(10).offset(@page * 10)
jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('updated_on DESC')
else
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@jour_count = jours.count
@jour = jours.limit(10).offset(@page * 10)
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC')
end
else
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
@jour_count = jours.count
@jour = jours.limit(10).offset(@page * 10)
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC')
end
@jour_count = jours.count
@jour = jours.limit(10).offset(@page * 10)
@type = params[:type]
if User.current == @user
jours.update_all(:is_readed => true, :status => false)
@ -1633,6 +1684,10 @@ class UsersController < ApplicationController
attach_copied_obj.attachtype = 1
end
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
elsif params[:send_ids].present?
@ -1668,6 +1723,9 @@ class UsersController < ApplicationController
attach_copied_obj.attachtype = 1
end
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
@ -1796,13 +1854,24 @@ class UsersController < ApplicationController
def share_news_to_project
news = News.find(params[:send_id])
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|
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)
project = Project.find(project_id)
if project.news.map(&:id).exclude?(news.id)
message = Message.create(:board_id => project.boards.first.id, :subject => news.title, :content => news.description, :author_id => User.current.id)
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)
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

View File

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

View File

@ -49,6 +49,11 @@ module ApplicationHelper
end
end
def link_to_user_version(version, options = {})
return '' unless version && version.is_a?(Version)
link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue "
end
# 判断课程是否为精品课程
def is_excellent_course course
(course.is_excellent? or course.excellent_option?) ? true : false

View File

@ -35,14 +35,29 @@ module CoursesHelper
# a_tags = Course.find_by_sql(sql).select{|course| course.is_public ==1 unless User.current.member_of_course?(course)}
# 通过elastic结果获取精品课程
a_courses = []
courses = Course.search(keywords)
courses.each do |c|
a_courses << c.id
end
#courses = Course.search(keywords)
#courses.each do |c|
# a_courses << c.id
#end
a_courses << a_tags unless a_tags.length == 0
# 课程本身不能搜索显示自己
excellent_ids = a_courses.flatten.uniq.delete_if{|i| i == current_course.id}
limit = 5 - excellent_ids.length.to_i
sql = "SELECT distinct c.id FROM course_activities cs, courses c where cs.course_id = c.id
and c.is_excellent =1 and c.id != #{current_course.id} order by cs.updated_at desc;"
default_ecourse_ids = Course.find_by_sql(sql).flatten
# REDO:时间紧,待优化
default_ids =[]
default_ecourse_ids.each do |de|
default_ids << de.id
end
default_ids = default_ids - excellent_ids
#default_ecourse = Course.where("id is not in (?)", ids).find_by_sql(sql).flatten.delete_if{|i| i == current_course.id}.flatten
arr_result = excellent_ids << default_ids
arr_result = arr_result.flatten.first(5)
return arr_result
# 过滤条件:精品课程、本身不在搜索范围
e_courses = Course.where("is_excellent =? and id in (?)",1,a_courses.flatten.uniq).where("id !=?",current_course.id)
e_courses
#e_courses = Course.where("is_excellent =? and id in (?)",1, arr_result).where("id !=?", current_course.id)
end
# 判断精品课程是否可见,非课程成员无法查看私有课程
@ -682,17 +697,16 @@ module CoursesHelper
def join_in_course_header(course, user, options=[])
if user.logged?
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)
method = joined ? 'delete' : 'post'
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
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
else
link = "<span class='pr_join_span mr5' ><em class='pr_add'></em>#{l(:label_course_join_student)}</span>" +
"<span class='pr_join_span mr5' ><em class='pr_arrow'></em>#{l(:label_course_exit_student)}</span>"
link = "<span class='pr_join_span mr5' >#{l(:label_course_join_student)}</span>"
end
link.html_safe
end
@ -781,7 +795,7 @@ module CoursesHelper
# 学生按作业总分排序取前8个
def hero_homework_score(course, score_sort_by)
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
WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = #{course.id}

View File

@ -85,11 +85,6 @@ module UsersHelper
end
end
def link_to_user_version(version, options = {})
return '' unless version && version.is_a?(Version)
link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue "
end
# 统计未读消息数
def unviewed_message(user)
course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count

View File

@ -18,6 +18,7 @@ class BlogComment < ActiveRecord::Base
after_save :add_user_activity
after_update :update_activity
after_create :update_parent_time
before_destroy :destroy_user_activity
scope :like, lambda {|arg|
@ -64,6 +65,11 @@ class BlogComment < ActiveRecord::Base
(user && user.logged? && (self.author == user) ) || user.admin?
end
def update_parent_time
if !self.parent.nil?
self.root.update_attribute(:updated_on, self.updated_on)
end
end
def project
end
end

View File

@ -70,7 +70,7 @@ class JournalsForMessage < ActiveRecord::Base
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 :reset_counters!
after_update :update_ativity
#after_update :update_activity
after_destroy :reset_counters!
after_save :be_user_score
after_destroy :down_user_score

View File

@ -380,7 +380,15 @@ class Mailer < ActionMailer::Base
end
# issue截止时间提醒
def issue_due_date(issue, recipients)
def issue_due_date(issue)
recipients ||= []
if issue.author.id != issue.assigned_to_id
recipients << issue.author.mail
end
# 被指派人邮箱地址加入数组
recipients << issue.assigned_to.mail
# cc = wiki_content.page.wiki.watcher_recipients - recipients
@author = issue.author
@issue_name = issue.subject
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)

View File

@ -825,6 +825,9 @@ class User < Principal
end
def admin_of_org?(org)
if self.admin?
return true
end
if OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count == 0
return false
end

View File

@ -47,7 +47,7 @@
</thead>
<tbody>
<% @count=@page * 30 %>
<% for user in @user do %>
<% for user in @users do %>
<tr>
<% @count +=1 %>
<td align="center">

View File

@ -1,5 +1,5 @@
<% if User.current.logged? && User.current.id == @user.id %>
<%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage]},:method=>'PUT',
<%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage],:in_act => params[:in_act]},:method=>'PUT',
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'blog_comments/edit', :locals => {:f => f, :article => @article, :edit_mode => true, :user => @user} %>
<% end %>

View File

@ -45,7 +45,7 @@
<li>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @article.id},
{:action => 'edit', :id => @article.id,:in_act => params[:in_act]},
:class => 'postOptionLink'
) if User.current && User.current.id == @article.author.id %>
</li>
@ -215,4 +215,4 @@
postContent = postContent.replace(/&nbsp;/g," ");
$("#message_description_<%= @article.id %>").html(postContent);
});
</script>
</script>

View File

@ -30,7 +30,7 @@
<%= import_ke(enable_at: false, prettify: false) %>
<%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.created_on desc"), :page => 0, :user => @user} %>
<%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.updated_on desc"), :page => 0, :user => @user} %>
<script type="text/javascript">//侧导航

View File

@ -1,18 +1,20 @@
<% unless excellent_course_recommend(course).count == 0 %>
<ul class="courseR mb10">
<h4 class="mb5" ><%= l(:label_homework_recommendation) %></h4>
<% excellent_course_recommend(course).each do |e_course| %>
<li class="mt15"> <%= image_tag(url_to_avatar(e_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %>
<div class="fl">
<p class="f12 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %></p>
<p class="f12">
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>)</span>
<span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(e_course), :class => "linkBlue2" %>)</span></p>
</div>
<div class="cl"></div>
</li>
<% end %>
<div class="cl"></div>
</ul>
<% end %>
<% unless excellent_course_recommend(course).length == 0 %>
<ul class="courseR mb10">
<h4 class="mb5" ><%= l(:label_homework_recommendation) %></h4>
<% excellent_course_recommend(course).each do |e_course| %>
<% e_course = Course.find(e_course) %>
<li class="mt15"> <%= image_tag(url_to_avatar(e_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %>
<div class="fl">
<p class="f12 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %></p>
<p class="f12">
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>)</span>
<span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)</span></p>
</div>
<div class="cl"></div>
</li>
<% end %>
<div class="cl"></div>
</ul>
<% 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

@ -126,4 +126,4 @@
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
</div>
</div>
<% html_title(l(:label_attachment_plural)) -%>
<%# html_title(l(:label_attachment_plural)) -%>

View File

@ -95,4 +95,4 @@
<%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %>
</div>
</div>
<% html_title(l(:label_attachment_plural)) -%>
<%# html_title(l(:label_attachment_plural)) -%>

View File

@ -74,7 +74,7 @@
</div><!---re_con end-->
</div>
<% html_title(l(:label_attachment_plural)) -%>
<%# html_title(l(:label_attachment_plural)) -%>
<script>
function org_upload_files(org_subfield_id){
$.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="homepageRightBanner mb10">
<div class="NewsBannerName">作业</div>
<div id="search_div" class="fr mr10">
<%= render :partial => 'homework_search_form',:locals => {:course=>@course} %>
</div>
</div>
<div class="cl"></div>
@ -50,8 +53,8 @@
<% end%>
</div><!----HomeWork end-->
<% end%>
<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homeworks,:page => 0,:is_in_course => 1,:course_id => @course.id} %>
</div>
<div class="cl"></div>

View File

@ -20,7 +20,7 @@
$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)')
sd_create_editor_from_data(<%= @issue.id %>, null, "100%");
<%else%>
$("#div_user_issue_reply_<%=@user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
$("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'users/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity');
// sd_create_editor_from_data(<%#= @issue.id%>, null, "100%");
<%end %>

View File

@ -9,13 +9,16 @@
<!--<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") %>
</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) %>
<img src="/images/course/medal.png" alt="精品课程" style="vertical-align:bottom;" class="ml5" />
<% end %>
</div>
<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 class="pr_info_id fl mb5 f14">
ID:<%#= @course.id%>

View File

View File

@ -23,7 +23,7 @@
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
项目通知
新闻
</div>
</div>
<% if @project && User.current.allowed_to?(:manage_news, @project) %>

View File

@ -6,7 +6,7 @@
<div id="new_course_news">
<div class="homepagePostBrief c_grey">
<div>
<input type="text" name="news[title]" id="news_title" class="InputBox w713" maxlength="60" onfocus="$('#news_editor').show()" onkeyup="regexTitle();" placeholder="发布通知,请先输入通知标题" value="<%= news.title%>" >
<input type="text" name="news[title]" id="news_title" class="InputBox w713" maxlength="60" onfocus="$('#news_editor').show()" onkeyup="regexTitle();" placeholder="发布新闻,请先输入新闻标题" value="<%= news.title%>" >
<p id="title_notice_span"></p>
</div>
<div id="news_editor" style="display: none;">

View File

@ -72,7 +72,7 @@
</div>
<%end%>
<div class="postDetailTitle fl">
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">通知: <%= @news.title%></a>
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">新闻: <%= @news.title%></a>
</div>
<div class="cl"></div>

View File

@ -11,7 +11,7 @@
<div class="homepageRight mt0 ml10">
<div class="homepageRightBanner">
<div class="NewsBannerName">
编辑通知
编辑<%= @news.project_id != -1 ? '新闻':'通知' %>
</div>
</div>
<%= labelled_form_for :news, @news, :url => news_path(@news),

View File

@ -194,7 +194,7 @@
<% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<p class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p class="mh18"><%=time_from_now !com_time.nil? && format_time(com_time) > format_timetime ? com_time : time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</p>
<p class="mh18"><%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />

View File

@ -12,7 +12,7 @@
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% end %>
TO
<%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",org_subfield_boards_path(activity.board.org_subfield), :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 class="homepagePostTitle break_word">

View File

@ -35,7 +35,21 @@
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}','#{User.current.id}','news')") %></li>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<li>
<%= link_to(
l(:button_edit),
{:controller => 'news', :action => 'edit', :id => activity},
:class => 'postOptionLink'
) if activity.author == User.current %>
</li>
<li>
<%= delete_link(
news_path(activity),
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if activity.author == User.current %>
</li>
</ul>
<% end %>
</li>

View File

@ -65,8 +65,9 @@
<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" />
</div>
<div class="orgRow mb10 mt5"><span>允许游客下载: </span>
<input type="checkbox" name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" />
<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" />
&nbsp;<span>允许游客下载</span>
</div>
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org(<%=@organization.id %>);">保存</a>
<% end %>

View File

@ -108,7 +108,7 @@
<div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment[comments]"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="comment"></textarea>
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left;padding-top:3px; margin-left: 5px;"></div>
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<% attachments.each_with_index do |attachment,i| %>
<div id="attachment_<%= attachment.id%>">
<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 -%>
</span>
</span>

View File

@ -193,7 +193,7 @@
<% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<p class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p class="mh18"><%=time_from_now !com_time.nil? && format_time(com_time) > format_timetime ? com_time : time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</p>
<p class="mh18"><%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />

View File

@ -40,7 +40,21 @@
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<li>
<%= link_to(
l(:button_edit),
{controller:'news', :action => 'edit', :id => activity.id},
:class => 'postOptionLink'
) if User.current.allowed_to?(:manage_news, activity.course) %>
</li>
<li>
<%= delete_link(
news_path(activity),
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if User.current.allowed_to?(:manage_news, activity.course) %>
</li>
</ul>
<% end %>
</li>

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

@ -8,8 +8,8 @@
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor :content, :editor_id => 'jour_content_editor',
:width => '99.7%',
:height => 40,
:minHeight=>40,
:height => 100,
:minHeight=>100,
:input_html => { :id => 'jour_content',
:class => 'talk_text fl',
:maxlength => 5000 }%>

View File

@ -52,9 +52,13 @@
</div>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
<%# 局部刷新修改xissue属性 %>
<div id="div_user_issue_detail_<%=activity.id %>">
<%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %>
</div>
<% if is_project_manager?(User.current, activity.project) %>
<% unless params[:action] == "index" %>
<div id="div_user_issue_detail_<%=activity.id %>">
<%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %>
</div>
<% end %>
<% end %>
<div class="cl"></div>
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>

View File

@ -42,7 +42,7 @@
{: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"} %>
<%# end %>
<%= form_tag({:controller => 'issues', :action => 'update', :issue_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>
<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>
@ -54,7 +54,7 @@
</li>
<% end %>
<div class="cl"></div>
<%= form_tag({:controller => 'issues', :action => 'update', :issue_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>
<p class="label03">&nbsp;指派&nbsp;&nbsp;:&nbsp;</p>
<span class="pro_info_p">
@ -68,7 +68,7 @@
<div class="cl"></div>
</ul>
<ul class="fl">
<%= form_tag({:controller => 'issues', :action => 'update', :issue_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>
<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>
@ -78,7 +78,7 @@
</li>
<% end %>
<div class="cl"></div>
<%= form_tag({:controller => 'issues', :action => 'update', :issue_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>
<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>

View File

@ -10,8 +10,8 @@
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% end %> TO <!--+"(课程名称)"-->
<%= link_to activity.project.name.to_s+" | 项目通知", project_news_index_path(activity.project), :class => "newsBlue ml15" %>
<% end %> TO <!--+"(名称)"-->
<%= link_to activity.project.name.to_s+" | 新闻", project_news_index_path(activity.project), :class => "newsBlue ml15" %>
</div>
<div class="homepagePostTitle break_word hidden fl m_w600"> <!--+"(通知标题)"-->
<%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
@ -37,7 +37,21 @@
<li class="homepagePostSettingIcon">
<% if User.current.logged? %>
<ul class="homepagePostSettiongText">
<li><%= link_to("发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}','#{User.current.id}','news')") %></li>
<li><%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %></li>
<li>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => activity},
:class => 'postOptionLink'
) if activity.author == User.current %>
</li>
<li>
<%= delete_link(
news_path(activity),
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if activity.author == User.current %>
</li>
</ul>
<% end %>
</li>

View File

@ -1,13 +1,35 @@
<% user_homeworks.each do |homework|%>
<ul class="homeworkPublish">
<li class="fl">
<input name="checkMenu" type="radio" class="courseSendCheckbox" value="<%= homework.id%>"/>
<% homeworks.each do |homework| %>
<ul class="subjectRow">
<li class="subjectName fl hidden">
<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 class="sendCourseName fl hidden w450">
<%= homework.name%>
<li class="subjectType fl">
<% case homework.homework_type %>
<% when 1 %>
普通
<% when 2 %>
编程
<% when 3 %>
分组
<% end %>
</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>
<div class="homeworkPublishTime">
创建时间:<%= format_date homework.created_at%>
</div>
<% end%>
<% end %>
<script type="text/javascript">
function show_homework_detail(url){
$.get(
url,
{
},
function (data) {
}
);
}
</script>

View File

@ -1,27 +1,52 @@
<div class="coursesChoosePopup" id="coursesChoosePopup">
<div>
<div class="sendText">导入作业</div>
</div>
<div >
<%= form_tag user_search_homeworks_user_path(User.current.id), :multipart => true, :remote => true, :class => "coursesSearchBox" do%>
<input type="text" name="name" placeholder="输入作业名称进行搜索" class="searchCoursesPopup" id="search_homework_name"/>
<a href="javascript:void(0);" class="searchIconPopup" onclick="$(this).parent().submit();"></a>
<% end%>
</div>
<%= 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 class="homeworkListForm mb10 " id="homework_list_form_show">
<%= render :partial => 'users/show_user_homework_form', :locals => {:user_homeworks => @user_homeworks}%>
</div>
<div>
<div class="courseSendSubmit">
<a href="javascript:void(0);" class="sendSourceText" onclick="$('#select_homework_form').submit();">确定</a>
<div class="w985" style="padding:11px;"> <a href="javascript:void(0);" class="popupClose" onclick="hideModal()"></a>
<div class="f16 fb fontBlue mb10">选用题库中的题目</div>
<div class="subjectList fl mr10">
<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 id="homework_search_input">
<%=render :partial=>'homework_search_input', :locals=>{:type=>@type} %>
</div>
<div class="cl"></div>
<div>
<ul class="subjectBanner mt10">
<li class="subjectName fl hidden"><span style="padding-left:15px;">作业名称</span></li>
<li class="subjectType fl">类型</li>
<li class="subjectCount fl">引用数</li>
<li class="subjectPublisher fl">贡献者</li>
<li class="fl subjectDate">发布时间</li>
</ul>
</div>
<%= 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 class="courseSendCancel">
<a href="javascript:void(0);" class="sendSourceText" onclick="hideModal('#coursesChoosePopup')">取消</a>
</div>
</div>
<% end%>
<% end %>
<div class="courseSendSubmit mr15">
<a href="javascript:void(0);" class="sendSourceText" onclick="$('#select_homework_form').submit();hideModal()">选用</a>
</div>
<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>
</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

@ -111,7 +111,7 @@
<% case user_activity.act_type.to_s %>
<% when 'JournalsForMessage' %>
<% unless act.private == 1 && (!User.current || (User.current && act.jour_id != User.current.id && act.user_id != User.current.id)) %>
<%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_activity=>true} %>
<%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_activity=>1} %>
<% end %>
<% end %>
<% end %>

View File

@ -15,7 +15,7 @@
</div>
<div class="homepagePostTitle break_word"> <!--+"(通知标题)"-->
<div class="fl">
<%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id), :class => "postGrey" %>
<%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id,:in_act => true), :class => "postGrey" %>
</div>
<% if activity.sticky == 1%>
<span class="sticky_btn_cir ml10">置顶</span>

View File

@ -195,7 +195,7 @@
<% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<p class="mh18"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p class="mh18"><%=time_from_now !com_time.nil? && format_time(com_time) > format_timetime ? com_time : time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</p>
<p class="mh18"><%=time_from_now !com_time.nil? && format_time(com_time) > format_time(time) ? com_time : time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=homework_common.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />

View File

@ -33,7 +33,10 @@
<div class="cl"></div>
<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 %>
<label class="fl c_grey f14" style="margin-top: 4px;">截止日期:</label>
<% end %>

View File

@ -14,6 +14,7 @@
.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() {
@ -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"%>
<% end%>
<% end%>
<% end%>
</div>

View File

@ -16,7 +16,7 @@
<% end %>
<% end %>
</div>
<% if is_activity %>
<% if is_activity.to_i == 1 %>
<div class="homepagePostTitle break_word list_style upload_img">
<% if activity.parent %>
<%= link_to activity.parent.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
@ -39,6 +39,22 @@
更新时间:<%= format_time(PrincipalActivity.where("principal_act_type='#{activity.class}' and principal_act_id =#{activity.id}").first.updated_at) %>
</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 class="cl"></div>
</div>
@ -71,7 +87,7 @@
<ul>
<% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %>
<% 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">
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
</div>
@ -90,6 +106,14 @@
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
<% end %>
</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 class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= user_activity_id %>">
<%= comment.notes.html_safe %>
@ -112,7 +136,6 @@
<%= 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 '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 %>
<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>

View File

@ -18,11 +18,27 @@
<% jours.each do |jour|%>
<% unless jour.private == 1 && (!User.current || (User.current && jour.jour_id != User.current.id && jour.user_id != User.current.id)) %>
<script type="text/javascript">
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();
}
}
$(function(){
init_activity_KindEditor_data(<%= jour.id%>, null, "87%", "<%=jour.class.to_s%>");
});
</script>
<%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id,:is_activity=>false} %>
<%= render :partial => 'user_journalsformessage', :locals => {:activity => jour,:user_activity_id =>jour.id,:is_activity=>0} %>
<%#= render :partial => 'user_jours_new', :locals => {:jour => jour} %>
<% end %>
<%end%>

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) %>
</select>
</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? %>
<% homework.homework_tests.each_with_index do |test, index| %>
<div class="mt10">

View File

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

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') %>');
showModal('ajax-modal', '580px');
$('#ajax-modal').css('height','300px').css("width","580px");
showModal('ajax-modal', '1040px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<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");
$('#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"%>
$("#course_id").val("<%= @homework.course_id%>");
<% 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_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>");
<% if @homework_detail_group %>

View File

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

View File

@ -2,13 +2,19 @@
alert('<%=l(:notice_failed_delete)%>');
<% elsif (['Principal','Project','Course', 'Bid', 'Contest', 'Softapplication','HomeworkCommon'].include? @journal_destroyed.jour_type)%>
<% 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.remove();
});
<% if @jours_count && @jours_count == 0 %>
<%# if @jours_count && @jours_count == 0 %>
$("#user_jour_list").css("padding","0px");
<% end %>
<%# end %>*/
<% else %>
<% if @bid && @jours_count %>
$('#jours_count').html("<%= @jours_count %>");

View File

@ -674,7 +674,7 @@ zh:
label_day_plural:
label_repository: 版本库
label_course_repository: 代码库
label_browse: 浏览
label_browse: 上传文件
label_branch: 分支
label_tag: 标签
label_revision: 修订

View File

@ -82,6 +82,10 @@ RedmineApp::Application.routes.draw do
get '/', to: 'organizations#show', defaults: { id: 23 }, constraints: {subdomain: 'nubot'}
get '/', to: 'organizations#show', defaults: { id: 1 }, constraints: {subdomain: 'team'}
get '/', to: 'users#show', defaults: {id: 7}, constraints: {subdomain: 'whm'}
get '/', to: 'users#show', defaults: {id: 5}, constraints: {subdomain: 'yg'}
get '/', to: 'users#show', defaults: {id:11}, constraints: {subdomain: 'wt'}
resources :org_member do
member do
@ -499,7 +503,7 @@ RedmineApp::Application.routes.draw do
match 'user_visitorlist', :to => 'users#user_visitorlist', :via => :get
match 'user_homeworks', :to => 'users#user_homeworks', :via => :get
get 'user_import_homeworks'
post 'user_search_homeworks'
get 'user_search_homeworks'
get 'user_import_resource'
match 'watch_projects', :to => 'users#watch_projects', :via => :get
#
@ -549,7 +553,9 @@ RedmineApp::Application.routes.draw do
get 'user_organizations'
get 'search_user_orgs'
get 'search_user_org' #for send resource
get 'user_homework_type'
get 'user_ref_homework_search'
get 'show_homework_detail'
# end
end
#resources :blogs
@ -986,6 +992,7 @@ RedmineApp::Application.routes.draw do
post 'set_course_outline'
get 'syllabus'
get 'search_public_orgs_not_in_course'
get "homework_search"
end
collection do
match 'join_private_courses', :via => [:get, :post]

View File

@ -0,0 +1,17 @@
class ExcellentCourse < ActiveRecord::Migration
def up
arr = [302,192,370,394,183,361,117,218,379,178,418,203,342,403,225]
for i in 0..arr.length-1
begin
puts arr[i]
course = Course.find(arr[i])
course.update_attribute(:is_excellent, true)
rescue
logger.error("Course is not found!")
end
end
end
def down
end
end

View File

@ -0,0 +1,19 @@
class ExcellentOptionCourse < ActiveRecord::Migration
def up
arr = [151,122,15,227,139,410,291,224,55,137,414,43,417,52,205,44,216,132,204,258,411,50,
419,390,420,133,91,112,202,95,194,34,172,403,177,252,138,352,225,46,279,382,397,286,344,27,175,
124,265,88,59,110,72,92,392,413,26,201,94,57,156,393,154,12,262]
for i in 0..arr.length-1
begin
puts arr[i]
course = Course.find(arr[i])
course.update_attribute(:excellent_option, true)
rescue
logger.error("Course is not found!")
end
end
end
def down
end
end

View File

@ -0,0 +1,17 @@
class ExcellentCourseSe < ActiveRecord::Migration
def up
arr = [302,192,370,394,183,361,117,218,379,178,418,203,342,403,225]
for i in 0..arr.length-1
begin
puts arr[i]
course = Course.find(arr[i])
course.update_attribute(:is_excellent, true)
rescue
logger.error("Course is not found!")
end
end
end
def down
end
end

View File

@ -0,0 +1,19 @@
class ExcellentOptionSe < ActiveRecord::Migration
def up
arr = [151,122,15,227,139,410,291,224,55,137,414,43,417,52,205,44,216,132,204,258,411,50,
419,390,420,133,91,112,202,95,194,34,172,403,177,252,138,352,225,46,279,382,397,286,344,27,175,
124,265,88,59,110,72,92,392,413,26,201,94,57,156,393,154,12,262]
for i in 0..arr.length-1
begin
puts arr[i]
course = Course.find(arr[i])
course.update_attribute(:excellent_option, true)
rescue
logger.error("Course is not found!")
end
end
end
def down
end
end

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.
ActiveRecord::Schema.define(:version => 20160122083507) do
ActiveRecord::Schema.define(:version => 20160128024452) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -501,6 +501,7 @@ ActiveRecord::Schema.define(:version => 20160122083507) do
t.string "end_term"
t.integer "is_excellent", :default => 0
t.integer "excellent_option", :default => 0
t.integer "is_copy", :default => 0
end
create_table "custom_fields", :force => true do |t|
@ -782,6 +783,7 @@ ActiveRecord::Schema.define(:version => 20160122083507) do
t.datetime "updated_at", :null => false
t.integer "teacher_priority", :default => 1
t.integer "anonymous_comment", :default => 0
t.integer "quotes", :default => 0
end
add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
@ -1371,7 +1373,9 @@ ActiveRecord::Schema.define(:version => 20160122083507) do
t.integer "changeset_num", :default => 0
t.integer "board_message_num", :default => 0
t.integer "board_num", :default => 0
t.integer "act_num", :default => 0
t.integer "attach_num", :default => 0
t.datetime "commit_time"
end
create_table "project_statuses", :force => true do |t|

View File

@ -1,3 +1,4 @@
#coding=utf-8
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
@ -180,8 +181,20 @@ module Redmine
end
def render_single_menu_node(item, caption, url, selected)
link_to(h(caption), url, item.html_options(:selected => selected))
title = h(caption)
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

View File

@ -14,10 +14,10 @@ namespace :issue_due_date do
recipients << assigner
recipients.each do |r|
issue.forge_messages << ForgeMessage.new(:user_id => r.id, :project_id => issue.project_id, :viewed => false, :status => 1)
# issue截止时间邮件提醒
Mailer.issue_due_date(issue, recipients).deliver
end
end
# issue截止时间邮件提醒
Mailer.issue_due_date(issue).deliver
end
end
end

View File

@ -117,6 +117,7 @@ $(function(){
$('#BluePopupBox').parent().resizable("disable");
$('#BluePopupBox').parent().removeClass("ui-state-disabled");
$('#BluePopupBox').parent().css("border","3px solid #269ac9").css("padding","10px");
$('#BluePopupBox').parent().css("position","fixed");
$('a.ProBtn').live('click', function(){
$("#BluePopupBox").dialog("open");
@ -194,7 +195,7 @@ $(function(){
autoTextarea2(outputs[i], inputs[i]);
}
}
$(inputs[inputs.length - 1]).focus();
});
$("#BluePopupBox").on('click', 'a.icon_remove', function(){
$(this).parent('.mt10').remove();

View File

@ -75,7 +75,7 @@ function private_jour_submit(){
function jourReplyVerify() {
var content = jour_content_editor.html();//$.trim($("#message_content").val());
if (jour_content_editor.isEmpty()) {
$("#jour_content_span").text("回复不能为空");
$("#jour_content_span").text("留言不能为空");
$("#jour_content_span").css('color', '#ff0000');
$("#submit_feedback_user").one('click',function() {
jour_submit();

View File

@ -513,7 +513,7 @@ a.exit { height:24px; display:block; width:80px; color:#000000; background:#c3c3
.st_list{ width:670px;}
.st_search{ }
.st_search span{ font-size:14px; font-weight:bold; color:#606060; margin-right:35px;}
.st_search_input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:200px; padding-left:5px; margin-bottom:5px;}
.st_search_input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:220px; padding-left:5px; margin-bottom:5px;}
.st_search a{ background:#1c9ec7; color:#fff;border:1px solid #1c9ec7; text-align:center; display:block; width:60px; height:20px; float:left; font-size:12px; }
.st_search a:hover{ background:#048fbb; text-decoration:none;}
.classbox{ border:1px solid #f8df8c; background:#fffce6; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -693,7 +693,7 @@ a.postReplyCancel:hover {color:#ffffff;}
.homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;}
.homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;}
.homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}
a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;}
a.postOptionLink {color:#616060; display:block; width:55px; padding:0px 15px;text-align:center;}
a.postOptionLink:hover {color:#ffffff; background-color:#269ac9;}
.homepagePostReplyPortrait {float:left; width:33px;}
.imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;}
@ -1432,4 +1432,27 @@ span.at a{color:#269ac9;text-decoration: none;}
.w80{ width:80px;}
.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; }
.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

@ -414,7 +414,7 @@ a.link_file_board{ background:url(../images/pic_file.png) 0 3px no-repeat !impor
.st_list{ width:670px;}
.st_search{ }
.st_search span{ font-size:14px; font-weight:bold; color:#606060; margin-right:35px;}
.st_search_input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:200px; padding-left:5px; margin-bottom:5px;}
.st_search_input{ border:1px solid #1c9ec7; background:#fff; height:20px; color:#c4c4c4; width:220px; padding-left:5px; margin-bottom:5px;}
.st_search a{ background:#1c9ec7; color:#fff;border:1px solid #1c9ec7; text-align:center; display:block; width:60px; height:20px; float:left; font-size:12px; }
.st_search a:hover{ background:#048fbb; text-decoration:none;}
.classbox{ border:1px solid #f8df8c; background:#fffce6; color:#0d90c3; padding:0 3px; float:left; margin-left:15px;}
@ -1167,4 +1167,4 @@ div.disable_link {background-color: #c1c1c1 !important;}
/*问题跟踪局部修改属性*/
.proInfoBox2{ border:1px solid #dddddd; height:45px; padding:10px 0; background-color:#f1f1f1;}
.proInfoBox2 ul li{ height:24px; position:relative;}
.proInfoBox2 ul li{ height:24px; position:relative;}

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;}
.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;}