资源库代码封装
This commit is contained in:
parent
79d162ecca
commit
b3fea3e229
|
@ -684,21 +684,23 @@ class UsersController < ApplicationController
|
|||
render_403
|
||||
return
|
||||
end
|
||||
user_course_ids = User.current.courses.map { |c| c.id}
|
||||
user_project_ids = User.current.projects.map {|p| p.id}
|
||||
# user_org_ids = User.current.organizations.map {|o| o.id}
|
||||
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','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}
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) ").order("created_on desc")
|
||||
elsif params[:type] == "3" #项目资源
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc")
|
||||
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
|
||||
elsif params[:type] == "2" # 课程资源
|
||||
@attachments = get_course_resources(params[:id], user_course_ids)
|
||||
elsif params[:type] == "3" # 项目资源
|
||||
@attachments = get_project_resources(params[:id], user_project_ids)
|
||||
elsif params[:type] == "4" #附件
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")
|
||||
@attachments = get_attch_resources params[:id]
|
||||
elsif params[:type] == "5" #用户资源
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Principal'").order("created_on desc")
|
||||
elsif params[:type] == "6" #公共资源
|
||||
Attachment.where("(is_public =1 and is_publish = 1 and container_id is not null)" + "or (author_id = #{params[:id]} and is_publish = 0)").order("created_on desc")
|
||||
@attachments = get_principal_resources params[:id]
|
||||
elsif params[:type] == "6" # 公共资源
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = get_public_resources(user_course_ids, user_project_ids)
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 7
|
||||
|
@ -1407,50 +1409,27 @@ class UsersController < ApplicationController
|
|||
|
||||
# 上传用户资源
|
||||
def user_resource_create
|
||||
user_course_ids = User.current.courses.map { |c| c.id}
|
||||
user_project_ids = User.current.projects.map {|p| p.id}
|
||||
# user_org_ids = User.current.organizations.map {|o| o.id}
|
||||
@user = User.find(params[:id])
|
||||
#@user.save_attachments(params[:attachments],User.current)
|
||||
# Container_type为Principal
|
||||
Attachment.attach_filesex(@user, params[:attachments], params[:attachment_type])
|
||||
if(params[:type].blank?|| params[:type] == "1") #全部
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
||||
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','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" #课程资源
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
user_course_ids = User.current.courses.map { |c| c.id}
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) ").order("created_on desc")
|
||||
else
|
||||
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+
|
||||
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
||||
end
|
||||
elsif params[:type] == "3" #项目资源
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc")
|
||||
else
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' ").order("created_on desc")
|
||||
end
|
||||
if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
|
||||
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
|
||||
elsif params[:type] == "2" # 课程资源
|
||||
@attachments = get_course_resources(params[:id], user_course_ids)
|
||||
elsif params[:type] == "3" # 项目资源
|
||||
@attachments = get_project_resources(params[:id], user_project_ids)
|
||||
elsif params[:type] == "4" #附件
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")
|
||||
else
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")
|
||||
end
|
||||
elsif params[:type] == "5" #附件
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type ='Principal'").order("created_on desc")
|
||||
else
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type ='Principal'").order("created_on desc")
|
||||
end
|
||||
@attachments = get_attch_resources params[:id]
|
||||
elsif params[:type] == "5" #用户资源
|
||||
@attachments = get_principal_resources params[:id]
|
||||
elsif params[:type] == "6" # 公共资源
|
||||
@attachments = Attachment.where("(is_public =1 and is_publish = 1 and container_id is not null)" + "or (author_id = #{params[:id]} and is_publish = 0)").order("created_on desc")
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = get_public_resources(user_course_ids, user_project_ids)
|
||||
end
|
||||
@type = params[:type] || 1
|
||||
@limit = 25
|
||||
|
@ -1474,45 +1453,23 @@ class UsersController < ApplicationController
|
|||
Attachment.where("author_id = #{User.current.id}").delete(id)
|
||||
end
|
||||
end
|
||||
|
||||
user_course_ids = User.current.courses.map { |c| c.id}
|
||||
user_project_ids = User.current.projects.map {|p| p.id}
|
||||
# user_org_ids = User.current.organizations.map {|o| o.id}
|
||||
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','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','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" #课程资源
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
user_course_ids = User.current.courses.map { |c| c.id}
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) ").order("created_on desc")
|
||||
else
|
||||
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+
|
||||
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
||||
end
|
||||
elsif params[:type] == "3" #项目资源
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc")
|
||||
else
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' ").order("created_on desc")
|
||||
end
|
||||
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
|
||||
elsif params[:type] == "2" # 课程资源
|
||||
@attachments = get_course_resources(params[:id], user_course_ids)
|
||||
elsif params[:type] == "3" # 项目资源
|
||||
@attachments = get_project_resources(params[:id], user_project_ids)
|
||||
elsif params[:type] == "4" #附件
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")
|
||||
else
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")
|
||||
end
|
||||
@attachments = get_attch_resources params[:id]
|
||||
elsif params[:type] == "5" #用户资源
|
||||
if User.current.id.to_i == params[:id].to_i
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type ='Principal'").order("created_on desc")
|
||||
else
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type ='Principal'").order("created_on desc")
|
||||
end
|
||||
@attachments = get_principal_resources params[:id]
|
||||
elsif params[:type] == "6" # 公共资源
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = get_public_resources(user_course_ids, user_project_ids)
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 25
|
||||
|
@ -2175,6 +2132,40 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
# 获取公共资源
|
||||
def get_public_resources user_course_ids, user_project_ids
|
||||
attachments = Attachment.where("(is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
|
||||
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)" ).order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取我的资源
|
||||
def get_my_resources author_id, user_course_ids, user_project_ids
|
||||
attachments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
|
||||
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)" ).order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取我的课程资源
|
||||
def get_course_resources author_id, user_course_ids
|
||||
attchments = Attachment.where("(author_id = #{author_id} and container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取我的项目资源
|
||||
def get_project_resources author_id, user_project_ids
|
||||
attchments = Attachment.where("author_id = #{author_id} and container_type = 'Project'").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取我上传的附件
|
||||
def get_attch_resources author_id
|
||||
attchments = Attachment.where("author_id = #{author_id} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
|
||||
end
|
||||
|
||||
# 获取我的用户类型资源
|
||||
def get_principal_resources author_id
|
||||
attchments = Attachment.where("author_id = #{author_id} and container_type = 'Principal'").order("created_on desc")
|
||||
end
|
||||
|
||||
# 资源库 分为全部 课程资源 项目资源 附件
|
||||
def user_resource
|
||||
# 别人的资源库是没有权限去看的
|
||||
|
@ -2184,23 +2175,21 @@ class UsersController < ApplicationController
|
|||
end
|
||||
user_course_ids = User.current.courses.map { |c| c.id}
|
||||
user_project_ids = User.current.projects.map {|p| p.id}
|
||||
# user_org_ids = User.current.projects.map {|p| p.id}
|
||||
# user_org_ids = User.current.organizations.map {|o| o.id}
|
||||
if(params[:type].blank? || params[:type] == "1") # 我的资源
|
||||
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and is_publish = 1 and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)" +
|
||||
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1)" ).order("created_on desc")
|
||||
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
|
||||
elsif params[:type] == "2" # 课程资源
|
||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
|
||||
@attachments = get_course_resources(params[:id], user_course_ids)
|
||||
elsif params[:type] == "3" # 项目资源
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc")
|
||||
@attachments = get_project_resources(params[:id], user_project_ids)
|
||||
elsif params[:type] == "4" #附件
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
|
||||
@attachments = get_attch_resources params[:id]
|
||||
elsif params[:type] == "5" #用户资源
|
||||
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Principal'").order("created_on desc")
|
||||
@attachments = get_principal_resources params[:id]
|
||||
elsif params[:type] == "6" # 公共资源
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = Attachment.where(" ").order("created_on desc")
|
||||
@attachments = get_public_resources(user_course_ids, user_project_ids)
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 25
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<div id="users_setting">
|
||||
<div class="resourcesUploadBox mt10"><a href="javascript:void(0);" onclick="show_upload();" class="uploadBoxIcon">上传资源</a></div>
|
||||
<div id="search_div">
|
||||
<%= render :partial => 'resource_search_form',:locals => {:user => @user, :type => @type} %>
|
||||
</div>
|
||||
<div style="float: left; margin-top: 7px; font-size: 14px; margin-left: 15px;"><span style="align:center ;font-size: 14px;color: gray;">为您找到<span id="res_all_count"><%= @atta_count %></span>个资源</span></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<ul class="resource-list-tab mt10">
|
||||
<li class="resource-list-checkbox fl"> </li>
|
||||
<li class="resource-list-name fl">资源名称</li>
|
||||
<li class="resource-list-time fr">上传时间</li>
|
||||
<li class="resource-list-uploader fr">上传者</li>
|
||||
<li class="resource-list-type fr">类别</li>
|
||||
<li class="resource-list-size fr">大小</li>
|
||||
<li class="resource-list-from fr">资源来源</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<form id="resources_list_form">
|
||||
<div id="resources_list">
|
||||
<%= render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="resource-list-option fl">
|
||||
<div class="resource-check-all">
|
||||
<input id="checkboxAll" type="checkbox" value="" onclick="all_select();" class="resourcesCheckbox" />
|
||||
</div>
|
||||
<a href="javascript:void(0);" class="replyGrey1 mr15" onclick="all_select();">全选</a>
|
||||
<a href="javascript:void(0);" class="replyGrey" onclick="batch_delete();">删除</a>
|
||||
<div class="resourcesSelectSend">
|
||||
<div class="fl">选择 <span class="c_red" id="res_count">0</span> 个资源</div>
|
||||
<div class="resourcesSelectSendButton" onclick="batch_send();">
|
||||
<a href="javascript:void(0);" class="sendButtonBlue db" data-remote="true" >发送</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<ul class="wlist" id="pages" style="margin-top: 5px;">
|
||||
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<!--<div id="upload_box" style="display: none">-->
|
||||
<!--<%#= render :partial => 'upload_resource' ,:locals => {:user=>@user}%>-->
|
||||
<!--</div>-->
|
||||
<ul class="resource-list">
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" id="contextMenu">
|
||||
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)preview();" onfocus="this.blur()">预览</a></li>
|
||||
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)rename();" onfocus="this.blur()">重命名</a></li>
|
||||
<!-- data-remote="true" 这个属性会让ajax请求状态标志就在当前按钮的上方显示,就不会滚动浏览器,因而弹出框也会在当前窗口中央展示-->
|
||||
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)show_send_();" data-remote="true" onfocus="this.blur()" >发送</a></li>
|
||||
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)delete_file();" onfocus="this.blur()">删除</a></li>
|
||||
</ul>
|
||||
</ul>
|
|
@ -11,12 +11,12 @@
|
|||
function remote_get_resources(user_id,type){
|
||||
|
||||
}
|
||||
$(document).ready(function(){
|
||||
$(".resource-switch").click(function(){
|
||||
$(".resource-switch").children().removeClass("resource-tab-active");
|
||||
$(this).children().addClass("resource-tab-active");
|
||||
});
|
||||
});
|
||||
// $(document).ready(function(){
|
||||
// $(".resource-switch").click(function(){
|
||||
// $(".resource-switch").children().removeClass("resource-tab-active");
|
||||
// $(this).children().addClass("resource-tab-active");
|
||||
// });
|
||||
// });
|
||||
function remote_search(){
|
||||
$("#resource_search_form").submit();
|
||||
}
|
||||
|
@ -31,6 +31,14 @@
|
|||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||
}
|
||||
|
||||
function show_public_resource(){
|
||||
$("#resource_remote").html('<%= escape_javascript( render :partial => 'user_resource_info' ,:locals => { :tpye => 6}) %>');
|
||||
}
|
||||
|
||||
function show_public_resource(){
|
||||
$("#resource_remote").html('<%= escape_javascript( render :partial => 'user_resource_info' ,:locals => { :tpye => 1}) %>');
|
||||
}
|
||||
|
||||
function closeModal()
|
||||
{
|
||||
hideModal($(".uploadBoxContainer"));
|
||||
|
@ -62,98 +70,44 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<div class="homepageContentContainer" >
|
||||
<div class="homepageContent">
|
||||
<div class="resource-wrapper">
|
||||
<ul class="resource-banner">
|
||||
<li class="fl resource-switch"><a href="javascript:void(0);" class="resource-tab resource-tab-active">公共资源</a></li>
|
||||
<li class="fl resource-switch"><%=link_to "我的资源", {:controller => 'users', :action => 'user_resource', :id => User.current.id, :type => 1, :remote => true}, :class => "resource-tab" %></li>
|
||||
<li class="fl w770 border-bottom h34"> </li>
|
||||
<li class="fr resource-banner-li border-bottom h34">
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="resourcesType">
|
||||
<li>
|
||||
<%= link_to '全部' ,user_resource_user_path(:id => @user.id, :type => 1), :remote => true, :method => 'get', :class => 'resourcesTypeAll resourcesGrey' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to '课程资源' ,user_resource_user_path(:id => @user.id, :type => 2), :remote => true, :method => 'get', :class=> 'homepagePostTypeAssignment postTypeGrey' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to '项目资源' ,user_resource_user_path(:id => @user.id, :type => 3), :remote => true, :method => 'get', :class => 'homepagePostTypeQuiz postTypeGrey' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to '用户资源' ,user_resource_user_path(:id=>@user.id,:type=>5),:remote=>true,:method => 'get', :class=>'resourcesTypeUser resourcesGrey' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to '附件' ,user_resource_user_path(:id=>@user.id,:type=>4),:remote=>true,:method => 'get',:class=>'resourcesTypeAtt resourcesGrey' %>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="resource-wrapper">
|
||||
<ul class="resource-banner">
|
||||
<li class="fl resource-switch"><a href="<%= user_resource_user_path %>;" class="resource-tab resource-tab-active">公共资源</a></li>
|
||||
<li class="fl resource-switch"><a href="javascript:void(0);" onclick="show_my_resource();" class="resource-tab ">我的资源</a></li>
|
||||
<li class="fl w770 border-bottom h34"> </li>
|
||||
<li class="fr resource-banner-li border-bottom h34">
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="resourcesType">
|
||||
<li>
|
||||
<%= link_to '全部' ,user_resource_user_path(:id => @user.id, :type => 1), :remote => true, :method => 'get', :class => 'resourcesTypeAll resourcesGrey' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to '课程资源' ,user_resource_user_path(:id => @user.id, :type => 2), :remote => true, :method => 'get', :class=> 'homepagePostTypeAssignment postTypeGrey' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to '项目资源' ,user_resource_user_path(:id => @user.id, :type => 3), :remote => true, :method => 'get', :class => 'homepagePostTypeQuiz postTypeGrey' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to '用户资源' ,user_resource_user_path(:id=>@user.id,:type=>5),:remote=>true,:method => 'get', :class=>'resourcesTypeUser resourcesGrey' %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to '附件' ,user_resource_user_path(:id=>@user.id,:type=>4),:remote=>true,:method => 'get',:class=>'resourcesTypeAtt resourcesGrey' %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div id="users_setting">
|
||||
<div class="resourcesUploadBox mt10"><a href="javascript:void(0);" onclick="show_upload();" class="uploadBoxIcon">上传资源</a></div>
|
||||
<div id="search_div">
|
||||
<%= render :partial => 'resource_search_form',:locals => {:user => @user, :type => @type} %>
|
||||
</div>
|
||||
<div style="float: left; margin-top: 7px; font-size: 14px; margin-left: 15px;"><span style="align:center ;font-size: 14px;color: gray;">为您找到<span id="res_all_count"><%= @atta_count %></span>个资源</span></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<ul class="resource-list-tab mt10">
|
||||
<li class="resource-list-checkbox fl"> </li>
|
||||
<li class="resource-list-name fl">资源名称</li>
|
||||
<li class="resource-list-time fr">上传时间</li>
|
||||
<li class="resource-list-uploader fr">上传者</li>
|
||||
<li class="resource-list-type fr">类别</li>
|
||||
<li class="resource-list-size fr">大小</li>
|
||||
<li class="resource-list-from fr">资源来源</li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<form id="resources_list_form">
|
||||
<div id="resources_list">
|
||||
<%= render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="resource-list-option fl">
|
||||
<div class="resource-check-all">
|
||||
<input id="checkboxAll" type="checkbox" value="" onclick="all_select();" class="resourcesCheckbox" />
|
||||
</div>
|
||||
<a href="javascript:void(0);" class="replyGrey1 mr15" onclick="all_select();">全选</a>
|
||||
<a href="javascript:void(0);" class="replyGrey" onclick="batch_delete();">删除</a>
|
||||
<div class="resourcesSelectSend">
|
||||
<div class="fl">选择 <span class="c_red" id="res_count">0</span> 个资源</div>
|
||||
<div class="resourcesSelectSendButton" onclick="batch_send();">
|
||||
<a href="javascript:void(0);" class="sendButtonBlue db" data-remote="true" >发送</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<ul class="wlist" id="pages" style="margin-top: 5px;">
|
||||
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<div id ="resource_remote">
|
||||
<%= render :partial => 'user_resource_info' %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<!--<div id="upload_box" style="display: none">-->
|
||||
<!--<%#= render :partial => 'upload_resource' ,:locals => {:user=>@user}%>-->
|
||||
<!--</div>-->
|
||||
<ul class="resource-list">
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" id="contextMenu">
|
||||
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)preview();" onfocus="this.blur()">预览</a></li>
|
||||
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)rename();" onfocus="this.blur()">重命名</a></li>
|
||||
<!-- data-remote="true" 这个属性会让ajax请求状态标志就在当前按钮的上方显示,就不会滚动浏览器,因而弹出框也会在当前窗口中央展示-->
|
||||
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)show_send_();" data-remote="true" onfocus="this.blur()" >发送</a></li>
|
||||
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)delete_file();" onfocus="this.blur()">删除</a></li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
|
||||
<script>
|
||||
var pageX = 0;
|
||||
var pageY = 0;
|
||||
|
|
Loading…
Reference in New Issue