Merge branch 'hjq_new_course' of https://git.trustie.net/jacknudt/trustieforge into hjq_new_course
Conflicts: app/views/users/search_user_course.js.erb app/views/users/search_user_org.js.erb app/views/users/search_user_project.js.erb
This commit is contained in:
commit
a2afec77e3
|
@ -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'
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the shield_activities controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the subfield_subdomain_dirs controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -7,10 +7,14 @@ class AtController < ApplicationController
|
|||
@logger = Logger.new(Rails.root.join('log', 'at.log').to_s)
|
||||
users = find_at_users(params[:type], params[:id])
|
||||
@users = users
|
||||
@users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id } if users
|
||||
@users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }.sort{|x,y| to_pinyin(x.show_name) <=> to_pinyin(y.show_name)} if users
|
||||
end
|
||||
|
||||
private
|
||||
def to_pinyin(s)
|
||||
Pinyin.t(s).downcase
|
||||
end
|
||||
|
||||
def find_at_users(type, id)
|
||||
@logger.info("#{type}, #{id}")
|
||||
case type
|
||||
|
@ -49,6 +53,7 @@ class AtController < ApplicationController
|
|||
end
|
||||
|
||||
def find_project(id)
|
||||
return [] if id<0
|
||||
at_persons = Project.find(id).users
|
||||
at_persons.delete_if { |u| u.id == User.current.id }
|
||||
end
|
||||
|
|
|
@ -600,7 +600,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,7 +52,11 @@ class BlogCommentsController < ApplicationController
|
|||
render_attachment_warning_if_needed(@article)
|
||||
else
|
||||
end
|
||||
redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id])
|
||||
if params[:is_homepage]
|
||||
redirect_to user_blogs_path(params[:user_id])
|
||||
else
|
||||
redirect_to user_blog_blog_comment_path(:user_id=>params[:user_id],:blog_id=>params[:blog_id],:id=>params[:id])
|
||||
end
|
||||
end
|
||||
def destroy
|
||||
@article = BlogComment.find(params[:id])
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class BlogsController < ApplicationController
|
||||
before_filter :find_blog,:except => [:index,:create,:new]
|
||||
before_filter :find_blog,:except => [:index,:create,:new,:set_homepage, :cancel_homepage]
|
||||
before_filter :find_user
|
||||
def index
|
||||
@articls = @user.blog.articles
|
||||
|
@ -26,6 +26,18 @@ class BlogsController < ApplicationController
|
|||
def edit
|
||||
|
||||
end
|
||||
|
||||
def set_homepage
|
||||
@blog = Blog.find(params[:id])
|
||||
@blog.update_attribute(:homepage_id, params[:article_id])
|
||||
redirect_to user_blogs_path(params[:user_id])
|
||||
end
|
||||
|
||||
def cancel_homepage
|
||||
@blog = Blog.find(params[:id])
|
||||
@blog.update_attribute(:homepage_id, nil)
|
||||
redirect_to user_blogs_path(params[:user_id])
|
||||
end
|
||||
private
|
||||
def find_blog
|
||||
if params[:blog_id]
|
||||
|
|
|
@ -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]
|
||||
|
@ -54,16 +56,9 @@ class CommentsController < ApplicationController
|
|||
# end
|
||||
# # <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD>ļ<EFBFBD>¼add end
|
||||
#flash[:notice] = l(:label_comment_added)
|
||||
course_activity = CourseActivity.where("course_act_type='News' and course_act_id =#{@news.id}").first
|
||||
if course_activity
|
||||
course_activity.updated_at = Time.now
|
||||
course_activity.save
|
||||
end
|
||||
user_activity = UserActivity.where("act_type='News' and act_id =#{@news.id}").first
|
||||
if user_activity
|
||||
user_activity.updated_at = Time.now
|
||||
user_activity.save
|
||||
end
|
||||
update_course_activity(@news.class,@news.id)
|
||||
update_user_activity(@news.class,@news.id)
|
||||
update_org_activity(@news.class,@news.id)
|
||||
end
|
||||
|
||||
if params[:user_activity_id]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#encoding: utf-8
|
||||
class CoursesController < ApplicationController
|
||||
# layout 'base_courses'
|
||||
include CoursesHelper
|
||||
|
@ -38,15 +39,17 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
limit = 15
|
||||
course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{params[:id]}").map(&:organization_id)
|
||||
if course_org_ids.empty?
|
||||
@orgs_not_in_course = Organization.where("(is_public or creator_id =?) and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit)
|
||||
@org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count
|
||||
else
|
||||
course_org_ids = "(" + course_org_ids.join(',') + ")"
|
||||
@orgs_not_in_course = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit)
|
||||
@org_count = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count
|
||||
end
|
||||
# @course_count = Project.course_entities.visible.like(params[:name]).page(params[:page]).count
|
||||
#@orgs_not_in_course = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).page(params[:page].to_i || 1).per(limit)
|
||||
#@org_count = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).count
|
||||
if course_org_ids.empty?
|
||||
@orgs_not_in_course = User.current.organizations.where("name like ?",condition).page((params[:page].to_i || 1)).per(limit)
|
||||
@org_count = @orgs_not_in_course.count
|
||||
else
|
||||
course_org_ids = "(" + course_org_ids.join(',') + ")"
|
||||
@orgs_not_in_course = User.current.organizations.where("organizations.id not in #{course_org_ids} and organizations.name like ?", condition).page((params[:page].to_i || 1)).per(limit)
|
||||
@org_count = @orgs_not_in_course.empty? ? 0 : @orgs_not_in_course.count
|
||||
end
|
||||
@course_count = Project.course_entities.visible.like(params[:name]).page(params[:page]).count
|
||||
@orgs_page = Paginator.new @org_count, limit,params[:page]
|
||||
@hint_flag = params[:hint_flag]
|
||||
#render :json => {:orgs => @orgs_not_in_course, :count => @org_count}.to_json
|
||||
|
@ -436,10 +439,77 @@ class CoursesController < ApplicationController
|
|||
def create
|
||||
cs = CoursesService.new
|
||||
@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)
|
||||
if params[:checkAll]
|
||||
attachments = copy_course.attachments
|
||||
attachments.each do |attachment|
|
||||
attach_copied_obj = attachment.copy
|
||||
attach_copied_obj.tag_list.add(attachment.tag_list) # tag关联
|
||||
attach_copied_obj.container = @course
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
attach_copied_obj.copy_from = attachment.copy_from.nil? ? attachment.id : attachment.copy_from
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 4
|
||||
end
|
||||
attach_copied_obj.save
|
||||
update_quotes attach_copied_obj
|
||||
end
|
||||
elsif params[:course_attachment_type]
|
||||
copy_attachments = []
|
||||
params[:course_attachment_type].each do |type|
|
||||
case type
|
||||
when "1"
|
||||
tag_name = l(:label_courseware)
|
||||
when "2"
|
||||
tag_name = l(:label_software)
|
||||
when "3"
|
||||
tag_name = l(:label_media)
|
||||
when "4"
|
||||
tag_name = l(:label_code)
|
||||
when "6"
|
||||
tag_name = "论文"
|
||||
else
|
||||
tag_name = ""
|
||||
end
|
||||
if tag_name == ""
|
||||
tag_attachments = copy_course.attachments.select{|attachment|
|
||||
!attachment.tag_list.include?('课件') &&
|
||||
!attachment.tag_list.include?('软件') &&
|
||||
!attachment.tag_list.include?('媒体') &&
|
||||
!attachment.tag_list.include?('代码') &&
|
||||
!attachment.tag_list.include?('论文') }
|
||||
else
|
||||
tag_attachments = copy_course.attachments.select{|attachment| attachment.tag_list.include?(tag_name)}
|
||||
end
|
||||
tag_attachments.each do |attach|
|
||||
next if copy_attachments.include?(attach)
|
||||
copy_attachments << attach
|
||||
end
|
||||
end
|
||||
unless copy_attachments.blank?
|
||||
copy_attachments.each do |c_attach|
|
||||
attach_copied_obj = c_attach.copy
|
||||
attach_copied_obj.tag_list.add(c_attach.tag_list) # tag关联
|
||||
attach_copied_obj.container = @course
|
||||
attach_copied_obj.created_on = Time.now
|
||||
attach_copied_obj.author_id = User.current.id
|
||||
attach_copied_obj.copy_from = c_attach.copy_from.nil? ? c_attach.id : c_attach.copy_from
|
||||
if attach_copied_obj.attachtype == nil
|
||||
attach_copied_obj.attachtype = 4
|
||||
end
|
||||
attach_copied_obj.save
|
||||
update_quotes attach_copied_obj
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
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
|
||||
|
@ -751,6 +821,11 @@ class CoursesController < ApplicationController
|
|||
#param id:已有课程ID
|
||||
def copy_course
|
||||
if @course
|
||||
@new_course = Course.new
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
=begin
|
||||
@new_course = Course.new @course.attributes
|
||||
@new_course.tea_id = User.current.id
|
||||
@new_course.created_at = DateTime.now
|
||||
|
@ -769,6 +844,7 @@ class CoursesController < ApplicationController
|
|||
@new_course.course_infos << course
|
||||
redirect_to settings_course_url @new_course
|
||||
end
|
||||
=end
|
||||
else
|
||||
render_404
|
||||
end
|
||||
|
@ -829,6 +905,33 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
|
||||
private
|
||||
def update_quotes attachment
|
||||
if attachment.copy_from
|
||||
attachments = Attachment.find_by_sql("select * from attachments where copy_from = #{attachment.copy_from} or id = #{attachment.copy_from}")
|
||||
else
|
||||
attachments = Attachment.find_by_sql("select * from attachments where copy_from = #{attachment.id} or id = #{attachment.copy_from}")
|
||||
end
|
||||
attachment.quotes = get_qute_number attachment
|
||||
attachment.save
|
||||
attachments.each do |att|
|
||||
att.quotes = attachment.quotes
|
||||
att.save
|
||||
end
|
||||
end
|
||||
|
||||
def get_qute_number attachment
|
||||
if attachment.copy_from
|
||||
result = Attachment.find_by_sql("select count(*) as number from attachments where copy_from = #{attachment.copy_from}")
|
||||
else
|
||||
result = Attachment.find_by_sql("select count(*) as number from attachments where copy_from = #{attachment.id}")
|
||||
end
|
||||
if result.nil? || result.count <= 0
|
||||
return 0
|
||||
else
|
||||
return result[0].number
|
||||
end
|
||||
end
|
||||
|
||||
def allow_join course
|
||||
if course_endTime_timeout? course
|
||||
respond_to do |format|
|
||||
|
|
|
@ -376,6 +376,11 @@ class ExerciseController < ApplicationController
|
|||
end
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.xls {
|
||||
filename = "#{@course.teacher.lastname.to_s + @course.teacher.firstname}_#{@course.name}_#{@course.time.to_s + @course.term}_#{@exercise.exercise_name}#{l(:excel_exercise_list)}.xls"
|
||||
send_data(exercise_to_xls(@exercise_users_list), :type => "text/excel;charset=utf-8; header=present",
|
||||
:filename => filename_for_content_disposition(filename))
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -603,6 +608,29 @@ class ExerciseController < ApplicationController
|
|||
end
|
||||
|
||||
private
|
||||
#测验列表转换为excel
|
||||
def exercise_to_xls items
|
||||
xls_report = StringIO.new
|
||||
book = Spreadsheet::Workbook.new
|
||||
sheet1 = book.create_worksheet :name => "exercise"
|
||||
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
|
||||
sheet1.row(0).default_format = blue
|
||||
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)])
|
||||
count_row = 1
|
||||
items.each do |exercise|
|
||||
sheet1[count_row,0]=exercise.user.id
|
||||
sheet1[count_row,1] = exercise.user.lastname.to_s + exercise.user.firstname.to_s
|
||||
sheet1[count_row,2] = exercise.user.login
|
||||
sheet1[count_row,3] = exercise.user.user_extensions.student_id
|
||||
sheet1[count_row,4] = exercise.user.mail
|
||||
sheet1[count_row,5] = ""
|
||||
sheet1[count_row,6] = exercise.score
|
||||
sheet1[count_row,7] = format_time(exercise.created_at)
|
||||
count_row += 1
|
||||
end
|
||||
book.write xls_report
|
||||
xls_report.string
|
||||
end
|
||||
|
||||
# ExerciseUser记录用户是否已提交问卷有对应的记录则已提交,没有则新建一个
|
||||
def get_exercise_user exercise_id,user_id
|
||||
|
|
|
@ -17,14 +17,16 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
class FilesController < ApplicationController
|
||||
|
||||
layout 'base_projects' #by young
|
||||
layout 'base_projects' #by young
|
||||
|
||||
menu_item :files
|
||||
before_filter :auth_login1, :only => [:index]
|
||||
before_filter :logged_user_by_apptoken,:only => [:index]
|
||||
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
||||
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]
|
||||
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]
|
||||
|
||||
helper :sort
|
||||
include SortHelper
|
||||
|
@ -170,6 +172,7 @@ class FilesController < ApplicationController
|
|||
# #render 'stores'
|
||||
# redirect_to search_course_files_url
|
||||
end
|
||||
@page = params[:page] || 1
|
||||
end
|
||||
|
||||
def find_course_attache keywords,course,sort = ""
|
||||
|
@ -227,6 +230,7 @@ class FilesController < ApplicationController
|
|||
@order = ""
|
||||
@is_remote = false
|
||||
if params[:project_id]
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 2
|
||||
@container_type = 0
|
||||
if params[:sort]
|
||||
params[:sort].split(",").each do |sort_type|
|
||||
|
@ -280,7 +284,7 @@ class FilesController < ApplicationController
|
|||
render :layout => 'base_projects'
|
||||
elsif params[:course_id]
|
||||
@container_type = 1
|
||||
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 2
|
||||
if params[:sort]
|
||||
params[:sort].split(",").each do |sort_type|
|
||||
order_by = sort_type.split(":")
|
||||
|
@ -377,6 +381,7 @@ class FilesController < ApplicationController
|
|||
@organization = Organization.find(@containers.first.organization_id)
|
||||
show_attachments @containers
|
||||
@tag_list = attachment_tag_list @all_attachments
|
||||
@page = params[:page] || 1
|
||||
render :layout => 'base_org'
|
||||
# @subfield = params[:org_subfield_id]
|
||||
end
|
||||
|
@ -450,6 +455,11 @@ class FilesController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
# 更新资源总数, 根据上传的附件数累加
|
||||
unless @project.project_score.nil?
|
||||
@project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count)
|
||||
end
|
||||
# end
|
||||
# TODO: 临时用 nyan
|
||||
sort_init 'created_on', 'desc'
|
||||
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
||||
|
@ -478,9 +488,6 @@ class FilesController < ApplicationController
|
|||
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||
Mailer.run.attachments_added(attachments[:files])
|
||||
end
|
||||
# 更新课程英雄榜得分
|
||||
update_contributor_score(@course, attachments[:files].first)
|
||||
# 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
|
||||
|
@ -502,8 +509,9 @@ class FilesController < ApplicationController
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# 更新课程英雄榜得分
|
||||
update_contributor_score(@course, attachments[:files].first)
|
||||
# end
|
||||
# TODO: 临时用 nyan
|
||||
sort_init 'created_on', 'desc'
|
||||
sort_update 'created_on' => "#{Attachment.table_name}.created_on",
|
||||
|
@ -821,4 +829,8 @@ class FilesController < ApplicationController
|
|||
def subfield_upload_file
|
||||
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||
end
|
||||
|
||||
def upload_files_menu
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,6 +55,7 @@ class IssuesController < ApplicationController
|
|||
helper :timelog
|
||||
include Redmine::Export::PDF
|
||||
helper :project_score
|
||||
include ApplicationHelper
|
||||
|
||||
def index
|
||||
retrieve_query
|
||||
|
@ -80,6 +81,7 @@ class IssuesController < ApplicationController
|
|||
@priority_id = params[:priority_id]
|
||||
@status_id = params[:status_id]
|
||||
@subject = params[:subject]
|
||||
@done_ratio = parmas[: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
|
||||
|
@ -219,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[:issue_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
|
||||
|
@ -277,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
|
||||
|
@ -405,13 +428,14 @@ class IssuesController < ApplicationController
|
|||
jour.journalized = @issue
|
||||
jour.save_attachments(params[:attachments])
|
||||
jour.save
|
||||
user_activity = UserActivity.where("act_type='Issue' and act_id =#{@issue.id}").first
|
||||
user_activity.updated_at = jour.created_on
|
||||
user_activity.save
|
||||
update_user_activity(@issue.class,@issue.id)
|
||||
update_forge_activity(@issue.class,@issue.id)
|
||||
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
if params[:issue_id]
|
||||
@issue_id = params[:issue_id]
|
||||
end
|
||||
@priorities = IssuePriority.active
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -454,9 +478,9 @@ class IssuesController < ApplicationController
|
|||
@issue = Issue.find params[:id]
|
||||
jour.journalized = @issue
|
||||
jour.save
|
||||
user_activity = UserActivity.where("act_type='Issue' and act_id =#{@issue.id}").first
|
||||
user_activity.updated_at = jour.created_on
|
||||
user_activity.save
|
||||
update_user_activity(@issue.class,@issue.id)
|
||||
update_forge_activity(@issue.class,@issue.id)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
|
@ -176,26 +176,11 @@ class MessagesController < ApplicationController
|
|||
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
|
||||
# @reply.reply_id = params[:id]
|
||||
@topic.children << @reply
|
||||
course_activity = CourseActivity.where("course_act_type='Message' and course_act_id =#{@topic.id}").first
|
||||
if course_activity
|
||||
course_activity.updated_at = Time.now
|
||||
course_activity.save
|
||||
end
|
||||
forge_activity = ForgeActivity.where("forge_act_type='Message' and forge_act_id=#{@topic.id}").first
|
||||
if forge_activity
|
||||
forge_activity.updated_at = Time.now
|
||||
forge_activity.save
|
||||
end
|
||||
user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first
|
||||
if user_activity
|
||||
user_activity.updated_at = Time.now
|
||||
user_activity.save
|
||||
end
|
||||
org_activity = OrgActivity.where("org_act_type='Message' and org_act_id =#{@topic.id}").first
|
||||
if org_activity
|
||||
org_activity.updated_at = Time.now
|
||||
org_activity.save
|
||||
end
|
||||
update_course_activity(@topic.class,@topic.id)
|
||||
update_user_activity(@topic.class,@topic.id)
|
||||
update_forge_activity(@topic.class,@topic.id)
|
||||
update_org_activity(@topic.class,@topic.id)
|
||||
|
||||
#@topic.update_attribute(:updated_on, Time.now)
|
||||
if !@reply.new_record?
|
||||
if params[:asset_id]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -20,7 +20,12 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
flash.keep[:notice] = l(:notice_successful_create)
|
||||
EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document_comment.id, :created_at => @org_document_comment.updated_at)
|
||||
if params[:field_id]
|
||||
redirect_to organization_path(@organization, :org_subfield_id => params[:field_id])
|
||||
@org_subfield = OrgSubfield.find(params[:field_id])
|
||||
if @org_subfield.subfield_subdomain_dir.nil?
|
||||
redirect_to organization_path(@organization, :org_subfield_id => params[:field_id])
|
||||
else
|
||||
redirect_to show_org_subfield_organization_path(:id => @organization.id, :sub_dir_name => @org_subfield.subfield_subdomain_dir.name)
|
||||
end
|
||||
else
|
||||
redirect_to organization_org_document_comments_path(@organization)
|
||||
end
|
||||
|
|
|
@ -1,22 +1,95 @@
|
|||
class OrgSubfieldsController < ApplicationController
|
||||
helper :attachments
|
||||
include FilesHelper
|
||||
layout 'base_org'
|
||||
def create
|
||||
@subfield = OrgSubfield.create(:name => params[:name])
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
@organization.org_subfields << @subfield
|
||||
@subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
|
||||
if OrgSubfield.where("organization_id=#{params[:organization_id]} and name=?",params[:name]).count == 0
|
||||
@res = true
|
||||
@subfield = OrgSubfield.create(:name => params[:name])
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
@organization.org_subfields << @subfield
|
||||
if !params[:sub_dir].blank?
|
||||
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
|
||||
"and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
|
||||
if SubfieldSubdomainDir.find_by_sql(sql).count == 0
|
||||
SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir])
|
||||
end
|
||||
end
|
||||
@subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
|
||||
else
|
||||
@res = false
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@org_subfield = OrgSubfield.find(params[:id])
|
||||
@organization = @org_subfield.organization.id
|
||||
@messages = []
|
||||
@messages << @org_subfield.org_document_comments
|
||||
@messages << @org_subfield.messages
|
||||
@messages.sort{|a, b| b.updated_at <=> a.updated_at}
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_org'}
|
||||
@flag = params[:flag] || false
|
||||
sort = ""
|
||||
@sort = ""
|
||||
@order = ""
|
||||
@is_remote = false
|
||||
if params[:id]
|
||||
@organization = Organization.find(params[:id])
|
||||
else
|
||||
@organization = Organization.where("domain=?",request.subdomain).first
|
||||
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
|
||||
if @org_subfield.field_type == 'Post'
|
||||
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
|
||||
@org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
#redirect_to organization_path(@organization, :org_subfield_id => @org_subfield.id)
|
||||
else
|
||||
if params[:sort]
|
||||
params[:sort].split(",").each do |sort_type|
|
||||
order_by = sort_type.split(":")
|
||||
case order_by[0]
|
||||
when "filename"
|
||||
attribute = "filename"
|
||||
when "size"
|
||||
attribute = "filesize"
|
||||
when "attach_type"
|
||||
attribute = "attachtype"
|
||||
when "content_type"
|
||||
attribute = "created_on"
|
||||
when "field_file_dense"
|
||||
attribute = "is_public"
|
||||
when "downloads"
|
||||
attribute = "downloads"
|
||||
when "created_on"
|
||||
attribute = "created_on"
|
||||
when "quotes"
|
||||
attribute = "quotes"
|
||||
else
|
||||
attribute = "created_on"
|
||||
end
|
||||
@sort = order_by[0]
|
||||
@order = order_by[1]
|
||||
if order_by.count == 1 && attribute
|
||||
sort += "#{Attachment.table_name}.#{attribute} asc "
|
||||
if sort_type != params[:sort].split(",").last
|
||||
sort += ","
|
||||
end
|
||||
elsif order_by.count == 2 && order_by[1]
|
||||
sort += "#{Attachment.table_name}.#{attribute} #{order_by[1]} "
|
||||
if sort_type != params[:sort].split(",").last
|
||||
sort += ","
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
sort = "#{Attachment.table_name}.created_on desc"
|
||||
end
|
||||
@container_type = 2
|
||||
@containers = [ OrgSubfield.includes(:attachments).reorder(sort).find(@org_subfield.id)]
|
||||
@organization = Organization.find(@containers.first.organization_id)
|
||||
show_attachments @containers
|
||||
@tag_list = attachment_tag_list @all_attachments
|
||||
end
|
||||
@page = params[:page] || 1
|
||||
#render :layout => 'base_org'
|
||||
end
|
||||
|
||||
def destroy
|
||||
@subfield = OrgSubfield.find(params[:id])
|
||||
@organization = Organization.find(@subfield.organization_id)
|
||||
|
@ -29,4 +102,43 @@ class OrgSubfieldsController < ApplicationController
|
|||
@subfield.update_attributes(:name => params[:name])
|
||||
end
|
||||
|
||||
def update_sub_dir
|
||||
@org_subfield = OrgSubfield.find(params[:id])
|
||||
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
|
||||
"and org_subfields.organization_id=#{@org_subfield.organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir_name]}'"
|
||||
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])
|
||||
else
|
||||
@sub_dir = SubfieldSubdomainDir.create(:org_subfield_id => @org_subfield.id, :name => params[:sub_dir_name])
|
||||
end
|
||||
@exist = false
|
||||
else
|
||||
@exist = true
|
||||
end
|
||||
end
|
||||
|
||||
def show_attachments obj
|
||||
@attachments = []
|
||||
obj.each do |container|
|
||||
@attachments += container.attachments
|
||||
end
|
||||
@all_attachments = User.current.admin? ? @attachments : visable_attachemnts(@attachments)
|
||||
@limit = 10
|
||||
@feedback_count = @all_attachments.count
|
||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
@offset ||= @feedback_pages.offset
|
||||
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
||||
@obj_attachments = paginateHelper @all_attachments,10
|
||||
end
|
||||
|
||||
#获取指定资源列表的TAG的集合以及每个TAG的数量,降序排序
|
||||
def attachment_tag_list attachments
|
||||
tag_list = Hash.new
|
||||
attachments.each do |attachment|
|
||||
attachment.tag_list.map{|tag| tag_list.has_key?(tag) ? tag_list[tag] = tag_list[tag] + 1 : tag_list[tag] = 1}
|
||||
end
|
||||
tag_list.sort {|a,b| b[1]<=>a[1]}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ class OrganizationsController < ApplicationController
|
|||
helper :project_score
|
||||
helper :issues
|
||||
include UsersHelper
|
||||
before_filter :find_organization, :only => [:show, :members]
|
||||
before_filter :find_organization, :only => [:show, :members, :apply_subdomain]
|
||||
layout 'base_org'
|
||||
def index
|
||||
|
||||
|
@ -73,8 +73,10 @@ class OrganizationsController < ApplicationController
|
|||
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0
|
||||
@org_activities = OrgActivity.where("(org_act_type='OrgDocumentComment'and org_act_id in (#{@org_subfield_ids.join(",")})) || (container_type='OrgSubfield' and container_id=#{@org_subfield.id})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
else
|
||||
project_ids = @organization.projects.map(&:id) << 0
|
||||
course_ids = @organization.courses.map(&:id) << 0
|
||||
shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
|
||||
shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
|
||||
project_ids = (@organization.projects.map(&:id)-shield_project_ids) << 0
|
||||
course_ids = (@organization.courses.map(&:id)-shield_course_ids) << 0
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
||||
case params[:type]
|
||||
when nil
|
||||
|
@ -98,7 +100,7 @@ class OrganizationsController < ApplicationController
|
|||
@org_activities = OrgActivity.where("container_type = 'Course' and org_act_type = 'Poll' and container_id in (#{course_ids.join(',')})").order('updated_at desc').page(params[:page] || 1).per(10)
|
||||
end
|
||||
end
|
||||
@page = params[:page]
|
||||
@page = params[:page] ? params[:page].to_i : 1
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
|
@ -112,8 +114,9 @@ class OrganizationsController < ApplicationController
|
|||
@organization = Organization.find(params[:id])
|
||||
@organization.name = params[:organization][:name]
|
||||
@organization.description = params[:organization][:description]
|
||||
@organization.domain = params[:organization][:domain]
|
||||
# @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|
|
||||
|
@ -134,6 +137,10 @@ class OrganizationsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def check_uniq_domain
|
||||
@is_exist = (Organization.where("domain=?", params[:org_domain]).count > 0)
|
||||
end
|
||||
|
||||
def find_organization
|
||||
@organization = Organization.find(params[:id])
|
||||
end
|
||||
|
@ -294,10 +301,29 @@ 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'
|
||||
@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
|
||||
end
|
||||
def apply_subdomain
|
||||
@organization = Organization.find(params[:id])
|
||||
admins = User.where("admin=1")
|
||||
admins.each do |admin|
|
||||
OrgMessage.create(:user_id => admin.id, :organization_id => @organization.id, :message_type => 'ApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:domain])
|
||||
end
|
||||
end
|
||||
|
||||
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 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
|
||||
end
|
||||
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
|
||||
|
@ -503,6 +504,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
|
||||
|
|
|
@ -5,39 +5,73 @@ class PraiseTreadController < ApplicationController
|
|||
|
||||
def praise_plus
|
||||
@obj = nil
|
||||
# @is_in_list = nil
|
||||
@activity = false
|
||||
|
||||
if request.get?
|
||||
@obj_id = params[:obj_id]
|
||||
@obj_type = params[:obj_type]
|
||||
@horizontal = params[:horizontal].downcase == "false" ? false:true
|
||||
if !params[:user_activity_id].nil? && !params[:type].nil?
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@type = params[:type]
|
||||
@activity = true
|
||||
end
|
||||
# @is_in_list = nil
|
||||
@obj = find_object_by_type_and_id(@obj_type,@obj_id)
|
||||
unless @obj.author_id == User.current.id
|
||||
pts = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",@obj_id,@obj_type.to_s,User.current.id)
|
||||
unless pts.empty?
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
return
|
||||
end
|
||||
@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")
|
||||
author_id = @obj.user_id
|
||||
end
|
||||
unless author_id == User.current.id
|
||||
praise_tread_plus(@obj_type,@obj_id,1)
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def praise_minus
|
||||
@obj = nil
|
||||
@activity = false
|
||||
if request.get?
|
||||
@obj = params[:obj] # 传的是对象,最后变成id了
|
||||
|
||||
#@obj = params[:obj] # 传的是对象,最后变成id了
|
||||
#首先更新praise_tread 表 删除关注记录
|
||||
@pt = PraiseTread.find_by_user_id_and_praise_tread_object_id_and_praise_tread_object_type(User.current.id,@obj,"user")
|
||||
@pt.delete
|
||||
|
||||
#@pt = PraiseTread.find_by_user_id_and_praise_tread_object_id_and_praise_tread_object_type(User.current.id,@obj,"user")
|
||||
@obj_id = params[:obj_id]
|
||||
@obj_type = params[:obj_type]
|
||||
if !params[:user_activity_id].nil? && !params[:type].nil?
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
@type = params[:type]
|
||||
@activity = true
|
||||
end
|
||||
@obj = find_object_by_type_and_id(@obj_type,@obj_id)
|
||||
@pt = PraiseTread.where("praise_tread_object_id=? and praise_tread_object_type=? and user_id=?",@obj_id,@obj_type.to_s,User.current.id).first
|
||||
if @pt.nil?
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
return
|
||||
end
|
||||
@pt.delete if !@pt.nil?
|
||||
#再更新praise_tread_cache表 使相应的记录减1 当为0时删除
|
||||
@ptc = PraiseTreadCache.find_by_object_id(@obj)
|
||||
@ptc.minus(1)
|
||||
@ptc = PraiseTreadCache.where("object_id=? and object_type=?",@obj_id,@obj_type.to_s).first
|
||||
@ptc.minus(1) if !@ptc.nil?
|
||||
if @ptc.praise_num == 0
|
||||
@ptc.delete
|
||||
@ptc.delete
|
||||
end
|
||||
|
||||
end
|
||||
@obj = User.find_by_id(@obj)
|
||||
#@obj = User.find_by_id(@obj)
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
@ -48,7 +82,7 @@ class PraiseTreadController < ApplicationController
|
|||
if request.get?
|
||||
@obj_id = params[:obj_id]
|
||||
@obj_type = params[:obj_type]
|
||||
@horizontal = params[:horizontal].downcase == "false" ? false:true
|
||||
#@horizontal = params[:horizontal].downcase == "false" ? false:true
|
||||
@obj = find_object_by_type_and_id(@obj_type,@obj_id)
|
||||
unless @obj.author_id == User.current.id
|
||||
praise_tread_plus(@obj_type,@obj_id,0)
|
||||
|
@ -69,20 +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 '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
|
||||
|
@ -99,17 +149,14 @@ 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
|
||||
@ptc.save
|
||||
@ptc.plus(flag,1)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -76,16 +76,17 @@ class ProjectsController < ApplicationController
|
|||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
limit = 15
|
||||
project_org_ids = OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{params[:id]}").map(&:organization_id)
|
||||
if project_org_ids.empty?
|
||||
@orgs_not_in_project = Organization.where("(is_public or creator_id =?) = 1 and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit)
|
||||
@org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count
|
||||
else
|
||||
project_org_ids = "(" + project_org_ids.join(',') + ")"
|
||||
@orgs_not_in_project = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit)
|
||||
@org_count = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count
|
||||
end
|
||||
# @project_count = Project.project_entities.visible.like(params[:name]).page(params[:page]).count
|
||||
project_org_ids = OrgProject.find_by_sql("select distinct organization_id from org_projects where project_id = #{params[:id]}").map(&:organization_id) << 0
|
||||
@orgs_not_in_project = User.current.organizations.where("organizations.id not in (#{project_org_ids.join(',')}) and organizations.name like ?", condition).page(params[:page].to_i || 1).per(limit)
|
||||
@org_count = User.current.organizations.where("organizations.id not in (#{project_org_ids.join(',')}) and organizations.name like '#{condition}'").count
|
||||
# if project_org_ids.empty?
|
||||
# @orgs_not_in_project = Organization.where("(is_public or creator_id =?) = 1 and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit)
|
||||
# @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count
|
||||
# else
|
||||
# project_org_ids = "(" + project_org_ids.join(',') + ")"
|
||||
# @orgs_not_in_project = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit)
|
||||
# @org_count = Organization.where("id not in #{project_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count
|
||||
# end
|
||||
@orgs_page = Paginator.new @org_count, limit,params[:page]
|
||||
@no_roll_hint = params[:hint_flag]
|
||||
#render :json => {:orgs => @orgs_not_in_project, :count => @org_count}.to_json
|
||||
|
@ -202,6 +203,8 @@ class ProjectsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 注意:修改该方法的时候注意同步修改forked方法
|
||||
# forked方法也会创建项目
|
||||
def create
|
||||
unless User.current.login?
|
||||
redirect_to signin_url
|
||||
|
@ -221,6 +224,11 @@ class ProjectsController < ApplicationController
|
|||
#unless User.current.admin?
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
# project's score
|
||||
if ProjectScore.where("project_id=?", @project.id).first.nil?
|
||||
ProjectScore.create(:project_id => @project.id, :score => false)
|
||||
end
|
||||
# end
|
||||
project_info = ProjectInfo.new(:user_id => User.current.id, :project_id => @project.id)
|
||||
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => @project.id)
|
||||
Rails.logger.debug "UserGrade created: #{user_grades.to_json}"
|
||||
|
@ -511,6 +519,14 @@ class ProjectsController < ApplicationController
|
|||
def edit
|
||||
end
|
||||
|
||||
def set_public_or_private
|
||||
@project = Project.find(params[:id])
|
||||
if @project.is_public?
|
||||
@project.update_attribute(:is_public, 0)
|
||||
else
|
||||
@project.update_attribute(:is_public, 1)
|
||||
end
|
||||
end
|
||||
# by young
|
||||
# include CoursesHelper
|
||||
def member
|
||||
|
|
|
@ -122,6 +122,9 @@ class RepositoriesController < ApplicationController
|
|||
if project.save
|
||||
r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
|
||||
m = Member.new(:user => User.current, :roles => [r])
|
||||
if ProjectScore.where("project_id=?", project.id).first.nil?
|
||||
ProjectScore.create(:project_id => project.id, :score => false)
|
||||
end
|
||||
project_info = ProjectInfo.new(:user_id => User.current.id, :project_id => project.id)
|
||||
user_grades = UserGrade.create(:user_id => User.current.id, :project_id => project.id)
|
||||
Rails.logger.debug "UserGrade created: #{user_grades.to_json}"
|
||||
|
@ -344,20 +347,18 @@ update
|
|||
#Modified by young
|
||||
# (show_error_not_found; return) unless @entries
|
||||
g = Gitlab.client
|
||||
|
||||
# count = 0
|
||||
# (0..100).each do |page|
|
||||
# if g.commits(@project.gpid,:page => page).count == 0
|
||||
# break
|
||||
# else
|
||||
# count = count + g.commits(@project.gpid,:page => page).count
|
||||
# end
|
||||
# end
|
||||
|
||||
@changesets = g.commits(@project.gpid, :ref_name => @rev)
|
||||
# @changesets = @repository.latest_changesets(@path, @rev)
|
||||
# @changesets_count = @repository.latest_changesets(@path, @rev).count
|
||||
@changesets_all_count = @project.gpid.nil? ? 0 : g.commits_total_count(@project.gpid).count
|
||||
@changesets_all_count = @project.gpid.nil? ? 0 : g.project(@project.gpid).commit_count
|
||||
# 访问该页面的是会后则刷新
|
||||
if @project.project_score.nil?
|
||||
ProjectScore.create(:project_id => @project.id, :score => false)
|
||||
end
|
||||
if @changesets_all_count != @project.project_score.changeset_num && @changesets_all_count != 0
|
||||
update_commits_count(@project, @changesets_all_count)
|
||||
end
|
||||
# end
|
||||
@changesets_latest_coimmit = @changesets[0]
|
||||
@properties = @repository.properties(@path, @rev)
|
||||
@repositories = @project.repositories
|
||||
|
@ -583,6 +584,10 @@ update
|
|||
end
|
||||
|
||||
private
|
||||
# 更新项目统计数
|
||||
def update_commits_count project, count
|
||||
project.project_score.update_attribute(:changeset_num, count)
|
||||
end
|
||||
|
||||
def find_repository
|
||||
@repository = Repository.find(params[:id])
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
class ShieldActivitiesController < ApplicationController
|
||||
def create
|
||||
if params[:org_id]
|
||||
if params[:project_id]
|
||||
ShieldActivity.create(:container_type => 'Organization', :container_id => params[:org_id].to_i, :shield_type => 'Project', :shield_id => params[:project_id].to_i)
|
||||
elsif params[:course_id]
|
||||
ShieldActivity.create(:container_type => 'Organization', :container_id => params[:org_id].to_i, :shield_type => 'Course', :shield_id => params[:course_id].to_i)
|
||||
end
|
||||
elsif params[:user_id]
|
||||
if params[:project_id]
|
||||
ShieldActivity.create(:container_type => 'User', :container_id => params[:user_id].to_i, :shield_type => 'Project', :shield_id => params[:project_id].to_i)
|
||||
elsif params[:course_id]
|
||||
ShieldActivity.create(:container_type => 'User', :container_id => params[:user_id].to_i, :shield_type => 'Course', :shield_id => params[:course_id].to_i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def show_acts
|
||||
if params[:org_id]
|
||||
if params[:project_id]
|
||||
ShieldActivity.where("container_type='Organization' and container_id=#{params[:org_id].to_i} and shield_type='Project' and shield_id=#{params[:project_id]}").each do |act|
|
||||
act.destroy
|
||||
end
|
||||
# ShieldActivity.create(:container_type => 'Organization', :container_id => params[:org_id].to_i, :shield_type => 'Project', :shield_id => params[:project_id].to_i)
|
||||
elsif params[:course_id]
|
||||
ShieldActivity.where("container_type='Organization' and container_id=#{params[:org_id].to_i} and shield_type='Course' and shield_id=#{params[:course_id]}").each do |act|
|
||||
act.destroy
|
||||
end
|
||||
end
|
||||
elsif params[:user_id]
|
||||
if params[:project_id]
|
||||
ShieldActivity.where("container_type='User' and container_id=#{params[:user_id].to_i} and shield_type='Project' and shield_id=#{params[:project_id]}").each do |act|
|
||||
act.destroy
|
||||
end
|
||||
# ShieldActivity.create(:container_type => 'Organization', :container_id => params[:org_id].to_i, :shield_type => 'Project', :shield_id => params[:project_id].to_i)
|
||||
elsif params[:course_id]
|
||||
ShieldActivity.where("container_type='User' and container_id=#{params[:user_id].to_i} and shield_type='Course' and shield_id=#{params[:course_id]}").each do |act|
|
||||
act.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,6 +1,7 @@
|
|||
class StudentWorkController < ApplicationController
|
||||
layout "base_courses"
|
||||
include StudentWorkHelper
|
||||
include ApplicationHelper
|
||||
require 'bigdecimal'
|
||||
require "base64"
|
||||
before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project,:search_course_students]
|
||||
|
@ -259,16 +260,10 @@ class StudentWorkController < ApplicationController
|
|||
stu_project.save
|
||||
end
|
||||
end
|
||||
course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework.id}").first
|
||||
if course_activity
|
||||
course_activity.updated_at = Time.now
|
||||
course_activity.save
|
||||
end
|
||||
user_activity = UserActivity.where("act_type='HomeworkCommon' and act_id =#{@homework.id}").first
|
||||
if user_activity
|
||||
user_activity.updated_at = Time.now
|
||||
user_activity.save
|
||||
end
|
||||
update_course_activity(@homework.class,@homework.id)
|
||||
update_user_activity(@homework.class,@homework.id)
|
||||
update_org_activity(@homework.class,@homework.id)
|
||||
|
||||
course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"new",:course_message_id=>student_work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录
|
||||
course_message.save
|
||||
|
||||
|
@ -689,7 +684,7 @@ class StudentWorkController < ApplicationController
|
|||
if !params[:name].nil?
|
||||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
@project_ids = Project.where("user_id = #{User.current.id} and name like '#{condition}'")
|
||||
@project_ids = Project.visible.where("user_id = #{User.current.id} and name like '#{condition}'")
|
||||
@first = params[:first].to_i
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
class SubfieldSubdomainDirsController < ApplicationController
|
||||
def update
|
||||
@org_subfield = OrgSubfield.find(params[:org_subfield_id])
|
||||
if @org_subfield.subfield_subdomain_dir
|
||||
@org_subfield.subfield_subdomain_dir.update_attribute(:name, :params[:sub_dir_name])
|
||||
else
|
||||
SubfieldSubdomainDir.create(:org_subfield_id => @org_subfield.id, :name => params[:sub_dir_name])
|
||||
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)
|
||||
|
@ -746,14 +751,34 @@ 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('created_on DESC')
|
||||
@jour_count = jours.count
|
||||
@jour = jours.limit(10).offset(@page * 10)
|
||||
when "private"
|
||||
jours = @user.journals_for_messages.where('m_parent_id IS NULL and private = 1').order('created_on DESC')
|
||||
@jour_count = jours.count
|
||||
@jour = jours.limit(10).offset(@page * 10)
|
||||
else
|
||||
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@jour_count = jours.count
|
||||
@jour = jours.limit(10).offset(@page * 10)
|
||||
end
|
||||
else
|
||||
jours = @user.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||
@jour_count = jours.count
|
||||
@jour = jours.limit(10).offset(@page * 10)
|
||||
end
|
||||
@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
|
||||
|
@ -967,9 +992,11 @@ class UsersController < ApplicationController
|
|||
params[:course_id], 'JoinCourseRequest', User.current.id, @user.id, false)
|
||||
join_course_messages.update_all(:viewed => true)
|
||||
end
|
||||
shield_project_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
|
||||
shield_course_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
user_project_ids = @user.projects.visible.empty? ? "(-1)" : "(" + @user.projects.visible.map{|project| project.id}.join(",") + ")"
|
||||
user_course_ids = @user.courses.visible.empty? ? "(-1)" : "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
|
||||
user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
|
||||
user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")"
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
||||
project_types = "('Message','Issue','ProjectCreateInfo')"
|
||||
principal_types = "JournalsForMessage"
|
||||
|
@ -1751,6 +1778,48 @@ 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|
|
||||
if Project.find(project_id).news.map(&:id).exclude?(news.id)
|
||||
project_news = News.create(:project_id => project_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now)
|
||||
news.attachments.each do |attach|
|
||||
project_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
||||
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
||||
:is_public => attach.is_public, :quotes => 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
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 change_org_subfield
|
||||
|
||||
end
|
||||
|
@ -2100,9 +2169,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'
|
||||
@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'
|
||||
@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
|
||||
|
|
|
@ -57,21 +57,11 @@ class WordsController < ApplicationController
|
|||
@jfm = add_reply_adapter options
|
||||
@save_succ = true if @jfm.errors.empty?
|
||||
if @save_succ
|
||||
course_activity = CourseActivity.where("course_act_type='JournalsForMessage' and course_act_id =#{parent_id}").first
|
||||
if course_activity
|
||||
course_activity.updated_at = Time.now
|
||||
course_activity.save
|
||||
end
|
||||
principal_activity = PrincipalActivity.where("principal_act_type='JournalsForMessage' and principal_act_id =#{parent_id}").first
|
||||
if principal_activity
|
||||
principal_activity.updated_at = Time.now
|
||||
principal_activity.save
|
||||
end
|
||||
user_activity = UserActivity.where("act_type='JournalsForMessage' and act_id =#{parent_id}").first
|
||||
if user_activity
|
||||
user_activity.updated_at = Time.now
|
||||
user_activity.save
|
||||
end
|
||||
update_course_activity('JournalsForMessage',parent_id)
|
||||
update_user_activity('JournalsForMessage',parent_id)
|
||||
update_forge_activity('JournalsForMessage',parent_id)
|
||||
update_org_activity('JournalsForMessage',parent_id)
|
||||
update_principal_activity('JournalsForMessage',parent_id)
|
||||
end
|
||||
respond_to do |format|
|
||||
# format.html {
|
||||
|
@ -235,8 +225,12 @@ 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
|
||||
@user.add_jour(User.current, params[:new_form][:user_message])
|
||||
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][:content], :reply_id => 0, :status => true, :is_readed => false, :private => 1)
|
||||
else
|
||||
@user.add_jour(User.current, params[:new_form][:content])
|
||||
end
|
||||
end
|
||||
redirect_to feedback_path(@user)
|
||||
else
|
||||
|
@ -274,16 +268,9 @@ class WordsController < ApplicationController
|
|||
update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
|
||||
end
|
||||
|
||||
course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework_common.id}").first
|
||||
if course_activity
|
||||
course_activity.updated_at = Time.now
|
||||
course_activity.save
|
||||
end
|
||||
user_activity = UserActivity.where("act_type='HomeworkCommon' and act_id =#{@homework_common.id}").first
|
||||
if user_activity
|
||||
user_activity.updated_at = Time.now
|
||||
user_activity.save
|
||||
end
|
||||
update_course_activity(@homework_common.class,@homework_common.id)
|
||||
update_user_activity(@homework_common.class,@homework_common.id)
|
||||
update_org_activity(@homework_common.class,@homework_common.id)
|
||||
respond_to do |format|
|
||||
format.js{
|
||||
@user_activity_id = params[:user_activity_id]
|
||||
|
|
|
@ -49,6 +49,22 @@ module ApplicationHelper
|
|||
end
|
||||
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
|
||||
end
|
||||
|
||||
# 获取组织成员中文名字
|
||||
def get_org_member_role_name member
|
||||
case member.roles[0].name
|
||||
|
@ -59,6 +75,19 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
|
||||
# 判断组织左侧展开或者隐藏
|
||||
def is_hide_org_left obj
|
||||
if obj.nil?
|
||||
return true
|
||||
else
|
||||
if obj.hide == 0
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Time 2015-03-24 16:38:05
|
||||
# Author lizanle
|
||||
# Description after save后需要进行资源记录的更新
|
||||
|
@ -940,7 +969,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
|
||||
|
@ -1977,6 +2016,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
|
||||
|
@ -2768,4 +2809,53 @@ int main(int argc, char** argv){
|
|||
ss.html_safe
|
||||
end
|
||||
|
||||
#课程动态的更新
|
||||
def update_course_activity type, id
|
||||
course_activity = CourseActivity.where("course_act_type=? and course_act_id =?", type.to_s, id).first
|
||||
if course_activity
|
||||
course_activity.updated_at = Time.now
|
||||
course_activity.save
|
||||
end
|
||||
end
|
||||
#首页动态更新
|
||||
def update_user_activity type, id
|
||||
user_activity = UserActivity.where("act_type=? and act_id =?", type.to_s, id).first
|
||||
if user_activity
|
||||
user_activity.updated_at = Time.now
|
||||
user_activity.save
|
||||
end
|
||||
end
|
||||
#项目动态更新
|
||||
def update_forge_activity type, id
|
||||
forge_activity = ForgeActivity.where("forge_act_type=? and forge_act_id=?", type.to_s, id).first
|
||||
if forge_activity
|
||||
forge_activity.updated_at = Time.now
|
||||
forge_activity.save
|
||||
end
|
||||
end
|
||||
#组织动态更新
|
||||
def update_org_activity type , id
|
||||
org_activity = OrgActivity.where("org_act_type=? and org_act_id =?", type.to_s, id).first
|
||||
if org_activity
|
||||
org_activity.updated_at = Time.now
|
||||
org_activity.save
|
||||
end
|
||||
end
|
||||
#个人动态更新
|
||||
def update_principal_activity type, id
|
||||
principal_activity = PrincipalActivity.where("principal_act_type=? and principal_act_id =?", type.to_s, id).first
|
||||
if principal_activity
|
||||
principal_activity.updated_at = Time.now
|
||||
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
|
||||
|
|
|
@ -12,6 +12,44 @@ module CoursesHelper
|
|||
#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
|
||||
# 过滤条件:精品课程、本身不在搜索范围
|
||||
e_courses = Course.where("is_excellent =? and id in (?)",1,a_courses.flatten.uniq).where("id !=?",current_course.id)
|
||||
e_courses
|
||||
end
|
||||
|
||||
# 判断精品课程是否可见,非课程成员无法查看私有课程
|
||||
def visible_excellent_course obj
|
||||
# if course.is_pu
|
||||
end
|
||||
|
||||
# 返回x项目成员数量,即roles表中定义的所有成员
|
||||
def projectCount project
|
||||
#searchCountByRoles project, AllPeople
|
||||
|
@ -507,8 +545,10 @@ module CoursesHelper
|
|||
#课程实践年份下拉框
|
||||
def course_time_option year
|
||||
type = []
|
||||
month = Time.now.month
|
||||
now_year = year.nil? ? Time.now.year : (Time.now.year <= year ? Time.now.year : year)
|
||||
for i in (now_year..now_year + 10)
|
||||
year = month < 3 ? now_year - 1 : now_year
|
||||
for i in (year..year + 10)
|
||||
option = []
|
||||
option << i
|
||||
option << i
|
||||
|
|
|
@ -20,14 +20,6 @@ module ProjectScoreHelper
|
|||
project.documents.count
|
||||
end
|
||||
|
||||
#代码提交数量
|
||||
def changesets_num project
|
||||
g = Gitlab.client
|
||||
project.gpid.nil? ? 0 : g.commits_total_count(project.gpid).count
|
||||
# # commits_total_count(project.gpid)
|
||||
# project.changesets.count
|
||||
end
|
||||
|
||||
#讨论区帖子数量
|
||||
def board_message_num project
|
||||
board_message_count = 0
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
module ShieldActivitiesHelper
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
module SubfieldSubdomainDirsHelper
|
||||
end
|
|
@ -85,6 +85,11 @@ module UsersHelper
|
|||
end
|
||||
end
|
||||
|
||||
def link_to_user_version(version, options = {})
|
||||
return '' unless version && version.is_a?(Version)
|
||||
link_to_if version.visible?, format_version_name(version), { :controller => 'versions', :action => 'show', :id => version }, :class => " f16 fb c_dblue "
|
||||
end
|
||||
|
||||
# 统计未读消息数
|
||||
def unviewed_message(user)
|
||||
course_count = CourseMessage.where("user_id =? and viewed =?", user, 0).count
|
||||
|
@ -591,7 +596,7 @@ module UsersHelper
|
|||
option << "请选择发布作业的课程"
|
||||
option << -1
|
||||
type << option
|
||||
user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").select{|c| user.allowed_to?(:as_teacher,c)}.each do |course|
|
||||
user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").select{|c| user.allowed_to?(:as_teacher,c)}.each do |course|
|
||||
option = []
|
||||
option << course.name+"("+course.time.to_s+course.term+")"
|
||||
option << course.id
|
||||
|
|
|
@ -90,7 +90,7 @@ class Attachment < ActiveRecord::Base
|
|||
before_save :files_to_final_location,:act_as_course_activity
|
||||
after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index
|
||||
after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index
|
||||
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index
|
||||
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count
|
||||
|
||||
# add by nwb
|
||||
# 获取所有可公开的资源文件列表
|
||||
|
@ -617,6 +617,7 @@ class Attachment < ActiveRecord::Base
|
|||
self.__elasticsearch__.index_document
|
||||
end
|
||||
end
|
||||
|
||||
def update_attachment_ealasticsearch_index
|
||||
if self.is_public == 1 && ( ((self.container_type == 'Project' or self.container_type == 'Version') && Project.find(self.container_id).is_public == 1) ||
|
||||
( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) ||
|
||||
|
@ -632,12 +633,20 @@ class Attachment < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def delete_attachment_ealasticsearch_index
|
||||
begin
|
||||
self.__elasticsearch__.delete_document
|
||||
rescue => e
|
||||
end
|
||||
end
|
||||
|
||||
def decrease_attchments_count
|
||||
if self.container_type == "Project" && !self.project.project_score.nil?
|
||||
aatach_count = self.container.project_score.attach_num - 1
|
||||
self.container.project_score.update_attribute(:attach_num, aatach_count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Delete the previous articles index in Elasticsearch
|
||||
|
|
|
@ -17,6 +17,7 @@ class BlogComment < ActiveRecord::Base
|
|||
safe_attributes 'title', 'content',"sticky", "locked"
|
||||
|
||||
after_save :add_user_activity
|
||||
after_update :update_activity
|
||||
before_destroy :destroy_user_activity
|
||||
|
||||
scope :like, lambda {|arg|
|
||||
|
@ -28,6 +29,15 @@ class BlogComment < ActiveRecord::Base
|
|||
end
|
||||
}
|
||||
|
||||
#动态更新
|
||||
def update_activity
|
||||
user_activity = UserActivity.where("act_type='BlogComment' and act_id =?",self.id).first
|
||||
if user_activity
|
||||
user_activity.updated_at = Time.now
|
||||
user_activity.save
|
||||
end
|
||||
end
|
||||
|
||||
#在个人动态里面增加当前动态
|
||||
def add_user_activity
|
||||
if self.parent_id.nil? #只有发博文才插入动态
|
||||
|
|
|
@ -144,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
|
||||
|
@ -383,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)
|
||||
|
@ -404,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
|
||||
|
@ -427,8 +449,12 @@ class Course < ActiveRecord::Base
|
|||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
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,18 @@ 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"
|
||||
name = Redmine::Configuration['course_message_lead_subject']
|
||||
content = Redmine::Configuration['course_message_lead_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)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,6 +26,7 @@ class HomeworkCommon < ActiveRecord::Base
|
|||
:author => :author,
|
||||
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
|
||||
after_create :act_as_activity, :send_mail, :act_as_course_message
|
||||
after_update :update_activity
|
||||
after_save :act_as_course_activity
|
||||
after_destroy :delete_kindeditor_assets
|
||||
|
||||
|
@ -60,7 +61,12 @@ class HomeworkCommon < 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
|
||||
#删除对应的图片
|
||||
def delete_kindeditor_assets
|
||||
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON
|
||||
|
|
|
@ -19,6 +19,7 @@ class Issue < ActiveRecord::Base
|
|||
include Redmine::SafeAttributes
|
||||
include Redmine::Utils::DateCalculation
|
||||
include UserScoreHelper
|
||||
include ApplicationHelper
|
||||
belongs_to :project,:touch=> true
|
||||
belongs_to :tracker
|
||||
belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'
|
||||
|
@ -83,9 +84,9 @@ class Issue < ActiveRecord::Base
|
|||
attr_reader :current_journal
|
||||
|
||||
# fq
|
||||
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message, :act_as_at_message
|
||||
after_update :be_user_score
|
||||
after_destroy :down_user_score
|
||||
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message, :act_as_at_message, :add_issues_count
|
||||
after_update :be_user_score,:update_activity
|
||||
after_destroy :down_user_score, :decrease_issues_count
|
||||
# after_create :be_user_score
|
||||
# end
|
||||
|
||||
|
@ -126,6 +127,12 @@ class Issue < ActiveRecord::Base
|
|||
after_save :after_create_from_copy
|
||||
after_destroy :update_parent_attributes
|
||||
|
||||
#动态的更新
|
||||
def update_activity
|
||||
update_user_activity(self.class, self.id)
|
||||
update_forge_activity(self.class, self.id)
|
||||
update_org_activity(self.class, self.id)
|
||||
end
|
||||
|
||||
# fq
|
||||
def act_as_activity
|
||||
|
@ -165,6 +172,22 @@ class Issue < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# 创建issue的时候,issues_count加1
|
||||
def add_issues_count
|
||||
unless self.project.project_score.nil?
|
||||
issue_count = self.project.project_score.issue_num + 1
|
||||
self.project.project_score.update_attribute(:issue_num, issue_count)
|
||||
end
|
||||
end
|
||||
|
||||
# 删除issue的时候,issues_count减1
|
||||
def decrease_issues_count
|
||||
unless self.project.project_score.nil?
|
||||
issue_count = self.project.project_score.issue_num - 1
|
||||
self.project.project_score.update_attribute(:issue_num, issue_count)
|
||||
end
|
||||
end
|
||||
|
||||
# 更新缺陷
|
||||
#def act_as_forge_message_update
|
||||
# unless self.author_id == self.assigned_to_id
|
||||
|
|
|
@ -48,14 +48,14 @@ class Journal < ActiveRecord::Base
|
|||
:conditions => "#{Journal.table_name}.journalized_type = 'Issue' AND" +
|
||||
"(#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"}
|
||||
|
||||
before_create :split_private_notes
|
||||
before_create :split_private_notes, :add_journals_count
|
||||
|
||||
# fq
|
||||
after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message
|
||||
# end
|
||||
#after_destroy :down_user_score
|
||||
#before_save :be_user_score
|
||||
after_destroy :down_user_score
|
||||
after_destroy :down_user_score, :decrease_issues_journal_count
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
user = args.shift || User.current
|
||||
|
@ -214,4 +214,20 @@ class Journal < ActiveRecord::Base
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
# 减少留言数量统计
|
||||
def decrease_issues_journal_count
|
||||
unless self.issue.project.nil?
|
||||
project = self.issue.project
|
||||
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num - 1)
|
||||
end
|
||||
end
|
||||
|
||||
# issue留言总数更新
|
||||
def add_journals_count
|
||||
if !self.issue.project.nil? && self.journalized_type == "Issue" && !self.issue.project.project_score.nil?
|
||||
project = self.issue.project
|
||||
project.project_score.update_attribute(:issue_journal_num, project.project_score.issue_journal_num + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,8 +15,9 @@ class JournalsForMessage < ActiveRecord::Base
|
|||
"m_parent_id", # 留言信息的父留言id
|
||||
"is_readed", # 留言是否已读
|
||||
"m_reply_count", # 留言的回复数量
|
||||
"m_reply_id" # 回复某留言的留言id(a留言回复了b留言,这是b留言的id)
|
||||
"is_comprehensive_evaluation" # 1 教师评论、2 匿评、3 留言
|
||||
"m_reply_id" , # 回复某留言的留言id(a留言回复了b留言,这是b留言的id)
|
||||
"is_comprehensive_evaluation", # 1 教师评论、2 匿评、3 留言
|
||||
"private"
|
||||
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
|
||||
after_destroy :delete_kindeditor_assets
|
||||
belongs_to :project,
|
||||
|
@ -69,12 +70,21 @@ 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_destroy :reset_counters!
|
||||
after_save :be_user_score
|
||||
after_destroy :down_user_score
|
||||
|
||||
# default_scope { where('m_parent_id IS NULL') }
|
||||
|
||||
#动态的更新
|
||||
def update_activity
|
||||
update_course_activity(self.class, self.id)
|
||||
update_user_activity(self.class, self.id)
|
||||
update_forge_activity(self.class, self.id)
|
||||
update_org_activity(self.class, self.id)
|
||||
update_principal_activity(self.class, self.id)
|
||||
end
|
||||
def self.create_by_user? user
|
||||
if user.anonymous?
|
||||
return false
|
||||
|
|
|
@ -379,6 +379,16 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
end
|
||||
|
||||
# issue截止时间提醒
|
||||
def issue_due_date(issue, 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:
|
||||
|
|
|
@ -36,6 +36,7 @@ class Message < ActiveRecord::Base
|
|||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# 课程动态
|
||||
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
|
||||
|
||||
# end
|
||||
# 课程/项目 消息
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
|
@ -74,9 +75,9 @@ class Message < ActiveRecord::Base
|
|||
validates_length_of :subject, :maximum => 255
|
||||
validate :cannot_reply_to_locked_topic, :on => :create
|
||||
|
||||
after_create :add_author_as_watcher, :reset_counters!
|
||||
after_update :update_messages_board
|
||||
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets
|
||||
after_create :add_author_as_watcher, :reset_counters!, :add_boards_count
|
||||
after_update :update_messages_board, :update_activity
|
||||
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count
|
||||
|
||||
after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, :act_as_at_message
|
||||
#before_save :be_user_score
|
||||
|
@ -125,6 +126,34 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# 发帖精辟更新发帖总数
|
||||
def add_boards_count
|
||||
if self.project && !project.project_score.nil?
|
||||
# 讨论区
|
||||
if self.parent_id.nil?
|
||||
count = self.project.project_score.board_num + 1
|
||||
self.project.project_score.update_attribute(:board_num, count)
|
||||
else # 回复
|
||||
count = self.project.project_score.board_message_num + 1
|
||||
self.project.project_score.update_attribute(:board_message_num, count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少
|
||||
def decrease_boards_count
|
||||
if self.project && !project.project_score.nil?
|
||||
# 讨论区
|
||||
if self.parent_id.nil?
|
||||
count = self.project.project_score.board_num - 1
|
||||
self.project.project_score.update_attribute(:board_num, count)
|
||||
else # 回复
|
||||
count = self.project.project_score.board_message_num - 1
|
||||
self.project.project_score.update_attribute(:board_message_num, count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def reset_counters!
|
||||
if parent && parent.id
|
||||
Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id})
|
||||
|
@ -180,6 +209,13 @@ class Message < ActiveRecord::Base
|
|||
def get_notify_is_read()
|
||||
return @notify_is_read
|
||||
end
|
||||
#动态的更新
|
||||
def update_activity
|
||||
update_course_activity(self.class, self.id)
|
||||
update_user_activity(self.class, self.id)
|
||||
update_forge_activity(self.class, self.id)
|
||||
update_org_activity(self.class, self.id)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -55,9 +56,9 @@ class News < ActiveRecord::Base
|
|||
:author_key => :author_id
|
||||
acts_as_watchable
|
||||
|
||||
after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail
|
||||
|
||||
after_destroy :delete_kindeditor_assets
|
||||
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, :delete_org_activities
|
||||
|
||||
scope :visible, lambda {|*args|
|
||||
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args))
|
||||
|
@ -68,6 +69,14 @@ class News < ActiveRecord::Base
|
|||
}
|
||||
safe_attributes 'title', 'summary', 'description', 'sticky'
|
||||
|
||||
#动态的更新
|
||||
def update_activity
|
||||
update_course_activity(self.class, self.id)
|
||||
update_user_activity(self.class, self.id)
|
||||
update_org_activity(self.class, self.id)
|
||||
update_forge_activity(self.class, self.id)
|
||||
end
|
||||
|
||||
def visible?(user=User.current)
|
||||
!user.nil? && user.allowed_to?(:view_news, project)
|
||||
end
|
||||
|
@ -107,10 +116,24 @@ class News < ActiveRecord::Base
|
|||
end
|
||||
|
||||
private
|
||||
def add_news_count
|
||||
if self.project && !self.project.project_score.nil?
|
||||
count = self.project.project_score.news_num + 1
|
||||
self.project.project_score.update_attribute(:news_num, count)
|
||||
end
|
||||
end
|
||||
|
||||
def decrease_news_count
|
||||
if self.project && !self.project.project_score.nil?
|
||||
count = self.project.project_score.news_num - 1
|
||||
self.project.project_score.update_attribute(:news_num, count)
|
||||
end
|
||||
end
|
||||
|
||||
def add_author_as_watcher
|
||||
Watcher.create(:watchable => self, :user => author)
|
||||
end
|
||||
|
||||
## fq
|
||||
def act_as_activity
|
||||
self.acts << Activity.new(:user_id => self.author_id)
|
||||
|
@ -165,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
|
|
@ -1,6 +1,7 @@
|
|||
class OrgDocumentComment < ActiveRecord::Base
|
||||
attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title,:sticky,:locked
|
||||
include Redmine::SafeAttributes
|
||||
include ApplicationHelper
|
||||
belongs_to :organization
|
||||
belongs_to :creator, :class_name => 'User', :foreign_key => 'creator_id'
|
||||
has_many :editor_of_documents, :dependent => :destroy
|
||||
|
@ -8,6 +9,16 @@ class OrgDocumentComment < ActiveRecord::Base
|
|||
acts_as_attachable
|
||||
has_many :org_acts, :class_name => 'OrgActivity',:as =>:org_act ,:dependent => :destroy
|
||||
after_create :document_save_as_org_activity
|
||||
after_update :update_activity
|
||||
|
||||
#动态的更新
|
||||
def update_activity
|
||||
org_activity = OrgActivity.where("org_act_type='OrgDocumentComment' and org_act_id =?", id).first
|
||||
if org_activity
|
||||
org_activity.updated_at = Time.now
|
||||
org_activity.save
|
||||
end
|
||||
end
|
||||
|
||||
def document_save_as_org_activity
|
||||
if(self.parent().nil?)
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
class OrgMessage < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
belongs_to :organization
|
||||
has_many :message_alls, :as => :message, :dependent => :destroy
|
||||
validates :message_type, :presence => true
|
||||
validates :message_id, :presence => true
|
||||
validates :organization_id, :presence => true
|
||||
after_create :add_user_message
|
||||
|
||||
def add_user_message
|
||||
if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
|
||||
self.message_alls << MessageAll.new(:user_id => self.user_id)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,10 +1,12 @@
|
|||
class OrgSubfield < ActiveRecord::Base
|
||||
belongs_to :organization, :foreign_key => :organization_id
|
||||
has_one :subfield_subdomain_dir,:dependent => :destroy
|
||||
has_many :org_document_comments, :dependent => :destroy
|
||||
has_many :files
|
||||
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
|
||||
# 创建资源栏目讨论区
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
class Poll < ActiveRecord::Base
|
||||
#attr_accessible :closed_at, :polls_group_id, :polls_name, :polls_status, :polls_type, :published_at, :user_id
|
||||
include Redmine::SafeAttributes
|
||||
include ApplicationHelper
|
||||
|
||||
belongs_to :user
|
||||
has_many :poll_questions, :dependent => :destroy,:order => "#{PollQuestion.table_name}.question_number"
|
||||
|
@ -14,7 +15,7 @@ class Poll < ActiveRecord::Base
|
|||
# 课程消息
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
after_save :act_as_course_message, :act_as_activity, :act_as_course_activity
|
||||
|
||||
after_update :update_activity
|
||||
acts_as_event :title => Proc.new {|o| "#{l(:label_course_poll)}: #{o.polls_name}" },
|
||||
:description => :polls_description,
|
||||
:datetime => :published_at,
|
||||
|
@ -32,6 +33,13 @@ class Poll < ActiveRecord::Base
|
|||
self.acts << Activity.new(:user_id => self.user_id)
|
||||
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
|
||||
|
||||
#课程动态公共表记录
|
||||
def act_as_course_activity
|
||||
if self.polls_type == "Course"
|
||||
|
|
|
@ -1223,6 +1223,7 @@ class Project < ActiveRecord::Base
|
|||
self.__elasticsearch__.index_document
|
||||
end
|
||||
end
|
||||
|
||||
def update_project_ealasticsearch_index
|
||||
if self.is_public #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
|
||||
begin
|
||||
|
@ -1238,11 +1239,11 @@ class Project < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
def delete_project_ealasticsearch_index
|
||||
begin
|
||||
self.__elasticsearch__.delete_document
|
||||
rescue => e
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
class ShieldActivity < ActiveRecord::Base
|
||||
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
class SubfieldSubdomainDir < ActiveRecord::Base
|
||||
# attr_accessible :title, :body
|
||||
belongs_to :org_subfield
|
||||
end
|
|
@ -409,7 +409,7 @@ class User < Principal
|
|||
|
||||
def get_at_show_name
|
||||
name = show_name
|
||||
name = "#{name} #{self.login}" if name != self.login
|
||||
(name != self.login) ? "#{name} #{self.login}" : name
|
||||
end
|
||||
|
||||
#added by nie
|
||||
|
|
|
@ -193,6 +193,7 @@ class CoursesService
|
|||
@course.extra = 'course' + DateTime.parse(Time.now.to_s).strftime('%Y-%m-%d_%H-%M-%S').to_s
|
||||
@course.send(:safe_attributes=, params[:course], current_user)
|
||||
#@course.safe_attributes(current_user,params[:course])
|
||||
@course.password = params[:course][:password]
|
||||
@course.tea_id = current_user.id
|
||||
@course.term = params[:term]
|
||||
@course.time = params[:time]
|
||||
|
|
|
@ -205,7 +205,7 @@
|
|||
<div class="loginContent">
|
||||
<div class="loginLeft">
|
||||
<div class="loginLogo"><img src="images/trustie_big_log.png" width="100" height="88" alt="Trustie Logo" /></div>
|
||||
<div class="loginInro"> 欢迎加入Trustie高校创新实践社区!老师、学生和科研人员可以在此开展各种在线协同学习、协同作业、协同开发等活动。<br/><br/> Trustie是在中国推行大规模开放在线研究模式(MOORE)的支撑平台。</div>
|
||||
<div class="loginInro"> 欢迎加入Trustie创新实践社区!在这里,您的创新意识和创新潜力将得到充分发挥!目前已有超过200所高校和科研机构在平台中开展在线协同开发、协同学习和协同研究。<br/><br/> Trustie社区的理想是:让创新过程变的更美好!</div>
|
||||
</div>
|
||||
<div class="loginRight">
|
||||
<div id="loginInBox">
|
||||
|
@ -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;">
|
||||
用户身份
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
<% if activity.attachments.any? %>
|
||||
<% activity.attachments.each do |attachment| %>
|
||||
<div class="break_word">
|
||||
<span class="fl">
|
||||
<span title="<%= attachment.filename %>" id="attachment_<%=attachment.id %>">
|
||||
<%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw400', :download => true -%>
|
||||
</span>
|
||||
</span>
|
||||
<span class="postAttSize">(
|
||||
<%= number_to_human_size attachment.filesize %>)
|
||||
</span>
|
||||
<span class="author" title="<%= attachment.author%>">
|
||||
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "c_orange" %>,
|
||||
<%= format_time(attachment.created_on) %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -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',
|
||||
|
|
|
@ -6,8 +6,8 @@ $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@atta
|
|||
:remote => true, :class => "postOptionLink", :method => :post) %>");
|
||||
|
||||
<% else %>
|
||||
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
|
||||
:remote=>true,:class=>"f_l re_open",:method => :post) %>");
|
||||
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
|
||||
:remote=>true,:class=>"postOptionLink",:method => :post) %>");
|
||||
<% end %>
|
||||
<% if @attachment.is_public? %>
|
||||
$("#image_private_<%= @attachment.id%>").html('')
|
||||
|
|
|
@ -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 %>
|
||||
|
||||
|
|
|
@ -4,5 +4,5 @@ showModal('ajax-modal', '500px');
|
|||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
|
@ -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},:method=>'PUT',
|
||||
<%= form_for @article, :url =>{:controller=>'blog_comments',:action => 'update',:user_id=>@user.id , :blog_id => @article.id, :is_homepage => params[:is_homepage]},: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 %>
|
||||
|
|
|
@ -6,19 +6,3 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(r
|
|||
//init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity');
|
||||
<% end %>
|
||||
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
|
||||
showNormalImage('activity_description_<%= @user_activity_id %>');
|
||||
if($("#intro_content_<%= @user_activity_id %>").height() > 810) {
|
||||
$("#intro_content_show_<%= @user_activity_id %>").show();
|
||||
}
|
||||
$("#intro_content_show_<%= @user_activity_id %>").click(function(){
|
||||
$("#activity_description_<%= @user_activity_id %>").toggleClass("maxh360");
|
||||
$("#activity_description_<%= @user_activity_id%>").toggleClass("lh18");
|
||||
$("#intro_content_show_<%= @user_activity_id %>").hide();
|
||||
$("#intro_content_hide_<%= @user_activity_id %>").show();
|
||||
});
|
||||
$("#intro_content_hide_<%= @user_activity_id %>").click(function(){
|
||||
$("#activity_description_<%= @user_activity_id %>").toggleClass("maxh360");
|
||||
$("#activity_description_<%= @user_activity_id%>").toggleClass("lh18");
|
||||
$("#intro_content_hide_<%= @user_activity_id %>").hide();
|
||||
$("#intro_content_show_<%= @user_activity_id %>").show();
|
||||
});
|
|
@ -58,6 +58,23 @@
|
|||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == @article.author.id %>
|
||||
</li>
|
||||
<li>
|
||||
<% if @article.id == @article.blog.homepage_id %>
|
||||
<%= link_to(
|
||||
l(:button_cancel_homepage),
|
||||
{:controller => 'blogs',:action => 'cancel_homepage',:user_id=>@article.author_id,:id=>@article.blog_id, :article_id => @article.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == @article.blog.author_id %>
|
||||
<% else %>
|
||||
<%= link_to(
|
||||
l(:button_set_homepage),
|
||||
{:controller => 'blogs',:action => 'set_homepage',:user_id=>@article.author_id,:id=>@article.blog_id, :article_id => @article.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == @article.blog.author_id %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -99,9 +116,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%>
|
||||
|
@ -133,7 +159,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},
|
||||
|
@ -158,7 +191,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
<%# end %>
|
||||
<div class="cl"></div>
|
||||
<% if !@article.locked? && User.current.logged?%>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
|
|
|
@ -25,6 +25,23 @@
|
|||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.author.id %>
|
||||
</li>
|
||||
<li>
|
||||
<% if activity.id == activity.blog.homepage_id %>
|
||||
<%= link_to(
|
||||
l(:button_cancel_homepage),
|
||||
{:controller => 'blogs',:action => 'cancel_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.blog.author_id %>
|
||||
<% else %>
|
||||
<%= link_to(
|
||||
l(:button_set_homepage),
|
||||
{:controller => 'blogs',:action => 'set_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.blog.author_id %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -38,6 +55,9 @@
|
|||
<% end %>
|
||||
TO
|
||||
<%= link_to activity.blog.name+" | 博客", user_blogs_path(:user_id=>activity.author_id,:host=>Setting.host_user), :class => "newsBlue ml15 mr5"%>
|
||||
<% if activity.blog.homepage_id and activity.id == activity.blog.homepage_id %>
|
||||
<span class="red_homework_btn_cir ml5">已设为首页</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostTitle hidden m_w530 fl">
|
||||
|
@ -54,30 +74,34 @@
|
|||
<span class="locked_btn_cir ml10 fl" title="已锁定"> </span>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostDate">
|
||||
<div class="homepagePostDate fl">
|
||||
发帖时间:<%= format_time(activity.created_on) %>
|
||||
</div>
|
||||
<div class="homepagePostIntro break_word upload_img list_style maxh360 lh18 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 class="homepagePostDate fl ml15">
|
||||
更新时间:<%= format_time(activity.updated_on) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class=" fl" style="width: 600px">
|
||||
<% if activity.attachments.any?%>
|
||||
<% options = {:author => true, :deletable => false } %>
|
||||
<%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => activity.attachments, :options => options, :is_float => true} %>
|
||||
<% end %>
|
||||
</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?%>
|
||||
<%# options = {:author => true, :deletable => false } %>
|
||||
<%#= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => activity.attachments, :options => options, :is_float => true} %>
|
||||
<%# end %>
|
||||
</div>
|
||||
<div class="cl"></div>-->
|
||||
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
|
@ -99,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">
|
||||
|
@ -138,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 %>
|
||||
|
@ -176,3 +213,14 @@
|
|||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$("#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>
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<%= @user.name%>的博客
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if User.current.logged? && User.current.id == @user.id %>
|
||||
<%= labelled_form_for @article, :url =>{:controller=>'blog_comments',:action => 'create',:user_id=>user.id , :blog_id => blog.id},
|
||||
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
|
||||
|
@ -75,22 +76,6 @@
|
|||
|
||||
$(function () {
|
||||
init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>");
|
||||
showNormalImage('activity_description_<%= topic.id %>');
|
||||
if($("#intro_content_<%= topic.id %>").height() > 810) {
|
||||
$("#intro_content_show_<%= topic.id %>").show();
|
||||
}
|
||||
$("#intro_content_show_<%= topic.id %>").click(function(){
|
||||
$("#activity_description_<%= topic.id %>").toggleClass("maxh360");
|
||||
$("#activity_description_<%= topic.id%>").toggleClass("lh18");
|
||||
$("#intro_content_show_<%= topic.id %>").hide();
|
||||
$("#intro_content_hide_<%= topic.id %>").show();
|
||||
});
|
||||
$("#intro_content_hide_<%= topic.id %>").click(function(){
|
||||
$("#activity_description_<%= topic.id %>").toggleClass("maxh360");
|
||||
$("#activity_description_<%= topic.id%>").toggleClass("lh18");
|
||||
$("#intro_content_hide_<%= topic.id %>").hide();
|
||||
$("#intro_content_show_<%= topic.id %>").show();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% if topic %>
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
<div class="resources mt10" id="user_activity_<%= user_activity_id%>" >
|
||||
<div class="homepagePostBrief" onmouseover="$('#homepage_message_setting_<%=activity.id%>').show();" onmouseout="$('#homepage_message_setting_<%= activity.id%>').hide();">
|
||||
<div class="homepagePostDes">
|
||||
<% if activity.author.id == User.current.id%>
|
||||
<div class="homepagePostSetting" id="homepage_message_setting_<%= activity.id%>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_edit_homepage),
|
||||
{:controller => 'blog_comments',:action => 'edit',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id, :is_homepage => 1},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.author.id %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_delete_homepage),
|
||||
{:controller => 'blog_comments',:action => 'destroy',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id},
|
||||
:method => :delete,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.author.id %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to(
|
||||
l(:button_cancel_homepage),
|
||||
{:controller => 'blogs',:action => 'cancel_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
|
||||
:method => :post,
|
||||
:class => 'postOptionLink'
|
||||
) if User.current && User.current.id == activity.blog.author_id %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<%end%>
|
||||
<div class="cl"></div>
|
||||
<div class="homepagePostTitle hidden m_w530">
|
||||
<%= 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>
|
||||
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.content} %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
|
@ -40,23 +40,7 @@
|
|||
}
|
||||
|
||||
$(function () {
|
||||
init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
|
||||
showNormalImage('activity_description_<%= topic.id %>');
|
||||
if($("#intro_content_<%= topic.id %>").height() > 810) {
|
||||
$("#intro_content_show_<%= topic.id %>").show();
|
||||
}
|
||||
$("#intro_content_show_<%= topic.id %>").click(function(){
|
||||
$("#activity_description_<%= topic.id %>").toggleClass("maxh360");
|
||||
$("#activity_description_<%= topic.id%>").toggleClass("lh18");
|
||||
$("#intro_content_show_<%= topic.id %>").hide();
|
||||
$("#intro_content_hide_<%= topic.id %>").show();
|
||||
});
|
||||
$("#intro_content_hide_<%= topic.id %>").click(function(){
|
||||
$("#activity_description_<%= topic.id %>").toggleClass("maxh360");
|
||||
$("#activity_description_<%= topic.id%>").toggleClass("lh18");
|
||||
$("#intro_content_hide_<%= topic.id %>").hide();
|
||||
$("#intro_content_show_<%= topic.id %>").show();
|
||||
});
|
||||
init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>");
|
||||
});
|
||||
</script>
|
||||
<% if topic %>
|
||||
|
|
|
@ -40,22 +40,6 @@
|
|||
|
||||
$(function () {
|
||||
init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
|
||||
showNormalImage('activity_description_<%= topic.id %>');
|
||||
if($("#intro_content_<%= topic.id %>").height() > 810) {
|
||||
$("#intro_content_show_<%= topic.id %>").show();
|
||||
}
|
||||
$("#intro_content_show_<%= topic.id %>").click(function(){
|
||||
$("#activity_description_<%= topic.id %>").toggleClass("maxh360");
|
||||
$("#activity_description_<%= topic.id%>").toggleClass("lh18");
|
||||
$("#intro_content_show_<%= topic.id %>").hide();
|
||||
$("#intro_content_hide_<%= topic.id %>").show();
|
||||
});
|
||||
$("#intro_content_hide_<%= topic.id %>").click(function(){
|
||||
$("#activity_description_<%= topic.id %>").toggleClass("maxh360");
|
||||
$("#activity_description_<%= topic.id%>").toggleClass("lh18");
|
||||
$("#intro_content_hide_<%= topic.id %>").hide();
|
||||
$("#intro_content_show_<%= topic.id %>").show();
|
||||
});
|
||||
});
|
||||
</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");
|
||||
|
|
|
@ -0,0 +1,145 @@
|
|||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$("#time").change(function(){
|
||||
document.getElementById("end_time").options[document.getElementById("time").selectedIndex].selected = true;
|
||||
});
|
||||
$("#term").change(function(){
|
||||
document.getElementById("end_term").options[document.getElementById("term").selectedIndex].selected = true;
|
||||
});
|
||||
|
||||
var popupHeight = $(".referenceResourcesPopup").outerHeight(true);
|
||||
$(".referenceResourcesPopup").css("marginTop",-popupHeight/2);
|
||||
$(".resourcePopupClose").click(function(){
|
||||
hideModal();
|
||||
});
|
||||
$("#copyResource").click(function(){
|
||||
if ($("#allResource").is(":checked")){
|
||||
$("input[name='course_attachment_type[]']").attr("checked",true);
|
||||
}
|
||||
else{
|
||||
$("input[name='course_attachment_type[]']").attr("checked",false);
|
||||
}
|
||||
});
|
||||
$("#copyResource2").click(function(){
|
||||
if ($("input[name='course_attachment_type[]']:checked").length == 6){
|
||||
$("#allResource").attr("checked",true);
|
||||
}
|
||||
else{
|
||||
$("#allResource").attr("checked",false);
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<div class="referenceText">信息配置</div>
|
||||
</div>
|
||||
<ul class="mt10">
|
||||
<%=labelled_form_for @new_course do |f| %>
|
||||
<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=>"上传图片")%>
|
||||
</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>
|
||||
<input type="text" name="course[name]" id="course_name" class="courses_input grey_border" maxlength="100" onkeyup="regex_course_name();" value="<%=@course.name %>">
|
||||
<span class="c_red" id="course_name_notice" style="display: none;">课程名称不能为空</span>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45">
|
||||
<label><span class="c_red">*</span> <%= l(:label_class_period)%> :</label>
|
||||
<input type="text" name="class_period" id="class_period" class="hwork_input02 grey_border" onkeyup="regex_course_class_period();" maxlength="6" value="<%=@course.class_period %>">
|
||||
<span class="c_red" id="course_class_period_notice" style="display: none;"></span>
|
||||
</li>
|
||||
<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(@new_course.time),@new_course.time), {} %>
|
||||
<%= select_tag :term,options_for_select(course_term_option,@new_course.term || cur_course_term),{} %>
|
||||
<span class="c_red" id="course_time_term_notice"></span>
|
||||
</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(@new_course.end_time),@new_course.end_time), {} %>
|
||||
<%= select_tag :end_term,options_for_select(course_term_option,@new_course.end_term || cur_course_term),{} %>
|
||||
<span class="mr15 c_red">仅针对跨越多个学期的班级,否则不用修改。</span>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ml45 mb10">
|
||||
<label><span class="c_red">*</span> <%= l(:label_new_course_password)%> :</label>
|
||||
<input type="text" style="display: none;">
|
||||
<input type="text" name="course[password]" id="course_course_password" class="hwork_input02 grey_border" onkeyup="regex_course_password();" value="<%=@course.password %>">
|
||||
<!--<a id="psw_btn" href="javascript:void(0)">显示明码</a>-->
|
||||
<span class="c_red" id="course_course_password_notice"></span>
|
||||
<div class="cl"></div>
|
||||
<span class="ml95 c_red">学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。</span>
|
||||
</li>
|
||||
<li class="ml50">
|
||||
<label class="fl" > <%= l(:label_new_course_description)%> :</label>
|
||||
<textarea name="course[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="courses_text fl grey_border" ><%= @course.description.nil? ? "" : @course.description %></textarea>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" mb5 ml85">
|
||||
<label >公开 :</label>
|
||||
<input <%= @course.is_public == 1 ? 'checked' : ''%> id="course_is_public" name="course[is_public]" type="checkbox" value="<%=@course.is_public.to_i %>">
|
||||
<span class="c_grey">(选中后课外用户可见该课程,否则仅对课内成员可见)</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="ml58">
|
||||
<label class="fl">复制资源 :</label>
|
||||
<ul class="fl" id="copyResource">
|
||||
<li class="sendCourseName fl mr15 ml5">
|
||||
<label>
|
||||
<input name="checkAll" type="checkbox" id="allResource" value="0" class="resourceCopy"/>
|
||||
全部</label>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="fl" id="copyResource2">
|
||||
<li class="sendCourseName fl mr15">
|
||||
<label>
|
||||
<input name="course_attachment_type[]" type="checkbox" value="1" class="resourceCopy"/>
|
||||
课件</label>
|
||||
</li>
|
||||
<li class="sendCourseName fl mr15">
|
||||
<label>
|
||||
<input name="course_attachment_type[]" type="checkbox" value="2" class="resourceCopy"/>
|
||||
软件</label>
|
||||
</li>
|
||||
<li class="sendCourseName fl mr15">
|
||||
<label>
|
||||
<input name="course_attachment_type[]" type="checkbox" value="3" class="resourceCopy"/>
|
||||
媒体</label>
|
||||
</li>
|
||||
<li class="sendCourseName fl mr15">
|
||||
<label>
|
||||
<input name="course_attachment_type[]" type="checkbox" value="4" class="resourceCopy"/>
|
||||
代码</label>
|
||||
</li>
|
||||
<li class="sendCourseName fl mr15">
|
||||
<label>
|
||||
<input name="course_attachment_type[]" type="checkbox" value="6" class="resourceCopy"/>
|
||||
论文</label>
|
||||
</li>
|
||||
<li class="sendCourseName fl mr15">
|
||||
<label>
|
||||
<input name="course_attachment_type[]" type="checkbox" value="5" class="resourceCopy"/>
|
||||
其它</label>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<span class="c_red ml5 fl mb10">您可以通过选择资源类型,将对应资源复制到新课程中。</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div>
|
||||
<a href="javascript:void(0);" class="greyBtn fr mr40 f12" onclick="submit_new_course();">完成</a>
|
||||
<a href="javascript:void(0);" class="greyBtn fr mr10 f12" onclick="hideResource();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
|
@ -1,7 +1,42 @@
|
|||
<%= content_for(:header_tags) do %>
|
||||
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
|
||||
<% end %>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$("#relateProject,.relatePInfo").mouseover(function(){
|
||||
$(".relatePInfo").css("display","block");
|
||||
})
|
||||
$("#relateProject,.relatePInfo").mouseout(function(){
|
||||
$(".relatePInfo").css("display","none");
|
||||
})
|
||||
$(".homepagePostPortrait").mouseover(function(){
|
||||
$(this).children(".userCard").css("display","block");
|
||||
})
|
||||
$(".homepagePostPortrait").mouseout(function(){
|
||||
$(this).children(".userCard").css("display","none");
|
||||
})
|
||||
$(".userCard").mouseover(function(){
|
||||
$(this).css("display","block");
|
||||
})
|
||||
$(".userCard").mouseout(function(){
|
||||
$(this).css("display","none");
|
||||
})
|
||||
$(".coursesLineGrey").mouseover(function(){
|
||||
$(this).css("color","#ffffff");
|
||||
})
|
||||
$(".coursesLineGrey").mouseout(function(){
|
||||
$(this).css("color","#808080");
|
||||
})
|
||||
$(".homepagePostSetting,.coursesLineGrey").mouseover(function(){
|
||||
$(this).prev().css("color","#ffffff");
|
||||
$(this).css("z-index", "9999");
|
||||
})
|
||||
$(".homepagePostSetting").mouseout(function(){
|
||||
$(this).prev().css("color","#808080");
|
||||
$(this).css("z-index", "1");
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<style type="text/css">
|
||||
/*回复框*/
|
||||
div.ke-toolbar {
|
||||
|
@ -73,22 +108,6 @@
|
|||
|
||||
$(function () {
|
||||
init_activity_KindEditor_data(<%= activity.id%>, null, "87%", "<%= activity.class.to_s %>");
|
||||
showNormalImage('activity_description_<%= activity.id %>');
|
||||
if($("#intro_content_<%= activity.id %>").height() > 360) {
|
||||
$("#intro_content_show_<%= activity.id %>").show();
|
||||
}
|
||||
$("#intro_content_show_<%= activity.id %>").click(function(){
|
||||
$("#activity_description_<%= activity.id %>").toggleClass("maxh360");
|
||||
$("#activity_description_<%= activity.id%>").toggleClass("lh18");
|
||||
$("#intro_content_show_<%= activity.id %>").hide();
|
||||
$("#intro_content_hide_<%= activity.id %>").show();
|
||||
});
|
||||
$("#intro_content_hide_<%= activity.id %>").click(function(){
|
||||
$("#activity_description_<%= activity.id %>").toggleClass("maxh360");
|
||||
$("#activity_description_<%= activity.id%>").toggleClass("lh18");
|
||||
$("#intro_content_hide_<%= activity.id %>").hide();
|
||||
$("#intro_content_show_<%= activity.id %>").show();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<% if activity && activity.course_act%>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<% unless excellent_course_recommend(course).count == 0 %>
|
||||
<ul class="courseR mb10">
|
||||
<h4 class="mb5" ><%= l(:label_homework_recommendation) %>:</h4>
|
||||
<% excellent_course_recommend(course).each do |e_course| %>
|
||||
<li class="mt15"> <%= image_tag(url_to_avatar(e_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %>
|
||||
<div class="fl">
|
||||
<p class="f12 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %></p>
|
||||
<p class="f12">
|
||||
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>)</span>
|
||||
<span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(e_course), :class => "linkBlue2" %>)</span></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
|
@ -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">
|
||||
|
|
|
@ -12,13 +12,14 @@
|
|||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt15 grey_c lh22">
|
||||
<%= link_to "复制学期", copy_course_course_path(@course.id),:remote=>true, :class => "term_btn fl" %>
|
||||
<!--<a href="javascript:" class="term_btn fl" onclick="copyTerm();">
|
||||
复制学期
|
||||
</a>-->
|
||||
<div class="disable_btn fl">
|
||||
<!--<div class="disable_btn fl">
|
||||
<span style="display: inline-block">复制学期</span>
|
||||
<span style="display: inline-block">(开发中...)</span>
|
||||
</div>
|
||||
</div>-->
|
||||
复制学期将为您创建一个新的课程学期,新学期将继承本学期的相关资源,具体您稍后可以选择。
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -2,19 +2,19 @@
|
|||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
|
||||
<% if show_nav?(@course.homework_commons.count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02 ml10 fn"%>
|
||||
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f12 c_blue02 ml10 fn"%>
|
||||
<%= link_to( "", homework_common_index_path(:course => @course.id,:is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_course_homework_new)}") if is_teacher %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if show_nav?(@course.news.count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_news), course_news_index_path(@course), :class => "f14 c_blue02 ml10 fn" %>
|
||||
<%= link_to l(:label_course_news), course_news_index_path(@course), :class => "f12 c_blue02 ml10 fn" %>
|
||||
<%= link_to( "", new_course_news_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if show_nav?(course_file_num) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02 ml10 fn" %>
|
||||
<%= link_to l(:label_course_file), course_files_path(@course), :class => "f12 c_blue02 ml10 fn" %>
|
||||
<% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %>
|
||||
<!--link_to( "+#{l(:label_upload_files)}", course_files_path(@course), :class => 'subnav_green ml95 c_white')-->
|
||||
<a class="courseMenuSetting" title="上传资源" href="javascript:void(0);" onclick="course_files_upload();"> </a>
|
||||
|
@ -23,25 +23,25 @@
|
|||
<% end %>
|
||||
<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02 ml10 fn" %>
|
||||
<%= link_to l(:label_course_board), course_boards_path(@course), :class => "f12 c_blue02 ml10 fn" %>
|
||||
<%= link_to( "",course_boards_path(@course, :flag => true, :is_new => 1), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}") if User.current.member_of_course?(@course) && @course.boards.first %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if show_nav?(course_feedback_count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02 ml10 fn" %>
|
||||
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f12 c_blue02 ml10 fn" %>
|
||||
<%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if show_nav?(course_poll_count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f14 c_blue02 ml10 fn"%>
|
||||
<%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f12 c_blue02 ml10 fn"%>
|
||||
<%= link_to( "", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'courseMenuSetting', :title =>"#{l(:label_new_poll)}") if is_teacher %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02 ml10 fn"%>
|
||||
<%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f12 c_blue02 ml10 fn"%>
|
||||
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'courseMenuSetting', :title =>"新建试卷") if is_teacher %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,13 @@
|
|||
if(document.getElementById("popbox02")) {
|
||||
hideModal("#popbox02");
|
||||
}
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'copy_course') %>');
|
||||
showModal('ajax-modal', '730px');
|
||||
$('#ajax-modal').css('height','530px').css('width','730px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<div class='resourcePopupClose mt5 mr-5'>" +
|
||||
"<a href='javascript:void(0)' class='resourceClose' onclick='hideResource();'></a></div>");
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","").css("position","fixed");
|
||||
$('#ajax-modal').parent().addClass("popbox").addClass("copyCoursePopup");
|
||||
|
||||
|
|
@ -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");
|
||||
|
|
|
@ -4,5 +4,5 @@ $('#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().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("anonymos");
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
$("#project_info_<%=@course.id %>").html('<%=escape_javascript(render :partial=>'layouts/project_info') %>');
|
||||
if(document.getElementById("course_is_public")) {
|
||||
<% if @course.is_public == 0%>
|
||||
$("#course_is_public").attr("checked",false);
|
||||
<% elsif @course.is_public == 1 %>
|
||||
$("#course_is_public").attr("checked",true);
|
||||
<% if params[:user_page].nil? %>
|
||||
$("#project_info_<%=@course.id %>").html('<%=escape_javascript(render :partial=>'layouts/project_info') %>');
|
||||
if(document.getElementById("course_is_public")) {
|
||||
<% if @course.is_public == 0%>
|
||||
$("#course_is_public").attr("checked",false);
|
||||
<% elsif @course.is_public == 1 %>
|
||||
$("#course_is_public").attr("checked",true);
|
||||
<% end %>
|
||||
}
|
||||
<% else %>
|
||||
<% if @course.is_public? %>
|
||||
$("#set_course_public_<%= @course.id %>").text("设为私有");
|
||||
$("#show_course_<%= @course.id %>").attr("title","公开课程:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)");
|
||||
<% else %>
|
||||
$("#set_course_public_<%= @course.id %>").text("设为公开");
|
||||
$("#show_course_<%= @course.id %>").attr("title","私有课程:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)");
|
||||
<% end %>
|
||||
}
|
||||
<% end %>
|
|
@ -109,7 +109,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,7 +135,7 @@
|
|||
$('#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);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -30,7 +30,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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,5 +4,5 @@ $('#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').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");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,5 +6,5 @@ $('#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","");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("poll_alert_form");
|
|
@ -6,5 +6,5 @@ $('#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","");
|
||||
$('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("poll_alert_form");
|
|
@ -5,29 +5,6 @@
|
|||
$("#Container").css("width","1000px");
|
||||
});
|
||||
|
||||
// 匿评弹框提示
|
||||
<%# if @is_evaluation && !@stundet_works.empty?%>
|
||||
// $(function(){
|
||||
// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'student_work/praise_alert') %>');
|
||||
// showModal('ajax-modal', '500px');
|
||||
// $('#ajax-modal').siblings().remove();
|
||||
// $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
// "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
// $('#ajax-modal').parent().css("top","").css("left","");
|
||||
// $('#ajax-modal').parent().addClass("anonymos");
|
||||
// });
|
||||
<%# end%>
|
||||
|
||||
//设置评分规则
|
||||
function set_score_rule(){
|
||||
$('#ajax-modal').html('<%#= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework,:student_path => true}) %>');
|
||||
showModal('ajax-modal', '350px');
|
||||
$('#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","25%").css("left","35%").css("position","fixed");
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$("#homework_info_hidden").click(function(){
|
||||
$("#homeworkInformation").hide();
|
||||
|
@ -84,6 +61,20 @@
|
|||
<!---menu_r end--->
|
||||
</div>
|
||||
<!--div class="hworkInfor"><a href="javascript:void(0);" class="linkBlue">作业信息</a></div-->
|
||||
<% if @is_teacher%>
|
||||
<div class="fr mt5">
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected">
|
||||
<a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="hworkMenu">
|
||||
<li>
|
||||
<%= link_to "导出测验成绩", student_exercise_list_exercise_path(@exercise.id,:course_id => @course.id, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => "export_student_work"%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</span>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
<span class="fontGrey2 mr15 fl">上传时间:<%= format_date(file.created_on)%></span>
|
||||
<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 %>
|
||||
|
@ -43,7 +43,7 @@
|
|||
<% 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("发 送".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 @course.is_public? %>
|
||||
<li>
|
||||
|
@ -61,7 +61,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 %>
|
||||
|
@ -82,9 +82,9 @@
|
|||
<% if curse_attachments.count == 10%>
|
||||
<% if params[:action] == 'search' %>
|
||||
<%=link_to "点击展开更多", search_course_files_path({:course_id => course.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
|
||||
<%else%>
|
||||
<% else %>
|
||||
<!-- 全站搜索的时候 返回的页码对象是obj_pages,而站内搜索返回的页码对象是feedback_pages -->
|
||||
<%=link_to "点击展开更多", course_files_path({:course_id => course.id,:page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
|
||||
<%=link_to "点击展开更多", course_files_path(:course_id => course.id, :page => @page), :id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
|
||||
<%end%>
|
||||
<% 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 %>
|
||||
|
|
|
@ -1,59 +1,78 @@
|
|||
<% delete_allowed = User.current.admin? %>
|
||||
<div class="re_con_top">
|
||||
<p class="f_l c_blue f_b f_14">共有 <%= all_attachments.count%> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
<% if order == "asc" %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
<% else %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: sort,order:order,current:"quotes"} %> 排序
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="files_tag" id="files_tag">
|
||||
<%= render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="for_img_thumbnails">
|
||||
<% org_subfield_attachments.each do |file| %>
|
||||
<% if 1 %>
|
||||
<div class="re_con_box" id="container_files_<%= file.id %>">
|
||||
<div class="">
|
||||
<%= 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 => "c_dblue f_14 f_b f_l" %>
|
||||
<% org_subfield_attachments.each do |file| %>
|
||||
<div class="resources mt10" id="container_files_<%= file.id %>">
|
||||
<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 => "c_dblue f_14 f_b f_l" %>
|
||||
<%= 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>
|
||||
<br/>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
<span class="fontGrey2 mr15 fl">上传时间:<%= format_date(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">
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
</div>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<% if User.current.logged? %>
|
||||
<% if !@org_subfield.attachments.all.include?file %>
|
||||
<%= link_to("选入栏目",quote_resource_show_org_subfield_org_subfield_file_path(:org_subfield_id => @org_subfield.id, :id => file.id),:class => "f_l re_select c_lorange",:remote => true) %>
|
||||
<% elsif @org_subfield.organization.org_subfields.where("field_type='Resource'").count > 1 %>
|
||||
<%= link_to("选入组织其他栏目",quote_resource_show_org_subfield_org_subfield_file_path(:org_subfield_id => @org_subfield.id, :id => file.id),:class => "f_l re_select c_lorange",:remote => true) %>
|
||||
<% 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}','#{User.current.id}','file')") %></li>
|
||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
||||
<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>
|
||||
<li>
|
||||
<%= link_to( '删除资源', attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" && file.destroyable %>
|
||||
</li>
|
||||
</ul>
|
||||
<%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 %>
|
||||
<%= file_preview_tag(file, class: 'f_l re_open', style:'text-align: center;') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<p class="f_l mb5 c_grey02">文件大小:<%= number_to_human_size(file.filesize) %></p>
|
||||
<%= link_to( l(:button_delete), attachment_path(file),
|
||||
:data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "f_r re_de") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @org_subfield.id && file.container_type == "OrgSubfield"%>
|
||||
<p class="f_r c_grey02" ><%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %> </p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="tag_h">
|
||||
<%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6"} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!---re_con_box end-->
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
</div><!---re_con_box end-->
|
||||
<% end %>
|
||||
|
||||
<% if org_subfield_attachments.count == 10 %>
|
||||
<% if params[:action] == 'search_files_in_subfield' %>
|
||||
<%=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" %>
|
||||
<%end%>
|
||||
<% end%>
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<span class="add_attachment" data-containerid="<%= container.id %>">
|
||||
<button name="button" class="sub_btn" onclick="_file<%=container.id %>.click()" onmouseover="this.focus()" style="<%= ie8? ? 'display:none' : ''%>" type="button" ><%= l(:label_browse) %></button>
|
||||
<%= file_field_tag 'attachments[dummy][file]',
|
||||
:id => "_file#{container.id}",
|
||||
:class => ie8? ? '':'file_selector',
|
||||
:multiple => true,
|
||||
:onchange => "addInputFiles_board(this, '#{container.id}','"+"submit_resource"+"');",
|
||||
:style => ie8? ? '': 'display:none',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||
:upload_path => uploads_path(:format => 'js'),
|
||||
:description_placeholder => l(:label_optional_description),
|
||||
:field_is_public => l(:field_is_public),
|
||||
:are_you_sure => l(:text_are_you_sure),
|
||||
:file_count => l(:label_file_count),
|
||||
:delete_all_files => l(:text_are_you_sure_all),
|
||||
:lebel_file_uploding => l(:lebel_file_uploding),
|
||||
:containerid => "#{container.id}"
|
||||
} %>
|
||||
</span>
|
||||
<!--<input type="submit" name="" value="上传文件" class="f_l ml10" style="width:80px; height:26px;">-->
|
||||
|
||||
<span id="upload_file_count<%=container.id %>">
|
||||
<%= l(:label_no_file_uploaded)%>
|
||||
</span>
|
||||
(<%= l(:label_max_size) %>:
|
||||
<%= number_to_human_size(Setting.attachment_max_size.to_i.kilobytes) %>)
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<span id="attachments_fields<%= container.id %>" data-containerid="<%= container.id %>" xmlns="http://www.w3.org/1999/html">
|
||||
</span>
|
||||
</div>
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</span>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
<span class="fontGrey2 mr15 fl">上传时间:<%= format_date(file.created_on)%></span>
|
||||
<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 %>
|
||||
|
@ -45,8 +45,17 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
|
||||
</ul>
|
||||
<% if project_attachments.count == 10%>
|
||||
<% if params[:action] == 'search_project' %>
|
||||
<!--<ul class="wlist">-->
|
||||
<!--<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>-->
|
||||
<!--</ul>-->
|
||||
<%=link_to "点击展开更多", search_project_project_files_path({:project_id => project.id, :page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
|
||||
<%else%>
|
||||
<!-- 全站搜索的时候 返回的页码对象是obj_pages,而站内搜索返回的页码对象是feedback_pages -->
|
||||
<%=link_to "点击展开更多", project_files_path(:project_id => project.id,:page => @page),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
|
||||
<%end%>
|
||||
<% end%>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= stylesheet_link_tag 'courses' %>
|
||||
<%= stylesheet_link_tag 'courses'%>
|
||||
<script>
|
||||
function searchone4reload(fileid){
|
||||
var url = "<%= searchone4reload_org_subfield_files_path(@org_subfield)%>";
|
||||
|
@ -11,87 +11,75 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
function show_upload(obj)
|
||||
{
|
||||
switch(obj)
|
||||
{
|
||||
// case 1:
|
||||
// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 1}) %>');
|
||||
// break;
|
||||
case 2:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 2}) %>');
|
||||
break;
|
||||
case 3:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 3}) %>');
|
||||
break;
|
||||
case 4:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 4}) %>');
|
||||
break;
|
||||
// case 6:
|
||||
// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 6}) %>');
|
||||
// break;
|
||||
default:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_subfield_file',:locals => {:org_subfield => @org_subfield,:org_subfield_attachment_type => 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().addClass("popbox_polls");
|
||||
}
|
||||
|
||||
function closeModal()
|
||||
{
|
||||
hideModal($("#popbox_upload"));
|
||||
}
|
||||
|
||||
function presscss(id)
|
||||
{
|
||||
if(id == "inorg_subfield")
|
||||
{
|
||||
$('#inorg_subfield').attr("class", "re_schbtn b_dblue");
|
||||
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#inorg_subfield').attr("class", "re_schbtn b_lblue");
|
||||
$('#insite').attr("class", "re_schbtn b_dblue");
|
||||
}
|
||||
}
|
||||
function buttoncss()
|
||||
{
|
||||
$('#inorg_subfield').attr("class", "re_schbtn b_lblue");
|
||||
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
<div class="resources"><!--资源库内容开始--->
|
||||
<div class="re_top" style="width:710px;">
|
||||
<%= form_tag( search_files_in_subfield_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search f_l",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "栏目内搜索", :class => "re_schbtn b_lblue",:style => 'width:72px;',:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %>
|
||||
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||
<div class="homepageRight mt0 ml0">
|
||||
<div class="homepageRightBanner" style="margin-top:<%= User.current.logged? ? '0px':'10px' %>">
|
||||
<div class="NewsBannerName"><%= org_subfield.name %></div>
|
||||
<ul class="resourcesSelect">
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="resourcesType">
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','','<%= @q%>','<%= org_subfield.id%>');" class="resourcesTypeAll resourcesGrey">全部</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','软件','<%= @q%>','<%= org_subfield.id%>');" class="softwareIcon postTypeGrey">软件</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','媒体','<%= @q%>','<%= org_subfield.id%>');" class="mediaIcon resourcesGrey">媒体</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield)%>','代码','<%= @q%>','<%= org_subfield.id%>');" class="codeIcon resourcesGrey">代码</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_org_subfield_tag_attachment_org_subfield_files_path(org_subfield,:other=>true)%>','其他','<%= @q%>','<%= org_subfield.id%>');" class="othersIcon resourcesGrey">其它</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="resources mt10" style="padding-bottom:5px;">
|
||||
<div class="reTop mb5">
|
||||
<%= form_tag( search_files_in_subfield_org_subfield_files_path(@org_subfield), method: 'get',:class => "re_search",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "栏目内搜索", :class => "blueBtn mr5 fl",:style => 'width:72px;',:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %>
|
||||
<%= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
|
||||
<input class="blueBtn fr mr5" value="上传资源" onclick="org_upload_files(<%= org_subfield.id %>);">
|
||||
<%#= link_to "上传资源",subfield_upload_file_org_subfield_files_path(@org_subfield.id, :in_org => 1),:method => "post",:class=>"blueBtn fr mr5",:remote => true %>
|
||||
<% end %>
|
||||
<%# if is_org_subfield_teacher(User.current,@org_subfield) || (@org_subfield.publish_resource==1 && User.current.member_of_org_subfield?(@org_subfield) ) %> <!-- show_window('light','fade','20%','35%')-->
|
||||
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
|
||||
<p class="c_grey fr mt10 mr5">
|
||||
上传:
|
||||
<!--<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(1);">课件</a> | -->
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(2);">软件</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(3);">媒体</a> |
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(4);">代码</a> |
|
||||
<!--<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(6);">论文</a> | -->
|
||||
<a href="javascript:void(0);" class=" c_dblue font_bold" onclick="show_upload(5);">其他</a>
|
||||
</p>
|
||||
<%# end %>
|
||||
</div><!---re_top end-->
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="reCon" id="org_subfield_list">
|
||||
<%= render :partial => 'org_subfield_list',:locals => {org_subfield: @org_subfield,all_attachments: @all_attachments,sort:@sort,order:@order,org_subfield_attachments:@obj_attachments} %>
|
||||
</div><!---re_con end-->
|
||||
|
||||
<div>
|
||||
<div class="re_con_top">
|
||||
<div class="files_tag" id="files_tag">
|
||||
<%= render :partial => "files/subfield_tags", :locals => {:tag_list => @tag_list,:org_subfield => @org_subfield,:tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<p class="f_l fontBlue f_b f_14">共有 <span id="attachment_count"><%= @all_attachments.count %></span> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
<% if @order == "asc" %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序
|
||||
<% else %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="org_subfield_list">
|
||||
<%= render :partial => 'files/org_subfield_list',:locals => {org_subfield: @org_subfield,all_attachments: @all_attachments,sort:@sort,order:@order,org_subfield_attachments:@obj_attachments} %>
|
||||
</div><!---re_con end-->
|
||||
|
||||
</div>
|
||||
<% html_title(l(:label_attachment_plural)) -%>
|
||||
<script>
|
||||
function org_upload_files(org_subfield_id){
|
||||
$.ajax({
|
||||
url :"/org_subfields/" + org_subfield_id + "/files/subfield_upload_file",
|
||||
type :'post'
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -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 %>
|
||||
|
|
|
@ -7,18 +7,14 @@
|
|||
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
|
||||
|
||||
<%= form_tag(org_subfield_files_path(org_subfield, :in_org => params[:in_org]), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
|
||||
<% if params[:in_org] %>
|
||||
<div class="c_dark">
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="2" checked class="c_dblue">软件</input> <span class="c_grey">|</span>
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="3" class="c_dblue">媒体</input> <span class="c_grey">|</span>
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="4" class="c_dblue">代码</input> <span class="c_grey">|</span>
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="5" class="c_dblue">其他</input></a>
|
||||
</div>
|
||||
<% else %>
|
||||
<input type="hidden" name="org_subfield_attachment_type" value="<%= org_subfield_attachment_type %>">
|
||||
<% end %>
|
||||
<!--<input type="hidden" name="org_subfield_attachment_type" value="<%= org_subfield_attachment_type%>">-->
|
||||
<%= render :partial => 'files/attachement_list'%>
|
||||
<div class="c_dark">
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="2" checked class="c_dblue">软件</input> <span class="c_grey">|</span>
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="3" class="c_dblue">媒体</input> <span class="c_grey">|</span>
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="4" class="c_dblue">代码</input> <span class="c_grey">|</span>
|
||||
<input name="org_subfield_attachment_type[]" type="checkbox" value="5" class="c_dblue">其他</input></a>
|
||||
</div>
|
||||
<!--<input type="hidden" name="org_subfield_attachment_type" value="<%#= org_subfield_attachment_type%>">-->
|
||||
<%= render :partial => 'files/org_subfield_upload_attachment_list', :locals => {:container => org_subfield}%>
|
||||
<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>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue