merge
This commit is contained in:
commit
a83cb2a1fa
|
@ -272,7 +272,7 @@ module Mobile
|
|||
params do
|
||||
requires :token,type:String
|
||||
requires :course_id,type:Integer,desc: '课程id'
|
||||
optional :name,type:String,desc:'学生的姓名或者昵称或者学号可能包含的字符'
|
||||
optional :name,type:String,desc:'学生的姓名或者登录名或者学号可能包含的字符'
|
||||
end
|
||||
get ":course_id/members" do
|
||||
cs = CoursesService.new
|
||||
|
|
|
@ -82,7 +82,7 @@ module Mobile
|
|||
desc "用户搜索"
|
||||
params do
|
||||
requires :name, type: String, desc: '用户名关键字'
|
||||
requires :search_by, type: String,desc: '搜索依据:0 昵称,1 用户名,2 邮箱,3 昵称和姓名'
|
||||
requires :search_by, type: String,desc: '搜索依据:0 登录名,1 用户名,2 邮箱,3 登录名和姓名'
|
||||
optional :is_search_assitant,type:Integer,desc:'是否搜索注册用户来作为助教'
|
||||
optional :course_id,type:Integer,desc: '课程id,搜索注册用户不为该课程教师的其他用户'
|
||||
optional :user_id,type:Integer,desc:'用户id'
|
||||
|
|
|
@ -461,8 +461,8 @@ class AdminController < ApplicationController
|
|||
scope = User.order('last_login_on desc')
|
||||
scope = scope.where("last_login_on>= '#{params[:startdate]} 00:00:00'") if params[:startdate].present?
|
||||
scope =scope.where("last_login_on <= '#{params[:enddate]} 23:59:59'") if params[:enddate].present?
|
||||
@user = scope
|
||||
@user = paginateHelper @user,30
|
||||
@users = scope
|
||||
@users = paginateHelper @users,30
|
||||
@page = (params['page'] || 1).to_i - 1
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
|
|
@ -312,7 +312,8 @@ class ApplicationController < ActionController::Base
|
|||
elsif @course
|
||||
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @course || @courses, :global => global)
|
||||
else
|
||||
allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global)
|
||||
# allowed = User.current.allowed_to?({:controller => ctrl, :action => action}, @project || @projects, :global => global)
|
||||
allowed = true
|
||||
end
|
||||
allowed
|
||||
end
|
||||
|
@ -769,6 +770,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def api_request?
|
||||
return false if params[:controller] == 'at'
|
||||
%w(xml json).include? params[:format]
|
||||
end
|
||||
|
||||
|
|
|
@ -34,6 +34,12 @@ class AtController < ApplicationController
|
|||
find_homework(id)
|
||||
when 'Topic'
|
||||
find_topic(id)
|
||||
when 'JournalsForMessage'
|
||||
find_journals_for_message(id)
|
||||
when 'Principal'
|
||||
find_principal(id)
|
||||
when 'All'
|
||||
nil
|
||||
else
|
||||
nil
|
||||
end
|
||||
|
@ -120,7 +126,11 @@ class AtController < ApplicationController
|
|||
#JournalsForMessage
|
||||
def find_journals_for_message(id)
|
||||
jounrnal = JournalsForMessage.find(id)
|
||||
find_at_users(jounrnal.jour_type, jounrnal.jour_id)
|
||||
if jounrnal.jour_type == 'Principal'
|
||||
[jounrnal.user] + (JournalsForMessage.where(m_reply_id: id).map(&:user) || [])
|
||||
else
|
||||
find_at_users(jounrnal.jour_type, jounrnal.jour_id)
|
||||
end
|
||||
end
|
||||
|
||||
#Poll
|
||||
|
@ -129,8 +139,6 @@ class AtController < ApplicationController
|
|||
|
||||
#Journal
|
||||
def find_journal(id)
|
||||
journal = Journal.find(id)
|
||||
find_at_users(journal.journalized_type, journal.journalized_id)
|
||||
end
|
||||
|
||||
#Document
|
||||
|
@ -145,7 +153,6 @@ class AtController < ApplicationController
|
|||
|
||||
#Principal
|
||||
def find_principal(id)
|
||||
|
||||
end
|
||||
|
||||
#BlogComment
|
||||
|
|
|
@ -74,6 +74,45 @@ class AttachmentsController < ApplicationController
|
|||
:disposition => 'attachment' #inline can open in browser
|
||||
end
|
||||
|
||||
def direct_download_history
|
||||
@attachment_history = AttachmentHistory.find(params[:id])
|
||||
@attachment_history.increment_download
|
||||
send_file @attachment_history.diskfile_history, :filename => filename_for_content_disposition(@attachment_history.filename),
|
||||
:type => detect_content_type(@attachment_history),
|
||||
:disposition => 'attachment' #inline can open in browser
|
||||
end
|
||||
|
||||
def download_history
|
||||
@attachment_history = AttachmentHistory.find(params[:id])
|
||||
candown = attachment_history_candown @attachment_history
|
||||
if candown || User.current.admin? || User.current.id == @attachment_history.author_id
|
||||
if stale?(:etag => @attachment_history.digest)
|
||||
if params[:preview] == 'true'
|
||||
convered_file = @attachment_history.diskfile_history
|
||||
#如果本身不是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_history.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_history
|
||||
end
|
||||
else
|
||||
direct_download_history
|
||||
end
|
||||
end
|
||||
else
|
||||
render_403 :message => :notice_not_authorized
|
||||
end
|
||||
rescue => e
|
||||
redirect_to "http://" + (Setting.host_name.to_s) +"/file_not_found.html"
|
||||
end
|
||||
|
||||
def download
|
||||
# modify by nwb
|
||||
# 下载添加权限设置
|
||||
|
@ -212,7 +251,7 @@ class AttachmentsController < ApplicationController
|
|||
@history.version = @old_history.nil? ? 1 : @old_history.version + 1
|
||||
@history.save #历史记录保存完毕
|
||||
#将最新保存的记录 数据替换到 需要修改的文件记录
|
||||
@old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public")
|
||||
@old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads")
|
||||
@old_attachment.save
|
||||
#删除当前记录
|
||||
@attachment.delete
|
||||
|
@ -600,7 +639,7 @@ private
|
|||
|
||||
def has_login
|
||||
unless @attachment && @attachment.container_type == "PhoneAppVersion"
|
||||
render_403 unless User.current.logged?
|
||||
render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,10 +52,14 @@ class BlogCommentsController < ApplicationController
|
|||
render_attachment_warning_if_needed(@article)
|
||||
else
|
||||
end
|
||||
if params[:is_homepage]
|
||||
redirect_to user_blogs_path(params[:user_id])
|
||||
if params[:in_act]
|
||||
redirect_to user_path(params[:user_id])
|
||||
else
|
||||
redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id])
|
||||
if @article.id.eql?(User.find(params[:user_id]).blog.homepage_id)
|
||||
redirect_to user_path(params[:user_id])
|
||||
else
|
||||
redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id])
|
||||
end
|
||||
end
|
||||
end
|
||||
def destroy
|
||||
|
@ -123,6 +127,7 @@ class BlogCommentsController < ApplicationController
|
|||
@blogComment.title = "RE: #{@article.title}" unless params[:blog_comment][:title]
|
||||
@article.children << @blogComment
|
||||
@article.save
|
||||
# @article.update_attribute(:updated_on, @blogComment.updated_on)
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first
|
||||
if user_activity
|
||||
|
|
|
@ -2,7 +2,6 @@ class BlogsController < ApplicationController
|
|||
before_filter :find_blog,:except => [:index,:create,:new,:set_homepage, :cancel_homepage]
|
||||
before_filter :find_user
|
||||
def index
|
||||
@articls = @user.blog.articles
|
||||
@article = BlogComment.new
|
||||
respond_to do |format|
|
||||
format.html {render :layout=>'new_base_user'}
|
||||
|
|
|
@ -25,7 +25,9 @@ class CommentsController < ApplicationController
|
|||
|
||||
def create
|
||||
raise Unauthorized unless @news.commentable?
|
||||
|
||||
if !@news.org_subfield_id.nil?
|
||||
@org_subfield = OrgSubfield.find(@news.org_subfield_id)
|
||||
end
|
||||
@comment = Comment.new
|
||||
#@project ? @comment.comments = params[:comment][:comments] : @comment.comments = params[:comment]
|
||||
if params[:user_activity_id]
|
||||
|
|
|
@ -321,11 +321,12 @@ class CoursesController < ApplicationController
|
|||
|
||||
def export_course_member_excel
|
||||
@all_members = student_homework_score(0,0,0,"desc")
|
||||
@homeworks = @course.homework_commons.order("created_at desc")
|
||||
filename="#{@course.teacher.lastname.to_s + @course.teacher.firstname.to_s }_#{@course.name}_#{@course.time.to_s + @course.term}#{l(:excel_member_list)}";
|
||||
|
||||
respond_to do |format|
|
||||
format.xls {
|
||||
send_data(member_to_xls(@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present",
|
||||
send_data(member_to_xls(@homeworks,@course,@all_members,@course.course_groups), :type => "text/excel;charset=utf-8; header=present",
|
||||
:filename => filename_for_content_disposition("#{filename}.xls"))
|
||||
}
|
||||
end
|
||||
|
@ -441,7 +442,14 @@ class CoursesController < ApplicationController
|
|||
@course = cs.create_course(params,User.current)[:course]
|
||||
if params[:copy_course]
|
||||
copy_course = Course.find params[:copy_course].to_i
|
||||
@course.update_attributes(:open_student => copy_course.open_student, :publish_resource => copy_course.publish_resource)
|
||||
@course.is_copy = params[:copy_course].to_i
|
||||
@course.open_student = copy_course.open_student
|
||||
@course.publish_resource = copy_course.publish_resource
|
||||
@course.save
|
||||
|
||||
#copy avatar
|
||||
copy_avatar(@course, copy_course)
|
||||
|
||||
if params[:checkAll]
|
||||
attachments = copy_course.attachments
|
||||
attachments.each do |attachment|
|
||||
|
@ -509,7 +517,7 @@ class CoursesController < ApplicationController
|
|||
if @course
|
||||
respond_to do |format|
|
||||
flash[:notice] = l(:notice_successful_create)
|
||||
format.html {redirect_to settings_course_url(@course, :course_type => 1)}
|
||||
format.html {redirect_to course_url(@course)}
|
||||
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'courses', :action => 'show', :id => @course.id) }
|
||||
end
|
||||
else
|
||||
|
@ -903,6 +911,17 @@ class CoursesController < ApplicationController
|
|||
return 404
|
||||
end
|
||||
end
|
||||
#搜索作业
|
||||
def homework_search
|
||||
@search = "%#{params[:search].strip.downcase}%"
|
||||
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
if @is_teacher
|
||||
@homeworks = @course.homework_commons.where("name like '%#{@search}%'").order("created_at desc").limit(10).offset(@page * 10)
|
||||
else
|
||||
@homeworks = @course.homework_commons.where("name like '%#{@search}%' and publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def update_quotes attachment
|
||||
|
@ -960,7 +979,7 @@ class CoursesController < ApplicationController
|
|||
sql_select = ""
|
||||
if groupid == 0
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(student_works.final_score)
|
||||
SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{@course.id}
|
||||
|
@ -972,7 +991,7 @@ class CoursesController < ApplicationController
|
|||
WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}"
|
||||
else
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(student_works.final_score)
|
||||
SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{@course.id}
|
||||
|
@ -1006,16 +1025,54 @@ class CoursesController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
def member_to_xls members,groups
|
||||
def member_to_xls homeworks, course, members,groups
|
||||
xls_report = StringIO.new
|
||||
book = Spreadsheet::Workbook.new
|
||||
sheet1 = book.create_worksheet :name => "student"
|
||||
|
||||
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
|
||||
sheet1.row(0).default_format = blue
|
||||
#sheet1.row(0).default_format = blue
|
||||
#sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)])
|
||||
sheet1[0,0] = "课程编号"
|
||||
sheet1[0,1] = course.id
|
||||
sheet1[1,0] = "课程学期"
|
||||
sheet1[1,1] = course.time.to_s+"年"+course.term
|
||||
sheet1[2,0] = "课程名称"
|
||||
sheet1[2,1] = course.name
|
||||
sheet1[3,0] = "教师团队"
|
||||
sheet1[3,1] = (searchTeacherAndAssistant course).map{|member| member.user.show_name}.join('、')
|
||||
sheet1[4,0] = "主讲教师"
|
||||
sheet1[4,1] = course.teacher.show_name
|
||||
sheet1[5,0] = "排名"
|
||||
sheet1[5,1] = "学生姓名"
|
||||
sheet1[5,2] = "昵称"
|
||||
sheet1[5,3] = "学号"
|
||||
for i in 0 ... homeworks.count
|
||||
sheet1[5,i+4] = "第"+(i+1).to_s+"次"
|
||||
end
|
||||
sheet1[5,homeworks.count+4] = "总成绩"
|
||||
sheet1[5,0] = "排名"
|
||||
sheet1[5,0] = "排名"
|
||||
count_row = 6
|
||||
members.each_with_index do |member, i|
|
||||
sheet1[count_row,0]= i+1
|
||||
sheet1[count_row,1] = member.user.lastname.to_s + member.user.firstname.to_s
|
||||
sheet1[count_row,2] = member.user.login
|
||||
sheet1[count_row,3] = member.user.user_extensions.student_id
|
||||
homeworks.each_with_index do |homework, j|
|
||||
student_works = homework.student_works.where("user_id = #{member.user.id}")
|
||||
if student_works.empty?
|
||||
sheet1[count_row,j+4] = format("%0.2f",0)
|
||||
else
|
||||
final_score = student_works.first.final_score.nil? ? 0 : student_works.first.final_score
|
||||
score = final_score - student_works.first.absence_penalty - student_works.first.late_penalty
|
||||
sheet1[count_row,j+4] = format("%0.2f",score <0 ? 0:score)
|
||||
end
|
||||
end
|
||||
sheet1[count_row,homeworks.count+4] = format("%0.2f",member.score.nil? ? 0:member.score.to_s)
|
||||
count_row += 1
|
||||
end
|
||||
|
||||
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_homework_score)])
|
||||
count_row = 1
|
||||
=begin
|
||||
group0 = CourseGroup.new();
|
||||
group0.id = 0;
|
||||
group0.name = l(:excel_member_with_out_class)
|
||||
|
@ -1037,6 +1094,7 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
=end
|
||||
book.write xls_report
|
||||
xls_report.string
|
||||
end
|
||||
|
|
|
@ -26,7 +26,7 @@ class FilesController < ApplicationController
|
|||
before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,
|
||||
:search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment,
|
||||
:search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache,
|
||||
:search_files_in_subfield,:upload_files_menu]
|
||||
:search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file]
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
|
@ -96,6 +96,33 @@ class FilesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def file_hidden
|
||||
@file = Attachment.find params[:id]
|
||||
@course = Course.find params[:course_id]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def republish_file
|
||||
@file = Attachment.find params[:id]
|
||||
@course = Course.find params[:course_id]
|
||||
if params[:publish_time]
|
||||
unless params[:publish_time] == ""
|
||||
@file.publish_time = params[:publish_time]
|
||||
end
|
||||
end
|
||||
if @file.publish_time > Date.today
|
||||
@file.is_publish = 0
|
||||
else
|
||||
@file.is_publish = 1
|
||||
end
|
||||
@file.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def search_project
|
||||
sort = ""
|
||||
@sort = ""
|
||||
|
@ -488,6 +515,23 @@ class FilesController < ApplicationController
|
|||
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||
Mailer.run.attachments_added(attachments[:files])
|
||||
end
|
||||
if !attachments.empty? && attachments[:files]
|
||||
attachments[:files].each do |attachment|
|
||||
if params[:publish_time]
|
||||
if params[:publish_time] == ""
|
||||
attachment.publish_time = Date.today
|
||||
else
|
||||
attachment.publish_time = params[:publish_time]
|
||||
end
|
||||
else
|
||||
attachment.publish_time = Date.today
|
||||
end
|
||||
if attachment.publish_time > Date.today
|
||||
attachment.is_publish = 0
|
||||
end
|
||||
attachment.save
|
||||
end
|
||||
end
|
||||
if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array)
|
||||
params[:course_attachment_type].each do |type|
|
||||
tag_name = get_tag_name_by_type_number type
|
||||
|
|
|
@ -15,8 +15,12 @@ class HomeworkCommonController < ApplicationController
|
|||
@new_homework.homework_detail_manual = HomeworkDetailManual.new
|
||||
@new_homework.course = @course
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
@homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10)
|
||||
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
|
||||
if @is_teacher
|
||||
@homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10)
|
||||
else
|
||||
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10)
|
||||
end
|
||||
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
|
||||
@is_new = params[:is_new]
|
||||
|
||||
|
@ -340,7 +344,7 @@ class HomeworkCommonController < ApplicationController
|
|||
|
||||
#当前用户是不是课程的成员
|
||||
def member_of_course
|
||||
render_403 unless @course.is_public || User.current.member_of_course?(@course) || User.current.admin?
|
||||
render_403 unless @course.is_public==1 || User.current.member_of_course?(@course) || User.current.admin?
|
||||
end
|
||||
|
||||
def get_assigned_homeworks(student_works, n, index)
|
||||
|
|
|
@ -81,6 +81,7 @@ class IssuesController < ApplicationController
|
|||
@priority_id = params[:priority_id]
|
||||
@status_id = params[:status_id]
|
||||
@subject = params[:subject]
|
||||
@done_ratio = params[:done_ratio]
|
||||
@issue_count = @query.issue_count
|
||||
@issue_pages = Paginator.new @issue_count, @limit, params['page']
|
||||
params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1
|
||||
|
@ -220,19 +221,27 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
|
||||
def update
|
||||
return unless update_issue_from_params
|
||||
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
|
||||
saved = false
|
||||
begin
|
||||
@saved = @issue.save_issue_with_child_records(params, @time_entry)
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
@conflict = true
|
||||
if params[:last_journal_id]
|
||||
@conflict_journals = @issue.journals_after(params[:last_journal_id]).all
|
||||
@conflict_journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
|
||||
if params[:issue_detail]
|
||||
issue = Issue.find(params[:id])
|
||||
issue = update_user_issue_detail(issue, params)
|
||||
@saved = update_user_issue_detail(issue, params)
|
||||
return
|
||||
else
|
||||
return unless update_issue_from_params
|
||||
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
|
||||
saved = false
|
||||
begin
|
||||
@saved = @issue.save_issue_with_child_records(params, @time_entry)
|
||||
rescue ActiveRecord::StaleObjectError
|
||||
@conflict = true
|
||||
if params[:last_journal_id]
|
||||
@conflict_journals = @issue.journals_after(params[:last_journal_id]).all
|
||||
@conflict_journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if @saved
|
||||
#修改界面增加跟踪者
|
||||
watcherlist = @issue.watcher_users
|
||||
|
@ -278,6 +287,19 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def update_user_issue_detail(issue, params)
|
||||
case params[:type]
|
||||
when "status"
|
||||
issue.update_attribute(:status_id, params[:status_id])
|
||||
when "assigned"
|
||||
issue.update_attribute(:assigned_to_id, params[:assigned_to_id])
|
||||
when "ratio"
|
||||
issue.update_attribute(:done_ratio, params[:done_ratio])
|
||||
when "prior"
|
||||
issue.update_attribute(:priority_id, params[:priority_id])
|
||||
end
|
||||
end
|
||||
|
||||
# Updates the issue form when changing the project, status or tracker
|
||||
# on issue creation/update
|
||||
def update_form
|
||||
|
|
|
@ -46,15 +46,16 @@ class NewsController < ApplicationController
|
|||
@course = Course.find(params[:course_id])
|
||||
end
|
||||
if @project
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
scope = @project ? @project.news.visible : News.visible
|
||||
|
||||
@news_count = scope.count
|
||||
@news_pages = Paginator.new @news_count, @limit, params['page']
|
||||
@offset ||= @news_pages.offset
|
||||
#@news_pages = Paginator.new @news_count, @limit, params['page']
|
||||
#@offset ||= @news_pages.offset
|
||||
@newss = scope.all(:include => [:author, :project],
|
||||
:order => "#{News.table_name}.created_on DESC",
|
||||
:offset => @offset,
|
||||
:limit => @limit)
|
||||
:offset => @page * 10,
|
||||
:limit => 10)
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
|
@ -63,6 +64,7 @@ class NewsController < ApplicationController
|
|||
|
||||
render :layout => false if request.xhr?
|
||||
}
|
||||
format.js
|
||||
format.api
|
||||
format.atom { render_feed(@newss, :title => (@project ? @project.name : Setting.app_title) + ": #{l(:label_news_plural)}") }
|
||||
end
|
||||
|
@ -144,6 +146,10 @@ class NewsController < ApplicationController
|
|||
if @course
|
||||
render :layout => 'base_courses'
|
||||
end
|
||||
elsif @news.org_subfield_id
|
||||
@org_subfield = OrgSubfield.find(@news.org_subfield_id)
|
||||
@organization = @org_subfield.organization
|
||||
render :layout => 'base_org'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -151,6 +157,21 @@ class NewsController < ApplicationController
|
|||
#modify by nwb
|
||||
if @project
|
||||
@news = News.new(:project => @project, :author => User.current)
|
||||
@news.safe_attributes = params[:news]
|
||||
@news.save_attachments(params[:attachments])
|
||||
if @news.save
|
||||
if params[:asset_id]
|
||||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS
|
||||
end
|
||||
render_attachment_warning_if_needed(@news)
|
||||
#flash[:notice] = l(:notice_successful_create)
|
||||
redirect_to project_news_index_url(@project)
|
||||
else
|
||||
redirect_to project_news_index_url(@project)
|
||||
#layout_file = 'base_courses'
|
||||
#render :action => 'new', :layout => layout_file
|
||||
end
|
||||
elsif @course
|
||||
@news = News.new(:course => @course, :author => User.current)
|
||||
#render :layout => 'base_courses'
|
||||
|
@ -221,8 +242,14 @@ class NewsController < ApplicationController
|
|||
end
|
||||
|
||||
def edit
|
||||
if @news.org_subfield_id
|
||||
@org_subfield = OrgSubfield.find(@news.org_subfield_id)
|
||||
@organization = @org_subfield.organization
|
||||
end
|
||||
if @course
|
||||
render :layout => "base_courses"
|
||||
elsif @org_subfield
|
||||
render :layout => 'base_org'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -240,12 +267,17 @@ class NewsController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
if @news.org_subfield_id
|
||||
@org_subfield = OrgSubfield.find(@news.org_subfield_id)
|
||||
end
|
||||
@news.destroy
|
||||
# modify by nwb
|
||||
if @project
|
||||
redirect_to project_news_index_url(@project)
|
||||
elsif @course
|
||||
redirect_to course_news_index_url(@course)
|
||||
elsif @org_subfield
|
||||
redirect_to organization_path(@org_subfield.organization, :org_subfield_id => @org_subfield.id)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -27,7 +27,12 @@ class OrgSubfieldsController < ApplicationController
|
|||
@sort = ""
|
||||
@order = ""
|
||||
@is_remote = false
|
||||
@organization = Organization.find(params[:id])
|
||||
if params[:id]
|
||||
@organization = Organization.find(params[:id])
|
||||
else
|
||||
domain = Secdomain.where("subname=?", request.subdomain).first
|
||||
@organization = Organization.find(domain.pid)
|
||||
end
|
||||
@org_subfield = OrgSubfield.find_by_sql("select distinct org_subfields.* from org_subfields,"+
|
||||
"subfield_subdomain_dirs where org_subfields.id = subfield_subdomain_dirs.org_subfield_id and "+
|
||||
" org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'").first
|
||||
|
@ -105,7 +110,8 @@ class OrgSubfieldsController < ApplicationController
|
|||
if SubfieldSubdomainDir.find_by_sql(sql).count == 0
|
||||
if @org_subfield.subfield_subdomain_dir
|
||||
@sub_dir = @org_subfield.subfield_subdomain_dir
|
||||
@sub_dir.update_attribute(:name, params[:sub_dir_name])
|
||||
@sub_dir = SubfieldSubdomainDir.update(@sub_dir.id, :name => params[:sub_dir_name])
|
||||
#@sub_dir.update_attribute(:name, params[:sub_dir_name])
|
||||
else
|
||||
@sub_dir = SubfieldSubdomainDir.create(:org_subfield_id => @org_subfield.id, :name => params[:sub_dir_name])
|
||||
end
|
||||
|
|
|
@ -55,6 +55,7 @@ class OrganizationsController < ApplicationController
|
|||
@organization.name = params[:organization][:name]
|
||||
@organization.description = params[:organization][:description]
|
||||
@organization.is_public = params[:organization][:is_public]
|
||||
@organization.allow_guest_download = params[:organization][:allow_guest_download] == '1' ? 1 : 0
|
||||
@organization.creator_id = User.current.id
|
||||
member = OrgMember.new(:user_id => User.current.id)
|
||||
|
||||
|
@ -116,6 +117,7 @@ class OrganizationsController < ApplicationController
|
|||
@organization.description = params[:organization][:description]
|
||||
# @organization.domain = params[:organization][:domain]
|
||||
@organization.is_public = params[:organization][:is_public] == 'on' ? 1 : 0
|
||||
@organization.allow_guest_download = params[:organization][:allow_guest_download] == 'on' ? 1 : 0
|
||||
#@organization.name = params[:organization][:name]
|
||||
@organization.save
|
||||
respond_to do |format|
|
||||
|
@ -136,6 +138,10 @@ class OrganizationsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def check_uniq_domain
|
||||
@is_exist = (Secdomain.where("subname=?",params[:org_domain]).count > 0)
|
||||
end
|
||||
|
||||
def find_organization
|
||||
@organization = Organization.find(params[:id])
|
||||
end
|
||||
|
@ -296,7 +302,11 @@ class OrganizationsController < ApplicationController
|
|||
|
||||
def org_resources_subfield
|
||||
@org = Organization.find(params[:id])
|
||||
@subfield = @org.org_subfields.where('field_type = "Resource" ')
|
||||
if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message')
|
||||
@subfield = @org.org_subfields.where("field_type = 'Post'")
|
||||
else
|
||||
@subfield = @org.org_subfields.where('field_type = "Resource" ')
|
||||
end
|
||||
respond_to do | format|
|
||||
format.js
|
||||
end
|
||||
|
@ -312,7 +322,12 @@ class OrganizationsController < ApplicationController
|
|||
def agree_apply_subdomain
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
OrgMessage.find(params[:act_id]).update_attribute(:viewed, 1)
|
||||
@organization.update_attribute(:domain, params[:org_domain])
|
||||
if Secdomain.where("pid=? and sub_type=2",@organization.id).count > 0
|
||||
domain = Secdomain.where("pid=? and sub_type=2",params[:organization_id]).first
|
||||
Secdomain.update(domain.id, :subname => params[:org_domain])
|
||||
else
|
||||
Secdomain.create(:sub_type => 2, :pid => params[:organization_id], :subname => params[:org_domain])
|
||||
end
|
||||
if OrgMessage.where("message_type='AgreeApplySubdomain' and organization_id=#{@organization.id} and content=?",params[:org_domain]).count == 0
|
||||
OrgMessage.create(:user_id => params[:user_id], :organization_id => @organization.id, :message_type => 'AgreeApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:org_domain])
|
||||
end
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
class PollController < ApplicationController
|
||||
before_filter :find_poll_and_course, :only => [:edit,:update,:destroy,:show,:statistics_result,:create_poll_question,:commit_poll,:commit_answer,:publish_poll,:republish_poll,:poll_result,:close_poll,:export_poll]
|
||||
before_filter :find_container, :only => [:new,:create, :index]
|
||||
before_filter :is_logged, :only => [:index, :show, :poll_result,:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll,:commit_answer,:commit_poll,:statistics_result]
|
||||
before_filter :is_member_of_course, :only => [:index,:show,:poll_result]
|
||||
before_filter :is_course_teacher, :only => [:new,:create,:edit,:update,:destroy,:publish_poll,:republish_poll,:close_poll,:export_poll]
|
||||
include PollHelper
|
||||
|
@ -213,6 +214,7 @@ class PollController < ApplicationController
|
|||
def publish_poll
|
||||
@poll.polls_status = 2
|
||||
@poll.published_at = Time.now
|
||||
@poll.show_result = params[:show_result]
|
||||
if @poll.save
|
||||
if params[:is_remote]
|
||||
redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)
|
||||
|
@ -503,6 +505,10 @@ class PollController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def is_logged
|
||||
redirect_to signin_path unless User.current.logged?
|
||||
end
|
||||
|
||||
def is_member_of_course
|
||||
render_403 unless(@course && (User.current.member_of_course?(@course) || User.current.admin?))
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ class PraiseTreadController < ApplicationController
|
|||
end
|
||||
return
|
||||
end
|
||||
#@horizontal = params[:horizontal].downcase == "false" ? false:true
|
||||
@horizontal = params[:horizontal].downcase == "false" ? false:true if params[:horizontal]
|
||||
if @obj.respond_to?("author_id")
|
||||
author_id = @obj.author_id
|
||||
elsif @obj.respond_to?("user_id")
|
||||
|
@ -103,30 +103,36 @@ class PraiseTreadController < ApplicationController
|
|||
def find_object_by_type_and_id(type,id)
|
||||
@obj = nil
|
||||
case type
|
||||
when 'User'
|
||||
@obj = User.find_by_id(id)
|
||||
when 'Issue'
|
||||
@obj = Issue.find_by_id(id)
|
||||
when 'Project'
|
||||
@obj = Project.find_by_id(id)
|
||||
when 'Bid'
|
||||
@obj = Bid.find_by_id(id)
|
||||
when 'Contest'
|
||||
@obj = Contest.find_by_id(id)
|
||||
when 'Memo'
|
||||
@obj = Memo.find_by_id(id)
|
||||
when 'Message'
|
||||
@obj = Message.find_by_id(id)
|
||||
when 'HomeworkCommon'
|
||||
@obj = HomeworkCommon.find_by_id(id)
|
||||
when 'JournalsForMessage'
|
||||
@obj = JournalsForMessage.find_by_id(id)
|
||||
when 'News'
|
||||
@obj = News.find_by_id(id)
|
||||
when 'Comment'
|
||||
@obj = Comment.find_by_id(id)
|
||||
when 'Journal'
|
||||
@obj = Journal.find_by_id(id)
|
||||
when 'Memo'
|
||||
@obj = Memo.find_by_id(id)
|
||||
when 'Message'
|
||||
@obj = Message.find_by_id(id)
|
||||
when 'HomeworkCommon'
|
||||
@obj = HomeworkCommon.find_by_id(id)
|
||||
when 'JournalsForMessage'
|
||||
@obj = JournalsForMessage.find_by_id(id)
|
||||
when 'News'
|
||||
@obj = News.find_by_id(id)
|
||||
when 'Comment'
|
||||
@obj = Comment.find_by_id(id)
|
||||
when 'Journal'
|
||||
@obj = Journal.find_by_id(id)
|
||||
when 'BlogComment'
|
||||
@obj = BlogComment.find_by_id(id)
|
||||
when 'OrgDocumentComment'
|
||||
@obj = OrgDocumentComment.find_by_id(id)
|
||||
when 'User'
|
||||
@obj = User.find_by_id(id)
|
||||
when 'Issue'
|
||||
@obj = Issue.find_by_id(id)
|
||||
when 'Project'
|
||||
@obj = Project.find_by_id(id)
|
||||
when 'Bid'
|
||||
@obj = Bid.find_by_id(id)
|
||||
when 'Contest'
|
||||
@obj = Contest.find_by_id(id)
|
||||
else
|
||||
@obj = nil
|
||||
end
|
||||
return @obj
|
||||
end
|
||||
|
@ -143,7 +149,8 @@ class PraiseTreadController < ApplicationController
|
|||
# end
|
||||
|
||||
#再创建或更新praise_tread_cache表
|
||||
@ptc = PraiseTreadCache.find_by_object_id_and_object_type(id,type)
|
||||
#@ptc = PraiseTreadCache.find_by_object_id_and_object_type(id,type)
|
||||
@ptc = PraiseTreadCache.where("object_id = ? and object_type = ?",id.to_i,type).first
|
||||
@ptc = @ptc.nil? ? PraiseTreadCache.new : @ptc
|
||||
@ptc.object_id = id.to_i
|
||||
@ptc.object_type = type
|
||||
|
|
|
@ -112,7 +112,6 @@ class ProjectsController < ApplicationController
|
|||
@project_pages = Project.project_entities.visible.like(params[:name]).page(params[:page]).per(10)
|
||||
else
|
||||
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
|
||||
@project_pages = Project.project_entities.visible.page(params[:page] ).per(10)
|
||||
end
|
||||
@projects = @project_pages.order("created_on desc")
|
||||
@limit = 10#per_page_option
|
||||
|
|
|
@ -360,6 +360,9 @@ update
|
|||
end
|
||||
# end
|
||||
@changesets_latest_coimmit = @changesets[0]
|
||||
unless @changesets[0].blank?
|
||||
update_commits_date(@project, @changesets_latest_coimmit)
|
||||
end
|
||||
@properties = @repository.properties(@path, @rev)
|
||||
@repositories = @project.repositories
|
||||
@course_tag = params[:course]
|
||||
|
@ -589,6 +592,11 @@ update
|
|||
project.project_score.update_attribute(:changeset_num, count)
|
||||
end
|
||||
|
||||
# 更新项目提交次数时间
|
||||
def update_commits_date project, date
|
||||
project.project_score.update_attribute(:commit_time, date.created_at)
|
||||
end
|
||||
|
||||
def find_repository
|
||||
@repository = Repository.find(params[:id])
|
||||
@project = @repository.project
|
||||
|
|
|
@ -98,14 +98,22 @@ class StudentWorkController < ApplicationController
|
|||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
if pro.nil?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
end
|
||||
|
@ -113,7 +121,11 @@ class StudentWorkController < ApplicationController
|
|||
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
|
@ -134,14 +146,22 @@ class StudentWorkController < ApplicationController
|
|||
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
if pro.nil?
|
||||
@stundet_works = []
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.where(:user_id => User.current.id)
|
||||
end
|
||||
|
@ -149,7 +169,11 @@ class StudentWorkController < ApplicationController
|
|||
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
|
||||
if @homework.homework_type == 3
|
||||
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
if pro.nil?
|
||||
my_work = []
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id)
|
||||
end
|
||||
else
|
||||
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id)
|
||||
end
|
||||
|
@ -1031,4 +1055,4 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -93,6 +93,11 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 更新issue状态
|
||||
def user_act_issue_assign_to
|
||||
|
||||
end
|
||||
|
||||
# 用户消息
|
||||
# 说明: homework 发布作业;message:讨论区; news:新闻; poll:问卷;works_reviewers:作品评阅;works_reply:作品回复,exercise:课程测验
|
||||
# issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment)
|
||||
|
@ -187,11 +192,13 @@ class UsersController < ApplicationController
|
|||
forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0)
|
||||
user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0)
|
||||
forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0)
|
||||
org_querys = OrgMessage.where("user_id=? and viewed=0", user)
|
||||
if User.current.id == @user.id
|
||||
course_querys.update_all(:viewed => true)
|
||||
forge_querys.update_all(:viewed => true)
|
||||
user_querys.update_all(:viewed => true)
|
||||
forum_querys.update_all(:viewed => true)
|
||||
org_querys.update_all(:viewed => true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -398,8 +405,47 @@ class UsersController < ApplicationController
|
|||
|
||||
#导入作业
|
||||
def user_import_homeworks
|
||||
@user = User.current
|
||||
@select_course = params[:select_course] ? 1 : 0
|
||||
@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc")
|
||||
#@user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc")
|
||||
visible_course = Course.where("is_public = 1 && is_delete = 0")
|
||||
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc")
|
||||
@type = params[:type]
|
||||
@limit = 15
|
||||
@is_remote = true
|
||||
@hw_count = @homeworks.count
|
||||
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
|
||||
@offset ||= @hw_pages.offset
|
||||
@homeworks = paginateHelper @homeworks,15
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def user_homework_type
|
||||
@user = User.current
|
||||
if(params[:type].blank? || params[:type] == "1") #公共题库
|
||||
visible_course = Course.where("is_public = 1 && is_delete = 0")
|
||||
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc")
|
||||
elsif params[:type] == "2" #我的题库
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc")
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 15
|
||||
@is_remote = true
|
||||
@hw_count = @homeworks.count
|
||||
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
|
||||
@offset ||= @hw_pages.offset
|
||||
@homeworks = paginateHelper @homeworks,15
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def show_homework_detail
|
||||
@homework = HomeworkCommon.find params[:homework].to_i
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -407,7 +453,22 @@ class UsersController < ApplicationController
|
|||
|
||||
#用户主页过滤作业
|
||||
def user_search_homeworks
|
||||
@user_homeworks = HomeworkCommon.where("user_id = '#{@user.id}' and lower(name) like '%#{params[:name].to_s.downcase}%'").order("created_at desc")
|
||||
@user = User.current
|
||||
search = params[:name].to_s.strip.downcase
|
||||
if(params[:type].blank? || params[:type] == "1") #全部
|
||||
visible_course = Course.where("is_public = 1 && is_delete = 0")
|
||||
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
|
||||
@homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%')").order("created_at desc")
|
||||
elsif params[:type] == "2" #课程资源
|
||||
@homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and (name like '%#{search}%')").order("created_at desc")
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 15
|
||||
@is_remote = true
|
||||
@hw_count = @homeworks.count
|
||||
@hw_pages = Paginator.new @hw_count, @limit, params['page'] || 1
|
||||
@offset ||= @hw_pages.offset
|
||||
@homeworks = paginateHelper @homeworks,15
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -421,6 +482,7 @@ class UsersController < ApplicationController
|
|||
@homework = HomeworkCommon.new
|
||||
@select_course = params[:select_course] || 0
|
||||
if homework
|
||||
@ref_homework = homework
|
||||
@homework.name = homework.name
|
||||
@homework.description = homework.description
|
||||
@homework.end_time = homework.end_time
|
||||
|
@ -578,13 +640,15 @@ class UsersController < ApplicationController
|
|||
homework_detail_manual.save if homework_detail_manual
|
||||
homework_detail_programing.save if homework_detail_programing
|
||||
homework_detail_group.save if homework_detail_group
|
||||
|
||||
if params[:quotes] && !params[:quotes].blank?
|
||||
homework = HomeworkCommon.find params[:quotes].to_i
|
||||
homework.update_attribute(:quotes, homework.quotes+1)
|
||||
end
|
||||
if params[:is_in_course] == "1"
|
||||
redirect_to homework_common_index_path(:course => homework.course_id)
|
||||
else
|
||||
redirect_to user_homeworks_user_path(User.current.id)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -746,14 +810,28 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
# end
|
||||
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
if params[:type].present?
|
||||
case params[:type]
|
||||
when "public"
|
||||
jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 0').order('updated_on DESC')
|
||||
when "private"
|
||||
jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('updated_on DESC')
|
||||
else
|
||||
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC')
|
||||
end
|
||||
else
|
||||
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('updated_on DESC')
|
||||
end
|
||||
@jour_count = jours.count
|
||||
@jour = jours.limit(10).offset(@page * 10)
|
||||
@type = params[:type]
|
||||
if User.current == @user
|
||||
jours.update_all(:is_readed => true, :status => false)
|
||||
jours.each do |journal|
|
||||
fetch_user_leaveWord_reply(journal).update_all(:is_readed => true, :status => false)
|
||||
end
|
||||
end
|
||||
@jour = paginateHelper jours,10
|
||||
@state = false
|
||||
render :layout=>'new_base_user'
|
||||
end
|
||||
|
@ -1608,6 +1686,10 @@ class UsersController < ApplicationController
|
|||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
attach_copied_obj.save
|
||||
unless Project.find(project_id).project_score.nil?
|
||||
Project.find(project_id).project_score.update_attribute(:attach_num,
|
||||
Project.find(project_id).project_score.attach_num + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
elsif params[:send_ids].present?
|
||||
|
@ -1643,6 +1725,9 @@ class UsersController < ApplicationController
|
|||
attach_copied_obj.attachtype = 1
|
||||
end
|
||||
attach_copied_obj.save
|
||||
unless Project.find(project_id).project_score.nil?
|
||||
Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1753,6 +1838,96 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def share_news_to_course
|
||||
news = News.find(params[:send_id])
|
||||
course_ids = params[:course_ids]
|
||||
course_ids.each do |course_id|
|
||||
if Course.find(course_id).news.map(&:id).exclude?(news.id)
|
||||
course_news = News.create(:course_id => course_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now,:project_id => -1)
|
||||
news.attachments.each do |attach|
|
||||
course_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
||||
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
||||
:is_public => attach.is_public, :quotes => 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def share_news_to_project
|
||||
news = News.find(params[:send_id])
|
||||
project_ids = params[:project_ids]
|
||||
project_ids.each do |project_id|
|
||||
project = Project.find(project_id)
|
||||
if project.news.map(&:id).exclude?(news.id)
|
||||
message = Message.create(:board_id => project.boards.first.id, :subject => news.title, :content => news.description, :author_id => User.current.id)
|
||||
news.attachments.each do |attach|
|
||||
message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
||||
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
||||
:is_public => attach.is_public, :quotes => 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def share_news_to_org
|
||||
news = News.find(params[:send_id])
|
||||
field_id = params[:subfield]
|
||||
org_news = News.create(:org_subfield_id => field_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now,:project_id => -1)
|
||||
news.attachments.each do |attach|
|
||||
org_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
||||
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
||||
:is_public => attach.is_public, :quotes => 0)
|
||||
end
|
||||
OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'News', :org_act_id => org_news.id, :user_id => User.current.id)
|
||||
end
|
||||
|
||||
def share_message_to_course
|
||||
@message = Message.find(params[:send_id])
|
||||
course_ids = params[:course_ids]
|
||||
course_ids.each do |course_id|
|
||||
course = Course.find(course_id)
|
||||
if course.news.map(&:id).exclude?(@message.id)
|
||||
message = Message.create(:board_id => course.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id)
|
||||
@message.attachments.each do |attach|
|
||||
message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
||||
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
||||
:is_public => attach.is_public, :quotes => 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def share_message_to_project
|
||||
@message = Message.find(params[:send_id])
|
||||
project_ids = params[:project_ids]
|
||||
project_ids.each do |project_id|
|
||||
project = Project.find(project_id)
|
||||
if project.news.map(&:id).exclude?(@message.id)
|
||||
message = Message.create(:board_id => project.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id)
|
||||
@message.attachments.each do |attach|
|
||||
message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
||||
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
||||
:is_public => attach.is_public, :quotes => 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def share_message_to_org
|
||||
field_id = params[:subfield]
|
||||
@message = Message.find(params[:send_id])
|
||||
@message.quotes = @message.quotes.nil? ? 1 : (@message.quotes + 1)
|
||||
@message.save
|
||||
board = OrgSubfield.find(field_id).boards.first
|
||||
mes = Message.create(:board_id => board.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id)
|
||||
@message.attachments.each do |attach|
|
||||
mes.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
||||
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
||||
:is_public => attach.is_public, :quotes => 0)
|
||||
end
|
||||
OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'Message', :org_act_id => mes.id, :user_id => User.current.id)
|
||||
end
|
||||
|
||||
def change_org_subfield
|
||||
|
||||
end
|
||||
|
@ -1969,22 +2144,22 @@ class UsersController < ApplicationController
|
|||
if(params[:type].blank? || params[:type] == "1") #全部
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and is_publish = 1 and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)").order("created_on desc")
|
||||
else
|
||||
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " +
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and is_publish = 1 " +
|
||||
"and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
|
||||
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
||||
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)").order("created_on desc")
|
||||
end
|
||||
elsif params[:type] == "2" #课程资源
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
user_course_ids = User.current.courses.map { |c| c.id}
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) ").order("created_on desc")
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
|
||||
else
|
||||
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+
|
||||
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' and is_publish = 1)"+
|
||||
"or (container_type = 'Course' and is_public = 1 and is_publish = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
||||
end
|
||||
elsif params[:type] == "3" #项目资源
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
|
@ -1994,9 +2169,9 @@ class UsersController < ApplicationController
|
|||
end
|
||||
elsif params[:type] == "4" #附件
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
|
||||
else
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
|
||||
end
|
||||
elsif params[:type] == "5" #用户资源
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
|
@ -2102,9 +2277,17 @@ class UsersController < ApplicationController
|
|||
@user = User.current
|
||||
if !params[:search].nil? #发送到有栏目类型为资源的组织中
|
||||
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||
@orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}
|
||||
if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message')
|
||||
@orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Post'").count > 0}
|
||||
else
|
||||
@orgs = @user.organizations.where("name like ?", search).select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}
|
||||
end
|
||||
else
|
||||
@orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}
|
||||
if params[:send_type].present? and (params[:send_type] == 'news' or params[:send_type] == 'message')
|
||||
@orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Post'").count > 0}
|
||||
else
|
||||
@orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}
|
||||
end
|
||||
end
|
||||
@search = params[:search]
|
||||
#这里仅仅是传递需要发送的资源id
|
||||
|
|
|
@ -62,6 +62,7 @@ class WordsController < ApplicationController
|
|||
update_forge_activity('JournalsForMessage',parent_id)
|
||||
update_org_activity('JournalsForMessage',parent_id)
|
||||
update_principal_activity('JournalsForMessage',parent_id)
|
||||
(JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now)
|
||||
end
|
||||
respond_to do |format|
|
||||
# format.html {
|
||||
|
@ -73,9 +74,9 @@ class WordsController < ApplicationController
|
|||
# render 'test/index'
|
||||
# }
|
||||
format.js {
|
||||
@reply_type = params[:reply_type]
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@activity = JournalsForMessage.find(parent_id)
|
||||
@is_activity = params[:is_activity]
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -94,6 +95,9 @@ class WordsController < ApplicationController
|
|||
@user = User.find(@journal_destroyed.jour_id)
|
||||
@jours_count = @user.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
@is_user = true
|
||||
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
|
||||
@is_activity = params[:is_activity].to_i if params[:is_activity]
|
||||
@activity = @journal_destroyed.parent if @journal_destroyed.parent
|
||||
elsif @journal_destroyed.jour_type == 'HomeworkCommon'
|
||||
@homework = HomeworkCommon.find @journal_destroyed.jour_id
|
||||
if params[:user_activity_id]
|
||||
|
@ -225,11 +229,11 @@ class WordsController < ApplicationController
|
|||
def leave_user_message
|
||||
if User.current.logged?
|
||||
@user = User.find(params[:id])
|
||||
if params[:new_form][:user_message].size>0 && User.current.logged? && @user
|
||||
if params[:new_form][:content].size>0 && User.current.logged? && @user
|
||||
if params[:private] && params[:private] == '1'
|
||||
@user.journals_for_messages << JournalsForMessage.new(:user_id => User.current.id, :notes => params[:new_form][:user_message], :reply_id => 0, :status => true, :is_readed => false, :private => 1)
|
||||
@user.journals_for_messages << JournalsForMessage.new(:user_id => User.current.id, :notes => params[:new_form][:content], :reply_id => 0, :status => true, :is_readed => false, :private => 1)
|
||||
else
|
||||
@user.add_jour(User.current, params[:new_form][:user_message])
|
||||
@user.add_jour(User.current, params[:new_form][:content])
|
||||
end
|
||||
end
|
||||
redirect_to feedback_path(@user)
|
||||
|
|
|
@ -134,8 +134,11 @@ class ZipdownController < ApplicationController
|
|||
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
|
||||
|
||||
bid_homework_path << out_file.file_path
|
||||
digests << out_file.file_digest
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
homework_id = homework_common.id
|
||||
|
@ -172,7 +175,11 @@ class ZipdownController < ApplicationController
|
|||
}
|
||||
end
|
||||
|
||||
def zip_student_work_by_user work
|
||||
def make_zip_name(work)
|
||||
"#{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}"
|
||||
end
|
||||
|
||||
def zip_student_work_by_user(work)
|
||||
homeworks_attach_path = []
|
||||
not_exist_file = []
|
||||
# 需要将所有homework.attachments遍历加入zip
|
||||
|
@ -186,10 +193,23 @@ class ZipdownController < ApplicationController
|
|||
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)
|
||||
}
|
||||
|
||||
#单个文件的话,不需要压缩,只改名
|
||||
out_file = nil
|
||||
if homeworks_attach_path.size == 1
|
||||
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
|
||||
des_path = "#{OUTPUT_FOLDER}/#{make_zip_name(work)}_#{File.basename(homeworks_attach_path.first)}"
|
||||
FileUtils.cp homeworks_attach_path.first, des_path
|
||||
des_path
|
||||
}
|
||||
else
|
||||
out_file = find_or_pack(work.homework_common_id, work.user_id, digests.sort){
|
||||
zipping("#{make_zip_name(work)}.zip",
|
||||
homeworks_attach_path, OUTPUT_FOLDER, true, not_exist_file)
|
||||
}
|
||||
end
|
||||
out_file
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -49,10 +49,25 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
def link_to_user_version(version, options = {})
|
||||
return '' unless version && version.is_a?(Version)
|
||||
link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => "linkBlue"
|
||||
end
|
||||
|
||||
# 判断课程是否为精品课程
|
||||
def is_excellent_course course
|
||||
(course.is_excellent? or course.excellent_option?) ? true : false
|
||||
end
|
||||
|
||||
# 判断课程对成员是否可见
|
||||
def visible_course?(course)
|
||||
(course.is_delete? or (!course.is_public? && !User.current.member_of_course?(course))) ? false : true
|
||||
end
|
||||
|
||||
# 获取项目/课程总分
|
||||
# 发布缺陷 4分 回复缺陷 1分 提交一次 4分 讨论帖子 2分 回复帖子 1分 发布新闻 1分
|
||||
def static_project_score obj
|
||||
score = obj.issue_num * 4 + obj.issue_journal_num + obj.changeset_num * 4 + obj.board_num * 2 + obj.board_message_num + obj.news_num + obj.attach_num * 5
|
||||
score = obj.issue_num * 4 + obj.issue_journal_num + (obj.changeset_num||0) * 4 + obj.board_num * 2 + obj.board_message_num + obj.news_num + obj.attach_num * 5
|
||||
end
|
||||
|
||||
# 获取组织成员中文名字
|
||||
|
@ -959,7 +974,17 @@ module ApplicationHelper
|
|||
first_page = FirstPage.find_by_page_type('project')
|
||||
if args.empty?
|
||||
title = @html_title || []
|
||||
title << @project.name if @project
|
||||
if @project
|
||||
title << @project.name
|
||||
elsif @course
|
||||
title << @course.name
|
||||
elsif @organization
|
||||
title << @organization.name
|
||||
elsif @user
|
||||
title << @user.login
|
||||
else
|
||||
title << User.current.login
|
||||
end
|
||||
if first_page.nil? || first_page.web_title.nil?
|
||||
title << Setting.app_title unless Setting.app_title == title.last
|
||||
else
|
||||
|
@ -1972,6 +1997,18 @@ module ApplicationHelper
|
|||
courses_doing
|
||||
end
|
||||
|
||||
def attachment_history_candown attachment_history
|
||||
if attachment_history.container_type == "Course"
|
||||
course = Course.find(attachment_history.container_id)
|
||||
candown = User.current.member_of?(course) || (course.is_public && attachment_history.is_public == 1)
|
||||
elsif attachment_history.container_type == "Project"
|
||||
project = Project.find(attachment_history.container_id)
|
||||
candown = User.current.member_of?(project) || (project.is_public && attachment_history.is_public == 1)
|
||||
elsif attachment_history.container_type == "OrgSubfield"
|
||||
org = OrgSubfield.find(attachment_history.container_id)
|
||||
candown = User.current.member_of_org?(org) || (org.organization.is_public && attachment_history.is_public == 1)
|
||||
end
|
||||
end
|
||||
|
||||
def attachment_candown attachment
|
||||
candown = false
|
||||
|
@ -1996,6 +2033,8 @@ module ApplicationHelper
|
|||
candown= User.current.member_of_course?(course) || (course.is_public==1 && attachment.is_public == 1)
|
||||
elsif attachment.container.is_a?(OrgSubfield)
|
||||
candown = true
|
||||
elsif attachment.container.is_a?(OrgDocumentComment)
|
||||
candown = true
|
||||
elsif (attachment.container.has_attribute?(:board) || attachment.container.has_attribute?(:board_id)) && attachment.container.board &&
|
||||
attachment.container.board.course
|
||||
course = attachment.container.board.course
|
||||
|
@ -2781,19 +2820,12 @@ int main(int argc, char** argv){
|
|||
end
|
||||
|
||||
if opt[:init_activity]
|
||||
ss += javascript_include_tag "init_activity_KindEditor"
|
||||
ss += javascript_include_tag "create_kindeditor"
|
||||
end
|
||||
|
||||
ss.html_safe
|
||||
end
|
||||
|
||||
#代码提交数量
|
||||
def changesets_num project
|
||||
g = Gitlab.client
|
||||
project.gpid.nil? ? 0 : g.project(project.gpid).commit_count
|
||||
# project.changesets.count
|
||||
end
|
||||
|
||||
#课程动态的更新
|
||||
def update_course_activity type, id
|
||||
course_activity = CourseActivity.where("course_act_type=? and course_act_id =?", type.to_s, id).first
|
||||
|
@ -2834,4 +2866,13 @@ end
|
|||
principal_activity.save
|
||||
end
|
||||
end
|
||||
|
||||
#项目按更新时间排序
|
||||
def project_sort_update projects
|
||||
unless projects.empty?
|
||||
project_ids = '('+projects.map{|pro|pro.project_id}.join(',')+')'
|
||||
sort_projects = ForgeActivity.find_by_sql("SELECT MAX(updated_at) AS updated_at,user_id, project_id FROM forge_activities WHERE project_id IN #{project_ids} GROUP BY project_id ORDER BY MAX(updated_at) DESC")
|
||||
return sort_projects
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,24 @@
|
|||
module AvatarHelper
|
||||
|
||||
AVATAR_SIZE="50x50"
|
||||
|
||||
def copy_avatar(des, src)
|
||||
src_file = disk_filename(src.class,src.id)
|
||||
des_file = disk_filename(des.class,des.id)
|
||||
|
||||
FileUtils.cp(src_file, des_file) if File.exist?(src_file)
|
||||
end
|
||||
|
||||
def avatar_image(source)
|
||||
File.join(relative_path, avatar_directory(source.class), source.id.to_s)
|
||||
def avatar_image(source, copyed=false)
|
||||
source_type = source.class
|
||||
source_id = source.id
|
||||
|
||||
course = Course.find(source_id) rescue nil
|
||||
if course && copyed
|
||||
source_id = course.is_copy
|
||||
end
|
||||
|
||||
File.join(relative_path, avatar_directory(source_type), source_id.to_s)
|
||||
end
|
||||
|
||||
def relative_path
|
||||
|
@ -23,7 +38,18 @@ module AvatarHelper
|
|||
end
|
||||
|
||||
def disk_filename(source_type,source_id,image_file=nil)
|
||||
File.join(storage_path,avatar_directory(source_type),avatar_filename(source_id,image_file))
|
||||
File.join(storage_path,avatar_directory(source_type),avatar_filename(source_id,image_file))
|
||||
end
|
||||
|
||||
def copy_course?(source_type, source_id)
|
||||
file= disk_filename(source_type, source_id)
|
||||
if source_type == Course && !File.exist?(file)
|
||||
course = Course.find(source_id) rescue nil
|
||||
if course && course.is_copy>0
|
||||
return true
|
||||
end
|
||||
end
|
||||
false
|
||||
end
|
||||
|
||||
def file_extension(filename=nil)
|
||||
|
@ -35,7 +61,9 @@ module AvatarHelper
|
|||
return File.join(relative_path,'AnonymousUser','0')
|
||||
end
|
||||
if source.class && source.id && File.exist?(disk_filename(source.class,source.id))
|
||||
avatar_image(source)
|
||||
avatar_image(source, false)
|
||||
elsif copy_course?(source.class, source.id)
|
||||
get_avatar(Course.find(source.is_copy)) rescue nil
|
||||
else
|
||||
File.join(relative_path,avatar_directory(source.class),'0')
|
||||
end
|
||||
|
|
|
@ -11,6 +11,59 @@ module CoursesHelper
|
|||
#StudentRoles = [5, 10]
|
||||
#AllPeople = StudentRoles+TeacherRoles
|
||||
## return people count
|
||||
|
||||
|
||||
# 推荐的精品课程
|
||||
def excellent_course_recommend new_course
|
||||
q = "%#{new_course.name.strip}%"
|
||||
result = find_excelletn_course(q, new_course)
|
||||
end
|
||||
|
||||
# 查询符合条件的精品课程
|
||||
# 用新课程名去匹配精品课程中按课程名和Tag名
|
||||
def find_excelletn_course keywords, current_course
|
||||
# 获取tag匹配结果ID
|
||||
a_tags = []
|
||||
# kc = keywords.to_a
|
||||
Course.visible.where("is_excellent =?", 1).each do |ec|
|
||||
if ec.tags.any?{|value| current_course.name.include?(value.to_s)}
|
||||
a_tags << ec.id
|
||||
end
|
||||
end
|
||||
# sql = "SELECT distinct c.* FROM `courses` c, tags t, taggings ts where t.id = ts.tag_id and ts.taggable_id = c.id and c.is_excellent = 1 and is_delete = 0 and
|
||||
# ts.taggable_type = 'Course' and t.name like '%#{keywords}%'"
|
||||
# a_tags = Course.find_by_sql(sql).select{|course| course.is_public ==1 unless User.current.member_of_course?(course)}
|
||||
# 通过elastic结果获取精品课程
|
||||
a_courses = []
|
||||
#courses = Course.search(keywords)
|
||||
#courses.each do |c|
|
||||
# a_courses << c.id
|
||||
#end
|
||||
a_courses << a_tags unless a_tags.length == 0
|
||||
# 课程本身不能搜索显示自己
|
||||
excellent_ids = a_courses.flatten.uniq.delete_if{|i| i == current_course.id}
|
||||
limit = 5 - excellent_ids.length.to_i
|
||||
sql = "SELECT distinct c.id FROM course_activities cs, courses c where cs.course_id = c.id
|
||||
and c.is_excellent =1 and c.id != #{current_course.id} order by cs.updated_at desc;"
|
||||
default_ecourse_ids = Course.find_by_sql(sql).flatten
|
||||
# REDO:时间紧,待优化
|
||||
default_ids =[]
|
||||
default_ecourse_ids.each do |de|
|
||||
default_ids << de.id
|
||||
end
|
||||
default_ids = default_ids - excellent_ids
|
||||
#default_ecourse = Course.where("id is not in (?)", ids).find_by_sql(sql).flatten.delete_if{|i| i == current_course.id}.flatten
|
||||
arr_result = excellent_ids << default_ids
|
||||
arr_result = arr_result.flatten.first(5)
|
||||
return arr_result
|
||||
# 过滤条件:精品课程、本身不在搜索范围
|
||||
#e_courses = Course.where("is_excellent =? and id in (?)",1, arr_result).where("id !=?", current_course.id)
|
||||
end
|
||||
|
||||
# 判断精品课程是否可见,非课程成员无法查看私有课程
|
||||
def visible_excellent_course obj
|
||||
# if course.is_pu
|
||||
end
|
||||
|
||||
# 返回x项目成员数量,即roles表中定义的所有成员
|
||||
def projectCount project
|
||||
|
@ -63,6 +116,34 @@ module CoursesHelper
|
|||
@course.journals_for_messages.where('m_parent_id IS NULL').count
|
||||
end
|
||||
|
||||
#当前学期
|
||||
def current_time_and_term course
|
||||
str = ""
|
||||
term = cur_course_term
|
||||
if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year
|
||||
str = course.time.to_s + course.term.to_s
|
||||
elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term)
|
||||
str = course.time.to_s + course.term.to_s
|
||||
elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term))
|
||||
str = course.end_time.to_s + course.end_term.to_s
|
||||
else
|
||||
str = Time.now.year.to_s + cur_course_term.to_s
|
||||
end
|
||||
str
|
||||
end
|
||||
|
||||
def set_term_value term
|
||||
val = 0
|
||||
if term == "春季学期"
|
||||
val = 1
|
||||
elsif term == "夏季学期"
|
||||
val = 2
|
||||
elsif term == "秋季学期"
|
||||
val = 3
|
||||
end
|
||||
val
|
||||
end
|
||||
|
||||
# 返回学生数量,即roles表中定义的Reporter
|
||||
#def studentCount project
|
||||
# searchStudent(project).count
|
||||
|
@ -509,7 +590,7 @@ module CoursesHelper
|
|||
type = []
|
||||
month = Time.now.month
|
||||
now_year = year.nil? ? Time.now.year : (Time.now.year <= year ? Time.now.year : year)
|
||||
year = month < 3 ? now_year - 1 : now_year
|
||||
year = month < 2 && now_year >=Time.now.year ? now_year - 1 : now_year
|
||||
for i in (year..year + 10)
|
||||
option = []
|
||||
option << i
|
||||
|
@ -539,8 +620,10 @@ module CoursesHelper
|
|||
|
||||
def cur_course_term
|
||||
month = Time.now.month
|
||||
if month >= 9 || month < 3
|
||||
if month >= 9 || month < 2
|
||||
term = "秋季学期"
|
||||
elsif (month >= 7 && Time.now.day >= 15) || month == 8
|
||||
term = "夏季学期"
|
||||
else
|
||||
term = "春季学期"
|
||||
end
|
||||
|
@ -550,7 +633,7 @@ module CoursesHelper
|
|||
def course_in_current_or_next_term course
|
||||
is_current_term = false
|
||||
is_next_term = false
|
||||
year_now = Time.now.month < 3 ? Time.now.year - 1:Time.now.year
|
||||
year_now = Time.now.month < 2 ? Time.now.year - 1:Time.now.year
|
||||
if course.time == year_now && course.term == cur_course_term
|
||||
is_current_term = true
|
||||
end
|
||||
|
@ -559,6 +642,7 @@ module CoursesHelper
|
|||
elsif cur_course_term == "春季学期" && course.time == year_now && course.term == "夏季学期"
|
||||
is_next_term = true
|
||||
elsif cur_course_term == "夏季学期" && course.time == year_now && course.term == "秋季学期"
|
||||
is_next_term = true
|
||||
end
|
||||
is_current_term || is_next_term
|
||||
end
|
||||
|
@ -644,17 +728,16 @@ module CoursesHelper
|
|||
def join_in_course_header(course, user, options=[])
|
||||
if user.logged?
|
||||
joined = course.members.map{|member| member.user_id}.include? user.id
|
||||
text = joined ? ("<em class='pr_arrow'></em>".html_safe + l(:label_course_exit_student)) : ("<em class='pr_add'></em>".html_safe + l(:label_course_join_student))
|
||||
text = joined ? l(:label_course_exit_student) : l(:label_course_join_student)
|
||||
url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
|
||||
method = joined ? 'delete' : 'post'
|
||||
if joined
|
||||
link = "<span class='pr_join_span mr5' ><em class='pr_add'></em>#{l(:label_course_join_student)}</span>" + link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out))
|
||||
link = link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out))
|
||||
else
|
||||
link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a") + "<span class='pr_join_span mr5' ><em class='pr_arrow'></em>#{l(:label_course_exit_student)}</span>".html_safe
|
||||
link = link_to(text, url, :remote => true, :method => method, :id => "#{course.id}", :class => "pr_join_a")
|
||||
end
|
||||
else
|
||||
link = "<span class='pr_join_span mr5' ><em class='pr_add'></em>#{l(:label_course_join_student)}</span>" +
|
||||
"<span class='pr_join_span mr5' ><em class='pr_arrow'></em>#{l(:label_course_exit_student)}</span>"
|
||||
link = "<span class='pr_join_span mr5' >#{l(:label_course_join_student)}</span>"
|
||||
end
|
||||
link.html_safe
|
||||
end
|
||||
|
@ -663,7 +746,7 @@ module CoursesHelper
|
|||
return[] unless course
|
||||
result = []
|
||||
course.attachments.each do |attachment|
|
||||
if attachment.is_public? || User.current.member_of_course?(course) || User.current.admin?
|
||||
if attachment.is_public? ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id))|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
|
||||
result << attachment
|
||||
end
|
||||
end
|
||||
|
@ -743,7 +826,7 @@ module CoursesHelper
|
|||
# 学生按作业总分排序,取前8个
|
||||
def hero_homework_score(course, score_sort_by)
|
||||
sql_select = "SELECT members.*,(
|
||||
SELECT SUM(student_works.final_score)
|
||||
SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))
|
||||
FROM student_works,homework_commons
|
||||
WHERE student_works.homework_common_id = homework_commons.id
|
||||
AND homework_commons.course_id = #{course.id}
|
||||
|
|
|
@ -123,7 +123,8 @@ module FilesHelper
|
|||
attachments.each do |attachment|
|
||||
if attachment.is_public? ||
|
||||
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
|
||||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)))||
|
||||
(attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))||
|
||||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)||
|
||||
attachment.author_id == User.current.id ||
|
||||
attachment.container_type == "OrgSubfield"
|
||||
result << attachment
|
||||
|
|
|
@ -89,10 +89,11 @@ module UsersHelper
|
|||
def unviewed_message(user)
|
||||
course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
forge_count = ForgeMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
org_count = OrgMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
at_count = user.at_messages.where(viewed: false).count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count + org_count
|
||||
end
|
||||
|
||||
def user_mail_notification_options(user)
|
||||
|
|
|
@ -47,7 +47,11 @@ class AtMessage < ActiveRecord::Base
|
|||
"回复帖子: "
|
||||
end + at_message.subject
|
||||
when 'JournalsForMessage'
|
||||
"作业: #{at_message.jour.name} 中留言"
|
||||
if at_message.jour_type == 'Principal'
|
||||
"留言: 在#{at_message.at_user.show_name}主页中留言"
|
||||
else
|
||||
"作业: #{at_message.jour.name} 中留言"
|
||||
end
|
||||
else
|
||||
logger.error "error type: #{at_message_type}"
|
||||
end
|
||||
|
@ -92,7 +96,12 @@ class AtMessage < ActiveRecord::Base
|
|||
when 'Message'
|
||||
{controller: :boards, action: :show, project_id: at_message.board.project, id: at_message.board}
|
||||
when 'JournalsForMessage'
|
||||
{controller: :homework_common, action: :index, course: at_message.jour.course_id}
|
||||
if at_message.jour_type == 'Principal'
|
||||
{controller: :users, action: :user_messages, id: at_message.at_user}
|
||||
else
|
||||
{controller: :homework_common, action: :index, course: at_message.jour.course_id}
|
||||
end
|
||||
|
||||
else
|
||||
logger.error "error type: #{at_message_type}"
|
||||
end
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
class AttachmentHistory < ActiveRecord::Base
|
||||
belongs_to :attachment,foreign_key: 'attachment_id'
|
||||
cattr_accessor :storage_history_path
|
||||
@@storage_history_path = Redmine::Configuration['attachments_storage_path'] || File.join(Rails.root, "files")
|
||||
|
||||
# Returns file's location on disk
|
||||
def diskfile_history
|
||||
File.join(self.class.storage_history_path, disk_directory.to_s, disk_filename.to_s)
|
||||
end
|
||||
|
||||
def increment_download
|
||||
increment!(:downloads)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,6 +18,7 @@ class BlogComment < ActiveRecord::Base
|
|||
|
||||
after_save :add_user_activity
|
||||
after_update :update_activity
|
||||
after_create :update_parent_time
|
||||
before_destroy :destroy_user_activity
|
||||
|
||||
scope :like, lambda {|arg|
|
||||
|
@ -64,6 +65,11 @@ class BlogComment < ActiveRecord::Base
|
|||
(user && user.logged? && (self.author == user) ) || user.admin?
|
||||
end
|
||||
|
||||
def update_parent_time
|
||||
if !self.parent.nil?
|
||||
self.root.update_attribute(:updated_on, self.updated_on)
|
||||
end
|
||||
end
|
||||
def project
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
require 'elasticsearch/model'
|
||||
class Course < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
include ApplicationHelper
|
||||
|
||||
STATUS_ACTIVE = 1
|
||||
STATUS_CLOSED = 5
|
||||
|
@ -71,7 +70,7 @@ class Course < ActiveRecord::Base
|
|||
validates_length_of :description, :maximum => 10000
|
||||
before_save :self_validate
|
||||
# 公开课程变成私有课程,所有资源都变成私有
|
||||
after_update :update_files_public,:update_course_ealasticsearch_index,:update_activity
|
||||
after_update :update_files_public,:update_course_ealasticsearch_index
|
||||
after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index
|
||||
before_destroy :delete_all_members,:delete_course_ealasticsearch_index
|
||||
|
||||
|
@ -145,6 +144,26 @@ class Course < ActiveRecord::Base
|
|||
)
|
||||
end
|
||||
|
||||
def self.e_search(query)
|
||||
__elasticsearch__.search(
|
||||
{
|
||||
query: {
|
||||
multi_match: {
|
||||
query: query,
|
||||
type:"most_fields",
|
||||
operator: "or",
|
||||
fields: ['name', 'description^0.5']
|
||||
}
|
||||
},
|
||||
sort: {
|
||||
_score:{order: "desc" },
|
||||
updated_at:{order:"desc"}
|
||||
|
||||
}
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
def visible?(user=User.current)
|
||||
user.allowed_to?(:view_course, self)
|
||||
end
|
||||
|
@ -384,6 +403,7 @@ class Course < ActiveRecord::Base
|
|||
def act_as_course_message
|
||||
self.course_messages << CourseMessage.new(:user_id => self.tea_id, :course_id => self.id, :viewed => false)
|
||||
end
|
||||
|
||||
#项目与课程分离后,很多课程的名称等信息为空,这些数据信息存储在项目表中!!就是数据兼容的问题
|
||||
#def name
|
||||
# read_attribute('name') || Project.find_by_identifier(self.extra).try(:name)
|
||||
|
@ -405,6 +425,7 @@ class Course < ActiveRecord::Base
|
|||
self.__elasticsearch__.index_document
|
||||
end
|
||||
end
|
||||
|
||||
def update_course_ealasticsearch_index
|
||||
if self.is_public == 1 and self.is_delete == 0 #如果是初次更新成为公开或者恢复被删除的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
|
||||
begin
|
||||
|
@ -428,13 +449,11 @@ class Course < ActiveRecord::Base
|
|||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
#动态的更新
|
||||
def update_activity
|
||||
update_course_activity(self.class, self.id)
|
||||
update_user_activity(self.class, self.id)
|
||||
update_org_activity(self.class, self.id)
|
||||
end
|
||||
|
||||
|
||||
|
||||
# Delete the previous articles index in Elasticsearch
|
||||
# Course.__elasticsearch__.client.indices.delete index: Course.index_name rescue nil
|
||||
|
|
|
@ -6,6 +6,7 @@ class CourseActivity < ActiveRecord::Base
|
|||
belongs_to :user
|
||||
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
|
||||
after_save :add_user_activity, :add_course_activity
|
||||
after_create :add_course_lead
|
||||
before_destroy :destroy_user_activity, :destroy_org_activity
|
||||
|
||||
#在个人动态里面增加当前动态
|
||||
|
@ -60,4 +61,19 @@ class CourseActivity < ActiveRecord::Base
|
|||
org_activity = OrgActivity.where("org_act_type = '#{self.course_act_type.to_s}' and org_act_id = '#{self.course_act_id}'")
|
||||
org_activity.destroy_all
|
||||
end
|
||||
|
||||
# 发布新课导语
|
||||
# 导语要放置在课程创建信息之后
|
||||
# 导语
|
||||
def add_course_lead
|
||||
if self.course_act_type == "Course"
|
||||
lead_message = Message.find(12440)
|
||||
name = lead_message.subject
|
||||
content = lead_message.content
|
||||
# message的status状态为0为正常,为1表示创建课程时发送的message
|
||||
message = Message.create(:subject => name, :content => content, :board_id => self.course.boards.first.id, :author_id => self.course.tea_id , :sticky => true, :status => true )
|
||||
# 更新的目的是为了排序,因为该条动态的时间可能与课程创建的动态创建时间一直
|
||||
message.course_acts.first.update_attribute(:updated_at, message.course_acts.first.updated_at + 1) if message.course_acts.first
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,6 +52,7 @@ class Journal < ActiveRecord::Base
|
|||
|
||||
# fq
|
||||
after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message
|
||||
after_create :update_issue_time
|
||||
# end
|
||||
#after_destroy :down_user_score
|
||||
#before_save :be_user_score
|
||||
|
@ -230,4 +231,12 @@ class Journal < ActiveRecord::Base
|
|||
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1)
|
||||
end
|
||||
end
|
||||
|
||||
# 回复issue的时候,更新issue的时候
|
||||
def update_issue_time
|
||||
if self.journalized_type == "Issue"
|
||||
forge_activity = ForgeActivity.where("forge_act_id =? and forge_act_type =?", self.issue, "Issue").first
|
||||
forge_activity.update_attribute(:created_at, self.created_on) unless forge_activity.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -70,7 +70,7 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
validates :notes, presence: true, if: :is_homework_jour?
|
||||
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score
|
||||
after_create :reset_counters!
|
||||
after_update :update_ativity
|
||||
#after_update :update_activity
|
||||
after_destroy :reset_counters!
|
||||
after_save :be_user_score
|
||||
after_destroy :down_user_score
|
||||
|
|
|
@ -379,6 +379,24 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
end
|
||||
|
||||
# issue截止时间提醒
|
||||
def issue_due_date(issue)
|
||||
recipients ||= []
|
||||
if issue.author.id != issue.assigned_to_id
|
||||
recipients << issue.author.mail
|
||||
end
|
||||
|
||||
# 被指派人邮箱地址加入数组
|
||||
recipients << issue.assigned_to.mail
|
||||
# cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
@author = issue.author
|
||||
@issue_name = issue.subject
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
||||
@subject = "#{l(:mail_issue)}#{issue.subject} #{l(:mail_issue_due_date)} "
|
||||
mail :to => recipients,
|
||||
:subject => @subject
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email recipients of the added issue.
|
||||
#
|
||||
# Example:
|
||||
|
|
|
@ -150,7 +150,7 @@ class Member < ActiveRecord::Base
|
|||
|
||||
#当前学生在指定作业内的得分
|
||||
def homework_common_score homework_common
|
||||
StudentWork.select("final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id)
|
||||
StudentWork.select("IF(final_score is null,null,final_score - absence_penalty - late_penalty) as final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id)
|
||||
end
|
||||
|
||||
def student_work_score_avg
|
||||
|
@ -158,7 +158,12 @@ class Member < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def student_work_score_sum
|
||||
StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").sum(:final_score).try(:round, 2).to_f
|
||||
sql_select = "SELECT (SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))) as score
|
||||
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}"
|
||||
score = StudentWork.find_by_sql(sql_select)
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
@ -22,6 +22,7 @@ class News < ActiveRecord::Base
|
|||
has_many_kindeditor_assets :assets, :dependent => :destroy
|
||||
#added by nwb
|
||||
belongs_to :course,:touch => true
|
||||
belongs_to :org_subfield, :touch => true
|
||||
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
|
||||
has_many :comments, :as => :commented, :dependent => :destroy, :order => "created_on"
|
||||
# fq
|
||||
|
@ -57,7 +58,7 @@ class News < ActiveRecord::Base
|
|||
|
||||
after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail, :add_news_count
|
||||
after_update :update_activity
|
||||
after_destroy :delete_kindeditor_assets, :decrease_news_count
|
||||
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args))
|
||||
|
@ -187,4 +188,8 @@ class News < ActiveRecord::Base
|
|||
Mailer.run.news_added(self) if Setting.notified_events.include?('news_added')
|
||||
end
|
||||
|
||||
def delete_org_activities
|
||||
OrgActivity.where("container_type='OrgSubfield' and org_act_type='News' and org_act_id=?", self.id).destroy_all
|
||||
end
|
||||
|
||||
end
|
|
@ -6,6 +6,7 @@ class OrgSubfield < ActiveRecord::Base
|
|||
has_many :org_subfield_messages, :dependent => :destroy
|
||||
has_many :messages, :through => :org_subfield_messages
|
||||
has_many :boards, :dependent => :destroy
|
||||
has_many :news, :dependent => :destroy
|
||||
acts_as_attachable
|
||||
after_create :create_board_sync
|
||||
# 创建资源栏目讨论区
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
class Secdomain < ActiveRecord::Base
|
||||
attr_accessible :pid, :subname, :sub_type, :desc
|
||||
|
||||
validates_presence_of :subname, :sub_type
|
||||
validates_uniqueness_of :subname
|
||||
|
||||
def controller
|
||||
return 'organizations' if sub_type == 2
|
||||
return 'users' if sub_type == 3
|
||||
nil
|
||||
end
|
||||
|
||||
def action
|
||||
return 'show' if sub_type == 2
|
||||
return 'show' if sub_type == 3
|
||||
nil
|
||||
end
|
||||
end
|
|
@ -1,4 +1,5 @@
|
|||
class SubfieldSubdomainDir < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
belongs_to :org_subfield
|
||||
validates_exclusion_of :name, :in => %w(setting members org_document_comments)
|
||||
end
|
||||
|
|
|
@ -346,7 +346,8 @@ class User < Principal
|
|||
user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
|
||||
system_messages_count = SystemMessage.where("created_at >?", User.current.onclick_time.onclick_time).count
|
||||
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count
|
||||
org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", User.current.id,0, User.current.onclick_time.onclick_time).count
|
||||
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count
|
||||
end
|
||||
|
||||
# 查询指派给我的缺陷记录
|
||||
|
@ -826,6 +827,9 @@ class User < Principal
|
|||
end
|
||||
|
||||
def admin_of_org?(org)
|
||||
if self.admin?
|
||||
return true
|
||||
end
|
||||
if OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count == 0
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -254,6 +254,8 @@ class CoursesService
|
|||
#course.safe_attributes = params[:course]
|
||||
course.time = params[:time]
|
||||
course.term = params[:term]
|
||||
course.end_time = params[:end_time]
|
||||
course.end_term = params[:end_term]
|
||||
course.class_period = params[:class_period].to_i
|
||||
params[:course][:is_public] ? course.is_public = 1 : course.is_public = 0
|
||||
params[:course][:open_student] ? course.open_student = 1 : course.open_student = 0
|
||||
|
|
|
@ -224,7 +224,7 @@
|
|||
<%= back_url_hidden_field_tag %>
|
||||
<div class="mb20">
|
||||
<%= text_field_tag 'username', params[:username], :tabindex => '1' ,
|
||||
:class=>'loginSignBox',:placeholder=>'请输入邮箱地址或昵称', :onkeypress => "user_name_keypress(event);"%>
|
||||
:class=>'loginSignBox',:placeholder=>'请输入邮箱地址或登录名', :onkeypress => "user_name_keypress(event);"%>
|
||||
<!--<input type="text" placeholder="请输入邮箱地址或昵称" class="loginSignBox" />-->
|
||||
</div>
|
||||
<% if Setting.openid? %>
|
||||
|
@ -283,8 +283,8 @@
|
|||
</div>
|
||||
<div class="loginSignRow">
|
||||
<!--<input type="text" placeholder="请输入用户昵称" class="loginSignBox" />-->
|
||||
<%= f.text_field :login, :size => 25,:placeholder=>"请输入用户昵称",:class=>'loginSignBox'%>
|
||||
<div class="loginSignAlert" id="login_req" style="display: none">用户昵称为2-18个中英文,数字或下划线</div>
|
||||
<%= f.text_field :login, :size => 25,:placeholder=>"请输入用户登录名",:class=>'loginSignBox'%>
|
||||
<div class="loginSignAlert" id="login_req" style="display: none">用户登录名为2-18个中英文,数字或下划线</div>
|
||||
</div>
|
||||
<div class="loginSignOption">
|
||||
<div class="fl mt3 mr5">
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
用户姓名
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
用户昵称
|
||||
用户登录名
|
||||
</th>
|
||||
<th style="width: 50px;">
|
||||
用户身份
|
||||
|
@ -47,7 +47,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<% @count=@page * 30 %>
|
||||
<% for user in @user do %>
|
||||
<% for user in @users do %>
|
||||
<tr>
|
||||
<% @count +=1 %>
|
||||
<td align="center">
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="break_word">
|
||||
<span class="fl">
|
||||
<span title="<%= attachment.filename %>" id="attachment_<%=attachment.id %>">
|
||||
<%= link_to_short_attachment attachment,:length=> 58, :class => 'mw400 hidden link_file_a fl newsBlue', :download => true -%>
|
||||
<%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw400', :download => true -%>
|
||||
</span>
|
||||
</span>
|
||||
<span class="postAttSize">(
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<span class="add_attachment" style="font-weight:normal;">
|
||||
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
|
||||
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
|
||||
<%= button_tag "文件浏览", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
|
||||
<%= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file').click();",:onmouseover => 'this.focus()',:class => 'sub_btn' %>
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => '_file',
|
||||
:class => 'file_selector',
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
<span class="add_attachment">
|
||||
<%#= button_tag "浏览", :type=>"button", :onclick=>"CompatibleSend();" %>
|
||||
<!--%= link_to image_tag(),"javascript:void(0)", :onclick => "_file.click()"%-->
|
||||
<%= button_tag "文件浏览", :type=>"button", :onclick=>"_file.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
|
||||
<%= button_tag "上传附件", :type=>"button", :onclick=>"_file.click()", :class =>"sub_btn",:style => ie8? ? 'display:none' : '' %>
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => '_file',
|
||||
:class => 'file_selector',
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<% if options[:length] %>
|
||||
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true,:length => options[:length] -%>
|
||||
<% else %>
|
||||
<%= link_to_short_attachment attachment, :class => ' link_file_board', :download => true -%>
|
||||
<%= link_to_short_attachment attachment, :length=> 58,:class => 'hidden link_file_a fl newsBlue mw400', :download => true -%>
|
||||
<% end %>
|
||||
</span>
|
||||
<%if is_float%>
|
||||
|
|
|
@ -1,54 +1,57 @@
|
|||
<!--<div class="resourceUploadPopup">-->
|
||||
<span class="uploadDialogText">更新资源版本</span>
|
||||
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
|
||||
<div class="uploadBoxContainer mt0">
|
||||
<div>
|
||||
<div>当前版本
|
||||
<span class="attachment" >
|
||||
<input readonly="readonly" name="attachments[1][filename]" value="<%=@attachment.filename%>" class="upload_filename readonly" type="text">
|
||||
</span>
|
||||
</div>
|
||||
<% unless @attachment_histories.empty? %>
|
||||
|
||||
<div >历史版本</div>
|
||||
<div style="max-height: 95px;overflow-y:auto; background-color: #e3e3e3;" class="mb10 p10">
|
||||
<% @attachment_histories.each do |history| %>
|
||||
<span class="attachment">
|
||||
<input readonly="readonly" name="attachments_versions_<%= history.id%>" value="<%=history.filename%>" class="upload_filename readonly" type="text">
|
||||
<span>版本号:<%= history.version %></span>
|
||||
</span>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<%= form_tag(upload_attachment_version_path, :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %>
|
||||
<%= hidden_field_tag :old_attachment_id,@attachment.id %>
|
||||
<div>
|
||||
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
|
||||
</span>
|
||||
</div>
|
||||
<div class="uploadBox">
|
||||
<input type="hidden" name="attachment_type" value="1">
|
||||
<%= render :partial => 'attachments/upload_attachment_new_version' %>
|
||||
<div class="cl"></div>
|
||||
<!--<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%#= l(:button_cancel)%></a>-->
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
</div>
|
||||
<div class="uploadResourceIntr">
|
||||
<div class="uploadResourceName fl"><span id="upload_file_count">(未选择文件)</span></div>
|
||||
<div class="uploadResourceIntr2 fl">您可以上传小于<span class="c_red">50MB</span>的文件</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div style="margin-top: 10px" >
|
||||
<div class="courseSendSubmit">
|
||||
<!--<a href="javascript:void(0);" class="sendSourceText" onclick="">确定</a>-->
|
||||
<%= submit_tag '确定',:onclick=>'upload_attachment_version(event);',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
|
||||
</div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" id="upload_files_cancle_btn" class="sendSourceText" onclick="hideModal();">取消</a></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<!--<div class="resourceUploadPopup">-->
|
||||
<span class="uploadDialogText">更新资源版本</span>
|
||||
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
|
||||
<div class="uploadBoxContainer mt0">
|
||||
<div>
|
||||
<div>当前版本
|
||||
<span class="attachment" >
|
||||
<input readonly="readonly" name="attachments[1][filename]" value="<%=@attachment.filename%>" class="upload_filename readonly" type="text">
|
||||
</span>
|
||||
</div>
|
||||
<% unless @attachment_histories.empty? %>
|
||||
|
||||
<div >历史版本</div>
|
||||
<div style="max-height: 95px;overflow-y:auto; background-color: #e3e3e3;" class="mb10 p10">
|
||||
<% @attachment_histories.each do |history| %>
|
||||
<span class="attachment">
|
||||
<%= link_to truncate(history.filename,length: 35, omission: '...'),
|
||||
download_history_attachment_path(history.id, history.filename),
|
||||
:title => history.filename+"\n"+history.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f_14 f_b link_file_a2 fl" %>
|
||||
<span class="fr">版本号:<%= history.version %></span>
|
||||
<div class="cl"></div>
|
||||
</span>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
<%= form_tag(upload_attachment_version_path, :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %>
|
||||
<%= hidden_field_tag :old_attachment_id,@attachment.id %>
|
||||
<div>
|
||||
<span id="attachments_fields" xmlns="http://www.w3.org/1999/html">
|
||||
</span>
|
||||
</div>
|
||||
<div class="uploadBox">
|
||||
<input type="hidden" name="attachment_type" value="1">
|
||||
<%= render :partial => 'attachments/upload_attachment_new_version' %>
|
||||
<div class="cl"></div>
|
||||
<!--<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%#= l(:button_cancel)%></a>-->
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
</div>
|
||||
<div class="uploadResourceIntr">
|
||||
<div class="uploadResourceName fl"><span id="upload_file_count">(未选择文件)</span></div>
|
||||
<div class="uploadResourceIntr2 fl">您可以上传小于<span class="c_red">50MB</span>的文件</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div style="margin-top: 10px" >
|
||||
<div class="courseSendSubmit">
|
||||
<!--<a href="javascript:void(0);" class="sendSourceText" onclick="">确定</a>-->
|
||||
<%= submit_tag '确定',:onclick=>'upload_attachment_version(event);',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
|
||||
</div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" id="upload_files_cancle_btn" class="sendSourceText" onclick="hideModal();">取消</a></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<!--</div>-->
|
|
@ -2,6 +2,6 @@ $("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/sh
|
|||
showModal('ajax-modal', '452px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","46%");
|
||||
$('#ajax-modal').parent().css("top","40%").css("left","50%");
|
||||
$('#ajax-modal').parent().addClass("resourceUploadPopup");
|
||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
|
@ -28,7 +28,7 @@
|
|||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='hiddent_alert_model();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("width","511");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("width","511").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("alert_praise");
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'alert_anonyoms', locals: { bid: @bid, totle_size:@totle_size, cur_size:@cur_size, percent:@percent}) %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
//$('#ajax-modal').css('height','180px');
|
||||
$('#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').html('<%= escape_javascript(render :partial => 'alert_anonyoms', locals: { bid: @bid, totle_size:@totle_size, cur_size:@cur_size, percent:@percent}) %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
//$('#ajax-modal').css('height','180px');
|
||||
$('#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","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
|
@ -1,16 +1,3 @@
|
|||
<style type="text/css">
|
||||
/*回复框*/
|
||||
.ReplyToMessageInputContainer .ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
|
||||
.ReplyToMessageInputContainer .ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
|
||||
.ReplyToMessageInputContainer .ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
|
||||
.ReplyToMessageInputContainer .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
|
||||
.ReplyToMessageInputContainer .ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
|
||||
.ReplyToMessageInputContainer .ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
||||
.ReplyToMessageInputContainer .ke-outline{border:none;}
|
||||
.ReplyToMessageInputContainer .ke-inline-block{display: none;}
|
||||
.ReplyToMessageInputContainer .ke-container{float:left;}
|
||||
</style>
|
||||
|
||||
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
|
@ -21,8 +8,8 @@
|
|||
<input type="hidden" name="course_id" id="" value="<%= course_id%>">
|
||||
<% end %>
|
||||
<input type="hidden" name="blog_comment[title]" id="reply_subject">
|
||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="blog_comment[content]"></textarea>
|
||||
<div nhname='toolbar_container_<%= reply.id%>' style="float:left; margin-left: 5px; padding-top:3px;"></div>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% if User.current.logged? && User.current.id == @user.id %>
|
||||
<%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage]},:method=>'PUT',
|
||||
<%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage],:in_act => params[:in_act]},:method=>'PUT',
|
||||
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= render :partial => 'blog_comments/edit', :locals => {:f => f, :article => @article, :edit_mode => true, :user => @user} %>
|
||||
<% end %>
|
||||
|
|
|
@ -3,7 +3,7 @@ if($("#reply_message_<%= @blogComment.id%>").length > 0) {
|
|||
$(function(){
|
||||
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
|
||||
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
|
||||
init_activity_KindEditor_data(<%= @blogComment.id%>,null,"85%", "<%=@blogComment.class.to_s%>");
|
||||
sd_create_editor_from_data(<%= @blogComment.id%>,null,"100%", "<%=@blogComment.class.to_s%>");
|
||||
});
|
||||
}else if($("#reply_to_message_<%= @blogComment.id%>").length >0) {
|
||||
$("#reply_to_message_<%= @blogComment.id%>").replaceWith("<p id='reply_message_<%= @blogComment.id%>'></p>");
|
||||
|
|
|
@ -5,4 +5,4 @@
|
|||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/article', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
|
||||
//init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity');
|
||||
<% end %>
|
||||
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
|
||||
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", 'UserActivity');
|
|
@ -1,6 +1,7 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false) %>
|
||||
<%= javascript_include_tag "init_activity_KindEditor",'blog' %>
|
||||
<%#= javascript_include_tag "init_activity_KindEditor",'blog' %>
|
||||
<%= javascript_include_tag "create_kindeditor",'blog' %>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -27,7 +28,7 @@
|
|||
}
|
||||
}
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= @article.id%>,null,"85%", '<%=@article.class.to_s%>');
|
||||
sd_create_editor_from_data(<%= @article.id%>,null,"100%", '<%=@article.class.to_s%>');
|
||||
showNormalImage('message_description_<%= @article.id %>');
|
||||
});
|
||||
</script>
|
||||
|
@ -45,7 +46,7 @@
|
|||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit),
|
||||
{:action => 'edit', :id => @article.id},
|
||||
{:action => 'edit', :id => @article.id,:in_act => params[:in_act]},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == @article.author.id %>
|
||||
</li>
|
||||
|
@ -94,7 +95,7 @@
|
|||
</div>
|
||||
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
|
||||
<div class="cl"></div>
|
||||
<div class="memo-content upload_img break_word" id="message_description_<%= @article.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
|
||||
<div class="homepagePostIntro memo-content upload_img break_word" id="message_description_<%= @article.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
|
||||
<%= @article.content.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -116,9 +117,18 @@
|
|||
<% count=@article.children.count%>
|
||||
<% end %>
|
||||
<div class="homepagePostReply">
|
||||
<% unless count == 0 %>
|
||||
<%# unless count == 0 %>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%=count %>)</div>
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=@article.id %>">
|
||||
<% if @article.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(@article) > 0 ? "(#{get_praise_num(@article)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@article, :user_activity_id=>@article.id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"></div>
|
||||
<!-- <div class="homepagePostReplyBannerMore">
|
||||
<%# if @reply_count > 2%>
|
||||
|
@ -150,7 +160,14 @@
|
|||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_on) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<span id="reply_praise_count_<%=reply.id %>">
|
||||
<% if reply.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
<div class="fr mr10" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'blog_comments',:action => 'quote',:user_id=>reply.author_id,:blog_id=>reply.blog_id, :id => reply.id},
|
||||
|
@ -175,7 +192,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<%# end %>
|
||||
<div class="cl"></div>
|
||||
<% if !@article.locked? && User.current.logged?%>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
|
@ -192,4 +209,11 @@
|
|||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
var postContent = $("#message_description_<%= @article.id %>").html();
|
||||
postContent = postContent.replace(/ /g," ");
|
||||
$("#message_description_<%= @article.id %>").html(postContent);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -78,18 +78,16 @@
|
|||
发帖时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %>
|
||||
更新时间:<%= format_time(activity.updated_on) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
|
||||
<div id="intro_content_<%= user_activity_id%>">
|
||||
<% if activity.parent_id.nil? %>
|
||||
<%= activity.content.to_s.html_safe%>
|
||||
<% else %>
|
||||
<%= activity.parent.content.to_s.html_safe%>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% if activity.parent_id.nil? %>
|
||||
<% content= activity.content%>
|
||||
<% else %>
|
||||
<% content= activity.parent.content%>
|
||||
<% end %>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
|
||||
|
||||
<div class="cl"></div>
|
||||
<!--<div class=" fl" style="width: 600px">
|
||||
<%# if activity.attachments.any?%>
|
||||
|
@ -125,11 +123,17 @@
|
|||
<% count=activity.children.count%>
|
||||
<% end %>
|
||||
<div class="homepagePostReply">
|
||||
<div class="topBorder" style="display: <%= count<=0 && !activity.locked ? '': 'none' %>"></div>
|
||||
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
|
||||
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(
|
||||
<%= count %>
|
||||
)</div>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<span id="praise_count_<%=user_activity_id %>">
|
||||
<% if activity.author == User.current %>
|
||||
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
|
||||
<%if count > 3 %>
|
||||
<div class="homepagePostReplyBannerMore">
|
||||
|
@ -164,6 +168,13 @@
|
|||
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
|
||||
<% end %>
|
||||
<%= format_time(reply.created_on) %>
|
||||
<span id="reply_praise_count_<%=reply.id %>">
|
||||
<% if reply.author == User.current %>
|
||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %></span></span>
|
||||
<% else %>
|
||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="homepagePostReplyContent break_word list_style upload_img" id="reply_content_<%= reply.id %>">
|
||||
<%= reply.content.html_safe %>
|
||||
|
@ -187,8 +198,8 @@
|
|||
<input type="hidden" name="blog_comment[locked]" value="0">
|
||||
<input type="hidden" name="blog_comment[title]" value="RE:<%= activity.title%>">
|
||||
<input type="hidden" name="user_activity_id" value="<%=user_activity_id%>">
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="blog_comment[content]"></textarea>
|
||||
<div nhname='toolbar_container_<%= user_activity_id%>' style="float:left; margin-left: 5px; padding-top:3px;"></div>
|
||||
<a id="new_message_submit_btn_<%= user_activity_id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= user_activity_id%>'></p>
|
||||
|
@ -203,5 +214,13 @@
|
|||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(description_show_hide(<%=user_activity_id %>));
|
||||
$("#moreProject_<%=user_activity_id %>").click(function(){
|
||||
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
|
||||
$("#relatePWrap_<%=user_activity_id %>").css("height","auto");
|
||||
$(this).hide();
|
||||
});
|
||||
$("#hideProject_<%=user_activity_id %>").click(function(){
|
||||
$("#relatePWrap_<%=user_activity_id %>").toggleClass('relatePWrap');
|
||||
$("#moreProject_<%=user_activity_id %>").show();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false) %>
|
||||
<%= javascript_include_tag "init_activity_KindEditor" %>
|
||||
<%= javascript_include_tag "create_kindeditor" %>
|
||||
<% end %>
|
||||
|
||||
<style type="text/css">
|
||||
/*回复框*/
|
||||
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
|
||||
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
|
||||
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
|
||||
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-outline {border: none;}
|
||||
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
|
||||
.homepagePostReplyInputContainer .ke-container {float: left;}
|
||||
/*.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}*/
|
||||
/*.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-outline {border: none;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-inline-block {display: none;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-container {float: left;}*/
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
|
@ -75,7 +75,7 @@
|
|||
}
|
||||
|
||||
$(function () {
|
||||
init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>");
|
||||
sd_create_editor_from_data(<%= topic.id%>, null, "100%", "<%=topic.class.to_s%>");
|
||||
});
|
||||
</script>
|
||||
<% if topic %>
|
||||
|
|
|
@ -40,9 +40,8 @@
|
|||
<%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id,
|
||||
:blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey", :style => 'text-align:center;' %>
|
||||
</div>
|
||||
<div class="homepagePostIntro break_word upload_img list_style maxh360 lh18 table_maxWidth" >
|
||||
<%= activity.content.to_s.html_safe %>
|
||||
</div>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.content} %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<%= import_ke(enable_at: false, prettify: false) %>
|
||||
|
||||
|
||||
<%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.created_on desc"), :page => 0, :user => @user} %>
|
||||
<%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @user.blog.articles.reorder("#{BlogComment.table_name}.sticky desc,#{BlogComment.table_name}.updated_on desc"), :page => 0, :user => @user} %>
|
||||
|
||||
|
||||
<script type="text/javascript">//侧导航
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false) %>
|
||||
<%= javascript_include_tag "init_activity_KindEditor" %>
|
||||
<%= javascript_include_tag "create_kindeditor" %>
|
||||
<% end %>
|
||||
|
||||
<style type="text/css">
|
||||
/*回复框*/
|
||||
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
|
||||
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
|
||||
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
|
||||
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-outline {border: none;}
|
||||
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
|
||||
.homepagePostReplyInputContainer .ke-container {float: left;}
|
||||
/*.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}*/
|
||||
/*.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-outline {border: none;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-inline-block {display: none;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-container {float: left;}*/
|
||||
</style>
|
||||
<% if topics%>
|
||||
<% topics.each do |topic| %>
|
||||
|
@ -40,7 +40,7 @@
|
|||
}
|
||||
|
||||
$(function () {
|
||||
init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>");
|
||||
sd_create_editor_from_data(<%= topic.id%>, null, "100%", "<%=topic.class.to_s%>");
|
||||
});
|
||||
</script>
|
||||
<% if topic %>
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: false, prettify: false) %>
|
||||
<%= javascript_include_tag "init_activity_KindEditor" %>
|
||||
<%= javascript_include_tag "create_kindeditor" %>
|
||||
<% end %>
|
||||
<style type="text/css">
|
||||
/*回复框*/
|
||||
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
|
||||
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
|
||||
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
|
||||
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
|
||||
.homepagePostReplyInputContainer .ke-outline {border: none;}
|
||||
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
|
||||
.homepagePostReplyInputContainer .ke-container {float: left;}
|
||||
/*.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}*/
|
||||
/*.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-outline {border: none;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-inline-block {display: none;}*/
|
||||
/*.homepagePostReplyInputContainer .ke-container {float: left;}*/
|
||||
</style>
|
||||
<% if topics%>
|
||||
<% topics.each do |topic| %>
|
||||
|
@ -39,7 +39,7 @@
|
|||
}
|
||||
|
||||
$(function () {
|
||||
init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
|
||||
sd_create_editor_from_data(<%= topic.id%>, null, "100%");
|
||||
});
|
||||
</script>
|
||||
<% if topic %>
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
<% if @course %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% elsif @project %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% else %>
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||
<% end %>
|
||||
init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%", "UserActivity");
|
||||
sd_create_editor_from_data('<%= @user_activity_id%>',"","100%", "UserActivity");
|
||||
|
|
|
@ -39,12 +39,13 @@
|
|||
<input name="copy_course" value="<%=@course.id %>" style="display: none"/>
|
||||
<li class="ml45 mb10">
|
||||
<a href="javascript:void(0)" class="upimg fl">
|
||||
<%= image_tag(url_to_avatar(@new_course), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
|
||||
<%= image_tag(url_to_avatar(@course), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
|
||||
</a> <!--<a href="javascript:void(0)" class="upbtn fl ml30" onclick="$('#upload_course_logo').click();">上传图片</a>-->
|
||||
<!--</span>-->
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="ml45">
|
||||
|
||||
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
|
||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||
|
|
|
@ -38,54 +38,6 @@
|
|||
})
|
||||
</script>
|
||||
<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;
|
||||
}
|
||||
|
||||
.ke-inline-block {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.ke-container {
|
||||
float: left;
|
||||
}
|
||||
</style>
|
||||
<% course_activities.each do |activity| if course_activities %>
|
||||
<script>
|
||||
|
@ -107,7 +59,7 @@
|
|||
}
|
||||
|
||||
$(function () {
|
||||
init_activity_KindEditor_data(<%= activity.id%>, null, "87%", "<%= activity.class.to_s %>");
|
||||
sd_create_editor_from_data(<%= activity.id%>, null, "100%", "<%= activity.class.to_s %>");
|
||||
});
|
||||
</script>
|
||||
<% if activity && activity.course_act%>
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
<div nhname='new_message_' style="display:none;">
|
||||
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_course_message'}, :html=>{:id => "course_feedback_new"},:method => "post") do |f|%>
|
||||
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||
<div nhname='toolbar_container_' ></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea_' name="new_form[course_message]"></textarea>
|
||||
<p nhname='contentmsg_'></p>
|
||||
<div nhname='toolbar_container_' style="float:left;padding-top:3px;margin-bottom: 15px;"></div>
|
||||
<a id="new_message_cancel_btn_" href="javascript:void(0)" class="grey_btn fr mt10">取消</a>
|
||||
<a href="javascript:void(0);" class="blue_btn fr ml10 mt10" id="submit_feedback_course" >留言</a>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<% unless excellent_course_recommend(course).length == 0 %>
|
||||
<ul class="courseR mb10">
|
||||
<h4 class="mb5" ><%= l(:label_homework_recommendation) %>:</h4>
|
||||
<% excellent_course_recommend(course).each do |e_course| %>
|
||||
<% e_course = Course.find(e_course) %>
|
||||
|
||||
<li class="mt15"> <%= image_tag(url_to_avatar(e_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %>
|
||||
<div class="fl">
|
||||
<p class="f12 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %></p>
|
||||
<p class="f12">
|
||||
<% if e_course.attachments.count > 0 %>
|
||||
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>)</span>
|
||||
<% end %>
|
||||
<% if e_course.homework_commons.count > 0 %>
|
||||
<span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)</span>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:remote=>true,:id => "search_student") do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生昵称、姓名、学号进行搜索'%>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 'st_search_input', :placeholder => '输入学生登录名、姓名、学号进行搜索'%>
|
||||
<% if @group %>
|
||||
<%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %>
|
||||
<input type="hidden" name="ingroup">
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
<li><span class="c_blue03 w280">作业积分(总分)</span><span class="c_red w70"><%= @member_score.student_work_score_sum %></span></li>
|
||||
<li><span class="c_blue03 w280">作业积分(总分)</span><span class="c_red w70"><%= (@member_score.student_work_score_sum).first.score %></span></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
|
||||
<div id="user_homework_list">
|
||||
<% homework_commons.each do |homework_common|%>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= homework_common.id%>, null, "87%", "<%=homework_common.class.to_s%>");
|
||||
});
|
||||
|
||||
function expand_reply(container,btnid){
|
||||
var target = $(container);
|
||||
var btn = $(btnid);
|
||||
if(btn.data('init')=='0'){
|
||||
btn.data('init',1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
}else{
|
||||
btn.data('init',0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<%= render :partial => 'users/user_homework_detail', :locals => {:homework_common => homework_common,:is_in_course => is_in_course} %>
|
||||
<% end%>
|
||||
<% if homework_commons.count == 10%>
|
||||
<%= link_to "点击展开更多",homework_search_course_path(course_id,:page => page,:search=>search),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
|
||||
<% end%>
|
||||
</div>
|
|
@ -0,0 +1,5 @@
|
|||
<% if @page == 0 %>
|
||||
$("#user_homework_list").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>");
|
||||
<% else %>
|
||||
$("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'courses/user_homework_search_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id,:search=>@search} )%>");
|
||||
<% end %>
|
|
@ -7,5 +7,5 @@ $('#ajax-modal').siblings().hide();
|
|||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
|
||||
"<a href='javascript:' onclick='hidden_join_course_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("alert_box");
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/new_join', locals: { :course => @course}) %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').css('height','100px');
|
||||
$('#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");
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/new_join', locals: { :course => @course}) %>');
|
||||
showModal('ajax-modal', '500px');
|
||||
$('#ajax-modal').css('height','100px');
|
||||
$('#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","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
|
|
|
@ -46,14 +46,15 @@
|
|||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_course_term)%> :</label>
|
||||
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"time_selected"} %>
|
||||
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"term_selected"} %>
|
||||
<%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {:id=>"time"} %>
|
||||
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"term"} %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> 结束学期 :</label>
|
||||
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"end_time_selected"} %>
|
||||
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"end_term_selected"} %>
|
||||
<%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"end_time"} %>
|
||||
<%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"end_term"} %>
|
||||
<span class="c_red" id="course_time_term_notice"></span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
|
@ -109,7 +110,7 @@
|
|||
<div class="search_course fl">
|
||||
<%= form_tag(search_member_course_path,:id => "course_member_search_form", :method => :get, :class => "search_form_course",:remote => true) do %>
|
||||
<!-- , :onkeyup => "regexQ('#{l(:label_search_conditions_not_null)}');" -->
|
||||
<%= text_field_tag 'name', params[:name], :placeholder => "昵称、学号、姓名搜索", :class => "search_text fl" %>
|
||||
<%= text_field_tag 'name', params[:name], :placeholder => "登录名、学号、姓名搜索", :class => "search_text fl" %>
|
||||
<a href="javascript:void(0)" onclick="submitMemberSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white ml10" >
|
||||
<%= l(:label_search)%>
|
||||
</a>
|
||||
|
@ -135,11 +136,9 @@
|
|||
$('#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().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
}
|
||||
$("#time_selected").click(select);
|
||||
$("#term_selected").click(select);
|
||||
$("#end_time_selected").click(select);
|
||||
$("#end_term_selected").click(select);
|
||||
//$("#time").click(select);
|
||||
//$("#term").click(select);
|
||||
</script>
|
||||
|
|
|
@ -9,5 +9,5 @@ $('#ajax-modal').siblings().remove();
|
|||
$('#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().css("top","30%").css("left","40%").css("position","fixed").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("new-watcher");
|
||||
|
|
|
@ -4,18 +4,6 @@
|
|||
<%= javascript_include_tag 'blog' %>
|
||||
<% end %>
|
||||
|
||||
<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;}
|
||||
.ke-inline-block{display: none;}
|
||||
div.ke-container{float:left;}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
|
@ -40,7 +28,8 @@
|
|||
}
|
||||
}
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= @article.id%>,null,"87%", "<%=@article.class.to_s%>");
|
||||
//init_activity_KindEditor_data(<%= @article.id%>,null,"87%", "<%=@article.class.to_s%>");
|
||||
sd_create_editor_from_data(<%= @article.id%>,null,"100%", "<%=@article.class.to_s%>");
|
||||
showNormalImage('message_description_<%= @article.id %>');
|
||||
});
|
||||
</script>
|
||||
|
@ -94,7 +83,7 @@
|
|||
</div>
|
||||
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
|
||||
<div class="cl"></div>
|
||||
<div class="memo-content upload_img break_word" id="message_description_<%= @article.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
|
||||
<div class="homepagePostIntro memo-content upload_img break_word" id="message_description_<%= @article.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
|
||||
<%= @article.content.html_safe%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -201,8 +190,8 @@
|
|||
<input type="hidden" name="blog_comment[sticky]" value="0">
|
||||
<input type="hidden" name="quote[quote]" value="">
|
||||
<input type="hidden" name="blog_comment[locked]" value="0">
|
||||
<div nhname='toolbar_container_<%= @article.id%>'></div>
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= @article.id%>' name="blog_comment[content]"></textarea>
|
||||
<div nhname='toolbar_container_<%= @article.id%>' style="float:left; margin-left: 5px;"></div>
|
||||
<a id="new_message_submit_btn_<%= @article.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= @article.id%>'></p>
|
||||
|
@ -214,4 +203,16 @@
|
|||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#message_description_<%= @article.id %> p,#message_description_<%= @article.id %> span,#message_description_<%= @article.id %> em").each(function(){
|
||||
var postContent = $(this).html();
|
||||
postContent = postContent.replace(/ /g," ");
|
||||
postContent= postContent.replace(/ {2}/g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
postContent=postContent.replace(/ /g," ");
|
||||
$(this).html(postContent);
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -1,37 +1,37 @@
|
|||
<%= form_for('',
|
||||
:html => { :multipart => true },
|
||||
:url => {:controller => 'exercise',
|
||||
:action => 'commit_exercise',
|
||||
:id => exercise.id
|
||||
},:remote=>true ) do |f| %>
|
||||
<div class="ur_buttons">
|
||||
<a class="ur_button_submit" onclick="poll_submit();"> 提交 </a>
|
||||
<div class="polls_cha">
|
||||
<%= f.check_box 'show_result', :value => exercise.show_result%>
|
||||
<%= label_tag '_show_result', '允许学生查看测验结果' %>
|
||||
<!--<input name="exercise[show_result]" value="<%#exercise.show_result %>" type="checkbox" checked="true">
|
||||
<label for="">允许学生查看测验结果</label>-->
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
function poll_submit() {
|
||||
var question_form = $("form.new_exercise_question");
|
||||
if($("#polls_head_edit").is(":visible")){
|
||||
alert("请先保存测验标题及测验基本信息。");
|
||||
} else if(question_form.length > 0) {
|
||||
alert("请先保存正在编辑的题目。");
|
||||
} else{
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'exercise_submit_info', locals: { :exercise => exercise}) %>');
|
||||
showModal('ajax-modal', '400px');
|
||||
//$('#ajax-modal').css('height','120px');
|
||||
$('#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().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
}
|
||||
<%= form_for('',
|
||||
:html => { :multipart => true },
|
||||
:url => {:controller => 'exercise',
|
||||
:action => 'commit_exercise',
|
||||
:id => exercise.id
|
||||
},:remote=>true ) do |f| %>
|
||||
<div class="ur_buttons">
|
||||
<a class="ur_button_submit" onclick="poll_submit();"> 提交 </a>
|
||||
<div class="polls_cha">
|
||||
<%= f.check_box 'show_result', :value => exercise.show_result%>
|
||||
<%= label_tag '_show_result', '允许学生查看测验结果' %>
|
||||
<!--<input name="exercise[show_result]" value="<%#exercise.show_result %>" type="checkbox" checked="true">
|
||||
<label for="">允许学生查看测验结果</label>-->
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
function poll_submit() {
|
||||
var question_form = $("form.new_exercise_question");
|
||||
if($("#polls_head_edit").is(":visible")){
|
||||
alert("请先保存测验标题及测验基本信息。");
|
||||
} else if(question_form.length > 0) {
|
||||
alert("请先保存正在编辑的题目。");
|
||||
} else{
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'exercise_submit_info', locals: { :exercise => exercise}) %>');
|
||||
showModal('ajax-modal', '400px');
|
||||
//$('#ajax-modal').css('height','120px');
|
||||
$('#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().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,8 +1,8 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status,:exercise =>@exercise}) %>');
|
||||
showModal('ajax-modal', '270px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='hidden_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status,:exercise =>@exercise}) %>');
|
||||
showModal('ajax-modal', '270px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='hidden_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("alert_box");
|
|
@ -25,7 +25,7 @@
|
|||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@
|
|||
$('#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().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>");
|
||||
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
|
||||
showModal('ajax-modal', '250px');
|
||||
//$('#ajax-modal').css('height','111px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>");
|
||||
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
|
||||
showModal('ajax-modal', '250px');
|
||||
//$('#ajax-modal').css('height','111px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("poll_alert_form");
|
|
@ -1,10 +1,10 @@
|
|||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>");
|
||||
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
|
||||
showModal('ajax-modal', '250px');
|
||||
//$('#ajax-modal').css('height','80px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>");
|
||||
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
|
||||
showModal('ajax-modal', '250px');
|
||||
//$('#ajax-modal').css('height','80px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("poll_alert_form");
|
|
@ -40,7 +40,7 @@
|
|||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#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().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
||||
|
@ -126,4 +126,4 @@
|
|||
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
|
||||
</div>
|
||||
</div>
|
||||
<% html_title(l(:label_attachment_plural)) -%>
|
||||
<%# html_title(l(:label_attachment_plural)) -%>
|
|
@ -1,79 +1,8 @@
|
|||
|
||||
<% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
|
||||
<% curse_attachments.each do |file| %>
|
||||
<% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %>
|
||||
<div class="resources mt10"><!--资源库内容开始--->
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTitle break_word mt-4">
|
||||
<%= link_to truncate(file.filename,length: 35, omission: '...'),
|
||||
download_named_attachment_path(file.id, file.filename),
|
||||
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %>
|
||||
<%= file_preview_eye(file, class: 'preview') %>
|
||||
<span id="image_private_<%= file.id%>">
|
||||
<% if file.is_public? == false%>
|
||||
<span class="img_private ml5">私有</span>
|
||||
<%end %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
<span class="fontGrey2 mr15 fl">上传时间:<%= format_time(file.created_on)%></span>
|
||||
<% if file.tag_list.length > 0%>
|
||||
<span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span>
|
||||
<% end %>
|
||||
<p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<p class="fl ml15 fontGrey2">下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<!-- container_type = 1 代表是课程里的资源 -->
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
|
||||
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
|
||||
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %></li>
|
||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
||||
<% if @course.is_public? %>
|
||||
<li>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
|
||||
</span>
|
||||
</li>
|
||||
<%end%>
|
||||
<li>
|
||||
<%= link_to( '删除资源', attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<% end %>
|
||||
<%else%>
|
||||
<ul class="resourceSendO">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="resource_detail_<%=file.id %>">
|
||||
<%=render :partial=>'files/resource_detail',:locals => {:file => file} %>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="re_con_box"><span class='fr mr10 pr_join_span '><%= file.filename %>是私有资源</span></div>
|
||||
<% end %>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<% if (is_project_manager?(User.current, @project) || file.author_id == User.current.id) && project_contains_attachment?(@project,file) %>
|
||||
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @project.id && file.container_type == "Project" %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %></li>
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
||||
<% if @project.is_public? %>
|
||||
<li>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<% end %>
|
||||
<%else%>
|
||||
<ul class="resourceSendO">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %></li>
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
<script src="/javascripts/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
|
||||
<span class="uploadText mb10" style="margin-top: -20px;">发布设置</span>
|
||||
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose"></a></div>-->
|
||||
<%= form_tag(republish_file_course_file_path(@course,@file), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
|
||||
<div class="mb10">
|
||||
<label class="fl c_dark f14" style="margin-top: 4px;">延迟发布:</label>
|
||||
<div class="calendar_div fl">
|
||||
<input type="text" name="publish_time" id="attachment_publish_time" placeholder="发布日期" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%=@file.publish_time %>">
|
||||
<%#= calendar_for('attachment_publish_time')%>
|
||||
</div>
|
||||
<span class="fl c_red" style="margin-top: 4px;" id="publish_time_notice"></span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<!--<div class="mt15"> <span class="f14 fontGrey3 mr10">延迟发布:</span>
|
||||
<input type="text" name="" placeholder="请输入0-50数值" class="markInput" />
|
||||
</div>-->
|
||||
<div>
|
||||
<div class="courseSendSubmit"><a href="javascript:void(0);" onclick="submit_republish_file()" class="sendSourceText" id="submit_file">确定</a></div>
|
||||
<div class="courseSendCancel"><a href="javascript:void(0);" onclick="hideModal()" class="sendSourceText linkGrey6">取消</a></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<script>
|
||||
function regex_publish_time()
|
||||
{
|
||||
var myDate = new Date();
|
||||
if($.trim($("#attachment_publish_time").val()) == "")
|
||||
{
|
||||
$("#publish_time_notice").text("发布日期不能为空");
|
||||
return false;
|
||||
} else{
|
||||
var publish_time = Date.parse($("#attachment_publish_time").val());
|
||||
if(Date.parse(formate_date(myDate)) > publish_time)
|
||||
{
|
||||
$("#publish_time_notice").text("发布日期不能小于当前日期");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#publish_time_notice").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
function submit_republish_file()
|
||||
{
|
||||
if(regex_publish_time()) {
|
||||
$('#submit_file').parent().parent().submit();
|
||||
}
|
||||
}
|
||||
$(function(){
|
||||
var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
|
||||
$('#attachment_publish_time').datepicker(datepickerOptions);
|
||||
});
|
||||
</script>
|
|
@ -38,7 +38,7 @@
|
|||
<% if User.current.logged? %>
|
||||
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %></li>
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
||||
<li>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
|
@ -52,7 +52,7 @@
|
|||
</ul>
|
||||
<%else%>
|
||||
<ul class="resourceSendO">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %></li>
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -72,7 +72,7 @@
|
|||
<%=link_to "点击展开更多", search_files_in_subfield_org_subfield_files_path(:org_subfield_id => org_subfield.id,:page => @page.to_i + 1, :name => params[:name],:insite => params[:insite]),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
|
||||
<% else %>
|
||||
<!-- 全站搜索的时候 返回的页码对象是obj_pages,而站内搜索返回的页码对象是feedback_pages -->
|
||||
<%=link_to "点击展开更多", org_subfield_files_path(:org_subfield_id => org_subfield.id, :page => @page.nil? ? 2 :(@page + 1)), :id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
|
||||
<%=link_to "点击展开更多", org_subfield_files_path(:org_subfield_id => org_subfield.id, :page => @page.nil? ? 2 :(@page.to_i + 1)), :id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
|
||||
<%end%>
|
||||
<% end%>
|
||||
|
||||
|
|
|
@ -95,4 +95,4 @@
|
|||
<%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %>
|
||||
</div>
|
||||
</div>
|
||||
<% html_title(l(:label_attachment_plural)) -%>
|
||||
<%# html_title(l(:label_attachment_plural)) -%>
|
|
@ -6,7 +6,7 @@
|
|||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#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().css("top","40%").css("left","36%").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
<% delete_allowed = User.current.allowed_to?(:manage_files, @course) %>
|
||||
<div class="resources mt10"><!--资源库内容开始--->
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTitle break_word mt-4">
|
||||
<%= link_to truncate(file.filename,length: 35, omission: '...'),
|
||||
download_named_attachment_path(file.id, file.filename),
|
||||
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %>
|
||||
<%= file_preview_eye(file, class: 'preview') %>
|
||||
<span id="image_private_<%= file.id%>">
|
||||
<% if file.is_public? == false%>
|
||||
<span class="img_private ml5">私有</span>
|
||||
<%end %>
|
||||
</span>
|
||||
<% if file.is_publish == 0 %>
|
||||
<span class="grey_homework_btn_cir ml5"><%=file.publish_time %> 0点发布</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
<span class="fontGrey2 mr15 fl">上传时间:<%= format_time(file.created_on)%></span>
|
||||
<% if file.tag_list.length > 0%>
|
||||
<span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span>
|
||||
<% end %>
|
||||
<p class="f_l mb5 fontGrey2">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<p class="fl ml15 fontGrey2">下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<!-- container_type = 1 代表是课程里的资源 -->
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
|
||||
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
|
||||
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
<li><%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %></li>
|
||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
||||
<% if @course.is_public? %>
|
||||
<li>
|
||||
<span id="is_public_<%= file.id %>">
|
||||
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
|
||||
</span>
|
||||
</li>
|
||||
<%end%>
|
||||
<li>
|
||||
<%= link_to( '删除资源', attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<% end %>
|
||||
<%else%>
|
||||
<ul class="resourceSendO">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
|
@ -19,7 +19,7 @@
|
|||
</script>
|
||||
|
||||
<div class="homepageRight mt0 ml0">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="homepageRightBanner" style="margin-top:<%= User.current.logged? ? '0px':'10px' %>">
|
||||
<div class="NewsBannerName"><%= org_subfield.name %></div>
|
||||
<ul class="resourcesSelect">
|
||||
<ul class="resourcesSelect">
|
||||
|
@ -74,7 +74,7 @@
|
|||
</div><!---re_con end-->
|
||||
|
||||
</div>
|
||||
<% html_title(l(:label_attachment_plural)) -%>
|
||||
<%# html_title(l(:label_attachment_plural)) -%>
|
||||
<script>
|
||||
function org_upload_files(org_subfield_id){
|
||||
$.ajax({
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<% if (is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file) %>
|
||||
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project" %>
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %></li>
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
||||
<% if project.is_public? %>
|
||||
<li>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<% end %>
|
||||
<% else %>
|
||||
<ul class="resourceSendO">
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %></li>
|
||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<script src="/javascripts/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
|
||||
<div id="popbox_upload" class="mb10" style="margin-top: -30px;color:#15bccf; font-size:16px;">
|
||||
<div class="upload_con">
|
||||
<h2 style="text-align: center"><%= l(:label_upload_files)%></h2>
|
||||
|
@ -21,10 +22,20 @@
|
|||
<%= render :partial => 'files/new_style_attachment_list',:locals => {:container => course} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
<%= submit_tag '确定',:onclick=>'submit_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
|
||||
<% if User.current.allowed_to?(:as_teacher,course) %>
|
||||
<div class="mb5">
|
||||
<label class="fl c_dark f14" style="margin-top: 4px;">延迟发布:</label>
|
||||
<div class="calendar_div fl">
|
||||
<input type="text" name="publish_time" id="attachment_publish_time" placeholder="发布日期(可选)" class="InputBox fl W120 calendar_input" readonly="readonly">
|
||||
<%#= calendar_for('attachment_publish_time')%>
|
||||
</div>
|
||||
<span class="fl c_red f12" style="margin-top: 4px;" id="publish_time_notice"></span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<a href="javascript:void(0);" class=" fr courseSendCancel mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<a id="submit_resource" href="javascript:void(0);" class="c_white courseSendSubmit fr" onclick="submit_course_resource();"><%= l(:button_confirm)%></a>
|
||||
<%#= submit_tag '确定',:onclick=>'submit_course_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
@ -35,8 +46,39 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
function submit_resource()
|
||||
function regex_publish_time()
|
||||
{
|
||||
$('#submit_resource').parent().submit();
|
||||
var myDate = new Date();
|
||||
if($.trim($("#attachment_publish_time").val()) == "")
|
||||
{
|
||||
return true;
|
||||
} else{
|
||||
var publish_time = Date.parse($("#attachment_publish_time").val());
|
||||
if(Date.parse(formate_date(myDate)) > publish_time)
|
||||
{
|
||||
$("#publish_time_notice").text("发布日期不能小于当前日期");
|
||||
return false;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#publish_time_notice").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
function submit_course_resource()
|
||||
{
|
||||
<% if User.current.allowed_to?(:as_teacher,course) %>
|
||||
if(regex_publish_time()) {
|
||||
$('#submit_resource').parent().submit();
|
||||
}
|
||||
<% else %>
|
||||
$('#submit_resource').parent().submit();
|
||||
<% end %>
|
||||
}
|
||||
$(function(){
|
||||
var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: 0, showOn: 'button', buttonImageOnly: true, buttonImage: '/images/public_icon.png', showButtonPanel: true, showWeek: true, showOtherMonths: true, selectOtherMonths: true};
|
||||
$('#attachment_publish_time').datepicker(datepickerOptions);
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,6 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'files/hidden_file',:locals => {:course => @course,:course_attachment_type => 1}) %>');
|
||||
showModal('ajax-modal', '311px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 280px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
|
@ -185,20 +185,6 @@
|
|||
|
||||
}
|
||||
|
||||
|
||||
function org_id_click(){
|
||||
var sendText = $("input[name='org_id']:checked").next().text();
|
||||
var orgDirection = "目标地址:"
|
||||
$(".orgDirection").text(orgDirection + sendText);
|
||||
}
|
||||
function subfield_click(){
|
||||
var sendText = $("input[name='org_id']:checked").next().text();
|
||||
var orgDirection = "目标地址:"
|
||||
var sendColumn = $("input[name='subfield']:checked").next().text();
|
||||
$(".orgDirection").text(orgDirection + sendText + " / " + sendColumn);
|
||||
}
|
||||
|
||||
|
||||
function course_attachmenttypes_change(id, type) {
|
||||
<% if @course%>
|
||||
$.ajax({
|
||||
|
@ -245,105 +231,7 @@
|
|||
});
|
||||
|
||||
}
|
||||
function observeSearchfieldOnInput(fieldId, url,send_id,send_ids) {
|
||||
$('#'+fieldId).each(function() {
|
||||
var $this = $(this);
|
||||
$this.addClass('autocomplete');
|
||||
$this.attr('data-value-was', $this.val());
|
||||
var check = function() {
|
||||
var val = $this.val();
|
||||
if ($this.attr('data-value-was') != val){
|
||||
$this.attr('data-value-was', val);
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'get',
|
||||
data: {search: $this.val(),send_id:send_id,send_ids:send_ids},
|
||||
success: function(data){ },
|
||||
beforeSend: function(){ $this.addClass('ajax-loading'); },
|
||||
complete: function(){ $this.removeClass('ajax-loading'); }
|
||||
});
|
||||
}
|
||||
};
|
||||
var reset = function() {
|
||||
if (timer) {
|
||||
clearInterval(timer);
|
||||
timer = setInterval(check, 300);
|
||||
}
|
||||
};
|
||||
var timer = setInterval(check, 300);
|
||||
$this.bind('keyup click mousemove', reset);
|
||||
});
|
||||
}
|
||||
function check_des(event){
|
||||
if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){
|
||||
event.preventDefault();
|
||||
$(".orgDirection").text('目标地址组织不能为空')
|
||||
return false;
|
||||
}else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){
|
||||
event.preventDefault();
|
||||
$(".orgDirection").text('目标地址栏目不能为空')
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
<% if User.current.logged? %>
|
||||
var sendType = '1';
|
||||
var lastSendType ;//初始为发送到我的课程
|
||||
function show_send(id){
|
||||
if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else if(lastSendType == '1'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else if( lastSendType == '3'){//组织
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}else{
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//id 发送的id
|
||||
//发送的id数组
|
||||
function chooseSendType(res_id,res_ids){
|
||||
|
||||
sendType = $(".resourcesSendType").val();
|
||||
if (sendType === lastSendType) {
|
||||
return;
|
||||
} else if(lastSendType != null) { //不是第一次点击的时候
|
||||
if (sendType == '1') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_course_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
} else if(sendType == '2') {
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_project_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
}else if(sendType == '3'){
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '<%= search_user_org_user_path(User.current)%>' + '?send_id=' + res_id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
lastSendType = sendType;
|
||||
}
|
||||
<% end %>
|
||||
<% if @course %>
|
||||
var tagNameHtml; //当前双击的链接的父节点的html
|
||||
var tagName; //标签的值
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#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().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
|
@ -1,11 +1,11 @@
|
|||
<% if @can_quote %>
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => ''}) %>');
|
||||
<% else %>
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => '403'}) %>');
|
||||
<% end %>
|
||||
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#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","");
|
||||
<% if @can_quote %>
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => ''}) %>');
|
||||
<% else %>
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'show_quote_resource_org_subfield',:locals => {:org_subfield => @org_subfield,:file => @file,:error => '403'}) %>');
|
||||
<% end %>
|
||||
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#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","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
|
@ -7,5 +7,5 @@
|
|||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#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().css("top","30%").css("left","35%").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue