Merge branch 'szzh' into develop

This commit is contained in:
huang 2016-03-09 15:28:59 +08:00
commit 0dbcf30bdc
40 changed files with 470 additions and 231 deletions

View File

@ -251,7 +251,7 @@ class AttachmentsController < ApplicationController
@history.version = @old_history.nil? ? 1 : @old_history.version + 1
@history.save #历史记录保存完毕
#将最新保存的记录 数据替换到 需要修改的文件记录
@old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads")
@old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes")
@old_attachment.save
#删除当前记录
@attachment.delete

View File

@ -406,10 +406,14 @@ class FilesController < ApplicationController
@container_type = 2
@containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)]
@organization = Organization.find(@containers.first.organization_id)
if @organization.is_public? or User.current.admin? or User.current.member_of_org?(@organization)
show_attachments @containers
@tag_list = attachment_tag_list @all_attachments
@page = params[:page] || 1
render :layout => 'base_org'
else
render_403
end
# @subfield = params[:org_subfield_id]
end
@ -555,7 +559,8 @@ class FilesController < ApplicationController
end
end
# 更新课程英雄榜得分
update_contributor_score(@course, attachments[:files].first)
course_member_score(@course.id, attachments[:files].first.author_id, "Attachment")
# end
# end
# TODO: 临时用 nyan
sort_init 'created_on', 'desc'
@ -628,18 +633,6 @@ class FilesController < ApplicationController
end
end
def update_contributor_score(course, file )
course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course.id, file.author.id).first
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course.id, :user_id => file.author.id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 5, :journal_num => 0, :journal_reply_num => 0, :total_score => 5)
else
score = course_contributor_score.resource_num + 5
total_score = course_contributor_score.total_score + 5
course_contributor_score.update_attributes(:resource_num => score, :total_score => total_score)
end
end
def get_project_tag_name_by_type_nmuber type
case type
when "1"
@ -859,7 +852,15 @@ class FilesController < ApplicationController
q = "%#{@q.strip}%"
@result = find_org_subfield_attache q,@org_subfield,sort
@result = visable_attachemnts @result
if params[:other]
@result = @result.select{|attachment|
attachment.tag_list.exclude?('软件') &&
attachment.tag_list.exclude?('媒体') &&
attachment.tag_list.exclude?('代码')
}
else
@result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank?
end
@searched_attach = paginateHelper @result,10
@tag_list = get_org_subfield_tag_list @org_subfield

View File

@ -17,9 +17,9 @@ class HomeworkCommonController < ApplicationController
@page = params[:page] ? params[:page].to_i + 1 : 0
@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)
@homeworks = @course.homework_commons.order("updated_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)
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("updated_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

@ -33,6 +33,7 @@ class OrgSubfieldsController < ApplicationController
domain = Secdomain.where("subname=?", request.subdomain).first
@organization = Organization.find(domain.pid)
end
if @organization.is_public? or User.current.admin? or User.current.member_of_org?(@organization)
@org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+
"subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+
" org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'").first
@ -88,6 +89,9 @@ class OrgSubfieldsController < ApplicationController
@tag_list = attachment_tag_list @all_attachments
end
@page = params[:page] || 1
else
render_403
end
#render :layout => 'base_org'
end

View File

@ -406,6 +406,7 @@ class ProjectsController < ApplicationController
end
flash.now[:error] = html if !html.to_s.blank?
end
# for设置默认分支
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
@repository = Repository.factory(scm)
@repository.is_default = @project.repository.nil?

View File

@ -140,7 +140,7 @@ class RepositoriesController < ApplicationController
attrs = {:parent_id => project.parent_id}.reject {|k,v| v.nil?}
redirect_to new_project_url(attrs, :course => '0')
else
redirect_to settings_project_url(project)
redirect_to project_path(project)
end
}
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => project.id) }
@ -431,8 +431,11 @@ update
def entry
entry_and_raw(false)
@content = @repository.cat(@path, @rev)
if is_entry_text_data?(@content, @path)
render :layout => 'base_projects'
end
end
def entry_and_raw(is_raw)
@entry = @repository.entry(@path, @rev)
@ -443,9 +446,7 @@ update
@content = @repository.cat(@path, @rev)
(show_error_not_found; return) unless @content
if is_raw ||
(@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
! is_entry_text_data?(@content, @path)
if is_raw || (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || !is_entry_text_data?(@content, @path)
# Force the download
send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) }
send_type = Redmine::MimeType.of(@path)

View File

@ -303,6 +303,7 @@ class StudentWorkController < ApplicationController
stu_project.save
end
end
@homework.update_attributes(:updated_at => Time.now)
update_course_activity(@homework.class,@homework.id)
update_user_activity(@homework.class,@homework.id)
update_org_activity(@homework.class,@homework.id)
@ -500,6 +501,10 @@ class StudentWorkController < ApplicationController
when 3 #学生评分 学生评分显示平均分
@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
end
@homework.update_attributes(:updated_at => Time.now)
update_course_activity(@homework.class,@homework.id)
update_user_activity(@homework.class,@homework.id)
update_org_activity(@homework.class,@homework.id)
if @work.save
respond_to do |format|
format.js

View File

@ -58,6 +58,7 @@ class UsersController < ApplicationController
helper :sort
helper :attachments
include SortHelper
include ApplicationHelper
helper :custom_fields
include CustomFieldsHelper
include AvatarHelper
@ -425,9 +426,9 @@ class UsersController < ApplicationController
homework = HomeworkCommon.find params[:homework].to_i
if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%"
@course = @user.courses.where("#{Course.table_name}.id != #{homework.course_id} and #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)}
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)}
else
@course = @user.courses.where("#{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
end
@search = params[:search]
#这里仅仅是传递需要发送的资源id
@ -690,6 +691,11 @@ class UsersController < ApplicationController
end
student_work.save
homework.update_attributes(:updated_at => Time.now)
update_course_activity(homework.class,homework.id)
update_user_activity(homework.class,homework.id)
update_org_activity(homework.class,homework.id)
flash[:notice] = l(:notice_successful_create)
redirect_to student_work_index_url(:homework => params[:homework])
else
@ -1693,17 +1699,17 @@ class UsersController < ApplicationController
@flag = true
if params[:send_id].present?
send_id = params[:send_id]
ori = Attachment.find_by_id(send_id)
@ori = Attachment.find_by_id(send_id)
course_ids = params[:course_ids]
if course_ids.nil?
@flag = false
end
unless course_ids.nil?
course_ids.each do |id|
next if ori.blank?
next if @ori.blank?
@exist = false
Course.find(id).attachments.each do |att| #如果课程中包含该资源
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
if att.id == @ori.id || (!att.copy_from.nil? && !@ori.copy_from.nil? && att.copy_from == @ori.copy_from) || att.copy_from == @ori.id || att.id == @ori.copy_from
att.created_on = Time.now
att.save
@exist = true
@ -1711,21 +1717,21 @@ class UsersController < ApplicationController
end
end
next if @exist
attach_copied_obj = ori.copy
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
attach_copied_obj = @ori.copy
attach_copied_obj.tag_list.add(@ori.tag_list) # tag关联
attach_copied_obj.container = Course.find(id)
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
attach_copied_obj.is_public = 0
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
attach_copied_obj.copy_from = @ori.copy_from.nil? ? @ori.id : @ori.copy_from #发送要添加copy_from
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 4
end
if attach_copied_obj.save
# 更新引用次数
quotes = ori.quotes.to_i + 1
ori.update_attribute(:quotes, quotes) unless ori.nil?
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
quotes = @ori.quotes.to_i + 1
@ori.update_attribute(:quotes, quotes) unless @ori.nil?
@ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
end
@save_message = attach_copied_obj.errors.full_messages
end
@ -1837,6 +1843,7 @@ class UsersController < ApplicationController
Project.find(project_id).project_score.attach_num + 1)
end
end
@ori = ori
end
elsif params[:send_ids].present?
send_ids = params[:send_ids].split(" ")
@ -1941,6 +1948,7 @@ class UsersController < ApplicationController
end
end
end
@ori = ori
elsif params[:send_ids].present?
send_ids = params[:send_ids].split(" ")
subfield_id = params[:subfield]

View File

@ -276,7 +276,7 @@ class WordsController < ApplicationController
ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
end
@homework_common.update_attributes(:updated_at => Time.now)
update_course_activity(@homework_common.class,@homework_common.id)
update_user_activity(@homework_common.class,@homework_common.id)
update_org_activity(@homework_common.class,@homework_common.id)

View File

@ -117,56 +117,102 @@ module ApplicationHelper
when "HomeworkCommon"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :homework_journal_num => 1 , :total_score => 1)
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :homework_journal_num => 1)
else
score = course_contributor_score.homework_journal_num + 1
total_score = course_contributor_score.total_score + 1
course_contributor_score.update_attributes(:homework_journal_num => score, :total_score => total_score)
course_contributor_score.update_attributes(:homework_journal_num => score)
end
when "JournalForMessage"
# 课程留言
when "Course"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0, :total_score => 1)
:news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0)
else
score = course_contributor_score.journal_num + 1
total_score = course_contributor_score.total_score + 1
course_contributor_score.update_attributes(:journal_num => score, :total_score => total_score)
course_contributor_score.update_attributes(:journal_num => score)
end
when "Message"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 2, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 2)
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 1, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
else
score = course_contributor_score.message_num + 2
total_score = course_contributor_score.total_score + 2
course_contributor_score.update_attributes(:message_num => score, :total_score => total_score)
score = course_contributor_score.message_num + 1
course_contributor_score.update_attributes(:message_num => score)
end
when "MessageReply"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 1,
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1)
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
else
score = course_contributor_score.message_reply_num + 1
total_score = course_contributor_score.total_score + 1
course_contributor_score.update_attributes(:message_reply_num => score, :total_score => total_score)
course_contributor_score.update_attributes(:message_reply_num => score)
end
when "NewReply"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1)
:news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
else
score = course_contributor_score.news_reply_num + 1
total_score = course_contributor_score.total_score + 1
course_contributor_score.update_attributes(:news_reply_num => score, :total_score => total_score)
course_contributor_score.update_attributes(:news_reply_num => score)
end
when "News"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :news_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1)
:news_reply_num => 0, :news_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
else
score = course_contributor_score.news_num + 1
total_score = course_contributor_score.total_score + 1
course_contributor_score.update_attributes(:news_num => score, :total_score => total_score)
course_contributor_score.update_attributes(:news_num => score)
end
when "Attachment"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :news_num => 0, :resource_num => 1, :journal_num => 0, :journal_reply_num => 0)
else
score = course_contributor_score.resource_num + 1
course_contributor_score.update_attributes(:resource_num => score)
end
end
end
# 删除某条记录相应减少课程统计数
def down_course_score_num (course_id,user_id,type)
course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course_id, user_id).first
case type
when "HomeworkCommon"
unless course_contributor_score.nil?
score = course_contributor_score.homework_journal_num - 1
course_contributor_score.update_attribute(:homework_journal_num, score < 0 ? 0 : score)
end
# 课程留言
when "Course"
unless course_contributor_score.nil?
score = course_contributor_score.journal_num - 1
course_contributor_score.update_attribute(:journal_num, score < 0 ? 0 : score)
end
when "Message"
unless course_contributor_score.nil?
score = course_contributor_score.message_num - 1
course_contributor_score.update_attribute(:message_num, score < 0 ? 0 : score)
end
when "MessageReply"
unless course_contributor_score.nil?
score = course_contributor_score.message_reply_num - 1
course_contributor_score.update_attribute(:message_reply_num, score < 0 ? 0 : score)
end
when "NewReply"
unless course_contributor_score.nil?
score = course_contributor_score.news_reply_num - 1
course_contributor_score.update_attribute(:news_reply_num, score < 0 ? 0 : score)
end
when "News"
unless course_contributor_score.nil?
score = course_contributor_score.news_num - 1
course_contributor_score.update_attribute(:news_num, score < 0 ? 0 : score)
end
when "Attachment"
unless course_contributor_score.nil?
score = course_contributor_score.resource_num - 1
course_contributor_score.update_attribute(:resource_num, score < 0 ? 0 : score)
end
end
end
@ -2049,9 +2095,11 @@ module ApplicationHelper
course = attachment.container
candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
elsif attachment.container.is_a?(OrgSubfield)
candown = true
org = attachment.container.organization
candown = User.current.member_of_org?(org) || (org.is_public && attachment.is_public == 1)
elsif attachment.container.is_a?(OrgDocumentComment)
candown = true
org = attachment.container.organization
candown = User.current.member_of_org?(org) || (org.is_public && attachment.is_public == 1)
elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board &&
attachment.container.board.course
course = attachment.container.board.course

View File

@ -126,7 +126,7 @@ module FilesHelper
(attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)||
attachment.author_id == User.current.id ||
attachment.container_type == "OrgSubfield"
(attachment.container_type == "OrgSubfield" and User.current.member_of_org?(attachment.container.organization))
result << attachment
end
end

View File

@ -43,6 +43,7 @@ class Attachment < ActiveRecord::Base
#elasticsearch
include Elasticsearch::Model
include ApplicationHelper
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
@ -92,7 +93,7 @@ class Attachment < ActiveRecord::Base
after_save :act_as_course_activity
after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index
after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count, :down_course_score
# add by nwb
# 获取所有可公开的资源文件列表
@ -655,6 +656,12 @@ class Attachment < ActiveRecord::Base
self.container.project_score.update_attribute(:attach_num, attach_count < 0 ? 0 : attach_count)
end
end
def down_course_score
if self.container_type == "Course"
down_course_score_num(self.container_id, self.author_id, "Attachment")
end
end
end
# Delete the previous articles index in Elasticsearch

View File

@ -36,6 +36,7 @@ class Comment < ActiveRecord::Base
validates_presence_of :commented, :author, :comments
safe_attributes 'comments'
after_create :send_mail, :act_as_system_message, :act_as_student_score
after_destroy :down_course_score
def act_as_system_message
if self.commented.course
@ -86,4 +87,11 @@ class Comment < ActiveRecord::Base
end
end
# 课程新闻数减少
def down_course_score
if self.commented.course
down_course_score_num(self.commented.course.id, self.author_id, "NewReply")
end
end
end

View File

@ -73,7 +73,7 @@ class JournalsForMessage < ActiveRecord::Base
#after_update :update_activity
after_destroy :reset_counters!
after_save :be_user_score
after_destroy :down_user_score
after_destroy :down_user_score, :down_course_score
# default_scope { where('m_parent_id IS NULL') }
@ -184,6 +184,7 @@ class JournalsForMessage < ActiveRecord::Base
end
end
end
# 更新用户分数 -by zjc
def down_user_score
#删除了留言回复
@ -286,10 +287,19 @@ class JournalsForMessage < ActiveRecord::Base
# 课程成员得分(活跃度)
def act_as_student_score
if self.jour_type == "Course"
course_member_score(self.jour_id, self.user_id, "JournalForMessage")
course_member_score(self.jour_id, self.user_id, "Course")
elsif self.jour_type == "HomeworkCommon"
course_member_score(self.jour.course_id, self.user_id, "HomeworkCommon")
end
end
# 删除操作的时候相应扣掉回复数
def down_course_score
if self.jour_type == "Course"
down_course_score_num(self.jour_id, self.user_id, "Course")
elsif self.jour_type == "HomeworkCommon"
down_course_score_num(self.jour.course_id, self.user_id, "HomeworkCommon")
end
end
end

View File

@ -79,7 +79,7 @@ class Message < ActiveRecord::Base
after_create :add_author_as_watcher, :reset_counters!, :add_boards_count
after_update :update_messages_board, :update_activity
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count, :down_course_score
after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, :act_as_at_message
#before_save :be_user_score
@ -354,6 +354,18 @@ class Message < ActiveRecord::Base
end
end
# 删除帖子的时候更新课程帖子总数, 删除回复的时候减少总数
def down_course_score
if self.course
if self.parent_id.nil? # 发帖
down_course_score_num(self.course.id, self.author_id, "Message")
else
# 回帖
down_course_score_num(self.course.id, self.author_id, "MessageReply")
end
end
end
def delete_org_activities
OrgActivity.where("org_act_type='Message' and org_act_id =#{self.id} and container_type='OrgSubfield'").destroy_all
end

View File

@ -61,7 +61,7 @@ class News < ActiveRecord::Base
after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score
after_update :update_activity
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
scope :visible, lambda {|*args|
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args))
@ -195,10 +195,18 @@ class News < ActiveRecord::Base
OrgActivity.where("container_type='OrgSubfield' and org_act_type='News' and org_act_id=?", self.id).destroy_all
end
# 新增新闻统计数增加
def act_as_student_score
if self.course
course_member_score(self.course.id, self.author_id, "News")
end
end
# 删除新闻统计数减少
def down_course_score
if self.course
down_course_score_num(self.course.id, self.author_id, "News")
end
end
end

View File

@ -6,7 +6,7 @@
<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 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %><div class="cl"></div> </p>
<p class="f12">
<% if e_course.attachments.count > 0 %>
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>)</span>
@ -14,6 +14,7 @@
<% if e_course.homework_commons.count > 0 %>
<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>
<% end %>
<div class="cl"></div>
</p>
</div>
<div class="cl"></div>

View File

@ -1,6 +1,7 @@
<% delete_allowed = User.current.admin? %>
<% org_subfield_attachments.each do |file| %>
<% if file.is_public == 1 or User.current.member_of_org?(file.container.organization) %>
<div class="resources mt10" id="container_files_<%= file.id %>">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
@ -8,7 +9,7 @@
</div>
<div class="homepagePostDes">
<div class="homepagePostTitle break_word mt-4">
<%= link_to truncate(file.filename,length: 35, omission: '...'),
<%= link_to file.is_public? ? truncate(file.filename, length: 70) : truncate(file.filename,length: 50, omission: '...'),
download_named_attachment_path(file.id, file.filename),
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14 f_l" %>
<%= file_preview_eye(file, class: 'preview') %>
@ -25,7 +26,7 @@
<span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span>
<% end %>
<p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p>
<p class="fl ml15 fontGrey2">下载<%= file.downloads%>&nbsp;&nbsp;|&nbsp;&nbsp;引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
<p class="fl ml15 fontGrey2">下载<%= file.downloads%>&nbsp;&nbsp;|&nbsp;&nbsp;引用<span id="reference_number_<%= file.id %>"><%= file.quotes.nil? ? 0:file.quotes %></span></p>
</div>
<div class="cl"></div>
<div class="tag_h">
@ -66,6 +67,7 @@
</div><!---re_con_box end-->
<% end %>
<% end %>
<% if org_subfield_attachments.count == 10 %>
<% if params[:action] == 'search_files_in_subfield' %>

View File

@ -54,7 +54,7 @@
<%= render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name}%>
</div>
<div class="cl"></div>
<p class="f_l fontBlue f_b f_14">共有&nbsp;<span id="attachment_count"><%= @all_attachments.count %></span>&nbsp;个资源</p>
<p class="f_l fontBlue f_b f_14">共有&nbsp;<span id="attachment_count"><%= User.current.member_of_org?(@org_subfield.organization) ? @all_attachments.count : @all_attachments.select{|attach| attach.is_public == 1 }.count %></span>&nbsp;个资源</p>
<p class="f_r" style="color: #808080">
<% if @order == "asc" %>
按&nbsp;<%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %>&nbsp;/&nbsp;

View File

@ -143,18 +143,19 @@
<% unless contributor_course_scor(@course.id).count == 0 %>
<ul class="rankList">
<h4>课程活跃度
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))">积分规则</a>
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor: pointer; position:relative;">积分规则</a>
</h4>
<div style="display: none;padding: 5px;" class="numIntro color_888">
<div class="contributor_course_innor">积分规则</div>
资源发布:资源数 x 5 </br>
问答发布:发帖数 x 2 </br>
通知发布:通知数 x 1 </br>
问答回复:回复数 x 1 </br>
作业留言:留言数 x 1 </br>
通知留言:留言数 x 1 </br>
课程留言:留言数 x 1 </br>
总得分为以上得分之和
<div class="numIntro undis" style="cursor:pointer;">
<div class="active-degree-rule">
积分规则<br/>
资源发布:资源数 x 5 <br/>
问答发布:发帖数 x 2 <br/>
通知发布:通知数 x 1 <br/>
问答回复:回复数 x 1 <br/>
作业留言:留言数 x 1 <br/>
通知留言:留言数 x 1 <br/>
课程留言:留言数 x 1 <br/>
总得分为以上得分之和</div>
</div>
<% contributor_course_scor(@course.id).each do |contributor_score| %>
@ -163,13 +164,13 @@
+ contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 +
contributor_score.news_num.to_i * 1 %>
<% unless total_score ==0 %>
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %></a>
<p><a href="javascript:void:(0);"><%=link_to contributor_score.user.show_name, user_path(contributor_score.user), :title => contributor_score.user.show_name %></a></p>
<li><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %>
<p><%=link_to contributor_score.user.show_name, user_path(contributor_score.user.id), :title => contributor_score.user.show_name %></p>
<p><span class="c_green" style="cursor:pointer">
<a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="c_green">
<%=total_score %></a></span></p>
<div style="display: none" class="numIntro color_888">
<div class="contributor_course_calculate">积分计算</div>
<div style="display: none" class="numIntro">
<div class="contributor-course-calculate">积分计算</div>
<%# unless contributor_score.resource_num.to_i == 0 %>
<div style="padding-left: 2px;padding-bottom: 2px;padding-right: 2px">
资源发布数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %></br>
@ -208,11 +209,12 @@
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
<ul class="rankList">
<h4><span>课程英雄榜</span>
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))">积分规则</a></h4>
<div style="display: none" class="numIntro color_888">
<div class="hero_course_innor">积分规则</div>
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor:pointer;">积分规则</a></h4>
<div style="cursor:pointer;" class="numIntro undis">
<div class="hero-degree-rule">积分规则<br/>
英雄榜的得分是每个同学作业的得分总和
</div>
</div>
<% hero_homework_scores.each do |student_score| %>
<% if student_score.score.to_i != 0 %>
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a>

View File

@ -154,8 +154,18 @@
<% end %>
<% student_works.each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%></p>
<a href="javascript:void(0);" class="linkBlue">
<% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>
<%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
<p class="w100 hidden">
<%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%>
</p>
<% else %>
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>
<p class="w100 hidden">
<a href="javascript:void(0);" title="该作业的作品暂未公开"><%=sw.user.show_name %></a>
</p>
<% end %>
</a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p>

View File

@ -27,7 +27,7 @@
<div class="fl mt5 ml15"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_zip"></span>ZIP</a> </div>
<%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %>
<% if User.current.id != @project.user_id %>
<div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %>
<div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :target => "_blank", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %>
<span href="javascript:void(0);" class="vl_btn_2 fb"><%= @project.forked_count.to_i %></span>
</div>
<% end %>

View File

@ -153,8 +153,18 @@
<% end %>
<% student_works.each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%></p>
<a href="javascript:void(0);" class="linkBlue">
<% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>
<%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
<p class="w100 hidden">
<%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%>
</p>
<% else %>
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>
<p class="w100 hidden">
<a href="javascript:void(0);" title="该作业的作品暂未公开"><%=sw.user.show_name %></a>
</p>
<% end %>
</a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p>

View File

@ -37,8 +37,8 @@
</div>
<div class="uploadResourceIntr">
<div class="uploadResourceName"><span id="upload_file_count">(未选择文件)</span></div>
<div class="uploadResourceIntr2"><!--您可以上传小于<span class="c_red">50MB</span>的文件--></div>
<div class="uploadResourceName fl"><span id="upload_file_count">(未选择文件)</span></div>
<div class="uploadResourceIntr2 fl">您可以上传小于<span class="c_red">50MB</span>的文件</div>
</div>
</div>
<div class="cl"></div>

View File

@ -5,7 +5,7 @@
<span class="newsBlue homepageNewsPublisher"><%= ma.author.login %></span><span class="homepageNewsType fl">提到了你:</span>
</li>
<li class="homepageNewsContent fl">
<%= link_to ma.subject.html_safe, ma.url,
<%= link_to ma.subject.html_safe, course_boards_path(ma.at_message.course, :parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id),
:class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></li>

View File

@ -157,8 +157,18 @@
<% end %>
<% student_works.each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => homework_common.id), :alt => "学生头像" %>
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => homework_common.id)%></p>
<a href="javascript:void(0);" class="linkBlue">
<% if User.current.member_of_course?(homework_common.course) || User.current.admin? || homework_common.is_open == 1 %>
<%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => homework_common.id), :alt => "学生头像" %>
<p class="w100 hidden">
<%= link_to sw.user.show_name, student_work_index_path(:homework => homework_common.id)%>
</p>
<% else %>
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>
<p class="w100 hidden">
<a href="javascript:void(0);" title="该作业的作品暂未公开"><%=sw.user.show_name %></a>
</p>
<% end %>
</a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p>

View File

@ -246,7 +246,8 @@
<% if ma.course_message_type == "Message" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %></span></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">
<%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %></span></li>
<% if ma.course_message.parent_id.nil? %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),

View File

@ -12,8 +12,8 @@
<% homework.homework_tests.each_with_index do |test, index| %>
<div class="mt10">
<label class="fl mt5" name="inputs_label"><%=index+1 %>&nbsp;&nbsp;</label>
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" id="textarea_input_test"><%= test.input %></textarea>
<textarea class="InputBox W320 fl mr5" placeholder="测试输出" id="textarea_output_test"><%= test.output %></textarea>
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" name="program[input][]"><%= test.input %></textarea>
<textarea class="InputBox W320 fl mr5" placeholder="测试输出" name="program[output][]"><%= test.output %></textarea>
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
<% if index != 0 %>
<a href="javascript:void(0);" class=" fl icon_remove" title="删除测试组"></a>
@ -24,8 +24,8 @@
<% else %>
<div class="mt10">
<label class="fl mt5" name="inputs_label">1&nbsp;&nbsp;</label>
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" id="textarea_input_test"></textarea>
<textarea class="InputBox W320 fl mr5" placeholder="测试输出" id="textarea_output_test"></textarea>
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" name="program[input][]" id="textarea_input_test"></textarea>
<textarea class="InputBox W320 fl mr5" placeholder="测试输出" name="program[output][]" id="textarea_output_test"></textarea>
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
<div class="cl"></div>
</div>
@ -41,8 +41,10 @@
</div><!----HomeWorkCon end-->
<script>
<% if !edit_mode %>
var text = document.getElementById("textarea_input_test");
var text2 = document.getElementById("textarea_output_test");
autoTextarea2(text,text2);
autoTextarea2(text2,text);
<% end %>
</script>

View File

@ -3,7 +3,6 @@
<div id="search_div">
<%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type} %>
</div>
<div style="float: left; margin-top: 7px; font-size: 14px; margin-left: 15px;"><span style="align:center ;font-size: 14px;color: gray;">为您找到<span id="res_all_count"><%= @atta_count %></span>个资源</span></div>
</div>
<div class="cl"></div>
<ul class="resource-list-tab mt10">

View File

@ -4,7 +4,8 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
$("#res_all_count").html(<%= @atta_count%>);
$("#reference_number_<%= @ori.id %>").text("<%= @ori.quotes %>");
hideModal();
alert("发送成功")
alert("发送成功");
<% else%>
<% end %>

View File

@ -4,7 +4,10 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
$("#res_all_count").html(<%= @atta_count%>);
<% if @ori.present? and @ori.quotes.present? %>
$("#reference_number_<%= @ori.id %>").text("<%= @ori.quotes %>");
<% end %>
hideModal();
alert("发送成功")
alert("发送成功");
<% else%>
<% end %>

View File

@ -4,7 +4,10 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
$("#res_all_count").html(<%= @atta_count%>);
<% if @ori and @ori.quotes.present? %>
$("#reference_number_<%= @ori.id %>").text("<%= @ori.quotes %>");
<% end %>
hideModal();
alert("发送成功")
alert("发送成功");
<% else%>
<% end %>

View File

@ -97,7 +97,7 @@
<div class="mt10">
<a href="javascript:void(0);" class="BlueCirBtn fl" data-homework-id="<%=@homework.id%>" data-student-work-id="<%=@student_work.id%>" id="test-program-btn">测试代码</a>
<% if @is_test %>
<%=link_to '返 回',course_path(@course),:class=>'fr mt6' %>
<%=link_to '返 回',homework_common_index_path(:course => @course.id),:class=>'fr mt6' %>
<% else @is_test %>
<a href="javascript:void(0);" class="BlueCirBtn fr" id="commit-program-work-btn">提交代码</a>
<% end %>

View File

@ -0,0 +1,18 @@
class UpdateHomeworkCommonUpdatedAt < ActiveRecord::Migration
def up
count = HomeworkCommon.all.count / 30 + 2
transaction do
for i in 1 ... count do i
HomeworkCommon.page(i).per(30).each do |hw|
ca = CourseActivity.where("course_act_type = 'HomeworkCommon' and course_act_id = #{hw.id}").first
unless ca.nil?
hw.update_attributes(:updated_at => ca.updated_at)
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,50 @@
class UpdateContributorAfterDelete < ActiveRecord::Migration
def up
Course.all.each do |course|
if course.course_activities.count > 1
course.members.each do |s|
puts course.id
puts course.name
puts s.user_id
# board_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?",s.student_id, course.id, "Message").count * 2
# 发帖数
board_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is null;").count
# 回帖数
message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is not null").count * 1
# 新闻回复
common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.user_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
# 通知
common_count = News.find_by_sql("select n.* from news n where n.author_id = #{s.user_id} and n.course_id = #{course.id} ").count * 1
# attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5
# 附件数
attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.user_id} and container_type ='Course'").count
# 课程留言数
journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.user_id, course.id, "Course").count * 1
# 作业留言
journal_homework_count = JournalsForMessage.find_by_sql("SELECT jfm.* FROM `journals_for_messages` jfm, homework_commons hc where hc.id = jfm.jour_id and hc.course_id =#{course.id} and jfm.user_id =#{s.user_id} and jfm.jour_type ='HomeworkCommon';").count * 1
# journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1
# journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1
total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count
course_contributor = CourseContributorScore.where("course_id =? and user_id =?", course.id, s.user_id).first
if course_contributor.nil?
CourseContributorScore.create(:course_id => course.id, :user_id => s.user_id, :message_num => board_count, :message_reply_num => message_reply_count,
:news_reply_num => common_reply_count, :news_num => common_count, :resource_num => attachment_count, :journal_num => journal_count,
:homework_journal_num => journal_homework_count, :journal_reply_num => 0, :total_score => total)
else
course_contributor.message_num = board_count
course_contributor.message_reply_num = message_reply_count
course_contributor.news_reply_num = common_reply_count
course_contributor.news_num = common_count
course_contributor.resource_num = attachment_count
course_contributor.journal_num = journal_count
course_contributor.homework_journal_num = journal_homework_count
course_contributor.save
end
end
end
end
end
def down
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 => 20160304234903) do
ActiveRecord::Schema.define(:version => 20160309024051) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -1387,7 +1387,6 @@ ActiveRecord::Schema.define(:version => 20160304234903) 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

View File

@ -127,7 +127,15 @@ $(function(){
$("a.CloseBtn").on('click', function(){
$("#BluePopupBox" ).dialog("close");
});
$('#textarea_input_test').focus();
var inputs = document.getElementsByName("program[input][]");
var outputs = document.getElementsByName("program[output][]");
if (inputs.length == outputs.length) {
for (var i=0; i<inputs.length; i++) {
autoTextarea2(inputs[i], outputs[i]);
autoTextarea2(outputs[i], inputs[i]);
}
}
$(inputs[0]).focus();
} else if($("input[name=homework_type]").val() == "2") {
$("#NoticePopupBox" ).dialog("close");
$("input[name=homework_type]").val(1);
@ -168,7 +176,7 @@ $(function(){
$("#cancel_switch").on('click', function(){
$("#NoticePopupBox" ).dialog("close");
});
$("#switch_homework_type_notice").text("您的作业类型将改为“分组作业”,并且您的编程设置将被清除。请问是否继续?");
$("#switch_homework_type_notice").text("您的作业类型将改为“编程作业”,并且您的分组设置将被清除。请问是否继续?");
}
else {
$("#BluePopupBox").dialog("open");
@ -176,7 +184,15 @@ $(function(){
$("a.CloseBtn").on('click', function(){
$("#BluePopupBox" ).dialog("close");
});
$('#textarea_input_test').focus();
var inputs = document.getElementsByName("program[input][]");
var outputs = document.getElementsByName("program[output][]");
if (inputs.length == outputs.length) {
for (var i=0; i<inputs.length; i++) {
autoTextarea2(inputs[i], outputs[i]);
autoTextarea2(outputs[i], inputs[i]);
}
}
$(inputs[0]).focus();
}
});
@ -280,7 +296,7 @@ $(function(){
$("#cancel_switch").on('click', function(){
$("#NoticePopupBox" ).dialog("close");
});
$("#switch_homework_type_notice").text("您的作业类型将改为“编程作业”,并且您的分组设置将被清除。请问是否继续?");
$("#switch_homework_type_notice").text("您的作业类型将改为“分组作业”,并且您的编程设置将被清除。请问是否继续?");
}
else {
$("#GroupPopupBox").dialog("open");

View File

@ -1286,7 +1286,6 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;}
.subjectType {width:70px; text-align:center;}
.subjectCount {width:65px; text-align:center;}
a.contributor_course{float: right; color: #888; font-size: 12px; font-weight: normal;}
.contributor_course_innor{font-size: 12px;color: #888;padding-left: 36px;}
.hero_course_innor{font-size: 12px;color: #888;padding-left:77px;}
.contributor_course_calculate{padding-left: 54px; font-size: 12px;color: #888}
.color_888{color: #888}
.active-degree-rule{font-size: 12px;color: #888; text-align: center; cursor: pointer;}
.hero-degree-rule{font-size: 12px;color: #888;text-align: center;}
.contributor-course-calculate{padding-left: 54px; font-size: 12px;color: #888}

View File

@ -692,7 +692,7 @@ a.postReplyCancel:hover {color:#ffffff;}
.homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;}
.homepagePostSetting ul li:hover ul {display:block;}
.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;}
.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;z-index:999;}
.homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}
.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;}
.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}

View File

@ -615,7 +615,7 @@ a.postReplyCancel:hover {color:#ffffff;}
.homepagePostReplyContainer {border-bottom:1px solid #e3e3e3; width:690px; margin:0px auto; margin-top:15px; min-height:60px;}
.homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;}
.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;}
.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;z-index:999;}
.homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}
.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;}
.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}