merge
This commit is contained in:
commit
6ae4cd0767
2
Gemfile
2
Gemfile
|
@ -18,7 +18,7 @@ gem 'daemons'
|
|||
gem 'grape', '~> 0.9.0'
|
||||
gem 'grape-entity'
|
||||
gem 'seems_rateable', '~> 1.0.13'
|
||||
gem 'rails', '~> 3.2', '>= 3.2.22'
|
||||
gem 'rails', '~> 3.2'
|
||||
gem "jquery-rails", "~> 2.0.2"
|
||||
gem "i18n", "~> 0.6.0"
|
||||
gem 'coderay', '~> 1.1.0'
|
||||
|
|
|
@ -32,23 +32,60 @@ class AdminController < ApplicationController
|
|||
end
|
||||
|
||||
def projects
|
||||
=begin
|
||||
@status = params[:status] || 1
|
||||
|
||||
scope = Project.status(@status).order('id asc')
|
||||
scope = Project.status(@status)
|
||||
scope = scope.like(params[:name]) if params[:name].present?
|
||||
@projects = scope.where(project_type: Project::ProjectType_project).all
|
||||
|
||||
@projects = scope.where(project_type: Project::ProjectType_project).reorder("created_on desc").all
|
||||
=end
|
||||
@projects = Project.like(@name).order('created_on desc')
|
||||
@projects = paginateHelper @projects,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
render :action => "projects", :layout => false if request.xhr?
|
||||
end
|
||||
|
||||
def courses
|
||||
@name = params[:name]
|
||||
@courses = Course.like(@name)
|
||||
@courses = Course.like(@name).order('created_at desc')
|
||||
@courses = paginateHelper @courses,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#管理员界面精品课程列表
|
||||
def excellent_courses
|
||||
@courses = Course.where("is_excellent =? or excellent_option =?", 1, 1 )
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#管理员界面课程资源列表
|
||||
def course_resource_list
|
||||
@resource = Attachment.where(:container_type => 'Course')
|
||||
@resource = paginateHelper @resource,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
#管理员界面項目资源列表
|
||||
def project_resource_list
|
||||
@pro_resource = Attachment.where(:container_type => 'Project')
|
||||
@pro_resource = paginateHelper @pro_resource,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def users
|
||||
sort_init 'login', 'asc'
|
||||
sort_update %w(login firstname lastname mail admin created_on last_login_on)
|
||||
|
|
|
@ -8,6 +8,15 @@ class AtController < ApplicationController
|
|||
users = find_at_users(params[:type], params[:id])
|
||||
@users = users
|
||||
@users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }.sort{|x,y| to_pinyin(x.show_name) <=> to_pinyin(y.show_name)} if users
|
||||
|
||||
#加上all
|
||||
if @users.size > 0
|
||||
allUser = Struct.new(:id, :name).new
|
||||
allUser.id = @users.map{|u| u.id}.join(",")
|
||||
allUser.name = "all"
|
||||
@users.insert(0, allUser)
|
||||
end
|
||||
@users
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -103,6 +103,9 @@ class AttachmentsController < ApplicationController
|
|||
direct_download_history
|
||||
end
|
||||
else
|
||||
# 记录用户行为
|
||||
record_user_actions(params[:id])
|
||||
# 直接下载历史版本
|
||||
direct_download_history
|
||||
end
|
||||
end
|
||||
|
@ -113,6 +116,14 @@ class AttachmentsController < ApplicationController
|
|||
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
|
||||
end
|
||||
|
||||
def record_user_actions id
|
||||
if params[:action] == "download_history"
|
||||
UserActions.create(:action_id => id, :action_type => "AttachmentHistory", :user_id => User.current.id) unless id.nil?
|
||||
elsif params[:action] == "download"
|
||||
UserActions.create(:action_id => id, :action_type => "Attachment", :user_id => User.current.id) unless id.nil?
|
||||
end
|
||||
end
|
||||
|
||||
def download
|
||||
# modify by nwb
|
||||
# 下载添加权限设置
|
||||
|
@ -135,6 +146,8 @@ class AttachmentsController < ApplicationController
|
|||
direct_download
|
||||
end
|
||||
else
|
||||
# 记录用户行为
|
||||
record_user_actions(params[:id])
|
||||
direct_download
|
||||
end
|
||||
end
|
||||
|
@ -251,7 +264,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
|
||||
|
@ -572,6 +585,15 @@ class AttachmentsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#找到文件的所有的历史版本及当前版本
|
||||
def attachment_history_download
|
||||
@attachment = Attachment.find(params[:id])
|
||||
@attachment_histories = @attachment.attachment_histories
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def find_project
|
||||
@attachment = Attachment.find(params[:id])
|
||||
|
|
|
@ -91,8 +91,12 @@ class BlogCommentsController < ApplicationController
|
|||
|
||||
def edit
|
||||
@article = BlogComment.find(params[:id])
|
||||
if User.current.admin? || User.current.id == @article.author_id
|
||||
respond_to do |format|
|
||||
format.html {render :layout=>'new_base_user'}
|
||||
format.html { render :layout => 'new_base_user' }
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class BlogsController < ApplicationController
|
|||
def set_homepage
|
||||
@blog = Blog.find(params[:id])
|
||||
@blog.update_attribute(:homepage_id, params[:article_id])
|
||||
redirect_to user_blogs_path(params[:user_id])
|
||||
redirect_to user_path(params[:user_id])
|
||||
end
|
||||
|
||||
def cancel_homepage
|
||||
|
|
|
@ -7,6 +7,7 @@ class CoursesController < ApplicationController
|
|||
helper :members
|
||||
helper :words
|
||||
helper :attachments
|
||||
helper :files
|
||||
helper :activity_notifys
|
||||
|
||||
before_filter :auth_login1, :only => [:show, :course_activity, :feedback]
|
||||
|
@ -240,6 +241,18 @@ class CoursesController < ApplicationController
|
|||
# req[:message] = l(:modal_valid_passing) if req[:message].blank?
|
||||
render :json => req
|
||||
end
|
||||
|
||||
def teacher_assign_group
|
||||
member = Member.where(:course_id => @course.id, :user_id => params[:user_id]).first
|
||||
member.course_group_id = params[:course_group_id].to_i
|
||||
member.save
|
||||
@course_groups = @course.course_groups
|
||||
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def join_group
|
||||
@subPage_title = l :label_student_list
|
||||
group = CourseGroup.find(params[:object_id])
|
||||
|
@ -838,6 +851,8 @@ class CoursesController < ApplicationController
|
|||
# render_403
|
||||
# return
|
||||
# end
|
||||
# 统计访问量
|
||||
@course.update_attribute(:visits, @course.visits.to_i + 1)
|
||||
#更新创建课程消息状态
|
||||
create_course_messages = @course.course_messages.where("user_id =? and course_message_type =? and course_id =? and viewed =?", User.current.id, 'Course', @course.id, 0)
|
||||
create_course_messages.update_all(:viewed => true)
|
||||
|
@ -888,10 +903,7 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
|
||||
def feedback
|
||||
@course.journals_for_messages.each do |messages|
|
||||
query = messages.course_messages.where("user_id = ?", User.current.id)
|
||||
query.update_all(:viewed => true);
|
||||
end
|
||||
CourseMessage.where("user_id = ? and course_id = ?", User.current, @course.id).update_all(:viewed => true)
|
||||
|
||||
if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course)))
|
||||
page = params[:page]
|
||||
|
@ -1067,7 +1079,7 @@ class CoursesController < ApplicationController
|
|||
sql_select = ""
|
||||
if groupid == 0
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))
|
||||
SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,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}
|
||||
|
@ -1079,7 +1091,7 @@ class CoursesController < ApplicationController
|
|||
WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}"
|
||||
else
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))
|
||||
SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,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}
|
||||
|
|
|
@ -207,8 +207,7 @@ class FilesController < ApplicationController
|
|||
sort = "created_on DESC"
|
||||
end
|
||||
if keywords != "%%"
|
||||
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").
|
||||
reorder(sort)
|
||||
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").reorder(sort)
|
||||
else
|
||||
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' "). reorder(sort)
|
||||
end
|
||||
|
@ -406,10 +405,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
|
||||
|
||||
|
@ -529,6 +532,7 @@ class FilesController < ApplicationController
|
|||
if attachment.publish_time > Date.today
|
||||
attachment.is_publish = 0
|
||||
end
|
||||
attachment.description = params[:description]
|
||||
attachment.save
|
||||
end
|
||||
end
|
||||
|
@ -554,7 +558,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'
|
||||
|
@ -627,20 +632,6 @@ class FilesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def update_contributor_score(course, file )
|
||||
unless file.author.allowed_to?(:as_teacher, course)
|
||||
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
|
||||
end
|
||||
|
||||
def get_project_tag_name_by_type_nmuber type
|
||||
case type
|
||||
when "1"
|
||||
|
@ -860,7 +851,13 @@ 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.index{|tag|tag != '软件' and tag != '媒体' and tag != '代码'}.present?
|
||||
}
|
||||
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
|
||||
|
||||
|
|
|
@ -51,10 +51,16 @@ class HomeworkCommonController < ApplicationController
|
|||
@user = User.current
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
@course_activity = params[:course_activity].to_i
|
||||
if @is_in_course == 1 || @course_activity == 1
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'new_base_user'}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:homework_common]
|
||||
|
@ -73,9 +79,11 @@ class HomeworkCommonController < ApplicationController
|
|||
if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
|
||||
homework_detail_manual.comment_status = 1
|
||||
end
|
||||
homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? @homework.end_time + 7 : params[:evaluation_start]
|
||||
homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end]
|
||||
|
||||
eval_start = homework_detail_manual.evaluation_start
|
||||
if eval_start <= @homework.end_time && homework_detail_manual.comment_status <= 1
|
||||
homework_detail_manual.evaluation_start = @homework.end_time + 7
|
||||
homework_detail_manual.evaluation_end = homework_detail_manual.evaluation_start + 7
|
||||
end
|
||||
@homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@homework)
|
||||
|
||||
|
|
|
@ -118,6 +118,9 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
# 打开编辑内容
|
||||
@is_edit = true unless params[:edit].nil?
|
||||
|
||||
# 当前用户查看指派给他的缺陷消息,则设置消息为已读
|
||||
query = ForgeMessage.where("forge_message_type =? and user_id =? and forge_message_id =?", "Issue", User.current, @issue).first
|
||||
query.update_attribute(:viewed, true) unless query.nil?
|
||||
|
@ -387,6 +390,9 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
# 增加删除页面类型,如果是个人主页,则返回该主页,项目动态则返回项目动态页眉
|
||||
page_classify = params[:page_classify] unless params[:page_classify].nil?
|
||||
page_id = params[:page_id] unless params[:page_id].nil?
|
||||
@hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f
|
||||
if @hours > 0
|
||||
case params[:todo]
|
||||
|
@ -415,7 +421,11 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
if page_classify
|
||||
format.html { redirect_back_or_default _project_issues_path(@project, page_classify, page_id) }
|
||||
else
|
||||
format.html { redirect_back_or_default _project_issues_path(@project) }
|
||||
end
|
||||
format.api { render_api_ok }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -107,32 +107,18 @@ class NewsController < ApplicationController
|
|||
|
||||
def show
|
||||
# 更新news对应的forge_messages的消息viewed字段
|
||||
ids = @news.comments.map { |comment| comment.id }.join(",") unless @news.comments.nil?
|
||||
if @project
|
||||
query_message_news = @news.forge_messages
|
||||
# 更新新闻
|
||||
query_message_news = ForgeMessage.where("forge_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
|
||||
# 更新新闻的时候一并更新回复
|
||||
ForgeMessage.where("forge_message_id in (#{ids}) and forge_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
|
||||
else
|
||||
query_message_news = @news.course_messages
|
||||
query_message_news = CourseMessage.where("course_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
|
||||
CourseMessage.where("course_message_id in (#{ids}) and course_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
|
||||
end
|
||||
query_message_news.each do |query|
|
||||
if User.current.id == query.user_id
|
||||
query.update_attributes(:viewed => true)
|
||||
end
|
||||
end
|
||||
# 更新项目新闻的评阅的消息viewed字段
|
||||
current_message_comments = @news.comments
|
||||
current_message_comments.each do |current_message_comment|
|
||||
if @project
|
||||
query_message_comment = current_message_comment.forge_messages
|
||||
else
|
||||
query_message_comment = current_message_comment.course_messages
|
||||
end
|
||||
query_message_comment.each do |query|
|
||||
if User.current.id == query.user_id
|
||||
query.update_attributes(:viewed => true)
|
||||
end
|
||||
end
|
||||
end
|
||||
# end
|
||||
|
||||
query_message_news.update_attribute(:viewed, true) unless query_message_news.nil?
|
||||
# over
|
||||
cs = CoursesService.new
|
||||
result = cs.show_course_news params,User.current
|
||||
@news = result[:news]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class OrgDocumentCommentsController < ApplicationController
|
||||
before_filter :find_organization, :only => [:new, :create, :show, :index]
|
||||
helper :attachments
|
||||
helper :attachments,:organizations
|
||||
layout 'base_org'
|
||||
|
||||
def new
|
||||
|
|
|
@ -5,9 +5,8 @@ class OrgSubfieldsController < ApplicationController
|
|||
def create
|
||||
if OrgSubfield.where("organization_id=#{params[:organization_id]} and name=?",params[:name]).count == 0
|
||||
@res = true
|
||||
@subfield = OrgSubfield.create(:name => params[:name])
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
@organization.org_subfields << @subfield
|
||||
@subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id],:priority => @organization.org_subfields.order("priority").last.priority + 1)
|
||||
if !params[:sub_dir].blank?
|
||||
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
|
||||
"and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
|
||||
|
@ -15,7 +14,7 @@ class OrgSubfieldsController < ApplicationController
|
|||
SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir])
|
||||
end
|
||||
end
|
||||
@subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
|
||||
@subfield.update_attributes(:field_type => params[:field_type])
|
||||
else
|
||||
@res = false
|
||||
end
|
||||
|
@ -33,6 +32,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
|
||||
|
@ -82,12 +82,15 @@ class OrgSubfieldsController < ApplicationController
|
|||
sort = "#{Attachment.table_name}.created_on desc"
|
||||
end
|
||||
@container_type = 2
|
||||
@containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)]
|
||||
@containers = [OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)]
|
||||
@organization = Organization.find(@containers.first.organization_id)
|
||||
show_attachments @containers
|
||||
@tag_list = attachment_tag_list @all_attachments
|
||||
end
|
||||
@page = params[:page] || 1
|
||||
else
|
||||
render_403
|
||||
end
|
||||
#render :layout => 'base_org'
|
||||
end
|
||||
|
||||
|
@ -121,6 +124,12 @@ class OrgSubfieldsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def update_priority
|
||||
@org_subfield = OrgSubfield.find(params[:id])
|
||||
@org_subfield.update_attribute(:priority, params[:priority].to_i)
|
||||
@organization = @org_subfield.organization
|
||||
end
|
||||
|
||||
def show_attachments obj
|
||||
@attachments = []
|
||||
obj.each do |container|
|
||||
|
|
|
@ -69,6 +69,8 @@ class OrganizationsController < ApplicationController
|
|||
def show
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@organization = Organization.find(params[:id])
|
||||
# 统计访问量
|
||||
@organization.update_attribute(:visits, @organization.visits.to_i + 1)
|
||||
if params[:org_subfield_id]
|
||||
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
|
||||
|
@ -315,7 +317,7 @@ class OrganizationsController < ApplicationController
|
|||
@organization = Organization.find(params[:id])
|
||||
admins = User.where("admin=1")
|
||||
admins.each do |admin|
|
||||
OrgMessage.create(:user_id => admin.id, :organization_id => @organization.id, :message_type => 'ApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:domain])
|
||||
OrgMessage.create(:user_id => admin.id, :organization_id => @organization.id, :message_type => 'ApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:domain].downcase)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ class ProjectsController < ApplicationController
|
|||
helper :words
|
||||
helper :project_score
|
||||
helper :user_score
|
||||
include UsersHelper
|
||||
### added by william
|
||||
include ActsAsTaggableOn::TagsHelper
|
||||
|
||||
|
@ -297,66 +298,29 @@ class ProjectsController < ApplicationController
|
|||
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
|
||||
return
|
||||
end
|
||||
=begin
|
||||
cond = @project.project_condition(Setting.display_subprojects_issues?)
|
||||
has = {
|
||||
"show_issues" => true ,
|
||||
"show_files" => true,
|
||||
"show_documents" => true,
|
||||
"show_messages" => true,
|
||||
"show_news" => true,
|
||||
"show_bids" => true,
|
||||
"show_contests" => true,
|
||||
"show_wiki_edits"=>true,
|
||||
"show_journals_for_messages" => true
|
||||
}
|
||||
# 读取项目默认展示的动态时间天数
|
||||
@days = Setting.activity_days_default.to_i
|
||||
@date_to ||= Date.today + 1
|
||||
# 时间跨度不能太大,不然很慢,所以删掉了-1.years
|
||||
@date_from = @date_to - @days
|
||||
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
|
||||
=end
|
||||
|
||||
# 统计访问量
|
||||
@project.update_attribute(:visits, @project.visits.to_i + 1)
|
||||
@author = params[:user_id].blank? ? nil : User.active.find(params[:user_id])
|
||||
# 决定显示所用用户或单个用户活动
|
||||
=begin
|
||||
@activity = Redmine::Activity::Fetcher.new(User.current,
|
||||
:project => @project,
|
||||
:with_subprojects => @with_subprojects,
|
||||
:author => @author)
|
||||
@activity.scope_select {|t| !has["show_#{t}"].nil?}
|
||||
=end
|
||||
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
# 根据私密性,取出符合条件的所有数据
|
||||
if User.current.member_of?(@project) || User.current.admin?
|
||||
case params[:type]
|
||||
when nil
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'ProjectCreateInfo')",@project).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'ProjectCreateInfo', 'Attachment')",@project).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
when 'issue'
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'",@project).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
when 'news'
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'",@project).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
when 'message'
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Message'",@project).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
when 'attachment'
|
||||
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Attachment'",@project).order("updated_at desc").limit(10).offset(@page * 10)
|
||||
end
|
||||
|
||||
#events = @activity.events(@date_from, @date_to)
|
||||
else
|
||||
@events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public
|
||||
= ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc")
|
||||
.page(params['page'|| 1]).per(10);
|
||||
# @events = @activity.events(@date_from, @date_to, :is_public => 1)
|
||||
end
|
||||
|
||||
=begin
|
||||
@events_pages = Paginator.new events.count, 10, params['page']
|
||||
# 总的数据中取出某一页
|
||||
events = events.slice(@events_pages.offset,10)
|
||||
# 按天分组
|
||||
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
|
||||
=end
|
||||
boards = @project.boards.includes(:last_message => :author).all
|
||||
@topic_count = @project.boards.count
|
||||
# 根据对应的请求,返回对应的数据
|
||||
|
@ -405,11 +369,17 @@ 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?
|
||||
@repository.project = @project
|
||||
|
||||
unless @project.gpid.nil?
|
||||
g = Gitlab.client
|
||||
@gitlab_branches = g.branches(@project.gpid)
|
||||
@branch_names = g.branches(@project.gpid).map{|b| b.name}
|
||||
@gitlab_default_branch = g.project(@project.gpid).default_branch
|
||||
end
|
||||
end
|
||||
|
||||
# 项目邀请用户加入实现过程
|
||||
|
@ -670,8 +640,7 @@ class ProjectsController < ApplicationController
|
|||
# 更新公开私有时同步gitlab公开私有
|
||||
unless @project.gpid.nil?
|
||||
g = Gitlab.client
|
||||
gproject = g.project(@project.gpid)
|
||||
params[:project][:is_public] ? g.edit_project(gproject.id, 20) : g.edit_project(gproject.id, 0)
|
||||
params[:project][:is_public] ? g.edit_project(@project.gpid, 20, params[:branch]) : g.edit_project(@project.gpid, 0, params[:branch])
|
||||
end
|
||||
# end
|
||||
if validate_parent_id && @project.save
|
||||
|
|
|
@ -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)
|
||||
|
@ -633,9 +634,10 @@ update
|
|||
end
|
||||
(render_404; return false) unless @repository
|
||||
@path = params[:path].is_a?(Array) ? params[:path].join('/') : params[:path].to_s
|
||||
@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip
|
||||
# gitlab端获取默认分支
|
||||
gitlab_branchs = $g.project(@project.gpid).default_branch
|
||||
@project.gpid.nil? ? (@rev = params[:rev].blank? ? @repository.default_branch : params[:rev].to_s.strip) : (@rev = params[:rev].blank? ? gitlab_branchs : params[:rev].to_s.strip)
|
||||
@rev_to = params[:rev_to]
|
||||
|
||||
unless @rev.to_s.match(REV_PARAM_RE) && @rev_to.to_s.match(REV_PARAM_RE)
|
||||
if @repository.branches.blank?
|
||||
raise InvalidRevisionParam
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#encoding: utf-8
|
||||
class StudentWorkController < ApplicationController
|
||||
layout "base_courses"
|
||||
include StudentWorkHelper
|
||||
|
@ -36,6 +37,14 @@ class StudentWorkController < ApplicationController
|
|||
unless student_work.save
|
||||
resultObj[:status] = 200
|
||||
else
|
||||
student_work.name = params[:title]
|
||||
student_work.description = params[:src]
|
||||
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
|
||||
student_work.late_penalty = @homework.late_penalty
|
||||
else
|
||||
student_work.late_penalty = 0
|
||||
end
|
||||
student_work.save
|
||||
resultObj[:status] = result["status"].to_i
|
||||
resultObj[:time] = student_work_test.created_at.to_s(:db)
|
||||
resultObj[:index] = student_work.student_work_tests.count
|
||||
|
@ -91,25 +100,27 @@ class StudentWorkController < ApplicationController
|
|||
else
|
||||
student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')'
|
||||
end
|
||||
#老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
|
||||
if @homework.is_open == 1
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
|
||||
if @homework.is_open == 1 || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
|
||||
if @order == 'lastname'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
||||
elsif @order == 'student_id'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
@show_all = true
|
||||
elsif @homework.is_open == 0 && User.current.member_of_course?(@course) || User.current.admin?
|
||||
if @is_teacher || @homework.homework_detail_manual.nil? ||
|
||||
(@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
elsif User.current.member_of_course?(@course)
|
||||
if @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
|
@ -129,15 +140,21 @@ class StudentWorkController < ApplicationController
|
|||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
if @order == 'lastname'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
||||
elsif @order == 'student_id'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
@show_all = true
|
||||
end
|
||||
else
|
||||
|
@ -148,25 +165,28 @@ class StudentWorkController < ApplicationController
|
|||
return
|
||||
end
|
||||
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
|
||||
else
|
||||
if @homework.is_open == 1
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
if @homework.is_open == 1 || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
|
||||
if @order == 'lastname'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
||||
elsif @order == 'student_id'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
@show_all = true
|
||||
elsif @homework.is_open == 0 && User.current.member_of_course?(@course) || User.current.admin?
|
||||
if @is_teacher || @homework.homework_detail_manual.nil? || (@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) #老师 || 超级管理员 显示所有列表
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
@show_all = true
|
||||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
elsif User.current.member_of_course?(@course)
|
||||
if @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
if pro.nil?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
|
@ -186,15 +206,21 @@ class StudentWorkController < ApplicationController
|
|||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name
|
||||
if @order == 'lastname'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
||||
elsif @order == 'student_id'
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
@show_all = true
|
||||
end
|
||||
else
|
||||
|
@ -205,7 +231,7 @@ class StudentWorkController < ApplicationController
|
|||
return
|
||||
end
|
||||
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name).count
|
||||
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name).count
|
||||
end
|
||||
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
|
@ -257,7 +283,7 @@ class StudentWorkController < ApplicationController
|
|||
@submit_result = true
|
||||
student_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id]
|
||||
student_work ||= StudentWork.new
|
||||
student_work.name = params[:student_work][:name]
|
||||
student_work.name = params[:student_work][:name] == "#{@homework.name}的作品提交(可修改)" ? "#{@homework.name}的作品提交" : params[:student_work][:name]
|
||||
student_work.description = params[:student_work][:description]
|
||||
student_work.homework_common_id = @homework.id
|
||||
student_work.user_id = User.current.id
|
||||
|
@ -303,6 +329,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 +527,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
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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)
|
||||
|
|
|
@ -110,46 +110,109 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
# 更新课程英雄榜得分
|
||||
# user传过来必须是学生
|
||||
# 更新课程活跃度得分
|
||||
def course_member_score(course_id,user_id,type)
|
||||
course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course_id, user_id).first
|
||||
case type
|
||||
when "JournalForMessage"
|
||||
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 => 1, :journal_reply_num => 0, :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
|
||||
course_contributor_score.update_attributes(:homework_journal_num => score)
|
||||
end
|
||||
# 课程留言
|
||||
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)
|
||||
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)
|
||||
else
|
||||
score = course_contributor_score.news_num + 1
|
||||
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
|
||||
|
@ -307,7 +370,7 @@ module ApplicationHelper
|
|||
def link_to_short_attachment(attachment, options={})
|
||||
length = options[:length] ? options[:length]:23
|
||||
text = h(truncate(options.delete(:text) || attachment.filename, length: length, omission: '...'))
|
||||
route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path
|
||||
route_method = options.delete(:download) ? :download_named_attachment_url_without_domain : :named_attachment_url_without_domain
|
||||
html_options = options.slice!(:only_path)
|
||||
url = send(route_method, attachment, attachment.filename, options)
|
||||
link_to text, url, html_options
|
||||
|
@ -778,7 +841,7 @@ module ApplicationHelper
|
|||
def project_member_check_box_tags_ex name, principals
|
||||
s = ''
|
||||
principals.each do |principal|
|
||||
s << "<li>#{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_path( principal.id)}</li>\n"
|
||||
s << "<li>#{ check_box_tag name, principal.id, false, :id => nil } #{h link_to principal.userInfo, user_url_in_org( principal.id)}</li>\n"
|
||||
end
|
||||
s.html_safe
|
||||
end
|
||||
|
@ -981,9 +1044,9 @@ module ApplicationHelper
|
|||
elsif @organization
|
||||
title << @organization.name
|
||||
elsif @user
|
||||
title << @user.login
|
||||
title << @user.try(:realname)
|
||||
else
|
||||
title << User.current.login
|
||||
title << User.current.try(:realname)
|
||||
end
|
||||
if first_page.nil? || first_page.web_title.nil?
|
||||
title << Setting.app_title unless Setting.app_title == title.last
|
||||
|
@ -2006,7 +2069,7 @@ module ApplicationHelper
|
|||
candown = User.current.member_of?(project) || (project.is_public && attachment_history.is_public == 1)
|
||||
elsif attachment_history.container_type == "OrgSubfield"
|
||||
org = OrgSubfield.find(attachment_history.container_id)
|
||||
candown = User.current.member_of_org?(org) || (org.organization.is_public && attachment_history.is_public == 1)
|
||||
candown = User.current.member_of_org?(org) || (org.organization.is_public && attachment_history.is_public == 1 && (User.current.logged? || org.organization.allow_guest_download?))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -2032,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
|
||||
|
@ -2512,14 +2577,14 @@ module ApplicationHelper
|
|||
|
||||
#获取匿评相关连接代码
|
||||
def homework_anonymous_comment (homework, is_in_course, user_activity_id = -1, course_activity = -1)
|
||||
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||
if homework.homework_detail_manual.comment_status == 0 ||Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||
link = link_to "启动匿评","javascript:void(0)", :class => "postOptionLink", :title => "作业截止日期之前不可以启动匿评"
|
||||
elsif homework.student_works.count >= 2 && homework.homework_detail_manual#作业份数大于2
|
||||
case homework.homework_detail_manual.comment_status
|
||||
when 1
|
||||
link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
|
||||
link = link_to '启动匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'postOptionLink'
|
||||
when 2
|
||||
link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework,:is_in_course=>is_in_course,:user_activity_id=>user_activity_id,:course_activity=>course_activity), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
|
||||
link = link_to '关闭匿评', Setting.protocol + "://" + Setting.host_name + "/homework_common/" + homework.id.to_s + "/alert_anonymous_comment?is_in_course=" + is_in_course.to_s + "&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s, id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'postOptionLink'
|
||||
when 3
|
||||
# link = link_to "匿评结束","javascript:void(0)", :class => "postOptionLink", :title => "匿评结束"
|
||||
end
|
||||
|
@ -2566,7 +2631,7 @@ module ApplicationHelper
|
|||
def user_for_homework_common homework,is_teacher
|
||||
if User.current.member_of_course?(homework.course)
|
||||
if is_teacher #老师显示作品数量
|
||||
link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
|
||||
link_to "作品(#{homework.student_works.count})", student_work_index_url_in_org(homework.id), :class => "c_blue"
|
||||
else #学生显示提交作品、修改作品等按钮
|
||||
work = cur_user_works_for_homework homework
|
||||
project = cur_user_projects_for_homework homework
|
||||
|
@ -2574,30 +2639,30 @@ module ApplicationHelper
|
|||
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
||||
link_to "提交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
|
||||
else
|
||||
link_to "提交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
|
||||
link_to "提交作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
|
||||
end
|
||||
elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
|
||||
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
||||
link_to "补交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
|
||||
else
|
||||
link_to "补交作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_red'
|
||||
link_to "补交作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_red'
|
||||
end
|
||||
else
|
||||
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
|
||||
link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
|
||||
link_to "作品匿评", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
|
||||
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
|
||||
link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "匿评已结束"
|
||||
link_to "查看作品(#{homework.student_works.count})",student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "匿评已结束"
|
||||
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
|
||||
link_to "修改作品(#{homework.student_works.count})", new_student_work_path(:homework => homework.id),:class => 'c_blue'
|
||||
link_to "修改作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
|
||||
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
|
||||
link_to "修改作品(#{homework.student_works.count})", edit_student_work_path(work.id),:class => 'c_blue'
|
||||
link_to "修改作品(#{homework.student_works.count})", edit_student_work_url_without_domain(work.id),:class => 'c_blue'
|
||||
else
|
||||
link_to "查看作品(#{homework.student_works.count})", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"
|
||||
link_to "查看作品(#{homework.student_works.count})", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
|
||||
link_to "作品(#{homework.student_works.count})",student_work_index_url_in_org(homework.id),:class => "c_blue"
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -2876,3 +2941,106 @@ int main(int argc, char** argv){
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def user_url_in_org(user_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/users/" + user_id.to_s
|
||||
end
|
||||
|
||||
def project_issues_url_in_org(project_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/projects/" + project_id.to_s + "/issues"
|
||||
end
|
||||
|
||||
def issue_url_in_org(id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/issues/" + id.to_s
|
||||
end
|
||||
|
||||
def project_boards_url_in_org(id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/projects/" + id.to_s + "/boards"
|
||||
end
|
||||
|
||||
def board_message_url_in_org(board_id, message_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/boards/" + board_id.to_s + "/topics/" + message_id.to_s
|
||||
end
|
||||
|
||||
def project_url_in_org(id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/projects/" + id.to_s
|
||||
end
|
||||
|
||||
def homework_common_index_url_in_org(course_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/homework_common?course=" + course_id.to_s
|
||||
end
|
||||
|
||||
def student_work_index_url_in_org(homework_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s
|
||||
end
|
||||
|
||||
def course_url_in_org(course_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/courses/" + course_id.to_s
|
||||
end
|
||||
|
||||
def user_watchlist_url_in_org(id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/users/" + id.to_s + "/user_watchlist"
|
||||
end
|
||||
|
||||
def user_fanslist_url_in_org(id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/users/" + id.to_s + "/user_fanslist"
|
||||
end
|
||||
|
||||
def user_blogs_url_in_org(user_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/users/" + user_id.to_s + "/blogs"
|
||||
end
|
||||
|
||||
def feedback_url_in_org(user_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/users/" + user_id.to_s + "/user_newfeedback"
|
||||
end
|
||||
|
||||
def user_activities_url_in_org(user_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/users/" + user_id.to_s + "/user_activities"
|
||||
end
|
||||
|
||||
def course_news_index_url_in_org(course_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/courses/" + course_id.to_s + "/news"
|
||||
end
|
||||
|
||||
def news_url_in_org(news_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/news/" + news_id.to_s
|
||||
end
|
||||
|
||||
def course_boards_url_in_org(course_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/courses/" + course_id.to_s + "/boards"
|
||||
end
|
||||
|
||||
def logout_url_without_domain
|
||||
Setting.protocol + "://" + Setting.host_name + "/logout"
|
||||
end
|
||||
|
||||
def signin_url_without_domain
|
||||
Setting.protocol + "://" + Setting.host_name + "/login?login=true"
|
||||
end
|
||||
|
||||
def register_url_without_domain
|
||||
Setting.protocol + "://" + Setting.host_name + "/login?login=false"
|
||||
end
|
||||
|
||||
def new_student_work_url_without_domain(homework_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/student_work/new?homework=" + homework_id.to_s
|
||||
end
|
||||
|
||||
def edit_student_work_url_without_domain(homework_id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/student_work/" + homework_id.to_s + "/edit"
|
||||
end
|
||||
|
||||
def download_named_attachment_url_without_domain(id, filename, option={})
|
||||
attachment_id = (Attachment === id ? id.id : id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/attachments/download/" + attachment_id.to_s + "/" + filename
|
||||
end
|
||||
|
||||
def named_attachment_url_without_domain(id, filename, option={})
|
||||
attachment_id = (Attachment === id ? id.id : id)
|
||||
Setting.protocol + "://" + Setting.host_name + "/attachments/" + attachment_id.to_s + "/" + filename
|
||||
end
|
||||
#判断是否为默认的组织栏目
|
||||
def is_default_field? field
|
||||
(field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default'
|
||||
end
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ module CoursesHelper
|
|||
# 获取tag匹配结果ID
|
||||
a_tags = []
|
||||
# kc = keywords.to_a
|
||||
Course.visible.where("is_excellent =?", 1).each do |ec|
|
||||
Course.visible.where("is_excellent =? and is_public =?", 1, 1).each do |ec|
|
||||
if ec.tags.any?{|value| current_course.name.include?(value.to_s)}
|
||||
a_tags << ec.id
|
||||
end
|
||||
|
@ -44,7 +44,7 @@ module CoursesHelper
|
|||
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;"
|
||||
and c.is_excellent =1 and c.is_public = 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 =[]
|
||||
|
@ -71,6 +71,11 @@ module CoursesHelper
|
|||
project.members.count
|
||||
end
|
||||
|
||||
# 统计课程中作品的数量
|
||||
def student_works_num course
|
||||
StudentWork.find_by_sql("SELECT * FROM student_works WHERE homework_common_id IN (SELECT id FROM homework_commons WHERE course_id = '#{course.id}')").count
|
||||
end
|
||||
|
||||
# 返回教师数量,即roles表中定义的Manager
|
||||
def teacherCount project
|
||||
project ? project.members.count - studentCount(project).to_i : 0
|
||||
|
@ -116,7 +121,7 @@ module CoursesHelper
|
|||
@course.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
end
|
||||
|
||||
#当前学期
|
||||
#当前学期(2015春季学期)
|
||||
def current_time_and_term course
|
||||
str = ""
|
||||
term = cur_course_term
|
||||
|
@ -144,6 +149,22 @@ module CoursesHelper
|
|||
val
|
||||
end
|
||||
|
||||
#当前学期(2015春)
|
||||
def current_time_and_term_short course
|
||||
str = ""
|
||||
term = cur_course_term
|
||||
if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year
|
||||
str = course.time.to_s + course.term[0]
|
||||
elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term)
|
||||
str = course.time.to_s + course.term[0]
|
||||
elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term))
|
||||
str = course.end_time.to_s + course.end_term[0]
|
||||
else
|
||||
str = Time.now.year.to_s + cur_course_term[0]
|
||||
end
|
||||
str
|
||||
end
|
||||
|
||||
# 返回学生数量,即roles表中定义的Reporter
|
||||
#def studentCount project
|
||||
# searchStudent(project).count
|
||||
|
@ -585,6 +606,24 @@ module CoursesHelper
|
|||
Course.tagged_with(tag_name).order('updated_at desc')
|
||||
end
|
||||
|
||||
#分班下拉框
|
||||
def course_group_option course
|
||||
type = []
|
||||
option1 = []
|
||||
option1 << "暂无"
|
||||
option1 << 0
|
||||
type << option1
|
||||
unless course.course_groups.nil?
|
||||
course.course_groups.each do |cg|
|
||||
option = []
|
||||
option << cg.name
|
||||
option << cg.id
|
||||
type << option
|
||||
end
|
||||
end
|
||||
type
|
||||
end
|
||||
|
||||
#课程实践年份下拉框
|
||||
def course_time_option year
|
||||
type = []
|
||||
|
@ -746,7 +785,7 @@ module CoursesHelper
|
|||
return[] unless course
|
||||
result = []
|
||||
course.attachments.each do |attachment|
|
||||
if attachment.is_public? ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id))|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
|
||||
if (attachment.is_public? && attachment.is_publish == 1) ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,course)|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
|
||||
result << attachment
|
||||
end
|
||||
end
|
||||
|
@ -826,7 +865,7 @@ module CoursesHelper
|
|||
# 学生按作业总分排序,取前8个
|
||||
def hero_homework_score(course, score_sort_by)
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))
|
||||
SELECT SUM(IF(student_works.final_score is null,null,IF(student_works.final_score = 0, 0, 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}
|
||||
|
@ -840,7 +879,9 @@ module CoursesHelper
|
|||
end
|
||||
|
||||
def contributor_course_scor(course_id)
|
||||
ccs = CourseContributorScore.where("course_id =?", course_id).order("total_score desc") .limit(9)
|
||||
ccs = CourseContributorScore.find_by_sql("SELECT * FROM `course_contributor_scores` where course_id = #{course_id} order by
|
||||
(message_num*2 + message_reply_num + news_reply_num + news_num +
|
||||
resource_num*5 + journal_num + homework_journal_num ) desc limit 9;")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -86,6 +86,31 @@ module ExerciseHelper
|
|||
return result
|
||||
end
|
||||
|
||||
def convert_to_chi_num num
|
||||
result = ""
|
||||
case num.to_i
|
||||
when 1
|
||||
result = '一'
|
||||
when 2
|
||||
result = '二'
|
||||
when 3
|
||||
result = '三'
|
||||
when 4
|
||||
result = '四'
|
||||
when 5
|
||||
result = '五'
|
||||
when 6
|
||||
result = '六'
|
||||
when 7
|
||||
result = '七'
|
||||
when 8
|
||||
result = '八'
|
||||
when 9
|
||||
result = '九'
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
def get_current_score exercise
|
||||
score = 0
|
||||
unless exercise.nil?
|
||||
|
|
|
@ -121,12 +121,13 @@ module FilesHelper
|
|||
def visable_attachemnts attachments
|
||||
result = []
|
||||
attachments.each do |attachment|
|
||||
if attachment.is_public? ||
|
||||
if (attachment.is_public? && attachment.container_type != "Course") ||
|
||||
(attachment.is_public? && attachment.container_type == "Course" && attachment.is_publish == 1)||
|
||||
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
|
||||
(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
|
||||
|
|
|
@ -22,12 +22,20 @@ module RoutesHelper
|
|||
# Returns the path to project issues or to the cross-project
|
||||
# issue list if project is nil
|
||||
def _project_issues_path(project, *args)
|
||||
if args[0].to_s.include? '_page'
|
||||
if args[0].to_s == "user_page"
|
||||
user_activities_path(args[1].to_i)
|
||||
else
|
||||
project_path(project)
|
||||
end
|
||||
else
|
||||
if project
|
||||
project_issues_path(project, *args)
|
||||
else
|
||||
issues_path(*args)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def _project_calendar_path(project, *args)
|
||||
project ? project_calendar_path(project, *args) : issues_calendar_path(*args)
|
||||
|
|
|
@ -54,6 +54,61 @@ module UsersHelper
|
|||
end
|
||||
end
|
||||
|
||||
def get_resource_origin attach
|
||||
type = attach.container_type
|
||||
content = attach.container
|
||||
unless content.nil?
|
||||
case type
|
||||
when 'Course'
|
||||
result = current_time_and_term_resource content
|
||||
when 'Project'
|
||||
result = content.name
|
||||
when 'Issue'
|
||||
result = content.subject
|
||||
when 'Message'
|
||||
result = content.subject
|
||||
when 'News'
|
||||
result = content.title
|
||||
when 'HomewCommon'
|
||||
result = content.name
|
||||
when 'StudentWorkScore'
|
||||
result = content.name
|
||||
when 'Principal'
|
||||
result = content.name
|
||||
when 'OrgSubfield'
|
||||
result = content.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def current_time_and_term_resource course
|
||||
str = ""
|
||||
term = cur_course_term_resource
|
||||
name = course.name
|
||||
if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year
|
||||
str = name + "(" + course.time.to_s + course.term.to_s + ")"
|
||||
elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term)
|
||||
str = name + "(" + course.time.to_s + course.term.to_s + ")"
|
||||
elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term))
|
||||
str = name + "(" + course.end_time.to_s + course.end_term.to_s + ")"
|
||||
else
|
||||
str = name + "(" + Time.now.year.to_s + cur_course_term_resource.to_s + ")"
|
||||
end
|
||||
str
|
||||
end
|
||||
|
||||
def cur_course_term_resource
|
||||
month = Time.now.month
|
||||
if month >= 9 || month < 2
|
||||
term = "秋"
|
||||
elsif (month >= 7 && Time.now.day >= 15) || month == 8
|
||||
term = "夏"
|
||||
else
|
||||
term = "春"
|
||||
end
|
||||
term
|
||||
end
|
||||
|
||||
def title_for_message type
|
||||
case type
|
||||
when nil
|
||||
|
@ -606,4 +661,16 @@ module UsersHelper
|
|||
type
|
||||
end
|
||||
|
||||
#根据姓名搜索用户
|
||||
def search_user_by_name user_ids, name
|
||||
result_ids = []
|
||||
user_ids.each do |user_id|
|
||||
user = User.find user_id
|
||||
username = user.lastname.to_s.downcase + user.firstname.to_s.downcase
|
||||
if username.include?(name)
|
||||
result_ids << user_id
|
||||
end
|
||||
end
|
||||
result_ids
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ class Attachment < ActiveRecord::Base
|
|||
belongs_to :attachmentstype, :foreign_key => "attachtype",:primary_key => "id"
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
has_many :forwards, :as => :from
|
||||
has_many :forwards, :as => :from, :dependent => :destroy
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
# end
|
||||
|
@ -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
|
||||
|
@ -89,10 +90,10 @@ class Attachment < ActiveRecord::Base
|
|||
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
|
||||
|
||||
before_save :files_to_final_location
|
||||
after_save :act_as_course_activity
|
||||
after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index
|
||||
after_save :act_as_course_activity,:act_as_forge_activity
|
||||
after_create :office_conver, :be_user_score,: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
|
||||
# 获取所有可公开的资源文件列表
|
||||
|
@ -498,6 +499,12 @@ class Attachment < ActiveRecord::Base
|
|||
result
|
||||
end
|
||||
|
||||
def self.attach_filesex_public(obj, attachments,attachment_type, is_public)
|
||||
result = obj.save_attachmentsex_public(attachments, User.current,attachment_type, is_public)
|
||||
obj.attach_saved_attachments
|
||||
result
|
||||
end
|
||||
|
||||
def self.latest_attach(attachments, filename)
|
||||
attachments.sort_by(&:created_on).reverse.detect {
|
||||
|att| att.filename.downcase == filename.downcase
|
||||
|
@ -599,7 +606,7 @@ class Attachment < ActiveRecord::Base
|
|||
# Author lizanle
|
||||
# Description 上传该项目的文档资料也要保存一份在公共表中
|
||||
def act_as_forge_activity
|
||||
if self.container_type == 'Project'
|
||||
if self.container_type == 'Project' && self.forge_acts.empty?
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
|
||||
:project_id => self.container_id)
|
||||
end
|
||||
|
@ -655,6 +662,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
|
||||
|
|
|
@ -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
|
||||
|
@ -82,10 +83,15 @@ class Comment < ActiveRecord::Base
|
|||
# 课程成员得分(英雄榜)
|
||||
def act_as_student_score
|
||||
if self.commented.course
|
||||
unless self.author.allowed_to?(:as_teacher, self.commented.course)
|
||||
course_member_score(self.commented.course.id, self.author_id, "NewReply")
|
||||
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
|
||||
|
|
|
@ -5,7 +5,7 @@ class CourseActivity < ActiveRecord::Base
|
|||
belongs_to :course
|
||||
belongs_to :user
|
||||
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
|
||||
after_save :add_user_activity, :add_course_activity
|
||||
after_save :add_user_activity, :add_org_activity
|
||||
after_create :add_course_lead
|
||||
before_destroy :destroy_user_activity, :destroy_org_activity
|
||||
|
||||
|
@ -31,14 +31,16 @@ class CourseActivity < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def add_course_activity
|
||||
def add_org_activity
|
||||
org_activity = OrgActivity.where("org_act_type = '#{self.course_act_type.to_s}' and org_act_id = '#{self.course_act_id}'").first
|
||||
if org_activity
|
||||
org_activity.updated_at = self.updated_at
|
||||
org_activity.save
|
||||
else
|
||||
if self.course_act_type == 'Message' && !self.course_act.parent_id.nil?
|
||||
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.course_act.parent.id}").first
|
||||
org_activity.created_at = self.created_at
|
||||
org_activity.updated_at = self.updated_at
|
||||
org_activity.save
|
||||
else
|
||||
OrgActivity.create(:user_id => self.user_id,
|
||||
|
@ -64,15 +66,16 @@ class CourseActivity < ActiveRecord::Base
|
|||
|
||||
# 发布新课导语
|
||||
# 导语要放置在课程创建信息之后
|
||||
# 导语
|
||||
def add_course_lead
|
||||
if self.course_act_type == "Course"
|
||||
# 避免空数据迁移报错问题
|
||||
if self.course_act_type == "Course" and Message.where("id=12440").any?
|
||||
lead_message = Message.find(12440)
|
||||
name = lead_message.subject
|
||||
content = lead_message.content
|
||||
# message的status状态为0为正常,为1表示创建课程时发送的message
|
||||
message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true )
|
||||
# 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直
|
||||
# author_id 默认为课程使者创建
|
||||
message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => 1 , :sticky => true, :status => true )
|
||||
# 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一致
|
||||
message.course_acts.first.update_attribute(:updated_at, message.course_acts.first.updated_at + 1) if message.course_acts.first
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
class CourseContributorScore < ActiveRecord::Base
|
||||
attr_accessible :course_id, :journal_num, :journal_reply_num, :message_num, :message_reply_num, :news_reply_num, :resource_num, :user_id, :total_score
|
||||
attr_accessible :course_id, :journal_num, :journal_reply_num, :message_num, :message_reply_num, :news_reply_num,
|
||||
:resource_num, :user_id, :total_score, :homework_journal_num, :news_num
|
||||
belongs_to :course
|
||||
belongs_to :user
|
||||
end
|
||||
|
|
|
@ -48,7 +48,7 @@ class ForgeActivity < ActiveRecord::Base
|
|||
def add_org_activity
|
||||
org_activity = OrgActivity.where("org_act_type = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first
|
||||
if org_activity
|
||||
org_activity.created_at = self.created_at
|
||||
org_activity.updated_at = self.updated_at
|
||||
org_activity.save
|
||||
else
|
||||
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
|
||||
|
|
|
@ -84,7 +84,9 @@ class Issue < ActiveRecord::Base
|
|||
attr_reader :current_journal
|
||||
|
||||
# fq
|
||||
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message, :act_as_at_message, :add_issues_count
|
||||
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message,
|
||||
act_as_at_message(:description, :author_id), :add_issues_count
|
||||
|
||||
after_update :be_user_score,:update_activity
|
||||
after_destroy :down_user_score, :decrease_issues_count
|
||||
# after_create :be_user_score
|
||||
|
@ -165,12 +167,12 @@ class Issue < ActiveRecord::Base
|
|||
end
|
||||
|
||||
# at 功能添加消息提醒
|
||||
def act_as_at_message
|
||||
users = self.description.scan /<span class="at" data-user-id="(\d+?)">/m
|
||||
users && users.flatten.uniq.each do |uid|
|
||||
self.at_messages << AtMessage.new(user_id: uid, sender_id: self.author_id)
|
||||
end
|
||||
end
|
||||
# def act_as_at_message
|
||||
# users = self.description.scan /<span class="at" data-user-id="(\d+?)">/m
|
||||
# users && users.flatten.uniq.each do |uid|
|
||||
# self.at_messages << AtMessage.new(user_id: uid, sender_id: self.author_id)
|
||||
# end
|
||||
# end
|
||||
|
||||
# 创建issue的时候,issues_count加1
|
||||
def add_issues_count
|
||||
|
|
|
@ -51,7 +51,7 @@ class Journal < ActiveRecord::Base
|
|||
before_create :split_private_notes, :add_journals_count
|
||||
|
||||
# fq
|
||||
after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message
|
||||
after_save :act_as_activity,:be_user_score, :act_as_forge_message, act_as_at_message(:notes, :user_id)
|
||||
after_create :update_issue_time
|
||||
# end
|
||||
#after_destroy :down_user_score
|
||||
|
@ -186,13 +186,6 @@ class Journal < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def act_as_at_message
|
||||
users = self.notes.scan /<span class="at" data-user-id="(\d+?)">/m
|
||||
users && users.flatten.uniq.each do |uid|
|
||||
self.at_messages << AtMessage.new(user_id: uid, sender_id: self.user_id)
|
||||
end
|
||||
end
|
||||
|
||||
# 更新用户分数 -by zjc
|
||||
def be_user_score
|
||||
#新建了缺陷留言且留言不为空,不为空白
|
||||
|
|
|
@ -68,12 +68,14 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
has_many :at_messages, as: :at_message, dependent: :destroy
|
||||
|
||||
validates :notes, presence: true, if: :is_homework_jour?
|
||||
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score
|
||||
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message,
|
||||
act_as_at_message(:notes, :user_id), :act_as_user_feedback_message,
|
||||
:act_as_principal_activity, :act_as_student_score
|
||||
after_create :reset_counters!
|
||||
#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 +186,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 更新用户分数 -by zjc
|
||||
def down_user_score
|
||||
#删除了留言回复
|
||||
|
@ -252,12 +255,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def act_as_at_message
|
||||
users = self.notes.scan /<span class="at" data-user-id="(\d+?)">/m
|
||||
users && users.flatten.uniq.each do |uid|
|
||||
self.at_messages << AtMessage.new(user_id: uid, sender_id: self.user_id)
|
||||
end
|
||||
end
|
||||
|
||||
# 用户留言消息通知
|
||||
def act_as_user_feedback_message
|
||||
# 主留言
|
||||
|
@ -283,10 +281,21 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# 课程成员得分(英雄榜)
|
||||
# 课程成员得分(活跃度)
|
||||
def act_as_student_score
|
||||
if !self.user.allowed_to?(:as_teacher, self.jour) && self.jour_type == "Course"
|
||||
course_member_score(self.jour_id, self.user_id, "JournalForMessage")
|
||||
if self.jour_type == "Course"
|
||||
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
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ class Member < ActiveRecord::Base
|
|||
|
||||
#当前学生在指定作业内的得分
|
||||
def homework_common_score homework_common
|
||||
StudentWork.select("IF(final_score is null,null,final_score - absence_penalty - late_penalty) as final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id)
|
||||
StudentWork.select("IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id)
|
||||
end
|
||||
|
||||
def student_work_score_avg
|
||||
|
@ -158,7 +158,7 @@ class Member < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def student_work_score_sum
|
||||
sql_select = "SELECT (SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))) as score
|
||||
sql_select = "SELECT (SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)))) as score
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{self.course_id}
|
||||
|
|
|
@ -45,6 +45,8 @@ class Message < ActiveRecord::Base
|
|||
|
||||
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
|
||||
|
||||
#转发表
|
||||
has_many :forwards, :as => :from, :dependent => :destroy
|
||||
after_destroy :delete_org_activities
|
||||
|
||||
acts_as_searchable :columns => ['subject', 'content'],
|
||||
|
@ -77,9 +79,10 @@ 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
|
||||
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(:content, :author_id)
|
||||
#before_save :be_user_score
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
|
@ -285,13 +288,6 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def act_as_at_message
|
||||
users = self.content.scan /<span class="at" data-user-id="(\d+?)">/m
|
||||
users && users.flatten.uniq.each do |uid|
|
||||
self.at_messages << AtMessage.new(user_id: uid, sender_id: self.author_id)
|
||||
end
|
||||
end
|
||||
|
||||
#更新用户分数 -by zjc
|
||||
def be_user_score
|
||||
#新建message且无parent的为发帖
|
||||
|
@ -339,10 +335,9 @@ class Message < ActiveRecord::Base
|
|||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE
|
||||
end
|
||||
|
||||
# 课程成员得分(英雄榜)
|
||||
# 课程成员得分(活跃度)
|
||||
def act_as_student_score
|
||||
if self.course
|
||||
unless self.author.allowed_to?(:as_teacher, self.course)
|
||||
if self.parent_id.nil?
|
||||
# 发帖
|
||||
course_member_score(self.course.id, self.author_id, "Message")
|
||||
|
@ -352,6 +347,17 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
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
|
||||
|
|
|
@ -37,6 +37,9 @@ class News < ActiveRecord::Base
|
|||
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
|
||||
#end
|
||||
|
||||
#转发表
|
||||
has_many :forwards, :as => :from, :dependent => :destroy
|
||||
|
||||
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
|
||||
|
||||
validates_presence_of :title, :description
|
||||
|
@ -56,9 +59,9 @@ class News < ActiveRecord::Base
|
|||
:author_key => :author_id
|
||||
acts_as_watchable
|
||||
|
||||
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
|
||||
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))
|
||||
|
@ -192,4 +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
|
|
@ -9,6 +9,7 @@ class OrgSubfield < ActiveRecord::Base
|
|||
has_many :news, :dependent => :destroy
|
||||
acts_as_attachable
|
||||
after_create :create_board_sync
|
||||
after_destroy :update_priority
|
||||
# 创建资源栏目讨论区
|
||||
def create_board_sync
|
||||
@board = self.boards.build
|
||||
|
@ -25,4 +26,11 @@ class OrgSubfield < ActiveRecord::Base
|
|||
|
||||
def project
|
||||
end
|
||||
|
||||
def update_priority
|
||||
OrgSubfield.where("organization_id=? and priority>?", self.organization_id, self.priority).each do |field|
|
||||
field.decrement(:priority)
|
||||
field.save
|
||||
end
|
||||
end
|
||||
end
|
|
@ -16,8 +16,8 @@ class Organization < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def add_default_subfields
|
||||
OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default')
|
||||
OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default')
|
||||
OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default')
|
||||
OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default', :priority => 1)
|
||||
OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default', :priority => 2)
|
||||
OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default', :priority => 3)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,8 +2,8 @@ class PraiseTread < ActiveRecord::Base
|
|||
attr_accessible :user_id,:praise_tread_object_id,:praise_tread_object_type,:praise_or_tread
|
||||
belongs_to :user
|
||||
belongs_to :praise_tread_object, polymorphic: true
|
||||
after_create :be_user_score
|
||||
after_destroy :down_user_score
|
||||
#after_create :be_user_score
|
||||
#after_destroy :down_user_score
|
||||
include UserScoreHelper
|
||||
def self.find_object_by_type_and_id(type,id)
|
||||
@obj = nil
|
||||
|
|
|
@ -116,7 +116,7 @@ class User < Principal
|
|||
has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
|
||||
has_one :rss_token, :class_name => 'Token', :conditions => "action='feeds'"
|
||||
has_one :blog, :class_name => 'Blog', :foreign_key => "author_id"
|
||||
has_many :org_document_comments, :dependent =>:destroy
|
||||
has_many :org_document_comments, :dependent =>:destroy, :foreign_key => "creator_id"
|
||||
has_one :api_token, :class_name => 'Token', :conditions => "action='api'"
|
||||
belongs_to :auth_source
|
||||
has_many :org_members
|
||||
|
@ -823,6 +823,9 @@ class User < Principal
|
|||
end
|
||||
|
||||
def member_of_org?(org)
|
||||
if !self.logged?
|
||||
return false
|
||||
end
|
||||
OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count > 0
|
||||
end
|
||||
|
||||
|
@ -1065,6 +1068,16 @@ class User < Principal
|
|||
anonymous_user
|
||||
end
|
||||
|
||||
# refactor User model find function,
|
||||
# return anonymous user when can not find user id = user_id
|
||||
def self.find (*args, &block)
|
||||
begin
|
||||
super
|
||||
rescue
|
||||
self.anonymous
|
||||
end
|
||||
# super
|
||||
end
|
||||
# Salts all existing unsalted passwords
|
||||
# It changes password storage scheme from SHA1(password) to SHA1(salt + SHA1(password))
|
||||
# This method is used in the SaltPasswords migration and is to be kept as is
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
class UserActions < ActiveRecord::Base
|
||||
attr_accessible :action_id, :action_type, :user_id
|
||||
has_many :users
|
||||
end
|
|
@ -0,0 +1,64 @@
|
|||
<h3><%=l(:label_course_resource_list)%></h3>
|
||||
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th style="width: 60px;">
|
||||
资源名称
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
资源大小
|
||||
</th>
|
||||
<th style="width: 25px;">
|
||||
资源类型
|
||||
</th>
|
||||
<th style="width: 23px;">
|
||||
上传时间
|
||||
</th>
|
||||
<th style="width: 15px;">
|
||||
下载次数
|
||||
</th>
|
||||
<th style="width: 20px;">
|
||||
上传者
|
||||
</th>
|
||||
<th style="width: 35px;">
|
||||
所属课程
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @resource.each do |resource| %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: left;">
|
||||
<%= link_to truncate(resource.filename, :length => 18), download_named_attachment_path(resource.id, resource.filename ), :title => resource.filename,:class=>'resourcesBlack'%>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= number_to_human_size(resource.filesize)%>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
课程资源
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= format_date(resource.created_on)%>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= resource.downloads %>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= link_to(User.find(resource.author_id).realname, user_path(User.find(resource.author_id)) ) %>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%=link_to truncate(Course.find(resource.container_id).name, :length => 10), course_path(Course.find(resource.container_id)), :title => Course.find(resource.container_id).name, :class => "hidden fl w170" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
|
@ -73,4 +73,8 @@
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_course_all)) -%>
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
<h3>
|
||||
<%=l(:label_excellent_courses_list)%>
|
||||
</h3>
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 25px;">
|
||||
序号
|
||||
</th>
|
||||
<th style="width: 120px;">
|
||||
课程名
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
主讲老师
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
学生数
|
||||
</th>
|
||||
<th style="width: 25px;">
|
||||
作业数
|
||||
</th>
|
||||
<th style="width: 25px;">
|
||||
作品数
|
||||
</th>
|
||||
<th style="width: 25px;">
|
||||
资源数
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
帖子数
|
||||
</th>
|
||||
<th style="width: 70px;">
|
||||
动态数
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @courses.each do |course| %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center;">
|
||||
<%= course.id %>
|
||||
</td>
|
||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>'>
|
||||
<span>
|
||||
<%= link_to(course.name, course_path(course.id)) %>
|
||||
</span>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%= studentCount(course) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= course.homework_commons.count%>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= student_works_num(course) %>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= visable_attachemnts_incourse(course).count%>
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", course.boards.first.id, nil).count %>
|
||||
|
||||
</td>
|
||||
<td class="center">
|
||||
<%= course.course_activities.count%>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
|
@ -59,17 +59,17 @@
|
|||
<%=format_time(teacher.last_login_on) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=teacher.id %>
|
||||
<%=teacher.user_id %>
|
||||
</td>
|
||||
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if teacher.try(:realname) == ' '%><%= teacher.login%><% else %><%=teacher.try(:realname) %><% end %>'>
|
||||
<% if teacher.try(:realname) == ' '%>
|
||||
<%= link_to(teacher.login, user_path(teacher)) %>
|
||||
<%= link_to(teacher.login, user_path(teacher.user_id)) %>
|
||||
<% else %>
|
||||
<%= link_to(teacher.try(:realname), user_path(teacher)) %>
|
||||
<%= link_to(teacher.try(:realname), user_path(teacher.user_id)) %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=link_to(teacher.login, user_path(teacher)) %>
|
||||
<%=link_to(teacher.login, user_path(teacher.user_id)) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
老师
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
<h3><%=l(:label_project_resource_list)%></h3>
|
||||
|
||||
|
||||
<div class="autoscroll">
|
||||
<table class="list" style="width: 100%;table-layout: fixed">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th style="width: 60px;">
|
||||
资源名称
|
||||
</th>
|
||||
<th style="width: 30px;">
|
||||
资源大小
|
||||
</th>
|
||||
<th style="width: 25px;">
|
||||
资源类型
|
||||
</th>
|
||||
<th style="width: 23px;">
|
||||
上传时间
|
||||
</th>
|
||||
<th style="width: 15px;">
|
||||
下载次数
|
||||
</th>
|
||||
<th style="width: 20px;">
|
||||
上传者
|
||||
</th>
|
||||
<th style="width: 35px;">
|
||||
所属项目
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @pro_resource.each do |pro_resource| %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: left;">
|
||||
<%= link_to truncate(pro_resource.filename, :length => 18), download_named_attachment_path(pro_resource.id, pro_resource.filename ), :title => pro_resource.filename,:class=>'resourcesBlack'%>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= number_to_human_size(pro_resource.filesize)%>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
项目资源
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= format_date(pro_resource.created_on)%>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= pro_resource.downloads %>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%= link_to(User.find(pro_resource.author_id).realname, user_path(User.find(pro_resource.author_id)) ) %>
|
||||
</td>
|
||||
<td style=" text-align: center;">
|
||||
<%=link_to truncate(Project.find(pro_resource.container_id).name, :length => 10), project_path(Project.find(pro_resource.container_id)), :title => Project.find(pro_resource.container_id).name, :class => "hidden fl w170" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
|
@ -45,8 +45,8 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% project_tree(@projects) do |project, level| %>
|
||||
<tr class="<%= cycle("odd", "even") %> <%= project.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
|
||||
<% @projects.each do |project| %>
|
||||
<tr class="<%= cycle("odd", "even") %>">
|
||||
<td style="text-align: center;">
|
||||
<%= project.id %>
|
||||
</td>
|
||||
|
@ -73,6 +73,10 @@
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_project_plural)) -%>
|
||||
|
||||
<script>
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
[
|
||||
<% @users && @users.each_with_index do |person,index| %>
|
||||
<% if index == 0 %>
|
||||
{"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "<%=person.name%>", "searchKey": "<%=person.name%>"}
|
||||
<%= index != @users.size-1 ? ',' : '' %>
|
||||
<% else %>
|
||||
{"id":<%=index%>, "userid": <%=person.id%>, "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"}
|
||||
<%= index != @users.size-1 ? ',' : '' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
]
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".popupClose").click(function(){
|
||||
$(".popupWrap").css("display","none");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<span class="f16 fontBlue fb">选择版本 </span>
|
||||
<p class="c_red">注:该文件有历史版本,请选择您需要的文件,点击文件名下载。</p>
|
||||
<p class="fontGrey3 mb4 fb">版本及序号</p>
|
||||
|
||||
<div style="max-height:165px; overflow-y:auto; background-color: #e3e3e3; line-height:33px;" class="p10">
|
||||
<span class="attachment">
|
||||
<%= link_to truncate(@attachment.filename,length: 35, omission: '...'),
|
||||
download_named_attachment_path(@attachment.id, @attachment.filename),
|
||||
:title => @attachment.filename+"\n"+@attachment.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f14 fb link_file_a2 fl" %>
|
||||
</span>
|
||||
<span class="fr">版本号:当前</span>
|
||||
<div class="cl"></div>
|
||||
<% @attachment_histories.each do |history| %>
|
||||
<span class="attachment">
|
||||
<%= link_to truncate(history.filename,length: 35, omission: '...'),
|
||||
download_history_attachment_path(history.id, history.filename),
|
||||
:title => history.filename+"\n"+history.description.to_s,
|
||||
:style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f14 fb link_file_a2 fl" %>
|
||||
</span>
|
||||
<span class="fr">版本号:<%= history.version %></span>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1,7 @@
|
|||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/attachment_history_download' )%>');
|
||||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","50%");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
|
@ -10,7 +10,7 @@
|
|||
<input type="hidden" name="blog_comment[title]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
|
|
|
@ -1,6 +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],:in_act => params[:in_act]},: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 %>
|
||||
<% end %>
|
|
@ -38,7 +38,7 @@
|
|||
<%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %>
|
||||
</div>
|
||||
<div class="postThemeWrap">
|
||||
<% if @article.author.id == User.current.id%>
|
||||
<% if @article.author.id == User.current.id || User.current.admin? %>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= @article.id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
|
@ -48,7 +48,7 @@
|
|||
l(:button_edit),
|
||||
{:action => 'edit', :id => @article.id,:in_act => params[:in_act]},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == @article.author.id %>
|
||||
) if User.current.admin? || User.current.id == @article.author.id %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
|
@ -57,7 +57,7 @@
|
|||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == @article.author.id %>
|
||||
) if User.current.admin? || User.current.id == @article.author.id %>
|
||||
</li>
|
||||
<li>
|
||||
<% if @article.id == @article.blog.homepage_id %>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<% if activity.author.id == User.current.id%>
|
||||
<% if activity.author.id == User.current.id || User.current.admin? %>
|
||||
<div class="homepagePostSetting" id="message_setting_<%= activity.id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
|
@ -14,7 +14,7 @@
|
|||
l(:button_edit),
|
||||
{:controller => 'blog_comments',:action => 'edit',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.author.id %>
|
||||
) if User.current.admin? || User.current.id == activity.author.id %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
|
@ -23,7 +23,7 @@
|
|||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.author.id %>
|
||||
) if User.current.admin? || User.current.id == activity.author.id %>
|
||||
</li>
|
||||
<li>
|
||||
<% if activity.id == activity.blog.homepage_id %>
|
||||
|
@ -200,7 +200,7 @@
|
|||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="blog_comment[content]"></textarea>
|
||||
<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>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
<% end%>
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.content} %>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,123 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false) %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
function nh_check_field(params){
|
||||
var result=true;
|
||||
if(!regexTopicSubject()) {
|
||||
result=false;
|
||||
return result;
|
||||
}
|
||||
if(params.content!=undefined){
|
||||
if(params.content.isEmpty()){
|
||||
result=false;
|
||||
}
|
||||
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
|
||||
params.textarea.html(params.content.html());
|
||||
params.content.sync();
|
||||
if(params.content.isEmpty())
|
||||
{
|
||||
params.contentmsg.text("描述不能为空");
|
||||
params.contentmsg.css('color','#ff0000');
|
||||
}
|
||||
else if(params.content.html().length >=20000){
|
||||
params.contentmsg.text("描述最多20000个汉字(或40000个英文字符)");
|
||||
params.contentmsg.css('color','#ff0000');
|
||||
result=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
params.contentmsg.text("填写正确");
|
||||
params.contentmsg.css('color','#008000');
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function init_homework_form(params){
|
||||
params.form.submit(function(){
|
||||
params.textarea.html(params.editor.html());
|
||||
params.editor.sync();
|
||||
var flag = false;
|
||||
if(params.form.attr('data-remote') != undefined ){
|
||||
flag = true
|
||||
}
|
||||
var is_checked = false;
|
||||
is_checked = nh_check_field({
|
||||
issubmit:true,
|
||||
content:params.editor,
|
||||
contentmsg:params.contentmsg,
|
||||
textarea:params.textarea
|
||||
});
|
||||
if(is_checked){
|
||||
if(flag){
|
||||
return true;
|
||||
}else{
|
||||
$(this)[0].submit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
function init_homework_editor(params){
|
||||
params.textarea.removeAttr('placeholder');
|
||||
var editor = params.kindutil.create(params.textarea, {
|
||||
resizeType : 1,minWidth:"1px",width:"100%",minHeight:"30px",height:"30px",
|
||||
items : ['code','emoticons','fontname',
|
||||
'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
|
||||
'formatblock', 'fontsize', '|','indent', 'outdent',
|
||||
'|','imagedirectupload','table', 'media', 'preview',"more"
|
||||
],
|
||||
afterChange:function(){//按键事件
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
//paramsHeight = params.kindutil.removeUnit(this.height);
|
||||
edit.iframe.height(150);
|
||||
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 33, 150));
|
||||
},
|
||||
afterCreate:function(){
|
||||
//init
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.iframe[0].scroll = 'no';
|
||||
body.style.overflowY = 'hidden';
|
||||
//reset height
|
||||
var edit = this.edit;
|
||||
var body = edit.doc.body;
|
||||
edit.html(params.textarea.innerHTML);
|
||||
//paramsHeight = params.kindutil.removeUnit(this.height);
|
||||
edit.iframe.height(150);
|
||||
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150));
|
||||
elocalStorage(message_content_editor,'topic_course_<%=course.id %>');
|
||||
}
|
||||
}).loadPlugin('paste');
|
||||
return editor;
|
||||
}
|
||||
KindEditor.ready(function(K){
|
||||
$("div[nhname='topic_form']").each(function(){
|
||||
var params = {};
|
||||
params.kindutil = K;
|
||||
params.div_form = $(this);
|
||||
params.form = $("form",params.div_form);
|
||||
if(params.form==undefined || params.form.length==0){
|
||||
return;
|
||||
}
|
||||
params.textarea = $("textarea[nhname='topic_textarea']",params.div_form);
|
||||
params.contentmsg = $("#message_content_span");
|
||||
params.submit_btn = $("#new_message_submit_btn");
|
||||
if(params.textarea.data('init') == undefined) {
|
||||
params.editor = init_homework_editor(params);
|
||||
message_content_editor = params.editor;
|
||||
init_homework_form(params);
|
||||
params.submit_btn.click(function () {
|
||||
params.form.submit();
|
||||
});
|
||||
params.textarea.data('init', 1);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<%= error_messages_for 'message' %>
|
||||
<div class="resources mt10">
|
||||
<div id="new_course_topic">
|
||||
|
@ -25,7 +141,7 @@
|
|||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
|
||||
<%= f.kindeditor :content, :editor_id => 'message_content_editor',
|
||||
<%#= f.kindeditor :content, :editor_id => 'message_content_editor',
|
||||
:owner_id => topic.nil? ? 0: topic.id,
|
||||
:owner_type => OwnerTypeHelper::MESSAGE,
|
||||
:width => '100%',
|
||||
|
@ -37,8 +153,11 @@
|
|||
:maxlength => 5000 },
|
||||
at_id: topic.id, at_type: topic.class.to_s
|
||||
%>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='topic_textarea' name="message[content]"><%=topic.content %></textarea>
|
||||
<div class="cl"></div>
|
||||
<p id="message_content_span"></p>
|
||||
<p id="e_tip" class="c_grey"></p>
|
||||
<p id="e_tips" class="c_grey"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10">
|
||||
|
@ -49,11 +168,11 @@
|
|||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<%if !edit_mode %>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_topic();">确定</a>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_message_submit_btn">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" class="fr mr10 mt3" onclick="reset_topic();">取消</a>
|
||||
<% else %>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="submit_topic();">确定</a>
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" id="new_message_submit_btn" onclick="submit_topic();">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<%= link_to "取消",board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "fr mr10 mt3"%>
|
||||
<% end %>
|
||||
|
|
|
@ -22,14 +22,16 @@
|
|||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">
|
||||
课程讨论区
|
||||
课程问答区
|
||||
</div>
|
||||
</div>
|
||||
<div nhname="topic_form">
|
||||
<% if User.current.logged? %>
|
||||
<%= labelled_form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},
|
||||
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= render :partial => 'course_new', :locals => {:f => f, :topic => @message, :edit_mode => false, :course => @board.course} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render :partial=> 'course_show_detail',:locals =>{:topics => @topics, :page => 0} %>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
<script type="text/javascript">
|
||||
function submit_copy_course() {
|
||||
if(regex_course_name()&®ex_course_class_period()&®ex_time_term()&®ex_course_password())
|
||||
{
|
||||
$("#new_course").submit();
|
||||
document.getElementById("submit_copy_course").onclick = "";
|
||||
}
|
||||
}
|
||||
$(document).ready(function(){
|
||||
$("#time").change(function(){
|
||||
document.getElementById("end_time").options[document.getElementById("time").selectedIndex].selected = true;
|
||||
|
@ -147,7 +154,7 @@
|
|||
<% end %>
|
||||
</ul>
|
||||
<div>
|
||||
<a href="javascript:void(0);" class="greyBtn fr mr40 f12" onclick="submit_new_course();">完成</a>
|
||||
<a href="javascript:void(0);" class="greyBtn fr mr40 f12" id="submit_copy_course" onclick="submit_copy_course();">完成</a>
|
||||
<a href="javascript:void(0);" class="greyBtn fr mr10 f12" onclick="hideResource();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
|
@ -2,6 +2,8 @@
|
|||
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
<script>
|
||||
var onUserCard = false;
|
||||
var onImage = false;
|
||||
$(document).ready(function(){
|
||||
$("#relateProject,.relatePInfo").mouseover(function(){
|
||||
$(".relatePInfo").css("display","block");
|
||||
|
@ -10,15 +12,24 @@
|
|||
$(".relatePInfo").css("display","none");
|
||||
})
|
||||
$(".homepagePostPortrait").mouseover(function(){
|
||||
onImage = true;
|
||||
$(this).children(".userCard").css("display","block");
|
||||
})
|
||||
$(".homepagePostPortrait").mouseout(function(){
|
||||
$(this).children(".userCard").css("display","none");
|
||||
var cur = $(this);
|
||||
onImage = false;
|
||||
setTimeout(function(){
|
||||
if (onUserCard == false && onImage == false){
|
||||
$(cur).children(".userCard").css("display", "none");
|
||||
}
|
||||
}, 500);
|
||||
})
|
||||
$(".userCard").mouseover(function(){
|
||||
onUserCard = true;
|
||||
$(this).css("display","block");
|
||||
})
|
||||
$(".userCard").mouseout(function(){
|
||||
onUserCard = false;
|
||||
$(this).css("display","none");
|
||||
})
|
||||
$(".coursesLineGrey").mouseover(function(){
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
<ul class="st_box_top">
|
||||
<li class="ml50" style="padding-right: 5px;"><a href="">姓名</a></li>
|
||||
<li class="ml10" style="padding-right: 15px;"><a href="">学号</a></li>
|
||||
<li class="ml358">
|
||||
<li style="padding-right: 55px; margin-left: 260px;"><a href="">分班</a></li>
|
||||
<li style="margin-left: 25px;">
|
||||
<%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true%>
|
||||
<% if @score_sort_by == 'desc' %>
|
||||
<a id="pic" href="javascript:" class= "st_down"></a>
|
||||
|
@ -58,11 +59,31 @@
|
|||
<li><%= link_to("#{l(:label_bidding_user_studentcode)}:<span >#{member.user.user_extensions.student_id}</span>".html_safe,user_path(member.user)) %></li>
|
||||
<% end%>
|
||||
</ul>
|
||||
<% if User.current.allowed_to?(:as_teacher, @course) || User.current.admin? %>
|
||||
<% if @course.course_groups.nil? || @group %>
|
||||
<div class="select-class-option fl" style="margin-left: 105px;">
|
||||
<span style="width: 100px; text-align: center; float: left;" class="hidden"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id,:user_id => member.user_id},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %>
|
||||
<div class="select-class-option fl" style="margin-left: 105px;"><span style="width: 100px; text-align: center; float: left;" class="hidden"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
|
||||
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2 ml5"></a>
|
||||
</div>
|
||||
<%= select( :name,:group_id, course_group_option(@course),
|
||||
{ :include_blank => false,:selected => member.course_group_id},
|
||||
{:onchange=>"join_group_function('#join_group_form_#{member.id}');", :id =>"course_group_id", :name => "course_group_id",:class=>"w125 undis class-edit fl", :style => "margin-left: 105px;"}) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="select-class-option fl" style="margin-left: 105px;">
|
||||
<span style="width: 100px; text-align: center; float: left;" class="hidden"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= link_to format("%0.2f",member.score.nil? ? 0 : member.score.to_s), {
|
||||
:action => 'show_member_score',
|
||||
:member_id => member.id,
|
||||
:remote => true},
|
||||
:class => 'ml258 c_red' %>
|
||||
:class => 'ml25 c_red' %>
|
||||
<span class="fr mr15 c_grey"><%= format_date(member.created_on)%></span>
|
||||
<%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %>
|
||||
</div>
|
||||
|
@ -79,3 +100,40 @@
|
|||
</p>
|
||||
<% end%>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
/*$(".select-class-option").mouseover(function(){
|
||||
$(this).children(".pic_edit2").css("display","inline-block");
|
||||
});
|
||||
$(".select-class-option").mouseout(function(){
|
||||
$(this).children(".pic_edit2").css("display","none");
|
||||
});*/
|
||||
$(".pic_edit2").click(function(){
|
||||
$(this).parent().hide();
|
||||
$(this).parent().next().show();
|
||||
});
|
||||
$(".class-edit").blur(function(){
|
||||
$(this).hide();
|
||||
$(this).prev().show();
|
||||
var editValue = $(this).children("option:selected").text();
|
||||
$(this).prev().children(":first").text(editValue);
|
||||
});
|
||||
function stopPropagation(e) {
|
||||
if (e.stopPropagation)
|
||||
e.stopPropagation();
|
||||
else
|
||||
e.cancelBubble = true;
|
||||
};
|
||||
$(document).bind('click',function(){
|
||||
$('.class-edit').css('display','none');
|
||||
$('.select-class-option').show();
|
||||
});
|
||||
$('.class-edit,.pic_edit2').bind('click',function(e){
|
||||
stopPropagation(e);
|
||||
});
|
||||
});
|
||||
function join_group_function(id){
|
||||
$(id).submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -6,14 +6,15 @@
|
|||
|
||||
<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>
|
||||
<% if visable_attachemnts_incourse(e_course).count > 0 %>
|
||||
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to visable_attachemnts_incourse(e_course).count, course_files_path(e_course), :class => "linkBlue2" %>)</span>
|
||||
<% end %>
|
||||
<% 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>
|
||||
<% if e_course.homework_commons.where("publish_time <= '#{Date.today}'").count > 0 %>
|
||||
<span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.where("publish_time <= '#{Date.today}'").count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)</span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<% end %>
|
||||
<% if show_nav?(@course.news.count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_news), course_news_index_path(@course), :class => "f12 c_blue02 ml10 fn" %>
|
||||
<%= link_to "通知", course_news_index_path(@course), :class => "f12 c_blue02 ml10 fn" %>
|
||||
<%= link_to( "", new_course_news_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -24,7 +24,7 @@
|
|||
<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f12 c_blue02 ml10 fn" %>
|
||||
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") if User.current.member_of_course?(@course) && @course.boards.first %>
|
||||
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if show_nav?(course_feedback_count) %>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<h2 class="project_h2 fl"><%= @subPage_title%></h2>
|
||||
<% if User.current.allowed_to?(:as_teacher,@course) %>
|
||||
<span class="fr f14 fontGrey2" style="height: 40px; line-height: 40px; margin-right: 15px;">
|
||||
<%=link_to "修改角色", :controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member' %>
|
||||
<%=link_to "成员管理", :controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member' %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
}
|
||||
<% else %>
|
||||
<% if @course.is_public? %>
|
||||
$("#set_course_public_<%= @course.id %>").text("设为私有");
|
||||
$("#show_course_<%= @course.id %>").attr("title","公开课程:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)");
|
||||
<% else %>
|
||||
$("#set_course_public_<%= @course.id %>").text("设为公开");
|
||||
$("#show_course_<%= @course.id %>").attr("title","私有课程:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)");
|
||||
<% end %>
|
||||
$("#set_course_public_<%= @course.id %>").replaceWith('<%= escape_javascript(link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => "courses", :action => "private_or_public", :id => @course,:user_page => true},
|
||||
:id => "set_course_public_#{@course.id.to_s}",:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗") %>');
|
||||
<% end %>
|
|
@ -192,7 +192,7 @@
|
|||
<input type="hidden" name="blog_comment[locked]" value="0">
|
||||
<div nhname='toolbar_container_<%= @article.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @article.id%>' name="blog_comment[content]"></textarea>
|
||||
<a id="new_message_submit_btn_<%= @article.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<a id="new_message_submit_btn_<%= @article.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= @article.id%>'></p>
|
||||
<% end%>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>");
|
|
@ -8,7 +8,7 @@
|
|||
$("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>")
|
||||
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<label>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>: </label>" +
|
||||
"<label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>: </label>" +
|
||||
"<input maxlength='200' type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
|
@ -34,7 +34,7 @@
|
|||
<div id="poll_answers_<%=exercise_question.id%>">
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>: </label>
|
||||
<label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
$("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>")
|
||||
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<label>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>: </label>" +
|
||||
"<label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>: </label>" +
|
||||
"<input maxlength='200' type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
|
@ -34,7 +34,7 @@
|
|||
<div id="poll_answers_<%=exercise_question.id%>">
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>: </label>
|
||||
<label name='select_items' class='w56'>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>")
|
||||
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<label>候选答案<span class='ur_index'></span>: </label>" +
|
||||
"<label name='candiate_items'>候选答案<%=convert_to_chi_num(index+1) %><span class='ur_index'></span>: </label>" +
|
||||
"<input class='candiate_answer' name='exercise_choice[<%=exercise_choice.id %>]' placeholder='请输入候选答案' type='text' value='<%=exercise_choice.answer_text %>'/>" +
|
||||
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_candidate_answer($(this));'></a>" +
|
||||
|
@ -34,7 +34,7 @@
|
|||
<div id="poll_answers_<%=exercise_question.id%>">
|
||||
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label>候选答案<span class="ur_index"></span>: </label>
|
||||
<label name='candiate_items'>候选答案<%=convert_to_chi_num(index+1) %><span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer" name="exercise_choice[<%=exercise_choice.id %>]" placeholder="请输入候选答案" type="text" value="<%=exercise_choice.answer_text %>"/>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this));"></a>
|
||||
|
|
|
@ -162,15 +162,38 @@
|
|||
//单选题
|
||||
function add_single_answer(doc)
|
||||
{
|
||||
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span>: </label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
|
||||
var li = doc.parent().after("<li class='ur_item'><label name='select_items' class='w56'>选项 <span class='ur_index'></span>: </label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
|
||||
"</li><div class='cl'></div>");
|
||||
var select_items =$("label[name='select_items']",li.parent());
|
||||
for(var i=0; i<select_items.length; i++){
|
||||
$(select_items[i]).html("选项"+String.fromCharCode(64 + parseInt(i+1))+"<span class='ur_index'></span>: ");
|
||||
}
|
||||
}
|
||||
function add_candidate_answer(doc)
|
||||
{
|
||||
doc.parent().after("<li class='ur_item'><label>候选答案<span class='ur_index'></span>: </label><input maxlength='200' type='text' name='exercise_choice["+new Date().getTime()+"]' placeholder='请输入候选答案(选填)'/>" +
|
||||
doc.parent().after("<li class='ur_item'><label name='candiate_items'>候选答案<span class='ur_index'></span>: </label><input maxlength='200' type='text' name='exercise_choice["+new Date().getTime()+"]' placeholder='请输入候选答案(选填)'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_candidate_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
|
||||
"</li><div class='cl'></div>");
|
||||
var select_items =$("label[name='candiate_items']",doc.parent().parent());
|
||||
for(var i=0; i<select_items.length; i++){
|
||||
$(select_items[i]).html("候选答案"+revert_to_chinese_num(i + 1)+"<span class='ur_index'></span>: ");
|
||||
}
|
||||
}
|
||||
function revert_to_chinese_num(num){
|
||||
var s_num = "";
|
||||
switch (num) {
|
||||
case 1: s_num = '一'; break;
|
||||
case 2: s_num = '二'; break;
|
||||
case 3: s_num = '三'; break;
|
||||
case 4: s_num = '四'; break;
|
||||
case 5: s_num = '五'; break;
|
||||
case 6: s_num = '六'; break;
|
||||
case 7: s_num = '七'; break;
|
||||
case 8: s_num = '八'; break;
|
||||
case 9: s_num = '九'; break;
|
||||
}
|
||||
return s_num;
|
||||
}
|
||||
function remove_single_answer(doc)
|
||||
{
|
||||
|
@ -180,7 +203,16 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
var parent = doc.parent().parent();
|
||||
doc.parent().remove();
|
||||
var select_items =$("label[name='select_items']",parent);
|
||||
var candiate_items =$("label[name='candiate_items']",parent);
|
||||
for(var i=0; i<select_items.length; i++){
|
||||
$(select_items[i]).html("选项"+String.fromCharCode(64 + parseInt(i+1))+"<span class='ur_index'></span>: ");
|
||||
}
|
||||
for(var i=0; i<candiate_items.length; i++){
|
||||
$(candiate_items[i]).html("候选答案"+revert_to_chinese_num(i + 1)+"<span class='ur_index'></span>: ");
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -18,28 +18,28 @@
|
|||
<div class="cl"></div>
|
||||
<div>
|
||||
<li class="ur_item">
|
||||
<label>选项A<span class="ur_index"></span>: </label>
|
||||
<label name='select_items' class='w56'>选项A<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项B<span class="ur_index"></span>: </label>
|
||||
<label name='select_items' class='w56'>选项B<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项C<span class="ur_index"></span>: </label>
|
||||
<label name='select_items' class='w56'>选项C<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'/>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项D<span class="ur_index"></span>: </label>
|
||||
<label name='select_items' class='w56'>选项D<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'/>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
|
|
|
@ -18,28 +18,28 @@
|
|||
<div class="cl"></div>
|
||||
<div>
|
||||
<li class="ur_item">
|
||||
<label>选项A<span class="ur_index"></span>: </label>
|
||||
<label name='select_items' class='w56'>选项A<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项B<span class="ur_index"></span>: </label>
|
||||
<label name='select_items' class='w56'>选项B<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项C<span class="ur_index"></span>: </label>
|
||||
<label name='select_items' class='w56'>选项C<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项D<span class="ur_index"></span>: </label>
|
||||
<label name='select_items' class='w56'>选项D<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
|
|
|
@ -18,22 +18,22 @@
|
|||
<div class="cl"></div>
|
||||
<div>
|
||||
<li class="ur_item">
|
||||
<label>候选答案一<span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer" name="exercise_choice[0]" placeholder="请输入候选答案一" type="text">
|
||||
<label name='candiate_items'>候选答案一<span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer" name="exercise_choice[0]" placeholder="请输入候选答案" type="text">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>候选答案二<span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer" name="exercise_choice[1]" placeholder="请输入候选答案二(选填)" type="text">
|
||||
<label name='candiate_items'>候选答案二<span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer" name="exercise_choice[1]" placeholder="请输入候选答案(选填)" type="text">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>候选答案三<span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer" name="exercise_choice[2]" placeholder="请输入候选答案三(选填)" type="text">
|
||||
<label name='candiate_items'>候选答案三<span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer" name="exercise_choice[2]" placeholder="请输入候选答案(选填)" type="text">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
|
|
|
@ -55,28 +55,28 @@
|
|||
'<input value="<%=score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
|
||||
'</li><div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项A<span class="ur_index"></span>: </label>'+
|
||||
'<label name="select_items" class="w56">选项A<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项B<span class="ur_index"></span>: </label>'+
|
||||
'<label name="select_items" class="w56">选项B<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项C<span class="ur_index"></span>: </label>'+
|
||||
'<label name="select_items" class="w56">选项C<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项D<span class="ur_index"></span>: </label>'+
|
||||
'<label name="select_items" class="w56">选项D<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
|
|
|
@ -54,28 +54,28 @@
|
|||
'<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
|
||||
'</li><div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项A<span class="ur_index"></span>: </label>'+
|
||||
'<label name="select_items" class="w56">选项A<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项B<span class="ur_index"></span>: </label>'+
|
||||
'<label name="select_items" class="w56">选项B<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项C<span class="ur_index"></span>: </label>'+
|
||||
'<label name="select_items" class="w56">选项C<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项D<span class="ur_index"></span>: </label>'+
|
||||
'<label name="select_items" class="w56">选项D<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<div class="cl"></div>
|
||||
<div>
|
||||
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
|
||||
候选答案:<%= exercise_choice.answer_text%><br />
|
||||
候选答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%><br />
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -42,22 +42,22 @@
|
|||
'<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
|
||||
'</li><div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>候选答案一<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer" type="text" name="exercise_choice[0]" placeholder="请输入候选答案一"/>'+
|
||||
'<label name="candiate_items">候选答案一<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer" type="text" name="exercise_choice[0]" placeholder="请输入候选答案"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>候选答案二<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer" type="text" name="exercise_choice[1]" placeholder="请输入候选答案二(选填)"/>'+
|
||||
'<label name="candiate_items">候选答案二<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer" type="text" name="exercise_choice[1]" placeholder="请输入候选答案(选填)"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>候选答案三<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer" type="text" name="exercise_choice[2]" placeholder="请输入候选答案三(选填)"/>'+
|
||||
'<label name="candiate_items">候选答案三<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer" type="text" name="exercise_choice[2]" placeholder="请输入候选答案(选填)"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li></div>'+
|
||||
|
|
|
@ -91,9 +91,10 @@
|
|||
<%= form_tag( search_course_files_path(@course), method: 'get',:class => "re_search",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "课内搜索", :class => "blueBtn mr5 fl",:name => "incourse",:id => "incourse" %>
|
||||
<%= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite" %>
|
||||
<%#= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite" %>
|
||||
<% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %>
|
||||
<input class="blueBtn fr mr5" value="上传资源" onclick="course_files_upload();">
|
||||
<%= link_to("导入资源", import_resources_user_path(User.current, :type => 6, :course_id => @course.id), :class => "blue-btn fr mr5", :remote => true) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
@ -107,16 +108,8 @@
|
|||
<div class="cl"></div>
|
||||
<div class="re_con_top">
|
||||
<p class="f_l fontBlue f_b f_14">共有 <span id="attachment_count"><%= @all_attachments.count%></span> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
<% if @order == "asc" %>
|
||||
按 <%= 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"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序
|
||||
<% else %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序
|
||||
<% end %>
|
||||
<p class="f_r" style="color: #808080" id="course_filter_order">
|
||||
<%= render :partial => 'course_file_filter_order', :locals => {:remote => @is_remote, :sort => @sort, :order => @order} %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<% if @order == "asc" %>
|
||||
按 <%= link_to "时间", search_tag_attachment_course_files_path(@course, :sort => "created_on:desc", :tag_name => @tag_name.nil? ? " " : @tag_name, :q => @q.nil? ? " " : @q), :class => "f_b c_grey", :remote => true %>
|
||||
<%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数", search_tag_attachment_course_files_path(@course, :sort => "downloads:desc", :tag_name => @tag_name.nil? ? " " : @tag_name, :q => @q.nil? ? " " : @q), :class => "f_b c_grey",:remote => true %>
|
||||
<%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数", search_tag_attachment_course_files_path(@course, :sort => "quotes:desc", :tag_name => @tag_name.nil? ? " " : @tag_name, :q => @q.nil? ? " " : @q), :class => "f_b c_grey", :remote => true %>
|
||||
<%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序
|
||||
<% else %>
|
||||
按 <%= link_to "时间", search_tag_attachment_course_files_path(@course, :sort => "created_on:asc", :tag_name => @tag_name.nil? ? ' ' : @tag_name, :q => @q.nil? ? ' ' : @q), :class => "f_b c_grey" , :remote => true %>
|
||||
<%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数", search_tag_attachment_course_files_path(@course, :sort => "downloads:asc", :tag_name => @tag_name.nil? ? ' ' : @tag_name, :q => @q.nil? ? ' ' : @q), :class => "f_b c_grey", :remote => true %>
|
||||
<%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数", search_tag_attachment_course_files_path(@course, :sort =>"quotes:asc", :tag_name => @tag_name.nil? ? ' ' : @tag_name, :q => @q.nil? ? ' ' : @q),:class => "f_b c_grey", :remote => true %>
|
||||
<%= render partial:'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序
|
||||
<% end %>
|
|
@ -0,0 +1,138 @@
|
|||
<%#= render :partial => 'users/user_resource_info' %>
|
||||
<div class="f16 fb fontBlue mb10">选用资源库中的资源</div>
|
||||
<div class="subjectList fl mr10"> <a href="javascript:void(0);" class="subjectChoose chooseActive fl">公共资源</a> <a href="javascript:void(0);" class="subjectChoose fl">我的资源</a>
|
||||
<input type="text" name="serach" placeholder="输入关键词进行搜索" class="subjectSearch fr" />
|
||||
<div class="cl"></div>
|
||||
<div style="height:441px; min-height:441px; max-height:441px;">
|
||||
<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>
|
||||
<ul class="subjectRow">
|
||||
<li class="subjectName fl hidden">
|
||||
<label>
|
||||
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
|
||||
<span>123456.jpg</span></label>
|
||||
</li>
|
||||
<li class="subjectType fl">课程资源</li>
|
||||
<li class="subjectCount fl">123.0KB</li>
|
||||
<li class="subjectPublisher fl">尹刚</li>
|
||||
<li class="fl subjectDate">2016-01-21</li>
|
||||
</ul>
|
||||
<ul class="subjectRow">
|
||||
<li class="subjectName fl hidden">
|
||||
<label>
|
||||
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
|
||||
<span>123456.jpg</span></label>
|
||||
</li>
|
||||
<li class="subjectType fl">项目资源</li>
|
||||
<li class="subjectCount fl">123.0KB</li>
|
||||
<li class="subjectPublisher fl">尹刚</li>
|
||||
<li class="fl subjectDate">2016-01-21</li>
|
||||
</ul>
|
||||
<ul class="subjectRow">
|
||||
<li class="subjectName fl hidden">
|
||||
<label>
|
||||
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
|
||||
<span>123456.jpg</span></label>
|
||||
</li>
|
||||
<li class="subjectType fl">附件</li>
|
||||
<li class="subjectCount fl">123.0KB</li>
|
||||
<li class="subjectPublisher fl">尹刚</li>
|
||||
<li class="fl subjectDate">2016-01-21</li>
|
||||
</ul>
|
||||
<ul class="subjectRow">
|
||||
<li class="subjectName fl hidden">
|
||||
<label>
|
||||
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
|
||||
<span>123456.jpg</span></label>
|
||||
</li>
|
||||
<li class="subjectType fl">课程资源</li>
|
||||
<li class="subjectCount fl">123.0KB</li>
|
||||
<li class="subjectPublisher fl">尹刚</li>
|
||||
<li class="fl subjectDate">2016-01-21</li>
|
||||
</ul>
|
||||
<ul class="subjectRow">
|
||||
<li class="subjectName fl hidden">
|
||||
<label>
|
||||
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
|
||||
<span>123456.jpg</span></label>
|
||||
</li>
|
||||
<li class="subjectType fl">课程资源</li>
|
||||
<li class="subjectCount fl">123.0KB</li>
|
||||
<li class="subjectPublisher fl">尹刚</li>
|
||||
<li class="fl subjectDate">2016-01-21</li>
|
||||
</ul>
|
||||
<ul class="subjectRow">
|
||||
<li class="subjectName fl hidden">
|
||||
<label>
|
||||
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
|
||||
<span>123456.jpg</span></label>
|
||||
</li>
|
||||
<li class="subjectType fl">课程资源</li>
|
||||
<li class="subjectCount fl">123.0KB</li>
|
||||
<li class="subjectPublisher fl">尹刚</li>
|
||||
<li class="fl subjectDate">2016-01-21</li>
|
||||
</ul>
|
||||
<ul class="subjectRow">
|
||||
<li class="subjectName fl hidden">
|
||||
<label>
|
||||
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
|
||||
<span>123456.jpg</span></label>
|
||||
</li>
|
||||
<li class="subjectType fl">课程资源</li>
|
||||
<li class="subjectCount fl">123.0KB</li>
|
||||
<li class="subjectPublisher fl">尹刚</li>
|
||||
<li class="fl subjectDate">2016-01-21</li>
|
||||
</ul>
|
||||
<ul class="subjectRow">
|
||||
<li class="subjectName fl hidden">
|
||||
<label>
|
||||
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
|
||||
<span>123456.jpg</span></label>
|
||||
</li>
|
||||
<li class="subjectType fl">课程资源</li>
|
||||
<li class="subjectCount fl">123.0KB</li>
|
||||
<li class="subjectPublisher fl">尹刚</li>
|
||||
<li class="fl subjectDate">2016-01-21</li>
|
||||
</ul>
|
||||
<ul class="subjectRow">
|
||||
<li class="subjectName fl hidden">
|
||||
<label>
|
||||
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
|
||||
<span>123456.jpg</span></label>
|
||||
</li>
|
||||
<li class="subjectType fl">课程资源</li>
|
||||
<li class="subjectCount fl">123.0KB</li>
|
||||
<li class="subjectPublisher fl">尹刚</li>
|
||||
<li class="fl subjectDate">2016-01-21</li>
|
||||
</ul>
|
||||
<ul class="subjectRow">
|
||||
<li class="subjectName fl hidden">
|
||||
<label>
|
||||
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
|
||||
<span>123456.jpg</span></label>
|
||||
</li>
|
||||
<li class="subjectType fl">课程资源</li>
|
||||
<li class="subjectCount fl">123.0KB</li>
|
||||
<li class="subjectPublisher fl">尹刚</li>
|
||||
<li class="fl subjectDate">2016-01-21</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="courseSendSubmit mr15"><a href="javascript:void(0);" class="sendSourceText">选用</a></div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText">取消</a></div>
|
||||
<div class="pageRoll mt0">
|
||||
<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">上一页</a></div>
|
||||
<div class="pageCell pageCellActive"><a href="javascript:void(0);" class="c_white">1</a></div>
|
||||
<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">2</a></div>
|
||||
<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">3</a></div>
|
||||
<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">...</a></div>
|
||||
<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">14</a></div>
|
||||
<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">下一页</a></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
|
@ -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,9 +9,17 @@
|
|||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTitle break_word mt-4">
|
||||
<%= link_to truncate(file.filename,length: 35, omission: '...'),
|
||||
<%# 如果有历史版本则提供历史版本下载 %>
|
||||
<% if file.attachment_histories.count == 0 %>
|
||||
<%= link_to file.is_public? ? truncate(file.filename, length: 45) : truncate(file.filename,length: 35, 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 => "c_dblue f_14 f_b f_l" %>
|
||||
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
|
||||
<% else %>
|
||||
<%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id),
|
||||
:title => file.filename+"\n"+file.description.to_s,
|
||||
:class => "linkGrey3 f_14",
|
||||
:style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :remote=>true %>
|
||||
<% end %>
|
||||
<%= file_preview_eye(file, class: 'preview') %>
|
||||
<span id="image_private_<%= file.id%>">
|
||||
<% if file.is_public? == false%>
|
||||
|
@ -25,7 +34,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%> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
<p class="fl ml15 fontGrey2">下载<%= file.downloads%> | 引用<span id="reference_number_<%= file.id %>"><%= file.quotes.nil? ? 0:file.quotes %></span></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
|
@ -40,11 +49,13 @@
|
|||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
||||
<% if file.container.try(:organization).try(:is_public?) %>
|
||||
<li>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
|
||||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link_to( '删除资源', attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" && file.destroyable %>
|
||||
|
@ -65,6 +76,7 @@
|
|||
</div>
|
||||
|
||||
</div><!---re_con_box end-->
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if org_subfield_attachments.count == 10 %>
|
||||
|
|
|
@ -62,10 +62,12 @@
|
|||
<%= form_tag( search_project_project_files_path(@project), method: 'get',:class => "re_search",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "项目内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()", :style =>"width:72px;" %>
|
||||
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||
<%#= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||
<!--REDO: 权限测试-->
|
||||
<% if User.current.member_of?(@project) %>
|
||||
<input class="blueBtn fr mr5" value="上传资源" onclick="project_files_upload();">
|
||||
<%= link_to("导入资源", import_resources_user_path(User.current, :type => 6, :project_id => @project.id), :class => "blue-btn fr mr5", :remote => true) %>
|
||||
<!--<input class="blueBtn fr mr5" value="导入资源" onclick="project_files_import();">-->
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -8,9 +8,17 @@
|
|||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTitle break_word mt-4">
|
||||
<%# 如果有历史版本则提供历史版本下载 %>
|
||||
<% if file.attachment_histories.count == 0 %>
|
||||
<%= link_to truncate(file.filename,length: 35, 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 => "linkBlue f_14 f_b" %>
|
||||
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
|
||||
<% else %>
|
||||
<%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id),
|
||||
:title => file.filename+"\n"+file.description.to_s,
|
||||
:class => "linkGrey3 f_14",
|
||||
:style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :remote=>true %>
|
||||
<% end %>
|
||||
<%= file_preview_eye(file, class: 'preview') %>
|
||||
<span id="image_private_<%= file.id%>">
|
||||
<% if file.is_public? == false%>
|
||||
|
|
|
@ -6,9 +6,17 @@
|
|||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTitle break_word mt-4">
|
||||
<%# 如果有历史版本则提供历史版本下载 %>
|
||||
<% if file.attachment_histories.count == 0 %>
|
||||
<%= link_to truncate(file.filename,length: 35, 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 => "linkBlue f_14 f_b" %>
|
||||
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
|
||||
<% else %>
|
||||
<%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id),
|
||||
:title => file.filename+"\n"+file.description.to_s,
|
||||
:class => "linkGrey3 f_14",
|
||||
:style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :remote=>true %>
|
||||
<% end %>
|
||||
<%= file_preview_eye(file, class: 'preview') %>
|
||||
<span id="image_private_<%= file.id%>">
|
||||
<% if file.is_public? == false%>
|
||||
|
@ -27,6 +35,10 @@
|
|||
<p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<p class="fl ml15 fontGrey2">下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<% unless file.description.blank? %>
|
||||
<div class="cl"></div>
|
||||
<div class="fontGrey2 mb4">资源描述:<%= file.description %></div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<!-- container_type = 1 代表是课程里的资源 -->
|
||||
|
@ -34,15 +46,12 @@
|
|||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
|
||||
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
|
||||
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
<li><%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %></li>
|
||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
||||
|
@ -55,10 +64,10 @@
|
|||
<%end%>
|
||||
<li>
|
||||
<%= link_to( '删除资源', attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<% end %>
|
||||
<%else%>
|
||||
<ul class="resourceSendO">
|
||||
|
|
|
@ -40,9 +40,11 @@
|
|||
<%= form_tag( search_files_in_subfield_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "栏目内搜索", :class => "blueBtn mr5 fl",:style => 'width:72px;',:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %>
|
||||
<%= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||
<%#= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||
<% if User.current.member_of_org?(org_subfield.organization) %>
|
||||
<input class="blueBtn fr mr5" value="上传资源" onclick="org_upload_files(<%= org_subfield.id %>);">
|
||||
<%#= link_to "上传资源",subfield_upload_file_org_subfield_files_path(@org_subfield.id, :in_org => 1),:method => "post",:class=>"blueBtn fr mr5",:remote => true %>
|
||||
<%= link_to("导入资源", import_resources_user_path(User.current, :type => 6, :subfield_file_id => @org_subfield.id), :class => "blue-btn fr mr5", :remote => true) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div><!---re_top end-->
|
||||
<div class="cl"></div>
|
||||
|
@ -53,7 +55,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">共有 <span id="attachment_count"><%= @all_attachments.count %></span> 个资源</p>
|
||||
<p class="f_l fontBlue f_b f_14">共有 <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> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
<% if @order == "asc" %>
|
||||
按 <%= 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"} %> /
|
||||
|
|
|
@ -22,6 +22,14 @@
|
|||
<%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mb5">
|
||||
<label class="fl c_dark f14" style="margin-top: 4px;">附件描述:</label>
|
||||
<div class="fl">
|
||||
<input type="text" name="description" placeholder="文件描述" class="InputBox fl W160">
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<% if User.current.allowed_to?(:as_teacher,course) %>
|
||||
<div class="mb5">
|
||||
<label class="fl c_dark f14" style="margin-top: 4px;">延迟发布:</label>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
<script type='text/javascript'>
|
||||
var slideHeight = 29;
|
||||
function readmore(aNode) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<% if @course %>
|
||||
$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>");
|
||||
$("#course_filter_order").html("<%= escape_javascript(render :partial => 'course_file_filter_order', :locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach, tag_name: @tag_name, q: @q})%>");
|
||||
$("#attachment_count").html("<%= @result.count%>")
|
||||
<% else %>
|
||||
$("#course_list").html("<%= escape_javascript(render :partial => 'project_list',:locals => {project:@project, all_attachments:@result_search_project, sort:@sort, order:@order, project_attachments:@searched_attach}) %>");
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
<script type="text/javascript">
|
||||
<% if @is_in_course == 1 || @course_activity == 1 %>
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
<% end %>
|
||||
function reset_homework(){
|
||||
$("#homework_name").val("");
|
||||
$("#homework_publish_time").val("");
|
||||
|
@ -24,7 +30,7 @@
|
|||
<% end %>
|
||||
}
|
||||
</script>
|
||||
<div class="homepageRightBanner mb10">
|
||||
<div class="homepageRightBanner mb10 <%= (@is_in_course == 1 || @course_activity == 1) ? 'ml10' : '' %>">
|
||||
<div class="NewsBannerName">编辑作业</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
<%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %>
|
||||
</div>
|
||||
<span nhname='contentmsg_<%= @issue.id %>' class="fl"></span>
|
||||
<a id="new_message_submit_btn_<%= @issue.id %>" href="javascript:void(0)" class="blue_n_btn fr mt5" style="display:none;">发送</a>
|
||||
<a id="new_message_submit_btn_<%= @issue.id %>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr mt5" style="display:none;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @issue.id%>' name="notes"></textarea>
|
||||
<div class="cl"></div>
|
||||
<span nhname='contentmsg_<%= @issue.id%>' class="fl"></span>
|
||||
<a id="new_message_submit_btn_<%= @issue.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<a id="new_message_submit_btn_<%= @issue.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#Container").css("width","1000px");
|
||||
is_edit = <%= @is_edit.present? && @is_edit == true %>
|
||||
if(is_edit) {
|
||||
issueEditShow();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<div class="homepageRight mt0 ml10" >
|
||||
|
|
|
@ -8,10 +8,16 @@
|
|||
<%= link_to "首页",user_activities_path(User.current.id), :class => "c_white f16 db p10", :title => "回到个人首页"%>
|
||||
</li>
|
||||
<li class="navHomepageMenu fl">
|
||||
<a href="<%=url_for(:controller => 'users', :action => 'user_resource',:id=>User.current.id,:type=>1)%>" class="c_white f16 db p10">资源库</a></li>
|
||||
<a href="<%=url_for(:controller => 'users', :action => 'user_resource', :id => User.current.id, :type => 6) %>" class="c_white f16 db p10">资源库</a></li>
|
||||
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "作业", user_homeworks_user_path(User.current.id), :class => "c_white f16 db p10"%>
|
||||
<%= link_to "题库", user_homeworks_user_path(User.current.id), :class => "c_white f16 db p10"%>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="navHomepageMenu fl">
|
||||
<%= link_to "我的作业", student_homeworks_user_path(User.current.id), :class => "c_white f16 db p10"%>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="navHomepageMenu fl mr30">
|
||||
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>
|
||||
</li>
|
||||
|
@ -94,7 +100,7 @@
|
|||
</li>
|
||||
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
|
||||
<li>
|
||||
<%= link_to "退出",signout_path,:class => "menuGrey",:method => "post"%>
|
||||
<%= link_to "退出",logout_url_without_domain,:class => "menuGrey",:method => "post"%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
@ -103,7 +109,7 @@
|
|||
|
||||
<div class="navHomepageNews">
|
||||
<%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon", :target =>"_Blank", :title => "您的所有消息" %>
|
||||
<% if User.current.count_new_message >0 %>
|
||||
<% if User.current.count_new_message.to_i >0 %>
|
||||
<div ><%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target =>"_Blank" %></div>
|
||||
<% end %>
|
||||
<%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<% courses.each do |course|%>
|
||||
<%# pro = Project.find course.course_id %>
|
||||
<li class="homepageLeftMenuCoursesLine" style="position:relative;">
|
||||
<%= link_to course.name, course_path(course.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden", :title => course.name%>
|
||||
<%= link_to course.name, course_url_in_org(course.id), :class => "coursesLineGrey hidden", :title => course.name%>
|
||||
<!--<div class="homepagePostSetting mt5 mr10">-->
|
||||
<!--<ul>-->
|
||||
<!--<li class="menuSetting">-->
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<% projects.each do |project|%>
|
||||
<%# pro = Project.find project.project_id %>
|
||||
<li class="homepageLeftMenuCoursesLine" style="position:relative;">
|
||||
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden", :title => project.name%>
|
||||
<%= link_to project.name, project_url_in_org(project.id), :class => "coursesLineGrey hidden", :title => project.name%>
|
||||
<!--<div class="homepagePostSetting mt5 mr10">-->
|
||||
<!--<ul>-->
|
||||
<!--<li class="menuSetting">-->
|
||||
|
|
|
@ -77,10 +77,10 @@
|
|||
|
||||
</div>
|
||||
<div id="loginInButton" class="fr ml20">
|
||||
<a href="<%= signin_path(:login=>true) %>" class="c_white db">登录</a>
|
||||
<a href="<%= signin_url_without_domain %>" class="c_white db">登录</a>
|
||||
</div>
|
||||
<div id="loginSignButton" class="fr">
|
||||
<a href="<%= signin_path(:login=>false) %>" class="c_white db">注册</a>
|
||||
<a href="<%= register_url_without_domain %>" class="c_white db">注册</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<% courses.each do |course|%>
|
||||
<li class="homepageLeftMenuCoursesLine pr">
|
||||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
|
||||
<%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
|
||||
:id => "show_course_#{course.id}",:title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"("+current_time_and_term(course)+")"%>
|
||||
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
|
||||
:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"("+current_time_and_term(course)+")"%>
|
||||
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
|
||||
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
|
||||
<li>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<% projects.each do |project|%>
|
||||
<li class="homepageLeftMenuCoursesLine pr">
|
||||
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count %>
|
||||
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :class => "coursesLineGrey hidden",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
|
||||
<%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "coursesLineGrey hidden",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
|
||||
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
|
||||
<li>
|
||||
<ul class="subNavMenu boxShadow">
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<% homework_num = @course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
|
||||
<% end %>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>
|
||||
|
@ -85,7 +85,7 @@
|
|||
<% end %>
|
||||
<% unless show_nav?(@course.news.count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_news), course_news_index_path(@course), :class => "f14 c_blue02" %>
|
||||
<%= link_to "通知", course_news_index_path(@course), :class => "f14 c_blue02" %>
|
||||
<%= link_to "(#{@course.news.count})", course_news_index_path(@course), :class => "subnav_num c_orange"%>
|
||||
<%= link_to( "", new_course_news_path(@course,:is_new=>1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
|
||||
</div>
|
||||
|
@ -104,7 +104,7 @@
|
|||
<div class="subNav">
|
||||
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02" %>
|
||||
<%= link_to "(#{@course.boards.first ? (@course.boards.first.topics.count + Message.where("board_id =? and parent_id is not ?", @course.boards.first.id, nil).count) : 0})", course_boards_path(@course), :class => "subnav_num c_orange" %>
|
||||
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") if User.current.member_of_course?(@course) && @course.boards.first %>
|
||||
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% unless show_nav?(course_feedback_count) %>
|
||||
|
@ -142,29 +142,61 @@
|
|||
<div class="cl"></div>
|
||||
<% unless contributor_course_scor(@course.id).count == 0 %>
|
||||
<ul class="rankList">
|
||||
<h4>课程活跃度</h4>
|
||||
<h4>课程活跃度
|
||||
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor: pointer; position:relative;">积分规则</a>
|
||||
</h4>
|
||||
<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| %>
|
||||
<% unless contributor_score.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>
|
||||
<% total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 +
|
||||
contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 +
|
||||
+ 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><%=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"><%= contributor_score.total_score.to_i %></a></span></p>
|
||||
<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">
|
||||
<% unless contributor_score.resource_num == 0 %>
|
||||
课程资源:<%= contributor_score.resource_num %><br />
|
||||
<% end %>
|
||||
<% unless contributor_score.message_num == 0 %>
|
||||
课程讨论:<%= contributor_score.message_num %><br />
|
||||
<% end %>
|
||||
<% unless contributor_score.message_reply_num == 0 %>
|
||||
评论回复:<%= contributor_score.message_reply_num %><br />
|
||||
<% end %>
|
||||
<% unless contributor_score.journal_num == 0 %>
|
||||
课程留言:<%= contributor_score.journal_num %><br />
|
||||
<% end %>
|
||||
<% unless contributor_score.news_reply_num == 0 %>
|
||||
课程通知:<%= contributor_score.news_reply_num %><br />
|
||||
<% end %>
|
||||
<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>
|
||||
<%# end %>
|
||||
<%# unless contributor_score.message_num.to_i == 0 %>
|
||||
问答发布数 x 2 = <%= contributor_score.message_num.to_i %> x 2 = <%= contributor_score.message_num.to_i * 2 %></br>
|
||||
通知发布数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %></br>
|
||||
<%# end %>
|
||||
<%# unless contributor_score.message_reply_num.to_i == 0 %>
|
||||
问答回帖数 x 1 = <%= contributor_score.message_reply_num.to_i %> x 1 = <%= contributor_score.message_reply_num.to_i %></br>
|
||||
作业留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %></br>
|
||||
通知留言数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %></br>
|
||||
<%# end %>
|
||||
<%# unless contributor_score.journal_num.to_i == 0 %>
|
||||
课程留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %></br>
|
||||
<%# end %>
|
||||
<%# unless contributor_score.homework_journal_num.to_i == 0 %>
|
||||
|
||||
<%# end %>
|
||||
<%# unless contributor_score.news_reply_num.to_i == 0 %>
|
||||
|
||||
|
||||
<%# end %>
|
||||
总得分:<%=total_score %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</li>
|
||||
<% end %>
|
||||
|
@ -176,12 +208,18 @@
|
|||
<% hero_homework_scores = hero_homework_score(@course, "desc") %>
|
||||
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
|
||||
<ul class="rankList">
|
||||
<h4>课程英雄榜</h4>
|
||||
<h4><span>课程英雄榜</span>
|
||||
<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>
|
||||
<p><a href="javascript:void:(0);"><%=link_to student_score.user.show_name, user_path(student_score.user), :title => student_score.user.show_name %></a></p>
|
||||
<p><span class="c_red" style="cursor:pointer" title="作业总分:<%= format("%.1f",student_score.score<0 ? 0 : student_score.score) %>"><%= student_score.score<0 ? 0 : student_score.score.to_i %></span></p>
|
||||
<p><span class="c_red" style="cursor:pointer" ><%= student_score.score<0 ? 0 : student_score.score.to_i %></span></p>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -189,6 +227,7 @@
|
|||
</ul>
|
||||
<% end %>
|
||||
|
||||
<% if @course.description && !@course.description.blank? %>
|
||||
<div class="project_intro">
|
||||
<div id="course_description" class="course_description">
|
||||
<h4 ><%= l(:label_course_brief_introduction)%>:</h4>
|
||||
|
@ -203,6 +242,7 @@
|
|||
</span>
|
||||
</div>
|
||||
</div><!--项目简介 end-->
|
||||
<% end %>
|
||||
<div class="project_Label">
|
||||
<h4 class="mb5" ><%= l(:label_tag)%>:</h4>
|
||||
<div class="tag_h" >
|
||||
|
@ -212,6 +252,7 @@
|
|||
</div><!--项目标签 end-->
|
||||
<!--课程推荐-->
|
||||
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
|
||||
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @course.visits.to_i %></div>
|
||||
</div><!--LSide end-->
|
||||
|
||||
<div id="RSide" class="fl">
|
||||
|
@ -280,7 +321,7 @@
|
|||
}
|
||||
|
||||
})
|
||||
|
||||
//资源库上传附件
|
||||
function course_files_upload(){
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/upload_course_files',:locals => {:course => @course,:course_attachment_type => 1}) %>');
|
||||
showModal('ajax-modal', '513px');
|
||||
|
@ -300,6 +341,16 @@
|
|||
obj.parent().parent().next("div").hide();
|
||||
}
|
||||
|
||||
function message_titile_show2(obj,e)
|
||||
{
|
||||
obj.parent().next("div").show();
|
||||
obj.parent().next("div").css("top",e.pageY).css("left",e.pageX).css("position","absolute");
|
||||
}
|
||||
function message_titile_hide2(obj)
|
||||
{
|
||||
obj.parent().next("div").hide();
|
||||
}
|
||||
|
||||
$("#expand_tools_expand").click(function(){
|
||||
$("#navContentCourse").toggle();
|
||||
});
|
||||
|
|
|
@ -44,14 +44,14 @@
|
|||
</li>
|
||||
<% if User.current.logged? %>
|
||||
<li class="navOrgMenu fr" id="orgUser" style="cursor:pointer;">
|
||||
<%= link_to image_tag(url_to_avatar(User.current),:width => '23',:height => '23'), request.local? ? user_path(User.current):("https://www.trustie.net/users/" + User.current.id.to_s),:alt => '用户头像', :target => '_blank',:style=>'border-radius:3px; vertical-align:top; margin-top:3px; display:inline-block; margin-right:3px;' %>
|
||||
<%= link_to User.current, (request.local? || request.subdomain.blank?) ? user_path(User.current):("https://www.trustie.net/users/" + User.current.id.to_s),:id => "orgUserName",:class => 'fontGrey2 f14 mr5',:target => '_blank' %>
|
||||
<%= link_to "退出",(request.local? || request.subdomain.blank?) ? signout_path():"https://www.trustie.net/logout", :class =>"menuGrey", :method => 'post', :rel => "nofollow" %>
|
||||
<%= link_to image_tag(url_to_avatar(User.current),:width => '23',:height => '23'), user_url_in_org(User.current.id),:alt => '用户头像', :target => '_blank',:style=>'border-radius:3px; vertical-align:top; margin-top:3px; display:inline-block; margin-right:3px;' %>
|
||||
<%= link_to User.current, user_url_in_org(User.current.id),:id => "orgUserName",:class => 'fontGrey2 f14 mr5',:target => '_blank' %>
|
||||
<%= link_to "退出",logout_url_without_domain, :class =>"menuGrey", :method => 'post', :rel => "nofollow" %>
|
||||
</li>
|
||||
<!--<li class="navOrgMenu fr"><%#=link_to User.current, user_path(User.current), :class => "linkGrey8 f14" %></li>-->
|
||||
<% else %>
|
||||
<li class="navOrgMenu fr"><a href="<%= (request.local? || request.subdomain.blank?) ? signin_path(:login=>true):'https://www.trustie.net/login?login=true' %>" class="linkGrey8 f14">登录</a></li>
|
||||
<li class="navOrgMenu fr"><a href="<%= (request.local? || request.subdomain.blank?) ? signin_path(:login=>false):'https://www.trustie.net/login?login=false' %>" class="linkGrey8 f14 mr15">注册</a></li>
|
||||
<li class="navOrgMenu fr"><a href="<%= signin_url_without_domain %>" class="linkGrey8 f14">登录</a></li>
|
||||
<li class="navOrgMenu fr"><a href="<%= register_url_without_domain %>" class="linkGrey8 f14 mr15">注册</a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<!--<div class="navHomepageProfile">
|
||||
|
@ -132,6 +132,7 @@
|
|||
<div class="homepageLeftMenuContainer" id="sub_field_left_lists">
|
||||
<%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %>
|
||||
</div>
|
||||
<div class="fontGrey5 mt10 ml20">访问计数 <%= @organization.visits.to_i %></div>
|
||||
</div>
|
||||
<div class="homepageRight" style="margin-top:<%= (params[:show_homepage].nil? && User.current.logged?) ? '10px':'0px' %>;">
|
||||
<%= render_flash_messages %>
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
<!-- 项目得分 -->
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<%= link_to l(:label_project_name)+"#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %>
|
||||
<%= link_to "#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %>
|
||||
<% if @project.is_public? %>
|
||||
<span class="img_private"><%= l(:label_public)%></span>
|
||||
<% else %>
|
||||
|
@ -158,9 +158,12 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--项目标签 end-->
|
||||
|
||||
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @project.visits.to_i %></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="RSide" class="fl">
|
||||
<%= render_flash_messages %>
|
||||
<%= yield %>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue