|
|
@ -121,7 +121,7 @@ class UsersController < ApplicationController
|
|
|
|
messages = MessageAll.where("user_id =?", @user).order("created_at desc")
|
|
|
|
messages = MessageAll.where("user_id =?", @user).order("created_at desc")
|
|
|
|
messages.each do |message_all|
|
|
|
|
messages.each do |message_all|
|
|
|
|
# 在点击或者刷新消息列表后未读的消息存放在数组
|
|
|
|
# 在点击或者刷新消息列表后未读的消息存放在数组
|
|
|
|
if message_all.message_type != "SystemMessage" && message_all.message.viewed == 0
|
|
|
|
if message_all.message_type != "SystemMessage"&& !message_all.message.nil? && message_all.message.viewed == 0
|
|
|
|
@message_alls << message_all.message
|
|
|
|
@message_alls << message_all.message
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -522,6 +522,7 @@ class UsersController < ApplicationController
|
|
|
|
@atta_count = @attachments.count
|
|
|
|
@atta_count = @attachments.count
|
|
|
|
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
|
|
|
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
|
|
|
@offset ||= @atta_pages.offset
|
|
|
|
@offset ||= @atta_pages.offset
|
|
|
|
|
|
|
|
@seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids]
|
|
|
|
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
|
|
|
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
|
|
|
@attachments = paginateHelper @attachments,7
|
|
|
|
@attachments = paginateHelper @attachments,7
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
@ -555,6 +556,7 @@ class UsersController < ApplicationController
|
|
|
|
@atta_count = @attachments.count
|
|
|
|
@atta_count = @attachments.count
|
|
|
|
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
|
|
|
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
|
|
|
@offset ||= @atta_pages.offset
|
|
|
|
@offset ||= @atta_pages.offset
|
|
|
|
|
|
|
|
@seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids]
|
|
|
|
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
|
|
|
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
|
|
|
@attachments = paginateHelper @attachments,7
|
|
|
|
@attachments = paginateHelper @attachments,7
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
@ -586,6 +588,7 @@ class UsersController < ApplicationController
|
|
|
|
@atta_count = @attachments.count
|
|
|
|
@atta_count = @attachments.count
|
|
|
|
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
|
|
|
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
|
|
|
|
@offset ||= @atta_pages.offset
|
|
|
|
@offset ||= @atta_pages.offset
|
|
|
|
|
|
|
|
@seleted_resources = session[:seleted_resource_ids].nil? ? [] : session[:seleted_resource_ids]
|
|
|
|
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
|
|
|
#@curse_attachments_all = @all_attachments[@offset, @limit]
|
|
|
|
@attachments = paginateHelper @attachments,7
|
|
|
|
@attachments = paginateHelper @attachments,7
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
@ -596,8 +599,8 @@ class UsersController < ApplicationController
|
|
|
|
#将资源批量引入
|
|
|
|
#将资源批量引入
|
|
|
|
def import_resources_to_homework
|
|
|
|
def import_resources_to_homework
|
|
|
|
@attachments = []
|
|
|
|
@attachments = []
|
|
|
|
unless params[:checkbox1].nil? || params[:checkbox1].blank?
|
|
|
|
unless session[:seleted_resource_ids].nil? || session[:seleted_resource_ids].blank?
|
|
|
|
params[:checkbox1].each do |id|
|
|
|
|
session[:seleted_resource_ids].each do |id|
|
|
|
|
atta = Attachment.find(id)
|
|
|
|
atta = Attachment.find(id)
|
|
|
|
att_copy = atta.copy
|
|
|
|
att_copy = atta.copy
|
|
|
|
att_copy.container_id = nil
|
|
|
|
att_copy.container_id = nil
|
|
|
@ -608,11 +611,23 @@ class UsersController < ApplicationController
|
|
|
|
@attachments << att_copy
|
|
|
|
@attachments << att_copy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
session[:seleted_resource_ids] = [] #保存后清空
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
|
format.js
|
|
|
|
format.js
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ajax 用session保存选择的资源id
|
|
|
|
|
|
|
|
def store_selected_resource
|
|
|
|
|
|
|
|
session[:seleted_resource_ids] = [] if session[:seleted_resource_ids].nil?
|
|
|
|
|
|
|
|
if params[:save] == 'y'
|
|
|
|
|
|
|
|
session[:seleted_resource_ids] << params[:res_id]
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
session[:seleted_resource_ids].delete( params[:res_id])
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
render :nothing => true
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
include CoursesHelper
|
|
|
|
include CoursesHelper
|
|
|
|
def user_courses
|
|
|
|
def user_courses
|
|
|
|