diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 9ce76dca8..fd43977ee 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -185,7 +185,6 @@ class AttachmentsController < ApplicationController
end
@attachment.filename = params[:filename].presence || Redmine::Utils.random_hex(16)
saved = @attachment.save
-
respond_to do |format|
format.js
format.api {
@@ -198,12 +197,43 @@ class AttachmentsController < ApplicationController
end
end
+ def upload_attachment_version
+ @flag = false
+ Attachment.transaction do
+ @old_attachment = Attachment.find params[:old_attachment_id]
+ #取出当前上传的文件
+ @attachment = Attachment.find(params[:attachments ].first[1][:attachment_id])
+ #将需要修改的记录保存到历史记录
+ @history = AttachmentHistory.new
+ @history.attributes = @old_attachment.attributes.dup.except("id")
+ @history.attachment_id = params[:old_attachment_id]
+ #需要更新版本号,需要拿到原来该文件最大的历史版本号
+ @old_history = @old_attachment.attachment_histories.reorder('version desc').first
+ @history.version = @old_history.nil? ? 1 : @old_history.version + 1
+ @history.save #历史记录保存完毕
+ #将最新保存的记录 数据替换到 需要修改的文件记录
+ @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public")
+ @old_attachment.save
+ #删除当前记录
+ @attachment.delete
+ @flag = true
+ end
+
+ respond_to do |format|
+ format.js
+ end
+ end
+
def destroy
if @attachment.container.respond_to?(:init_journal)
@attachment.container.init_journal(User.current)
end
if @attachment.container
- @attachment.container.attachments.delete(@attachment)
+ if @attachment.container_type == "Issue"
+ @attachment.destroy
+ else
+ @attachment.container.attachments.delete(@attachment)
+ end
else
@attachment.destroy
end
@@ -255,7 +285,7 @@ class AttachmentsController < ApplicationController
format.js
end
end
-
+
def delete_homework
@bid = @attachment.container.bid
# Make sure association callbacks are called
@@ -318,13 +348,13 @@ class AttachmentsController < ApplicationController
end
respond_to do |format|
- format.js
+ format.js
end
rescue NoMethodError
@save_flag = false
@save_message = [] << l(:error_attachment_empty)
respond_to do |format|
- format.js
+ format.js
end
end
@@ -494,6 +524,15 @@ class AttachmentsController < ApplicationController
end
end
+ #找到文件的所有的历史版本
+ def attachment_versions
+ @attachment = Attachment.find(params[:id])
+ @attachment_histories = @attachment.attachment_histories
+ respond_to do |format|
+ format.js
+ end
+ end
+
private
def find_project
@attachment = Attachment.find(params[:id])
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index c5f5c0fc2..ef195712e 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -748,7 +748,16 @@ class FilesController < ApplicationController
q = "%#{@q.strip}%"
@result = find_course_attache q,@course,sort
@result = visable_attachemnts @result
- @result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank?
+ if params[:other]
+ @result = @result.select{|attachment|
+ !attachment.tag_list.include?('课件') &&
+ !attachment.tag_list.include?('软件') &&
+ !attachment.tag_list.include?('媒体') &&
+ !attachment.tag_list.include?('代码') &&
+ !attachment.tag_list.include?('论文') }
+ else
+ @result = @result.select{|attachment| attachment.tag_list.include?(@tag_name)} unless @tag_name.blank?
+ end
@searched_attach = paginateHelper @result,10
@tag_list = get_course_tag_list @course
diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index 46362c2d3..d345fba5f 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -63,7 +63,7 @@ class HomeworkCommonController < ApplicationController
end
@homework.end_time = params[:homework_common][:end_time] || Time.now
@homework.course_id = params[:course_id]
- @homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 1
+ @homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 77dc1a9aa..c3f926867 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -85,7 +85,7 @@ class IssuesController < ApplicationController
params[:page] = (params[:page] || 1).to_i + 1 #页码需要加1
@offset ||= @issue_pages.offset
@issues = @query.issues(:include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
- :order => sort_clause,
+ :order => 'issues.updated_on desc',
:offset => @offset,
:limit => @limit)
if params[:set_filter]
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index de9ec9852..72bffa06c 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -211,6 +211,8 @@ class MessagesController < ApplicationController
end
if params[:user_activity_id]
@user_activity_id = params[:user_activity_id]
+ @is_course = params[:is_course]
+ @is_board = params[:is_board]
respond_to do |format|
format.js
end
@@ -241,38 +243,42 @@ class MessagesController < ApplicationController
if request.post? && @message.save
attachments = Attachment.attach_files(@message, params[:attachments])
render_attachment_warning_if_needed(@message)
- flash[:notice] = l(:notice_successful_update)
+ #flash[:notice] = l(:notice_successful_update)
@message.reload
- if params[:is_board]
+ if params[:is_course] && params[:is_course].to_i == 0
+ redirect_to user_activities_path(User.current.id)
+ elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0
if @project
- redirect_to project_boards_path(@project)
+ redirect_to project_path(@project)
elsif @course
- redirect_to course_boards_path(@course)
+ redirect_to course_activity_path(@course)
end
- else
- redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
- end
- elsif request.get? || request.post?
- if params[:is_board]
+ elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
else
- respond_to do |format|
- format.html {
- if @project
- layout_file = 'base_projects'
- elsif @course
- layout_file = 'base_courses'
- elsif @org_subfield
- @organization = @org_subfield.organization
- layout_file = 'base_org'
- end
- render :layout => layout_file
- }
- end
+ redirect_to board_message_url(@message.board, @message.root, :r => (@message.parent_id && @message.id))
+ end
+ elsif request.get? || request.post?
+ if params[:is_course] && params[:is_board]
+ @is_course = params[:is_course]
+ @is_board = params[:is_board]
+ end
+ respond_to do |format|
+ format.html {
+ if @project
+ layout_file = 'base_projects'
+ elsif @course
+ layout_file = 'base_courses'
+ elsif @org_subfield
+ @organization = @org_subfield.organization
+ layout_file = 'base_org'
+ end
+ render :layout => layout_file
+ }
end
end
end
@@ -290,25 +296,28 @@ class MessagesController < ApplicationController
@message.destroy
# modify by nwb
if @project
- if params[:is_board]
- redirect_to project_boards_url(@project)
+ if params[:is_course] && params[:is_course].to_i == 0
+ redirect_to user_activities_path(User.current.id)
+ elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0
+ redirect_to project_path(@project)
+ elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
+ redirect_to project_boards_path(@project)
+ elsif @message.parent
+ redirect_to board_message_url(@board, @message.parent, :r => r)
else
- if @message.parent
- redirect_to board_message_url(@board, @message.parent, :r => r)
- else
- redirect_to project_board_url(@project, @board)
- end
- # redirect_to board_message_url(@board, @topic, :r => @reply)
+ redirect_to project_board_url(@project, @board)
end
elsif @course
- if params[:is_board]
- redirect_to course_boards_url(@course)
+ if params[:is_course] && params[:is_course].to_i == 0
+ redirect_to user_activities_path(User.current.id)
+ elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 0
+ redirect_to course_activity_path(@course)
+ elsif params[:is_course] && params[:is_course].to_i == 1 && params[:is_board] && params[:is_board].to_i == 1
+ redirect_to course_boards_path(@course)
+ elsif @message.parent
+ redirect_to board_message_url(@board, @message.parent, :r => r)
else
- if @message.parent
- redirect_to board_message_url(@board, @message.parent, :r => r)
- else
- redirect_to course_board_url(@course, @board)
- end
+ redirect_to course_boards_path(@course)
end
elsif @org_subfield
if params[:is_board]
diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index 3c5266f79..ba017579f 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -292,6 +292,13 @@ class OrganizationsController < ApplicationController
@org_subfield.update_attribute(:hide, 0)
end
+ def org_resources_subfield
+ @org = Organization.find(params[:id])
+ @subfield = @org.org_subfields.where('field_type = "Resource" ')
+ respond_to do | format|
+ format.js
+ end
+ end
def apply_subdomain
@organization = Organization.find(params[:id])
admins = User.where("admin=1")
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 78d8e2b46..d28837858 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -522,7 +522,7 @@ class UsersController < ApplicationController
else
homework.publish_time = params[:homework_common][:publish_time]
end
- homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 1
+ homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
homework.homework_type = params[:homework_type].to_i || 1
homework.late_penalty = 10
homework.teacher_priority = 1
@@ -619,7 +619,7 @@ class UsersController < ApplicationController
end
if(params[:type].blank? || params[:type] == "1") #全部
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
- @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
+ @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
elsif params[:type] == "2" #课程资源
user_course_ids = User.current.courses.map { |c| c.id}
@@ -875,7 +875,7 @@ class UsersController < ApplicationController
#显示更多用户课程
def user_courses4show
@page = params[:page].to_i + 1
- @courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5)
+ @courses = @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").limit(5).offset(@page * 5)
end
#显示更多用户项目
@@ -1327,12 +1327,12 @@ class UsersController < ApplicationController
if(params[:type].blank?|| params[:type] == "1") #全部
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
- @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
+ @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " +
- "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
+ "and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
end
elsif params[:type] == "2" #课程资源
@@ -1389,12 +1389,12 @@ class UsersController < ApplicationController
if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
- @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
+ @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " +
- "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
+ "and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
end
elsif params[:type] == "2" #课程资源
@@ -1489,11 +1489,23 @@ class UsersController < ApplicationController
unless course_ids.nil?
course_ids.each do |id|
next if ori.blank?
+ @exist = false
+ Course.find(id).attachments.each do |att| #如果课程中包含该资源
+ if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
+ att.created_on = Time.now
+ att.save
+ @exist = true
+ break
+ end
+ end
+ next if @exist
attach_copied_obj = ori.copy
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
attach_copied_obj.container = Course.find(id)
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
+ attach_copied_obj.is_public = 0
+ attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 4
end
@@ -1513,11 +1525,23 @@ class UsersController < ApplicationController
unless course_ids.nil?
course_ids.each do |id|
next if ori.blank?
+ @exist = false
+ Course.find(id).attachments.each do |att| #如果课程中包含该资源
+ if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
+ att.created_on = Time.now
+ att.save
+ @exist = true
+ break
+ end
+ end
+ next if @exist
attach_copied_obj = ori.copy
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
attach_copied_obj.container = Course.find(id)
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
+ attach_copied_obj.is_public = 0
+ attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 4
end
@@ -1530,7 +1554,7 @@ class UsersController < ApplicationController
@flag = false
end
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
- @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
+ @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
@type = params[:type]
@limit = 25
@@ -1559,11 +1583,23 @@ class UsersController < ApplicationController
unless project_ids.nil?
project_ids.each do |project_id|
next if ori.blank?
+ @exist = false
+ Project.find(project_id).attachments.each do |att| #如果课程中包含该资源
+ if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
+ att.created_on = Time.now
+ att.save
+ @exist = true
+ break
+ end
+ end
+ next if @exist
attach_copied_obj = ori.copy
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
attach_copied_obj.container = Project.find(project_id)
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
+ attach_copied_obj.is_public = 0
+ attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 1
end
@@ -1582,11 +1618,23 @@ class UsersController < ApplicationController
unless project_ids.nil?
project_ids.each do |project_id|
next if ori.blank?
+ @exist = false
+ Project.find(project_id).attachments.each do |att| #如果课程中包含该资源
+ if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
+ att.created_on = Time.now
+ att.save
+ @exist = true
+ break
+ end
+ end
+ next if @exist
attach_copied_obj = ori.copy
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
attach_copied_obj.container = Project.find(project_id)
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
+ attach_copied_obj.is_public = 0
+ attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 1
end
@@ -1598,7 +1646,94 @@ class UsersController < ApplicationController
@flag=true
end
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
- @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
+ @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
+ "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
+ @type = params[:type]
+ @limit = 25
+ @user = User.current
+ @is_remote = true
+ @atta_count = @attachments.count
+ @atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
+ @offset ||= @atta_pages.offset
+ #@curse_attachments_all = @all_attachments[@offset, @limit]
+ @attachments = paginateHelper @attachments,25
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ def add_exist_file_to_org
+ @flag = true
+ if params[:send_id].present?
+ send_id = params[:send_id]
+ subfield_id = params[:subfield]
+ if subfield_id.nil?
+ @flag = false
+ end
+ ori = Attachment.find_by_id(send_id)
+ unless subfield_id.nil?
+ attach_copied_obj = ori.copy
+ @exist = false
+ OrgSubfield.find(subfield_id).attachments.each do |att| #如果课程中包含该资源
+ if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
+ att.created_on = Time.now
+ att.save
+ @exist = true
+ break
+ end
+ end
+ if @exist == false #如果不存在该资源
+ attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
+ attach_copied_obj.container = OrgSubfield.find(subfield_id)
+ attach_copied_obj.created_on = Time.now
+ attach_copied_obj.author_id = User.current.id
+ attach_copied_obj.is_public = 0
+ attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
+ if attach_copied_obj.attachtype == nil
+ attach_copied_obj.attachtype = 1
+ end
+ attach_copied_obj.save
+ end
+ end
+ elsif params[:send_ids].present?
+ send_ids = params[:send_ids].split(" ")
+ subfield_id = params[:subfield]
+ if subfield_id.nil?
+ @flag = false
+ end
+ send_ids.each do |send_id|
+
+ ori = Attachment.find_by_id(send_id)
+ unless subfield_id.nil?
+ next if ori.blank?
+ @exist = false
+ OrgSubfield.find(subfield_id).attachments.each do |att| #如果课程中包含该资源
+ if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
+ att.created_on = Time.now
+ att.save
+ @exist = true
+ break
+ end
+ end
+ next if @exist
+ attach_copied_obj = ori.copy
+ attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
+ attach_copied_obj.container = OrgSubfield.find(subfield_id)
+ attach_copied_obj.created_on = Time.now
+ attach_copied_obj.author_id = User.current.id
+ attach_copied_obj.is_public = 0
+ attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
+ if attach_copied_obj.attachtype == nil
+ attach_copied_obj.attachtype = 1
+ end
+ attach_copied_obj.save
+ end
+ end
+ else
+ @flag=true
+ end
+ user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
+ @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
@type = params[:type]
@limit = 25
@@ -1614,6 +1749,10 @@ class UsersController < ApplicationController
end
end
+ def change_org_subfield
+
+ end
+
# 资源预览
def resource_preview
preview_id = params[:resource_id]
@@ -1826,12 +1965,12 @@ class UsersController < ApplicationController
if(params[:type].blank? || params[:type] == "1") #全部
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
- @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
+ @attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话,应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " +
- "and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
+ "and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
end
elsif params[:type] == "2" #课程资源
@@ -1882,7 +2021,7 @@ class UsersController < ApplicationController
if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询
- @attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
+ @attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
" or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))) and (filename like :p) ",:p=>search).order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
@@ -1955,6 +2094,23 @@ class UsersController < ApplicationController
end
end
+ def search_user_org
+ @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}
+ else
+ @orgs = @user.organizations.select{|org| OrgSubfield.where("organization_id = #{org.id} and field_type='Resource'").count > 0}
+ end
+ @search = params[:search]
+ #这里仅仅是传递需要发送的资源id
+ @send_id = params[:send_id]
+ @send_ids = params[:checkbox1] || params[:send_ids]
+ respond_to do |format|
+ format.js
+ end
+ end
+
private
def find_user
diff --git a/app/helpers/api_helper.rb b/app/helpers/api_helper.rb
index f73cc87e6..8324951f9 100644
--- a/app/helpers/api_helper.rb
+++ b/app/helpers/api_helper.rb
@@ -180,7 +180,7 @@ module ApiHelper
if timePassed < 0
updateAtValue = "时间有问题"
elsif timePassed < ONE_MINUTE
- updateAtValue = "一分钟前"
+ updateAtValue = "1分钟前"
elsif timePassed < ONE_HOUR
timeIntoFormat = timePassed / ONE_MINUTE
updateAtValue = timeIntoFormat.to_s + "分钟前"
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 4bdffb9dc..55a017019 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -2588,6 +2588,12 @@ module ApplicationHelper
end
end
+ def file_preview_eye(file, html_options={})
+ if %w(pdf pptx doc docx xls xlsx).any?{|x| file.filename.downcase.end_with?(x)}
+ link_to '', download_named_attachment_path(file.id, file.filename, preview: true),html_options
+ end
+ end
+
#将文本内的/n转换为
def text_format text
text.gsub("&","&").gsub("<","<").gsub(">",">").gsub("\n"," ").html_safe
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index 963284f7f..d1ab6661a 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -49,6 +49,8 @@ module UsersHelper
'批改附件'
when 'Principal'
'用户资源'
+ when 'OrgSubfield'
+ '组织资源'
end
end
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index ad5655b02..c8fe0811e 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -32,6 +32,7 @@ class Attachment < ActiveRecord::Base
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
# end
include UserScoreHelper
+ has_many :attachment_histories
validates :filename, presence: true, length: {maximum: 254}
validates :author, presence: true
@@ -348,11 +349,18 @@ class Attachment < ActiveRecord::Base
# Deletes the file from the file system if it's not referenced by other attachments
def delete_from_disk
- if Attachment.where("disk_filename = ? AND id <> ?", disk_filename, id).empty?
+ #资源存在,且历史记录为0 且 该资源没有存在任何拷贝才能删除资源
+ if Attachment.where("disk_filename = ? AND id <> ?", disk_filename, id).empty? && self.attachment_histories.count == 0 && Attachment.where('copy_from = ?',self.id) .count == 0
delete_from_disk!
end
end
+ #有了历史记录的数据记录是不能被删除的。
+ #true 能被删除 false 不能被删除
+ def destroyable
+ self.attachment_histories.count == 0
+ end
+
# Returns file's location on disk
def diskfile
File.join(self.class.storage_path, disk_directory.to_s, disk_filename.to_s)
diff --git a/app/models/attachment_history.rb b/app/models/attachment_history.rb
new file mode 100644
index 000000000..2160d242d
--- /dev/null
+++ b/app/models/attachment_history.rb
@@ -0,0 +1,3 @@
+class AttachmentHistory < ActiveRecord::Base
+ belongs_to :attachment,foreign_key: 'attachment_id'
+end
diff --git a/app/models/journal.rb b/app/models/journal.rb
index 638a98006..a66c4327a 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -17,10 +17,10 @@
class Journal < ActiveRecord::Base
include UserScoreHelper
- belongs_to :journalized, :polymorphic => true
+ belongs_to :journalized, :polymorphic => true,:touch => true
# added as a quick fix to allow eager loading of the polymorphic association
# since always associated to an issue, for now
- belongs_to :issue, :foreign_key => :journalized_id
+ belongs_to :issue, :foreign_key => :journalized_id,:touch => true
belongs_to :user
has_many :details, :class_name => "JournalDetail", :dependent => :delete_all
diff --git a/app/models/message.rb b/app/models/message.rb
index 6d108e607..3bb08f481 100644
--- a/app/models/message.rb
+++ b/app/models/message.rb
@@ -199,8 +199,7 @@ class Message < ActiveRecord::Base
def act_as_forge_activity
# 如果project为空,那么就是课程相关的消息
if self.board.project_id != -1 && self.parent_id.nil?
- self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
- :project_id => self.board.project.id)
+ self.forge_acts << ForgeActivity.new(:user_id => self.author_id, :project_id => self.board.project.id)
end
end
diff --git a/app/models/organization.rb b/app/models/organization.rb
index 350dc3080..fcb777fb6 100644
--- a/app/models/organization.rb
+++ b/app/models/organization.rb
@@ -9,9 +9,15 @@ class Organization < ActiveRecord::Base
has_many :org_subfields, :dependent => :destroy
has_many :users, :through => :org_members
validates_uniqueness_of :name
- after_create :save_as_org_activity
+ after_create :save_as_org_activity, :add_default_subfields
def save_as_org_activity
OrgActivity.create(:user_id => User.current.id, :org_act_id => self.id, :org_act_type => 'CreateOrganization', :container_id => self.id, :container_type => 'Organization')
end
+
+ def add_default_subfields
+ OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default')
+ OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default')
+ OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default')
+ end
end
diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb
index 5d60238bf..aabe1a921 100644
--- a/app/services/courses_service.rb
+++ b/app/services/courses_service.rb
@@ -196,6 +196,8 @@ class CoursesService
@course.tea_id = current_user.id
@course.term = params[:term]
@course.time = params[:time]
+ @course.end_term = params[:end_term]
+ @course.end_time = params[:end_time]
#@course.school_id = params[:occupation]
@course.school_id = current_user.user_extensions.school_id
@course.setup_time = params[:setup_time]
diff --git a/app/views/attachments/_show_attachment_history.html.erb b/app/views/attachments/_show_attachment_history.html.erb
new file mode 100644
index 000000000..c1a6464e8
--- /dev/null
+++ b/app/views/attachments/_show_attachment_history.html.erb
@@ -0,0 +1,54 @@
+
+更新资源版本
+
+
+
+
当前版本
+
+
+
+
+ <% unless @attachment_histories.empty? %>
+
+
历史版本
+
+ <% @attachment_histories.each do |history| %>
+
+
+ 版本号:<%= history.version %>
+
+
+ <% end %>
+
+ <% end %>
+
+
+ <%= form_tag(upload_attachment_version_path, :multipart => true,:remote => !ie8?,:name=>"upload_form",:id=>'upload_form') do %>
+ <%= hidden_field_tag :old_attachment_id,@attachment.id %>
+
+
+
+
+
+
+ <%= render :partial => 'attachments/upload_attachment_new_version' %>
+
+
+
+
+
+
(未选择文件)
+
您可以上传小于50MB 的文件
+
+
+
+
+
+
+ <%= submit_tag '确定',:onclick=>'upload_attachment_version(event);',:onfocus=>'this.blur()',:id=>'upload_files_submit_btn',:class=>'sendSourceText' %>
+
+
+
+ <% end %>
+
+
\ No newline at end of file
diff --git a/app/views/attachments/_upload_attachment_new_version.html.erb b/app/views/attachments/_upload_attachment_new_version.html.erb
new file mode 100644
index 000000000..cd35535c0
--- /dev/null
+++ b/app/views/attachments/_upload_attachment_new_version.html.erb
@@ -0,0 +1,23 @@
+
+
+
+
+ 选择文件
+<%= file_field_tag 'attachments[dummy][file]',
+ :id => '_file',
+ :class => ie8? ? '':'file_selector',
+ :multiple => true,
+ :onchange => 'addInputFiles(this,"'+'upload_files_submit_btn'+'");',
+ :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',:old_attachment_id=>@attachment.id),
+ :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),
+ :lebel_file_uploding => l(:lebel_file_uploding),
+ :delete_all_files => l(:text_are_you_sure_all)
+ } %>
diff --git a/app/views/attachments/attachment_versions.js.erb b/app/views/attachments/attachment_versions.js.erb
new file mode 100644
index 000000000..4f3bf41c3
--- /dev/null
+++ b/app/views/attachments/attachment_versions.js.erb
@@ -0,0 +1,7 @@
+$("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/show_attachment_history' )%>');
+showModal('ajax-modal', '452px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before(" ");
+$('#ajax-modal').parent().css("top","40%").css("left","46%");
+$('#ajax-modal').parent().addClass("resourceUploadPopup");
+$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
\ No newline at end of file
diff --git a/app/views/attachments/update_file_dense.js.erb b/app/views/attachments/update_file_dense.js.erb
index d99481d08..747024dec 100644
--- a/app/views/attachments/update_file_dense.js.erb
+++ b/app/views/attachments/update_file_dense.js.erb
@@ -1,2 +1,12 @@
+<% if @attachment.container_type == 'Course' %>
+$("#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) %>");
+<%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) %>");
+<%end %>
+<%if @attachment.is_public? %>
+ $("#image_private_<%= @attachment.id%>").html('')
+<%else%>
+$("#image_private_<%= @attachment.id%>").html('私有 ')
+<%end%>
\ No newline at end of file
diff --git a/app/views/attachments/upload.js.erb b/app/views/attachments/upload.js.erb
index 970c5b22d..62db5ebfd 100644
--- a/app/views/attachments/upload.js.erb
+++ b/app/views/attachments/upload.js.erb
@@ -11,4 +11,5 @@ fileSpan.find('a.remove-upload')
})
.off('click');
$(' ', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan);
+$(' ',{type:'hidden',name:'attachments[<%= j params[:attachment_id] %>][attachment_id]'}).val('<%= @attachment.id %>').appendTo(fileSpan);
<% end %>
diff --git a/app/views/attachments/upload_attachment_version.js.erb b/app/views/attachments/upload_attachment_version.js.erb
new file mode 100644
index 000000000..eb5559563
--- /dev/null
+++ b/app/views/attachments/upload_attachment_version.js.erb
@@ -0,0 +1,7 @@
+<% if @flag %>
+ hideModal();
+ alert('更新成功')
+ $(".re_search").submit();
+<%else%>
+ $("#upload_file_count").html('(更新失败)')
+<%end %>
\ No newline at end of file
diff --git a/app/views/blog_comments/reply.js.erb b/app/views/blog_comments/reply.js.erb
index 06adca74d..fe46d870c 100644
--- a/app/views/blog_comments/reply.js.erb
+++ b/app/views/blog_comments/reply.js.erb
@@ -1,7 +1,24 @@
<% if @in_user_center%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
- init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
+// init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity');
<% else%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/article', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
+//init_activity_KindEditor_data(<%#= @user_activity_id%>,"","87%", 'UserActivity');
+<% end %>
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
-<% end %>
\ No newline at end of file
+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();
+});
\ No newline at end of file
diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb
index 33a3201c0..99c743a96 100644
--- a/app/views/blogs/_article.html.erb
+++ b/app/views/blogs/_article.html.erb
@@ -57,13 +57,14 @@
发帖时间:<%= format_time(activity.created_on) %>
-
-
- <% if activity.parent_id.nil? %>
- <%= activity.content.to_s.html_safe%>
- <% else %>
- <%= activity.parent.content.to_s.html_safe%>
- <% end %>
+
+
+ <% if activity.parent_id.nil? %>
+ <%= activity.content.to_s.html_safe%>
+ <% else %>
+ <%= activity.parent.content.to_s.html_safe%>
+ <% end %>
+
@@ -72,6 +73,11 @@
<%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => activity.attachments, :options => options, :is_float => true} %>
<% end %>
+
+
+
+
+
diff --git a/app/views/blogs/_article_list.html.erb b/app/views/blogs/_article_list.html.erb
index f6383c95b..62f1391b0 100644
--- a/app/views/blogs/_article_list.html.erb
+++ b/app/views/blogs/_article_list.html.erb
@@ -76,15 +76,21 @@
$(function () {
init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>");
showNormalImage('activity_description_<%= topic.id %>');
- /*var description_images=$("div#activity_description_<%#= topic.id %>").find("img");
- if (description_images.length>0) {
- for (var i=0; i").attr("href",image.attr('src'));
- image.wrap(element);
- }
- }
- $('#activity_description_<%#= topic.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});*/
+ 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();
+ });
});
<% if topic %>
diff --git a/app/views/boards/_course_show_detail.html.erb b/app/views/boards/_course_show_detail.html.erb
index 7b96c4f9a..8f50905c6 100644
--- a/app/views/boards/_course_show_detail.html.erb
+++ b/app/views/boards/_course_show_detail.html.erb
@@ -42,19 +42,25 @@
$(function () {
init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
showNormalImage('activity_description_<%= topic.id %>');
- /*var description_images=$("div#activity_description_<%#= topic.id %>").find("img");
- if (description_images.length>0) {
- for (var i=0; i").attr("href",image.attr('src'));
- image.wrap(element);
- }
- }
- $('#activity_description_<%#= topic.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});*/
+ 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();
+ });
});
<% if topic %>
- <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id} %>
+ <%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id,:is_course=>1,:is_board=>1} %>
<% end %>
<% end %>
diff --git a/app/views/boards/_project_show_detail.html.erb b/app/views/boards/_project_show_detail.html.erb
index 8fb663aff..5b266b90c 100644
--- a/app/views/boards/_project_show_detail.html.erb
+++ b/app/views/boards/_project_show_detail.html.erb
@@ -41,19 +41,25 @@
$(function () {
init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
showNormalImage('activity_description_<%= topic.id %>');
- /*var description_images=$("div#activity_description_<%#= topic.id %>").find("img");
- if (description_images.length>0) {
- for (var i=0; i").attr("href",image.attr('src'));
- image.wrap(element);
- }
- }
- $('#activity_description_<%#= topic.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});*/
+ 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();
+ });
});
<% if topic %>
- <%= render :partial => 'users/project_message', :locals => {:activity => topic, :user_activity_id => topic.id} %>
+ <%= render :partial => 'users/project_message', :locals => {:activity => topic, :user_activity_id => topic.id,:is_course=>1,:is_board=>1} %>
<% end %>
<% end %>
diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb
index 2f2622f3c..ea41787d5 100644
--- a/app/views/courses/_course_activity.html.erb
+++ b/app/views/courses/_course_activity.html.erb
@@ -99,7 +99,7 @@
<% when 'News' %>
<%= render :partial => 'users/course_news', :locals => {:activity => act, :user_activity_id => activity.id} %>
<% when 'Message' %>
- <%= render :partial => 'users/course_message', :locals => {:activity => act, :user_activity_id => activity.id} %>
+ <%= render :partial => 'users/course_message', :locals => {:activity => act, :user_activity_id => activity.id,:is_course=>1,:is_board=>0} %>
<% when 'Poll' %>
<%= render :partial => 'users/course_poll', :locals => {:activity => act, :user_activity_id => activity.id} %>
<% when 'JournalsForMessage' %>
diff --git a/app/views/courses/_tool_expand.html.erb b/app/views/courses/_tool_expand.html.erb
index e032496ea..50854cf23 100644
--- a/app/views/courses/_tool_expand.html.erb
+++ b/app/views/courses/_tool_expand.html.erb
@@ -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) %>
- <%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02 ml10"%>
+ <%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 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 %>
<% end %>
<% if show_nav?(@course.news.count) %>
- <%= link_to l(:label_course_news), course_news_index_path(@course), :class => "f14 c_blue02 ml10" %>
+ <%= link_to l(:label_course_news), course_news_index_path(@course), :class => "f14 c_blue02 ml10 fn" %>
<%= link_to( "", new_course_news_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_news_new)}") if is_teacher %>
<% end %>
<% if show_nav?(course_file_num) %>
- <%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02 ml10" %>
+ <%= link_to l(:label_course_file), course_files_path(@course), :class => "f14 c_blue02 ml10 fn" %>
<% if is_teacher || (@course.publish_resource == 1 && User.current.member_of_course?(@course)) %>
@@ -23,25 +23,25 @@
<% end %>
<% if show_nav?(@course.boards.first ? @course.boards.first.topics.count : 0) %>
- <%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 c_blue02 ml10" %>
+ <%= link_to l(:label_course_board), course_boards_path(@course), :class => "f14 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 %>
<% end %>
<% if show_nav?(course_feedback_count) %>
- <%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02 ml10" %>
+ <%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02 ml10 fn" %>
<%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
<% end %>
<% if show_nav?(course_poll_count) %>
- <%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f14 c_blue02 ml10"%>
+ <%= link_to l(:label_poll), poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => " f14 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 %>
<% end %>
<% if show_nav?(User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count) %>
- <%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02 ml10"%>
+ <%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02 ml10 fn"%>
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'courseMenuSetting', :title =>"新建试卷") if is_teacher %>
<% end %>
\ No newline at end of file
diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb
index f1b917816..9875ec9b7 100644
--- a/app/views/courses/new.html.erb
+++ b/app/views/courses/new.html.erb
@@ -4,64 +4,82 @@
<%= labelled_form_for @course do |f| %>
-
-
-
- * <%= l(:label_tags_course_name)%> :
-
- 课程名称不能为空
-
-
-
- * <%= l(:label_class_period)%> :
-
-
-
-
-
- * <%= l(:label_course_term)%> :
- <%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %>
- <%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
-
-
-
- * <%= l(:label_new_course_password)%> :
-
-
- 显示明码
-
+
+
+
+ * <%= l(:label_tags_course_name)%> :
+
+ 课程名称不能为空
+
- 学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。
-
-
- <%= l(:label_new_course_description)%> :
-
+
+ * <%= l(:label_class_period)%> :
+
+
+
-
-
- 公开 :
-
- (打钩为公开,不打钩则不公开,若不公开,仅课程成员可见该课程。)
+
+ * <%= l(:label_course_term)%> :
+ <%= select_tag :time,options_for_select(course_time_option(@course.time),@course.time), {} %>
+ <%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{} %>
+
+
-
-
- 学生列表公开 :
-
- (打钩为"学生列表公开",不打钩为不公开,若不公开,则课程外部人员看不到学生列表)
+
+ * 结束学期 :
+ <%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {} %>
+ <%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{} %>
+ 仅针对跨越多个学期的班级,否则不用修改。
+
-
-
+
+ * <%= l(:label_new_course_password)%> :
+
+
+ 显示明码
+
+
+ 学生或其他成员申请加入课程时候需要使用该口令,该口令可以由老师在课堂上公布。
+
+
+ <%= l(:label_new_course_description)%> :
+
+
+
+
+ 公开 :
+
+ (选中后课外用户可见该课程,否则仅对课内成员可见)
+
+
+
+ 学生列表公开 :
+
+ (选中后课外用户可见学生列表,否则仅对课内成员可见)
+
+
+
学生上传资源 :
id="course_publish_resource" name="course[publish_resource]" type="checkbox" />
- (打钩为"允许学生上传资源",不打钩为"不允许学生上传资源")
+ (选中后允许学生上传课程资源,否则不允许)
-
-
- 提交
- <%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
-
-
+
+
+ 提交
+ <%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
+
+
<% end%>
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/app/views/courses/settings.html.erb b/app/views/courses/settings.html.erb
index ae6416c9d..23d0a2a3f 100644
--- a/app/views/courses/settings.html.erb
+++ b/app/views/courses/settings.html.erb
@@ -2,11 +2,11 @@
<%= l(:label_course_modify_settings)%>
@@ -50,6 +50,12 @@
<%= select_tag :term,options_for_select(course_term_option,@course.term || cur_course_term),{:id=>"term_selected"} %>
+
+ * 结束学期 :
+ <%= select_tag :end_time,options_for_select(course_time_option(@course.end_time),@course.end_time), {:id=>"end_time_selected"} %>
+ <%= select_tag :end_term,options_for_select(course_term_option,@course.end_term || cur_course_term),{:id=>"end_term_selected"} %>
+
+
* <%= l(:label_new_course_password)%> :
@@ -123,15 +129,17 @@
diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb
index a0cb419b2..9513baab0 100644
--- a/app/views/files/_course_file.html.erb
+++ b/app/views/files/_course_file.html.erb
@@ -1,4 +1,9 @@
+
-
-
-
- <%= form_tag( search_course_files_path(@course), 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",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()" %>
- <%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
+
+
+ <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
<% html_title(l(:label_attachment_plural)) -%>
\ No newline at end of file
diff --git a/app/views/files/_course_list.html.erb b/app/views/files/_course_list.html.erb
index f04d70577..08e23fb19 100644
--- a/app/views/files/_course_list.html.erb
+++ b/app/views/files/_course_list.html.erb
@@ -1,79 +1,90 @@
-<% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
-
-
共有 <%= all_attachments.count%> 个资源
-
- <% 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 %>
-
-
-
-
-
- <%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => course,:tag_name => @tag_name}%>
-
-
-
+<% delete_allowed = User.current.allowed_to?(:manage_files, course) %>
<% curse_attachments.each do |file| %>
<% if file.is_public? || User.current.member_of_course?(course) || User.current.admin? %>
-
-
- <%= 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" %>
- <% if User.current.logged? %>
- <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
- <%= link_to("选入我的其他课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
+
+
+
+ <%= link_to image_tag(url_to_avatar(file.author), :width => 50, :height => 50), user_path(file.author) %>
+
+
+
+ <%= link_to truncate(file.filename,length: 35, omission: '...'),
+ download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkBlue f_14 f_b" %>
+ <%= file_preview_eye(file, class: 'preview') %>
+
+ <% if file.is_public? == false%>
+ 私有
+ <%end %>
+
+
+
+
上传时间:<%= format_date(file.created_on)%>
+ <% if file.tag_list.length > 0%>
+
上传类型:<%= file.tag_list[0] %>
+ <% end %>
+
文件大小:<%= number_to_human_size(file.filesize) %>
+
下载<%= file.downloads%> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
+
+
+
+
+ <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+ <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
+
+
+
+
+
+ <% if User.current.logged? %>
- <% if delete_allowed && file.container_id == @course.id && file.container_type == "Course" %>
- <% if @course.is_public? %>
-
- <%= link_to (file.is_public? ? "公开":"私有"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"f_l re_open c_blue",:method => :post %>
-
- <% else %>
-
- 私有
-
- <% end %>
+ <% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
+ <% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
+
- <% else %>
-
- <% end %>
- <% else %>
- <%= link_to("选入我的课程",quote_resource_show_course_file_path(@course,file),:class => "f_l re_select c_lorange",:remote => true) if has_course?(User.current,file) %>
- <% end %>
- <%= file_preview_tag(file, class: 'f_l re_open') %>
- <% else %>
- <% end %>
-
-
-
-
文件大小:<%= number_to_human_size(file.filesize) %>
- <%= 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 == @course.id && file.container_type == "Course"%>
-
<%= time_tag(file.created_on).html_safe %><%= l(:label_bids_published_ago) %> | 下载<%= file.downloads %> | 引用<%= file.quotes.nil? ? 0:file.quotes %>
-
-
-
-
- <%= render :partial => 'tags/tag_new', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
- <%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
-
-
-
+
<%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}')") %>
+
<%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
+ <% if @course.is_public? %>
+
+
+ <%= 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 %>
+
+
+ <%end%>
+
+ <%= link_to( '删除资源', attachment_path(file),
+ :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
+
+
+
+ <% end %>
+ <%else%>
+
+ <%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}')") %>
+
+ <% end %>
+ <% end %>
+
+
+
+
+
+
+
+
+
<% else %>
<%= file.filename %>是私有资源
<% end %>
<% end %>
-
-
- <%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
-
-
+
+<% 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%>
+
+ <%=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" %>
+ <%end%>
+<% end%>
+
diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb
index 3d1ded552..f9c6c1666 100644
--- a/app/views/files/_tag_yun.html.erb
+++ b/app/views/files/_tag_yun.html.erb
@@ -8,12 +8,12 @@
<% tag_list.each do |k,v|%>
<% if tag_name && tag_name == k%>
-
<%= k%>(<%= v%>)
+
<%= k%> x<%= v%>
<% else%>
<%= k%>(<%= v%>)
+ ondblclick="rename_tag($(this),'<%= k %>','',<%= 6 %>);"><%= k%> x<%= v%>
<% end%>
<% end%>
<% end%>
\ No newline at end of file
diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb
index 8b199ab4e..383ea155e 100644
--- a/app/views/files/index.html.erb
+++ b/app/views/files/index.html.erb
@@ -1,12 +1,18 @@
-
+
<% if @container_type == 0 %>
- <%= render :partial => 'project_file_new', locals: {project: @project} %>
+
+ <%= render :partial => 'project_file_new', locals: {project: @project} %>
+
<% elsif @container_type == 1 %>
- <%= render :partial => 'course_file', locals: {course: @course} %>
+
+ <%= render :partial => 'course_file', locals: {course: @course} %>
+
<% elsif @container_type == 2 %>
- <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
+
+ <%= render :partial => 'files/subfield_files', locals: {org_subfield: @org_subfield} %>
+
<% end %>
-
+
diff --git a/app/views/files/index.js.erb b/app/views/files/index.js.erb
new file mode 100644
index 000000000..e4f38f7d9
--- /dev/null
+++ b/app/views/files/index.js.erb
@@ -0,0 +1,4 @@
+
+<% if @course %>
+$("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>");
+<%end %>
\ No newline at end of file
diff --git a/app/views/files/search.js.erb b/app/views/files/search.js.erb
index 50f46d2f5..fd88b3f9e 100644
--- a/app/views/files/search.js.erb
+++ b/app/views/files/search.js.erb
@@ -1 +1,6 @@
-$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>");
\ No newline at end of file
+<% if (@obj_pages &&( @obj_pages.page > 1)) || (@feedback_pages && (@feedback_pages.page > 1)) %> //搜索的时候有时候是需要加载下一页,有时候是直接替换当前 #course_list。这个根据 page来判定
+ $("#show_more_attachments").replaceWith("<%= escape_javascript( render :partial => 'files/course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach} )%>");
+<% else %>
+ $("#course_list").html("<%= escape_javascript(render :partial => 'files/course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>");
+ $("#attachment_count").html("<%= @result.count%>")
+<% end %>
\ No newline at end of file
diff --git a/app/views/files/search_tag_attachment.js.erb b/app/views/files/search_tag_attachment.js.erb
index 50f46d2f5..4b1e9734d 100644
--- a/app/views/files/search_tag_attachment.js.erb
+++ b/app/views/files/search_tag_attachment.js.erb
@@ -1 +1,2 @@
-$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>");
\ No newline at end of file
+$("#course_list").html("<%= escape_javascript(render :partial => 'course_list',:locals => {course: @course,all_attachments: @result,sort:@sort,order:@order,curse_attachments:@searched_attach})%>");
+$("#attachment_count").html("<%= @result.count%>")
\ No newline at end of file
diff --git a/app/views/messages/edit.html.erb b/app/views/messages/edit.html.erb
index 6e54a88e1..89fe71c65 100644
--- a/app/views/messages/edit.html.erb
+++ b/app/views/messages/edit.html.erb
@@ -1,6 +1,6 @@
<% if @message.project %>
<%= form_for @message, {:as => :message,
- :url => {:action => 'edit'},
+ :url => {:action => 'edit',:is_course=>@is_course,:is_board=>@is_board},
:html => {:multipart => true,
:id => 'message-form',
:method => :post}
@@ -14,7 +14,7 @@
<% elsif @message.course %>
<%= form_for @message, {
:as => :message,
- :url => {:action => 'edit'},
+ :url => {:action => 'edit',:is_course=>@is_course,:is_board=>@is_board},
:html => {:multipart => true,
:id => 'message-form',
:method => :post}
diff --git a/app/views/messages/reply.js.erb b/app/views/messages/reply.js.erb
index c0da5ab9b..ea848439f 100644
--- a/app/views/messages/reply.js.erb
+++ b/app/views/messages/reply.js.erb
@@ -1,8 +1,24 @@
<%if @project%>
- $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
+ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
<%elsif @course%>
- $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
+ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
<% elsif @org_subfield %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%end%>
-init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
\ No newline at end of file
+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();
+});
\ No newline at end of file
diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb
index 56cf4b915..9cca5da5c 100644
--- a/app/views/my/account.html.erb
+++ b/app/views/my/account.html.erb
@@ -44,9 +44,7 @@
<%= l(:label_account_identity_student) %>
-
- <%= l(:label_account_identity_enterprise) %>
-
+
<%= l(:label_account_identity_developer) %>
diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb
index 9699eff5f..22b0b2cb4 100644
--- a/app/views/organizations/_org_course_homework.html.erb
+++ b/app/views/organizations/_org_course_homework.html.erb
@@ -44,7 +44,27 @@
教师评阅中
<% end%>
<% end%>
+
+ <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%>
+
系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
+ <% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%>
+
系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!
+ <% end %>
+ <% if activity.homework_type == 3 && !is_teacher && activity.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(activity.course)%>
+ <% projects = cur_user_projects_for_homework activity %>
+ <% works = cur_user_works_for_homework activity %>
+ <% if works.nil? && projects.nil? %>
+
+ <%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
+ <%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
+
+ <% elsif works.nil? %>
+
+ <%=link_to "取消关联",cancel_relate_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity), :confirm => "您确定要取消关联吗?", remote: true,:class => "c_blue", :title=> '取消关联项目' %>
+
+ <% end %>
+ <% end %>
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<%= user_for_homework_common activity,is_teacher %>
@@ -61,8 +81,16 @@
<%= activity.language_name%>
<% end %>
-
-
截止时间:<%= activity.end_time.to_s %> 23:59
+ <% if activity.homework_type == 3 && activity.homework_detail_group%>
+
+ 分组人数:<%=activity.homework_detail_group.min_num %>-<%=activity.homework_detail_group.max_num %> 人
+
+ <% end %>
+ <% if activity.homework_detail_manual && activity.homework_detail_manual.comment_status < 2 %>
+
提交截止时间:<%= activity.end_time.to_s %> 23:59
+ <% elsif activity.homework_detail_manual && activity.homework_detail_manual.comment_status >= 2 %>
+
匿评截止时间:<%= activity.homework_detail_manual.evaluation_end.to_s %> 23:59
+ <% end %>
@@ -73,10 +101,88 @@
+
+
+ 迟交扣分:<%= activity.late_penalty%>分
+
+ <% if activity.anonymous_comment == 0%>
+
+ 匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%> 00:00
+
+ <% end %>
+
+
+
+
+ 缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
+
+ <% if activity.anonymous_comment == 0%>
+
+ 匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%> 23:59
+
+ <% end %>
+
+
+ <% if activity.student_works.count != 0 %>
+ <% sw = activity.student_works.reorder("created_at desc").first %>
+
+ <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
+
+ <% end %>
+
+ <% if activity.student_works.count != 0 %>
+ <% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %>
+ <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
+ <% unless student_work_scores.empty? %>
+ <% last_score = student_work_scores.first %>
+
+ <%=time_from_now last_score.created_at %><%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品
+
+ <% end %>
+ <% end %>
+
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => activity.attachments} %>
+ <% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
+
+ <% projects = activity.student_work_projects.where("is_leader = 1") %>
+
+ 已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
+
+ <% projects.each do |pro| %>
+ <% project = Project.find pro.project_id %>
+
+
+
+ <% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
+ <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %>
+ <% else %>
+ <%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
+ <% end %>
+ <% time=project.updated_on %>
+ <% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
+
<%=(User.find project.user_id).show_name %> (组长)
+
<%=time_from_now time %>
+
+ 项目名称:<%=project.name %>
+ 创建者:<%=(User.find project.user_id).show_name %>(组长)
+ 更新时间:<%=time_from_now time %>
+
+
+ <% end %>
+
+ <% end %>
+
<% if is_teacher%>
<% comment_status = activity.homework_detail_manual.comment_status %>
diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb
index 8a092f7e2..de837c66f 100644
--- a/app/views/organizations/_subfield_list.html.erb
+++ b/app/views/organizations/_subfield_list.html.erb
@@ -11,7 +11,7 @@
<%= name %>
默认
默认
-
<%= field.hide==0?"设为隐藏":"设为显示" %>
+
<%= field.hide==0?"设为隐藏":"设为可见" %>
<% end %>
@@ -27,7 +27,7 @@
新增
<%= field.field_type == "Post" ? "帖子" : "资源" %>
<%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %>
-
<%= field.hide==0?"设为隐藏":"设为显示" %>
+
<%= field.hide==0?"设为隐藏":"设为可见" %>
<%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %>
编辑
diff --git a/app/views/organizations/hide_org_subfield.js.erb b/app/views/organizations/hide_org_subfield.js.erb
index 09ed3c280..18241c269 100644
--- a/app/views/organizations/hide_org_subfield.js.erb
+++ b/app/views/organizations/hide_org_subfield.js.erb
@@ -1,2 +1,2 @@
-$("#hide_<%= @org_subfield.id %>").text("设为显示");
+$("#hide_<%= @org_subfield.id %>").text("设为可见");
$("#org_subfield_<%= @org_subfield.id %>").css("display", "none");
\ No newline at end of file
diff --git a/app/views/organizations/org_resources_subfield.js.erb b/app/views/organizations/org_resources_subfield.js.erb
new file mode 100644
index 000000000..6c1f2d690
--- /dev/null
+++ b/app/views/organizations/org_resources_subfield.js.erb
@@ -0,0 +1,2 @@
+$(".columnContent").html('<%= escape_javascript( render :partial => 'users/org_resources_subfield',:locals => {:subfield=>@subfield})%>')
+$(".orgDirection").text('目标地址:'+'<%= @org.name.html_safe%>')
\ No newline at end of file
diff --git a/app/views/projects/_project_activities.html.erb b/app/views/projects/_project_activities.html.erb
index b46522fa1..781b65810 100644
--- a/app/views/projects/_project_activities.html.erb
+++ b/app/views/projects/_project_activities.html.erb
@@ -34,7 +34,7 @@
$(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) {
+ if ($("#intro_content_<%= activity.id %>").height() > 810) {
$("#intro_content_show_<%= activity.id %>").show();
}
$("#intro_content_show_<%= activity.id %>").click(function () {
@@ -61,7 +61,7 @@
<% when "Message" %>
- <%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id} %>
+ <%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id,:is_course=>1,:is_board=>0} %>
<% when "News" %>
<% if !activity.forge_act.nil? and activity.forge_act.project %>
diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb
index a0ce84795..db276d88b 100644
--- a/app/views/users/_course_homework.html.erb
+++ b/app/views/users/_course_homework.html.erb
@@ -124,6 +124,24 @@
<% end %>
+ <% if activity.student_works.count != 0 %>
+ <% sw = activity.student_works.reorder("created_at desc").first %>
+
+ <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
+
+ <% end %>
+
+ <% if activity.student_works.count != 0 %>
+ <% sw_id = "("+activity.student_works.map{|sw| sw.id}.join(",")+")" %>
+ <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
+ <% unless student_work_scores.empty? %>
+ <% last_score = student_work_scores.first %>
+
+ <%=time_from_now last_score.created_at %><%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品
+
+ <% end %>
+ <% end %>
+
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => activity.attachments} %>
@@ -131,7 +149,7 @@
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<% projects = activity.student_work_projects.where("is_leader = 1") %>
-
+
已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
<% projects.each do |pro| %>
@@ -154,7 +172,7 @@
<% end %>
<% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
-
<%=(User.find project.user_id).show_name %> (组长)
+
<%=(User.find project.user_id).show_name %> (组长)
<%=time_from_now time %>
项目名称:<%=project.name %>
diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb
index 4996f7730..22a4bcf57 100644
--- a/app/views/users/_course_message.html.erb
+++ b/app/views/users/_course_message.html.erb
@@ -1,4 +1,4 @@
-
+
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
@@ -43,17 +43,38 @@
-
+
+
+
- 编辑
- 复制
- 删除
+ <% if activity.author.id == User.current.id%>
+
+ <%= link_to(
+ l(:button_edit),
+ edit_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
+ :class => 'postOptionLink'
+ ) if activity.course_editable_by?(User.current) %>
+
+
+ <%= link_to(
+ l(:button_delete),
+ delete_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
+ :method => :post,
+ :data => {:confirm => l(:text_are_you_sure)},
+ :class => 'postOptionLink'
+ ) if activity.course_destroyable_by?(User.current) %>
+
+ <% end %>
+
+ <%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %>
+
+
@@ -120,7 +141,7 @@
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
- <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
+ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => is_board,is_course=>is_course},:method => "post", :remote => true) do |f|%>
diff --git a/app/views/users/_org_resources_subfield.html.erb b/app/views/users/_org_resources_subfield.html.erb
new file mode 100644
index 000000000..989191dc7
--- /dev/null
+++ b/app/views/users/_org_resources_subfield.html.erb
@@ -0,0 +1,10 @@
+
请选择栏目:
+<% unless subfield.nil? || subfield.empty? %>
+ <% subfield.each do |field| %>
+
+
+
+ <%= field.name %>
+
+ <%end %>
+<%end %>
\ No newline at end of file
diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb
index b9ebc2135..5a9f7e398 100644
--- a/app/views/users/_project_message.html.erb
+++ b/app/views/users/_project_message.html.erb
@@ -1,4 +1,4 @@
-
+
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
@@ -44,6 +44,36 @@
+
+
+
+
+
+ <% if activity.author.id == User.current.id%>
+
+ <%= link_to(
+ l(:button_edit),
+ edit_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
+ :class => 'postOptionLink'
+ ) if activity.editable_by?(User.current) %>
+
+
+ <%= link_to(
+ l(:button_delete),
+ delete_board_message_path(activity.id,:board_id=>activity.board_id,:is_course=>is_course,:is_board=>is_board),
+ :method => :post,
+ :data => {:confirm => l(:text_are_you_sure)},
+ :class => 'postOptionLink'
+ ) if activity.destroyable_by?(User.current) %>
+
+ <% end %>
+
+ <%= link_to "发送",messages_join_org_subfield_path(:message_id => activity.id) , :remote=> true,:class => 'postOptionLink' %>
+
+
+
+
+
@@ -56,9 +86,7 @@
-
回复(
- <%=count %>
- )
+
回复(<%=count %>)
<%#=format_date(activity.updated_on)%>
<%if count>3 %>
diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb
new file mode 100644
index 000000000..9da439c8e
--- /dev/null
+++ b/app/views/users/_resource_share_for_orgs.html.erb
@@ -0,0 +1,58 @@
+
+
发送到
+
+
+ 课程
+ 项目
+ 组织
+
+
+ <%= form_tag search_user_org_user_path(user),:method => 'get',
+ :remote=>true,:id=>'search_user_org_form' do %>
+ <%= hidden_field_tag(:send_id, send_id) %>
+ <%= hidden_field_tag(:send_ids, send_ids) %>
+
+
+ <% end %>
+
+
+<%= form_tag add_exist_file_to_org_user_path(user),:remote=>true,:id=>'orgs_list_form' do %>
+ <%= hidden_field_tag(:send_id, send_id) %>
+ <%= hidden_field_tag(:send_ids, send_ids) %>
+
+
+
+
+
+ <%= render :partial => 'users/org_resources_subfield',:locals => {:subfield=>nil}%>
+
+
+
+
+
+
+
+
+
目标地址:
+
+ <%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();',:onclick=>"check_des(event);" %>
+
+
+
+ <%end %>
\ No newline at end of file
diff --git a/app/views/users/_resource_share_for_project_popup.html.erb b/app/views/users/_resource_share_for_project_popup.html.erb
index ba136899c..10df82feb 100644
--- a/app/views/users/_resource_share_for_project_popup.html.erb
+++ b/app/views/users/_resource_share_for_project_popup.html.erb
@@ -2,11 +2,12 @@
-
将资源发送至
+
发送到
课程
项目
+ 组织
@@ -47,7 +48,7 @@
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
-
+
<% end %>
diff --git a/app/views/users/_resource_share_popup.html.erb b/app/views/users/_resource_share_popup.html.erb
index 53fb6673b..a12a02683 100644
--- a/app/views/users/_resource_share_popup.html.erb
+++ b/app/views/users/_resource_share_popup.html.erb
@@ -2,11 +2,12 @@
-
将资源发送至
+
发送到
课程
项目
+ 组织
@@ -47,7 +48,7 @@
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
-
+
<% end %>
diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb
index ef6397ec0..a0a1377f1 100644
--- a/app/views/users/_resources_list.html.erb
+++ b/app/views/users/_resources_list.html.erb
@@ -7,7 +7,7 @@
<% attachments.each do |attach| %>
-
+
diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb
index 5cadcddd6..bb1a42f58 100644
--- a/app/views/users/_user_activities.html.erb
+++ b/app/views/users/_user_activities.html.erb
@@ -69,7 +69,7 @@
<% when 'News' %>
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% when 'Message'%>
- <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
+ <%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
<% when 'Poll' %>
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
<% when 'Course'%>
@@ -82,7 +82,7 @@
<% when 'Issue' %>
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% when 'Message' %>
- <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
+ <%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
<% when 'ProjectCreateInfo'%>
<%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% end %>
diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb
index 0472613e4..6cb502d77 100644
--- a/app/views/users/_user_homework_detail.html.erb
+++ b/app/views/users/_user_homework_detail.html.erb
@@ -127,6 +127,24 @@
<% end %>
+ <% if homework_common.student_works.count != 0 %>
+ <% sw = homework_common.student_works.reorder("created_at desc").first %>
+
+ <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
+
+ <% end %>
+
+ <% if homework_common.student_works.count != 0 %>
+ <% sw_id = "("+homework_common.student_works.map{|sw| sw.id}.join(",")+")" %>
+ <% student_work_scores = StudentWorksScore.where("student_work_id in #{sw_id}").reorder("created_at desc") %>
+ <% unless student_work_scores.empty? %>
+ <% last_score = student_work_scores.first %>
+
+ <%=time_from_now last_score.created_at %><%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品
+
+ <% end %>
+ <% end %>
+
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
@@ -134,7 +152,7 @@
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %>
<% projects = homework_common.student_work_projects.where("is_leader = 1") %>
-
+
已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
<% projects.each do |pro| %>
@@ -156,7 +174,7 @@
<% end %>
<% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
-
<%=(User.find project.user_id).show_name %> (组长)
+
<%=(User.find project.user_id).show_name %> (组长)
<%=time_from_now time %>
项目名称:<%=project.name %>
diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb
index 29be69a23..d145dab90 100644
--- a/app/views/users/_user_homework_form.html.erb
+++ b/app/views/users/_user_homework_form.html.erb
@@ -5,9 +5,9 @@
@@ -53,8 +53,8 @@
<% if !edit_mode || edit_mode && homework.homework_detail_manual.comment_status < 2 %>
-
- 启用匿评
+
+ 禁用匿评
<% end %>
diff --git a/app/views/users/add_exist_file_to_course.js.erb b/app/views/users/add_exist_file_to_course.js.erb
index 95f7784f7..57fe9d42d 100644
--- a/app/views/users/add_exist_file_to_course.js.erb
+++ b/app/views/users/add_exist_file_to_course.js.erb
@@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
$("#res_all_count").html(<%= @atta_count%>);
-closePopUp();
+hideModal();
alert("发送成功")
<% else%>
<% end %>
\ No newline at end of file
diff --git a/app/views/users/add_exist_file_to_org.js.erb b/app/views/users/add_exist_file_to_org.js.erb
new file mode 100644
index 000000000..57fe9d42d
--- /dev/null
+++ b/app/views/users/add_exist_file_to_org.js.erb
@@ -0,0 +1,10 @@
+<% if @flag == true%>
+$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>');
+$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
+$("#res_count").html(0);
+$("#checkboxAll").attr('checked',false);
+$("#res_all_count").html(<%= @atta_count%>);
+hideModal();
+alert("发送成功")
+<% else%>
+<% end %>
\ No newline at end of file
diff --git a/app/views/users/add_exist_file_to_project.js.erb b/app/views/users/add_exist_file_to_project.js.erb
index 95f7784f7..57fe9d42d 100644
--- a/app/views/users/add_exist_file_to_project.js.erb
+++ b/app/views/users/add_exist_file_to_project.js.erb
@@ -4,7 +4,7 @@ $("#resources_list").html('<%= escape_javascript( render :partial => 'resources_
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);
$("#res_all_count").html(<%= @atta_count%>);
-closePopUp();
+hideModal();
alert("发送成功")
<% else%>
<% end %>
\ No newline at end of file
diff --git a/app/views/users/change_org_subfield.js.erb b/app/views/users/change_org_subfield.js.erb
new file mode 100644
index 000000000..e69de29bb
diff --git a/app/views/users/search_user_course.js.erb b/app/views/users/search_user_course.js.erb
index 2a0c98cad..f32ed521a 100644
--- a/app/views/users/search_user_course.js.erb
+++ b/app/views/users/search_user_course.js.erb
@@ -9,10 +9,10 @@
//$("#upload_box").css('left','').css('top','');
//$("#upload_box").html('<%#= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
//$("#upload_box").css('display','block');
-$("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
+$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_popup' ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before("
");
+$('#ajax-modal').before("
");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
diff --git a/app/views/users/search_user_org.js.erb b/app/views/users/search_user_org.js.erb
new file mode 100644
index 000000000..94ac37968
--- /dev/null
+++ b/app/views/users/search_user_org.js.erb
@@ -0,0 +1,9 @@
+$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/resource_share_for_orgs' ,:locals => {:orgs=>@orgs,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
+showModal('ajax-modal', '452px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before("
");
+$('#ajax-modal').parent().css("top","").css("left","");
+$('#ajax-modal').parent().addClass("popbox").addClass("shareDP");
+$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
+var val = $("#search_org_input").val();
+$("#search_org_input").val("").focus().val(val);
\ No newline at end of file
diff --git a/app/views/users/search_user_project.js.erb b/app/views/users/search_user_project.js.erb
index f38d9edc8..b99d36348 100644
--- a/app/views/users/search_user_project.js.erb
+++ b/app/views/users/search_user_project.js.erb
@@ -8,7 +8,7 @@
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'resource_share_for_project_popup' ,:locals => {:projects=>@projects,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
-$('#ajax-modal').before("
");
+$('#ajax-modal').before("
");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("resourceUploadPopup").addClass("popbox")
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb
index 418809917..2f94e4401 100644
--- a/app/views/users/user_resource.html.erb
+++ b/app/views/users/user_resource.html.erb
@@ -41,6 +41,20 @@
function submit_files(){
$("#upload_form").submit();
}
+
+ function check_des(event){
+ if($(".sectionContent").find('input[type="radio"]:checked').length <= 0){
+ event.preventDefault();
+ $(".orgDirection").text('目标地址组织不能为空')
+ return false;
+ }else if($(".columnContent").find('input[type="radio"]:checked').length <= 0){
+ event.preventDefault();
+ $(".orgDirection").text('目标地址栏目不能为空')
+ return false;
+ }else{
+ return true;
+ }
+ }