Merge remote-tracking branch 'origin/szzh' into szzh
Conflicts: db/schema.rb
This commit is contained in:
commit
949356c37b
|
@ -5,6 +5,7 @@
|
|||
*.swp
|
||||
/config/database.yml
|
||||
/config/configuration.yml
|
||||
/config/additional_environment.rb
|
||||
|
||||
/files/*
|
||||
/log/*
|
||||
|
|
5
Gemfile
5
Gemfile
|
@ -6,10 +6,7 @@ unless RUBY_PLATFORM =~ /w32/
|
|||
gem 'iconv'
|
||||
end
|
||||
|
||||
source 'http://rubygems.oneapm.com' do
|
||||
gem 'oneapm_rpm'
|
||||
end
|
||||
|
||||
gem 'rest-client'
|
||||
gem "mysql2", "= 0.3.18"
|
||||
gem 'redis-rails'
|
||||
gem 'rubyzip'
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
class ActivityNotifysController < ApplicationController
|
||||
# layout 'base_projects'#by young
|
||||
# default_search_scope :messages
|
||||
before_filter :find_project_by_project_id#, :find_board_if_available
|
||||
# before_filter :authorize, :except => [:new, :show, :create, :index]
|
||||
# accept_rss_auth :index, :show
|
||||
|
||||
helper :activities
|
||||
def index
|
||||
query = nil
|
||||
if @course
|
||||
query = ActivityNotify.where('activity_container_id=? and activity_container_type=? and notify_to=?',@course.id,'Course',User.current.id);
|
||||
else
|
||||
@events_by_day = []
|
||||
end
|
||||
|
||||
if( query != nil )
|
||||
limit = 10;
|
||||
@obj_count = query.count();
|
||||
@obj_pages = Paginator.new @obj_count,limit,params['page']
|
||||
list = query.order('is_read,id desc').limit(limit).offset(@obj_pages.offset).all();
|
||||
events=[];
|
||||
for item in list
|
||||
event = item.activity;
|
||||
event.set_notify_id(item.id)
|
||||
event.set_notify_is_read(item.is_read)
|
||||
events << event
|
||||
end
|
||||
@events_by_day = events.group_by {|event| User.current.time_to_date(event.event_datetime)}
|
||||
@controller_name = 'ActivityNotifys'
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html {render :template => 'courses/show', :layout => 'base_courses'}
|
||||
end
|
||||
end
|
||||
|
||||
def chang_read_flag
|
||||
if @course
|
||||
if(params[:an_id] != nil )
|
||||
query = ActivityNotify.where('id=? and notify_to=?',params[:an_id],User.current.id)
|
||||
else
|
||||
query = ActivityNotify.where('activity_container_id=? and activity_container_type=? and notify_to=? and is_read=0',@course.id,'Course',User.current.id)
|
||||
end
|
||||
@result = query.update_all('is_read=1');
|
||||
else
|
||||
@result = false;
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html{render :layout => nil}
|
||||
end
|
||||
end
|
||||
end
|
|
@ -62,24 +62,47 @@ class AttachmentsController < ApplicationController
|
|||
render :action => 'file'
|
||||
end
|
||||
|
||||
def pdf?(file)
|
||||
file.downcase.end_with?(".pdf")
|
||||
end
|
||||
|
||||
def direct_download
|
||||
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
|
||||
:type => detect_content_type(@attachment),
|
||||
:disposition => 'attachment' #inline can open in browser
|
||||
end
|
||||
|
||||
def download
|
||||
# modify by nwb
|
||||
# 下载添加权限设置
|
||||
candown = attachment_candown @attachment
|
||||
candown = attachment_candown @attachment
|
||||
if candown || User.current.admin? || User.current.id == @attachment.author_id
|
||||
@attachment.increment_download
|
||||
if stale?(:etag => @attachment.digest)
|
||||
send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename),
|
||||
:type => detect_content_type(@attachment),
|
||||
:disposition => 'attachment' #inline can open in browser
|
||||
if params[:force] == 'true'
|
||||
direct_download
|
||||
else
|
||||
convered_file = @attachment.diskfile
|
||||
#如果本身不是pdf文件,则先寻找是不是已转换化,如果没有则转化
|
||||
unless pdf?(convered_file)
|
||||
convered_file = File.join(Rails.root, "files", "convered_office", @attachment.disk_filename + ".pdf")
|
||||
unless File.exist?(convered_file)
|
||||
office = Trustie::Utils::Office.new(@attachment.diskfile)
|
||||
office.conver(convered_file)
|
||||
end
|
||||
end
|
||||
if File.exist?(convered_file) && pdf?(convered_file)
|
||||
send_file convered_file, :type => 'application/pdf; charset=utf-8', :disposition => 'inline'
|
||||
else
|
||||
direct_download
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
render_403 :message => :notice_not_authorized
|
||||
end
|
||||
|
||||
rescue => e
|
||||
redirect_to "http: //" + (Setting.host_name.to_s) +"/file_not_found.html"
|
||||
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
|
||||
end
|
||||
|
||||
#更新资源文件类型
|
||||
|
@ -188,9 +211,19 @@ class AttachmentsController < ApplicationController
|
|||
if !@attachment.container.nil? &&
|
||||
(@attachment.container.is_a?(Course) || ((@attachment.container.has_attribute?(:course) || @attachment.container.has_attribute?(:course_id) ) &&
|
||||
@attachment.container.course ) || ((@attachment.container.has_attribute?(:board) || @attachment.container.has_attribute?(:board_id)) &&
|
||||
@attachment.container.board && @attachment.container.board.course ) )
|
||||
@attachment.container.board && @attachment.container.board.course ) || @attachment.container.is_a?(StudentWorksScore) || @attachment.container.is_a?(HomeworkCommon) ||
|
||||
@attachment.container.is_a?(StudentWork))
|
||||
if @attachment.container.is_a?(News)
|
||||
format.html { redirect_to_referer_or news_path(@attachment.container) }
|
||||
elsif @attachment.container.is_a?(StudentWorksScore)
|
||||
@is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据,js刷新页面
|
||||
format.js
|
||||
elsif @attachment.container.is_a?(HomeworkCommon)
|
||||
@is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据,js刷新页面
|
||||
format.js
|
||||
elsif @attachment.container.is_a?(StudentWork)
|
||||
@is_destroy = true unless params[:attachment_id] #根据ID删除页面对应的数据,js刷新页面
|
||||
format.js
|
||||
elsif @attachment.container.is_a?(Message)
|
||||
format.html { redirect_to_referer_or new_board_message_path(@attachment.container) }
|
||||
elsif @course.nil?
|
||||
|
@ -213,7 +246,7 @@ class AttachmentsController < ApplicationController
|
|||
end
|
||||
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def delete_homework
|
||||
|
@ -428,7 +461,7 @@ private
|
|||
@attachment.container.board.course)
|
||||
@course = @attachment.container.board.course
|
||||
else
|
||||
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion'
|
||||
unless @attachment.container_type == 'Bid' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork'
|
||||
@project = @attachment.project
|
||||
end
|
||||
end
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -88,14 +88,40 @@ class BoardsController < ApplicationController
|
|||
preload(:author, {:last_reply => :author}).
|
||||
all
|
||||
elsif @course
|
||||
board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc").
|
||||
includes(:last_reply).
|
||||
# limit(@topic_pages.per_page).
|
||||
# offset(@topic_pages.offset).
|
||||
|
||||
preload(:author, {:last_reply => :author}).
|
||||
all : []
|
||||
@topics = paginateHelper board_topics,10
|
||||
#
|
||||
# board_topics = @board ? @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc").
|
||||
# includes(:last_reply).
|
||||
# # limit(@topic_pages.per_page).
|
||||
# # offset(@topic_pages.offset).
|
||||
#
|
||||
# preload(:author, {:last_reply => :author}).
|
||||
# all : []
|
||||
# @topics = paginateHelper board_topics,10
|
||||
if( @board )
|
||||
limit = 10;
|
||||
pageno = params[:page];
|
||||
if(pageno == nil || pageno=='')
|
||||
dw_topic = nil;
|
||||
if( params[:parent_id]!=nil && params[:parent_id]!='' )
|
||||
dw_topic = @board.topics.where(id:params[:parent_id]).first();
|
||||
end
|
||||
if( dw_topic != nil )
|
||||
dw_count = @board.topics.where('(sticky>?) or (sticky=? and created_on>?)',dw_topic.sticky,dw_topic.sticky,dw_topic.created_on).count();
|
||||
dw_count = dw_count+1;
|
||||
pageno = dw_count%10==0 ? (dw_count/limit) : (dw_count/limit+1)
|
||||
end
|
||||
end
|
||||
if(pageno == nil || pageno=='')
|
||||
pageno=1;
|
||||
end
|
||||
@topic_count = @board.topics.count();
|
||||
@topic_pages = Paginator.new @topic_count, limit, pageno
|
||||
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, #{Message.table_name}.created_on desc").
|
||||
limit(limit).offset(@topic_pages.offset).includes(:last_reply).
|
||||
preload(:author, {:last_reply => :author}).all();
|
||||
else
|
||||
@topics = [];
|
||||
end
|
||||
end
|
||||
|
||||
@message = Message.new(:board => @board)
|
||||
|
@ -103,6 +129,7 @@ class BoardsController < ApplicationController
|
|||
if @project
|
||||
render :action => 'show', :layout => 'base_projects'
|
||||
elsif @course
|
||||
@params=params
|
||||
render :action => 'show', :layout => 'base_courses'
|
||||
end
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ class CoursesController < ApplicationController
|
|||
helper :members
|
||||
helper :words
|
||||
helper :attachments
|
||||
helper :activity_notifys
|
||||
|
||||
before_filter :auth_login1, :only => [:show, :feedback]
|
||||
menu_item :overview
|
||||
|
@ -298,7 +299,6 @@ class CoursesController < ApplicationController
|
|||
else
|
||||
page_from = params[:page].nil? ? 0 : (params[:page].to_i - 1)
|
||||
@results = student_homework_score(0,page_from, 10,"desc")
|
||||
@results = paginateHelper_for_members @results, 10
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -317,14 +317,11 @@ class CoursesController < ApplicationController
|
|||
when '1'
|
||||
@subPage_title = l :label_teacher_list
|
||||
@all_members = searchTeacherAndAssistant(@course)
|
||||
#@members = paginateHelper @all_members, 10
|
||||
@members = @all_members
|
||||
when '2'
|
||||
@subPage_title = l :label_student_list
|
||||
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
|
||||
@all_members = student_homework_score(0,page, 10,"desc")
|
||||
# @all_members = @course.members
|
||||
# @members = paginateHelper_for_members @all_members, 10
|
||||
@members = @all_members
|
||||
end
|
||||
respond_to do |format|
|
||||
|
@ -379,11 +376,9 @@ class CoursesController < ApplicationController
|
|||
if group_id == '0'
|
||||
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
|
||||
@results = student_homework_score(0,page, 10,@score_sort_by)
|
||||
@results = paginateHelper_for_members @results, 10
|
||||
else
|
||||
@group = CourseGroup.find(group_id)
|
||||
@results = student_homework_score(group_id, 0, 0,@score_sort_by)
|
||||
@results = paginateHelper @results, 10
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -612,32 +607,6 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def homework
|
||||
if @course.is_public != 0 || User.current.member_of_course?(@course) || User.current.admin?
|
||||
bids = @course.homeworks.order('created_on DESC')
|
||||
bids = bids.like(params[:name]) if params[:name].present?
|
||||
@bids = paginateHelper bids,10
|
||||
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
|
||||
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
|
||||
render :layout => 'base_courses'
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
# 新建作业
|
||||
def new_homework
|
||||
@homework = Bid.new
|
||||
@homework.safe_attributes = params[:bid]
|
||||
@homework.open_anonymous_evaluation = 1
|
||||
@homework.deadline = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
if (User.current.logged? && User.current.member_of_course?(Course.find params[:id] ))
|
||||
render :layout => 'base_courses'
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def toggleCourse
|
||||
@course_prefs = Course.find_by_extra(@course.extra)
|
||||
unless (@course_prefs.teacher == User.current || User.current.admin?)
|
||||
|
@ -712,8 +681,8 @@ class CoursesController < ApplicationController
|
|||
"show_course_news" => true,
|
||||
"show_course_messages" => true,
|
||||
#"show_course_journals_for_messages" => true,
|
||||
"show_bids" => true,
|
||||
"show_homeworks" => true,
|
||||
# "show_bids" => true,
|
||||
# "show_homeworks" => true,
|
||||
"show_polls" => true
|
||||
}
|
||||
@date_to ||= Date.today + 1
|
||||
|
@ -863,44 +832,32 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
|
||||
def student_homework_score(groupid,start_from, nums, score_sort_by)
|
||||
#teachers = find_course_teachers(@course)
|
||||
start_from = start_from * nums
|
||||
sql_select = ""
|
||||
if groupid == 0
|
||||
if nums == 0
|
||||
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
|
||||
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
|
||||
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id}) GROUP BY members.user_id
|
||||
UNION all
|
||||
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id} AND
|
||||
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
|
||||
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
|
||||
)
|
||||
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
|
||||
else
|
||||
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
|
||||
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
|
||||
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id}) GROUP BY members.user_id
|
||||
UNION all
|
||||
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id} AND
|
||||
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
|
||||
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
|
||||
)
|
||||
GROUP BY members.user_id ORDER BY score #{score_sort_by} " #limit #{start_from}, #{nums}"
|
||||
|
||||
end
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(student_works.final_score)
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{@course.id}
|
||||
AND student_works.user_id = members.user_id
|
||||
) AS score
|
||||
FROM members
|
||||
JOIN students_for_courses
|
||||
ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id
|
||||
WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}"
|
||||
else
|
||||
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
|
||||
WHERE members.course_id = #{@course.id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{@course.id}) AND members.user_id = homework_attaches.user_id
|
||||
and members.course_group_id = #{groupid} AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id})
|
||||
GROUP BY members.user_id
|
||||
UNION all
|
||||
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{@course.id}
|
||||
and members.course_group_id = #{groupid} AND
|
||||
students_for_courses.course_id = #{@course.id} and members.user_id = students_for_courses.student_id AND
|
||||
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{@course.id} )
|
||||
)
|
||||
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(student_works.final_score)
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{@course.id}
|
||||
AND student_works.user_id = members.user_id
|
||||
) AS score
|
||||
FROM members
|
||||
JOIN students_for_courses
|
||||
ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id
|
||||
WHERE members.course_id = #{@course.id} AND members.course_group_id = #{groupid} ORDER BY score #{score_sort_by}"
|
||||
end
|
||||
sql = ActiveRecord::Base.connection()
|
||||
homework_scores = Member.find_by_sql(sql_select)
|
||||
|
@ -922,7 +879,6 @@ class CoursesController < ApplicationController
|
|||
@score_sort_by = "desc"
|
||||
page_from = params[:page].nil? ? 0 : (params[:page].to_i - 1)
|
||||
@results = student_homework_score(group.id,0,0, "desc")
|
||||
@results = paginateHelper @results, 10
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -334,9 +334,8 @@ class HomeworkAttachController < ApplicationController
|
|||
@homework.name = name
|
||||
@homework.description = description
|
||||
@homework.project_id = params[:project_id] || 0
|
||||
if params[:attachments]
|
||||
@homework.save_attachments(params[:attachments])
|
||||
end
|
||||
@homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@homework)
|
||||
if @homework.save
|
||||
respond_to do |format|
|
||||
format.html { redirect_to course_for_bid_url @homework.bid }
|
||||
|
|
|
@ -0,0 +1,210 @@
|
|||
class HomeworkCommonController < ApplicationController
|
||||
layout "base_courses"
|
||||
before_filter :find_course, :only => [:index,:new,:create]
|
||||
before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy]
|
||||
before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment]
|
||||
|
||||
def index
|
||||
homeworks = @course.homework_commons.order("created_at desc")
|
||||
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
|
||||
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
|
||||
@homeworks = paginateHelper homeworks,20
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@homework = HomeworkCommon.new
|
||||
@homework.safe_attributes = params[:homework_common]
|
||||
@homework.late_penalty = 0
|
||||
@homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
@homework.publish_time = Time.now.strftime('%Y-%m-%d')
|
||||
|
||||
#匿评作业相关属性
|
||||
@homework_detail_manual = HomeworkDetailManual.new
|
||||
@homework_detail_manual.ta_proportion = 0.6
|
||||
@homework_detail_manual.absence_penalty = 0
|
||||
@homework_detail_manual.evaluation_num = 3
|
||||
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
|
||||
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
|
||||
@homework.homework_detail_manual = @homework_detail_manual
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
if params[:homework_common]
|
||||
homework = HomeworkCommon.new
|
||||
homework.name = params[:homework_common][:name]
|
||||
homework.description = params[:homework_common][:description]
|
||||
homework.end_time = params[:homework_common][:end_time]
|
||||
homework.publish_time = params[:homework_common][:publish_time]
|
||||
homework.homework_type = params[:homework_common][:homework_type]
|
||||
homework.late_penalty = params[:late_penalty]
|
||||
homework.user_id = User.current.id
|
||||
homework.course_id = @course.id
|
||||
|
||||
homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(homework)
|
||||
|
||||
#匿评作业相关属性
|
||||
homework_detail_manual = HomeworkDetailManual.new
|
||||
homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
|
||||
homework_detail_manual.comment_status = 1
|
||||
homework_detail_manual.evaluation_start = params[:evaluation_start]
|
||||
homework_detail_manual.evaluation_end = params[:evaluation_end]
|
||||
homework_detail_manual.evaluation_num = params[:evaluation_num]
|
||||
homework_detail_manual.absence_penalty = params[:absence_penalty]
|
||||
homework.homework_detail_manual = homework_detail_manual
|
||||
|
||||
if homework.save
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to homework_common_index_path(:course => @course.id)
|
||||
}
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_failed_create)
|
||||
redirect_to new_homework_common_path(:course => @course.id)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@homework.name = params[:homework_common][:name]
|
||||
@homework.description = params[:homework_common][:description]
|
||||
@homework.end_time = params[:homework_common][:end_time]
|
||||
@homework.publish_time = params[:homework_common][:publish_time]
|
||||
@homework.homework_type = params[:homework_common][:homework_type]
|
||||
@homework.late_penalty = params[:late_penalty]
|
||||
@homework.user_id = User.current.id
|
||||
@homework.course_id = @course.id
|
||||
|
||||
#匿评作业相关属性
|
||||
@homework_detail_manual.ta_proportion = params[:ta_proportion] || 0.6
|
||||
@homework_detail_manual.evaluation_start = params[:evaluation_start]
|
||||
@homework_detail_manual.evaluation_end = params[:evaluation_end]
|
||||
@homework_detail_manual.evaluation_num = params[:evaluation_num]
|
||||
@homework_detail_manual.absence_penalty = params[:absence_penalty]
|
||||
|
||||
@homework.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@homework)
|
||||
|
||||
if @homework.save && @homework_detail_manual.save
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_edit)
|
||||
redirect_to homework_common_index_path(:course => @course.id)
|
||||
}
|
||||
end
|
||||
return
|
||||
else
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_failed_edit)
|
||||
redirect_to edit_homework_common_path(@homework)
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @homework.destroy
|
||||
respond_to do |format|
|
||||
format.html {redirect_to homework_common_index_path(:course => @course.id)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#开启匿评
|
||||
#statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限
|
||||
def start_anonymous_comment
|
||||
@statue =4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
|
||||
if @homework_detail_manual.comment_status == 1
|
||||
student_works = @homework.student_works
|
||||
if student_works && student_works.size >=2
|
||||
student_works.each_with_index do |work, index|
|
||||
user = work.user
|
||||
n = @homework_detail_manual.evaluation_num
|
||||
n = n < student_works.size ? n : student_works.size - 1
|
||||
assigned_homeworks = get_assigned_homeworks(student_works, n, index)
|
||||
assigned_homeworks.each do |h|
|
||||
student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
|
||||
student_works_evaluation_distributions.save
|
||||
end
|
||||
end
|
||||
@homework_detail_manual.update_column('comment_status', 2)
|
||||
@statue = 1
|
||||
else
|
||||
@statue = 2
|
||||
end
|
||||
else
|
||||
@statue = 3
|
||||
end
|
||||
end
|
||||
|
||||
#关闭匿评
|
||||
def stop_anonymous_comment
|
||||
@homework_detail_manual.update_column('comment_status', 3)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#提示
|
||||
def alert_anonymous_comment
|
||||
@cur_size = 0
|
||||
@totle_size = 0
|
||||
if @homework_detail_manual.comment_status == 1
|
||||
@totle_size = @course.student.count
|
||||
@cur_size = @homework.student_works.size
|
||||
elsif @homework_detail_manual.comment_status == 2
|
||||
@homework.student_works.map { |work| @totle_size += work.student_works_evaluation_distributions.count}
|
||||
@cur_size = 0
|
||||
@homework.student_works.map { |work| @cur_size += work.student_works_scores.where(:reviewer_role => 3).count}
|
||||
end
|
||||
@percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
#获取课程
|
||||
def find_course
|
||||
@course = Course.find params[:course]
|
||||
rescue
|
||||
render_404
|
||||
end
|
||||
#获取作业
|
||||
def find_homework
|
||||
@homework = HomeworkCommon.find params[:id]
|
||||
@homework_detail_manual = @homework.homework_detail_manual
|
||||
@course = @homework.course
|
||||
rescue
|
||||
render_404
|
||||
end
|
||||
#是不是课程的老师
|
||||
def teacher_of_course
|
||||
render_403 unless User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
end
|
||||
|
||||
def get_assigned_homeworks(student_works, n, index)
|
||||
student_works += student_works
|
||||
student_works[index + 1 .. index + n]
|
||||
end
|
||||
end
|
|
@ -31,6 +31,8 @@ class MessagesController < ApplicationController
|
|||
include AttachmentsHelper
|
||||
helper :project_score
|
||||
|
||||
include CoursesHelper
|
||||
|
||||
REPLIES_PER_PAGE = 25 unless const_defined?(:REPLIES_PER_PAGE)
|
||||
|
||||
# Show a topic and its replies
|
||||
|
@ -91,6 +93,29 @@ class MessagesController < ApplicationController
|
|||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE
|
||||
end
|
||||
# 与我相关动态的记录add start
|
||||
if(@board && @board.course) #项目的先不管
|
||||
teachers = searchTeacherAndAssistant(@board.course)
|
||||
for teacher in teachers
|
||||
if(teacher.user_id != User.current.id)
|
||||
notify = ActivityNotify.new()
|
||||
if(@board.course)
|
||||
notify.activity_container_id = @board.course_id
|
||||
notify.activity_container_type = 'Course'
|
||||
else
|
||||
notify.activity_container_id = @board.project_id
|
||||
notify.activity_container_type = 'Project'
|
||||
end
|
||||
notify.activity_id = @message.id
|
||||
notify.activity_type = 'Message'
|
||||
notify.notify_to = teacher.user_id
|
||||
notify.is_read = 0
|
||||
notify.save()
|
||||
end
|
||||
end
|
||||
end
|
||||
# 与我相关动态的记录add end
|
||||
|
||||
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
|
||||
render_attachment_warning_if_needed(@message)
|
||||
if params[:is_board]
|
||||
|
@ -151,6 +176,35 @@ class MessagesController < ApplicationController
|
|||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@reply.id,OwnerTypeHelper::MESSAGE
|
||||
end
|
||||
|
||||
# 与我相关动态的记录add start
|
||||
if(@board && @board.course) #项目的先不管
|
||||
notifyto_arr = {}
|
||||
notifyto_arr[@topic.author_id] = @topic.author_id
|
||||
if( params[:parent_topic] != nil && params[:parent_topic] != '')
|
||||
parent_topic = Message.find(params[:parent_topic])
|
||||
notifyto_arr[parent_topic.author_id] = parent_topic.author_id
|
||||
end
|
||||
notifyto_arr.each do |k,user_id|
|
||||
if(user_id != User.current.id)
|
||||
notify = ActivityNotify.new()
|
||||
if(@board.course)
|
||||
notify.activity_container_id = @board.course_id
|
||||
notify.activity_container_type = 'Course'
|
||||
else
|
||||
notify.activity_container_id = @board.project_id
|
||||
notify.activity_container_type = 'Project'
|
||||
end
|
||||
notify.activity_id = @reply.id
|
||||
notify.activity_type = 'Message'
|
||||
notify.notify_to = user_id
|
||||
notify.is_read = 0
|
||||
notify.save()
|
||||
end
|
||||
end
|
||||
end
|
||||
# 与我相关动态的记录add end
|
||||
|
||||
call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})
|
||||
attachments = Attachment.attach_files(@reply, params[:attachments])
|
||||
render_attachment_warning_if_needed(@reply)
|
||||
|
|
|
@ -363,7 +363,23 @@ class ProjectsController < ApplicationController
|
|||
|
||||
#发送邮件邀请新用户
|
||||
def invite_members_by_mail
|
||||
if User.current.member_of?(@project) || User.current.admin?
|
||||
if User.current.member_of?(@project) || User.current.admin?
|
||||
@inviter_lists = InviteList.where(project_id:@project.id).all
|
||||
@inviters = []
|
||||
@waiters = []
|
||||
unless @inviter_lists.blank?
|
||||
@inviter_lists.each do|inviter_list|
|
||||
unless inviter_list.user.nil?
|
||||
if inviter_list.user.member_of?(@project)
|
||||
@inviters << inviter_list.user
|
||||
@inviters_count = @inviters.size
|
||||
else
|
||||
@waiters << inviter_list.user
|
||||
@waiters_count = @waiters.size
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@is_zhuce = false
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
|
|
@ -0,0 +1,300 @@
|
|||
class StudentWorkController < ApplicationController
|
||||
layout "base_courses"
|
||||
include StudentWorkHelper
|
||||
require 'bigdecimal'
|
||||
before_filter :find_homework, :only => [:new, :index, :create]
|
||||
before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work]
|
||||
before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work]
|
||||
before_filter :author_of_work, :only => [:edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@order,@b_sort,@name = params[:order] || "final_score",params[:sort] || "desc",params[:name] || ""
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
#老师 || 非匿评作业 || 匿评结束 显示所有的作品
|
||||
@show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3
|
||||
if @show_all
|
||||
if @homework.homework_type == 1 || @is_teacher || User.current.admin?
|
||||
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
|
||||
else
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
if my_work.empty?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = search_homework_member @homework.student_works.order("#{@order} #{@b_sort}"),@name
|
||||
end
|
||||
end
|
||||
else #学生
|
||||
if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品
|
||||
@stundet_works = @homework.student_works.where(:user_id => User.current.id)
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品
|
||||
@is_evaluation = true
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
|
||||
end
|
||||
end
|
||||
@homework_commons = @course.homework_commons.order("created_at desc")
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls {
|
||||
send_data(homework_to_xls(@stundet_works), :type => "text/excel;charset=utf-8; header=present",
|
||||
:filename => "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@homework.name}#{l(:excel_homework_list)}.xls")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
student_work = @homework.student_works.where("user_id = ?",User.current.id).first
|
||||
if student_work.nil?
|
||||
@stundet_work = StudentWork.new
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
if params[:student_work]
|
||||
stundet_work = StudentWork.new
|
||||
stundet_work.name = params[:student_work][:name]
|
||||
stundet_work.description = params[:student_work][:description]
|
||||
stundet_work.project_id = params[:student_work][:project_id]
|
||||
stundet_work.homework_common_id = @homework.id
|
||||
stundet_work.user_id = User.current.id
|
||||
stundet_work.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(stundet_work)
|
||||
if stundet_work.save
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to student_work_index_url(:homework => @homework.id)
|
||||
}
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_failed_create)
|
||||
redirect_to new_student_work_url(:homework => @homework.id)
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:student_work]
|
||||
@work.name = params[:student_work][:name]
|
||||
@work.description = params[:student_work][:description]
|
||||
@work.project_id = params[:student_work][:project]
|
||||
@work.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@work)
|
||||
if @work.save
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
flash[:notice] = l(:notice_successful_edit)
|
||||
redirect_to student_work_index_url(:homework => @homework.id)
|
||||
}
|
||||
end
|
||||
return
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html{redirect_to edit_student_work_url(@work)}
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@score = student_work_score @work,User.current
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @work.destroy
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
redirect_to student_work_index_url(:homework => @homework.id)
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#添加评分,已评分则为修改评分
|
||||
def add_score
|
||||
render_403 and return if User.current == @work.user #不可以匿评自己的作品
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
#老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分
|
||||
render_403 and return unless @is_teacher || (@homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2)
|
||||
@score = student_work_score @work,User.current
|
||||
if @score
|
||||
@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
|
||||
@score.score = params[:score] if params[:score]
|
||||
@is_new = false
|
||||
else
|
||||
@score = StudentWorksScore.new
|
||||
@score.score = params[:score] if params[:score]
|
||||
@score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != ""
|
||||
@score.user_id = User.current.id
|
||||
@score.student_work_id = @work.id
|
||||
role = User.current.members.where("course_id = ?",@course.id).first.roles.first.name
|
||||
User.current.admin? ? @score.reviewer_role = 1 : @score.reviewer_role = get_role_by_name(role)
|
||||
@is_new = true
|
||||
end
|
||||
|
||||
@score.save_attachments(params[:attachments])
|
||||
render_attachment_warning_if_needed(@score)
|
||||
|
||||
if @score.save
|
||||
case @score.reviewer_role
|
||||
when 1 #教师评分:最后一个教师评分为最终评分
|
||||
@work.teacher_score = @score.score
|
||||
@work.final_score = @score.score
|
||||
when 2 #教辅评分 教辅评分显示平均分
|
||||
@work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f
|
||||
if @work.teacher_score.nil?
|
||||
if @work.student_score.nil?
|
||||
@work.final_score = @work.teaching_asistant_score
|
||||
else
|
||||
final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}")
|
||||
final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}"))
|
||||
final_score = final_ta_score + final_s_score
|
||||
@work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
end
|
||||
when 3 #学生评分 学生评分显示平均分
|
||||
@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
|
||||
if @work.teacher_score.nil?
|
||||
if @work.teaching_asistant_score.nil?
|
||||
@work.final_score = @work.student_score
|
||||
else
|
||||
final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}")
|
||||
final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}"))
|
||||
final_score = final_ta_score + final_s_score
|
||||
@work.final_score = format("%.2f",final_score.to_f)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if @work.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#添加评分的回复
|
||||
def add_score_reply
|
||||
@score = StudentWorksScore.find params[:score_id]
|
||||
@jour = @score.journals_for_messages.new(:user_id => User.current.id,:notes =>params[:message], :reply_id => 0)
|
||||
if @jour.save
|
||||
@status = 1
|
||||
else
|
||||
@status = 2
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
#删除评分的回复
|
||||
def destroy_score_reply
|
||||
@jour = JournalsForMessage.find params[:jour_id]
|
||||
if @jour.destroy
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#为作品点赞
|
||||
def praise_student_work
|
||||
pt = PraiseTread.new
|
||||
pt.user_id = User.current.id
|
||||
pt.praise_tread_object_id = @work.id
|
||||
pt.praise_tread_object_type = "StudentWork"
|
||||
pt.praise_or_tread = 1
|
||||
if pt.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
else
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
#获取作业
|
||||
def find_homework
|
||||
@homework = HomeworkCommon.find params[:homework]
|
||||
@course = @homework.course
|
||||
rescue
|
||||
render_404
|
||||
end
|
||||
#获取作品
|
||||
def find_work
|
||||
@work = StudentWork.find params[:id]
|
||||
@homework = @work.homework_common
|
||||
@course = @homework.course
|
||||
rescue
|
||||
render_404
|
||||
end
|
||||
|
||||
#是不是当前课程的成员
|
||||
#当前课程成员才可以看到作品列表
|
||||
def member_of_course
|
||||
render_403 unless User.current.member_of_course? @course || User.current.admin?
|
||||
end
|
||||
|
||||
#判断是不是当前作品的提交者
|
||||
#提交者 && (非匿评作业 || 未开启匿评) 可以编辑作品
|
||||
def author_of_work
|
||||
render_403 unless (User.current.id == @work.user_id || User.current.admin?) && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1 )
|
||||
end
|
||||
|
||||
#根据条件过滤作业结果
|
||||
def search_homework_member homeworks,name
|
||||
name = name.downcase
|
||||
select_homework = homeworks.select{ |homework|
|
||||
homework.user[:login].to_s.downcase.include?(name) || homework.user.user_extensions[:student_id].to_s.downcase.include?(name) || (homework.user[:lastname].to_s.downcase + homework.user[:firstname].to_s.downcase).include?(name)
|
||||
}
|
||||
select_homework
|
||||
end
|
||||
|
||||
def homework_to_xls items
|
||||
xls_report = StringIO.new
|
||||
book = Spreadsheet::Workbook.new
|
||||
sheet1 = book.create_worksheet :name => "homework"
|
||||
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
|
||||
sheet1.row(0).default_format = blue
|
||||
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_name),
|
||||
l(:excel_t_score),l(:excel_ta_score),l(:excel_n_score),l(:excel_f_score),l(:excel_commit_time)])
|
||||
count_row = 1
|
||||
items.each do |homework|
|
||||
sheet1[count_row,0]=homework.user.id
|
||||
sheet1[count_row,1] = homework.user.lastname.to_s + homework.user.firstname.to_s
|
||||
sheet1[count_row,2] = homework.user.login
|
||||
sheet1[count_row,3] = homework.user.user_extensions.student_id
|
||||
sheet1[count_row,4] = homework.user.mail
|
||||
sheet1[count_row,5] = homework.name
|
||||
sheet1[count_row,6] = homework.teacher_score.nil? ? l(:label_without_score) : format("%.2f",homework.teacher_score)
|
||||
sheet1[count_row,7] = homework.teaching_asistant_score.nil? ? l(:label_without_score) : format("%.2f",homework.teaching_asistant_score)
|
||||
sheet1[count_row,8] = homework.student_score.nil? ? l(:label_without_score) : format("%.2f",homework.student_score)
|
||||
sheet1[count_row,9] = homework.final_score.nil? ? l(:label_without_score) : format("%.2f",homework.final_score)
|
||||
sheet1[count_row,10] = format_time(homework.created_at)
|
||||
count_row += 1
|
||||
end
|
||||
book.write xls_report
|
||||
xls_report.string
|
||||
end
|
||||
end
|
|
@ -1,3 +1,5 @@
|
|||
require 'net/http'
|
||||
|
||||
class TestController < ApplicationController
|
||||
|
||||
helper :UserScore
|
||||
|
@ -5,6 +7,10 @@ class TestController < ApplicationController
|
|||
|
||||
def bootstrap; end
|
||||
|
||||
def view_office
|
||||
|
||||
end
|
||||
|
||||
def zip
|
||||
homeworks_attach_path = []
|
||||
homework_id = params[:homework_id]
|
||||
|
|
|
@ -25,7 +25,7 @@ class UsersController < ApplicationController
|
|||
menu_item :user_course, :only => :user_courses
|
||||
menu_item :user_homework, :only => :user_homeworks
|
||||
menu_item :user_project, :only => [:user_projects, :watch_projects]
|
||||
menu_item :requirement_focus, :only => :watch_bids
|
||||
# menu_item :requirement_focus, :only => :watch_bids
|
||||
menu_item :requirement_focus, :only => :watch_contests
|
||||
menu_item :user_newfeedback, :only => :user_newfeedback
|
||||
|
||||
|
@ -36,14 +36,14 @@ class UsersController < ApplicationController
|
|||
|
||||
#
|
||||
before_filter :can_show_course, :only => [:user_courses,:user_homeworks]
|
||||
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info,
|
||||
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :tag_saveEx,:user_projects, :user_newfeedback, :user_comments, :watch_contests, :info,
|
||||
:user_watchlist, :user_fanslist,:update, :user_courses, :user_homeworks, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:update_score,:user_activities,:user_projects_index]
|
||||
#edit has been deleted by huang, 2013-9-23
|
||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
|
||||
:user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments,
|
||||
:watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||
:watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index]
|
||||
before_filter :auth_user_extension, only: :show
|
||||
|
@ -141,25 +141,25 @@ class UsersController < ApplicationController
|
|||
|
||||
##added by fq
|
||||
def watch_bids
|
||||
cond = 'bids.reward_type <> 1'
|
||||
@bids = Bid.watched_by(@user).where('reward_type = ?', 1) # added by huang
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@bid_count = @bids.count
|
||||
@bid_pages = Paginator.new @bid_count, @limit, params['page']
|
||||
@offset ||= @bid_pages.reverse_offset
|
||||
unless @offset == 0
|
||||
@bid = @bids.offset(@offset).limit(@limit).all.reverse
|
||||
else
|
||||
limit = @bid_count % @limit
|
||||
@bid = @bids.offset(@offset).limit(limit).all.reverse
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
render :layout => 'base_users'
|
||||
}
|
||||
format.api
|
||||
end
|
||||
# cond = 'bids.reward_type <> 1'
|
||||
# @bids = Bid.watched_by(@user).where('reward_type = ?', 1) # added by huang
|
||||
# @offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
# @bid_count = @bids.count
|
||||
# @bid_pages = Paginator.new @bid_count, @limit, params['page']
|
||||
# @offset ||= @bid_pages.reverse_offset
|
||||
# unless @offset == 0
|
||||
# @bid = @bids.offset(@offset).limit(@limit).all.reverse
|
||||
# else
|
||||
# limit = @bid_count % @limit
|
||||
# @bid = @bids.offset(@offset).limit(limit).all.reverse
|
||||
# end
|
||||
#
|
||||
# respond_to do |format|
|
||||
# format.html {
|
||||
# render :layout => 'base_users'
|
||||
# }
|
||||
# format.api
|
||||
# end
|
||||
end
|
||||
|
||||
#new add by linchun
|
||||
|
@ -215,24 +215,24 @@ class UsersController < ApplicationController
|
|||
|
||||
# added by huang
|
||||
def user_homeworks
|
||||
@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
@memberships = []
|
||||
@membership.each do |membership|
|
||||
if membership.project.project_type == 1
|
||||
@memberships << membership
|
||||
end
|
||||
end
|
||||
@bid = []
|
||||
@memberships.each do |membership|
|
||||
@bid += membership.project.homeworks
|
||||
end
|
||||
@bid = @bid.group_by {|bid| bid.courses.first.id}
|
||||
unless User.current.admin?
|
||||
if !@user.active?
|
||||
render_404
|
||||
return
|
||||
end
|
||||
end
|
||||
# @membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
# @memberships = []
|
||||
# @membership.each do |membership|
|
||||
# if membership.project.project_type == 1
|
||||
# @memberships << membership
|
||||
# end
|
||||
# end
|
||||
# @bid = []
|
||||
# @memberships.each do |membership|
|
||||
# @bid += membership.project.homeworks
|
||||
# end
|
||||
# @bid = @bid.group_by {|bid| bid.courses.first.id}
|
||||
# unless User.current.admin?
|
||||
# if !@user.active?
|
||||
# render_404
|
||||
# return
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
|
||||
|
@ -462,14 +462,14 @@ class UsersController < ApplicationController
|
|||
ids = []
|
||||
ids << Issue.where(id: act_ids, project_id: p_ids).map{|x| x.id}
|
||||
|
||||
#Bid
|
||||
act_ids = activity.where(act_type: 'Bid').select('act_id').map{|x| x.act_id}
|
||||
course_ids = HomeworkForCourse.where(bid_id: act_ids).select('distinct course_id').map{|x| x.course_id}
|
||||
#HomeworkCommon
|
||||
act_ids = activity.where(act_type: 'HomeworkCommon').select('act_id').map{|x| x.act_id}
|
||||
course_ids = HomeworkCommon.where(id: act_ids).select('distinct course_id').map{|x| x.course_id}
|
||||
c_ids = []
|
||||
Course.where(id: course_ids).each do |x|
|
||||
c_ids << x.id unless x.is_public !=0 && User.current.member_of_course?(x)
|
||||
end
|
||||
ids << HomeworkForCourse.where(bid_id: act_ids, course_id: c_ids).map{|x| x.id}
|
||||
ids << HomeworkCommon.where(id: act_ids, course_id: c_ids).map{|x| x.id}
|
||||
|
||||
#Journal
|
||||
act_ids = activity.where(act_type: 'Journal').select('act_id').map{|x| x.act_id}
|
||||
|
@ -757,7 +757,7 @@ class UsersController < ApplicationController
|
|||
when '3' then
|
||||
@obj = Issue.find_by_id(@obj_id)
|
||||
when '4' then
|
||||
@obj = Bid.find_by_id(@obj_id)
|
||||
# @obj = Bid.find_by_id(@obj_id)
|
||||
when '5' then
|
||||
@obj = Forum.find_by_id(@obj_id)
|
||||
when '6'
|
||||
|
@ -800,7 +800,7 @@ class UsersController < ApplicationController
|
|||
when '3' then
|
||||
@obj = Issue.find_by_id(@obj_id)
|
||||
when '4' then
|
||||
@obj = Bid.find_by_id(@obj_id)
|
||||
# @obj = Bid.find_by_id(@obj_id)
|
||||
when '5' then
|
||||
@obj = Forum.find_by_id(@obj_id)
|
||||
when '6'
|
||||
|
|
|
@ -30,29 +30,26 @@ class ZipdownController < ApplicationController
|
|||
if file_count > 0
|
||||
zipfile = zip_bid bid
|
||||
else
|
||||
render file: 'public/no_file_found.html'
|
||||
return
|
||||
zipfile = {:message => "no file"}
|
||||
end
|
||||
elsif params[:obj_class] == "HomeworkCommon"
|
||||
homework = HomeworkCommon.find params[:obj_id]
|
||||
render_403 if User.current.allowed_to?(:as_teacher,homework.course)
|
||||
file_count = 0
|
||||
homework.student_works.map { |work| file_count += work.attachments.count}
|
||||
if file_count > 0
|
||||
zipfile = zip_homework_common homework
|
||||
else
|
||||
zipfile = {:message => "no file"}
|
||||
end
|
||||
else
|
||||
logger.error "[ZipDown#assort] ===> #{params[:obj_class]} unKown !!"
|
||||
end
|
||||
|
||||
# if zipfile
|
||||
# if zipfile.length > 1
|
||||
# @mut_down_files = zipfile #zipfile.each{|x| File.basename(x)}
|
||||
# else
|
||||
# send_file zipfile.first[:real_file], :filename => bid.name + ".zip", :type => detect_content_type(zipfile.first[:real_file])
|
||||
# return
|
||||
# end
|
||||
# end
|
||||
|
||||
respond_to do |format|
|
||||
format.json {
|
||||
render json: zipfile.to_json
|
||||
}
|
||||
end
|
||||
#rescue Exception => e
|
||||
# render file: 'public/no_file_found.html'
|
||||
end
|
||||
|
||||
#下载某一学生的作业的所有文件
|
||||
|
@ -63,7 +60,7 @@ class ZipdownController < ApplicationController
|
|||
unless homework.attachments.empty?
|
||||
zipfile = zip_homework_by_user homework
|
||||
send_file zipfile.file_path, :filename => ((homework.user.user_extensions.nil? || homework.user.user_extensions.student_id.nil?) ? "" : homework.user.user_extensions.student_id) +
|
||||
"_" + (homework.user.lastname.nil? ? "" : homework.user.lastname) + (homework.user.firstname.nil? ? "" : homework.user.firstname) +
|
||||
"_" + homework.user.show_name +
|
||||
"_" + homework.name + ".zip", :type => detect_content_type(zipfile.file_path) if(zipfile)
|
||||
else
|
||||
render file: 'public/no_file_found.html'
|
||||
|
@ -102,29 +99,34 @@ class ZipdownController < ApplicationController
|
|||
digests << out_file.file_digest
|
||||
end
|
||||
end
|
||||
|
||||
homework_id = bid.id
|
||||
user_id = bid.author_id
|
||||
|
||||
|
||||
out_file = find_or_pack(homework_id, user_id, digests.sort){
|
||||
zipping("#{Time.now.to_i}_#{bid.name}.zip",
|
||||
bid_homework_path, OUTPUT_FOLDER)
|
||||
}
|
||||
[{files:[out_file.file_path], count: 1, index: 1,
|
||||
real_file: out_file.file_path, file: File.basename(out_file.file_path),
|
||||
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
|
||||
}]
|
||||
end
|
||||
|
||||
|
||||
# zips = split_pack_files(bid_homework_path, Setting.pack_attachment_max_size.to_i*1024)
|
||||
# x = 0
|
||||
#
|
||||
#
|
||||
# zips.each { |o|
|
||||
# x += 1
|
||||
# file = zipping "#{Time.now.to_i}_#{bid.name}_#{x}.zip", o[:files], OUTPUT_FOLDER
|
||||
# o[:real_file] = file
|
||||
# o[:file] = File.basename(file)
|
||||
# o[:size] = (File.size(file) / 1024.0 / 1024.0).round(2)
|
||||
# }
|
||||
|
||||
def zip_homework_common homework_common
|
||||
bid_homework_path = []
|
||||
digests = []
|
||||
homework_common.student_works.each do |work|
|
||||
unless work.attachments.empty?
|
||||
out_file = zip_student_work_by_user(work)
|
||||
bid_homework_path << out_file.file_path
|
||||
digests << out_file.file_digest
|
||||
end
|
||||
end
|
||||
homework_id = homework_common.id
|
||||
user_id = homework_common.user_id
|
||||
out_file = find_or_pack(homework_id, user_id, digests.sort){
|
||||
zipping("#{Time.now.to_i}_#{homework_common.name}.zip",
|
||||
bid_homework_path, OUTPUT_FOLDER)
|
||||
}
|
||||
[{files:[out_file.file_path], count: 1, index: 1,
|
||||
real_file: out_file.file_path, file: File.basename(out_file.file_path),
|
||||
size:(out_file.pack_size / 1024.0 / 1024.0).round(2)
|
||||
|
@ -135,8 +137,6 @@ class ZipdownController < ApplicationController
|
|||
homeworks_attach_path = []
|
||||
not_exist_file = []
|
||||
# 需要将所有homework.attachments遍历加入zip
|
||||
|
||||
|
||||
digests = []
|
||||
homework_attach.attachments.each do |attach|
|
||||
if File.exist?(attach.diskfile)
|
||||
|
@ -147,12 +147,30 @@ class ZipdownController < ApplicationController
|
|||
digests << 'not_exist_file'
|
||||
end
|
||||
end
|
||||
|
||||
out_file = find_or_pack(homework_attach.bid_id, homework_attach.user_id, digests.sort){
|
||||
zipping("#{homework_attach.user.lastname}#{homework_attach.user.firstname}_#{((homework_attach.user.user_extensions.nil? || homework_attach.user.user_extensions.student_id.nil?) ? "" : homework_attach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
|
||||
zipping("#{homework_attach.user.show_name}_#{((homework_attach.user.user_extensions.nil? || homework_attach.user.user_extensions.student_id.nil?) ? "" : homework_attach.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
|
||||
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
|
||||
}
|
||||
end
|
||||
|
||||
def zip_student_work_by_user work
|
||||
homeworks_attach_path = []
|
||||
not_exist_file = []
|
||||
# 需要将所有homework.attachments遍历加入zip
|
||||
digests = []
|
||||
work.attachments.each do |attach|
|
||||
if File.exist?(attach.diskfile)
|
||||
homeworks_attach_path << attach.diskfile
|
||||
digests << attach.digest
|
||||
else
|
||||
not_exist_file << attach.filename
|
||||
digests << 'not_exist_file'
|
||||
end
|
||||
end
|
||||
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
|
||||
zipping("#{work.user.show_name}_#{((work.user.user_extensions.nil? || work.user.user_extensions.student_id.nil?) ? "" : work.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip",
|
||||
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
module ActivityNotifysHelper
|
||||
def get_new_notify_count(container,type)
|
||||
logger.info('xxoo')
|
||||
query = ActivityNotify.where('activity_container_id=? and activity_container_type=? and notify_to=?',container.id,type,User.current.id);
|
||||
return query.count()
|
||||
end
|
||||
end
|
|
@ -1824,7 +1824,7 @@ module ApplicationHelper
|
|||
def attachment_candown attachment
|
||||
candown = false
|
||||
if attachment.container
|
||||
if attachment.container.class.to_s != "HomeworkAttach" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project
|
||||
if attachment.container.class.to_s != "HomeworkAttach" && attachment.container.class.to_s != "StudentWork" && (attachment.container.has_attribute?(:project) || attachment.container.has_attribute?(:project_id)) && attachment.container.project
|
||||
project = attachment.container.project
|
||||
candown= User.current.member_of?(project) || (project.is_public && attachment.is_public == 1)
|
||||
elsif attachment.container.is_a?(Project)
|
||||
|
@ -1844,7 +1844,11 @@ module ApplicationHelper
|
|||
attachment.container.board.course
|
||||
course = attachment.container.board.course
|
||||
candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
|
||||
elsif attachment.container.class.to_s=="HomeworkAttach" && attachment.container.bid.reward_type == 3
|
||||
elsif attachment.container.class.to_s=="HomeworkAttach"
|
||||
candown = true
|
||||
elsif attachment.container.class.to_s=="StudentWorksScore"
|
||||
candown = true
|
||||
elsif attachment.container.class.to_s=="StudentWork"
|
||||
candown = true
|
||||
elsif attachment.container_type == "Bid" && attachment.container && attachment.container.courses
|
||||
course = attachment.container.courses.first
|
||||
|
@ -2110,7 +2114,7 @@ module ApplicationHelper
|
|||
# courses_link = link_to l(:label_course_practice), {:controller => 'courses', :action => 'index'}
|
||||
#users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :host => Setting.host_user}
|
||||
# contest_link = link_to l(:label_contest_innovate), {:controller => 'contests', :action => 'index'}
|
||||
bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'}
|
||||
# bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'}
|
||||
forum_link = link_to l(:label_forum_all), {:controller => "forums", :action => "index"}
|
||||
stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'}
|
||||
school_all_school_link = link_to l(:label_school_all), {:controller => 'school', :action => 'index'}
|
||||
|
@ -2270,4 +2274,60 @@ module ApplicationHelper
|
|||
tag_list = attachment_tag_list all_attachments
|
||||
tag_list
|
||||
end
|
||||
|
||||
#获取匿评相关连接代码
|
||||
def homework_anonymous_comment homework
|
||||
if homework.homework_type == 1 && homework.homework_detail_manual #匿评作业
|
||||
if homework.student_works.count >= 2 #作业份数大于2
|
||||
case homework.homework_detail_manual.comment_status
|
||||
when 1
|
||||
link = link_to '启动匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit'
|
||||
when 2
|
||||
link = link_to '关闭匿评', alert_anonymous_comment_homework_common_path(homework), id: "#{homework.id}_stop_anonymous_comment", remote: true,:class => 'fr mr10 work_edit'
|
||||
when 3
|
||||
link = "<span class='fr pr_join_span mr10' title='匿评结束'>匿评结束</span>".html_safe
|
||||
end
|
||||
else
|
||||
link = "<span class='fr mr10 pr_join_span ' title='学生提交作业数大于2时才可以启动匿评'>启动匿评</span>".html_safe
|
||||
end
|
||||
else
|
||||
link = "<span class='fr mr10 pr_join_span ' title='未开启匿评作业不可以启动匿评'>启动匿评</span>".html_safe
|
||||
end
|
||||
link
|
||||
end
|
||||
#学生根据传入作业确定显示为编辑作品还是新建作品
|
||||
def student_new_homework homework
|
||||
work = cur_user_works_for_homework homework
|
||||
if work.nil?
|
||||
link_to l(:label_commit_homework), new_student_work_path(:homework => homework.id),:class => 'fr mr10 work_edit'
|
||||
else
|
||||
if homework.homework_type == 1 && homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
|
||||
"<span class='fr mr10 pr_join_span '>#{l(:label_edit_homework)}</span>".html_safe
|
||||
else
|
||||
link_to l(:label_edit_homework), edit_student_work_path(work.id),:class => 'fr mr10 work_edit'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def student_anonymous_comment homework
|
||||
if homework.homework_type == 1 && homework.homework_detail_manual
|
||||
case homework.homework_detail_manual.comment_status
|
||||
when 1
|
||||
"<span class='fr mr10 pr_join_span '>未开启匿评</span>".html_safe
|
||||
when 2
|
||||
"<span class='fr mr10 pr_join_span '>正在匿评中</span>".html_safe
|
||||
when 3
|
||||
"<span class='fr mr10 pr_join_span '>匿评已结束</span>".html_safe
|
||||
end
|
||||
elsif homework.homework_type == 0
|
||||
"<span class='fr mr10 pr_join_span '>未启用匿评</span>".html_safe
|
||||
elsif homework.homework_type == 2
|
||||
"<span class='fr mr10 pr_join_span '>编程作业</span>".html_safe
|
||||
end
|
||||
end
|
||||
|
||||
#获取当前用户在指定作业下提交的作业的集合
|
||||
def cur_user_works_for_homework homework
|
||||
homework.student_works.where("user_id = ?",User.current).first
|
||||
end
|
||||
end
|
||||
|
|
|
@ -201,14 +201,13 @@ module CoursesHelper
|
|||
end
|
||||
members
|
||||
end
|
||||
|
||||
def searchStudent project
|
||||
#searchPeopleByRoles(project, StudentRoles)
|
||||
members = []
|
||||
|
||||
project.members.each do |m|
|
||||
if m && m.user && m.user.allowed_to?(:as_student,project)
|
||||
members << m
|
||||
|
||||
end
|
||||
end
|
||||
members
|
||||
|
@ -428,40 +427,19 @@ module CoursesHelper
|
|||
|
||||
now > cTime
|
||||
end
|
||||
|
||||
def find_by_extra_from_project extra
|
||||
Course.find_by_extra(try(extra))
|
||||
end
|
||||
|
||||
#判断指定用户是不是当前课程的老师
|
||||
def is_course_teacher (user,course)
|
||||
#course.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and members.user_id = #{user.id}", {:role_id => TeacherRoles}).count != 0
|
||||
user.allowed_to?(:as_teacher,course)
|
||||
#修改为根据用户是否有发布任务的权限来判断用户是否是课程的老师
|
||||
#is_teacher = false
|
||||
#@membership = user.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
#@membership.each do |membership|
|
||||
# unless(membership.project.project_type==0)
|
||||
# if user.allowed_to?({:controller => "projects", :action => "new_homework"}, membership.project, :global => false)
|
||||
# is_teacher = true
|
||||
# end
|
||||
# end
|
||||
#end
|
||||
#is_teacher
|
||||
end
|
||||
|
||||
#当前用户是不是指定课程的学生
|
||||
def is_cur_course_student course
|
||||
#course.members.joins(:member_roles).where("member_roles.role_id IN (:role_id) and members.user_id = #{User.current.id}", {:role_id => StudentRoles}).count != 0
|
||||
User.current.logged? && User.current.member_of_course?(course) && !(User.current.allowed_to?(:as_teacher,course))
|
||||
#修改:能新建占位且不能新建任务的角色判定为学生
|
||||
#is_student = false
|
||||
#@membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
#@membership.each do |membership|
|
||||
# unless(membership.project.project_type==0)
|
||||
# if !User.current.allowed_to?({:controller => "projects", :action => "new_homework"}, membership.project, :global => false) && User.current.allowed_to?({:controller => "homework_attach", :action => "new"}, membership.project, :global => false)
|
||||
# is_student = true
|
||||
# end
|
||||
# end
|
||||
#end
|
||||
#is_student
|
||||
end
|
||||
#获取当前用户在指定作业下提交的作业的集合
|
||||
def cur_user_homework_for_bid bid
|
||||
|
@ -479,61 +457,6 @@ module CoursesHelper
|
|||
homework.nil? ? [] : (homework.users + [homework.user])
|
||||
end
|
||||
|
||||
#获取指定作业的最终评分
|
||||
#最终评分 = 学生评分的平均分 * 0.4 +教师评分 * 0.6
|
||||
def score_for_homework homework
|
||||
if homework.bid.is_evaluation == 1 || homework.bid.is_evaluation == nil
|
||||
return format("%.2f",(homework.bid.proportion * 1.0 / 100) * (teacher_score_for_homework(homework).to_f) + (1 - homework.bid.proportion * 1.0 / 100) * (student_score_for_homework(homework).to_f))
|
||||
else
|
||||
return teacher_score_for_homework homework
|
||||
end
|
||||
end
|
||||
def score_for_homework_new homework
|
||||
if teacher_score_for_homework(homework) != 0
|
||||
return teacher_score_for_homework homework
|
||||
else
|
||||
return student_score_for_homework homework
|
||||
end
|
||||
end
|
||||
#获取作业的互评得分
|
||||
def student_score_for_homework homework
|
||||
#member = searchTeacherAndAssistant(homework.bid.courses.first).first#searchPeopleByRoles(homework.bid.courses.first,TeacherRoles).first
|
||||
#if member.nil?
|
||||
# return "0.00"
|
||||
#end
|
||||
#student_stars = homework.rates(:quality).where("rater_id <> #{member.user_id}").select("stars")
|
||||
members = searchStudent(homework.bid.courses.first)
|
||||
user_ids = []
|
||||
members.each do |user|
|
||||
user_ids << user.user_id
|
||||
end
|
||||
student_stars = homework.rates(:quality).where("rater_id in (:user_ids)",{:user_ids => user_ids}).select("stars")
|
||||
student_stars_count = 0
|
||||
student_stars.each do |star|
|
||||
student_stars_count = student_stars_count + star.stars
|
||||
end
|
||||
return format("%.2f",student_stars_count / (student_stars.count == 0 ? 1 : student_stars.count))
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
#获取作业的教师评分
|
||||
#多个教师只获取一份教师评分
|
||||
def teacher_score_for_homework homework
|
||||
members = searchTeacherAndAssistant(homework.bid.courses.first)
|
||||
teacher_ids = []
|
||||
members.each do |user|
|
||||
teacher_ids << user.user_id
|
||||
end
|
||||
teacher_stars = homework.rates(:quality).where("rater_id in (:teacher_ids)",{:teacher_ids => teacher_ids}).select("stars")
|
||||
teacher_stars_count = 0
|
||||
teacher_stars.each do |star|
|
||||
teacher_stars_count = teacher_stars_count + star.stars
|
||||
end
|
||||
return format("%.2f",teacher_stars.count > 0 ? teacher_stars_count/teacher_stars.count : 0)
|
||||
end
|
||||
|
||||
#获取指定项目的得分
|
||||
def project_score project
|
||||
issue_count = project.issues.count
|
||||
|
@ -647,11 +570,6 @@ module CoursesHelper
|
|||
end
|
||||
end
|
||||
|
||||
#message_count
|
||||
#Board.where(course_id: @course_ids).each do |board|
|
||||
# activities[board.course_id]+=board.messages.where("updated_on>?", date_from).count
|
||||
#end
|
||||
|
||||
#message_count
|
||||
Board.where(course_id: @course_ids).each do |board|
|
||||
countmessage = 0
|
||||
|
@ -671,24 +589,15 @@ module CoursesHelper
|
|||
end
|
||||
end
|
||||
|
||||
#feedback_count 留言目前有问题留待下一步处理
|
||||
#JournalsForMessage.where(jour_id: @course_ids, jour_type: Course).each do |jourformess|
|
||||
# activities[jourformess.jour_id]+=1
|
||||
#end
|
||||
|
||||
#homework_count
|
||||
HomeworkForCourse.where(course_id: @course_ids).each do |homework|
|
||||
countbid=0
|
||||
# @bid_ids<<homework.bid_id
|
||||
Bid.where(id: homework.bid_id).where("created_on>?",date_from).each do |bid|
|
||||
countbid+=1
|
||||
end
|
||||
activities[homework.course_id]+=countbid
|
||||
end
|
||||
|
||||
#@bid_ids.each do |bid_id|
|
||||
# activities[] +=Bid.where(id: bid_id ).where("created_on>?",date_from).count
|
||||
#end
|
||||
# HomeworkForCourse.where(course_id: @course_ids).each do |homework|
|
||||
# countbid=0
|
||||
# # @bid_ids<<homework.bid_id
|
||||
# Bid.where(id: homework.bid_id).where("created_on>?",date_from).each do |bid|
|
||||
# countbid+=1
|
||||
# end
|
||||
# activities[homework.course_id]+=countbid
|
||||
# end
|
||||
|
||||
#poll_count
|
||||
# 动态目前只统计发布的问卷,关闭的问卷不在动态内显示
|
||||
|
@ -739,54 +648,6 @@ module CoursesHelper
|
|||
link.html_safe
|
||||
end
|
||||
|
||||
def bid_anonymous_comment bid
|
||||
if bid.open_anonymous_evaluation == 1
|
||||
if bid.homeworks.count >= 2
|
||||
case bid.comment_status
|
||||
when 0
|
||||
link = link_to '启动匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_start_anonymous_comment", remote: true, disable_with: '加载中...',:class => 'fr mr10 work_edit'
|
||||
when 1
|
||||
link = link_to '关闭匿评', alert_anonymous_comment_bid_path(bid), id: "#{bid.id}_stop_anonymous_comment", remote: true,:class => 'fr mr10 work_edit'
|
||||
when 2
|
||||
link = "<span class='fr pr_join_span mr10' title='匿评结束'>匿评结束</span>".html_safe
|
||||
end
|
||||
else
|
||||
link = "<span class='fr mr10 pr_join_span ' title='学生提交作业数大于2时才可以启动匿评'>启动匿评</span>".html_safe
|
||||
end
|
||||
else
|
||||
link = "<span class='fr mr10 pr_join_span ' title='未开启匿评作业不可以启动匿评'>启动匿评</span>".html_safe
|
||||
end
|
||||
link
|
||||
end
|
||||
|
||||
def student_new_homework bid
|
||||
user_homework = cur_user_homework_for_bid bid
|
||||
if user_homework && user_homework.empty?
|
||||
link_to l(:label_commit_homework), new_exercise_book_path(bid),:class => 'fr mr10 work_edit'
|
||||
else
|
||||
if bid.comment_status == 1 && bid.open_anonymous_evaluation == 1
|
||||
"<span class='fr mr10 pr_join_span ' title='已开启匿评不能修改作品'>#{l(:label_edit_homework)}</span>".html_safe
|
||||
else
|
||||
link_to l(:label_edit_homework), edit_homework_attach_path(user_homework.first.id),:class => 'fr mr10 work_edit'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def student_anonymous_comment bid
|
||||
if bid.open_anonymous_evaluation == 1
|
||||
case bid.comment_status
|
||||
when 0
|
||||
"<span class='fr mr10 pr_join_span '>未开启匿评</span>".html_safe
|
||||
when 1
|
||||
"<span class='fr mr10 pr_join_span '>正在匿评中</span>".html_safe
|
||||
when 2
|
||||
"<span class='fr mr10 pr_join_span '>匿评已结束</span>".html_safe
|
||||
end
|
||||
else
|
||||
"<span class='fr mr10 pr_join_span '>未启用匿评</span>".html_safe
|
||||
end
|
||||
end
|
||||
|
||||
def visable_attachemnts_incourse course
|
||||
return[] unless course
|
||||
result = []
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
# encoding: utf-8
|
||||
module HomeworkCommonHelper
|
||||
#迟交扣分下拉框
|
||||
def late_penalty_option
|
||||
type = []
|
||||
for i in (0..5)
|
||||
option = []
|
||||
option << i
|
||||
option << i
|
||||
type << option
|
||||
end
|
||||
type
|
||||
end
|
||||
|
||||
#教辅评分比例下拉框
|
||||
def ta_proportion_option
|
||||
type = []
|
||||
i = 10
|
||||
while i <= 100
|
||||
option = []
|
||||
option << i.to_s + "%"
|
||||
option << i.to_f / 100
|
||||
type << option
|
||||
i += 10
|
||||
end
|
||||
type
|
||||
end
|
||||
|
||||
#缺评扣分
|
||||
def absence_penalty_option
|
||||
type = []
|
||||
i = 0
|
||||
while i <= 5
|
||||
option = []
|
||||
option << i
|
||||
option << i
|
||||
type << option
|
||||
i += 1
|
||||
end
|
||||
type
|
||||
end
|
||||
|
||||
#根据传入作业确定跳转到开启匿评还是关闭匿评功能
|
||||
def alert_anonyoms_path homework,homework_detail_manual
|
||||
link = ""
|
||||
if homework_detail_manual.comment_status == 1
|
||||
link = start_anonymous_comment_homework_common_url homework.id
|
||||
elsif homework_detail_manual.comment_status == 2
|
||||
link = stop_anonymous_comment_homework_common_url homework.id
|
||||
end
|
||||
link
|
||||
end
|
||||
end
|
|
@ -6,4 +6,5 @@ module OwnerTypeHelper
|
|||
COMMENT = 5
|
||||
BID = 6
|
||||
JOURNALSFORMESSAGE = 7
|
||||
HOMEWORKCOMMON = 8
|
||||
end
|
|
@ -0,0 +1,63 @@
|
|||
# encoding: utf-8
|
||||
module StudentWorkHelper
|
||||
def user_projects_option
|
||||
cond = Project.visible_condition(User.current) + " AND projects.project_type <> 1"
|
||||
memberships = User.current.memberships.all(:conditions => cond)
|
||||
projects = memberships.map(&:project)
|
||||
not_have_project = []
|
||||
not_have_project << Setting.please_chose
|
||||
not_have_project << 0
|
||||
type = []
|
||||
type << not_have_project
|
||||
projects.each do |project|
|
||||
if project != nil
|
||||
option = []
|
||||
option << project.name
|
||||
option << project.id
|
||||
type << option
|
||||
end
|
||||
end
|
||||
type
|
||||
end
|
||||
|
||||
#获取指定用户对某一作业的评分结果
|
||||
def student_work_score work,user
|
||||
StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).first
|
||||
end
|
||||
|
||||
#获取指定评分的角色
|
||||
def student_work_score_role score
|
||||
case score.reviewer_role
|
||||
when 1
|
||||
role = "教师"
|
||||
when 2
|
||||
role = "助教"
|
||||
when 3
|
||||
role = "学生"
|
||||
end
|
||||
end
|
||||
|
||||
def get_role_by_name role
|
||||
case role
|
||||
when "Teacher"
|
||||
result = 1
|
||||
when "Manager"
|
||||
result = 1
|
||||
when "TeachingAsistant"
|
||||
result = 2
|
||||
when "Student"
|
||||
result = 3
|
||||
end
|
||||
result
|
||||
end
|
||||
|
||||
#获取赞的总数
|
||||
def praise_homework_count obj_id
|
||||
PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'StudentWork'").count
|
||||
end
|
||||
|
||||
#判断指定用户是不是已经赞过该作业
|
||||
def is_praise_homework user_id, obj_id
|
||||
PraiseTread.where("user_id = #{user_id} AND praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'StudentWork'").empty?
|
||||
end
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class ActivityNotify < ActiveRecord::Base
|
||||
belongs_to :activity, polymorphic: true
|
||||
end
|
|
@ -72,8 +72,8 @@ class Attachment < ActiveRecord::Base
|
|||
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
|
||||
|
||||
before_save :files_to_final_location
|
||||
after_create :be_user_score ,:act_as_forge_activity# user_score
|
||||
after_update :be_user_score
|
||||
after_create :office_conver, :be_user_score,:act_as_forge_activity# user_score
|
||||
after_update :office_conver, :be_user_score
|
||||
after_destroy :delete_from_disk,:down_user_score
|
||||
|
||||
# add by nwb
|
||||
|
@ -258,6 +258,17 @@ class Attachment < ActiveRecord::Base
|
|||
filename
|
||||
end
|
||||
|
||||
def office_conver
|
||||
# 不在这里做后台转换,换为点击时做转换
|
||||
# return unless %w(Project Course).include? (self.container_type)
|
||||
# saved_path = File.join(Rails.root, "files", "convered_office")
|
||||
# unless Dir.exist?(saved_path)
|
||||
# Dir.mkdir(saved_path)
|
||||
# end
|
||||
# convered_file = File.join(saved_path, self.disk_filename + ".pdf")
|
||||
# OfficeConverTask.new.conver(self.diskfile, convered_file)
|
||||
end
|
||||
|
||||
# Copies the temporary file to its final location
|
||||
# and computes its MD5 hash
|
||||
def files_to_final_location
|
||||
|
|
|
@ -10,7 +10,7 @@ class Course < ActiveRecord::Base
|
|||
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
|
||||
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表
|
||||
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表
|
||||
has_many :bid
|
||||
# has_many :bid
|
||||
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
|
||||
has_many :memberships, :class_name => 'Member'
|
||||
has_many :member_principals, :class_name => 'Member',
|
||||
|
@ -18,9 +18,9 @@ class Course < ActiveRecord::Base
|
|||
:conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE})"
|
||||
has_many :principals, :through => :member_principals, :source => :principal
|
||||
has_many :users, :through => :members
|
||||
has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
|
||||
# has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :homework_for_courses, :dependent => :destroy
|
||||
# has_many :homework_for_courses, :dependent => :destroy
|
||||
has_many :student, :class_name => 'StudentsForCourse', :source => :user
|
||||
has_many :course_infos, :class_name => 'CourseInfos',:dependent => :destroy
|
||||
has_many :enabled_modules, :dependent => :delete_all
|
||||
|
@ -29,6 +29,9 @@ class Course < ActiveRecord::Base
|
|||
has_many :news, :dependent => :destroy, :include => :author
|
||||
has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy
|
||||
|
||||
has_many :homework_commons, :dependent => :destroy
|
||||
has_many :student_works, :through => :homework_commons, :dependent => :destroy
|
||||
|
||||
has_many :course_groups, :dependent => :destroy
|
||||
|
||||
acts_as_taggable
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
#老师布置的作业表
|
||||
#homework_type: 0:普通作业;1:匿评作业;2:编程作业
|
||||
class HomeworkCommon < ActiveRecord::Base
|
||||
# attr_accessible :name, :user_id, :description, :publish_time, :end_time, :homework_type, :late_penalty, :course_id
|
||||
include Redmine::SafeAttributes
|
||||
include ApplicationHelper
|
||||
|
||||
belongs_to :course
|
||||
belongs_to :user
|
||||
has_one :homework_detail_manual, :dependent => :destroy
|
||||
has_one :homework_detail_programing, :dependent => :destroy
|
||||
has_many :homework_tests, :dependent => :destroy
|
||||
has_many :student_works, :dependent => :destroy
|
||||
has_many :student_works_evaluation_distributions, :through => :student_works #一个作业的分配的匿评列表
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy #用户活动
|
||||
acts_as_attachable
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_course_homework)} ##{o.id}: #{o.name}" },
|
||||
:description => :description,
|
||||
:author => :author,
|
||||
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
|
||||
after_create :act_as_activity
|
||||
after_destroy :delete_kindeditor_assets
|
||||
|
||||
def act_as_activity
|
||||
self.acts << Activity.new(:user_id => self.user_id)
|
||||
end
|
||||
#删除对应的图片
|
||||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
#手动评分作业表
|
||||
#comment_status: 1:未开启匿评,2:开启匿评,3:匿评结束
|
||||
class HomeworkDetailManual < ActiveRecord::Base
|
||||
attr_accessible :ta_proportion, :comment_status, :evaluation_start, :evaluation_end, :evaluation_num, :absence_penalty, :homework_common_id
|
||||
|
||||
belongs_to :homework_common
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class HomeworkDetailPrograming < ActiveRecord::Base
|
||||
attr_accessible :language, :standard_code, :homework_common_id
|
||||
|
||||
belongs_to :homework_common
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class HomeworkTest < ActiveRecord::Base
|
||||
attr_accessible :input, :output, :homework_common_id
|
||||
|
||||
belongs_to :homework_common
|
||||
end
|
|
@ -1,5 +1,13 @@
|
|||
class InviteList < ActiveRecord::Base
|
||||
attr_accessible :project_id, :user_id
|
||||
# belongs_to :user
|
||||
# belongs_to :project
|
||||
belongs_to :user
|
||||
belongs_to :project
|
||||
|
||||
# 用户拒绝邀请后,删除记录
|
||||
def self.delete_inviter(userid, projectid)
|
||||
@inviters = AppliedProject.where("user_id = ? and project_id = ?", userid, projectid)
|
||||
@inviters.each do |inviter|
|
||||
inviter.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,6 +29,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
belongs_to :jour, :polymorphic => true
|
||||
belongs_to :user
|
||||
belongs_to :homework_attach
|
||||
belongs_to :student_works_score
|
||||
belongs_to :at_user, :class_name => "User", :foreign_key => 'reply_id'
|
||||
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_my_message)}"},
|
||||
|
|
|
@ -58,6 +58,7 @@ class Mailer < ActionMailer::Base
|
|||
us = UsersService.new
|
||||
# 自动激活用户
|
||||
user = us.register_auto(login, @email, @password)
|
||||
InviteList.create(:user_id => user.id, :project_id => project.id)
|
||||
User.current = user unless User.current.nil?
|
||||
@user = user
|
||||
|
||||
|
@ -73,6 +74,10 @@ class Mailer < ActionMailer::Base
|
|||
@project_name = "#{project.name}"
|
||||
@user = user
|
||||
@project = project
|
||||
inviter_lists = InviteList.where(project_id:@project.id, user_id:@user.id).all
|
||||
if inviter_lists.blank?
|
||||
InviteList.create(:user_id => user.id, :project_id => project.id)
|
||||
end
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
@project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true, :token => @token.value)
|
||||
mail :to => email, :subject => @subject
|
||||
|
@ -83,13 +88,10 @@ class Mailer < ActionMailer::Base
|
|||
# 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言
|
||||
def send_for_user_activities(user, date_to, days)
|
||||
date_from = date_to - days.days
|
||||
|
||||
subject = "[ #{user.show_name}#{l(:label_day_mail)}]"
|
||||
@subject = " #{user.show_name}#{l(:label_day_mail)}"
|
||||
|
||||
date_from = "#{date_from} 17:59:59"
|
||||
date_to = "#{date_to} 17:59:59"
|
||||
|
||||
# 生成token用于直接点击登录
|
||||
@user = user
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
|
@ -100,34 +102,33 @@ class Mailer < ActionMailer::Base
|
|||
project_ids = projects.map{|project| project.id}.join(",")
|
||||
course_ids = courses.map {|course| course.id}.join(",")
|
||||
|
||||
# 查询user的缺陷,包括发布的,跟踪的以及被指派的缺陷
|
||||
sql = "select DISTINCT i.* from issues i, watchers w
|
||||
where (i.assigned_to_id = #{user.id} or i.author_id = #{user.id}
|
||||
or (w.watchable_type = 'Issue' and w.watchable_id = i.id and w.user_id = #{user.id}))
|
||||
and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
|
||||
# 查询user的缺陷,项目中成员都能收到
|
||||
sql = "select * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
|
||||
and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
|
||||
@issues = Issue.find_by_sql(sql)
|
||||
|
||||
# @bids 查询课程作业,包括老师发布的作业,以及user提交作业
|
||||
# @attachments查询课程课件更新
|
||||
@attachments ||= []
|
||||
|
||||
@bids ||= [] # 老师发布的作业
|
||||
|
||||
unless courses.first.nil?
|
||||
count = courses.count
|
||||
count = count - 1
|
||||
for i in 0..count do
|
||||
bids = courses[i].homeworks.where("bids.created_on between '#{date_from}' and '#{date_to}'").order("bids.created_on desc")
|
||||
bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order("homework_commons.created_at desc")
|
||||
attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC')
|
||||
@bids += bids if bids.count > 0
|
||||
@attachments += attachments if attachments.count > 0
|
||||
@bids += bids if bids.count > 0
|
||||
@attachments += attachments if attachments.count > 0
|
||||
|
||||
end
|
||||
end
|
||||
# user 提交的作业
|
||||
@homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
|
||||
# @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
|
||||
|
||||
# 查询user在课程。项目中发布的讨论帖子
|
||||
messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||
messages = Message.find_by_sql("select me.* from messages me, boards b, members m where
|
||||
b.id = me.board_id and b.project_id = m.project_id and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||
# messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||
@course_messages ||= []
|
||||
@project_messages ||= []
|
||||
unless messages.first.nil?
|
||||
|
@ -139,6 +140,7 @@ class Mailer < ActionMailer::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 查询user在课程中发布的通知,项目中发的新闻
|
||||
@course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n
|
||||
where n.course_id in (#{course_ids})
|
||||
|
@ -151,18 +153,13 @@ class Mailer < ActionMailer::Base
|
|||
jour_type='Course' and user_id = #{user.id}
|
||||
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||
@user_journal_messages = user.journals_for_messages.where("m_parent_id IS NULL and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC')
|
||||
|
||||
|
||||
# 查询user新建贴吧或发布帖子
|
||||
@forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc")
|
||||
@memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id}))
|
||||
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
|
||||
|
||||
|
||||
has_content = [@issues,@homeworks,@course_messages,@project_messages,@course_news,@project_news,
|
||||
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o|
|
||||
!o.empty?
|
||||
}
|
||||
has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news,
|
||||
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?}
|
||||
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
|
||||
#有内容才发,没有不发
|
||||
mail :to => user.mail,:subject => subject if has_content
|
||||
|
@ -202,8 +199,8 @@ class Mailer < ActionMailer::Base
|
|||
@title = "#@user #{t(:label_leave_your_message, :locale => 'zh')}"
|
||||
@issue_author_url = url_for(user_activities_url(@user))
|
||||
@url = case journals_for_message.jour.class.to_s.to_sym # 判断留言的对象所属类型
|
||||
when :Bid
|
||||
course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
# when :Bid
|
||||
# course_for_bid_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
when :Project
|
||||
return -1 if journals_for_message.jour.project_type == Project::ProjectType_project
|
||||
project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
|
||||
|
@ -239,12 +236,12 @@ class Mailer < ActionMailer::Base
|
|||
mail :to => @recipients,
|
||||
:subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ",
|
||||
:filter => true
|
||||
elsif journals_for_message.jour.class.to_s.to_sym == :Bid
|
||||
if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||
return -1
|
||||
end
|
||||
|
||||
mail :to => recipients, :subject => @title,:filter => true
|
||||
# elsif journals_for_message.jour.class.to_s.to_sym == :Bid
|
||||
# if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||
# return -1
|
||||
# end
|
||||
#
|
||||
# mail :to => recipients, :subject => @title,:filter => true
|
||||
elsif journals_for_message.jour.class.to_s.to_sym == :Contest
|
||||
if !journals_for_message.jour.author.notify_about? journals_for_message
|
||||
return -1
|
||||
|
@ -277,11 +274,11 @@ class Mailer < ActionMailer::Base
|
|||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :token => @token.value)
|
||||
|
||||
# edit
|
||||
@issue_author_url = url_for(user_activities_url(@author,:token => @token.value))
|
||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value)
|
||||
# edit
|
||||
@issue_author_url = url_for(user_activities_url(@author,:token => @token.value))
|
||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value)
|
||||
|
||||
@user_url = url_for(my_account_url(user,:token => @token.value))
|
||||
@user_url = url_for(my_account_url(user,:token => @token.value))
|
||||
|
||||
|
||||
subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
|
||||
|
@ -289,13 +286,13 @@ class Mailer < ActionMailer::Base
|
|||
:subject => subject,
|
||||
:filter => true
|
||||
end
|
||||
# issue.attachments.each do |attach|
|
||||
# attachments["#{attach.filename}"] = File.read("#{attach.disk_filename}")
|
||||
# end
|
||||
# cc = issue.watcher_recipients - recipients
|
||||
#mail.attachments['test'] = File.read("#{RAILS.root}/files/2015/01/150114094010_libegl.dll")
|
||||
# issue.attachments.each do |attach|
|
||||
# attachments["#{attach.filename}"] = File.read("#{attach.disk_filename}")
|
||||
# end
|
||||
# cc = issue.watcher_recipients - recipients
|
||||
#mail.attachments['test'] = File.read("#{RAILS.root}/files/2015/01/150114094010_libegl.dll")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Builds a Mail::Message object used to email recipients of the edited issue.
|
||||
|
@ -324,13 +321,13 @@ class Mailer < ActionMailer::Base
|
|||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value)
|
||||
@user_url = url_for(my_account_url(user,:token => @token.value))
|
||||
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}", :token => @token.value)
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}", :token => @token.value)
|
||||
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] "
|
||||
s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
|
||||
s << issue.subject
|
||||
@issue = issue
|
||||
@journal = journal
|
||||
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}")
|
||||
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}")
|
||||
mail :to => recipients,
|
||||
:subject => s,
|
||||
:filter => true
|
||||
|
@ -360,10 +357,10 @@ class Mailer < ActionMailer::Base
|
|||
@issues = issues
|
||||
@days = days
|
||||
@issues_url = url_for(:controller => 'issues', :action => 'index',
|
||||
:set_filter => 1, :assigned_to_id => user.id,
|
||||
:sort => 'due_date:asc')
|
||||
:set_filter => 1, :assigned_to_id => user.id,
|
||||
:sort => 'due_date:asc')
|
||||
mail :to => user.mail,
|
||||
:subject => l(:mail_subject_reminder, :count => issues.size, :days => days)
|
||||
:subject => l(:mail_subject_reminder, :count => issues.size, :days => days)
|
||||
end
|
||||
|
||||
#缺陷到期邮件通知
|
||||
|
@ -494,8 +491,8 @@ class Mailer < ActionMailer::Base
|
|||
@news = news
|
||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
mail :to => news.recipients,
|
||||
:subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
:filter => true
|
||||
:subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
:filter => true
|
||||
elsif news.course
|
||||
redmine_headers 'Course' => news.course.id
|
||||
@author = news.author
|
||||
|
@ -526,9 +523,9 @@ class Mailer < ActionMailer::Base
|
|||
@comment = comment
|
||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
mail :to => news.recipients,
|
||||
:cc => news.watcher_recipients,
|
||||
:subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
:filter => true
|
||||
:cc => news.watcher_recipients,
|
||||
:subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
:filter => true
|
||||
elsif news.course
|
||||
redmine_headers 'Course' => news.course.id
|
||||
@author = comment.author
|
||||
|
@ -563,9 +560,9 @@ class Mailer < ActionMailer::Base
|
|||
@message = message
|
||||
@message_url = url_for(message.event_url)
|
||||
mail :to => recipients,
|
||||
:cc => cc,
|
||||
:subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
||||
:filter => true
|
||||
:cc => cc,
|
||||
:subject => "[#{message.board.project.name} - #{message.board.name} - msg#{message.root.id}] #{message.subject}",
|
||||
:filter => true
|
||||
elsif message.course
|
||||
redmine_headers 'Course' => message.course.id,
|
||||
'Topic-Id' => (message.parent_id || message.id)
|
||||
|
@ -598,12 +595,12 @@ class Mailer < ActionMailer::Base
|
|||
cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
@wiki_content = wiki_content
|
||||
@wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
||||
:project_id => wiki_content.project,
|
||||
:id => wiki_content.page.title)
|
||||
:project_id => wiki_content.project,
|
||||
:id => wiki_content.page.title)
|
||||
mail :to => recipients,
|
||||
:cc => cc,
|
||||
:subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}",
|
||||
:filter => true
|
||||
:cc => cc,
|
||||
:subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_added, :id => wiki_content.page.pretty_title)}",
|
||||
:filter => true
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email the recipients of a project of the specified wiki content was updated.
|
||||
|
@ -620,15 +617,15 @@ class Mailer < ActionMailer::Base
|
|||
cc = wiki_content.page.wiki.watcher_recipients + wiki_content.page.watcher_recipients - recipients
|
||||
@wiki_content = wiki_content
|
||||
@wiki_content_url = url_for(:controller => 'wiki', :action => 'show',
|
||||
:project_id => wiki_content.project,
|
||||
:id => wiki_content.page.title)
|
||||
:project_id => wiki_content.project,
|
||||
:id => wiki_content.page.title)
|
||||
@wiki_diff_url = url_for(:controller => 'wiki', :action => 'diff',
|
||||
:project_id => wiki_content.project, :id => wiki_content.page.title,
|
||||
:version => wiki_content.version)
|
||||
:project_id => wiki_content.project, :id => wiki_content.page.title,
|
||||
:version => wiki_content.version)
|
||||
mail :to => recipients,
|
||||
:cc => cc,
|
||||
:subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}",
|
||||
:filter => true
|
||||
:cc => cc,
|
||||
:subject => "[#{wiki_content.project.name}] #{l(:mail_subject_wiki_content_updated, :id => wiki_content.page.pretty_title)}",
|
||||
:filter => true
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email the specified user their account information.
|
||||
|
@ -642,7 +639,7 @@ class Mailer < ActionMailer::Base
|
|||
@password = password
|
||||
@login_url = url_for(:controller => 'account', :action => 'login')
|
||||
mail :to => user.mail,
|
||||
:subject => l(:mail_subject_register, Setting.app_title)
|
||||
:subject => l(:mail_subject_register, Setting.app_title)
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email all active administrators of an account activation request.
|
||||
|
@ -655,10 +652,10 @@ class Mailer < ActionMailer::Base
|
|||
recipients = User.active.where(:admin => true).all.collect { |u| u.mail }.compact
|
||||
@user = user
|
||||
@url = url_for(:controller => 'users', :action => 'index',
|
||||
:status => User::STATUS_REGISTERED,
|
||||
:sort_key => 'created_on', :sort_order => 'desc')
|
||||
:status => User::STATUS_REGISTERED,
|
||||
:sort_key => 'created_on', :sort_order => 'desc')
|
||||
mail :to => recipients,
|
||||
:subject => l(:mail_subject_account_activation_request, Setting.app_title)
|
||||
:subject => l(:mail_subject_account_activation_request, Setting.app_title)
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email the specified user that their account was activated by an administrator.
|
||||
|
@ -671,7 +668,7 @@ class Mailer < ActionMailer::Base
|
|||
@user = user
|
||||
@login_url = url_for(:controller => 'account', :action => 'login')
|
||||
mail :to => user.mail,
|
||||
:subject => l(:mail_subject_register, Setting.app_title)
|
||||
:subject => l(:mail_subject_register, Setting.app_title)
|
||||
end
|
||||
|
||||
def lost_password(token)
|
||||
|
@ -679,7 +676,7 @@ class Mailer < ActionMailer::Base
|
|||
@token = token
|
||||
@url = url_for(:controller => 'account', :action => 'lost_password', :token => token.value)
|
||||
mail :to => token.user.mail,
|
||||
:subject => l(:mail_subject_lost_password, Setting.app_title)
|
||||
:subject => l(:mail_subject_lost_password, Setting.app_title)
|
||||
end
|
||||
|
||||
def register(token)
|
||||
|
@ -687,14 +684,14 @@ class Mailer < ActionMailer::Base
|
|||
@token = token
|
||||
@url = url_for(:controller => 'account', :action => 'activate', :token => token.value)
|
||||
mail :to => token.user.mail,
|
||||
:subject => l(:mail_subject_register, Setting.app_title)
|
||||
:subject => l(:mail_subject_register, Setting.app_title)
|
||||
end
|
||||
|
||||
def test_email(user)
|
||||
set_language_if_valid(user.language)
|
||||
@url = url_for(:controller => 'welcome')
|
||||
mail :to => user.mail,
|
||||
:subject => 'forge test'
|
||||
:subject => 'forge test'
|
||||
end
|
||||
|
||||
# Overrides default deliver! method to prevent from sending an email
|
||||
|
@ -702,8 +699,8 @@ class Mailer < ActionMailer::Base
|
|||
def deliver!(mail = @mail)
|
||||
set_language_if_valid @initial_language
|
||||
return false if (recipients.nil? || recipients.empty?) &&
|
||||
(cc.nil? || cc.empty?) &&
|
||||
(bcc.nil? || bcc.empty?)
|
||||
(cc.nil? || cc.empty?) &&
|
||||
(bcc.nil? || bcc.empty?)
|
||||
|
||||
|
||||
# Log errors when raise_delivery_errors is set to false, Rails does not
|
||||
|
@ -735,8 +732,8 @@ class Mailer < ActionMailer::Base
|
|||
user_ids = options[:users]
|
||||
|
||||
scope = Issue.open.where("#{Issue.table_name}.assigned_to_id IS NOT NULL" +
|
||||
" AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" +
|
||||
" AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date
|
||||
" AND #{Project.table_name}.status = #{Project::STATUS_ACTIVE}" +
|
||||
" AND #{Issue.table_name}.due_date <= ?", days.day.from_now.to_date
|
||||
)
|
||||
scope = scope.where(:assigned_to_id => user_ids) if user_ids.present?
|
||||
scope = scope.where(:project_id => project.id) if project
|
||||
|
@ -800,12 +797,12 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
def mail(headers={})
|
||||
headers.merge! 'X-Mailer' => 'Redmine',
|
||||
'X-Redmine-Host' => Setting.host_name,
|
||||
'X-Redmine-Site' => Setting.app_title,
|
||||
'X-Auto-Response-Suppress' => 'OOF',
|
||||
'Auto-Submitted' => 'auto-generated',
|
||||
'From' => Setting.mail_from,
|
||||
'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>"
|
||||
'X-Redmine-Host' => Setting.host_name,
|
||||
'X-Redmine-Site' => Setting.app_title,
|
||||
'X-Auto-Response-Suppress' => 'OOF',
|
||||
'Auto-Submitted' => 'auto-generated',
|
||||
'From' => Setting.mail_from,
|
||||
'List-Id' => "<#{Setting.mail_from.to_s.gsub('@', '.')}>"
|
||||
|
||||
# Removes the author from the recipients and cc
|
||||
# if he doesn't want to receive notifications about what he does
|
||||
|
@ -851,7 +848,7 @@ class Mailer < ActionMailer::Base
|
|||
set_language_if_valid Setting.default_language
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
def self.deliver_mail(mail)
|
||||
return false if mail.to.blank? && mail.cc.blank? && mail.bcc.blank?
|
||||
Thread.new do
|
||||
|
@ -898,7 +895,7 @@ class Mailer < ActionMailer::Base
|
|||
end
|
||||
|
||||
def mylogger
|
||||
if Setting.delayjob_enabled?
|
||||
if Setting.delayjob_enabled?
|
||||
Delayed::Worker.logger
|
||||
else
|
||||
Rails.logger
|
||||
|
|
|
@ -117,10 +117,11 @@ class Member < ActiveRecord::Base
|
|||
# 查找每个学生每个作业的评分
|
||||
def student_homework_score
|
||||
score_count = 0
|
||||
homework_score = HomeworkAttach.find_by_sql("SELECT bids.name, homework_attaches.score as score
|
||||
FROM homework_attaches, bids where homework_attaches.user_id = #{self.user_id}
|
||||
and homework_attaches.bid_id IN (SELECT bid_id FROM homework_for_courses where course_id = #{self.course_id})
|
||||
AND homework_attaches.bid_id = bids.id ")
|
||||
homework_score = StudentWork.find_by_sql("SELECT homework_commons.name,student_works.final_score as score
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{self.course_id}
|
||||
AND student_works.user_id = #{self.user_id}")
|
||||
homework_score.each do |homework|
|
||||
mem_score = 0
|
||||
if homework[:score]
|
||||
|
|
|
@ -34,6 +34,8 @@ class Message < ActiveRecord::Base
|
|||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# end
|
||||
|
||||
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
|
||||
|
||||
acts_as_searchable :columns => ['subject', 'content'],
|
||||
:include => {:board => :project},
|
||||
:project_key => "#{Board.table_name}.project_id",
|
||||
|
@ -148,6 +150,19 @@ class Message < ActiveRecord::Base
|
|||
usr && usr.logged? && (usr.allowed_to?(:delete_messages, project) || (self.author == usr && usr.allowed_to?(:delete_own_messages, project)))
|
||||
end
|
||||
|
||||
def set_notify_id(notify_id)
|
||||
@notify_id= notify_id
|
||||
end
|
||||
def get_notify_id()
|
||||
return @notify_id
|
||||
end
|
||||
def set_notify_is_read(notify_is_read)
|
||||
@notify_is_read = notify_is_read
|
||||
end
|
||||
def get_notify_is_read()
|
||||
return @notify_is_read
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def add_author_as_watcher
|
||||
|
@ -218,4 +233,5 @@ class Message < ActiveRecord::Base
|
|||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ class Project < ActiveRecord::Base
|
|||
|
||||
# Specific overidden Activities
|
||||
|
||||
belongs_to :homework_attach
|
||||
has_many :student_works
|
||||
has_many :time_entry_activities
|
||||
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
|
||||
has_many :memberships, :class_name => 'Member'
|
||||
|
@ -67,7 +67,7 @@ class Project < ActiveRecord::Base
|
|||
has_many :student, :through => :students_for_courses, :source => :user
|
||||
has_one :course_extra, :class_name => 'Course', :foreign_key => :extra,:primary_key => :identifier, :dependent => :destroy
|
||||
has_many :applied_projects
|
||||
# has_many :invite_lists
|
||||
has_many :invite_lists
|
||||
|
||||
# end
|
||||
#ADDED BY NIE
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#学生提交作品表
|
||||
class StudentWork < ActiveRecord::Base
|
||||
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :project_id
|
||||
|
||||
belongs_to :homework_common
|
||||
belongs_to :user
|
||||
has_many :student_works_evaluation_distributions, :dependent => :destroy
|
||||
has_many :student_works_scores, :dependent => :destroy
|
||||
belongs_to :project
|
||||
|
||||
acts_as_attachable
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
#学生作品匿评分配表
|
||||
class StudentWorksEvaluationDistribution < ActiveRecord::Base
|
||||
attr_accessible :student_work_id, :user_id
|
||||
|
||||
belongs_to :student_work
|
||||
belongs_to :user
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
class StudentWorksScore < ActiveRecord::Base
|
||||
#reviewer_role: 1:教师评分;2:教辅评分;3:学生匿评
|
||||
attr_accessible :student_work_id, :user_id, :score, :comment, :reviewer_role
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :student_work
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
|
||||
acts_as_attachable
|
||||
end
|
|
@ -75,13 +75,18 @@ class User < Principal
|
|||
has_many :homework_users
|
||||
has_many :homework_attaches, :through => :homework_users
|
||||
has_many :homework_evaluations
|
||||
|
||||
#问卷相关关关系
|
||||
has_many :poll_users, :dependent => :destroy
|
||||
has_many :poll_votes, :dependent => :destroy
|
||||
has_many :poll, :dependent => :destroy #用户创建的问卷
|
||||
has_many :answers, :source => :poll, :through => :poll_users, :dependent => :destroy #用户已经完成问答的问卷
|
||||
# end
|
||||
#作业相关关系
|
||||
has_many :homework_commons, :dependent => :destroy
|
||||
has_many :student_works, :dependent => :destroy
|
||||
has_many :student_works_evaluation_distributions, :dependent => :destroy
|
||||
has_many :student_works_scores, :dependent => :destroy
|
||||
#end
|
||||
|
||||
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
|
||||
:after_remove => Proc.new {|user, group| group.user_removed(user)}
|
||||
|
@ -92,7 +97,7 @@ class User < Principal
|
|||
belongs_to :auth_source
|
||||
belongs_to :ucourse, :class_name => 'Course', :foreign_key => :id #huang
|
||||
## added by xianbo for delete
|
||||
has_many :biding_projects, :dependent => :destroy
|
||||
# has_many :biding_projects, :dependent => :destroy
|
||||
has_many :contesting_projects, :dependent => :destroy
|
||||
belongs_to :softapplication, :foreign_key => 'id', :dependent => :destroy
|
||||
##ended by xianbo
|
||||
|
@ -100,7 +105,7 @@ class User < Principal
|
|||
#####fq
|
||||
has_many :jours, :class_name => 'JournalsForMessage', :dependent => :destroy
|
||||
has_many :journals_messages, :class_name => 'JournalsForMessage', :foreign_key => "user_id", :dependent => :destroy
|
||||
has_many :bids, :foreign_key => 'author_id', :dependent => :destroy
|
||||
# has_many :bids, :foreign_key => 'author_id', :dependent => :destroy
|
||||
has_many :contests, :foreign_key => 'author_id', :dependent => :destroy
|
||||
has_many :softapplications, :foreign_key => 'user_id', :dependent => :destroy
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
|
@ -261,16 +266,6 @@ class User < Principal
|
|||
end
|
||||
end
|
||||
|
||||
# 判断用户是否加入了竞赛中 fq
|
||||
def join_in_contest?(bid)
|
||||
joined = JoinInContest.where('user_id = ? and bid_id =?', self.id, bid.id)
|
||||
if joined.size > 0
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
### fq
|
||||
def join_in?(course)
|
||||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', self.id, course.id)
|
||||
|
@ -282,15 +277,18 @@ class User < Principal
|
|||
end
|
||||
|
||||
def show_name
|
||||
name = ""
|
||||
unless self.user_extensions.nil?
|
||||
if self.user_extensions.identity == 2
|
||||
firstname
|
||||
name = firstname
|
||||
else
|
||||
lastname+firstname
|
||||
name = lastname+firstname
|
||||
end
|
||||
else
|
||||
lastname+firstname
|
||||
name = lastname+firstname
|
||||
end
|
||||
name = name.empty? || name.nil? ? login : name
|
||||
name
|
||||
end
|
||||
## end
|
||||
|
||||
|
|
|
@ -255,7 +255,9 @@ class UsersService
|
|||
watcher.push(params[:user_id])
|
||||
scope = scope.where("id not in (?)",watcher)
|
||||
end
|
||||
scope = scope.like(params[:name],search_by)
|
||||
#scope = scope.like(params[:name],search_by)
|
||||
scope = scope.where("( LOWER(login) LIKE ? or LOWER(concat(lastname, firstname)) LIKE ? or LOWER(mail) LIKE ? )",
|
||||
"%#{params[:name]}%","%#{params[:name]}%","%#{params[:name]}%")
|
||||
end
|
||||
#modify by yutao 2015/5/18 没有params[:user_id]参数时去掉"id not in (?)"条件 end
|
||||
else
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#coding=utf-8
|
||||
#
|
||||
class OfficeConverTask
|
||||
def conver(source_file, saved_file)
|
||||
office = Trustie::Utils::Office.new(source_file)
|
||||
if office.conver(saved_file)
|
||||
Rails.logger.info "process ok: #{saved_file} "
|
||||
end
|
||||
end
|
||||
handle_asynchronously :conver,:queue => 'office_conver'
|
||||
end
|
||||
|
|
@ -0,0 +1 @@
|
|||
<%= @result == false ? 'false' : 'true' %>
|
|
@ -1,26 +1,30 @@
|
|||
var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>');
|
||||
//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start
|
||||
var containerid=$('.remove-upload',attachment_html_obj).data('containerid');
|
||||
if(containerid==undefined){
|
||||
$('#attachments_<%= j params[:attachment_id] %>').remove();
|
||||
var count=$('#attachments_fields>span').length;
|
||||
if(count<=0){
|
||||
$("#upload_file_count").text('<%= l(:label_no_file_uploaded)%>');
|
||||
$(".remove_all").remove();
|
||||
<% if @is_destroy%>
|
||||
$("#attachment_<%= @attachment.id%>").remove();
|
||||
<%else%>
|
||||
var attachment_html_obj = $('#attachments_<%= j params[:attachment_id] %>');
|
||||
//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 start
|
||||
var containerid=$('.remove-upload',attachment_html_obj).data('containerid');
|
||||
if(containerid==undefined){
|
||||
$('#attachments_<%= j params[:attachment_id] %>').remove();
|
||||
var count=$('#attachments_fields>span').length;
|
||||
if(count<=0){
|
||||
$("#upload_file_count").text('<%= l(:label_no_file_uploaded)%>');
|
||||
$(".remove_all").remove();
|
||||
}else{
|
||||
$("#upload_file_count").html("<span id=\"count\">"+count+"</span>"+"个文件"+"已上传");
|
||||
}
|
||||
}else{
|
||||
$("#upload_file_count").html("<span id=\"count\">"+count+"</span>"+"个文件"+"已上传");
|
||||
$('#attachments_<%= j params[:attachment_id] %>').remove();
|
||||
var count=$('#attachments_fields'+containerid+'>span').length;
|
||||
if(count<=0){
|
||||
$('#upload_file_count'+containerid).text('<%= l(:label_no_file_uploaded)%>');
|
||||
var remove_all_html_obj = $(".remove_all").filter(function(index){
|
||||
return $(this).data('containerid')==containerid;
|
||||
});
|
||||
remove_all_html_obj.remove();
|
||||
}else{
|
||||
$('#upload_file_count'+containerid).html("<span id=\"count\">"+count+"</span>"+"个文件"+"已上传");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$('#attachments_<%= j params[:attachment_id] %>').remove();
|
||||
var count=$('#attachments_fields'+containerid+'>span').length;
|
||||
if(count<=0){
|
||||
$('#upload_file_count'+containerid).text('<%= l(:label_no_file_uploaded)%>');
|
||||
var remove_all_html_obj = $(".remove_all").filter(function(index){
|
||||
return $(this).data('containerid')==containerid;
|
||||
});
|
||||
remove_all_html_obj.remove();
|
||||
}else{
|
||||
$('#upload_file_count'+containerid).html("<span id=\"count\">"+count+"</span>"+"个文件"+"已上传");
|
||||
}
|
||||
}
|
||||
//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end
|
||||
//modify by yutao 2015-5-14 当1个页面存在多个上传控件时此块代码存在bug 故改之 end
|
||||
<% end%>
|
|
@ -11,7 +11,4 @@ fileSpan.find('a.remove-upload')
|
|||
})
|
||||
.off('click');
|
||||
$('<input>', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan);
|
||||
|
||||
//var divattach = fileSpan.find('div.div_attachments');
|
||||
//divattach.html('<%= j(render :partial => 'tags/tagEx', :locals => {:obj => @attachment, :object_flag => "6"})%>');
|
||||
<% end %>
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
:html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
|
||||
|
||||
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
|
||||
<input name="parent_topic" type="hidden" value=""/>
|
||||
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
|
||||
<div style="padding-top:5px;" class="fr">
|
||||
<a href="javascript:void(0)" nhname="cancelbtn" class="grey_btn fr ml10" style=""><%= l(:button_cancel)%></a>
|
||||
|
@ -127,7 +128,7 @@
|
|||
<ul>
|
||||
<% replies_all.each do |message| %>
|
||||
<% replies_all_i=replies_all_i+1 %>
|
||||
<li nhname="reply_rec" style="display:<%= replies_all_i>2?'none':'' %>">
|
||||
<li nhname="reply_rec" style="display:<%= replies_all_i>2?'none':'' %>" id="topic<%=message.id%>">
|
||||
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
|
||||
<div class="Msg_txt">
|
||||
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
|
||||
|
@ -151,6 +152,7 @@
|
|||
:nhname =>'showbtn_child_reply',
|
||||
:class => ' c_dblue fr',
|
||||
:style => 'margin-right: 10px;',
|
||||
'data-topic-id' =>message.id,
|
||||
:title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -172,7 +174,8 @@
|
|||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
<%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
|
||||
</ul>
|
||||
<%# other_formats_links do |f| %>
|
||||
<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||
|
@ -255,6 +258,18 @@
|
|||
}
|
||||
nh_init_board(params);
|
||||
});
|
||||
|
||||
<% if( @params[:topic_id]!=nil && @params[:topic_id]!='' && @params[:page]==nil ) %>
|
||||
var nh_dw_html = $("#topic<%=@params[:topic_id]%>");
|
||||
if(nh_dw_html!=undefined && nh_dw_html.length!=0){
|
||||
if(nh_dw_html.is(':hidden')){
|
||||
$("a[nhname='reply_ex_btn']",nh_dw_html.parent('ul').parent('div').parent('div')).click();
|
||||
}
|
||||
$("#nhjump").attr('href','#'+nh_dw_html.attr('id'));
|
||||
$("#nhjump")[0].click();
|
||||
|
||||
}
|
||||
<% end %>
|
||||
<% if(!@flag.nil? && @flag=='true') %>
|
||||
if($("#new_topic_btn")!=undefined)$("#new_topic_btn").click();
|
||||
<% end %>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
<style>
|
||||
.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
|
||||
.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
|
||||
.ke-toolbar-icon-url{background-image:url( '/images/public_icon.png' )}
|
||||
.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
|
||||
.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
|
||||
.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
||||
.ke-toolbar .ke-outline{border:none;}
|
||||
<style type="text/css">
|
||||
/*div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
|
||||
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
|
||||
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
|
||||
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
|
||||
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
|
||||
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
||||
div.ke-toolbar .ke-outline{border:none;}*/
|
||||
.break_word {width:100%;}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
|
@ -13,7 +13,9 @@
|
|||
var menuids=["TopUserNav"] //Enter id(s) of SuckerTree UL menus, separated by commas
|
||||
function buildsubmenus(){
|
||||
for (var i=0; i<menuids.length; i++){
|
||||
var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
|
||||
var div = document.getElementById(menuids[i]);
|
||||
if(div == undefined)continue;
|
||||
var ultags=div.getElementsByTagName("ul")
|
||||
for (var t=0; t<ultags.length; t++){
|
||||
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
|
||||
ultags[t].parentNode.onmouseover=function(){
|
||||
|
@ -31,7 +33,8 @@
|
|||
else if (window.attachEvent)
|
||||
window.attachEvent("onload", buildsubmenus)
|
||||
</script>
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%#= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
|
||||
|
||||
<% if @project %>
|
||||
<%= render :partial => 'project_show', locals: {project: @project} %>
|
||||
|
@ -121,21 +124,20 @@ function nh_init_board(params){
|
|||
if(params.textarea.data('init') == undefined){
|
||||
//初始化编辑器
|
||||
var editor = params.kindutil.create(params.textarea, {
|
||||
resizeType : 1,
|
||||
allowPreviewEmoticons : false,
|
||||
allowImageUpload : false,
|
||||
minWidth:"1px",
|
||||
width:"565px",
|
||||
items : ['emoticons'],
|
||||
// allowPreviewEmoticons : false,
|
||||
// allowImageUpload : false,
|
||||
resizeType : 1,minWidth:"1px",width:"565px",height:"150px",
|
||||
allowFileManager:true,uploadJson:"/kindeditor/upload",
|
||||
fileManagerJson:"/kindeditor/filemanager",
|
||||
afterChange:function(){//按键事件
|
||||
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
|
||||
},
|
||||
afterCreate:function(){
|
||||
var toolbar = $("div[class='ke-toolbar']",params.about_talk);
|
||||
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
|
||||
params.toolbar_container.append(toolbar);
|
||||
// var toolbar = $("div[class='ke-toolbar']",params.about_talk);
|
||||
// $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
|
||||
// params.toolbar_container.append(toolbar);
|
||||
}
|
||||
});
|
||||
}).loadPlugin('paste');
|
||||
|
||||
//主题输入框按键事件
|
||||
params.inputsubject.keyup(function(){
|
||||
|
@ -201,6 +203,8 @@ function nh_init_board(params){
|
|||
params.cancelbtn.click();
|
||||
}
|
||||
}
|
||||
var parent_topic_id = $(this).data('topic-id');
|
||||
if(parent_topic_id!=undefined)$("input[name='parent_topic']",params.form).val(parent_topic_id);
|
||||
var ref_str = params.get_ref_str_call($(this));
|
||||
params.quote_show.html(ref_str);
|
||||
params.quote_input.html(ref_str);
|
||||
|
|
|
@ -46,8 +46,8 @@
|
|||
|
||||
<div class="information_for_course" >
|
||||
<p class="stats">
|
||||
<%= content_tag('span', link_to("#{@course.homeworks.count}", homework_course_path(@course)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_task, :count => @course.homeworks.count)) %>
|
||||
<%= content_tag('span', link_to("#{@course.homework_commons.count}", homework_common_index_path(:course => @course.id)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_task, :count => @course.homework_commons.count)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<% files_count = @course.attachments.count %>
|
||||
|
|
|
@ -1,24 +1,5 @@
|
|||
<style>
|
||||
table,tr,td{border:0; cellspacing:0; cellpadding:0;}
|
||||
ul,li{ list-style-type:none}
|
||||
.cl{ clear:both; overflow:hidden; }
|
||||
a{ text-decoration:none; text-align:center; }
|
||||
a:hover{ text-decoration:underline;}
|
||||
/**** 常用***/
|
||||
.f_l{ float:left;}
|
||||
.f_r{ float:right;}
|
||||
.b_lblue{ background:#64bdd9;}
|
||||
.b_dblue{ background:#55a1b9; cursor:pointer;}
|
||||
.f_b{ font-weight: bold;}
|
||||
.c_blue{ color:#64bdd9;}
|
||||
.c_grey{ color:#999999;}
|
||||
.c_grey02{ color:#666666;}
|
||||
.f_14{ font-size:14px;}
|
||||
.c_dblue{ color:#3e6d8e;}
|
||||
.w90{width:90px;}
|
||||
.ml10{margin-left:10px;}
|
||||
.ml5{margin-left:5px;}
|
||||
.b_grey{ background:#a3a3a3;}
|
||||
.c_blue02{ color:#15bcce; font-weight: bold;}
|
||||
.w280{ display:block; width:280px;float:left;}
|
||||
.w70{ display:block;width:70px; text-align:center; float:left;}
|
||||
|
@ -26,9 +7,6 @@
|
|||
.c_blue03{ color:#0d90c4;}
|
||||
|
||||
|
||||
/***弹框***/
|
||||
/*#popbox_tscore{width:480px;position:absolute;z-index:100;left:50%;top:50%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}*/
|
||||
/*.alert .close02{width:26px;height:26px;overflow:hidden;position:absolute;top:-10px;right:-490px;background:url(images/close.png) no-repeat;cursor:pointer;}*/
|
||||
.tscore_con h2{ display:block; background:#eaeaea; font-size:14px; color:#343333; height:31px; width: auto; text-align: center; padding-top:5px;}
|
||||
.tscore_box{ width:350px; margin:15px auto;}
|
||||
.tscore_box li{ height:25px;}
|
||||
|
@ -40,11 +18,16 @@
|
|||
<ul class="tscore_box">
|
||||
<li ><span class="c_blue02 w280">作业名称</span><span class="c_blue02 w70">得分</span></li>
|
||||
<% @member_score.student_homework_score[0].each do |homework_score| %>
|
||||
|
||||
<li><span class="c_grey02 w280"><%= homework_score.name %></span><span class="c_red w70"><%= format("%0.2f",homework_score[:score].nil? ? 0 : homework_score[:score]) %></span></li>
|
||||
<li>
|
||||
<span class="c_grey02 w280">
|
||||
<%= homework_score.name %>
|
||||
</span>
|
||||
<span class="c_red w70">
|
||||
<%= format("%0.2f",homework_score[:score].nil? ? 0 : homework_score[:score]) %>
|
||||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
<li><span class="c_blue03 w280">作业积分(总得分)</span><span class="c_red w70"><%= @member_score.student_homework_score[1] %></span></li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2">
|
||||
<%= l(:label_homework)%>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="talk_top">
|
||||
<p class="fl">
|
||||
<%= l(:label_totle)%><span><%= @obj_count%></span><%= l(:label_homework_count)%>
|
||||
</p>
|
||||
<%= link_to( l(:label_course_homework_new), new_homework_course_path(@course), :class => 'problem_new_btn fl c_dorange') if @is_teacher %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% @bids.each do |bid|%>
|
||||
<div class="problem_main">
|
||||
<%= link_to(image_tag(url_to_avatar(bid.author), :width => "42", :height => "42"), user_path(bid.author), :class => "problem_pic fl") %>
|
||||
<div class="problem_txt fl mt5">
|
||||
<%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author),:class => 'problem_name fl') %>
|
||||
<span class="fl"> <%= l(:label_user_create_project_homework) %>:</span>
|
||||
<%= link_to(bid.name, course_for_bid_path(bid), :class => 'problem_tit fl fb c_dblue') %>
|
||||
<div class="cl mb5"></div>
|
||||
<p class="fl "><%= l(:lebel_homework_commit)%> ( <%= link_to bid.homeworks.count, course_for_bid_path(bid.id), :class => 'c_red'%> )</p>
|
||||
<% if @is_teacher%>
|
||||
<%= bid_anonymous_comment(bid)%>
|
||||
<% if bid.homeworks.empty? %>
|
||||
<%= link_to(l(:button_delete),bids_homework_path(:id => bid.id), :method => :delete, :confirm => l(:label_delete_confirm), :class => "fr mr10 work_edit") %>
|
||||
<% end %>
|
||||
<%= link_to(l(:button_edit),edit_bid_path(:course_id =>@course.id, :bid_id => bid.id), :class => "fr mr10 work_edit") %>
|
||||
<% elsif @is_student%>
|
||||
<%= student_anonymous_comment bid %>
|
||||
<%= student_new_homework bid %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<script>
|
||||
$(function(){if($("#bid_description_<%= bid.id%>_content").height()>360){$("#bid_show_more_des_button<%= bid.id%>").show();}});
|
||||
</script>
|
||||
<div id="bid_description_<%= bid.id%>" class="news_description mt5">
|
||||
<div id="bid_description_<%= bid.id%>_content" class="upload_img">
|
||||
<%= bid.description.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="news_foot c_red" id="bid_show_more_des_button<%= bid.id%>" onclick="bid_show_more_des(<%= bid.id%>);" style="cursor:pointer;display: none;">
|
||||
<%= l(:button_more)%>...
|
||||
<span class="g-arr-down"></span>
|
||||
</div>
|
||||
<span class="fl"><%= l(:label_end_time)%>:<%= bid.deadline%></span>
|
||||
<% if betweentime(bid.deadline) < 0 %>
|
||||
<span class='fr mr10 c_red '>
|
||||
<%= l(:label_commit_limit)%>
|
||||
</span>
|
||||
<% else %>
|
||||
<script type="text/javascript">
|
||||
window.setInterval(function(){show_bid_dead_line(<%= bid.deadline.year%>,<%= bid.deadline.month%>,<%= bid.deadline.day + 1%>,"bid_deadline_<%= bid.id%>");},1000)
|
||||
</script>
|
||||
<div id="bid_deadline_<%= bid.id%>">
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end%>
|
||||
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
|
@ -1,4 +0,0 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= labelled_form_for @homework, :html => { :multipart => true }, :url => {:controller => 'bids', :action => 'create_homework',:course_id => "#{params[:id] || params[:course_id]}"} do |f| %>
|
||||
<%= render :partial => 'bids/new_homework_form', :locals => { :bid => @homework,:bid_id => "new_bid",:f => f,:edit_mode => false } %>
|
||||
<% end %>
|
|
@ -1,11 +1,28 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_activity)%></h2>
|
||||
<% if @controller_name=='ActivityNotifys' %>
|
||||
<a class="fl about_me" style="width:80px;" href="<%=course_path(@course)%>"><%= l(:label_activity)%></a>
|
||||
<h2 class="fl project_h2" style="width:100px;">与我相关
|
||||
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
|
||||
</h2>
|
||||
<div class="fr mt10 mr5 c_grey02">
|
||||
<a class="c_dblue">
|
||||
<label class="mr5" style="cursor:pointer;" data-href="<%= course_activity_notifys_path(@course) %>/chang_read_flag" nhname='nh_act_link_all'>全部标为已读</label>
|
||||
</a>
|
||||
</div>
|
||||
<% else %>
|
||||
<h2 class="fl project_h2"><%= l(:label_activity)%></h2>
|
||||
<% if User.current.logged? %>
|
||||
<a class="fl about_me" href="<%=course_activity_notifys_path(@course)%>">与我相关
|
||||
<span class="c_orange f12" style="display:none;">(<font id="new_notify_count"><%=get_new_notify_count(@course,'Course')%></font>)</span>
|
||||
</a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% if @events_by_day != nil && @events_by_day.size >0 %>
|
||||
<% @events_by_day.keys.sort.reverse.each do |day| %>
|
||||
<% sort_activity_events(@events_by_day[day]).each do |e, in_group| -%>
|
||||
<div class="problem_main">
|
||||
<div class="problem_main" nhname="container">
|
||||
<a class="problem_pic fl">
|
||||
<%= image_tag(url_to_avatar(e.event_author), :width => "42", :height => "42") %>
|
||||
</a>
|
||||
|
@ -14,8 +31,19 @@
|
|||
<%= link_to_user_header("(#{e.event_author})", @canShowRealName,:class => 'problem_name c_orange fl') if @canShowRealName && e.respond_to?(:event_author) %>
|
||||
<span class="fl"> </span>
|
||||
<span class="fl"> <%= l(:label_new_activity) %>:</span>
|
||||
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) :
|
||||
(e.event_type.eql?("bid") ? homework_course_path(@course) : (e.event_type.eql?("message") || e.event_type.eql?("reply") ? course_boards_path(@course,:topic_id => e.id) : e.event_url)),:class => "problem_tit c_dblue fl fb"%>
|
||||
<%
|
||||
link = (e.event_type.eql?("attachment")&&e.container.kind_of?(Course)) ? course_files_path(e.container) :
|
||||
(e.event_type.eql?("bid") ? homework_course_path(@course) :
|
||||
(e.event_type.eql?("message") || e.event_type.eql?("reply") ?
|
||||
course_boards_path(@course,:topic_id => e.id,:parent_id=>(e.parent_id ? e.parent_id : e.id)) : e.event_url))
|
||||
%>
|
||||
<%= link_to "#{eventToLanguageCourse(e.event_type, @course)} "<< format_activity_title(e.event_title), link,
|
||||
:class => "problem_tit c_dblue fl fb",'data-type'=>e.event_type,
|
||||
'data-notify-id'=>(e.respond_to?('get_notify_id') ? e.get_notify_id : ''),:nhname=>"nh_act_link",
|
||||
'data-href'=>(course_activity_notifys_path(@course)+"/chang_read_flag?an_id="+(e.respond_to?('get_notify_id') ? e.get_notify_id : '').to_s)%>
|
||||
<%if @controller_name=='ActivityNotifys' && e.get_notify_is_read!=1%>
|
||||
<span nhname="nh_act_flag" class="ml10 fl"><img src="/images/new.png" width="35" height="15"/></span>
|
||||
<%end%>
|
||||
<br />
|
||||
<p class="mt5 break_word"><%= e.event_description.html_safe %>
|
||||
<br />
|
||||
|
@ -27,8 +55,10 @@
|
|||
</div><!--课程动态 end-->
|
||||
<% end%>
|
||||
<% end%>
|
||||
<% elsif @controller_name=='ActivityNotifys' %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end%>
|
||||
<% if @obj_pages.next_page.nil? %>
|
||||
<% if @obj_pages.next_page.nil? && @controller_name!='ActivityNotifys' %>
|
||||
<div class="problem_main">
|
||||
<a class="problem_pic fl">
|
||||
<%= image_tag(url_to_avatar(@user), :width => "42", :height => "42") %>
|
||||
|
@ -51,3 +81,48 @@
|
|||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
function nh_new_notify_count_show(){
|
||||
var new_notify_count = $("#new_notify_count").html();
|
||||
if(new_notify_count>0){
|
||||
$("#new_notify_count").parent('span').show();
|
||||
}else{
|
||||
$("#new_notify_count").parent('span').hide();
|
||||
}
|
||||
}
|
||||
$("div[nhname='container']").each(function(){
|
||||
var container = $(this);
|
||||
var btn = $("a[nhname='nh_act_link']",container);
|
||||
if(btn.data('notify-id')>0){
|
||||
btn.attr('target','_blank');
|
||||
btn.click(function(){
|
||||
var flag = $("span[nhname='nh_act_flag']",container);
|
||||
if(flag!=undefined){
|
||||
var url = $(this).data('href');
|
||||
$.ajax({url:url,dataType:'text',success:function(data){
|
||||
if(data == 'true'){
|
||||
flag.remove();
|
||||
$("#new_notify_count").html($("#new_notify_count").html()-1);
|
||||
nh_new_notify_count_show();
|
||||
}
|
||||
}});
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
});
|
||||
$("label[nhname='nh_act_link_all']").click(function(){
|
||||
var url = $(this).data('href');
|
||||
$.ajax({url:url,dataType:'text',success:function(data){
|
||||
if(data == 'true'){
|
||||
$("span[nhname='nh_act_flag']").remove();
|
||||
$("#new_notify_count").html('0');
|
||||
nh_new_notify_count_show();
|
||||
}
|
||||
}});
|
||||
});
|
||||
nh_new_notify_count_show();
|
||||
});
|
||||
</script>
|
|
@ -6,8 +6,8 @@ $('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/show_me
|
|||
showModal('ajax-modal', '400px');
|
||||
//$('#ajax-modal').css('height','569px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
|
||||
"<a href='javascript:void(0)' onclick='hidden_homework_score_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').before("<span>" +
|
||||
"<a href='javascript:void(0)' onclick='hidden_homework_score_form();'><img src='/images/bid/close.png' width='26px' height='26px' style='margin-left: 375px;' /></a></span>");
|
||||
//$('#ajax-modal').parent().removeClass();
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","40%").css("position","fixed");
|
||||
$('#ajax-modal').parent().addClass("new-watcher");
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
}
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
|
|
@ -31,20 +31,21 @@
|
|||
<%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
|
||||
|
||||
<% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
|
||||
<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=>"f_l re_open c_blue",:method => :post %>
|
||||
</span>
|
||||
<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=>"f_l re_open c_blue",:method => :post %>
|
||||
</span>
|
||||
<% else %>
|
||||
<!-- <#%= link_to (file.is_public? ? "公开":"私有"),"javascript:void(0)",:class=>"f_l re_open" %> -->
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
|
||||
<% end %>
|
||||
<%= link_to '下载',download_named_attachment_path(file.id, file.filename, force: true),class: 'f_l re_open' %>
|
||||
<% else %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="">
|
||||
<div class="mt5">
|
||||
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<%= link_to( l(:button_delete), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if delete_allowed && file.container_id == @course.id && file.container_type == "Course"%>
|
||||
|
@ -65,4 +66,4 @@
|
|||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
<% else %>
|
||||
<%= link_to(l(:label_slected_to_project),quote_resource_show_project_project_file_path(project,file),:class => "f_l re_select",:remote => true) if has_project?(User.current,file) %>
|
||||
<% end %>
|
||||
<%= link_to '下载',download_named_attachment_path(file.id, file.filename, force: true),class: 'f_l re_open' %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -37,7 +38,7 @@
|
|||
<p class="f_l c_grey02 font">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<%= link_to( l(:button_delete), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if manage_allowed && file.container_id == project.id && file.container_type == "Project"%>
|
||||
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
|
@ -51,4 +52,4 @@
|
|||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => project}) %>');
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","36%");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
|
|
@ -6,6 +6,6 @@
|
|||
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
|
@ -6,6 +6,6 @@
|
|||
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'><a href='javascript:void(0)' onclick='closeModal()'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","35%");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
|
@ -0,0 +1,42 @@
|
|||
<div id="popbox02">
|
||||
<div class="ni_con">
|
||||
<% if @homework_detail_manual.comment_status == 1%>
|
||||
<h2>开启匿评功能</h2>
|
||||
<p>
|
||||
开启匿评后学生将不能对作品进行
|
||||
<span class="c_blue">修改、删除</span>
|
||||
等操作,目前有
|
||||
<span class="c_pink"><%= @totle_size%>个</span>
|
||||
学生,共提交了
|
||||
<span class="c_pink"><%= @cur_size %></span>
|
||||
份作品,占
|
||||
<span class="c_pink"><%= @percent %>%</span>,
|
||||
是否确定开启匿评?
|
||||
</p>
|
||||
<% elsif @homework_detail_manual.comment_status == 2 %>
|
||||
<h2>关闭匿评功能</h2>
|
||||
<p>
|
||||
关闭匿评后学生将不能对作品进行
|
||||
<span class="c_blue">匿评</span>
|
||||
,且作品列表将会
|
||||
<span class="c_blue">公开</span>,
|
||||
目前分配了
|
||||
<span class="c_pink"><%= @totle_size%>份</span>
|
||||
匿评作品,已评了
|
||||
<span class="c_pink"><%= @cur_size %></span>
|
||||
份作品,占
|
||||
<span class="c_pink"><%= @percent %>%</span>,
|
||||
是否确定关闭匿评?
|
||||
</p>
|
||||
<% end %>
|
||||
<div class="ni_btn">
|
||||
<a href="javascript:" class="tijiao" onclick="clickOK('<%= alert_anonyoms_path @homework,@homework_detail_manual%>');" style="margin-bottom: 20px;" >
|
||||
确 定
|
||||
</a>
|
||||
<a href="javascript:" class="tijiao" onclick="clickCanel();" style="margin-bottom: 20px;">
|
||||
取 消
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
<ul class="hwork_new_basic mb10">
|
||||
<li>
|
||||
<label class="label02 mb20">
|
||||
<span class="c_red">*</span>
|
||||
<%= l(:field_name)%>:
|
||||
</label>
|
||||
<input type="text" name="homework_common[name]" id="homework_name" class="w548 h26 fl" maxlength="<%= Bid::NAME_LENGTH_LIMIT%>" onkeyup="regex_homework_name();" value="<%= homework.name%>" >
|
||||
<p id="homework_name_span" class="c_red ml110"></p>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li >
|
||||
<label class="label02 "> <%= l(:field_quote)%>: </label>
|
||||
<!--<textarea name="" placeholder="请在此填入作业的要求及评分依据" class=" w548 h150 mb10 fl" ></textarea>-->
|
||||
<% if edit_mode %>
|
||||
<%= f.kindeditor :description,:width=>'83%',:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %>
|
||||
<% else %>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<%= f.kindeditor :description,:width=>'83%',:editor_id => 'homework_description_editor' %>
|
||||
<% end %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="mt10">
|
||||
<label class="label02"> 附件: </label>
|
||||
<%= render :partial => 'attachments/new_form', :locals => {:container => homework} %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="fl">
|
||||
<label class="label02">
|
||||
<span class="c_red">*</span>
|
||||
<%= l(:label_limit_time)%>:
|
||||
</label>
|
||||
<input type="text" name="homework_common[end_time]" id="homework_end_time" class="hwork_input02 fl" readonly="readonly" value="<%= homework.end_time%>" >
|
||||
<%= calendar_for('homework_end_time')%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="fl ml100" style="display: none;">
|
||||
<label class="label02"> 发布日期: </label>
|
||||
<input type="text" name="homework_common[publish_time]" id="homework_publish_time" class="hwork_input02 fl" readonly="readonly" value="<%= homework.publish_time%>" >
|
||||
<%= calendar_for('homework_publish_time')%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul><!--hwork_new_basic end--->
|
||||
<div class="hwork_new_set" >
|
||||
<p class="fl ml20 f14 mb10 c_orange">基本规则设置(总分为100分)</p>
|
||||
<div class="cl"></div>
|
||||
<ul class="ml10">
|
||||
<li style="display: none;">
|
||||
<label class="label02">迟交扣分: </label>
|
||||
<%= select_tag :late_penalty,options_for_select(late_penalty_option,homework.late_penalty), {:class => "fl mb10 h26 w70"} %>
|
||||
<span class="fl mt5"> 分</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
<label class="label02" >是否匿评: </label>
|
||||
<%= f.check_box :homework_type, :class => "mb10 mt5 fl" %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
<label class="label02">评分比例: </label>
|
||||
<%= select_tag :ta_proportion,options_for_select(ta_proportion_option,homework.homework_detail_manual.ta_proportion), {:class => "fl mb10 h26 w70"} %>
|
||||
<span class="ml5 fl mt5">× 教辅评分</span>
|
||||
<span class="ml5 fl mt5"> + </span>
|
||||
<input type="text" id="student_proportion" value="<%= (100 - homework.homework_detail_manual.ta_proportion* 100).to_i%>%" class="fl mb10 h26 w70" readonly>
|
||||
<span class="ml5 fl mt5">× 匿评得分</span>
|
||||
<span class="ml5 fl mt5">= 学生得分</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
<label class="label02" > </label>
|
||||
<span class=" fl c_red">如果教师对学生作品进行了评分,则教师评分为学生最终得分。</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div><!--hwork_new_set end-->
|
||||
|
||||
<div class="hwork_new_set" id="evaluation_setting" >
|
||||
<p class="fl ml20 f14 mb10 c_orange">学生互评设置</p>
|
||||
<div class="cl"></div>
|
||||
<ul class="ml10">
|
||||
<li style="display: none;">
|
||||
<label class="label02">互评启动时间: </label>
|
||||
<input type="text" name="evaluation_start" id="evaluation_start_time" class="hwork_input02 fl" readonly="readonly" value="<%= homework.homework_detail_manual.evaluation_start%>" >
|
||||
<%= calendar_for('evaluation_start_time')%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li style="display: none;">
|
||||
<label class="label02">互评结束时间: </label>
|
||||
<input type="text" name="evaluation_end" id="evaluation_end_time" class="hwork_input02 fl" readonly="readonly" value="<%= homework.homework_detail_manual.evaluation_end%>" >
|
||||
<%= calendar_for('evaluation_end_time')%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
<label class="label02">匿评分配数: </label>
|
||||
<input type="text" name="evaluation_num" id="evaluation_num" class=" hwork_input02 fl" value="<%= homework.homework_detail_manual.evaluation_num%>" maxlength="2" onkeyup="regex_evaluation_num()">
|
||||
<p class="ml5 fl mt5" id="evaluation_num_notice">每个学生将收到<span class="c_red"> 3 </span>份待匿评作品</p>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
||||
<li style="display: none;">
|
||||
<label class="label02">缺评扣分: </label>
|
||||
<%= select_tag :absence_penalty,options_for_select(absence_penalty_option,homework.homework_detail_manual.absence_penalty), {:class => "fl mb10 h26 w70"} %>
|
||||
<span class="fl mt5"> 分</span>
|
||||
<p class="ml5 fl mt5">学生漏评1个作品将扣<span class="c_red" id="absence_penalty_notice"> 2 </span>分</p>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul> <!-- h1 end--->
|
||||
</div><!--hwork_new_set end-->
|
|
@ -0,0 +1,7 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms') %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
|
@ -0,0 +1,16 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= error_messages_for 'homework_common' %>
|
||||
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2">
|
||||
<%= l(:label_course_homework_edit)%>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="hwork_new">
|
||||
<%= form_for @homework do |f| %>
|
||||
<%= render :partial => 'homework_common/homework_common_form', :locals => { :homework => @homework,:f => f,:edit_mode => true } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('edit_homework_common_<%= @homework.id%>');" >提交</a>
|
||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
||||
<% end%>
|
||||
</div><!--hwork_new end-->
|
||||
<div class="cl"></div>
|
|
@ -0,0 +1,81 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2">
|
||||
<%= l(:label_homework)%>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="talk_top">
|
||||
<p class="fl">
|
||||
<%= l(:label_totle)%>
|
||||
<span><%= @obj_count%></span>
|
||||
<%= l(:label_homework_count)%>
|
||||
</p>
|
||||
<%= link_to( l(:label_course_homework_new), new_homework_common_path(:course => @course.id), :class => 'problem_new_btn fl c_dorange') if @is_teacher %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% @homeworks.each do |homework|%>
|
||||
<div class="problem_main">
|
||||
<%= link_to(image_tag(url_to_avatar(homework.user), :width => "42", :height => "42"), user_path(homework.user), :class => "problem_pic fl") %>
|
||||
<div class="problem_txt fl mt5">
|
||||
<%= link_to(homework.user.lastname+homework.user.firstname, user_path(homework.user),:class => 'problem_name fl',:target => "_blank") %>
|
||||
<span class="fl"> <%= l(:label_user_create_project_homework) %>:</span>
|
||||
<%= link_to(homework.name, student_work_index_path(:homework => homework.id), :class => 'problem_tit fl fb c_dblue',:target => "_blank") %>
|
||||
<div class="cl mb5"></div>
|
||||
<p class="fl ">
|
||||
<%= l(:lebel_homework_commit)%>
|
||||
( <%= link_to homework.student_works.count, student_work_index_path(:homework => homework.id), :class => 'c_red'%> )
|
||||
</p>
|
||||
<% if @is_teacher%>
|
||||
<%= homework_anonymous_comment(homework)%>
|
||||
<%= link_to(l(:label_bid_respond_delete), homework_common_path(homework),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr mr10 work_edit") %>
|
||||
<%= link_to(l(:button_edit),edit_homework_common_path(homework), :class => "fr mr10 work_edit") %>
|
||||
<% elsif @is_student%>
|
||||
<%= student_anonymous_comment homework %>
|
||||
<%= student_new_homework homework %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<script>
|
||||
$(function(){if($("#bid_description_<%= homework.id%>_content").height()>360){$("#bid_show_more_des_button<%= homework.id%>").show();}});
|
||||
</script>
|
||||
<div id="bid_description_<%= homework.id%>" class="news_description mt5">
|
||||
<div id="bid_description_<%= homework.id%>_content" class="upload_img">
|
||||
<%= homework.description.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="news_foot c_red" id="bid_show_more_des_button<%= homework.id%>" onclick="bid_show_more_des(<%= homework.id%>);" style="cursor:pointer;display: none;">
|
||||
<%= l(:button_more)%>...
|
||||
<span class="g-arr-down"></span>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<% unless homework.attachments.empty?%>
|
||||
<span class="tit_fb" style="width: auto;"> 附件:</span>
|
||||
<div class="fl mb5">
|
||||
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework.attachments} %>
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
|
||||
<span class="fl"><%= l(:label_end_time)%>:<%= homework.end_time%></span>
|
||||
<% if betweentime(homework.end_time) < 0 %>
|
||||
<span class='fr mr10 c_red '>
|
||||
<%= l(:label_commit_limit)%>
|
||||
</span>
|
||||
<% else %>
|
||||
<script type="text/javascript">
|
||||
window.setInterval(function(){show_bid_dead_line(<%= homework.end_time.year%>,<%= homework.end_time.month%>,<%= homework.end_time.day + 1%>,"bid_deadline_<%= homework.id%>");},1000)
|
||||
</script>
|
||||
<div id="bid_deadline_<%= homework.id%>">
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end%>
|
||||
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
|
@ -0,0 +1,17 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
||||
<%= error_messages_for 'homework_common' %>
|
||||
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2">
|
||||
<%= l(:label_course_homework_new)%>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="hwork_new">
|
||||
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
|
||||
<%= hidden_field_tag "course",@course.id%>
|
||||
<%= render :partial => 'homework_common/homework_common_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
|
||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
|
||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
||||
<% end%>
|
||||
</div><!--hwork_new end-->
|
||||
<div class="cl"></div>
|
|
@ -0,0 +1,10 @@
|
|||
<% if @statue == 1%>
|
||||
alert('启动成功');
|
||||
$("#<%= @homework.id %>_start_anonymous_comment").replaceWith('<%= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "fr mr10 work_edit")%>');
|
||||
<% elsif @statue == 2 %>
|
||||
alert('启动失败\n作业总数大于等于2份时才能启动匿评');
|
||||
<% elsif @statue == 3%>
|
||||
alert("已开启匿评,请务重复开启");
|
||||
<% elsif @statue == 3%>
|
||||
alert("您没有权限开启匿评");
|
||||
<% end %>
|
|
@ -0,0 +1,2 @@
|
|||
$("#<%= @homework.id %>_stop_anonymous_comment").replaceWith('<span class="fr pr_join_span mr10" title="匿评结束">匿评结束</span>');
|
||||
alert('关闭成功');
|
|
@ -18,15 +18,15 @@
|
|||
<% if User.current.logged? -%>
|
||||
|
||||
<li id="current_user_li">
|
||||
<%= link_to "#{User.current.login}<span class='pic_triangle'></span>".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, :class => "uses_name"%>
|
||||
<%= link_to "#{User.current.login}<span class='pic_triangle'></span>".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, target:"_blank", :class => "uses_name"%>
|
||||
<ul id="user_sub_menu" style="right: 0px;display: none;">
|
||||
<% unless User.current.projects.empty? %>
|
||||
<li id="my_projects_li">
|
||||
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name}, :class => "parent" %>
|
||||
<ul id="my_projects_ul">
|
||||
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name},target:"_blank", :class => "parent" %>
|
||||
<ul id="my_projects_ul" >
|
||||
<% User.current.projects.each do |project| %>
|
||||
<li title="<%=project.name%>">
|
||||
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
|
||||
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name }, target:"_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
@ -37,11 +37,11 @@
|
|||
<% user_course = get_user_course User.current%>
|
||||
<% unless user_course.empty? %>
|
||||
<li id="my_courses_li">
|
||||
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id}, :class => "parent" %>
|
||||
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id},target:"_blank", :class => "parent" %>
|
||||
<ul id="my_courses_ul">
|
||||
<% user_course.each do |course| %>
|
||||
<li title="<%=course.name%>">
|
||||
<%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id} %>
|
||||
<%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id},target:"_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
<% if course %>
|
||||
<li id="homework_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title="<%=course.name%>" onmouseover="homeworkSlipMenuOver(<%= course.id%>);" onmouseout="homeworkSlipMenuOut(<%= course.id%>);">
|
||||
<%= link_to course.name, course_path(course.id, host: Setting.host_course) %>
|
||||
<ul class="homework_sub_menu" id="homework_loggedas_ul_<%= course.id%>" style="top:<%= course_index * 28.1%>px;">
|
||||
<% course.homework_for_courses.map(&:bid).each do |bid| %>
|
||||
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=bid.name%>">
|
||||
<%= link_to bid.name, course_for_bid_path(bid, host: Setting.host_course), :target => "_blank" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
<% end %>
|
|
@ -17,8 +17,8 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= stylesheet_link_tag 'public', 'leftside', 'courses'%>
|
||||
<%= javascript_include_tag "course","header" %>
|
||||
<%= stylesheet_link_tag 'public', 'leftside', 'jquery/jquery-ui-1.9.2', 'courses'%>
|
||||
<%= javascript_include_tag "course","header","attachments" %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
|
@ -116,9 +116,9 @@
|
|||
<%= link_to "(#{course_activity_count @course})", course_path(@course), :class => "subnav_num c_orange"%>
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_homework), homework_course_path(@course), :class => "f14 c_blue02"%>
|
||||
<%= link_to "(#{@course.homeworks.count})", homework_course_path(@course), :class => "subnav_num c_orange"%>
|
||||
<%= link_to( "+#{l(:label_course_homework_new)}", new_homework_course_path(@course), :class => 'subnav_green c_white') if is_teacher %>
|
||||
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%>
|
||||
<%= link_to "(#{@course.homework_commons.count})", homework_common_index_path(:course => @course.id), :class => "subnav_num c_orange"%>
|
||||
<%= link_to( "+#{l(:label_course_homework_new)}", new_homework_common_path(:course => @course.id), :class => 'subnav_green c_white') if is_teacher %>
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_news), course_news_index_path(@course), :class => "f14 c_blue02" %>
|
||||
|
|
|
@ -218,9 +218,8 @@
|
|||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% unless @user.user_extensions.nil?&&@user.user_extensions.location.empty?%>
|
||||
<% if @user.user_extensions && @user.user_extensions.location && !@user.user_extensions.location.empty?%>
|
||||
<tr>
|
||||
|
||||
<td style=" float: right" width="70px">
|
||||
<span style="float: right"> <%= l(:label_location) %>:</span>
|
||||
</td>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
</li>
|
||||
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
|
||||
<span style="float: left; width: 526px">
|
||||
<%= @message.content %>
|
||||
<%= @message.content.html_safe %>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
|
||||
<p>
|
||||
<span class="c_blue" style="color:#1b55a7;">
|
||||
|
||||
<%= link_to(h("#{@news.author.login}(#{@news.author.show_name})"), @issue_author_url , :style=>'color:#1b55a7; font-weight:bold;') %>
|
||||
|
||||
</span><%= l(:mail_issue_title_userin)%>
|
||||
<span class="c_blue" style="color:#1b55a7;">
|
||||
<%= link_to(h("#{@news.author.login}(#{@news.author.show_name})"), @issue_author_url , :style=>'color:#1b55a7; font-weight:bold;') %>
|
||||
</span><%= l(:mail_issue_title_userin)%>
|
||||
<span class="c_blue" style="color:#1b55a7;">
|
||||
<% if @news.project %>
|
||||
<%=h @news.project.name %> : <%= link_to(h(@news.title), @news_url,:style=>'color:#1b55a7; font-weight:bold;') %>
|
||||
<%=h @news.project.name %> : <%= link_to(h(@news.title), @news_url,:style=>'color:#1b55a7; font-weight:bold;') %>
|
||||
<% elsif @news.course %>
|
||||
<%=h @news.course.name %> : <%= link_to(h(@news.title), @news_url,:style=>'color:#1b55a7; font-weight:bold;') %>
|
||||
<% end %>
|
||||
</span><%= l(:mail_issue_title_active)%></p>
|
||||
<%=h @news.course.name %> : <%= link_to(h(@news.title), @news_url,:style=>'color:#1b55a7; font-weight:bold;') %>
|
||||
<% end %>
|
||||
</span><%= l(:mail_issue_title_active)%>
|
||||
</p>
|
||||
<div class="mail_box" style="border:1px solid #c8c8c8; width:570px; height: auto; padding:15px; margin-top:10px; margin-bottom:10px;">
|
||||
<ul style="list-style-type:none; margin:0; padding:0;">
|
||||
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_subject)%></strong></span>
|
||||
|
@ -25,7 +23,7 @@
|
|||
</li>
|
||||
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
|
||||
<span style="float: left; width: 526px">
|
||||
<%= @news.description %>
|
||||
<%= @news.description.html_safe %>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
|
|
|
@ -1,341 +1,335 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="content">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= @subject %>
|
||||
<%= @subject %>
|
||||
</h4>
|
||||
<% if @attachments.first || @course_news.first || @bids.first ||
|
||||
@homeworks.first || @course_journal_messages.first|| @course_messages.first %>
|
||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_course_overview)%></h2>
|
||||
<% unless @course_news.first.nil? %>
|
||||
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
@course_journal_messages.first|| @course_messages.first %>
|
||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_course_overview)%></h2>
|
||||
<% unless @course_news.first.nil? %>
|
||||
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_course_news) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_news.count %>)</span>
|
||||
</h4>
|
||||
<% @course_news.each do |course_new|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_course_news) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_news.count %>)</span>
|
||||
</h4>
|
||||
<%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<% @course_news.each do |course_new|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
<%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_notice) %></span>
|
||||
|
||||
<%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_notice) %></span>
|
||||
<%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_new.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_new.created_on) %></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul><!--课程通知 end-->
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--课程动态 end-->
|
||||
<% end %>
|
||||
<% if !@bids.first.nil? || !@homeworks.first.nil? %>
|
||||
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<!--课程作业-->
|
||||
<% unless @bids.empty? %>
|
||||
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;"><%= l(:label_homework_overview) %><span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @bids.count %>)</span></h4>
|
||||
<% unless @bids.first.nil?%>
|
||||
<% @bids.each do |bid| %>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;"><%= l(:label_homework_overview) %><span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @bids.count %>)</span></h4>
|
||||
<% unless @bids.first.nil?%>
|
||||
<% @bids.each do |bid| %>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
<%= link_to truncate(bid.course.name,length: 30,omission: '...'), course_url(bid.course, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'), course_url(bid.courses.first, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
<%= link_to bid.user, user_activities_url(bid.user,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_homework) %></span>
|
||||
|
||||
<%= link_to bid.author, user_activities_url(bid.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_homework) %></span>
|
||||
<%= link_to truncate(bid.name,length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(bid.created_at) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(:id => bid.id,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(bid.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% unless @homeworks.first.nil? %>
|
||||
<% @homeworks.each do |homework| %>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to homework.user, user_activities_url(homework.user,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_submit_homework) %></span>
|
||||
|
||||
<%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(:id => homework.bid.id,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(homework.created_at) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul><!--作业动态 end-->
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--作业动态 end-->
|
||||
<% end %>
|
||||
<!-- 课程留言 -->
|
||||
<% unless @course_journal_messages.first.nil? %>
|
||||
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:view_course_journals_for_messages) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% unless @course_journal_messages.first.nil? %>
|
||||
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<% @course_journal_messages.each do |course_journal_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:view_course_journals_for_messages) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span>
|
||||
</h4>
|
||||
<%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<% @course_journal_messages.each do |course_journal_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
<%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_journals_for_messages) %></span>
|
||||
|
||||
<%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
<%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_journal_message.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul><!--课程留言 end-->
|
||||
<% end %>
|
||||
|
||||
<%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_journals_for_messages) %></span>
|
||||
<!-- 课程讨论区 -->
|
||||
<% unless @course_messages.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:view_borad_course) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span>
|
||||
</h4>
|
||||
<% @course_messages.each do |course_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
<%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course.id, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
<%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_messages) %></span>
|
||||
<%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_message.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul><!-- 课程讨论区end -->
|
||||
<% end %>
|
||||
|
||||
<%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_journal_message.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<!-- 课件 -->
|
||||
<% unless @attachments.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_course_attendingcontestwork_download) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @attachments.count %>)</span>
|
||||
</h4>
|
||||
<% @attachments.each do |attachment|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--课程留言 end-->
|
||||
<% end %>
|
||||
<%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<% unless @course_messages.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_file_upload) %></span>
|
||||
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:view_borad_course) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @course_messages.each do |course_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course.id, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_messages) %></span>
|
||||
|
||||
<%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_message.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--课程讨论 end-->
|
||||
<% end %>
|
||||
|
||||
<% unless @attachments.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_course_attendingcontestwork_download) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @attachments.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @attachments.each do |attachment|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_course_file_upload) %></span>
|
||||
|
||||
<%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(attachment.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul><!--课件下载 end-->
|
||||
<% end %>
|
||||
</div><!--课程动态 end-->
|
||||
<% end %>
|
||||
<% if @issues.first || @project_messages.first %>
|
||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_project_overview_new)%></h2>
|
||||
<% unless @issues.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_issue_tracking) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @issues.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @issues.each do |issue|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_issue) %></span>
|
||||
|
||||
<%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(issue.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--问题跟踪 end-->
|
||||
<% end %>
|
||||
|
||||
<% unless @project_messages.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:project_moule_boards_show) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @project_messages.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @project_messages.each do |project_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_messages) %></span>
|
||||
|
||||
<%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_message.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--项目论坛 end-->
|
||||
<% end %>
|
||||
<%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(attachment.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul><!--课件下载 end-->
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
|
||||
</div><!--项目动态 end-->
|
||||
<% end %>
|
||||
<% unless @user_journal_messages.first.nil? %>
|
||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_activities) %></h2>
|
||||
<!--项目相关-->
|
||||
<% if @issues.first || @project_messages.first %>
|
||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_project_overview_new)%></h2>
|
||||
<% unless @issues.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_issue_tracking) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @issues.count %>)</span>
|
||||
</h4>
|
||||
<% @issues.each do |issue|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
<%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
<%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_issue) %></span>
|
||||
<%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(issue.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_user_message) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @user_journal_messages.count %>)</span>
|
||||
</h4>
|
||||
<div class="cl"></div>
|
||||
</ul><!--问题跟踪 end-->
|
||||
<% end %>
|
||||
|
||||
<% @user_journal_messages.each do |user_journal_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<!-- 讨论区 -->
|
||||
<% unless @project_messages.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:project_moule_boards_show) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @project_messages.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value),
|
||||
:class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_show_your_message) %></span>
|
||||
<% @project_messages.each do |project_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'),feedback_url(@user,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_send_course_messages) %></span>
|
||||
|
||||
<%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_message.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--项目论坛 end-->
|
||||
<% end %>
|
||||
|
||||
<!--项目新闻-->
|
||||
<% unless @project_news.first.nil? %>
|
||||
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_project_news) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @project_news.count %>)</span>
|
||||
</h4>
|
||||
<% @project_news.each do |project_new|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value),
|
||||
:class=> "wmail_column",
|
||||
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
|
||||
<%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value), :class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_project_notice) %></span>
|
||||
|
||||
<%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_new.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul><!-- 项目新闻end -->
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<% end %><!-- 项目动态end -->
|
||||
|
||||
<!-- 用户留言 -->
|
||||
<% unless @user_journal_messages.first.nil? %>
|
||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_activities) %></h2>
|
||||
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_user_message) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @user_journal_messages.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @user_journal_messages.each do |user_journal_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
|
||||
<%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value),
|
||||
:class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_show_your_message) %></span>
|
||||
|
||||
<%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'),feedback_url(@user,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(user_journal_message.created_on) %></span></li>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!--课程动态 end-->
|
||||
<div class="cl"></div>
|
||||
</ul><!--用户留言 end-->
|
||||
|
||||
</div><!--个人动态 end-->
|
||||
<% end %>
|
||||
<% if @forums.first || @memos.first %>
|
||||
</div><!--个人动态 end-->
|
||||
<% end %>
|
||||
<% if @forums.first || @memos.first %>
|
||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:lable_bar_active) %></h2>
|
||||
<% unless @forums.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_user_forum) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @forums.count %>)</span>
|
||||
</h4>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_user_forum) %>
|
||||
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @forums.count %>)</span>
|
||||
</h4>
|
||||
|
||||
<% @forums.each do |forum|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<% @forums.each do |forum|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
|
||||
<%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value),
|
||||
:class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_forum_new) %></span>
|
||||
<%= link_to forum.creator, user_activities_url(forum.creator,:token => @token.value),
|
||||
:class => "wmail_name",
|
||||
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
|
||||
<span class="wmail_txt" style="float:left; margin-right:5px;color:#6e6e6e;"><%= l(:label_forum_new) %></span>
|
||||
|
||||
<%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(forum.created_at) %></span></li>
|
||||
<%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value),
|
||||
:class => 'wmail_info',
|
||||
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(forum.created_at) %></span></li>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</ul><!-- 新建贴吧 end-->
|
||||
<div class="cl"></div>
|
||||
</ul><!-- 新建贴吧 end-->
|
||||
<% end %>
|
||||
<% unless @memos.first.nil? %>
|
||||
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
|
||||
|
@ -366,14 +360,14 @@
|
|||
<% end %>
|
||||
</div><!--贴吧动态 end-->
|
||||
<% end %>
|
||||
<div class="wmail_foot" style="margin-top:20px;color:#2775d2; margin-left:10px;">
|
||||
<% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %>
|
||||
<% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %>
|
||||
<label style="margin-top:20px;color:gray; margin-left:10px;"><%= l(mail_option) %></label>
|
||||
<% else %>
|
||||
<%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="wmail_foot" style="margin-top:20px;color:#2775d2; margin-left:10px;">
|
||||
<% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %>
|
||||
<% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %>
|
||||
<label style="margin-top:20px;color:gray; margin-left:10px;"><%= l(mail_option) %></label>
|
||||
<% else %>
|
||||
<%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%= @subject %>
|
||||
<% if @attachments.first || @course_news.first || @bids.first ||
|
||||
@homeworks.first || @course_journal_messages.first|| @course_messages.first %>
|
||||
@course_journal_messages.first|| @course_messages.first %>
|
||||
<%= l(:label_course_overview)%>
|
||||
<% unless @course_news.first.nil? %>
|
||||
<%= l(:label_course_news) %>
|
||||
|
@ -27,50 +27,30 @@
|
|||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<% if !@bids.first.nil? || !@homeworks.first.nil? %>
|
||||
<% unless @bids.empty? %>
|
||||
<%= l(:label_homework_overview) %><%= @bids.count %>
|
||||
<% unless @bids.first.nil?%>
|
||||
<% @bids.each do |bid| %>
|
||||
▪
|
||||
[
|
||||
|
||||
<%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'),course_url(bid.courses.first, :token => @token.value)
|
||||
<%= link_to truncate(bid.course.name,length: 30,omission: '...'),course_url(bid.course, :token => @token.value)
|
||||
|
||||
%>
|
||||
]
|
||||
|
||||
<%= link_to bid.author, user_activities_url(bid.author,:token => @token.value)
|
||||
<%= link_to bid.user, user_activities_url(bid.user,:token => @token.value)
|
||||
%>
|
||||
<%= l(:label_course_homework) %>
|
||||
|
||||
<%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(bid,:token => @token.value)
|
||||
<%= link_to truncate(bid.name, length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value)
|
||||
|
||||
|
||||
%>
|
||||
<%= format_time(bid.created_on) %>
|
||||
<%= format_time(bid.created_at) %>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% unless @homeworks.first.nil? %>
|
||||
<% @homeworks.each do |homework| %>
|
||||
▪[
|
||||
|
||||
<%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value)
|
||||
|
||||
%>
|
||||
]
|
||||
|
||||
<%= link_to homework.user, user_activities_url(homework.user,:token => @token.value)
|
||||
%>
|
||||
<%= l(:label_course_submit_homework) %>
|
||||
|
||||
<%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(homework.bid,:token => @token.value)
|
||||
|
||||
|
||||
%>
|
||||
<%= format_time(homework.created_at) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<!--作业动态 end-->
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
<li style="list-style-type:none; margin:0; padding:0;"><span style="float: left;"><strong><%= l(:mail_issue_content)%></strong></span>
|
||||
<span style="float: left; width: 526px">
|
||||
<p><%= @subject %> </p>
|
||||
<p> <%= link_to @project_url, @project_url%></p>
|
||||
<p>点击链接后,将自动为您注册账号</p>
|
||||
<p><%= @subject %> </p>
|
||||
<p style="color: #15BCCF ">点击下面的链接即可激活账号,系统会根据给出的密码和账号自动登录Trustie平台。</p>
|
||||
<p> <%= link_to @project_url, @project_url%></p>
|
||||
<p>您的账号为:<%= @email %></p>
|
||||
<p>密码为: <%= @password %></p>
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<p><%= l(:mail_body_wiki_content_added, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
|
||||
:author => h(@wiki_content.author)).html_safe %><br />
|
||||
<em><%=h @wiki_content.comments %></em></p>
|
||||
<em><%=h @wiki_content.comments.html_safe %></em></p>
|
||||
|
|
|
@ -131,9 +131,9 @@
|
|||
<%= link_to image_tag(url_to_avatar(reply.author), :class => "avatar"), user_path(reply.author) %>
|
||||
</td>
|
||||
<td class="comments" style="word-wrap: break-word;word-break: break-all;">
|
||||
<div class="reply_content" >
|
||||
<%=h sanitize(reply.content.html_safe) %>
|
||||
</div>
|
||||
<div class="reply_content" >
|
||||
<%=h sanitize(reply.content.html_safe) %>
|
||||
</div>
|
||||
<p>
|
||||
<% if reply.attachments.any?%>
|
||||
<% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %>
|
||||
|
@ -183,4 +183,4 @@
|
|||
});
|
||||
};
|
||||
$("img").removeAttr("align");
|
||||
</script>
|
||||
</script>
|
||||
|
|
|
@ -36,8 +36,13 @@
|
|||
<%= link_to h(news.title), news_path(news),:class => 'problem_tit fl fb c_dblue' %>
|
||||
<br />
|
||||
<div class="cl mb5"></div>
|
||||
<div id="news_description_<%= news.id %>" class="news_description mt5">
|
||||
<%= news.description.html_safe %>
|
||||
<script>
|
||||
$(function(){if($("#news_description_<%= news.id%>_content").height()>360){$("#news_foot_<%= news.id%>").show();}});
|
||||
</script>
|
||||
<div id="news_description_<%= news.id%>" class="news_description mt5">
|
||||
<div id="news_description_<%= news.id%>_content" class="upload_img">
|
||||
<%= news.description.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="news_foot c_red" style="cursor:pointer;display: none;" onclick="news_show_more_des(<%= news.id %>);" id="news_foot_<%= news.id %>">
|
||||
<%= l(:button_more)%>...
|
||||
|
|
|
@ -45,39 +45,57 @@
|
|||
}
|
||||
|
||||
|
||||
// if (filter.test(email)&& !(email.value == null)) return true;
|
||||
// else
|
||||
// {
|
||||
// document.getElementById('valid_email').innerHTML = "您所填写的电子邮件格式不正确";
|
||||
// document.getElementById('valid_email').style.color = "#FF0000";
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// if (filter.test(email)&& !(email.value == null)) return true;
|
||||
// else
|
||||
// {
|
||||
// document.getElementById('valid_email').innerHTML = "您所填写的电子邮件格式不正确";
|
||||
// document.getElementById('valid_email').style.color = "#FF0000";
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
</script>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:label_invite_join)%></h2>
|
||||
</div>
|
||||
<div class="box_main">
|
||||
<p class="box_p">
|
||||
<%= l(:label_invite_email_tips)%>
|
||||
</p>
|
||||
<div id="is_registed">
|
||||
<%= render :partial => 'regested', locals: { :isregisted => false} %>
|
||||
</div>
|
||||
<%= form_tag('send_mail_to_member', :controller => 'projects',:action => 'send_mail_to_member', method: 'get') do %>
|
||||
<span id="valid_email" style="color: #FF0000;"></span>
|
||||
<ul>
|
||||
<li>
|
||||
<%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyAddress(this);" %>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<a href="#" class="btn_free" onclick="senderEmail($(this));">
|
||||
<%= l(:label_send_email)%>
|
||||
</a>
|
||||
<p class="box_p">
|
||||
<%= l(:label_invite_email_tips)%>
|
||||
</p>
|
||||
<div id="is_registed">
|
||||
<%= render :partial => 'regested', locals: { :isregisted => false} %>
|
||||
</div>
|
||||
<%= form_tag('send_mail_to_member', :controller => 'projects',:action => 'send_mail_to_member', method: 'get') do %>
|
||||
<span id="valid_email" style="color: #FF0000;"></span>
|
||||
<ul>
|
||||
<li>
|
||||
<%= text_field_tag 'mail', '', :class => "fb_item fl", :placeholder => l(:label_input_email), :onkeyup => "this.value=this.value.replace(' ','')", :style => "ime-mode:disabled;", :onblur => "verifyAddress(this);" %>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<a href="#" class="btn_free" onclick="senderEmail($(this));">
|
||||
<%= l(:label_send_email)%>
|
||||
</a>
|
||||
<% end %>
|
||||
<%# 邀请用户的状态 %>
|
||||
<% unless @inviter_lists.blank? %>
|
||||
<div>
|
||||
<% unless @inviters_count.nil? %>
|
||||
<span class="status_inviter">已加入项目的用户</span><br/>
|
||||
<% @inviters.each do |inv| %>
|
||||
<%= inv.name unless inv.nil? %><br/>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</br>
|
||||
<% unless @waiters_count.nil? %>
|
||||
<span class="status_inviter">等待加入项目的用户</span><br/>
|
||||
<% @waiters.each do |wai| %>
|
||||
<%= wai.name unless wai.nil?%><br/>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
|
@ -0,0 +1,22 @@
|
|||
<%= form_for('new_form', :remote => true, :method => :post,:url => add_score_student_work_path(work.id)) do |f|%>
|
||||
<li >
|
||||
<span class="tit_fb"> 评价:</span>
|
||||
<%= f.text_area 'user_message', :class => 'hwork_ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
<span class="tit_fb mt2"> 评分:</span>
|
||||
<input type="number" name="score" id="score_<%= work.id%>" value="<%= score.nil? ? 60 : score.score%>" min="0" max="100" size="4" data-units="dollars" />
|
||||
<span class=" ml5">分</span>
|
||||
<div class="cl"></div></li>
|
||||
<li >
|
||||
<% if @is_teacher%> <!-- 老师才可以上传批阅结果 -->
|
||||
<span class="tit_fb"> 批阅结果:</span>
|
||||
<div>
|
||||
<%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
|
||||
</div>
|
||||
<%end%>
|
||||
<a href="javascript:void(0);" class="blue_n_btn fr evaluation_submit" onclick="$(this).parent().parent().submit();">提交</a>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end%>
|
|
@ -0,0 +1,4 @@
|
|||
<%= form_for('', :remote => true, :method => :post,:url => add_score_reply_student_work_index_path(:score_id => score.id)) do |f|%>
|
||||
<%= f.text_area 'message', :class => 'ping_text', :placeholder => l(:text_caracters_maximum,:count=>250),:maxlength => 250 %>
|
||||
<a href="javascript:void(0);" class="fr blue_n_btn" onclick="$('#add_score_reply_<%= score.id%>').find('form').submit();">回复</a>
|
||||
<% end%>
|
|
@ -0,0 +1,28 @@
|
|||
<!-- 匿评作品列表,显示某一个作品的信息 -->
|
||||
<ul class="hwork_ul <%= cycle("b_grey", "") %>" id="student_work_<%= student_work.id%>">
|
||||
<% is_my_work = student_work.user == User.current%>
|
||||
<li class="hwork_num">
|
||||
<% if is_my_work%>
|
||||
<span>
|
||||
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
|
||||
</span>
|
||||
<% else%>
|
||||
<span class="ml30">--</span>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="hwork_name">
|
||||
<% if is_my_work%>
|
||||
<%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02" %>
|
||||
<% else%>
|
||||
<%= link_to "匿名","javascript:void(0)", :class => "c_blue02"%>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class=" hwork_tit_e" style="width: 410px">
|
||||
<%= link_to student_work.name, student_work_path(student_work),:remote => true, :title => student_work.name, :class => "c_blue02"%>
|
||||
</li>
|
||||
<% my_score = student_work_score(student_work,User.current) %>
|
||||
<li class=" hwork_code <%= my_score.nil? ? 'c_grey' : 'c_red'%>">
|
||||
<%= my_score.nil? ? "--" : format("%.2f",my_score.score)%>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul><!---hwork_ul end-->
|
|
@ -0,0 +1,12 @@
|
|||
<li class="hwork_num ">
|
||||
<span class="f14 f_b c_dark fl ">学号</span>
|
||||
</li>
|
||||
<li class="hwork_name f14 fb c_dark">
|
||||
<span class="c_dark f14 fb fl ">学生姓名</span>
|
||||
</li>
|
||||
<li class="hwork_tit_e">
|
||||
<span class="c_dark f14 fb fl">作品名称</span>
|
||||
</li>
|
||||
<li class="w70 mr5" >
|
||||
<%= link_to "我的评分","javascript:void(0)",:class => "c_dark f14 fb fl"%>
|
||||
</li>
|
|
@ -0,0 +1,20 @@
|
|||
<div class="ping_back mt10" id="jour_replay_<%= jour.id%>">
|
||||
<%= link_to image_tag(url_to_avatar(jour.user), :width => "32", :height => "32"), user_path(jour.user),:class => "st_img fl" %>
|
||||
<div class="ping_back_tit">
|
||||
<a href="javascript:void(0);" class="c_blue fl" >
|
||||
<%= link_to jour.user.show_name, user_path(jour.user), :title => jour.user.show_name, :class => "c_blue fl" %>
|
||||
</a>
|
||||
<% if jour.user==User.current || User.current.admin? %>
|
||||
<%= link_to(l(:label_bid_respond_delete), destroy_score_reply_student_work_index_path(:jour_id => jour.id),
|
||||
:remote => true, :confirm => l(:text_are_you_sure), :title => l(:button_delete), :class => "fr c_purple") %>
|
||||
<% end %>
|
||||
<span class=" fr c_grey mr10">
|
||||
<%=format_time jour.created_on %>
|
||||
</span>
|
||||
<div class="cl mb5"></div>
|
||||
<p class="break_word">
|
||||
<%= jour.notes%>
|
||||
</p>
|
||||
</div><!---ping_box_tit end--->
|
||||
<div class="cl"></div>
|
||||
</div><!---ping_back end--->
|
|
@ -0,0 +1,72 @@
|
|||
<div class="show_hwork_arrow"></div>
|
||||
<div class="show_hwork">
|
||||
<ul>
|
||||
<li class="fl">
|
||||
<span class="tit_fb">上交时间:</span>
|
||||
<%=format_time @work.created_at %>
|
||||
</li>
|
||||
|
||||
<% if !@is_teacher && @work.user == User.current && (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 1) %>
|
||||
<!-- 我的作业 && (非匿评作业 || 为开启匿评),显示编辑和删除按钮 -->
|
||||
<li class="fr" >
|
||||
<%= link_to("", student_work_path(@work),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "pic_del") %>
|
||||
</li>
|
||||
<li class="fr" >
|
||||
<%= link_to "",edit_student_work_path(@work),:class => "pic_edit"%>
|
||||
</li>
|
||||
<% end%>
|
||||
<% if (@homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3) && @work.user != User.current%>
|
||||
<!-- 普通作业或者编程作业,或者是匿评结束阶段,显示点赞按钮 -->
|
||||
<li class="fr" id="student_work_praise_<%= @work.id%>">
|
||||
<%= render :partial => 'student_work_praise' %>
|
||||
</li>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
|
||||
<!--<li >-->
|
||||
<!--<span class="tit_fb"> 参与人员:</span>-->
|
||||
<!--程梦雯 王强-->
|
||||
<!--</li>-->
|
||||
<% if @work.project%>
|
||||
<li >
|
||||
<span class="tit_fb"> 关联项目:</span>
|
||||
<%= link_to( @work.project.name, project_path(@work.project.id), :class => "c_blue02" )%>
|
||||
</li>
|
||||
<% end%>
|
||||
<li >
|
||||
<span class="tit_fb ">内容:</span>
|
||||
<div class="show_hwork_p break_word">
|
||||
<%= textilizable @work.description%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li >
|
||||
<span class="tit_fb"> 附件:</span>
|
||||
<% if @work.attachments.empty?%>
|
||||
<span style="color: #999999">尚未提交附件</span>
|
||||
<% else%>
|
||||
<div class="fl">
|
||||
<%= render :partial => 'work_attachments', :locals => {:attachments => @work.attachments} %>
|
||||
</div>
|
||||
<% end%>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% if @is_teacher || (@homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2 && @work.user != User.current )%>
|
||||
<!-- 老师 || 匿评作业 && 开启匿评状态 && 不是当前用户自己的作品 -->
|
||||
<div id="add_student_score_<%= @work.id%>" class="mt10 evaluation">
|
||||
<%= render :partial => 'add_score',:locals => {:work => @work,:score => @score}%>
|
||||
</div>
|
||||
<% end%>
|
||||
</ul>
|
||||
|
||||
<div class="ping_box mt10" id="score_list_<%= @work.id%>" style="<%= @work.student_works_scores.empty? ? 'padding:0px;' : ''%>">
|
||||
<%@work.student_works_scores.order("created_at desc").each do |score|%>
|
||||
<div id="work_score_<%= score.id%>">
|
||||
<%= render :partial => 'student_work_score',:locals => {:score => score}%>
|
||||
</div>
|
||||
<% end%>
|
||||
</div><!---ping_box end--->
|
||||
<a href="javascript:void(0);" class="fr c_blue mt5 mb5" onclick="$('#about_hwork_<%= @work.id%>').html('');">收起</a>
|
||||
<div class="cl"></div>
|
||||
</div><!---show_hwork end--->
|
|
@ -0,0 +1,38 @@
|
|||
<!-- 作品列表,显示某一个作品的信息 -->
|
||||
<ul class="hwork_ul <%= cycle("b_grey", "") %>" id="student_work_<%= student_work.id%>">
|
||||
<li class="hwork_num">
|
||||
<span>
|
||||
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
|
||||
</span>
|
||||
</li>
|
||||
<li class=" hwork_name ">
|
||||
<%= link_to student_work.user.show_name,user_path(student_work.user),:title => student_work.user.show_name, :class => "c_blue02"%>
|
||||
</li>
|
||||
<li class=" hwork_tit">
|
||||
<%= link_to student_work.name, student_work_path(student_work),:remote => true,:title => student_work.name, :class => "c_blue02"%>
|
||||
</li>
|
||||
<li class=" hwork_code <%= student_work.teacher_score.nil? ? 'c_grey' : 'c_red'%> mr18">
|
||||
<%= student_work.teacher_score.nil? ? "--" : format("%.2f",student_work.teacher_score)%>
|
||||
</li>
|
||||
<li class=" hwork_code <%= student_work.teaching_asistant_score.nil? ? 'c_grey' : 'c_red'%> mr18">
|
||||
<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.2f",student_work.teaching_asistant_score)%>
|
||||
</li>
|
||||
<li class=" hwork_code02 <%= student_work.student_score.nil? ? 'c_grey' : 'c_red'%> mr18 student_score_info" >
|
||||
<%= student_work.student_score.nil? ? "--" : format("%.2f",student_work.student_score)%>
|
||||
<% unless student_work.student_score.nil?%>
|
||||
<span class="c_blue">
|
||||
(<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>)
|
||||
</span>
|
||||
<div class="info_ni">
|
||||
现共有
|
||||
<span class="c_red"> <%= student_work.student_works_scores.where(:reviewer_role => 3).count%> </span>
|
||||
名学生进行了匿评,平均分为
|
||||
<span class="c_red"> <%= format("%.2f",student_work.student_score)%> </span>分。
|
||||
</div>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class=" hwork_code <%= student_work.final_score.nil? ? 'c_grey' : 'c_red'%>">
|
||||
<%= student_work.final_score.nil? ? "--" : format("%.2f",student_work.final_score)%>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul><!---hwork_ul end-->
|
|
@ -0,0 +1,35 @@
|
|||
<div class="fl">
|
||||
<span id="attachments_fields<%= work.id%>" xmlns="http://www.w3.org/1999/html">
|
||||
</span>
|
||||
<div class="cl"></div>
|
||||
<span class="add_attachment" style="font-weight:normal;">
|
||||
<%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => "_file#{work.id}",
|
||||
:class => 'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => "addInputFiles_board(this, '#{work.id}');",
|
||||
:style => 'display:none',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||
:upload_path => uploads_path(:format => 'js'),
|
||||
:description_placeholder => l(:label_optional_description),
|
||||
:field_is_public => l(:field_is_public),
|
||||
:are_you_sure => l(:text_are_you_sure),
|
||||
:file_count => l(:label_file_count),
|
||||
:delete_all_files => l(:text_are_you_sure_all),
|
||||
:containerid => "#{work.id}"
|
||||
} %>
|
||||
<span id="upload_file_count<%= work.id%>">
|
||||
<%= l(:label_no_file_uploaded) %>
|
||||
</span>
|
||||
(<%= l(:label_max_size) %>:
|
||||
<%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
</span>
|
||||
<% content_for :header_tags do %>
|
||||
<%= javascript_include_tag 'attachments' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<% if is_praise_homework User.current.id,@work.id %>
|
||||
<%= link_to "赞(#{praise_homework_count @work.id})",praise_student_work_student_work_path(@work), :remote => true,:class => 'orange_btn', :style => 'font-size:12px;'%>
|
||||
<% else %>
|
||||
<%= link_to "赞(#{praise_homework_count @work.id})","javascript:void(0)",:class => 'grey_btn', :style => 'font-size:12px;'%>
|
||||
<% end %>
|
|
@ -0,0 +1,32 @@
|
|||
<ul class="ping_box_ul ping_line">
|
||||
<% show_real_name = @is_teacher || score.user == User.current || score.user.allowed_to?(:as_teacher,@course) %>
|
||||
<%= link_to image_tag(url_to_avatar(show_real_name ? score.user : ""), :width => "34", :height => "34"), show_real_name ? user_path(score.user) : "javascript:void(0)",:class => "ping_pic fl" %>
|
||||
<div class="ping_box_tit">
|
||||
<%= link_to show_real_name ? score.user.show_name : "匿名", show_real_name ? user_path(score.user) : "javascript:void(0)", :title => show_real_name ? score.user.show_name : "匿评用户", :class => "c_blue fl" %>
|
||||
<span class="ml5 fl">(<%= student_work_score_role score%>)</span>
|
||||
<span class="ml20 fl">评分:</span>
|
||||
<a href="javascript:void(0);" class="c_orange fl" ><%= score.score%>分</a>
|
||||
<a href="javascript:void(0);" class="fr c_purple mr5" onclick="$('#add_score_reply_<%= score.id%>').slideToggle();">回复</a>
|
||||
<span class=" fr c_grey mr20">
|
||||
<%=format_time score.created_at %>
|
||||
</span>
|
||||
<div class="cl mb5"></div>
|
||||
<p class="break_word">
|
||||
<%= score.comment%>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'work_attachments', :locals => {:attachments => score.attachments} %>
|
||||
<div class="cl"></div>
|
||||
<div id="add_score_reply_<%= score.id%>" class="undis">
|
||||
<%= render :partial => 'add_score_reply',:locals => {:score => score}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="replay_histroy_<%= score.id%>">
|
||||
<% score.journals_for_messages.order("created_on desc").each do |jour|%>
|
||||
<%= render :partial => 'jour_replay',:locals => {:jour => jour}%>
|
||||
<% end%>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
|
@ -0,0 +1,33 @@
|
|||
<li class="hwork_num ">
|
||||
<a href="javascript:void(0);" class=" f14 f_b c_dark fl" >学号</a>
|
||||
</li>
|
||||
<li class=" hwork_name f14 fb c_dark">
|
||||
学生姓名
|
||||
</li>
|
||||
<li class="hwork_tit">
|
||||
<span class="c_dark f14 fb fl">作品名称</span>
|
||||
</li>
|
||||
<li class="mr5 w70">
|
||||
<%= link_to "教师评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl hwork_code"%>
|
||||
<% if @show_all && @order == "teacher_score"%>
|
||||
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="mr5 w70">
|
||||
<%= link_to "教辅评分",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl hwork_code"%>
|
||||
<% if @show_all && @order == "teaching_asistant_score"%>
|
||||
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="mr5 ml15 w40">
|
||||
<%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "student_score"%>
|
||||
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
||||
<% end%>
|
||||
</li>
|
||||
<li class="ml30">
|
||||
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "final_score", :sort => @score, :name => @name) : "javascript:void(0)",:class => "f14 f_b c_dark fl"%>
|
||||
<% if @show_all && @order == "final_score"%>
|
||||
<a href="javascript:void(0);" class="<%= @score == 'desc' ? 'st_up' : 'st_down'%>" ></a>
|
||||
<% end%>
|
||||
</li>
|
|
@ -0,0 +1,8 @@
|
|||
<% attachments.each_with_index do |attachment,i| %>
|
||||
<div id="attachment_<%= attachment.id%>">
|
||||
<%= link_to_short_attachment attachment, :class => 'link_file', :download => true -%>
|
||||
<%= link_to(' '.html_safe, attachment_path(attachment, :format => 'js'), :method => 'delete', :remote => true, :title => '删除', :class => 'remove-upload', :confirm => l(:text_are_you_sure)) if attachment.id && User.current == attachment.author %>
|
||||
<span class="ml5">(<%= number_to_human_size attachment.filesize %>)</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end -%>
|
|
@ -0,0 +1,29 @@
|
|||
$("#add_student_score_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'add_score',:locals => {:work => @work,:score => @score}) %>");
|
||||
$('#score_<%= @work.id%>').peSlider({range: 'min'});
|
||||
|
||||
<% if @is_new%>
|
||||
$("#score_list_<%= @work.id%>").prepend("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>");
|
||||
<% else %>
|
||||
$("#work_score_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'student_work_score', :locals => {:score => @score}) %>");
|
||||
<% end%>
|
||||
$("#score_list_<%= @work.id%>").removeAttr("style");
|
||||
|
||||
<% if @is_teacher %>
|
||||
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'student_work',:locals => {:student_work => @work}) %>");
|
||||
<% else %>
|
||||
$("#student_work_<%= @work.id%>").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work}) %>");
|
||||
<% end%>
|
||||
|
||||
|
||||
$(function(){
|
||||
$(".student_score_info").bind("mouseover",function(e){
|
||||
//alert($(this).html());
|
||||
$(this).find("div").show();
|
||||
$(this).find("div").css("top",e.pageY);
|
||||
$(this).find("div").css("left",e.pageX);
|
||||
});
|
||||
$(".student_score_info").bind("mouseout",function(e){
|
||||
//alert($(this).html());
|
||||
$(this).find("div").hide();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,6 @@
|
|||
$("#add_score_reply_<%= @score.id%>").html("<%= escape_javascript(render :partial => 'add_score_reply', :locals => {:score => @score}) %>");
|
||||
<% if @status && @status == 1%>
|
||||
$("#replay_histroy_<%= @score.id%>").prepend("<%= escape_javascript(render :partial => 'jour_replay', :locals => {:jour => @jour}) %>");
|
||||
<% else%>
|
||||
alert("回复内容不能为空");
|
||||
<% end%>
|
|
@ -0,0 +1 @@
|
|||
$("#jour_replay_<%= @jour.id%>").remove();
|
|
@ -0,0 +1,60 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2">编辑作品</h2>
|
||||
</div>
|
||||
<div class="Newwork">
|
||||
<!--<div id="tb_" class="hwork_tb_">-->
|
||||
<!--<ul>-->
|
||||
<!--<li id="tb_1" class="hwork_hovertab" onclick="x:HoverLi(1);" >-->
|
||||
<!--课程名称课程名称课程名</li>-->
|
||||
<!--<li id="tb_2" class="hwork_normaltab" onclick="i:HoverLi(2);">-->
|
||||
<!--成员</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</div>-->
|
||||
<div class="hwork_ctt">
|
||||
<div class="hwork_dis" id="tbc_01">
|
||||
<%= labelled_form_for @work do |f|%>
|
||||
<div class="N_con">
|
||||
<p>
|
||||
<label class="fl"><span class="c_red">*</span> 作品名称 :</label>
|
||||
<input type="text" name="student_work[name]" id="student_work_name" class="bo fl" maxlength="200" onkeyup="regexStudentWorkName();" value="<%= @work.name%>">
|
||||
<a href="javascript:void(0)" class="fl ml10 mt3" onclick="show_project();" >项目信息
|
||||
<img class="ml5 " src="/images/bid/pic_question.png" width="15" height="15" Title="项目是一种由用户创建的基于 网络的协作空间,能够为个人 或小组提供分布式的协同交流 和资料管理等方面的。">
|
||||
</a>
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_name_span" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
|
||||
<p id="about_project" class="about_project" style="<%= @work.project.nil? ? '' : 'display:block;'%>">
|
||||
<label class="fl"> 关联项目 :</label>
|
||||
<%= f.select :project,options_for_select(user_projects_option,@work.project_id), {},{:class => "bo02 mb10"} %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
|
||||
<p>
|
||||
<label class="fl">
|
||||
<span class="c_red">*</span>
|
||||
作品描述 :
|
||||
</label>
|
||||
<textarea name="student_work[description]" placeholder="最多3000个汉字(或6000个英文字符)" id="student_work_description" class="w620 hwork_txt" maxlength="6000" onkeyup="regexStudentWorkDescription();"><%= @work.description%></textarea>
|
||||
<p id="student_work_description_textarea" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<label class="fl"> 添加附件 :</label>
|
||||
<%= render :partial => 'attachments/new_form',:locals => {:container => @work} %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p class="ml80 ">
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="edit_student_work(<%= @work.id%>);">提交作品</a>
|
||||
<%= link_to "返 回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white"%>
|
||||
<div class="cl"></div>
|
||||
</p>
|
||||
</div><!---创建作业内容结束-->
|
||||
<% end%>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--新建作业结束-->
|
||||
<div class="cl"></div>
|
|
@ -0,0 +1,125 @@
|
|||
<div class="project_r_h">
|
||||
<div id="menu_r">
|
||||
<ul class="menu_r">
|
||||
<li><a href="javascript:void(0);" class="parent">作业批次</a>
|
||||
<ul>
|
||||
<% @homework_commons.each_with_index { |homework_common,index |%>
|
||||
<li>
|
||||
<%= link_to "第#{@homework_commons.count - index}次作业",student_work_index_path(:homework => homework_common.id)%>
|
||||
</li>
|
||||
<%}%>
|
||||
</ul>
|
||||
</li><!---level1 end--->
|
||||
</ul><!---menu_r end--->
|
||||
</div>
|
||||
</div><!--contentbox end-->
|
||||
|
||||
<div class="to_top" id="goTopBtn" style="display: none;">
|
||||
返<br/>回<br/>顶<br/>部
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="contentbox">
|
||||
<div id="tb_" class="hwork_tb_">
|
||||
<ul>
|
||||
<li id="tb_1" class="hwork_hovertab" onclick="course_setting(1)">全部作品</li>
|
||||
<li id="tb_2" class="hwork_normaltab" onclick="course_setting(2)">作业信息</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="ctt">
|
||||
<div class="dis" id="tbc_01">
|
||||
<div class="code_list">
|
||||
<span class="fl mt3">
|
||||
<%= link_to "所有作品(<span class='c_red'>#{@stundet_works.count}</span>)".html_safe,student_work_index_path(:homework => @homework.id), :class => "fl"%>
|
||||
</span>
|
||||
<% if @show_all%>
|
||||
<input type="text" value="<%= @name%>" placeholder="昵称、学号、姓名搜索" class="min_search ml10 fl" onkeypress="SearchByName($(this),'<%= student_work_index_path(:homework => @homework.id)%>',event);">
|
||||
<a class="student_work_search fl" onclick="SearchByName_1($(this).prev(),'<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)">搜索</a>
|
||||
<% end%>
|
||||
<% if @is_teacher%>
|
||||
<div class="fr">
|
||||
<% if @homework.student_works.empty?%>
|
||||
<%= link_to "附件", "javascript:void(0)", class: "down_btn fr", :onclick => "alert('没有学生提交作业,无法下载附件')" %>
|
||||
<% else%>
|
||||
<%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json),
|
||||
remote: true, class: "down_btn fr", :id => "download_homework_attachments" %>
|
||||
<% end%>
|
||||
|
||||
<%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%>
|
||||
<span class="mt3 fr " style="color:#136b3b;">导出全部:</span>
|
||||
</div>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
</div><!---code_list end--->
|
||||
<ul class="hwork_ul">
|
||||
<% if @is_evaluation.nil?%>
|
||||
<%= render :partial => 'student_work_title'%>
|
||||
<% else%>
|
||||
<%= render :partial => 'evaluation_work_title'%>
|
||||
<% end%>
|
||||
</ul><!---hwork_ul end-->
|
||||
<div class="cl"></div>
|
||||
|
||||
<% @stundet_works.each do |student_work|%>
|
||||
<%= render :partial => (@is_evaluation ? 'evaluation_work' :'student_work'),:locals => {:student_work => student_work}%>
|
||||
<div id="about_hwork_<%= student_work.id%>" ></div>
|
||||
<% end%>
|
||||
|
||||
<div class="cl"></div>
|
||||
</div><!---tbc_01 end-->
|
||||
|
||||
<div class="undis" id="tbc_02">
|
||||
<div class="problem_main mt10">
|
||||
<%= link_to(image_tag(url_to_avatar(@homework.user), :width => "42", :height => "42"), user_path(@homework.user), :class => "problem_pic fl") %>
|
||||
<div class="problem_txt fl mt5">
|
||||
<h4 class="r_txt_tit mb5">
|
||||
<%= @homework.name%>
|
||||
</h4>
|
||||
<% if @is_teacher%>
|
||||
<%= homework_anonymous_comment(@homework)%>
|
||||
<%= link_to(l(:button_edit),edit_homework_common_path(@homework), :class => "fr mr10 work_edit") %>
|
||||
<% else%>
|
||||
<%= student_anonymous_comment @homework %>
|
||||
<%= student_new_homework @homework %>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div id="bid_description_<%= @homework.id%>" class="mt5 upload_img">
|
||||
<%= @homework.description.html_safe %>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<% unless @homework.attachments.empty?%>
|
||||
<span class="tit_fb" style="width: auto;"> 附件:</span>
|
||||
<div class="fl mb5">
|
||||
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => @homework.attachments} %>
|
||||
</div>
|
||||
<% end%>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<span class="fl">截止时间:<%= @homework.end_time%></span>
|
||||
<div >
|
||||
<% if betweentime(@homework.end_time) < 0 %>
|
||||
<span class='fr mr10 c_red '>
|
||||
<%= l(:label_commit_limit)%>
|
||||
</span>
|
||||
<% else %>
|
||||
<script type="text/javascript">
|
||||
window.setInterval(function(){show_bid_dead_line(<%= @homework.end_time.year%>,<%= @homework.end_time.month%>,<%= @homework.end_time.day + 1%>,"bid_deadline_<%= @homework.id%>");},1000)
|
||||
</script>
|
||||
<div id="bid_deadline_<%= @homework.id%>">
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div> <!--problem_txt end-->
|
||||
<div class="cl"></div>
|
||||
</div><!--problem_main end-->
|
||||
</div><!---tbc_02 end-->
|
||||
|
||||
|
||||
</div><!--ctt end-->
|
||||
</div><!--contentbox end-->
|
|
@ -0,0 +1,51 @@
|
|||
<div class="project_r_h">
|
||||
<h2 class="project_h2">创建作品</h2>
|
||||
</div>
|
||||
<div class="Newwork">
|
||||
<div class="hwork_ctt">
|
||||
<div class="hwork_dis" id="tbc_01">
|
||||
<%= form_for(@stundet_work,
|
||||
:html => { :multipart => true },
|
||||
:url => {:controller => 'student_work',
|
||||
:action => 'create',
|
||||
:homework => @homework.id
|
||||
}) do |f|%>
|
||||
<div class="N_con">
|
||||
<p>
|
||||
<label class="fl"><span class="c_red">*</span> 作品名称 :</label>
|
||||
<%= f.text_field "name", :required => true, :size => 60, :class => "bo fl", :maxlength => 200, :placeholder => "作品名称", :onkeyup => "regexStudentWorkName();" %>
|
||||
<a href="javascript:void(0)" class="fl ml10 mt3" onclick="show_project();" >项目信息
|
||||
<img class="ml5 " src="../images/bid/pic_question.png" width="15" height="15" Title="项目是一种由用户创建的基于 网络的协作空间,能够为个人 或小组提供分布式的协同交流 和资料管理等方面的。">
|
||||
</a>
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_name_span" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p id="about_project" class="about_project" >
|
||||
<label class="fl"> 关联项目 :</label>
|
||||
<%= f.select :project_id,options_for_select(user_projects_option), {},{:class => "bo02 mb10"} %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<label class="fl"><span class="c_red">*</span> 作品描述 :</label>
|
||||
<%= f.text_area "description", :class => "w620 hwork_txt ", :maxlength => 3000, :placeholder => "最多3000个汉字", :onkeyup => "regexStudentWorkDescription();"%>
|
||||
<div class="cl"></div>
|
||||
<p id="student_work_description_textarea" class="c_red ml90 mb10"></p>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p>
|
||||
<label class="fl"> 添加附件 :</label>
|
||||
<%= render :partial => 'attachments/new_form' %>
|
||||
</p>
|
||||
<div class="cl"></div>
|
||||
<p class="ml80 ">
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="new_student_work();">提交作品</a>
|
||||
<%= link_to "返 回".html_safe, student_work_index_path(:homework => @homework), :class => "blue_btn grey_btn fl c_white"%>
|
||||
<div class="cl"></div>
|
||||
</p>
|
||||
</div><!---创建作业内容结束-->
|
||||
<% end%>
|
||||
</div>
|
||||
</div>
|
||||
</div><!--新建作业结束-->
|
||||
<div class="cl"></div>
|
|
@ -0,0 +1 @@
|
|||
$('#student_work_praise_<%= @work.id%>').html('<%= escape_javascript(render :partial => 'student_work/student_work_praise')%>');
|
|
@ -0,0 +1,7 @@
|
|||
if($("#about_hwork_<%= @work.id%>").children().length > 0)
|
||||
{$("#about_hwork_<%= @work.id%>").html("");}
|
||||
else
|
||||
{
|
||||
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show') %>");
|
||||
$('#score_<%= @work.id%>').peSlider({range: 'min'});
|
||||
}
|
|
@ -27,7 +27,7 @@
|
|||
<%= l(:label_homework) %>
|
||||
(
|
||||
<span class="">
|
||||
<%= link_to (membership.course.homeworks.count), {:controller => 'courses', :action => 'homework', :id => membership.course.id} %>
|
||||
<%= link_to (membership.course.homework_commons.count), homework_common_index_path(:course => membership.course.id) %>
|
||||
</span>
|
||||
)
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
<td rowspan="2" >
|
||||
<div class="project-search" style="float: right">
|
||||
<!--label for="user_browse_label"><%#= l(:label_user_search_type) %></label-->
|
||||
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]],@search_by), :onchange => "searchByChange();" ) %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 30 %>
|
||||
<%= select_tag(:search_by,options_for_select([["昵称","0"],["姓名","1"],["邮箱","2"]],@search_by), :onchange => "searchByChange();",:style=>'display:none;' ) %>
|
||||
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder=>'昵称/姓名/邮箱' %>
|
||||
<input type="text" name="search_by_input" hidden="hidden;" id="search_by_input" value="0">
|
||||
<input type="button" class="enterprise" value="<%= l(:label_search) %>" onclick="searchUser();"/>
|
||||
<%#= submit_tag l(:label_search), :class => "enterprise", :name => nil %>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue